Skip to content

Commit

Permalink
[Gratuitous ARP] Only send ARP packets when IF is up
Browse files Browse the repository at this point in the history
  • Loading branch information
TD-er committed Aug 27, 2019
1 parent 4a8cfd2 commit a6ab40e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Networking.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
# endif // if !defined(ARDUINO_ESP8266_RELEASE_2_4_0) && !defined(ARDUINO_ESP8266_RELEASE_2_3_0)
#endif // ifdef ESP8266

#ifdef ESP32
#define SUPPORT_ARP
#endif

#ifdef SUPPORT_ARP
# include <lwip/etharp.h>
#endif // ifdef SUPPORT_ARP
Expand Down Expand Up @@ -918,7 +922,11 @@ void sendGratuitousARP() {
netif *n = netif_list;

while (n) {
etharp_gratuitous(n);
if ((n->hwaddr_len == ETH_HWADDR_LEN) &&
(n->flags & NETIF_FLAG_ETHARP) &&
((n->flags & NETIF_FLAG_LINK_UP) || (n->flags & NETIF_FLAG_UP))) {
etharp_gratuitous(n);
}
n = n->next;
}
STOP_TIMER(GRAT_ARP_STATS);
Expand Down

0 comments on commit a6ab40e

Please sign in to comment.