forked from mirrors/linux
		
	nl80211: Add CONTROL_PORT_OVER_NL80211 attribute
Signed-off-by: Denis Kenzior <denkenz@gmail.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
		
							parent
							
								
									2576a9ace4
								
							
						
					
					
						commit
						64bf3d4bc2
					
				
					 3 changed files with 42 additions and 1 deletions
				
			
		| 
						 | 
					@ -647,6 +647,8 @@ struct survey_info {
 | 
				
			||||||
 *	allowed through even on unauthorized ports
 | 
					 *	allowed through even on unauthorized ports
 | 
				
			||||||
 * @control_port_no_encrypt: TRUE to prevent encryption of control port
 | 
					 * @control_port_no_encrypt: TRUE to prevent encryption of control port
 | 
				
			||||||
 *	protocol frames.
 | 
					 *	protocol frames.
 | 
				
			||||||
 | 
					 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
 | 
				
			||||||
 | 
					 *	port frames over NL80211 instead of the network interface.
 | 
				
			||||||
 * @wep_keys: static WEP keys, if not NULL points to an array of
 | 
					 * @wep_keys: static WEP keys, if not NULL points to an array of
 | 
				
			||||||
 *	CFG80211_MAX_WEP_KEYS WEP keys
 | 
					 *	CFG80211_MAX_WEP_KEYS WEP keys
 | 
				
			||||||
 * @wep_tx_key: key index (0..3) of the default TX static WEP key
 | 
					 * @wep_tx_key: key index (0..3) of the default TX static WEP key
 | 
				
			||||||
| 
						 | 
					@ -662,6 +664,7 @@ struct cfg80211_crypto_settings {
 | 
				
			||||||
	bool control_port;
 | 
						bool control_port;
 | 
				
			||||||
	__be16 control_port_ethertype;
 | 
						__be16 control_port_ethertype;
 | 
				
			||||||
	bool control_port_no_encrypt;
 | 
						bool control_port_no_encrypt;
 | 
				
			||||||
 | 
						bool control_port_over_nl80211;
 | 
				
			||||||
	struct key_params *wep_keys;
 | 
						struct key_params *wep_keys;
 | 
				
			||||||
	int wep_tx_key;
 | 
						int wep_tx_key;
 | 
				
			||||||
	const u8 *psk;
 | 
						const u8 *psk;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -542,7 +542,8 @@
 | 
				
			||||||
 *	IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_USE_MFP,
 | 
					 *	IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_USE_MFP,
 | 
				
			||||||
 *	%NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT,
 | 
					 *	%NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT,
 | 
				
			||||||
 *	%NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
 | 
					 *	%NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
 | 
				
			||||||
 *	%NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, %NL80211_ATTR_MAC_HINT, and
 | 
					 *	%NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT,
 | 
				
			||||||
 | 
					 *	%NL80211_ATTR_CONTROL_PORT_OVER_NL80211, %NL80211_ATTR_MAC_HINT, and
 | 
				
			||||||
 *	%NL80211_ATTR_WIPHY_FREQ_HINT.
 | 
					 *	%NL80211_ATTR_WIPHY_FREQ_HINT.
 | 
				
			||||||
 *	If included, %NL80211_ATTR_MAC and %NL80211_ATTR_WIPHY_FREQ are
 | 
					 *	If included, %NL80211_ATTR_MAC and %NL80211_ATTR_WIPHY_FREQ are
 | 
				
			||||||
 *	restrictions on BSS selection, i.e., they effectively prevent roaming
 | 
					 *	restrictions on BSS selection, i.e., they effectively prevent roaming
 | 
				
			||||||
| 
						 | 
					@ -1488,6 +1489,15 @@ enum nl80211_commands {
 | 
				
			||||||
 * @NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT: When included along with
 | 
					 * @NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT: When included along with
 | 
				
			||||||
 *	%NL80211_ATTR_CONTROL_PORT_ETHERTYPE, indicates that the custom
 | 
					 *	%NL80211_ATTR_CONTROL_PORT_ETHERTYPE, indicates that the custom
 | 
				
			||||||
 *	ethertype frames used for key negotiation must not be encrypted.
 | 
					 *	ethertype frames used for key negotiation must not be encrypted.
 | 
				
			||||||
 | 
					 * @NL80211_ATTR_CONTROL_PORT_OVER_NL80211: A flag indicating whether control
 | 
				
			||||||
 | 
					 *	port frames (e.g. of type given in %NL80211_ATTR_CONTROL_PORT_ETHERTYPE)
 | 
				
			||||||
 | 
					 *	will be sent directly to the network interface or sent via the NL80211
 | 
				
			||||||
 | 
					 *	socket.  If this attribute is missing, then legacy behavior of sending
 | 
				
			||||||
 | 
					 *	control port frames directly to the network interface is used.  If the
 | 
				
			||||||
 | 
					 *	flag is included, then control port frames are sent over NL80211 instead
 | 
				
			||||||
 | 
					 *	using %CMD_CONTROL_PORT_FRAME.  If control port routing over NL80211 is
 | 
				
			||||||
 | 
					 *	to be used then userspace must also use the %NL80211_ATTR_SOCKET_OWNER
 | 
				
			||||||
 | 
					 *	flag.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver.
 | 
					 * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver.
 | 
				
			||||||
 *	We recommend using nested, driver-specific attributes within this.
 | 
					 *	We recommend using nested, driver-specific attributes within this.
 | 
				
			||||||
| 
						 | 
					@ -2647,6 +2657,8 @@ enum nl80211_attrs {
 | 
				
			||||||
	NL80211_ATTR_NSS,
 | 
						NL80211_ATTR_NSS,
 | 
				
			||||||
	NL80211_ATTR_ACK_SIGNAL,
 | 
						NL80211_ATTR_ACK_SIGNAL,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						NL80211_ATTR_CONTROL_PORT_OVER_NL80211,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* add attributes here, update the policy in nl80211.c */
 | 
						/* add attributes here, update the policy in nl80211.c */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	__NL80211_ATTR_AFTER_LAST,
 | 
						__NL80211_ATTR_AFTER_LAST,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -287,6 +287,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
 | 
				
			||||||
	[NL80211_ATTR_CONTROL_PORT] = { .type = NLA_FLAG },
 | 
						[NL80211_ATTR_CONTROL_PORT] = { .type = NLA_FLAG },
 | 
				
			||||||
	[NL80211_ATTR_CONTROL_PORT_ETHERTYPE] = { .type = NLA_U16 },
 | 
						[NL80211_ATTR_CONTROL_PORT_ETHERTYPE] = { .type = NLA_U16 },
 | 
				
			||||||
	[NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT] = { .type = NLA_FLAG },
 | 
						[NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT] = { .type = NLA_FLAG },
 | 
				
			||||||
 | 
						[NL80211_ATTR_CONTROL_PORT_OVER_NL80211] = { .type = NLA_FLAG },
 | 
				
			||||||
	[NL80211_ATTR_PRIVACY] = { .type = NLA_FLAG },
 | 
						[NL80211_ATTR_PRIVACY] = { .type = NLA_FLAG },
 | 
				
			||||||
	[NL80211_ATTR_CIPHER_SUITE_GROUP] = { .type = NLA_U32 },
 | 
						[NL80211_ATTR_CIPHER_SUITE_GROUP] = { .type = NLA_U32 },
 | 
				
			||||||
	[NL80211_ATTR_WPA_VERSIONS] = { .type = NLA_U32 },
 | 
						[NL80211_ATTR_WPA_VERSIONS] = { .type = NLA_U32 },
 | 
				
			||||||
| 
						 | 
					@ -8211,6 +8212,22 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int validate_pae_over_nl80211(struct cfg80211_registered_device *rdev,
 | 
				
			||||||
 | 
									     struct genl_info *info)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (!info->attrs[NL80211_ATTR_SOCKET_OWNER]) {
 | 
				
			||||||
 | 
							GENL_SET_ERR_MSG(info, "SOCKET_OWNER not set");
 | 
				
			||||||
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!rdev->ops->tx_control_port ||
 | 
				
			||||||
 | 
						    !wiphy_ext_feature_isset(&rdev->wiphy,
 | 
				
			||||||
 | 
									     NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211))
 | 
				
			||||||
 | 
							return -EOPNOTSUPP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
 | 
					static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
 | 
				
			||||||
				   struct genl_info *info,
 | 
									   struct genl_info *info,
 | 
				
			||||||
				   struct cfg80211_crypto_settings *settings,
 | 
									   struct cfg80211_crypto_settings *settings,
 | 
				
			||||||
| 
						 | 
					@ -8234,6 +8251,15 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
 | 
				
			||||||
	} else
 | 
						} else
 | 
				
			||||||
		settings->control_port_ethertype = cpu_to_be16(ETH_P_PAE);
 | 
							settings->control_port_ethertype = cpu_to_be16(ETH_P_PAE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (info->attrs[NL80211_ATTR_CONTROL_PORT_OVER_NL80211]) {
 | 
				
			||||||
 | 
							int r = validate_pae_over_nl80211(rdev, info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (r < 0)
 | 
				
			||||||
 | 
								return r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							settings->control_port_over_nl80211 = true;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]) {
 | 
						if (info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]) {
 | 
				
			||||||
		void *data;
 | 
							void *data;
 | 
				
			||||||
		int len, i;
 | 
							int len, i;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue