diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-09-26 09:19:43 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:53:15 -0400 |
commit | fb1c1cd6c5a8988b14c5c6c0dfe55542df3a34c6 (patch) | |
tree | 9dec818b2b6aea9c9823902e9c5b0108134d5747 | |
parent | af1a90da397f071d7ee893145a1e7b2124689376 (diff) |
[PATCH] mac80211: fix vlan bug
VLAN interfaces have yet another bug: they aren't accounted
for properly in the receive path in prepare_for_handlers().
I noticed this by code inspection, but it would be easy for
the compiler to catch such things if we'd just use the proper
enum where appropriate.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | net/mac80211/ieee80211.c | 7 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 2 | ||||
-rw-r--r-- | net/mac80211/ieee80211_iface.c | 3 | ||||
-rw-r--r-- | net/mac80211/rx.c | 8 |
4 files changed, 19 insertions, 1 deletions
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index 52638194e45f..b1180536c335 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c | |||
@@ -344,6 +344,13 @@ static int ieee80211_open(struct net_device *dev) | |||
344 | if (!sdata->u.vlan.ap) | 344 | if (!sdata->u.vlan.ap) |
345 | return -ENOLINK; | 345 | return -ENOLINK; |
346 | break; | 346 | break; |
347 | case IEEE80211_IF_TYPE_AP: | ||
348 | case IEEE80211_IF_TYPE_MGMT: | ||
349 | case IEEE80211_IF_TYPE_STA: | ||
350 | case IEEE80211_IF_TYPE_MNTR: | ||
351 | case IEEE80211_IF_TYPE_IBSS: | ||
352 | /* no special treatment */ | ||
353 | break; | ||
347 | } | 354 | } |
348 | 355 | ||
349 | if (local->open_count == 0) { | 356 | if (local->open_count == 0) { |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index a5961f16f206..636de70cd85d 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -290,7 +290,7 @@ struct ieee80211_if_sta { | |||
290 | #define IEEE80211_SDATA_SHORT_PREAMBLE BIT(3) | 290 | #define IEEE80211_SDATA_SHORT_PREAMBLE BIT(3) |
291 | struct ieee80211_sub_if_data { | 291 | struct ieee80211_sub_if_data { |
292 | struct list_head list; | 292 | struct list_head list; |
293 | unsigned int type; | 293 | enum ieee80211_if_types type; |
294 | 294 | ||
295 | struct wireless_dev wdev; | 295 | struct wireless_dev wdev; |
296 | 296 | ||
diff --git a/net/mac80211/ieee80211_iface.c b/net/mac80211/ieee80211_iface.c index 369ee4f52a29..60cee6e602d2 100644 --- a/net/mac80211/ieee80211_iface.c +++ b/net/mac80211/ieee80211_iface.c | |||
@@ -243,6 +243,9 @@ void ieee80211_if_reinit(struct net_device *dev) | |||
243 | ieee80211_if_sdata_deinit(sdata); | 243 | ieee80211_if_sdata_deinit(sdata); |
244 | 244 | ||
245 | switch (sdata->type) { | 245 | switch (sdata->type) { |
246 | case IEEE80211_IF_TYPE_MGMT: | ||
247 | /* nothing to do */ | ||
248 | break; | ||
246 | case IEEE80211_IF_TYPE_AP: { | 249 | case IEEE80211_IF_TYPE_AP: { |
247 | /* Remove all virtual interfaces that use this BSS | 250 | /* Remove all virtual interfaces that use this BSS |
248 | * as their sdata->bss */ | 251 | * as their sdata->bss */ |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 453ccab060a2..34adc5288fbc 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1425,6 +1425,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
1425 | rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb, | 1425 | rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb, |
1426 | bssid, hdr->addr2); | 1426 | bssid, hdr->addr2); |
1427 | break; | 1427 | break; |
1428 | case IEEE80211_IF_TYPE_VLAN: | ||
1428 | case IEEE80211_IF_TYPE_AP: | 1429 | case IEEE80211_IF_TYPE_AP: |
1429 | if (!bssid) { | 1430 | if (!bssid) { |
1430 | if (compare_ether_addr(sdata->dev->dev_addr, | 1431 | if (compare_ether_addr(sdata->dev->dev_addr, |
@@ -1449,6 +1450,13 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
1449 | if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2)) | 1450 | if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2)) |
1450 | return 0; | 1451 | return 0; |
1451 | break; | 1452 | break; |
1453 | case IEEE80211_IF_TYPE_MNTR: | ||
1454 | /* take everything */ | ||
1455 | break; | ||
1456 | case IEEE80211_IF_TYPE_MGMT: | ||
1457 | /* should never get here */ | ||
1458 | WARN_ON(1); | ||
1459 | break; | ||
1452 | } | 1460 | } |
1453 | 1461 | ||
1454 | return 1; | 1462 | return 1; |