[PATCH 46/71] NAN: Fix setting dialog token in NDP setup
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Wed Apr 1 15:01:55 PDT 2026
From: Ilan Peer <ilan.peer at intel.com>
The WiFi Aware specification is not very clear about the setting
of the dialog token in the NDP and NDL attributes of an NDP request
action frame. While the current implementation sets them independently
in the NDP and NDL attributes, this causes interoperability
issues with device implementations that expect that dialog token
to be identical in both attributes.
Modify the implementation such that the same dialog token would be
used in both NDP and NDL attributes.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
src/nan/nan.c | 9 ++++++---
src/nan/nan_i.h | 2 +-
src/nan/nan_ndl.c | 7 +++++--
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/nan/nan.c b/src/nan/nan.c
index 46e38bc295..b44407a662 100644
--- a/src/nan/nan.c
+++ b/src/nan/nan.c
@@ -1684,7 +1684,8 @@ int nan_handle_ndp_setup(struct nan_data *nan, struct nan_ndp_params *params)
if (ret)
return ret;
- ret = nan_ndl_setup(nan, peer, params);
+ ret = nan_ndl_setup(nan, peer, params,
+ peer->ndp_setup.dialog_token);
if (ret) {
nan_ndp_setup_stop(nan, peer);
return ret;
@@ -1712,7 +1713,8 @@ int nan_handle_ndp_setup(struct nan_data *nan, struct nan_ndp_params *params)
}
if (peer->ndp_setup.status != NAN_NDP_STATUS_REJECTED) {
- ret = nan_ndl_setup(nan, peer, params);
+ ret = nan_ndl_setup(nan, peer, params,
+ peer->ndp_setup.dialog_token);
if (!ret) {
ret = nan_configure_peer_schedule(nan, peer,
&peer->ndl->sched);
@@ -1738,7 +1740,8 @@ int nan_handle_ndp_setup(struct nan_data *nan, struct nan_ndp_params *params)
timeout = NAN_NDP_SETUP_TIMEOUT_SHORT;
break;
case NAN_NDP_ACTION_CONF:
- ret = nan_ndl_setup(nan, peer, params);
+ ret = nan_ndl_setup(nan, peer, params,
+ peer->ndp_setup.dialog_token);
if (!ret) {
ret = nan_configure_peer_schedule(nan, peer,
&peer->ndl->sched);
diff --git a/src/nan/nan_i.h b/src/nan/nan_i.h
index 2f3d9eaeff..982764cd99 100644
--- a/src/nan/nan_i.h
+++ b/src/nan/nan_i.h
@@ -547,7 +547,7 @@ int nan_parse_device_attrs(struct nan_data *nan, struct nan_peer *peer,
int nan_ndp_term_req(struct nan_data *nan, struct nan_peer *peer,
struct nan_ndp_id *ndp_id);
int nan_ndl_setup(struct nan_data *nan, struct nan_peer *peer,
- const struct nan_ndp_params *params);
+ const struct nan_ndp_params *params, u8 dialog_token);
void nan_ndl_setup_failure(struct nan_data *nan, struct nan_peer *peer,
enum nan_reason reason, bool reset_state);
void nan_ndl_reset(struct nan_data *nan, struct nan_peer *peer);
diff --git a/src/nan/nan_ndl.c b/src/nan/nan_ndl.c
index ca537e26d5..9404a4a728 100644
--- a/src/nan/nan_ndl.c
+++ b/src/nan/nan_ndl.c
@@ -616,13 +616,16 @@ out:
* @nan: NAN module context from nan_init()
* @peer: The peer for which the NDL is being setup
* @params: NDP setup request parameters
+ * @dialog_token: Dialog token to be used for the NDL setup messages. Should be
+ * used for a new NDL only.
* Returns: 0 on success, negative on failure.
* It is possible that an NDL with the peer already exists in which case it
* would be reused. Otherwise, new NDL establishment will be started.
*/
int nan_ndl_setup(struct nan_data *nan, struct nan_peer *peer,
- const struct nan_ndp_params *params)
+ const struct nan_ndp_params *params,
+ u8 dialog_token)
{
struct nan_ndl *ndl;
enum nan_reason reason;
@@ -704,7 +707,7 @@ int nan_ndl_setup(struct nan_data *nan, struct nan_peer *peer,
ndl->local_qos.max_latency = params->qos.max_latency;
if (ndl->state == NAN_NDL_STATE_NONE) {
- ndl->dialog_token = nan_get_next_dialog_token(nan);
+ ndl->dialog_token = dialog_token;
nan_ndl_set_state(nan, ndl, NAN_NDL_STATE_START);
ndl->status = NAN_NDL_STATUS_CONTINUED;
} else {
--
2.53.0
More information about the Hostap
mailing list