[RFC 03/13] NAN: Support publishing NPBA in SDF frames
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Tue Dec 23 03:57:15 PST 2025
Support configuring and publishing of Pairing Bootstrapping Methods
attribute (NPBA) in SDF frames.
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
src/common/nan_de.c | 33 +++++++++++++++++++++++++++++++++
src/common/nan_de.h | 12 ++++++++++++
wpa_supplicant/ctrl_iface.c | 10 ++++++++++
3 files changed, 55 insertions(+)
diff --git a/src/common/nan_de.c b/src/common/nan_de.c
index 8ffcf1ef9b..9d24d87091 100644
--- a/src/common/nan_de.c
+++ b/src/common/nan_de.c
@@ -78,6 +78,10 @@ struct nan_de_service {
u8 srf_bf_idx;
struct wpabuf *srf;
bool close_proximity;
+
+ /* Bootstrapping methods */
+ u16 pbm;
+
};
#define NAN_DE_RSSI_CLOSE_PROXIMITY (-70) /* dBm */
@@ -253,6 +257,25 @@ static int nan_de_tx(struct nan_de *de, unsigned int freq,
}
+static void nan_buf_add_npba(struct nan_de *de, struct nan_de_service *srv,
+ struct wpabuf *buf)
+{
+ u8 type_and_status = NAN_PBA_TYPE_ADVERTISE |
+ (NAN_PBA_STATUS_ACCEPTED << NAN_PBA_STATUS_POS);
+
+ wpa_printf(MSG_DEBUG, "NAN: Add NPBA");
+
+ wpabuf_put_u8(buf, NAN_ATTR_BPBA);
+ wpabuf_put_le16(buf, 5);
+
+ /* Dialog token is 0 for advertise */
+ wpabuf_put_u8(buf, 0);
+ wpabuf_put_u8(buf, type_and_status);
+ wpabuf_put_u8(buf, NAN_REASON_RESERVED);
+ wpabuf_put_le16(buf, srv->pbm);
+}
+
+
static void nan_de_tx_sdf(struct nan_de *de, struct nan_de_service *srv,
unsigned int wait_time,
enum nan_service_control_type type,
@@ -293,6 +316,10 @@ static void nan_de_tx_sdf(struct nan_de *de, struct nan_de_service *srv,
if (srv->elems)
len += NAN_ATTR_HDR_LEN + 1 + wpabuf_len(srv->elems);
+ /* NPBA attribute (dialog token, type and status, reason, pbm */
+ if (srv->pbm && type != NAN_SRV_CTRL_FOLLOW_UP)
+ len += NAN_ATTR_HDR_LEN + 1 + 1 + 1 + 2;
+
/* Reserve some additional space for extra attributes */
if (de->cb.add_extra_attrs)
len += 256;
@@ -361,6 +388,9 @@ static void nan_de_tx_sdf(struct nan_de *de, struct nan_de_service *srv,
wpabuf_put_buf(buf, srv->elems);
}
+ if (srv->pbm && type != NAN_SRV_CTRL_FOLLOW_UP)
+ nan_buf_add_npba(de, srv, buf);
+
if (de->cb.add_extra_attrs)
de->cb.add_extra_attrs(de->cb.ctx, buf);
@@ -1669,6 +1699,8 @@ int nan_de_publish(struct nan_de *de, const char *service_name,
srv->is_p2p = p2p;
srv->is_pr = params->proximity_ranging && params->solicited;
srv->close_proximity = params->close_proximity;
+ srv->pbm = params->pbm;
+
nan_de_add_srv(de, srv);
nan_de_run_timer(de);
return publish_id;
@@ -1933,6 +1965,7 @@ int nan_de_subscribe(struct nan_de *de, const char *service_name,
srv->is_pr = params->proximity_ranging && params->active;
srv->sync = params->sync;
srv->close_proximity = params->close_proximity;
+ srv->pbm = params->pbm;
nan_de_add_srv(de, srv);
nan_de_run_timer(de);
diff --git a/src/common/nan_de.h b/src/common/nan_de.h
index f21fe8c506..dd6ff73549 100644
--- a/src/common/nan_de.h
+++ b/src/common/nan_de.h
@@ -132,6 +132,12 @@ struct nan_publish_params {
/* RSSI range limit */
bool close_proximity;
+
+ /*
+ * Pairing Bootstrapping Methods as defined in Table 128 in Wi-Fi
+ * Aware specification v4.0
+ */
+ u16 pbm;
};
/* Returns -1 on failure or >0 publish_id */
@@ -193,6 +199,12 @@ struct nan_subscribe_params {
/* RSSI range limit */
bool close_proximity;
+
+ /*
+ * Pairing Bootstrapping Methods as defined in Table 128 in Wi-Fi
+ * Aware specification v4.0
+ */
+ u16 pbm;
};
/* Returns -1 on failure or >0 subscribe_id */
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 59ec1d772e..7648602b6b 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -12834,6 +12834,11 @@ static int wpas_ctrl_nan_publish(struct wpa_supplicant *wpa_s, char *cmd,
continue;
}
+ if (os_strncmp(token, "pbm=", 4) == 0) {
+ params.pbm = strtol(token + 4, NULL, 0);
+ continue;
+ }
+
wpa_printf(MSG_INFO, "CTRL: Invalid NAN_PUBLISH parameter: %s",
token);
goto fail;
@@ -13061,6 +13066,11 @@ static int wpas_ctrl_nan_subscribe(struct wpa_supplicant *wpa_s, char *cmd,
continue;
}
+ if (os_strncmp(token, "pbm=", 4) == 0) {
+ params.pbm = strtol(token + 4, NULL, 0);
+ continue;
+ }
+
wpa_printf(MSG_INFO,
"CTRL: Invalid NAN_SUBSCRIBE parameter: %s",
token);
--
2.49.0
More information about the Hostap
mailing list