[PATCH] mac80211: fix vlan bug
authorJohannes Berg <johannes@sipsolutions.net>
Wed, 26 Sep 2007 13:19:43 +0000 (15:19 +0200)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:53:15 +0000 (16:53 -0700)
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>
net/mac80211/ieee80211.c
net/mac80211/ieee80211_i.h
net/mac80211/ieee80211_iface.c
net/mac80211/rx.c

index 52638194e45fbd4616e4343569b3b236ae7164fe..b1180536c33535a4a0c3e7dac86d83063d83015c 100644 (file)
@@ -344,6 +344,13 @@ static int ieee80211_open(struct net_device *dev)
                if (!sdata->u.vlan.ap)
                        return -ENOLINK;
                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) {
index a5961f16f206a7767fa29654e2f315387cbc988e..636de70cd85dd5724de6a99c1999ec04c3b45f4d 100644 (file)
@@ -290,7 +290,7 @@ struct ieee80211_if_sta {
 #define IEEE80211_SDATA_SHORT_PREAMBLE BIT(3)
 struct ieee80211_sub_if_data {
        struct list_head list;
-       unsigned int type;
+       enum ieee80211_if_types type;
 
        struct wireless_dev wdev;
 
index 369ee4f52a29c0d741aabe2428bcf0cc2f01f97e..60cee6e602d229b5f1a5315ba1f656f2480e9ec3 100644 (file)
@@ -243,6 +243,9 @@ void ieee80211_if_reinit(struct net_device *dev)
        ieee80211_if_sdata_deinit(sdata);
 
        switch (sdata->type) {
+       case IEEE80211_IF_TYPE_MGMT:
+               /* nothing to do */
+               break;
        case IEEE80211_IF_TYPE_AP: {
                /* Remove all virtual interfaces that use this BSS
                 * as their sdata->bss */
index 453ccab060a2e8d3d14547e698fb04f65b9d927a..34adc5288fbc155c1ca6f5afec9c003280f6d9f5 100644 (file)
@@ -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,
                                                         bssid, hdr->addr2);
                break;
+       case IEEE80211_IF_TYPE_VLAN:
        case IEEE80211_IF_TYPE_AP:
                if (!bssid) {
                        if (compare_ether_addr(sdata->dev->dev_addr,
@@ -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))
                        return 0;
                break;
+       case IEEE80211_IF_TYPE_MNTR:
+               /* take everything */
+               break;
+       case IEEE80211_IF_TYPE_MGMT:
+               /* should never get here */
+               WARN_ON(1);
+               break;
        }
 
        return 1;
This page took 0.029522 seconds and 5 git commands to generate.