Skip to content

Commit abb9a68

Browse files
NicolasDichtelkuba-moo
authored andcommitted
ipv6: take care of scope when choosing the src addr
When the source address is selected, the scope must be checked. For example, if a loopback address is assigned to the vrf device, it must not be chosen for packets sent outside. CC: [email protected] Fixes: afbac60 ("net: ipv6: Address selection needs to consider L3 domains") Signed-off-by: Nicolas Dichtel <[email protected]> Reviewed-by: David Ahern <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 252442f commit abb9a68

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/ipv6/addrconf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1873,7 +1873,8 @@ int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
18731873
master, &dst,
18741874
scores, hiscore_idx);
18751875

1876-
if (scores[hiscore_idx].ifa)
1876+
if (scores[hiscore_idx].ifa &&
1877+
scores[hiscore_idx].scopedist >= 0)
18771878
goto out;
18781879
}
18791880

0 commit comments

Comments
 (0)