diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-12-18 19:31:27 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:09:37 -0500 |
commit | 51fb61e76d952e6bc2fbdd9f0d38425fbab1cf31 (patch) | |
tree | 09618b395aae1b91fbc8dec7ea9397a9654a9f0f /net/mac80211/ieee80211_sta.c | |
parent | 32bfd35d4b63bd63de4bb0d791ef049c3c868726 (diff) |
mac80211: move interface type to vif structure
Drivers that support mixed AP/STA operation may well need to
know the type of a virtual interface when iterating over them.
The easiest way to support that is to move the interface type
variable into the vif structure.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/ieee80211_sta.c')
-rw-r--r-- | net/mac80211/ieee80211_sta.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c index d1f7199a2083..b1e7d17ee253 100644 --- a/net/mac80211/ieee80211_sta.c +++ b/net/mac80211/ieee80211_sta.c | |||
@@ -471,7 +471,7 @@ static void ieee80211_set_associated(struct net_device *dev, | |||
471 | ifsta->flags |= IEEE80211_STA_ASSOCIATED; | 471 | ifsta->flags |= IEEE80211_STA_ASSOCIATED; |
472 | 472 | ||
473 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 473 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
474 | if (sdata->type != IEEE80211_IF_TYPE_STA) | 474 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
475 | return; | 475 | return; |
476 | 476 | ||
477 | bss = ieee80211_rx_bss_get(dev, ifsta->bssid, | 477 | bss = ieee80211_rx_bss_get(dev, ifsta->bssid, |
@@ -1025,7 +1025,7 @@ static void ieee80211_send_addba_resp(struct net_device *dev, u8 *da, u16 tid, | |||
1025 | memset(mgmt, 0, 24); | 1025 | memset(mgmt, 0, 24); |
1026 | memcpy(mgmt->da, da, ETH_ALEN); | 1026 | memcpy(mgmt->da, da, ETH_ALEN); |
1027 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 1027 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); |
1028 | if (sdata->type == IEEE80211_IF_TYPE_AP) | 1028 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) |
1029 | memcpy(mgmt->bssid, dev->dev_addr, ETH_ALEN); | 1029 | memcpy(mgmt->bssid, dev->dev_addr, ETH_ALEN); |
1030 | else | 1030 | else |
1031 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 1031 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
@@ -1184,7 +1184,7 @@ void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid, | |||
1184 | memset(mgmt, 0, 24); | 1184 | memset(mgmt, 0, 24); |
1185 | memcpy(mgmt->da, da, ETH_ALEN); | 1185 | memcpy(mgmt->da, da, ETH_ALEN); |
1186 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 1186 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); |
1187 | if (sdata->type == IEEE80211_IF_TYPE_AP) | 1187 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) |
1188 | memcpy(mgmt->bssid, dev->dev_addr, ETH_ALEN); | 1188 | memcpy(mgmt->bssid, dev->dev_addr, ETH_ALEN); |
1189 | else | 1189 | else |
1190 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 1190 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
@@ -1329,7 +1329,7 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev, | |||
1329 | DECLARE_MAC_BUF(mac); | 1329 | DECLARE_MAC_BUF(mac); |
1330 | 1330 | ||
1331 | if (ifsta->state != IEEE80211_AUTHENTICATE && | 1331 | if (ifsta->state != IEEE80211_AUTHENTICATE && |
1332 | sdata->type != IEEE80211_IF_TYPE_IBSS) { | 1332 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) { |
1333 | printk(KERN_DEBUG "%s: authentication frame received from " | 1333 | printk(KERN_DEBUG "%s: authentication frame received from " |
1334 | "%s, but not in authenticate state - ignored\n", | 1334 | "%s, but not in authenticate state - ignored\n", |
1335 | dev->name, print_mac(mac, mgmt->sa)); | 1335 | dev->name, print_mac(mac, mgmt->sa)); |
@@ -1343,7 +1343,7 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev, | |||
1343 | return; | 1343 | return; |
1344 | } | 1344 | } |
1345 | 1345 | ||
1346 | if (sdata->type != IEEE80211_IF_TYPE_IBSS && | 1346 | if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS && |
1347 | memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { | 1347 | memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { |
1348 | printk(KERN_DEBUG "%s: authentication frame received from " | 1348 | printk(KERN_DEBUG "%s: authentication frame received from " |
1349 | "unknown AP (SA=%s BSSID=%s) - " | 1349 | "unknown AP (SA=%s BSSID=%s) - " |
@@ -1352,7 +1352,7 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev, | |||
1352 | return; | 1352 | return; |
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | if (sdata->type != IEEE80211_IF_TYPE_IBSS && | 1355 | if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS && |
1356 | memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) { | 1356 | memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) { |
1357 | printk(KERN_DEBUG "%s: authentication frame received from " | 1357 | printk(KERN_DEBUG "%s: authentication frame received from " |
1358 | "unknown BSSID (SA=%s BSSID=%s) - " | 1358 | "unknown BSSID (SA=%s BSSID=%s) - " |
@@ -1370,7 +1370,7 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev, | |||
1370 | dev->name, print_mac(mac, mgmt->sa), auth_alg, | 1370 | dev->name, print_mac(mac, mgmt->sa), auth_alg, |
1371 | auth_transaction, status_code); | 1371 | auth_transaction, status_code); |
1372 | 1372 | ||
1373 | if (sdata->type == IEEE80211_IF_TYPE_IBSS) { | 1373 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
1374 | /* IEEE 802.11 standard does not require authentication in IBSS | 1374 | /* IEEE 802.11 standard does not require authentication in IBSS |
1375 | * networks and most implementations do not seem to use it. | 1375 | * networks and most implementations do not seem to use it. |
1376 | * However, try to reply to authentication attempts if someone | 1376 | * However, try to reply to authentication attempts if someone |
@@ -1849,7 +1849,7 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
1849 | 1849 | ||
1850 | timestamp = le64_to_cpu(mgmt->u.beacon.timestamp); | 1850 | timestamp = le64_to_cpu(mgmt->u.beacon.timestamp); |
1851 | 1851 | ||
1852 | if (sdata->type == IEEE80211_IF_TYPE_IBSS && beacon && | 1852 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && beacon && |
1853 | memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0) { | 1853 | memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0) { |
1854 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 1854 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
1855 | static unsigned long last_tsf_debug = 0; | 1855 | static unsigned long last_tsf_debug = 0; |
@@ -1874,7 +1874,7 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
1874 | 1874 | ||
1875 | ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems); | 1875 | ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems); |
1876 | 1876 | ||
1877 | if (sdata->type == IEEE80211_IF_TYPE_IBSS && elems.supp_rates && | 1877 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && elems.supp_rates && |
1878 | memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0 && | 1878 | memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0 && |
1879 | (sta = sta_info_get(local, mgmt->sa))) { | 1879 | (sta = sta_info_get(local, mgmt->sa))) { |
1880 | struct ieee80211_hw_mode *mode; | 1880 | struct ieee80211_hw_mode *mode; |
@@ -2103,7 +2103,7 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev, | |||
2103 | ieee80211_rx_bss_info(dev, mgmt, len, rx_status, 1); | 2103 | ieee80211_rx_bss_info(dev, mgmt, len, rx_status, 1); |
2104 | 2104 | ||
2105 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 2105 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
2106 | if (sdata->type != IEEE80211_IF_TYPE_STA) | 2106 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
2107 | return; | 2107 | return; |
2108 | ifsta = &sdata->u.sta; | 2108 | ifsta = &sdata->u.sta; |
2109 | 2109 | ||
@@ -2163,7 +2163,7 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev, | |||
2163 | DECLARE_MAC_BUF(mac3); | 2163 | DECLARE_MAC_BUF(mac3); |
2164 | #endif | 2164 | #endif |
2165 | 2165 | ||
2166 | if (sdata->type != IEEE80211_IF_TYPE_IBSS || | 2166 | if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS || |
2167 | ifsta->state != IEEE80211_IBSS_JOINED || | 2167 | ifsta->state != IEEE80211_IBSS_JOINED || |
2168 | len < 24 + 2 || !ifsta->probe_resp) | 2168 | len < 24 + 2 || !ifsta->probe_resp) |
2169 | return; | 2169 | return; |
@@ -2474,10 +2474,10 @@ void ieee80211_sta_work(struct work_struct *work) | |||
2474 | if (local->sta_sw_scanning || local->sta_hw_scanning) | 2474 | if (local->sta_sw_scanning || local->sta_hw_scanning) |
2475 | return; | 2475 | return; |
2476 | 2476 | ||
2477 | if (sdata->type != IEEE80211_IF_TYPE_STA && | 2477 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && |
2478 | sdata->type != IEEE80211_IF_TYPE_IBSS) { | 2478 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) { |
2479 | printk(KERN_DEBUG "%s: ieee80211_sta_work: non-STA interface " | 2479 | printk(KERN_DEBUG "%s: ieee80211_sta_work: non-STA interface " |
2480 | "(type=%d)\n", dev->name, sdata->type); | 2480 | "(type=%d)\n", dev->name, sdata->vif.type); |
2481 | return; | 2481 | return; |
2482 | } | 2482 | } |
2483 | ifsta = &sdata->u.sta; | 2483 | ifsta = &sdata->u.sta; |
@@ -2572,7 +2572,7 @@ void ieee80211_sta_req_auth(struct net_device *dev, | |||
2572 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 2572 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
2573 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 2573 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
2574 | 2574 | ||
2575 | if (sdata->type != IEEE80211_IF_TYPE_STA) | 2575 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
2576 | return; | 2576 | return; |
2577 | 2577 | ||
2578 | if ((ifsta->flags & (IEEE80211_STA_BSSID_SET | | 2578 | if ((ifsta->flags & (IEEE80211_STA_BSSID_SET | |
@@ -3039,7 +3039,7 @@ int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len) | |||
3039 | ifsta->flags |= IEEE80211_STA_SSID_SET; | 3039 | ifsta->flags |= IEEE80211_STA_SSID_SET; |
3040 | else | 3040 | else |
3041 | ifsta->flags &= ~IEEE80211_STA_SSID_SET; | 3041 | ifsta->flags &= ~IEEE80211_STA_SSID_SET; |
3042 | if (sdata->type == IEEE80211_IF_TYPE_IBSS && | 3042 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && |
3043 | !(ifsta->flags & IEEE80211_STA_BSSID_SET)) { | 3043 | !(ifsta->flags & IEEE80211_STA_BSSID_SET)) { |
3044 | ifsta->ibss_join_req = jiffies; | 3044 | ifsta->ibss_join_req = jiffies; |
3045 | ifsta->state = IEEE80211_IBSS_SEARCH; | 3045 | ifsta->state = IEEE80211_IBSS_SEARCH; |
@@ -3157,7 +3157,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw) | |||
3157 | if (sdata->dev == local->mdev) | 3157 | if (sdata->dev == local->mdev) |
3158 | continue; | 3158 | continue; |
3159 | 3159 | ||
3160 | if (sdata->type == IEEE80211_IF_TYPE_STA) { | 3160 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) { |
3161 | if (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED) | 3161 | if (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED) |
3162 | ieee80211_send_nullfunc(local, sdata, 0); | 3162 | ieee80211_send_nullfunc(local, sdata, 0); |
3163 | ieee80211_sta_timer((unsigned long)sdata); | 3163 | ieee80211_sta_timer((unsigned long)sdata); |
@@ -3169,7 +3169,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw) | |||
3169 | 3169 | ||
3170 | done: | 3170 | done: |
3171 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 3171 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
3172 | if (sdata->type == IEEE80211_IF_TYPE_IBSS) { | 3172 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
3173 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 3173 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
3174 | if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || | 3174 | if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || |
3175 | (!ifsta->state == IEEE80211_IBSS_JOINED && | 3175 | (!ifsta->state == IEEE80211_IBSS_JOINED && |
@@ -3204,7 +3204,7 @@ void ieee80211_sta_scan_work(struct work_struct *work) | |||
3204 | skip = !(local->enabled_modes & (1 << mode->mode)); | 3204 | skip = !(local->enabled_modes & (1 << mode->mode)); |
3205 | chan = &mode->channels[local->scan_channel_idx]; | 3205 | chan = &mode->channels[local->scan_channel_idx]; |
3206 | if (!(chan->flag & IEEE80211_CHAN_W_SCAN) || | 3206 | if (!(chan->flag & IEEE80211_CHAN_W_SCAN) || |
3207 | (sdata->type == IEEE80211_IF_TYPE_IBSS && | 3207 | (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && |
3208 | !(chan->flag & IEEE80211_CHAN_W_IBSS)) || | 3208 | !(chan->flag & IEEE80211_CHAN_W_IBSS)) || |
3209 | (local->hw_modes & local->enabled_modes & | 3209 | (local->hw_modes & local->enabled_modes & |
3210 | (1 << MODE_IEEE80211G) && mode->mode == MODE_IEEE80211B)) | 3210 | (1 << MODE_IEEE80211G) && mode->mode == MODE_IEEE80211B)) |
@@ -3312,7 +3312,7 @@ static int ieee80211_sta_start_scan(struct net_device *dev, | |||
3312 | continue; | 3312 | continue; |
3313 | 3313 | ||
3314 | netif_stop_queue(sdata->dev); | 3314 | netif_stop_queue(sdata->dev); |
3315 | if (sdata->type == IEEE80211_IF_TYPE_STA && | 3315 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA && |
3316 | (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED)) | 3316 | (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED)) |
3317 | ieee80211_send_nullfunc(local, sdata, 1); | 3317 | ieee80211_send_nullfunc(local, sdata, 1); |
3318 | } | 3318 | } |
@@ -3353,7 +3353,7 @@ int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len) | |||
3353 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 3353 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
3354 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3354 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
3355 | 3355 | ||
3356 | if (sdata->type != IEEE80211_IF_TYPE_STA) | 3356 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
3357 | return ieee80211_sta_start_scan(dev, ssid, ssid_len); | 3357 | return ieee80211_sta_start_scan(dev, ssid, ssid_len); |
3358 | 3358 | ||
3359 | if (local->sta_sw_scanning || local->sta_hw_scanning) { | 3359 | if (local->sta_sw_scanning || local->sta_hw_scanning) { |
@@ -3576,8 +3576,8 @@ int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason) | |||
3576 | printk(KERN_DEBUG "%s: deauthenticate(reason=%d)\n", | 3576 | printk(KERN_DEBUG "%s: deauthenticate(reason=%d)\n", |
3577 | dev->name, reason); | 3577 | dev->name, reason); |
3578 | 3578 | ||
3579 | if (sdata->type != IEEE80211_IF_TYPE_STA && | 3579 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && |
3580 | sdata->type != IEEE80211_IF_TYPE_IBSS) | 3580 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) |
3581 | return -EINVAL; | 3581 | return -EINVAL; |
3582 | 3582 | ||
3583 | ieee80211_send_deauth(dev, ifsta, reason); | 3583 | ieee80211_send_deauth(dev, ifsta, reason); |
@@ -3594,7 +3594,7 @@ int ieee80211_sta_disassociate(struct net_device *dev, u16 reason) | |||
3594 | printk(KERN_DEBUG "%s: disassociate(reason=%d)\n", | 3594 | printk(KERN_DEBUG "%s: disassociate(reason=%d)\n", |
3595 | dev->name, reason); | 3595 | dev->name, reason); |
3596 | 3596 | ||
3597 | if (sdata->type != IEEE80211_IF_TYPE_STA) | 3597 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
3598 | return -EINVAL; | 3598 | return -EINVAL; |
3599 | 3599 | ||
3600 | if (!(ifsta->flags & IEEE80211_STA_ASSOCIATED)) | 3600 | if (!(ifsta->flags & IEEE80211_STA_ASSOCIATED)) |