aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-04-08 08:31:37 (GMT)
committerJouni Malinen <j@w1.fi>2010-04-08 08:31:37 (GMT)
commit77339912817d758c131309d4944c0bec19e3d1f6 (patch)
tree5da1e045936fba1ab734a02f9268e2e65dd1f54f /src/drivers
parent27cf8871ad6b24eb7fad108f4d648d590df3eed9 (diff)
downloadhostap-77339912817d758c131309d4944c0bec19e3d1f6.zip
hostap-77339912817d758c131309d4944c0bec19e3d1f6.tar.gz
hostap-77339912817d758c131309d4944c0bec19e3d1f6.tar.bz2
nl80211: Start using NL80211_ATTR_LOCAL_STATE_CHANGE
This removes transmission of some unnecessary Deauthentication frames in cases where we only need to clear the local state. In addition, this resolves issues for 802.11r FT-over-DS by allowing authentication state to be set locally even when no actual Authentication frame is to be transmitted.
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/driver_nl80211.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 70a0d07..268ddea 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -132,7 +132,8 @@ static int wpa_driver_nl80211_set_mode(void *priv, int mode);
static int
wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv);
static int wpa_driver_nl80211_mlme(struct wpa_driver_nl80211_data *drv,
- const u8 *addr, int cmd, u16 reason_code);
+ const u8 *addr, int cmd, u16 reason_code,
+ int local_state_change);
static void nl80211_remove_monitor_interface(
struct wpa_driver_nl80211_data *drv);
@@ -1845,7 +1846,7 @@ static void clear_state_mismatch(struct wpa_driver_nl80211_data *drv,
"mismatch (" MACSTR ")", MAC2STR(addr));
wpa_driver_nl80211_mlme(drv, addr,
NL80211_CMD_DEAUTHENTICATE,
- WLAN_REASON_PREV_AUTH_NOT_VALID);
+ WLAN_REASON_PREV_AUTH_NOT_VALID, 1);
}
}
@@ -2216,7 +2217,8 @@ nla_put_failure:
static int wpa_driver_nl80211_mlme(struct wpa_driver_nl80211_data *drv,
- const u8 *addr, int cmd, u16 reason_code)
+ const u8 *addr, int cmd, u16 reason_code,
+ int local_state_change)
{
int ret = -1;
struct nl_msg *msg;
@@ -2230,6 +2232,8 @@ static int wpa_driver_nl80211_mlme(struct wpa_driver_nl80211_data *drv,
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
NLA_PUT_U16(msg, NL80211_ATTR_REASON_CODE, reason_code);
NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
+ if (local_state_change)
+ NLA_PUT_FLAG(msg, NL80211_ATTR_LOCAL_STATE_CHANGE);
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
msg = NULL;
@@ -2252,7 +2256,7 @@ static int wpa_driver_nl80211_disconnect(struct wpa_driver_nl80211_data *drv,
wpa_printf(MSG_DEBUG, "%s", __func__);
drv->associated = 0;
return wpa_driver_nl80211_mlme(drv, addr, NL80211_CMD_DISCONNECT,
- reason_code);
+ reason_code, 0);
}
@@ -2266,7 +2270,7 @@ static int wpa_driver_nl80211_deauthenticate(void *priv, const u8 *addr,
wpa_printf(MSG_DEBUG, "%s", __func__);
drv->associated = 0;
return wpa_driver_nl80211_mlme(drv, addr, NL80211_CMD_DEAUTHENTICATE,
- reason_code);
+ reason_code, 0);
}
@@ -2280,7 +2284,7 @@ static int wpa_driver_nl80211_disassociate(void *priv, const u8 *addr,
wpa_printf(MSG_DEBUG, "%s", __func__);
drv->associated = 0;
return wpa_driver_nl80211_mlme(drv, addr, NL80211_CMD_DISASSOCIATE,
- reason_code);
+ reason_code, 0);
}
@@ -2366,6 +2370,10 @@ retry:
goto nla_put_failure;
wpa_printf(MSG_DEBUG, " * Auth Type %d", type);
NLA_PUT_U32(msg, NL80211_ATTR_AUTH_TYPE, type);
+ if (params->local_state_change) {
+ wpa_printf(MSG_DEBUG, " * Local state change only");
+ NLA_PUT_FLAG(msg, NL80211_ATTR_LOCAL_STATE_CHANGE);
+ }
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
msg = NULL;
@@ -2373,7 +2381,8 @@ retry:
wpa_printf(MSG_DEBUG, "nl80211: MLME command failed: ret=%d "
"(%s)", ret, strerror(-ret));
count++;
- if (ret == -EALREADY && count == 1 && params->bssid) {
+ if (ret == -EALREADY && count == 1 && params->bssid &&
+ !params->local_state_change) {
/*
* mac80211 does not currently accept new
* authentication if we are already authenticated. As a