1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-28 16:01:18 +01:00

gnrc/netif: fix source address selection for non-matching prefixes

According to RFC 6724 ch. 5 rule 8, the source address candidate with
the longest matching prefix has to be selected. The current
implementation discards source addresses that have no matching prefix
(`match = 0`) which is perfectly fine for any global address.
This commit is contained in:
Daniel Krebs 2018-02-08 13:46:46 +01:00
parent bba457290e
commit cbc9121ad4

View File

@ -874,7 +874,7 @@ static unsigned _match(const gnrc_netif_t *netif, const ipv6_addr_t *addr,
}
match = ipv6_addr_match_prefix(&(netif->ipv6.addrs[i]), addr);
if (((match > 64U) || !ipv6_addr_is_link_local(&(netif->ipv6.addrs[i]))) &&
(match > best_match)) {
(match >= best_match)) {
if (idx != NULL) {
*idx = i;
}