A recent commit skips nexthops in a route if the device has been
deleted. Update lfib_nlmsg_size accordingly.

Reported-by: Roopa Prabhu <ro...@cumulusnetworks.com>
Signed-off-by: David Ahern <d...@cumulusnetworks.com>
---
 net/mpls/af_mpls.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 74755920c689..0d08229c98c9 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -1876,6 +1876,8 @@ static inline size_t lfib_nlmsg_size(struct mpls_route 
*rt)
                size_t nhsize = 0;
 
                for_nexthops(rt) {
+                       if (!rtnl_dereference(nh->nh_dev))
+                               continue;
                        nhsize += nla_total_size(sizeof(struct rtnexthop));
                        /* RTA_VIA */
                        if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC)
-- 
2.1.4

Reply via email to