diff options
| author | Don Slice <dslice@cumulusnetworks.com> | 2017-02-02 12:58:33 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-04-06 10:29:19 -0400 |
| commit | a64448baa6150a7431d55e0e65d0b51d62c4b5be (patch) | |
| tree | adb195d3f8e26c4ae893f85fb1020e1d55d73241 /lib/nexthop.c | |
| parent | cceb79ac9b05c2f5d3e4a74b9cd11e908ea634ec (diff) | |
zebra: labeled unicast handling
Support install of labeled-unicast routes by a client. This would be
BGP, in order to install routes corresponding to AFI/SAFI 1/4 (IPv4)
or 2/4 (IPv6). Convert labeled-unicast routes into label forwarding
entries (i.e., transit LSPs) when there is a static label binding.
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Diffstat (limited to 'lib/nexthop.c')
| -rw-r--r-- | lib/nexthop.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/nexthop.c b/lib/nexthop.c index 7b8ac95e83..a6420fea33 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -92,6 +92,28 @@ nexthop_type_to_str (enum nexthop_types_t nh_type) return desc[nh_type]; } +/* + * Check if the labels match for the 2 nexthops specified. + */ +int +nexthop_labels_match (struct nexthop *nh1, struct nexthop *nh2) +{ + struct nexthop_label *nhl1, *nhl2; + + nhl1 = nh1->nh_label; + nhl2 = nh2->nh_label; + if ((nhl1 && !nhl2) || (!nhl1 && nhl2)) + return 0; + + if (nhl1->num_labels != nhl2->num_labels) + return 0; + + if (memcmp (nhl1->label, nhl2->label, nhl1->num_labels)) + return 0; + + return 1; +} + struct nexthop * nexthop_new (void) { |
