Store cluster ID and send a notification over the control interface. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@xxxxxxxxx> --- src/common/nan_de.c | 13 +++++++++++++ src/common/nan_de.h | 1 + src/common/wpa_ctrl.h | 3 ++- wpa_supplicant/nan_supplicant.c | 9 +++++---- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/common/nan_de.c b/src/common/nan_de.c index 4a918661f6..c45725a392 100644 --- a/src/common/nan_de.c +++ b/src/common/nan_de.c @@ -68,6 +68,8 @@ struct nan_de_service { struct nan_de { u8 nmi[ETH_ALEN]; + u8 cluster_id[ETH_ALEN]; + bool cluster_id_set; bool offload; bool ap; unsigned int max_listen; @@ -1566,3 +1568,14 @@ int nan_de_transmit(struct nan_de *de, int handle, return 0; } + + +void nan_de_set_cluster_id(struct nan_de *de, const u8 *cluster_id) +{ + if (cluster_id) { + os_memcpy(de->cluster_id, cluster_id, ETH_ALEN); + de->cluster_id_set = true; + } else { + de->cluster_id_set = false; + } +} diff --git a/src/common/nan_de.h b/src/common/nan_de.h index 4e2e45b0f1..8c81deb326 100644 --- a/src/common/nan_de.h +++ b/src/common/nan_de.h @@ -158,5 +158,6 @@ void nan_de_cancel_subscribe(struct nan_de *de, int subscribe_id); int nan_de_transmit(struct nan_de *de, int handle, const struct wpabuf *ssi, const struct wpabuf *elems, const u8 *peer_addr, u8 req_instance_id); +void nan_de_set_cluster_id(struct nan_de *de, const u8 *cluster_id); #endif /* NAN_DE_H */ diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h index ae5711aa6b..2b24c20736 100644 --- a/src/common/wpa_ctrl.h +++ b/src/common/wpa_ctrl.h @@ -240,12 +240,13 @@ extern "C" { #define DPP_EVENT_PB_RESULT "DPP-PB-RESULT " #define DPP_EVENT_RELAY_NEEDS_CONTROLLER "DPP-RELAY-NEEDS-CONTROLLER " -/* Wi-Fi Aware (NAN USD) events */ +/* Wi-Fi Aware (NAN) events */ #define NAN_DISCOVERY_RESULT "NAN-DISCOVERY-RESULT " #define NAN_REPLIED "NAN-REPLIED " #define NAN_PUBLISH_TERMINATED "NAN-PUBLISH-TERMINATED " #define NAN_SUBSCRIBE_TERMINATED "NAN-SUBSCRIBE-TERMINATED " #define NAN_RECEIVE "NAN-RECEIVE " +#define NAN_CLUSTER_JOIN "NAN-CLUSTER-JOIN " /* MESH events */ #define MESH_GROUP_STARTED "MESH-GROUP-STARTED " diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c index d29deaa99f..a3b9bf6c20 100644 --- a/wpa_supplicant/nan_supplicant.c +++ b/wpa_supplicant/nan_supplicant.c @@ -105,7 +105,7 @@ int wpas_nan_stop(struct wpa_supplicant *wpa_s) return -1; nan_stop(wpa_s->nan); - + nan_de_set_cluster_id(wpa_s->nan_de, NULL); return 0; } @@ -126,9 +126,10 @@ void wpas_nan_cluster_join(struct wpa_supplicant *wpa_s, if (!wpas_nan_ready(wpa_s)) return; - /* TODO: handle cluster merge */ - wpa_printf(MSG_DEBUG, "NAN: Joined cluster " MACSTR " (new: %d)", - MAC2STR(cluster_id), new_cluster); + wpa_msg_global(wpa_s, MSG_INFO, NAN_CLUSTER_JOIN "cluster_id=" MACSTR + " new=%d", MAC2STR(cluster_id), new_cluster); + + nan_de_set_cluster_id(wpa_s->nan_de, cluster_id); } void wpas_nan_next_dw(struct wpa_supplicant *wpa_s, u32 freq) -- 2.49.0 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap