Skip to content

Commit 6fe7494

Browse files
dsaherndavem330
authored andcommitted
net/ipv6: Change ip6_route_get_saddr to get dev from route
Prior to 4832c30 ("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 4832c30 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: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent eea68cd commit 6fe7494

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

include/net/ip6_route.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,15 @@ static inline int ip6_route_get_saddr(struct net *net, struct fib6_info *f6i,
114114
unsigned int prefs,
115115
struct in6_addr *saddr)
116116
{
117-
struct inet6_dev *idev = f6i ? f6i->fib6_idev : NULL;
118117
int err = 0;
119118

120-
if (f6i && f6i->fib6_prefsrc.plen)
119+
if (f6i && f6i->fib6_prefsrc.plen) {
121120
*saddr = f6i->fib6_prefsrc.addr;
122-
else
123-
err = ipv6_dev_get_saddr(net, idev ? idev->dev : NULL,
124-
daddr, prefs, saddr);
121+
} else {
122+
struct net_device *dev = f6i ? fib6_info_nh_dev(f6i) : NULL;
123+
124+
err = ipv6_dev_get_saddr(net, dev, daddr, prefs, saddr);
125+
}
125126

126127
return err;
127128
}

0 commit comments

Comments
 (0)