Skip to content

Commit c00e51d

Browse files
David Aherndavem330
authored andcommitted
net: mpls: Don't show nexthop if device has been deleted
If the device for a nexthop in a multipath route is deleted, the nexthop is effectively removed from the route. Currently, a route dump still returns the nexhop though without the device set: $ ip -f mpls ro ls 100 nexthopvia inet 10.11.1.2 dev br0 nexthopvia inet 10.100.3.1 dev eth3 $ ip li del br0 $ ip -f mpls ro ls 100 nexthopvia inet 10.11.1.2 dev * dead linkdown nexthopvia inet 10.100.3.1 dev eth3 Since the nexthop is effectively deleted, drop the hop from the route dump. Signed-off-by: David Ahern <[email protected]> Acked-by: Roopa Prabhu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 88275ed commit c00e51d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

net/mpls/af_mpls.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,13 +1769,15 @@ static int mpls_dump_route(struct sk_buff *skb, u32 portid, u32 seq, int event,
17691769
goto nla_put_failure;
17701770

17711771
for_nexthops(rt) {
1772+
dev = rtnl_dereference(nh->nh_dev);
1773+
if (!dev)
1774+
continue;
1775+
17721776
rtnh = nla_reserve_nohdr(skb, sizeof(*rtnh));
17731777
if (!rtnh)
17741778
goto nla_put_failure;
17751779

1776-
dev = rtnl_dereference(nh->nh_dev);
1777-
if (dev)
1778-
rtnh->rtnh_ifindex = dev->ifindex;
1780+
rtnh->rtnh_ifindex = dev->ifindex;
17791781
if (nh->nh_flags & RTNH_F_LINKDOWN) {
17801782
rtnh->rtnh_flags |= RTNH_F_LINKDOWN;
17811783
linkdown++;

0 commit comments

Comments
 (0)