]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: only pass mpls proto type if doing install 1362/head
authorDon Slice <dslice@cumulusnetworks.com>
Mon, 16 Oct 2017 16:07:15 +0000 (09:07 -0700)
committerDon Slice <dslice@cumulusnetworks.com>
Wed, 25 Oct 2017 12:19:22 +0000 (08:19 -0400)
Problem reported with not deleting LSPs from the zebra kernal mpls table
when a delete occurred in bgp.  Found that we were exiting the delete
process incorrectly due to not being able to derive the route_type from
the best_nhlre on the lsp while deleting. Since this info was only
needed for route installation, removed this early exit in the case of
deleting the lsp.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Ticket: CM-18309
Reviewed By: CCR-6781
Testing Done:  Manual testing looks good.  mpls tests successful

zebra/rt_netlink.c

index 0cc2e0217f29c7dc594f31a329bf76803994b98a..c9a6335277ba48fe24dc366eac9de979bb64766a 100644 (file)
@@ -2370,7 +2370,6 @@ int netlink_mpls_multipath(int cmd, zebra_lsp_t *lsp)
 
        memset(&req, 0, sizeof req - NL_PKT_BUF_SIZE);
 
-
        /*
         * Count # nexthops so we can decide whether to use singlepath
         * or multipath case.
@@ -2394,11 +2393,9 @@ int netlink_mpls_multipath(int cmd, zebra_lsp_t *lsp)
                }
        }
 
-       if (nexthop_num == 0 || !lsp->best_nhlfe) // unexpected
+       if ((nexthop_num == 0) || (!lsp->best_nhlfe && (cmd != RTM_DELROUTE)))
                return 0;
 
-       route_type = re_type_from_lsp_type(lsp->best_nhlfe->type);
-
        req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg));
        req.n.nlmsg_flags = NLM_F_CREATE | NLM_F_REQUEST;
        req.n.nlmsg_type = cmd;
@@ -2407,14 +2404,18 @@ int netlink_mpls_multipath(int cmd, zebra_lsp_t *lsp)
        req.r.rtm_family = AF_MPLS;
        req.r.rtm_table = RT_TABLE_MAIN;
        req.r.rtm_dst_len = MPLS_LABEL_LEN_BITS;
-       req.r.rtm_protocol = zebra2proto(route_type);
        req.r.rtm_scope = RT_SCOPE_UNIVERSE;
        req.r.rtm_type = RTN_UNICAST;
 
-       if (cmd == RTM_NEWROUTE)
+       if (cmd == RTM_NEWROUTE) {
                /* We do a replace to handle update. */
                req.n.nlmsg_flags |= NLM_F_REPLACE;
 
+               /* set the protocol value if installing */
+               route_type = re_type_from_lsp_type(lsp->best_nhlfe->type);
+               req.r.rtm_protocol = zebra2proto(route_type);
+       }
+
        /* Fill destination */
        lse = mpls_lse_encode(lsp->ile.in_label, 0, 0, 1);
        addattr_l(&req.n, sizeof req, RTA_DST, &lse, sizeof(mpls_lse_t));