zebra: add explicit-null option for static MPLS LSPs

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
Renato Westphal 2016-09-17 10:55:24 -03:00 committed by Donald Sharp
parent e2a4192a42
commit e64f3c323b
2 changed files with 24 additions and 5 deletions

View File

@ -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);
}
}

View File

@ -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,