Skip to content

Commit

Permalink
ipv6: take care of scope when choosing the src addr
Browse files Browse the repository at this point in the history
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: stable@vger.kernel.org
Fixes: afbac60 ("net: ipv6: Address selection needs to consider L3 domains")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/20240710081521.3809742-4-nicolas.dichtel@6wind.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Nicolas Dichtel authored and Jakub Kicinski committed Jul 14, 2024
1 parent 252442f commit abb9a68
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit abb9a68

Please sign in to comment.