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

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

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