From a95ee5e62e4afd255054dafa9d26f64d7e504d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Henke?= Date: Mon, 21 Feb 2022 15:48:15 +0100 Subject: [PATCH] hostap: changed nas-port type to ethernet for wired-802.1X BugzId: 78385 (cherry picked from commit f3eba274bbf5fb5882fd47bc9ad86a91a1b057e3) --- ...-port-type-ethernet-for-wired-802.1X.patch | 49 +++++++++++++++++++ recipes-connectivity/hostapd/hostapd.inc | 1 + 2 files changed, 50 insertions(+) create mode 100644 recipes-connectivity/hostapd/files/0001-use-nas-port-type-ethernet-for-wired-802.1X.patch diff --git a/recipes-connectivity/hostapd/files/0001-use-nas-port-type-ethernet-for-wired-802.1X.patch b/recipes-connectivity/hostapd/files/0001-use-nas-port-type-ethernet-for-wired-802.1X.patch new file mode 100644 index 0000000..fce9090 --- /dev/null +++ b/recipes-connectivity/hostapd/files/0001-use-nas-port-type-ethernet-for-wired-802.1X.patch @@ -0,0 +1,49 @@ +From 6cb306fef195a430642a2475d72fcc6b375acb11 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=BCrgen=20Henke?= +Date: Mon, 21 Feb 2022 15:40:04 +0100 +Subject: [PATCH] use nas-port-type ethernet for wired 802.1X + +- if the driver is "wired", use nas-port type "ethernet", otherwise + use "wirless-802.1X" as before. + +BugzId: 78385 +--- + src/ap/ieee802_1x.c | 9 +++++++-- + src/radius/radius.h | 1 + + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c +index 9ee99cff3..8a012a9e4 100644 +--- a/src/ap/ieee802_1x.c ++++ b/src/ap/ieee802_1x.c +@@ -578,11 +578,16 @@ int add_common_radius_attr(struct hostapd_data *hapd, + return -1; + } + ++ int32_t nas_port_type = RADIUS_NAS_PORT_TYPE_IEEE_802_11; ++ if (os_strcmp(hapd->driver->name,"wired") == 0) { ++ // wired ports need a different port type: ++ nas_port_type = RADIUS_NAS_PORT_TYPE_ETHERNET; ++ } + if (!hostapd_config_get_radius_attr(req_attr, + RADIUS_ATTR_NAS_PORT_TYPE) && + !radius_msg_add_attr_int32(msg, RADIUS_ATTR_NAS_PORT_TYPE, +- RADIUS_NAS_PORT_TYPE_IEEE_802_11)) { +- wpa_printf(MSG_ERROR, "Could not add NAS-Port-Type"); ++ nas_port_type)) { ++ wpa_printf(MSG_ERROR, "Could not add NAS-Port-Type (%i)", nas_port_type); + return -1; + } + +diff --git a/src/radius/radius.h b/src/radius/radius.h +index 630c0f9d0..a6056d8bd 100644 +--- a/src/radius/radius.h ++++ b/src/radius/radius.h +@@ -125,6 +125,7 @@ enum { RADIUS_ATTR_USER_NAME = 1, + + /* NAS-Port-Type */ + #define RADIUS_NAS_PORT_TYPE_IEEE_802_11 19 ++#define RADIUS_NAS_PORT_TYPE_ETHERNET 15 + + /* Acct-Status-Type */ + #define RADIUS_ACCT_STATUS_TYPE_START 1 diff --git a/recipes-connectivity/hostapd/hostapd.inc b/recipes-connectivity/hostapd/hostapd.inc index 7579cf1..77c8819 100644 --- a/recipes-connectivity/hostapd/hostapd.inc +++ b/recipes-connectivity/hostapd/hostapd.inc @@ -81,6 +81,7 @@ SRC_URI = "git://w1.fi/hostap.git;protocol=http;branch=main \ file://913-iapp-improvements.patch \ file://914-wlan-acs-srd-channels.patch \ file://0001-fix-create-a-versioned-shared-library-libwlan_client.patch \ + file://0001-use-nas-port-type-ethernet-for-wired-802.1X.patch \ " SRCREV = "5a8b366233f5585e68a4ffbb604fbb4a848eb325"