Open kelleyk opened 2 years ago
I ran into this issue a while ago and we discussed it on Matrix here; in short yes, the ARP request is transmitted in place of the ICMP echo response, and nothing remembers we received that echo request, so it's not sent once the ARP response is received.
Previously the ARP cache was more opportunistically populated, but this led to various horrible bugs, so 6210612be047ee706ac729015cdbc2581e6ae9a3 made ARP filling more restrictive. In the chat we discussed possibly allowing populating the ARP cache from received unicast packets, which I think would fix this, but I don't think has been done.
I'm starting to think the original fix was too conservative, yup. Adding cache filling back in a super restricted form, like "only fill if src+dst MAC and IP are all unicast, and the DST ip+mac is ours" would hopefully work, and should cover all "first packet gets lost" cases.
Does anyone know what Linux does? Does it fill from packets like this, or does it buffer the ICMP response somewhere while it sends the ARP request?
Adding cache filling back in a super restricted form, like "only fill if src+dst MAC and IP are all unicast, and the DST ip+mac is ours" would hopefully work, and should cover all "first packet gets lost" cases.
This would not work in the case of RPL. When a node in the network receives a packet not destined for that node, it forwards the packet to its parent, without changing the source IP address. This means that that node transmits a message with its own link-layer address but with a source IP address that is not the one from the node. The parent node thus receives a message with a link-layer address that cannot be linked to that IP source address.
Edit: maybe we could actually add them how you say it, but also only when the hop limit or time to live is 64 or 255, reducing the chance that it is from a forwarded packet.
Edit 2: what about IPv6 packets transmitted to the ALL_NODES and ALL_RPL_NODES multicast addresses? In case of RPL, I would add them to the neighbor cache. E.g. a DIO (some kind of advertisement from a neighbor) should only be transmitted from a neighbor with the destination IP address being the ALL_RPL_NODES address.
Just to revive this issue, I also ran into this (only with TCP sockets), and while it doesn't break my application, it makes it significantly more annoying to use. A fix would be greatly welcome :)
When I boot a dev board running
smoltcp@v0.8.0
and ping it, I see the following defmt output on the host:... and on the host side, I see no reply to that first ping:
Is it possible that
smoltcp
is populating the ARP cache after processing the inbound ICMP echo request? If so, is this deliberate/known behavior, or would you be open to a patch that reordered things?