summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2016-09-17 15:55:24 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-09-23 15:31:22 +0200
commite64f3c323bf176544c5d0cac9a9d55fc4510972a (patch)
treefcc84ee6cfd2e93599ac97ed35e56d9d1bb13d65 /zebra
parentzebra: fix bug in nexthop label allocation (diff)
downloadfrr-e64f3c323bf176544c5d0cac9a9d55fc4510972a.tar.xz
frr-e64f3c323bf176544c5d0cac9a9d55fc4510972a.zip
zebra: add explicit-null option for static MPLS LSPs
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/zebra_mpls.c19
-rw-r--r--zebra/zebra_mpls_vty.c10
2 files changed, 24 insertions, 5 deletions
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index 07b69eccd..ccb81dcff 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -1837,18 +1837,31 @@ zebra_mpls_write_lsp_config (struct vty *vty, struct zebra_vrf *zvrf)
zebra_slsp_t *slsp;
zebra_snhlfe_t *snhlfe;
struct listnode *node;
- char buf[INET6_ADDRSTRLEN];
struct list *slsp_list = hash_get_sorted_list(zvrf->slsp_table, slsp_cmp);
for (ALL_LIST_ELEMENTS_RO(slsp_list, node, slsp))
{
for (snhlfe = slsp->snhlfe_list; snhlfe; snhlfe = snhlfe->next)
{
+ char buf[INET6_ADDRSTRLEN];
char lstr[30];
+
snhlfe2str (snhlfe, buf, BUFSIZ);
+ switch (snhlfe->out_label) {
+ case MPLS_V4_EXP_NULL_LABEL:
+ case MPLS_V6_EXP_NULL_LABEL:
+ strlcpy(lstr, "explicit-null", sizeof(lstr));
+ break;
+ case MPLS_IMP_NULL_LABEL:
+ strlcpy(lstr, "implicit-null", sizeof(lstr));
+ break;
+ default:
+ sprintf(lstr, "%u", snhlfe->out_label);
+ break;
+ }
+
vty_out (vty, "mpls lsp %u %s %s%s",
- slsp->ile.in_label, buf,
- label2str(snhlfe->out_label, lstr, 30), VTY_NEWLINE);
+ slsp->ile.in_label, buf, lstr, VTY_NEWLINE);
}
}
diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c
index 6975ba560..e5f6932e8 100644
--- a/zebra/zebra_mpls_vty.c
+++ b/zebra/zebra_mpls_vty.c
@@ -115,6 +115,10 @@ zebra_mpls_transit_lsp (struct vty *vty, int add_cmd, const char *inlabel_str,
{
if (outlabel_str[0] == 'i')
out_label = MPLS_IMP_NULL_LABEL;
+ else if (outlabel_str[0] == 'e' && gtype == NEXTHOP_TYPE_IPV4)
+ out_label = MPLS_V4_EXP_NULL_LABEL;
+ else if (outlabel_str[0] == 'e' && gtype == NEXTHOP_TYPE_IPV6)
+ out_label = MPLS_V6_EXP_NULL_LABEL;
else
out_label = atoi(outlabel_str);
}
@@ -150,13 +154,14 @@ zebra_mpls_transit_lsp (struct vty *vty, int add_cmd, const char *inlabel_str,
DEFUN (mpls_transit_lsp,
mpls_transit_lsp_cmd,
- "mpls lsp <16-1048575> (A.B.C.D|X:X::X:X) (<16-1048575>|implicit-null)",
+ "mpls lsp <16-1048575> (A.B.C.D|X:X::X:X) (<16-1048575>|explicit-null|implicit-null)",
MPLS_STR
"Establish label switched path\n"
"Incoming MPLS label\n"
"IPv4 gateway address\n"
"IPv6 gateway address\n"
"Outgoing MPLS label\n"
+ "Use Explicit-Null label\n"
"Use Implicit-Null label\n")
{
return zebra_mpls_transit_lsp (vty, 1, argv[0], argv[1], argv[2], NULL);
@@ -177,7 +182,7 @@ DEFUN (no_mpls_transit_lsp,
ALIAS (no_mpls_transit_lsp,
no_mpls_transit_lsp_out_label_cmd,
- "no mpls lsp <16-1048575> (A.B.C.D|X:X::X:X) (<16-1048575>|implicit-null)",
+ "no mpls lsp <16-1048575> (A.B.C.D|X:X::X:X) (<16-1048575>|explicit-null|implicit-null)",
NO_STR
MPLS_STR
"Establish label switched path\n"
@@ -185,6 +190,7 @@ ALIAS (no_mpls_transit_lsp,
"IPv4 gateway address\n"
"IPv6 gateway address\n"
"Outgoing MPLS label\n"
+ "Use Explicit-Null label\n"
"Use Implicit-Null label\n")
DEFUN (no_mpls_transit_lsp_all,