]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Ensure unconfiguration works properly for vrf labels 1753/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 15 Feb 2018 18:52:57 +0000 (13:52 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 15 Feb 2018 18:52:57 +0000 (13:52 -0500)
If you were to configure a v4 and v6 vrf pop and forward label
that both happened to be the same, unconfiguring one would
remove them both.

This fixes that issue by noticing if we should remove it or
not based upon v4 or v6 having the same label or not.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/zserv.c

index ab8d8b51bcbc5b9905bd09f53028ab75640dd088..b3b1fa79e9ba89880ba1bcecf965cdbbad1fa398 100644 (file)
@@ -2522,9 +2522,29 @@ static void zread_vrf_label(struct zserv *client,
 
        def_zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
 
-       if (zvrf->label[afi] != MPLS_LABEL_NONE)
-               mpls_lsp_uninstall(def_zvrf, ltype, zvrf->label[afi],
-                                  NEXTHOP_TYPE_IFINDEX, NULL, ifp->ifindex);
+       if (zvrf->label[afi] != MPLS_LABEL_NONE) {
+               afi_t scrubber;
+               bool really_remove;
+
+               really_remove = true;
+               for (scrubber = AFI_IP; scrubber < AFI_MAX ; scrubber++) {
+                       if (scrubber == afi)
+                               continue;
+
+                       if (zvrf->label[scrubber] == MPLS_LABEL_NONE)
+                               continue;
+
+                       if (zvrf->label[afi] == zvrf->label[scrubber]) {
+                               really_remove = false;
+                               break;
+                       }
+               }
+
+               if (really_remove)
+                       mpls_lsp_uninstall(def_zvrf, ltype, zvrf->label[afi],
+                                          NEXTHOP_TYPE_IFINDEX, NULL,
+                                          ifp->ifindex);
+       }
 
        if (nlabel != MPLS_LABEL_NONE)
                mpls_lsp_install(def_zvrf, ltype, nlabel, MPLS_LABEL_IMPLICIT_NULL,