]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
ProxyARP: Clear bridge parameters on deinit only if hostapd set them
authorJouni Malinen <quic_jouni@quicinc.com>
Tue, 31 May 2022 08:53:05 +0000 (11:53 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 31 May 2022 08:53:05 +0000 (11:53 +0300)
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 <quic_jouni@quicinc.com>
src/ap/hostapd.h
src/ap/x_snoop.c

index 297faaf1409c4bfa57c3034414284de7b76a9f00..cbe03a06064a8b9e08a024c4e857bd6b7455ddfd 100644 (file)
@@ -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;
index aef9a53c46cf90476592feee5d836ca82ae68379..029f4de239f0797e582a02e9459c713afed04fd0 100644 (file)
@@ -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;
 }