Skip to content

Commit eea68cd

Browse files
dsaherndavem330
authored andcommitted
net/ipv6: Remove unnecessary checks on fib6_idev
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 a couple of device checks during route lookups are no longer needed. Remove them. Signed-off-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9ee8cbb commit eea68cd

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

net/ipv6/route.c

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,6 @@ static inline struct fib6_info *rt6_device_match(struct net *net,
455455
int oif,
456456
int flags)
457457
{
458-
struct fib6_info *local = NULL;
459458
struct fib6_info *sprt;
460459

461460
if (!oif && ipv6_addr_any(saddr) &&
@@ -471,31 +470,15 @@ static inline struct fib6_info *rt6_device_match(struct net *net,
471470
if (oif) {
472471
if (dev->ifindex == oif)
473472
return sprt;
474-
if (dev->flags & IFF_LOOPBACK) {
475-
if (!sprt->fib6_idev ||
476-
sprt->fib6_idev->dev->ifindex != oif) {
477-
if (flags & RT6_LOOKUP_F_IFACE)
478-
continue;
479-
if (local &&
480-
local->fib6_idev->dev->ifindex == oif)
481-
continue;
482-
}
483-
local = sprt;
484-
}
485473
} else {
486474
if (ipv6_chk_addr(net, saddr, dev,
487475
flags & RT6_LOOKUP_F_IFACE))
488476
return sprt;
489477
}
490478
}
491479

492-
if (oif) {
493-
if (local)
494-
return local;
495-
496-
if (flags & RT6_LOOKUP_F_IFACE)
497-
return net->ipv6.fib6_null_entry;
498-
}
480+
if (oif && flags & RT6_LOOKUP_F_IFACE)
481+
return net->ipv6.fib6_null_entry;
499482

500483
return rt->fib6_nh.nh_flags & RTNH_F_DEAD ? net->ipv6.fib6_null_entry : rt;
501484
}
@@ -586,9 +569,6 @@ static inline int rt6_check_dev(struct fib6_info *rt, int oif)
586569

587570
if (!oif || dev->ifindex == oif)
588571
return 2;
589-
if ((dev->flags & IFF_LOOPBACK) &&
590-
rt->fib6_idev && rt->fib6_idev->dev->ifindex == oif)
591-
return 1;
592572
return 0;
593573
}
594574

0 commit comments

Comments
 (0)