diff mbox series

[5/7] Add default_radius_vlan in sta_info

Message ID 20211011112437.178673-6-jeltz+hostap@auro.re
State Changes Requested
Headers show
Series Support for multiple RADIUS Tunnel-* attributes | expand

Commit Message

Tom Barthe Oct. 11, 2021, 11:24 a.m. UTC
Used to store the vlan_description corresponding to RADIUS tag 0.

Signed-off-by: Tom Barthe <jeltz+hostap@auro.re>
---
 src/ap/ieee802_11.c | 15 +--------------
 src/ap/sta_info.h   |  3 ++-
 2 files changed, 3 insertions(+), 15 deletions(-)

Comments

Jouni Malinen Nov. 3, 2021, 9:28 p.m. UTC | #1
On Mon, Oct 11, 2021 at 01:24:35PM +0200, Tom Barthe wrote:
> Used to store the vlan_description corresponding to RADIUS tag 0.

> diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h
> @@ -200,8 +200,9 @@ struct sta_info {
>  	struct hostapd_sta_wpa_psk_short *psk;
> +	struct vlan_description default_radius_vlan;

This would increase the size of struct sta_info by 34*sizeof(int)
unconditionally for all cases regardless of whether this
RADIUS-controlled PSK/passphrase-to-VLAN-mapping is used. That feels a
bit excessive.. Does this really need that full data structure to be
stored? Maybe a better way of doing this would be to introduce a new
data structure that would hold both of those two members here and that
data structure would be allocated conditionally only when the
RADIUS-based design is used.
diff mbox series

Patch

diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 71fbefc8e..7229011b7 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -2326,20 +2326,7 @@  ieee802_11_set_radius_info(struct hostapd_data *hapd, struct sta_info *sta,
 	char *identity = info->identity;
 	char *radius_cui = info->radius_cui;
 
-	if (vlan_id->notempty &&
-	    !hostapd_vlan_valid(hapd->conf->vlan, vlan_id)) {
-		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS,
-			       HOSTAPD_LEVEL_INFO,
-			       "Invalid VLAN %d%s received from RADIUS server",
-			       vlan_id->untagged,
-			       vlan_id->tagged[0] ? "+" : "");
-		return -1;
-	}
-	if (ap_sta_set_vlan(hapd, sta, vlan_id) < 0)
-		return -1;
-	if (sta->vlan_id)
-		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS,
-			       HOSTAPD_LEVEL_INFO, "VLAN ID %d", sta->vlan_id);
+	sta->default_radius_vlan = *vlan_id;
 
 	hostapd_free_psk_list(sta->psk);
 	if (hapd->conf->wpa_psk_radius != PSK_RADIUS_IGNORED)
diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h
index 27e72f9a0..fc165f5d5 100644
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -200,8 +200,9 @@  struct sta_info {
 	int vlan_id; /* 0: none, >0: VID */
 	struct vlan_description *vlan_desc;
 	int vlan_id_bound; /* updated by ap_sta_bind_vlan() */
-	 /* PSKs from RADIUS authentication server */
+	/* PSKs from RADIUS authentication server */
 	struct hostapd_sta_wpa_psk_short *psk;
+	struct vlan_description default_radius_vlan;
 
 	char *identity; /* User-Name from RADIUS */
 	char *radius_cui; /* Chargeable-User-Identity from RADIUS */