Commit fb1c1cd6 authored by Johannes Berg's avatar Johannes Berg Committed by David S. Miller

[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: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent af1a90da
...@@ -344,6 +344,13 @@ static int ieee80211_open(struct net_device *dev) ...@@ -344,6 +344,13 @@ static int ieee80211_open(struct net_device *dev)
if (!sdata->u.vlan.ap) if (!sdata->u.vlan.ap)
return -ENOLINK; return -ENOLINK;
break; break;
case IEEE80211_IF_TYPE_AP:
case IEEE80211_IF_TYPE_MGMT:
case IEEE80211_IF_TYPE_STA:
case IEEE80211_IF_TYPE_MNTR:
case IEEE80211_IF_TYPE_IBSS:
/* no special treatment */
break;
} }
if (local->open_count == 0) { if (local->open_count == 0) {
......
...@@ -290,7 +290,7 @@ struct ieee80211_if_sta { ...@@ -290,7 +290,7 @@ struct ieee80211_if_sta {
#define IEEE80211_SDATA_SHORT_PREAMBLE BIT(3) #define IEEE80211_SDATA_SHORT_PREAMBLE BIT(3)
struct ieee80211_sub_if_data { struct ieee80211_sub_if_data {
struct list_head list; struct list_head list;
unsigned int type; enum ieee80211_if_types type;
struct wireless_dev wdev; struct wireless_dev wdev;
......
...@@ -243,6 +243,9 @@ void ieee80211_if_reinit(struct net_device *dev) ...@@ -243,6 +243,9 @@ void ieee80211_if_reinit(struct net_device *dev)
ieee80211_if_sdata_deinit(sdata); ieee80211_if_sdata_deinit(sdata);
switch (sdata->type) { switch (sdata->type) {
case IEEE80211_IF_TYPE_MGMT:
/* nothing to do */
break;
case IEEE80211_IF_TYPE_AP: { case IEEE80211_IF_TYPE_AP: {
/* Remove all virtual interfaces that use this BSS /* Remove all virtual interfaces that use this BSS
* as their sdata->bss */ * as their sdata->bss */
......
...@@ -1425,6 +1425,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, ...@@ -1425,6 +1425,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb, rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb,
bssid, hdr->addr2); bssid, hdr->addr2);
break; break;
case IEEE80211_IF_TYPE_VLAN:
case IEEE80211_IF_TYPE_AP: case IEEE80211_IF_TYPE_AP:
if (!bssid) { if (!bssid) {
if (compare_ether_addr(sdata->dev->dev_addr, if (compare_ether_addr(sdata->dev->dev_addr,
...@@ -1449,6 +1450,13 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, ...@@ -1449,6 +1450,13 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2)) if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2))
return 0; return 0;
break; break;
case IEEE80211_IF_TYPE_MNTR:
/* take everything */
break;
case IEEE80211_IF_TYPE_MGMT:
/* should never get here */
WARN_ON(1);
break;
} }
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment