The NL80211_ATTR_USE_MFP attribute was originally added for NL80211_CMD_ASSOCIATE, but it is actually as useful (if not even more useful) with NL80211_CMD_CONNECT, so process that attribute with the connect command, too.
Unified · Split
| @@ -1465,6 +1465,7 @@ struct cfg80211_ibss_params { · 1464 unmodified lines | ||
| 1465 | 1465 | * @ie: IEs for association request |
| 1466 | 1466 | * @ie_len: Length of assoc_ie in octets |
| 1467 | 1467 | * @privacy: indicates whether privacy-enabled APs should be used |
| 1468 | + * @mfp: indicate whether management frame protection is used | |
| 1468 | 1469 | * @crypto: crypto settings |
| 1469 | 1470 | * @key_len: length of WEP key for shared key authentication |
| 1470 | 1471 | * @key_idx: index of WEP key for shared key authentication |
| @@ -1485,6 +1486,7 @@ struct cfg80211_connect_params { · 14 unmodified lines | ||
| 1485 | 1486 | u8 *ie; |
| 1486 | 1487 | size_t ie_len; |
| 1487 | 1488 | bool privacy; |
| 1489 | + enum nl80211_mfp mfp; | |
| 1488 | 1490 | struct cfg80211_crypto_settings crypto; |
| 1489 | 1491 | const u8 *key; |
| 1490 | 1492 | u8 key_len, key_idx; |
| @@ -374,8 +374,8 @@ · 373 unmodified lines | ||
| 374 | 374 | * requests to connect to a specified network but without separating |
| 375 | 375 | * auth and assoc steps. For this, you need to specify the SSID in a |
| 376 | 376 | * %NL80211_ATTR_SSID attribute, and can optionally specify the association |
| 377 | − * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_MAC, | |
| 378 | − * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, | |
| 377 | + * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_USE_MFP, | |
| 378 | + * %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, | |
| 379 | 379 | * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and |
| 380 | 380 | * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT. |
| 381 | 381 | * Background scan period can optionally be |
| @@ -958,7 +958,7 @@ enum nl80211_commands { · 576 unmodified lines | ||
| 958 | 958 | * @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is |
| 959 | 959 | * used for the association (&enum nl80211_mfp, represented as a u32); |
| 960 | 960 | * this attribute can be used |
| 961 | − * with %NL80211_CMD_ASSOCIATE request | |
| 961 | + * with %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests | |
| 962 | 962 | * |
| 963 | 963 | * @NL80211_ATTR_STA_FLAGS2: Attribute containing a |
| 964 | 964 | * &struct nl80211_sta_flag_update. |
| @@ -5932,6 +5932,15 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) · 5931 unmodified lines | ||
| 5932 | 5932 | connect.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); |
| 5933 | 5933 | } |
| 5934 | 5934 | |
| 5935 | + if (info->attrs[NL80211_ATTR_USE_MFP]) { | |
| 5936 | + connect.mfp = nla_get_u32(info->attrs[NL80211_ATTR_USE_MFP]); | |
| 5937 | + if (connect.mfp != NL80211_MFP_REQUIRED && | |
| 5938 | + connect.mfp != NL80211_MFP_NO) | |
| 5939 | + return -EINVAL; | |
| 5940 | + } else { | |
| 5941 | + connect.mfp = NL80211_MFP_NO; | |
| 5942 | + } | |
| 5943 | + | |
| 5935 | 5944 | if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { |
| 5936 | 5945 | connect.channel = |
| 5937 | 5946 | ieee80211_get_channel(wiphy, |
| @@ -192,7 +192,8 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev) · 191 unmodified lines | ||
| 192 | 192 | prev_bssid, |
| 193 | 193 | params->ssid, params->ssid_len, |
| 194 | 194 | params->ie, params->ie_len, |
| 195 | − false, ¶ms->crypto, | |
| 195 | + params->mfp != NL80211_MFP_NO, | |
| 196 | + ¶ms->crypto, | |
| 196 | 197 | params->flags, ¶ms->ht_capa, |
| 197 | 198 | ¶ms->ht_capa_mask); |
| 198 | 199 | if (err) |