blob: a28db106e84320e9820e294266e59cc6699bd62e [file] [log] [blame]
developer66e89bc2024-04-23 14:50:01 +08001From 26c23f7dc1fe47e22ceab581b7abed089148c68f Mon Sep 17 00:00:00 2001
2From: Bo Jiao <Bo.Jiao@mediatek.com>
3Date: Thu, 19 Oct 2023 13:38:11 +0800
4Subject: [PATCH 079/104] mtk: hostapd: initialize i802_bss's flink->freq with
5 iface freq.
6
7Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
8---
9 src/ap/ap_drv_ops.c | 6 +++---
10 src/ap/ap_drv_ops.h | 2 +-
11 src/ap/hostapd.c | 2 +-
12 src/drivers/driver.h | 2 +-
13 src/drivers/driver_nl80211.c | 4 ++--
14 wpa_supplicant/driver_i.h | 2 +-
15 6 files changed, 9 insertions(+), 9 deletions(-)
16
17diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
18index d6bd157d8..b7896c110 100644
19--- a/src/ap/ap_drv_ops.c
20+++ b/src/ap/ap_drv_ops.c
21@@ -368,7 +368,7 @@ int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname)
22 char force_ifname[IFNAMSIZ];
23 u8 if_addr[ETH_ALEN];
24 return hostapd_if_add(hapd, WPA_IF_AP_VLAN, ifname, hapd->own_addr,
25- NULL, NULL, force_ifname, if_addr, NULL, 0);
26+ NULL, NULL, force_ifname, if_addr, NULL, 0, hapd->iface->freq);
27 }
28
29
30@@ -560,13 +560,13 @@ int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len)
31 int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
32 const char *ifname, const u8 *addr, void *bss_ctx,
33 void **drv_priv, char *force_ifname, u8 *if_addr,
34- const char *bridge, int use_existing)
35+ const char *bridge, int use_existing, int freq)
36 {
37 if (hapd->driver == NULL || hapd->driver->if_add == NULL)
38 return -1;
39 return hapd->driver->if_add(hapd->drv_priv, type, ifname, addr,
40 bss_ctx, drv_priv, force_ifname, if_addr,
41- bridge, use_existing, 1);
42+ bridge, use_existing, 1, freq);
43 }
44
45
46diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
47index 78e5c8d5a..5830705a3 100644
48--- a/src/ap/ap_drv_ops.h
49+++ b/src/ap/ap_drv_ops.h
50@@ -58,7 +58,7 @@ int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len);
51 int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
52 const char *ifname, const u8 *addr, void *bss_ctx,
53 void **drv_priv, char *force_ifname, u8 *if_addr,
54- const char *bridge, int use_existing);
55+ const char *bridge, int use_existing, int freq);
56 int hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type,
57 const char *ifname);
58 int hostapd_if_link_remove(struct hostapd_data *hapd,
59diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
60index 636655ea1..e4fc1f85a 100644
61--- a/src/ap/hostapd.c
62+++ b/src/ap/hostapd.c
63@@ -1433,7 +1433,7 @@ int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon)
64 conf->iface, addr, hapd,
65 &hapd->drv_priv, force_ifname, if_addr,
66 conf->bridge[0] ? conf->bridge : NULL,
67- first == -1)) {
68+ first == -1, hapd->iface->freq)) {
69 wpa_printf(MSG_ERROR, "Failed to add BSS (BSSID="
70 MACSTR ")", MAC2STR(hapd->own_addr));
71 hapd->interface_added = 0;
72diff --git a/src/drivers/driver.h b/src/drivers/driver.h
73index 332a51c55..2940650df 100644
74--- a/src/drivers/driver.h
75+++ b/src/drivers/driver.h
76@@ -3866,7 +3866,7 @@ struct wpa_driver_ops {
77 int (*if_add)(void *priv, enum wpa_driver_if_type type,
78 const char *ifname, const u8 *addr, void *bss_ctx,
79 void **drv_priv, char *force_ifname, u8 *if_addr,
80- const char *bridge, int use_existing, int setup_ap);
81+ const char *bridge, int use_existing, int setup_ap, int freq);
82
83 /**
84 * if_remove - Remove a virtual interface
85diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
86index e588e7538..3d69c9c49 100644
87--- a/src/drivers/driver_nl80211.c
88+++ b/src/drivers/driver_nl80211.c
89@@ -8872,7 +8872,7 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
90 void *bss_ctx, void **drv_priv,
91 char *force_ifname, u8 *if_addr,
92 const char *bridge, int use_existing,
93- int setup_ap)
94+ int setup_ap, int freq)
95 {
96 enum nl80211_iftype nlmode;
97 struct i802_bss *bss = priv;
98@@ -8992,7 +8992,7 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
99 new_bss->valid_links = 0;
100 os_memcpy(new_bss->flink->addr, new_bss->addr, ETH_ALEN);
101
102- new_bss->flink->freq = drv->first_bss->flink->freq;
103+ new_bss->flink->freq = (freq == -1) ? drv->first_bss->flink->freq : freq;
104 new_bss->ctx = bss_ctx;
105 new_bss->added_if = added;
106 drv->first_bss->next = new_bss;
107diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
108index 663e16053..624192ebd 100644
109--- a/wpa_supplicant/driver_i.h
110+++ b/wpa_supplicant/driver_i.h
111@@ -446,7 +446,7 @@ static inline int wpa_drv_if_add(struct wpa_supplicant *wpa_s,
112 if (wpa_s->driver->if_add)
113 return wpa_s->driver->if_add(wpa_s->drv_priv, type, ifname,
114 addr, bss_ctx, NULL, force_ifname,
115- if_addr, bridge, 0, 0);
116+ if_addr, bridge, 0, 0, -1);
117 return -1;
118 }
119
120--
1212.39.2
122