mac80211: add support for control port protocol in AP mode
authorJohannes Berg <johannes.berg@intel.com>
Fri, 4 Nov 2011 10:18:11 +0000 (11:18 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 9 Nov 2011 21:05:49 +0000 (16:05 -0500)
This will allow us to support dynamic WEP with 802.1X
properly in mac80211 by not encrypting outgoing and
accepting unencrypted incoming frames.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/cfg.c
net/mac80211/iface.c

index 65b72ae2b4e0cc8df20213a11be3e439383e403d..1f1056172ef1f4e04c7f2e260cb6ce96464ad2e7 100644 (file)
@@ -594,6 +594,8 @@ static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
 {
        struct ieee80211_sub_if_data *sdata;
        struct beacon_data *old;
+       struct ieee80211_sub_if_data *vlan;
+       int ret;
 
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
@@ -601,7 +603,24 @@ static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
        if (old)
                return -EALREADY;
 
-       return ieee80211_config_beacon(sdata, params);
+       ret = ieee80211_config_beacon(sdata, params);
+       if (ret)
+               return ret;
+
+       /*
+        * Apply control port protocol, this allows us to
+        * not encrypt dynamic WEP control frames.
+        */
+       sdata->control_port_protocol = params->crypto.control_port_ethertype;
+       sdata->control_port_no_encrypt = params->crypto.control_port_no_encrypt;
+       list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) {
+               vlan->control_port_protocol =
+                       params->crypto.control_port_ethertype;
+               vlan->control_port_no_encrypt =
+                       params->crypto.control_port_no_encrypt;
+       }
+
+       return 0;
 }
 
 static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
index 4ee624c543cbb6dd8c44c2a4cb2eee8d2c7bc7a1..b7bc4b7b80af2f7c3496e70ef61a036f751bb378 100644 (file)
@@ -188,11 +188,22 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up)
                if (!is_valid_ether_addr(sdata->u.wds.remote_addr))
                        return -ENOLINK;
                break;
-       case NL80211_IFTYPE_AP_VLAN:
+       case NL80211_IFTYPE_AP_VLAN: {
+               struct ieee80211_sub_if_data *master;
+
                if (!sdata->bss)
                        return -ENOLINK;
+
                list_add(&sdata->u.vlan.list, &sdata->bss->vlans);
+
+               master = container_of(sdata->bss,
+                                     struct ieee80211_sub_if_data, u.ap);
+               sdata->control_port_protocol =
+                       master->control_port_protocol;
+               sdata->control_port_no_encrypt =
+                       master->control_port_no_encrypt;
                break;
+               }
        case NL80211_IFTYPE_AP:
                sdata->bss = &sdata->u.ap;
                break;