summaryrefslogtreecommitdiff
path: root/bgpd/bgp_open.c
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2017-05-10 09:40:29 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-05-10 10:06:47 -0400
commit343e90c328b27ea9497cdcd286e541cb163ab69a (patch)
tree388a109779bcf3fe04bfbe979a70a1f2fe42c39d /bgpd/bgp_open.c
parent0896b755080b300116d493444bfc05e2ef7ca9f6 (diff)
bgpd: add ENHE support for "address-family ipv4 labeled-unicast"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_open.c')
-rw-r--r--bgpd/bgp_open.c52
1 files changed, 27 insertions, 25 deletions
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 83fc3fe977..3ad6be1a3f 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -594,11 +594,11 @@ bgp_capability_enhe (struct peer *peer, struct capability_header *hdr)
/* RFC 5549 specifies use of this capability only for IPv4 AFI, with
* the Nexthop AFI being IPv6. A future spec may introduce other
* possibilities, so we ignore other values with a log. Also, only
- * Unicast SAFI is currently supported (and expected).
+ * SAFI_UNICAST and SAFI_LABELED_UNICAST are currently supported (and expected).
*/
nh_afi = afi_iana2int (pkt_nh_afi);
- if (afi != AFI_IP || safi != SAFI_UNICAST || nh_afi != AFI_IP6)
+ if (afi != AFI_IP || nh_afi != AFI_IP6 || !(safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST))
{
zlog_warn ("%s Unexpected afi/safi/next-hop afi: %u/%u/%u "
"in Extended Next-hop capability, ignoring",
@@ -1288,32 +1288,34 @@ bgp_open_capability (struct stream *s, struct peer *peer)
stream_putw (s, pkt_afi);
stream_putc (s, 0);
stream_putc (s, pkt_safi);
+
+ /* Extended nexthop capability - currently supporting RFC-5549 for
+ * Link-Local peering only
+ */
+ if (CHECK_FLAG (peer->flags, PEER_FLAG_CAPABILITY_ENHE) &&
+ peer->su.sa.sa_family == AF_INET6 &&
+ IN6_IS_ADDR_LINKLOCAL(&peer->su.sin6.sin6_addr) &&
+ afi == AFI_IP &&
+ (safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST))
+ {
+ /* RFC 5549 Extended Next Hop Encoding */
+ SET_FLAG (peer->cap, PEER_CAP_ENHE_ADV);
+ stream_putc (s, BGP_OPEN_OPT_CAP);
+ stream_putc (s, CAPABILITY_CODE_ENHE_LEN + 2);
+ stream_putc (s, CAPABILITY_CODE_ENHE);
+ stream_putc (s, CAPABILITY_CODE_ENHE_LEN);
+
+ SET_FLAG (peer->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_ADV);
+ stream_putw (s, pkt_afi);
+ stream_putw (s, pkt_safi);
+ stream_putw (s, afi_int2iana(AFI_IP6));
+
+ if (CHECK_FLAG (peer->af_cap[afi][safi], PEER_CAP_ENHE_AF_RCV))
+ SET_FLAG (peer->af_cap[afi][safi], PEER_CAP_ENHE_AF_NEGO);
+ }
}
}
- /* Extended nexthop capability - currently supporting RFC-5549 for
- * Link-Local peering only
- */
- if (CHECK_FLAG (peer->flags, PEER_FLAG_CAPABILITY_ENHE) &&
- peer->su.sa.sa_family == AF_INET6 &&
- IN6_IS_ADDR_LINKLOCAL(&peer->su.sin6.sin6_addr))
- {
- /* RFC 5549 Extended Next Hop Encoding */
- SET_FLAG (peer->cap, PEER_CAP_ENHE_ADV);
- stream_putc (s, BGP_OPEN_OPT_CAP);
- stream_putc (s, CAPABILITY_CODE_ENHE_LEN + 2);
- stream_putc (s, CAPABILITY_CODE_ENHE);
- stream_putc (s, CAPABILITY_CODE_ENHE_LEN);
- /* Currently supporting for SAFI_UNICAST only */
- SET_FLAG (peer->af_cap[AFI_IP][SAFI_UNICAST], PEER_CAP_ENHE_AF_ADV);
- stream_putw (s, AFI_IP);
- stream_putw (s, SAFI_UNICAST);
- stream_putw (s, AFI_IP6);
-
- if (CHECK_FLAG (peer->af_cap[AFI_IP][SAFI_UNICAST], PEER_CAP_ENHE_AF_RCV))
- SET_FLAG (peer->af_cap[AFI_IP][SAFI_UNICAST], PEER_CAP_ENHE_AF_NEGO);
- }
-
/* Route refresh. */
SET_FLAG (peer->cap, PEER_CAP_REFRESH_ADV);
stream_putc (s, BGP_OPEN_OPT_CAP);