If you attempt to send a packet via a raw socket with a source address that does not match the interface address (i.e. a spoofed packet), smoltcp may generate an ARP request if it doesn't have the destination MAC address cached. This ARP request will have a source address matching the spoofed packet NOT the interface. As a result, smoltcp will ignore the ARP response.
This is most relevant when using Raw sockets.
If you attempt to send a packet via a raw socket with a source address that does not match the interface address (i.e. a spoofed packet), smoltcp may generate an ARP request if it doesn't have the destination MAC address cached. This ARP request will have a source address matching the spoofed packet NOT the interface. As a result, smoltcp will ignore the ARP response.
The problem appears to be that
InterfaceInnner::lookup_hardware_addr()
uses the packet's source IPv4 address instead of looking up the interfaces's source IPv4 address at 989: https://github.com/smoltcp-rs/smoltcp/blob/57b1dd4b158327c31edebd3260d90bf5c3b1452d/src/iface/interface/mod.rs#L977-L992It seems likely that
self.get_source_address_ipv4(dst_addr)
should be used instead.