Wi-Fi Aware R4 specification defines NAN Pairing which uses PASN handshake to authenticate the peer and generate keys. Hence allow to register and transmit the PASN authentication frames on NAN interface and set the keys to driver or underlying modules on NAN interface. The driver needs to configure the feature flag NL80211_EXT_FEATURE_SECURE_NAN, which also helps userspace modules to know if the driver supports secure NAN.
Unified · Split
| @@ -6323,6 +6323,9 @@ enum nl80211_feature_flags { · 6322 unmodified lines | ||
| 6323 | 6323 | * |
| 6324 | 6324 | * @NL80211_EXT_FEATURE_PUNCT: Driver supports preamble puncturing in AP mode. |
| 6325 | 6325 | * |
| 6326 | + * @NL80211_EXT_FEATURE_SECURE_NAN: Device supports NAN Pairing which enables | |
| 6327 | + * authentication, data encryption and message integrity. | |
| 6328 | + * | |
| 6326 | 6329 | * @NUM_NL80211_EXT_FEATURES: number of extended features. |
| 6327 | 6330 | * @MAX_NL80211_EXT_FEATURES: highest extended feature index. |
| 6328 | 6331 | */ |
| @@ -6392,6 +6395,7 @@ enum nl80211_ext_feature_index { · 63 unmodified lines | ||
| 6392 | 6395 | NL80211_EXT_FEATURE_RADAR_BACKGROUND, |
| 6393 | 6396 | NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE, |
| 6394 | 6397 | NL80211_EXT_FEATURE_PUNCT, |
| 6398 | + NL80211_EXT_FEATURE_SECURE_NAN, | |
| 6395 | 6399 | |
| 6396 | 6400 | /* add new features before the definition below */ |
| 6397 | 6401 | NUM_NL80211_EXT_FEATURES, |
| @@ -1549,10 +1549,14 @@ static int nl80211_key_allowed(struct wireless_dev *wdev) · 1548 unmodified lines | ||
| 1549 | 1549 | if (wdev->connected) |
| 1550 | 1550 | return 0; |
| 1551 | 1551 | return -ENOLINK; |
| 1552 | + case NL80211_IFTYPE_NAN: | |
| 1553 | + if (wiphy_ext_feature_isset(wdev->wiphy, | |
| 1554 | + NL80211_EXT_FEATURE_SECURE_NAN)) | |
| 1555 | + return 0; | |
| 1556 | + return -EINVAL; | |
| 1552 | 1557 | case NL80211_IFTYPE_UNSPECIFIED: |
| 1553 | 1558 | case NL80211_IFTYPE_OCB: |
| 1554 | 1559 | case NL80211_IFTYPE_MONITOR: |
| 1555 | − case NL80211_IFTYPE_NAN: | |
| 1556 | 1560 | case NL80211_IFTYPE_P2P_DEVICE: |
| 1557 | 1561 | case NL80211_IFTYPE_WDS: |
| 1558 | 1562 | case NUM_NL80211_IFTYPES: |
| @@ -12342,6 +12346,10 @@ static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info) · 10783 unmodified lines | ||
| 12342 | 12346 | case NL80211_IFTYPE_P2P_DEVICE: |
| 12343 | 12347 | break; |
| 12344 | 12348 | case NL80211_IFTYPE_NAN: |
| 12349 | + if (!wiphy_ext_feature_isset(wdev->wiphy, | |
| 12350 | + NL80211_EXT_FEATURE_SECURE_NAN)) | |
| 12351 | + return -EOPNOTSUPP; | |
| 12352 | + break; | |
| 12345 | 12353 | default: |
| 12346 | 12354 | return -EOPNOTSUPP; |
| 12347 | 12355 | } |
| @@ -12399,6 +12407,10 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) · 51 unmodified lines | ||
| 12399 | 12407 | case NL80211_IFTYPE_P2P_GO: |
| 12400 | 12408 | break; |
| 12401 | 12409 | case NL80211_IFTYPE_NAN: |
| 12410 | + if (!wiphy_ext_feature_isset(wdev->wiphy, | |
| 12411 | + NL80211_EXT_FEATURE_SECURE_NAN)) | |
| 12412 | + return -EOPNOTSUPP; | |
| 12413 | + break; | |
| 12402 | 12414 | default: |
| 12403 | 12415 | return -EOPNOTSUPP; |
| 12404 | 12416 | } |
| @@ -12536,6 +12548,10 @@ static int nl80211_tx_mgmt_cancel_wait(struct sk_buff *skb, struct genl_info *in · 131 unmodified lines | ||
| 12536 | 12548 | case NL80211_IFTYPE_P2P_DEVICE: |
| 12537 | 12549 | break; |
| 12538 | 12550 | case NL80211_IFTYPE_NAN: |
| 12551 | + if (!wiphy_ext_feature_isset(wdev->wiphy, | |
| 12552 | + NL80211_EXT_FEATURE_SECURE_NAN)) | |
| 12553 | + return -EOPNOTSUPP; | |
| 12554 | + break; | |
| 12539 | 12555 | default: |
| 12540 | 12556 | return -EOPNOTSUPP; |
| 12541 | 12557 | } |