hostap: changed nas-port type to ethernet for wired-802.1X

BugzId: 78385
This commit is contained in:
Jürgen Henke 2022-02-21 15:48:15 +01:00
parent 11623c993c
commit f3eba274bb
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,49 @@
From 6cb306fef195a430642a2475d72fcc6b375acb11 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=BCrgen=20Henke?= <juergen.henke@netmodule.com>
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

View File

@ -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"