aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-08-27 07:26:53 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-08-27 13:27:07 -0400
commitc0692b8fe29fb4d4dad33487aabf3ed7e1e880c0 (patch)
tree39c0c74c2270a285e1a0cfc7958ced7368cf28a6 /net/wireless
parent3ffc2a905b1faae4c0fe39d66f0752c3a4cbb3c7 (diff)
cfg80211: allow changing port control protocol
Some vendor specified mechanisms for 802.1X-style functionality use a different protocol than EAP (even if EAP is vendor-extensible). Allow setting the ethertype for the protocol when a driver has support for this. The default if unspecified is EAP, of course. Note: This is suitable only for station mode, not for AP implementation. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/nl80211.c25
-rw-r--r--net/wireless/wext-sme.c2
2 files changed, 24 insertions, 3 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 49f5ca35e787..85a23de7bff3 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -136,6 +136,8 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
136 .len = sizeof(struct nl80211_sta_flag_update), 136 .len = sizeof(struct nl80211_sta_flag_update),
137 }, 137 },
138 [NL80211_ATTR_CONTROL_PORT] = { .type = NLA_FLAG }, 138 [NL80211_ATTR_CONTROL_PORT] = { .type = NLA_FLAG },
139 [NL80211_ATTR_CONTROL_PORT_ETHERTYPE] = { .type = NLA_U16 },
140 [NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT] = { .type = NLA_FLAG },
139 [NL80211_ATTR_PRIVACY] = { .type = NLA_FLAG }, 141 [NL80211_ATTR_PRIVACY] = { .type = NLA_FLAG },
140 [NL80211_ATTR_CIPHER_SUITE_GROUP] = { .type = NLA_U32 }, 142 [NL80211_ATTR_CIPHER_SUITE_GROUP] = { .type = NLA_U32 },
141 [NL80211_ATTR_WPA_VERSIONS] = { .type = NLA_U32 }, 143 [NL80211_ATTR_WPA_VERSIONS] = { .type = NLA_U32 },
@@ -474,6 +476,9 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
474 NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_PMKIDS, 476 NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_PMKIDS,
475 dev->wiphy.max_num_pmkids); 477 dev->wiphy.max_num_pmkids);
476 478
479 if (dev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL)
480 NLA_PUT_FLAG(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE);
481
477 nl_modes = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_IFTYPES); 482 nl_modes = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_IFTYPES);
478 if (!nl_modes) 483 if (!nl_modes)
479 goto nla_put_failure; 484 goto nla_put_failure;
@@ -3691,7 +3696,8 @@ unlock_rtnl:
3691 return err; 3696 return err;
3692} 3697}
3693 3698
3694static int nl80211_crypto_settings(struct genl_info *info, 3699static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
3700 struct genl_info *info,
3695 struct cfg80211_crypto_settings *settings, 3701 struct cfg80211_crypto_settings *settings,
3696 int cipher_limit) 3702 int cipher_limit)
3697{ 3703{
@@ -3699,6 +3705,19 @@ static int nl80211_crypto_settings(struct genl_info *info,
3699 3705
3700 settings->control_port = info->attrs[NL80211_ATTR_CONTROL_PORT]; 3706 settings->control_port = info->attrs[NL80211_ATTR_CONTROL_PORT];
3701 3707
3708 if (info->attrs[NL80211_ATTR_CONTROL_PORT_ETHERTYPE]) {
3709 u16 proto;
3710 proto = nla_get_u16(
3711 info->attrs[NL80211_ATTR_CONTROL_PORT_ETHERTYPE]);
3712 settings->control_port_ethertype = cpu_to_be16(proto);
3713 if (!(rdev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL) &&
3714 proto != ETH_P_PAE)
3715 return -EINVAL;
3716 if (info->attrs[NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT])
3717 settings->control_port_no_encrypt = true;
3718 } else
3719 settings->control_port_ethertype = cpu_to_be16(ETH_P_PAE);
3720
3702 if (info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]) { 3721 if (info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]) {
3703 void *data; 3722 void *data;
3704 int len, i; 3723 int len, i;
@@ -3826,7 +3845,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
3826 if (info->attrs[NL80211_ATTR_PREV_BSSID]) 3845 if (info->attrs[NL80211_ATTR_PREV_BSSID])
3827 prev_bssid = nla_data(info->attrs[NL80211_ATTR_PREV_BSSID]); 3846 prev_bssid = nla_data(info->attrs[NL80211_ATTR_PREV_BSSID]);
3828 3847
3829 err = nl80211_crypto_settings(info, &crypto, 1); 3848 err = nl80211_crypto_settings(rdev, info, &crypto, 1);
3830 if (!err) 3849 if (!err)
3831 err = cfg80211_mlme_assoc(rdev, dev, chan, bssid, prev_bssid, 3850 err = cfg80211_mlme_assoc(rdev, dev, chan, bssid, prev_bssid,
3832 ssid, ssid_len, ie, ie_len, use_mfp, 3851 ssid, ssid_len, ie, ie_len, use_mfp,
@@ -4303,7 +4322,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
4303 4322
4304 connect.privacy = info->attrs[NL80211_ATTR_PRIVACY]; 4323 connect.privacy = info->attrs[NL80211_ATTR_PRIVACY];
4305 4324
4306 err = nl80211_crypto_settings(info, &connect.crypto, 4325 err = nl80211_crypto_settings(rdev, info, &connect.crypto,
4307 NL80211_MAX_NR_CIPHER_SUITES); 4326 NL80211_MAX_NR_CIPHER_SUITES);
4308 if (err) 4327 if (err)
4309 return err; 4328 return err;
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index 9818198add8a..6fffe62d7c25 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -197,6 +197,8 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev,
197 wdev->wext.connect.ssid_len = len; 197 wdev->wext.connect.ssid_len = len;
198 198
199 wdev->wext.connect.crypto.control_port = false; 199 wdev->wext.connect.crypto.control_port = false;
200 wdev->wext.connect.crypto.control_port_ethertype =
201 cpu_to_be16(ETH_P_PAE);
200 202
201 err = cfg80211_mgd_wext_connect(rdev, wdev); 203 err = cfg80211_mgd_wext_connect(rdev, wdev);
202 out: 204 out: