diff options
author | Lou Berger <lberger@labn.net> | 2016-01-12 19:42:02 +0100 |
---|---|---|
committer | vivek <vivek@cumulusnetworks.com> | 2016-06-12 00:36:42 +0200 |
commit | 587ff0fd881e3532226afa7a007a5a8ff7b89871 (patch) | |
tree | 365b73c9a50bcec3fa97763afd691e929eeb6b6e /bgpd/bgp_open.c | |
parent | bgpd: Fixes and updates for VPNv6 (diff) | |
download | frr-587ff0fd881e3532226afa7a007a5a8ff7b89871.tar.xz frr-587ff0fd881e3532226afa7a007a5a8ff7b89871.zip |
bgpd: encap: add encap SAFI (RFC5512)
Adds RFC5512 and Encapsulation Attribute.
Signed-off-by: Lou Berger <lberger@labn.net>
(cherry picked from commit 298cc2f688dbadf0a447fcd06ae8e20fa5006ce4)
Conflicts:
bgpd/Makefile.am
bgpd/bgp_attr.c
bgpd/bgp_open.c
bgpd/bgp_packet.c
bgpd/bgp_route.c
bgpd/bgp_vty.c
bgpd/bgpd.c
Diffstat (limited to 'bgpd/bgp_open.c')
-rw-r--r-- | bgpd/bgp_open.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index 54ca5efed..947f5c09d 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -102,6 +102,9 @@ bgp_capability_vty_out (struct vty *vty, struct peer *peer, u_char use_json, jso case SAFI_MPLS_LABELED_VPN: json_object_string_add(json_cap, "capabilityErrorMultiProtocolSafi", "MPLS-labeled VPN"); break; + case SAFI_ENCAP: + json_object_string_add(json_cap, "capabilityErrorMultiProtocolSafi", "encap"); + break; default: json_object_int_add(json_cap, "capabilityErrorMultiProtocolSafiUnknown", mpc.safi); break; @@ -130,9 +133,12 @@ bgp_capability_vty_out (struct vty *vty, struct peer *peer, u_char use_json, jso case SAFI_MULTICAST: vty_out (vty, "SAFI Multicast"); break; - case SAFI_MPLS_LABELED_VPN: + case SAFI_MPLS_LABELED_VPN: vty_out (vty, "SAFI MPLS-labeled VPN"); break; + case SAFI_ENCAP: + vty_out (vty, "SAFI ENCAP"); + break; default: vty_out (vty, "SAFI Unknown %d ", mpc.safi); break; @@ -185,6 +191,7 @@ bgp_afi_safi_valid_indices (afi_t afi, safi_t *safi) case SAFI_UNICAST: case SAFI_MULTICAST: case SAFI_MPLS_VPN: + case SAFI_ENCAP: return 1; } break; @@ -1127,9 +1134,11 @@ bgp_open_option_parse (struct peer *peer, u_char length, int *mp_capability) if (! peer->afc_nego[AFI_IP][SAFI_UNICAST] && ! peer->afc_nego[AFI_IP][SAFI_MULTICAST] && ! peer->afc_nego[AFI_IP][SAFI_MPLS_VPN] + && ! peer->afc_nego[AFI_IP][SAFI_ENCAP] && ! peer->afc_nego[AFI_IP6][SAFI_UNICAST] && ! peer->afc_nego[AFI_IP6][SAFI_MULTICAST] - && ! peer->afc_nego[AFI_IP6][SAFI_MPLS_VPN]) + && ! peer->afc_nego[AFI_IP6][SAFI_MPLS_VPN] + && ! peer->afc_nego[AFI_IP6][SAFI_ENCAP]) { zlog_err ("%s [Error] Configured AFI/SAFIs do not " "overlap with received MP capabilities", @@ -1276,6 +1285,18 @@ bgp_open_capability (struct stream *s, struct peer *peer) stream_putc (s, 0); stream_putc (s, SAFI_MPLS_LABELED_VPN); } + /* ENCAP */ + if (peer->afc[AFI_IP][SAFI_ENCAP]) + { + peer->afc_adv[AFI_IP][SAFI_ENCAP] = 1; + stream_putc (s, BGP_OPEN_OPT_CAP); + stream_putc (s, CAPABILITY_CODE_MP_LEN + 2); + stream_putc (s, CAPABILITY_CODE_MP); + stream_putc (s, CAPABILITY_CODE_MP_LEN); + stream_putw (s, AFI_IP); + stream_putc (s, 0); + stream_putc (s, SAFI_ENCAP); + } #ifdef HAVE_IPV6 /* Currently supporting RFC-5549 for Link-Local peering only */ if (CHECK_FLAG (peer->flags, PEER_FLAG_CAPABILITY_ENHE) && @@ -1333,6 +1354,18 @@ bgp_open_capability (struct stream *s, struct peer *peer) stream_putc (s, 0); stream_putc (s, SAFI_MPLS_LABELED_VPN); } + /* IPv6 ENCAP. */ + if (peer->afc[AFI_IP6][SAFI_ENCAP]) + { + peer->afc_adv[AFI_IP6][SAFI_ENCAP] = 1; + stream_putc (s, BGP_OPEN_OPT_CAP); + stream_putc (s, CAPABILITY_CODE_MP_LEN + 2); + stream_putc (s, CAPABILITY_CODE_MP); + stream_putc (s, CAPABILITY_CODE_MP_LEN); + stream_putw (s, AFI_IP6); + stream_putc (s, 0); + stream_putc (s, SAFI_ENCAP); + } #endif /* HAVE_IPV6 */ /* Route refresh. */ |