From: Jouni Malinen Date: Tue, 31 May 2022 08:53:05 +0000 (+0300) Subject: ProxyARP: Clear bridge parameters on deinit only if hostapd set them X-Git-Tag: hostap_2_11~1869 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4015440af80d569d15b4f41d6a9aebf6fab1f3d;p=thirdparty%2Fhostap.git ProxyARP: Clear bridge parameters on deinit only if hostapd set them Skip the x_snoop_deinit() operations if hostapd did not actually configure the parameters in the first place. While clearing these specific parameters is unlikely to change how they were set outside the scope of hostapd, it is better to leave them as-is to avoid surprises if hostapd was not configured to use ProxyARP. Signed-off-by: Jouni Malinen --- diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index 297faaf14..cbe03a060 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -324,6 +324,7 @@ struct hostapd_data { #ifdef CONFIG_PROXYARP struct l2_packet_data *sock_dhcp; struct l2_packet_data *sock_ndisc; + bool x_snoop_initialized; #endif /* CONFIG_PROXYARP */ #ifdef CONFIG_MESH int num_plinks; diff --git a/src/ap/x_snoop.c b/src/ap/x_snoop.c index aef9a53c4..029f4de23 100644 --- a/src/ap/x_snoop.c +++ b/src/ap/x_snoop.c @@ -31,6 +31,8 @@ int x_snoop_init(struct hostapd_data *hapd) return -1; } + hapd->x_snoop_initialized = true; + if (hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_HAIRPIN_MODE, 1)) { wpa_printf(MSG_DEBUG, @@ -125,7 +127,10 @@ void x_snoop_mcast_to_ucast_convert_send(struct hostapd_data *hapd, void x_snoop_deinit(struct hostapd_data *hapd) { + if (!hapd->x_snoop_initialized) + return; hostapd_drv_br_set_net_param(hapd, DRV_BR_NET_PARAM_GARP_ACCEPT, 0); hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_PROXYARP, 0); hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_HAIRPIN_MODE, 0); + hapd->x_snoop_initialized = false; }