Function netstack3_ip::socket::select_ipv6_source_address

source ยท
pub fn select_ipv6_source_address<'a, D: PartialEq, I: Iterator<Item = SasCandidate<D>>>(
    remote_ip: Option<SpecifiedAddr<Ipv6Addr>>,
    outbound_device: &D,
    addresses: I,
) -> Ipv6SourceAddr
Expand description

Selects the source address for an IPv6 socket using the algorithm defined in [RFC 6724 Section 5].

This algorithm is only applicable when the user has not explicitly specified a source address.

remote_ip is the remote IP address of the socket, outbound_device is the device over which outbound traffic to remote_ip is sent (according to the forwarding table), and addresses is an iterator of all addresses on all devices. The algorithm works by iterating over addresses and selecting the address which is most preferred according to a set of selection criteria.