diff options
| -rw-r--r-- | bgpd/Makefile.am | 4 | ||||
| -rw-r--r-- | bgpd/bgp_attr.c | 8 | ||||
| -rw-r--r-- | bgpd/bgp_encap.c | 777 | ||||
| -rw-r--r-- | bgpd/bgp_encap.h | 31 | ||||
| -rw-r--r-- | bgpd/bgp_mplsvpn.c | 82 | ||||
| -rw-r--r-- | bgpd/bgp_mplsvpn.h | 1 | ||||
| -rw-r--r-- | bgpd/bgp_packet.c | 4 | ||||
| -rw-r--r-- | bgpd/bgp_route.c | 68 | ||||
| -rw-r--r-- | bgpd/bgp_updgrp_packet.c | 56 | ||||
| -rw-r--r-- | bgpd/bgp_vty.c | 162 | ||||
| -rw-r--r-- | bgpd/bgp_vty.h | 3 | ||||
| -rw-r--r-- | bgpd/bgpd.c | 2 | ||||
| -rw-r--r-- | bgpd/rfapi/bgp_rfapi_cfg.c | 3 | ||||
| -rw-r--r-- | lib/command.c | 6 | ||||
| -rw-r--r-- | lib/command.h | 2 | ||||
| -rw-r--r-- | lib/privs.c | 4 | ||||
| -rw-r--r-- | lib/vty.c | 2 | ||||
| -rw-r--r-- | nhrpd/nhrp_vty.c | 3 | ||||
| -rw-r--r-- | ospf6d/ospf6_intra.c | 3 | ||||
| -rw-r--r-- | ospfd/ospf_abr.c | 9 | ||||
| -rw-r--r-- | ospfd/ospf_interface.c | 4 | ||||
| -rw-r--r-- | ospfd/ospf_interface.h | 12 | ||||
| -rw-r--r-- | ospfd/ospf_vty.c | 114 | ||||
| -rw-r--r-- | ospfd/ospf_vty.h | 7 | ||||
| -rw-r--r-- | ospfd/ospfd.c | 39 | ||||
| -rw-r--r-- | ospfd/ospfd.h | 14 | ||||
| -rw-r--r-- | pimd/pim_cmd.c | 2 | ||||
| -rw-r--r-- | vtysh/Makefile.am | 1 | ||||
| -rw-r--r-- | vtysh/vtysh.c | 61 |
29 files changed, 234 insertions, 1250 deletions
diff --git a/bgpd/Makefile.am b/bgpd/Makefile.am index b6ed9a4d6d..ad455edfcd 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 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 bgpd_SOURCES = bgp_main.c diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 61dcbd1b29..4d5f7cab5d 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -2742,6 +2742,7 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi, else if (nh_afi == AFI_MAX) nh_afi = BGP_NEXTHOP_AFI_FROM_NHLEN(attr->extra->mp_nexthop_len); /* Nexthop */ + bpacket_attr_vec_arr_set_vec (vecarr, BGP_ATTR_VEC_NH, s, attr); switch (nh_afi) { case AFI_IP: @@ -2754,7 +2755,6 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi, stream_put_ipv4 (s, attr->nexthop.s_addr); break; case SAFI_MPLS_VPN: - bpacket_attr_vec_arr_set_vec (vecarr, BGP_ATTR_VEC_NH, s, attr); stream_putc (s, 12); stream_putl (s, 0); /* RD = 0, per RFC */ stream_putl (s, 0); @@ -2777,7 +2777,6 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi, struct attr_extra *attre = attr->extra; assert (attr->extra); - bpacket_attr_vec_arr_set_vec (vecarr, BGP_ATTR_VEC_NH, s, attr); stream_putc (s, attre->mp_nexthop_len); stream_put (s, &attre->mp_nexthop_global, IPV6_MAX_BYTELEN); if (attre->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) @@ -2918,7 +2917,8 @@ bgp_packet_mpattr_tea( case BGP_ATTR_ENCAP: attrname = "Tunnel Encap"; subtlvs = attr->extra->encap_subtlvs; - + if (subtlvs == NULL) /* nothing to do */ + return; /* * The tunnel encap attr has an "outer" tlv. * T = tunneltype, @@ -2933,6 +2933,8 @@ bgp_packet_mpattr_tea( case BGP_ATTR_VNC: attrname = "VNC"; subtlvs = attr->extra->vnc_subtlvs; + if (subtlvs == NULL) /* nothing to do */ + return; attrlenfield = 0; /* no outer T + L */ attrhdrlen = 2 + 2; /* subTLV T + L */ break; diff --git a/bgpd/bgp_encap.c b/bgpd/bgp_encap.c deleted file mode 100644 index 01df053952..0000000000 --- a/bgpd/bgp_encap.c +++ /dev/null @@ -1,777 +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 <kunihiro@zebra.org> - * - */ - -/* - -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. */ - -#include <zebra.h> - -#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 tag WORD", - "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 = 1; - int idx_rd = 3; - int idx_word = 5; - return bgp_static_set_safi (AFI_IP, SAFI_ENCAP, vty, argv[idx_ipv4]->arg, argv[idx_rd]->arg, argv[idx_word]->arg, - 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 tag WORD", - 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; - int idx_word = 6; - return bgp_static_unset_safi (AFI_IP, SAFI_ENCAP, vty, argv[idx_ipv4]->arg, argv[idx_rd]->arg, argv[idx_word]->arg, - 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 <A.B.C.D|X:X::X:X> 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 <A.B.C.D|X:X::X:X> 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 <A.B.C.D|X:X::X:X> 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 <A.B.C.D|X:X::X:X> 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 (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 4d57fca79d..0000000000 --- a/bgpd/bgp_encap.h +++ /dev/null @@ -1,31 +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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 60a48f506b..f25c00005a 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -381,31 +381,6 @@ out: return lret; } -int -str2tag (const char *str, u_char *tag) -{ - unsigned long l; - char *endptr; - u_int32_t t; - - if (*str == '-') - return 0; - - errno = 0; - l = strtoul (str, &endptr, 10); - - if (*endptr != '\0' || errno || l > UINT32_MAX) - return 0; - - t = (u_int32_t) l; - - tag[0] = (u_char)(t >> 12); - tag[1] = (u_char)(t >> 4); - tag[2] = (u_char)(t << 4); - - return 1; -} - char * prefix_rd2str (struct prefix_rd *prd, char *buf, size_t size) { @@ -460,99 +435,104 @@ prefix_rd2str (struct prefix_rd *prd, char *buf, size_t size) /* For testing purpose, static route of MPLS-VPN. */ DEFUN (vpnv4_network, vpnv4_network_cmd, - "network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD", + "network A.B.C.D/M rd ASN:nn_or_IP-address:nn <tag|label> (0-1048575)", "Specify a network to announce via BGP\n" "IPv4 prefix\n" "Specify Route Distinguisher\n" "VPN Route Distinguisher\n" - "BGP tag\n" - "tag value\n") + "VPN NLRI label (tag)\n" + "VPN NLRI label (tag)\n" + "Label value\n") { int idx_ipv4_prefixlen = 1; int idx_ext_community = 3; - int idx_word = 5; + int idx_label = 5; return bgp_static_set_safi (AFI_IP, SAFI_MPLS_VPN, vty, argv[idx_ipv4_prefixlen]->arg, argv[idx_ext_community]->arg, - argv[idx_word]->arg, NULL, 0, NULL, NULL, NULL, NULL); + argv[idx_label]->arg, NULL, 0, NULL, NULL, NULL, NULL); } DEFUN (vpnv4_network_route_map, vpnv4_network_route_map_cmd, - "network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD route-map WORD", + "network A.B.C.D/M rd ASN:nn_or_IP-address:nn <tag|label> (0-1048575) route-map WORD", "Specify a network to announce via BGP\n" "IPv4 prefix\n" "Specify Route Distinguisher\n" "VPN Route Distinguisher\n" - "BGP tag\n" - "tag value\n" + "VPN NLRI label (tag)\n" + "VPN NLRI label (tag)\n" + "Label value\n" "route map\n" "route map name\n") { int idx_ipv4_prefixlen = 1; int idx_ext_community = 3; - int idx_word = 5; + int idx_label = 5; int idx_word_2 = 7; - return bgp_static_set_safi (AFI_IP, SAFI_MPLS_VPN, vty, argv[idx_ipv4_prefixlen]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, + return bgp_static_set_safi (AFI_IP, SAFI_MPLS_VPN, vty, argv[idx_ipv4_prefixlen]->arg, argv[idx_ext_community]->arg, argv[idx_label]->arg, argv[idx_word_2]->arg, 0, NULL, NULL, NULL, NULL); } /* For testing purpose, static route of MPLS-VPN. */ DEFUN (no_vpnv4_network, no_vpnv4_network_cmd, - "no network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD", + "no network A.B.C.D/M rd ASN:nn_or_IP-address:nn <tag|label> (0-1048575)", NO_STR "Specify a network to announce via BGP\n" "IPv4 prefix\n" "Specify Route Distinguisher\n" "VPN Route Distinguisher\n" - "BGP tag\n" - "tag value\n") + "VPN NLRI label (tag)\n" + "VPN NLRI label (tag)\n" + "Label value\n") { int idx_ipv4_prefixlen = 2; int idx_ext_community = 4; - int idx_word = 6; + int idx_label = 6; return bgp_static_unset_safi (AFI_IP, SAFI_MPLS_VPN, vty, argv[idx_ipv4_prefixlen]->arg, - argv[idx_ext_community]->arg, argv[idx_word]->arg, + argv[idx_ext_community]->arg, argv[idx_label]->arg, 0, NULL, NULL, NULL); } DEFUN (vpnv6_network, vpnv6_network_cmd, - "network X:X::X:X/M rd ASN:nn_or_IP-address:nn tag WORD [route-map WORD]", + "network X:X::X:X/M rd ASN:nn_or_IP-address:nn <tag|label> (0-1048575) [route-map WORD]", "Specify a network to announce via BGP\n" "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n" "Specify Route Distinguisher\n" "VPN Route Distinguisher\n" - "BGP tag\n" - "tag value\n" + "VPN NLRI label (tag)\n" + "VPN NLRI label (tag)\n" + "Label value\n" "route map\n" "route map name\n") { int idx_ipv6_prefix = 1; int idx_ext_community = 3; - int idx_word = 5; + int idx_label = 5; int idx_word_2 = 7; if (argc == 8) - return bgp_static_set_safi (AFI_IP6, SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, argv[idx_word_2]->arg, 0, NULL, NULL, NULL, NULL); + return bgp_static_set_safi (AFI_IP6, SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_label]->arg, argv[idx_word_2]->arg, 0, NULL, NULL, NULL, NULL); else - return bgp_static_set_safi (AFI_IP6, SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, NULL, 0, NULL, NULL, NULL, NULL); + return bgp_static_set_safi (AFI_IP6, SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_label]->arg, NULL, 0, NULL, NULL, NULL, NULL); } /* For testing purpose, static route of MPLS-VPN. */ DEFUN (no_vpnv6_network, no_vpnv6_network_cmd, - "no network X:X::X:X/M rd ASN:nn_or_IP-address:nn tag WORD", + "no network X:X::X:X/M rd ASN:nn_or_IP-address:nn <tag|label> (0-1048575)", NO_STR "Specify a network to announce via BGP\n" "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n" "Specify Route Distinguisher\n" "VPN Route Distinguisher\n" - "BGP tag\n" - "tag value\n") + "VPN NLRI label (tag)\n" + "VPN NLRI label (tag)\n" + "Label value\n") { int idx_ipv6_prefix = 2; int idx_ext_community = 4; - int idx_word = 6; - return bgp_static_unset_safi (AFI_IP6, SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, 0, NULL, NULL, NULL); + int idx_label = 6; + return bgp_static_unset_safi (AFI_IP6, SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_label]->arg, 0, NULL, NULL, NULL); } int diff --git a/bgpd/bgp_mplsvpn.h b/bgpd/bgp_mplsvpn.h index 518bf6143f..3abd818b10 100644 --- a/bgpd/bgp_mplsvpn.h +++ b/bgpd/bgp_mplsvpn.h @@ -104,7 +104,6 @@ extern void decode_rd_vnc_eth (u_char *pnt, struct rd_vnc_eth *rd_vnc_eth); #endif extern int str2prefix_rd (const char *, struct prefix_rd *); -extern int str2tag (const char *, u_char *); extern char *prefix_rd2str (struct prefix_rd *, char *, size_t); extern int diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 661dce133c..77395bf859 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -50,8 +50,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #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" @@ -1347,8 +1345,6 @@ bgp_nlri_parse (struct peer *peer, struct attr *attr, struct bgp_nlri *packet, i return bgp_nlri_parse_ip (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 cb4d88859e..38e696d11b 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -53,7 +53,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #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" @@ -4008,7 +4007,7 @@ bgp_static_update_safi (struct bgp *bgp, struct prefix *p, if ((safi == SAFI_EVPN) || (safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP)) { - if (bgp_static->igpnexthop.s_addr) + if (afi == AFI_IP) { bgp_attr_extra_get (&attr)->mp_nexthop_global_in = bgp_static->igpnexthop; bgp_attr_extra_get (&attr)->mp_nexthop_len = IPV4_MAX_BYTELEN; @@ -4454,7 +4453,7 @@ bgp_purge_static_redist_routes (struct bgp *bgp) */ int bgp_static_set_safi (afi_t afi, safi_t safi, struct vty *vty, const char *ip_str, - const char *rd_str, const char *tag_str, + const char *rd_str, const char *label_str, const char *rmap_str, int evpn_type, const char *esi, const char *gwip, const char *ethtag, const char *routermac) { @@ -4491,18 +4490,15 @@ bgp_static_set_safi (afi_t afi, safi_t safi, struct vty *vty, const char *ip_str return CMD_WARNING; } - if (tag_str) + if (label_str) { - ret = str2tag (tag_str, tag); - if (! ret) - { - vty_out (vty, "%% Malformed tag%s", VTY_NEWLINE); - return CMD_WARNING; - } + unsigned long label_val; + VTY_GET_INTEGER_RANGE("Label/tag", label_val, label_str, 0, 16777215); + encode_label (label_val, tag); } else { - encode_label (0, tag); + memset (tag, 0, sizeof(tag)); /* empty, not even BoS */ } if (safi == SAFI_EVPN) { @@ -4562,8 +4558,8 @@ bgp_static_set_safi (afi_t afi, safi_t safi, struct vty *vty, const char *ip_str if (rmap_str) { if (bgp_static->rmap.name) - free (bgp_static->rmap.name); - bgp_static->rmap.name = strdup (rmap_str); + XFREE(MTYPE_ROUTE_MAP_NAME, bgp_static->rmap.name); + bgp_static->rmap.name = XSTRDUP(MTYPE_ROUTE_MAP_NAME, rmap_str); bgp_static->rmap.map = route_map_lookup_by_name (rmap_str); } @@ -4594,7 +4590,7 @@ bgp_static_set_safi (afi_t afi, safi_t safi, struct vty *vty, const char *ip_str /* Configure static BGP network. */ int bgp_static_unset_safi(afi_t afi, safi_t safi, struct vty *vty, const char *ip_str, - const char *rd_str, const char *tag_str, + const char *rd_str, const char *label_str, int evpn_type, const char *esi, const char *gwip, const char *ethtag) { VTY_DECLVAR_CONTEXT(bgp, bgp); @@ -4628,11 +4624,15 @@ bgp_static_unset_safi(afi_t afi, safi_t safi, struct vty *vty, const char *ip_st return CMD_WARNING; } - ret = str2tag (tag_str, tag); - if (! ret) + if (label_str) { - vty_out (vty, "%% Malformed tag%s", VTY_NEWLINE); - return CMD_WARNING; + unsigned long label_val; + VTY_GET_INTEGER_RANGE("Label/tag", label_val, label_str, 0, MPLS_LABEL_MAX); + encode_label (label_val, tag); + } + else + { + memset (tag, 0, sizeof(tag)); /* empty, not even BoS */ } prn = bgp_node_get (bgp->route[afi][safi], @@ -7839,12 +7839,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]; @@ -8216,7 +8210,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 [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]] large-community-list <(1-500)|WORD> [json]", + "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn>]] large-community-list <(1-500)|WORD> [json]", SHOW_STR IP_STR BGP_STR @@ -8226,7 +8220,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" @@ -8262,7 +8255,7 @@ DEFUN (show_ip_bgp_large_community_list, } DEFUN (show_ip_bgp_large_community, show_ip_bgp_large_community_cmd, - "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]] large-community [AA:BB:CC] [json]", + "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn>]] large-community [AA:BB:CC] [json]", SHOW_STR IP_STR BGP_STR @@ -8272,7 +8265,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) @@ -8428,8 +8420,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); } @@ -9213,7 +9203,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 [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]] " + "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn>]] " "neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]", SHOW_STR IP_STR @@ -9224,7 +9214,6 @@ DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, "Address Family modifier\n" "Address Family modifier\n" "Address Family modifier\n" - "Address Family modifier\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" @@ -10433,10 +10422,19 @@ bgp_config_write_network_vpn (struct vty *vty, struct bgp *bgp, prefix_rd2str (prd, rdbuf, RD_ADDRSTRLEN); label = decode_label (bgp_static->tag); - vty_out (vty, " network %s/%d rd %s tag %d", + vty_out (vty, " network %s/%d rd %s", inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen, - rdbuf, label); + p->prefixlen, rdbuf); + if (safi == SAFI_MPLS_VPN) + vty_out (vty, " label %u", label); + + if (bgp_static->rmap.name) + vty_out (vty, " route-map %s", bgp_static->rmap.name); + else + { + if (bgp_static->backdoor) + vty_out (vty, " backdoor"); + } vty_out (vty, "%s", VTY_NEWLINE); } return 0; diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index 8839de391e..5872ca6f3f 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -427,21 +427,33 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) nhafi = BGP_NEXTHOP_AFI_FROM_NHLEN(nhlen); if (peer_cap_enhe(peer)) nhafi = AFI_IP6; - if (paf->safi == SAFI_MPLS_VPN && /* if VPN && not global */ - nhlen != BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL) - nhafi = AFI_MAX; /* no change allowed */ } if (nhafi == AFI_IP) { struct in_addr v4nh, *mod_v4nh; int nh_modified = 0; + size_t offset_nh = vec->offset + 1; route_map_sets_nh = (CHECK_FLAG (vec->flags, BPKT_ATTRVEC_FLAGS_RMAP_IPV4_NH_CHANGED) || CHECK_FLAG (vec->flags, BPKT_ATTRVEC_FLAGS_RMAP_NH_PEER_ADDRESS)); - stream_get_from (&v4nh, s, vec->offset + 1, 4); + switch (nhlen) + { + case BGP_ATTR_NHLEN_IPV4: + break; + case BGP_ATTR_NHLEN_VPNV4: + offset_nh += 8; + break; + default: + /* TODO: handle IPv6 nexthops */ + zlog_warn ("%s: %s: invalid MP nexthop length (AFI IP): %u", + __func__, peer->host, nhlen); + return NULL; + } + + stream_get_from (&v4nh, s, offset_nh, IPV4_MAX_BYTELEN); mod_v4nh = &v4nh; /* @@ -482,7 +494,7 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) } if (nh_modified) /* allow for VPN RD */ - stream_put_in_addr_at (s, vec->offset + 1 + nhlen - 4, mod_v4nh); + stream_put_in_addr_at (s, offset_nh, mod_v4nh); if (bgp_debug_update(peer, NULL, NULL, 0)) zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ nexthop %s%s", @@ -495,6 +507,8 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) struct in6_addr v6nhglobal, *mod_v6nhg; struct in6_addr v6nhlocal, *mod_v6nhl; int gnh_modified, lnh_modified; + size_t offset_nhglobal = vec->offset + 1; + size_t offset_nhlocal = vec->offset + 1; gnh_modified = lnh_modified = 0; mod_v6nhg = &v6nhglobal; @@ -509,7 +523,28 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) * additional work being to handle 1 or 2 nexthops. Also, 3rd * party nexthop is not propagated for EBGP right now. */ - stream_get_from (&v6nhglobal, s, vec->offset + 1, 16); + switch (nhlen) + { + case BGP_ATTR_NHLEN_IPV6_GLOBAL: + break; + case BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL: + offset_nhlocal += IPV6_MAX_BYTELEN; + break; + case BGP_ATTR_NHLEN_VPNV6_GLOBAL: + offset_nhglobal += 8; + break; + case BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL: + offset_nhglobal += 8; + offset_nhlocal += 8 * 2 + IPV6_MAX_BYTELEN; + break; + default: + /* TODO: handle IPv4 nexthops */ + zlog_warn ("%s: %s: invalid MP nexthop length (AFI IP6): %u", + __func__, peer->host, nhlen); + return NULL; + } + + stream_get_from (&v6nhglobal, s, offset_nhglobal, IPV6_MAX_BYTELEN); if (route_map_sets_nh) { if (CHECK_FLAG(vec->flags, @@ -536,9 +571,10 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) } - if (nhlen == 32 || nhlen == 48) /* 48 == VPN */ + if (nhlen == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL || + nhlen == BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL) { - stream_get_from (&v6nhlocal, s, vec->offset + 1 + (nhlen-IPV6_MAX_BYTELEN), IPV6_MAX_BYTELEN); + stream_get_from (&v6nhlocal, s, offset_nhlocal, IPV6_MAX_BYTELEN); if (IN6_IS_ADDR_UNSPECIFIED (&v6nhlocal)) { mod_v6nhl = &peer->nexthop.v6_local; @@ -547,9 +583,9 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) } if (gnh_modified) - stream_put_in6_addr_at (s, vec->offset + 1, mod_v6nhg); + stream_put_in6_addr_at (s, offset_nhglobal, mod_v6nhg); if (lnh_modified) - stream_put_in6_addr_at (s, vec->offset + 1 + (nhlen-IPV6_MAX_BYTELEN), mod_v6nhl); + stream_put_in6_addr_at (s, offset_nhlocal, mod_v6nhl); if (bgp_debug_update(peer, NULL, NULL, 0)) { diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 1372e820f9..66689c8367 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -71,7 +71,6 @@ bgp_node_afi (struct vty *vty) case BGP_IPV6_NODE: case BGP_IPV6M_NODE: case BGP_VPNV6_NODE: - case BGP_ENCAPV6_NODE: afi = AFI_IP6; break; case BGP_EVPN_NODE: @@ -92,10 +91,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; @@ -160,7 +155,7 @@ argv_find_and_parse_afi(struct cmd_token **argv, int argc, int *index, afi_t *af return ret; } -/* supports <unicast|multicast|vpn|encap> */ +/* supports <unicast|multicast|vpn> */ safi_t bgp_vty_safi_from_arg(const char *safi_str) { @@ -169,8 +164,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; return safi; @@ -198,12 +191,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; @@ -223,12 +210,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 [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]] ..." + * "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn>]] ..." * * Since we use argv_find if the show command in particular doesn't have: * [ip] * [<view|vrf> WORD] - * [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]] + * [<ipv4|ipv6> [<unicast|multicast|vpn>]] * The command parsing should still be ok. * * vty -> The vty for the command so we can output some useful data in @@ -5656,7 +5643,7 @@ DEFUN (no_neighbor_addpath_tx_bestpath_per_as, DEFUN_NOSH (address_family_ipv4_safi, address_family_ipv4_safi_cmd, - "address-family ipv4 [<unicast|multicast|vpn|encap>]", + "address-family ipv4 [<unicast|multicast|vpn>]", "Enter Address Family command mode\n" "Address Family\n" BGP_SAFI_HELP_STR) @@ -5669,9 +5656,6 @@ DEFUN_NOSH (address_family_ipv4_safi, case SAFI_MULTICAST: vty->node = BGP_IPV4M_NODE; break; - case SAFI_ENCAP: - vty->node = BGP_ENCAP_NODE; - break; case SAFI_MPLS_VPN: vty->node = BGP_VPNV4_NODE; break; @@ -5689,7 +5673,7 @@ DEFUN_NOSH (address_family_ipv4_safi, DEFUN_NOSH (address_family_ipv6_safi, address_family_ipv6_safi_cmd, - "address-family ipv6 [<unicast|multicast|vpn|encap>]", + "address-family ipv6 [<unicast|multicast|vpn>]", "Enter Address Family command mode\n" "Address Family\n" BGP_SAFI_HELP_STR) @@ -5702,9 +5686,6 @@ DEFUN_NOSH (address_family_ipv6_safi, case SAFI_MULTICAST: vty->node = BGP_IPV6M_NODE; break; - case SAFI_ENCAP: - vty->node = BGP_ENCAPV6_NODE; - break; case SAFI_MPLS_VPN: vty->node = BGP_VPNV6_NODE; break; @@ -5744,28 +5725,6 @@ DEFUN_NOSH (address_family_vpnv6, } #endif -DEFUN_NOSH (address_family_encap, - address_family_encap_cmd, - "address-family <encap|encapv4>", - "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 <l2vpn evpn>", @@ -5789,8 +5748,6 @@ DEFUN_NOSH (exit_address_family, || vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_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; @@ -10094,20 +10051,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, @@ -10128,8 +10071,6 @@ bgp_vty_init (void) install_node (&bgp_ipv6_multicast_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. */ @@ -10140,8 +10081,6 @@ bgp_vty_init (void) install_default (BGP_IPV6M_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. */ @@ -10354,8 +10293,6 @@ bgp_vty_init (void) install_element (BGP_IPV6M_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. */ @@ -10366,8 +10303,6 @@ bgp_vty_init (void) install_element (BGP_IPV6M_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. @@ -10383,8 +10318,6 @@ bgp_vty_init (void) install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd); /* "no neighbor peer-group unset" commands. */ install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); @@ -10394,8 +10327,6 @@ bgp_vty_init (void) install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd); /* "neighbor softreconfiguration inbound" commands.*/ install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); @@ -10412,10 +10343,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_cmd); @@ -10433,12 +10360,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); @@ -10461,10 +10382,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_cmd); @@ -10555,10 +10472,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_cmd); @@ -10589,14 +10502,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_cmd); @@ -10613,10 +10518,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_cmd); @@ -10633,10 +10534,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_cmd); @@ -10759,10 +10656,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); @@ -10803,10 +10696,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_cmd); @@ -10823,10 +10712,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_cmd); @@ -10843,10 +10728,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_cmd); @@ -10863,10 +10744,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_cmd); @@ -10883,10 +10760,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_cmd); @@ -10939,22 +10812,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_cmd); install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); @@ -10970,10 +10827,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); @@ -10983,9 +10836,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. */ @@ -10995,8 +10845,6 @@ bgp_vty_init (void) install_element (BGP_IPV6M_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 33d24d530e..522eeabefb 100644 --- a/bgpd/bgp_vty.h +++ b/bgpd/bgp_vty.h @@ -28,11 +28,10 @@ struct bgp; #define BGP_AFI_CMD_STR "<ipv4|ipv6>" #define BGP_AFI_HELP_STR "Address Family\nAddress Family\n" -#define BGP_SAFI_CMD_STR "<unicast|multicast|vpn|encap>" +#define BGP_SAFI_CMD_STR "<unicast|multicast|vpn>" #define BGP_SAFI_HELP_STR \ "Address Family modifier\n" \ "Address Family modifier\n" \ - "Address Family modifier\n" \ "Address Family modifier\n" #define BGP_AFI_SAFI_CMD_STR BGP_AFI_CMD_STR" "BGP_SAFI_CMD_STR #define BGP_AFI_SAFI_HELP_STR BGP_AFI_HELP_STR BGP_SAFI_HELP_STR diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 1da69c9f32..94433df2f3 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -61,7 +61,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #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" @@ -7695,7 +7694,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 4f46565900..fe1d272ade 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.c +++ b/bgpd/rfapi/bgp_rfapi_cfg.c @@ -291,10 +291,9 @@ bgp_rfapi_is_vnc_configured (struct bgp *bgp) DEFUN (vnc_advertise_un_method, vnc_advertise_un_method_cmd, - "vnc advertise-un-method <encap-safi|encap-attr>", + "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 ff921ff402..4912461adb 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1047,8 +1047,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: @@ -1416,8 +1414,6 @@ cmd_exit (struct vty *vty) case BGP_IPV4M_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: @@ -1481,8 +1477,6 @@ DEFUN (config_end, case RIP_NODE: case RIPNG_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 d62f7655ee..223f028144 100644 --- a/lib/command.h +++ b/lib/command.h @@ -98,8 +98,6 @@ enum node_type BGP_IPV4M_NODE, /* BGP IPv4 multicast address family. */ BGP_IPV6_NODE, /* BGP IPv6 address family */ BGP_IPV6M_NODE, /* BGP IPv6 multicast 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/privs.c b/lib/privs.c index decd4bb7db..c25310c8d3 100644 --- a/lib/privs.c +++ b/lib/privs.c @@ -105,7 +105,7 @@ static struct #ifdef HAVE_LCAPS /* Quagga -> Linux capabilities mappings */ [ZCAP_SETID] = { 2, (pvalue_t []) { CAP_SETGID, CAP_SETUID }, }, - [ZCAP_BIND] = { 2, (pvalue_t []) { CAP_NET_BIND_SERVICE }, }, + [ZCAP_BIND] = { 1, (pvalue_t []) { CAP_NET_BIND_SERVICE }, }, [ZCAP_NET_ADMIN] = { 1, (pvalue_t []) { CAP_NET_ADMIN }, }, [ZCAP_NET_RAW] = { 1, (pvalue_t []) { CAP_NET_RAW }, }, [ZCAP_CHROOT] = { 1, (pvalue_t []) { CAP_SYS_CHROOT, }, }, @@ -130,7 +130,7 @@ static struct [ZCAP_CHROOT] = { 1, (pvalue_t []) { PRIV_PROC_CHROOT }, }, [ZCAP_NICE] = { 1, (pvalue_t []) { PRIV_PROC_PRIOCNTL }, }, [ZCAP_PTRACE] = { 1, (pvalue_t []) { PRIV_PROC_SESSION }, }, - [ZCAP_DAC_OVERRIDE] = { 2, (pvalue_t []) { PRIV_FILE_DAC_EXECUTE, + [ZCAP_DAC_OVERRIDE] = { 5, (pvalue_t []) { PRIV_FILE_DAC_EXECUTE, PRIV_FILE_DAC_READ, PRIV_FILE_DAC_SEARCH, PRIV_FILE_DAC_WRITE, @@ -737,8 +737,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/nhrpd/nhrp_vty.c b/nhrpd/nhrp_vty.c index 9b8463fb54..dc89683277 100644 --- a/nhrpd/nhrp_vty.c +++ b/nhrpd/nhrp_vty.c @@ -937,6 +937,9 @@ void nhrp_config_init(void) install_node(&zebra_node, nhrp_config_write); install_default(ZEBRA_NODE); + /* access-list commands */ + access_list_init (); + /* global commands */ install_element(VIEW_NODE, &show_debugging_nhrp_cmd); install_element(VIEW_NODE, &show_ip_nhrp_cmd); diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 6461963856..5dd10b4c72 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -1455,13 +1455,14 @@ ospf6_intra_route_calculation (struct ospf6_area *oa) { if (hook_add) (*hook_add) (route); + route->flag = 0; } else { /* Redo the summaries as things might have changed */ ospf6_abr_originate_summary (route); + route->flag = 0; } - route->flag = 0; } if (IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX)) diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c index a54170e048..aa4909314a 100644 --- a/ospfd/ospf_abr.c +++ b/ospfd/ospf_abr.c @@ -197,9 +197,8 @@ ospf_area_range_set (struct ospf *ospf, struct in_addr area_id, { struct ospf_area *area; struct ospf_area_range *range; - int ret = OSPF_AREA_ID_FORMAT_ADDRESS; - area = ospf_area_get (ospf, area_id, ret); + area = ospf_area_get (ospf, area_id); if (area == NULL) return 0; @@ -233,9 +232,8 @@ ospf_area_range_cost_set (struct ospf *ospf, struct in_addr area_id, { struct ospf_area *area; struct ospf_area_range *range; - int ret = OSPF_AREA_ID_FORMAT_ADDRESS; - area = ospf_area_get (ospf, area_id, ret); + area = ospf_area_get (ospf, area_id); if (area == NULL) return 0; @@ -282,9 +280,8 @@ ospf_area_range_substitute_set (struct ospf *ospf, struct in_addr area_id, { struct ospf_area *area; struct ospf_area_range *range; - int ret = OSPF_AREA_ID_FORMAT_ADDRESS; - area = ospf_area_get (ospf, area_id, ret); + area = ospf_area_get (ospf, area_id); range = ospf_area_range_lookup (area, p); if (range != NULL) diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index aeb12a59fa..137df16a05 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -795,7 +795,7 @@ ospf_vl_data_new (struct ospf_area *area, struct in_addr vl_peer) vl_data->vl_peer.s_addr = vl_peer.s_addr; vl_data->vl_area_id = area->area_id; - vl_data->format = area->format; + vl_data->vl_area_id_fmt = area->area_id_fmt; return vl_data; } @@ -869,7 +869,7 @@ ospf_vl_new (struct ospf *ospf, struct ospf_vl_data *vl_data) zlog_debug ("ospf_vl_new(): set if->name to %s", vi->name); area_id.s_addr = 0; - area = ospf_area_get (ospf, area_id, OSPF_AREA_ID_FORMAT_ADDRESS); + area = ospf_area_get (ospf, area_id); voi->area = area; if (IS_DEBUG_OSPF_EVENT) diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h index 39202f777a..c5e6594926 100644 --- a/ospfd/ospf_interface.h +++ b/ospfd/ospf_interface.h @@ -104,12 +104,12 @@ struct ospf_interface; struct ospf_vl_data { - struct in_addr vl_peer; /* Router-ID of the peer for VLs. */ - struct in_addr vl_area_id; /* Transit area for this VL. */ - int format; /* area ID format */ - struct ospf_interface *vl_oi; /* Interface data structure for the VL. */ - struct vertex_nexthop nexthop; /* Nexthop router and oi to use */ - struct in_addr peer_addr; /* Address used to reach the peer. */ + struct in_addr vl_peer; /* Router-ID of the peer */ + struct in_addr vl_area_id; /* Transit area */ + int vl_area_id_fmt; /* Area ID format */ + struct ospf_interface *vl_oi; /* Interface data structure */ + struct vertex_nexthop nexthop; /* Nexthop router and oi to use */ + struct in_addr peer_addr; /* Address used to reach the peer */ u_char flags; }; diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index f409aa8bb4..caf1b0c668 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -67,36 +67,29 @@ static const char *ospf_network_type_str[] = /* Utility functions. */ int -ospf_str2area_id (const char *str, struct in_addr *area_id, int *format) +str2area_id (const char *str, struct in_addr *area_id, int *area_id_fmt) { - char *endptr = NULL; - unsigned long ret; + char *ep; - /* match "A.B.C.D". */ - if (strchr (str, '.') != NULL) - { - ret = inet_aton (str, area_id); - if (!ret) - return -1; - *format = OSPF_AREA_ID_FORMAT_ADDRESS; - } - /* match "<0-4294967295>". */ - else - { - if (*str == '-') - return -1; - errno = 0; - ret = strtoul (str, &endptr, 10); - if (*endptr != '\0' || errno || ret > UINT32_MAX) - return -1; + area_id->s_addr = htonl (strtoul (str, &ep, 10)); + if (*ep && !inet_aton (str, area_id)) + return -1; - area_id->s_addr = htonl (ret); - *format = OSPF_AREA_ID_FORMAT_DECIMAL; - } + *area_id_fmt = *ep ? OSPF_AREA_ID_FMT_DOTTEDQUAD : OSPF_AREA_ID_FMT_DECIMAL; return 0; } +void +area_id2str (char *buf, int length, struct in_addr *area_id, int area_id_fmt) +{ + memset (buf, 0, length); + + if (area_id_fmt == OSPF_AREA_ID_FMT_DOTTEDQUAD) + strncpy (buf, inet_ntoa (*area_id), length); + else + sprintf (buf, "%lu", (unsigned long) ntohl (area_id->s_addr)); +} static int str2metric (const char *str, int *metric) @@ -534,7 +527,7 @@ DEFUN (ospf_network_area, VTY_GET_IPV4_PREFIX ("network prefix", p, argv[idx_ipv4_prefixlen]->arg); VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); - ret = ospf_network_set (ospf, &p, area_id); + ret = ospf_network_set (ospf, &p, area_id, format); if (ret == 0) { vty_out (vty, "There is already same network statement.%s", VTY_NEWLINE); @@ -641,6 +634,7 @@ DEFUN (ospf_area_range_cost, VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg); ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE); + ospf_area_display_format_set (ospf, ospf_area_get (ospf, area_id), format); VTY_GET_INTEGER ("range cost", cost, argv[idx_cost]->arg); ospf_area_range_cost_set (ospf, area_id, &p, cost); @@ -669,6 +663,7 @@ DEFUN (ospf_area_range_not_advertise, VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg); ospf_area_range_set (ospf, area_id, &p, 0); + ospf_area_display_format_set (ospf, ospf_area_get (ospf, area_id), format); return CMD_SUCCESS; } @@ -728,6 +723,7 @@ DEFUN (ospf_area_range_substitute, VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[idx_ipv4_prefixlen_2]->arg); ospf_area_range_substitute_set (ospf, area_id, &p, &s); + ospf_area_display_format_set (ospf, ospf_area_get (ospf, area_id), format); return CMD_SUCCESS; } @@ -782,7 +778,7 @@ DEFUN (no_ospf_area_range_substitute, struct ospf_vl_config_data { struct vty *vty; /* vty stuff */ struct in_addr area_id; /* area ID from command line */ - int format; /* command line area ID format */ + int area_id_fmt; /* command line area ID format */ struct in_addr vl_peer; /* command line vl_peer */ int auth_type; /* Authehntication type, if given */ char *auth_key; /* simple password if present */ @@ -821,11 +817,12 @@ ospf_find_vl_data (struct ospf *ospf, struct ospf_vl_config_data *vl_config) VTY_NEWLINE); return NULL; } - area = ospf_area_get (ospf, area_id, vl_config->format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, vl_config->area_id_fmt); if (area->external_routing != OSPF_AREA_DEFAULT) { - if (vl_config->format == OSPF_AREA_ID_FORMAT_ADDRESS) + if (vl_config->area_id_fmt == OSPF_AREA_ID_FMT_DOTTEDQUAD) vty_out (vty, "Area %s is %s%s", inet_ntoa (area_id), area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", @@ -1037,7 +1034,8 @@ DEFUN (ospf_area_vlink, ospf_vl_config_data_init(&vl_config, vty); /* Read off first 2 parameters and check them */ - ret = ospf_str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &vl_config.format); + ret = str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, + &vl_config.area_id_fmt); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); @@ -1155,7 +1153,7 @@ DEFUN (ospf_area_vlink_intervals, char *area_id = argv[1]->arg; char *router_id = argv[3]->arg; - ret = ospf_str2area_id (area_id, &vl_config.area_id, &vl_config.format); + ret = str2area_id (area_id, &vl_config.area_id, &vl_config.area_id_fmt); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); @@ -1210,7 +1208,7 @@ DEFUN (no_ospf_area_vlink, ospf_vl_config_data_init(&vl_config, vty); - ret = ospf_str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &format); + ret = str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &format); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); @@ -1319,7 +1317,7 @@ DEFUN (no_ospf_area_vlink_intervals, char *area_id = argv[2]->arg; char *router_id = argv[4]->arg; - ret = ospf_str2area_id (area_id, &vl_config.area_id, &vl_config.format); + ret = str2area_id (area_id, &vl_config.area_id, &vl_config.area_id_fmt); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); @@ -1371,7 +1369,8 @@ DEFUN (ospf_area_shortcut, VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[idx_ipv4_number]->arg); - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, format); if (strncmp (argv[idx_enable_disable]->arg, "de", 2) == 0) mode = OSPF_SHORTCUT_DEFAULT; @@ -1437,6 +1436,7 @@ DEFUN (ospf_area_stub, VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg); ret = ospf_area_stub_set (ospf, area_id); + ospf_area_display_format_set (ospf, ospf_area_get (ospf, area_id), format); if (ret == 0) { vty_out (vty, "First deconfigure all virtual link through this area%s", @@ -1466,6 +1466,7 @@ DEFUN (ospf_area_stub_no_summary, VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg); ret = ospf_area_stub_set (ospf, area_id); + ospf_area_display_format_set (ospf, ospf_area_get (ospf, area_id), format); if (ret == 0) { vty_out (vty, "%% Area cannot be stub as it contains a virtual link%s", @@ -1532,6 +1533,7 @@ ospf_area_nssa_cmd_handler (struct vty *vty, int argc, struct cmd_token **argv, VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[1]->arg); ret = ospf_area_nssa_set (ospf, area_id); + ospf_area_display_format_set (ospf, ospf_area_get (ospf, area_id), format); if (ret == 0) { vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s", @@ -1669,7 +1671,8 @@ DEFUN (ospf_area_default_cost, VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[idx_ipv4_number]->arg); VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[idx_number]->arg, 0, 16777215); - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, format); if (area->external_routing == OSPF_AREA_DEFAULT) { @@ -1756,7 +1759,8 @@ DEFUN (ospf_area_export_list, VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, format); ospf_area_export_list_set (ospf, area, argv[3]->arg); return CMD_SUCCESS; @@ -1807,7 +1811,8 @@ DEFUN (ospf_area_import_list, VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, format); ospf_area_import_list_set (ospf, area, argv[3]->arg); return CMD_SUCCESS; @@ -1863,7 +1868,8 @@ DEFUN (ospf_area_filter_list, VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, format); plist = prefix_list_lookup (AFI_IP, argv[idx_word]->arg); if (strncmp (argv[idx_in_out]->arg, "in", 2) == 0) { @@ -1963,7 +1969,8 @@ DEFUN (ospf_area_authentication_message_digest, VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, format); area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; return CMD_SUCCESS; @@ -1985,7 +1992,8 @@ DEFUN (ospf_area_authentication, VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, format); area->auth_type = OSPF_AUTH_SIMPLE; return CMD_SUCCESS; @@ -7003,7 +7011,7 @@ DEFUN (ip_ospf_area, return CMD_SUCCESS; } - ret = ospf_str2area_id (areaid, &area_id, &format); + ret = str2area_id (areaid, &area_id, &format); if (ret < 0) { vty_out (vty, "Please specify area by A.B.C.D|<0-4294967295>%s", @@ -8165,19 +8173,6 @@ const char *ospf_shortcut_mode_str[] = "disable" }; - -static void -area_id2str (char *buf, int length, struct ospf_area *area) -{ - memset (buf, 0, length); - - if (area->format == OSPF_AREA_ID_FORMAT_ADDRESS) - strncpy (buf, inet_ntoa (area->area_id), length); - else - sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr)); -} - - const char *ospf_int_type_str[] = { "unknown", /* should never be used. */ @@ -8424,7 +8419,7 @@ config_write_network_area (struct vty *vty, struct ospf *ospf) memset (buf, 0, INET_ADDRSTRLEN); /* Create Area ID string by specified Area ID format. */ - if (n->format == OSPF_AREA_ID_FORMAT_ADDRESS) + if (n->area_id_fmt == OSPF_AREA_ID_FMT_DOTTEDQUAD) strncpy ((char *) buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN); else sprintf ((char *) buf, "%lu", @@ -8451,7 +8446,8 @@ config_write_ospf_area (struct vty *vty, struct ospf *ospf) { struct route_node *rn1; - area_id2str ((char *) buf, INET_ADDRSTRLEN, area); + area_id2str ((char *) buf, INET_ADDRSTRLEN, &area->area_id, + area->area_id_fmt); if (area->auth_type != OSPF_AUTH_NULL) { @@ -8570,7 +8566,7 @@ config_write_virtual_link (struct vty *vty, struct ospf *ospf) { struct listnode *node; struct ospf_vl_data *vl_data; - u_char buf[INET_ADDRSTRLEN]; + char buf[INET_ADDRSTRLEN]; /* Virtual-Link print */ for (ALL_LIST_ELEMENTS_RO (ospf->vlinks, node, vl_data)) @@ -8582,12 +8578,8 @@ config_write_virtual_link (struct vty *vty, struct ospf *ospf) if (vl_data != NULL) { memset (buf, 0, INET_ADDRSTRLEN); - - if (vl_data->format == OSPF_AREA_ID_FORMAT_ADDRESS) - strncpy ((char *) buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN); - else - sprintf ((char *) buf, "%lu", - (unsigned long int) ntohl (vl_data->vl_area_id.s_addr)); + + area_id2str (buf, sizeof(buf), &vl_data->vl_area_id, vl_data->vl_area_id_fmt); oi = vl_data->vl_oi; /* timers */ diff --git a/ospfd/ospf_vty.h b/ospfd/ospf_vty.h index 429ac318f7..cf6b322ac7 100644 --- a/ospfd/ospf_vty.h +++ b/ospfd/ospf_vty.h @@ -26,7 +26,7 @@ #define VTY_GET_OSPF_AREA_ID(V,F,STR) \ { \ int retv; \ - retv = ospf_str2area_id ((STR), &(V), &(F)); \ + retv = str2area_id ((STR), &(V), &(F)); \ if (retv < 0) \ { \ vty_out (vty, "%% Invalid OSPF area ID%s", VTY_NEWLINE); \ @@ -37,7 +37,7 @@ #define VTY_GET_OSPF_AREA_ID_NO_BB(NAME,V,F,STR) \ { \ int retv; \ - retv = ospf_str2area_id ((STR), &(V), &(F)); \ + retv = str2area_id ((STR), &(V), &(F)); \ if (retv < 0) \ { \ vty_out (vty, "%% Invalid OSPF area ID%s", VTY_NEWLINE); \ @@ -54,6 +54,7 @@ extern void ospf_vty_init (void); extern void ospf_vty_show_init (void); extern void ospf_vty_clear_init (void); -extern int ospf_str2area_id (const char *, struct in_addr *, int *); +extern int str2area_id (const char *, struct in_addr *, int *); +extern void area_id2str (char *, int, struct in_addr *, int); #endif /* _QUAGGA_OSPF_VTY_H */ diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 30b1e9622f..af68d1d35f 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -717,6 +717,7 @@ ospf_area_new (struct ospf *ospf, struct in_addr area_id) new->ospf = ospf; new->area_id = area_id; + new->area_id_fmt = OSPF_AREA_ID_FMT_DOTTEDQUAD; new->external_routing = OSPF_AREA_DEFAULT; new->default_cost = 1; @@ -809,7 +810,7 @@ ospf_area_check_free (struct ospf *ospf, struct in_addr area_id) } struct ospf_area * -ospf_area_get (struct ospf *ospf, struct in_addr area_id, int format) +ospf_area_get (struct ospf *ospf, struct in_addr area_id) { struct ospf_area *area; @@ -817,7 +818,6 @@ ospf_area_get (struct ospf *ospf, struct in_addr area_id, int format) if (!area) { area = ospf_area_new (ospf, area_id); - area->format = format; listnode_add_sort (ospf->areas, area); ospf_check_abr_status (ospf); if (ospf->stub_router_admin_set == OSPF_STUB_ROUTER_ADMINISTRATIVE_SET) @@ -920,13 +920,13 @@ static void update_redistributed(struct ospf *ospf, int add_to_ospf) /* Config network statement related functions. */ static struct ospf_network * -ospf_network_new (struct in_addr area_id, int format) +ospf_network_new (struct in_addr area_id) { struct ospf_network *new; new = XCALLOC (MTYPE_OSPF_NETWORK, sizeof (struct ospf_network)); new->area_id = area_id; - new->format = format; + new->area_id_fmt = OSPF_AREA_ID_FMT_DOTTEDQUAD; return new; } @@ -941,12 +941,11 @@ ospf_network_free (struct ospf *ospf, struct ospf_network *network) int ospf_network_set (struct ospf *ospf, struct prefix_ipv4 *p, - struct in_addr area_id) + struct in_addr area_id, int df) { struct ospf_network *network; struct ospf_area *area; struct route_node *rn; - int ret = OSPF_AREA_ID_FORMAT_ADDRESS; rn = route_node_get (ospf->networks, (struct prefix *)p); if (rn->info) @@ -956,8 +955,10 @@ ospf_network_set (struct ospf *ospf, struct prefix_ipv4 *p, return 0; } - rn->info = network = ospf_network_new (area_id, ret); - area = ospf_area_get (ospf, area_id, ret); + rn->info = network = ospf_network_new (area_id); + network->area_id_fmt = df; + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, df); /* Run network config now. */ ospf_network_run ((struct prefix *)p, area); @@ -1037,7 +1038,6 @@ ospf_interface_set (struct interface *ifp, struct in_addr area_id) struct ospf *ospf; struct ospf_if_params *params; struct ospf_interface *oi; - int ret = OSPF_AREA_ID_FORMAT_ADDRESS; if ((ospf = ospf_lookup ()) == NULL) return 1; /* Ospf not ready yet */ @@ -1047,7 +1047,7 @@ ospf_interface_set (struct interface *ifp, struct in_addr area_id) SET_IF_PARAM (params, if_area); params->if_area = area_id; - area = ospf_area_get (ospf, area_id, ret); + area = ospf_area_get (ospf, area_id); for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, co)) { @@ -1235,7 +1235,7 @@ ospf_if_update (struct ospf *ospf, struct interface *ifp) if (rn->info != NULL) { network = (struct ospf_network *) rn->info; - area = ospf_area_get (ospf, network->area_id, network->format); + area = ospf_area_get (ospf, network->area_id); ospf_network_run_interface (&rn->p, area, ifp); } @@ -1369,12 +1369,19 @@ ospf_area_vlink_count (struct ospf *ospf, struct ospf_area *area) } int +ospf_area_display_format_set (struct ospf *ospf, struct ospf_area *area, int df) +{ + area->area_id_fmt = df; + + return 1; +} + +int ospf_area_stub_set (struct ospf *ospf, struct in_addr area_id) { struct ospf_area *area; - int format = OSPF_AREA_ID_FORMAT_ADDRESS; - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); if (ospf_area_vlink_count (ospf, area)) return 0; @@ -1405,9 +1412,8 @@ int ospf_area_no_summary_set (struct ospf *ospf, struct in_addr area_id) { struct ospf_area *area; - int format = OSPF_AREA_ID_FORMAT_ADDRESS; - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); area->no_summary = 1; return 1; @@ -1432,9 +1438,8 @@ int ospf_area_nssa_set (struct ospf *ospf, struct in_addr area_id) { struct ospf_area *area; - int format = OSPF_AREA_ID_FORMAT_ADDRESS; - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); if (ospf_area_vlink_count (ospf, area)) return 0; diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index 9198d5c620..787a77bf96 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -322,9 +322,9 @@ struct ospf_area struct in_addr area_id; /* Area ID format. */ - char format; -#define OSPF_AREA_ID_FORMAT_ADDRESS 1 -#define OSPF_AREA_ID_FORMAT_DECIMAL 2 + int area_id_fmt; +#define OSPF_AREA_ID_FMT_DOTTEDQUAD 1 +#define OSPF_AREA_ID_FMT_DECIMAL 2 /* Address range. */ struct list *address_range; @@ -431,7 +431,7 @@ struct ospf_network { /* Area ID. */ struct in_addr area_id; - int format; + int area_id_fmt; }; /* OSPF NBMA neighbor structure. */ @@ -525,9 +525,11 @@ extern struct ospf *ospf_get_instance (u_short); extern void ospf_finish (struct ospf *); extern void ospf_router_id_update (struct ospf *ospf); extern int ospf_network_set (struct ospf *, struct prefix_ipv4 *, - struct in_addr); + struct in_addr, int); extern int ospf_network_unset (struct ospf *, struct prefix_ipv4 *, struct in_addr); +extern int ospf_area_display_format_set (struct ospf *, struct ospf_area *area, + int df); extern int ospf_area_stub_set (struct ospf *, struct in_addr); extern int ospf_area_stub_unset (struct ospf *, struct in_addr); extern int ospf_area_no_summary_set (struct ospf *, struct in_addr); @@ -566,7 +568,7 @@ extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup_next (struct ospf *, int); extern int ospf_oi_count (struct interface *); -extern struct ospf_area *ospf_area_get (struct ospf *, struct in_addr, int); +extern struct ospf_area *ospf_area_get (struct ospf *, struct in_addr); extern void ospf_area_check_free (struct ospf *, struct in_addr); extern struct ospf_area *ospf_area_lookup_by_area_id (struct ospf *, struct in_addr); diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 80decc34cd..eeb72236cf 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -6210,7 +6210,7 @@ DEFUN (show_ip_msdp_peer_detail, if (uj) argc--; - if (argc == 4) + if (argc > 4) ip_msdp_show_peers_detail(vty, argv[4]->arg, uj); else ip_msdp_show_peers(vty, uj); diff --git a/vtysh/Makefile.am b/vtysh/Makefile.am index 9b81f99607..a8dbb8d71d 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 337925c6e8..17b95707d6 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -306,7 +306,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_IPV6M_NODE || saved_node == BGP_EVPN_NODE) @@ -927,18 +926,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, @@ -1138,31 +1125,6 @@ DEFUNSH (VTYSH_BGPD, } DEFUNSH (VTYSH_BGPD, - address_family_encapv4, - address_family_encapv4_cmd, - "address-family [ipv4] <encap|encapv4>", - "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, "address-family ipv4 [unicast]", @@ -1548,8 +1510,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_IPV6_NODE: @@ -1614,8 +1574,6 @@ DEFUNSH (VTYSH_BGPD, || vty->node == BGP_IPV4M_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_IPV6M_NODE) vty->node = BGP_NODE; @@ -2530,6 +2488,7 @@ vtysh_write_config_integrated(void) err++; } +#ifdef FRR_USER pwentry = getpwnam (FRR_USER); if (pwentry) uid = pwentry->pw_uid; @@ -2538,7 +2497,8 @@ vtysh_write_config_integrated(void) printf ("%% Warning: could not look up user \"%s\"\n", FRR_USER); err++; } - +#endif +#ifdef FRR_GROUP grentry = getgrnam (FRR_GROUP); if (grentry) gid = grentry->gr_gid; @@ -2547,6 +2507,7 @@ vtysh_write_config_integrated(void) printf ("%% Warning: could not look up group \"%s\"\n", FRR_GROUP); err++; } +#endif if (!fstat (fd, &st)) { @@ -3140,8 +3101,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_ipv6_node, NULL); @@ -3178,8 +3137,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_IPV6_NODE); @@ -3245,10 +3202,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); @@ -3298,8 +3251,6 @@ vtysh_init_vty (void) install_element (BGP_IPV4M_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_VRF_POLICY_NODE, &vtysh_end_all_cmd); @@ -3349,8 +3300,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); @@ -3366,8 +3315,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_IPV6_NODE, &exit_address_family_cmd); |
