From 7c7e7877fcd876f50ca8fbcbe1043f7e8beeb622 Mon Sep 17 00:00:00 2001 From: Bob Copeland Date: Mon, 1 Sep 2014 00:23:23 -0400 Subject: [PATCH] nl80211: Add plink_action_field to hostapd_sta_add_params Signed-off-by: Javier Lopez Signed-off-by: Javier Cardona Signed-off-by: Jason Mobarak Signed-off-by: Bob Copeland --- src/common/defs.h | 10 ++++++++++ src/drivers/driver.h | 3 +++ src/drivers/driver_nl80211.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/src/common/defs.h b/src/common/defs.h index d4091e310..bf992e00b 100644 --- a/src/common/defs.h +++ b/src/common/defs.h @@ -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 */ diff --git a/src/drivers/driver.h b/src/drivers/driver.h index f10414b27..d4e013405 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -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; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 606023e49..56b30d0c0 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -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);