diff options
Diffstat (limited to 'bgpd/bgp_open.c')
| -rw-r--r-- | bgpd/bgp_open.c | 96 |
1 files changed, 53 insertions, 43 deletions
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index 51079f31e0..4374729668 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -1,22 +1,22 @@ /* BGP open message handling - Copyright (C) 1998, 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -GNU Zebra is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1998, 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ #include <zebra.h> @@ -108,6 +108,9 @@ bgp_capability_vty_out (struct vty *vty, struct peer *peer, u_char use_json, jso case SAFI_MULTICAST: json_object_string_add(json_cap, "capabilityErrorMultiProtocolSafi", "multicast"); break; + case SAFI_LABELED_UNICAST: + json_object_string_add(json_cap, "capabilityErrorMultiProtocolSafi", "labeled-unicast"); + break; case SAFI_MPLS_VPN: json_object_string_add(json_cap, "capabilityErrorMultiProtocolSafi", "MPLS-labeled VPN"); break; @@ -148,6 +151,9 @@ 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_LABELED_UNICAST: + vty_out (vty, "SAFI Labeled-unicast"); + break; case SAFI_MPLS_VPN: vty_out (vty, "SAFI MPLS-labeled VPN"); break; @@ -588,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", @@ -1143,10 +1149,12 @@ 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_LABELED_UNICAST] && ! 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_LABELED_UNICAST] && ! peer->afc_nego[AFI_IP6][SAFI_MPLS_VPN] && ! peer->afc_nego[AFI_IP6][SAFI_ENCAP] && ! peer->afc_nego[AFI_L2VPN][SAFI_EVPN]) @@ -1280,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); |
