blob: 0be5c0ed8b046eccb09e330c745d1488d528187d [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From c3f080cfa523b13726b223411cc1bf574000883b Mon Sep 17 00:00:00 2001
developer66e89bc2024-04-23 14:50:01 +08002From: Bo Jiao <Bo.Jiao@mediatek.com>
3Date: Thu, 19 Oct 2023 13:38:11 +0800
developer05f3b2b2024-08-19 19:17:34 +08004Subject: [PATCH 059/126] mtk: hostapd: initialize i802_bss's flink->freq with
developer66e89bc2024-04-23 14:50:01 +08005 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
developer05f3b2b2024-08-19 19:17:34 +080018index d4be02b77..011bb37f8 100644
developer66e89bc2024-04-23 14:50:01 +080019--- a/src/ap/ap_drv_ops.c
20+++ b/src/ap/ap_drv_ops.c
developer05f3b2b2024-08-19 19:17:34 +080021@@ -371,7 +371,7 @@ int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname)
developer66e89bc2024-04-23 14:50:01 +080022 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
developer05f3b2b2024-08-19 19:17:34 +080030@@ -589,13 +589,13 @@ int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len)
developer66e89bc2024-04-23 14:50:01 +080031 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
developer05f3b2b2024-08-19 19:17:34 +080047index 2ee4ebd04..8c783610c 100644
developer66e89bc2024-04-23 14:50:01 +080048--- a/src/ap/ap_drv_ops.h
49+++ b/src/ap/ap_drv_ops.h
developer05f3b2b2024-08-19 19:17:34 +080050@@ -61,7 +61,7 @@ int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len);
developer66e89bc2024-04-23 14:50:01 +080051 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
developer05f3b2b2024-08-19 19:17:34 +080060index 97bc4808e..f64f17ee6 100644
developer66e89bc2024-04-23 14:50:01 +080061--- a/src/ap/hostapd.c
62+++ b/src/ap/hostapd.c
developer05f3b2b2024-08-19 19:17:34 +080063@@ -1487,7 +1487,7 @@ int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon)
developer66e89bc2024-04-23 14:50:01 +080064 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
developer05f3b2b2024-08-19 19:17:34 +080073index b24caae8a..8f5d260aa 100644
developer66e89bc2024-04-23 14:50:01 +080074--- a/src/drivers/driver.h
75+++ b/src/drivers/driver.h
developer05f3b2b2024-08-19 19:17:34 +080076@@ -3892,7 +3892,7 @@ struct wpa_driver_ops {
developer66e89bc2024-04-23 14:50:01 +080077 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
developer05f3b2b2024-08-19 19:17:34 +080086index 10e5c837b..7cb65a2bc 100644
developer66e89bc2024-04-23 14:50:01 +080087--- a/src/drivers/driver_nl80211.c
88+++ b/src/drivers/driver_nl80211.c
developer05f3b2b2024-08-19 19:17:34 +080089@@ -8869,7 +8869,7 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
developer66e89bc2024-04-23 14:50:01 +080090 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;
developer05f3b2b2024-08-19 19:17:34 +080098@@ -8989,7 +8989,7 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
developer66e89bc2024-04-23 14:50:01 +080099 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--
developer05f3b2b2024-08-19 19:17:34 +08001212.18.0
developer66e89bc2024-04-23 14:50:01 +0800122