nl80211: Add plink_action_field to hostapd_sta_add_params
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 12:54:38 +0000 (15:54 +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/common/defs.h
src/drivers/driver.h
src/drivers/driver_nl80211.c

index d4091e3..bf992e0 100644 (file)
@@ -300,4 +300,14 @@ enum wpa_ctrl_req_type {
 /* Maximum number of EAP methods to store for EAP server user information */
 #define EAP_MAX_METHODS 8
 
+enum mesh_plink_state {
+       PLINK_LISTEN = 1,
+       PLINK_OPEN_SENT,
+       PLINK_OPEN_RCVD,
+       PLINK_CNF_RCVD,
+       PLINK_ESTAB,
+       PLINK_HOLDING,
+       PLINK_BLOCKED,
+};
+
 #endif /* DEFS_H */
index f10414b..d4e0134 100644 (file)
@@ -1145,6 +1145,9 @@ struct hostapd_sta_add_params {
        u8 vht_opmode;
        u32 flags; /* bitmask of WPA_STA_* flags */
        u32 flags_mask; /* unset bits in flags */
+#ifdef CONFIG_MESH
+       enum mesh_plink_state plink_state;
+#endif /* CONFIG_MESH */
        int set; /* Set STA parameters instead of add */
        u8 qosinfo;
        const u8 *ext_capab;
index 606023e..56b30d0 100644 (file)
@@ -7877,6 +7877,33 @@ static u32 sta_flags_nl80211(int flags)
 }
 
 
+#ifdef CONFIG_MESH
+static u32 sta_plink_state_nl80211(enum mesh_plink_state state)
+{
+       switch (state) {
+       case PLINK_LISTEN:
+               return NL80211_PLINK_LISTEN;
+       case PLINK_OPEN_SENT:
+               return NL80211_PLINK_OPN_SNT;
+       case PLINK_OPEN_RCVD:
+               return NL80211_PLINK_OPN_RCVD;
+       case PLINK_CNF_RCVD:
+               return NL80211_PLINK_CNF_RCVD;
+       case PLINK_ESTAB:
+               return NL80211_PLINK_ESTAB;
+       case PLINK_HOLDING:
+               return NL80211_PLINK_HOLDING;
+       case PLINK_BLOCKED:
+               return NL80211_PLINK_BLOCKED;
+       default:
+               wpa_printf(MSG_ERROR, "nl80211: Invalid mesh plink state %d",
+                          state);
+       }
+       return -1;
+}
+#endif /* CONFIG_MESH */
+
+
 static int wpa_driver_nl80211_sta_add(void *priv,
                                      struct hostapd_sta_add_params *params)
 {
@@ -7983,6 +8010,12 @@ static int wpa_driver_nl80211_sta_add(void *priv,
                   upd.set, upd.mask);
        NLA_PUT(msg, NL80211_ATTR_STA_FLAGS2, sizeof(upd), &upd);
 
+#ifdef CONFIG_MESH
+       if (params->plink_state)
+               NLA_PUT_U8(msg, NL80211_ATTR_STA_PLINK_STATE,
+                          sta_plink_state_nl80211(params->plink_state));
+#endif /* CONFIG_MESH */
+
        if (params->flags & WPA_STA_WMM) {
                struct nlattr *wme = nla_nest_start(msg, NL80211_ATTR_STA_WME);