diff options
author | Dan Williams <dcbw@redhat.com> | 2008-08-21 17:46:18 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-29 16:24:06 -0400 |
commit | 191bb40e725304c5fcfabd92c57eef58799f0e25 (patch) | |
tree | a64e66713495e39f74f088209d4b558628c214aa /drivers/net/wireless/libertas/assoc.c | |
parent | 87c8c72d532f96257162f978d5945dcf7f0df19e (diff) |
libertas: convert CMD_802_11_DEAUTHENTICATE to a direct command
and remove DISASSOCIATE because it's not in any of the specs and has
never been used.
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/assoc.c')
-rw-r--r-- | drivers/net/wireless/libertas/assoc.c | 61 |
1 files changed, 26 insertions, 35 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index a267d6e65f03..5072a8917fd9 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -1029,7 +1029,9 @@ void lbs_association_worker(struct work_struct *work) | |||
1029 | */ | 1029 | */ |
1030 | if (priv->mode == IW_MODE_INFRA) { | 1030 | if (priv->mode == IW_MODE_INFRA) { |
1031 | if (should_deauth_infrastructure(priv, assoc_req)) { | 1031 | if (should_deauth_infrastructure(priv, assoc_req)) { |
1032 | ret = lbs_send_deauthentication(priv); | 1032 | ret = lbs_cmd_80211_deauthenticate(priv, |
1033 | priv->curbssparams.bssid, | ||
1034 | WLAN_REASON_DEAUTH_LEAVING); | ||
1033 | if (ret) { | 1035 | if (ret) { |
1034 | lbs_deb_assoc("Deauthentication due to new " | 1036 | lbs_deb_assoc("Deauthentication due to new " |
1035 | "configuration request failed: %d\n", | 1037 | "configuration request failed: %d\n", |
@@ -1290,18 +1292,6 @@ static void lbs_set_basic_rate_flags(u8 *rates, size_t len) | |||
1290 | } | 1292 | } |
1291 | 1293 | ||
1292 | /** | 1294 | /** |
1293 | * @brief Send Deauthentication Request | ||
1294 | * | ||
1295 | * @param priv A pointer to struct lbs_private structure | ||
1296 | * @return 0--success, -1--fail | ||
1297 | */ | ||
1298 | int lbs_send_deauthentication(struct lbs_private *priv) | ||
1299 | { | ||
1300 | return lbs_prepare_and_send_command(priv, CMD_802_11_DEAUTHENTICATE, | ||
1301 | 0, CMD_OPTION_WAITFORRSP, 0, NULL); | ||
1302 | } | ||
1303 | |||
1304 | /** | ||
1305 | * @brief This function prepares command of authenticate. | 1295 | * @brief This function prepares command of authenticate. |
1306 | * | 1296 | * |
1307 | * @param priv A pointer to struct lbs_private structure | 1297 | * @param priv A pointer to struct lbs_private structure |
@@ -1353,26 +1343,37 @@ out: | |||
1353 | return ret; | 1343 | return ret; |
1354 | } | 1344 | } |
1355 | 1345 | ||
1356 | int lbs_cmd_80211_deauthenticate(struct lbs_private *priv, | 1346 | /** |
1357 | struct cmd_ds_command *cmd) | 1347 | * @brief Deauthenticate from a specific BSS |
1348 | * | ||
1349 | * @param priv A pointer to struct lbs_private structure | ||
1350 | * @param bssid The specific BSS to deauthenticate from | ||
1351 | * @param reason The 802.11 sec. 7.3.1.7 Reason Code for deauthenticating | ||
1352 | * | ||
1353 | * @return 0 on success, error on failure | ||
1354 | */ | ||
1355 | int lbs_cmd_80211_deauthenticate(struct lbs_private *priv, u8 bssid[ETH_ALEN], | ||
1356 | u16 reason) | ||
1358 | { | 1357 | { |
1359 | struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth; | 1358 | struct cmd_ds_802_11_deauthenticate cmd; |
1359 | int ret; | ||
1360 | 1360 | ||
1361 | lbs_deb_enter(LBS_DEB_JOIN); | 1361 | lbs_deb_enter(LBS_DEB_JOIN); |
1362 | 1362 | ||
1363 | cmd->command = cpu_to_le16(CMD_802_11_DEAUTHENTICATE); | 1363 | memset(&cmd, 0, sizeof(cmd)); |
1364 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) + | 1364 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
1365 | S_DS_GEN); | 1365 | memcpy(cmd.macaddr, &bssid[0], ETH_ALEN); |
1366 | cmd.reasoncode = cpu_to_le16(reason); | ||
1366 | 1367 | ||
1367 | /* set AP MAC address */ | 1368 | ret = lbs_cmd_with_response(priv, CMD_802_11_DEAUTHENTICATE, &cmd); |
1368 | memmove(dauth->macaddr, priv->curbssparams.bssid, ETH_ALEN); | ||
1369 | 1369 | ||
1370 | /* Reason code 3 = Station is leaving */ | 1370 | /* Clean up everything even if there was an error; can't assume that |
1371 | #define REASON_CODE_STA_LEAVING 3 | 1371 | * we're still authenticated to the AP after trying to deauth. |
1372 | dauth->reasoncode = cpu_to_le16(REASON_CODE_STA_LEAVING); | 1372 | */ |
1373 | lbs_mac_event_disconnected(priv); | ||
1373 | 1374 | ||
1374 | lbs_deb_leave(LBS_DEB_JOIN); | 1375 | lbs_deb_leave(LBS_DEB_JOIN); |
1375 | return 0; | 1376 | return ret; |
1376 | } | 1377 | } |
1377 | 1378 | ||
1378 | int lbs_cmd_80211_associate(struct lbs_private *priv, | 1379 | int lbs_cmd_80211_associate(struct lbs_private *priv, |
@@ -1815,16 +1816,6 @@ done: | |||
1815 | return ret; | 1816 | return ret; |
1816 | } | 1817 | } |
1817 | 1818 | ||
1818 | int lbs_ret_80211_disassociate(struct lbs_private *priv) | ||
1819 | { | ||
1820 | lbs_deb_enter(LBS_DEB_JOIN); | ||
1821 | |||
1822 | lbs_mac_event_disconnected(priv); | ||
1823 | |||
1824 | lbs_deb_leave(LBS_DEB_JOIN); | ||
1825 | return 0; | ||
1826 | } | ||
1827 | |||
1828 | int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv, | 1819 | int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv, |
1829 | struct cmd_ds_command *resp) | 1820 | struct cmd_ds_command *resp) |
1830 | { | 1821 | { |