]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
mesh: Report mesh peer AID to kernel
authorMasashi Honma <masashi.honma@gmail.com>
Fri, 1 Jul 2016 01:22:39 +0000 (10:22 +0900)
committerJouni Malinen <j@w1.fi>
Sat, 23 Jul 2016 17:26:26 +0000 (20:26 +0300)
Previously, mesh power management functionality works only with kernel
MPM. Because user space MPM did not report mesh peer AID to kernel,
the kernel could not identify the bit in TIM element. So this patch
reports mesh peer AID to kernel.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
src/ap/sta_info.h
src/drivers/driver.h
src/drivers/driver_nl80211.c
wpa_supplicant/mesh_mpm.c

index 5d4d0c82b41fd9f83587587277551c4becf01b59..cf3fbb12b7b3fc1fa990da6da217620a07b28598 100644 (file)
@@ -80,6 +80,7 @@ struct sta_info {
        enum mesh_plink_state plink_state;
        u16 peer_lid;
        u16 my_lid;
+       u16 peer_aid;
        u16 mpm_close_reason;
        int mpm_retries;
        u8 my_nonce[WPA_NONCE_LEN];
index 671a4b810d28069f22eb700ec6c65a09ead0da3f..d7b6a26490f7b4d18d2290cca0031d7562aa5c7e 100644 (file)
@@ -1425,6 +1425,7 @@ struct hostapd_sta_add_params {
        u32 flags_mask; /* unset bits in flags */
 #ifdef CONFIG_MESH
        enum mesh_plink_state plink_state;
+       u16 peer_aid;
 #endif /* CONFIG_MESH */
        int set; /* Set STA parameters instead of add */
        u8 qosinfo;
index b2b27a705df9856a62ec435cc6d3dadf46e0de89..e08b7a59afa5b5b0e2401f58fd08456407364d48 100644 (file)
@@ -4032,6 +4032,15 @@ static int wpa_driver_nl80211_sta_add(void *priv,
                        if (!(params->flags & WPA_STA_ASSOCIATED))
                                upd.mask |= BIT(NL80211_STA_FLAG_ASSOCIATED);
                }
+#ifdef CONFIG_MESH
+       } else {
+               if (params->plink_state == PLINK_ESTAB && params->peer_aid) {
+                       ret = nla_put_u16(msg, NL80211_ATTR_MESH_PEER_AID,
+                                         params->peer_aid);
+                       if (ret)
+                               goto fail;
+               }
+#endif /* CONFIG_MESH */
        }
 
        wpa_printf(MSG_DEBUG, "  * flags set=0x%x mask=0x%x",
index 45ef4a9ecfa508b4b366cf49a6edfec556bcc163..7ffdefe217415c391de0a1ab6a18de92ee151bb7 100644 (file)
@@ -191,6 +191,7 @@ static void mesh_mpm_init_link(struct wpa_supplicant *wpa_s,
 
        sta->my_lid = llid;
        sta->peer_lid = 0;
+       sta->peer_aid = 0;
 
        /*
         * We do not use wpa_mesh_set_plink_state() here because there is no
@@ -390,6 +391,7 @@ void wpa_mesh_set_plink_state(struct wpa_supplicant *wpa_s,
        os_memset(&params, 0, sizeof(params));
        params.addr = sta->addr;
        params.plink_state = state;
+       params.peer_aid = sta->peer_aid;
        params.set = 1;
 
        ret = wpa_drv_sta_add(wpa_s, &params);
@@ -696,6 +698,7 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s,
        params.addr = addr;
        params.plink_state = sta->plink_state;
        params.aid = sta->aid;
+       params.peer_aid = sta->peer_aid;
        params.listen_interval = 100;
        params.ht_capabilities = sta->ht_capabilities;
        params.vht_capabilities = sta->vht_capabilities;
@@ -1037,7 +1040,7 @@ void mesh_mpm_action_rx(struct wpa_supplicant *wpa_s,
        struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
        struct mesh_conf *mconf = wpa_s->ifmsh->mconf;
        struct sta_info *sta;
-       u16 plid = 0, llid = 0;
+       u16 plid = 0, llid = 0, aid = 0;
        enum plink_event event;
        struct ieee802_11_elems elems;
        struct mesh_peer_mgmt_ie peer_mgmt_ie;
@@ -1075,7 +1078,8 @@ void mesh_mpm_action_rx(struct wpa_supplicant *wpa_s,
                ie_len -= 2;
        }
        if (action_field == PLINK_CONFIRM) {
-               wpa_printf(MSG_DEBUG, "MPM: AID 0x%x", WPA_GET_LE16(ies));
+               aid = WPA_GET_LE16(ies);
+               wpa_printf(MSG_DEBUG, "MPM: AID 0x%x", aid);
                ies += 2;       /* aid */
                ie_len -= 2;
        }
@@ -1210,6 +1214,7 @@ void mesh_mpm_action_rx(struct wpa_supplicant *wpa_s,
                } else {
                        if (!sta->peer_lid)
                                sta->peer_lid = plid;
+                       sta->peer_aid = aid;
                        event = CNF_ACPT;
                }
                break;