diff --git a/bgpd/Makefile.am b/bgpd/Makefile.am index 4ea0455525..a57a66488f 100644 --- a/bgpd/Makefile.am +++ b/bgpd/Makefile.am @@ -80,7 +80,7 @@ libbgp_a_SOURCES = \ bgp_mplsvpn.c bgp_nexthop.c \ bgp_damp.c bgp_table.c bgp_advertise.c bgp_vty.c bgp_mpath.c \ bgp_nht.c bgp_updgrp.c bgp_updgrp_packet.c bgp_updgrp_adv.c bgp_bfd.c \ - bgp_encap.c bgp_encap_tlv.c $(BGP_VNC_RFAPI_SRC) bgp_attr_evpn.c \ + bgp_encap_tlv.c $(BGP_VNC_RFAPI_SRC) bgp_attr_evpn.c \ bgp_evpn.c bgp_evpn_vty.c bgp_vpn.c bgp_label.c noinst_HEADERS = \ @@ -91,7 +91,7 @@ noinst_HEADERS = \ bgp_ecommunity.h bgp_lcommunity.h \ bgp_mplsvpn.h bgp_nexthop.h bgp_damp.h bgp_table.h \ bgp_advertise.h bgp_vty.h bgp_mpath.h bgp_nht.h \ - bgp_updgrp.h bgp_bfd.h bgp_encap.h bgp_encap_tlv.h bgp_encap_types.h \ + bgp_updgrp.h bgp_bfd.h bgp_encap_tlv.h bgp_encap_types.h \ $(BGP_VNC_RFAPI_HD) bgp_attr_evpn.h bgp_evpn.h bgp_evpn_vty.h \ bgp_vpn.h bgp_label.h diff --git a/bgpd/bgp_encap.c b/bgpd/bgp_encap.c deleted file mode 100644 index 572d9fdd1e..0000000000 --- a/bgpd/bgp_encap.c +++ /dev/null @@ -1,805 +0,0 @@ -/* - * This file created by LabN Consulting, L.L.C. - * - * This file is based on bgp_mplsvpn.c which is Copyright (C) 2000 - * 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 - -#include "command.h" -#include "prefix.h" -#include "log.h" -#include "memory.h" -#include "stream.h" -#include "filter.h" - -#include "bgpd/bgpd.h" -#include "bgpd/bgp_table.h" -#include "bgpd/bgp_route.h" -#include "bgpd/bgp_attr.h" -#include "bgpd/bgp_ecommunity.h" -#include "bgpd/bgp_lcommunity.h" -#include "bgpd/bgp_mplsvpn.h" -#include "bgpd/bgp_vty.h" -#include "bgpd/bgp_encap.h" - -#if ENABLE_BGP_VNC -#include "bgpd/rfapi/rfapi_backend.h" -#endif - -static void -ecom2prd(struct ecommunity *ecom, struct prefix_rd *prd) -{ - int i; - - memset(prd, 0, sizeof(struct prefix_rd)); - prd->family = AF_UNSPEC; - prd->prefixlen = 64; - - if (!ecom) - return; - - for (i = 0; i < (ecom->size * ECOMMUNITY_SIZE); i += ECOMMUNITY_SIZE) { - - uint8_t *ep; - - ep = ecom->val + i; - - switch (ep[0]) { - default: - continue; - - case 0x80: - case 0x81: - case 0x82: - if (ep[1] == 0x0) { - prd->val[1] = ep[0] & 0x03; - memcpy(prd->val + 2, ep + 2, 6); - return; - } - } - } -} - -int -bgp_nlri_parse_encap( - struct peer *peer, - struct attr *attr, - struct bgp_nlri *packet) -{ - u_char *pnt; - u_char *lim; - afi_t afi = packet->afi; - struct prefix p; - int psize = 0; - int prefixlen; - struct rd_as rd_as; - struct rd_ip rd_ip; - struct prefix_rd prd; - struct ecommunity *pEcom = NULL; - u_int16_t rdtype = 0xffff; - char buf[BUFSIZ]; - - /* Check peer status. */ - if (peer->status != Established) - return 0; - - /* Make prefix_rd */ - if (attr && attr->extra && attr->extra->ecommunity) - pEcom = attr->extra->ecommunity; - - ecom2prd(pEcom, &prd); - memset(&rd_as, 0, sizeof(rd_as)); - memset(&rd_ip, 0, sizeof(rd_ip)); - - if (pEcom) { - - rdtype = (prd.val[0] << 8) | prd.val[1]; - - /* Decode RD value. */ - if (rdtype == RD_TYPE_AS) - decode_rd_as (prd.val + 2, &rd_as); - else if (rdtype == RD_TYPE_IP) - decode_rd_ip (prd.val + 2, &rd_ip); - else if (rdtype == RD_TYPE_AS4) - decode_rd_as4 (prd.val + 2, &rd_as); - else - { - zlog_err ("Invalid RD type %d", rdtype); - } - - } - - /* - * NB: this code was based on the MPLS VPN code, which supported RDs. - * For the moment we are retaining the underlying RIB structure that - * keeps a per-RD radix tree, but since the RDs are not carried over - * the wire, we set the RD internally to 0. - */ - prd.family = AF_UNSPEC; - prd.prefixlen = 64; - memset(prd.val, 0, sizeof(prd.val)); - - pnt = packet->nlri; - lim = pnt + packet->length; - - for (; pnt < lim; pnt += psize) - { - /* Clear prefix structure. */ - memset (&p, 0, sizeof (struct prefix)); - - /* Fetch prefix length. */ - prefixlen = *pnt++; - p.family = afi2family(afi); - if (p.family == 0) { - /* bad afi, shouldn't happen */ - zlog_warn("%s: bad afi %d, dropping incoming route", __func__, afi); - continue; - } - psize = PSIZE (prefixlen); - - p.prefixlen = prefixlen; - memcpy (&p.u.prefix, pnt, psize); - - if (pnt + psize > lim) - return -1; - - - if (rdtype == RD_TYPE_AS) - zlog_info ("rd-as %u:%u prefix %s/%d", rd_as.as, rd_as.val, - inet_ntop (p.family, &p.u.prefix, buf, BUFSIZ), - p.prefixlen); - else if (rdtype == RD_TYPE_IP) - zlog_info ("rd-ip %s:%u prefix %s/%d", inet_ntoa (rd_ip.ip), - rd_ip.val, - inet_ntop (p.family, &p.u.prefix, buf, BUFSIZ), - p.prefixlen); - else if (rdtype == RD_TYPE_AS4) - zlog_info ("rd-as4 %u:%u prefix %s/%d", rd_as.as, rd_as.val, - inet_ntop (p.family, &p.u.prefix, buf, BUFSIZ), - p.prefixlen); - else - zlog_info ("rd unknown, default to 0:0 prefix %s/%d", - inet_ntop (p.family, &p.u.prefix, buf, BUFSIZ), - p.prefixlen); - - if (attr) { - bgp_update (peer, &p, 0, attr, afi, SAFI_ENCAP, - ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL, 0, NULL); - } else { - bgp_withdraw (peer, &p, 0, attr, afi, SAFI_ENCAP, - ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL, NULL); - } - } - - /* Packet length consistency check. */ - if (pnt != lim) - return -1; - - return 0; -} - - -/* TBD: these routes should probably all be host routes */ - -/* For testing purpose, static route of ENCAP. */ -DEFUN (encap_network, - encap_network_cmd, - "network A.B.C.D/M rd ASN:nn_or_IP-address:nn", - "Specify a network to announce via BGP\n" - "IPv4 prefix\n" - "Specify Route Distinguisher\n" - "ENCAP Route Distinguisher\n") -{ - int idx_ipv4 = 1; - int idx_rd = 3; - return bgp_static_set_safi (AFI_IP, SAFI_ENCAP, vty, argv[idx_ipv4]->arg, argv[idx_rd]->arg, NULL, - NULL, 0, NULL, NULL, NULL, NULL); -} - -/* For testing purpose, static route of ENCAP. */ -DEFUN (no_encap_network, - no_encap_network_cmd, - "no network A.B.C.D/M rd ASN:nn_or_IP-address:nn", - NO_STR - "Specify a network to announce via BGP\n" - "IPv4 prefix\n" - "Specify Route Distinguisher\n" - "ENCAP Route Distinguisher\n" - "BGP tag\n" - "tag value\n") -{ - int idx_ipv4 = 2; - int idx_rd = 4; - return bgp_static_unset_safi (AFI_IP, SAFI_ENCAP, vty, argv[idx_ipv4]->arg, argv[idx_rd]->arg, NULL, - 0, NULL, NULL, NULL); -} - -DEFUN (encapv6_network, - encapv6_network_cmd, - "network X:X::X:X/M rd ASN:nn_or_IP-address:nn [route-map WORD]", - "Specify a network to announce via BGP\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Specify Route Distinguisher\n" - "VPN Route Distinguisher\n" - "route map\n" - "route map name\n") -{ - int idx_ipv6 = 1; - int idx_rd = 3; - int idx_rmap = 5; - const char *rmap_str = (argc == 6) ? argv[idx_rmap]->arg : NULL; - return bgp_static_set_safi (AFI_IP6, SAFI_ENCAP, vty, argv[idx_ipv6]->arg, - argv[idx_rd]->arg, NULL, rmap_str, 0, NULL, - NULL, NULL, NULL); -} - -DEFUN (no_encapv6_network, - no_encapv6_network_cmd, - "no network X:X::X:X/M rd ASN:nn_or_IP-address:nn [route-map WORD]", - NO_STR - "Specify a network to announce via BGP\n" - "IPv6 prefix /, e.g., 3ffe::/16\n" - "Specify Route Distinguisher\n" - "VPN Route Distinguisher\n" - "route map\n" - "route map name\n") -{ - int idx_ipv6 = 2; - int idx_rd = 4; - return bgp_static_unset_safi (AFI_IP6, SAFI_ENCAP, vty, argv[idx_ipv6]->arg, - argv[idx_rd]->arg, NULL, 0, NULL, NULL, NULL); -} - -static int -show_adj_route_encap (struct vty *vty, struct peer *peer, struct prefix_rd *prd) -{ - struct bgp *bgp; - struct bgp_table *table; - struct bgp_node *rn; - struct bgp_node *rm; - struct attr *attr; - int rd_header; - int header = 1; - char v4_header[] = " Network Next Hop Metric LocPrf Weight Path%s"; - - bgp = bgp_get_default (); - if (bgp == NULL) - { - vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); - return CMD_WARNING; - } - - for (rn = bgp_table_top (bgp->rib[AFI_IP][SAFI_ENCAP]); rn; - rn = bgp_route_next (rn)) - { - if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) - continue; - - if ((table = rn->info) != NULL) - { - rd_header = 1; - - for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm)) - if ((attr = rm->info) != NULL) - { - if (header) - { - vty_out (vty, "BGP table version is 0, local router ID is %s%s", - inet_ntoa (bgp->router_id), VTY_NEWLINE); - vty_out (vty, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s", - VTY_NEWLINE); - vty_out (vty, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s", - VTY_NEWLINE, VTY_NEWLINE); - vty_out (vty, v4_header, VTY_NEWLINE); - header = 0; - } - - if (rd_header) - { - u_int16_t type; - struct rd_as rd_as; - struct rd_ip rd_ip; - u_char *pnt; - - pnt = rn->p.u.val; - - vty_out (vty, "Route Distinguisher: "); - - /* Decode RD type. */ - type = decode_rd_type (pnt); - - switch (type) { - - case RD_TYPE_AS: - decode_rd_as (pnt + 2, &rd_as); - vty_out (vty, "%u:%d", rd_as.as, rd_as.val); - break; - - case RD_TYPE_IP: - decode_rd_ip (pnt + 2, &rd_ip); - vty_out (vty, "%s:%d", inet_ntoa (rd_ip.ip), rd_ip.val); - break; - - default: - vty_out (vty, "unknown RD type"); - } - - - vty_out (vty, "%s", VTY_NEWLINE); - rd_header = 0; - } - route_vty_out_tmp (vty, &rm->p, attr, SAFI_ENCAP, 0, NULL); - } - } - } - return CMD_SUCCESS; -} - -int -bgp_show_encap ( - struct vty *vty, - afi_t afi, - struct prefix_rd *prd, - enum bgp_show_type type, - void *output_arg, - int tags) -{ - struct bgp *bgp; - struct bgp_table *table; - struct bgp_node *rn; - struct bgp_node *rm; - struct bgp_info *ri; - int rd_header; - int header = 1; - char v4_header[] = " Network Next Hop Metric LocPrf Weight Path%s"; - char v4_header_tag[] = " Network Next Hop In tag/Out tag%s"; - - unsigned long output_count = 0; - unsigned long total_count = 0; - - bgp = bgp_get_default (); - if (bgp == NULL) - { - vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); - return CMD_WARNING; - } - - if ((afi != AFI_IP) && (afi != AFI_IP6)) { - vty_out (vty, "Afi %d not supported%s", afi, VTY_NEWLINE); - return CMD_WARNING; - } - - for (rn = bgp_table_top (bgp->rib[afi][SAFI_ENCAP]); rn; rn = bgp_route_next (rn)) - { - if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) - continue; - - if ((table = rn->info) != NULL) - { - rd_header = 1; - - for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm)) - for (ri = rm->info; ri; ri = ri->next) - { - total_count++; - if (type == bgp_show_type_neighbor) - { - union sockunion *su = output_arg; - - if (ri->peer->su_remote == NULL || ! sockunion_same(ri->peer->su_remote, su)) - continue; - } - if (header) - { - if (tags) - vty_out (vty, v4_header_tag, VTY_NEWLINE); - else - { - vty_out (vty, "BGP table version is 0, local router ID is %s%s", - inet_ntoa (bgp->router_id), VTY_NEWLINE); - vty_out (vty, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s", - VTY_NEWLINE); - vty_out (vty, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s", - VTY_NEWLINE, VTY_NEWLINE); - vty_out (vty, v4_header, VTY_NEWLINE); - } - header = 0; - } - - if (rd_header) - { - u_int16_t type; - struct rd_as rd_as; - struct rd_ip rd_ip; - u_char *pnt; - - pnt = rn->p.u.val; - - /* Decode RD type. */ - type = decode_rd_type (pnt); - - vty_out (vty, "Route Distinguisher: "); - - switch (type) { - - case RD_TYPE_AS: - decode_rd_as (pnt + 2, &rd_as); - vty_out (vty, "%u:%d", rd_as.as, rd_as.val); - break; - - case RD_TYPE_IP: - decode_rd_ip (pnt + 2, &rd_ip); - vty_out (vty, "%s:%d", inet_ntoa (rd_ip.ip), rd_ip.val); - break; - - default: - vty_out (vty, "Unknown RD type"); - break; - } - - vty_out (vty, "%s", VTY_NEWLINE); - rd_header = 0; - } - if (tags) - route_vty_out_tag (vty, &rm->p, ri, 0, SAFI_ENCAP, NULL); - else - route_vty_out (vty, &rm->p, ri, 0, SAFI_ENCAP, NULL); - output_count++; - } - } - } - - if (output_count == 0) - { - vty_out (vty, "No prefixes displayed, %ld exist%s", total_count, VTY_NEWLINE); - } - else - vty_out (vty, "%sDisplayed %ld routes and %ld total paths%s", - VTY_NEWLINE, output_count, total_count, VTY_NEWLINE); - - return CMD_SUCCESS; -} - -DEFUN (show_bgp_ipv4_encap_rd, - show_bgp_ipv4_encap_rd_cmd, - "show [ip] bgp ipv4 encap rd ASN:nn_or_IP-address:nn", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n") -{ - int idx_rd = 5; - int ret; - struct prefix_rd prd; - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - return bgp_show_encap (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 0); -} - -DEFUN (show_bgp_ipv6_encap_rd, - show_bgp_ipv6_encap_rd_cmd, - "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n" - "Display BGP tags for prefixes\n") -{ - int idx_rd = 5; - int ret; - struct prefix_rd prd; - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - return bgp_show_encap (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 0); -} - -DEFUN (show_bgp_ipv4_encap_tags, - show_bgp_ipv4_encap_tags_cmd, - "show [ip] bgp ipv4 encap tags", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display BGP tags for prefixes\n") -{ - return bgp_show_encap (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 1); -} - -DEFUN (show_bgp_ipv6_encap_tags, - show_bgp_ipv6_encap_tags_cmd, - "show [ip] bgp ipv6 encap tags", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display BGP tags for prefixes\n") -{ - return bgp_show_encap (vty, AFI_IP6, NULL, bgp_show_type_normal, NULL, 1); -} - -DEFUN (show_bgp_ipv4_encap_rd_tags, - show_bgp_ipv4_encap_rd_tags_cmd, - "show [ip] bgp ipv4 encap rd ASN:nn_or_IP-address:nn tags", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n" - "Display BGP tags for prefixes\n") -{ - int idx_rd = 5; - int ret; - struct prefix_rd prd; - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - return bgp_show_encap (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 1); -} - -DEFUN (show_bgp_ipv6_encap_rd_tags, - show_bgp_ipv6_encap_rd_tags_cmd, - "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn tags", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n" - "Display BGP tags for prefixes\n") -{ - int idx_rd = 5; - int ret; - struct prefix_rd prd; - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - return bgp_show_encap (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 1); -} - -DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes, - show_bgp_ipv4_encap_rd_neighbor_routes_cmd, - "show [ip] bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Display routes learned from neighbor\n") -{ - int idx_rd = 5; - int idx_peer = 7; - int ret; - union sockunion su; - struct peer *peer; - struct prefix_rd prd; - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - - if (str2sockunion(argv[idx_peer]->arg, &su)) - { - vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - - peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_encap (vty, AFI_IP, &prd, bgp_show_type_neighbor, &su, 0); -} - -DEFUN (show_bgp_ipv6_encap_rd_neighbor_routes, - show_bgp_ipv6_encap_rd_neighbor_routes_cmd, - "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Display routes learned from neighbor\n") -{ - int idx_rd = 5; - int idx_peer = 7; - int ret; - union sockunion su; - struct peer *peer; - struct prefix_rd prd; - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - - if (str2sockunion(argv[idx_peer]->arg, &su)) - { - vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - - peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP6][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_encap (vty, AFI_IP6, &prd, bgp_show_type_neighbor, &su, 0); -} - -DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes, - show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd, - "show [ip] bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors advertised-routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Display the routes advertised to a BGP neighbor\n") -{ - int idx_rd = 5; - int idx_peer = 7; - int ret; - struct peer *peer; - struct prefix_rd prd; - union sockunion su; - - ret = str2sockunion (argv[idx_peer]->arg, &su); - if (ret < 0) - { - vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return show_adj_route_encap (vty, peer, &prd); -} - -DEFUN (show_bgp_ipv6_encap_rd_neighbor_advertised_routes, - show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd, - "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors advertised-routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Display the routes advertised to a BGP neighbor\n") -{ - int idx_rd = 5; - int idx_peer = 7; - int ret; - struct peer *peer; - struct prefix_rd prd; - union sockunion su; - - ret = str2sockunion (argv[idx_peer]->arg, &su); - if (ret < 0) - { - vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP6][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return show_adj_route_encap (vty, peer, &prd); -} - -void -bgp_encap_init (void) -{ - install_element (BGP_ENCAP_NODE, &encap_network_cmd); - install_element (BGP_ENCAP_NODE, &no_encap_network_cmd); - install_element (BGP_ENCAPV6_NODE, &encapv6_network_cmd); - install_element (BGP_ENCAPV6_NODE, &no_encapv6_network_cmd); - - install_element (VIEW_NODE, &show_bgp_ipv4_encap_rd_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_encap_tags_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_encap_rd_tags_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_encap_rd_neighbor_routes_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd); - - install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_encap_tags_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_tags_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_neighbor_routes_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd); -} diff --git a/bgpd/bgp_encap.h b/bgpd/bgp_encap.h deleted file mode 100644 index 2805dd3e1d..0000000000 --- a/bgpd/bgp_encap.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * - * Copyright 2009-2015, LabN Consulting, L.L.C. - * - * - * This program 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 - * of the License, or (at your option) any later version. - * - * This program 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 - */ - -#ifndef _QUAGGA_BGP_ENCAP_H -#define _QUAGGA_BGP_ENCAP_H -#include "bgpd/bgp_route.h" - -extern void bgp_encap_init (void); -extern int bgp_nlri_parse_encap (struct peer *, struct attr *, struct bgp_nlri *); -extern int bgp_show_encap (struct vty *vty, afi_t afi, struct prefix_rd *prd, - enum bgp_show_type type, void *output_arg, int tags); -#include "bgp_encap_types.h" -#endif /* _QUAGGA_BGP_ENCAP_H */ diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 126a920944..da6bf5c3cb 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -50,8 +50,6 @@ #include "bgpd/bgp_network.h" #include "bgpd/bgp_mplsvpn.h" #include "bgpd/bgp_evpn.h" -#include "bgpd/bgp_encap.h" -#include "bgpd/bgp_evpn.h" #include "bgpd/bgp_advertise.h" #include "bgpd/bgp_vty.h" #include "bgpd/bgp_updgrp.h" @@ -1352,8 +1350,6 @@ bgp_nlri_parse (struct peer *peer, struct attr *attr, struct bgp_nlri *packet, i return bgp_nlri_parse_label (peer, mp_withdraw?NULL:attr, packet); case SAFI_MPLS_VPN: return bgp_nlri_parse_vpn (peer, mp_withdraw?NULL:attr, packet); - case SAFI_ENCAP: - return bgp_nlri_parse_encap (peer, mp_withdraw?NULL:attr, packet); case SAFI_EVPN: return bgp_nlri_parse_evpn (peer, attr, packet, mp_withdraw); } diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index fc89bc046b..7a328e79d7 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -54,7 +54,6 @@ #include "bgpd/bgp_filter.h" #include "bgpd/bgp_fsm.h" #include "bgpd/bgp_mplsvpn.h" -#include "bgpd/bgp_encap.h" #include "bgpd/bgp_nexthop.h" #include "bgpd/bgp_damp.h" #include "bgpd/bgp_advertise.h" @@ -8059,12 +8058,6 @@ bgp_show (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, return bgp_show_mpls_vpn(vty, afi, NULL, type, output_arg, 0, use_json); } - if (safi == SAFI_ENCAP) - { - return bgp_show_encap(vty, afi, NULL, type, output_arg, - 0); - } - table = bgp->rib[afi][safi]; @@ -8448,7 +8441,7 @@ bgp_show_lcommunity_list (struct vty *vty, struct bgp *bgp, const char *lcom, DEFUN (show_ip_bgp_large_community_list, show_ip_bgp_large_community_list_cmd, - "show [ip] bgp [ WORD] [ []] large-community-list <(1-500)|WORD> [json]", + "show [ip] bgp [ WORD] [ []] large-community-list <(1-500)|WORD> [json]", SHOW_STR IP_STR BGP_STR @@ -8459,7 +8452,6 @@ DEFUN (show_ip_bgp_large_community_list, "Address Family modifier\n" "Address Family modifier\n" "Address Family modifier\n" - "Address Family modifier\n" "Display routes matching the large-community-list\n" "large-community-list number\n" "large-community-list name\n" @@ -8495,7 +8487,7 @@ DEFUN (show_ip_bgp_large_community_list, } DEFUN (show_ip_bgp_large_community, show_ip_bgp_large_community_cmd, - "show [ip] bgp [ WORD] [ []] large-community [AA:BB:CC] [json]", + "show [ip] bgp [ WORD] [ []] large-community [AA:BB:CC] [json]", SHOW_STR IP_STR BGP_STR @@ -8506,7 +8498,6 @@ DEFUN (show_ip_bgp_large_community, "Address Family modifier\n" "Address Family modifier\n" "Address Family modifier\n" - "Address Family modifier\n" "Display routes matching the large-communities\n" "List of large-community numbers\n" JSON_STR) @@ -8662,8 +8653,6 @@ DEFUN (show_ip_bgp, if (safi == SAFI_MPLS_VPN) return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_normal, NULL, 0, uj); - else if (safi == SAFI_ENCAP) - return bgp_show_encap (vty, afi, NULL, bgp_show_type_normal, NULL, 0); else return bgp_show (vty, bgp, afi, safi, sh_type, NULL, uj); } @@ -9451,7 +9440,7 @@ bgp_peer_counts (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, u_c DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, show_ip_bgp_instance_neighbor_prefix_counts_cmd, - "show [ip] bgp [ WORD] [ []] " + "show [ip] bgp [ WORD] [ []] " "neighbors prefix-counts [json]", SHOW_STR IP_STR diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 5059104e92..c2942b50dc 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -81,9 +81,6 @@ bgp_node_type (afi_t afi, safi_t safi) case SAFI_MPLS_VPN: return BGP_VPNV4_NODE; break; - case SAFI_ENCAP: - return BGP_ENCAP_NODE; - break; } break; case AFI_IP6: @@ -101,9 +98,6 @@ bgp_node_type (afi_t afi, safi_t safi) case SAFI_MPLS_VPN: return BGP_VPNV6_NODE; break; - case SAFI_ENCAP: - return BGP_ENCAPV6_NODE; - break; } break; case AFI_L2VPN: @@ -130,7 +124,6 @@ bgp_node_afi (struct vty *vty) case BGP_IPV6M_NODE: case BGP_IPV6L_NODE: case BGP_VPNV6_NODE: - case BGP_ENCAPV6_NODE: afi = AFI_IP6; break; case BGP_EVPN_NODE: @@ -151,10 +144,6 @@ bgp_node_safi (struct vty *vty) safi_t safi; switch (vty->node) { - case BGP_ENCAP_NODE: - case BGP_ENCAPV6_NODE: - safi = SAFI_ENCAP; - break; case BGP_VPNV4_NODE: case BGP_VPNV6_NODE: safi = SAFI_MPLS_VPN; @@ -223,7 +212,7 @@ argv_find_and_parse_afi(struct cmd_token **argv, int argc, int *index, afi_t *af return ret; } -/* supports */ +/* supports */ safi_t bgp_vty_safi_from_arg(const char *safi_str) { @@ -232,8 +221,6 @@ bgp_vty_safi_from_arg(const char *safi_str) safi = SAFI_MULTICAST; else if (strncmp (safi_str, "u", 1) == 0) safi = SAFI_UNICAST; - else if (strncmp (safi_str, "e", 1) == 0) - safi = SAFI_ENCAP; else if (strncmp (safi_str, "v", 1) == 0) safi = SAFI_MPLS_VPN; else if (strncmp (safi_str, "l", 1) == 0) @@ -269,12 +256,6 @@ argv_find_and_parse_safi (struct cmd_token **argv, int argc, int *index, safi_t if (safi) *safi = SAFI_MPLS_VPN; } - else if (argv_find (argv, argc, "encap", index)) - { - ret = 1; - if (safi) - *safi = SAFI_ENCAP; - } else if (argv_find (argv, argc, "evpn", index)) { ret = 1; @@ -294,12 +275,12 @@ argv_find_and_parse_safi (struct cmd_token **argv, int argc, int *index, safi_t * that is being parsed. * * The show commands are generally of the form: - * "show [ip] bgp [ WORD] [ []] ..." + * "show [ip] bgp [ WORD] [ []] ..." * * Since we use argv_find if the show command in particular doesn't have: * [ip] * [ WORD] - * [ []] + * [ []] * The command parsing should still be ok. * * vty -> The vty for the command so we can output some useful data in @@ -6345,7 +6326,7 @@ ALIAS_HIDDEN (no_neighbor_addpath_tx_bestpath_per_as, DEFUN_NOSH (address_family_ipv4_safi, address_family_ipv4_safi_cmd, - "address-family ipv4 []", + "address-family ipv4 []", "Enter Address Family command mode\n" "Address Family\n" BGP_SAFI_HELP_STR) @@ -6364,7 +6345,7 @@ DEFUN_NOSH (address_family_ipv4_safi, DEFUN_NOSH (address_family_ipv6_safi, address_family_ipv6_safi_cmd, - "address-family ipv6 []", + "address-family ipv6 []", "Enter Address Family command mode\n" "Address Family\n" BGP_SAFI_HELP_STR) @@ -6404,28 +6385,6 @@ DEFUN_NOSH (address_family_vpnv6, } #endif -DEFUN_NOSH (address_family_encap, - address_family_encap_cmd, - "address-family ", - "Enter Address Family command mode\n" - "Address Family\n" - "Address Family\n") -{ - vty->node = BGP_ENCAP_NODE; - return CMD_SUCCESS; -} - - -DEFUN_NOSH (address_family_encapv6, - address_family_encapv6_cmd, - "address-family encapv6", - "Enter Address Family command mode\n" - "Address Family\n") -{ - vty->node = BGP_ENCAPV6_NODE; - return CMD_SUCCESS; -} - DEFUN_NOSH (address_family_evpn, address_family_evpn_cmd, "address-family ", @@ -6451,8 +6410,6 @@ DEFUN_NOSH (exit_address_family, || vty->node == BGP_IPV6M_NODE || vty->node == BGP_IPV6L_NODE || vty->node == BGP_VPNV6_NODE - || vty->node == BGP_ENCAP_NODE - || vty->node == BGP_ENCAPV6_NODE || vty->node == BGP_EVPN_NODE) vty->node = BGP_NODE; return CMD_SUCCESS; @@ -10903,20 +10860,6 @@ static struct cmd_node bgp_vpnv6_node = 1 }; -static struct cmd_node bgp_encap_node = -{ - BGP_ENCAP_NODE, - "%s(config-router-af-encap)# ", - 1 -}; - -static struct cmd_node bgp_encapv6_node = -{ - BGP_ENCAPV6_NODE, - "%s(config-router-af-encapv6)# ", - 1 -}; - static struct cmd_node bgp_evpn_node = { BGP_EVPN_NODE, @@ -10992,8 +10935,6 @@ bgp_vty_init (void) install_node (&bgp_ipv6_labeled_unicast_node, NULL); install_node (&bgp_vpnv4_node, NULL); install_node (&bgp_vpnv6_node, NULL); - install_node (&bgp_encap_node, NULL); - install_node (&bgp_encapv6_node, NULL); install_node (&bgp_evpn_node, NULL); /* Install default VTY commands to new nodes. */ @@ -11006,8 +10947,6 @@ bgp_vty_init (void) install_default (BGP_IPV6L_NODE); install_default (BGP_VPNV4_NODE); install_default (BGP_VPNV6_NODE); - install_default (BGP_ENCAP_NODE); - install_default (BGP_ENCAPV6_NODE); install_default (BGP_EVPN_NODE); /* "bgp multiple-instance" commands. */ @@ -11234,8 +11173,6 @@ bgp_vty_init (void) install_element (BGP_IPV6L_NODE, &neighbor_activate_cmd); install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd); install_element (BGP_EVPN_NODE, &neighbor_activate_cmd); /* "no neighbor activate" commands. */ @@ -11248,8 +11185,6 @@ bgp_vty_init (void) install_element (BGP_IPV6L_NODE, &no_neighbor_activate_cmd); install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd); install_element (BGP_EVPN_NODE, &no_neighbor_activate_cmd); /* "neighbor peer-group" set commands. */ @@ -11262,8 +11197,6 @@ bgp_vty_init (void) install_element (BGP_IPV6L_NODE, &neighbor_set_peer_group_hidden_cmd); install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_hidden_cmd); install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_hidden_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_hidden_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_hidden_cmd); /* "no neighbor peer-group unset" commands. */ install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); @@ -11275,8 +11208,6 @@ bgp_vty_init (void) install_element (BGP_IPV6L_NODE, &no_neighbor_set_peer_group_hidden_cmd); install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_hidden_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_hidden_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_hidden_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_hidden_cmd); /* "neighbor softreconfiguration inbound" commands.*/ install_element (BGP_NODE, &neighbor_soft_reconfiguration_hidden_cmd); @@ -11297,10 +11228,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); /* "neighbor attribute-unchanged" commands. */ install_element (BGP_NODE, &neighbor_attr_unchanged_hidden_cmd); @@ -11322,12 +11249,6 @@ bgp_vty_init (void) install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd); - - install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd); - install_element (BGP_EVPN_NODE, &neighbor_attr_unchanged_cmd); install_element (BGP_EVPN_NODE, &no_neighbor_attr_unchanged_cmd); @@ -11354,10 +11275,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd); /* "neighbor next-hop-self force" commands. */ install_element (BGP_NODE, &neighbor_nexthop_self_force_hidden_cmd); @@ -11472,10 +11389,6 @@ bgp_vty_init (void) install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd); /* "neighbor send-community" commands.*/ install_element (BGP_NODE, &neighbor_send_community_hidden_cmd); @@ -11514,14 +11427,6 @@ bgp_vty_init (void) install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd); /* "neighbor route-reflector" commands.*/ install_element (BGP_NODE, &neighbor_route_reflector_client_hidden_cmd); @@ -11542,10 +11447,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd); /* "neighbor route-server" commands.*/ install_element (BGP_NODE, &neighbor_route_server_client_hidden_cmd); @@ -11566,10 +11467,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd); /* "neighbor addpath-tx-all-paths" commands.*/ install_element (BGP_NODE, &neighbor_addpath_tx_all_paths_hidden_cmd); @@ -11714,10 +11611,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_weight_cmd); install_element (BGP_VPNV6_NODE, &neighbor_weight_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_weight_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_weight_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_weight_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_weight_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_weight_cmd); /* "neighbor override-capability" commands. */ install_element (BGP_NODE, &neighbor_override_capability_cmd); @@ -11762,10 +11655,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd); /* "neighbor prefix-list" commands. */ install_element (BGP_NODE, &neighbor_prefix_list_hidden_cmd); @@ -11786,10 +11675,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd); /* "neighbor filter-list" commands. */ install_element (BGP_NODE, &neighbor_filter_list_hidden_cmd); @@ -11810,10 +11695,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd); /* "neighbor route-map" commands. */ install_element (BGP_NODE, &neighbor_route_map_hidden_cmd); @@ -11834,10 +11715,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd); /* "neighbor unsuppress-map" commands. */ install_element (BGP_NODE, &neighbor_unsuppress_map_hidden_cmd); @@ -11858,10 +11735,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd); /* "neighbor maximum-prefix" commands. */ install_element (BGP_NODE, &neighbor_maximum_prefix_hidden_cmd); @@ -11928,22 +11801,6 @@ bgp_vty_init (void) install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd); - - install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd); - /* "neighbor allowas-in" */ install_element (BGP_NODE, &neighbor_allowas_in_hidden_cmd); install_element (BGP_NODE, &no_neighbor_allowas_in_hidden_cmd); @@ -11963,10 +11820,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd); /* address-family commands. */ install_element (BGP_NODE, &address_family_ipv4_safi_cmd); @@ -11976,9 +11829,6 @@ bgp_vty_init (void) install_element (BGP_NODE, &address_family_vpnv6_cmd); #endif /* KEEP_OLD_VPN_COMMANDS */ - install_element (BGP_NODE, &address_family_encap_cmd); - install_element (BGP_NODE, &address_family_encapv6_cmd); - install_element (BGP_NODE, &address_family_evpn_cmd); /* "exit-address-family" command. */ @@ -11990,8 +11840,6 @@ bgp_vty_init (void) install_element (BGP_IPV6L_NODE, &exit_address_family_cmd); install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); install_element (BGP_VPNV6_NODE, &exit_address_family_cmd); - install_element (BGP_ENCAP_NODE, &exit_address_family_cmd); - install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd); install_element (BGP_EVPN_NODE, &exit_address_family_cmd); /* "clear ip bgp commands" */ diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h index eae1f2d018..1bb9cfb712 100644 --- a/bgpd/bgp_vty.h +++ b/bgpd/bgp_vty.h @@ -28,10 +28,8 @@ struct bgp; #define BGP_AFI_CMD_STR "" #define BGP_AFI_HELP_STR "Address Family\nAddress Family\n" -#define BGP_SAFI_CMD_STR "" +#define BGP_SAFI_CMD_STR "" #define BGP_SAFI_HELP_STR \ - "Address Family modifier\n" \ - "Address Family modifier\n" \ "Address Family modifier\n" \ "Address Family modifier\n" \ "Address Family modifier\n" \ diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 655431b015..92a0cd6acc 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -61,7 +61,6 @@ #include "bgpd/bgp_nexthop.h" #include "bgpd/bgp_damp.h" #include "bgpd/bgp_mplsvpn.h" -#include "bgpd/bgp_encap.h" #if ENABLE_BGP_VNC #include "bgpd/rfapi/bgp_rfapi_cfg.h" #include "bgpd/rfapi/rfapi_backend.h" @@ -7701,7 +7700,6 @@ bgp_init (void) bgp_route_map_init (); bgp_scan_vty_init(); bgp_mplsvpn_init (); - bgp_encap_init (); #if ENABLE_BGP_VNC rfapi_init (); #endif diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c index 722948c737..6002046bcd 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.c +++ b/bgpd/rfapi/bgp_rfapi_cfg.c @@ -290,10 +290,9 @@ bgp_rfapi_is_vnc_configured (struct bgp *bgp) DEFUN (vnc_advertise_un_method, vnc_advertise_un_method_cmd, - "vnc advertise-un-method ", + "vnc advertise-un-method encap-attr", VNC_CONFIG_STR "Method of advertising UN addresses\n" - "Via Encapsulation SAFI\n" "Via Tunnel Encap attribute (in VPN SAFI)\n") { VTY_DECLVAR_CONTEXT(bgp, bgp); diff --git a/lib/command.c b/lib/command.c index 84d59f076c..eb163f6189 100644 --- a/lib/command.c +++ b/lib/command.c @@ -865,8 +865,6 @@ node_parent ( enum node_type node ) { case BGP_VPNV4_NODE: case BGP_VPNV6_NODE: - case BGP_ENCAP_NODE: - case BGP_ENCAPV6_NODE: case BGP_VRF_POLICY_NODE: case BGP_VNC_DEFAULTS_NODE: case BGP_VNC_NVE_GROUP_NODE: @@ -1238,8 +1236,6 @@ cmd_exit (struct vty *vty) case BGP_IPV4L_NODE: case BGP_VPNV4_NODE: case BGP_VPNV6_NODE: - case BGP_ENCAP_NODE: - case BGP_ENCAPV6_NODE: case BGP_VRF_POLICY_NODE: case BGP_VNC_DEFAULTS_NODE: case BGP_VNC_NVE_GROUP_NODE: @@ -1305,8 +1301,6 @@ DEFUN (config_end, case RIPNG_NODE: case EIGRP_NODE: case BGP_NODE: - case BGP_ENCAP_NODE: - case BGP_ENCAPV6_NODE: case BGP_VRF_POLICY_NODE: case BGP_VNC_DEFAULTS_NODE: case BGP_VNC_NVE_GROUP_NODE: diff --git a/lib/command.h b/lib/command.h index 35fb20f8b0..7894334dfc 100644 --- a/lib/command.h +++ b/lib/command.h @@ -101,8 +101,6 @@ enum node_type BGP_IPV6_NODE, /* BGP IPv6 address family */ BGP_IPV6M_NODE, /* BGP IPv6 multicast address family. */ BGP_IPV6L_NODE, /* BGP IPv6 labeled unicast address family. */ - BGP_ENCAP_NODE, /* BGP ENCAP SAFI */ - BGP_ENCAPV6_NODE, /* BGP ENCAP SAFI */ BGP_VRF_POLICY_NODE, /* BGP VRF policy */ BGP_VNC_DEFAULTS_NODE, /* BGP VNC nve defaults */ BGP_VNC_NVE_GROUP_NODE, /* BGP VNC nve group */ diff --git a/lib/vty.c b/lib/vty.c index e27f8d74ba..c500a45194 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -738,8 +738,6 @@ vty_end_config (struct vty *vty) case BGP_NODE: case BGP_VPNV4_NODE: case BGP_VPNV6_NODE: - case BGP_ENCAP_NODE: - case BGP_ENCAPV6_NODE: case BGP_VRF_POLICY_NODE: case BGP_VNC_DEFAULTS_NODE: case BGP_VNC_NVE_GROUP_NODE: diff --git a/vtysh/Makefile.am b/vtysh/Makefile.am index bb6bbbe87e..29ffa7e22b 100644 --- a/vtysh/Makefile.am +++ b/vtysh/Makefile.am @@ -47,7 +47,6 @@ if BGPD vtysh_scan += $(top_srcdir)/bgpd/bgp_bfd.c vtysh_scan += $(top_srcdir)/bgpd/bgp_debug.c vtysh_scan += $(top_srcdir)/bgpd/bgp_dump.c -vtysh_scan += $(top_srcdir)/bgpd/bgp_encap.c vtysh_scan += $(top_srcdir)/bgpd/bgp_evpn_vty.c vtysh_scan += $(top_srcdir)/bgpd/bgp_filter.c vtysh_scan += $(top_srcdir)/bgpd/bgp_mplsvpn.c diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 2eee7a6897..ecd0b72e78 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -304,7 +304,6 @@ vtysh_execute_func (const char *line, int pager) if (ret == CMD_SUCCESS || ret == CMD_SUCCESS_DAEMON || ret == CMD_WARNING) { if ((saved_node == BGP_VPNV4_NODE || saved_node == BGP_VPNV6_NODE - || saved_node == BGP_ENCAP_NODE || saved_node == BGP_ENCAPV6_NODE || saved_node == BGP_IPV4_NODE || saved_node == BGP_IPV6_NODE || saved_node == BGP_IPV4M_NODE || saved_node == BGP_IPV4L_NODE || saved_node == BGP_IPV6L_NODE @@ -948,18 +947,6 @@ static struct cmd_node bgp_vpnv6_node = "%s(config-router-af)# " }; -static struct cmd_node bgp_encap_node = -{ - BGP_ENCAP_NODE, - "%s(config-router-af)# " -}; - -static struct cmd_node bgp_encapv6_node = -{ - BGP_ENCAPV6_NODE, - "%s(config-router-af)# " -}; - static struct cmd_node bgp_ipv4_node = { BGP_IPV4_NODE, @@ -1176,31 +1163,6 @@ DEFUNSH (VTYSH_BGPD, return CMD_SUCCESS; } -DEFUNSH (VTYSH_BGPD, - address_family_encapv4, - address_family_encapv4_cmd, - "address-family [ipv4] ", - "Enter Address Family command mode\n" - "Address Family\n" - "Address Family\n" - "Address Family\n") -{ - vty->node = BGP_ENCAP_NODE; - return CMD_SUCCESS; -} - -DEFUNSH (VTYSH_BGPD, - address_family_encapv6, - address_family_encapv6_cmd, - "address-family [ipv6] encapv6", - "Enter Address Family command mode\n" - "Address Family\n" - "Address Family\n") -{ - vty->node = BGP_ENCAPV6_NODE; - return CMD_SUCCESS; -} - DEFUNSH (VTYSH_BGPD, address_family_ipv4, address_family_ipv4_cmd, @@ -1624,8 +1586,6 @@ vtysh_exit (struct vty *vty) break; case BGP_VPNV4_NODE: case BGP_VPNV6_NODE: - case BGP_ENCAP_NODE: - case BGP_ENCAPV6_NODE: case BGP_IPV4_NODE: case BGP_IPV4M_NODE: case BGP_IPV4L_NODE: @@ -1693,8 +1653,6 @@ DEFUNSH (VTYSH_BGPD, || vty->node == BGP_IPV4L_NODE || vty->node == BGP_VPNV4_NODE || vty->node == BGP_VPNV6_NODE - || vty->node == BGP_ENCAP_NODE - || vty->node == BGP_ENCAPV6_NODE || vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6L_NODE || vty->node == BGP_IPV6M_NODE) @@ -3273,8 +3231,6 @@ vtysh_init_vty (void) install_node (&zebra_node, NULL); install_node (&bgp_vpnv4_node, NULL); install_node (&bgp_vpnv6_node, NULL); - install_node (&bgp_encap_node, NULL); - install_node (&bgp_encapv6_node, NULL); install_node (&bgp_ipv4_node, NULL); install_node (&bgp_ipv4m_node, NULL); install_node (&bgp_ipv4l_node, NULL); @@ -3314,8 +3270,6 @@ vtysh_init_vty (void) vtysh_install_default (ZEBRA_NODE); vtysh_install_default (BGP_VPNV4_NODE); vtysh_install_default (BGP_VPNV6_NODE); - vtysh_install_default (BGP_ENCAP_NODE); - vtysh_install_default (BGP_ENCAPV6_NODE); vtysh_install_default (BGP_IPV4_NODE); vtysh_install_default (BGP_IPV4M_NODE); vtysh_install_default (BGP_IPV4L_NODE); @@ -3386,10 +3340,6 @@ vtysh_init_vty (void) install_element (BGP_VPNV4_NODE, &vtysh_quit_bgpd_cmd); install_element (BGP_VPNV6_NODE, &vtysh_exit_bgpd_cmd); install_element (BGP_VPNV6_NODE, &vtysh_quit_bgpd_cmd); - install_element (BGP_ENCAP_NODE, &vtysh_exit_bgpd_cmd); - install_element (BGP_ENCAP_NODE, &vtysh_quit_bgpd_cmd); - install_element (BGP_ENCAPV6_NODE, &vtysh_exit_bgpd_cmd); - install_element (BGP_ENCAPV6_NODE, &vtysh_quit_bgpd_cmd); install_element (BGP_IPV4_NODE, &vtysh_exit_bgpd_cmd); install_element (BGP_IPV4_NODE, &vtysh_quit_bgpd_cmd); install_element (BGP_IPV4M_NODE, &vtysh_exit_bgpd_cmd); @@ -3445,8 +3395,6 @@ vtysh_init_vty (void) install_element (BGP_IPV4L_NODE, &vtysh_end_all_cmd); install_element (BGP_VPNV4_NODE, &vtysh_end_all_cmd); install_element (BGP_VPNV6_NODE, &vtysh_end_all_cmd); - install_element (BGP_ENCAP_NODE, &vtysh_end_all_cmd); - install_element (BGP_ENCAPV6_NODE, &vtysh_end_all_cmd); install_element (BGP_IPV6_NODE, &vtysh_end_all_cmd); install_element (BGP_IPV6M_NODE, &vtysh_end_all_cmd); install_element (BGP_IPV6L_NODE, &vtysh_end_all_cmd); @@ -3498,8 +3446,6 @@ vtysh_init_vty (void) install_element (CONFIG_NODE, &router_bgp_cmd); install_element (BGP_NODE, &address_family_vpnv4_cmd); install_element (BGP_NODE, &address_family_vpnv6_cmd); - install_element (BGP_NODE, &address_family_encapv4_cmd); - install_element (BGP_NODE, &address_family_encapv6_cmd); #if defined(ENABLE_BGP_VNC) install_element (BGP_NODE, &vnc_vrf_policy_cmd); install_element (BGP_NODE, &vnc_defaults_cmd); @@ -3517,8 +3463,6 @@ vtysh_init_vty (void) install_element (BGP_NODE, &address_family_evpn_cmd); install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); install_element (BGP_VPNV6_NODE, &exit_address_family_cmd); - install_element (BGP_ENCAP_NODE, &exit_address_family_cmd); - install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd); install_element (BGP_IPV4_NODE, &exit_address_family_cmd); install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); install_element (BGP_IPV4L_NODE, &exit_address_family_cmd);