summaryrefslogtreecommitdiff
path: root/zebra/zebra_mpls.c
diff options
context:
space:
mode:
authoranlan_cs <anlan_cs@tom.com>2024-05-16 16:44:45 +0800
committeranlan_cs <anlan_cs@tom.com>2024-05-16 23:30:41 +0800
commit05ad3ccb034c174d2e853e88b826ca0db1e77f45 (patch)
treea319bdd6124be2a4195af21568b8376c01f83765 /zebra/zebra_mpls.c
parentdb1e2a094d3a24b5bbf515c1d5b61ba48d85a43a (diff)
zebra: fix mpls command
Configured with "mpls label bind 1.1.1.1/32 explicit-null", the running configuration is: ``` ! mpls label bind 1.1.1.1/32 IPv4 Explicit Null ! ``` After this commit, the running configuration is: ``` ! mpls label bind 1.1.1.1/32 explicit-null ! ``` And add the support for the "no" form: ``` anlan(config)# mpls label bind 1.1.1.1/32 explicit-null anlan(config)# no mpls label bind 1.1.1.1/32 explicit-null ``` Signed-off-by: anlan_cs <anlan_cs@tom.com>
Diffstat (limited to 'zebra/zebra_mpls.c')
-rw-r--r--zebra/zebra_mpls.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index 4cc85d461f..d1c9cd54af 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -2638,8 +2638,16 @@ int zebra_mpls_write_fec_config(struct vty *vty, struct zebra_vrf *zvrf)
continue;
write = 1;
- vty_out(vty, "mpls label bind %pFX %s\n", &rn->p,
- label2str(fec->label, 0, lstr, BUFSIZ));
+
+ if (fec->label == MPLS_LABEL_IPV4_EXPLICIT_NULL ||
+ fec->label == MPLS_LABEL_IPV6_EXPLICIT_NULL)
+ strlcpy(lstr, "explicit-null", sizeof(lstr));
+ else if (fec->label == MPLS_LABEL_IMPLICIT_NULL)
+ strlcpy(lstr, "implicit-null", sizeof(lstr));
+ else
+ snprintf(lstr, sizeof(lstr), "%d", fec->label);
+
+ vty_out(vty, "mpls label bind %pFX %s\n", &rn->p, lstr);
}
}