diff options
-rw-r--r-- | include/linux/nl80211.h | 16 | ||||
-rw-r--r-- | include/net/cfg80211.h | 24 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 25 | ||||
-rw-r--r-- | net/wireless/wext-sme.c | 2 |
4 files changed, 56 insertions, 11 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index ec1690da7845..31603e8b5581 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -295,7 +295,9 @@ | |||
295 | * auth and assoc steps. For this, you need to specify the SSID in a | 295 | * auth and assoc steps. For this, you need to specify the SSID in a |
296 | * %NL80211_ATTR_SSID attribute, and can optionally specify the association | 296 | * %NL80211_ATTR_SSID attribute, and can optionally specify the association |
297 | * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_MAC, | 297 | * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_MAC, |
298 | * %NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_CONTROL_PORT. | 298 | * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, |
299 | * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and | ||
300 | * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT. | ||
299 | * It is also sent as an event, with the BSSID and response IEs when the | 301 | * It is also sent as an event, with the BSSID and response IEs when the |
300 | * connection is established or failed to be established. This can be | 302 | * connection is established or failed to be established. This can be |
301 | * determined by the STATUS_CODE attribute. | 303 | * determined by the STATUS_CODE attribute. |
@@ -686,6 +688,15 @@ enum nl80211_commands { | |||
686 | * request, the driver will assume that the port is unauthorized until | 688 | * request, the driver will assume that the port is unauthorized until |
687 | * authorized by user space. Otherwise, port is marked authorized by | 689 | * authorized by user space. Otherwise, port is marked authorized by |
688 | * default in station mode. | 690 | * default in station mode. |
691 | * @NL80211_ATTR_CONTROL_PORT_ETHERTYPE: A 16-bit value indicating the | ||
692 | * ethertype that will be used for key negotiation. It can be | ||
693 | * specified with the associate and connect commands. If it is not | ||
694 | * specified, the value defaults to 0x888E (PAE, 802.1X). This | ||
695 | * attribute is also used as a flag in the wiphy information to | ||
696 | * indicate that protocols other than PAE are supported. | ||
697 | * @NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT: When included along with | ||
698 | * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, indicates that the custom | ||
699 | * ethertype frames used for key negotiation must not be encrypted. | ||
689 | * | 700 | * |
690 | * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver. | 701 | * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver. |
691 | * We recommend using nested, driver-specific attributes within this. | 702 | * We recommend using nested, driver-specific attributes within this. |
@@ -951,6 +962,9 @@ enum nl80211_attrs { | |||
951 | NL80211_ATTR_RX_FRAME_TYPES, | 962 | NL80211_ATTR_RX_FRAME_TYPES, |
952 | NL80211_ATTR_FRAME_TYPE, | 963 | NL80211_ATTR_FRAME_TYPE, |
953 | 964 | ||
965 | NL80211_ATTR_CONTROL_PORT_ETHERTYPE, | ||
966 | NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, | ||
967 | |||
954 | /* add attributes here, update the policy in nl80211.c */ | 968 | /* add attributes here, update the policy in nl80211.c */ |
955 | 969 | ||
956 | __NL80211_ATTR_AFTER_LAST, | 970 | __NL80211_ATTR_AFTER_LAST, |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index f2740537b5d6..4c8c727d0cca 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -763,6 +763,10 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); | |||
763 | * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is | 763 | * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is |
764 | * required to assume that the port is unauthorized until authorized by | 764 | * required to assume that the port is unauthorized until authorized by |
765 | * user space. Otherwise, port is marked authorized by default. | 765 | * user space. Otherwise, port is marked authorized by default. |
766 | * @control_port_ethertype: the control port protocol that should be | ||
767 | * allowed through even on unauthorized ports | ||
768 | * @control_port_no_encrypt: TRUE to prevent encryption of control port | ||
769 | * protocol frames. | ||
766 | */ | 770 | */ |
767 | struct cfg80211_crypto_settings { | 771 | struct cfg80211_crypto_settings { |
768 | u32 wpa_versions; | 772 | u32 wpa_versions; |
@@ -772,6 +776,8 @@ struct cfg80211_crypto_settings { | |||
772 | int n_akm_suites; | 776 | int n_akm_suites; |
773 | u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; | 777 | u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; |
774 | bool control_port; | 778 | bool control_port; |
779 | __be16 control_port_ethertype; | ||
780 | bool control_port_no_encrypt; | ||
775 | }; | 781 | }; |
776 | 782 | ||
777 | /** | 783 | /** |
@@ -1293,15 +1299,19 @@ struct cfg80211_ops { | |||
1293 | * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station | 1299 | * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station |
1294 | * on a VLAN interface) | 1300 | * on a VLAN interface) |
1295 | * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station | 1301 | * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station |
1302 | * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the | ||
1303 | * control port protocol ethertype. The device also honours the | ||
1304 | * control_port_no_encrypt flag. | ||
1296 | */ | 1305 | */ |
1297 | enum wiphy_flags { | 1306 | enum wiphy_flags { |
1298 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), | 1307 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), |
1299 | WIPHY_FLAG_STRICT_REGULATORY = BIT(1), | 1308 | WIPHY_FLAG_STRICT_REGULATORY = BIT(1), |
1300 | WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), | 1309 | WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), |
1301 | WIPHY_FLAG_NETNS_OK = BIT(3), | 1310 | WIPHY_FLAG_NETNS_OK = BIT(3), |
1302 | WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), | 1311 | WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), |
1303 | WIPHY_FLAG_4ADDR_AP = BIT(5), | 1312 | WIPHY_FLAG_4ADDR_AP = BIT(5), |
1304 | WIPHY_FLAG_4ADDR_STATION = BIT(6), | 1313 | WIPHY_FLAG_4ADDR_STATION = BIT(6), |
1314 | WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), | ||
1305 | }; | 1315 | }; |
1306 | 1316 | ||
1307 | struct mac_address { | 1317 | struct mac_address { |
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 | ||
3694 | static int nl80211_crypto_settings(struct genl_info *info, | 3699 | static 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: |