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

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: default avatarDavid Ahern <dsa@cumulusnetworks.com>
Acked-by: default avatarRoopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 88275ed0
...@@ -1769,12 +1769,14 @@ static int mpls_dump_route(struct sk_buff *skb, u32 portid, u32 seq, int event, ...@@ -1769,12 +1769,14 @@ static int mpls_dump_route(struct sk_buff *skb, u32 portid, u32 seq, int event,
goto nla_put_failure; goto nla_put_failure;
for_nexthops(rt) { for_nexthops(rt) {
dev = rtnl_dereference(nh->nh_dev);
if (!dev)
continue;
rtnh = nla_reserve_nohdr(skb, sizeof(*rtnh)); rtnh = nla_reserve_nohdr(skb, sizeof(*rtnh));
if (!rtnh) if (!rtnh)
goto nla_put_failure; goto nla_put_failure;
dev = rtnl_dereference(nh->nh_dev);
if (dev)
rtnh->rtnh_ifindex = dev->ifindex; rtnh->rtnh_ifindex = dev->ifindex;
if (nh->nh_flags & RTNH_F_LINKDOWN) { if (nh->nh_flags & RTNH_F_LINKDOWN) {
rtnh->rtnh_flags |= RTNH_F_LINKDOWN; rtnh->rtnh_flags |= RTNH_F_LINKDOWN;
......
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