LCOV - code coverage report
Current view: top level - bgpd - bgp_vty.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 9 3649 0.2 %
Date: 2015-11-19 Functions: 1 392 0.3 %

          Line data    Source code
       1             : /* BGP VTY interface.
       2             :    Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro
       3             : 
       4             : This file is part of GNU Zebra.
       5             : 
       6             : GNU Zebra is free software; you can redistribute it and/or modify it
       7             : under the terms of the GNU General Public License as published by the
       8             : Free Software Foundation; either version 2, or (at your option) any
       9             : later version.
      10             : 
      11             : GNU Zebra is distributed in the hope that it will be useful, but
      12             : WITHOUT ANY WARRANTY; without even the implied warranty of
      13             : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      14             : General Public License for more details.
      15             : 
      16             : You should have received a copy of the GNU General Public License
      17             : along with GNU Zebra; see the file COPYING.  If not, write to the Free
      18             : Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
      19             : 02111-1307, USA.  */
      20             : 
      21             : #include <zebra.h>
      22             : 
      23             : #include "command.h"
      24             : #include "prefix.h"
      25             : #include "plist.h"
      26             : #include "buffer.h"
      27             : #include "linklist.h"
      28             : #include "stream.h"
      29             : #include "thread.h"
      30             : #include "log.h"
      31             : #include "memory.h"
      32             : #include "hash.h"
      33             : 
      34             : #include "bgpd/bgpd.h"
      35             : #include "bgpd/bgp_advertise.h"
      36             : #include "bgpd/bgp_attr.h"
      37             : #include "bgpd/bgp_aspath.h"
      38             : #include "bgpd/bgp_community.h"
      39             : #include "bgpd/bgp_ecommunity.h"
      40             : #include "bgpd/bgp_damp.h"
      41             : #include "bgpd/bgp_debug.h"
      42             : #include "bgpd/bgp_fsm.h"
      43             : #include "bgpd/bgp_mplsvpn.h"
      44             : #include "bgpd/bgp_nexthop.h"
      45             : #include "bgpd/bgp_open.h"
      46             : #include "bgpd/bgp_regex.h"
      47             : #include "bgpd/bgp_route.h"
      48             : #include "bgpd/bgp_zebra.h"
      49             : #include "bgpd/bgp_table.h"
      50             : #include "bgpd/bgp_vty.h"
      51             : #include "bgpd/bgp_mpath.h"
      52             : 
      53             : extern struct in_addr router_id_zebra;
      54             : 
      55             : /* Utility function to get address family from current node.  */
      56             : afi_t
      57           0 : bgp_node_afi (struct vty *vty)
      58             : {
      59           0 :   if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE)
      60           0 :     return AFI_IP6;
      61           0 :   return AFI_IP;
      62             : }
      63             : 
      64             : /* Utility function to get subsequent address family from current
      65             :    node.  */
      66             : safi_t
      67           0 : bgp_node_safi (struct vty *vty)
      68             : {
      69           0 :   if (vty->node == BGP_VPNV4_NODE)
      70           0 :     return SAFI_MPLS_VPN;
      71           0 :   if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE)
      72           0 :     return SAFI_MULTICAST;
      73           0 :   return SAFI_UNICAST;
      74             : }
      75             : 
      76             : static int
      77           0 : peer_address_self_check (union sockunion *su)
      78             : {
      79           0 :   struct interface *ifp = NULL;
      80             : 
      81           0 :   if (su->sa.sa_family == AF_INET)
      82           0 :     ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
      83             : #ifdef HAVE_IPV6
      84           0 :   else if (su->sa.sa_family == AF_INET6)
      85           0 :     ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
      86             : #endif /* HAVE IPV6 */
      87             : 
      88           0 :   if (ifp)
      89           0 :     return 1;
      90             : 
      91           0 :   return 0;
      92             : }
      93             : 
      94             : /* Utility function for looking up peer from VTY.  */
      95             : static struct peer *
      96           0 : peer_lookup_vty (struct vty *vty, const char *ip_str)
      97             : {
      98             :   int ret;
      99             :   struct bgp *bgp;
     100             :   union sockunion su;
     101             :   struct peer *peer;
     102             : 
     103           0 :   bgp = vty->index;
     104             : 
     105           0 :   ret = str2sockunion (ip_str, &su);
     106           0 :   if (ret < 0)
     107             :     {
     108           0 :       vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
     109           0 :       return NULL;
     110             :     }
     111             : 
     112           0 :   peer = peer_lookup (bgp, &su);
     113           0 :   if (! peer)
     114             :     {
     115           0 :       vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
     116           0 :       return NULL;
     117             :     }
     118           0 :   return peer;
     119             : }
     120             : 
     121             : /* Utility function for looking up peer or peer group.  */
     122             : static struct peer *
     123           0 : peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
     124             : {
     125             :   int ret;
     126             :   struct bgp *bgp;
     127             :   union sockunion su;
     128             :   struct peer *peer;
     129             :   struct peer_group *group;
     130             : 
     131           0 :   bgp = vty->index;
     132             : 
     133           0 :   ret = str2sockunion (peer_str, &su);
     134           0 :   if (ret == 0)
     135             :     {
     136           0 :       peer = peer_lookup (bgp, &su);
     137           0 :       if (peer)
     138           0 :         return peer;
     139             :     }
     140             :   else
     141             :     {
     142           0 :       group = peer_group_lookup (bgp, peer_str);
     143           0 :       if (group)
     144           0 :         return group->conf;
     145             :     }
     146             : 
     147           0 :   vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
     148           0 :            VTY_NEWLINE);
     149             : 
     150           0 :   return NULL;
     151             : }
     152             : 
     153             : static int
     154           0 : bgp_vty_return (struct vty *vty, int ret)
     155             : {
     156           0 :   const char *str = NULL;
     157             : 
     158           0 :   switch (ret)
     159             :     {
     160             :     case BGP_ERR_INVALID_VALUE:
     161           0 :       str = "Invalid value";
     162           0 :       break;
     163             :     case BGP_ERR_INVALID_FLAG:
     164           0 :       str = "Invalid flag";
     165           0 :       break;
     166             :     case BGP_ERR_PEER_INACTIVE:
     167           0 :       str = "Activate the neighbor for the address family first";
     168           0 :       break;
     169             :     case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
     170           0 :       str = "Invalid command for a peer-group member";
     171           0 :       break;
     172             :     case BGP_ERR_PEER_GROUP_SHUTDOWN:
     173           0 :       str = "Peer-group has been shutdown. Activate the peer-group first";
     174           0 :       break;
     175             :     case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
     176           0 :       str = "This peer is a peer-group member.  Please change peer-group configuration";
     177           0 :       break;
     178             :     case BGP_ERR_PEER_FLAG_CONFLICT:
     179           0 :       str = "Can't set override-capability and strict-capability-match at the same time";
     180           0 :       break;
     181             :     case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
     182           0 :       str = "No activate for peergroup can be given only if peer-group has no members";
     183           0 :       break;
     184             :     case BGP_ERR_PEER_BELONGS_TO_GROUP:
     185           0 :       str = "No activate for an individual peer-group member is invalid";
     186           0 :       break;
     187             :     case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
     188           0 :       str = "Activate the peer-group for the address family first";
     189           0 :       break;
     190             :     case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
     191           0 :       str = "Specify remote-as or peer-group remote AS first";
     192           0 :       break;
     193             :     case BGP_ERR_PEER_GROUP_CANT_CHANGE:
     194           0 :       str = "Cannot change the peer-group. Deconfigure first";
     195           0 :       break;
     196             :     case BGP_ERR_PEER_GROUP_MISMATCH:
     197           0 :       str = "Cannot have different peer-group for the neighbor";
     198           0 :       break;
     199             :     case BGP_ERR_PEER_FILTER_CONFLICT:
     200           0 :       str = "Prefix/distribute list can not co-exist";
     201           0 :       break;
     202             :     case BGP_ERR_NOT_INTERNAL_PEER:
     203           0 :       str = "Invalid command. Not an internal neighbor";
     204           0 :       break;
     205             :     case BGP_ERR_REMOVE_PRIVATE_AS:
     206           0 :       str = "Private AS cannot be removed for IBGP peers";
     207           0 :       break;
     208             :     case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
     209           0 :       str = "Local-AS allowed only for EBGP peers";
     210           0 :       break;
     211             :     case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
     212           0 :       str = "Cannot have local-as same as BGP AS number";
     213           0 :       break;
     214             :     case BGP_ERR_TCPSIG_FAILED:
     215           0 :       str = "Error while applying TCP-Sig to session(s)";
     216           0 :       break;
     217             :     case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
     218           0 :       str = "ebgp-multihop and ttl-security cannot be configured together";
     219           0 :       break;
     220             :     case BGP_ERR_NO_IBGP_WITH_TTLHACK:
     221           0 :       str = "ttl-security only allowed for EBGP peers";
     222           0 :       break;
     223             :     }
     224           0 :   if (str)
     225             :     {
     226           0 :       vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
     227           0 :       return CMD_WARNING;
     228             :     }
     229           0 :   return CMD_SUCCESS;
     230             : }
     231             : 
     232             : /* BGP global configuration.  */
     233             : 
     234           0 : DEFUN (bgp_multiple_instance_func,
     235             :        bgp_multiple_instance_cmd,
     236             :        "bgp multiple-instance",
     237             :        BGP_STR
     238             :        "Enable bgp multiple instance\n")
     239             : {
     240           0 :   bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
     241           0 :   return CMD_SUCCESS;
     242             : }
     243             : 
     244           0 : DEFUN (no_bgp_multiple_instance,
     245             :        no_bgp_multiple_instance_cmd,
     246             :        "no bgp multiple-instance",
     247             :        NO_STR
     248             :        BGP_STR
     249             :        "BGP multiple instance\n")
     250             : {
     251             :   int ret;
     252             : 
     253           0 :   ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
     254           0 :   if (ret < 0)
     255             :     {
     256           0 :       vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
     257           0 :       return CMD_WARNING;
     258             :     }
     259           0 :   return CMD_SUCCESS;
     260             : }
     261             : 
     262           0 : DEFUN (bgp_config_type,
     263             :        bgp_config_type_cmd,
     264             :        "bgp config-type (cisco|zebra)",
     265             :        BGP_STR
     266             :        "Configuration type\n"
     267             :        "cisco\n"
     268             :        "zebra\n")
     269             : {
     270           0 :   if (strncmp (argv[0], "c", 1) == 0)
     271           0 :     bgp_option_set (BGP_OPT_CONFIG_CISCO);
     272             :   else
     273           0 :     bgp_option_unset (BGP_OPT_CONFIG_CISCO);
     274             : 
     275           0 :   return CMD_SUCCESS;
     276             : }
     277             : 
     278           0 : DEFUN (no_bgp_config_type,
     279             :        no_bgp_config_type_cmd,
     280             :        "no bgp config-type",
     281             :        NO_STR
     282             :        BGP_STR
     283             :        "Display configuration type\n")
     284             : {
     285           0 :   bgp_option_unset (BGP_OPT_CONFIG_CISCO);
     286           0 :   return CMD_SUCCESS;
     287             : }
     288             : 
     289           0 : DEFUN (no_synchronization,
     290             :        no_synchronization_cmd,
     291             :        "no synchronization",
     292             :        NO_STR
     293             :        "Perform IGP synchronization\n")
     294             : {
     295           0 :   return CMD_SUCCESS;
     296             : }
     297             : 
     298           0 : DEFUN (no_auto_summary,
     299             :        no_auto_summary_cmd,
     300             :        "no auto-summary",
     301             :        NO_STR
     302             :        "Enable automatic network number summarization\n")
     303             : {
     304           0 :   return CMD_SUCCESS;
     305             : }
     306             : 
     307           0 : DEFUN_DEPRECATED (neighbor_version,
     308             :                   neighbor_version_cmd,
     309             :                   NEIGHBOR_CMD "version (4|4-)",
     310             :                   NEIGHBOR_STR
     311             :                   NEIGHBOR_ADDR_STR
     312             :                   "Set the BGP version to match a neighbor\n"
     313             :                   "Neighbor's BGP version\n")
     314             : {
     315           0 :   return CMD_SUCCESS;
     316             : }
     317             : 
     318             : /* "router bgp" commands. */
     319           0 : DEFUN (router_bgp, 
     320             :        router_bgp_cmd, 
     321             :        "router bgp " CMD_AS_RANGE,
     322             :        ROUTER_STR
     323             :        BGP_STR
     324             :        AS_STR)
     325             : {
     326             :   int ret;
     327             :   as_t as;
     328             :   struct bgp *bgp;
     329           0 :   const char *name = NULL;
     330             : 
     331           0 :   VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
     332             : 
     333           0 :   if (argc == 2)
     334           0 :     name = argv[1];
     335             : 
     336           0 :   ret = bgp_get (&bgp, &as, name);
     337           0 :   switch (ret)
     338             :     {
     339             :     case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
     340           0 :       vty_out (vty, "Please specify 'bgp multiple-instance' first%s", 
     341           0 :                VTY_NEWLINE);
     342           0 :       return CMD_WARNING;
     343             :     case BGP_ERR_AS_MISMATCH:
     344           0 :       vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
     345           0 :       return CMD_WARNING;
     346             :     case BGP_ERR_INSTANCE_MISMATCH:
     347           0 :       vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
     348           0 :       vty_out (vty, "BGP instance is already running; AS is %u%s",
     349           0 :                as, VTY_NEWLINE);
     350           0 :       return CMD_WARNING;
     351             :     }
     352             : 
     353           0 :   vty->node = BGP_NODE;
     354           0 :   vty->index = bgp;
     355             : 
     356           0 :   return CMD_SUCCESS;
     357             : }
     358             : 
     359             : ALIAS (router_bgp,
     360             :        router_bgp_view_cmd,
     361             :        "router bgp " CMD_AS_RANGE " view WORD",
     362             :        ROUTER_STR
     363             :        BGP_STR
     364             :        AS_STR
     365             :        "BGP view\n"
     366             :        "view name\n")
     367             : 
     368             : /* "no router bgp" commands. */
     369           0 : DEFUN (no_router_bgp,
     370             :        no_router_bgp_cmd,
     371             :        "no router bgp " CMD_AS_RANGE,
     372             :        NO_STR
     373             :        ROUTER_STR
     374             :        BGP_STR
     375             :        AS_STR)
     376             : {
     377             :   as_t as;
     378             :   struct bgp *bgp;
     379           0 :   const char *name = NULL;
     380             : 
     381           0 :   VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
     382             : 
     383           0 :   if (argc == 2)
     384           0 :     name = argv[1];
     385             : 
     386             :   /* Lookup bgp structure. */
     387           0 :   bgp = bgp_lookup (as, name);
     388           0 :   if (! bgp)
     389             :     {
     390           0 :       vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
     391           0 :       return CMD_WARNING;
     392             :     }
     393             : 
     394           0 :   bgp_delete (bgp);
     395             : 
     396           0 :   return CMD_SUCCESS;
     397             : }
     398             : 
     399             : ALIAS (no_router_bgp,
     400             :        no_router_bgp_view_cmd,
     401             :        "no router bgp " CMD_AS_RANGE " view WORD",
     402             :        NO_STR
     403             :        ROUTER_STR
     404             :        BGP_STR
     405             :        AS_STR
     406             :        "BGP view\n"
     407             :        "view name\n")
     408             : 
     409             : /* BGP router-id.  */
     410             : 
     411           0 : DEFUN (bgp_router_id,
     412             :        bgp_router_id_cmd,
     413             :        "bgp router-id A.B.C.D",
     414             :        BGP_STR
     415             :        "Override configured router identifier\n"
     416             :        "Manually configured router identifier\n")
     417             : {
     418             :   int ret;
     419             :   struct in_addr id;
     420             :   struct bgp *bgp;
     421             : 
     422           0 :   bgp = vty->index;
     423             : 
     424           0 :   ret = inet_aton (argv[0], &id);
     425           0 :   if (! ret)
     426             :     {
     427           0 :       vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
     428           0 :       return CMD_WARNING;
     429             :     }
     430             : 
     431           0 :   bgp->router_id_static = id;
     432           0 :   bgp_router_id_set (bgp, &id);
     433             : 
     434           0 :   return CMD_SUCCESS;
     435             : }
     436             : 
     437           0 : DEFUN (no_bgp_router_id,
     438             :        no_bgp_router_id_cmd,
     439             :        "no bgp router-id",
     440             :        NO_STR
     441             :        BGP_STR
     442             :        "Override configured router identifier\n")
     443             : {
     444             :   int ret;
     445             :   struct in_addr id;
     446             :   struct bgp *bgp;
     447             : 
     448           0 :   bgp = vty->index;
     449             : 
     450           0 :   if (argc == 1)
     451             :     {
     452           0 :       ret = inet_aton (argv[0], &id);
     453           0 :       if (! ret)
     454             :         {
     455           0 :           vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
     456           0 :           return CMD_WARNING;
     457             :         }
     458             : 
     459           0 :       if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
     460             :         {
     461           0 :           vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
     462           0 :           return CMD_WARNING;
     463             :         }
     464             :     }
     465             : 
     466           0 :   bgp->router_id_static.s_addr = 0;
     467           0 :   bgp_router_id_set (bgp, &router_id_zebra);
     468             : 
     469           0 :   return CMD_SUCCESS;
     470             : }
     471             : 
     472             : ALIAS (no_bgp_router_id,
     473             :        no_bgp_router_id_val_cmd,
     474             :        "no bgp router-id A.B.C.D",
     475             :        NO_STR
     476             :        BGP_STR
     477             :        "Override configured router identifier\n"
     478             :        "Manually configured router identifier\n")
     479             : 
     480             : /* BGP Cluster ID.  */
     481             : 
     482           0 : DEFUN (bgp_cluster_id,
     483             :        bgp_cluster_id_cmd,
     484             :        "bgp cluster-id A.B.C.D",
     485             :        BGP_STR
     486             :        "Configure Route-Reflector Cluster-id\n"
     487             :        "Route-Reflector Cluster-id in IP address format\n")
     488             : {
     489             :   int ret;
     490             :   struct bgp *bgp;
     491             :   struct in_addr cluster;
     492             : 
     493           0 :   bgp = vty->index;
     494             : 
     495           0 :   ret = inet_aton (argv[0], &cluster);
     496           0 :   if (! ret)
     497             :     {
     498           0 :       vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
     499           0 :       return CMD_WARNING;
     500             :     }
     501             : 
     502           0 :   bgp_cluster_id_set (bgp, &cluster);
     503             : 
     504           0 :   return CMD_SUCCESS;
     505             : }
     506             : 
     507             : ALIAS (bgp_cluster_id,
     508             :        bgp_cluster_id32_cmd,
     509             :        "bgp cluster-id <1-4294967295>",
     510             :        BGP_STR
     511             :        "Configure Route-Reflector Cluster-id\n"
     512             :        "Route-Reflector Cluster-id as 32 bit quantity\n")
     513             : 
     514           0 : DEFUN (no_bgp_cluster_id,
     515             :        no_bgp_cluster_id_cmd,
     516             :        "no bgp cluster-id",
     517             :        NO_STR
     518             :        BGP_STR
     519             :        "Configure Route-Reflector Cluster-id\n")
     520             : {
     521             :   int ret;
     522             :   struct bgp *bgp;
     523             :   struct in_addr cluster;
     524             : 
     525           0 :   bgp = vty->index;
     526             : 
     527           0 :   if (argc == 1)
     528             :     {
     529           0 :       ret = inet_aton (argv[0], &cluster);
     530           0 :       if (! ret)
     531             :         {
     532           0 :           vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
     533           0 :           return CMD_WARNING;
     534             :         }
     535             :     }
     536             : 
     537           0 :   bgp_cluster_id_unset (bgp);
     538             : 
     539           0 :   return CMD_SUCCESS;
     540             : }
     541             : 
     542             : ALIAS (no_bgp_cluster_id,
     543             :        no_bgp_cluster_id_arg_cmd,
     544             :        "no bgp cluster-id A.B.C.D",
     545             :        NO_STR
     546             :        BGP_STR
     547             :        "Configure Route-Reflector Cluster-id\n"
     548             :        "Route-Reflector Cluster-id in IP address format\n")
     549             : 
     550           0 : DEFUN (bgp_confederation_identifier,
     551             :        bgp_confederation_identifier_cmd,
     552             :        "bgp confederation identifier " CMD_AS_RANGE,
     553             :        "BGP specific commands\n"
     554             :        "AS confederation parameters\n"
     555             :        "AS number\n"
     556             :        "Set routing domain confederation AS\n")
     557             : {
     558             :   struct bgp *bgp;
     559             :   as_t as;
     560             : 
     561           0 :   bgp = vty->index;
     562             : 
     563           0 :   VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
     564             : 
     565           0 :   bgp_confederation_id_set (bgp, as);
     566             : 
     567           0 :   return CMD_SUCCESS;
     568             : }
     569             : 
     570           0 : DEFUN (no_bgp_confederation_identifier,
     571             :        no_bgp_confederation_identifier_cmd,
     572             :        "no bgp confederation identifier",
     573             :        NO_STR
     574             :        "BGP specific commands\n"
     575             :        "AS confederation parameters\n"
     576             :        "AS number\n")
     577             : {
     578             :   struct bgp *bgp;
     579             :   as_t as;
     580             : 
     581           0 :   bgp = vty->index;
     582             : 
     583           0 :   if (argc == 1)
     584           0 :     VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
     585             : 
     586           0 :   bgp_confederation_id_unset (bgp);
     587             : 
     588           0 :   return CMD_SUCCESS;
     589             : }
     590             : 
     591             : ALIAS (no_bgp_confederation_identifier,
     592             :        no_bgp_confederation_identifier_arg_cmd,
     593             :        "no bgp confederation identifier " CMD_AS_RANGE,
     594             :        NO_STR
     595             :        "BGP specific commands\n"
     596             :        "AS confederation parameters\n"
     597             :        "AS number\n"
     598             :        "Set routing domain confederation AS\n")
     599             : 
     600           0 : DEFUN (bgp_confederation_peers,
     601             :        bgp_confederation_peers_cmd,
     602             :        "bgp confederation peers ." CMD_AS_RANGE,
     603             :        "BGP specific commands\n"
     604             :        "AS confederation parameters\n"
     605             :        "Peer ASs in BGP confederation\n"
     606             :        AS_STR)
     607             : {
     608             :   struct bgp *bgp;
     609             :   as_t as;
     610             :   int i;
     611             : 
     612           0 :   bgp = vty->index;
     613             : 
     614           0 :   for (i = 0; i < argc; i++)
     615             :     {
     616           0 :       VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
     617             : 
     618           0 :       if (bgp->as == as)
     619             :         {
     620           0 :           vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
     621           0 :                    VTY_NEWLINE);
     622           0 :           continue;
     623             :         }
     624             : 
     625           0 :       bgp_confederation_peers_add (bgp, as);
     626             :     }
     627           0 :   return CMD_SUCCESS;
     628             : }
     629             : 
     630           0 : DEFUN (no_bgp_confederation_peers,
     631             :        no_bgp_confederation_peers_cmd,
     632             :        "no bgp confederation peers ." CMD_AS_RANGE,
     633             :        NO_STR
     634             :        "BGP specific commands\n"
     635             :        "AS confederation parameters\n"
     636             :        "Peer ASs in BGP confederation\n"
     637             :        AS_STR)
     638             : {
     639             :   struct bgp *bgp;
     640             :   as_t as;
     641             :   int i;
     642             : 
     643           0 :   bgp = vty->index;
     644             : 
     645           0 :   for (i = 0; i < argc; i++)
     646             :     {
     647           0 :       VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
     648             : 
     649           0 :       bgp_confederation_peers_remove (bgp, as);
     650             :     }
     651           0 :   return CMD_SUCCESS;
     652             : }
     653             : 
     654             : /* Maximum-paths configuration */
     655           0 : DEFUN (bgp_maxpaths,
     656             :        bgp_maxpaths_cmd,
     657             :        "maximum-paths <1-255>",
     658             :        "Forward packets over multiple paths\n"
     659             :        "Number of paths\n")
     660             : {
     661             :   struct bgp *bgp;
     662             :   u_int16_t maxpaths;
     663             :   int ret;
     664             : 
     665           0 :   bgp = vty->index;
     666             : 
     667           0 :   VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
     668             : 
     669           0 :   ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
     670             :                                BGP_PEER_EBGP, maxpaths);
     671           0 :   if (ret < 0)
     672             :     {
     673           0 :       vty_out (vty,
     674             :                "%% Failed to set maximum-paths %u for afi %u, safi %u%s",
     675           0 :                maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
     676           0 :       return CMD_WARNING;
     677             :     }
     678             : 
     679           0 :   return CMD_SUCCESS;
     680             : }
     681             : 
     682           0 : DEFUN (bgp_maxpaths_ibgp,
     683             :        bgp_maxpaths_ibgp_cmd,
     684             :        "maximum-paths ibgp <1-255>",
     685             :        "Forward packets over multiple paths\n"
     686             :        "iBGP-multipath\n"
     687             :        "Number of paths\n")
     688             : {
     689             :   struct bgp *bgp;
     690             :   u_int16_t maxpaths;
     691             :   int ret;
     692             : 
     693           0 :   bgp = vty->index;
     694             : 
     695           0 :   VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
     696             : 
     697           0 :   ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
     698             :                                BGP_PEER_IBGP, maxpaths);
     699           0 :   if (ret < 0)
     700             :     {
     701           0 :       vty_out (vty,
     702             :                "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
     703           0 :                maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
     704           0 :       return CMD_WARNING;
     705             :     }
     706             : 
     707           0 :   return CMD_SUCCESS;
     708             : }
     709             : 
     710           0 : DEFUN (no_bgp_maxpaths,
     711             :        no_bgp_maxpaths_cmd,
     712             :        "no maximum-paths",
     713             :        NO_STR
     714             :        "Forward packets over multiple paths\n"
     715             :        "Number of paths\n")
     716             : {
     717             :   struct bgp *bgp;
     718             :   int ret;
     719             : 
     720           0 :   bgp = vty->index;
     721             : 
     722           0 :   ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
     723             :                                  BGP_PEER_EBGP);
     724           0 :   if (ret < 0)
     725             :     {
     726           0 :       vty_out (vty,
     727             :                "%% Failed to unset maximum-paths for afi %u, safi %u%s",
     728           0 :                bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
     729           0 :       return CMD_WARNING;
     730             :     }
     731             : 
     732           0 :   return CMD_SUCCESS;
     733             : }
     734             : 
     735             : ALIAS (no_bgp_maxpaths,
     736             :        no_bgp_maxpaths_arg_cmd,
     737             :        "no maximum-paths <1-255>",
     738             :        NO_STR
     739             :        "Forward packets over multiple paths\n"
     740             :        "Number of paths\n")
     741             : 
     742           0 : DEFUN (no_bgp_maxpaths_ibgp,
     743             :        no_bgp_maxpaths_ibgp_cmd,
     744             :        "no maximum-paths ibgp",
     745             :        NO_STR
     746             :        "Forward packets over multiple paths\n"
     747             :        "iBGP-multipath\n"
     748             :        "Number of paths\n")
     749             : {
     750             :   struct bgp *bgp;
     751             :   int ret;
     752             : 
     753           0 :   bgp = vty->index;
     754             : 
     755           0 :   ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
     756             :                                  BGP_PEER_IBGP);
     757           0 :   if (ret < 0)
     758             :     {
     759           0 :       vty_out (vty,
     760             :                "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
     761           0 :                bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
     762           0 :       return CMD_WARNING;
     763             :     }
     764             : 
     765           0 :   return CMD_SUCCESS;
     766             : }
     767             : 
     768             : ALIAS (no_bgp_maxpaths_ibgp,
     769             :        no_bgp_maxpaths_ibgp_arg_cmd,
     770             :        "no maximum-paths ibgp <1-255>",
     771             :        NO_STR
     772             :        "Forward packets over multiple paths\n"
     773             :        "iBGP-multipath\n"
     774             :        "Number of paths\n")
     775             : 
     776             : int
     777           0 : bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
     778             :                            safi_t safi, int *write)
     779             : {
     780           0 :   if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
     781             :     {
     782           0 :       bgp_config_write_family_header (vty, afi, safi, write);
     783           0 :       vty_out (vty, " maximum-paths %d%s",
     784           0 :                bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
     785             :     }
     786             : 
     787           0 :   if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
     788             :     {
     789           0 :       bgp_config_write_family_header (vty, afi, safi, write);
     790           0 :       vty_out (vty, " maximum-paths ibgp %d%s",
     791           0 :                bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
     792             :     }
     793             : 
     794           0 :   return 0;
     795             : }
     796             : 
     797             : /* BGP timers.  */
     798             : 
     799           0 : DEFUN (bgp_timers,
     800             :        bgp_timers_cmd,
     801             :        "timers bgp <0-65535> <0-65535>",
     802             :        "Adjust routing timers\n"
     803             :        "BGP timers\n"
     804             :        "Keepalive interval\n"
     805             :        "Holdtime\n")
     806             : {
     807             :   struct bgp *bgp;
     808           0 :   unsigned long keepalive = 0;
     809           0 :   unsigned long holdtime = 0;
     810             : 
     811           0 :   bgp = vty->index;
     812             : 
     813           0 :   VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
     814           0 :   VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
     815             : 
     816             :   /* Holdtime value check. */
     817           0 :   if (holdtime < 3 && holdtime != 0)
     818             :     {
     819           0 :       vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
     820           0 :                VTY_NEWLINE);
     821           0 :       return CMD_WARNING;
     822             :     }
     823             : 
     824           0 :   bgp_timers_set (bgp, keepalive, holdtime);
     825             : 
     826           0 :   return CMD_SUCCESS;
     827             : }
     828             : 
     829           0 : DEFUN (no_bgp_timers,
     830             :        no_bgp_timers_cmd,
     831             :        "no timers bgp",
     832             :        NO_STR
     833             :        "Adjust routing timers\n"
     834             :        "BGP timers\n")
     835             : {
     836             :   struct bgp *bgp;
     837             : 
     838           0 :   bgp = vty->index;
     839           0 :   bgp_timers_unset (bgp);
     840             : 
     841           0 :   return CMD_SUCCESS;
     842             : }
     843             : 
     844             : ALIAS (no_bgp_timers,
     845             :        no_bgp_timers_arg_cmd,
     846             :        "no timers bgp <0-65535> <0-65535>",
     847             :        NO_STR
     848             :        "Adjust routing timers\n"
     849             :        "BGP timers\n"
     850             :        "Keepalive interval\n"
     851             :        "Holdtime\n")
     852             : 
     853           0 : DEFUN (bgp_client_to_client_reflection,
     854             :        bgp_client_to_client_reflection_cmd,
     855             :        "bgp client-to-client reflection",
     856             :        "BGP specific commands\n"
     857             :        "Configure client to client route reflection\n"
     858             :        "reflection of routes allowed\n")
     859             : {
     860             :   struct bgp *bgp;
     861             : 
     862           0 :   bgp = vty->index;
     863           0 :   bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
     864           0 :   return CMD_SUCCESS;
     865             : }
     866             : 
     867           0 : DEFUN (no_bgp_client_to_client_reflection,
     868             :        no_bgp_client_to_client_reflection_cmd,
     869             :        "no bgp client-to-client reflection",
     870             :        NO_STR
     871             :        "BGP specific commands\n"
     872             :        "Configure client to client route reflection\n"
     873             :        "reflection of routes allowed\n")
     874             : {
     875             :   struct bgp *bgp;
     876             : 
     877           0 :   bgp = vty->index;
     878           0 :   bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
     879           0 :   return CMD_SUCCESS;
     880             : }
     881             : 
     882             : /* "bgp always-compare-med" configuration. */
     883           0 : DEFUN (bgp_always_compare_med,
     884             :        bgp_always_compare_med_cmd,
     885             :        "bgp always-compare-med",
     886             :        "BGP specific commands\n"
     887             :        "Allow comparing MED from different neighbors\n")
     888             : {
     889             :   struct bgp *bgp;
     890             : 
     891           0 :   bgp = vty->index;
     892           0 :   bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
     893           0 :   return CMD_SUCCESS;
     894             : }
     895             : 
     896           0 : DEFUN (no_bgp_always_compare_med,
     897             :        no_bgp_always_compare_med_cmd,
     898             :        "no bgp always-compare-med",
     899             :        NO_STR
     900             :        "BGP specific commands\n"
     901             :        "Allow comparing MED from different neighbors\n")
     902             : {
     903             :   struct bgp *bgp;
     904             : 
     905           0 :   bgp = vty->index;
     906           0 :   bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
     907           0 :   return CMD_SUCCESS;
     908             : }
     909             : 
     910             : /* "bgp deterministic-med" configuration. */
     911           0 : DEFUN (bgp_deterministic_med,
     912             :        bgp_deterministic_med_cmd,
     913             :        "bgp deterministic-med",
     914             :        "BGP specific commands\n"
     915             :        "Pick the best-MED path among paths advertised from the neighboring AS\n")
     916             : {
     917             :   struct bgp *bgp;
     918             : 
     919           0 :   bgp = vty->index;
     920           0 :   bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
     921           0 :   return CMD_SUCCESS;
     922             : }
     923             : 
     924           0 : DEFUN (no_bgp_deterministic_med,
     925             :        no_bgp_deterministic_med_cmd,
     926             :        "no bgp deterministic-med",
     927             :        NO_STR
     928             :        "BGP specific commands\n"
     929             :        "Pick the best-MED path among paths advertised from the neighboring AS\n")
     930             : {
     931             :   struct bgp *bgp;
     932             : 
     933           0 :   bgp = vty->index;
     934           0 :   bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
     935           0 :   return CMD_SUCCESS;
     936             : }
     937             : 
     938             : /* "bgp graceful-restart" configuration. */
     939           0 : DEFUN (bgp_graceful_restart,
     940             :        bgp_graceful_restart_cmd,
     941             :        "bgp graceful-restart",
     942             :        "BGP specific commands\n"
     943             :        "Graceful restart capability parameters\n")
     944             : {
     945             :   struct bgp *bgp;
     946             : 
     947           0 :   bgp = vty->index;
     948           0 :   bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
     949           0 :   return CMD_SUCCESS;
     950             : }
     951             : 
     952           0 : DEFUN (no_bgp_graceful_restart,
     953             :        no_bgp_graceful_restart_cmd,
     954             :        "no bgp graceful-restart",
     955             :        NO_STR
     956             :        "BGP specific commands\n"
     957             :        "Graceful restart capability parameters\n")
     958             : {
     959             :   struct bgp *bgp;
     960             : 
     961           0 :   bgp = vty->index;
     962           0 :   bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
     963           0 :   return CMD_SUCCESS;
     964             : }
     965             : 
     966           0 : DEFUN (bgp_graceful_restart_stalepath_time,
     967             :        bgp_graceful_restart_stalepath_time_cmd,
     968             :        "bgp graceful-restart stalepath-time <1-3600>",
     969             :        "BGP specific commands\n"
     970             :        "Graceful restart capability parameters\n"
     971             :        "Set the max time to hold onto restarting peer's stale paths\n"
     972             :        "Delay value (seconds)\n")
     973             : {
     974             :   struct bgp *bgp;
     975             :   u_int32_t stalepath;
     976             : 
     977           0 :   bgp = vty->index;
     978           0 :   if (! bgp)
     979           0 :     return CMD_WARNING;
     980             : 
     981           0 :   VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
     982           0 :   bgp->stalepath_time = stalepath;
     983           0 :   return CMD_SUCCESS;
     984             : }
     985             : 
     986           0 : DEFUN (no_bgp_graceful_restart_stalepath_time,
     987             :        no_bgp_graceful_restart_stalepath_time_cmd,
     988             :        "no bgp graceful-restart stalepath-time",
     989             :        NO_STR
     990             :        "BGP specific commands\n"
     991             :        "Graceful restart capability parameters\n"
     992             :        "Set the max time to hold onto restarting peer's stale paths\n")
     993             : {
     994             :   struct bgp *bgp;
     995             : 
     996           0 :   bgp = vty->index;
     997           0 :   if (! bgp)
     998           0 :     return CMD_WARNING;
     999             : 
    1000           0 :   bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
    1001           0 :   return CMD_SUCCESS;
    1002             : }
    1003             : 
    1004             : ALIAS (no_bgp_graceful_restart_stalepath_time,
    1005             :        no_bgp_graceful_restart_stalepath_time_val_cmd,
    1006             :        "no bgp graceful-restart stalepath-time <1-3600>",
    1007             :        NO_STR
    1008             :        "BGP specific commands\n"
    1009             :        "Graceful restart capability parameters\n"
    1010             :        "Set the max time to hold onto restarting peer's stale paths\n"
    1011             :        "Delay value (seconds)\n")
    1012             : 
    1013             : /* "bgp fast-external-failover" configuration. */
    1014           0 : DEFUN (bgp_fast_external_failover,
    1015             :        bgp_fast_external_failover_cmd,
    1016             :        "bgp fast-external-failover",
    1017             :        BGP_STR
    1018             :        "Immediately reset session if a link to a directly connected external peer goes down\n")
    1019             : {
    1020             :   struct bgp *bgp;
    1021             : 
    1022           0 :   bgp = vty->index;
    1023           0 :   bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
    1024           0 :   return CMD_SUCCESS;
    1025             : }
    1026             : 
    1027           0 : DEFUN (no_bgp_fast_external_failover,
    1028             :        no_bgp_fast_external_failover_cmd,
    1029             :        "no bgp fast-external-failover",
    1030             :        NO_STR
    1031             :        BGP_STR
    1032             :        "Immediately reset session if a link to a directly connected external peer goes down\n")
    1033             : {
    1034             :   struct bgp *bgp;
    1035             : 
    1036           0 :   bgp = vty->index;
    1037           0 :   bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
    1038           0 :   return CMD_SUCCESS;
    1039             : }
    1040             : 
    1041             : /* "bgp enforce-first-as" configuration. */
    1042           0 : DEFUN (bgp_enforce_first_as,
    1043             :        bgp_enforce_first_as_cmd,
    1044             :        "bgp enforce-first-as",
    1045             :        BGP_STR
    1046             :        "Enforce the first AS for EBGP routes\n")
    1047             : {
    1048             :   struct bgp *bgp;
    1049             : 
    1050           0 :   bgp = vty->index;
    1051           0 :   bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
    1052           0 :   return CMD_SUCCESS;
    1053             : }
    1054             : 
    1055           0 : DEFUN (no_bgp_enforce_first_as,
    1056             :        no_bgp_enforce_first_as_cmd,
    1057             :        "no bgp enforce-first-as",
    1058             :        NO_STR
    1059             :        BGP_STR
    1060             :        "Enforce the first AS for EBGP routes\n")
    1061             : {
    1062             :   struct bgp *bgp;
    1063             : 
    1064           0 :   bgp = vty->index;
    1065           0 :   bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
    1066           0 :   return CMD_SUCCESS;
    1067             : }
    1068             : 
    1069             : /* "bgp bestpath compare-routerid" configuration.  */
    1070           0 : DEFUN (bgp_bestpath_compare_router_id,
    1071             :        bgp_bestpath_compare_router_id_cmd,
    1072             :        "bgp bestpath compare-routerid",
    1073             :        "BGP specific commands\n"
    1074             :        "Change the default bestpath selection\n"
    1075             :        "Compare router-id for identical EBGP paths\n")
    1076             : {
    1077             :   struct bgp *bgp;
    1078             : 
    1079           0 :   bgp = vty->index;
    1080           0 :   bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
    1081           0 :   return CMD_SUCCESS;
    1082             : }
    1083             : 
    1084           0 : DEFUN (no_bgp_bestpath_compare_router_id,
    1085             :        no_bgp_bestpath_compare_router_id_cmd,
    1086             :        "no bgp bestpath compare-routerid",
    1087             :        NO_STR
    1088             :        "BGP specific commands\n"
    1089             :        "Change the default bestpath selection\n"
    1090             :        "Compare router-id for identical EBGP paths\n")
    1091             : {
    1092             :   struct bgp *bgp;
    1093             : 
    1094           0 :   bgp = vty->index;
    1095           0 :   bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
    1096           0 :   return CMD_SUCCESS;
    1097             : }
    1098             : 
    1099             : /* "bgp bestpath as-path ignore" configuration.  */
    1100           0 : DEFUN (bgp_bestpath_aspath_ignore,
    1101             :        bgp_bestpath_aspath_ignore_cmd,
    1102             :        "bgp bestpath as-path ignore",
    1103             :        "BGP specific commands\n"
    1104             :        "Change the default bestpath selection\n"
    1105             :        "AS-path attribute\n"
    1106             :        "Ignore as-path length in selecting a route\n")
    1107             : {
    1108             :   struct bgp *bgp;
    1109             : 
    1110           0 :   bgp = vty->index;
    1111           0 :   bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
    1112           0 :   return CMD_SUCCESS;
    1113             : }
    1114             : 
    1115           0 : DEFUN (no_bgp_bestpath_aspath_ignore,
    1116             :        no_bgp_bestpath_aspath_ignore_cmd,
    1117             :        "no bgp bestpath as-path ignore",
    1118             :        NO_STR
    1119             :        "BGP specific commands\n"
    1120             :        "Change the default bestpath selection\n"
    1121             :        "AS-path attribute\n"
    1122             :        "Ignore as-path length in selecting a route\n")
    1123             : {
    1124             :   struct bgp *bgp;
    1125             : 
    1126           0 :   bgp = vty->index;
    1127           0 :   bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
    1128           0 :   return CMD_SUCCESS;
    1129             : }
    1130             : 
    1131             : /* "bgp bestpath as-path confed" configuration.  */
    1132           0 : DEFUN (bgp_bestpath_aspath_confed,
    1133             :        bgp_bestpath_aspath_confed_cmd,
    1134             :        "bgp bestpath as-path confed",
    1135             :        "BGP specific commands\n"
    1136             :        "Change the default bestpath selection\n"
    1137             :        "AS-path attribute\n"
    1138             :        "Compare path lengths including confederation sets & sequences in selecting a route\n")
    1139             : {
    1140             :   struct bgp *bgp;
    1141             : 
    1142           0 :   bgp = vty->index;
    1143           0 :   bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
    1144           0 :   return CMD_SUCCESS;
    1145             : }
    1146             : 
    1147           0 : DEFUN (no_bgp_bestpath_aspath_confed,
    1148             :        no_bgp_bestpath_aspath_confed_cmd,
    1149             :        "no bgp bestpath as-path confed",
    1150             :        NO_STR
    1151             :        "BGP specific commands\n"
    1152             :        "Change the default bestpath selection\n"
    1153             :        "AS-path attribute\n"
    1154             :        "Compare path lengths including confederation sets & sequences in selecting a route\n")
    1155             : {
    1156             :   struct bgp *bgp;
    1157             : 
    1158           0 :   bgp = vty->index;
    1159           0 :   bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
    1160           0 :   return CMD_SUCCESS;
    1161             : }
    1162             : 
    1163             : /* "bgp log-neighbor-changes" configuration.  */
    1164           0 : DEFUN (bgp_log_neighbor_changes,
    1165             :        bgp_log_neighbor_changes_cmd,
    1166             :        "bgp log-neighbor-changes",
    1167             :        "BGP specific commands\n"
    1168             :        "Log neighbor up/down and reset reason\n")
    1169             : {
    1170             :   struct bgp *bgp;
    1171             : 
    1172           0 :   bgp = vty->index;
    1173           0 :   bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
    1174           0 :   return CMD_SUCCESS;
    1175             : }
    1176             : 
    1177           0 : DEFUN (no_bgp_log_neighbor_changes,
    1178             :        no_bgp_log_neighbor_changes_cmd,
    1179             :        "no bgp log-neighbor-changes",
    1180             :        NO_STR
    1181             :        "BGP specific commands\n"
    1182             :        "Log neighbor up/down and reset reason\n")
    1183             : {
    1184             :   struct bgp *bgp;
    1185             : 
    1186           0 :   bgp = vty->index;
    1187           0 :   bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
    1188           0 :   return CMD_SUCCESS;
    1189             : }
    1190             : 
    1191             : /* "bgp bestpath med" configuration. */
    1192           0 : DEFUN (bgp_bestpath_med,
    1193             :        bgp_bestpath_med_cmd,
    1194             :        "bgp bestpath med (confed|missing-as-worst)",
    1195             :        "BGP specific commands\n"
    1196             :        "Change the default bestpath selection\n"
    1197             :        "MED attribute\n"
    1198             :        "Compare MED among confederation paths\n"
    1199             :        "Treat missing MED as the least preferred one\n")
    1200             : {
    1201             :   struct bgp *bgp;
    1202             :   
    1203           0 :   bgp = vty->index;
    1204             : 
    1205           0 :   if (strncmp (argv[0], "confed", 1) == 0)
    1206           0 :     bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
    1207             :   else
    1208           0 :     bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
    1209             : 
    1210           0 :   return CMD_SUCCESS;
    1211             : }
    1212             : 
    1213           0 : DEFUN (bgp_bestpath_med2,
    1214             :        bgp_bestpath_med2_cmd,
    1215             :        "bgp bestpath med confed missing-as-worst",
    1216             :        "BGP specific commands\n"
    1217             :        "Change the default bestpath selection\n"
    1218             :        "MED attribute\n"
    1219             :        "Compare MED among confederation paths\n"
    1220             :        "Treat missing MED as the least preferred one\n")
    1221             : {
    1222             :   struct bgp *bgp;
    1223             :   
    1224           0 :   bgp = vty->index;
    1225           0 :   bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
    1226           0 :   bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
    1227           0 :   return CMD_SUCCESS;
    1228             : }
    1229             : 
    1230             : ALIAS (bgp_bestpath_med2,
    1231             :        bgp_bestpath_med3_cmd,
    1232             :        "bgp bestpath med missing-as-worst confed",
    1233             :        "BGP specific commands\n"
    1234             :        "Change the default bestpath selection\n"
    1235             :        "MED attribute\n"
    1236             :        "Treat missing MED as the least preferred one\n"
    1237             :        "Compare MED among confederation paths\n")
    1238             : 
    1239           0 : DEFUN (no_bgp_bestpath_med,
    1240             :        no_bgp_bestpath_med_cmd,
    1241             :        "no bgp bestpath med (confed|missing-as-worst)",
    1242             :        NO_STR
    1243             :        "BGP specific commands\n"
    1244             :        "Change the default bestpath selection\n"
    1245             :        "MED attribute\n"
    1246             :        "Compare MED among confederation paths\n"
    1247             :        "Treat missing MED as the least preferred one\n")
    1248             : {
    1249             :   struct bgp *bgp;
    1250             : 
    1251           0 :   bgp = vty->index;
    1252             :   
    1253           0 :   if (strncmp (argv[0], "confed", 1) == 0)
    1254           0 :     bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
    1255             :   else
    1256           0 :     bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
    1257             : 
    1258           0 :   return CMD_SUCCESS;
    1259             : }
    1260             : 
    1261           0 : DEFUN (no_bgp_bestpath_med2,
    1262             :        no_bgp_bestpath_med2_cmd,
    1263             :        "no bgp bestpath med confed missing-as-worst",
    1264             :        NO_STR
    1265             :        "BGP specific commands\n"
    1266             :        "Change the default bestpath selection\n"
    1267             :        "MED attribute\n"
    1268             :        "Compare MED among confederation paths\n"
    1269             :        "Treat missing MED as the least preferred one\n")
    1270             : {
    1271             :   struct bgp *bgp;
    1272             :   
    1273           0 :   bgp = vty->index;
    1274           0 :   bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
    1275           0 :   bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
    1276           0 :   return CMD_SUCCESS;
    1277             : }
    1278             : 
    1279             : ALIAS (no_bgp_bestpath_med2,
    1280             :        no_bgp_bestpath_med3_cmd,
    1281             :        "no bgp bestpath med missing-as-worst confed",
    1282             :        NO_STR
    1283             :        "BGP specific commands\n"
    1284             :        "Change the default bestpath selection\n"
    1285             :        "MED attribute\n"
    1286             :        "Treat missing MED as the least preferred one\n"
    1287             :        "Compare MED among confederation paths\n")
    1288             : 
    1289             : /* "no bgp default ipv4-unicast". */
    1290           0 : DEFUN (no_bgp_default_ipv4_unicast,
    1291             :        no_bgp_default_ipv4_unicast_cmd,
    1292             :        "no bgp default ipv4-unicast",
    1293             :        NO_STR
    1294             :        "BGP specific commands\n"
    1295             :        "Configure BGP defaults\n"
    1296             :        "Activate ipv4-unicast for a peer by default\n")
    1297             : {
    1298             :   struct bgp *bgp;
    1299             : 
    1300           0 :   bgp = vty->index;
    1301           0 :   bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
    1302           0 :   return CMD_SUCCESS;
    1303             : }
    1304             : 
    1305           0 : DEFUN (bgp_default_ipv4_unicast,
    1306             :        bgp_default_ipv4_unicast_cmd,
    1307             :        "bgp default ipv4-unicast",
    1308             :        "BGP specific commands\n"
    1309             :        "Configure BGP defaults\n"
    1310             :        "Activate ipv4-unicast for a peer by default\n")
    1311             : {
    1312             :   struct bgp *bgp;
    1313             : 
    1314           0 :   bgp = vty->index;
    1315           0 :   bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
    1316           0 :   return CMD_SUCCESS;
    1317             : }
    1318             : 
    1319             : /* "bgp import-check" configuration.  */
    1320           0 : DEFUN (bgp_network_import_check,
    1321             :        bgp_network_import_check_cmd,
    1322             :        "bgp network import-check",
    1323             :        "BGP specific commands\n"
    1324             :        "BGP network command\n"
    1325             :        "Check BGP network route exists in IGP\n")
    1326             : {
    1327             :   struct bgp *bgp;
    1328             : 
    1329           0 :   bgp = vty->index;
    1330           0 :   bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
    1331           0 :   return CMD_SUCCESS;
    1332             : }
    1333             : 
    1334           0 : DEFUN (no_bgp_network_import_check,
    1335             :        no_bgp_network_import_check_cmd,
    1336             :        "no bgp network import-check",
    1337             :        NO_STR
    1338             :        "BGP specific commands\n"
    1339             :        "BGP network command\n"
    1340             :        "Check BGP network route exists in IGP\n")
    1341             : {
    1342             :   struct bgp *bgp;
    1343             : 
    1344           0 :   bgp = vty->index;
    1345           0 :   bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
    1346           0 :   return CMD_SUCCESS;
    1347             : }
    1348             : 
    1349           0 : DEFUN (bgp_default_local_preference,
    1350             :        bgp_default_local_preference_cmd,
    1351             :        "bgp default local-preference <0-4294967295>",
    1352             :        "BGP specific commands\n"
    1353             :        "Configure BGP defaults\n"
    1354             :        "local preference (higher=more preferred)\n"
    1355             :        "Configure default local preference value\n")
    1356             : {
    1357             :   struct bgp *bgp;
    1358             :   u_int32_t local_pref;
    1359             : 
    1360           0 :   bgp = vty->index;
    1361             : 
    1362           0 :   VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
    1363             : 
    1364           0 :   bgp_default_local_preference_set (bgp, local_pref);
    1365             : 
    1366           0 :   return CMD_SUCCESS;
    1367             : }
    1368             : 
    1369           0 : DEFUN (no_bgp_default_local_preference,
    1370             :        no_bgp_default_local_preference_cmd,
    1371             :        "no bgp default local-preference",
    1372             :        NO_STR
    1373             :        "BGP specific commands\n"
    1374             :        "Configure BGP defaults\n"
    1375             :        "local preference (higher=more preferred)\n")
    1376             : {
    1377             :   struct bgp *bgp;
    1378             : 
    1379           0 :   bgp = vty->index;
    1380           0 :   bgp_default_local_preference_unset (bgp);
    1381           0 :   return CMD_SUCCESS;
    1382             : }
    1383             : 
    1384             : ALIAS (no_bgp_default_local_preference,
    1385             :        no_bgp_default_local_preference_val_cmd,
    1386             :        "no bgp default local-preference <0-4294967295>",
    1387             :        NO_STR
    1388             :        "BGP specific commands\n"
    1389             :        "Configure BGP defaults\n"
    1390             :        "local preference (higher=more preferred)\n"
    1391             :        "Configure default local preference value\n")
    1392             : 
    1393             : static int
    1394           0 : peer_remote_as_vty (struct vty *vty, const char *peer_str, 
    1395             :                     const char *as_str, afi_t afi, safi_t safi)
    1396             : {
    1397             :   int ret;
    1398             :   struct bgp *bgp;
    1399             :   as_t as;
    1400             :   union sockunion su;
    1401             : 
    1402           0 :   bgp = vty->index;
    1403             : 
    1404             :   /* Get AS number.  */
    1405           0 :   VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
    1406             : 
    1407             :   /* If peer is peer group, call proper function.  */
    1408           0 :   ret = str2sockunion (peer_str, &su);
    1409           0 :   if (ret < 0)
    1410             :     {
    1411           0 :       ret = peer_group_remote_as (bgp, peer_str, &as);
    1412           0 :       if (ret < 0)
    1413             :         {
    1414           0 :           vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
    1415           0 :           return CMD_WARNING;
    1416             :         }
    1417           0 :       return CMD_SUCCESS;
    1418             :     }
    1419             : 
    1420           0 :   if (peer_address_self_check (&su))
    1421             :     {
    1422           0 :       vty_out (vty, "%% Can not configure the local system as neighbor%s",
    1423           0 :                VTY_NEWLINE);
    1424           0 :       return CMD_WARNING;
    1425             :     }
    1426             : 
    1427           0 :   ret = peer_remote_as (bgp, &su, &as, afi, safi);
    1428             : 
    1429             :   /* This peer belongs to peer group.  */
    1430           0 :   switch (ret)
    1431             :     {
    1432             :     case BGP_ERR_PEER_GROUP_MEMBER:
    1433           0 :       vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
    1434           0 :       return CMD_WARNING;
    1435             :     case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
    1436           0 :       vty_out (vty, "%% The AS# can not be changed from %u to %s, peer-group members must be all internal or all external%s", as, as_str, VTY_NEWLINE);
    1437           0 :       return CMD_WARNING;
    1438             :     }
    1439           0 :   return bgp_vty_return (vty, ret);
    1440             : }
    1441             : 
    1442           0 : DEFUN (neighbor_remote_as,
    1443             :        neighbor_remote_as_cmd,
    1444             :        NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
    1445             :        NEIGHBOR_STR
    1446             :        NEIGHBOR_ADDR_STR2
    1447             :        "Specify a BGP neighbor\n"
    1448             :        AS_STR)
    1449             : {
    1450           0 :   return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
    1451             : }
    1452             : 
    1453           0 : DEFUN (neighbor_peer_group,
    1454             :        neighbor_peer_group_cmd,
    1455             :        "neighbor WORD peer-group",
    1456             :        NEIGHBOR_STR
    1457             :        "Neighbor tag\n"
    1458             :        "Configure peer-group\n")
    1459             : {
    1460             :   struct bgp *bgp;
    1461             :   struct peer_group *group;
    1462             : 
    1463           0 :   bgp = vty->index;
    1464             : 
    1465           0 :   group = peer_group_get (bgp, argv[0]);
    1466           0 :   if (! group)
    1467           0 :     return CMD_WARNING;
    1468             : 
    1469           0 :   return CMD_SUCCESS;
    1470             : }
    1471             : 
    1472           0 : DEFUN (no_neighbor,
    1473             :        no_neighbor_cmd,
    1474             :        NO_NEIGHBOR_CMD2,
    1475             :        NO_STR
    1476             :        NEIGHBOR_STR
    1477             :        NEIGHBOR_ADDR_STR2)
    1478             : {
    1479             :   int ret;
    1480             :   union sockunion su;
    1481             :   struct peer_group *group;
    1482             :   struct peer *peer;
    1483             : 
    1484           0 :   ret = str2sockunion (argv[0], &su);
    1485           0 :   if (ret < 0)
    1486             :     {
    1487           0 :       group = peer_group_lookup (vty->index, argv[0]);
    1488           0 :       if (group)
    1489           0 :         peer_group_delete (group);
    1490             :       else
    1491             :         {
    1492           0 :           vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
    1493           0 :           return CMD_WARNING;
    1494             :         }
    1495             :     }
    1496             :   else
    1497             :     {
    1498           0 :       peer = peer_lookup (vty->index, &su);
    1499           0 :       if (peer)
    1500           0 :         peer_delete (peer);
    1501             :     }
    1502             : 
    1503           0 :   return CMD_SUCCESS;
    1504             : }
    1505             : 
    1506             : ALIAS (no_neighbor,
    1507             :        no_neighbor_remote_as_cmd,
    1508             :        NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
    1509             :        NO_STR
    1510             :        NEIGHBOR_STR
    1511             :        NEIGHBOR_ADDR_STR
    1512             :        "Specify a BGP neighbor\n"
    1513             :        AS_STR)
    1514             : 
    1515           0 : DEFUN (no_neighbor_peer_group,
    1516             :        no_neighbor_peer_group_cmd,
    1517             :        "no neighbor WORD peer-group",
    1518             :        NO_STR
    1519             :        NEIGHBOR_STR
    1520             :        "Neighbor tag\n"
    1521             :        "Configure peer-group\n")
    1522             : {
    1523             :   struct peer_group *group;
    1524             : 
    1525           0 :   group = peer_group_lookup (vty->index, argv[0]);
    1526           0 :   if (group)
    1527           0 :     peer_group_delete (group);
    1528             :   else
    1529             :     {
    1530           0 :       vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
    1531           0 :       return CMD_WARNING;
    1532             :     }
    1533           0 :   return CMD_SUCCESS;
    1534             : }
    1535             : 
    1536           0 : DEFUN (no_neighbor_peer_group_remote_as,
    1537             :        no_neighbor_peer_group_remote_as_cmd,
    1538             :        "no neighbor WORD remote-as " CMD_AS_RANGE,
    1539             :        NO_STR
    1540             :        NEIGHBOR_STR
    1541             :        "Neighbor tag\n"
    1542             :        "Specify a BGP neighbor\n"
    1543             :        AS_STR)
    1544             : {
    1545             :   struct peer_group *group;
    1546             : 
    1547           0 :   group = peer_group_lookup (vty->index, argv[0]);
    1548           0 :   if (group)
    1549           0 :     peer_group_remote_as_delete (group);
    1550             :   else
    1551             :     {
    1552           0 :       vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
    1553           0 :       return CMD_WARNING;
    1554             :     }
    1555           0 :   return CMD_SUCCESS;
    1556             : }
    1557             : 
    1558           0 : DEFUN (neighbor_local_as,
    1559             :        neighbor_local_as_cmd,
    1560             :        NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
    1561             :        NEIGHBOR_STR
    1562             :        NEIGHBOR_ADDR_STR2
    1563             :        "Specify a local-as number\n"
    1564             :        "AS number used as local AS\n")
    1565             : {
    1566             :   struct peer *peer;
    1567             :   int ret;
    1568             : 
    1569           0 :   peer = peer_and_group_lookup_vty (vty, argv[0]);
    1570           0 :   if (! peer)
    1571           0 :     return CMD_WARNING;
    1572             : 
    1573           0 :   ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
    1574           0 :   return bgp_vty_return (vty, ret);
    1575             : }
    1576             : 
    1577           0 : DEFUN (neighbor_local_as_no_prepend,
    1578             :        neighbor_local_as_no_prepend_cmd,
    1579             :        NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
    1580             :        NEIGHBOR_STR
    1581             :        NEIGHBOR_ADDR_STR2
    1582             :        "Specify a local-as number\n"
    1583             :        "AS number used as local AS\n"
    1584             :        "Do not prepend local-as to updates from ebgp peers\n")
    1585             : {
    1586             :   struct peer *peer;
    1587             :   int ret;
    1588             : 
    1589           0 :   peer = peer_and_group_lookup_vty (vty, argv[0]);
    1590           0 :   if (! peer)
    1591           0 :     return CMD_WARNING;
    1592             : 
    1593           0 :   ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
    1594           0 :   return bgp_vty_return (vty, ret);
    1595             : }
    1596             : 
    1597           0 : DEFUN (neighbor_local_as_no_prepend_replace_as,
    1598             :        neighbor_local_as_no_prepend_replace_as_cmd,
    1599             :        NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
    1600             :        NEIGHBOR_STR
    1601             :        NEIGHBOR_ADDR_STR2
    1602             :        "Specify a local-as number\n"
    1603             :        "AS number used as local AS\n"
    1604             :        "Do not prepend local-as to updates from ebgp peers\n"
    1605             :        "Do not prepend local-as to updates from ibgp peers\n")
    1606             : {
    1607             :   struct peer *peer;
    1608             :   int ret;
    1609             : 
    1610           0 :   peer = peer_and_group_lookup_vty (vty, argv[0]);
    1611           0 :   if (! peer)
    1612           0 :     return CMD_WARNING;
    1613             : 
    1614           0 :   ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
    1615           0 :   return bgp_vty_return (vty, ret);
    1616             : }
    1617             : 
    1618             : 
    1619           0 : DEFUN (no_neighbor_local_as,
    1620             :        no_neighbor_local_as_cmd,
    1621             :        NO_NEIGHBOR_CMD2 "local-as",
    1622             :        NO_STR
    1623             :        NEIGHBOR_STR
    1624             :        NEIGHBOR_ADDR_STR2
    1625             :        "Specify a local-as number\n")
    1626             : {
    1627             :   struct peer *peer;
    1628             :   int ret;
    1629             : 
    1630           0 :   peer = peer_and_group_lookup_vty (vty, argv[0]);
    1631           0 :   if (! peer)
    1632           0 :     return CMD_WARNING;
    1633             : 
    1634           0 :   ret = peer_local_as_unset (peer);
    1635           0 :   return bgp_vty_return (vty, ret);
    1636             : }
    1637             : 
    1638             : ALIAS (no_neighbor_local_as,
    1639             :        no_neighbor_local_as_val_cmd,
    1640             :        NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
    1641             :        NO_STR
    1642             :        NEIGHBOR_STR
    1643             :        NEIGHBOR_ADDR_STR2
    1644             :        "Specify a local-as number\n"
    1645             :        "AS number used as local AS\n")
    1646             : 
    1647             : ALIAS (no_neighbor_local_as,
    1648             :        no_neighbor_local_as_val2_cmd,
    1649             :        NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
    1650             :        NO_STR
    1651             :        NEIGHBOR_STR
    1652             :        NEIGHBOR_ADDR_STR2
    1653             :        "Specify a local-as number\n"
    1654             :        "AS number used as local AS\n"
    1655             :        "Do not prepend local-as to updates from ebgp peers\n")
    1656             : 
    1657             : ALIAS (no_neighbor_local_as,
    1658             :        no_neighbor_local_as_val3_cmd,
    1659             :        NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
    1660             :        NO_STR
    1661             :        NEIGHBOR_STR
    1662             :        NEIGHBOR_ADDR_STR2
    1663             :        "Specify a local-as number\n"
    1664             :        "AS number used as local AS\n"
    1665             :        "Do not prepend local-as to updates from ebgp peers\n"
    1666             :        "Do not prepend local-as to updates from ibgp peers\n")
    1667             : 
    1668           0 : DEFUN (neighbor_password,
    1669             :        neighbor_password_cmd,
    1670             :        NEIGHBOR_CMD2 "password LINE",
    1671             :        NEIGHBOR_STR
    1672             :        NEIGHBOR_ADDR_STR2
    1673             :        "Set a password\n"
    1674             :        "The password\n")
    1675             : {
    1676             :   struct peer *peer;
    1677             :   int ret;
    1678             : 
    1679           0 :   peer = peer_and_group_lookup_vty (vty, argv[0]);
    1680           0 :   if (! peer)
    1681           0 :     return CMD_WARNING;
    1682             : 
    1683           0 :   ret = peer_password_set (peer, argv[1]);
    1684           0 :   return bgp_vty_return (vty, ret);
    1685             : }
    1686             : 
    1687           0 : DEFUN (no_neighbor_password,
    1688             :        no_neighbor_password_cmd,
    1689             :        NO_NEIGHBOR_CMD2 "password",
    1690             :        NO_STR
    1691             :        NEIGHBOR_STR
    1692             :        NEIGHBOR_ADDR_STR2
    1693             :        "Set a password\n")
    1694             : {
    1695             :   struct peer *peer;
    1696             :   int ret;
    1697             : 
    1698           0 :   peer = peer_and_group_lookup_vty (vty, argv[0]);
    1699           0 :   if (! peer)
    1700           0 :     return CMD_WARNING;
    1701             : 
    1702           0 :   ret = peer_password_unset (peer);
    1703           0 :   return bgp_vty_return (vty, ret);
    1704             : }
    1705             : 
    1706           0 : DEFUN (neighbor_activate,
    1707             :        neighbor_activate_cmd,
    1708             :        NEIGHBOR_CMD2 "activate",
    1709             :        NEIGHBOR_STR
    1710             :        NEIGHBOR_ADDR_STR2
    1711             :        "Enable the Address Family for this Neighbor\n")
    1712             : {
    1713             :   struct peer *peer;
    1714             : 
    1715           0 :   peer = peer_and_group_lookup_vty (vty, argv[0]);
    1716           0 :   if (! peer)
    1717           0 :     return CMD_WARNING;
    1718             : 
    1719           0 :   peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
    1720             : 
    1721           0 :   return CMD_SUCCESS;
    1722             : }
    1723             : 
    1724           0 : DEFUN (no_neighbor_activate,
    1725             :        no_neighbor_activate_cmd,
    1726             :        NO_NEIGHBOR_CMD2 "activate",
    1727             :        NO_STR
    1728             :        NEIGHBOR_STR
    1729             :        NEIGHBOR_ADDR_STR2
    1730             :        "Enable the Address Family for this Neighbor\n")
    1731             : {
    1732             :   int ret;
    1733             :   struct peer *peer;
    1734             : 
    1735             :   /* Lookup peer. */
    1736           0 :   peer = peer_and_group_lookup_vty (vty, argv[0]);
    1737           0 :   if (! peer)
    1738           0 :     return CMD_WARNING;
    1739             : 
    1740           0 :   ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
    1741             : 
    1742           0 :   return bgp_vty_return (vty, ret);
    1743             : }
    1744             : 
    1745           0 : DEFUN (neighbor_set_peer_group,
    1746             :        neighbor_set_peer_group_cmd,
    1747             :        NEIGHBOR_CMD "peer-group WORD",
    1748             :        NEIGHBOR_STR
    1749             :        NEIGHBOR_ADDR_STR
    1750             :        "Member of the peer-group\n"
    1751             :        "peer-group name\n")
    1752             : {
    1753             :   int ret;
    1754             :   as_t as;
    1755             :   union sockunion su;
    1756             :   struct bgp *bgp;
    1757             :   struct peer_group *group;
    1758             : 
    1759           0 :   bgp = vty->index;
    1760             : 
    1761           0 :   ret = str2sockunion (argv[0], &su);
    1762           0 :   if (ret < 0)
    1763             :     {
    1764           0 :       vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
    1765           0 :       return CMD_WARNING;
    1766             :     }
    1767             : 
    1768           0 :   group = peer_group_lookup (bgp, argv[1]);
    1769           0 :   if (! group)
    1770             :     {
    1771           0 :       vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
    1772           0 :       return CMD_WARNING;
    1773             :     }
    1774             : 
    1775           0 :   if (peer_address_self_check (&su))
    1776             :     {
    1777           0 :       vty_out (vty, "%% Can not configure the local system as neighbor%s",
    1778           0 :                VTY_NEWLINE);
    1779           0 :       return CMD_WARNING;
    1780             :     }
    1781             : 
    1782           0 :   ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty), 
    1783           0 :                          bgp_node_safi (vty), &as);
    1784             : 
    1785           0 :   if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
    1786             :     {
    1787           0 :       vty_out (vty, "%% Peer with AS %u cannot be in this peer-group, members must be all internal or all external%s", as, VTY_NEWLINE);
    1788           0 :       return CMD_WARNING;
    1789             :     }
    1790             : 
    1791           0 :   return bgp_vty_return (vty, ret);
    1792             : }
    1793             : 
    1794           0 : DEFUN (no_neighbor_set_peer_group,
    1795             :        no_neighbor_set_peer_group_cmd,
    1796             :        NO_NEIGHBOR_CMD "peer-group WORD",
    1797             :        NO_STR
    1798             :        NEIGHBOR_STR
    1799             :        NEIGHBOR_ADDR_STR
    1800             :        "Member of the peer-group\n"
    1801             :        "peer-group name\n")
    1802             : {
    1803             :   int ret;
    1804             :   struct bgp *bgp;
    1805             :   struct peer *peer;
    1806             :   struct peer_group *group;
    1807             : 
    1808           0 :   bgp = vty->index;
    1809             : 
    1810           0 :   peer = peer_lookup_vty (vty, argv[0]);
    1811           0 :   if (! peer)
    1812           0 :     return CMD_WARNING;
    1813             : 
    1814           0 :   group = peer_group_lookup (bgp, argv[1]);
    1815           0 :   if (! group)
    1816             :     {
    1817           0 :       vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
    1818           0 :       return CMD_WARNING;
    1819             :     }
    1820             : 
    1821           0 :   ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
    1822           0 :                            bgp_node_safi (vty));
    1823             : 
    1824           0 :   return bgp_vty_return (vty, ret);
    1825             : }
    1826             : 
    1827             : static int
    1828           0 : peer_flag_modify_vty (struct vty *vty, const char *ip_str, 
    1829             :                       u_int16_t flag, int set)
    1830             : {
    1831             :   int ret;
    1832             :   struct peer *peer;
    1833             : 
    1834           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    1835           0 :   if (! peer)
    1836           0 :     return CMD_WARNING;
    1837             : 
    1838           0 :   if (set)
    1839           0 :     ret = peer_flag_set (peer, flag);
    1840             :   else
    1841           0 :     ret = peer_flag_unset (peer, flag);
    1842             : 
    1843           0 :   return bgp_vty_return (vty, ret);
    1844             : }
    1845             : 
    1846             : static int
    1847           0 : peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
    1848             : {
    1849           0 :   return peer_flag_modify_vty (vty, ip_str, flag, 1);
    1850             : }
    1851             : 
    1852             : static int
    1853           0 : peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
    1854             : {
    1855           0 :   return peer_flag_modify_vty (vty, ip_str, flag, 0);
    1856             : }
    1857             : 
    1858             : /* neighbor passive. */
    1859           0 : DEFUN (neighbor_passive,
    1860             :        neighbor_passive_cmd,
    1861             :        NEIGHBOR_CMD2 "passive",
    1862             :        NEIGHBOR_STR
    1863             :        NEIGHBOR_ADDR_STR2
    1864             :        "Don't send open messages to this neighbor\n")
    1865             : {
    1866           0 :   return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
    1867             : }
    1868             : 
    1869           0 : DEFUN (no_neighbor_passive,
    1870             :        no_neighbor_passive_cmd,
    1871             :        NO_NEIGHBOR_CMD2 "passive",
    1872             :        NO_STR
    1873             :        NEIGHBOR_STR
    1874             :        NEIGHBOR_ADDR_STR2
    1875             :        "Don't send open messages to this neighbor\n")
    1876             : {
    1877           0 :   return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
    1878             : }
    1879             : 
    1880             : /* neighbor shutdown. */
    1881           0 : DEFUN (neighbor_shutdown,
    1882             :        neighbor_shutdown_cmd,
    1883             :        NEIGHBOR_CMD2 "shutdown",
    1884             :        NEIGHBOR_STR
    1885             :        NEIGHBOR_ADDR_STR2
    1886             :        "Administratively shut down this neighbor\n")
    1887             : {
    1888           0 :   return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
    1889             : }
    1890             : 
    1891           0 : DEFUN (no_neighbor_shutdown,
    1892             :        no_neighbor_shutdown_cmd,
    1893             :        NO_NEIGHBOR_CMD2 "shutdown",
    1894             :        NO_STR
    1895             :        NEIGHBOR_STR
    1896             :        NEIGHBOR_ADDR_STR2
    1897             :        "Administratively shut down this neighbor\n")
    1898             : {
    1899           0 :   return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
    1900             : }
    1901             : 
    1902             : /* Deprecated neighbor capability route-refresh. */
    1903           0 : DEFUN_DEPRECATED (neighbor_capability_route_refresh,
    1904             :                   neighbor_capability_route_refresh_cmd,
    1905             :                   NEIGHBOR_CMD2 "capability route-refresh",
    1906             :                   NEIGHBOR_STR
    1907             :                   NEIGHBOR_ADDR_STR2
    1908             :                   "Advertise capability to the peer\n"
    1909             :                   "Advertise route-refresh capability to this neighbor\n")
    1910             : {
    1911           0 :   return CMD_SUCCESS;
    1912             : }
    1913             : 
    1914           0 : DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
    1915             :                   no_neighbor_capability_route_refresh_cmd,
    1916             :                   NO_NEIGHBOR_CMD2 "capability route-refresh",
    1917             :                   NO_STR
    1918             :                   NEIGHBOR_STR
    1919             :                   NEIGHBOR_ADDR_STR2
    1920             :                   "Advertise capability to the peer\n"
    1921             :                   "Advertise route-refresh capability to this neighbor\n")
    1922             : {
    1923           0 :   return CMD_SUCCESS;
    1924             : }
    1925             : 
    1926             : /* neighbor capability dynamic. */
    1927           0 : DEFUN (neighbor_capability_dynamic,
    1928             :        neighbor_capability_dynamic_cmd,
    1929             :        NEIGHBOR_CMD2 "capability dynamic",
    1930             :        NEIGHBOR_STR
    1931             :        NEIGHBOR_ADDR_STR2
    1932             :        "Advertise capability to the peer\n"
    1933             :        "Advertise dynamic capability to this neighbor\n")
    1934             : {
    1935           0 :   return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
    1936             : }
    1937             : 
    1938           0 : DEFUN (no_neighbor_capability_dynamic,
    1939             :        no_neighbor_capability_dynamic_cmd,
    1940             :        NO_NEIGHBOR_CMD2 "capability dynamic",
    1941             :        NO_STR
    1942             :        NEIGHBOR_STR
    1943             :        NEIGHBOR_ADDR_STR2
    1944             :        "Advertise capability to the peer\n"
    1945             :        "Advertise dynamic capability to this neighbor\n")
    1946             : {
    1947           0 :   return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
    1948             : }
    1949             : 
    1950             : /* neighbor dont-capability-negotiate */
    1951           0 : DEFUN (neighbor_dont_capability_negotiate,
    1952             :        neighbor_dont_capability_negotiate_cmd,
    1953             :        NEIGHBOR_CMD2 "dont-capability-negotiate",
    1954             :        NEIGHBOR_STR
    1955             :        NEIGHBOR_ADDR_STR2
    1956             :        "Do not perform capability negotiation\n")
    1957             : {
    1958           0 :   return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
    1959             : }
    1960             : 
    1961           0 : DEFUN (no_neighbor_dont_capability_negotiate,
    1962             :        no_neighbor_dont_capability_negotiate_cmd,
    1963             :        NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
    1964             :        NO_STR
    1965             :        NEIGHBOR_STR
    1966             :        NEIGHBOR_ADDR_STR2
    1967             :        "Do not perform capability negotiation\n")
    1968             : {
    1969           0 :   return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
    1970             : }
    1971             : 
    1972             : static int
    1973           0 : peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
    1974             :                          safi_t safi, u_int32_t flag, int set)
    1975             : {
    1976             :   int ret;
    1977             :   struct peer *peer;
    1978             : 
    1979           0 :   peer = peer_and_group_lookup_vty (vty, peer_str);
    1980           0 :   if (! peer)
    1981           0 :     return CMD_WARNING;
    1982             : 
    1983           0 :   if (set)
    1984           0 :     ret = peer_af_flag_set (peer, afi, safi, flag);
    1985             :   else
    1986           0 :     ret = peer_af_flag_unset (peer, afi, safi, flag);
    1987             : 
    1988           0 :   return bgp_vty_return (vty, ret);
    1989             : }
    1990             : 
    1991             : static int
    1992           0 : peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
    1993             :                       safi_t safi, u_int32_t flag)
    1994             : {
    1995           0 :   return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
    1996             : }
    1997             : 
    1998             : static int
    1999           0 : peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
    2000             :                         safi_t safi, u_int32_t flag)
    2001             : {
    2002           0 :   return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
    2003             : }
    2004             : 
    2005             : /* neighbor capability orf prefix-list. */
    2006           0 : DEFUN (neighbor_capability_orf_prefix,
    2007             :        neighbor_capability_orf_prefix_cmd,
    2008             :        NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
    2009             :        NEIGHBOR_STR
    2010             :        NEIGHBOR_ADDR_STR2
    2011             :        "Advertise capability to the peer\n"
    2012             :        "Advertise ORF capability to the peer\n"
    2013             :        "Advertise prefixlist ORF capability to this neighbor\n"
    2014             :        "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
    2015             :        "Capability to RECEIVE the ORF from this neighbor\n"
    2016             :        "Capability to SEND the ORF to this neighbor\n")
    2017             : {
    2018           0 :   u_int16_t flag = 0;
    2019             : 
    2020           0 :   if (strncmp (argv[1], "s", 1) == 0)
    2021           0 :     flag = PEER_FLAG_ORF_PREFIX_SM;
    2022           0 :   else if (strncmp (argv[1], "r", 1) == 0)
    2023           0 :     flag = PEER_FLAG_ORF_PREFIX_RM;
    2024           0 :   else if (strncmp (argv[1], "b", 1) == 0)
    2025           0 :     flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
    2026             :   else
    2027           0 :     return CMD_WARNING;
    2028             : 
    2029           0 :   return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2030           0 :                                bgp_node_safi (vty), flag);
    2031             : }
    2032             : 
    2033           0 : DEFUN (no_neighbor_capability_orf_prefix,
    2034             :        no_neighbor_capability_orf_prefix_cmd,
    2035             :        NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
    2036             :        NO_STR
    2037             :        NEIGHBOR_STR
    2038             :        NEIGHBOR_ADDR_STR2
    2039             :        "Advertise capability to the peer\n"
    2040             :        "Advertise ORF capability to the peer\n"
    2041             :        "Advertise prefixlist ORF capability to this neighbor\n"
    2042             :        "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
    2043             :        "Capability to RECEIVE the ORF from this neighbor\n"
    2044             :        "Capability to SEND the ORF to this neighbor\n")
    2045             : {
    2046           0 :   u_int16_t flag = 0;
    2047             : 
    2048           0 :   if (strncmp (argv[1], "s", 1) == 0)
    2049           0 :     flag = PEER_FLAG_ORF_PREFIX_SM;
    2050           0 :   else if (strncmp (argv[1], "r", 1) == 0)
    2051           0 :     flag = PEER_FLAG_ORF_PREFIX_RM;
    2052           0 :   else if (strncmp (argv[1], "b", 1) == 0)
    2053           0 :     flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
    2054             :   else
    2055           0 :     return CMD_WARNING;
    2056             : 
    2057           0 :   return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
    2058           0 :                                  bgp_node_safi (vty), flag);
    2059             : }
    2060             : 
    2061             : /* neighbor next-hop-self. */
    2062           0 : DEFUN (neighbor_nexthop_self,
    2063             :        neighbor_nexthop_self_cmd,
    2064             :        NEIGHBOR_CMD2 "next-hop-self",
    2065             :        NEIGHBOR_STR
    2066             :        NEIGHBOR_ADDR_STR2
    2067             :        "Disable the next hop calculation for this neighbor\n")
    2068             : {
    2069           0 :   return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2070           0 :                                bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
    2071             : }
    2072             : 
    2073           0 : DEFUN (no_neighbor_nexthop_self,
    2074             :        no_neighbor_nexthop_self_cmd,
    2075             :        NO_NEIGHBOR_CMD2 "next-hop-self",
    2076             :        NO_STR
    2077             :        NEIGHBOR_STR
    2078             :        NEIGHBOR_ADDR_STR2
    2079             :        "Disable the next hop calculation for this neighbor\n")
    2080             : {
    2081           0 :   return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
    2082           0 :                                  bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
    2083             : }
    2084             : 
    2085             : /* neighbor remove-private-AS. */
    2086           0 : DEFUN (neighbor_remove_private_as,
    2087             :        neighbor_remove_private_as_cmd,
    2088             :        NEIGHBOR_CMD2 "remove-private-AS",
    2089             :        NEIGHBOR_STR
    2090             :        NEIGHBOR_ADDR_STR2
    2091             :        "Remove private AS number from outbound updates\n")
    2092             : {
    2093           0 :   return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2094           0 :                                bgp_node_safi (vty),
    2095             :                                PEER_FLAG_REMOVE_PRIVATE_AS);
    2096             : }
    2097             : 
    2098           0 : DEFUN (no_neighbor_remove_private_as,
    2099             :        no_neighbor_remove_private_as_cmd,
    2100             :        NO_NEIGHBOR_CMD2 "remove-private-AS",
    2101             :        NO_STR
    2102             :        NEIGHBOR_STR
    2103             :        NEIGHBOR_ADDR_STR2
    2104             :        "Remove private AS number from outbound updates\n")
    2105             : {
    2106           0 :   return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
    2107           0 :                                  bgp_node_safi (vty),
    2108             :                                  PEER_FLAG_REMOVE_PRIVATE_AS);
    2109             : }
    2110             : 
    2111             : /* neighbor send-community. */
    2112           0 : DEFUN (neighbor_send_community,
    2113             :        neighbor_send_community_cmd,
    2114             :        NEIGHBOR_CMD2 "send-community",
    2115             :        NEIGHBOR_STR
    2116             :        NEIGHBOR_ADDR_STR2
    2117             :        "Send Community attribute to this neighbor\n")
    2118             : {
    2119           0 :   return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2120           0 :                                bgp_node_safi (vty),
    2121             :                                PEER_FLAG_SEND_COMMUNITY);
    2122             : }
    2123             : 
    2124           0 : DEFUN (no_neighbor_send_community,
    2125             :        no_neighbor_send_community_cmd,
    2126             :        NO_NEIGHBOR_CMD2 "send-community",
    2127             :        NO_STR
    2128             :        NEIGHBOR_STR
    2129             :        NEIGHBOR_ADDR_STR2
    2130             :        "Send Community attribute to this neighbor\n")
    2131             : {
    2132           0 :   return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
    2133           0 :                                  bgp_node_safi (vty),
    2134             :                                  PEER_FLAG_SEND_COMMUNITY);
    2135             : }
    2136             : 
    2137             : /* neighbor send-community extended. */
    2138           0 : DEFUN (neighbor_send_community_type,
    2139             :        neighbor_send_community_type_cmd,
    2140             :        NEIGHBOR_CMD2 "send-community (both|extended|standard)",
    2141             :        NEIGHBOR_STR
    2142             :        NEIGHBOR_ADDR_STR2
    2143             :        "Send Community attribute to this neighbor\n"
    2144             :        "Send Standard and Extended Community attributes\n"
    2145             :        "Send Extended Community attributes\n"
    2146             :        "Send Standard Community attributes\n")
    2147             : {
    2148           0 :   if (strncmp (argv[1], "s", 1) == 0)
    2149           0 :     return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2150           0 :                                  bgp_node_safi (vty),
    2151             :                                  PEER_FLAG_SEND_COMMUNITY);
    2152           0 :   if (strncmp (argv[1], "e", 1) == 0)
    2153           0 :     return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2154           0 :                                  bgp_node_safi (vty),
    2155             :                                  PEER_FLAG_SEND_EXT_COMMUNITY);
    2156             : 
    2157           0 :   return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2158           0 :                                bgp_node_safi (vty),
    2159             :                                (PEER_FLAG_SEND_COMMUNITY|
    2160             :                                 PEER_FLAG_SEND_EXT_COMMUNITY));
    2161             : }
    2162             : 
    2163           0 : DEFUN (no_neighbor_send_community_type,
    2164             :        no_neighbor_send_community_type_cmd,
    2165             :        NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
    2166             :        NO_STR
    2167             :        NEIGHBOR_STR
    2168             :        NEIGHBOR_ADDR_STR2
    2169             :        "Send Community attribute to this neighbor\n"
    2170             :        "Send Standard and Extended Community attributes\n"
    2171             :        "Send Extended Community attributes\n"
    2172             :        "Send Standard Community attributes\n")
    2173             : {
    2174           0 :   if (strncmp (argv[1], "s", 1) == 0)
    2175           0 :     return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
    2176           0 :                                    bgp_node_safi (vty),
    2177             :                                    PEER_FLAG_SEND_COMMUNITY);
    2178           0 :   if (strncmp (argv[1], "e", 1) == 0)
    2179           0 :     return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
    2180           0 :                                    bgp_node_safi (vty),
    2181             :                                    PEER_FLAG_SEND_EXT_COMMUNITY);
    2182             : 
    2183           0 :   return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
    2184           0 :                                  bgp_node_safi (vty),
    2185             :                                  (PEER_FLAG_SEND_COMMUNITY |
    2186             :                                   PEER_FLAG_SEND_EXT_COMMUNITY));
    2187             : }
    2188             : 
    2189             : /* neighbor soft-reconfig. */
    2190           0 : DEFUN (neighbor_soft_reconfiguration,
    2191             :        neighbor_soft_reconfiguration_cmd,
    2192             :        NEIGHBOR_CMD2 "soft-reconfiguration inbound",
    2193             :        NEIGHBOR_STR
    2194             :        NEIGHBOR_ADDR_STR2
    2195             :        "Per neighbor soft reconfiguration\n"
    2196             :        "Allow inbound soft reconfiguration for this neighbor\n")
    2197             : {
    2198           0 :   return peer_af_flag_set_vty (vty, argv[0],
    2199           0 :                                bgp_node_afi (vty), bgp_node_safi (vty),
    2200             :                                PEER_FLAG_SOFT_RECONFIG);
    2201             : }
    2202             : 
    2203           0 : DEFUN (no_neighbor_soft_reconfiguration,
    2204             :        no_neighbor_soft_reconfiguration_cmd,
    2205             :        NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
    2206             :        NO_STR
    2207             :        NEIGHBOR_STR
    2208             :        NEIGHBOR_ADDR_STR2
    2209             :        "Per neighbor soft reconfiguration\n"
    2210             :        "Allow inbound soft reconfiguration for this neighbor\n")
    2211             : {
    2212           0 :   return peer_af_flag_unset_vty (vty, argv[0],
    2213           0 :                                  bgp_node_afi (vty), bgp_node_safi (vty),
    2214             :                                  PEER_FLAG_SOFT_RECONFIG);
    2215             : }
    2216             : 
    2217           0 : DEFUN (neighbor_route_reflector_client,
    2218             :        neighbor_route_reflector_client_cmd,
    2219             :        NEIGHBOR_CMD2 "route-reflector-client",
    2220             :        NEIGHBOR_STR
    2221             :        NEIGHBOR_ADDR_STR2
    2222             :        "Configure a neighbor as Route Reflector client\n")
    2223             : {
    2224             :   struct peer *peer;
    2225             : 
    2226             : 
    2227           0 :   peer = peer_and_group_lookup_vty (vty, argv[0]);
    2228           0 :   if (! peer)
    2229           0 :     return CMD_WARNING;
    2230             : 
    2231           0 :   return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2232           0 :                                bgp_node_safi (vty),
    2233             :                                PEER_FLAG_REFLECTOR_CLIENT);
    2234             : }
    2235             : 
    2236           0 : DEFUN (no_neighbor_route_reflector_client,
    2237             :        no_neighbor_route_reflector_client_cmd,
    2238             :        NO_NEIGHBOR_CMD2 "route-reflector-client",
    2239             :        NO_STR
    2240             :        NEIGHBOR_STR
    2241             :        NEIGHBOR_ADDR_STR2
    2242             :        "Configure a neighbor as Route Reflector client\n")
    2243             : {
    2244           0 :   return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
    2245           0 :                                  bgp_node_safi (vty),
    2246             :                                  PEER_FLAG_REFLECTOR_CLIENT);
    2247             : }
    2248             : 
    2249             : static int
    2250           0 : peer_rsclient_set_vty (struct vty *vty, const char *peer_str, 
    2251             :                        int afi, int safi)
    2252             : {
    2253             :   int ret;
    2254             :   struct bgp *bgp;
    2255             :   struct peer *peer;
    2256             :   struct peer_group *group;
    2257             :   struct listnode *node, *nnode;
    2258             :   struct bgp_filter *pfilter;
    2259             :   struct bgp_filter *gfilter;
    2260           0 :   int locked_and_added = 0;
    2261             : 
    2262           0 :   bgp = vty->index;
    2263             : 
    2264           0 :   peer = peer_and_group_lookup_vty (vty, peer_str);
    2265           0 :   if ( ! peer )
    2266           0 :     return CMD_WARNING;
    2267             : 
    2268             :   /* If it is already a RS-Client, don't do anything. */
    2269           0 :   if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
    2270           0 :     return CMD_SUCCESS;
    2271             : 
    2272           0 :   if ( ! peer_rsclient_active (peer) )
    2273             :     {
    2274           0 :       peer = peer_lock (peer); /* rsclient peer list reference */
    2275           0 :       listnode_add_sort (bgp->rsclient, peer);
    2276           0 :       locked_and_added = 1;
    2277             :     }
    2278             : 
    2279           0 :   ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
    2280           0 :   if (ret < 0)
    2281             :     {
    2282           0 :       if (locked_and_added)
    2283             :         {
    2284           0 :           listnode_delete (bgp->rsclient, peer);
    2285           0 :           peer_unlock (peer); /* rsclient peer list reference */
    2286             :         }
    2287             : 
    2288           0 :       return bgp_vty_return (vty, ret);
    2289             :     }
    2290             : 
    2291           0 :   peer->rib[afi][safi] = bgp_table_init (afi, safi);
    2292           0 :   peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
    2293             :   /* RIB peer reference.  Released when table is free'd in bgp_table_free. */
    2294           0 :   peer->rib[afi][safi]->owner = peer_lock (peer);
    2295             : 
    2296             :   /* Check for existing 'network' and 'redistribute' routes. */
    2297           0 :   bgp_check_local_routes_rsclient (peer, afi, safi);
    2298             : 
    2299             :   /* Check for routes for peers configured with 'soft-reconfiguration'. */
    2300           0 :   bgp_soft_reconfig_rsclient (peer, afi, safi);
    2301             : 
    2302           0 :   if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
    2303             :     {
    2304           0 :       group = peer->group;
    2305           0 :       gfilter = &peer->filter[afi][safi];
    2306             : 
    2307           0 :       for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
    2308             :         {
    2309           0 :           pfilter = &peer->filter[afi][safi];
    2310             : 
    2311             :           /* Members of a non-RS-Client group should not be RS-Clients, as that 
    2312             :              is checked when the become part of the peer-group */
    2313           0 :           ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
    2314           0 :           if (ret < 0)
    2315           0 :             return bgp_vty_return (vty, ret);
    2316             : 
    2317             :           /* Make peer's RIB point to group's RIB. */
    2318           0 :           peer->rib[afi][safi] = group->conf->rib[afi][safi];
    2319             : 
    2320             :           /* Import policy. */
    2321           0 :           if (pfilter->map[RMAP_IMPORT].name)
    2322           0 :             free (pfilter->map[RMAP_IMPORT].name);
    2323           0 :           if (gfilter->map[RMAP_IMPORT].name)
    2324             :             {
    2325           0 :               pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
    2326           0 :               pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
    2327             :             }
    2328             :           else
    2329             :             {
    2330           0 :               pfilter->map[RMAP_IMPORT].name = NULL;
    2331           0 :               pfilter->map[RMAP_IMPORT].map =NULL;
    2332             :             }
    2333             : 
    2334             :           /* Export policy. */
    2335           0 :           if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
    2336             :             {
    2337           0 :               pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
    2338           0 :               pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
    2339             :             }
    2340             :         }
    2341             :     }
    2342           0 :   return CMD_SUCCESS;
    2343             : }
    2344             : 
    2345             : static int
    2346           0 : peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, 
    2347             :                          int afi, int safi)
    2348             : {
    2349             :   int ret;
    2350             :   struct bgp *bgp;
    2351             :   struct peer *peer;
    2352             :   struct peer_group *group;
    2353             :   struct listnode *node, *nnode;
    2354             : 
    2355           0 :   bgp = vty->index;
    2356             : 
    2357           0 :   peer = peer_and_group_lookup_vty (vty, peer_str);
    2358           0 :   if ( ! peer )
    2359           0 :     return CMD_WARNING;
    2360             : 
    2361             :   /* If it is not a RS-Client, don't do anything. */
    2362           0 :   if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
    2363           0 :     return CMD_SUCCESS;
    2364             : 
    2365           0 :   if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
    2366             :     {
    2367           0 :       group = peer->group;
    2368             : 
    2369           0 :       for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
    2370             :         {
    2371           0 :           ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
    2372           0 :           if (ret < 0)
    2373           0 :             return bgp_vty_return (vty, ret);
    2374             : 
    2375           0 :           peer->rib[afi][safi] = NULL;
    2376             :         }
    2377             : 
    2378           0 :         peer = group->conf;
    2379             :     }
    2380             : 
    2381           0 :   ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
    2382           0 :   if (ret < 0)
    2383           0 :     return bgp_vty_return (vty, ret);
    2384             : 
    2385           0 :   if ( ! peer_rsclient_active (peer) )
    2386             :     {
    2387           0 :       bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
    2388           0 :       listnode_delete (bgp->rsclient, peer);
    2389           0 :       peer_unlock (peer); /* peer bgp rsclient reference */
    2390             :     }
    2391             : 
    2392           0 :   bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
    2393             : 
    2394           0 :   return CMD_SUCCESS;
    2395             : }
    2396             : 
    2397             : /* neighbor route-server-client. */
    2398           0 : DEFUN (neighbor_route_server_client,
    2399             :        neighbor_route_server_client_cmd,
    2400             :        NEIGHBOR_CMD2 "route-server-client",
    2401             :        NEIGHBOR_STR
    2402             :        NEIGHBOR_ADDR_STR2
    2403             :        "Configure a neighbor as Route Server client\n")
    2404             : {
    2405           0 :   return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
    2406           0 :                   bgp_node_safi(vty));
    2407             : }
    2408             : 
    2409           0 : DEFUN (no_neighbor_route_server_client,
    2410             :        no_neighbor_route_server_client_cmd,
    2411             :        NO_NEIGHBOR_CMD2 "route-server-client",
    2412             :        NO_STR
    2413             :        NEIGHBOR_STR
    2414             :        NEIGHBOR_ADDR_STR2
    2415             :        "Configure a neighbor as Route Server client\n")
    2416             : {
    2417           0 :   return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
    2418           0 :                   bgp_node_safi(vty));
    2419             : }
    2420             : 
    2421           0 : DEFUN (neighbor_nexthop_local_unchanged,
    2422             :        neighbor_nexthop_local_unchanged_cmd,
    2423             :        NEIGHBOR_CMD2 "nexthop-local unchanged",
    2424             :        NEIGHBOR_STR
    2425             :        NEIGHBOR_ADDR_STR2
    2426             :        "Configure treatment of outgoing link-local nexthop attribute\n"
    2427             :        "Leave link-local nexthop unchanged for this peer\n")
    2428             : {
    2429           0 :   return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2430           0 :                                 bgp_node_safi (vty),
    2431             :                                 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
    2432             : }
    2433             : 
    2434           0 : DEFUN (no_neighbor_nexthop_local_unchanged,
    2435             :        no_neighbor_nexthop_local_unchanged_cmd,
    2436             :        NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
    2437             :        NO_STR
    2438             :        NEIGHBOR_STR
    2439             :        NEIGHBOR_ADDR_STR2
    2440             :        "Configure treatment of outgoing link-local-nexthop attribute\n"
    2441             :        "Leave link-local nexthop unchanged for this peer\n")
    2442             : {
    2443           0 :   return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
    2444           0 :                                  bgp_node_safi (vty),
    2445             :                                 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
    2446             : }
    2447             : 
    2448           0 : DEFUN (neighbor_attr_unchanged,
    2449             :        neighbor_attr_unchanged_cmd,
    2450             :        NEIGHBOR_CMD2 "attribute-unchanged",
    2451             :        NEIGHBOR_STR
    2452             :        NEIGHBOR_ADDR_STR2
    2453             :        "BGP attribute is propagated unchanged to this neighbor\n")
    2454             : {
    2455           0 :   return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2456           0 :                                bgp_node_safi (vty),
    2457             :                                (PEER_FLAG_AS_PATH_UNCHANGED |
    2458             :                                 PEER_FLAG_NEXTHOP_UNCHANGED |
    2459             :                                 PEER_FLAG_MED_UNCHANGED));
    2460             : }
    2461             : 
    2462           0 : DEFUN (neighbor_attr_unchanged1,
    2463             :        neighbor_attr_unchanged1_cmd,
    2464             :        NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
    2465             :        NEIGHBOR_STR
    2466             :        NEIGHBOR_ADDR_STR2
    2467             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2468             :        "As-path attribute\n"
    2469             :        "Nexthop attribute\n"
    2470             :        "Med attribute\n")
    2471             : {
    2472           0 :   u_int16_t flags = 0;
    2473             : 
    2474           0 :   if (strncmp (argv[1], "as-path", 1) == 0)
    2475           0 :     SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
    2476           0 :   else if (strncmp (argv[1], "next-hop", 1) == 0)
    2477           0 :     SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
    2478           0 :   else if (strncmp (argv[1], "med", 1) == 0)
    2479           0 :     SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
    2480             : 
    2481           0 :   return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2482           0 :                                bgp_node_safi (vty), flags);
    2483             : }
    2484             : 
    2485           0 : DEFUN (neighbor_attr_unchanged2,
    2486             :        neighbor_attr_unchanged2_cmd,
    2487             :        NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
    2488             :        NEIGHBOR_STR
    2489             :        NEIGHBOR_ADDR_STR2
    2490             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2491             :        "As-path attribute\n"
    2492             :        "Nexthop attribute\n"
    2493             :        "Med attribute\n")
    2494             : {
    2495           0 :   u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
    2496             : 
    2497           0 :   if (strncmp (argv[1], "next-hop", 1) == 0)
    2498           0 :     SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
    2499           0 :   else if (strncmp (argv[1], "med", 1) == 0)
    2500           0 :     SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
    2501             : 
    2502           0 :   return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2503           0 :                                bgp_node_safi (vty), flags);
    2504             : 
    2505             : }
    2506             : 
    2507           0 : DEFUN (neighbor_attr_unchanged3,
    2508             :        neighbor_attr_unchanged3_cmd,
    2509             :        NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
    2510             :        NEIGHBOR_STR
    2511             :        NEIGHBOR_ADDR_STR2
    2512             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2513             :        "Nexthop attribute\n"
    2514             :        "As-path attribute\n"
    2515             :        "Med attribute\n")
    2516             : {
    2517           0 :   u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
    2518             : 
    2519           0 :   if (strncmp (argv[1], "as-path", 1) == 0)
    2520           0 :     SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
    2521           0 :   else if (strncmp (argv[1], "med", 1) == 0)
    2522           0 :     SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
    2523             : 
    2524           0 :   return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2525           0 :                                bgp_node_safi (vty), flags);
    2526             : }
    2527             : 
    2528           0 : DEFUN (neighbor_attr_unchanged4,
    2529             :        neighbor_attr_unchanged4_cmd,
    2530             :        NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
    2531             :        NEIGHBOR_STR
    2532             :        NEIGHBOR_ADDR_STR2
    2533             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2534             :        "Med attribute\n"
    2535             :        "As-path attribute\n"
    2536             :        "Nexthop attribute\n")
    2537             : {
    2538           0 :   u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
    2539             : 
    2540           0 :   if (strncmp (argv[1], "as-path", 1) == 0)
    2541           0 :     SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
    2542           0 :   else if (strncmp (argv[1], "next-hop", 1) == 0)
    2543           0 :     SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
    2544             : 
    2545           0 :   return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2546           0 :                                bgp_node_safi (vty), flags);
    2547             : }
    2548             : 
    2549             : ALIAS (neighbor_attr_unchanged,
    2550             :        neighbor_attr_unchanged5_cmd,
    2551             :        NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
    2552             :        NEIGHBOR_STR
    2553             :        NEIGHBOR_ADDR_STR2
    2554             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2555             :        "As-path attribute\n"
    2556             :        "Nexthop attribute\n"
    2557             :        "Med attribute\n")
    2558             : 
    2559             : ALIAS (neighbor_attr_unchanged,
    2560             :        neighbor_attr_unchanged6_cmd,
    2561             :        NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
    2562             :        NEIGHBOR_STR
    2563             :        NEIGHBOR_ADDR_STR2
    2564             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2565             :        "As-path attribute\n"
    2566             :        "Med attribute\n"
    2567             :        "Nexthop attribute\n")
    2568             : 
    2569             : ALIAS (neighbor_attr_unchanged,
    2570             :        neighbor_attr_unchanged7_cmd,
    2571             :        NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
    2572             :        NEIGHBOR_STR
    2573             :        NEIGHBOR_ADDR_STR2
    2574             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2575             :        "Nexthop attribute\n"
    2576             :        "Med attribute\n"
    2577             :        "As-path attribute\n")
    2578             : 
    2579             : ALIAS (neighbor_attr_unchanged,
    2580             :        neighbor_attr_unchanged8_cmd,
    2581             :        NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
    2582             :        NEIGHBOR_STR
    2583             :        NEIGHBOR_ADDR_STR2
    2584             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2585             :        "Nexthop attribute\n"
    2586             :        "As-path attribute\n"
    2587             :        "Med attribute\n")
    2588             : 
    2589             : ALIAS (neighbor_attr_unchanged,
    2590             :        neighbor_attr_unchanged9_cmd,
    2591             :        NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
    2592             :        NEIGHBOR_STR
    2593             :        NEIGHBOR_ADDR_STR2
    2594             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2595             :        "Med attribute\n"
    2596             :        "Nexthop attribute\n"
    2597             :        "As-path attribute\n")
    2598             : 
    2599             : ALIAS (neighbor_attr_unchanged,
    2600             :        neighbor_attr_unchanged10_cmd,
    2601             :        NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
    2602             :        NEIGHBOR_STR
    2603             :        NEIGHBOR_ADDR_STR2
    2604             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2605             :        "Med attribute\n"
    2606             :        "As-path attribute\n"
    2607             :        "Nexthop attribute\n")
    2608             : 
    2609           0 : DEFUN (no_neighbor_attr_unchanged,
    2610             :        no_neighbor_attr_unchanged_cmd,
    2611             :        NO_NEIGHBOR_CMD2 "attribute-unchanged",
    2612             :        NO_STR    
    2613             :        NEIGHBOR_STR
    2614             :        NEIGHBOR_ADDR_STR2
    2615             :        "BGP attribute is propagated unchanged to this neighbor\n")
    2616             : {
    2617           0 :   return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
    2618           0 :                                  bgp_node_safi (vty),
    2619             :                                  (PEER_FLAG_AS_PATH_UNCHANGED |
    2620             :                                   PEER_FLAG_NEXTHOP_UNCHANGED |
    2621             :                                   PEER_FLAG_MED_UNCHANGED));
    2622             : }
    2623             : 
    2624           0 : DEFUN (no_neighbor_attr_unchanged1,
    2625             :        no_neighbor_attr_unchanged1_cmd,
    2626             :        NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
    2627             :        NO_STR
    2628             :        NEIGHBOR_STR
    2629             :        NEIGHBOR_ADDR_STR2
    2630             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2631             :        "As-path attribute\n"
    2632             :        "Nexthop attribute\n"
    2633             :        "Med attribute\n")
    2634             : {
    2635           0 :   u_int16_t flags = 0;
    2636             : 
    2637           0 :   if (strncmp (argv[1], "as-path", 1) == 0)
    2638           0 :     SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
    2639           0 :   else if (strncmp (argv[1], "next-hop", 1) == 0)
    2640           0 :     SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
    2641           0 :   else if (strncmp (argv[1], "med", 1) == 0)
    2642           0 :     SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
    2643             : 
    2644           0 :   return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
    2645           0 :                                  bgp_node_safi (vty), flags);
    2646             : }
    2647             : 
    2648           0 : DEFUN (no_neighbor_attr_unchanged2,
    2649             :        no_neighbor_attr_unchanged2_cmd,
    2650             :        NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
    2651             :        NO_STR
    2652             :        NEIGHBOR_STR
    2653             :        NEIGHBOR_ADDR_STR2
    2654             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2655             :        "As-path attribute\n"
    2656             :        "Nexthop attribute\n"
    2657             :        "Med attribute\n")
    2658             : {
    2659           0 :   u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
    2660             : 
    2661           0 :   if (strncmp (argv[1], "next-hop", 1) == 0)
    2662           0 :     SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
    2663           0 :   else if (strncmp (argv[1], "med", 1) == 0)
    2664           0 :     SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
    2665             : 
    2666           0 :   return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
    2667           0 :                                bgp_node_safi (vty), flags);
    2668             : }
    2669             : 
    2670           0 : DEFUN (no_neighbor_attr_unchanged3,
    2671             :        no_neighbor_attr_unchanged3_cmd,
    2672             :        NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
    2673             :        NO_STR
    2674             :        NEIGHBOR_STR
    2675             :        NEIGHBOR_ADDR_STR2
    2676             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2677             :        "Nexthop attribute\n"
    2678             :        "As-path attribute\n"
    2679             :        "Med attribute\n")
    2680             : {
    2681           0 :   u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
    2682             : 
    2683           0 :   if (strncmp (argv[1], "as-path", 1) == 0)
    2684           0 :     SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
    2685           0 :   else if (strncmp (argv[1], "med", 1) == 0)
    2686           0 :     SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
    2687             : 
    2688           0 :   return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
    2689           0 :                                  bgp_node_safi (vty), flags);
    2690             : }
    2691             : 
    2692           0 : DEFUN (no_neighbor_attr_unchanged4,
    2693             :        no_neighbor_attr_unchanged4_cmd,
    2694             :        NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
    2695             :        NO_STR
    2696             :        NEIGHBOR_STR
    2697             :        NEIGHBOR_ADDR_STR2
    2698             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2699             :        "Med attribute\n"
    2700             :        "As-path attribute\n"
    2701             :        "Nexthop attribute\n")
    2702             : {
    2703           0 :   u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
    2704             : 
    2705           0 :   if (strncmp (argv[1], "as-path", 1) == 0)
    2706           0 :     SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
    2707           0 :   else if (strncmp (argv[1], "next-hop", 1) == 0)
    2708           0 :     SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
    2709             : 
    2710           0 :   return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
    2711           0 :                                bgp_node_safi (vty), flags);
    2712             : }
    2713             : 
    2714             : ALIAS (no_neighbor_attr_unchanged,
    2715             :        no_neighbor_attr_unchanged5_cmd,
    2716             :        NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
    2717             :        NO_STR
    2718             :        NEIGHBOR_STR
    2719             :        NEIGHBOR_ADDR_STR2
    2720             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2721             :        "As-path attribute\n"
    2722             :        "Nexthop attribute\n"
    2723             :        "Med attribute\n")
    2724             : 
    2725             : ALIAS (no_neighbor_attr_unchanged,
    2726             :        no_neighbor_attr_unchanged6_cmd,
    2727             :        NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
    2728             :        NO_STR
    2729             :        NEIGHBOR_STR
    2730             :        NEIGHBOR_ADDR_STR2
    2731             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2732             :        "As-path attribute\n"
    2733             :        "Med attribute\n"
    2734             :        "Nexthop attribute\n")
    2735             : 
    2736             : ALIAS (no_neighbor_attr_unchanged,
    2737             :        no_neighbor_attr_unchanged7_cmd,
    2738             :        NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
    2739             :        NO_STR
    2740             :        NEIGHBOR_STR
    2741             :        NEIGHBOR_ADDR_STR2
    2742             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2743             :        "Nexthop attribute\n"
    2744             :        "Med attribute\n"
    2745             :        "As-path attribute\n")
    2746             : 
    2747             : ALIAS (no_neighbor_attr_unchanged,
    2748             :        no_neighbor_attr_unchanged8_cmd,
    2749             :        NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
    2750             :        NO_STR
    2751             :        NEIGHBOR_STR
    2752             :        NEIGHBOR_ADDR_STR2
    2753             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2754             :        "Nexthop attribute\n"
    2755             :        "As-path attribute\n"
    2756             :        "Med attribute\n")
    2757             : 
    2758             : ALIAS (no_neighbor_attr_unchanged,
    2759             :        no_neighbor_attr_unchanged9_cmd,
    2760             :        NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
    2761             :        NO_STR
    2762             :        NEIGHBOR_STR
    2763             :        NEIGHBOR_ADDR_STR2
    2764             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2765             :        "Med attribute\n"
    2766             :        "Nexthop attribute\n"
    2767             :        "As-path attribute\n")
    2768             : 
    2769             : ALIAS (no_neighbor_attr_unchanged,
    2770             :        no_neighbor_attr_unchanged10_cmd,
    2771             :        NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
    2772             :        NO_STR
    2773             :        NEIGHBOR_STR
    2774             :        NEIGHBOR_ADDR_STR2
    2775             :        "BGP attribute is propagated unchanged to this neighbor\n"
    2776             :        "Med attribute\n"
    2777             :        "As-path attribute\n"
    2778             :        "Nexthop attribute\n")
    2779             : 
    2780             : /* For old version Zebra compatibility.  */
    2781           0 : DEFUN_DEPRECATED (neighbor_transparent_as,
    2782             :                   neighbor_transparent_as_cmd,
    2783             :                   NEIGHBOR_CMD "transparent-as",
    2784             :                   NEIGHBOR_STR
    2785             :                   NEIGHBOR_ADDR_STR
    2786             :                   "Do not append my AS number even peer is EBGP peer\n")
    2787             : {
    2788           0 :   return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2789           0 :                                bgp_node_safi (vty),
    2790             :                                PEER_FLAG_AS_PATH_UNCHANGED);
    2791             : }
    2792             : 
    2793           0 : DEFUN_DEPRECATED (neighbor_transparent_nexthop,
    2794             :                   neighbor_transparent_nexthop_cmd,
    2795             :                   NEIGHBOR_CMD "transparent-nexthop",
    2796             :                   NEIGHBOR_STR
    2797             :                   NEIGHBOR_ADDR_STR
    2798             :                   "Do not change nexthop even peer is EBGP peer\n")
    2799             : {
    2800           0 :   return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
    2801           0 :                                bgp_node_safi (vty),
    2802             :                                PEER_FLAG_NEXTHOP_UNCHANGED);
    2803             : }
    2804             : 
    2805             : /* EBGP multihop configuration. */
    2806             : static int
    2807           0 : peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, 
    2808             :                             const char *ttl_str)
    2809             : {
    2810             :   struct peer *peer;
    2811             :   unsigned int ttl;
    2812             : 
    2813           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    2814           0 :   if (! peer)
    2815           0 :     return CMD_WARNING;
    2816             : 
    2817           0 :   if (! ttl_str)
    2818           0 :     ttl = TTL_MAX;
    2819             :   else
    2820           0 :     VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
    2821             : 
    2822           0 :   return bgp_vty_return (vty,  peer_ebgp_multihop_set (peer, ttl));
    2823             : }
    2824             : 
    2825             : static int
    2826           0 : peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) 
    2827             : {
    2828             :   struct peer *peer;
    2829             : 
    2830           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    2831           0 :   if (! peer)
    2832           0 :     return CMD_WARNING;
    2833             : 
    2834           0 :   return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
    2835             : }
    2836             : 
    2837             : /* neighbor ebgp-multihop. */
    2838           0 : DEFUN (neighbor_ebgp_multihop,
    2839             :        neighbor_ebgp_multihop_cmd,
    2840             :        NEIGHBOR_CMD2 "ebgp-multihop",
    2841             :        NEIGHBOR_STR
    2842             :        NEIGHBOR_ADDR_STR2
    2843             :        "Allow EBGP neighbors not on directly connected networks\n")
    2844             : {
    2845           0 :   return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
    2846             : }
    2847             : 
    2848           0 : DEFUN (neighbor_ebgp_multihop_ttl,
    2849             :        neighbor_ebgp_multihop_ttl_cmd,
    2850             :        NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
    2851             :        NEIGHBOR_STR
    2852             :        NEIGHBOR_ADDR_STR2
    2853             :        "Allow EBGP neighbors not on directly connected networks\n"
    2854             :        "maximum hop count\n")
    2855             : {
    2856           0 :   return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
    2857             : }
    2858             : 
    2859           0 : DEFUN (no_neighbor_ebgp_multihop,
    2860             :        no_neighbor_ebgp_multihop_cmd,
    2861             :        NO_NEIGHBOR_CMD2 "ebgp-multihop",
    2862             :        NO_STR
    2863             :        NEIGHBOR_STR
    2864             :        NEIGHBOR_ADDR_STR2
    2865             :        "Allow EBGP neighbors not on directly connected networks\n")
    2866             : {
    2867           0 :   return peer_ebgp_multihop_unset_vty (vty, argv[0]);
    2868             : }
    2869             : 
    2870             : ALIAS (no_neighbor_ebgp_multihop,
    2871             :        no_neighbor_ebgp_multihop_ttl_cmd,
    2872             :        NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
    2873             :        NO_STR
    2874             :        NEIGHBOR_STR
    2875             :        NEIGHBOR_ADDR_STR2
    2876             :        "Allow EBGP neighbors not on directly connected networks\n"
    2877             :        "maximum hop count\n")
    2878             : 
    2879             : /* disable-connected-check */
    2880           0 : DEFUN (neighbor_disable_connected_check,
    2881             :        neighbor_disable_connected_check_cmd,
    2882             :        NEIGHBOR_CMD2 "disable-connected-check",
    2883             :        NEIGHBOR_STR
    2884             :        NEIGHBOR_ADDR_STR2
    2885             :        "one-hop away EBGP peer using loopback address\n")
    2886             : {
    2887           0 :   return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
    2888             : }
    2889             : 
    2890           0 : DEFUN (no_neighbor_disable_connected_check,
    2891             :        no_neighbor_disable_connected_check_cmd,
    2892             :        NO_NEIGHBOR_CMD2 "disable-connected-check",
    2893             :        NO_STR
    2894             :        NEIGHBOR_STR
    2895             :        NEIGHBOR_ADDR_STR2
    2896             :        "one-hop away EBGP peer using loopback address\n")
    2897             : {
    2898           0 :   return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
    2899             : }
    2900             : 
    2901             : /* Enforce multihop.  */
    2902             : ALIAS (neighbor_disable_connected_check,
    2903             :        neighbor_enforce_multihop_cmd,
    2904             :        NEIGHBOR_CMD2 "enforce-multihop",
    2905             :        NEIGHBOR_STR
    2906             :        NEIGHBOR_ADDR_STR2
    2907             :        "Enforce EBGP neighbors perform multihop\n")
    2908             : 
    2909             : /* Enforce multihop.  */
    2910             : ALIAS (no_neighbor_disable_connected_check,
    2911             :        no_neighbor_enforce_multihop_cmd,
    2912             :        NO_NEIGHBOR_CMD2 "enforce-multihop",
    2913             :        NO_STR
    2914             :        NEIGHBOR_STR
    2915             :        NEIGHBOR_ADDR_STR2
    2916             :        "Enforce EBGP neighbors perform multihop\n")
    2917             : 
    2918           0 : DEFUN (neighbor_description,
    2919             :        neighbor_description_cmd,
    2920             :        NEIGHBOR_CMD2 "description .LINE",
    2921             :        NEIGHBOR_STR
    2922             :        NEIGHBOR_ADDR_STR2
    2923             :        "Neighbor specific description\n"
    2924             :        "Up to 80 characters describing this neighbor\n")
    2925             : {
    2926             :   struct peer *peer;
    2927             :   char *str;
    2928             : 
    2929           0 :   peer = peer_and_group_lookup_vty (vty, argv[0]);
    2930           0 :   if (! peer)
    2931           0 :     return CMD_WARNING;
    2932             : 
    2933           0 :   if (argc == 1)
    2934           0 :     return CMD_SUCCESS;
    2935             : 
    2936           0 :   str = argv_concat(argv, argc, 1);
    2937             : 
    2938           0 :   peer_description_set (peer, str);
    2939             : 
    2940           0 :   XFREE (MTYPE_TMP, str);
    2941             : 
    2942           0 :   return CMD_SUCCESS;
    2943             : }
    2944             : 
    2945           0 : DEFUN (no_neighbor_description,
    2946             :        no_neighbor_description_cmd,
    2947             :        NO_NEIGHBOR_CMD2 "description",
    2948             :        NO_STR
    2949             :        NEIGHBOR_STR
    2950             :        NEIGHBOR_ADDR_STR2
    2951             :        "Neighbor specific description\n")
    2952             : {
    2953             :   struct peer *peer;
    2954             : 
    2955           0 :   peer = peer_and_group_lookup_vty (vty, argv[0]);
    2956           0 :   if (! peer)
    2957           0 :     return CMD_WARNING;
    2958             : 
    2959           0 :   peer_description_unset (peer);
    2960             : 
    2961           0 :   return CMD_SUCCESS;
    2962             : }
    2963             : 
    2964             : ALIAS (no_neighbor_description,
    2965             :        no_neighbor_description_val_cmd,
    2966             :        NO_NEIGHBOR_CMD2 "description .LINE",
    2967             :        NO_STR
    2968             :        NEIGHBOR_STR
    2969             :        NEIGHBOR_ADDR_STR2
    2970             :        "Neighbor specific description\n"
    2971             :        "Up to 80 characters describing this neighbor\n")
    2972             : 
    2973             : /* Neighbor update-source. */
    2974             : static int
    2975           0 : peer_update_source_vty (struct vty *vty, const char *peer_str, 
    2976             :                         const char *source_str)
    2977             : {
    2978             :   struct peer *peer;
    2979             : 
    2980           0 :   peer = peer_and_group_lookup_vty (vty, peer_str);
    2981           0 :   if (! peer)
    2982           0 :     return CMD_WARNING;
    2983             : 
    2984           0 :   if (source_str)
    2985             :     {
    2986             :       union sockunion su;
    2987           0 :       int ret = str2sockunion (source_str, &su);
    2988             : 
    2989           0 :       if (ret == 0)
    2990           0 :         peer_update_source_addr_set (peer, &su);
    2991             :       else
    2992           0 :         peer_update_source_if_set (peer, source_str);
    2993             :     }
    2994             :   else
    2995           0 :     peer_update_source_unset (peer);
    2996             : 
    2997           0 :   return CMD_SUCCESS;
    2998             : }
    2999             : 
    3000             : #define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
    3001             : #define BGP_UPDATE_SOURCE_HELP_STR \
    3002             :   "IPv4 address\n" \
    3003             :   "IPv6 address\n" \
    3004             :   "Interface name (requires zebra to be running)\n"
    3005             : 
    3006           0 : DEFUN (neighbor_update_source,
    3007             :        neighbor_update_source_cmd,
    3008             :        NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
    3009             :        NEIGHBOR_STR
    3010             :        NEIGHBOR_ADDR_STR2
    3011             :        "Source of routing updates\n"
    3012             :        BGP_UPDATE_SOURCE_HELP_STR)
    3013             : {
    3014           0 :   return peer_update_source_vty (vty, argv[0], argv[1]);
    3015             : }
    3016             : 
    3017           0 : DEFUN (no_neighbor_update_source,
    3018             :        no_neighbor_update_source_cmd,
    3019             :        NO_NEIGHBOR_CMD2 "update-source",
    3020             :        NO_STR
    3021             :        NEIGHBOR_STR
    3022             :        NEIGHBOR_ADDR_STR2
    3023             :        "Source of routing updates\n")
    3024             : {
    3025           0 :   return peer_update_source_vty (vty, argv[0], NULL);
    3026             : }
    3027             : 
    3028             : static int
    3029           0 : peer_default_originate_set_vty (struct vty *vty, const char *peer_str, 
    3030             :                                 afi_t afi, safi_t safi, 
    3031             :                                 const char *rmap, int set)
    3032             : {
    3033             :   int ret;
    3034             :   struct peer *peer;
    3035             : 
    3036           0 :   peer = peer_and_group_lookup_vty (vty, peer_str);
    3037           0 :   if (! peer)
    3038           0 :     return CMD_WARNING;
    3039             : 
    3040           0 :   if (set)
    3041           0 :     ret = peer_default_originate_set (peer, afi, safi, rmap);
    3042             :   else
    3043           0 :     ret = peer_default_originate_unset (peer, afi, safi);
    3044             : 
    3045           0 :   return bgp_vty_return (vty, ret);
    3046             : }
    3047             : 
    3048             : /* neighbor default-originate. */
    3049           0 : DEFUN (neighbor_default_originate,
    3050             :        neighbor_default_originate_cmd,
    3051             :        NEIGHBOR_CMD2 "default-originate",
    3052             :        NEIGHBOR_STR
    3053             :        NEIGHBOR_ADDR_STR2
    3054             :        "Originate default route to this neighbor\n")
    3055             : {
    3056           0 :   return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
    3057           0 :                                          bgp_node_safi (vty), NULL, 1);
    3058             : }
    3059             : 
    3060           0 : DEFUN (neighbor_default_originate_rmap,
    3061             :        neighbor_default_originate_rmap_cmd,
    3062             :        NEIGHBOR_CMD2 "default-originate route-map WORD",
    3063             :        NEIGHBOR_STR
    3064             :        NEIGHBOR_ADDR_STR2
    3065             :        "Originate default route to this neighbor\n"
    3066             :        "Route-map to specify criteria to originate default\n"
    3067             :        "route-map name\n")
    3068             : {
    3069           0 :   return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
    3070           0 :                                          bgp_node_safi (vty), argv[1], 1);
    3071             : }
    3072             : 
    3073           0 : DEFUN (no_neighbor_default_originate,
    3074             :        no_neighbor_default_originate_cmd,
    3075             :        NO_NEIGHBOR_CMD2 "default-originate",
    3076             :        NO_STR
    3077             :        NEIGHBOR_STR
    3078             :        NEIGHBOR_ADDR_STR2
    3079             :        "Originate default route to this neighbor\n")
    3080             : {
    3081           0 :   return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
    3082           0 :                                          bgp_node_safi (vty), NULL, 0);
    3083             : }
    3084             : 
    3085             : ALIAS (no_neighbor_default_originate,
    3086             :        no_neighbor_default_originate_rmap_cmd,
    3087             :        NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
    3088             :        NO_STR
    3089             :        NEIGHBOR_STR
    3090             :        NEIGHBOR_ADDR_STR2
    3091             :        "Originate default route to this neighbor\n"
    3092             :        "Route-map to specify criteria to originate default\n"
    3093             :        "route-map name\n")
    3094             : 
    3095             : /* Set neighbor's BGP port.  */
    3096             : static int
    3097           0 : peer_port_vty (struct vty *vty, const char *ip_str, int afi, 
    3098             :                const char *port_str)
    3099             : {
    3100             :   struct peer *peer;
    3101             :   u_int16_t port;
    3102             :   struct servent *sp;
    3103             : 
    3104           0 :   peer = peer_lookup_vty (vty, ip_str);
    3105           0 :   if (! peer)
    3106           0 :     return CMD_WARNING;
    3107             : 
    3108           0 :   if (! port_str)
    3109             :     { 
    3110           0 :       sp = getservbyname ("bgp", "tcp");
    3111           0 :       port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
    3112             :     }
    3113             :   else
    3114             :     {
    3115           0 :       VTY_GET_INTEGER("port", port, port_str);
    3116             :     }
    3117             : 
    3118           0 :   peer_port_set (peer, port);
    3119             : 
    3120           0 :   return CMD_SUCCESS;
    3121             : }
    3122             : 
    3123             : /* Set specified peer's BGP port.  */
    3124           0 : DEFUN (neighbor_port,
    3125             :        neighbor_port_cmd,
    3126             :        NEIGHBOR_CMD "port <0-65535>",
    3127             :        NEIGHBOR_STR
    3128             :        NEIGHBOR_ADDR_STR
    3129             :        "Neighbor's BGP port\n"
    3130             :        "TCP port number\n")
    3131             : {
    3132           0 :   return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
    3133             : }
    3134             : 
    3135           0 : DEFUN (no_neighbor_port,
    3136             :        no_neighbor_port_cmd,
    3137             :        NO_NEIGHBOR_CMD "port",
    3138             :        NO_STR
    3139             :        NEIGHBOR_STR
    3140             :        NEIGHBOR_ADDR_STR
    3141             :        "Neighbor's BGP port\n")
    3142             : {
    3143           0 :   return peer_port_vty (vty, argv[0], AFI_IP, NULL);
    3144             : }
    3145             : 
    3146             : ALIAS (no_neighbor_port,
    3147             :        no_neighbor_port_val_cmd,
    3148             :        NO_NEIGHBOR_CMD "port <0-65535>",
    3149             :        NO_STR
    3150             :        NEIGHBOR_STR
    3151             :        NEIGHBOR_ADDR_STR
    3152             :        "Neighbor's BGP port\n"
    3153             :        "TCP port number\n")
    3154             : 
    3155             : /* neighbor weight. */
    3156             : static int
    3157           0 : peer_weight_set_vty (struct vty *vty, const char *ip_str, 
    3158             :                      const char *weight_str)
    3159             : {
    3160             :   int ret;
    3161             :   struct peer *peer;
    3162             :   unsigned long weight;
    3163             : 
    3164           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3165           0 :   if (! peer)
    3166           0 :     return CMD_WARNING;
    3167             : 
    3168           0 :   VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
    3169             : 
    3170           0 :   ret = peer_weight_set (peer, weight);
    3171             : 
    3172           0 :   return CMD_SUCCESS;
    3173             : }
    3174             : 
    3175             : static int
    3176           0 : peer_weight_unset_vty (struct vty *vty, const char *ip_str)
    3177             : {
    3178             :   struct peer *peer;
    3179             : 
    3180           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3181           0 :   if (! peer)
    3182           0 :     return CMD_WARNING;
    3183             : 
    3184           0 :   peer_weight_unset (peer);
    3185             : 
    3186           0 :   return CMD_SUCCESS;
    3187             : }
    3188             : 
    3189           0 : DEFUN (neighbor_weight,
    3190             :        neighbor_weight_cmd,
    3191             :        NEIGHBOR_CMD2 "weight <0-65535>",
    3192             :        NEIGHBOR_STR
    3193             :        NEIGHBOR_ADDR_STR2
    3194             :        "Set default weight for routes from this neighbor\n"
    3195             :        "default weight\n")
    3196             : {
    3197           0 :   return peer_weight_set_vty (vty, argv[0], argv[1]);
    3198             : }
    3199             : 
    3200           0 : DEFUN (no_neighbor_weight,
    3201             :        no_neighbor_weight_cmd,
    3202             :        NO_NEIGHBOR_CMD2 "weight",
    3203             :        NO_STR
    3204             :        NEIGHBOR_STR
    3205             :        NEIGHBOR_ADDR_STR2
    3206             :        "Set default weight for routes from this neighbor\n")
    3207             : {
    3208           0 :   return peer_weight_unset_vty (vty, argv[0]);
    3209             : }
    3210             : 
    3211             : ALIAS (no_neighbor_weight,
    3212             :        no_neighbor_weight_val_cmd,
    3213             :        NO_NEIGHBOR_CMD2 "weight <0-65535>",
    3214             :        NO_STR
    3215             :        NEIGHBOR_STR
    3216             :        NEIGHBOR_ADDR_STR2
    3217             :        "Set default weight for routes from this neighbor\n"
    3218             :        "default weight\n")
    3219             : 
    3220             : /* Override capability negotiation. */
    3221           0 : DEFUN (neighbor_override_capability,
    3222             :        neighbor_override_capability_cmd,
    3223             :        NEIGHBOR_CMD2 "override-capability",
    3224             :        NEIGHBOR_STR
    3225             :        NEIGHBOR_ADDR_STR2
    3226             :        "Override capability negotiation result\n")
    3227             : {
    3228           0 :   return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
    3229             : }
    3230             : 
    3231           0 : DEFUN (no_neighbor_override_capability,
    3232             :        no_neighbor_override_capability_cmd,
    3233             :        NO_NEIGHBOR_CMD2 "override-capability",
    3234             :        NO_STR
    3235             :        NEIGHBOR_STR
    3236             :        NEIGHBOR_ADDR_STR2
    3237             :        "Override capability negotiation result\n")
    3238             : {
    3239           0 :   return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
    3240             : }
    3241             : 
    3242           0 : DEFUN (neighbor_strict_capability,
    3243             :        neighbor_strict_capability_cmd,
    3244             :        NEIGHBOR_CMD "strict-capability-match",
    3245             :        NEIGHBOR_STR
    3246             :        NEIGHBOR_ADDR_STR
    3247             :        "Strict capability negotiation match\n")
    3248             : {
    3249           0 :   return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
    3250             : }
    3251             : 
    3252           0 : DEFUN (no_neighbor_strict_capability,
    3253             :        no_neighbor_strict_capability_cmd,
    3254             :        NO_NEIGHBOR_CMD "strict-capability-match",
    3255             :        NO_STR
    3256             :        NEIGHBOR_STR
    3257             :        NEIGHBOR_ADDR_STR
    3258             :        "Strict capability negotiation match\n")
    3259             : {
    3260           0 :   return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
    3261             : }
    3262             : 
    3263             : static int
    3264           0 : peer_timers_set_vty (struct vty *vty, const char *ip_str, 
    3265             :                      const char *keep_str, const char *hold_str)
    3266             : {
    3267             :   int ret;
    3268             :   struct peer *peer;
    3269             :   u_int32_t keepalive;
    3270             :   u_int32_t holdtime;
    3271             : 
    3272           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3273           0 :   if (! peer)
    3274           0 :     return CMD_WARNING;
    3275             : 
    3276           0 :   VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
    3277           0 :   VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
    3278             : 
    3279           0 :   ret = peer_timers_set (peer, keepalive, holdtime);
    3280             : 
    3281           0 :   return bgp_vty_return (vty, ret);
    3282             : }
    3283             : 
    3284             : static int
    3285           0 : peer_timers_unset_vty (struct vty *vty, const char *ip_str)
    3286             : {
    3287             :   int ret;
    3288             :   struct peer *peer;
    3289             : 
    3290           0 :   peer = peer_lookup_vty (vty, ip_str);
    3291           0 :   if (! peer)
    3292           0 :     return CMD_WARNING;
    3293             : 
    3294           0 :   ret = peer_timers_unset (peer);
    3295             : 
    3296           0 :   return bgp_vty_return (vty, ret);
    3297             : }
    3298             : 
    3299           0 : DEFUN (neighbor_timers,
    3300             :        neighbor_timers_cmd,
    3301             :        NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
    3302             :        NEIGHBOR_STR
    3303             :        NEIGHBOR_ADDR_STR2
    3304             :        "BGP per neighbor timers\n"
    3305             :        "Keepalive interval\n"
    3306             :        "Holdtime\n")
    3307             : {
    3308           0 :   return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
    3309             : }
    3310             : 
    3311           0 : DEFUN (no_neighbor_timers,
    3312             :        no_neighbor_timers_cmd,
    3313             :        NO_NEIGHBOR_CMD2 "timers",
    3314             :        NO_STR
    3315             :        NEIGHBOR_STR
    3316             :        NEIGHBOR_ADDR_STR2
    3317             :        "BGP per neighbor timers\n")
    3318             : {
    3319           0 :   return peer_timers_unset_vty (vty, argv[0]);
    3320             : }
    3321             : 
    3322             : static int
    3323           0 : peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, 
    3324             :                              const char *time_str)
    3325             : {
    3326             :   int ret;
    3327             :   struct peer *peer;
    3328             :   u_int32_t connect;
    3329             : 
    3330           0 :   peer = peer_lookup_vty (vty, ip_str);
    3331           0 :   if (! peer)
    3332           0 :     return CMD_WARNING;
    3333             : 
    3334           0 :   VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
    3335             : 
    3336           0 :   ret = peer_timers_connect_set (peer, connect);
    3337             : 
    3338           0 :   return CMD_SUCCESS;
    3339             : }
    3340             : 
    3341             : static int
    3342           0 : peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
    3343             : {
    3344             :   int ret;
    3345             :   struct peer *peer;
    3346             : 
    3347           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3348           0 :   if (! peer)
    3349           0 :     return CMD_WARNING;
    3350             : 
    3351           0 :   ret = peer_timers_connect_unset (peer);
    3352             : 
    3353           0 :   return CMD_SUCCESS;
    3354             : }
    3355             : 
    3356           0 : DEFUN (neighbor_timers_connect,
    3357             :        neighbor_timers_connect_cmd,
    3358             :        NEIGHBOR_CMD "timers connect <0-65535>",
    3359             :        NEIGHBOR_STR
    3360             :        NEIGHBOR_ADDR_STR
    3361             :        "BGP per neighbor timers\n"
    3362             :        "BGP connect timer\n"
    3363             :        "Connect timer\n")
    3364             : {
    3365           0 :   return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
    3366             : }
    3367             : 
    3368           0 : DEFUN (no_neighbor_timers_connect,
    3369             :        no_neighbor_timers_connect_cmd,
    3370             :        NO_NEIGHBOR_CMD "timers connect",
    3371             :        NO_STR
    3372             :        NEIGHBOR_STR
    3373             :        NEIGHBOR_ADDR_STR
    3374             :        "BGP per neighbor timers\n"
    3375             :        "BGP connect timer\n")
    3376             : {
    3377           0 :   return peer_timers_connect_unset_vty (vty, argv[0]);
    3378             : }
    3379             : 
    3380             : ALIAS (no_neighbor_timers_connect,
    3381             :        no_neighbor_timers_connect_val_cmd,
    3382             :        NO_NEIGHBOR_CMD "timers connect <0-65535>",
    3383             :        NO_STR
    3384             :        NEIGHBOR_STR
    3385             :        NEIGHBOR_ADDR_STR
    3386             :        "BGP per neighbor timers\n"
    3387             :        "BGP connect timer\n"
    3388             :        "Connect timer\n")
    3389             : 
    3390             : static int
    3391           0 : peer_advertise_interval_vty (struct vty *vty, const char *ip_str, 
    3392             :                              const char *time_str, int set)  
    3393             : {
    3394             :   int ret;
    3395             :   struct peer *peer;
    3396           0 :   u_int32_t routeadv = 0;
    3397             : 
    3398           0 :   peer = peer_lookup_vty (vty, ip_str);
    3399           0 :   if (! peer)
    3400           0 :     return CMD_WARNING;
    3401             : 
    3402           0 :   if (time_str)
    3403           0 :     VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
    3404             : 
    3405           0 :   if (set)
    3406           0 :     ret = peer_advertise_interval_set (peer, routeadv);
    3407             :   else
    3408           0 :     ret = peer_advertise_interval_unset (peer);
    3409             : 
    3410           0 :   return CMD_SUCCESS;
    3411             : }
    3412             : 
    3413           0 : DEFUN (neighbor_advertise_interval,
    3414             :        neighbor_advertise_interval_cmd,
    3415             :        NEIGHBOR_CMD "advertisement-interval <0-600>",
    3416             :        NEIGHBOR_STR
    3417             :        NEIGHBOR_ADDR_STR
    3418             :        "Minimum interval between sending BGP routing updates\n"
    3419             :        "time in seconds\n")
    3420             : {
    3421           0 :   return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
    3422             : }
    3423             : 
    3424           0 : DEFUN (no_neighbor_advertise_interval,
    3425             :        no_neighbor_advertise_interval_cmd,
    3426             :        NO_NEIGHBOR_CMD "advertisement-interval",
    3427             :        NO_STR
    3428             :        NEIGHBOR_STR
    3429             :        NEIGHBOR_ADDR_STR
    3430             :        "Minimum interval between sending BGP routing updates\n")
    3431             : {
    3432           0 :   return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
    3433             : }
    3434             : 
    3435             : ALIAS (no_neighbor_advertise_interval,
    3436             :        no_neighbor_advertise_interval_val_cmd,
    3437             :        NO_NEIGHBOR_CMD "advertisement-interval <0-600>",
    3438             :        NO_STR
    3439             :        NEIGHBOR_STR
    3440             :        NEIGHBOR_ADDR_STR
    3441             :        "Minimum interval between sending BGP routing updates\n"
    3442             :        "time in seconds\n")
    3443             : 
    3444             : /* neighbor interface */
    3445             : static int
    3446           0 : peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
    3447             : {
    3448             :   int ret;
    3449             :   struct peer *peer;
    3450             : 
    3451           0 :   peer = peer_lookup_vty (vty, ip_str);
    3452           0 :   if (! peer)
    3453           0 :     return CMD_WARNING;
    3454             : 
    3455           0 :   if (str)
    3456           0 :     ret = peer_interface_set (peer, str);
    3457             :   else
    3458           0 :     ret = peer_interface_unset (peer);
    3459             : 
    3460           0 :   return CMD_SUCCESS;
    3461             : }
    3462             : 
    3463           0 : DEFUN (neighbor_interface,
    3464             :        neighbor_interface_cmd,
    3465             :        NEIGHBOR_CMD "interface WORD",
    3466             :        NEIGHBOR_STR
    3467             :        NEIGHBOR_ADDR_STR
    3468             :        "Interface\n"
    3469             :        "Interface name\n")
    3470             : {
    3471           0 :   return peer_interface_vty (vty, argv[0], argv[1]);
    3472             : }
    3473             : 
    3474           0 : DEFUN (no_neighbor_interface,
    3475             :        no_neighbor_interface_cmd,
    3476             :        NO_NEIGHBOR_CMD "interface WORD",
    3477             :        NO_STR
    3478             :        NEIGHBOR_STR
    3479             :        NEIGHBOR_ADDR_STR
    3480             :        "Interface\n"
    3481             :        "Interface name\n")
    3482             : {
    3483           0 :   return peer_interface_vty (vty, argv[0], NULL);
    3484             : }
    3485             : 
    3486             : /* Set distribute list to the peer. */
    3487             : static int
    3488           0 : peer_distribute_set_vty (struct vty *vty, const char *ip_str, 
    3489             :                          afi_t afi, safi_t safi,
    3490             :                          const char *name_str, const char *direct_str)
    3491             : {
    3492             :   int ret;
    3493             :   struct peer *peer;
    3494           0 :   int direct = FILTER_IN;
    3495             : 
    3496           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3497           0 :   if (! peer)
    3498           0 :     return CMD_WARNING;
    3499             : 
    3500             :   /* Check filter direction. */
    3501           0 :   if (strncmp (direct_str, "i", 1) == 0)
    3502           0 :     direct = FILTER_IN;
    3503           0 :   else if (strncmp (direct_str, "o", 1) == 0)
    3504           0 :     direct = FILTER_OUT;
    3505             : 
    3506           0 :   ret = peer_distribute_set (peer, afi, safi, direct, name_str);
    3507             : 
    3508           0 :   return bgp_vty_return (vty, ret);
    3509             : }
    3510             : 
    3511             : static int
    3512           0 : peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
    3513             :                            safi_t safi, const char *direct_str)
    3514             : {
    3515             :   int ret;
    3516             :   struct peer *peer;
    3517           0 :   int direct = FILTER_IN;
    3518             : 
    3519           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3520           0 :   if (! peer)
    3521           0 :     return CMD_WARNING;
    3522             : 
    3523             :   /* Check filter direction. */
    3524           0 :   if (strncmp (direct_str, "i", 1) == 0)
    3525           0 :     direct = FILTER_IN;
    3526           0 :   else if (strncmp (direct_str, "o", 1) == 0)
    3527           0 :     direct = FILTER_OUT;
    3528             : 
    3529           0 :   ret = peer_distribute_unset (peer, afi, safi, direct);
    3530             : 
    3531           0 :   return bgp_vty_return (vty, ret);
    3532             : }
    3533             : 
    3534           0 : DEFUN (neighbor_distribute_list,
    3535             :        neighbor_distribute_list_cmd,
    3536             :        NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
    3537             :        NEIGHBOR_STR
    3538             :        NEIGHBOR_ADDR_STR2
    3539             :        "Filter updates to/from this neighbor\n"
    3540             :        "IP access-list number\n"
    3541             :        "IP access-list number (expanded range)\n"
    3542             :        "IP Access-list name\n"
    3543             :        "Filter incoming updates\n"
    3544             :        "Filter outgoing updates\n")
    3545             : {
    3546           0 :   return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
    3547           0 :                                   bgp_node_safi (vty), argv[1], argv[2]);
    3548             : }
    3549             : 
    3550           0 : DEFUN (no_neighbor_distribute_list,
    3551             :        no_neighbor_distribute_list_cmd,
    3552             :        NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
    3553             :        NO_STR
    3554             :        NEIGHBOR_STR
    3555             :        NEIGHBOR_ADDR_STR2
    3556             :        "Filter updates to/from this neighbor\n"
    3557             :        "IP access-list number\n"
    3558             :        "IP access-list number (expanded range)\n"
    3559             :        "IP Access-list name\n"
    3560             :        "Filter incoming updates\n"
    3561             :        "Filter outgoing updates\n")
    3562             : {
    3563           0 :   return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
    3564           0 :                                     bgp_node_safi (vty), argv[2]);
    3565             : }
    3566             : 
    3567             : /* Set prefix list to the peer. */
    3568             : static int
    3569           0 : peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
    3570             :                           safi_t safi, const char *name_str, 
    3571             :                           const char *direct_str)
    3572             : {
    3573             :   int ret;
    3574             :   struct peer *peer;
    3575           0 :   int direct = FILTER_IN;
    3576             : 
    3577           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3578           0 :   if (! peer)
    3579           0 :     return CMD_WARNING;
    3580             : 
    3581             :   /* Check filter direction. */
    3582           0 :   if (strncmp (direct_str, "i", 1) == 0)
    3583           0 :     direct = FILTER_IN;
    3584           0 :   else if (strncmp (direct_str, "o", 1) == 0)
    3585           0 :     direct = FILTER_OUT;
    3586             : 
    3587           0 :   ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
    3588             : 
    3589           0 :   return bgp_vty_return (vty, ret);
    3590             : }
    3591             : 
    3592             : static int
    3593           0 : peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
    3594             :                             safi_t safi, const char *direct_str)
    3595             : {
    3596             :   int ret;
    3597             :   struct peer *peer;
    3598           0 :   int direct = FILTER_IN;
    3599             : 
    3600           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3601           0 :   if (! peer)
    3602           0 :     return CMD_WARNING;
    3603             :   
    3604             :   /* Check filter direction. */
    3605           0 :   if (strncmp (direct_str, "i", 1) == 0)
    3606           0 :     direct = FILTER_IN;
    3607           0 :   else if (strncmp (direct_str, "o", 1) == 0)
    3608           0 :     direct = FILTER_OUT;
    3609             : 
    3610           0 :   ret = peer_prefix_list_unset (peer, afi, safi, direct);
    3611             : 
    3612           0 :   return bgp_vty_return (vty, ret);
    3613             : }
    3614             : 
    3615           0 : DEFUN (neighbor_prefix_list,
    3616             :        neighbor_prefix_list_cmd,
    3617             :        NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
    3618             :        NEIGHBOR_STR
    3619             :        NEIGHBOR_ADDR_STR2
    3620             :        "Filter updates to/from this neighbor\n"
    3621             :        "Name of a prefix list\n"
    3622             :        "Filter incoming updates\n"
    3623             :        "Filter outgoing updates\n")
    3624             : {
    3625           0 :   return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
    3626           0 :                                    bgp_node_safi (vty), argv[1], argv[2]);
    3627             : }
    3628             : 
    3629           0 : DEFUN (no_neighbor_prefix_list,
    3630             :        no_neighbor_prefix_list_cmd,
    3631             :        NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
    3632             :        NO_STR
    3633             :        NEIGHBOR_STR
    3634             :        NEIGHBOR_ADDR_STR2
    3635             :        "Filter updates to/from this neighbor\n"
    3636             :        "Name of a prefix list\n"
    3637             :        "Filter incoming updates\n"
    3638             :        "Filter outgoing updates\n")
    3639             : {
    3640           0 :   return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
    3641           0 :                                      bgp_node_safi (vty), argv[2]);
    3642             : }
    3643             : 
    3644             : static int
    3645           0 : peer_aslist_set_vty (struct vty *vty, const char *ip_str, 
    3646             :                      afi_t afi, safi_t safi,
    3647             :                      const char *name_str, const char *direct_str)
    3648             : {
    3649             :   int ret;
    3650             :   struct peer *peer;
    3651           0 :   int direct = FILTER_IN;
    3652             : 
    3653           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3654           0 :   if (! peer)
    3655           0 :     return CMD_WARNING;
    3656             : 
    3657             :   /* Check filter direction. */
    3658           0 :   if (strncmp (direct_str, "i", 1) == 0)
    3659           0 :     direct = FILTER_IN;
    3660           0 :   else if (strncmp (direct_str, "o", 1) == 0)
    3661           0 :     direct = FILTER_OUT;
    3662             : 
    3663           0 :   ret = peer_aslist_set (peer, afi, safi, direct, name_str);
    3664             : 
    3665           0 :   return bgp_vty_return (vty, ret);
    3666             : }
    3667             : 
    3668             : static int
    3669           0 : peer_aslist_unset_vty (struct vty *vty, const char *ip_str, 
    3670             :                        afi_t afi, safi_t safi,
    3671             :                        const char *direct_str)
    3672             : {
    3673             :   int ret;
    3674             :   struct peer *peer;
    3675           0 :   int direct = FILTER_IN;
    3676             : 
    3677           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3678           0 :   if (! peer)
    3679           0 :     return CMD_WARNING;
    3680             : 
    3681             :   /* Check filter direction. */
    3682           0 :   if (strncmp (direct_str, "i", 1) == 0)
    3683           0 :     direct = FILTER_IN;
    3684           0 :   else if (strncmp (direct_str, "o", 1) == 0)
    3685           0 :     direct = FILTER_OUT;
    3686             : 
    3687           0 :   ret = peer_aslist_unset (peer, afi, safi, direct);
    3688             : 
    3689           0 :   return bgp_vty_return (vty, ret);
    3690             : }
    3691             : 
    3692           0 : DEFUN (neighbor_filter_list,
    3693             :        neighbor_filter_list_cmd,
    3694             :        NEIGHBOR_CMD2 "filter-list WORD (in|out)",
    3695             :        NEIGHBOR_STR
    3696             :        NEIGHBOR_ADDR_STR2
    3697             :        "Establish BGP filters\n"
    3698             :        "AS path access-list name\n"
    3699             :        "Filter incoming routes\n"
    3700             :        "Filter outgoing routes\n")
    3701             : {
    3702           0 :   return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
    3703           0 :                               bgp_node_safi (vty), argv[1], argv[2]);
    3704             : }
    3705             : 
    3706           0 : DEFUN (no_neighbor_filter_list,
    3707             :        no_neighbor_filter_list_cmd,
    3708             :        NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
    3709             :        NO_STR
    3710             :        NEIGHBOR_STR
    3711             :        NEIGHBOR_ADDR_STR2
    3712             :        "Establish BGP filters\n"
    3713             :        "AS path access-list name\n"
    3714             :        "Filter incoming routes\n"
    3715             :        "Filter outgoing routes\n")
    3716             : {
    3717           0 :   return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
    3718           0 :                                 bgp_node_safi (vty), argv[2]);
    3719             : }
    3720             : 
    3721             : /* Set route-map to the peer. */
    3722             : static int
    3723           0 : peer_route_map_set_vty (struct vty *vty, const char *ip_str, 
    3724             :                         afi_t afi, safi_t safi,
    3725             :                         const char *name_str, const char *direct_str)
    3726             : {
    3727             :   int ret;
    3728             :   struct peer *peer;
    3729           0 :   int direct = RMAP_IN;
    3730             : 
    3731           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3732           0 :   if (! peer)
    3733           0 :     return CMD_WARNING;
    3734             : 
    3735             :   /* Check filter direction. */
    3736           0 :   if (strncmp (direct_str, "in", 2) == 0)
    3737           0 :     direct = RMAP_IN;
    3738           0 :   else if (strncmp (direct_str, "o", 1) == 0)
    3739           0 :     direct = RMAP_OUT;
    3740           0 :   else if (strncmp (direct_str, "im", 2) == 0)
    3741           0 :     direct = RMAP_IMPORT;
    3742           0 :   else if (strncmp (direct_str, "e", 1) == 0)
    3743           0 :     direct = RMAP_EXPORT;
    3744             : 
    3745           0 :   ret = peer_route_map_set (peer, afi, safi, direct, name_str);
    3746             : 
    3747           0 :   return bgp_vty_return (vty, ret);
    3748             : }
    3749             : 
    3750             : static int
    3751           0 : peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
    3752             :                           safi_t safi, const char *direct_str)
    3753             : {
    3754             :   int ret;
    3755             :   struct peer *peer;
    3756           0 :   int direct = RMAP_IN;
    3757             : 
    3758           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3759           0 :   if (! peer)
    3760           0 :     return CMD_WARNING;
    3761             : 
    3762             :   /* Check filter direction. */
    3763           0 :   if (strncmp (direct_str, "in", 2) == 0)
    3764           0 :     direct = RMAP_IN;
    3765           0 :   else if (strncmp (direct_str, "o", 1) == 0)
    3766           0 :     direct = RMAP_OUT;
    3767           0 :   else if (strncmp (direct_str, "im", 2) == 0)
    3768           0 :     direct = RMAP_IMPORT;
    3769           0 :   else if (strncmp (direct_str, "e", 1) == 0)
    3770           0 :     direct = RMAP_EXPORT;
    3771             : 
    3772           0 :   ret = peer_route_map_unset (peer, afi, safi, direct);
    3773             : 
    3774           0 :   return bgp_vty_return (vty, ret);
    3775             : }
    3776             : 
    3777           0 : DEFUN (neighbor_route_map,
    3778             :        neighbor_route_map_cmd,
    3779             :        NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
    3780             :        NEIGHBOR_STR
    3781             :        NEIGHBOR_ADDR_STR2
    3782             :        "Apply route map to neighbor\n"
    3783             :        "Name of route map\n"
    3784             :        "Apply map to incoming routes\n"
    3785             :        "Apply map to outbound routes\n"
    3786             :        "Apply map to routes going into a Route-Server client's table\n"
    3787             :        "Apply map to routes coming from a Route-Server client")
    3788             : {
    3789           0 :   return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
    3790           0 :                                  bgp_node_safi (vty), argv[1], argv[2]);
    3791             : }
    3792             : 
    3793           0 : DEFUN (no_neighbor_route_map,
    3794             :        no_neighbor_route_map_cmd,
    3795             :        NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
    3796             :        NO_STR
    3797             :        NEIGHBOR_STR
    3798             :        NEIGHBOR_ADDR_STR2
    3799             :        "Apply route map to neighbor\n"
    3800             :        "Name of route map\n"
    3801             :        "Apply map to incoming routes\n"
    3802             :        "Apply map to outbound routes\n"
    3803             :        "Apply map to routes going into a Route-Server client's table\n"
    3804             :        "Apply map to routes coming from a Route-Server client")
    3805             : {
    3806           0 :   return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
    3807           0 :                                    bgp_node_safi (vty), argv[2]);
    3808             : }
    3809             : 
    3810             : /* Set unsuppress-map to the peer. */
    3811             : static int
    3812           0 : peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
    3813             :                              safi_t safi, const char *name_str)
    3814             : {
    3815             :   int ret;
    3816             :   struct peer *peer;
    3817             : 
    3818           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3819           0 :   if (! peer)
    3820           0 :     return CMD_WARNING;
    3821             : 
    3822           0 :   ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
    3823             : 
    3824           0 :   return bgp_vty_return (vty, ret);
    3825             : }
    3826             : 
    3827             : /* Unset route-map from the peer. */
    3828             : static int
    3829           0 : peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
    3830             :                                safi_t safi)
    3831             : {
    3832             :   int ret;
    3833             :   struct peer *peer;
    3834             : 
    3835           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3836           0 :   if (! peer)
    3837           0 :     return CMD_WARNING;
    3838             : 
    3839           0 :   ret = peer_unsuppress_map_unset (peer, afi, safi);
    3840             : 
    3841           0 :   return bgp_vty_return (vty, ret);
    3842             : }
    3843             : 
    3844           0 : DEFUN (neighbor_unsuppress_map,
    3845             :        neighbor_unsuppress_map_cmd,
    3846             :        NEIGHBOR_CMD2 "unsuppress-map WORD",
    3847             :        NEIGHBOR_STR
    3848             :        NEIGHBOR_ADDR_STR2
    3849             :        "Route-map to selectively unsuppress suppressed routes\n"
    3850             :        "Name of route map\n")
    3851             : {
    3852           0 :   return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
    3853           0 :                                       bgp_node_safi (vty), argv[1]);
    3854             : }
    3855             : 
    3856           0 : DEFUN (no_neighbor_unsuppress_map,
    3857             :        no_neighbor_unsuppress_map_cmd,
    3858             :        NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
    3859             :        NO_STR
    3860             :        NEIGHBOR_STR
    3861             :        NEIGHBOR_ADDR_STR2
    3862             :        "Route-map to selectively unsuppress suppressed routes\n"
    3863             :        "Name of route map\n")
    3864             : {
    3865           0 :   return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
    3866           0 :                                         bgp_node_safi (vty));
    3867             : }
    3868             : 
    3869             : static int
    3870           0 : peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
    3871             :                              safi_t safi, const char *num_str,  
    3872             :                              const char *threshold_str, int warning,
    3873             :                              const char *restart_str)
    3874             : {
    3875             :   int ret;
    3876             :   struct peer *peer;
    3877             :   u_int32_t max;
    3878             :   u_char threshold;
    3879             :   u_int16_t restart;
    3880             : 
    3881           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3882           0 :   if (! peer)
    3883           0 :     return CMD_WARNING;
    3884             : 
    3885           0 :   VTY_GET_INTEGER ("maximum number", max, num_str);
    3886           0 :   if (threshold_str)
    3887           0 :     threshold = atoi (threshold_str);
    3888             :   else
    3889           0 :     threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
    3890             : 
    3891           0 :   if (restart_str)
    3892           0 :     restart = atoi (restart_str);
    3893             :   else
    3894           0 :     restart = 0;
    3895             : 
    3896           0 :   ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
    3897             : 
    3898           0 :   return bgp_vty_return (vty, ret);
    3899             : }
    3900             : 
    3901             : static int
    3902           0 : peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
    3903             :                                safi_t safi)
    3904             : {
    3905             :   int ret;
    3906             :   struct peer *peer;
    3907             : 
    3908           0 :   peer = peer_and_group_lookup_vty (vty, ip_str);
    3909           0 :   if (! peer)
    3910           0 :     return CMD_WARNING;
    3911             : 
    3912           0 :   ret = peer_maximum_prefix_unset (peer, afi, safi);
    3913             : 
    3914           0 :   return bgp_vty_return (vty, ret);
    3915             : }
    3916             : 
    3917             : /* Maximum number of prefix configuration.  prefix count is different
    3918             :    for each peer configuration.  So this configuration can be set for
    3919             :    each peer configuration. */
    3920           0 : DEFUN (neighbor_maximum_prefix,
    3921             :        neighbor_maximum_prefix_cmd,
    3922             :        NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
    3923             :        NEIGHBOR_STR
    3924             :        NEIGHBOR_ADDR_STR2
    3925             :        "Maximum number of prefix accept from this peer\n"
    3926             :        "maximum no. of prefix limit\n")
    3927             : {
    3928           0 :   return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
    3929           0 :                                       bgp_node_safi (vty), argv[1], NULL, 0,
    3930             :                                       NULL);
    3931             : }
    3932             : 
    3933           0 : DEFUN (neighbor_maximum_prefix_threshold,
    3934             :        neighbor_maximum_prefix_threshold_cmd,
    3935             :        NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
    3936             :        NEIGHBOR_STR
    3937             :        NEIGHBOR_ADDR_STR2
    3938             :        "Maximum number of prefix accept from this peer\n"
    3939             :        "maximum no. of prefix limit\n"
    3940             :        "Threshold value (%) at which to generate a warning msg\n")
    3941             : {
    3942           0 :   return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
    3943           0 :                                       bgp_node_safi (vty), argv[1], argv[2], 0,
    3944             :                                       NULL);
    3945             : }
    3946             : 
    3947           0 : DEFUN (neighbor_maximum_prefix_warning,
    3948             :        neighbor_maximum_prefix_warning_cmd,
    3949             :        NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
    3950             :        NEIGHBOR_STR
    3951             :        NEIGHBOR_ADDR_STR2
    3952             :        "Maximum number of prefix accept from this peer\n"
    3953             :        "maximum no. of prefix limit\n"
    3954             :        "Only give warning message when limit is exceeded\n")
    3955             : {
    3956           0 :   return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
    3957           0 :                                       bgp_node_safi (vty), argv[1], NULL, 1,
    3958             :                                       NULL);
    3959             : }
    3960             : 
    3961           0 : DEFUN (neighbor_maximum_prefix_threshold_warning,
    3962             :        neighbor_maximum_prefix_threshold_warning_cmd,
    3963             :        NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
    3964             :        NEIGHBOR_STR
    3965             :        NEIGHBOR_ADDR_STR2
    3966             :        "Maximum number of prefix accept from this peer\n"
    3967             :        "maximum no. of prefix limit\n"
    3968             :        "Threshold value (%) at which to generate a warning msg\n"
    3969             :        "Only give warning message when limit is exceeded\n")
    3970             : {
    3971           0 :   return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
    3972           0 :                                       bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
    3973             : }
    3974             : 
    3975           0 : DEFUN (neighbor_maximum_prefix_restart,
    3976             :        neighbor_maximum_prefix_restart_cmd,
    3977             :        NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
    3978             :        NEIGHBOR_STR
    3979             :        NEIGHBOR_ADDR_STR2
    3980             :        "Maximum number of prefix accept from this peer\n"
    3981             :        "maximum no. of prefix limit\n"
    3982             :        "Restart bgp connection after limit is exceeded\n"
    3983             :        "Restart interval in minutes")
    3984             : {
    3985           0 :   return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
    3986           0 :                                       bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
    3987             : }
    3988             : 
    3989           0 : DEFUN (neighbor_maximum_prefix_threshold_restart,
    3990             :        neighbor_maximum_prefix_threshold_restart_cmd,
    3991             :        NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
    3992             :        NEIGHBOR_STR
    3993             :        NEIGHBOR_ADDR_STR2
    3994             :        "Maximum number of prefix accept from this peer\n"
    3995             :        "maximum no. of prefix limit\n"
    3996             :        "Threshold value (%) at which to generate a warning msg\n"
    3997             :        "Restart bgp connection after limit is exceeded\n"
    3998             :        "Restart interval in minutes")
    3999             : {
    4000           0 :   return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
    4001           0 :                                       bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
    4002             : }
    4003             : 
    4004           0 : DEFUN (no_neighbor_maximum_prefix,
    4005             :        no_neighbor_maximum_prefix_cmd,
    4006             :        NO_NEIGHBOR_CMD2 "maximum-prefix",
    4007             :        NO_STR
    4008             :        NEIGHBOR_STR
    4009             :        NEIGHBOR_ADDR_STR2
    4010             :        "Maximum number of prefix accept from this peer\n")
    4011             : {
    4012           0 :   return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
    4013           0 :                                         bgp_node_safi (vty));
    4014             : }
    4015             :  
    4016             : ALIAS (no_neighbor_maximum_prefix,
    4017             :        no_neighbor_maximum_prefix_val_cmd,
    4018             :        NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
    4019             :        NO_STR
    4020             :        NEIGHBOR_STR
    4021             :        NEIGHBOR_ADDR_STR2
    4022             :        "Maximum number of prefix accept from this peer\n"
    4023             :        "maximum no. of prefix limit\n")
    4024             : 
    4025             : ALIAS (no_neighbor_maximum_prefix,
    4026             :        no_neighbor_maximum_prefix_threshold_cmd,
    4027             :        NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
    4028             :        NO_STR
    4029             :        NEIGHBOR_STR
    4030             :        NEIGHBOR_ADDR_STR2
    4031             :        "Maximum number of prefix accept from this peer\n"
    4032             :        "maximum no. of prefix limit\n"
    4033             :        "Threshold value (%) at which to generate a warning msg\n")
    4034             : 
    4035             : ALIAS (no_neighbor_maximum_prefix,
    4036             :        no_neighbor_maximum_prefix_warning_cmd,
    4037             :        NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
    4038             :        NO_STR
    4039             :        NEIGHBOR_STR
    4040             :        NEIGHBOR_ADDR_STR2
    4041             :        "Maximum number of prefix accept from this peer\n"
    4042             :        "maximum no. of prefix limit\n"
    4043             :        "Only give warning message when limit is exceeded\n")
    4044             : 
    4045             : ALIAS (no_neighbor_maximum_prefix,
    4046             :        no_neighbor_maximum_prefix_threshold_warning_cmd,
    4047             :        NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
    4048             :        NO_STR
    4049             :        NEIGHBOR_STR
    4050             :        NEIGHBOR_ADDR_STR2
    4051             :        "Maximum number of prefix accept from this peer\n"
    4052             :        "maximum no. of prefix limit\n"
    4053             :        "Threshold value (%) at which to generate a warning msg\n"
    4054             :        "Only give warning message when limit is exceeded\n")
    4055             : 
    4056             : ALIAS (no_neighbor_maximum_prefix,
    4057             :        no_neighbor_maximum_prefix_restart_cmd,
    4058             :        NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
    4059             :        NO_STR
    4060             :        NEIGHBOR_STR
    4061             :        NEIGHBOR_ADDR_STR2
    4062             :        "Maximum number of prefix accept from this peer\n"
    4063             :        "maximum no. of prefix limit\n"
    4064             :        "Restart bgp connection after limit is exceeded\n"
    4065             :        "Restart interval in minutes")
    4066             : 
    4067             : ALIAS (no_neighbor_maximum_prefix,
    4068             :        no_neighbor_maximum_prefix_threshold_restart_cmd,
    4069             :        NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
    4070             :        NO_STR
    4071             :        NEIGHBOR_STR
    4072             :        NEIGHBOR_ADDR_STR2
    4073             :        "Maximum number of prefix accept from this peer\n"
    4074             :        "maximum no. of prefix limit\n"
    4075             :        "Threshold value (%) at which to generate a warning msg\n"
    4076             :        "Restart bgp connection after limit is exceeded\n"
    4077             :        "Restart interval in minutes")
    4078             : 
    4079             : /* "neighbor allowas-in" */
    4080           0 : DEFUN (neighbor_allowas_in,
    4081             :        neighbor_allowas_in_cmd,
    4082             :        NEIGHBOR_CMD2 "allowas-in",
    4083             :        NEIGHBOR_STR
    4084             :        NEIGHBOR_ADDR_STR2
    4085             :        "Accept as-path with my AS present in it\n")
    4086             : {
    4087             :   int ret;
    4088             :   struct peer *peer;
    4089             :   unsigned int allow_num;
    4090             : 
    4091           0 :   peer = peer_and_group_lookup_vty (vty, argv[0]);
    4092           0 :   if (! peer)
    4093           0 :     return CMD_WARNING;
    4094             : 
    4095           0 :   if (argc == 1)
    4096           0 :     allow_num = 3;
    4097             :   else
    4098           0 :     VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
    4099             : 
    4100           0 :   ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
    4101             :                              allow_num);
    4102             : 
    4103           0 :   return bgp_vty_return (vty, ret);
    4104             : }
    4105             : 
    4106             : ALIAS (neighbor_allowas_in,
    4107             :        neighbor_allowas_in_arg_cmd,
    4108             :        NEIGHBOR_CMD2 "allowas-in <1-10>",
    4109             :        NEIGHBOR_STR
    4110             :        NEIGHBOR_ADDR_STR2
    4111             :        "Accept as-path with my AS present in it\n"
    4112             :        "Number of occurances of AS number\n")
    4113             : 
    4114           0 : DEFUN (no_neighbor_allowas_in,
    4115             :        no_neighbor_allowas_in_cmd,
    4116             :        NO_NEIGHBOR_CMD2 "allowas-in",
    4117             :        NO_STR
    4118             :        NEIGHBOR_STR
    4119             :        NEIGHBOR_ADDR_STR2
    4120             :        "allow local ASN appears in aspath attribute\n")
    4121             : {
    4122             :   int ret;
    4123             :   struct peer *peer;
    4124             : 
    4125           0 :   peer = peer_and_group_lookup_vty (vty, argv[0]);
    4126           0 :   if (! peer)
    4127           0 :     return CMD_WARNING;
    4128             : 
    4129           0 :   ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
    4130             : 
    4131           0 :   return bgp_vty_return (vty, ret);
    4132             : }
    4133             : 
    4134           0 : DEFUN (neighbor_ttl_security,
    4135             :        neighbor_ttl_security_cmd,
    4136             :        NEIGHBOR_CMD2 "ttl-security hops <1-254>",
    4137             :        NEIGHBOR_STR
    4138             :        NEIGHBOR_ADDR_STR2
    4139             :        "Specify the maximum number of hops to the BGP peer\n")
    4140             : {
    4141             :   struct peer *peer;
    4142             :   int gtsm_hops;
    4143             : 
    4144           0 :   peer = peer_and_group_lookup_vty (vty, argv[0]);
    4145           0 :   if (! peer)
    4146           0 :     return CMD_WARNING;
    4147             :     
    4148           0 :   VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
    4149             : 
    4150           0 :   return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
    4151             : }
    4152             : 
    4153           0 : DEFUN (no_neighbor_ttl_security,
    4154             :        no_neighbor_ttl_security_cmd,
    4155             :        NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
    4156             :        NO_STR
    4157             :        NEIGHBOR_STR
    4158             :        NEIGHBOR_ADDR_STR2
    4159             :        "Specify the maximum number of hops to the BGP peer\n")
    4160             : {
    4161             :   struct peer *peer;
    4162             : 
    4163           0 :   peer = peer_and_group_lookup_vty (vty, argv[0]);
    4164           0 :   if (! peer)
    4165           0 :     return CMD_WARNING;
    4166             : 
    4167           0 :   return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
    4168             : }
    4169             : 
    4170             : /* Address family configuration.  */
    4171           0 : DEFUN (address_family_ipv4,
    4172             :        address_family_ipv4_cmd,
    4173             :        "address-family ipv4",
    4174             :        "Enter Address Family command mode\n"
    4175             :        "Address family\n")
    4176             : {
    4177           0 :   vty->node = BGP_IPV4_NODE;
    4178           0 :   return CMD_SUCCESS;
    4179             : }
    4180             : 
    4181           0 : DEFUN (address_family_ipv4_safi,
    4182             :        address_family_ipv4_safi_cmd,
    4183             :        "address-family ipv4 (unicast|multicast)",
    4184             :        "Enter Address Family command mode\n"
    4185             :        "Address family\n"
    4186             :        "Address Family modifier\n"
    4187             :        "Address Family modifier\n")
    4188             : {
    4189           0 :   if (strncmp (argv[0], "m", 1) == 0)
    4190           0 :     vty->node = BGP_IPV4M_NODE;
    4191             :   else
    4192           0 :     vty->node = BGP_IPV4_NODE;
    4193             : 
    4194           0 :   return CMD_SUCCESS;
    4195             : }
    4196             : 
    4197           0 : DEFUN (address_family_ipv6,
    4198             :        address_family_ipv6_cmd,
    4199             :        "address-family ipv6",
    4200             :        "Enter Address Family command mode\n"
    4201             :        "Address family\n")
    4202             : {
    4203           0 :   vty->node = BGP_IPV6_NODE;
    4204           0 :   return CMD_SUCCESS;
    4205             : }
    4206             : 
    4207           0 : DEFUN (address_family_ipv6_safi,
    4208             :        address_family_ipv6_safi_cmd,
    4209             :        "address-family ipv6 (unicast|multicast)",
    4210             :        "Enter Address Family command mode\n"
    4211             :        "Address family\n"
    4212             :        "Address Family modifier\n"
    4213             :        "Address Family modifier\n")
    4214             : {
    4215           0 :   if (strncmp (argv[0], "m", 1) == 0)
    4216           0 :     vty->node = BGP_IPV6M_NODE;
    4217             :   else
    4218           0 :     vty->node = BGP_IPV6_NODE;
    4219             : 
    4220           0 :   return CMD_SUCCESS;
    4221             : }
    4222             : 
    4223           0 : DEFUN (address_family_vpnv4,
    4224             :        address_family_vpnv4_cmd,
    4225             :        "address-family vpnv4",
    4226             :        "Enter Address Family command mode\n"
    4227             :        "Address family\n")
    4228             : {
    4229           0 :   vty->node = BGP_VPNV4_NODE;
    4230           0 :   return CMD_SUCCESS;
    4231             : }
    4232             : 
    4233             : ALIAS (address_family_vpnv4,
    4234             :        address_family_vpnv4_unicast_cmd,
    4235             :        "address-family vpnv4 unicast",
    4236             :        "Enter Address Family command mode\n"
    4237             :        "Address family\n"
    4238             :        "Address Family Modifier\n")
    4239             : 
    4240           0 : DEFUN (exit_address_family,
    4241             :        exit_address_family_cmd,
    4242             :        "exit-address-family",
    4243             :        "Exit from Address Family configuration mode\n")
    4244             : {
    4245           0 :   if (vty->node == BGP_IPV4_NODE
    4246           0 :       || vty->node == BGP_IPV4M_NODE
    4247           0 :       || vty->node == BGP_VPNV4_NODE
    4248           0 :       || vty->node == BGP_IPV6_NODE
    4249           0 :       || vty->node == BGP_IPV6M_NODE)
    4250           0 :     vty->node = BGP_NODE;
    4251           0 :   return CMD_SUCCESS;
    4252             : }
    4253             : 
    4254             : /* BGP clear sort. */
    4255             : enum clear_sort
    4256             : {
    4257             :   clear_all,
    4258             :   clear_peer,
    4259             :   clear_group,
    4260             :   clear_external,
    4261             :   clear_as
    4262             : };
    4263             : 
    4264             : static void
    4265           0 : bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
    4266             :                      safi_t safi, int error)
    4267             : {
    4268           0 :   switch (error)
    4269             :     {
    4270             :     case BGP_ERR_AF_UNCONFIGURED:
    4271           0 :       vty_out (vty,
    4272             :                "%%BGP: Enable %s %s address family for the neighbor %s%s",
    4273           0 :                afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
    4274             :                safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
    4275           0 :                peer->host, VTY_NEWLINE);
    4276           0 :       break;
    4277             :     case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
    4278           0 :       vty_out (vty, "%%BGP: Inbound soft reconfig for %s not possible as it%s      has neither refresh capability, nor inbound soft reconfig%s", peer->host, VTY_NEWLINE, VTY_NEWLINE);
    4279           0 :       break;
    4280             :     default:
    4281           0 :       break;
    4282             :     }
    4283           0 : }
    4284             : 
    4285             : /* `clear ip bgp' functions. */
    4286             : static int
    4287           0 : bgp_clear (struct vty *vty, struct bgp *bgp,  afi_t afi, safi_t safi,
    4288             :            enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
    4289             : {
    4290             :   int ret;
    4291             :   struct peer *peer;
    4292             :   struct listnode *node, *nnode;
    4293             : 
    4294             :   /* Clear all neighbors. */
    4295           0 :   if (sort == clear_all)
    4296             :     {
    4297           0 :       for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
    4298             :         {
    4299           0 :           if (stype == BGP_CLEAR_SOFT_NONE)
    4300           0 :             ret = peer_clear (peer);
    4301             :           else
    4302           0 :             ret = peer_clear_soft (peer, afi, safi, stype);
    4303             : 
    4304           0 :           if (ret < 0)
    4305           0 :             bgp_clear_vty_error (vty, peer, afi, safi, ret);
    4306             :         }
    4307           0 :       return CMD_SUCCESS;
    4308             :     }
    4309             : 
    4310             :   /* Clear specified neighbors. */
    4311           0 :   if (sort == clear_peer)
    4312             :     {
    4313             :       union sockunion su;
    4314             :       int ret;
    4315             : 
    4316             :       /* Make sockunion for lookup. */
    4317           0 :       ret = str2sockunion (arg, &su);
    4318           0 :       if (ret < 0)
    4319             :         {
    4320           0 :           vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
    4321           0 :           return CMD_WARNING;
    4322             :         }
    4323           0 :       peer = peer_lookup (bgp, &su);
    4324           0 :       if (! peer)
    4325             :         {
    4326           0 :           vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
    4327           0 :           return CMD_WARNING;
    4328             :         }
    4329             : 
    4330           0 :       if (stype == BGP_CLEAR_SOFT_NONE)
    4331           0 :         ret = peer_clear (peer);
    4332             :       else
    4333           0 :         ret = peer_clear_soft (peer, afi, safi, stype);
    4334             : 
    4335           0 :       if (ret < 0)
    4336           0 :         bgp_clear_vty_error (vty, peer, afi, safi, ret);
    4337             : 
    4338           0 :       return CMD_SUCCESS;
    4339             :     }
    4340             : 
    4341             :   /* Clear all peer-group members. */
    4342           0 :   if (sort == clear_group)
    4343             :     {
    4344             :       struct peer_group *group;
    4345             : 
    4346           0 :       group = peer_group_lookup (bgp, arg);
    4347           0 :       if (! group)
    4348             :         {
    4349           0 :           vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
    4350           0 :           return CMD_WARNING; 
    4351             :         }
    4352             : 
    4353           0 :       for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
    4354             :         {
    4355           0 :           if (stype == BGP_CLEAR_SOFT_NONE)
    4356             :             {
    4357           0 :               ret = peer_clear (peer);
    4358           0 :               continue;
    4359             :             }
    4360             : 
    4361           0 :           if (! peer->af_group[afi][safi])
    4362           0 :             continue;
    4363             : 
    4364           0 :           ret = peer_clear_soft (peer, afi, safi, stype);
    4365             : 
    4366           0 :           if (ret < 0)
    4367           0 :             bgp_clear_vty_error (vty, peer, afi, safi, ret);
    4368             :         }
    4369           0 :       return CMD_SUCCESS;
    4370             :     }
    4371             : 
    4372           0 :   if (sort == clear_external)
    4373             :     {
    4374           0 :       for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
    4375             :         {
    4376           0 :           if (peer->sort == BGP_PEER_IBGP)
    4377           0 :             continue;
    4378             : 
    4379           0 :           if (stype == BGP_CLEAR_SOFT_NONE)
    4380           0 :             ret = peer_clear (peer);
    4381             :           else
    4382           0 :             ret = peer_clear_soft (peer, afi, safi, stype);
    4383             : 
    4384           0 :           if (ret < 0)
    4385           0 :             bgp_clear_vty_error (vty, peer, afi, safi, ret);
    4386             :         }
    4387           0 :       return CMD_SUCCESS;
    4388             :     }
    4389             : 
    4390           0 :   if (sort == clear_as)
    4391             :     {
    4392             :       as_t as;
    4393           0 :       int find = 0;
    4394             : 
    4395           0 :       VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
    4396             :       
    4397           0 :       for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
    4398             :         {
    4399           0 :           if (peer->as != as) 
    4400           0 :             continue;
    4401             : 
    4402           0 :           find = 1;
    4403           0 :           if (stype == BGP_CLEAR_SOFT_NONE)
    4404           0 :             ret = peer_clear (peer);
    4405             :           else
    4406           0 :             ret = peer_clear_soft (peer, afi, safi, stype);
    4407             : 
    4408           0 :           if (ret < 0)
    4409           0 :             bgp_clear_vty_error (vty, peer, afi, safi, ret);
    4410             :         }
    4411           0 :       if (! find)
    4412           0 :         vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
    4413           0 :                  VTY_NEWLINE);
    4414           0 :       return CMD_SUCCESS;
    4415             :     }
    4416             : 
    4417           0 :   return CMD_SUCCESS;
    4418             : }
    4419             : 
    4420             : static int
    4421           0 : bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
    4422             :                enum clear_sort sort, enum bgp_clear_type stype, 
    4423             :                const char *arg)
    4424             : {
    4425             :   struct bgp *bgp;
    4426             : 
    4427             :   /* BGP structure lookup. */
    4428           0 :   if (name)
    4429             :     {
    4430           0 :       bgp = bgp_lookup_by_name (name);
    4431           0 :       if (bgp == NULL)
    4432             :         {
    4433           0 :           vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
    4434           0 :           return CMD_WARNING;
    4435             :         }
    4436             :     }
    4437             :   else
    4438             :     {
    4439           0 :       bgp = bgp_get_default ();
    4440           0 :       if (bgp == NULL)
    4441             :         {
    4442           0 :           vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
    4443           0 :           return CMD_WARNING;
    4444             :         }
    4445             :     }
    4446             : 
    4447           0 :   return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
    4448             : }
    4449             :   
    4450           0 : DEFUN (clear_ip_bgp_all,
    4451             :        clear_ip_bgp_all_cmd,
    4452             :        "clear ip bgp *",
    4453             :        CLEAR_STR
    4454             :        IP_STR
    4455             :        BGP_STR
    4456             :        "Clear all peers\n")
    4457             : {
    4458           0 :   if (argc == 1)
    4459           0 :     return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);    
    4460             : 
    4461           0 :   return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
    4462             : }
    4463             : 
    4464             : ALIAS (clear_ip_bgp_all,
    4465             :        clear_bgp_all_cmd,
    4466             :        "clear bgp *",
    4467             :        CLEAR_STR
    4468             :        BGP_STR
    4469             :        "Clear all peers\n")
    4470             : 
    4471             : ALIAS (clear_ip_bgp_all,
    4472             :        clear_bgp_ipv6_all_cmd,
    4473             :        "clear bgp ipv6 *",
    4474             :        CLEAR_STR
    4475             :        BGP_STR
    4476             :        "Address family\n"
    4477             :        "Clear all peers\n")
    4478             : 
    4479             : ALIAS (clear_ip_bgp_all,
    4480             :        clear_ip_bgp_instance_all_cmd,
    4481             :        "clear ip bgp view WORD *",
    4482             :        CLEAR_STR
    4483             :        IP_STR
    4484             :        BGP_STR
    4485             :        "BGP view\n"
    4486             :        "view name\n"
    4487             :        "Clear all peers\n")
    4488             : 
    4489             : ALIAS (clear_ip_bgp_all,
    4490             :        clear_bgp_instance_all_cmd,
    4491             :        "clear bgp view WORD *",
    4492             :        CLEAR_STR
    4493             :        BGP_STR
    4494             :        "BGP view\n"
    4495             :        "view name\n"
    4496             :        "Clear all peers\n")
    4497             : 
    4498           0 : DEFUN (clear_ip_bgp_peer,
    4499             :        clear_ip_bgp_peer_cmd, 
    4500             :        "clear ip bgp (A.B.C.D|X:X::X:X)",
    4501             :        CLEAR_STR
    4502             :        IP_STR
    4503             :        BGP_STR
    4504             :        "BGP neighbor IP address to clear\n"
    4505             :        "BGP IPv6 neighbor to clear\n")
    4506             : {
    4507           0 :   return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
    4508             : }
    4509             : 
    4510             : ALIAS (clear_ip_bgp_peer,
    4511             :        clear_bgp_peer_cmd, 
    4512             :        "clear bgp (A.B.C.D|X:X::X:X)",
    4513             :        CLEAR_STR
    4514             :        BGP_STR
    4515             :        "BGP neighbor address to clear\n"
    4516             :        "BGP IPv6 neighbor to clear\n")
    4517             : 
    4518             : ALIAS (clear_ip_bgp_peer,
    4519             :        clear_bgp_ipv6_peer_cmd, 
    4520             :        "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
    4521             :        CLEAR_STR
    4522             :        BGP_STR
    4523             :        "Address family\n"
    4524             :        "BGP neighbor address to clear\n"
    4525             :        "BGP IPv6 neighbor to clear\n")
    4526             : 
    4527           0 : DEFUN (clear_ip_bgp_peer_group,
    4528             :        clear_ip_bgp_peer_group_cmd, 
    4529             :        "clear ip bgp peer-group WORD",
    4530             :        CLEAR_STR
    4531             :        IP_STR
    4532             :        BGP_STR
    4533             :        "Clear all members of peer-group\n"
    4534             :        "BGP peer-group name\n")
    4535             : {
    4536           0 :   return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
    4537             : }
    4538             : 
    4539             : ALIAS (clear_ip_bgp_peer_group,
    4540             :        clear_bgp_peer_group_cmd, 
    4541             :        "clear bgp peer-group WORD",
    4542             :        CLEAR_STR
    4543             :        BGP_STR
    4544             :        "Clear all members of peer-group\n"
    4545             :        "BGP peer-group name\n")
    4546             : 
    4547             : ALIAS (clear_ip_bgp_peer_group,
    4548             :        clear_bgp_ipv6_peer_group_cmd, 
    4549             :        "clear bgp ipv6 peer-group WORD",
    4550             :        CLEAR_STR
    4551             :        BGP_STR
    4552             :        "Address family\n"
    4553             :        "Clear all members of peer-group\n"
    4554             :        "BGP peer-group name\n")
    4555             : 
    4556           0 : DEFUN (clear_ip_bgp_external,
    4557             :        clear_ip_bgp_external_cmd,
    4558             :        "clear ip bgp external",
    4559             :        CLEAR_STR
    4560             :        IP_STR
    4561             :        BGP_STR
    4562             :        "Clear all external peers\n")
    4563             : {
    4564           0 :   return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
    4565             : }
    4566             : 
    4567             : ALIAS (clear_ip_bgp_external,
    4568             :        clear_bgp_external_cmd, 
    4569             :        "clear bgp external",
    4570             :        CLEAR_STR
    4571             :        BGP_STR
    4572             :        "Clear all external peers\n")
    4573             : 
    4574             : ALIAS (clear_ip_bgp_external,
    4575             :        clear_bgp_ipv6_external_cmd, 
    4576             :        "clear bgp ipv6 external",
    4577             :        CLEAR_STR
    4578             :        BGP_STR
    4579             :        "Address family\n"
    4580             :        "Clear all external peers\n")
    4581             : 
    4582           0 : DEFUN (clear_ip_bgp_as,
    4583             :        clear_ip_bgp_as_cmd,
    4584             :        "clear ip bgp " CMD_AS_RANGE,
    4585             :        CLEAR_STR
    4586             :        IP_STR
    4587             :        BGP_STR
    4588             :        "Clear peers with the AS number\n")
    4589             : {
    4590           0 :   return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
    4591             : }       
    4592             : 
    4593             : ALIAS (clear_ip_bgp_as,
    4594             :        clear_bgp_as_cmd,
    4595             :        "clear bgp " CMD_AS_RANGE,
    4596             :        CLEAR_STR
    4597             :        BGP_STR
    4598             :        "Clear peers with the AS number\n")
    4599             : 
    4600             : ALIAS (clear_ip_bgp_as,
    4601             :        clear_bgp_ipv6_as_cmd,
    4602             :        "clear bgp ipv6 " CMD_AS_RANGE,
    4603             :        CLEAR_STR
    4604             :        BGP_STR
    4605             :        "Address family\n"
    4606             :        "Clear peers with the AS number\n")
    4607             : 
    4608             : /* Outbound soft-reconfiguration */
    4609           0 : DEFUN (clear_ip_bgp_all_soft_out,
    4610             :        clear_ip_bgp_all_soft_out_cmd,
    4611             :        "clear ip bgp * soft out",
    4612             :        CLEAR_STR
    4613             :        IP_STR
    4614             :        BGP_STR
    4615             :        "Clear all peers\n"
    4616             :        "Soft reconfig\n"
    4617             :        "Soft reconfig outbound update\n")
    4618             : {
    4619           0 :   if (argc == 1)
    4620           0 :     return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
    4621             :                           BGP_CLEAR_SOFT_OUT, NULL);
    4622             : 
    4623           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
    4624             :                         BGP_CLEAR_SOFT_OUT, NULL);
    4625             : }
    4626             : 
    4627             : ALIAS (clear_ip_bgp_all_soft_out,
    4628             :        clear_ip_bgp_all_out_cmd,
    4629             :        "clear ip bgp * out",
    4630             :        CLEAR_STR
    4631             :        IP_STR
    4632             :        BGP_STR
    4633             :        "Clear all peers\n"
    4634             :        "Soft reconfig outbound update\n")
    4635             : 
    4636             : ALIAS (clear_ip_bgp_all_soft_out,
    4637             :        clear_ip_bgp_instance_all_soft_out_cmd,
    4638             :        "clear ip bgp view WORD * soft out",
    4639             :        CLEAR_STR
    4640             :        IP_STR
    4641             :        BGP_STR
    4642             :        "BGP view\n"
    4643             :        "view name\n"
    4644             :        "Clear all peers\n"
    4645             :        "Soft reconfig\n"
    4646             :        "Soft reconfig outbound update\n")
    4647             : 
    4648           0 : DEFUN (clear_ip_bgp_all_ipv4_soft_out,
    4649             :        clear_ip_bgp_all_ipv4_soft_out_cmd,
    4650             :        "clear ip bgp * ipv4 (unicast|multicast) soft out",
    4651             :        CLEAR_STR
    4652             :        IP_STR
    4653             :        BGP_STR
    4654             :        "Clear all peers\n"
    4655             :        "Address family\n"
    4656             :        "Address Family modifier\n"
    4657             :        "Address Family modifier\n"
    4658             :        "Soft reconfig\n"
    4659             :        "Soft reconfig outbound update\n")
    4660             : {
    4661           0 :   if (strncmp (argv[0], "m", 1) == 0)
    4662           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
    4663             :                           BGP_CLEAR_SOFT_OUT, NULL);
    4664             : 
    4665           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
    4666             :                         BGP_CLEAR_SOFT_OUT, NULL);
    4667             : }
    4668             : 
    4669             : ALIAS (clear_ip_bgp_all_ipv4_soft_out,
    4670             :        clear_ip_bgp_all_ipv4_out_cmd,
    4671             :        "clear ip bgp * ipv4 (unicast|multicast) out",
    4672             :        CLEAR_STR
    4673             :        IP_STR
    4674             :        BGP_STR
    4675             :        "Clear all peers\n"
    4676             :        "Address family\n"
    4677             :        "Address Family modifier\n"
    4678             :        "Address Family modifier\n"
    4679             :        "Soft reconfig outbound update\n")
    4680             : 
    4681           0 : DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
    4682             :        clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
    4683             :        "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
    4684             :        CLEAR_STR
    4685             :        IP_STR
    4686             :        BGP_STR
    4687             :        "BGP view\n"
    4688             :        "view name\n"
    4689             :        "Clear all peers\n"
    4690             :        "Address family\n"
    4691             :        "Address Family modifier\n"
    4692             :        "Address Family modifier\n"
    4693             :        "Soft reconfig outbound update\n")
    4694             : {
    4695           0 :   if (strncmp (argv[1], "m", 1) == 0)
    4696           0 :     return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
    4697             :                           BGP_CLEAR_SOFT_OUT, NULL);
    4698             : 
    4699           0 :   return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
    4700             :                         BGP_CLEAR_SOFT_OUT, NULL);
    4701             : }
    4702             : 
    4703           0 : DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
    4704             :        clear_ip_bgp_all_vpnv4_soft_out_cmd,
    4705             :        "clear ip bgp * vpnv4 unicast soft out",
    4706             :        CLEAR_STR
    4707             :        IP_STR
    4708             :        BGP_STR
    4709             :        "Clear all peers\n"
    4710             :        "Address family\n"
    4711             :        "Address Family Modifier\n"
    4712             :        "Soft reconfig\n"
    4713             :        "Soft reconfig outbound update\n")
    4714             : {
    4715           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
    4716             :                         BGP_CLEAR_SOFT_OUT, NULL);
    4717             : }
    4718             : 
    4719             : ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
    4720             :        clear_ip_bgp_all_vpnv4_out_cmd,
    4721             :        "clear ip bgp * vpnv4 unicast out",
    4722             :        CLEAR_STR
    4723             :        IP_STR
    4724             :        BGP_STR
    4725             :        "Clear all peers\n"
    4726             :        "Address family\n"
    4727             :        "Address Family Modifier\n"
    4728             :        "Soft reconfig outbound update\n")
    4729             : 
    4730           0 : DEFUN (clear_bgp_all_soft_out,
    4731             :        clear_bgp_all_soft_out_cmd,
    4732             :        "clear bgp * soft out",
    4733             :        CLEAR_STR
    4734             :        BGP_STR
    4735             :        "Clear all peers\n"
    4736             :        "Soft reconfig\n"
    4737             :        "Soft reconfig outbound update\n")
    4738             : {
    4739           0 :   if (argc == 1)
    4740           0 :     return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
    4741             :                           BGP_CLEAR_SOFT_OUT, NULL);
    4742             : 
    4743           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
    4744             :                         BGP_CLEAR_SOFT_OUT, NULL);
    4745             : }
    4746             : 
    4747             : ALIAS (clear_bgp_all_soft_out,
    4748             :        clear_bgp_instance_all_soft_out_cmd,
    4749             :        "clear bgp view WORD * soft out",
    4750             :        CLEAR_STR
    4751             :        BGP_STR
    4752             :        "BGP view\n"
    4753             :        "view name\n"
    4754             :        "Clear all peers\n"
    4755             :        "Soft reconfig\n"
    4756             :        "Soft reconfig outbound update\n")
    4757             : 
    4758             : ALIAS (clear_bgp_all_soft_out,
    4759             :        clear_bgp_all_out_cmd,
    4760             :        "clear bgp * out",
    4761             :        CLEAR_STR
    4762             :        BGP_STR
    4763             :        "Clear all peers\n"
    4764             :        "Soft reconfig outbound update\n")
    4765             : 
    4766             : ALIAS (clear_bgp_all_soft_out,
    4767             :        clear_bgp_ipv6_all_soft_out_cmd,
    4768             :        "clear bgp ipv6 * soft out",
    4769             :        CLEAR_STR
    4770             :        BGP_STR
    4771             :        "Address family\n"
    4772             :        "Clear all peers\n"
    4773             :        "Soft reconfig\n"
    4774             :        "Soft reconfig outbound update\n")
    4775             : 
    4776             : ALIAS (clear_bgp_all_soft_out,
    4777             :        clear_bgp_ipv6_all_out_cmd,
    4778             :        "clear bgp ipv6 * out",
    4779             :        CLEAR_STR
    4780             :        BGP_STR
    4781             :        "Address family\n"
    4782             :        "Clear all peers\n"
    4783             :        "Soft reconfig outbound update\n")
    4784             : 
    4785           0 : DEFUN (clear_ip_bgp_peer_soft_out,
    4786             :        clear_ip_bgp_peer_soft_out_cmd,
    4787             :        "clear ip bgp A.B.C.D soft out",
    4788             :        CLEAR_STR
    4789             :        IP_STR
    4790             :        BGP_STR
    4791             :        "BGP neighbor address to clear\n"
    4792             :        "Soft reconfig\n"
    4793             :        "Soft reconfig outbound update\n")
    4794             : {
    4795           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
    4796             :                         BGP_CLEAR_SOFT_OUT, argv[0]);
    4797             : }
    4798             : 
    4799             : ALIAS (clear_ip_bgp_peer_soft_out,
    4800             :        clear_ip_bgp_peer_out_cmd,
    4801             :        "clear ip bgp A.B.C.D out",
    4802             :        CLEAR_STR
    4803             :        IP_STR
    4804             :        BGP_STR
    4805             :        "BGP neighbor address to clear\n"
    4806             :        "Soft reconfig outbound update\n")
    4807             : 
    4808           0 : DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
    4809             :        clear_ip_bgp_peer_ipv4_soft_out_cmd,
    4810             :        "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
    4811             :        CLEAR_STR
    4812             :        IP_STR
    4813             :        BGP_STR
    4814             :        "BGP neighbor address to clear\n"
    4815             :        "Address family\n"
    4816             :        "Address Family modifier\n"
    4817             :        "Address Family modifier\n"
    4818             :        "Soft reconfig\n"
    4819             :        "Soft reconfig outbound update\n")
    4820             : {
    4821           0 :   if (strncmp (argv[1], "m", 1) == 0)
    4822           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
    4823             :                           BGP_CLEAR_SOFT_OUT, argv[0]);
    4824             : 
    4825           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
    4826             :                         BGP_CLEAR_SOFT_OUT, argv[0]);
    4827             : }
    4828             : 
    4829             : ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
    4830             :        clear_ip_bgp_peer_ipv4_out_cmd,
    4831             :        "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
    4832             :        CLEAR_STR
    4833             :        IP_STR
    4834             :        BGP_STR
    4835             :        "BGP neighbor address to clear\n"
    4836             :        "Address family\n"
    4837             :        "Address Family modifier\n"
    4838             :        "Address Family modifier\n"
    4839             :        "Soft reconfig outbound update\n")
    4840             : 
    4841           0 : DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
    4842             :        clear_ip_bgp_peer_vpnv4_soft_out_cmd,
    4843             :        "clear ip bgp A.B.C.D vpnv4 unicast soft out",
    4844             :        CLEAR_STR
    4845             :        IP_STR
    4846             :        BGP_STR
    4847             :        "BGP neighbor address to clear\n"
    4848             :        "Address family\n"
    4849             :        "Address Family Modifier\n"
    4850             :        "Soft reconfig\n"
    4851             :        "Soft reconfig outbound update\n")
    4852             : {
    4853           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
    4854             :                         BGP_CLEAR_SOFT_OUT, argv[0]);
    4855             : }
    4856             : 
    4857             : ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
    4858             :        clear_ip_bgp_peer_vpnv4_out_cmd,
    4859             :        "clear ip bgp A.B.C.D vpnv4 unicast out",
    4860             :        CLEAR_STR
    4861             :        IP_STR
    4862             :        BGP_STR
    4863             :        "BGP neighbor address to clear\n"
    4864             :        "Address family\n"
    4865             :        "Address Family Modifier\n"
    4866             :        "Soft reconfig outbound update\n")
    4867             : 
    4868           0 : DEFUN (clear_bgp_peer_soft_out,
    4869             :        clear_bgp_peer_soft_out_cmd,
    4870             :        "clear bgp (A.B.C.D|X:X::X:X) soft out",
    4871             :        CLEAR_STR
    4872             :        BGP_STR
    4873             :        "BGP neighbor address to clear\n"
    4874             :        "BGP IPv6 neighbor to clear\n"
    4875             :        "Soft reconfig\n"
    4876             :        "Soft reconfig outbound update\n")
    4877             : {
    4878           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
    4879             :                         BGP_CLEAR_SOFT_OUT, argv[0]);
    4880             : }
    4881             : 
    4882             : ALIAS (clear_bgp_peer_soft_out,
    4883             :        clear_bgp_ipv6_peer_soft_out_cmd,
    4884             :        "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
    4885             :        CLEAR_STR
    4886             :        BGP_STR
    4887             :        "Address family\n"
    4888             :        "BGP neighbor address to clear\n"
    4889             :        "BGP IPv6 neighbor to clear\n"
    4890             :        "Soft reconfig\n"
    4891             :        "Soft reconfig outbound update\n")
    4892             : 
    4893             : ALIAS (clear_bgp_peer_soft_out,
    4894             :        clear_bgp_peer_out_cmd,
    4895             :        "clear bgp (A.B.C.D|X:X::X:X) out",
    4896             :        CLEAR_STR
    4897             :        BGP_STR
    4898             :        "BGP neighbor address to clear\n"
    4899             :        "BGP IPv6 neighbor to clear\n"
    4900             :        "Soft reconfig outbound update\n")
    4901             : 
    4902             : ALIAS (clear_bgp_peer_soft_out,
    4903             :        clear_bgp_ipv6_peer_out_cmd,
    4904             :        "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
    4905             :        CLEAR_STR
    4906             :        BGP_STR
    4907             :        "Address family\n"
    4908             :        "BGP neighbor address to clear\n"
    4909             :        "BGP IPv6 neighbor to clear\n"
    4910             :        "Soft reconfig outbound update\n")
    4911             : 
    4912           0 : DEFUN (clear_ip_bgp_peer_group_soft_out,
    4913             :        clear_ip_bgp_peer_group_soft_out_cmd, 
    4914             :        "clear ip bgp peer-group WORD soft out",
    4915             :        CLEAR_STR
    4916             :        IP_STR
    4917             :        BGP_STR
    4918             :        "Clear all members of peer-group\n"
    4919             :        "BGP peer-group name\n"
    4920             :        "Soft reconfig\n"
    4921             :        "Soft reconfig outbound update\n")
    4922             : {
    4923           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
    4924             :                         BGP_CLEAR_SOFT_OUT, argv[0]);
    4925             : }
    4926             : 
    4927             : ALIAS (clear_ip_bgp_peer_group_soft_out,
    4928             :        clear_ip_bgp_peer_group_out_cmd, 
    4929             :        "clear ip bgp peer-group WORD out",
    4930             :        CLEAR_STR
    4931             :        IP_STR
    4932             :        BGP_STR
    4933             :        "Clear all members of peer-group\n"
    4934             :        "BGP peer-group name\n"
    4935             :        "Soft reconfig outbound update\n")
    4936             : 
    4937           0 : DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
    4938             :        clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
    4939             :        "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
    4940             :        CLEAR_STR
    4941             :        IP_STR
    4942             :        BGP_STR
    4943             :        "Clear all members of peer-group\n"
    4944             :        "BGP peer-group name\n"
    4945             :        "Address family\n"
    4946             :        "Address Family modifier\n"
    4947             :        "Address Family modifier\n"
    4948             :        "Soft reconfig\n"
    4949             :        "Soft reconfig outbound update\n")
    4950             : {
    4951           0 :   if (strncmp (argv[1], "m", 1) == 0)
    4952           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
    4953             :                           BGP_CLEAR_SOFT_OUT, argv[0]);
    4954             : 
    4955           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
    4956             :                         BGP_CLEAR_SOFT_OUT, argv[0]);
    4957             : }
    4958             : 
    4959             : ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
    4960             :        clear_ip_bgp_peer_group_ipv4_out_cmd,
    4961             :        "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
    4962             :        CLEAR_STR
    4963             :        IP_STR
    4964             :        BGP_STR
    4965             :        "Clear all members of peer-group\n"
    4966             :        "BGP peer-group name\n"
    4967             :        "Address family\n"
    4968             :        "Address Family modifier\n"
    4969             :        "Address Family modifier\n"
    4970             :        "Soft reconfig outbound update\n")
    4971             : 
    4972           0 : DEFUN (clear_bgp_peer_group_soft_out,
    4973             :        clear_bgp_peer_group_soft_out_cmd,
    4974             :        "clear bgp peer-group WORD soft out",
    4975             :        CLEAR_STR
    4976             :        BGP_STR
    4977             :        "Clear all members of peer-group\n"
    4978             :        "BGP peer-group name\n"
    4979             :        "Soft reconfig\n"
    4980             :        "Soft reconfig outbound update\n")
    4981             : {
    4982           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
    4983             :                         BGP_CLEAR_SOFT_OUT, argv[0]);
    4984             : }
    4985             : 
    4986             : ALIAS (clear_bgp_peer_group_soft_out,
    4987             :        clear_bgp_ipv6_peer_group_soft_out_cmd,
    4988             :        "clear bgp ipv6 peer-group WORD soft out",
    4989             :        CLEAR_STR
    4990             :        BGP_STR
    4991             :        "Address family\n"
    4992             :        "Clear all members of peer-group\n"
    4993             :        "BGP peer-group name\n"
    4994             :        "Soft reconfig\n"
    4995             :        "Soft reconfig outbound update\n")
    4996             : 
    4997             : ALIAS (clear_bgp_peer_group_soft_out,
    4998             :        clear_bgp_peer_group_out_cmd,
    4999             :        "clear bgp peer-group WORD out",
    5000             :        CLEAR_STR
    5001             :        BGP_STR
    5002             :        "Clear all members of peer-group\n"
    5003             :        "BGP peer-group name\n"
    5004             :        "Soft reconfig outbound update\n")
    5005             : 
    5006             : ALIAS (clear_bgp_peer_group_soft_out,
    5007             :        clear_bgp_ipv6_peer_group_out_cmd,
    5008             :        "clear bgp ipv6 peer-group WORD out",
    5009             :        CLEAR_STR
    5010             :        BGP_STR
    5011             :        "Address family\n"
    5012             :        "Clear all members of peer-group\n"
    5013             :        "BGP peer-group name\n"
    5014             :        "Soft reconfig outbound update\n")
    5015             : 
    5016           0 : DEFUN (clear_ip_bgp_external_soft_out,
    5017             :        clear_ip_bgp_external_soft_out_cmd, 
    5018             :        "clear ip bgp external soft out",
    5019             :        CLEAR_STR
    5020             :        IP_STR
    5021             :        BGP_STR
    5022             :        "Clear all external peers\n"
    5023             :        "Soft reconfig\n"
    5024             :        "Soft reconfig outbound update\n")
    5025             : {
    5026           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
    5027             :                         BGP_CLEAR_SOFT_OUT, NULL);
    5028             : }
    5029             : 
    5030             : ALIAS (clear_ip_bgp_external_soft_out,
    5031             :        clear_ip_bgp_external_out_cmd, 
    5032             :        "clear ip bgp external out",
    5033             :        CLEAR_STR
    5034             :        IP_STR
    5035             :        BGP_STR
    5036             :        "Clear all external peers\n"
    5037             :        "Soft reconfig outbound update\n")
    5038             : 
    5039           0 : DEFUN (clear_ip_bgp_external_ipv4_soft_out,
    5040             :        clear_ip_bgp_external_ipv4_soft_out_cmd,
    5041             :        "clear ip bgp external ipv4 (unicast|multicast) soft out",
    5042             :        CLEAR_STR
    5043             :        IP_STR
    5044             :        BGP_STR
    5045             :        "Clear all external peers\n"
    5046             :        "Address family\n"
    5047             :        "Address Family modifier\n"
    5048             :        "Address Family modifier\n"
    5049             :        "Soft reconfig\n"
    5050             :        "Soft reconfig outbound update\n")
    5051             : {
    5052           0 :   if (strncmp (argv[0], "m", 1) == 0)
    5053           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
    5054             :                           BGP_CLEAR_SOFT_OUT, NULL);
    5055             : 
    5056           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
    5057             :                         BGP_CLEAR_SOFT_OUT, NULL);
    5058             : }
    5059             : 
    5060             : ALIAS (clear_ip_bgp_external_ipv4_soft_out,
    5061             :        clear_ip_bgp_external_ipv4_out_cmd,
    5062             :        "clear ip bgp external ipv4 (unicast|multicast) out",
    5063             :        CLEAR_STR
    5064             :        IP_STR
    5065             :        BGP_STR
    5066             :        "Clear all external peers\n"
    5067             :        "Address family\n"
    5068             :        "Address Family modifier\n"
    5069             :        "Address Family modifier\n"
    5070             :        "Soft reconfig outbound update\n")
    5071             : 
    5072           0 : DEFUN (clear_bgp_external_soft_out,
    5073             :        clear_bgp_external_soft_out_cmd,
    5074             :        "clear bgp external soft out",
    5075             :        CLEAR_STR
    5076             :        BGP_STR
    5077             :        "Clear all external peers\n"
    5078             :        "Soft reconfig\n"
    5079             :        "Soft reconfig outbound update\n")
    5080             : {
    5081           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
    5082             :                         BGP_CLEAR_SOFT_OUT, NULL);
    5083             : }
    5084             : 
    5085             : ALIAS (clear_bgp_external_soft_out,
    5086             :        clear_bgp_ipv6_external_soft_out_cmd,
    5087             :        "clear bgp ipv6 external soft out",
    5088             :        CLEAR_STR
    5089             :        BGP_STR
    5090             :        "Address family\n"
    5091             :        "Clear all external peers\n"
    5092             :        "Soft reconfig\n"
    5093             :        "Soft reconfig outbound update\n")
    5094             : 
    5095             : ALIAS (clear_bgp_external_soft_out,
    5096             :        clear_bgp_external_out_cmd,
    5097             :        "clear bgp external out",
    5098             :        CLEAR_STR
    5099             :        BGP_STR
    5100             :        "Clear all external peers\n"
    5101             :        "Soft reconfig outbound update\n")
    5102             : 
    5103             : ALIAS (clear_bgp_external_soft_out,
    5104             :        clear_bgp_ipv6_external_out_cmd,
    5105             :        "clear bgp ipv6 external WORD out",
    5106             :        CLEAR_STR
    5107             :        BGP_STR
    5108             :        "Address family\n"
    5109             :        "Clear all external peers\n"
    5110             :        "Soft reconfig outbound update\n")
    5111             : 
    5112           0 : DEFUN (clear_ip_bgp_as_soft_out,
    5113             :        clear_ip_bgp_as_soft_out_cmd,
    5114             :        "clear ip bgp " CMD_AS_RANGE " soft out",
    5115             :        CLEAR_STR
    5116             :        IP_STR
    5117             :        BGP_STR
    5118             :        "Clear peers with the AS number\n"
    5119             :        "Soft reconfig\n"
    5120             :        "Soft reconfig outbound update\n")
    5121             : {
    5122           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
    5123             :                         BGP_CLEAR_SOFT_OUT, argv[0]);
    5124             : }
    5125             : 
    5126             : ALIAS (clear_ip_bgp_as_soft_out,
    5127             :        clear_ip_bgp_as_out_cmd,
    5128             :        "clear ip bgp " CMD_AS_RANGE " out",
    5129             :        CLEAR_STR
    5130             :        IP_STR
    5131             :        BGP_STR
    5132             :        "Clear peers with the AS number\n"
    5133             :        "Soft reconfig outbound update\n")
    5134             : 
    5135           0 : DEFUN (clear_ip_bgp_as_ipv4_soft_out,
    5136             :        clear_ip_bgp_as_ipv4_soft_out_cmd,
    5137             :        "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
    5138             :        CLEAR_STR
    5139             :        IP_STR
    5140             :        BGP_STR
    5141             :        "Clear peers with the AS number\n"
    5142             :        "Address family\n"
    5143             :        "Address Family modifier\n"
    5144             :        "Address Family modifier\n"
    5145             :        "Soft reconfig\n"
    5146             :        "Soft reconfig outbound update\n")
    5147             : {
    5148           0 :   if (strncmp (argv[1], "m", 1) == 0)
    5149           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
    5150             :                           BGP_CLEAR_SOFT_OUT, argv[0]);
    5151             : 
    5152           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
    5153             :                         BGP_CLEAR_SOFT_OUT, argv[0]);
    5154             : }
    5155             : 
    5156             : ALIAS (clear_ip_bgp_as_ipv4_soft_out,
    5157             :        clear_ip_bgp_as_ipv4_out_cmd,
    5158             :        "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
    5159             :        CLEAR_STR
    5160             :        IP_STR
    5161             :        BGP_STR
    5162             :        "Clear peers with the AS number\n"
    5163             :        "Address family\n"
    5164             :        "Address Family modifier\n"
    5165             :        "Address Family modifier\n"
    5166             :        "Soft reconfig outbound update\n")
    5167             : 
    5168           0 : DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
    5169             :        clear_ip_bgp_as_vpnv4_soft_out_cmd,
    5170             :        "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
    5171             :        CLEAR_STR
    5172             :        IP_STR
    5173             :        BGP_STR
    5174             :        "Clear peers with the AS number\n"
    5175             :        "Address family\n"
    5176             :        "Address Family modifier\n"
    5177             :        "Soft reconfig\n"
    5178             :        "Soft reconfig outbound update\n")
    5179             : {
    5180           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
    5181             :                         BGP_CLEAR_SOFT_OUT, argv[0]);
    5182             : }
    5183             : 
    5184             : ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
    5185             :        clear_ip_bgp_as_vpnv4_out_cmd,
    5186             :        "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
    5187             :        CLEAR_STR
    5188             :        IP_STR
    5189             :        BGP_STR
    5190             :        "Clear peers with the AS number\n"
    5191             :        "Address family\n"
    5192             :        "Address Family modifier\n"
    5193             :        "Soft reconfig outbound update\n")
    5194             : 
    5195           0 : DEFUN (clear_bgp_as_soft_out,
    5196             :        clear_bgp_as_soft_out_cmd,
    5197             :        "clear bgp " CMD_AS_RANGE " soft out",
    5198             :        CLEAR_STR
    5199             :        BGP_STR
    5200             :        "Clear peers with the AS number\n"
    5201             :        "Soft reconfig\n"
    5202             :        "Soft reconfig outbound update\n")
    5203             : {
    5204           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
    5205             :                         BGP_CLEAR_SOFT_OUT, argv[0]);
    5206             : }
    5207             : 
    5208             : ALIAS (clear_bgp_as_soft_out,
    5209             :        clear_bgp_ipv6_as_soft_out_cmd,
    5210             :        "clear bgp ipv6 " CMD_AS_RANGE " soft out",
    5211             :        CLEAR_STR
    5212             :        BGP_STR
    5213             :        "Address family\n"
    5214             :        "Clear peers with the AS number\n"
    5215             :        "Soft reconfig\n"
    5216             :        "Soft reconfig outbound update\n")
    5217             : 
    5218             : ALIAS (clear_bgp_as_soft_out,
    5219             :        clear_bgp_as_out_cmd,
    5220             :        "clear bgp " CMD_AS_RANGE " out",
    5221             :        CLEAR_STR
    5222             :        BGP_STR
    5223             :        "Clear peers with the AS number\n"
    5224             :        "Soft reconfig outbound update\n")
    5225             : 
    5226             : ALIAS (clear_bgp_as_soft_out,
    5227             :        clear_bgp_ipv6_as_out_cmd,
    5228             :        "clear bgp ipv6 " CMD_AS_RANGE " out",
    5229             :        CLEAR_STR
    5230             :        BGP_STR
    5231             :        "Address family\n"
    5232             :        "Clear peers with the AS number\n"
    5233             :        "Soft reconfig outbound update\n")
    5234             : 
    5235             : /* Inbound soft-reconfiguration */
    5236           0 : DEFUN (clear_ip_bgp_all_soft_in,
    5237             :        clear_ip_bgp_all_soft_in_cmd,
    5238             :        "clear ip bgp * soft in",
    5239             :        CLEAR_STR
    5240             :        IP_STR
    5241             :        BGP_STR
    5242             :        "Clear all peers\n"
    5243             :        "Soft reconfig\n"
    5244             :        "Soft reconfig inbound update\n")
    5245             : {
    5246           0 :   if (argc == 1)
    5247           0 :     return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
    5248             :                           BGP_CLEAR_SOFT_IN, NULL);
    5249             : 
    5250           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
    5251             :                         BGP_CLEAR_SOFT_IN, NULL);
    5252             : }
    5253             : 
    5254             : ALIAS (clear_ip_bgp_all_soft_in,
    5255             :        clear_ip_bgp_instance_all_soft_in_cmd,
    5256             :        "clear ip bgp view WORD * soft in",
    5257             :        CLEAR_STR
    5258             :        IP_STR
    5259             :        BGP_STR
    5260             :        "BGP view\n"
    5261             :        "view name\n"
    5262             :        "Clear all peers\n"
    5263             :        "Soft reconfig\n"
    5264             :        "Soft reconfig inbound update\n")
    5265             : 
    5266             : ALIAS (clear_ip_bgp_all_soft_in,
    5267             :        clear_ip_bgp_all_in_cmd,
    5268             :        "clear ip bgp * in",
    5269             :        CLEAR_STR
    5270             :        IP_STR
    5271             :        BGP_STR
    5272             :        "Clear all peers\n"
    5273             :        "Soft reconfig inbound update\n")
    5274             : 
    5275           0 : DEFUN (clear_ip_bgp_all_in_prefix_filter,
    5276             :        clear_ip_bgp_all_in_prefix_filter_cmd,
    5277             :        "clear ip bgp * in prefix-filter",
    5278             :        CLEAR_STR
    5279             :        IP_STR
    5280             :        BGP_STR
    5281             :        "Clear all peers\n"
    5282             :        "Soft reconfig inbound update\n"
    5283             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    5284             : {
    5285           0 :   if (argc== 1)
    5286           0 :     return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
    5287             :                           BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
    5288             : 
    5289           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
    5290             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
    5291             : }
    5292             : 
    5293             : ALIAS (clear_ip_bgp_all_in_prefix_filter,
    5294             :        clear_ip_bgp_instance_all_in_prefix_filter_cmd,
    5295             :        "clear ip bgp view WORD * in prefix-filter",
    5296             :        CLEAR_STR
    5297             :        IP_STR
    5298             :        BGP_STR
    5299             :        "BGP view\n"
    5300             :        "view name\n"
    5301             :        "Clear all peers\n"
    5302             :        "Soft reconfig inbound update\n"
    5303             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    5304             : 
    5305             : 
    5306           0 : DEFUN (clear_ip_bgp_all_ipv4_soft_in,
    5307             :        clear_ip_bgp_all_ipv4_soft_in_cmd,
    5308             :        "clear ip bgp * ipv4 (unicast|multicast) soft in",
    5309             :        CLEAR_STR
    5310             :        IP_STR
    5311             :        BGP_STR
    5312             :        "Clear all peers\n"
    5313             :        "Address family\n"
    5314             :        "Address Family modifier\n"
    5315             :        "Address Family modifier\n"
    5316             :        "Soft reconfig\n"
    5317             :        "Soft reconfig inbound update\n")
    5318             : {
    5319           0 :   if (strncmp (argv[0], "m", 1) == 0)
    5320           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
    5321             :                           BGP_CLEAR_SOFT_IN, NULL);
    5322             : 
    5323           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
    5324             :                         BGP_CLEAR_SOFT_IN, NULL);
    5325             : }
    5326             : 
    5327             : ALIAS (clear_ip_bgp_all_ipv4_soft_in,
    5328             :        clear_ip_bgp_all_ipv4_in_cmd,
    5329             :        "clear ip bgp * ipv4 (unicast|multicast) in",
    5330             :        CLEAR_STR
    5331             :        IP_STR
    5332             :        BGP_STR
    5333             :        "Clear all peers\n"
    5334             :        "Address family\n"
    5335             :        "Address Family modifier\n"
    5336             :        "Address Family modifier\n"
    5337             :        "Soft reconfig inbound update\n")
    5338             : 
    5339           0 : DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
    5340             :        clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
    5341             :        "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
    5342             :        CLEAR_STR
    5343             :        IP_STR
    5344             :        BGP_STR
    5345             :        "BGP view\n"
    5346             :        "view name\n"
    5347             :        "Clear all peers\n"
    5348             :        "Address family\n"
    5349             :        "Address Family modifier\n"
    5350             :        "Address Family modifier\n"
    5351             :        "Soft reconfig\n"
    5352             :        "Soft reconfig inbound update\n")
    5353             : {
    5354           0 :   if (strncmp (argv[1], "m", 1) == 0)
    5355           0 :     return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
    5356             :                           BGP_CLEAR_SOFT_IN, NULL);
    5357             : 
    5358           0 :   return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
    5359             :                         BGP_CLEAR_SOFT_IN, NULL);
    5360             : }
    5361             : 
    5362           0 : DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
    5363             :        clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
    5364             :        "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
    5365             :        CLEAR_STR
    5366             :        IP_STR
    5367             :        BGP_STR
    5368             :        "Clear all peers\n"
    5369             :        "Address family\n"
    5370             :        "Address Family modifier\n"
    5371             :        "Address Family modifier\n"
    5372             :        "Soft reconfig inbound update\n"
    5373             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    5374             : {
    5375           0 :   if (strncmp (argv[0], "m", 1) == 0)
    5376           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
    5377             :                           BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
    5378             : 
    5379           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
    5380             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
    5381             : }
    5382             : 
    5383           0 : DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
    5384             :        clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
    5385             :        "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
    5386             :        CLEAR_STR
    5387             :        IP_STR
    5388             :        BGP_STR
    5389             :        "Clear all peers\n"
    5390             :        "Address family\n"
    5391             :        "Address Family modifier\n"
    5392             :        "Address Family modifier\n"
    5393             :        "Soft reconfig inbound update\n"
    5394             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    5395             : {
    5396           0 :   if (strncmp (argv[1], "m", 1) == 0)
    5397           0 :     return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
    5398             :                           BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
    5399             : 
    5400           0 :   return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
    5401             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
    5402             : }
    5403             : 
    5404           0 : DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
    5405             :        clear_ip_bgp_all_vpnv4_soft_in_cmd,
    5406             :        "clear ip bgp * vpnv4 unicast soft in",
    5407             :        CLEAR_STR
    5408             :        IP_STR
    5409             :        BGP_STR
    5410             :        "Clear all peers\n"
    5411             :        "Address family\n"
    5412             :        "Address Family Modifier\n"
    5413             :        "Soft reconfig\n"
    5414             :        "Soft reconfig inbound update\n")
    5415             : {
    5416           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
    5417             :                         BGP_CLEAR_SOFT_IN, NULL);
    5418             : }
    5419             : 
    5420             : ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
    5421             :        clear_ip_bgp_all_vpnv4_in_cmd,
    5422             :        "clear ip bgp * vpnv4 unicast in",
    5423             :        CLEAR_STR
    5424             :        IP_STR
    5425             :        BGP_STR
    5426             :        "Clear all peers\n"
    5427             :        "Address family\n"
    5428             :        "Address Family Modifier\n"
    5429             :        "Soft reconfig inbound update\n")
    5430             : 
    5431           0 : DEFUN (clear_bgp_all_soft_in,
    5432             :        clear_bgp_all_soft_in_cmd,
    5433             :        "clear bgp * soft in",
    5434             :        CLEAR_STR
    5435             :        BGP_STR
    5436             :        "Clear all peers\n"
    5437             :        "Soft reconfig\n"
    5438             :        "Soft reconfig inbound update\n")
    5439             : {
    5440           0 :   if (argc == 1)
    5441           0 :     return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
    5442             :                         BGP_CLEAR_SOFT_IN, NULL);
    5443             : 
    5444           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
    5445             :                         BGP_CLEAR_SOFT_IN, NULL);
    5446             : }
    5447             : 
    5448             : ALIAS (clear_bgp_all_soft_in,
    5449             :        clear_bgp_instance_all_soft_in_cmd,
    5450             :        "clear bgp view WORD * soft in",
    5451             :        CLEAR_STR
    5452             :        BGP_STR
    5453             :        "BGP view\n"
    5454             :        "view name\n"
    5455             :        "Clear all peers\n"
    5456             :        "Soft reconfig\n"
    5457             :        "Soft reconfig inbound update\n")
    5458             : 
    5459             : ALIAS (clear_bgp_all_soft_in,
    5460             :        clear_bgp_ipv6_all_soft_in_cmd,
    5461             :        "clear bgp ipv6 * soft in",
    5462             :        CLEAR_STR
    5463             :        BGP_STR
    5464             :        "Address family\n"
    5465             :        "Clear all peers\n"
    5466             :        "Soft reconfig\n"
    5467             :        "Soft reconfig inbound update\n")
    5468             : 
    5469             : ALIAS (clear_bgp_all_soft_in,
    5470             :        clear_bgp_all_in_cmd,
    5471             :        "clear bgp * in",
    5472             :        CLEAR_STR
    5473             :        BGP_STR
    5474             :        "Clear all peers\n"
    5475             :        "Soft reconfig inbound update\n")
    5476             : 
    5477             : ALIAS (clear_bgp_all_soft_in,
    5478             :        clear_bgp_ipv6_all_in_cmd,
    5479             :        "clear bgp ipv6 * in",
    5480             :        CLEAR_STR
    5481             :        BGP_STR
    5482             :        "Address family\n"
    5483             :        "Clear all peers\n"
    5484             :        "Soft reconfig inbound update\n")
    5485             : 
    5486           0 : DEFUN (clear_bgp_all_in_prefix_filter,
    5487             :        clear_bgp_all_in_prefix_filter_cmd,
    5488             :        "clear bgp * in prefix-filter",
    5489             :        CLEAR_STR
    5490             :        BGP_STR
    5491             :        "Clear all peers\n"
    5492             :        "Soft reconfig inbound update\n"
    5493             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    5494             : {
    5495           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
    5496             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
    5497             : }
    5498             : 
    5499             : ALIAS (clear_bgp_all_in_prefix_filter,
    5500             :        clear_bgp_ipv6_all_in_prefix_filter_cmd,
    5501             :        "clear bgp ipv6 * in prefix-filter",
    5502             :        CLEAR_STR
    5503             :        BGP_STR
    5504             :        "Address family\n"
    5505             :        "Clear all peers\n"
    5506             :        "Soft reconfig inbound update\n"
    5507             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    5508             : 
    5509           0 : DEFUN (clear_ip_bgp_peer_soft_in,
    5510             :        clear_ip_bgp_peer_soft_in_cmd,
    5511             :        "clear ip bgp A.B.C.D soft in",
    5512             :        CLEAR_STR
    5513             :        IP_STR
    5514             :        BGP_STR
    5515             :        "BGP neighbor address to clear\n"
    5516             :        "Soft reconfig\n"
    5517             :        "Soft reconfig inbound update\n")
    5518             : {
    5519           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
    5520             :                         BGP_CLEAR_SOFT_IN, argv[0]);
    5521             : }
    5522             : 
    5523             : ALIAS (clear_ip_bgp_peer_soft_in,
    5524             :        clear_ip_bgp_peer_in_cmd,
    5525             :        "clear ip bgp A.B.C.D in",
    5526             :        CLEAR_STR
    5527             :        IP_STR
    5528             :        BGP_STR
    5529             :        "BGP neighbor address to clear\n"
    5530             :        "Soft reconfig inbound update\n")
    5531             :        
    5532           0 : DEFUN (clear_ip_bgp_peer_in_prefix_filter,
    5533             :        clear_ip_bgp_peer_in_prefix_filter_cmd,
    5534             :        "clear ip bgp A.B.C.D in prefix-filter",
    5535             :        CLEAR_STR
    5536             :        IP_STR
    5537             :        BGP_STR
    5538             :        "BGP neighbor address to clear\n"
    5539             :        "Soft reconfig inbound update\n"
    5540             :        "Push out the existing ORF prefix-list\n")
    5541             : {
    5542           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
    5543             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
    5544             : }
    5545             : 
    5546           0 : DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
    5547             :        clear_ip_bgp_peer_ipv4_soft_in_cmd,
    5548             :        "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
    5549             :        CLEAR_STR
    5550             :        IP_STR
    5551             :        BGP_STR
    5552             :        "BGP neighbor address to clear\n"
    5553             :        "Address family\n"
    5554             :        "Address Family modifier\n"
    5555             :        "Address Family modifier\n"
    5556             :        "Soft reconfig\n"
    5557             :        "Soft reconfig inbound update\n")
    5558             : {
    5559           0 :   if (strncmp (argv[1], "m", 1) == 0)
    5560           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
    5561             :                           BGP_CLEAR_SOFT_IN, argv[0]);
    5562             : 
    5563           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
    5564             :                         BGP_CLEAR_SOFT_IN, argv[0]);
    5565             : }
    5566             : 
    5567             : ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
    5568             :        clear_ip_bgp_peer_ipv4_in_cmd,
    5569             :        "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
    5570             :        CLEAR_STR
    5571             :        IP_STR
    5572             :        BGP_STR
    5573             :        "BGP neighbor address to clear\n"
    5574             :        "Address family\n"
    5575             :        "Address Family modifier\n"
    5576             :        "Address Family modifier\n"
    5577             :        "Soft reconfig inbound update\n")
    5578             : 
    5579           0 : DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
    5580             :        clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
    5581             :        "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
    5582             :        CLEAR_STR
    5583             :        IP_STR
    5584             :        BGP_STR
    5585             :        "BGP neighbor address to clear\n"
    5586             :        "Address family\n"
    5587             :        "Address Family modifier\n"
    5588             :        "Address Family modifier\n"
    5589             :        "Soft reconfig inbound update\n"
    5590             :        "Push out the existing ORF prefix-list\n")
    5591             : {
    5592           0 :   if (strncmp (argv[1], "m", 1) == 0)
    5593           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
    5594             :                           BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
    5595             : 
    5596           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
    5597             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
    5598             : }
    5599             : 
    5600           0 : DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
    5601             :        clear_ip_bgp_peer_vpnv4_soft_in_cmd,
    5602             :        "clear ip bgp A.B.C.D vpnv4 unicast soft in",
    5603             :        CLEAR_STR
    5604             :        IP_STR
    5605             :        BGP_STR
    5606             :        "BGP neighbor address to clear\n"
    5607             :        "Address family\n"
    5608             :        "Address Family Modifier\n"
    5609             :        "Soft reconfig\n"
    5610             :        "Soft reconfig inbound update\n")
    5611             : {
    5612           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
    5613             :                         BGP_CLEAR_SOFT_IN, argv[0]);
    5614             : }
    5615             : 
    5616             : ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
    5617             :        clear_ip_bgp_peer_vpnv4_in_cmd,
    5618             :        "clear ip bgp A.B.C.D vpnv4 unicast in",
    5619             :        CLEAR_STR
    5620             :        IP_STR
    5621             :        BGP_STR
    5622             :        "BGP neighbor address to clear\n"
    5623             :        "Address family\n"
    5624             :        "Address Family Modifier\n"
    5625             :        "Soft reconfig inbound update\n")
    5626             : 
    5627           0 : DEFUN (clear_bgp_peer_soft_in,
    5628             :        clear_bgp_peer_soft_in_cmd,
    5629             :        "clear bgp (A.B.C.D|X:X::X:X) soft in",
    5630             :        CLEAR_STR
    5631             :        BGP_STR
    5632             :        "BGP neighbor address to clear\n"
    5633             :        "BGP IPv6 neighbor to clear\n"
    5634             :        "Soft reconfig\n"
    5635             :        "Soft reconfig inbound update\n")
    5636             : {
    5637           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
    5638             :                         BGP_CLEAR_SOFT_IN, argv[0]);
    5639             : }
    5640             : 
    5641             : ALIAS (clear_bgp_peer_soft_in,
    5642             :        clear_bgp_ipv6_peer_soft_in_cmd,
    5643             :        "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
    5644             :        CLEAR_STR
    5645             :        BGP_STR
    5646             :        "Address family\n"
    5647             :        "BGP neighbor address to clear\n"
    5648             :        "BGP IPv6 neighbor to clear\n"
    5649             :        "Soft reconfig\n"
    5650             :        "Soft reconfig inbound update\n")
    5651             : 
    5652             : ALIAS (clear_bgp_peer_soft_in,
    5653             :        clear_bgp_peer_in_cmd,
    5654             :        "clear bgp (A.B.C.D|X:X::X:X) in",
    5655             :        CLEAR_STR
    5656             :        BGP_STR
    5657             :        "BGP neighbor address to clear\n"
    5658             :        "BGP IPv6 neighbor to clear\n"
    5659             :        "Soft reconfig inbound update\n")
    5660             : 
    5661             : ALIAS (clear_bgp_peer_soft_in,
    5662             :        clear_bgp_ipv6_peer_in_cmd,
    5663             :        "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
    5664             :        CLEAR_STR
    5665             :        BGP_STR
    5666             :        "Address family\n"
    5667             :        "BGP neighbor address to clear\n"
    5668             :        "BGP IPv6 neighbor to clear\n"
    5669             :        "Soft reconfig inbound update\n")
    5670             : 
    5671           0 : DEFUN (clear_bgp_peer_in_prefix_filter,
    5672             :        clear_bgp_peer_in_prefix_filter_cmd,
    5673             :        "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
    5674             :        CLEAR_STR
    5675             :        BGP_STR
    5676             :        "BGP neighbor address to clear\n"
    5677             :        "BGP IPv6 neighbor to clear\n"
    5678             :        "Soft reconfig inbound update\n"
    5679             :        "Push out the existing ORF prefix-list\n")
    5680             : {
    5681           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
    5682             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
    5683             : }
    5684             : 
    5685             : ALIAS (clear_bgp_peer_in_prefix_filter,
    5686             :        clear_bgp_ipv6_peer_in_prefix_filter_cmd,
    5687             :        "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
    5688             :        CLEAR_STR
    5689             :        BGP_STR
    5690             :        "Address family\n"
    5691             :        "BGP neighbor address to clear\n"
    5692             :        "BGP IPv6 neighbor to clear\n"
    5693             :        "Soft reconfig inbound update\n"
    5694             :        "Push out the existing ORF prefix-list\n")
    5695             : 
    5696           0 : DEFUN (clear_ip_bgp_peer_group_soft_in,
    5697             :        clear_ip_bgp_peer_group_soft_in_cmd,
    5698             :        "clear ip bgp peer-group WORD soft in",
    5699             :        CLEAR_STR
    5700             :        IP_STR
    5701             :        BGP_STR
    5702             :        "Clear all members of peer-group\n"
    5703             :        "BGP peer-group name\n"
    5704             :        "Soft reconfig\n"
    5705             :        "Soft reconfig inbound update\n")
    5706             : {
    5707           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
    5708             :                         BGP_CLEAR_SOFT_IN, argv[0]);
    5709             : }
    5710             : 
    5711             : ALIAS (clear_ip_bgp_peer_group_soft_in,
    5712             :        clear_ip_bgp_peer_group_in_cmd,
    5713             :        "clear ip bgp peer-group WORD in",
    5714             :        CLEAR_STR
    5715             :        IP_STR
    5716             :        BGP_STR
    5717             :        "Clear all members of peer-group\n"
    5718             :        "BGP peer-group name\n"
    5719             :        "Soft reconfig inbound update\n")
    5720             : 
    5721           0 : DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
    5722             :        clear_ip_bgp_peer_group_in_prefix_filter_cmd,
    5723             :        "clear ip bgp peer-group WORD in prefix-filter",
    5724             :        CLEAR_STR
    5725             :        IP_STR
    5726             :        BGP_STR
    5727             :        "Clear all members of peer-group\n"
    5728             :        "BGP peer-group name\n"
    5729             :        "Soft reconfig inbound update\n"
    5730             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    5731             : {
    5732           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
    5733             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
    5734             : }
    5735             : 
    5736           0 : DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
    5737             :        clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
    5738             :        "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
    5739             :        CLEAR_STR
    5740             :        IP_STR
    5741             :        BGP_STR
    5742             :        "Clear all members of peer-group\n"
    5743             :        "BGP peer-group name\n"
    5744             :        "Address family\n"
    5745             :        "Address Family modifier\n"
    5746             :        "Address Family modifier\n"
    5747             :        "Soft reconfig\n"
    5748             :        "Soft reconfig inbound update\n")
    5749             : {
    5750           0 :   if (strncmp (argv[1], "m", 1) == 0)
    5751           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
    5752             :                           BGP_CLEAR_SOFT_IN, argv[0]);
    5753             : 
    5754           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
    5755             :                         BGP_CLEAR_SOFT_IN, argv[0]);
    5756             : }
    5757             : 
    5758             : ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
    5759             :        clear_ip_bgp_peer_group_ipv4_in_cmd,
    5760             :        "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
    5761             :        CLEAR_STR
    5762             :        IP_STR
    5763             :        BGP_STR
    5764             :        "Clear all members of peer-group\n"
    5765             :        "BGP peer-group name\n"
    5766             :        "Address family\n"
    5767             :        "Address Family modifier\n"
    5768             :        "Address Family modifier\n"
    5769             :        "Soft reconfig inbound update\n")
    5770             : 
    5771           0 : DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
    5772             :        clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
    5773             :        "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
    5774             :        CLEAR_STR
    5775             :        IP_STR
    5776             :        BGP_STR
    5777             :        "Clear all members of peer-group\n"
    5778             :        "BGP peer-group name\n"
    5779             :        "Address family\n"
    5780             :        "Address Family modifier\n"
    5781             :        "Address Family modifier\n"
    5782             :        "Soft reconfig inbound update\n"
    5783             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    5784             : {
    5785           0 :   if (strncmp (argv[1], "m", 1) == 0)
    5786           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
    5787             :                           BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
    5788             : 
    5789           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
    5790             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
    5791             : }
    5792             : 
    5793           0 : DEFUN (clear_bgp_peer_group_soft_in,
    5794             :        clear_bgp_peer_group_soft_in_cmd,
    5795             :        "clear bgp peer-group WORD soft in",
    5796             :        CLEAR_STR
    5797             :        BGP_STR
    5798             :        "Clear all members of peer-group\n"
    5799             :        "BGP peer-group name\n"
    5800             :        "Soft reconfig\n"
    5801             :        "Soft reconfig inbound update\n")
    5802             : {
    5803           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
    5804             :                         BGP_CLEAR_SOFT_IN, argv[0]);
    5805             : }
    5806             : 
    5807             : ALIAS (clear_bgp_peer_group_soft_in,
    5808             :        clear_bgp_ipv6_peer_group_soft_in_cmd,
    5809             :        "clear bgp ipv6 peer-group WORD soft in",
    5810             :        CLEAR_STR
    5811             :        BGP_STR
    5812             :        "Address family\n"
    5813             :        "Clear all members of peer-group\n"
    5814             :        "BGP peer-group name\n"
    5815             :        "Soft reconfig\n"
    5816             :        "Soft reconfig inbound update\n")
    5817             : 
    5818             : ALIAS (clear_bgp_peer_group_soft_in,
    5819             :        clear_bgp_peer_group_in_cmd,
    5820             :        "clear bgp peer-group WORD in",
    5821             :        CLEAR_STR
    5822             :        BGP_STR
    5823             :        "Clear all members of peer-group\n"
    5824             :        "BGP peer-group name\n"
    5825             :        "Soft reconfig inbound update\n")
    5826             : 
    5827             : ALIAS (clear_bgp_peer_group_soft_in,
    5828             :        clear_bgp_ipv6_peer_group_in_cmd,
    5829             :        "clear bgp ipv6 peer-group WORD in",
    5830             :        CLEAR_STR
    5831             :        BGP_STR
    5832             :        "Address family\n"
    5833             :        "Clear all members of peer-group\n"
    5834             :        "BGP peer-group name\n"
    5835             :        "Soft reconfig inbound update\n")
    5836             : 
    5837           0 : DEFUN (clear_bgp_peer_group_in_prefix_filter,
    5838             :        clear_bgp_peer_group_in_prefix_filter_cmd,
    5839             :        "clear bgp peer-group WORD in prefix-filter",
    5840             :        CLEAR_STR
    5841             :        BGP_STR
    5842             :        "Clear all members of peer-group\n"
    5843             :        "BGP peer-group name\n"
    5844             :        "Soft reconfig inbound update\n"
    5845             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    5846             : {
    5847           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
    5848             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
    5849             : }
    5850             : 
    5851             : ALIAS (clear_bgp_peer_group_in_prefix_filter,
    5852             :        clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
    5853             :        "clear bgp ipv6 peer-group WORD in prefix-filter",
    5854             :        CLEAR_STR
    5855             :        BGP_STR
    5856             :        "Address family\n"
    5857             :        "Clear all members of peer-group\n"
    5858             :        "BGP peer-group name\n"
    5859             :        "Soft reconfig inbound update\n"
    5860             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    5861             : 
    5862           0 : DEFUN (clear_ip_bgp_external_soft_in,
    5863             :        clear_ip_bgp_external_soft_in_cmd,
    5864             :        "clear ip bgp external soft in",
    5865             :        CLEAR_STR
    5866             :        IP_STR
    5867             :        BGP_STR
    5868             :        "Clear all external peers\n"
    5869             :        "Soft reconfig\n"
    5870             :        "Soft reconfig inbound update\n")
    5871             : {
    5872           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
    5873             :                         BGP_CLEAR_SOFT_IN, NULL);
    5874             : }
    5875             : 
    5876             : ALIAS (clear_ip_bgp_external_soft_in,
    5877             :        clear_ip_bgp_external_in_cmd,
    5878             :        "clear ip bgp external in",
    5879             :        CLEAR_STR
    5880             :        IP_STR
    5881             :        BGP_STR
    5882             :        "Clear all external peers\n"
    5883             :        "Soft reconfig inbound update\n")
    5884             : 
    5885           0 : DEFUN (clear_ip_bgp_external_in_prefix_filter,
    5886             :        clear_ip_bgp_external_in_prefix_filter_cmd,
    5887             :        "clear ip bgp external in prefix-filter",
    5888             :        CLEAR_STR
    5889             :        IP_STR
    5890             :        BGP_STR
    5891             :        "Clear all external peers\n"
    5892             :        "Soft reconfig inbound update\n"
    5893             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    5894             : {
    5895           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
    5896             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
    5897             : }
    5898             : 
    5899           0 : DEFUN (clear_ip_bgp_external_ipv4_soft_in,
    5900             :        clear_ip_bgp_external_ipv4_soft_in_cmd,
    5901             :        "clear ip bgp external ipv4 (unicast|multicast) soft in",
    5902             :        CLEAR_STR
    5903             :        IP_STR
    5904             :        BGP_STR
    5905             :        "Clear all external peers\n"
    5906             :        "Address family\n"
    5907             :        "Address Family modifier\n"
    5908             :        "Address Family modifier\n"
    5909             :        "Soft reconfig\n"
    5910             :        "Soft reconfig inbound update\n")
    5911             : {
    5912           0 :   if (strncmp (argv[0], "m", 1) == 0)
    5913           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
    5914             :                           BGP_CLEAR_SOFT_IN, NULL);
    5915             : 
    5916           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
    5917             :                         BGP_CLEAR_SOFT_IN, NULL);
    5918             : }
    5919             : 
    5920             : ALIAS (clear_ip_bgp_external_ipv4_soft_in,
    5921             :        clear_ip_bgp_external_ipv4_in_cmd,
    5922             :        "clear ip bgp external ipv4 (unicast|multicast) in",
    5923             :        CLEAR_STR
    5924             :        IP_STR
    5925             :        BGP_STR
    5926             :        "Clear all external peers\n"
    5927             :        "Address family\n"
    5928             :        "Address Family modifier\n"
    5929             :        "Address Family modifier\n"
    5930             :        "Soft reconfig inbound update\n")
    5931             : 
    5932           0 : DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
    5933             :        clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
    5934             :        "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
    5935             :        CLEAR_STR
    5936             :        IP_STR
    5937             :        BGP_STR
    5938             :        "Clear all external peers\n"
    5939             :        "Address family\n"
    5940             :        "Address Family modifier\n"
    5941             :        "Address Family modifier\n"
    5942             :        "Soft reconfig inbound update\n"
    5943             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    5944             : {
    5945           0 :   if (strncmp (argv[0], "m", 1) == 0)
    5946           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
    5947             :                           BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
    5948             : 
    5949           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
    5950             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
    5951             : }
    5952             : 
    5953           0 : DEFUN (clear_bgp_external_soft_in,
    5954             :        clear_bgp_external_soft_in_cmd,
    5955             :        "clear bgp external soft in",
    5956             :        CLEAR_STR
    5957             :        BGP_STR
    5958             :        "Clear all external peers\n"
    5959             :        "Soft reconfig\n"
    5960             :        "Soft reconfig inbound update\n")
    5961             : {
    5962           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
    5963             :                         BGP_CLEAR_SOFT_IN, NULL);
    5964             : }
    5965             : 
    5966             : ALIAS (clear_bgp_external_soft_in,
    5967             :        clear_bgp_ipv6_external_soft_in_cmd,
    5968             :        "clear bgp ipv6 external soft in",
    5969             :        CLEAR_STR
    5970             :        BGP_STR
    5971             :        "Address family\n"
    5972             :        "Clear all external peers\n"
    5973             :        "Soft reconfig\n"
    5974             :        "Soft reconfig inbound update\n")
    5975             : 
    5976             : ALIAS (clear_bgp_external_soft_in,
    5977             :        clear_bgp_external_in_cmd,
    5978             :        "clear bgp external in",
    5979             :        CLEAR_STR
    5980             :        BGP_STR
    5981             :        "Clear all external peers\n"
    5982             :        "Soft reconfig inbound update\n")
    5983             : 
    5984             : ALIAS (clear_bgp_external_soft_in,
    5985             :        clear_bgp_ipv6_external_in_cmd,
    5986             :        "clear bgp ipv6 external WORD in",
    5987             :        CLEAR_STR
    5988             :        BGP_STR
    5989             :        "Address family\n"
    5990             :        "Clear all external peers\n"
    5991             :        "Soft reconfig inbound update\n")
    5992             : 
    5993           0 : DEFUN (clear_bgp_external_in_prefix_filter,
    5994             :        clear_bgp_external_in_prefix_filter_cmd,
    5995             :        "clear bgp external in prefix-filter",
    5996             :        CLEAR_STR
    5997             :        BGP_STR
    5998             :        "Clear all external peers\n"
    5999             :        "Soft reconfig inbound update\n"
    6000             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    6001             : {
    6002           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
    6003             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
    6004             : }
    6005             : 
    6006             : ALIAS (clear_bgp_external_in_prefix_filter,
    6007             :        clear_bgp_ipv6_external_in_prefix_filter_cmd,
    6008             :        "clear bgp ipv6 external in prefix-filter",
    6009             :        CLEAR_STR
    6010             :        BGP_STR
    6011             :        "Address family\n"
    6012             :        "Clear all external peers\n"
    6013             :        "Soft reconfig inbound update\n"
    6014             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    6015             : 
    6016           0 : DEFUN (clear_ip_bgp_as_soft_in,
    6017             :        clear_ip_bgp_as_soft_in_cmd,
    6018             :        "clear ip bgp " CMD_AS_RANGE " soft in",
    6019             :        CLEAR_STR
    6020             :        IP_STR
    6021             :        BGP_STR
    6022             :        "Clear peers with the AS number\n"
    6023             :        "Soft reconfig\n"
    6024             :        "Soft reconfig inbound update\n")
    6025             : {
    6026           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
    6027             :                         BGP_CLEAR_SOFT_IN, argv[0]);
    6028             : }
    6029             : 
    6030             : ALIAS (clear_ip_bgp_as_soft_in,
    6031             :        clear_ip_bgp_as_in_cmd,
    6032             :        "clear ip bgp " CMD_AS_RANGE " in",
    6033             :        CLEAR_STR
    6034             :        IP_STR
    6035             :        BGP_STR
    6036             :        "Clear peers with the AS number\n"
    6037             :        "Soft reconfig inbound update\n")
    6038             : 
    6039           0 : DEFUN (clear_ip_bgp_as_in_prefix_filter,
    6040             :        clear_ip_bgp_as_in_prefix_filter_cmd,
    6041             :        "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
    6042             :        CLEAR_STR
    6043             :        IP_STR
    6044             :        BGP_STR
    6045             :        "Clear peers with the AS number\n"
    6046             :        "Soft reconfig inbound update\n"
    6047             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    6048             : {
    6049           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
    6050             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
    6051             : }
    6052             : 
    6053           0 : DEFUN (clear_ip_bgp_as_ipv4_soft_in,
    6054             :        clear_ip_bgp_as_ipv4_soft_in_cmd,
    6055             :        "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
    6056             :        CLEAR_STR
    6057             :        IP_STR
    6058             :        BGP_STR
    6059             :        "Clear peers with the AS number\n"
    6060             :        "Address family\n"
    6061             :        "Address Family modifier\n"
    6062             :        "Address Family modifier\n"
    6063             :        "Soft reconfig\n"
    6064             :        "Soft reconfig inbound update\n")
    6065             : {
    6066           0 :   if (strncmp (argv[1], "m", 1) == 0)
    6067           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
    6068             :                           BGP_CLEAR_SOFT_IN, argv[0]);
    6069             : 
    6070           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
    6071             :                         BGP_CLEAR_SOFT_IN, argv[0]);
    6072             : }
    6073             : 
    6074             : ALIAS (clear_ip_bgp_as_ipv4_soft_in,
    6075             :        clear_ip_bgp_as_ipv4_in_cmd,
    6076             :        "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
    6077             :        CLEAR_STR
    6078             :        IP_STR
    6079             :        BGP_STR
    6080             :        "Clear peers with the AS number\n"
    6081             :        "Address family\n"
    6082             :        "Address Family modifier\n"
    6083             :        "Address Family modifier\n"
    6084             :        "Soft reconfig inbound update\n")
    6085             : 
    6086           0 : DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
    6087             :        clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
    6088             :        "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
    6089             :        CLEAR_STR
    6090             :        IP_STR
    6091             :        BGP_STR
    6092             :        "Clear peers with the AS number\n"
    6093             :        "Address family\n"
    6094             :        "Address Family modifier\n"
    6095             :        "Address Family modifier\n"
    6096             :        "Soft reconfig inbound update\n"
    6097             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    6098             : {
    6099           0 :   if (strncmp (argv[1], "m", 1) == 0)
    6100           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
    6101             :                           BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
    6102             : 
    6103           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
    6104             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
    6105             : }
    6106             : 
    6107           0 : DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
    6108             :        clear_ip_bgp_as_vpnv4_soft_in_cmd,
    6109             :        "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
    6110             :        CLEAR_STR
    6111             :        IP_STR
    6112             :        BGP_STR
    6113             :        "Clear peers with the AS number\n"
    6114             :        "Address family\n"
    6115             :        "Address Family modifier\n"
    6116             :        "Soft reconfig\n"
    6117             :        "Soft reconfig inbound update\n")
    6118             : {
    6119           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
    6120             :                         BGP_CLEAR_SOFT_IN, argv[0]);
    6121             : }
    6122             : 
    6123             : ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
    6124             :        clear_ip_bgp_as_vpnv4_in_cmd,
    6125             :        "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
    6126             :        CLEAR_STR
    6127             :        IP_STR
    6128             :        BGP_STR
    6129             :        "Clear peers with the AS number\n"
    6130             :        "Address family\n"
    6131             :        "Address Family modifier\n"
    6132             :        "Soft reconfig inbound update\n")
    6133             : 
    6134           0 : DEFUN (clear_bgp_as_soft_in,
    6135             :        clear_bgp_as_soft_in_cmd,
    6136             :        "clear bgp " CMD_AS_RANGE " soft in",
    6137             :        CLEAR_STR
    6138             :        BGP_STR
    6139             :        "Clear peers with the AS number\n"
    6140             :        "Soft reconfig\n"
    6141             :        "Soft reconfig inbound update\n")
    6142             : {
    6143           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
    6144             :                         BGP_CLEAR_SOFT_IN, argv[0]);
    6145             : }
    6146             : 
    6147             : ALIAS (clear_bgp_as_soft_in,
    6148             :        clear_bgp_ipv6_as_soft_in_cmd,
    6149             :        "clear bgp ipv6 " CMD_AS_RANGE " soft in",
    6150             :        CLEAR_STR
    6151             :        BGP_STR
    6152             :        "Address family\n"
    6153             :        "Clear peers with the AS number\n"
    6154             :        "Soft reconfig\n"
    6155             :        "Soft reconfig inbound update\n")
    6156             : 
    6157             : ALIAS (clear_bgp_as_soft_in,
    6158             :        clear_bgp_as_in_cmd,
    6159             :        "clear bgp " CMD_AS_RANGE " in",
    6160             :        CLEAR_STR
    6161             :        BGP_STR
    6162             :        "Clear peers with the AS number\n"
    6163             :        "Soft reconfig inbound update\n")
    6164             : 
    6165             : ALIAS (clear_bgp_as_soft_in,
    6166             :        clear_bgp_ipv6_as_in_cmd,
    6167             :        "clear bgp ipv6 " CMD_AS_RANGE " in",
    6168             :        CLEAR_STR
    6169             :        BGP_STR
    6170             :        "Address family\n"
    6171             :        "Clear peers with the AS number\n"
    6172             :        "Soft reconfig inbound update\n")
    6173             : 
    6174           0 : DEFUN (clear_bgp_as_in_prefix_filter,
    6175             :        clear_bgp_as_in_prefix_filter_cmd,
    6176             :        "clear bgp " CMD_AS_RANGE " in prefix-filter",
    6177             :        CLEAR_STR
    6178             :        BGP_STR
    6179             :        "Clear peers with the AS number\n"
    6180             :        "Soft reconfig inbound update\n"
    6181             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    6182             : {
    6183           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
    6184             :                         BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
    6185             : }
    6186             : 
    6187             : ALIAS (clear_bgp_as_in_prefix_filter,
    6188             :        clear_bgp_ipv6_as_in_prefix_filter_cmd,
    6189             :        "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
    6190             :        CLEAR_STR
    6191             :        BGP_STR
    6192             :        "Address family\n"
    6193             :        "Clear peers with the AS number\n"
    6194             :        "Soft reconfig inbound update\n"
    6195             :        "Push out prefix-list ORF and do inbound soft reconfig\n")
    6196             : 
    6197             : /* Both soft-reconfiguration */
    6198           0 : DEFUN (clear_ip_bgp_all_soft,
    6199             :        clear_ip_bgp_all_soft_cmd,
    6200             :        "clear ip bgp * soft",
    6201             :        CLEAR_STR
    6202             :        IP_STR
    6203             :        BGP_STR
    6204             :        "Clear all peers\n"
    6205             :        "Soft reconfig\n")
    6206             : {
    6207           0 :   if (argc == 1)
    6208           0 :     return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
    6209             :                         BGP_CLEAR_SOFT_BOTH, NULL);
    6210             : 
    6211           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
    6212             :                         BGP_CLEAR_SOFT_BOTH, NULL);
    6213             : }
    6214             : 
    6215             : ALIAS (clear_ip_bgp_all_soft,
    6216             :        clear_ip_bgp_instance_all_soft_cmd,
    6217             :        "clear ip bgp view WORD * soft",
    6218             :        CLEAR_STR
    6219             :        IP_STR
    6220             :        BGP_STR
    6221             :        "BGP view\n"
    6222             :        "view name\n"
    6223             :        "Clear all peers\n"
    6224             :        "Soft reconfig\n")
    6225             : 
    6226             : 
    6227           0 : DEFUN (clear_ip_bgp_all_ipv4_soft,
    6228             :        clear_ip_bgp_all_ipv4_soft_cmd,
    6229             :        "clear ip bgp * ipv4 (unicast|multicast) soft",
    6230             :        CLEAR_STR
    6231             :        IP_STR
    6232             :        BGP_STR
    6233             :        "Clear all peers\n"
    6234             :        "Address family\n"
    6235             :        "Address Family Modifier\n"
    6236             :        "Address Family Modifier\n"
    6237             :        "Soft reconfig\n")
    6238             : {
    6239           0 :   if (strncmp (argv[0], "m", 1) == 0)
    6240           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
    6241             :                           BGP_CLEAR_SOFT_BOTH, NULL);
    6242             : 
    6243           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
    6244             :                         BGP_CLEAR_SOFT_BOTH, NULL);
    6245             : }
    6246             : 
    6247           0 : DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
    6248             :        clear_ip_bgp_instance_all_ipv4_soft_cmd,
    6249             :        "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
    6250             :        CLEAR_STR
    6251             :        IP_STR
    6252             :        BGP_STR
    6253             :        "BGP view\n"
    6254             :        "view name\n"
    6255             :        "Clear all peers\n"
    6256             :        "Address family\n"
    6257             :        "Address Family Modifier\n"
    6258             :        "Address Family Modifier\n"
    6259             :        "Soft reconfig\n")
    6260             : {
    6261           0 :   if (strncmp (argv[1], "m", 1) == 0)
    6262           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
    6263             :                           BGP_CLEAR_SOFT_BOTH, NULL);
    6264             : 
    6265           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
    6266             :                         BGP_CLEAR_SOFT_BOTH, NULL);
    6267             : }
    6268             : 
    6269           0 : DEFUN (clear_ip_bgp_all_vpnv4_soft,
    6270             :        clear_ip_bgp_all_vpnv4_soft_cmd,
    6271             :        "clear ip bgp * vpnv4 unicast soft",
    6272             :        CLEAR_STR
    6273             :        IP_STR
    6274             :        BGP_STR
    6275             :        "Clear all peers\n"
    6276             :        "Address family\n"
    6277             :        "Address Family Modifier\n"
    6278             :        "Soft reconfig\n")
    6279             : {
    6280           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
    6281             :                         BGP_CLEAR_SOFT_BOTH, argv[0]);
    6282             : }
    6283             : 
    6284           0 : DEFUN (clear_bgp_all_soft,
    6285             :        clear_bgp_all_soft_cmd,
    6286             :        "clear bgp * soft",
    6287             :        CLEAR_STR
    6288             :        BGP_STR
    6289             :        "Clear all peers\n"
    6290             :        "Soft reconfig\n")
    6291             : {
    6292           0 :   if (argc == 1)
    6293           0 :     return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
    6294             :                         BGP_CLEAR_SOFT_BOTH, argv[0]);
    6295             :  
    6296           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
    6297             :                         BGP_CLEAR_SOFT_BOTH, argv[0]);
    6298             : }
    6299             : 
    6300             : ALIAS (clear_bgp_all_soft,
    6301             :        clear_bgp_instance_all_soft_cmd,
    6302             :        "clear bgp view WORD * soft",
    6303             :        CLEAR_STR
    6304             :        BGP_STR
    6305             :        "BGP view\n"
    6306             :        "view name\n"
    6307             :        "Clear all peers\n"
    6308             :        "Soft reconfig\n")
    6309             : 
    6310             : ALIAS (clear_bgp_all_soft,
    6311             :        clear_bgp_ipv6_all_soft_cmd,
    6312             :        "clear bgp ipv6 * soft",
    6313             :        CLEAR_STR
    6314             :        BGP_STR
    6315             :        "Address family\n"
    6316             :        "Clear all peers\n"
    6317             :        "Soft reconfig\n")
    6318             : 
    6319           0 : DEFUN (clear_ip_bgp_peer_soft,
    6320             :        clear_ip_bgp_peer_soft_cmd,
    6321             :        "clear ip bgp A.B.C.D soft",
    6322             :        CLEAR_STR
    6323             :        IP_STR
    6324             :        BGP_STR
    6325             :        "BGP neighbor address to clear\n"
    6326             :        "Soft reconfig\n")
    6327             : {
    6328           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
    6329             :                         BGP_CLEAR_SOFT_BOTH, argv[0]);
    6330             : }
    6331             : 
    6332           0 : DEFUN (clear_ip_bgp_peer_ipv4_soft,
    6333             :        clear_ip_bgp_peer_ipv4_soft_cmd,
    6334             :        "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
    6335             :        CLEAR_STR
    6336             :        IP_STR
    6337             :        BGP_STR
    6338             :        "BGP neighbor address to clear\n"
    6339             :        "Address family\n"
    6340             :        "Address Family Modifier\n"
    6341             :        "Address Family Modifier\n"
    6342             :        "Soft reconfig\n")
    6343             : {
    6344           0 :   if (strncmp (argv[1], "m", 1) == 0)
    6345           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
    6346             :                           BGP_CLEAR_SOFT_BOTH, argv[0]);
    6347             : 
    6348           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
    6349             :                         BGP_CLEAR_SOFT_BOTH, argv[0]);
    6350             : }
    6351             : 
    6352           0 : DEFUN (clear_ip_bgp_peer_vpnv4_soft,
    6353             :        clear_ip_bgp_peer_vpnv4_soft_cmd,
    6354             :        "clear ip bgp A.B.C.D vpnv4 unicast soft",
    6355             :        CLEAR_STR
    6356             :        IP_STR
    6357             :        BGP_STR
    6358             :        "BGP neighbor address to clear\n"
    6359             :        "Address family\n"
    6360             :        "Address Family Modifier\n"
    6361             :        "Soft reconfig\n")
    6362             : {
    6363           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
    6364             :                         BGP_CLEAR_SOFT_BOTH, argv[0]);
    6365             : }
    6366             : 
    6367           0 : DEFUN (clear_bgp_peer_soft,
    6368             :        clear_bgp_peer_soft_cmd,
    6369             :        "clear bgp (A.B.C.D|X:X::X:X) soft",
    6370             :        CLEAR_STR
    6371             :        BGP_STR
    6372             :        "BGP neighbor address to clear\n"
    6373             :        "BGP IPv6 neighbor to clear\n"
    6374             :        "Soft reconfig\n")
    6375             : {
    6376           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
    6377             :                         BGP_CLEAR_SOFT_BOTH, argv[0]);
    6378             : }
    6379             : 
    6380             : ALIAS (clear_bgp_peer_soft,
    6381             :        clear_bgp_ipv6_peer_soft_cmd,
    6382             :        "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
    6383             :        CLEAR_STR
    6384             :        BGP_STR
    6385             :        "Address family\n"
    6386             :        "BGP neighbor address to clear\n"
    6387             :        "BGP IPv6 neighbor to clear\n"
    6388             :        "Soft reconfig\n")
    6389             : 
    6390           0 : DEFUN (clear_ip_bgp_peer_group_soft,
    6391             :        clear_ip_bgp_peer_group_soft_cmd,
    6392             :        "clear ip bgp peer-group WORD soft",
    6393             :        CLEAR_STR
    6394             :        IP_STR
    6395             :        BGP_STR
    6396             :        "Clear all members of peer-group\n"
    6397             :        "BGP peer-group name\n"
    6398             :        "Soft reconfig\n")
    6399             : {
    6400           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
    6401             :                         BGP_CLEAR_SOFT_BOTH, argv[0]);
    6402             : }
    6403             : 
    6404           0 : DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
    6405             :        clear_ip_bgp_peer_group_ipv4_soft_cmd,
    6406             :        "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
    6407             :        CLEAR_STR
    6408             :        IP_STR
    6409             :        BGP_STR
    6410             :        "Clear all members of peer-group\n"
    6411             :        "BGP peer-group name\n"
    6412             :        "Address family\n"
    6413             :        "Address Family modifier\n"
    6414             :        "Address Family modifier\n"
    6415             :        "Soft reconfig\n")
    6416             : {
    6417           0 :   if (strncmp (argv[1], "m", 1) == 0)
    6418           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
    6419             :                           BGP_CLEAR_SOFT_BOTH, argv[0]);
    6420             : 
    6421           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
    6422             :                         BGP_CLEAR_SOFT_BOTH, argv[0]);
    6423             : }
    6424             : 
    6425           0 : DEFUN (clear_bgp_peer_group_soft,
    6426             :        clear_bgp_peer_group_soft_cmd,
    6427             :        "clear bgp peer-group WORD soft",
    6428             :        CLEAR_STR
    6429             :        BGP_STR
    6430             :        "Clear all members of peer-group\n"
    6431             :        "BGP peer-group name\n"
    6432             :        "Soft reconfig\n")
    6433             : {
    6434           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
    6435             :                         BGP_CLEAR_SOFT_BOTH, argv[0]);
    6436             : }
    6437             : 
    6438             : ALIAS (clear_bgp_peer_group_soft,
    6439             :        clear_bgp_ipv6_peer_group_soft_cmd,
    6440             :        "clear bgp ipv6 peer-group WORD soft",
    6441             :        CLEAR_STR
    6442             :        BGP_STR
    6443             :        "Address family\n"
    6444             :        "Clear all members of peer-group\n"
    6445             :        "BGP peer-group name\n"
    6446             :        "Soft reconfig\n")
    6447             : 
    6448           0 : DEFUN (clear_ip_bgp_external_soft,
    6449             :        clear_ip_bgp_external_soft_cmd,
    6450             :        "clear ip bgp external soft",
    6451             :        CLEAR_STR
    6452             :        IP_STR
    6453             :        BGP_STR
    6454             :        "Clear all external peers\n"
    6455             :        "Soft reconfig\n")
    6456             : {
    6457           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
    6458             :                         BGP_CLEAR_SOFT_BOTH, NULL);
    6459             : }
    6460             : 
    6461           0 : DEFUN (clear_ip_bgp_external_ipv4_soft,
    6462             :        clear_ip_bgp_external_ipv4_soft_cmd,
    6463             :        "clear ip bgp external ipv4 (unicast|multicast) soft",
    6464             :        CLEAR_STR
    6465             :        IP_STR
    6466             :        BGP_STR
    6467             :        "Clear all external peers\n"
    6468             :        "Address family\n"
    6469             :        "Address Family modifier\n"
    6470             :        "Address Family modifier\n"
    6471             :        "Soft reconfig\n")
    6472             : {
    6473           0 :   if (strncmp (argv[0], "m", 1) == 0)
    6474           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
    6475             :                           BGP_CLEAR_SOFT_BOTH, NULL);
    6476             : 
    6477           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
    6478             :                         BGP_CLEAR_SOFT_BOTH, NULL);
    6479             : }
    6480             : 
    6481           0 : DEFUN (clear_bgp_external_soft,
    6482             :        clear_bgp_external_soft_cmd,
    6483             :        "clear bgp external soft",
    6484             :        CLEAR_STR
    6485             :        BGP_STR
    6486             :        "Clear all external peers\n"
    6487             :        "Soft reconfig\n")
    6488             : {
    6489           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
    6490             :                         BGP_CLEAR_SOFT_BOTH, NULL);
    6491             : }
    6492             : 
    6493             : ALIAS (clear_bgp_external_soft,
    6494             :        clear_bgp_ipv6_external_soft_cmd,
    6495             :        "clear bgp ipv6 external soft",
    6496             :        CLEAR_STR
    6497             :        BGP_STR
    6498             :        "Address family\n"
    6499             :        "Clear all external peers\n"
    6500             :        "Soft reconfig\n")
    6501             : 
    6502           0 : DEFUN (clear_ip_bgp_as_soft,
    6503             :        clear_ip_bgp_as_soft_cmd,
    6504             :        "clear ip bgp " CMD_AS_RANGE " soft",
    6505             :        CLEAR_STR
    6506             :        IP_STR
    6507             :        BGP_STR
    6508             :        "Clear peers with the AS number\n"
    6509             :        "Soft reconfig\n")
    6510             : {
    6511           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
    6512             :                         BGP_CLEAR_SOFT_BOTH, argv[0]);
    6513             : }
    6514             : 
    6515           0 : DEFUN (clear_ip_bgp_as_ipv4_soft,
    6516             :        clear_ip_bgp_as_ipv4_soft_cmd,
    6517             :        "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
    6518             :        CLEAR_STR
    6519             :        IP_STR
    6520             :        BGP_STR
    6521             :        "Clear peers with the AS number\n"
    6522             :        "Address family\n"
    6523             :        "Address Family Modifier\n"
    6524             :        "Address Family Modifier\n"
    6525             :        "Soft reconfig\n")
    6526             : {
    6527           0 :   if (strncmp (argv[1], "m", 1) == 0)
    6528           0 :     return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
    6529             :                           BGP_CLEAR_SOFT_BOTH, argv[0]);
    6530             : 
    6531           0 :   return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
    6532             :                         BGP_CLEAR_SOFT_BOTH, argv[0]);
    6533             : }
    6534             : 
    6535           0 : DEFUN (clear_ip_bgp_as_vpnv4_soft,
    6536             :        clear_ip_bgp_as_vpnv4_soft_cmd,
    6537             :        "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
    6538             :        CLEAR_STR
    6539             :        IP_STR
    6540             :        BGP_STR
    6541             :        "Clear peers with the AS number\n"
    6542             :        "Address family\n"
    6543             :        "Address Family Modifier\n"
    6544             :        "Soft reconfig\n")
    6545             : {
    6546           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
    6547             :                         BGP_CLEAR_SOFT_BOTH, argv[0]);
    6548             : }
    6549             : 
    6550           0 : DEFUN (clear_bgp_as_soft,
    6551             :        clear_bgp_as_soft_cmd,
    6552             :        "clear bgp " CMD_AS_RANGE " soft",
    6553             :        CLEAR_STR
    6554             :        BGP_STR
    6555             :        "Clear peers with the AS number\n"
    6556             :        "Soft reconfig\n")
    6557             : {
    6558           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
    6559             :                         BGP_CLEAR_SOFT_BOTH, argv[0]);
    6560             : }
    6561             : 
    6562             : ALIAS (clear_bgp_as_soft,
    6563             :        clear_bgp_ipv6_as_soft_cmd,
    6564             :        "clear bgp ipv6 " CMD_AS_RANGE " soft",
    6565             :        CLEAR_STR
    6566             :        BGP_STR
    6567             :        "Address family\n"
    6568             :        "Clear peers with the AS number\n"
    6569             :        "Soft reconfig\n")
    6570             : 
    6571             : /* RS-client soft reconfiguration. */
    6572             : #ifdef HAVE_IPV6
    6573           0 : DEFUN (clear_bgp_all_rsclient,
    6574             :        clear_bgp_all_rsclient_cmd,
    6575             :        "clear bgp * rsclient",
    6576             :        CLEAR_STR
    6577             :        BGP_STR
    6578             :        "Clear all peers\n"
    6579             :        "Soft reconfig for rsclient RIB\n")
    6580             : {
    6581           0 :   if (argc == 1)
    6582           0 :     return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
    6583             :                           BGP_CLEAR_SOFT_RSCLIENT, NULL);
    6584             : 
    6585           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
    6586             :                         BGP_CLEAR_SOFT_RSCLIENT, NULL);
    6587             : }
    6588             : 
    6589             : ALIAS (clear_bgp_all_rsclient,
    6590             :        clear_bgp_ipv6_all_rsclient_cmd,
    6591             :        "clear bgp ipv6 * rsclient",
    6592             :        CLEAR_STR
    6593             :        BGP_STR
    6594             :        "Address family\n"
    6595             :        "Clear all peers\n"
    6596             :        "Soft reconfig for rsclient RIB\n")
    6597             : 
    6598             : ALIAS (clear_bgp_all_rsclient,
    6599             :        clear_bgp_instance_all_rsclient_cmd,
    6600             :        "clear bgp view WORD * rsclient",
    6601             :        CLEAR_STR
    6602             :        BGP_STR
    6603             :        "BGP view\n"
    6604             :        "view name\n"
    6605             :        "Clear all peers\n"
    6606             :        "Soft reconfig for rsclient RIB\n")
    6607             : 
    6608             : ALIAS (clear_bgp_all_rsclient,
    6609             :        clear_bgp_ipv6_instance_all_rsclient_cmd,
    6610             :        "clear bgp ipv6 view WORD * rsclient",
    6611             :        CLEAR_STR
    6612             :        BGP_STR
    6613             :        "Address family\n"
    6614             :        "BGP view\n"
    6615             :        "view name\n"
    6616             :        "Clear all peers\n"
    6617             :        "Soft reconfig for rsclient RIB\n")
    6618             : #endif /* HAVE_IPV6 */
    6619             : 
    6620           0 : DEFUN (clear_ip_bgp_all_rsclient,
    6621             :        clear_ip_bgp_all_rsclient_cmd,
    6622             :        "clear ip bgp * rsclient",
    6623             :        CLEAR_STR
    6624             :        IP_STR
    6625             :        BGP_STR
    6626             :        "Clear all peers\n"
    6627             :        "Soft reconfig for rsclient RIB\n")
    6628             : {
    6629           0 :   if (argc == 1)
    6630           0 :     return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
    6631             :                           BGP_CLEAR_SOFT_RSCLIENT, NULL);
    6632             : 
    6633           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
    6634             :                         BGP_CLEAR_SOFT_RSCLIENT, NULL);
    6635             : }
    6636             : 
    6637             : ALIAS (clear_ip_bgp_all_rsclient,
    6638             :        clear_ip_bgp_instance_all_rsclient_cmd,
    6639             :        "clear ip bgp view WORD * rsclient",
    6640             :        CLEAR_STR
    6641             :        IP_STR
    6642             :        BGP_STR
    6643             :        "BGP view\n"
    6644             :        "view name\n"
    6645             :        "Clear all peers\n"
    6646             :        "Soft reconfig for rsclient RIB\n")
    6647             : 
    6648             : #ifdef HAVE_IPV6
    6649           0 : DEFUN (clear_bgp_peer_rsclient,
    6650             :        clear_bgp_peer_rsclient_cmd,
    6651             :        "clear bgp (A.B.C.D|X:X::X:X) rsclient",
    6652             :        CLEAR_STR
    6653             :        BGP_STR
    6654             :        "BGP neighbor IP address to clear\n"
    6655             :        "BGP IPv6 neighbor to clear\n"
    6656             :        "Soft reconfig for rsclient RIB\n")
    6657             : {
    6658           0 :   if (argc == 2)
    6659           0 :     return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
    6660           0 :                           BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
    6661             : 
    6662           0 :   return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
    6663             :                         BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
    6664             : }
    6665             : 
    6666             : ALIAS (clear_bgp_peer_rsclient,
    6667             :        clear_bgp_ipv6_peer_rsclient_cmd,
    6668             :        "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
    6669             :        CLEAR_STR
    6670             :        BGP_STR
    6671             :        "Address family\n"
    6672             :        "BGP neighbor IP address to clear\n"
    6673             :        "BGP IPv6 neighbor to clear\n"
    6674             :        "Soft reconfig for rsclient RIB\n")
    6675             : 
    6676             : ALIAS (clear_bgp_peer_rsclient,
    6677             :        clear_bgp_instance_peer_rsclient_cmd,
    6678             :        "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
    6679             :        CLEAR_STR
    6680             :        BGP_STR
    6681             :        "BGP view\n"
    6682             :        "view name\n"
    6683             :        "BGP neighbor IP address to clear\n"
    6684             :        "BGP IPv6 neighbor to clear\n"
    6685             :        "Soft reconfig for rsclient RIB\n")
    6686             : 
    6687             : ALIAS (clear_bgp_peer_rsclient,
    6688             :        clear_bgp_ipv6_instance_peer_rsclient_cmd,
    6689             :        "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
    6690             :        CLEAR_STR
    6691             :        BGP_STR
    6692             :        "Address family\n"
    6693             :        "BGP view\n"
    6694             :        "view name\n"
    6695             :        "BGP neighbor IP address to clear\n"
    6696             :        "BGP IPv6 neighbor to clear\n"
    6697             :        "Soft reconfig for rsclient RIB\n")
    6698             : #endif /* HAVE_IPV6 */
    6699             : 
    6700           0 : DEFUN (clear_ip_bgp_peer_rsclient,
    6701             :        clear_ip_bgp_peer_rsclient_cmd,
    6702             :        "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
    6703             :        CLEAR_STR
    6704             :        IP_STR
    6705             :        BGP_STR
    6706             :        "BGP neighbor IP address to clear\n"
    6707             :        "BGP IPv6 neighbor to clear\n"
    6708             :        "Soft reconfig for rsclient RIB\n")
    6709             : {
    6710           0 :   if (argc == 2)
    6711           0 :     return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
    6712           0 :                           BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
    6713             : 
    6714           0 :   return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
    6715             :                         BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
    6716             : }
    6717             : 
    6718             : ALIAS (clear_ip_bgp_peer_rsclient,
    6719             :        clear_ip_bgp_instance_peer_rsclient_cmd,
    6720             :        "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
    6721             :        CLEAR_STR
    6722             :        IP_STR
    6723             :        BGP_STR
    6724             :        "BGP view\n"
    6725             :        "view name\n"
    6726             :        "BGP neighbor IP address to clear\n"
    6727             :        "BGP IPv6 neighbor to clear\n"
    6728             :        "Soft reconfig for rsclient RIB\n")
    6729             : 
    6730           0 : DEFUN (show_bgp_views,
    6731             :        show_bgp_views_cmd,
    6732             :        "show bgp views",
    6733             :        SHOW_STR
    6734             :        BGP_STR
    6735             :        "Show the defined BGP views\n")
    6736             : {
    6737           0 :   struct list *inst = bm->bgp;
    6738             :   struct listnode *node;
    6739             :   struct bgp *bgp;
    6740             : 
    6741           0 :   if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
    6742             :     {
    6743           0 :       vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
    6744           0 :       return CMD_WARNING;
    6745             :     }
    6746             :   
    6747           0 :   vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
    6748           0 :   for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
    6749           0 :     vty_out (vty, "\t%s (AS%u)%s", 
    6750           0 :              bgp->name ? bgp->name : "(null)",
    6751           0 :              bgp->as, VTY_NEWLINE);
    6752             :   
    6753           0 :   return CMD_SUCCESS;
    6754             : }
    6755             : 
    6756           0 : DEFUN (show_bgp_memory, 
    6757             :        show_bgp_memory_cmd,
    6758             :        "show bgp memory",
    6759             :        SHOW_STR
    6760             :        BGP_STR
    6761             :        "Global BGP memory statistics\n")
    6762             : {
    6763             :   char memstrbuf[MTYPE_MEMSTR_LEN];
    6764             :   unsigned long count;
    6765             :   
    6766             :   /* RIB related usage stats */
    6767           0 :   count = mtype_stats_alloc (MTYPE_BGP_NODE);
    6768           0 :   vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
    6769             :            mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6770             :                          count * sizeof (struct bgp_node)),
    6771           0 :            VTY_NEWLINE);
    6772             :   
    6773           0 :   count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
    6774           0 :   vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
    6775             :            mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6776             :                          count * sizeof (struct bgp_info)),
    6777           0 :            VTY_NEWLINE);
    6778           0 :   if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
    6779           0 :     vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
    6780             :              mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6781             :                            count * sizeof (struct bgp_info_extra)),
    6782           0 :              VTY_NEWLINE);
    6783             :   
    6784           0 :   if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
    6785           0 :     vty_out (vty, "%ld Static routes, using %s of memory%s", count,
    6786             :              mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6787             :                          count * sizeof (struct bgp_static)),
    6788           0 :              VTY_NEWLINE);
    6789             :   
    6790             :   /* Adj-In/Out */
    6791           0 :   if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
    6792           0 :     vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
    6793             :              mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6794             :                            count * sizeof (struct bgp_adj_in)),
    6795           0 :              VTY_NEWLINE);
    6796           0 :   if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
    6797           0 :     vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
    6798             :              mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6799             :                            count * sizeof (struct bgp_adj_out)),
    6800           0 :              VTY_NEWLINE);
    6801             :   
    6802           0 :   if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
    6803           0 :     vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
    6804             :              mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6805             :                          count * sizeof (struct bgp_nexthop_cache)),
    6806           0 :              VTY_NEWLINE);
    6807             : 
    6808           0 :   if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
    6809           0 :     vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
    6810             :              mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6811             :                          count * sizeof (struct bgp_damp_info)),
    6812           0 :              VTY_NEWLINE);
    6813             : 
    6814             :   /* Attributes */
    6815           0 :   count = attr_count();
    6816           0 :   vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, 
    6817             :            mtype_memstr (memstrbuf, sizeof (memstrbuf), 
    6818             :                          count * sizeof(struct attr)), 
    6819           0 :            VTY_NEWLINE);
    6820           0 :   if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
    6821           0 :     vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, 
    6822             :              mtype_memstr (memstrbuf, sizeof (memstrbuf), 
    6823             :                            count * sizeof(struct attr_extra)), 
    6824           0 :              VTY_NEWLINE);
    6825             :   
    6826           0 :   if ((count = attr_unknown_count()))
    6827           0 :     vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
    6828             :   
    6829             :   /* AS_PATH attributes */
    6830           0 :   count = aspath_count ();
    6831           0 :   vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
    6832             :            mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6833             :                          count * sizeof (struct aspath)),
    6834           0 :            VTY_NEWLINE);
    6835             :   
    6836           0 :   count = mtype_stats_alloc (MTYPE_AS_SEG);
    6837           0 :   vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
    6838             :            mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6839             :                          count * sizeof (struct assegment)),
    6840           0 :            VTY_NEWLINE);
    6841             :   
    6842             :   /* Other attributes */
    6843           0 :   if ((count = community_count ()))
    6844           0 :     vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
    6845             :              mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6846             :                          count * sizeof (struct community)),
    6847           0 :              VTY_NEWLINE);
    6848           0 :   if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
    6849           0 :     vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
    6850             :              mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6851             :                          count * sizeof (struct ecommunity)),
    6852           0 :              VTY_NEWLINE);
    6853             :   
    6854           0 :   if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
    6855           0 :     vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
    6856             :              mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6857             :                          count * sizeof (struct cluster_list)),
    6858           0 :              VTY_NEWLINE);
    6859             :   
    6860             :   /* Peer related usage */
    6861           0 :   count = mtype_stats_alloc (MTYPE_BGP_PEER);
    6862           0 :   vty_out (vty, "%ld peers, using %s of memory%s", count,
    6863             :            mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6864             :                          count * sizeof (struct peer)),
    6865           0 :            VTY_NEWLINE);
    6866             :   
    6867           0 :   if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
    6868           0 :     vty_out (vty, "%ld peer groups, using %s of memory%s", count,
    6869             :              mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6870             :                            count * sizeof (struct peer_group)),
    6871           0 :              VTY_NEWLINE);
    6872             :   
    6873             :   /* Other */
    6874           0 :   if ((count = mtype_stats_alloc (MTYPE_HASH)))
    6875           0 :     vty_out (vty, "%ld hash tables, using %s of memory%s", count,
    6876             :              mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6877             :                            count * sizeof (struct hash)),
    6878           0 :              VTY_NEWLINE);
    6879           0 :   if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
    6880           0 :     vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
    6881             :              mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6882             :                            count * sizeof (struct hash_backet)),
    6883           0 :              VTY_NEWLINE);
    6884           0 :   if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
    6885           0 :     vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
    6886             :              mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6887             :                            count * sizeof (regex_t)),
    6888           0 :              VTY_NEWLINE);
    6889           0 :   return CMD_SUCCESS;
    6890             : }
    6891             : 
    6892             : /* Show BGP peer's summary information. */
    6893             : static int
    6894           0 : bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
    6895             : {
    6896             :   struct peer *peer;
    6897             :   struct listnode *node, *nnode;
    6898           0 :   unsigned int count = 0;
    6899             :   char timebuf[BGP_UPTIME_LEN];
    6900             :   int len;
    6901             : 
    6902             :   /* Header string for each address family. */
    6903             :   static char header[] = "Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd";
    6904             :   
    6905           0 :   for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
    6906             :     {
    6907           0 :       if (peer->afc[afi][safi])
    6908             :         {
    6909           0 :           if (!count)
    6910             :             {
    6911             :               unsigned long ents;
    6912             :               char memstrbuf[MTYPE_MEMSTR_LEN];
    6913             :               
    6914             :               /* Usage summary and header */
    6915           0 :               vty_out (vty,
    6916             :                        "BGP router identifier %s, local AS number %u%s",
    6917           0 :                        inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
    6918             : 
    6919           0 :               ents = bgp_table_count (bgp->rib[afi][safi]);
    6920           0 :               vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
    6921             :                        mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6922             :                                      ents * sizeof (struct bgp_node)),
    6923           0 :                        VTY_NEWLINE);
    6924             :               
    6925             :               /* Peer related usage */
    6926           0 :               ents = listcount (bgp->peer);
    6927           0 :               vty_out (vty, "Peers %ld, using %s of memory%s",
    6928             :                        ents,
    6929             :                        mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6930             :                                      ents * sizeof (struct peer)),
    6931           0 :                        VTY_NEWLINE);
    6932             :               
    6933           0 :               if ((ents = listcount (bgp->rsclient)))
    6934           0 :                 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
    6935             :                          ents,
    6936             :                          mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6937             :                                        ents * sizeof (struct peer)),
    6938           0 :                          VTY_NEWLINE);
    6939             :               
    6940           0 :               if ((ents = listcount (bgp->group)))
    6941           0 :                 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
    6942             :                          mtype_memstr (memstrbuf, sizeof (memstrbuf),
    6943             :                                        ents * sizeof (struct peer_group)),
    6944           0 :                          VTY_NEWLINE);
    6945             : 
    6946           0 :               if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
    6947           0 :                 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
    6948           0 :               vty_out (vty, "%s", VTY_NEWLINE);
    6949           0 :               vty_out (vty, "%s%s", header, VTY_NEWLINE);
    6950             :             }
    6951             :           
    6952           0 :           count++;
    6953             : 
    6954           0 :           len = vty_out (vty, "%s", peer->host);
    6955           0 :           len = 16 - len;
    6956           0 :           if (len < 1)
    6957           0 :             vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
    6958             :           else
    6959           0 :             vty_out (vty, "%*s", len, " ");
    6960             : 
    6961           0 :           vty_out (vty, "4 ");
    6962             : 
    6963           0 :           vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
    6964             :                    peer->as,
    6965           0 :                    peer->open_in + peer->update_in + peer->keepalive_in
    6966           0 :                    + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
    6967           0 :                    peer->open_out + peer->update_out + peer->keepalive_out
    6968           0 :                    + peer->notify_out + peer->refresh_out
    6969           0 :                    + peer->dynamic_cap_out,
    6970           0 :                    0, 0, (unsigned long) peer->obuf->count);
    6971             : 
    6972           0 :           vty_out (vty, "%8s", 
    6973             :                    peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
    6974             : 
    6975           0 :           if (peer->status == Established)
    6976             :             {
    6977           0 :               vty_out (vty, " %8ld", peer->pcount[afi][safi]);
    6978             :             }
    6979             :           else
    6980             :             {
    6981           0 :               if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
    6982           0 :                 vty_out (vty, " Idle (Admin)");
    6983           0 :               else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
    6984           0 :                 vty_out (vty, " Idle (PfxCt)");
    6985             :               else
    6986           0 :                 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
    6987             :             }
    6988             : 
    6989           0 :           vty_out (vty, "%s", VTY_NEWLINE);
    6990             :         }
    6991             :     }
    6992             : 
    6993           0 :   if (count)
    6994           0 :     vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
    6995           0 :              count, VTY_NEWLINE);
    6996             :   else
    6997           0 :     vty_out (vty, "No %s neighbor is configured%s",
    6998           0 :              afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
    6999           0 :   return CMD_SUCCESS;
    7000             : }
    7001             : 
    7002             : static int 
    7003           0 : bgp_show_summary_vty (struct vty *vty, const char *name, 
    7004             :                       afi_t afi, safi_t safi)
    7005             : {
    7006             :   struct bgp *bgp;
    7007             : 
    7008           0 :   if (name)
    7009             :     {
    7010           0 :       bgp = bgp_lookup_by_name (name);
    7011             :       
    7012           0 :       if (! bgp)
    7013             :         {
    7014           0 :           vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); 
    7015           0 :           return CMD_WARNING;
    7016             :         }
    7017             : 
    7018           0 :       bgp_show_summary (vty, bgp, afi, safi);
    7019           0 :       return CMD_SUCCESS;
    7020             :     }
    7021             :   
    7022           0 :   bgp = bgp_get_default ();
    7023             : 
    7024           0 :   if (bgp)
    7025           0 :     bgp_show_summary (vty, bgp, afi, safi);    
    7026             :  
    7027           0 :   return CMD_SUCCESS;
    7028             : }
    7029             : 
    7030             : /* `show ip bgp summary' commands. */
    7031           0 : DEFUN (show_ip_bgp_summary, 
    7032             :        show_ip_bgp_summary_cmd,
    7033             :        "show ip bgp summary",
    7034             :        SHOW_STR
    7035             :        IP_STR
    7036             :        BGP_STR
    7037             :        "Summary of BGP neighbor status\n")
    7038             : {
    7039           0 :   return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
    7040             : }
    7041             : 
    7042           0 : DEFUN (show_ip_bgp_instance_summary,
    7043             :        show_ip_bgp_instance_summary_cmd,
    7044             :        "show ip bgp view WORD summary",
    7045             :        SHOW_STR
    7046             :        IP_STR
    7047             :        BGP_STR
    7048             :        "BGP view\n"
    7049             :        "View name\n"
    7050             :        "Summary of BGP neighbor status\n")
    7051             : {
    7052           0 :   return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);  
    7053             : }
    7054             : 
    7055           0 : DEFUN (show_ip_bgp_ipv4_summary, 
    7056             :        show_ip_bgp_ipv4_summary_cmd,
    7057             :        "show ip bgp ipv4 (unicast|multicast) summary",
    7058             :        SHOW_STR
    7059             :        IP_STR
    7060             :        BGP_STR
    7061             :        "Address family\n"
    7062             :        "Address Family modifier\n"
    7063             :        "Address Family modifier\n"
    7064             :        "Summary of BGP neighbor status\n")
    7065             : {
    7066           0 :   if (strncmp (argv[0], "m", 1) == 0)
    7067           0 :     return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
    7068             : 
    7069           0 :   return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
    7070             : }
    7071             : 
    7072             : ALIAS (show_ip_bgp_ipv4_summary,
    7073             :        show_bgp_ipv4_safi_summary_cmd,
    7074             :        "show bgp ipv4 (unicast|multicast) summary",
    7075             :        SHOW_STR
    7076             :        BGP_STR
    7077             :        "Address family\n"
    7078             :        "Address Family modifier\n"
    7079             :        "Address Family modifier\n"
    7080             :        "Summary of BGP neighbor status\n")
    7081             : 
    7082           0 : DEFUN (show_ip_bgp_instance_ipv4_summary,
    7083             :        show_ip_bgp_instance_ipv4_summary_cmd,
    7084             :        "show ip bgp view WORD ipv4 (unicast|multicast) summary",
    7085             :        SHOW_STR
    7086             :        IP_STR
    7087             :        BGP_STR
    7088             :        "BGP view\n"
    7089             :        "View name\n"
    7090             :        "Address family\n"
    7091             :        "Address Family modifier\n"
    7092             :        "Address Family modifier\n"
    7093             :        "Summary of BGP neighbor status\n")
    7094             : {
    7095           0 :   if (strncmp (argv[1], "m", 1) == 0)
    7096           0 :     return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
    7097             :   else
    7098           0 :     return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
    7099             : }
    7100             : 
    7101             : ALIAS (show_ip_bgp_instance_ipv4_summary,
    7102             :        show_bgp_instance_ipv4_safi_summary_cmd,
    7103             :        "show bgp view WORD ipv4 (unicast|multicast) summary",
    7104             :        SHOW_STR
    7105             :        BGP_STR
    7106             :        "BGP view\n"
    7107             :        "View name\n"
    7108             :        "Address family\n"
    7109             :        "Address Family modifier\n"
    7110             :        "Address Family modifier\n"
    7111             :        "Summary of BGP neighbor status\n")
    7112             : 
    7113           0 : DEFUN (show_ip_bgp_vpnv4_all_summary,
    7114             :        show_ip_bgp_vpnv4_all_summary_cmd,
    7115             :        "show ip bgp vpnv4 all summary",
    7116             :        SHOW_STR
    7117             :        IP_STR
    7118             :        BGP_STR
    7119             :        "Display VPNv4 NLRI specific information\n"
    7120             :        "Display information about all VPNv4 NLRIs\n"
    7121             :        "Summary of BGP neighbor status\n")
    7122             : {
    7123           0 :   return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
    7124             : }
    7125             : 
    7126           0 : DEFUN (show_ip_bgp_vpnv4_rd_summary,
    7127             :        show_ip_bgp_vpnv4_rd_summary_cmd,
    7128             :        "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
    7129             :        SHOW_STR
    7130             :        IP_STR
    7131             :        BGP_STR
    7132             :        "Display VPNv4 NLRI specific information\n"
    7133             :        "Display information for a route distinguisher\n"
    7134             :        "VPN Route Distinguisher\n"
    7135             :        "Summary of BGP neighbor status\n")
    7136             : {
    7137             :   int ret;
    7138             :   struct prefix_rd prd;
    7139             : 
    7140           0 :   ret = str2prefix_rd (argv[0], &prd);
    7141           0 :   if (! ret)
    7142             :     {
    7143           0 :       vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
    7144           0 :       return CMD_WARNING;
    7145             :     }
    7146             : 
    7147           0 :   return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
    7148             : }
    7149             : 
    7150             : #ifdef HAVE_IPV6
    7151           0 : DEFUN (show_bgp_summary, 
    7152             :        show_bgp_summary_cmd,
    7153             :        "show bgp summary",
    7154             :        SHOW_STR
    7155             :        BGP_STR
    7156             :        "Summary of BGP neighbor status\n")
    7157             : {
    7158           0 :   return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
    7159             : }
    7160             : 
    7161           0 : DEFUN (show_bgp_instance_summary,
    7162             :        show_bgp_instance_summary_cmd,
    7163             :        "show bgp view WORD summary",
    7164             :        SHOW_STR
    7165             :        BGP_STR
    7166             :        "BGP view\n"
    7167             :        "View name\n"
    7168             :        "Summary of BGP neighbor status\n")
    7169             : {
    7170           0 :   return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
    7171             : }
    7172             : 
    7173             : ALIAS (show_bgp_summary, 
    7174             :        show_bgp_ipv6_summary_cmd,
    7175             :        "show bgp ipv6 summary",
    7176             :        SHOW_STR
    7177             :        BGP_STR
    7178             :        "Address family\n"
    7179             :        "Summary of BGP neighbor status\n")
    7180             : 
    7181             : ALIAS (show_bgp_instance_summary,
    7182             :        show_bgp_instance_ipv6_summary_cmd,
    7183             :        "show bgp view WORD ipv6 summary",
    7184             :        SHOW_STR
    7185             :        BGP_STR
    7186             :        "BGP view\n"
    7187             :        "View name\n"
    7188             :        "Address family\n"
    7189             :        "Summary of BGP neighbor status\n")
    7190             : 
    7191           0 : DEFUN (show_bgp_ipv6_safi_summary,
    7192             :        show_bgp_ipv6_safi_summary_cmd,
    7193             :        "show bgp ipv6 (unicast|multicast) summary",
    7194             :        SHOW_STR
    7195             :        BGP_STR
    7196             :        "Address family\n"
    7197             :        "Address Family modifier\n"
    7198             :        "Address Family modifier\n"
    7199             :        "Summary of BGP neighbor status\n")
    7200             : {
    7201           0 :   if (strncmp (argv[0], "m", 1) == 0)
    7202           0 :     return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
    7203             : 
    7204           0 :   return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
    7205             : }
    7206             : 
    7207           0 : DEFUN (show_bgp_instance_ipv6_safi_summary,
    7208             :        show_bgp_instance_ipv6_safi_summary_cmd,
    7209             :        "show bgp view WORD ipv6 (unicast|multicast) summary",
    7210             :        SHOW_STR
    7211             :        BGP_STR
    7212             :        "BGP view\n"
    7213             :        "View name\n"
    7214             :        "Address family\n"
    7215             :        "Address Family modifier\n"
    7216             :        "Address Family modifier\n"
    7217             :        "Summary of BGP neighbor status\n")
    7218             : {
    7219           0 :   if (strncmp (argv[1], "m", 1) == 0)
    7220           0 :     return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
    7221             : 
    7222           0 :   return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
    7223             : }
    7224             : 
    7225             : /* old command */
    7226           0 : DEFUN (show_ipv6_bgp_summary, 
    7227             :        show_ipv6_bgp_summary_cmd,
    7228             :        "show ipv6 bgp summary",
    7229             :        SHOW_STR
    7230             :        IPV6_STR
    7231             :        BGP_STR
    7232             :        "Summary of BGP neighbor status\n")
    7233             : {
    7234           0 :   return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
    7235             : }
    7236             : 
    7237             : /* old command */
    7238           0 : DEFUN (show_ipv6_mbgp_summary, 
    7239             :        show_ipv6_mbgp_summary_cmd,
    7240             :        "show ipv6 mbgp summary",
    7241             :        SHOW_STR
    7242             :        IPV6_STR
    7243             :        MBGP_STR
    7244             :        "Summary of BGP neighbor status\n")
    7245             : {
    7246           0 :   return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
    7247             : }
    7248             : #endif /* HAVE_IPV6 */
    7249             : 
    7250             : const char *
    7251           5 : afi_safi_print (afi_t afi, safi_t safi)
    7252             : {
    7253           5 :   if (afi == AFI_IP && safi == SAFI_UNICAST)
    7254           2 :     return "IPv4 Unicast";
    7255           3 :   else if (afi == AFI_IP && safi == SAFI_MULTICAST)
    7256           0 :     return "IPv4 Multicast";
    7257           3 :   else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
    7258           0 :     return "VPNv4 Unicast";
    7259           3 :   else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
    7260           2 :     return "IPv6 Unicast";
    7261           1 :   else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
    7262           1 :     return "IPv6 Multicast";
    7263             :   else
    7264           0 :     return "Unknown";
    7265             : }
    7266             : 
    7267             : /* Show BGP peer's information. */
    7268             : enum show_type
    7269             : {
    7270             :   show_all,
    7271             :   show_peer
    7272             : };
    7273             : 
    7274             : static void
    7275           0 : bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
    7276             :                            afi_t afi, safi_t safi,
    7277             :                            u_int16_t adv_smcap, u_int16_t adv_rmcap,
    7278             :                            u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
    7279             : {
    7280             :   /* Send-Mode */
    7281           0 :   if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
    7282           0 :       || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
    7283             :     {
    7284           0 :       vty_out (vty, "      Send-mode: ");
    7285           0 :       if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
    7286           0 :         vty_out (vty, "advertised");
    7287           0 :       if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
    7288           0 :         vty_out (vty, "%sreceived",
    7289           0 :                  CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
    7290             :                  ", " : "");
    7291           0 :       vty_out (vty, "%s", VTY_NEWLINE);
    7292             :     }
    7293             : 
    7294             :   /* Receive-Mode */
    7295           0 :   if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
    7296           0 :       || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
    7297             :     {
    7298           0 :       vty_out (vty, "      Receive-mode: ");
    7299           0 :       if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
    7300           0 :         vty_out (vty, "advertised");
    7301           0 :       if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
    7302           0 :         vty_out (vty, "%sreceived",
    7303           0 :                  CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
    7304             :                  ", " : "");
    7305           0 :       vty_out (vty, "%s", VTY_NEWLINE);
    7306             :     }
    7307           0 : }
    7308             : 
    7309             : static void
    7310           0 : bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
    7311             : {
    7312             :   struct bgp_filter *filter;
    7313             :   char orf_pfx_name[BUFSIZ];
    7314             :   int orf_pfx_count;
    7315             : 
    7316           0 :   filter = &p->filter[afi][safi];
    7317             : 
    7318           0 :   vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
    7319           0 :            VTY_NEWLINE);
    7320             : 
    7321           0 :   if (p->af_group[afi][safi])
    7322           0 :     vty_out (vty, "  %s peer-group member%s", p->group->name, VTY_NEWLINE);
    7323             : 
    7324           0 :   if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
    7325           0 :       || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
    7326           0 :       || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
    7327           0 :       || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
    7328           0 :       || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
    7329           0 :       || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
    7330           0 :     vty_out (vty, "  AF-dependant capabilities:%s", VTY_NEWLINE);
    7331             : 
    7332           0 :   if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
    7333           0 :       || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
    7334           0 :       || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
    7335           0 :       || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
    7336             :     {
    7337           0 :       vty_out (vty, "    Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
    7338           0 :                ORF_TYPE_PREFIX, VTY_NEWLINE);
    7339           0 :       bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
    7340             :                                  PEER_CAP_ORF_PREFIX_SM_ADV,
    7341             :                                  PEER_CAP_ORF_PREFIX_RM_ADV,
    7342             :                                  PEER_CAP_ORF_PREFIX_SM_RCV,
    7343             :                                  PEER_CAP_ORF_PREFIX_RM_RCV);
    7344             :     }
    7345           0 :   if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
    7346           0 :       || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
    7347           0 :       || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
    7348           0 :       || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
    7349             :     {
    7350           0 :       vty_out (vty, "    Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
    7351           0 :                ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
    7352           0 :       bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
    7353             :                                  PEER_CAP_ORF_PREFIX_SM_ADV,
    7354             :                                  PEER_CAP_ORF_PREFIX_RM_ADV,
    7355             :                                  PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
    7356             :                                  PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
    7357             :     }
    7358             : 
    7359           0 :   sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
    7360           0 :   orf_pfx_count =  prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
    7361             : 
    7362           0 :   if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
    7363           0 :       || orf_pfx_count)
    7364             :     {
    7365           0 :       vty_out (vty, "  Outbound Route Filter (ORF):");
    7366           0 :       if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
    7367           0 :           vty_out (vty, " sent;");
    7368           0 :       if (orf_pfx_count)
    7369           0 :         vty_out (vty, " received (%d entries)", orf_pfx_count);
    7370           0 :       vty_out (vty, "%s", VTY_NEWLINE);
    7371             :     }
    7372           0 :   if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
    7373           0 :       vty_out (vty, "  First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
    7374             : 
    7375           0 :   if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
    7376           0 :     vty_out (vty, "  Route-Reflector Client%s", VTY_NEWLINE);
    7377           0 :   if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
    7378           0 :     vty_out (vty, "  Route-Server Client%s", VTY_NEWLINE);
    7379           0 :   if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
    7380           0 :     vty_out (vty, "  Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
    7381           0 :   if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
    7382           0 :     vty_out (vty, "  Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
    7383           0 :   if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
    7384           0 :     vty_out (vty, "  NEXT_HOP is always this router%s", VTY_NEWLINE);
    7385           0 :   if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
    7386           0 :     vty_out (vty, "  AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
    7387           0 :   if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
    7388           0 :     vty_out (vty, "  NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
    7389           0 :   if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
    7390           0 :     vty_out (vty, "  MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
    7391           0 :   if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
    7392           0 :       || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
    7393             :     {
    7394           0 :       vty_out (vty, "  Community attribute sent to this neighbor");
    7395           0 :       if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
    7396           0 :         && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
    7397           0 :         vty_out (vty, "(both)%s", VTY_NEWLINE);
    7398           0 :       else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
    7399           0 :         vty_out (vty, "(extended)%s", VTY_NEWLINE);
    7400             :       else 
    7401           0 :         vty_out (vty, "(standard)%s", VTY_NEWLINE);
    7402             :     }
    7403           0 :   if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
    7404             :     {
    7405           0 :       vty_out (vty, "  Default information originate,");
    7406             : 
    7407           0 :       if (p->default_rmap[afi][safi].name)
    7408           0 :         vty_out (vty, " default route-map %s%s,",
    7409           0 :                  p->default_rmap[afi][safi].map ? "*" : "",
    7410             :                  p->default_rmap[afi][safi].name);
    7411           0 :       if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
    7412           0 :         vty_out (vty, " default sent%s", VTY_NEWLINE);
    7413             :       else
    7414           0 :         vty_out (vty, " default not sent%s", VTY_NEWLINE);
    7415             :     }
    7416             : 
    7417           0 :   if (filter->plist[FILTER_IN].name
    7418           0 :       || filter->dlist[FILTER_IN].name
    7419           0 :       || filter->aslist[FILTER_IN].name
    7420           0 :       || filter->map[RMAP_IN].name)
    7421           0 :     vty_out (vty, "  Inbound path policy configured%s", VTY_NEWLINE);
    7422           0 :   if (filter->plist[FILTER_OUT].name
    7423           0 :       || filter->dlist[FILTER_OUT].name
    7424           0 :       || filter->aslist[FILTER_OUT].name
    7425           0 :       || filter->map[RMAP_OUT].name
    7426           0 :       || filter->usmap.name)
    7427           0 :     vty_out (vty, "  Outbound path policy configured%s", VTY_NEWLINE);
    7428           0 :   if (filter->map[RMAP_IMPORT].name)
    7429           0 :     vty_out (vty, "  Import policy for this RS-client configured%s", VTY_NEWLINE);
    7430           0 :   if (filter->map[RMAP_EXPORT].name)
    7431           0 :     vty_out (vty, "  Export policy for this RS-client configured%s", VTY_NEWLINE);
    7432             : 
    7433             :   /* prefix-list */
    7434           0 :   if (filter->plist[FILTER_IN].name)
    7435           0 :     vty_out (vty, "  Incoming update prefix filter list is %s%s%s",
    7436           0 :              filter->plist[FILTER_IN].plist ? "*" : "",
    7437             :              filter->plist[FILTER_IN].name,
    7438           0 :              VTY_NEWLINE);
    7439           0 :   if (filter->plist[FILTER_OUT].name)
    7440           0 :     vty_out (vty, "  Outgoing update prefix filter list is %s%s%s",
    7441           0 :              filter->plist[FILTER_OUT].plist ? "*" : "",
    7442             :              filter->plist[FILTER_OUT].name,
    7443           0 :              VTY_NEWLINE);
    7444             : 
    7445             :   /* distribute-list */
    7446           0 :   if (filter->dlist[FILTER_IN].name)
    7447           0 :     vty_out (vty, "  Incoming update network filter list is %s%s%s",
    7448           0 :              filter->dlist[FILTER_IN].alist ? "*" : "",
    7449             :              filter->dlist[FILTER_IN].name,
    7450           0 :              VTY_NEWLINE);
    7451           0 :   if (filter->dlist[FILTER_OUT].name)
    7452           0 :     vty_out (vty, "  Outgoing update network filter list is %s%s%s",
    7453           0 :              filter->dlist[FILTER_OUT].alist ? "*" : "",
    7454             :              filter->dlist[FILTER_OUT].name,
    7455           0 :              VTY_NEWLINE);
    7456             : 
    7457             :   /* filter-list. */
    7458           0 :   if (filter->aslist[FILTER_IN].name)
    7459           0 :     vty_out (vty, "  Incoming update AS path filter list is %s%s%s",
    7460           0 :              filter->aslist[FILTER_IN].aslist ? "*" : "",
    7461             :              filter->aslist[FILTER_IN].name,
    7462           0 :              VTY_NEWLINE);
    7463           0 :   if (filter->aslist[FILTER_OUT].name)
    7464           0 :     vty_out (vty, "  Outgoing update AS path filter list is %s%s%s",
    7465           0 :              filter->aslist[FILTER_OUT].aslist ? "*" : "",
    7466             :              filter->aslist[FILTER_OUT].name,
    7467           0 :              VTY_NEWLINE);
    7468             : 
    7469             :   /* route-map. */
    7470           0 :   if (filter->map[RMAP_IN].name)
    7471           0 :     vty_out (vty, "  Route map for incoming advertisements is %s%s%s",
    7472           0 :             filter->map[RMAP_IN].map ? "*" : "",
    7473             :             filter->map[RMAP_IN].name,
    7474           0 :              VTY_NEWLINE);
    7475           0 :   if (filter->map[RMAP_OUT].name)
    7476           0 :     vty_out (vty, "  Route map for outgoing advertisements is %s%s%s",
    7477           0 :             filter->map[RMAP_OUT].map ? "*" : "",
    7478             :             filter->map[RMAP_OUT].name,
    7479           0 :             VTY_NEWLINE);
    7480           0 :   if (filter->map[RMAP_IMPORT].name)
    7481           0 :     vty_out (vty, "  Route map for advertisements going into this RS-client's table is %s%s%s",
    7482           0 :             filter->map[RMAP_IMPORT].map ? "*" : "",
    7483             :             filter->map[RMAP_IMPORT].name,
    7484           0 :             VTY_NEWLINE);
    7485           0 :   if (filter->map[RMAP_EXPORT].name)
    7486           0 :     vty_out (vty, "  Route map for advertisements coming from this RS-client is %s%s%s",
    7487           0 :             filter->map[RMAP_EXPORT].map ? "*" : "",
    7488             :             filter->map[RMAP_EXPORT].name,
    7489           0 :              VTY_NEWLINE);
    7490             : 
    7491             :   /* unsuppress-map */
    7492           0 :   if (filter->usmap.name)
    7493           0 :     vty_out (vty, "  Route map for selective unsuppress is %s%s%s",
    7494           0 :              filter->usmap.map ? "*" : "",
    7495           0 :              filter->usmap.name, VTY_NEWLINE);
    7496             : 
    7497             :   /* Receive prefix count */
    7498           0 :   vty_out (vty, "  %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
    7499             : 
    7500             :   /* Maximum prefix */
    7501           0 :   if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
    7502             :     {
    7503           0 :       vty_out (vty, "  Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
    7504           0 :                CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
    7505           0 :                ? " (warning-only)" : "", VTY_NEWLINE);
    7506           0 :       vty_out (vty, "  Threshold for warning message %d%%",
    7507           0 :                p->pmax_threshold[afi][safi]);
    7508           0 :       if (p->pmax_restart[afi][safi])
    7509           0 :         vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
    7510           0 :       vty_out (vty, "%s", VTY_NEWLINE);
    7511             :     }
    7512             : 
    7513           0 :   vty_out (vty, "%s", VTY_NEWLINE);
    7514           0 : }
    7515             : 
    7516             : static void
    7517           0 : bgp_show_peer (struct vty *vty, struct peer *p)
    7518             : {
    7519             :   struct bgp *bgp;
    7520             :   char buf1[BUFSIZ];
    7521             :   char timebuf[BGP_UPTIME_LEN];
    7522             :   afi_t afi;
    7523             :   safi_t safi;
    7524             : 
    7525           0 :   bgp = p->bgp;
    7526             : 
    7527             :   /* Configured IP address. */
    7528           0 :   vty_out (vty, "BGP neighbor is %s, ", p->host);
    7529           0 :   vty_out (vty, "remote AS %u, ", p->as);
    7530           0 :   vty_out (vty, "local AS %u%s%s, ",
    7531           0 :            p->change_local_as ? p->change_local_as : p->local_as,
    7532           0 :            CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
    7533             :            " no-prepend" : "",
    7534           0 :            CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
    7535             :            " replace-as" : "");
    7536           0 :   vty_out (vty, "%s link%s",
    7537           0 :            p->as == p->local_as ? "internal" : "external",
    7538           0 :            VTY_NEWLINE);
    7539             : 
    7540             :   /* Description. */
    7541           0 :   if (p->desc)
    7542           0 :     vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
    7543             :   
    7544             :   /* Peer-group */
    7545           0 :   if (p->group)
    7546           0 :     vty_out (vty, " Member of peer-group %s for session parameters%s",
    7547           0 :              p->group->name, VTY_NEWLINE);
    7548             : 
    7549             :   /* Administrative shutdown. */
    7550           0 :   if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
    7551           0 :     vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
    7552             : 
    7553             :   /* BGP Version. */
    7554           0 :   vty_out (vty, "  BGP version 4");
    7555           0 :   vty_out (vty, ", remote router ID %s%s", 
    7556           0 :            inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
    7557           0 :            VTY_NEWLINE);
    7558             : 
    7559             :   /* Confederation */
    7560           0 :   if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
    7561           0 :       && bgp_confederation_peers_check (bgp, p->as))
    7562           0 :     vty_out (vty, "  Neighbor under common administration%s", VTY_NEWLINE);
    7563             :   
    7564             :   /* Status. */
    7565           0 :   vty_out (vty, "  BGP state = %s",  
    7566             :            LOOKUP (bgp_status_msg, p->status));
    7567           0 :   if (p->status == Established) 
    7568           0 :     vty_out (vty, ", up for %8s", 
    7569             :              peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
    7570           0 :   else if (p->status == Active)
    7571             :     {
    7572           0 :       if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
    7573           0 :         vty_out (vty, " (passive)"); 
    7574           0 :       else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
    7575           0 :         vty_out (vty, " (NSF passive)"); 
    7576             :     }
    7577           0 :   vty_out (vty, "%s", VTY_NEWLINE);
    7578             :   
    7579             :   /* read timer */
    7580           0 :   vty_out (vty, "  Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
    7581             : 
    7582             :   /* Configured timer values. */
    7583           0 :   vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
    7584           0 :            p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
    7585           0 :   if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
    7586             :     {
    7587           0 :       vty_out (vty, "  Configured hold time is %d", p->holdtime);
    7588           0 :       vty_out (vty, ", keepalive interval is %d seconds%s",
    7589           0 :                p->keepalive, VTY_NEWLINE);
    7590             :     }
    7591             : 
    7592             :   /* Capability. */
    7593           0 :   if (p->status == Established) 
    7594             :     {
    7595           0 :       if (p->cap
    7596           0 :           || p->afc_adv[AFI_IP][SAFI_UNICAST]
    7597           0 :           || p->afc_recv[AFI_IP][SAFI_UNICAST]
    7598           0 :           || p->afc_adv[AFI_IP][SAFI_MULTICAST]
    7599           0 :           || p->afc_recv[AFI_IP][SAFI_MULTICAST]
    7600             : #ifdef HAVE_IPV6
    7601           0 :           || p->afc_adv[AFI_IP6][SAFI_UNICAST]
    7602           0 :           || p->afc_recv[AFI_IP6][SAFI_UNICAST]
    7603           0 :           || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
    7604           0 :           || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
    7605             : #endif /* HAVE_IPV6 */
    7606           0 :           || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
    7607           0 :           || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
    7608             :         {
    7609           0 :           vty_out (vty, "  Neighbor capabilities:%s", VTY_NEWLINE);
    7610             : 
    7611             :           /* AS4 */
    7612           0 :           if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
    7613           0 :               || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
    7614             :             {
    7615           0 :               vty_out (vty, "    4 Byte AS:");
    7616           0 :               if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
    7617           0 :                 vty_out (vty, " advertised");
    7618           0 :               if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
    7619           0 :                 vty_out (vty, " %sreceived",
    7620           0 :                          CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
    7621           0 :               vty_out (vty, "%s", VTY_NEWLINE);
    7622             :             }
    7623             :           /* Dynamic */
    7624           0 :           if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
    7625           0 :               || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
    7626             :             {
    7627           0 :               vty_out (vty, "    Dynamic:");
    7628           0 :               if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
    7629           0 :                 vty_out (vty, " advertised");
    7630           0 :               if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
    7631           0 :                 vty_out (vty, " %sreceived",
    7632           0 :                          CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
    7633           0 :               vty_out (vty, "%s", VTY_NEWLINE);
    7634             :             }
    7635             : 
    7636             :           /* Route Refresh */
    7637           0 :           if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
    7638           0 :               || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
    7639           0 :               || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
    7640             :             {
    7641           0 :               vty_out (vty, "    Route refresh:");
    7642           0 :               if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
    7643           0 :                 vty_out (vty, " advertised");
    7644           0 :               if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
    7645           0 :                   || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
    7646           0 :                 vty_out (vty, " %sreceived(%s)",
    7647           0 :                          CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
    7648           0 :                          (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
    7649           0 :                           && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
    7650           0 :                          "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
    7651             : 
    7652           0 :               vty_out (vty, "%s", VTY_NEWLINE);
    7653             :             }
    7654             : 
    7655             :           /* Multiprotocol Extensions */
    7656           0 :           for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
    7657           0 :             for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
    7658           0 :               if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
    7659             :                 {
    7660           0 :                   vty_out (vty, "    Address family %s:", afi_safi_print (afi, safi));
    7661           0 :                   if (p->afc_adv[afi][safi]) 
    7662           0 :                     vty_out (vty, " advertised");
    7663           0 :                   if (p->afc_recv[afi][safi])
    7664           0 :                     vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
    7665           0 :                   vty_out (vty, "%s", VTY_NEWLINE);
    7666             :                 } 
    7667             : 
    7668             :           /* Gracefull Restart */
    7669           0 :           if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
    7670           0 :               || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
    7671             :             {
    7672           0 :               vty_out (vty, "    Graceful Restart Capabilty:");
    7673           0 :               if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
    7674           0 :                 vty_out (vty, " advertised");
    7675           0 :               if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
    7676           0 :                 vty_out (vty, " %sreceived",
    7677           0 :                          CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
    7678           0 :               vty_out (vty, "%s", VTY_NEWLINE);
    7679             : 
    7680           0 :               if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
    7681             :                 {
    7682           0 :                   int restart_af_count = 0;
    7683             : 
    7684           0 :                   vty_out (vty, "      Remote Restart timer is %d seconds%s",
    7685           0 :                            p->v_gr_restart, VTY_NEWLINE);    
    7686           0 :                   vty_out (vty, "      Address families by peer:%s        ", VTY_NEWLINE);
    7687             : 
    7688           0 :                   for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
    7689           0 :                     for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
    7690           0 :                       if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
    7691             :                         {
    7692           0 :                           vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
    7693             :                                    afi_safi_print (afi, safi),
    7694           0 :                                    CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
    7695             :                                    "preserved" : "not preserved");
    7696           0 :                           restart_af_count++;
    7697             :                         }
    7698           0 :                   if (! restart_af_count)
    7699           0 :                     vty_out (vty, "none");
    7700           0 :                   vty_out (vty, "%s", VTY_NEWLINE);
    7701             :                 }
    7702             :             }
    7703             :         }
    7704             :     }
    7705             : 
    7706             :   /* graceful restart information */
    7707           0 :   if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
    7708           0 :       || p->t_gr_restart
    7709           0 :       || p->t_gr_stale)
    7710             :     {
    7711           0 :       int eor_send_af_count = 0;
    7712           0 :       int eor_receive_af_count = 0;
    7713             : 
    7714           0 :       vty_out (vty, "  Graceful restart informations:%s", VTY_NEWLINE);
    7715           0 :       if (p->status == Established) 
    7716             :         {
    7717           0 :           vty_out (vty, "    End-of-RIB send: ");
    7718           0 :           for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
    7719           0 :             for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
    7720           0 :               if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
    7721             :                 {
    7722           0 :                   vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
    7723             :                            afi_safi_print (afi, safi));
    7724           0 :                   eor_send_af_count++;
    7725             :                 }
    7726           0 :           vty_out (vty, "%s", VTY_NEWLINE);
    7727             : 
    7728           0 :           vty_out (vty, "    End-of-RIB received: ");
    7729           0 :           for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
    7730           0 :             for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
    7731           0 :               if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
    7732             :                 {
    7733           0 :                   vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
    7734             :                            afi_safi_print (afi, safi));
    7735           0 :                   eor_receive_af_count++;
    7736             :                 }
    7737           0 :           vty_out (vty, "%s", VTY_NEWLINE);
    7738             :         }
    7739             : 
    7740           0 :       if (p->t_gr_restart)
    7741           0 :         vty_out (vty, "    The remaining time of restart timer is %ld%s",
    7742           0 :                  thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
    7743             :       
    7744           0 :       if (p->t_gr_stale)
    7745           0 :         vty_out (vty, "    The remaining time of stalepath timer is %ld%s",
    7746           0 :                  thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
    7747             :     }
    7748             : 
    7749             :   /* Packet counts. */
    7750           0 :   vty_out (vty, "  Message statistics:%s", VTY_NEWLINE);
    7751           0 :   vty_out (vty, "    Inq depth is 0%s", VTY_NEWLINE);
    7752           0 :   vty_out (vty, "    Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
    7753           0 :   vty_out (vty, "                         Sent       Rcvd%s", VTY_NEWLINE);
    7754           0 :   vty_out (vty, "    Opens:         %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
    7755           0 :   vty_out (vty, "    Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
    7756           0 :   vty_out (vty, "    Updates:       %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
    7757           0 :   vty_out (vty, "    Keepalives:    %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
    7758           0 :   vty_out (vty, "    Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
    7759           0 :   vty_out (vty, "    Capability:    %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
    7760           0 :   vty_out (vty, "    Total:         %10d %10d%s", p->open_out + p->notify_out +
    7761           0 :            p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
    7762           0 :            p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
    7763           0 :            p->dynamic_cap_in, VTY_NEWLINE);
    7764             : 
    7765             :   /* advertisement-interval */
    7766           0 :   vty_out (vty, "  Minimum time between advertisement runs is %d seconds%s",
    7767           0 :            p->v_routeadv, VTY_NEWLINE);
    7768             : 
    7769             :   /* Update-source. */
    7770           0 :   if (p->update_if || p->update_source)
    7771             :     {
    7772           0 :       vty_out (vty, "  Update source is ");
    7773           0 :       if (p->update_if)
    7774           0 :         vty_out (vty, "%s", p->update_if);
    7775           0 :       else if (p->update_source)
    7776           0 :         vty_out (vty, "%s",
    7777             :                  sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
    7778           0 :       vty_out (vty, "%s", VTY_NEWLINE);
    7779             :     }
    7780             : 
    7781             :   /* Default weight */
    7782           0 :   if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
    7783           0 :     vty_out (vty, "  Default weight %d%s", p->weight,
    7784           0 :              VTY_NEWLINE);
    7785             : 
    7786           0 :   vty_out (vty, "%s", VTY_NEWLINE);
    7787             : 
    7788             :   /* Address Family Information */
    7789           0 :   for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
    7790           0 :     for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
    7791           0 :       if (p->afc[afi][safi])
    7792           0 :         bgp_show_peer_afi (vty, p, afi, safi);
    7793             : 
    7794           0 :   vty_out (vty, "  Connections established %d; dropped %d%s",
    7795             :            p->established, p->dropped,
    7796           0 :            VTY_NEWLINE);
    7797             : 
    7798           0 :   if (! p->dropped)
    7799           0 :     vty_out (vty, "  Last reset never%s", VTY_NEWLINE);
    7800             :   else
    7801           0 :     vty_out (vty, "  Last reset %s, due to %s%s",
    7802             :             peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
    7803           0 :             peer_down_str[(int) p->last_reset], VTY_NEWLINE);
    7804             : 
    7805           0 :   if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
    7806             :     {
    7807           0 :       vty_out (vty, "  Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
    7808             : 
    7809           0 :       if (p->t_pmax_restart)
    7810           0 :         vty_out (vty, "  Reduce the no. of prefix from %s, will restart in %ld seconds%s",
    7811             :                  p->host, thread_timer_remain_second (p->t_pmax_restart),
    7812           0 :                  VTY_NEWLINE);
    7813             :       else
    7814           0 :         vty_out (vty, "  Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
    7815           0 :                  p->host, VTY_NEWLINE);
    7816             :     }
    7817             : 
    7818             :   /* EBGP Multihop and GTSM */
    7819           0 :   if (p->sort != BGP_PEER_IBGP)
    7820             :     {
    7821           0 :       if (p->gtsm_hops > 0)
    7822           0 :         vty_out (vty, "  External BGP neighbor may be up to %d hops away.%s",
    7823           0 :                  p->gtsm_hops, VTY_NEWLINE);
    7824           0 :       else if (p->ttl > 1)
    7825           0 :         vty_out (vty, "  External BGP neighbor may be up to %d hops away.%s",
    7826           0 :                  p->ttl, VTY_NEWLINE);
    7827             :     }
    7828             : 
    7829             :   /* Local address. */
    7830           0 :   if (p->su_local)
    7831             :     {
    7832           0 :       vty_out (vty, "Local host: %s, Local port: %d%s",
    7833             :                sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
    7834           0 :                ntohs (p->su_local->sin.sin_port),
    7835           0 :                VTY_NEWLINE);
    7836             :     }
    7837             :       
    7838             :   /* Remote address. */
    7839           0 :   if (p->su_remote)
    7840             :     {
    7841           0 :       vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
    7842             :                sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
    7843           0 :                ntohs (p->su_remote->sin.sin_port),
    7844           0 :                VTY_NEWLINE);
    7845             :     }
    7846             : 
    7847             :   /* Nexthop display. */
    7848           0 :   if (p->su_local)
    7849             :     {
    7850           0 :       vty_out (vty, "Nexthop: %s%s", 
    7851           0 :                inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
    7852           0 :                VTY_NEWLINE);
    7853             : #ifdef HAVE_IPV6
    7854           0 :       vty_out (vty, "Nexthop global: %s%s", 
    7855           0 :                inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
    7856           0 :                VTY_NEWLINE);
    7857           0 :       vty_out (vty, "Nexthop local: %s%s",
    7858           0 :                inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
    7859           0 :                VTY_NEWLINE);
    7860           0 :       vty_out (vty, "BGP connection: %s%s",
    7861           0 :                p->shared_network ? "shared network" : "non shared network",
    7862           0 :                VTY_NEWLINE);
    7863             : #endif /* HAVE_IPV6 */
    7864             :     }
    7865             : 
    7866             :   /* Timer information. */
    7867           0 :   if (p->t_start)
    7868           0 :     vty_out (vty, "Next start timer due in %ld seconds%s",
    7869           0 :              thread_timer_remain_second (p->t_start), VTY_NEWLINE);
    7870           0 :   if (p->t_connect)
    7871           0 :     vty_out (vty, "Next connect timer due in %ld seconds%s",
    7872           0 :              thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
    7873             :   
    7874           0 :   vty_out (vty, "Read thread: %s  Write thread: %s%s", 
    7875           0 :            p->t_read ? "on" : "off",
    7876           0 :            p->t_write ? "on" : "off",
    7877           0 :            VTY_NEWLINE);
    7878             : 
    7879           0 :   if (p->notify.code == BGP_NOTIFY_OPEN_ERR
    7880           0 :       && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
    7881           0 :     bgp_capability_vty_out (vty, p);
    7882             :  
    7883           0 :   vty_out (vty, "%s", VTY_NEWLINE);
    7884           0 : }
    7885             : 
    7886             : static int
    7887           0 : bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
    7888             :                    enum show_type type, union sockunion *su)
    7889             : {
    7890             :   struct listnode *node, *nnode;
    7891             :   struct peer *peer;
    7892           0 :   int find = 0;
    7893             : 
    7894           0 :   for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
    7895             :     {
    7896           0 :       switch (type)
    7897             :         {
    7898             :         case show_all:
    7899           0 :           bgp_show_peer (vty, peer);
    7900           0 :           break;
    7901             :         case show_peer:
    7902           0 :           if (sockunion_same (&peer->su, su))
    7903             :             {
    7904           0 :               find = 1;
    7905           0 :               bgp_show_peer (vty, peer);
    7906             :             }
    7907           0 :           break;
    7908             :         }
    7909             :     }
    7910             : 
    7911           0 :   if (type == show_peer && ! find)
    7912           0 :     vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
    7913             :   
    7914           0 :   return CMD_SUCCESS;
    7915             : }
    7916             : 
    7917             : static int 
    7918           0 : bgp_show_neighbor_vty (struct vty *vty, const char *name, 
    7919             :                        enum show_type type, const char *ip_str)
    7920             : {
    7921             :   int ret;
    7922             :   struct bgp *bgp;
    7923             :   union sockunion su;
    7924             : 
    7925           0 :   if (ip_str)
    7926             :     {
    7927           0 :       ret = str2sockunion (ip_str, &su);
    7928           0 :       if (ret < 0)
    7929             :         {
    7930           0 :           vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
    7931           0 :           return CMD_WARNING;
    7932             :         }
    7933             :     }
    7934             : 
    7935           0 :   if (name)
    7936             :     {
    7937           0 :       bgp = bgp_lookup_by_name (name);
    7938             :       
    7939           0 :       if (! bgp)
    7940             :         {
    7941           0 :           vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); 
    7942           0 :           return CMD_WARNING;
    7943             :         }
    7944             : 
    7945           0 :       bgp_show_neighbor (vty, bgp, type, &su);
    7946             : 
    7947           0 :       return CMD_SUCCESS;
    7948             :     }
    7949             : 
    7950           0 :   bgp = bgp_get_default ();
    7951             : 
    7952           0 :   if (bgp)
    7953           0 :     bgp_show_neighbor (vty, bgp, type, &su);
    7954             : 
    7955           0 :   return CMD_SUCCESS;
    7956             : }
    7957             : 
    7958             : /* "show ip bgp neighbors" commands.  */
    7959           0 : DEFUN (show_ip_bgp_neighbors,
    7960             :        show_ip_bgp_neighbors_cmd,
    7961             :        "show ip bgp neighbors",
    7962             :        SHOW_STR
    7963             :        IP_STR
    7964             :        BGP_STR
    7965             :        "Detailed information on TCP and BGP neighbor connections\n")
    7966             : {
    7967           0 :   return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
    7968             : }
    7969             : 
    7970             : ALIAS (show_ip_bgp_neighbors,
    7971             :        show_ip_bgp_ipv4_neighbors_cmd,
    7972             :        "show ip bgp ipv4 (unicast|multicast) neighbors",
    7973             :        SHOW_STR
    7974             :        IP_STR
    7975             :        BGP_STR
    7976             :        "Address family\n"
    7977             :        "Address Family modifier\n"
    7978             :        "Address Family modifier\n"
    7979             :        "Detailed information on TCP and BGP neighbor connections\n")
    7980             : 
    7981             : ALIAS (show_ip_bgp_neighbors,
    7982             :        show_ip_bgp_vpnv4_all_neighbors_cmd,
    7983             :        "show ip bgp vpnv4 all neighbors",
    7984             :        SHOW_STR
    7985             :        IP_STR
    7986             :        BGP_STR
    7987             :        "Display VPNv4 NLRI specific information\n"
    7988             :        "Display information about all VPNv4 NLRIs\n"
    7989             :        "Detailed information on TCP and BGP neighbor connections\n")
    7990             : 
    7991             : ALIAS (show_ip_bgp_neighbors,
    7992             :        show_ip_bgp_vpnv4_rd_neighbors_cmd,
    7993             :        "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
    7994             :        SHOW_STR
    7995             :        IP_STR
    7996             :        BGP_STR
    7997             :        "Display VPNv4 NLRI specific information\n"
    7998             :        "Display information for a route distinguisher\n"
    7999             :        "VPN Route Distinguisher\n"
    8000             :        "Detailed information on TCP and BGP neighbor connections\n")
    8001             : 
    8002             : ALIAS (show_ip_bgp_neighbors,
    8003             :        show_bgp_neighbors_cmd,
    8004             :        "show bgp neighbors",
    8005             :        SHOW_STR
    8006             :        BGP_STR
    8007             :        "Detailed information on TCP and BGP neighbor connections\n")
    8008             : 
    8009             : ALIAS (show_ip_bgp_neighbors,
    8010             :        show_bgp_ipv6_neighbors_cmd,
    8011             :        "show bgp ipv6 neighbors",
    8012             :        SHOW_STR
    8013             :        BGP_STR
    8014             :        "Address family\n"
    8015             :        "Detailed information on TCP and BGP neighbor connections\n")
    8016             : 
    8017           0 : DEFUN (show_ip_bgp_neighbors_peer,
    8018             :        show_ip_bgp_neighbors_peer_cmd,
    8019             :        "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
    8020             :        SHOW_STR
    8021             :        IP_STR
    8022             :        BGP_STR
    8023             :        "Detailed information on TCP and BGP neighbor connections\n"
    8024             :        "Neighbor to display information about\n"
    8025             :        "Neighbor to display information about\n")
    8026             : {
    8027           0 :   return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
    8028             : }
    8029             : 
    8030             : ALIAS (show_ip_bgp_neighbors_peer,
    8031             :        show_ip_bgp_ipv4_neighbors_peer_cmd,
    8032             :        "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
    8033             :        SHOW_STR
    8034             :        IP_STR
    8035             :        BGP_STR
    8036             :        "Address family\n"
    8037             :        "Address Family modifier\n"
    8038             :        "Address Family modifier\n"
    8039             :        "Detailed information on TCP and BGP neighbor connections\n"
    8040             :        "Neighbor to display information about\n"
    8041             :        "Neighbor to display information about\n")
    8042             : 
    8043             : ALIAS (show_ip_bgp_neighbors_peer,
    8044             :        show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
    8045             :        "show ip bgp vpnv4 all neighbors A.B.C.D",
    8046             :        SHOW_STR
    8047             :        IP_STR
    8048             :        BGP_STR
    8049             :        "Display VPNv4 NLRI specific information\n"
    8050             :        "Display information about all VPNv4 NLRIs\n"
    8051             :        "Detailed information on TCP and BGP neighbor connections\n"
    8052             :        "Neighbor to display information about\n")
    8053             : 
    8054             : ALIAS (show_ip_bgp_neighbors_peer,
    8055             :        show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
    8056             :        "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
    8057             :        SHOW_STR
    8058             :        IP_STR
    8059             :        BGP_STR
    8060             :        "Display VPNv4 NLRI specific information\n"
    8061             :        "Display information about all VPNv4 NLRIs\n"
    8062             :        "Detailed information on TCP and BGP neighbor connections\n"
    8063             :        "Neighbor to display information about\n")
    8064             : 
    8065             : ALIAS (show_ip_bgp_neighbors_peer,
    8066             :        show_bgp_neighbors_peer_cmd,
    8067             :        "show bgp neighbors (A.B.C.D|X:X::X:X)",
    8068             :        SHOW_STR
    8069             :        BGP_STR
    8070             :        "Detailed information on TCP and BGP neighbor connections\n"
    8071             :        "Neighbor to display information about\n"
    8072             :        "Neighbor to display information about\n")
    8073             : 
    8074             : ALIAS (show_ip_bgp_neighbors_peer,
    8075             :        show_bgp_ipv6_neighbors_peer_cmd,
    8076             :        "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
    8077             :        SHOW_STR
    8078             :        BGP_STR
    8079             :        "Address family\n"
    8080             :        "Detailed information on TCP and BGP neighbor connections\n"
    8081             :        "Neighbor to display information about\n"
    8082             :        "Neighbor to display information about\n")
    8083             : 
    8084           0 : DEFUN (show_ip_bgp_instance_neighbors,
    8085             :        show_ip_bgp_instance_neighbors_cmd,
    8086             :        "show ip bgp view WORD neighbors",
    8087             :        SHOW_STR
    8088             :        IP_STR
    8089             :        BGP_STR
    8090             :        "BGP view\n"
    8091             :        "View name\n"
    8092             :        "Detailed information on TCP and BGP neighbor connections\n")
    8093             : {
    8094           0 :   return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
    8095             : }
    8096             : 
    8097             : ALIAS (show_ip_bgp_instance_neighbors,
    8098             :        show_bgp_instance_neighbors_cmd,
    8099             :        "show bgp view WORD neighbors",
    8100             :        SHOW_STR
    8101             :        BGP_STR
    8102             :        "BGP view\n"
    8103             :        "View name\n"
    8104             :        "Detailed information on TCP and BGP neighbor connections\n")
    8105             : 
    8106             : ALIAS (show_ip_bgp_instance_neighbors,
    8107             :        show_bgp_instance_ipv6_neighbors_cmd,
    8108             :        "show bgp view WORD ipv6 neighbors",
    8109             :        SHOW_STR
    8110             :        BGP_STR
    8111             :        "BGP view\n"
    8112             :        "View name\n"
    8113             :        "Address family\n"
    8114             :        "Detailed information on TCP and BGP neighbor connections\n")
    8115             : 
    8116           0 : DEFUN (show_ip_bgp_instance_neighbors_peer,
    8117             :        show_ip_bgp_instance_neighbors_peer_cmd,
    8118             :        "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
    8119             :        SHOW_STR
    8120             :        IP_STR
    8121             :        BGP_STR
    8122             :        "BGP view\n"
    8123             :        "View name\n"
    8124             :        "Detailed information on TCP and BGP neighbor connections\n"
    8125             :        "Neighbor to display information about\n"
    8126             :        "Neighbor to display information about\n")
    8127             : {
    8128           0 :   return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
    8129             : }
    8130             : 
    8131             : ALIAS (show_ip_bgp_instance_neighbors_peer,
    8132             :        show_bgp_instance_neighbors_peer_cmd,
    8133             :        "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
    8134             :        SHOW_STR
    8135             :        BGP_STR
    8136             :        "BGP view\n"
    8137             :        "View name\n"
    8138             :        "Detailed information on TCP and BGP neighbor connections\n"
    8139             :        "Neighbor to display information about\n"
    8140             :        "Neighbor to display information about\n")
    8141             : 
    8142             : ALIAS (show_ip_bgp_instance_neighbors_peer,
    8143             :        show_bgp_instance_ipv6_neighbors_peer_cmd,
    8144             :        "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
    8145             :        SHOW_STR
    8146             :        BGP_STR
    8147             :        "BGP view\n"
    8148             :        "View name\n"
    8149             :        "Address family\n"
    8150             :        "Detailed information on TCP and BGP neighbor connections\n"
    8151             :        "Neighbor to display information about\n"
    8152             :        "Neighbor to display information about\n")
    8153             :        
    8154             : /* Show BGP's AS paths internal data.  There are both `show ip bgp
    8155             :    paths' and `show ip mbgp paths'.  Those functions results are the
    8156             :    same.*/
    8157           0 : DEFUN (show_ip_bgp_paths, 
    8158             :        show_ip_bgp_paths_cmd,
    8159             :        "show ip bgp paths",
    8160             :        SHOW_STR
    8161             :        IP_STR
    8162             :        BGP_STR
    8163             :        "Path information\n")
    8164             : {
    8165           0 :   vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
    8166           0 :   aspath_print_all_vty (vty);
    8167           0 :   return CMD_SUCCESS;
    8168             : }
    8169             : 
    8170           0 : DEFUN (show_ip_bgp_ipv4_paths, 
    8171             :        show_ip_bgp_ipv4_paths_cmd,
    8172             :        "show ip bgp ipv4 (unicast|multicast) paths",
    8173             :        SHOW_STR
    8174             :        IP_STR
    8175             :        BGP_STR
    8176             :        "Address family\n"
    8177             :        "Address Family modifier\n"
    8178             :        "Address Family modifier\n"
    8179             :        "Path information\n")
    8180             : {
    8181           0 :   vty_out (vty, "Address Refcnt Path\r\n");
    8182           0 :   aspath_print_all_vty (vty);
    8183             : 
    8184           0 :   return CMD_SUCCESS;
    8185             : }
    8186             : 
    8187             : #include "hash.h"
    8188             : 
    8189             : static void
    8190           0 : community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
    8191             : {
    8192             :   struct community *com;
    8193             : 
    8194           0 :   com = (struct community *) backet->data;
    8195           0 :   vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt,
    8196           0 :            community_str (com), VTY_NEWLINE);
    8197           0 : }
    8198             : 
    8199             : /* Show BGP's community internal data. */
    8200           0 : DEFUN (show_ip_bgp_community_info, 
    8201             :        show_ip_bgp_community_info_cmd,
    8202             :        "show ip bgp community-info",
    8203             :        SHOW_STR
    8204             :        IP_STR
    8205             :        BGP_STR
    8206             :        "List all bgp community information\n")
    8207             : {
    8208           0 :   vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
    8209             : 
    8210           0 :   hash_iterate (community_hash (), 
    8211             :                 (void (*) (struct hash_backet *, void *))
    8212             :                 community_show_all_iterator,
    8213             :                 vty);
    8214             : 
    8215           0 :   return CMD_SUCCESS;
    8216             : }
    8217             : 
    8218           0 : DEFUN (show_ip_bgp_attr_info, 
    8219             :        show_ip_bgp_attr_info_cmd,
    8220             :        "show ip bgp attribute-info",
    8221             :        SHOW_STR
    8222             :        IP_STR
    8223             :        BGP_STR
    8224             :        "List all bgp attribute information\n")
    8225             : {
    8226           0 :   attr_show_all (vty);
    8227           0 :   return CMD_SUCCESS;
    8228             : }
    8229             : 
    8230             : static int
    8231           0 : bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
    8232             :         afi_t afi, safi_t safi)
    8233             : {
    8234             :   char timebuf[BGP_UPTIME_LEN];
    8235             :   char rmbuf[14];
    8236             :   const char *rmname;
    8237             :   struct peer *peer;
    8238             :   struct listnode *node, *nnode;
    8239             :   int len;
    8240           0 :   int count = 0;
    8241             : 
    8242           0 :   if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
    8243             :     {
    8244           0 :       for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
    8245             :         {
    8246           0 :           count++;
    8247           0 :           bgp_write_rsclient_summary (vty, peer, afi, safi);
    8248             :         }
    8249           0 :       return count;
    8250             :     }
    8251             : 
    8252           0 :   len = vty_out (vty, "%s", rsclient->host);
    8253           0 :   len = 16 - len;
    8254             : 
    8255           0 :   if (len < 1)
    8256           0 :     vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
    8257             :   else
    8258           0 :     vty_out (vty, "%*s", len, " ");
    8259             : 
    8260           0 :   vty_out (vty, "4 ");
    8261             : 
    8262           0 :   vty_out (vty, "%11d ", rsclient->as);
    8263             : 
    8264           0 :   rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
    8265           0 :   if ( rmname && strlen (rmname) > 13 )
    8266             :     {
    8267           0 :       sprintf (rmbuf, "%13s", "...");
    8268           0 :       rmname = strncpy (rmbuf, rmname, 10);
    8269             :     }
    8270           0 :   else if (! rmname)
    8271           0 :     rmname = "<none>";
    8272           0 :   vty_out (vty, " %13s ", rmname);
    8273             : 
    8274           0 :   rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
    8275           0 :   if ( rmname && strlen (rmname) > 13 )
    8276             :     {
    8277           0 :       sprintf (rmbuf, "%13s", "...");
    8278           0 :       rmname = strncpy (rmbuf, rmname, 10);
    8279             :     }
    8280           0 :   else if (! rmname)
    8281           0 :     rmname = "<none>";
    8282           0 :   vty_out (vty, " %13s ", rmname);
    8283             : 
    8284           0 :   vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
    8285             : 
    8286           0 :   if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
    8287           0 :     vty_out (vty, " Idle (Admin)");
    8288           0 :   else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
    8289           0 :     vty_out (vty, " Idle (PfxCt)");
    8290             :   else
    8291           0 :     vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
    8292             : 
    8293           0 :   vty_out (vty, "%s", VTY_NEWLINE);
    8294             : 
    8295           0 :   return 1;
    8296             : }
    8297             : 
    8298             : static int
    8299           0 : bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, 
    8300             :                            afi_t afi, safi_t safi)
    8301             : {
    8302             :   struct peer *peer;
    8303             :   struct listnode *node, *nnode;
    8304           0 :   int count = 0;
    8305             : 
    8306             :   /* Header string for each address family. */
    8307             :   static char header[] = "Neighbor        V    AS  Export-Policy  Import-Policy  Up/Down  State";
    8308             : 
    8309           0 :   for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
    8310             :     {
    8311           0 :       if (peer->afc[afi][safi] &&
    8312           0 :          CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
    8313             :        {
    8314           0 :          if (! count)
    8315             :            {
    8316           0 :              vty_out (vty,
    8317             :                       "Route Server's BGP router identifier %s%s",
    8318           0 :                       inet_ntoa (bgp->router_id), VTY_NEWLINE);
    8319           0 :              vty_out (vty,
    8320             :               "Route Server's local AS number %u%s", bgp->as,
    8321           0 :                        VTY_NEWLINE);
    8322             : 
    8323           0 :              vty_out (vty, "%s", VTY_NEWLINE);
    8324           0 :              vty_out (vty, "%s%s", header, VTY_NEWLINE);
    8325             :            }
    8326             : 
    8327           0 :          count += bgp_write_rsclient_summary (vty, peer, afi, safi);
    8328             :        }
    8329             :     }
    8330             : 
    8331           0 :   if (count)
    8332           0 :     vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
    8333           0 :             count, VTY_NEWLINE);
    8334             :   else
    8335           0 :     vty_out (vty, "No %s Route Server Client is configured%s",
    8336           0 :             afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
    8337             : 
    8338           0 :   return CMD_SUCCESS;
    8339             : }
    8340             : 
    8341             : static int
    8342           0 : bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, 
    8343             :                                afi_t afi, safi_t safi)
    8344             : {
    8345             :   struct bgp *bgp;
    8346             : 
    8347           0 :   if (name)
    8348             :     {
    8349           0 :       bgp = bgp_lookup_by_name (name);
    8350             : 
    8351           0 :       if (! bgp)
    8352             :        {
    8353           0 :          vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
    8354           0 :          return CMD_WARNING;
    8355             :        }
    8356             : 
    8357           0 :       bgp_show_rsclient_summary (vty, bgp, afi, safi);
    8358           0 :       return CMD_SUCCESS;
    8359             :     }
    8360             : 
    8361           0 :   bgp = bgp_get_default ();
    8362             : 
    8363           0 :   if (bgp)
    8364           0 :     bgp_show_rsclient_summary (vty, bgp, afi, safi);
    8365             : 
    8366           0 :   return CMD_SUCCESS;
    8367             : }
    8368             : 
    8369             : /* 'show bgp rsclient' commands. */
    8370           0 : DEFUN (show_ip_bgp_rsclient_summary,
    8371             :        show_ip_bgp_rsclient_summary_cmd,
    8372             :        "show ip bgp rsclient summary",
    8373             :        SHOW_STR
    8374             :        IP_STR
    8375             :        BGP_STR
    8376             :        "Information about Route Server Clients\n"
    8377             :        "Summary of all Route Server Clients\n")
    8378             : {
    8379           0 :   return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
    8380             : }
    8381             : 
    8382           0 : DEFUN (show_ip_bgp_instance_rsclient_summary,
    8383             :        show_ip_bgp_instance_rsclient_summary_cmd,
    8384             :        "show ip bgp view WORD rsclient summary",
    8385             :        SHOW_STR
    8386             :        IP_STR
    8387             :        BGP_STR
    8388             :        "BGP view\n"
    8389             :        "View name\n"
    8390             :        "Information about Route Server Clients\n"
    8391             :        "Summary of all Route Server Clients\n")
    8392             : {
    8393           0 :   return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
    8394             : }
    8395             : 
    8396           0 : DEFUN (show_ip_bgp_ipv4_rsclient_summary,
    8397             :       show_ip_bgp_ipv4_rsclient_summary_cmd,
    8398             :       "show ip bgp ipv4 (unicast|multicast) rsclient summary",
    8399             :        SHOW_STR
    8400             :        IP_STR
    8401             :        BGP_STR
    8402             :        "Address family\n"
    8403             :        "Address Family modifier\n"
    8404             :        "Address Family modifier\n"
    8405             :        "Information about Route Server Clients\n"
    8406             :        "Summary of all Route Server Clients\n")
    8407             : {
    8408           0 :   if (strncmp (argv[0], "m", 1) == 0)
    8409           0 :     return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
    8410             : 
    8411           0 :   return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
    8412             : }
    8413             : 
    8414           0 : DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
    8415             :       show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
    8416             :       "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
    8417             :        SHOW_STR
    8418             :        IP_STR
    8419             :        BGP_STR
    8420             :        "BGP view\n"
    8421             :        "View name\n"
    8422             :        "Address family\n"
    8423             :        "Address Family modifier\n"
    8424             :        "Address Family modifier\n"
    8425             :        "Information about Route Server Clients\n"
    8426             :        "Summary of all Route Server Clients\n")
    8427             : {
    8428           0 :   if (strncmp (argv[1], "m", 1) == 0)
    8429           0 :     return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
    8430             : 
    8431           0 :   return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
    8432             : }
    8433             : 
    8434           0 : DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
    8435             :        show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
    8436             :        "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
    8437             :        SHOW_STR
    8438             :        BGP_STR
    8439             :        "BGP view\n"
    8440             :        "View name\n"
    8441             :        "Address family\n"
    8442             :        "Address Family modifier\n"
    8443             :        "Address Family modifier\n"
    8444             :        "Information about Route Server Clients\n"
    8445             :        "Summary of all Route Server Clients\n")
    8446             : {
    8447             :   safi_t safi;
    8448             : 
    8449           0 :   if (argc == 2) {
    8450           0 :     safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
    8451           0 :     return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
    8452             :   } else {
    8453           0 :     safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
    8454           0 :     return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
    8455             :   }
    8456             : }
    8457             : 
    8458             : ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
    8459             :        show_bgp_ipv4_safi_rsclient_summary_cmd,
    8460             :        "show bgp ipv4 (unicast|multicast) rsclient summary",
    8461             :        SHOW_STR
    8462             :        BGP_STR
    8463             :        "Address family\n"
    8464             :        "Address Family modifier\n"
    8465             :        "Address Family modifier\n"
    8466             :        "Information about Route Server Clients\n"
    8467             :        "Summary of all Route Server Clients\n")
    8468             : 
    8469             : #ifdef HAVE_IPV6
    8470           0 : DEFUN (show_bgp_rsclient_summary,
    8471             :        show_bgp_rsclient_summary_cmd,
    8472             :        "show bgp rsclient summary",
    8473             :        SHOW_STR
    8474             :        BGP_STR
    8475             :        "Information about Route Server Clients\n"
    8476             :        "Summary of all Route Server Clients\n")
    8477             : {
    8478           0 :   return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
    8479             : }
    8480             : 
    8481           0 : DEFUN (show_bgp_instance_rsclient_summary,
    8482             :        show_bgp_instance_rsclient_summary_cmd,
    8483             :        "show bgp view WORD rsclient summary",
    8484             :        SHOW_STR
    8485             :        BGP_STR
    8486             :        "BGP view\n"
    8487             :        "View name\n"
    8488             :        "Information about Route Server Clients\n"
    8489             :        "Summary of all Route Server Clients\n")
    8490             : {
    8491           0 :   return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
    8492             : }
    8493             : 
    8494             : ALIAS (show_bgp_rsclient_summary,
    8495             :       show_bgp_ipv6_rsclient_summary_cmd,
    8496             :       "show bgp ipv6 rsclient summary",
    8497             :        SHOW_STR
    8498             :        BGP_STR
    8499             :        "Address family\n"
    8500             :        "Information about Route Server Clients\n"
    8501             :        "Summary of all Route Server Clients\n")
    8502             : 
    8503             : ALIAS (show_bgp_instance_rsclient_summary,
    8504             :       show_bgp_instance_ipv6_rsclient_summary_cmd,
    8505             :        "show bgp view WORD ipv6 rsclient summary",
    8506             :        SHOW_STR
    8507             :        BGP_STR
    8508             :        "BGP view\n"
    8509             :        "View name\n"
    8510             :        "Address family\n"
    8511             :        "Information about Route Server Clients\n"
    8512             :        "Summary of all Route Server Clients\n")
    8513             : 
    8514           0 : DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
    8515             :        show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
    8516             :        "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
    8517             :        SHOW_STR
    8518             :        BGP_STR
    8519             :        "BGP view\n"
    8520             :        "View name\n"
    8521             :        "Address family\n"
    8522             :        "Address Family modifier\n"
    8523             :        "Address Family modifier\n"
    8524             :        "Information about Route Server Clients\n"
    8525             :        "Summary of all Route Server Clients\n")
    8526             : {
    8527             :   safi_t safi;
    8528             : 
    8529           0 :   if (argc == 2) {
    8530           0 :     safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
    8531           0 :     return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
    8532             :   } else {
    8533           0 :     safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
    8534           0 :     return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
    8535             :   }
    8536             : }
    8537             : 
    8538             : ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
    8539             :        show_bgp_ipv6_safi_rsclient_summary_cmd,
    8540             :        "show bgp ipv6 (unicast|multicast) rsclient summary",
    8541             :        SHOW_STR
    8542             :        BGP_STR
    8543             :        "Address family\n"
    8544             :        "Address Family modifier\n"
    8545             :        "Address Family modifier\n"
    8546             :        "Information about Route Server Clients\n"
    8547             :        "Summary of all Route Server Clients\n")
    8548             : 
    8549             : #endif /* HAVE IPV6 */
    8550             : 
    8551             : /* Redistribute VTY commands.  */
    8552             : 
    8553           0 : DEFUN (bgp_redistribute_ipv4,
    8554             :        bgp_redistribute_ipv4_cmd,
    8555             :        "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
    8556             :        "Redistribute information from another routing protocol\n"
    8557             :        QUAGGA_IP_REDIST_HELP_STR_BGPD)
    8558             : {
    8559             :   int type;
    8560             : 
    8561           0 :   type = proto_redistnum (AFI_IP, argv[0]);
    8562           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8563             :     {
    8564           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8565           0 :       return CMD_WARNING;
    8566             :     }
    8567           0 :   return bgp_redistribute_set (vty->index, AFI_IP, type);
    8568             : }
    8569             : 
    8570           0 : DEFUN (bgp_redistribute_ipv4_rmap,
    8571             :        bgp_redistribute_ipv4_rmap_cmd,
    8572             :        "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
    8573             :        "Redistribute information from another routing protocol\n"
    8574             :        QUAGGA_IP_REDIST_HELP_STR_BGPD
    8575             :        "Route map reference\n"
    8576             :        "Pointer to route-map entries\n")
    8577             : {
    8578             :   int type;
    8579             : 
    8580           0 :   type = proto_redistnum (AFI_IP, argv[0]);
    8581           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8582             :     {
    8583           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8584           0 :       return CMD_WARNING;
    8585             :     }
    8586             : 
    8587           0 :   bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
    8588           0 :   return bgp_redistribute_set (vty->index, AFI_IP, type);
    8589             : }
    8590             : 
    8591           0 : DEFUN (bgp_redistribute_ipv4_metric,
    8592             :        bgp_redistribute_ipv4_metric_cmd,
    8593             :        "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
    8594             :        "Redistribute information from another routing protocol\n"
    8595             :        QUAGGA_IP_REDIST_HELP_STR_BGPD
    8596             :        "Metric for redistributed routes\n"
    8597             :        "Default metric\n")
    8598             : {
    8599             :   int type;
    8600             :   u_int32_t metric;
    8601             : 
    8602           0 :   type = proto_redistnum (AFI_IP, argv[0]);
    8603           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8604             :     {
    8605           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8606           0 :       return CMD_WARNING;
    8607             :     }
    8608           0 :   VTY_GET_INTEGER ("metric", metric, argv[1]);
    8609             : 
    8610           0 :   bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
    8611           0 :   return bgp_redistribute_set (vty->index, AFI_IP, type);
    8612             : }
    8613             : 
    8614           0 : DEFUN (bgp_redistribute_ipv4_rmap_metric,
    8615             :        bgp_redistribute_ipv4_rmap_metric_cmd,
    8616             :        "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
    8617             :        "Redistribute information from another routing protocol\n"
    8618             :        QUAGGA_IP_REDIST_HELP_STR_BGPD
    8619             :        "Route map reference\n"
    8620             :        "Pointer to route-map entries\n"
    8621             :        "Metric for redistributed routes\n"
    8622             :        "Default metric\n")
    8623             : {
    8624             :   int type;
    8625             :   u_int32_t metric;
    8626             : 
    8627           0 :   type = proto_redistnum (AFI_IP, argv[0]);
    8628           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8629             :     {
    8630           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8631           0 :       return CMD_WARNING;
    8632             :     }
    8633           0 :   VTY_GET_INTEGER ("metric", metric, argv[2]);
    8634             : 
    8635           0 :   bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
    8636           0 :   bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
    8637           0 :   return bgp_redistribute_set (vty->index, AFI_IP, type);
    8638             : }
    8639             : 
    8640           0 : DEFUN (bgp_redistribute_ipv4_metric_rmap,
    8641             :        bgp_redistribute_ipv4_metric_rmap_cmd,
    8642             :        "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
    8643             :        "Redistribute information from another routing protocol\n"
    8644             :        QUAGGA_IP_REDIST_HELP_STR_BGPD
    8645             :        "Metric for redistributed routes\n"
    8646             :        "Default metric\n"
    8647             :        "Route map reference\n"
    8648             :        "Pointer to route-map entries\n")
    8649             : {
    8650             :   int type;
    8651             :   u_int32_t metric;
    8652             : 
    8653           0 :   type = proto_redistnum (AFI_IP, argv[0]);
    8654           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8655             :     {
    8656           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8657           0 :       return CMD_WARNING;
    8658             :     }
    8659           0 :   VTY_GET_INTEGER ("metric", metric, argv[1]);
    8660             : 
    8661           0 :   bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
    8662           0 :   bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
    8663           0 :   return bgp_redistribute_set (vty->index, AFI_IP, type);
    8664             : }
    8665             : 
    8666           0 : DEFUN (no_bgp_redistribute_ipv4,
    8667             :        no_bgp_redistribute_ipv4_cmd,
    8668             :        "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
    8669             :        NO_STR
    8670             :        "Redistribute information from another routing protocol\n"
    8671             :        QUAGGA_IP_REDIST_HELP_STR_BGPD)
    8672             : {
    8673             :   int type;
    8674             : 
    8675           0 :   type = proto_redistnum (AFI_IP, argv[0]);
    8676           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8677             :     {
    8678           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8679           0 :       return CMD_WARNING;
    8680             :     }
    8681             : 
    8682           0 :   return bgp_redistribute_unset (vty->index, AFI_IP, type);
    8683             : }
    8684             : 
    8685           0 : DEFUN (no_bgp_redistribute_ipv4_rmap,
    8686             :        no_bgp_redistribute_ipv4_rmap_cmd,
    8687             :        "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
    8688             :        NO_STR
    8689             :        "Redistribute information from another routing protocol\n"
    8690             :        QUAGGA_IP_REDIST_HELP_STR_BGPD
    8691             :        "Route map reference\n"
    8692             :        "Pointer to route-map entries\n")
    8693             : {
    8694             :   int type;
    8695             : 
    8696           0 :   type = proto_redistnum (AFI_IP, argv[0]);
    8697           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8698             :     {
    8699           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8700           0 :       return CMD_WARNING;
    8701             :     }
    8702             : 
    8703           0 :   bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
    8704           0 :   return CMD_SUCCESS;
    8705             : }
    8706             : 
    8707           0 : DEFUN (no_bgp_redistribute_ipv4_metric,
    8708             :        no_bgp_redistribute_ipv4_metric_cmd,
    8709             :        "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
    8710             :        NO_STR
    8711             :        "Redistribute information from another routing protocol\n"
    8712             :        QUAGGA_IP_REDIST_HELP_STR_BGPD
    8713             :        "Metric for redistributed routes\n"
    8714             :        "Default metric\n")
    8715             : {
    8716             :   int type;
    8717             : 
    8718           0 :   type = proto_redistnum (AFI_IP, argv[0]);
    8719           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8720             :     {
    8721           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8722           0 :       return CMD_WARNING;
    8723             :     }
    8724             : 
    8725           0 :   bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
    8726           0 :   return CMD_SUCCESS;
    8727             : }
    8728             : 
    8729           0 : DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
    8730             :        no_bgp_redistribute_ipv4_rmap_metric_cmd,
    8731             :        "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
    8732             :        NO_STR
    8733             :        "Redistribute information from another routing protocol\n"
    8734             :        QUAGGA_IP_REDIST_HELP_STR_BGPD
    8735             :        "Route map reference\n"
    8736             :        "Pointer to route-map entries\n"
    8737             :        "Metric for redistributed routes\n"
    8738             :        "Default metric\n")
    8739             : {
    8740             :   int type;
    8741             : 
    8742           0 :   type = proto_redistnum (AFI_IP, argv[0]);
    8743           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8744             :     {
    8745           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8746           0 :       return CMD_WARNING;
    8747             :     }
    8748             : 
    8749           0 :   bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
    8750           0 :   bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
    8751           0 :   return CMD_SUCCESS;
    8752             : }
    8753             : 
    8754             : ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
    8755             :        no_bgp_redistribute_ipv4_metric_rmap_cmd,
    8756             :        "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
    8757             :        NO_STR
    8758             :        "Redistribute information from another routing protocol\n"
    8759             :        QUAGGA_IP_REDIST_HELP_STR_BGPD
    8760             :        "Metric for redistributed routes\n"
    8761             :        "Default metric\n"
    8762             :        "Route map reference\n"
    8763             :        "Pointer to route-map entries\n")
    8764             : 
    8765             : #ifdef HAVE_IPV6
    8766           0 : DEFUN (bgp_redistribute_ipv6,
    8767             :        bgp_redistribute_ipv6_cmd,
    8768             :        "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
    8769             :        "Redistribute information from another routing protocol\n"
    8770             :        QUAGGA_IP6_REDIST_HELP_STR_BGPD)
    8771             : {
    8772             :   int type;
    8773             : 
    8774           0 :   type = proto_redistnum (AFI_IP6, argv[0]);
    8775           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8776             :     {
    8777           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8778           0 :       return CMD_WARNING;
    8779             :     }
    8780             : 
    8781           0 :   return bgp_redistribute_set (vty->index, AFI_IP6, type);
    8782             : }
    8783             : 
    8784           0 : DEFUN (bgp_redistribute_ipv6_rmap,
    8785             :        bgp_redistribute_ipv6_rmap_cmd,
    8786             :        "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
    8787             :        "Redistribute information from another routing protocol\n"
    8788             :        QUAGGA_IP6_REDIST_HELP_STR_BGPD
    8789             :        "Route map reference\n"
    8790             :        "Pointer to route-map entries\n")
    8791             : {
    8792             :   int type;
    8793             : 
    8794           0 :   type = proto_redistnum (AFI_IP6, argv[0]);
    8795           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8796             :     {
    8797           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8798           0 :       return CMD_WARNING;
    8799             :     }
    8800             : 
    8801           0 :   bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
    8802           0 :   return bgp_redistribute_set (vty->index, AFI_IP6, type);
    8803             : }
    8804             : 
    8805           0 : DEFUN (bgp_redistribute_ipv6_metric,
    8806             :        bgp_redistribute_ipv6_metric_cmd,
    8807             :        "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
    8808             :        "Redistribute information from another routing protocol\n"
    8809             :        QUAGGA_IP6_REDIST_HELP_STR_BGPD
    8810             :        "Metric for redistributed routes\n"
    8811             :        "Default metric\n")
    8812             : {
    8813             :   int type;
    8814             :   u_int32_t metric;
    8815             : 
    8816           0 :   type = proto_redistnum (AFI_IP6, argv[0]);
    8817           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8818             :     {
    8819           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8820           0 :       return CMD_WARNING;
    8821             :     }
    8822           0 :   VTY_GET_INTEGER ("metric", metric, argv[1]);
    8823             : 
    8824           0 :   bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
    8825           0 :   return bgp_redistribute_set (vty->index, AFI_IP6, type);
    8826             : }
    8827             : 
    8828           0 : DEFUN (bgp_redistribute_ipv6_rmap_metric,
    8829             :        bgp_redistribute_ipv6_rmap_metric_cmd,
    8830             :        "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
    8831             :        "Redistribute information from another routing protocol\n"
    8832             :        QUAGGA_IP6_REDIST_HELP_STR_BGPD
    8833             :        "Route map reference\n"
    8834             :        "Pointer to route-map entries\n"
    8835             :        "Metric for redistributed routes\n"
    8836             :        "Default metric\n")
    8837             : {
    8838             :   int type;
    8839             :   u_int32_t metric;
    8840             : 
    8841           0 :   type = proto_redistnum (AFI_IP6, argv[0]);
    8842           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8843             :     {
    8844           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8845           0 :       return CMD_WARNING;
    8846             :     }
    8847           0 :   VTY_GET_INTEGER ("metric", metric, argv[2]);
    8848             : 
    8849           0 :   bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
    8850           0 :   bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
    8851           0 :   return bgp_redistribute_set (vty->index, AFI_IP6, type);
    8852             : }
    8853             : 
    8854           0 : DEFUN (bgp_redistribute_ipv6_metric_rmap,
    8855             :        bgp_redistribute_ipv6_metric_rmap_cmd,
    8856             :        "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
    8857             :        "Redistribute information from another routing protocol\n"
    8858             :        QUAGGA_IP6_REDIST_HELP_STR_BGPD
    8859             :        "Metric for redistributed routes\n"
    8860             :        "Default metric\n"
    8861             :        "Route map reference\n"
    8862             :        "Pointer to route-map entries\n")
    8863             : {
    8864             :   int type;
    8865             :   u_int32_t metric;
    8866             : 
    8867           0 :   type = proto_redistnum (AFI_IP6, argv[0]);
    8868           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8869             :     {
    8870           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8871           0 :       return CMD_WARNING;
    8872             :     }
    8873           0 :   VTY_GET_INTEGER ("metric", metric, argv[1]);
    8874             : 
    8875           0 :   bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
    8876           0 :   bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
    8877           0 :   return bgp_redistribute_set (vty->index, AFI_IP6, type);
    8878             : }
    8879             : 
    8880           0 : DEFUN (no_bgp_redistribute_ipv6,
    8881             :        no_bgp_redistribute_ipv6_cmd,
    8882             :        "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
    8883             :        NO_STR
    8884             :        "Redistribute information from another routing protocol\n"
    8885             :        QUAGGA_IP6_REDIST_HELP_STR_BGPD)
    8886             : {
    8887             :   int type;
    8888             : 
    8889           0 :   type = proto_redistnum (AFI_IP6, argv[0]);
    8890           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8891             :     {
    8892           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8893           0 :       return CMD_WARNING;
    8894             :     }
    8895             : 
    8896           0 :   return bgp_redistribute_unset (vty->index, AFI_IP6, type);
    8897             : }
    8898             : 
    8899           0 : DEFUN (no_bgp_redistribute_ipv6_rmap,
    8900             :        no_bgp_redistribute_ipv6_rmap_cmd,
    8901             :        "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
    8902             :        NO_STR
    8903             :        "Redistribute information from another routing protocol\n"
    8904             :        QUAGGA_IP6_REDIST_HELP_STR_BGPD
    8905             :        "Route map reference\n"
    8906             :        "Pointer to route-map entries\n")
    8907             : {
    8908             :   int type;
    8909             : 
    8910           0 :   type = proto_redistnum (AFI_IP6, argv[0]);
    8911           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8912             :     {
    8913           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8914           0 :       return CMD_WARNING;
    8915             :     }
    8916             : 
    8917           0 :   bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
    8918           0 :   return CMD_SUCCESS;
    8919             : }
    8920             : 
    8921           0 : DEFUN (no_bgp_redistribute_ipv6_metric,
    8922             :        no_bgp_redistribute_ipv6_metric_cmd,
    8923             :        "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
    8924             :        NO_STR
    8925             :        "Redistribute information from another routing protocol\n"
    8926             :        QUAGGA_IP6_REDIST_HELP_STR_BGPD
    8927             :        "Metric for redistributed routes\n"
    8928             :        "Default metric\n")
    8929             : {
    8930             :   int type;
    8931             : 
    8932           0 :   type = proto_redistnum (AFI_IP6, argv[0]);
    8933           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8934             :     {
    8935           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8936           0 :       return CMD_WARNING;
    8937             :     }
    8938             : 
    8939           0 :   bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
    8940           0 :   return CMD_SUCCESS;
    8941             : }
    8942             : 
    8943           0 : DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
    8944             :        no_bgp_redistribute_ipv6_rmap_metric_cmd,
    8945             :        "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
    8946             :        NO_STR
    8947             :        "Redistribute information from another routing protocol\n"
    8948             :        QUAGGA_IP6_REDIST_HELP_STR_BGPD
    8949             :        "Route map reference\n"
    8950             :        "Pointer to route-map entries\n"
    8951             :        "Metric for redistributed routes\n"
    8952             :        "Default metric\n")
    8953             : {
    8954             :   int type;
    8955             : 
    8956           0 :   type = proto_redistnum (AFI_IP6, argv[0]);
    8957           0 :   if (type < 0 || type == ZEBRA_ROUTE_BGP)
    8958             :     {
    8959           0 :       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
    8960           0 :       return CMD_WARNING;
    8961             :     }
    8962             : 
    8963           0 :   bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
    8964           0 :   bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
    8965           0 :   return CMD_SUCCESS;
    8966             : }
    8967             : 
    8968             : ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
    8969             :        no_bgp_redistribute_ipv6_metric_rmap_cmd,
    8970             :        "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
    8971             :        NO_STR
    8972             :        "Redistribute information from another routing protocol\n"
    8973             :        QUAGGA_IP6_REDIST_HELP_STR_BGPD
    8974             :        "Metric for redistributed routes\n"
    8975             :        "Default metric\n"
    8976             :        "Route map reference\n"
    8977             :        "Pointer to route-map entries\n")
    8978             : #endif /* HAVE_IPV6 */
    8979             : 
    8980             : int
    8981           0 : bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
    8982             :                                safi_t safi, int *write)
    8983             : {
    8984             :   int i;
    8985             : 
    8986             :   /* Unicast redistribution only.  */
    8987           0 :   if (safi != SAFI_UNICAST)
    8988           0 :     return 0;
    8989             : 
    8990           0 :   for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
    8991             :     {
    8992             :       /* Redistribute BGP does not make sense.  */
    8993           0 :       if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
    8994             :         {
    8995             :           /* Display "address-family" when it is not yet diplayed.  */
    8996           0 :           bgp_config_write_family_header (vty, afi, safi, write);
    8997             : 
    8998             :           /* "redistribute" configuration.  */
    8999           0 :           vty_out (vty, " redistribute %s", zebra_route_string(i));
    9000             : 
    9001           0 :           if (bgp->redist_metric_flag[afi][i])
    9002           0 :             vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
    9003             : 
    9004           0 :           if (bgp->rmap[afi][i].name)
    9005           0 :             vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
    9006             : 
    9007           0 :           vty_out (vty, "%s", VTY_NEWLINE);
    9008             :         }
    9009             :     }
    9010           0 :   return *write;
    9011             : }
    9012             : 
    9013             : /* BGP node structure. */
    9014             : static struct cmd_node bgp_node =
    9015             : {
    9016             :   BGP_NODE,
    9017             :   "%s(config-router)# ",
    9018             :   1,
    9019             : };
    9020             : 
    9021             : static struct cmd_node bgp_ipv4_unicast_node =
    9022             : {
    9023             :   BGP_IPV4_NODE,
    9024             :   "%s(config-router-af)# ",
    9025             :   1,
    9026             : };
    9027             : 
    9028             : static struct cmd_node bgp_ipv4_multicast_node =
    9029             : {
    9030             :   BGP_IPV4M_NODE,
    9031             :   "%s(config-router-af)# ",
    9032             :   1,
    9033             : };
    9034             : 
    9035             : static struct cmd_node bgp_ipv6_unicast_node =
    9036             : {
    9037             :   BGP_IPV6_NODE,
    9038             :   "%s(config-router-af)# ",
    9039             :   1,
    9040             : };
    9041             : 
    9042             : static struct cmd_node bgp_ipv6_multicast_node =
    9043             : {
    9044             :   BGP_IPV6M_NODE,
    9045             :   "%s(config-router-af)# ",
    9046             :   1,
    9047             : };
    9048             : 
    9049             : static struct cmd_node bgp_vpnv4_node =
    9050             : {
    9051             :   BGP_VPNV4_NODE,
    9052             :   "%s(config-router-af)# ",
    9053             :   1
    9054             : };
    9055             : 
    9056             : static void community_list_vty (void);
    9057             : 
    9058             : void
    9059           0 : bgp_vty_init (void)
    9060             : {
    9061             :   /* Install bgp top node. */
    9062           0 :   install_node (&bgp_node, bgp_config_write);
    9063           0 :   install_node (&bgp_ipv4_unicast_node, NULL);
    9064           0 :   install_node (&bgp_ipv4_multicast_node, NULL);
    9065           0 :   install_node (&bgp_ipv6_unicast_node, NULL);
    9066           0 :   install_node (&bgp_ipv6_multicast_node, NULL);
    9067           0 :   install_node (&bgp_vpnv4_node, NULL);
    9068             : 
    9069             :   /* Install default VTY commands to new nodes.  */
    9070           0 :   install_default (BGP_NODE);
    9071           0 :   install_default (BGP_IPV4_NODE);
    9072           0 :   install_default (BGP_IPV4M_NODE);
    9073           0 :   install_default (BGP_IPV6_NODE);
    9074           0 :   install_default (BGP_IPV6M_NODE);
    9075           0 :   install_default (BGP_VPNV4_NODE);
    9076             :   
    9077             :   /* "bgp multiple-instance" commands. */
    9078           0 :   install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
    9079           0 :   install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
    9080             : 
    9081             :   /* "bgp config-type" commands. */
    9082           0 :   install_element (CONFIG_NODE, &bgp_config_type_cmd);
    9083           0 :   install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
    9084             : 
    9085             :   /* Dummy commands (Currently not supported) */
    9086           0 :   install_element (BGP_NODE, &no_synchronization_cmd);
    9087           0 :   install_element (BGP_NODE, &no_auto_summary_cmd);
    9088             : 
    9089             :   /* "router bgp" commands. */
    9090           0 :   install_element (CONFIG_NODE, &router_bgp_cmd);
    9091           0 :   install_element (CONFIG_NODE, &router_bgp_view_cmd);
    9092             : 
    9093             :   /* "no router bgp" commands. */
    9094           0 :   install_element (CONFIG_NODE, &no_router_bgp_cmd);
    9095           0 :   install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
    9096             : 
    9097             :   /* "bgp router-id" commands. */
    9098           0 :   install_element (BGP_NODE, &bgp_router_id_cmd);
    9099           0 :   install_element (BGP_NODE, &no_bgp_router_id_cmd);
    9100           0 :   install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
    9101             : 
    9102             :   /* "bgp cluster-id" commands. */
    9103           0 :   install_element (BGP_NODE, &bgp_cluster_id_cmd);
    9104           0 :   install_element (BGP_NODE, &bgp_cluster_id32_cmd);
    9105           0 :   install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
    9106           0 :   install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
    9107             : 
    9108             :   /* "bgp confederation" commands. */
    9109           0 :   install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
    9110           0 :   install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
    9111           0 :   install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
    9112             : 
    9113             :   /* "bgp confederation peers" commands. */
    9114           0 :   install_element (BGP_NODE, &bgp_confederation_peers_cmd);
    9115           0 :   install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
    9116             : 
    9117             :   /* "maximum-paths" commands. */
    9118           0 :   install_element (BGP_NODE, &bgp_maxpaths_cmd);
    9119           0 :   install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
    9120           0 :   install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
    9121           0 :   install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
    9122           0 :   install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
    9123           0 :   install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
    9124           0 :   install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
    9125           0 :   install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
    9126           0 :   install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
    9127           0 :   install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
    9128           0 :   install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
    9129           0 :   install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
    9130             : 
    9131             :   /* "timers bgp" commands. */
    9132           0 :   install_element (BGP_NODE, &bgp_timers_cmd);
    9133           0 :   install_element (BGP_NODE, &no_bgp_timers_cmd);
    9134           0 :   install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
    9135             : 
    9136             :   /* "bgp client-to-client reflection" commands */
    9137           0 :   install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
    9138           0 :   install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
    9139             : 
    9140             :   /* "bgp always-compare-med" commands */
    9141           0 :   install_element (BGP_NODE, &bgp_always_compare_med_cmd);
    9142           0 :   install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
    9143             :   
    9144             :   /* "bgp deterministic-med" commands */
    9145           0 :   install_element (BGP_NODE, &bgp_deterministic_med_cmd);
    9146           0 :   install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
    9147             : 
    9148             :   /* "bgp graceful-restart" commands */
    9149           0 :   install_element (BGP_NODE, &bgp_graceful_restart_cmd);
    9150           0 :   install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
    9151           0 :   install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
    9152           0 :   install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
    9153           0 :   install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
    9154             :  
    9155             :   /* "bgp fast-external-failover" commands */
    9156           0 :   install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
    9157           0 :   install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
    9158             : 
    9159             :   /* "bgp enforce-first-as" commands */
    9160           0 :   install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
    9161           0 :   install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
    9162             : 
    9163             :   /* "bgp bestpath compare-routerid" commands */
    9164           0 :   install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
    9165           0 :   install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
    9166             : 
    9167             :   /* "bgp bestpath as-path ignore" commands */
    9168           0 :   install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
    9169           0 :   install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
    9170             : 
    9171             :   /* "bgp bestpath as-path confed" commands */
    9172           0 :   install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
    9173           0 :   install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
    9174             : 
    9175             :   /* "bgp log-neighbor-changes" commands */
    9176           0 :   install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
    9177           0 :   install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
    9178             : 
    9179             :   /* "bgp bestpath med" commands */
    9180           0 :   install_element (BGP_NODE, &bgp_bestpath_med_cmd);
    9181           0 :   install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
    9182           0 :   install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
    9183           0 :   install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
    9184           0 :   install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
    9185           0 :   install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
    9186             : 
    9187             :   /* "no bgp default ipv4-unicast" commands. */
    9188           0 :   install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
    9189           0 :   install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
    9190             :   
    9191             :   /* "bgp network import-check" commands. */
    9192           0 :   install_element (BGP_NODE, &bgp_network_import_check_cmd);
    9193           0 :   install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
    9194             : 
    9195             :   /* "bgp default local-preference" commands. */
    9196           0 :   install_element (BGP_NODE, &bgp_default_local_preference_cmd);
    9197           0 :   install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
    9198           0 :   install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
    9199             : 
    9200             :   /* "neighbor remote-as" commands. */
    9201           0 :   install_element (BGP_NODE, &neighbor_remote_as_cmd);
    9202           0 :   install_element (BGP_NODE, &no_neighbor_cmd);
    9203           0 :   install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
    9204             : 
    9205             :   /* "neighbor peer-group" commands. */
    9206           0 :   install_element (BGP_NODE, &neighbor_peer_group_cmd);
    9207           0 :   install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
    9208           0 :   install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
    9209             : 
    9210             :   /* "neighbor local-as" commands. */
    9211           0 :   install_element (BGP_NODE, &neighbor_local_as_cmd);
    9212           0 :   install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
    9213           0 :   install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
    9214           0 :   install_element (BGP_NODE, &no_neighbor_local_as_cmd);
    9215           0 :   install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
    9216           0 :   install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
    9217           0 :   install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
    9218             : 
    9219             :   /* "neighbor password" commands. */
    9220           0 :   install_element (BGP_NODE, &neighbor_password_cmd);
    9221           0 :   install_element (BGP_NODE, &no_neighbor_password_cmd);
    9222             : 
    9223             :   /* "neighbor activate" commands. */
    9224           0 :   install_element (BGP_NODE, &neighbor_activate_cmd);
    9225           0 :   install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
    9226           0 :   install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
    9227           0 :   install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
    9228           0 :   install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
    9229           0 :   install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
    9230             : 
    9231             :   /* "no neighbor activate" commands. */
    9232           0 :   install_element (BGP_NODE, &no_neighbor_activate_cmd);
    9233           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
    9234           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
    9235           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
    9236           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
    9237           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
    9238             : 
    9239             :   /* "neighbor peer-group set" commands. */
    9240           0 :   install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
    9241           0 :   install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
    9242           0 :   install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
    9243           0 :   install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
    9244           0 :   install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
    9245           0 :   install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
    9246             :   
    9247             :   /* "no neighbor peer-group unset" commands. */
    9248           0 :   install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
    9249           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
    9250           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
    9251           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
    9252           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
    9253           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
    9254             :   
    9255             :   /* "neighbor softreconfiguration inbound" commands.*/
    9256           0 :   install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
    9257           0 :   install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
    9258           0 :   install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
    9259           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
    9260           0 :   install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
    9261           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
    9262           0 :   install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
    9263           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
    9264           0 :   install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
    9265           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
    9266           0 :   install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
    9267           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
    9268             : 
    9269             :   /* "neighbor attribute-unchanged" commands.  */
    9270           0 :   install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
    9271           0 :   install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
    9272           0 :   install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
    9273           0 :   install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
    9274           0 :   install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
    9275           0 :   install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
    9276           0 :   install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
    9277           0 :   install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
    9278           0 :   install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
    9279           0 :   install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
    9280           0 :   install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
    9281           0 :   install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
    9282           0 :   install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
    9283           0 :   install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
    9284           0 :   install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
    9285           0 :   install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
    9286           0 :   install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
    9287           0 :   install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
    9288           0 :   install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
    9289           0 :   install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
    9290           0 :   install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
    9291           0 :   install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
    9292           0 :   install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
    9293           0 :   install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
    9294           0 :   install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
    9295           0 :   install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
    9296           0 :   install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
    9297           0 :   install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
    9298           0 :   install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
    9299           0 :   install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
    9300           0 :   install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
    9301           0 :   install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
    9302           0 :   install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
    9303           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
    9304           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
    9305           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
    9306           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
    9307           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
    9308           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
    9309           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
    9310           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
    9311           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
    9312           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
    9313           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
    9314           0 :   install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
    9315           0 :   install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
    9316           0 :   install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
    9317           0 :   install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
    9318           0 :   install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
    9319           0 :   install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
    9320           0 :   install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
    9321           0 :   install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
    9322           0 :   install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
    9323           0 :   install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
    9324           0 :   install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
    9325           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
    9326           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
    9327           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
    9328           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
    9329           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
    9330           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
    9331           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
    9332           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
    9333           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
    9334           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
    9335           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
    9336           0 :   install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
    9337           0 :   install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
    9338           0 :   install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
    9339           0 :   install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
    9340           0 :   install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
    9341           0 :   install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
    9342           0 :   install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
    9343           0 :   install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
    9344           0 :   install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
    9345           0 :   install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
    9346           0 :   install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
    9347           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
    9348           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
    9349           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
    9350           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
    9351           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
    9352           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
    9353           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
    9354           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
    9355           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
    9356           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
    9357           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
    9358           0 :   install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
    9359           0 :   install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
    9360           0 :   install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
    9361           0 :   install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
    9362           0 :   install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
    9363           0 :   install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
    9364           0 :   install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
    9365           0 :   install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
    9366           0 :   install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
    9367           0 :   install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
    9368           0 :   install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
    9369           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
    9370           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
    9371           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
    9372           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
    9373           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
    9374           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
    9375           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
    9376           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
    9377           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
    9378           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
    9379           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
    9380           0 :   install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
    9381           0 :   install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
    9382           0 :   install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
    9383           0 :   install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
    9384           0 :   install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
    9385           0 :   install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
    9386           0 :   install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
    9387           0 :   install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
    9388           0 :   install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
    9389           0 :   install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
    9390           0 :   install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
    9391           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
    9392           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
    9393           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
    9394           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
    9395           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
    9396           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
    9397           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
    9398           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
    9399           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
    9400           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
    9401           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
    9402             : 
    9403             :   /* "nexthop-local unchanged" commands */
    9404           0 :   install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
    9405           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
    9406             : 
    9407             :   /* "transparent-as" and "transparent-nexthop" for old version
    9408             :      compatibility.  */
    9409           0 :   install_element (BGP_NODE, &neighbor_transparent_as_cmd);
    9410           0 :   install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
    9411             : 
    9412             :   /* "neighbor next-hop-self" commands. */
    9413           0 :   install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
    9414           0 :   install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
    9415           0 :   install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
    9416           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
    9417           0 :   install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
    9418           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
    9419           0 :   install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
    9420           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
    9421           0 :   install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
    9422           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
    9423           0 :   install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
    9424           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
    9425             : 
    9426             :   /* "neighbor remove-private-AS" commands. */
    9427           0 :   install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
    9428           0 :   install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
    9429           0 :   install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
    9430           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
    9431           0 :   install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
    9432           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
    9433           0 :   install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
    9434           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
    9435           0 :   install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
    9436           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
    9437           0 :   install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
    9438           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
    9439             : 
    9440             :   /* "neighbor send-community" commands.*/
    9441           0 :   install_element (BGP_NODE, &neighbor_send_community_cmd);
    9442           0 :   install_element (BGP_NODE, &neighbor_send_community_type_cmd);
    9443           0 :   install_element (BGP_NODE, &no_neighbor_send_community_cmd);
    9444           0 :   install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
    9445           0 :   install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
    9446           0 :   install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
    9447           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
    9448           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
    9449           0 :   install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
    9450           0 :   install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
    9451           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
    9452           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
    9453           0 :   install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
    9454           0 :   install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
    9455           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
    9456           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
    9457           0 :   install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
    9458           0 :   install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
    9459           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
    9460           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
    9461           0 :   install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
    9462           0 :   install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
    9463           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
    9464           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
    9465             : 
    9466             :   /* "neighbor route-reflector" commands.*/
    9467           0 :   install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
    9468           0 :   install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
    9469           0 :   install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
    9470           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
    9471           0 :   install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
    9472           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
    9473           0 :   install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
    9474           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
    9475           0 :   install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
    9476           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
    9477           0 :   install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
    9478           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
    9479             : 
    9480             :   /* "neighbor route-server" commands.*/
    9481           0 :   install_element (BGP_NODE, &neighbor_route_server_client_cmd);
    9482           0 :   install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
    9483           0 :   install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
    9484           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
    9485           0 :   install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
    9486           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
    9487           0 :   install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
    9488           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
    9489           0 :   install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
    9490           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
    9491           0 :   install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
    9492           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
    9493             : 
    9494             :   /* "neighbor passive" commands. */
    9495           0 :   install_element (BGP_NODE, &neighbor_passive_cmd);
    9496           0 :   install_element (BGP_NODE, &no_neighbor_passive_cmd);
    9497             : 
    9498             :   /* "neighbor shutdown" commands. */
    9499           0 :   install_element (BGP_NODE, &neighbor_shutdown_cmd);
    9500           0 :   install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
    9501             : 
    9502             :   /* Deprecated "neighbor capability route-refresh" commands.*/
    9503           0 :   install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
    9504           0 :   install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
    9505             : 
    9506             :   /* "neighbor capability orf prefix-list" commands.*/
    9507           0 :   install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
    9508           0 :   install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
    9509           0 :   install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
    9510           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
    9511           0 :   install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
    9512           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
    9513           0 :   install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
    9514           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
    9515           0 :   install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
    9516           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
    9517             : 
    9518             :   /* "neighbor capability dynamic" commands.*/
    9519           0 :   install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
    9520           0 :   install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
    9521             : 
    9522             :   /* "neighbor dont-capability-negotiate" commands. */
    9523           0 :   install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
    9524           0 :   install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
    9525             : 
    9526             :   /* "neighbor ebgp-multihop" commands. */
    9527           0 :   install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
    9528           0 :   install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
    9529           0 :   install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
    9530           0 :   install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
    9531             : 
    9532             :   /* "neighbor disable-connected-check" commands.  */
    9533           0 :   install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
    9534           0 :   install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
    9535           0 :   install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
    9536           0 :   install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
    9537             : 
    9538             :   /* "neighbor description" commands. */
    9539           0 :   install_element (BGP_NODE, &neighbor_description_cmd);
    9540           0 :   install_element (BGP_NODE, &no_neighbor_description_cmd);
    9541           0 :   install_element (BGP_NODE, &no_neighbor_description_val_cmd);
    9542             : 
    9543             :   /* "neighbor update-source" commands. "*/
    9544           0 :   install_element (BGP_NODE, &neighbor_update_source_cmd);
    9545           0 :   install_element (BGP_NODE, &no_neighbor_update_source_cmd);
    9546             : 
    9547             :   /* "neighbor default-originate" commands. */
    9548           0 :   install_element (BGP_NODE, &neighbor_default_originate_cmd);
    9549           0 :   install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
    9550           0 :   install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
    9551           0 :   install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
    9552           0 :   install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
    9553           0 :   install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
    9554           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
    9555           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
    9556           0 :   install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
    9557           0 :   install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
    9558           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
    9559           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
    9560           0 :   install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
    9561           0 :   install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
    9562           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
    9563           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
    9564           0 :   install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
    9565           0 :   install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
    9566           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
    9567           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
    9568             : 
    9569             :   /* "neighbor port" commands. */
    9570           0 :   install_element (BGP_NODE, &neighbor_port_cmd);
    9571           0 :   install_element (BGP_NODE, &no_neighbor_port_cmd);
    9572           0 :   install_element (BGP_NODE, &no_neighbor_port_val_cmd);
    9573             : 
    9574             :   /* "neighbor weight" commands. */
    9575           0 :   install_element (BGP_NODE, &neighbor_weight_cmd);
    9576           0 :   install_element (BGP_NODE, &no_neighbor_weight_cmd);
    9577           0 :   install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
    9578             : 
    9579             :   /* "neighbor override-capability" commands. */
    9580           0 :   install_element (BGP_NODE, &neighbor_override_capability_cmd);
    9581           0 :   install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
    9582             : 
    9583             :   /* "neighbor strict-capability-match" commands. */
    9584           0 :   install_element (BGP_NODE, &neighbor_strict_capability_cmd);
    9585           0 :   install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
    9586             : 
    9587             :   /* "neighbor timers" commands. */
    9588           0 :   install_element (BGP_NODE, &neighbor_timers_cmd);
    9589           0 :   install_element (BGP_NODE, &no_neighbor_timers_cmd);
    9590             : 
    9591             :   /* "neighbor timers connect" commands. */
    9592           0 :   install_element (BGP_NODE, &neighbor_timers_connect_cmd);
    9593           0 :   install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
    9594           0 :   install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
    9595             : 
    9596             :   /* "neighbor advertisement-interval" commands. */
    9597           0 :   install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
    9598           0 :   install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
    9599           0 :   install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
    9600             : 
    9601             :   /* "neighbor version" commands. */
    9602           0 :   install_element (BGP_NODE, &neighbor_version_cmd);
    9603             : 
    9604             :   /* "neighbor interface" commands. */
    9605           0 :   install_element (BGP_NODE, &neighbor_interface_cmd);
    9606           0 :   install_element (BGP_NODE, &no_neighbor_interface_cmd);
    9607             : 
    9608             :   /* "neighbor distribute" commands. */
    9609           0 :   install_element (BGP_NODE, &neighbor_distribute_list_cmd);
    9610           0 :   install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
    9611           0 :   install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
    9612           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
    9613           0 :   install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
    9614           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
    9615           0 :   install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
    9616           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
    9617           0 :   install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
    9618           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
    9619           0 :   install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
    9620           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
    9621             : 
    9622             :   /* "neighbor prefix-list" commands. */
    9623           0 :   install_element (BGP_NODE, &neighbor_prefix_list_cmd);
    9624           0 :   install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
    9625           0 :   install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
    9626           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
    9627           0 :   install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
    9628           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
    9629           0 :   install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
    9630           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
    9631           0 :   install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
    9632           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
    9633           0 :   install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
    9634           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
    9635             : 
    9636             :   /* "neighbor filter-list" commands. */
    9637           0 :   install_element (BGP_NODE, &neighbor_filter_list_cmd);
    9638           0 :   install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
    9639           0 :   install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
    9640           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
    9641           0 :   install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
    9642           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
    9643           0 :   install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
    9644           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
    9645           0 :   install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
    9646           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
    9647           0 :   install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
    9648           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
    9649             : 
    9650             :   /* "neighbor route-map" commands. */
    9651           0 :   install_element (BGP_NODE, &neighbor_route_map_cmd);
    9652           0 :   install_element (BGP_NODE, &no_neighbor_route_map_cmd);
    9653           0 :   install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
    9654           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
    9655           0 :   install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
    9656           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
    9657           0 :   install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
    9658           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
    9659           0 :   install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
    9660           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
    9661           0 :   install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
    9662           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
    9663             : 
    9664             :   /* "neighbor unsuppress-map" commands. */
    9665           0 :   install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
    9666           0 :   install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
    9667           0 :   install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
    9668           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
    9669           0 :   install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
    9670           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
    9671           0 :   install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
    9672           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
    9673           0 :   install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
    9674           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
    9675           0 :   install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
    9676           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);  
    9677             : 
    9678             :   /* "neighbor maximum-prefix" commands. */
    9679           0 :   install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
    9680           0 :   install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
    9681           0 :   install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
    9682           0 :   install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
    9683           0 :   install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
    9684           0 :   install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
    9685           0 :   install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
    9686           0 :   install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
    9687           0 :   install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
    9688           0 :   install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
    9689           0 :   install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
    9690           0 :   install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
    9691           0 :   install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
    9692           0 :   install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
    9693           0 :   install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
    9694           0 :   install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
    9695           0 :   install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
    9696           0 :   install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
    9697           0 :   install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
    9698           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
    9699           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
    9700           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
    9701           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
    9702           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
    9703           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
    9704           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
    9705           0 :   install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
    9706           0 :   install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
    9707           0 :   install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
    9708           0 :   install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
    9709           0 :   install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
    9710           0 :   install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
    9711           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
    9712           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
    9713           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
    9714           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
    9715           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
    9716           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
    9717           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
    9718           0 :   install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
    9719           0 :   install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
    9720           0 :   install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
    9721           0 :   install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
    9722           0 :   install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
    9723           0 :   install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
    9724           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
    9725           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
    9726           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
    9727           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
    9728           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
    9729           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
    9730           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
    9731           0 :   install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
    9732           0 :   install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
    9733           0 :   install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
    9734           0 :   install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
    9735           0 :   install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
    9736           0 :   install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
    9737           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
    9738           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
    9739           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
    9740           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
    9741           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
    9742           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
    9743           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
    9744           0 :   install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
    9745           0 :   install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
    9746           0 :   install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
    9747           0 :   install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
    9748           0 :   install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
    9749           0 :   install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
    9750           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
    9751           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
    9752           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
    9753           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
    9754           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
    9755           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
    9756           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
    9757             : 
    9758             :   /* "neighbor allowas-in" */
    9759           0 :   install_element (BGP_NODE, &neighbor_allowas_in_cmd);
    9760           0 :   install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
    9761           0 :   install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
    9762           0 :   install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
    9763           0 :   install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
    9764           0 :   install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
    9765           0 :   install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
    9766           0 :   install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
    9767           0 :   install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
    9768           0 :   install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
    9769           0 :   install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
    9770           0 :   install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
    9771           0 :   install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
    9772           0 :   install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
    9773           0 :   install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
    9774           0 :   install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
    9775           0 :   install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
    9776           0 :   install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
    9777             : 
    9778             :   /* address-family commands. */
    9779           0 :   install_element (BGP_NODE, &address_family_ipv4_cmd);
    9780           0 :   install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
    9781             : #ifdef HAVE_IPV6
    9782           0 :   install_element (BGP_NODE, &address_family_ipv6_cmd);
    9783           0 :   install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
    9784             : #endif /* HAVE_IPV6 */
    9785           0 :   install_element (BGP_NODE, &address_family_vpnv4_cmd);
    9786           0 :   install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
    9787             : 
    9788             :   /* "exit-address-family" command. */
    9789           0 :   install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
    9790           0 :   install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
    9791           0 :   install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
    9792           0 :   install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
    9793           0 :   install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
    9794             : 
    9795             :   /* "clear ip bgp commands" */
    9796           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
    9797           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
    9798           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
    9799           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
    9800           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
    9801           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
    9802             : #ifdef HAVE_IPV6
    9803           0 :   install_element (ENABLE_NODE, &clear_bgp_all_cmd);
    9804           0 :   install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
    9805           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
    9806           0 :   install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
    9807           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
    9808           0 :   install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
    9809           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
    9810           0 :   install_element (ENABLE_NODE, &clear_bgp_external_cmd);
    9811           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
    9812           0 :   install_element (ENABLE_NODE, &clear_bgp_as_cmd);
    9813           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
    9814             : #endif /* HAVE_IPV6 */
    9815             : 
    9816             :   /* "clear ip bgp neighbor soft in" */
    9817           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
    9818           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
    9819           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
    9820           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
    9821           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
    9822           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
    9823           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
    9824           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
    9825           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
    9826           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
    9827           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
    9828           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
    9829           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
    9830           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
    9831           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
    9832           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
    9833           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
    9834           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
    9835           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
    9836           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
    9837           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
    9838           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
    9839           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
    9840           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
    9841           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
    9842           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
    9843           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
    9844           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
    9845           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
    9846           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
    9847           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
    9848           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
    9849           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
    9850           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
    9851           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
    9852           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
    9853           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
    9854           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
    9855           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
    9856           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
    9857             : #ifdef HAVE_IPV6
    9858           0 :   install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
    9859           0 :   install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
    9860           0 :   install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
    9861           0 :   install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
    9862           0 :   install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
    9863           0 :   install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
    9864           0 :   install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
    9865           0 :   install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
    9866           0 :   install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
    9867           0 :   install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
    9868           0 :   install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
    9869           0 :   install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
    9870           0 :   install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
    9871           0 :   install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
    9872           0 :   install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
    9873           0 :   install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
    9874           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
    9875           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
    9876           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
    9877           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
    9878           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
    9879           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
    9880           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
    9881           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
    9882           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
    9883           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
    9884           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
    9885           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
    9886           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
    9887           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
    9888           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
    9889             : #endif /* HAVE_IPV6 */
    9890             : 
    9891             :   /* "clear ip bgp neighbor soft out" */
    9892           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
    9893           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
    9894           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
    9895           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
    9896           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
    9897           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
    9898           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
    9899           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
    9900           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
    9901           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
    9902           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
    9903           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
    9904           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
    9905           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
    9906           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
    9907           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
    9908           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
    9909           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
    9910           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
    9911           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
    9912           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
    9913           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
    9914           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
    9915           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
    9916           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
    9917           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
    9918           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
    9919           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
    9920             : #ifdef HAVE_IPV6
    9921           0 :   install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
    9922           0 :   install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
    9923           0 :   install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
    9924           0 :   install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
    9925           0 :   install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
    9926           0 :   install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
    9927           0 :   install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
    9928           0 :   install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
    9929           0 :   install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
    9930           0 :   install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
    9931           0 :   install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
    9932           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
    9933           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
    9934           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
    9935           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
    9936           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
    9937           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
    9938           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
    9939           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
    9940           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
    9941           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
    9942             : #endif /* HAVE_IPV6 */
    9943             : 
    9944             :   /* "clear ip bgp neighbor soft" */
    9945           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
    9946           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
    9947           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
    9948           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
    9949           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
    9950           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
    9951           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
    9952           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
    9953           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
    9954           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
    9955           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
    9956           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
    9957           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
    9958           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
    9959           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
    9960             : #ifdef HAVE_IPV6
    9961           0 :   install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
    9962           0 :   install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
    9963           0 :   install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
    9964           0 :   install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
    9965           0 :   install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
    9966           0 :   install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
    9967           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
    9968           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
    9969           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
    9970           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
    9971           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
    9972             : #endif /* HAVE_IPV6 */
    9973             : 
    9974             :   /* "clear ip bgp neighbor rsclient" */
    9975           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
    9976           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
    9977           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
    9978           0 :   install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
    9979             : #ifdef HAVE_IPV6
    9980           0 :   install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
    9981           0 :   install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
    9982           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
    9983           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
    9984           0 :   install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
    9985           0 :   install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
    9986           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
    9987           0 :   install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
    9988             : #endif /* HAVE_IPV6 */
    9989             : 
    9990             :   /* "show ip bgp summary" commands. */
    9991           0 :   install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
    9992           0 :   install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
    9993           0 :   install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
    9994           0 :   install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
    9995           0 :   install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
    9996           0 :   install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
    9997           0 :   install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
    9998           0 :   install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
    9999             : #ifdef HAVE_IPV6
   10000           0 :   install_element (VIEW_NODE, &show_bgp_summary_cmd);
   10001           0 :   install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
   10002           0 :   install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
   10003           0 :   install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
   10004           0 :   install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
   10005           0 :   install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
   10006             : #endif /* HAVE_IPV6 */
   10007           0 :   install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
   10008           0 :   install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
   10009           0 :   install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
   10010           0 :   install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
   10011           0 :   install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
   10012           0 :   install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
   10013           0 :   install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
   10014           0 :   install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
   10015             : #ifdef HAVE_IPV6
   10016           0 :   install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
   10017           0 :   install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
   10018           0 :   install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
   10019           0 :   install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
   10020           0 :   install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
   10021           0 :   install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
   10022             : #endif /* HAVE_IPV6 */
   10023           0 :   install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
   10024           0 :   install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
   10025           0 :   install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
   10026           0 :   install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
   10027           0 :   install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
   10028           0 :   install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
   10029           0 :   install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
   10030           0 :   install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
   10031             : #ifdef HAVE_IPV6
   10032           0 :   install_element (ENABLE_NODE, &show_bgp_summary_cmd);
   10033           0 :   install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
   10034           0 :   install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
   10035           0 :   install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
   10036           0 :   install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
   10037           0 :   install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
   10038             : #endif /* HAVE_IPV6 */
   10039             : 
   10040             :   /* "show ip bgp neighbors" commands. */
   10041           0 :   install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
   10042           0 :   install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
   10043           0 :   install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
   10044           0 :   install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
   10045           0 :   install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
   10046           0 :   install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
   10047           0 :   install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
   10048           0 :   install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
   10049           0 :   install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
   10050           0 :   install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
   10051           0 :   install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
   10052           0 :   install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
   10053           0 :   install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
   10054           0 :   install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
   10055           0 :   install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
   10056           0 :   install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
   10057           0 :   install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
   10058           0 :   install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
   10059           0 :   install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
   10060           0 :   install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
   10061           0 :   install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
   10062           0 :   install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
   10063           0 :   install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
   10064           0 :   install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
   10065           0 :   install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
   10066             : 
   10067             : #ifdef HAVE_IPV6
   10068           0 :   install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
   10069           0 :   install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
   10070           0 :   install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
   10071           0 :   install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
   10072           0 :   install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
   10073           0 :   install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
   10074           0 :   install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
   10075           0 :   install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
   10076           0 :   install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
   10077           0 :   install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
   10078           0 :   install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
   10079           0 :   install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
   10080           0 :   install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
   10081           0 :   install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
   10082           0 :   install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
   10083           0 :   install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
   10084           0 :   install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
   10085           0 :   install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
   10086           0 :   install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
   10087           0 :   install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
   10088             : 
   10089             :   /* Old commands.  */
   10090           0 :   install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
   10091           0 :   install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
   10092           0 :   install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
   10093           0 :   install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
   10094             : #endif /* HAVE_IPV6 */
   10095             : 
   10096             :   /* "show ip bgp rsclient" commands. */
   10097           0 :   install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
   10098           0 :   install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
   10099           0 :   install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
   10100           0 :   install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
   10101           0 :   install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
   10102           0 :   install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
   10103           0 :   install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
   10104           0 :   install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
   10105           0 :   install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
   10106           0 :   install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
   10107           0 :   install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
   10108           0 :   install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
   10109           0 :   install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
   10110           0 :   install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
   10111           0 :   install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
   10112           0 :   install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
   10113           0 :   install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
   10114           0 :   install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
   10115             : 
   10116             : #ifdef HAVE_IPV6
   10117           0 :   install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
   10118           0 :   install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
   10119           0 :   install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
   10120           0 :   install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
   10121           0 :   install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
   10122           0 :   install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
   10123           0 :   install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
   10124           0 :   install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
   10125           0 :   install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
   10126           0 :   install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
   10127           0 :   install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
   10128           0 :   install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
   10129           0 :   install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
   10130           0 :   install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
   10131           0 :   install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
   10132           0 :   install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
   10133           0 :   install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
   10134           0 :   install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
   10135             : #endif /* HAVE_IPV6 */
   10136             : 
   10137             :   /* "show ip bgp paths" commands. */
   10138           0 :   install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
   10139           0 :   install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
   10140           0 :   install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
   10141           0 :   install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
   10142             : 
   10143             :   /* "show ip bgp community" commands. */
   10144           0 :   install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
   10145           0 :   install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
   10146             : 
   10147             :   /* "show ip bgp attribute-info" commands. */
   10148           0 :   install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
   10149           0 :   install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
   10150             : 
   10151             :   /* "redistribute" commands.  */
   10152           0 :   install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
   10153           0 :   install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
   10154           0 :   install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
   10155           0 :   install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
   10156           0 :   install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
   10157           0 :   install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
   10158           0 :   install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
   10159           0 :   install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
   10160           0 :   install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
   10161           0 :   install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
   10162             : #ifdef HAVE_IPV6
   10163           0 :   install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
   10164           0 :   install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
   10165           0 :   install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
   10166           0 :   install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
   10167           0 :   install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
   10168           0 :   install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
   10169           0 :   install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
   10170           0 :   install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
   10171           0 :   install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
   10172           0 :   install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
   10173             : #endif /* HAVE_IPV6 */
   10174             : 
   10175             :   /* ttl_security commands */
   10176           0 :   install_element (BGP_NODE, &neighbor_ttl_security_cmd);
   10177           0 :   install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
   10178             : 
   10179             :   /* "show bgp memory" commands. */
   10180           0 :   install_element (VIEW_NODE, &show_bgp_memory_cmd);
   10181           0 :   install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
   10182           0 :   install_element (ENABLE_NODE, &show_bgp_memory_cmd);
   10183             :   
   10184             :   /* "show bgp views" commands. */
   10185           0 :   install_element (VIEW_NODE, &show_bgp_views_cmd);
   10186           0 :   install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
   10187           0 :   install_element (ENABLE_NODE, &show_bgp_views_cmd);
   10188             :   
   10189             :   /* Community-list. */
   10190           0 :   community_list_vty ();
   10191           0 : }
   10192             : 
   10193             : #include "memory.h"
   10194             : #include "bgp_regex.h"
   10195             : #include "bgp_clist.h"
   10196             : #include "bgp_ecommunity.h"
   10197             : 
   10198             : /* VTY functions.  */
   10199             : 
   10200             : /* Direction value to string conversion.  */
   10201             : static const char *
   10202           0 : community_direct_str (int direct)
   10203             : {
   10204           0 :   switch (direct)
   10205             :     {
   10206             :     case COMMUNITY_DENY:
   10207           0 :       return "deny";
   10208             :     case COMMUNITY_PERMIT:
   10209           0 :       return "permit";
   10210             :     default:
   10211           0 :       return "unknown";
   10212             :     }
   10213             : }
   10214             : 
   10215             : /* Display error string.  */
   10216             : static void
   10217           0 : community_list_perror (struct vty *vty, int ret)
   10218             : {
   10219           0 :   switch (ret)
   10220             :     {
   10221             :     case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
   10222           0 :       vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
   10223           0 :       break;
   10224             :     case COMMUNITY_LIST_ERR_MALFORMED_VAL:
   10225           0 :       vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
   10226           0 :       break;
   10227             :     case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
   10228           0 :       vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
   10229           0 :       break;
   10230             :     case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
   10231           0 :       vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
   10232           0 :       break;
   10233             :     }
   10234           0 : }
   10235             : 
   10236             : /* VTY interface for community_set() function.  */
   10237             : static int
   10238           0 : community_list_set_vty (struct vty *vty, int argc, const char **argv, 
   10239             :                         int style, int reject_all_digit_name)
   10240             : {
   10241             :   int ret;
   10242             :   int direct;
   10243             :   char *str;
   10244             : 
   10245             :   /* Check the list type. */
   10246           0 :   if (strncmp (argv[1], "p", 1) == 0)
   10247           0 :     direct = COMMUNITY_PERMIT;
   10248           0 :   else if (strncmp (argv[1], "d", 1) == 0)
   10249           0 :     direct = COMMUNITY_DENY;
   10250             :   else
   10251             :     {
   10252           0 :       vty_out (vty, "%% Matching condition must be permit or deny%s",
   10253           0 :                VTY_NEWLINE);
   10254           0 :       return CMD_WARNING;
   10255             :     }
   10256             : 
   10257             :   /* All digit name check.  */
   10258           0 :   if (reject_all_digit_name && all_digit (argv[0]))
   10259             :     {
   10260           0 :       vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
   10261           0 :       return CMD_WARNING;
   10262             :     }
   10263             : 
   10264             :   /* Concat community string argument.  */
   10265           0 :   if (argc > 1)
   10266           0 :     str = argv_concat (argv, argc, 2);
   10267             :   else
   10268           0 :     str = NULL;
   10269             : 
   10270             :   /* When community_list_set() return nevetive value, it means
   10271             :      malformed community string.  */
   10272           0 :   ret = community_list_set (bgp_clist, argv[0], str, direct, style);
   10273             : 
   10274             :   /* Free temporary community list string allocated by
   10275             :      argv_concat().  */
   10276           0 :   if (str)
   10277           0 :     XFREE (MTYPE_TMP, str);
   10278             : 
   10279           0 :   if (ret < 0)
   10280             :     {
   10281             :       /* Display error string.  */
   10282           0 :       community_list_perror (vty, ret);
   10283           0 :       return CMD_WARNING;
   10284             :     }
   10285             : 
   10286           0 :   return CMD_SUCCESS;
   10287             : }
   10288             : 
   10289             : /* Communiyt-list entry delete.  */
   10290             : static int
   10291           0 : community_list_unset_vty (struct vty *vty, int argc, const char **argv,
   10292             :                           int style)
   10293             : {
   10294             :   int ret;
   10295           0 :   int direct = 0;
   10296           0 :   char *str = NULL;
   10297             : 
   10298           0 :   if (argc > 1)
   10299             :     {
   10300             :       /* Check the list direct. */
   10301           0 :       if (strncmp (argv[1], "p", 1) == 0)
   10302           0 :         direct = COMMUNITY_PERMIT;
   10303           0 :       else if (strncmp (argv[1], "d", 1) == 0)
   10304           0 :         direct = COMMUNITY_DENY;
   10305             :       else
   10306             :         {
   10307           0 :           vty_out (vty, "%% Matching condition must be permit or deny%s",
   10308           0 :                    VTY_NEWLINE);
   10309           0 :           return CMD_WARNING;
   10310             :         }
   10311             : 
   10312             :       /* Concat community string argument.  */
   10313           0 :       str = argv_concat (argv, argc, 2);
   10314             :     }
   10315             : 
   10316             :   /* Unset community list.  */
   10317           0 :   ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
   10318             : 
   10319             :   /* Free temporary community list string allocated by
   10320             :      argv_concat().  */
   10321           0 :   if (str)
   10322           0 :     XFREE (MTYPE_TMP, str);
   10323             : 
   10324           0 :   if (ret < 0)
   10325             :     {
   10326           0 :       community_list_perror (vty, ret);
   10327           0 :       return CMD_WARNING;
   10328             :     }
   10329             : 
   10330           0 :   return CMD_SUCCESS;
   10331             : }
   10332             : 
   10333             : /* "community-list" keyword help string.  */
   10334             : #define COMMUNITY_LIST_STR "Add a community list entry\n"
   10335             : #define COMMUNITY_VAL_STR  "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
   10336             : 
   10337           0 : DEFUN (ip_community_list_standard,
   10338             :        ip_community_list_standard_cmd,
   10339             :        "ip community-list <1-99> (deny|permit) .AA:NN",
   10340             :        IP_STR
   10341             :        COMMUNITY_LIST_STR
   10342             :        "Community list number (standard)\n"
   10343             :        "Specify community to reject\n"
   10344             :        "Specify community to accept\n"
   10345             :        COMMUNITY_VAL_STR)
   10346             : {
   10347           0 :   return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
   10348             : }
   10349             : 
   10350             : ALIAS (ip_community_list_standard,
   10351             :        ip_community_list_standard2_cmd,
   10352             :        "ip community-list <1-99> (deny|permit)",
   10353             :        IP_STR
   10354             :        COMMUNITY_LIST_STR
   10355             :        "Community list number (standard)\n"
   10356             :        "Specify community to reject\n"
   10357             :        "Specify community to accept\n")
   10358             : 
   10359           0 : DEFUN (ip_community_list_expanded,
   10360             :        ip_community_list_expanded_cmd,
   10361             :        "ip community-list <100-500> (deny|permit) .LINE",
   10362             :        IP_STR
   10363             :        COMMUNITY_LIST_STR
   10364             :        "Community list number (expanded)\n"
   10365             :        "Specify community to reject\n"
   10366             :        "Specify community to accept\n"
   10367             :        "An ordered list as a regular-expression\n")
   10368             : {
   10369           0 :   return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
   10370             : }
   10371             : 
   10372           0 : DEFUN (ip_community_list_name_standard,
   10373             :        ip_community_list_name_standard_cmd,
   10374             :        "ip community-list standard WORD (deny|permit) .AA:NN",
   10375             :        IP_STR
   10376             :        COMMUNITY_LIST_STR
   10377             :        "Add a standard community-list entry\n"
   10378             :        "Community list name\n"
   10379             :        "Specify community to reject\n"
   10380             :        "Specify community to accept\n"
   10381             :        COMMUNITY_VAL_STR)
   10382             : {
   10383           0 :   return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
   10384             : }
   10385             : 
   10386             : ALIAS (ip_community_list_name_standard,
   10387             :        ip_community_list_name_standard2_cmd,
   10388             :        "ip community-list standard WORD (deny|permit)",
   10389             :        IP_STR
   10390             :        COMMUNITY_LIST_STR
   10391             :        "Add a standard community-list entry\n"
   10392             :        "Community list name\n"
   10393             :        "Specify community to reject\n"
   10394             :        "Specify community to accept\n")
   10395             : 
   10396           0 : DEFUN (ip_community_list_name_expanded,
   10397             :        ip_community_list_name_expanded_cmd,
   10398             :        "ip community-list expanded WORD (deny|permit) .LINE",
   10399             :        IP_STR
   10400             :        COMMUNITY_LIST_STR
   10401             :        "Add an expanded community-list entry\n"
   10402             :        "Community list name\n"
   10403             :        "Specify community to reject\n"
   10404             :        "Specify community to accept\n"
   10405             :        "An ordered list as a regular-expression\n")
   10406             : {
   10407           0 :   return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
   10408             : }
   10409             : 
   10410           0 : DEFUN (no_ip_community_list_standard_all,
   10411             :        no_ip_community_list_standard_all_cmd,
   10412             :        "no ip community-list <1-99>",
   10413             :        NO_STR
   10414             :        IP_STR
   10415             :        COMMUNITY_LIST_STR
   10416             :        "Community list number (standard)\n")
   10417             : {
   10418           0 :   return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
   10419             : }
   10420             : 
   10421           0 : DEFUN (no_ip_community_list_expanded_all,
   10422             :        no_ip_community_list_expanded_all_cmd,
   10423             :        "no ip community-list <100-500>",
   10424             :        NO_STR
   10425             :        IP_STR
   10426             :        COMMUNITY_LIST_STR
   10427             :        "Community list number (expanded)\n")
   10428             : {
   10429           0 :   return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
   10430             : }
   10431             : 
   10432           0 : DEFUN (no_ip_community_list_name_standard_all,
   10433             :        no_ip_community_list_name_standard_all_cmd,
   10434             :        "no ip community-list standard WORD",
   10435             :        NO_STR
   10436             :        IP_STR
   10437             :        COMMUNITY_LIST_STR
   10438             :        "Add a standard community-list entry\n"
   10439             :        "Community list name\n")
   10440             : {
   10441           0 :   return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
   10442             : }
   10443             : 
   10444           0 : DEFUN (no_ip_community_list_name_expanded_all,
   10445             :        no_ip_community_list_name_expanded_all_cmd,
   10446             :        "no ip community-list expanded WORD",
   10447             :        NO_STR
   10448             :        IP_STR
   10449             :        COMMUNITY_LIST_STR
   10450             :        "Add an expanded community-list entry\n"
   10451             :        "Community list name\n")
   10452             : {
   10453           0 :   return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
   10454             : }
   10455             : 
   10456           0 : DEFUN (no_ip_community_list_standard,
   10457             :        no_ip_community_list_standard_cmd,
   10458             :        "no ip community-list <1-99> (deny|permit) .AA:NN",
   10459             :        NO_STR
   10460             :        IP_STR
   10461             :        COMMUNITY_LIST_STR
   10462             :        "Community list number (standard)\n"
   10463             :        "Specify community to reject\n"
   10464             :        "Specify community to accept\n"
   10465             :        COMMUNITY_VAL_STR)
   10466             : {
   10467           0 :   return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
   10468             : }
   10469             : 
   10470           0 : DEFUN (no_ip_community_list_expanded,
   10471             :        no_ip_community_list_expanded_cmd,
   10472             :        "no ip community-list <100-500> (deny|permit) .LINE",
   10473             :        NO_STR
   10474             :        IP_STR
   10475             :        COMMUNITY_LIST_STR
   10476             :        "Community list number (expanded)\n"
   10477             :        "Specify community to reject\n"
   10478             :        "Specify community to accept\n"
   10479             :        "An ordered list as a regular-expression\n")
   10480             : {
   10481           0 :   return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
   10482             : }
   10483             : 
   10484           0 : DEFUN (no_ip_community_list_name_standard,
   10485             :        no_ip_community_list_name_standard_cmd,
   10486             :        "no ip community-list standard WORD (deny|permit) .AA:NN",
   10487             :        NO_STR
   10488             :        IP_STR
   10489             :        COMMUNITY_LIST_STR
   10490             :        "Specify a standard community-list\n"
   10491             :        "Community list name\n"
   10492             :        "Specify community to reject\n"
   10493             :        "Specify community to accept\n"
   10494             :        COMMUNITY_VAL_STR)
   10495             : {
   10496           0 :   return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
   10497             : }
   10498             : 
   10499           0 : DEFUN (no_ip_community_list_name_expanded,
   10500             :        no_ip_community_list_name_expanded_cmd,
   10501             :        "no ip community-list expanded WORD (deny|permit) .LINE",
   10502             :        NO_STR
   10503             :        IP_STR
   10504             :        COMMUNITY_LIST_STR
   10505             :        "Specify an expanded community-list\n"
   10506             :        "Community list name\n"
   10507             :        "Specify community to reject\n"
   10508             :        "Specify community to accept\n"
   10509             :        "An ordered list as a regular-expression\n")
   10510             : {
   10511           0 :   return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
   10512             : }
   10513             : 
   10514             : static void
   10515           0 : community_list_show (struct vty *vty, struct community_list *list)
   10516             : {
   10517             :   struct community_entry *entry;
   10518             : 
   10519           0 :   for (entry = list->head; entry; entry = entry->next)
   10520             :     {
   10521           0 :       if (entry == list->head)
   10522             :         {
   10523           0 :           if (all_digit (list->name))
   10524           0 :             vty_out (vty, "Community %s list %s%s",
   10525           0 :                      entry->style == COMMUNITY_LIST_STANDARD ?
   10526             :                      "standard" : "(expanded) access",
   10527           0 :                      list->name, VTY_NEWLINE);
   10528             :           else
   10529           0 :             vty_out (vty, "Named Community %s list %s%s",
   10530           0 :                      entry->style == COMMUNITY_LIST_STANDARD ?
   10531             :                      "standard" : "expanded",
   10532           0 :                      list->name, VTY_NEWLINE);
   10533             :         }
   10534           0 :       if (entry->any)
   10535           0 :         vty_out (vty, "    %s%s",
   10536           0 :                  community_direct_str (entry->direct), VTY_NEWLINE);
   10537             :       else
   10538           0 :         vty_out (vty, "    %s %s%s",
   10539           0 :                  community_direct_str (entry->direct),
   10540           0 :                  entry->style == COMMUNITY_LIST_STANDARD
   10541           0 :                  ? community_str (entry->u.com) : entry->config,
   10542           0 :                  VTY_NEWLINE);
   10543             :     }
   10544           0 : }
   10545             : 
   10546           0 : DEFUN (show_ip_community_list,
   10547             :        show_ip_community_list_cmd,
   10548             :        "show ip community-list",
   10549             :        SHOW_STR
   10550             :        IP_STR
   10551             :        "List community-list\n")
   10552             : {
   10553             :   struct community_list *list;
   10554             :   struct community_list_master *cm;
   10555             : 
   10556           0 :   cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
   10557           0 :   if (! cm)
   10558           0 :     return CMD_SUCCESS;
   10559             : 
   10560           0 :   for (list = cm->num.head; list; list = list->next)
   10561           0 :     community_list_show (vty, list);
   10562             : 
   10563           0 :   for (list = cm->str.head; list; list = list->next)
   10564           0 :     community_list_show (vty, list);
   10565             : 
   10566           0 :   return CMD_SUCCESS;
   10567             : }
   10568             : 
   10569           0 : DEFUN (show_ip_community_list_arg,
   10570             :        show_ip_community_list_arg_cmd,
   10571             :        "show ip community-list (<1-500>|WORD)",
   10572             :        SHOW_STR
   10573             :        IP_STR
   10574             :        "List community-list\n"
   10575             :        "Community-list number\n"
   10576             :        "Community-list name\n")
   10577             : {
   10578             :   struct community_list *list;
   10579             : 
   10580           0 :   list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
   10581           0 :   if (! list)
   10582             :     {
   10583           0 :       vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
   10584           0 :       return CMD_WARNING;
   10585             :     }
   10586             : 
   10587           0 :   community_list_show (vty, list);
   10588             : 
   10589           0 :   return CMD_SUCCESS;
   10590             : }
   10591             : 
   10592             : static int
   10593           0 : extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, 
   10594             :                            int style, int reject_all_digit_name)
   10595             : {
   10596             :   int ret;
   10597             :   int direct;
   10598             :   char *str;
   10599             : 
   10600             :   /* Check the list type. */
   10601           0 :   if (strncmp (argv[1], "p", 1) == 0)
   10602           0 :     direct = COMMUNITY_PERMIT;
   10603           0 :   else if (strncmp (argv[1], "d", 1) == 0)
   10604           0 :     direct = COMMUNITY_DENY;
   10605             :   else
   10606             :     {
   10607           0 :       vty_out (vty, "%% Matching condition must be permit or deny%s",
   10608           0 :                VTY_NEWLINE);
   10609           0 :       return CMD_WARNING;
   10610             :     }
   10611             : 
   10612             :   /* All digit name check.  */
   10613           0 :   if (reject_all_digit_name && all_digit (argv[0]))
   10614             :     {
   10615           0 :       vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
   10616           0 :       return CMD_WARNING;
   10617             :     }
   10618             : 
   10619             :   /* Concat community string argument.  */
   10620           0 :   if (argc > 1)
   10621           0 :     str = argv_concat (argv, argc, 2);
   10622             :   else
   10623           0 :     str = NULL;
   10624             : 
   10625           0 :   ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
   10626             : 
   10627             :   /* Free temporary community list string allocated by
   10628             :      argv_concat().  */
   10629           0 :   if (str)
   10630           0 :     XFREE (MTYPE_TMP, str);
   10631             : 
   10632           0 :   if (ret < 0)
   10633             :     {
   10634           0 :       community_list_perror (vty, ret);
   10635           0 :       return CMD_WARNING;
   10636             :     }
   10637           0 :   return CMD_SUCCESS;
   10638             : }
   10639             : 
   10640             : static int
   10641           0 : extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
   10642             :                              int style)
   10643             : {
   10644             :   int ret;
   10645           0 :   int direct = 0;
   10646           0 :   char *str = NULL;
   10647             : 
   10648           0 :   if (argc > 1)
   10649             :     {
   10650             :       /* Check the list direct. */
   10651           0 :       if (strncmp (argv[1], "p", 1) == 0)
   10652           0 :         direct = COMMUNITY_PERMIT;
   10653           0 :       else if (strncmp (argv[1], "d", 1) == 0)
   10654           0 :         direct = COMMUNITY_DENY;
   10655             :       else
   10656             :         {
   10657           0 :           vty_out (vty, "%% Matching condition must be permit or deny%s",
   10658           0 :                    VTY_NEWLINE);
   10659           0 :           return CMD_WARNING;
   10660             :         }
   10661             : 
   10662             :       /* Concat community string argument.  */
   10663           0 :       str = argv_concat (argv, argc, 2);
   10664             :     }
   10665             : 
   10666             :   /* Unset community list.  */
   10667           0 :   ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
   10668             : 
   10669             :   /* Free temporary community list string allocated by
   10670             :      argv_concat().  */
   10671           0 :   if (str)
   10672           0 :     XFREE (MTYPE_TMP, str);
   10673             : 
   10674           0 :   if (ret < 0)
   10675             :     {
   10676           0 :       community_list_perror (vty, ret);
   10677           0 :       return CMD_WARNING;
   10678             :     }
   10679             : 
   10680           0 :   return CMD_SUCCESS;
   10681             : }
   10682             : 
   10683             : /* "extcommunity-list" keyword help string.  */
   10684             : #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
   10685             : #define EXTCOMMUNITY_VAL_STR  "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
   10686             : 
   10687           0 : DEFUN (ip_extcommunity_list_standard,
   10688             :        ip_extcommunity_list_standard_cmd,
   10689             :        "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
   10690             :        IP_STR
   10691             :        EXTCOMMUNITY_LIST_STR
   10692             :        "Extended Community list number (standard)\n"
   10693             :        "Specify community to reject\n"
   10694             :        "Specify community to accept\n"
   10695             :        EXTCOMMUNITY_VAL_STR)
   10696             : {
   10697           0 :   return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
   10698             : }
   10699             : 
   10700             : ALIAS (ip_extcommunity_list_standard,
   10701             :        ip_extcommunity_list_standard2_cmd,
   10702             :        "ip extcommunity-list <1-99> (deny|permit)",
   10703             :        IP_STR
   10704             :        EXTCOMMUNITY_LIST_STR
   10705             :        "Extended Community list number (standard)\n"
   10706             :        "Specify community to reject\n"
   10707             :        "Specify community to accept\n")
   10708             : 
   10709           0 : DEFUN (ip_extcommunity_list_expanded,
   10710             :        ip_extcommunity_list_expanded_cmd,
   10711             :        "ip extcommunity-list <100-500> (deny|permit) .LINE",
   10712             :        IP_STR
   10713             :        EXTCOMMUNITY_LIST_STR
   10714             :        "Extended Community list number (expanded)\n"
   10715             :        "Specify community to reject\n"
   10716             :        "Specify community to accept\n"
   10717             :        "An ordered list as a regular-expression\n")
   10718             : {
   10719           0 :   return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
   10720             : }
   10721             : 
   10722           0 : DEFUN (ip_extcommunity_list_name_standard,
   10723             :        ip_extcommunity_list_name_standard_cmd,
   10724             :        "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
   10725             :        IP_STR
   10726             :        EXTCOMMUNITY_LIST_STR
   10727             :        "Specify standard extcommunity-list\n"
   10728             :        "Extended Community list name\n"
   10729             :        "Specify community to reject\n"
   10730             :        "Specify community to accept\n"
   10731             :        EXTCOMMUNITY_VAL_STR)
   10732             : {
   10733           0 :   return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
   10734             : }
   10735             : 
   10736             : ALIAS (ip_extcommunity_list_name_standard,
   10737             :        ip_extcommunity_list_name_standard2_cmd,
   10738             :        "ip extcommunity-list standard WORD (deny|permit)",
   10739             :        IP_STR
   10740             :        EXTCOMMUNITY_LIST_STR
   10741             :        "Specify standard extcommunity-list\n"
   10742             :        "Extended Community list name\n"
   10743             :        "Specify community to reject\n"
   10744             :        "Specify community to accept\n")
   10745             : 
   10746           0 : DEFUN (ip_extcommunity_list_name_expanded,
   10747             :        ip_extcommunity_list_name_expanded_cmd,
   10748             :        "ip extcommunity-list expanded WORD (deny|permit) .LINE",
   10749             :        IP_STR
   10750             :        EXTCOMMUNITY_LIST_STR
   10751             :        "Specify expanded extcommunity-list\n"
   10752             :        "Extended Community list name\n"
   10753             :        "Specify community to reject\n"
   10754             :        "Specify community to accept\n"
   10755             :        "An ordered list as a regular-expression\n")
   10756             : {
   10757           0 :   return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
   10758             : }
   10759             : 
   10760           0 : DEFUN (no_ip_extcommunity_list_standard_all,
   10761             :        no_ip_extcommunity_list_standard_all_cmd,
   10762             :        "no ip extcommunity-list <1-99>",
   10763             :        NO_STR
   10764             :        IP_STR
   10765             :        EXTCOMMUNITY_LIST_STR
   10766             :        "Extended Community list number (standard)\n")
   10767             : {
   10768           0 :   return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
   10769             : }
   10770             : 
   10771           0 : DEFUN (no_ip_extcommunity_list_expanded_all,
   10772             :        no_ip_extcommunity_list_expanded_all_cmd,
   10773             :        "no ip extcommunity-list <100-500>",
   10774             :        NO_STR
   10775             :        IP_STR
   10776             :        EXTCOMMUNITY_LIST_STR
   10777             :        "Extended Community list number (expanded)\n")
   10778             : {
   10779           0 :   return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
   10780             : }
   10781             : 
   10782           0 : DEFUN (no_ip_extcommunity_list_name_standard_all,
   10783             :        no_ip_extcommunity_list_name_standard_all_cmd,
   10784             :        "no ip extcommunity-list standard WORD",
   10785             :        NO_STR
   10786             :        IP_STR
   10787             :        EXTCOMMUNITY_LIST_STR
   10788             :        "Specify standard extcommunity-list\n"
   10789             :        "Extended Community list name\n")
   10790             : {
   10791           0 :   return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
   10792             : }
   10793             : 
   10794           0 : DEFUN (no_ip_extcommunity_list_name_expanded_all,
   10795             :        no_ip_extcommunity_list_name_expanded_all_cmd,
   10796             :        "no ip extcommunity-list expanded WORD",
   10797             :        NO_STR
   10798             :        IP_STR
   10799             :        EXTCOMMUNITY_LIST_STR
   10800             :        "Specify expanded extcommunity-list\n"
   10801             :        "Extended Community list name\n")
   10802             : {
   10803           0 :   return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
   10804             : }
   10805             : 
   10806           0 : DEFUN (no_ip_extcommunity_list_standard,
   10807             :        no_ip_extcommunity_list_standard_cmd,
   10808             :        "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
   10809             :        NO_STR
   10810             :        IP_STR
   10811             :        EXTCOMMUNITY_LIST_STR
   10812             :        "Extended Community list number (standard)\n"
   10813             :        "Specify community to reject\n"
   10814             :        "Specify community to accept\n"
   10815             :        EXTCOMMUNITY_VAL_STR)
   10816             : {
   10817           0 :   return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
   10818             : }
   10819             : 
   10820           0 : DEFUN (no_ip_extcommunity_list_expanded,
   10821             :        no_ip_extcommunity_list_expanded_cmd,
   10822             :        "no ip extcommunity-list <100-500> (deny|permit) .LINE",
   10823             :        NO_STR
   10824             :        IP_STR
   10825             :        EXTCOMMUNITY_LIST_STR
   10826             :        "Extended Community list number (expanded)\n"
   10827             :        "Specify community to reject\n"
   10828             :        "Specify community to accept\n"
   10829             :        "An ordered list as a regular-expression\n")
   10830             : {
   10831           0 :   return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
   10832             : }
   10833             : 
   10834           0 : DEFUN (no_ip_extcommunity_list_name_standard,
   10835             :        no_ip_extcommunity_list_name_standard_cmd,
   10836             :        "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
   10837             :        NO_STR
   10838             :        IP_STR
   10839             :        EXTCOMMUNITY_LIST_STR
   10840             :        "Specify standard extcommunity-list\n"
   10841             :        "Extended Community list name\n"
   10842             :        "Specify community to reject\n"
   10843             :        "Specify community to accept\n"
   10844             :        EXTCOMMUNITY_VAL_STR)
   10845             : {
   10846           0 :   return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
   10847             : }
   10848             : 
   10849           0 : DEFUN (no_ip_extcommunity_list_name_expanded,
   10850             :        no_ip_extcommunity_list_name_expanded_cmd,
   10851             :        "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
   10852             :        NO_STR
   10853             :        IP_STR
   10854             :        EXTCOMMUNITY_LIST_STR
   10855             :        "Specify expanded extcommunity-list\n"
   10856             :        "Community list name\n"
   10857             :        "Specify community to reject\n"
   10858             :        "Specify community to accept\n"
   10859             :        "An ordered list as a regular-expression\n")
   10860             : {
   10861           0 :   return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
   10862             : }
   10863             : 
   10864             : static void
   10865           0 : extcommunity_list_show (struct vty *vty, struct community_list *list)
   10866             : {
   10867             :   struct community_entry *entry;
   10868             : 
   10869           0 :   for (entry = list->head; entry; entry = entry->next)
   10870             :     {
   10871           0 :       if (entry == list->head)
   10872             :         {
   10873           0 :           if (all_digit (list->name))
   10874           0 :             vty_out (vty, "Extended community %s list %s%s",
   10875           0 :                      entry->style == EXTCOMMUNITY_LIST_STANDARD ?
   10876             :                      "standard" : "(expanded) access",
   10877           0 :                      list->name, VTY_NEWLINE);
   10878             :           else
   10879           0 :             vty_out (vty, "Named extended community %s list %s%s",
   10880           0 :                      entry->style == EXTCOMMUNITY_LIST_STANDARD ?
   10881             :                      "standard" : "expanded",
   10882           0 :                      list->name, VTY_NEWLINE);
   10883             :         }
   10884           0 :       if (entry->any)
   10885           0 :         vty_out (vty, "    %s%s",
   10886           0 :                  community_direct_str (entry->direct), VTY_NEWLINE);
   10887             :       else
   10888           0 :         vty_out (vty, "    %s %s%s",
   10889           0 :                  community_direct_str (entry->direct),
   10890           0 :                  entry->style == EXTCOMMUNITY_LIST_STANDARD ?
   10891           0 :                  entry->u.ecom->str : entry->config,
   10892           0 :                  VTY_NEWLINE);
   10893             :     }
   10894           0 : }
   10895             : 
   10896           0 : DEFUN (show_ip_extcommunity_list,
   10897             :        show_ip_extcommunity_list_cmd,
   10898             :        "show ip extcommunity-list",
   10899             :        SHOW_STR
   10900             :        IP_STR
   10901             :        "List extended-community list\n")
   10902             : {
   10903             :   struct community_list *list;
   10904             :   struct community_list_master *cm;
   10905             : 
   10906           0 :   cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
   10907           0 :   if (! cm)
   10908           0 :     return CMD_SUCCESS;
   10909             : 
   10910           0 :   for (list = cm->num.head; list; list = list->next)
   10911           0 :     extcommunity_list_show (vty, list);
   10912             : 
   10913           0 :   for (list = cm->str.head; list; list = list->next)
   10914           0 :     extcommunity_list_show (vty, list);
   10915             : 
   10916           0 :   return CMD_SUCCESS;
   10917             : }
   10918             : 
   10919           0 : DEFUN (show_ip_extcommunity_list_arg,
   10920             :        show_ip_extcommunity_list_arg_cmd,
   10921             :        "show ip extcommunity-list (<1-500>|WORD)",
   10922             :        SHOW_STR
   10923             :        IP_STR
   10924             :        "List extended-community list\n"
   10925             :        "Extcommunity-list number\n"
   10926             :        "Extcommunity-list name\n")
   10927             : {
   10928             :   struct community_list *list;
   10929             : 
   10930           0 :   list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
   10931           0 :   if (! list)
   10932             :     {
   10933           0 :       vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
   10934           0 :       return CMD_WARNING;
   10935             :     }
   10936             : 
   10937           0 :   extcommunity_list_show (vty, list);
   10938             : 
   10939           0 :   return CMD_SUCCESS;
   10940             : }
   10941             : 
   10942             : /* Return configuration string of community-list entry.  */
   10943             : static const char *
   10944           0 : community_list_config_str (struct community_entry *entry)
   10945             : {
   10946             :   const char *str;
   10947             : 
   10948           0 :   if (entry->any)
   10949           0 :     str = "";
   10950             :   else
   10951             :     {
   10952           0 :       if (entry->style == COMMUNITY_LIST_STANDARD)
   10953           0 :         str = community_str (entry->u.com);
   10954             :       else
   10955           0 :         str = entry->config;
   10956             :     }
   10957           0 :   return str;
   10958             : }
   10959             : 
   10960             : /* Display community-list and extcommunity-list configuration.  */
   10961             : static int
   10962           0 : community_list_config_write (struct vty *vty)
   10963             : {
   10964             :   struct community_list *list;
   10965             :   struct community_entry *entry;
   10966             :   struct community_list_master *cm;
   10967           0 :   int write = 0;
   10968             : 
   10969             :   /* Community-list.  */
   10970           0 :   cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
   10971             : 
   10972           0 :   for (list = cm->num.head; list; list = list->next)
   10973           0 :     for (entry = list->head; entry; entry = entry->next)
   10974             :       {
   10975           0 :         vty_out (vty, "ip community-list %s %s %s%s",
   10976           0 :                  list->name, community_direct_str (entry->direct),
   10977             :                  community_list_config_str (entry),
   10978           0 :                  VTY_NEWLINE);
   10979           0 :         write++;
   10980             :       }
   10981           0 :   for (list = cm->str.head; list; list = list->next)
   10982           0 :     for (entry = list->head; entry; entry = entry->next)
   10983             :       {
   10984           0 :         vty_out (vty, "ip community-list %s %s %s %s%s",
   10985           0 :                  entry->style == COMMUNITY_LIST_STANDARD
   10986             :                  ? "standard" : "expanded",
   10987           0 :                  list->name, community_direct_str (entry->direct),
   10988             :                  community_list_config_str (entry),
   10989           0 :                  VTY_NEWLINE);
   10990           0 :         write++;
   10991             :       }
   10992             : 
   10993             :   /* Extcommunity-list.  */
   10994           0 :   cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
   10995             : 
   10996           0 :   for (list = cm->num.head; list; list = list->next)
   10997           0 :     for (entry = list->head; entry; entry = entry->next)
   10998             :       {
   10999           0 :         vty_out (vty, "ip extcommunity-list %s %s %s%s",
   11000           0 :                  list->name, community_direct_str (entry->direct),
   11001           0 :                  community_list_config_str (entry), VTY_NEWLINE);
   11002           0 :         write++;
   11003             :       }
   11004           0 :   for (list = cm->str.head; list; list = list->next)
   11005           0 :     for (entry = list->head; entry; entry = entry->next)
   11006             :       {
   11007           0 :         vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
   11008           0 :                  entry->style == EXTCOMMUNITY_LIST_STANDARD
   11009             :                  ? "standard" : "expanded",
   11010           0 :                  list->name, community_direct_str (entry->direct),
   11011           0 :                  community_list_config_str (entry), VTY_NEWLINE);
   11012           0 :         write++;
   11013             :       }
   11014           0 :   return write;
   11015             : }
   11016             : 
   11017             : static struct cmd_node community_list_node =
   11018             : {
   11019             :   COMMUNITY_LIST_NODE,
   11020             :   "",
   11021             :   1                             /* Export to vtysh.  */
   11022             : };
   11023             : 
   11024             : static void
   11025           0 : community_list_vty (void)
   11026             : {
   11027           0 :   install_node (&community_list_node, community_list_config_write);
   11028             : 
   11029             :   /* Community-list.  */
   11030           0 :   install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
   11031           0 :   install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
   11032           0 :   install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
   11033           0 :   install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
   11034           0 :   install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
   11035           0 :   install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
   11036           0 :   install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
   11037           0 :   install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
   11038           0 :   install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
   11039           0 :   install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
   11040           0 :   install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
   11041           0 :   install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
   11042           0 :   install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
   11043           0 :   install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
   11044           0 :   install_element (VIEW_NODE, &show_ip_community_list_cmd);
   11045           0 :   install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
   11046           0 :   install_element (ENABLE_NODE, &show_ip_community_list_cmd);
   11047           0 :   install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
   11048             : 
   11049             :   /* Extcommunity-list.  */
   11050           0 :   install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
   11051           0 :   install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
   11052           0 :   install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
   11053           0 :   install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
   11054           0 :   install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
   11055           0 :   install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
   11056           0 :   install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
   11057           0 :   install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
   11058           0 :   install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
   11059           0 :   install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
   11060           0 :   install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
   11061           0 :   install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
   11062           0 :   install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
   11063           0 :   install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
   11064           0 :   install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
   11065           0 :   install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
   11066           0 :   install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
   11067           0 :   install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
   11068           0 : }

Generated by: LCOV version 1.10