hostapd: sync upstream (#8101)

* hostapd: fix a race condition on adding AP mode wds sta interfaces

Both hostapd and netifd attempt to add a VLAN device to a bridge.
Depending on which one wins the race, bridge vlan settings might be incomplete,
or hostapd might run into an error and refuse to service the client.
Fix this by preventing hostapd from adding interfaces to the bridge and
instead rely entirely on netifd handling this properly

Signed-off-by: Felix Fietkau <nbd@nbd.name>

* hostapd: fix up patches after the last commit

Signed-off-by: Felix Fietkau <nbd@nbd.name>

* hostapd: ubus: fix uninitialized pointer

This fixes passing a bogus non-null pointer to the ubus handler in case
the transition request is rejected.

Signed-off-by: David Bauer <mail@david-bauer.net>

Co-authored-by: Felix Fietkau <nbd@nbd.name>
Co-authored-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
Beginner 2021-10-22 11:56:24 +08:00 committed by GitHub
parent 69753f8625
commit f100ebf845
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 8 deletions

View File

@ -755,7 +755,7 @@ hostapd_set_bss_options() {
} }
append bss_conf "ssid=$ssid" "$N" append bss_conf "ssid=$ssid" "$N"
[ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge" "$N" [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge${N}wds_bridge=" "$N"
[ -n "$network_ifname" ] && append bss_conf "snoop_iface=$network_ifname" "$N" [ -n "$network_ifname" ] && append bss_conf "snoop_iface=$network_ifname" "$N"
[ -n "$iapp_interface" ] && { [ -n "$iapp_interface" ] && {
local ifname local ifname

View File

@ -520,7 +520,7 @@
{ {
u8 dialog_token, status_code, bss_termination_delay; u8 dialog_token, status_code, bss_termination_delay;
- const u8 *pos, *end; - const u8 *pos, *end;
+ const u8 *pos, *end, *target_bssid; + const u8 *pos, *end, *target_bssid = NULL;
int enabled = hapd->conf->bss_transition; int enabled = hapd->conf->bss_transition;
struct sta_info *sta; struct sta_info *sta;

View File

@ -0,0 +1,22 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2357,6 +2357,8 @@ static int hostapd_config_fill(struct ho
sizeof(conf->bss[0]->iface));
} else if (os_strcmp(buf, "bridge") == 0) {
os_strlcpy(bss->bridge, pos, sizeof(bss->bridge));
+ if (!bss->wds_bridge[0])
+ os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge));
} else if (os_strcmp(buf, "vlan_bridge") == 0) {
os_strlcpy(bss->vlan_bridge, pos, sizeof(bss->vlan_bridge));
} else if (os_strcmp(buf, "wds_bridge") == 0) {
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -340,8 +340,6 @@ int hostapd_set_wds_sta(struct hostapd_d
return -1;
if (hapd->conf->wds_bridge[0])
bridge = hapd->conf->wds_bridge;
- else if (hapd->conf->bridge[0])
- bridge = hapd->conf->bridge;
return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val,
bridge, ifname_wds);
}

View File

@ -1,6 +1,6 @@
--- a/hostapd/config_file.c --- a/hostapd/config_file.c
+++ b/hostapd/config_file.c +++ b/hostapd/config_file.c
@@ -2873,6 +2873,14 @@ static int hostapd_config_fill(struct ho @@ -2875,6 +2875,14 @@ static int hostapd_config_fill(struct ho
line, bss->max_num_sta, MAX_STA_COUNT); line, bss->max_num_sta, MAX_STA_COUNT);
return 1; return 1;
} }
@ -60,7 +60,7 @@
struct hapd_interfaces *interfaces = iface->interfaces; struct hapd_interfaces *interfaces = iface->interfaces;
--- a/src/ap/beacon.c --- a/src/ap/beacon.c
+++ b/src/ap/beacon.c +++ b/src/ap/beacon.c
@@ -1042,7 +1042,7 @@ void handle_probe_req(struct hostapd_dat @@ -1039,7 +1039,7 @@ void handle_probe_req(struct hostapd_dat
if (hapd->conf->no_probe_resp_if_max_sta && if (hapd->conf->no_probe_resp_if_max_sta &&
is_multicast_ether_addr(mgmt->da) && is_multicast_ether_addr(mgmt->da) &&
is_multicast_ether_addr(mgmt->bssid) && is_multicast_ether_addr(mgmt->bssid) &&

View File

@ -1,6 +1,6 @@
--- a/hostapd/config_file.c --- a/hostapd/config_file.c
+++ b/hostapd/config_file.c +++ b/hostapd/config_file.c
@@ -3031,6 +3031,8 @@ static int hostapd_config_fill(struct ho @@ -3033,6 +3033,8 @@ static int hostapd_config_fill(struct ho
wpa_printf(MSG_INFO, wpa_printf(MSG_INFO,
"Line %d: Obsolete peerkey parameter ignored", line); "Line %d: Obsolete peerkey parameter ignored", line);
#ifdef CONFIG_IEEE80211R_AP #ifdef CONFIG_IEEE80211R_AP

View File

@ -55,10 +55,10 @@
"x_snoop: Failed to initialize L2 packet processing %s", "x_snoop: Failed to initialize L2 packet processing %s",
--- a/hostapd/config_file.c --- a/hostapd/config_file.c
+++ b/hostapd/config_file.c +++ b/hostapd/config_file.c
@@ -2357,6 +2357,8 @@ static int hostapd_config_fill(struct ho @@ -2359,6 +2359,8 @@ static int hostapd_config_fill(struct ho
sizeof(conf->bss[0]->iface));
} else if (os_strcmp(buf, "bridge") == 0) {
os_strlcpy(bss->bridge, pos, sizeof(bss->bridge)); os_strlcpy(bss->bridge, pos, sizeof(bss->bridge));
if (!bss->wds_bridge[0])
os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge));
+ } else if (os_strcmp(buf, "snoop_iface") == 0) { + } else if (os_strcmp(buf, "snoop_iface") == 0) {
+ os_strlcpy(bss->snoop_iface, pos, sizeof(bss->snoop_iface)); + os_strlcpy(bss->snoop_iface, pos, sizeof(bss->snoop_iface));
} else if (os_strcmp(buf, "vlan_bridge") == 0) { } else if (os_strcmp(buf, "vlan_bridge") == 0) {