mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-21 11:22:50 +00:00
Some checks failed
Build OpenWrt/uCentral images / build (cig_wf186h) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf186w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf188n) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf189) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf196) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-a1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-b1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap102) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap104) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap105) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap111) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap112) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_3) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xe) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (indio_um-305ax) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sercomm_ap72tip) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630c-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-211g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-id2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-od2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr5018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018-v4) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax820) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax840) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap640) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap650) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap655) (push) Has been cancelled
Build OpenWrt/uCentral images / trigger-testing (push) Has been cancelled
Build OpenWrt/uCentral images / create-x64_vm-ami (push) Has been cancelled
Signed-off-by: John Crispin <john@phrozen.org>
328 lines
10 KiB
Diff
328 lines
10 KiB
Diff
From 1eb38cda52ae95be1f67274e296a8d4a4d38acce Mon Sep 17 00:00:00 2001
|
|
From: Sriram R <quic_srirrama@quicinc.com>
|
|
Date: Fri, 10 Nov 2023 16:46:52 +0530
|
|
Subject: [PATCH] hostapd: mlo vlan changes
|
|
|
|
- use MLD addr for new VLAN interface
|
|
- for MLD, access VLAN list from list head of Link BSS for that MLD
|
|
|
|
Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
|
|
Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
|
|
---
|
|
src/ap/ap_drv_ops.c | 9 ++++-
|
|
src/ap/ieee802_11.c | 1 +
|
|
src/ap/sta_info.c | 77 +++++++++++++++++++++++++++++++-----------
|
|
src/ap/vlan_full.c | 26 ++++++++++++--
|
|
src/ap/wpa_auth_glue.c | 10 +++++-
|
|
5 files changed, 100 insertions(+), 23 deletions(-)
|
|
|
|
--- a/src/ap/ap_drv_ops.c
|
|
+++ b/src/ap/ap_drv_ops.c
|
|
@@ -328,7 +328,14 @@ int hostapd_vlan_if_add(struct hostapd_d
|
|
{
|
|
char force_ifname[IFNAMSIZ];
|
|
u8 if_addr[ETH_ALEN];
|
|
- return hostapd_if_add(hapd, WPA_IF_AP_VLAN, ifname, hapd->own_addr,
|
|
+ u8 *addr;
|
|
+
|
|
+ if (hapd->conf->mld_ap)
|
|
+ addr = hapd->mld->mld_addr;
|
|
+ else
|
|
+ addr = hapd->own_addr;
|
|
+
|
|
+ return hostapd_if_add(hapd, WPA_IF_AP_VLAN, ifname, addr,
|
|
NULL, NULL, force_ifname, if_addr, NULL, 0);
|
|
}
|
|
|
|
--- a/src/ap/ieee802_11.c
|
|
+++ b/src/ap/ieee802_11.c
|
|
@@ -4503,6 +4503,7 @@ static void ieee80211_ml_process_link(st
|
|
link->rsnxe = hostapd_wpa_ie(hapd, WLAN_EID_RSNX);
|
|
|
|
sta->flags |= WLAN_STA_AUTH | WLAN_STA_ASSOC_REQ_OK;
|
|
+ sta->vlan_id = origin_sta->vlan_id;
|
|
|
|
/* TODO: What other processing is required? */
|
|
|
|
--- a/src/ap/sta_info.c
|
|
+++ b/src/ap/sta_info.c
|
|
@@ -189,6 +189,7 @@ void ap_free_sta_pasn(struct hostapd_dat
|
|
|
|
void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
|
|
{
|
|
+ struct hostapd_data *vlan_bss = hapd;
|
|
int set_beacon = 0;
|
|
|
|
accounting_sta_stop(hapd, sta);
|
|
@@ -325,13 +326,20 @@ void ap_free_sta(struct hostapd_data *ha
|
|
#endif /* CONFIG_NO_RADIUS */
|
|
|
|
#ifndef CONFIG_NO_VLAN
|
|
+#ifdef CONFIG_IEEE80211BE
|
|
+ if (hapd->conf->mld_ap) {
|
|
+ vlan_bss = hostapd_mld_get_first_bss(hapd);
|
|
+ if (vlan_bss == NULL)
|
|
+ vlan_bss = hapd;
|
|
+ }
|
|
+#endif
|
|
/*
|
|
* sta->wpa_sm->group needs to be released before so that
|
|
* vlan_remove_dynamic() can check that no stations are left on the
|
|
* AP_VLAN netdev.
|
|
*/
|
|
if (sta->vlan_id)
|
|
- vlan_remove_dynamic(hapd, sta->vlan_id);
|
|
+ vlan_remove_dynamic(vlan_bss, sta->vlan_id);
|
|
if (sta->vlan_id_bound) {
|
|
/*
|
|
* Need to remove the STA entry before potentially removing the
|
|
@@ -342,10 +350,10 @@ void ap_free_sta(struct hostapd_data *ha
|
|
hostapd_drv_sta_remove(hapd, sta->addr);
|
|
sta->added_unassoc = 0;
|
|
}
|
|
- vlan_remove_dynamic(hapd, sta->vlan_id_bound);
|
|
+ vlan_remove_dynamic(vlan_bss, sta->vlan_id_bound);
|
|
}
|
|
#endif /* CONFIG_NO_VLAN */
|
|
-
|
|
+free:
|
|
os_free(sta->challenge);
|
|
|
|
os_free(sta->sa_query_trans_id);
|
|
@@ -1000,10 +1008,19 @@ int ap_sta_wps_cancel(struct hostapd_dat
|
|
static int ap_sta_get_free_vlan_id(struct hostapd_data *hapd)
|
|
{
|
|
struct hostapd_vlan *vlan;
|
|
+ struct hostapd_data *vlan_bss = hapd;
|
|
int vlan_id = MAX_VLAN_ID + 2;
|
|
|
|
+#ifdef CONFIG_IEEE80211BE
|
|
+ if(hapd->conf->mld_ap) {
|
|
+ vlan_bss = hostapd_mld_get_first_bss(hapd);
|
|
+ if (vlan_bss == NULL)
|
|
+ vlan_bss = hapd;
|
|
+ }
|
|
+#endif
|
|
+
|
|
retry:
|
|
- for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) {
|
|
+ for (vlan = vlan_bss->conf->vlan; vlan; vlan = vlan->next) {
|
|
if (vlan->vlan_id == vlan_id) {
|
|
vlan_id++;
|
|
goto retry;
|
|
@@ -1018,6 +1035,15 @@ int ap_sta_set_vlan(struct hostapd_data
|
|
{
|
|
struct hostapd_vlan *vlan = NULL, *wildcard_vlan = NULL;
|
|
int old_vlan_id, vlan_id = 0, ret = 0;
|
|
+ struct hostapd_data *vlan_bss = hapd;
|
|
+
|
|
+#ifdef CONFIG_IEEE80211BE
|
|
+ if(hapd->conf->mld_ap) {
|
|
+ vlan_bss = hostapd_mld_get_first_bss(hapd);
|
|
+ if (vlan_bss == NULL)
|
|
+ vlan_bss = hapd;
|
|
+ }
|
|
+#endif
|
|
|
|
/* Check if there is something to do */
|
|
if (hapd->conf->ssid.per_sta_vif && !sta->vlan_id) {
|
|
@@ -1035,7 +1061,7 @@ int ap_sta_set_vlan(struct hostapd_data
|
|
/* find a free vlan_id sufficiently big */
|
|
vlan_id = ap_sta_get_free_vlan_id(hapd);
|
|
/* Get wildcard VLAN */
|
|
- for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) {
|
|
+ for (vlan = vlan_bss->conf->vlan; vlan; vlan = vlan->next) {
|
|
if (vlan->vlan_id == VLAN_ID_WILDCARD)
|
|
break;
|
|
}
|
|
@@ -1049,7 +1075,7 @@ int ap_sta_set_vlan(struct hostapd_data
|
|
goto done;
|
|
}
|
|
} else if (vlan_desc && vlan_desc->notempty) {
|
|
- for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) {
|
|
+ for (vlan = vlan_bss->conf->vlan; vlan; vlan = vlan->next) {
|
|
if (!vlan_compare(&vlan->vlan_desc, vlan_desc))
|
|
break;
|
|
if (vlan->vlan_id == VLAN_ID_WILDCARD)
|
|
@@ -1062,10 +1088,10 @@ int ap_sta_set_vlan(struct hostapd_data
|
|
vlan_id = vlan_desc->untagged;
|
|
if (vlan_desc->tagged[0]) {
|
|
/* Tagged VLAN configuration */
|
|
- vlan_id = ap_sta_get_free_vlan_id(hapd);
|
|
+ vlan_id = ap_sta_get_free_vlan_id(vlan_bss);
|
|
}
|
|
} else {
|
|
- hostapd_logger(hapd, sta->addr,
|
|
+ hostapd_logger(vlan_bss, sta->addr,
|
|
HOSTAPD_MODULE_IEEE80211,
|
|
HOSTAPD_LEVEL_DEBUG,
|
|
"missing vlan and wildcard for vlan=%d%s",
|
|
@@ -1078,9 +1104,9 @@ int ap_sta_set_vlan(struct hostapd_data
|
|
}
|
|
|
|
if (vlan && vlan->vlan_id == VLAN_ID_WILDCARD) {
|
|
- vlan = vlan_add_dynamic(hapd, vlan, vlan_id, vlan_desc);
|
|
+ vlan = vlan_add_dynamic(vlan_bss, vlan, vlan_id, vlan_desc);
|
|
if (vlan == NULL) {
|
|
- hostapd_logger(hapd, sta->addr,
|
|
+ hostapd_logger(vlan_bss, sta->addr,
|
|
HOSTAPD_MODULE_IEEE80211,
|
|
HOSTAPD_LEVEL_DEBUG,
|
|
"could not add dynamic VLAN interface for vlan=%d%s",
|
|
@@ -1092,13 +1118,13 @@ int ap_sta_set_vlan(struct hostapd_data
|
|
goto done;
|
|
}
|
|
|
|
- hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
|
|
+ hostapd_logger(vlan_bss, sta->addr, HOSTAPD_MODULE_IEEE80211,
|
|
HOSTAPD_LEVEL_DEBUG,
|
|
"added new dynamic VLAN interface '%s'",
|
|
vlan->ifname);
|
|
} else if (vlan && vlan->dynamic_vlan > 0) {
|
|
vlan->dynamic_vlan++;
|
|
- hostapd_logger(hapd, sta->addr,
|
|
+ hostapd_logger(vlan_bss, sta->addr,
|
|
HOSTAPD_MODULE_IEEE80211,
|
|
HOSTAPD_LEVEL_DEBUG,
|
|
"updated existing dynamic VLAN interface '%s'",
|
|
@@ -1110,7 +1136,7 @@ done:
|
|
sta->vlan_desc = vlan ? &vlan->vlan_desc : NULL;
|
|
|
|
if (vlan_id != old_vlan_id && old_vlan_id)
|
|
- vlan_remove_dynamic(hapd, old_vlan_id);
|
|
+ vlan_remove_dynamic(vlan_bss, old_vlan_id);
|
|
|
|
return ret;
|
|
}
|
|
@@ -1121,13 +1147,18 @@ int ap_sta_bind_vlan(struct hostapd_data
|
|
#ifndef CONFIG_NO_VLAN
|
|
const char *iface;
|
|
struct hostapd_vlan *vlan = NULL;
|
|
+ struct hostapd_data *vlan_bss = hapd;
|
|
int ret;
|
|
int old_vlanid = sta->vlan_id_bound;
|
|
int mld_link_id = -1;
|
|
|
|
#ifdef CONFIG_IEEE80211BE
|
|
- if (hapd->conf->mld_ap)
|
|
+ if (hapd->conf->mld_ap) {
|
|
mld_link_id = hapd->mld_link_id;
|
|
+ vlan_bss = hostapd_mld_get_first_bss(hapd);
|
|
+ if (vlan_bss == NULL)
|
|
+ vlan_bss = hapd;
|
|
+ }
|
|
#endif /* CONFIG_IEEE80211BE */
|
|
|
|
if ((sta->flags & WLAN_STA_WDS) && sta->vlan_id == 0) {
|
|
@@ -1142,7 +1173,7 @@ int ap_sta_bind_vlan(struct hostapd_data
|
|
iface = hapd->conf->ssid.vlan;
|
|
|
|
if (sta->vlan_id > 0) {
|
|
- for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) {
|
|
+ for (vlan = vlan_bss->conf->vlan; vlan; vlan = vlan->next) {
|
|
if (vlan->vlan_id == sta->vlan_id)
|
|
break;
|
|
}
|
|
@@ -1159,7 +1190,7 @@ int ap_sta_bind_vlan(struct hostapd_data
|
|
goto skip_counting;
|
|
|
|
if (sta->vlan_id > 0 && !vlan) {
|
|
- hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
|
|
+ hostapd_logger(vlan_bss, sta->addr, HOSTAPD_MODULE_IEEE80211,
|
|
HOSTAPD_LEVEL_DEBUG, "could not find VLAN for "
|
|
"binding station to (vlan_id=%d)",
|
|
sta->vlan_id);
|
|
@@ -1167,7 +1198,7 @@ int ap_sta_bind_vlan(struct hostapd_data
|
|
goto done;
|
|
} else if (vlan && vlan->dynamic_vlan > 0) {
|
|
vlan->dynamic_vlan++;
|
|
- hostapd_logger(hapd, sta->addr,
|
|
+ hostapd_logger(vlan_bss, sta->addr,
|
|
HOSTAPD_MODULE_IEEE80211,
|
|
HOSTAPD_LEVEL_DEBUG,
|
|
"updated existing dynamic VLAN interface '%s'",
|
|
@@ -1178,7 +1209,7 @@ int ap_sta_bind_vlan(struct hostapd_data
|
|
sta->vlan_id_bound = sta->vlan_id;
|
|
|
|
skip_counting:
|
|
- hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
|
|
+ hostapd_logger(vlan_bss, sta->addr, HOSTAPD_MODULE_IEEE80211,
|
|
HOSTAPD_LEVEL_DEBUG, "binding station to interface "
|
|
"'%s'", iface);
|
|
|
|
@@ -1195,7 +1226,7 @@ skip_counting:
|
|
|
|
/* During 1x reauth, if the vlan id changes, then remove the old id. */
|
|
if (old_vlanid > 0 && old_vlanid != sta->vlan_id)
|
|
- vlan_remove_dynamic(hapd, old_vlanid);
|
|
+ vlan_remove_dynamic(vlan_bss, old_vlanid);
|
|
done:
|
|
|
|
return ret;
|
|
--- a/src/ap/vlan_full.c
|
|
+++ b/src/ap/vlan_full.c
|
|
@@ -463,10 +463,18 @@ void vlan_newlink(const char *ifname, st
|
|
char br_name[IFNAMSIZ];
|
|
struct hostapd_vlan *vlan;
|
|
int untagged, *tagged, i, notempty;
|
|
+ struct hostapd_data *vlan_bss = hapd;
|
|
|
|
wpa_printf(MSG_DEBUG, "VLAN: vlan_newlink(%s)", ifname);
|
|
|
|
- for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) {
|
|
+#ifdef CONFIG_IEEE80211BE
|
|
+ if (hapd->conf->mld_ap) {
|
|
+ vlan_bss = hostapd_mld_get_first_bss(hapd);
|
|
+ if (vlan_bss == NULL)
|
|
+ vlan_bss = hapd;
|
|
+ }
|
|
+#endif
|
|
+ for (vlan = vlan_bss->conf->vlan; vlan; vlan = vlan->next) {
|
|
if (vlan->configured ||
|
|
os_strcmp(ifname, vlan->ifname) != 0)
|
|
continue;
|
|
@@ -567,10 +575,20 @@ static void vlan_put_bridge(const char *
|
|
|
|
void vlan_dellink(const char *ifname, struct hostapd_data *hapd)
|
|
{
|
|
- struct hostapd_vlan *first, *prev, *vlan = hapd->conf->vlan;
|
|
+ struct hostapd_vlan *first, *prev, *vlan;
|
|
+ struct hostapd_data *vlan_bss = hapd;
|
|
|
|
wpa_printf(MSG_DEBUG, "VLAN: vlan_dellink(%s)", ifname);
|
|
|
|
+#ifdef CONFIG_IEEE80211BE
|
|
+ if (hapd->conf->mld_ap) {
|
|
+ vlan_bss = hostapd_mld_get_first_bss(hapd);
|
|
+ if (vlan_bss == NULL)
|
|
+ vlan_bss = hapd;
|
|
+ }
|
|
+#endif
|
|
+
|
|
+ vlan = vlan_bss->conf->vlan;
|
|
first = prev = vlan;
|
|
|
|
while (vlan) {
|
|
--- a/src/ap/wpa_auth_glue.c
|
|
+++ b/src/ap/wpa_auth_glue.c
|
|
@@ -450,10 +450,18 @@ static int hostapd_wpa_auth_set_key(void
|
|
size_t key_len, enum key_flag key_flag)
|
|
{
|
|
struct hostapd_data *hapd = ctx;
|
|
+ struct hostapd_data *link_bss = hapd;
|
|
const char *ifname = hapd->conf->iface;
|
|
|
|
+#ifdef CONFIG_IEEE80211BE
|
|
+ if (hapd->conf->mld_ap) {
|
|
+ link_bss = hostapd_mld_get_first_bss(hapd);
|
|
+ if (link_bss == NULL)
|
|
+ link_bss = hapd;
|
|
+ }
|
|
+#endif
|
|
if (vlan_id > 0) {
|
|
- ifname = hostapd_get_vlan_id_ifname(hapd->conf->vlan, vlan_id);
|
|
+ ifname = hostapd_get_vlan_id_ifname(link_bss->conf->vlan, vlan_id);
|
|
if (!ifname)
|
|
return -1;
|
|
}
|