]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Register to receive mesh frames
authorBob Copeland <me@bobcopeland.com>
Mon, 1 Sep 2014 04:23:23 +0000 (00:23 -0400)
committerJouni Malinen <j@w1.fi>
Sat, 25 Oct 2014 10:47:12 +0000 (13:47 +0300)
Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: Jason Mobarak <x@jason.mobarak.name>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
src/drivers/driver_nl80211.c

index 9a7260960c86b108b73934b86e66bcf7024123a3..1f8b33f8b54a94a0a2ef5dc15d9f1969ecd5f4f4 100644 (file)
@@ -604,6 +604,12 @@ static struct i802_bss * get_bss_ifindex(struct wpa_driver_nl80211_data *drv,
 }
 
 
+static int is_mesh_interface(enum nl80211_iftype nlmode)
+{
+       return nlmode == NL80211_IFTYPE_MESH_POINT;
+}
+
+
 static void nl80211_mark_disconnected(struct wpa_driver_nl80211_data *drv)
 {
        if (drv->associated)
@@ -4769,6 +4775,40 @@ static int nl80211_mgmt_subscribe_non_ap(struct i802_bss *bss)
 }
 
 
+static int nl80211_mgmt_subscribe_mesh(struct i802_bss *bss)
+{
+       int ret = 0;
+
+       if (nl80211_alloc_mgmt_handle(bss))
+               return -1;
+
+       wpa_printf(MSG_DEBUG,
+                  "nl80211: Subscribe to mgmt frames with mesh handle %p",
+                  bss->nl_mgmt);
+
+       /* Auth frames for mesh SAE */
+       if (nl80211_register_frame(bss, bss->nl_mgmt,
+                                  (WLAN_FC_TYPE_MGMT << 2) |
+                                  (WLAN_FC_STYPE_AUTH << 4),
+                                  NULL, 0) < 0)
+               ret = -1;
+
+       /* Mesh peering open */
+       if (nl80211_register_action_frame(bss, (u8 *) "\x0f\x01", 2) < 0)
+               ret = -1;
+       /* Mesh peering confirm */
+       if (nl80211_register_action_frame(bss, (u8 *) "\x0f\x02", 2) < 0)
+               ret = -1;
+       /* Mesh peering close */
+       if (nl80211_register_action_frame(bss, (u8 *) "\x0f\x03", 2) < 0)
+               ret = -1;
+
+       nl80211_mgmt_handle_register_eloop(bss);
+
+       return ret;
+}
+
+
 static int nl80211_register_spurious_class3(struct i802_bss *bss)
 {
        struct wpa_driver_nl80211_data *drv = bss->drv;
@@ -9509,7 +9549,12 @@ done:
                nl80211_mgmt_unsubscribe(bss, "mode change");
        }
 
+       if (is_mesh_interface(nlmode) &&
+           nl80211_mgmt_subscribe_mesh(bss))
+               return -1;
+
        if (!bss->in_deinit && !is_ap_interface(nlmode) &&
+           !is_mesh_interface(nlmode) &&
            nl80211_mgmt_subscribe_non_ap(bss) < 0)
                wpa_printf(MSG_DEBUG, "nl80211: Failed to register Action "
                           "frame processing - ignore for now");