diff options
| author | Nicolas Dichtel <[email protected]> | 2024-07-10 10:14:29 +0200 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2024-07-14 07:34:16 -0700 |
| commit | abb9a68d2c64dd9b128ae1f2e635e4d805e7ce64 (patch) | |
| tree | f4c0135691678b8cc3c84f1473e7193168ae7b86 | |
| parent | 252442f2ae317d109ef0b4b39ce0608c09563042 (diff) | |
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: afbac6010aec ("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]>
| -rw-r--r-- | net/ipv6/addrconf.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 5c424a0e7232..4f2c5cc31015 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -1873,7 +1873,8 @@ int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev, master, &dst, scores, hiscore_idx); - if (scores[hiscore_idx].ifa) + if (scores[hiscore_idx].ifa && + scores[hiscore_idx].scopedist >= 0) goto out; } |