-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test: etharp_gratuitous #1877
Test: etharp_gratuitous #1877
Conversation
@mcspr Its working. Dint see any reset. I also checked at the same time, n->ip_addr.addr was always giving value 0 for the fist iteration. I think this condition for checking netif up or not works well. 👍 |
Looks OK to me. |
For ESP32 at least, you need to check the So it will be something like this:
I am not sure if a check for |
See this PR: xoseperez/espurna#1877 and discussion here: esp8266/Arduino#5998 (comment) Fixes letscontrolit#2374
...UP check should be && btw, assuming lwip authors know something that we don't and expecting that LINK_UP can be missing independently of UP ETH flag is set by lwip-glue layer, so check is safe with 8266 too: And while I read the https://espeasy.readthedocs.io/en/latest/Tools/Tools.html#periodical-send-gratuitous-arp explanation for arp, in what case it should be on? Are we doing this so that router does not kick us, sort-of keep alive? |
I have been using the code I mentioned in my last comment, since that comment. It is not really a keep-alive, but more to make sure the MAC tables in switches/AP/router are not forgetting about the node. It is giving an answer to a question never asked. For normal ethernet traffic, each switch/router etc. needs to know what MAC address is behind what port. Sending ICMP (ping) packets to the ESP may also have a similar effect, since ICMP packets appear to be handled different by the AP compared to other packets. This simple test does show us a number of things happening here:
TL;DR In ESPeasy I use a more dynamic interval for sending these ARP packets. |
Wow, thanks for detailed explanation! It is surprising that esp32 build works differently, there's this exact functionality enabled by default: I think I'd settle with idf approach and randomize arp time between 15 and 30s (and maybe kick in sooner if any connection routine fails, that's an interesting idea) |
code/espurna/config/general.h
Outdated
// | ||
// Help solve compatibility issues with some routers. | ||
// If the ARP table of the AP is old, and the AP doesn't send ARP request to update it's ARP table, | ||
// this will lead to the STA sending IP packet fail. Thus we send gratuitous ARP periodically to let AP update it's ARP table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking, it is not the sending of an packet that fails, but receiving.
The other hosts in the network may no longer know how to retrieve what MAC address to use as destination when sending a packet to some IP-address. Also the other components on the network, like switch or AP may have the MAC address removed from their tables and thus no longer be able to route the packet to the correct port.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wording is weird, true... that was a blatant c/p from the esp-lwip Kconfig entry. Reworded to mention ARP tables.
#if WIFI_GRATUITOUS_ARP_SUPPORT | ||
// Only send out gra arp when in STA mode | ||
if (_wifi_gratuitous_arp_interval && ((WiFi.getMode() & WIFI_AP) == 0)) { | ||
_wifiSendGratuitousArp(_wifi_gratuitous_arp_interval); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With STA+AP mode the WiFi radio is always on, which makes it less likely ARP requests may be missed.
But it may still be useful to send it if you get a (new) IP address.
Just make sure to only send it to the STATION_IF if you want to distinguish this.
N.B. the AP and STA use different MAC addresses, so it should be no problem to send out Gratuitous ARP to the AP interface. (as long as you're sending the right IP of course :) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is copied from the idf, basically trying to emulate GARP flag that they check. No flag here, so STATION_IF seems like a solution.
See this comment and further discussion in the issue: xoseperez/espurna#1877 (comment) Use the same condition as esp-lwip.
2.3.0/lwip1 builds netif->num increments on for each sta or ap lwip2 keeps those constant, but that seems like a implementation detail might break in the future anyways...
fix #614 ?
esp8266/Arduino#5998 (comment)
@arihantdaga can you try this one? if I understood correctly the required process. Can be adjusted a bit later
edit: not seeing any resets on initial connection. wifi.reset, wifi.ap commands work too.
If you can reliably reproduce lost IP addresses (either modem or none sleep), it would be interesting to see if this helps