Closed samueljero closed 5 months ago
Thank you for reporting this! The loopback address should be in the candidate list of source addresses. I think line 45 should be src_addr.unspecified()
instead of src_addr.is_loopback()
, as line 45 covers the following in RFC6724:
In any case, multicast addresses and the unspecified address MUST NOT be included in a candidate set.
I'll fix this and add more tests for the source address selection.
In particular, given an interface with only the IPv6 localhost address, it is not possible to send packets to one's self. If sending ICMP packets, smoltcp panics:
(this is version 0.11, but master has the same bug)
This appears to result from a bug in #864, where localhost addresses are never considered for sending packets: https://github.com/smoltcp-rs/smoltcp/blob/d185a37a8e93a99aa1fe424f45b79420db8ddae5/src/iface/interface/ipv6.rs#L42-L47
Presumably this should have an exception for when the destination address is localhost.
Note that this only effects unbound sockets, as the IPv6 source address selection algorithm is not run for bound sockets.