Przeglądaj źródła

lwip:esp_netif: Send Periodic Gratuitous ARP only on valid IPv4

It was possible that the device would send a Gratuitous ARP before
acquiring a valid address, advertising it has 0.0.0.0 address.
David Cermak 2 lat temu
rodzic
commit
97e785c01d
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      components/esp_netif/lwip/esp_netif_lwip.c

+ 3 - 1
components/esp_netif/lwip/esp_netif_lwip.c

@@ -186,7 +186,9 @@ static esp_err_t remove_lwip_netif_callback(struct esp_netif_api_msg_s *msg)
 static void netif_send_garp(void *arg)
 {
     struct netif *netif = arg;
-    etharp_gratuitous(netif);
+    if (!ip4_addr_cmp(netif_ip4_addr(netif), IP4_ADDR_ANY4)) {  // Send GARP requests only if we have a valid IP
+        etharp_gratuitous(netif);
+    }
     sys_timeout(CONFIG_LWIP_GARP_TMR_INTERVAL*1000, netif_send_garp, netif);
 }