From fbca4c893d3de77e012e16956f694dfc15be97c2 Mon Sep 17 00:00:00 2001 From: Jason Abele Date: Mon, 1 Sep 2014 00:23:32 -0400 Subject: [PATCH] mesh: Implement mesh scanning When mesh is configured in, include the wildcard mesh id so that mesh networks are returned. Signed-off-by: Javier Lopez Signed-off-by: Jason Abele --- wpa_supplicant/mesh.c | 13 +++++++++++++ wpa_supplicant/mesh.h | 7 +++++++ wpa_supplicant/scan.c | 3 +++ 3 files changed, 23 insertions(+) diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index efacf7081..0c160d89e 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -257,6 +257,19 @@ void wpa_mesh_notify_peer(struct wpa_supplicant *wpa_s, const u8 *addr, } +void wpa_supplicant_mesh_add_scan_ie(struct wpa_supplicant *wpa_s, + struct wpabuf **extra_ie) +{ + /* EID + 0-length (wildcard) mesh-id */ + size_t ielen = 2; + + if (wpabuf_resize(extra_ie, ielen) == 0) { + wpabuf_put_u8(*extra_ie, WLAN_EID_MESH_ID); + wpabuf_put_u8(*extra_ie, 0); + } +} + + int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) { diff --git a/wpa_supplicant/mesh.h b/wpa_supplicant/mesh.h index 34a0ea2e9..44188a917 100644 --- a/wpa_supplicant/mesh.h +++ b/wpa_supplicant/mesh.h @@ -19,6 +19,8 @@ void wpa_supplicant_mesh_iface_deinit(struct wpa_supplicant *wpa_s, void wpa_mesh_notify_peer(struct wpa_supplicant *wpa_s, const u8 *addr, const u8 *ies, size_t ie_len); +void wpa_supplicant_mesh_add_scan_ie(struct wpa_supplicant *wpa_s, + struct wpabuf **extra_ie); #else /* CONFIG_MESH */ @@ -28,6 +30,11 @@ static inline void wpa_mesh_notify_peer(struct wpa_supplicant *wpa_s, { } +static inline void wpa_supplicant_mesh_add_scan_ie(struct wpa_supplicant *wpa_s, + struct wpabuf **extra_ie) +{ +} + #endif /* CONFIG_MESH */ #endif /* MESH_H */ diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index debceb913..b95182ec4 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -22,6 +22,7 @@ #include "notify.h" #include "bss.h" #include "scan.h" +#include "mesh.h" static void wpa_supplicant_gen_assoc_event(struct wpa_supplicant *wpa_s) @@ -460,6 +461,8 @@ static struct wpabuf * wpa_supplicant_extra_ies(struct wpa_supplicant *wpa_s) } #endif /* CONFIG_P2P */ + wpa_supplicant_mesh_add_scan_ie(wpa_s, &extra_ie); + #endif /* CONFIG_WPS */ #ifdef CONFIG_HS20