diff options
author | vivek <vivek@cumulusnetworks.com> | 2016-04-16 04:19:37 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-09-23 15:30:56 +0200 |
commit | 40c7bdb0c9ba746d1f1bdfe1cb4d03aa5f407661 (patch) | |
tree | deeff1f385d86818d5f85258074960cdd2827508 /lib/nexthop.c | |
parent | Quagga: Fix alignment in netlink messages in some cases (diff) | |
download | frr-40c7bdb0c9ba746d1f1bdfe1cb4d03aa5f407661.tar.xz frr-40c7bdb0c9ba746d1f1bdfe1cb4d03aa5f407661.zip |
Quagga: Install label forwarding entries for statically configured LSPs
Install the statically configured LSPs into the FIB (kernel). This is done
using the new attributes and definitions for MPLS in the kernel -
RTA_VIA, RTA_NEWDST and AF_MPLS.
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-4804
Reviewed By: CCR-3088
Testing Done: Manual in SE-1
Diffstat (limited to 'lib/nexthop.c')
-rw-r--r-- | lib/nexthop.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/nexthop.c b/lib/nexthop.c index 427f77f87..465cc9485 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -32,8 +32,10 @@ #include "thread.h" #include "prefix.h" #include "nexthop.h" +#include "mpls.h" -DEFINE_MTYPE_STATIC(LIB, NEXTHOP, "Nexthop") +DEFINE_MTYPE_STATIC(LIB, NEXTHOP, "Nexthop") +DEFINE_MTYPE_STATIC(LIB, NH_LABEL, "Nexthop label") /* check if nexthops are same, non-recursive */ int @@ -138,6 +140,7 @@ copy_nexthops (struct nexthop **tnh, struct nexthop *nh) void nexthop_free (struct nexthop *nexthop) { + nexthop_del_labels (nexthop); if (nexthop->resolved) nexthops_free(nexthop->resolved); XFREE (MTYPE_NEXTHOP, nexthop); @@ -156,6 +159,29 @@ 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) +{ + struct nexthop_label *nh_label; + int i; + + nh_label = XCALLOC (MTYPE_NH_LABEL, sizeof (struct nexthop_label)); + nh_label->num_labels = num_labels; + for (i = 0; i < num_labels; i++) + nh_label->label[i] = *(label + i); + nexthop->nh_label = nh_label; +} + +/* Free label information of nexthop, if present. */ +void +nexthop_del_labels (struct nexthop *nexthop) +{ + if (nexthop->nh_label) + XFREE (MTYPE_NH_LABEL, nexthop->nh_label); +} + const char * nexthop2str (struct nexthop *nexthop, char *str, int size) { |