Annotation of embedaddon/quagga/bgpd/bgp_vty.c, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>