blob: 66298fbb80c42ed4e980fdb53772cbc12a243dda [file] [log] [blame]
From be38342ebe7341c3a235e5797d1e2a792265ca17 Mon Sep 17 00:00:00 2001
From: Bo Jiao <Bo.Jiao@mediatek.com>
Date: Thu, 19 Oct 2023 13:38:11 +0800
Subject: [PATCH 59/69] mtk: hostapd: initialize i802_bss's flink->freq with
iface freq.
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
---
src/ap/ap_drv_ops.c | 6 +++---
src/ap/ap_drv_ops.h | 2 +-
src/ap/hostapd.c | 2 +-
src/drivers/driver.h | 2 +-
src/drivers/driver_nl80211.c | 4 ++--
wpa_supplicant/driver_i.h | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index c5a990691..12d0fb985 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -368,7 +368,7 @@ int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname)
char force_ifname[IFNAMSIZ];
u8 if_addr[ETH_ALEN];
return hostapd_if_add(hapd, WPA_IF_AP_VLAN, ifname, hapd->own_addr,
- NULL, NULL, force_ifname, if_addr, NULL, 0);
+ NULL, NULL, force_ifname, if_addr, NULL, 0, hapd->iface->freq);
}
@@ -560,13 +560,13 @@ int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len)
int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
const char *ifname, const u8 *addr, void *bss_ctx,
void **drv_priv, char *force_ifname, u8 *if_addr,
- const char *bridge, int use_existing)
+ const char *bridge, int use_existing, int freq)
{
if (hapd->driver == NULL || hapd->driver->if_add == NULL)
return -1;
return hapd->driver->if_add(hapd->drv_priv, type, ifname, addr,
bss_ctx, drv_priv, force_ifname, if_addr,
- bridge, use_existing, 1);
+ bridge, use_existing, 1, freq);
}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
index 0c29f90a8..6a97b0203 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -56,7 +56,7 @@ int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len);
int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
const char *ifname, const u8 *addr, void *bss_ctx,
void **drv_priv, char *force_ifname, u8 *if_addr,
- const char *bridge, int use_existing);
+ const char *bridge, int use_existing, int freq);
int hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type,
const char *ifname);
int hostapd_set_ieee8021x(struct hostapd_data *hapd,
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 627c9ba6e..b85525c28 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1386,7 +1386,7 @@ int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon)
conf->iface, addr, hapd,
&hapd->drv_priv, force_ifname, if_addr,
conf->bridge[0] ? conf->bridge : NULL,
- first == -1)) {
+ first == -1, hapd->iface->freq)) {
wpa_printf(MSG_ERROR, "Failed to add BSS (BSSID="
MACSTR ")", MAC2STR(hapd->own_addr));
hapd->interface_added = 0;
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index a657f3285..dbe32517e 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -3864,7 +3864,7 @@ struct wpa_driver_ops {
int (*if_add)(void *priv, enum wpa_driver_if_type type,
const char *ifname, const u8 *addr, void *bss_ctx,
void **drv_priv, char *force_ifname, u8 *if_addr,
- const char *bridge, int use_existing, int setup_ap);
+ const char *bridge, int use_existing, int setup_ap, int freq);
/**
* if_remove - Remove a virtual interface
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index c0bbd92a7..17774cce0 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -8865,7 +8865,7 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
void *bss_ctx, void **drv_priv,
char *force_ifname, u8 *if_addr,
const char *bridge, int use_existing,
- int setup_ap)
+ int setup_ap, int freq)
{
enum nl80211_iftype nlmode;
struct i802_bss *bss = priv;
@@ -8985,7 +8985,7 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
new_bss->valid_links = 0;
os_memcpy(new_bss->flink->addr, new_bss->addr, ETH_ALEN);
- new_bss->flink->freq = drv->first_bss->flink->freq;
+ new_bss->flink->freq = (freq == -1) ? drv->first_bss->flink->freq : freq;
new_bss->ctx = bss_ctx;
new_bss->added_if = added;
drv->first_bss->next = new_bss;
diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
index 0b7182f49..273bb024a 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -454,7 +454,7 @@ static inline int wpa_drv_if_add(struct wpa_supplicant *wpa_s,
if (wpa_s->driver->if_add)
return wpa_s->driver->if_add(wpa_s->drv_priv, type, ifname,
addr, bss_ctx, NULL, force_ifname,
- if_addr, bridge, 0, 0);
+ if_addr, bridge, 0, 0, -1);
return -1;
}
--
2.39.2