Files
wlan-ap/feeds/qca-wifi-7/hostapd/patches/r00-003-hostapd-fix-own-address-assignment-during-setup-of-f.patch
John Crispin 68cf54d9f7 qca-wifi-7: update to ath12.5.5
Signed-off-by: John Crispin <john@phrozen.org>
2025-02-27 12:45:52 +01:00

55 lines
1.9 KiB
Diff

From 183fe898dff0acf05ff48e66d9bfb738a33b5c4b Mon Sep 17 00:00:00 2001
From: Aditya Kumar Singh <quic_adisi@quicinc.com>
Date: Thu, 26 Oct 2023 10:03:38 +0530
Subject: [PATCH] hostapd: fix own address assignment during setup of first
link BSS
Currently during setting of first link of BSS in MLD, own address was set
as a random BSSID derived from the actual interface address even if the
BSSID config was passed. This is wrong and it should instead use the
config value if provided. If not then it can use a random value.
Add changes to check and assign a random value only if config is not
passed. If config is passed, use the same value.
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
hostapd/main.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -209,7 +209,7 @@ static int hostapd_driver_init(struct ho
hapd->setup_complete_cb = hostapd_setup_complete_cb;
/* Initialize the driver interface */
- if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
+ if (is_zero_ether_addr(b))
b = NULL;
os_memset(&params, 0, sizeof(params));
@@ -268,7 +268,12 @@ static int hostapd_driver_init(struct ho
*/
if (hapd->conf->mld_ap) {
os_memcpy(hapd->mld->mld_addr, hapd->own_addr, ETH_ALEN);
- random_mac_addr_keep_oui(hapd->own_addr);
+
+ if (!b)
+ random_mac_addr_keep_oui(hapd->own_addr);
+ else
+ os_memcpy(hapd->own_addr, b, ETH_ALEN);
+
hapd->mld_link_id = hapd->mld->next_link_id++;
hostapd_mld_add_link(hapd);
wpa_printf(MSG_DEBUG, "Setup of first link (link %d) BSS of MLD %s",
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1389,7 +1389,6 @@ static int hostapd_setup_bss(struct host
wpa_printf(MSG_DEBUG, "TSetup of first link BSS of MLD %s",
hapd->conf->iface);
os_memcpy(hapd->mld->mld_addr, hapd->own_addr, ETH_ALEN);
- random_mac_addr_keep_oui(hapd->own_addr);
hapd->mld_link_id = hapd->mld->next_link_id++;
hostapd_mld_add_link(hapd);
}