Commit 6fe74941 authored by David Ahern's avatar David Ahern Committed by David S. Miller

net/ipv6: Change ip6_route_get_saddr to get dev from route

Prior to 4832c30d ("net: ipv6: put host and anycast routes on device
with address") host routes and anycast routes were installed with the
device set to loopback (or VRF device once that feature was added). In the
older code dst.dev was set to loopback (needed for packet tx) and rt6i_idev
was used to denote the actual interface.

Commit 4832c30d changed the code to have dst.dev pointing to the real
device with the switch to lo or vrf device done on dst clones. As a
consequence of this change ip6_route_get_saddr can just pass the nexthop
device to ipv6_dev_get_saddr.
Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eea68cd3
...@@ -114,14 +114,15 @@ static inline int ip6_route_get_saddr(struct net *net, struct fib6_info *f6i, ...@@ -114,14 +114,15 @@ static inline int ip6_route_get_saddr(struct net *net, struct fib6_info *f6i,
unsigned int prefs, unsigned int prefs,
struct in6_addr *saddr) struct in6_addr *saddr)
{ {
struct inet6_dev *idev = f6i ? f6i->fib6_idev : NULL;
int err = 0; int err = 0;
if (f6i && f6i->fib6_prefsrc.plen) if (f6i && f6i->fib6_prefsrc.plen) {
*saddr = f6i->fib6_prefsrc.addr; *saddr = f6i->fib6_prefsrc.addr;
else } else {
err = ipv6_dev_get_saddr(net, idev ? idev->dev : NULL, struct net_device *dev = f6i ? fib6_info_nh_dev(f6i) : NULL;
daddr, prefs, saddr);
err = ipv6_dev_get_saddr(net, dev, daddr, prefs, saddr);
}
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment