hostapd: sync upstream (#7925)

* hostapd: let netifd set bridge port attributes for snooping

Avoids race conditions on bridge member add/remove

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

* hostapd: fix segfault when deinit mesh ifaces

In hostapd_ubus_add_bss(), ubus objects are not registered for mesh
interfaces. This provokes a segfault when accessing the ubus object in
mesh deinit.

This commit adds the same condition to hostapd_ubus_free_bss() for
discarding those mesh interfaces.

Signed-off-by: Jesus Fernandez Manzano <jesus.manzano@galgus.net>

Co-authored-by: Felix Fietkau <nbd@nbd.name>
Co-authored-by: Jesus Fernandez Manzano <jesus.manzano@galgus.net>
This commit is contained in:
Beginner 2021-09-25 01:42:07 +08:00 committed by GitHub
parent c85f84bfde
commit be087a4f7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 1 deletions

View File

@ -10,7 +10,36 @@
--- a/src/ap/x_snoop.c --- a/src/ap/x_snoop.c
+++ b/src/ap/x_snoop.c +++ b/src/ap/x_snoop.c
@@ -71,8 +71,12 @@ x_snoop_get_l2_packet(struct hostapd_dat @@ -31,14 +31,16 @@ int x_snoop_init(struct hostapd_data *ha
return -1;
}
- if (hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_HAIRPIN_MODE,
+ if (!conf->snoop_iface[0] &&
+ hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_HAIRPIN_MODE,
1)) {
wpa_printf(MSG_DEBUG,
"x_snoop: Failed to enable hairpin_mode on the bridge port");
return -1;
}
- if (hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_PROXYARP, 1)) {
+ if (!conf->snoop_iface[0] &&
+ hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_PROXYARP, 1)) {
wpa_printf(MSG_DEBUG,
"x_snoop: Failed to enable proxyarp on the bridge port");
return -1;
@@ -52,7 +54,8 @@ int x_snoop_init(struct hostapd_data *ha
}
#ifdef CONFIG_IPV6
- if (hostapd_drv_br_set_net_param(hapd, DRV_BR_MULTICAST_SNOOPING, 1)) {
+ if (!conf->snoop_iface[0] &&
+ hostapd_drv_br_set_net_param(hapd, DRV_BR_MULTICAST_SNOOPING, 1)) {
wpa_printf(MSG_DEBUG,
"x_snoop: Failed to enable multicast snooping on the bridge");
return -1;
@@ -71,8 +74,12 @@ x_snoop_get_l2_packet(struct hostapd_dat
{ {
struct hostapd_bss_config *conf = hapd->conf; struct hostapd_bss_config *conf = hapd->conf;
struct l2_packet_data *l2; struct l2_packet_data *l2;

View File

@ -1498,6 +1498,11 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd)
struct ubus_object *obj = &hapd->ubus.obj; struct ubus_object *obj = &hapd->ubus.obj;
char *name = (char *) obj->name; char *name = (char *) obj->name;
#ifdef CONFIG_MESH
if (hapd->conf->mesh & MESH_ENABLED)
return;
#endif
if (!ctx) if (!ctx)
return; return;