From: Thomas Pedersen <tho...@noack.us>

Handle EVENT_MGMT and EVENT_NEW_PEER_CANDIDATE for mesh interfaces.

Signed-off-by: Javier Lopez <jlo...@gmail.com>
Signed-hostap: Thomas Pedersen <tho...@noack.us>
---
 wpa_supplicant/events.c | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 4e84f6e..663ffd5 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -42,6 +42,8 @@
 #include "scan.h"
 #include "offchannel.h"
 #include "interworking.h"
+#include "mesh.h"
+#include "mesh_mpm.h"
 
 
 #ifndef CONFIG_NO_SCAN_PROCESSING
@@ -1128,7 +1130,11 @@ wpa_supplicant_pick_new_network(struct wpa_supplicant 
*wpa_s)
                        if (wpas_network_disabled(wpa_s, ssid))
                                continue;
                        if (ssid->mode == IEEE80211_MODE_IBSS ||
-                           ssid->mode == IEEE80211_MODE_AP)
+                           ssid->mode == IEEE80211_MODE_AP ||
+#ifdef CONFIG_MESH
+                           ssid->mode == IEEE80211_MODE_MESH ||
+#endif /* CONFIG_MESH */
+                           0)
                                return ssid;
                }
        }
@@ -1408,6 +1414,13 @@ static int wpas_select_network_from_last_scan(struct 
wpa_supplicant *wpa_s,
                 */
                return 1;
        } else {
+#ifdef CONFIG_MESH
+               if (wpa_s->ifmsh) {
+                       wpa_msg(wpa_s, MSG_INFO, "Avoiding join because "
+                               "we already joined a mesh group.");
+                       return 0;
+               }
+#endif /* CONFIG_MESH */
                wpa_dbg(wpa_s, MSG_DEBUG, "No suitable network found");
                ssid = wpa_supplicant_pick_new_network(wpa_s);
                if (ssid) {
@@ -2865,6 +2878,10 @@ static void wpas_event_rx_mgmt_action(struct 
wpa_supplicant *wpa_s,
 
        wpas_p2p_rx_action(wpa_s, mgmt->da, mgmt->sa, mgmt->bssid,
                           category, payload, plen, freq);
+#ifdef CONFIG_MESH
+       if (wpa_s->ifmsh)
+               mesh_mpm_action_rx(wpa_s, mgmt, len);
+#endif /* CONFIG_MESH */
 }
 
 
@@ -3212,7 +3229,9 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type 
event,
                        }
 #endif /* CONFIG_P2P */
 #ifdef CONFIG_IBSS_RSN
-                       if (stype == WLAN_FC_STYPE_AUTH &&
+                       if (wpa_s->current_ssid &&
+                           wpa_s->current_ssid->mode == WPAS_MODE_IBSS &&
+                           stype == WLAN_FC_STYPE_AUTH &&
                            data->rx_mgmt.frame_len >= 30) {
                                wpa_supplicant_event_ibss_auth(wpa_s, data);
                                break;
@@ -3227,6 +3246,12 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type 
event,
                                break;
                        }
 
+#ifdef CONFIG_MESH
+                       if (wpa_s->ifmsh) {
+                               mesh_mpm_mgmt_rx(wpa_s, &data->rx_mgmt);
+                               break;
+                       }
+#endif /* CONFIG_MESH */
                        wpa_dbg(wpa_s, MSG_DEBUG, "AP: ignore received "
                                "management frame in non-AP mode");
                        break;
@@ -3459,6 +3484,13 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type 
event,
                        data->connect_failed_reason.code);
 #endif /* CONFIG_AP */
                break;
+#ifdef CONFIG_MESH
+       case EVENT_NEW_PEER_CANDIDATE:
+               wpa_mesh_notify_peer(wpa_s, data->mesh_peer.peer,
+                                    data->mesh_peer.ies,
+                                    data->mesh_peer.ie_len);
+               break;
+#endif /* CONFIG_MESH */
        default:
                wpa_msg(wpa_s, MSG_INFO, "Unknown event %d", event);
                break;
-- 
2.0.0.rc2

_______________________________________________
Devel mailing list
Devel@lists.open80211s.org
http://lists.open80211s.org/cgi-bin/mailman/listinfo/devel

Reply via email to