From: Donald Sharp Date: Thu, 15 Feb 2018 18:52:57 +0000 (-0500) Subject: zebra: Ensure unconfiguration works properly for vrf labels X-Git-Tag: frr-5.0-dev~227^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=8fd9db586f17d7034ad2ec1fd972e503c70349cb;p=matthieu%2Ffrr.git zebra: Ensure unconfiguration works properly for vrf labels 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 --- diff --git a/zebra/zserv.c b/zebra/zserv.c index ab8d8b51bc..b3b1fa79e9 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -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,