summaryrefslogtreecommitdiff
path: root/lib/nexthop.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2016-06-01 14:19:30 -0300
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-09-23 09:31:12 -0400
commitce54994727bf237e0f89168d6818b04ea79f090d (patch)
treebd363cc85b7031136d4d8d51407ed7bd8c737cc3 /lib/nexthop.c
parent4fcbf6e2d9a3c1f13d142e9b0dbd2369ec2b0bda (diff)
mpls: add support for LDP LSPs
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/nexthop.c')
-rw-r--r--lib/nexthop.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/nexthop.c b/lib/nexthop.c
index 8e775b68be..01771e253c 100644
--- a/lib/nexthop.c
+++ b/lib/nexthop.c
@@ -130,8 +130,8 @@ copy_nexthops (struct nexthop **tnh, struct nexthop *nh)
memcpy(&(nexthop->gate), &(nh->gate), sizeof(union g_addr));
memcpy(&(nexthop->src), &(nh->src), sizeof(union g_addr));
if (nh->nh_label)
- nexthop_add_labels (nexthop, nh->nh_label->num_labels,
- &nh->nh_label->label[0]);
+ nexthop_add_labels (nexthop, nh->nh_label_type,
+ nh->nh_label->num_labels, &nh->nh_label->label[0]);
nexthop_add(tnh, nexthop);
if (CHECK_FLAG(nh1->flags, NEXTHOP_FLAG_RECURSIVE))
@@ -164,12 +164,13 @@ nexthops_free (struct nexthop *nexthop)
/* Update nexthop with label information. */
void
-nexthop_add_labels (struct nexthop *nexthop, u_int8_t num_labels,
- mpls_label_t *label)
+nexthop_add_labels (struct nexthop *nexthop, enum lsp_types_t type,
+ u_int8_t num_labels, mpls_label_t *label)
{
struct nexthop_label *nh_label;
int i;
+ nexthop->nh_label_type = type;
nh_label = XCALLOC (MTYPE_NH_LABEL, sizeof (struct nexthop_label));
nh_label->num_labels = num_labels;
for (i = 0; i < num_labels; i++)
@@ -182,7 +183,10 @@ void
nexthop_del_labels (struct nexthop *nexthop)
{
if (nexthop->nh_label)
- XFREE (MTYPE_NH_LABEL, nexthop->nh_label);
+ {
+ XFREE (MTYPE_NH_LABEL, nexthop->nh_label);
+ nexthop->nh_label_type = ZEBRA_LSP_NONE;
+ }
}
const char *