summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2017-06-20 19:53:27 +0000
committerDaniel Walton <dwalton@cumulusnetworks.com>2017-06-20 19:53:27 +0000
commitbf468c3ca5d96af40ba4af4967ec3e48fdf76447 (patch)
treea7aebb4e423c9e2c6bece888423580953f0353b3
parent0826e83cf6757a9ed47492b0cdce52f4d18a6647 (diff)
bgpd: Install SAFI_LABELED_UNICAST routes in SAFI_UNICAST table
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
-rw-r--r--bgpd/bgp_attr.c1
-rw-r--r--bgpd/bgp_label.c9
-rw-r--r--bgpd/bgp_label.h5
3 files changed, 9 insertions, 6 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 1d038ba450..94dd5a7f12 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -685,6 +685,7 @@ attrhash_key_make (void *p)
MIX(extra->mp_nexthop_global_in.s_addr);
MIX(extra->originator_id.s_addr);
MIX(extra->tag);
+ MIX(extra->label);
MIX(extra->label_index);
}
diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c
index adeaa7f3bd..fc0654f186 100644
--- a/bgpd/bgp_label.c
+++ b/bgpd/bgp_label.c
@@ -177,7 +177,7 @@ bgp_nlri_get_labels (struct peer *peer, u_char *pnt, u_char plen, mpls_label_t *
u_char *data = pnt;
u_char *lim = pnt + plen;
u_char llen = 0;
- u_char label_index = 0;
+ u_char label_depth = 0;
for (; data < lim; data += BGP_LABEL_BYTES)
{
@@ -185,18 +185,17 @@ bgp_nlri_get_labels (struct peer *peer, u_char *pnt, u_char plen, mpls_label_t *
llen += BGP_LABEL_BYTES;
bgp_set_valid_label(label);
+ label_depth += 1;
if (bgp_is_withdraw_label(label) || label_bos(label))
break;
-
- label_index += 1;
}
/* If we RX multiple labels we will end up keeping only the last
* one. We do not yet support a label stack greater than 1. */
- if (label_index > 1)
+ if (label_depth > 1)
zlog_warn("%s rcvd UPDATE with label stack %d deep",
- peer->host, label_index);
+ peer->host, label_depth);
if (!(bgp_is_withdraw_label(label) || label_bos(label)))
zlog_warn("%s rcvd UPDATE with invalid label stack - no bottom of stack",
diff --git a/bgpd/bgp_label.h b/bgpd/bgp_label.h
index 796df6652b..c98f4531f6 100644
--- a/bgpd/bgp_label.h
+++ b/bgpd/bgp_label.h
@@ -51,7 +51,10 @@ static inline int
bgp_is_withdraw_label (mpls_label_t *label)
{
u_char *pkt = (u_char *) label;
- if ((pkt[0] == 0x80) && (pkt[1] == 0x00) && (pkt[2] == 0x00))
+
+ /* The check on pkt[2] for 0x00 or 0x02 is in case bgp_set_valid_label()
+ * was called on the withdraw label */
+ if ((pkt[0] == 0x80) && (pkt[1] == 0x00) && ((pkt[2] == 0x00) || (pkt[2] == 0x02)))
return 1;
return 0;
}