From 932546ac285744802f04b10bb091792b3fbf646e Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 19 Apr 2020 12:30:55 +0300 Subject: [PATCH] nl80211: Add a separate driver capability for control port RX This is needed since the initial implementation of the control port mechanism in the kernel mixed in RSN pre-authentication ethertype unconditionally (and IMHO, incorrectly) into the control port. Signed-off-by: Jouni Malinen --- src/drivers/driver.h | 4 +++- src/drivers/driver_common.c | 1 + src/drivers/driver_nl80211.c | 4 +++- src/drivers/driver_nl80211_capa.c | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index e01f26c12..019a1081e 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1838,7 +1838,7 @@ struct wpa_driver_capa { #define WPA_DRIVER_FLAGS_FTM_RESPONDER 0x0100000000000000ULL /** Driver support 4-way handshake offload for WPA-Personal */ #define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_PSK 0x0200000000000000ULL -/** Driver supports a separate control port for EAPOL frames */ +/** Driver supports a separate control port TX for EAPOL frames */ #define WPA_DRIVER_FLAGS_CONTROL_PORT 0x0400000000000000ULL /** Driver supports VLAN offload */ #define WPA_DRIVER_FLAGS_VLAN_OFFLOAD 0x0800000000000000ULL @@ -1852,6 +1852,8 @@ struct wpa_driver_capa { #define WPA_DRIVER_FLAGS_EXTENDED_KEY_ID 0x8000000000000000ULL u64 flags; +/** Driver supports a separate control port RX for EAPOL frames */ +#define WPA_DRIVER_FLAGS2_CONTROL_PORT_RX 0x0000000000000001ULL u64 flags2; #define FULL_AP_CLIENT_STATE_SUPP(drv_flags) \ diff --git a/src/drivers/driver_common.c b/src/drivers/driver_common.c index c62cf51e3..23a6a4293 100644 --- a/src/drivers/driver_common.c +++ b/src/drivers/driver_common.c @@ -327,6 +327,7 @@ const char * driver_flag2_to_string(u64 flag2) { #define DF2S(x) case WPA_DRIVER_FLAGS2_ ## x: return #x switch (flag2) { + DF2S(CONTROL_PORT_RX); } return "UNKNOWN"; #undef DF2S diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 21f5000b0..3364054f8 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -8124,8 +8124,10 @@ static int nl80211_set_param(void *priv, const char *param) drv->test_use_roc_tx = 1; } - if (os_strstr(param, "control_port=0")) + if (os_strstr(param, "control_port=0")) { drv->capa.flags &= ~WPA_DRIVER_FLAGS_CONTROL_PORT; + drv->capa.flags2 &= ~WPA_DRIVER_FLAGS2_CONTROL_PORT_RX; + } if (os_strstr(param, "full_ap_client_state=0")) drv->capa.flags &= ~WPA_DRIVER_FLAGS_FULL_AP_CLIENT_STATE; diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index b4fed9ea8..f0335912c 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -441,6 +441,9 @@ static void wiphy_info_ext_feature_flags(struct wiphy_info_data *info, if (ext_feature_isset(ext_features, len, NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211)) capa->flags |= WPA_DRIVER_FLAGS_CONTROL_PORT; + if (ext_feature_isset(ext_features, len, + NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH)) + capa->flags2 |= WPA_DRIVER_FLAGS2_CONTROL_PORT_RX; if (ext_feature_isset(ext_features, len, NL80211_EXT_FEATURE_VLAN_OFFLOAD))