]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_vty.c
*: split & distribute memtypes and stop (re|ab)using lib/ MTYPEs
[mirror_frr.git] / bgpd / bgp_vty.c
CommitLineData
718e3744 1/* BGP VTY interface.
2 Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro
3
4This file is part of GNU Zebra.
5
6GNU Zebra is free software; you can redistribute it and/or modify it
7under the terms of the GNU General Public License as published by the
8Free Software Foundation; either version 2, or (at your option) any
9later version.
10
11GNU Zebra is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Zebra; see the file COPYING. If not, write to the Free
18Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1902111-1307, USA. */
20
21#include <zebra.h>
22
856ca177 23#include "lib/json.h"
718e3744 24#include "command.h"
25#include "prefix.h"
26#include "plist.h"
27#include "buffer.h"
28#include "linklist.h"
29#include "stream.h"
30#include "thread.h"
31#include "log.h"
3b8b1855 32#include "memory.h"
fc7948fa 33#include "memory_vty.h"
4bf6a362 34#include "hash.h"
3f9c7369 35#include "queue.h"
039f3a34 36#include "filter.h"
718e3744 37
38#include "bgpd/bgpd.h"
4bf6a362 39#include "bgpd/bgp_advertise.h"
718e3744 40#include "bgpd/bgp_attr.h"
41#include "bgpd/bgp_aspath.h"
42#include "bgpd/bgp_community.h"
4bf6a362
PJ
43#include "bgpd/bgp_ecommunity.h"
44#include "bgpd/bgp_damp.h"
718e3744 45#include "bgpd/bgp_debug.h"
e0701b79 46#include "bgpd/bgp_fsm.h"
718e3744 47#include "bgpd/bgp_mplsvpn.h"
4bf6a362 48#include "bgpd/bgp_nexthop.h"
718e3744 49#include "bgpd/bgp_open.h"
4bf6a362 50#include "bgpd/bgp_regex.h"
718e3744 51#include "bgpd/bgp_route.h"
52#include "bgpd/bgp_zebra.h"
fee0f4c6 53#include "bgpd/bgp_table.h"
94f2b392 54#include "bgpd/bgp_vty.h"
165b5fff 55#include "bgpd/bgp_mpath.h"
cb1faec9 56#include "bgpd/bgp_packet.h"
3f9c7369 57#include "bgpd/bgp_updgrp.h"
c43ed2e4 58#include "bgpd/bgp_bfd.h"
718e3744 59
20eb8864 60static struct peer_group *
61listen_range_exists (struct bgp *bgp, struct prefix *range, int exact);
62
718e3744 63/* Utility function to get address family from current node. */
64afi_t
65bgp_node_afi (struct vty *vty)
66{
4e851f1f
LB
67 afi_t afi;
68 switch (vty->node)
69 {
70 case BGP_IPV6_NODE:
71 case BGP_IPV6M_NODE:
72 case BGP_VPNV6_NODE:
73 case BGP_ENCAPV6_NODE:
74 afi = AFI_IP6;
75 break;
76 default:
77 afi = AFI_IP;
78 break;
79 }
80 return afi;
718e3744 81}
82
83/* Utility function to get subsequent address family from current
84 node. */
85safi_t
86bgp_node_safi (struct vty *vty)
87{
4e851f1f
LB
88 safi_t safi;
89 switch (vty->node)
90 {
91 case BGP_ENCAP_NODE:
92 case BGP_ENCAPV6_NODE:
93 safi = SAFI_ENCAP;
94 break;
95 case BGP_VPNV4_NODE:
96 case BGP_VPNV6_NODE:
97 safi = SAFI_MPLS_VPN;
98 break;
99 case BGP_IPV4M_NODE:
100 case BGP_IPV6M_NODE:
101 safi = SAFI_MULTICAST;
102 break;
103 default:
104 safi = SAFI_UNICAST;
105 break;
106 }
107 return safi;
718e3744 108}
109
8b1fb8be
LB
110int
111bgp_parse_afi(const char *str, afi_t *afi)
112{
113 if (!strcmp(str, "ipv4")) {
114 *afi = AFI_IP;
115 return 0;
116 }
117#ifdef HAVE_IPV6
118 if (!strcmp(str, "ipv6")) {
119 *afi = AFI_IP6;
120 return 0;
121 }
122#endif /* HAVE_IPV6 */
123 return -1;
124}
125
126int
127bgp_parse_safi(const char *str, safi_t *safi)
128{
129 if (!strcmp(str, "encap")) {
130 *safi = SAFI_ENCAP;
131 return 0;
132 }
133 if (!strcmp(str, "multicast")) {
134 *safi = SAFI_MULTICAST;
135 return 0;
136 }
137 if (!strcmp(str, "unicast")) {
138 *safi = SAFI_UNICAST;
139 return 0;
140 }
141 if (!strcmp(str, "vpn")) {
142 *safi = SAFI_MPLS_VPN;
143 return 0;
144 }
145 return -1;
146}
147
94f2b392 148static int
6aeb9e78 149peer_address_self_check (struct bgp *bgp, union sockunion *su)
718e3744 150{
151 struct interface *ifp = NULL;
152
153 if (su->sa.sa_family == AF_INET)
6aeb9e78 154 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr, bgp->vrf_id);
718e3744 155#ifdef HAVE_IPV6
156 else if (su->sa.sa_family == AF_INET6)
f2345335 157 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr,
6aeb9e78 158 su->sin6.sin6_scope_id, bgp->vrf_id);
718e3744 159#endif /* HAVE IPV6 */
160
161 if (ifp)
162 return 1;
163
164 return 0;
165}
166
167/* Utility function for looking up peer from VTY. */
f14e6fdb
DS
168/* This is used only for configuration, so disallow if attempted on
169 * a dynamic neighbor.
170 */
94f2b392 171static struct peer *
fd79ac91 172peer_lookup_vty (struct vty *vty, const char *ip_str)
718e3744 173{
174 int ret;
175 struct bgp *bgp;
176 union sockunion su;
177 struct peer *peer;
178
179 bgp = vty->index;
180
181 ret = str2sockunion (ip_str, &su);
182 if (ret < 0)
183 {
a80beece
DS
184 peer = peer_lookup_by_conf_if (bgp, ip_str);
185 if (!peer)
186 {
04b6bdc0
DW
187 if ((peer = peer_lookup_by_hostname(bgp, ip_str)) == NULL)
188 {
189 vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE);
190 return NULL;
191 }
a80beece 192 }
718e3744 193 }
a80beece 194 else
718e3744 195 {
a80beece
DS
196 peer = peer_lookup (bgp, &su);
197 if (! peer)
198 {
199 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
200 VTY_NEWLINE);
201 return NULL;
202 }
f14e6fdb
DS
203 if (peer_dynamic_neighbor (peer))
204 {
205 vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
206 VTY_NEWLINE);
207 return NULL;
208 }
209
718e3744 210 }
211 return peer;
212}
213
214/* Utility function for looking up peer or peer group. */
f14e6fdb
DS
215/* This is used only for configuration, so disallow if attempted on
216 * a dynamic neighbor.
217 */
c43ed2e4 218struct peer *
fd79ac91 219peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
718e3744 220{
221 int ret;
222 struct bgp *bgp;
223 union sockunion su;
f14e6fdb
DS
224 struct peer *peer = NULL;
225 struct peer_group *group = NULL;
718e3744 226
227 bgp = vty->index;
228
229 ret = str2sockunion (peer_str, &su);
230 if (ret == 0)
231 {
f14e6fdb 232 /* IP address, locate peer. */
718e3744 233 peer = peer_lookup (bgp, &su);
718e3744 234 }
235 else
236 {
f14e6fdb 237 /* Not IP, could match either peer configured on interface or a group. */
a80beece 238 peer = peer_lookup_by_conf_if (bgp, peer_str);
f14e6fdb
DS
239 if (!peer)
240 group = peer_group_lookup (bgp, peer_str);
241 }
a80beece 242
f14e6fdb
DS
243 if (peer)
244 {
245 if (peer_dynamic_neighbor (peer))
246 {
247 vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
248 VTY_NEWLINE);
249 return NULL;
250 }
251
252 return peer;
718e3744 253 }
254
f14e6fdb
DS
255 if (group)
256 return group->conf;
257
718e3744 258 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
259 VTY_NEWLINE);
260
261 return NULL;
262}
263
c43ed2e4 264int
718e3744 265bgp_vty_return (struct vty *vty, int ret)
266{
fd79ac91 267 const char *str = NULL;
718e3744 268
269 switch (ret)
270 {
271 case BGP_ERR_INVALID_VALUE:
272 str = "Invalid value";
273 break;
274 case BGP_ERR_INVALID_FLAG:
275 str = "Invalid flag";
276 break;
718e3744 277 case BGP_ERR_PEER_GROUP_SHUTDOWN:
278 str = "Peer-group has been shutdown. Activate the peer-group first";
279 break;
718e3744 280 case BGP_ERR_PEER_FLAG_CONFLICT:
281 str = "Can't set override-capability and strict-capability-match at the same time";
282 break;
718e3744 283 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
284 str = "Specify remote-as or peer-group remote AS first";
285 break;
286 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
287 str = "Cannot change the peer-group. Deconfigure first";
288 break;
289 case BGP_ERR_PEER_GROUP_MISMATCH:
4c48cf63 290 str = "Peer is not a member of this peer-group";
718e3744 291 break;
292 case BGP_ERR_PEER_FILTER_CONFLICT:
293 str = "Prefix/distribute list can not co-exist";
294 break;
295 case BGP_ERR_NOT_INTERNAL_PEER:
296 str = "Invalid command. Not an internal neighbor";
297 break;
298 case BGP_ERR_REMOVE_PRIVATE_AS:
5000f21c 299 str = "remove-private-AS cannot be configured for IBGP peers";
718e3744 300 break;
301 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
302 str = "Local-AS allowed only for EBGP peers";
303 break;
304 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
305 str = "Cannot have local-as same as BGP AS number";
306 break;
0df7c91f
PJ
307 case BGP_ERR_TCPSIG_FAILED:
308 str = "Error while applying TCP-Sig to session(s)";
309 break;
fa411a21
NH
310 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
311 str = "ebgp-multihop and ttl-security cannot be configured together";
312 break;
f5a4827d
SH
313 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
314 str = "ttl-security only allowed for EBGP peers";
315 break;
c7122e14
DS
316 case BGP_ERR_AS_OVERRIDE:
317 str = "as-override cannot be configured for IBGP peers";
318 break;
f14e6fdb
DS
319 case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT:
320 str = "Invalid limit for number of dynamic neighbors";
321 break;
322 case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS:
323 str = "Dynamic neighbor listen range already exists";
324 break;
325 case BGP_ERR_INVALID_FOR_DYNAMIC_PEER:
326 str = "Operation not allowed on a dynamic neighbor";
327 break;
63fa10b5
QY
328 case BGP_ERR_INVALID_FOR_DIRECT_PEER:
329 str = "Operation not allowed on a directly connected neighbor";
330 break;
718e3744 331 }
332 if (str)
333 {
334 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
335 return CMD_WARNING;
336 }
337 return CMD_SUCCESS;
338}
339
7aafcaca
DS
340/* BGP clear sort. */
341enum clear_sort
342{
343 clear_all,
344 clear_peer,
345 clear_group,
346 clear_external,
347 clear_as
348};
349
7aafcaca
DS
350static void
351bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
352 safi_t safi, int error)
353{
354 switch (error)
355 {
356 case BGP_ERR_AF_UNCONFIGURED:
357 vty_out (vty,
358 "%%BGP: Enable %s %s address family for the neighbor %s%s",
359 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
360 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
361 peer->host, VTY_NEWLINE);
362 break;
363 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
364 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);
365 break;
366 default:
367 break;
368 }
369}
370
371/* `clear ip bgp' functions. */
372static int
373bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
374 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
375{
376 int ret;
377 struct peer *peer;
378 struct listnode *node, *nnode;
379
380 /* Clear all neighbors. */
381 /*
382 * Pass along pointer to next node to peer_clear() when walking all nodes
383 * on the BGP instance as that may get freed if it is a doppelganger
384 */
385 if (sort == clear_all)
386 {
387 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
388 {
389 if (stype == BGP_CLEAR_SOFT_NONE)
390 ret = peer_clear (peer, &nnode);
391 else if (peer->afc[afi][safi])
392 ret = peer_clear_soft (peer, afi, safi, stype);
393 else
394 ret = 0;
395
396 if (ret < 0)
397 bgp_clear_vty_error (vty, peer, afi, safi, ret);
398 }
399
400 /* This is to apply read-only mode on this clear. */
401 if (stype == BGP_CLEAR_SOFT_NONE)
402 bgp->update_delay_over = 0;
403
404 return CMD_SUCCESS;
405 }
406
407 /* Clear specified neighbors. */
408 if (sort == clear_peer)
409 {
410 union sockunion su;
411 int ret;
412
413 /* Make sockunion for lookup. */
414 ret = str2sockunion (arg, &su);
415 if (ret < 0)
416 {
417 peer = peer_lookup_by_conf_if (bgp, arg);
418 if (!peer)
419 {
04b6bdc0
DW
420 peer = peer_lookup_by_hostname(bgp, arg);
421 if (!peer)
422 {
423 vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE);
424 return CMD_WARNING;
425 }
7aafcaca
DS
426 }
427 }
428 else
429 {
430 peer = peer_lookup (bgp, &su);
431 if (! peer)
432 {
433 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
434 return CMD_WARNING;
435 }
436 }
437
438 if (stype == BGP_CLEAR_SOFT_NONE)
439 ret = peer_clear (peer, NULL);
440 else
441 ret = peer_clear_soft (peer, afi, safi, stype);
442
443 if (ret < 0)
444 bgp_clear_vty_error (vty, peer, afi, safi, ret);
445
446 return CMD_SUCCESS;
447 }
448
449 /* Clear all peer-group members. */
450 if (sort == clear_group)
451 {
452 struct peer_group *group;
453
454 group = peer_group_lookup (bgp, arg);
455 if (! group)
456 {
457 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
458 return CMD_WARNING;
459 }
460
461 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
462 {
463 if (stype == BGP_CLEAR_SOFT_NONE)
464 {
18f1dc06 465 peer_clear (peer, NULL);
7aafcaca
DS
466 continue;
467 }
468
c8560b44 469 if (! peer->afc[afi][safi])
7aafcaca
DS
470 continue;
471
472 ret = peer_clear_soft (peer, afi, safi, stype);
473
474 if (ret < 0)
475 bgp_clear_vty_error (vty, peer, afi, safi, ret);
476 }
477 return CMD_SUCCESS;
478 }
479
480 if (sort == clear_external)
481 {
482 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
483 {
484 if (peer->sort == BGP_PEER_IBGP)
485 continue;
486
487 if (stype == BGP_CLEAR_SOFT_NONE)
488 ret = peer_clear (peer, &nnode);
489 else
490 ret = peer_clear_soft (peer, afi, safi, stype);
491
492 if (ret < 0)
493 bgp_clear_vty_error (vty, peer, afi, safi, ret);
494 }
495 return CMD_SUCCESS;
496 }
497
498 if (sort == clear_as)
499 {
500 as_t as;
501 int find = 0;
502
503 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
504
505 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
506 {
507 if (peer->as != as)
508 continue;
509
510 find = 1;
511 if (stype == BGP_CLEAR_SOFT_NONE)
512 ret = peer_clear (peer, &nnode);
513 else
514 ret = peer_clear_soft (peer, afi, safi, stype);
515
516 if (ret < 0)
517 bgp_clear_vty_error (vty, peer, afi, safi, ret);
518 }
519 if (! find)
520 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
521 VTY_NEWLINE);
522 return CMD_SUCCESS;
523 }
524
525 return CMD_SUCCESS;
526}
527
528static int
529bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
530 enum clear_sort sort, enum bgp_clear_type stype,
531 const char *arg)
532{
533 struct bgp *bgp;
534
535 /* BGP structure lookup. */
536 if (name)
537 {
538 bgp = bgp_lookup_by_name (name);
539 if (bgp == NULL)
540 {
6aeb9e78 541 vty_out (vty, "Can't find BGP instance %s%s", name, VTY_NEWLINE);
7aafcaca
DS
542 return CMD_WARNING;
543 }
544 }
545 else
546 {
f31fa004 547 bgp = bgp_get_default ();
7aafcaca
DS
548 if (bgp == NULL)
549 {
550 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
551 return CMD_WARNING;
552 }
553 }
554
555 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
556}
557
558/* clear soft inbound */
559static void
f31fa004 560bgp_clear_star_soft_in (struct vty *vty, const char *name)
7aafcaca 561{
f31fa004 562 bgp_clear_vty (vty,name, AFI_IP, SAFI_UNICAST, clear_all,
7aafcaca 563 BGP_CLEAR_SOFT_IN, NULL);
f31fa004 564 bgp_clear_vty (vty, name, AFI_IP6, SAFI_UNICAST, clear_all,
7aafcaca 565 BGP_CLEAR_SOFT_IN, NULL);
7aafcaca
DS
566}
567
568/* clear soft outbound */
569static void
f31fa004 570bgp_clear_star_soft_out (struct vty *vty, const char *name)
7aafcaca 571{
f31fa004 572 bgp_clear_vty (vty, name, AFI_IP, SAFI_UNICAST, clear_all,
7aafcaca 573 BGP_CLEAR_SOFT_OUT, NULL);
f31fa004 574 bgp_clear_vty (vty, name, AFI_IP6, SAFI_UNICAST, clear_all,
7aafcaca 575 BGP_CLEAR_SOFT_OUT, NULL);
7aafcaca
DS
576}
577
578
718e3744 579/* BGP global configuration. */
580
581DEFUN (bgp_multiple_instance_func,
582 bgp_multiple_instance_cmd,
583 "bgp multiple-instance",
584 BGP_STR
585 "Enable bgp multiple instance\n")
586{
587 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
588 return CMD_SUCCESS;
589}
590
591DEFUN (no_bgp_multiple_instance,
592 no_bgp_multiple_instance_cmd,
593 "no bgp multiple-instance",
594 NO_STR
595 BGP_STR
596 "BGP multiple instance\n")
597{
598 int ret;
599
600 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
601 if (ret < 0)
602 {
603 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
604 return CMD_WARNING;
605 }
606 return CMD_SUCCESS;
607}
608
609DEFUN (bgp_config_type,
610 bgp_config_type_cmd,
611 "bgp config-type (cisco|zebra)",
612 BGP_STR
613 "Configuration type\n"
614 "cisco\n"
615 "zebra\n")
616{
617 if (strncmp (argv[0], "c", 1) == 0)
618 bgp_option_set (BGP_OPT_CONFIG_CISCO);
619 else
620 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
621
622 return CMD_SUCCESS;
623}
624
625DEFUN (no_bgp_config_type,
626 no_bgp_config_type_cmd,
627 "no bgp config-type",
628 NO_STR
629 BGP_STR
630 "Display configuration type\n")
631{
632 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
633 return CMD_SUCCESS;
634}
635
813d4307
DW
636ALIAS (no_bgp_config_type,
637 no_bgp_config_type_val_cmd,
638 "no bgp config-type (cisco|zebra)",
639 NO_STR
640 BGP_STR
641 "Configuration type\n"
642 "cisco\n"
643 "zebra\n")
644
718e3744 645DEFUN (no_synchronization,
646 no_synchronization_cmd,
647 "no synchronization",
648 NO_STR
649 "Perform IGP synchronization\n")
650{
651 return CMD_SUCCESS;
652}
653
654DEFUN (no_auto_summary,
655 no_auto_summary_cmd,
656 "no auto-summary",
657 NO_STR
658 "Enable automatic network number summarization\n")
659{
660 return CMD_SUCCESS;
661}
3d515fd9 662
718e3744 663/* "router bgp" commands. */
664DEFUN (router_bgp,
665 router_bgp_cmd,
320da874 666 "router bgp " CMD_AS_RANGE,
718e3744 667 ROUTER_STR
668 BGP_STR
669 AS_STR)
670{
671 int ret;
672 as_t as;
673 struct bgp *bgp;
fd79ac91 674 const char *name = NULL;
ad4cbda1 675 enum bgp_instance_type inst_type;
718e3744 676
2385a876
DW
677 // "router bgp" without an ASN
678 if (argc < 1)
679 {
6aeb9e78 680 //Pending: Make VRF option available for ASN less config
2385a876 681 bgp = bgp_get_default();
718e3744 682
2385a876
DW
683 if (bgp == NULL)
684 {
685 vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE);
686 return CMD_WARNING;
687 }
718e3744 688
2385a876
DW
689 if (listcount(bm->bgp) > 1)
690 {
691 vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE);
692 return CMD_WARNING;
693 }
694 }
695
696 // "router bgp X"
697 else
718e3744 698 {
2385a876
DW
699 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
700
ad4cbda1 701 inst_type = BGP_INSTANCE_TYPE_DEFAULT;
6aeb9e78 702 if (argc == 3)
ad4cbda1 703 {
704 name = argv[2];
705 if (!strcmp(argv[1], "vrf"))
706 inst_type = BGP_INSTANCE_TYPE_VRF;
707 else if (!strcmp(argv[1], "view"))
708 inst_type = BGP_INSTANCE_TYPE_VIEW;
709 }
2385a876 710
ad4cbda1 711 ret = bgp_get (&bgp, &as, name, inst_type);
2385a876
DW
712 switch (ret)
713 {
714 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
715 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
716 VTY_NEWLINE);
717 return CMD_WARNING;
718 case BGP_ERR_AS_MISMATCH:
719 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
720 return CMD_WARNING;
721 case BGP_ERR_INSTANCE_MISMATCH:
6aeb9e78 722 vty_out (vty, "BGP instance name and AS number mismatch%s", VTY_NEWLINE);
2385a876
DW
723 vty_out (vty, "BGP instance is already running; AS is %u%s",
724 as, VTY_NEWLINE);
725 return CMD_WARNING;
726 }
6aeb9e78
DS
727
728 /* Pending: handle when user tries to change a view to vrf n vv. */
718e3744 729 }
730
731 vty->node = BGP_NODE;
732 vty->index = bgp;
733
734 return CMD_SUCCESS;
735}
736
737ALIAS (router_bgp,
6aeb9e78
DS
738 router_bgp_instance_cmd,
739 "router bgp " CMD_AS_RANGE " (view|vrf) WORD",
718e3744 740 ROUTER_STR
741 BGP_STR
742 AS_STR
6aeb9e78 743 "BGP view\nBGP VRF\n"
8386ac43 744 "View/VRF name\n")
6b0655a2 745
2385a876
DW
746ALIAS (router_bgp,
747 router_bgp_noasn_cmd,
748 "router bgp",
749 ROUTER_STR
750 BGP_STR)
751
718e3744 752/* "no router bgp" commands. */
753DEFUN (no_router_bgp,
754 no_router_bgp_cmd,
320da874 755 "no router bgp " CMD_AS_RANGE,
718e3744 756 NO_STR
757 ROUTER_STR
758 BGP_STR
759 AS_STR)
760{
761 as_t as;
762 struct bgp *bgp;
fd79ac91 763 const char *name = NULL;
718e3744 764
718e3744 765
7fb21a9f
QY
766 // "no router bgp" without an ASN
767 if (argc < 1)
768 {
769 //Pending: Make VRF option available for ASN less config
770 bgp = bgp_get_default();
718e3744 771
7fb21a9f
QY
772 if (bgp == NULL)
773 {
774 vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE);
775 return CMD_WARNING;
776 }
777
778 if (listcount(bm->bgp) > 1)
779 {
780 vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE);
781 return CMD_WARNING;
782 }
783 }
784 else
718e3744 785 {
7fb21a9f
QY
786 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
787
788 if (argc == 3)
789 name = argv[2];
790
791 /* Lookup bgp structure. */
792 bgp = bgp_lookup (as, name);
793 if (! bgp)
794 {
795 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
796 return CMD_WARNING;
797 }
718e3744 798 }
799
800 bgp_delete (bgp);
801
802 return CMD_SUCCESS;
803}
804
805ALIAS (no_router_bgp,
6aeb9e78
DS
806 no_router_bgp_instance_cmd,
807 "no router bgp " CMD_AS_RANGE " (view|vrf) WORD",
718e3744 808 NO_STR
809 ROUTER_STR
810 BGP_STR
811 AS_STR
6aeb9e78 812 "BGP view\nBGP VRF\n"
8386ac43 813 "View/VRF name\n")
6b0655a2 814
7fb21a9f
QY
815ALIAS (no_router_bgp,
816 no_router_bgp_noasn_cmd,
817 "no router bgp",
818 NO_STR
819 ROUTER_STR
820 BGP_STR)
821
718e3744 822/* BGP router-id. */
823
824DEFUN (bgp_router_id,
825 bgp_router_id_cmd,
826 "bgp router-id A.B.C.D",
827 BGP_STR
828 "Override configured router identifier\n"
829 "Manually configured router identifier\n")
830{
831 int ret;
832 struct in_addr id;
833 struct bgp *bgp;
834
835 bgp = vty->index;
836
837 ret = inet_aton (argv[0], &id);
838 if (! ret)
839 {
840 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
841 return CMD_WARNING;
842 }
843
0e6cb743 844 bgp_router_id_static_set (bgp, id);
718e3744 845
846 return CMD_SUCCESS;
847}
848
849DEFUN (no_bgp_router_id,
850 no_bgp_router_id_cmd,
851 "no bgp router-id",
852 NO_STR
853 BGP_STR
854 "Override configured router identifier\n")
855{
856 int ret;
857 struct in_addr id;
858 struct bgp *bgp;
859
860 bgp = vty->index;
861
862 if (argc == 1)
863 {
864 ret = inet_aton (argv[0], &id);
865 if (! ret)
e018c7cc
SK
866 {
867 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
868 return CMD_WARNING;
869 }
718e3744 870
18a6dce6 871 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
e018c7cc
SK
872 {
873 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
874 return CMD_WARNING;
875 }
718e3744 876 }
877
0e6cb743
DL
878 id.s_addr = 0;
879 bgp_router_id_static_set (bgp, id);
718e3744 880
881 return CMD_SUCCESS;
882}
883
884ALIAS (no_bgp_router_id,
885 no_bgp_router_id_val_cmd,
886 "no bgp router-id A.B.C.D",
887 NO_STR
888 BGP_STR
889 "Override configured router identifier\n"
890 "Manually configured router identifier\n")
6b0655a2 891
718e3744 892/* BGP Cluster ID. */
893
894DEFUN (bgp_cluster_id,
895 bgp_cluster_id_cmd,
896 "bgp cluster-id A.B.C.D",
897 BGP_STR
898 "Configure Route-Reflector Cluster-id\n"
899 "Route-Reflector Cluster-id in IP address format\n")
900{
901 int ret;
902 struct bgp *bgp;
903 struct in_addr cluster;
904
905 bgp = vty->index;
906
907 ret = inet_aton (argv[0], &cluster);
908 if (! ret)
909 {
910 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
911 return CMD_WARNING;
912 }
913
914 bgp_cluster_id_set (bgp, &cluster);
f31fa004 915 bgp_clear_star_soft_out (vty, bgp->name);
718e3744 916
917 return CMD_SUCCESS;
918}
919
920ALIAS (bgp_cluster_id,
921 bgp_cluster_id32_cmd,
922 "bgp cluster-id <1-4294967295>",
923 BGP_STR
924 "Configure Route-Reflector Cluster-id\n"
925 "Route-Reflector Cluster-id as 32 bit quantity\n")
926
927DEFUN (no_bgp_cluster_id,
928 no_bgp_cluster_id_cmd,
929 "no bgp cluster-id",
930 NO_STR
931 BGP_STR
932 "Configure Route-Reflector Cluster-id\n")
933{
934 int ret;
935 struct bgp *bgp;
936 struct in_addr cluster;
937
938 bgp = vty->index;
939
940 if (argc == 1)
941 {
942 ret = inet_aton (argv[0], &cluster);
943 if (! ret)
944 {
945 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
946 return CMD_WARNING;
947 }
948 }
949
950 bgp_cluster_id_unset (bgp);
f31fa004 951 bgp_clear_star_soft_out (vty, bgp->name);
718e3744 952
953 return CMD_SUCCESS;
954}
955
956ALIAS (no_bgp_cluster_id,
813d4307 957 no_bgp_cluster_id_ip_cmd,
718e3744 958 "no bgp cluster-id A.B.C.D",
959 NO_STR
960 BGP_STR
961 "Configure Route-Reflector Cluster-id\n"
962 "Route-Reflector Cluster-id in IP address format\n")
6b0655a2 963
813d4307
DW
964ALIAS (no_bgp_cluster_id,
965 no_bgp_cluster_id_decimal_cmd,
966 "no bgp cluster-id <1-4294967295>",
967 NO_STR
968 BGP_STR
969 "Configure Route-Reflector Cluster-id\n"
970 "Route-Reflector Cluster-id as 32 bit quantity\n")
971
718e3744 972DEFUN (bgp_confederation_identifier,
973 bgp_confederation_identifier_cmd,
320da874 974 "bgp confederation identifier " CMD_AS_RANGE,
718e3744 975 "BGP specific commands\n"
976 "AS confederation parameters\n"
977 "AS number\n"
978 "Set routing domain confederation AS\n")
979{
980 struct bgp *bgp;
981 as_t as;
982
983 bgp = vty->index;
984
0b2aa3a0 985 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
718e3744 986
987 bgp_confederation_id_set (bgp, as);
988
989 return CMD_SUCCESS;
990}
991
992DEFUN (no_bgp_confederation_identifier,
993 no_bgp_confederation_identifier_cmd,
994 "no bgp confederation identifier",
995 NO_STR
996 "BGP specific commands\n"
997 "AS confederation parameters\n"
998 "AS number\n")
999{
1000 struct bgp *bgp;
718e3744 1001
1002 bgp = vty->index;
1003
718e3744 1004 bgp_confederation_id_unset (bgp);
1005
1006 return CMD_SUCCESS;
1007}
1008
1009ALIAS (no_bgp_confederation_identifier,
1010 no_bgp_confederation_identifier_arg_cmd,
320da874 1011 "no bgp confederation identifier " CMD_AS_RANGE,
718e3744 1012 NO_STR
1013 "BGP specific commands\n"
1014 "AS confederation parameters\n"
1015 "AS number\n"
1016 "Set routing domain confederation AS\n")
6b0655a2 1017
718e3744 1018DEFUN (bgp_confederation_peers,
1019 bgp_confederation_peers_cmd,
320da874 1020 "bgp confederation peers ." CMD_AS_RANGE,
718e3744 1021 "BGP specific commands\n"
1022 "AS confederation parameters\n"
1023 "Peer ASs in BGP confederation\n"
1024 AS_STR)
1025{
1026 struct bgp *bgp;
1027 as_t as;
1028 int i;
1029
1030 bgp = vty->index;
1031
1032 for (i = 0; i < argc; i++)
1033 {
0b2aa3a0 1034 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
718e3744 1035
1036 if (bgp->as == as)
1037 {
1038 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
1039 VTY_NEWLINE);
1040 continue;
1041 }
1042
1043 bgp_confederation_peers_add (bgp, as);
1044 }
1045 return CMD_SUCCESS;
1046}
1047
1048DEFUN (no_bgp_confederation_peers,
1049 no_bgp_confederation_peers_cmd,
320da874 1050 "no bgp confederation peers ." CMD_AS_RANGE,
718e3744 1051 NO_STR
1052 "BGP specific commands\n"
1053 "AS confederation parameters\n"
1054 "Peer ASs in BGP confederation\n"
1055 AS_STR)
1056{
1057 struct bgp *bgp;
1058 as_t as;
1059 int i;
1060
1061 bgp = vty->index;
1062
1063 for (i = 0; i < argc; i++)
1064 {
0b2aa3a0
PJ
1065 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
1066
718e3744 1067 bgp_confederation_peers_remove (bgp, as);
1068 }
1069 return CMD_SUCCESS;
1070}
6b0655a2 1071
5e242b0d
DS
1072/**
1073 * Central routine for maximum-paths configuration.
1074 * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP
1075 * @set: 1 for setting values, 0 for removing the max-paths config.
1076 */
ffd0c037
DS
1077static int
1078bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths,
5e242b0d 1079 u_int16_t options, int set)
165b5fff
JB
1080{
1081 struct bgp *bgp;
ffd0c037 1082 u_int16_t maxpaths = 0;
165b5fff 1083 int ret;
5e242b0d
DS
1084 afi_t afi;
1085 safi_t safi;
165b5fff
JB
1086
1087 bgp = vty->index;
5e242b0d
DS
1088 afi = bgp_node_afi (vty);
1089 safi = bgp_node_safi (vty);
165b5fff 1090
5e242b0d
DS
1091 if (set)
1092 {
73ac8160 1093 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1,
5b964da3 1094 MULTIPATH_NUM);
5e242b0d
DS
1095 ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths,
1096 options);
1097 }
1098 else
1099 ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type);
165b5fff 1100
165b5fff
JB
1101 if (ret < 0)
1102 {
1103 vty_out (vty,
5e242b0d
DS
1104 "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s",
1105 (set == 1) ? "" : "un",
1106 (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp",
1107 maxpaths, afi, safi, VTY_NEWLINE);
165b5fff
JB
1108 return CMD_WARNING;
1109 }
1110
7aafcaca
DS
1111 bgp_recalculate_all_bestpaths (bgp);
1112
165b5fff
JB
1113 return CMD_SUCCESS;
1114}
1115
abc920f8
DS
1116DEFUN (bgp_maxmed_admin,
1117 bgp_maxmed_admin_cmd,
1118 "bgp max-med administrative ",
1119 BGP_STR
1120 "Advertise routes with max-med\n"
1121 "Administratively applied, for an indefinite period\n")
1122{
1123 struct bgp *bgp;
1124
1125 bgp = vty->index;
1126
1127 bgp->v_maxmed_admin = 1;
1128 bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT;
1129
1130 bgp_maxmed_update(bgp);
1131
1132 return CMD_SUCCESS;
1133}
1134
1135DEFUN (bgp_maxmed_admin_medv,
1136 bgp_maxmed_admin_medv_cmd,
1137 "bgp max-med administrative <0-4294967294>",
1138 BGP_STR
1139 "Advertise routes with max-med\n"
1140 "Administratively applied, for an indefinite period\n"
1141 "Max MED value to be used\n")
1142{
1143 struct bgp *bgp;
1144
1145 bgp = vty->index;
1146
1147 bgp->v_maxmed_admin = 1;
1148 VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[0]);
1149
1150 bgp_maxmed_update(bgp);
1151
1152 return CMD_SUCCESS;
1153}
1154
1155DEFUN (no_bgp_maxmed_admin,
1156 no_bgp_maxmed_admin_cmd,
1157 "no bgp max-med administrative",
1158 NO_STR
1159 BGP_STR
1160 "Advertise routes with max-med\n"
1161 "Administratively applied, for an indefinite period\n")
1162{
1163 struct bgp *bgp;
1164
1165 bgp = vty->index;
1166
1167 bgp->v_maxmed_admin = BGP_MAXMED_ADMIN_UNCONFIGURED;
1168 bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT;
1169
1170 bgp_maxmed_update(bgp);
1171
1172 return CMD_SUCCESS;
1173}
1174
1175ALIAS (no_bgp_maxmed_admin,
1176 no_bgp_maxmed_admin_medv_cmd,
1177 "no bgp max-med administrative <0-4294967294>",
1178 NO_STR
1179 BGP_STR
1180 "Advertise routes with max-med\n"
1181 "Administratively applied, for an indefinite period\n"
1182 "Max MED value to be used\n")
1183
1184
1185DEFUN (bgp_maxmed_onstartup,
1186 bgp_maxmed_onstartup_cmd,
1187 "bgp max-med on-startup <5-86400>",
1188 BGP_STR
1189 "Advertise routes with max-med\n"
1190 "Effective on a startup\n"
1191 "Time (seconds) period for max-med\n")
1192{
1193 struct bgp *bgp;
1194
1195 bgp = vty->index;
1196
1197 if (argc != 1)
1198 {
1199 vty_out (vty, "%% Must supply max-med on-startup period");
1200 return CMD_WARNING;
1201 }
1202
1203 VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]);
1204 bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT;
1205
1206 bgp_maxmed_update(bgp);
1207
1208 return CMD_SUCCESS;
1209}
1210
1211DEFUN (bgp_maxmed_onstartup_medv,
1212 bgp_maxmed_onstartup_medv_cmd,
1213 "bgp max-med on-startup <5-86400> <0-4294967294>",
1214 BGP_STR
1215 "Advertise routes with max-med\n"
1216 "Effective on a startup\n"
1217 "Time (seconds) period for max-med\n"
1218 "Max MED value to be used\n")
1219{
1220 struct bgp *bgp;
1221
1222 bgp = vty->index;
1223
1224 if (argc != 2)
1225 {
1226 vty_out (vty, "%% Must supply max-med on-startup period and med value");
1227 return CMD_WARNING;
1228 }
1229
1230 VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]);
1231 VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[1]);
1232
1233 bgp_maxmed_update(bgp);
1234
1235 return CMD_SUCCESS;
1236}
1237
1238DEFUN (no_bgp_maxmed_onstartup,
1239 no_bgp_maxmed_onstartup_cmd,
1240 "no bgp max-med on-startup",
1241 NO_STR
1242 BGP_STR
1243 "Advertise routes with max-med\n"
1244 "Effective on a startup\n")
1245{
1246 struct bgp *bgp;
1247
1248 bgp = vty->index;
1249
1250 /* Cancel max-med onstartup if its on */
1251 if (bgp->t_maxmed_onstartup)
1252 {
1253 THREAD_TIMER_OFF (bgp->t_maxmed_onstartup);
1254 bgp->maxmed_onstartup_over = 1;
1255 }
1256
1257 bgp->v_maxmed_onstartup = BGP_MAXMED_ONSTARTUP_UNCONFIGURED;
1258 bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT;
1259
1260 bgp_maxmed_update(bgp);
1261
1262 return CMD_SUCCESS;
1263}
1264
1265ALIAS (no_bgp_maxmed_onstartup,
1266 no_bgp_maxmed_onstartup_period_cmd,
1267 "no bgp max-med on-startup <5-86400>",
1268 NO_STR
1269 BGP_STR
1270 "Advertise routes with max-med\n"
1271 "Effective on a startup\n"
1272 "Time (seconds) period for max-med\n")
1273
1274ALIAS (no_bgp_maxmed_onstartup,
1275 no_bgp_maxmed_onstartup_period_medv_cmd,
1276 "no bgp max-med on-startup <5-86400> <0-4294967294>",
1277 NO_STR
1278 BGP_STR
1279 "Advertise routes with max-med\n"
1280 "Effective on a startup\n"
1281 "Time (seconds) period for max-med\n"
1282 "Max MED value to be used\n")
1283
f188f2c4
DS
1284static int
1285bgp_update_delay_config_vty (struct vty *vty, const char *delay,
1286 const char *wait)
1287{
1288 struct bgp *bgp;
1289 u_int16_t update_delay;
1290 u_int16_t establish_wait;
1291
1292
1293 bgp = vty->index;
1294
1295 VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay,
1296 BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX);
1297
1298 if (!wait) /* update-delay <delay> */
1299 {
1300 bgp->v_update_delay = update_delay;
1301 bgp->v_establish_wait = bgp->v_update_delay;
1302 return CMD_SUCCESS;
1303 }
1304
1305 /* update-delay <delay> <establish-wait> */
1306 establish_wait = atoi (wait);
1307 if (update_delay < establish_wait)
1308 {
1309 vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s",
1310 VTY_NEWLINE);
1311 return CMD_WARNING;
1312 }
1313
1314 bgp->v_update_delay = update_delay;
1315 bgp->v_establish_wait = establish_wait;
1316
1317 return CMD_SUCCESS;
1318}
1319
1320static int
1321bgp_update_delay_deconfig_vty (struct vty *vty)
1322{
1323 struct bgp *bgp;
1324
1325 bgp = vty->index;
1326
1327 bgp->v_update_delay = BGP_UPDATE_DELAY_DEF;
1328 bgp->v_establish_wait = bgp->v_update_delay;
1329
1330 return CMD_SUCCESS;
1331}
1332
1333int
1334bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp)
1335{
1336 if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF)
1337 {
1338 vty_out (vty, " update-delay %d", bgp->v_update_delay);
1339 if (bgp->v_update_delay != bgp->v_establish_wait)
1340 vty_out (vty, " %d", bgp->v_establish_wait);
1341 vty_out (vty, "%s", VTY_NEWLINE);
1342 }
1343
1344 return 0;
1345}
1346
1347
1348/* Update-delay configuration */
1349DEFUN (bgp_update_delay,
1350 bgp_update_delay_cmd,
1351 "update-delay <0-3600>",
1352 "Force initial delay for best-path and updates\n"
1353 "Seconds\n")
1354{
1355 return bgp_update_delay_config_vty(vty, argv[0], NULL);
1356}
1357
1358DEFUN (bgp_update_delay_establish_wait,
1359 bgp_update_delay_establish_wait_cmd,
1360 "update-delay <0-3600> <1-3600>",
1361 "Force initial delay for best-path and updates\n"
1362 "Seconds\n"
1363 "Wait for peers to be established\n"
1364 "Seconds\n")
1365{
1366 return bgp_update_delay_config_vty(vty, argv[0], argv[1]);
1367}
1368
1369/* Update-delay deconfiguration */
1370DEFUN (no_bgp_update_delay,
1371 no_bgp_update_delay_cmd,
1372 "no update-delay <0-3600>",
1373 "Force initial delay for best-path and updates\n"
1374 "Seconds\n")
1375{
1376 return bgp_update_delay_deconfig_vty(vty);
1377}
1378
1379ALIAS (no_bgp_update_delay,
1380 no_bgp_update_delay_establish_wait_cmd,
1381 "no update-delay <0-3600> <1-3600>",
1382 "Force initial delay for best-path and updates\n"
1383 "Seconds\n"
1384 "Wait for peers to be established\n"
1385 "Seconds\n")
5e242b0d 1386
ffd0c037
DS
1387static int
1388bgp_wpkt_quanta_config_vty (struct vty *vty, const char *num, char set)
cb1faec9
DS
1389{
1390 struct bgp *bgp;
cb1faec9
DS
1391
1392 bgp = vty->index;
1393
1394 if (set)
1395 VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num,
4543bbb4 1396 1, 10000);
cb1faec9
DS
1397 else
1398 bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX;
1399
1400 return CMD_SUCCESS;
1401}
1402
1403int
1404bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp)
1405{
1406 if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX)
1407 vty_out (vty, " write-quanta %d%s",
1408 bgp->wpkt_quanta, VTY_NEWLINE);
1409
1410 return 0;
1411}
1412
1413
1414/* Update-delay configuration */
1415DEFUN (bgp_wpkt_quanta,
1416 bgp_wpkt_quanta_cmd,
4543bbb4 1417 "write-quanta <1-10000>",
cb1faec9
DS
1418 "How many packets to write to peer socket per run\n"
1419 "Number of packets\n")
1420{
1421 return bgp_wpkt_quanta_config_vty(vty, argv[0], 1);
1422}
1423
1424/* Update-delay deconfiguration */
1425DEFUN (no_bgp_wpkt_quanta,
1426 no_bgp_wpkt_quanta_cmd,
4543bbb4 1427 "no write-quanta <1-10000>",
cb1faec9
DS
1428 "How many packets to write to peer socket per run\n"
1429 "Number of packets\n")
1430{
1431 return bgp_wpkt_quanta_config_vty(vty, argv[0], 0);
1432}
1433
ffd0c037 1434static int
3f9c7369
DS
1435bgp_coalesce_config_vty (struct vty *vty, const char *num, char set)
1436{
1437 struct bgp *bgp;
1438
1439 bgp = vty->index;
1440
1441 if (set)
1442 VTY_GET_INTEGER_RANGE ("coalesce-time", bgp->coalesce_time, num,
1443 0, 4294967295);
1444 else
1445 bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME;
1446
1447 return CMD_SUCCESS;
1448}
1449
1450int
1451bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp)
1452{
1453 if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME)
1454 vty_out (vty, " coalesce-time %d%s",
1455 bgp->coalesce_time, VTY_NEWLINE);
1456
1457 return 0;
1458}
1459
1460
1461DEFUN (bgp_coalesce_time,
1462 bgp_coalesce_time_cmd,
1463 "coalesce-time <0-4294967295>",
1464 "Subgroup coalesce timer\n"
1465 "Subgroup coalesce timer value (in ms)\n")
1466{
1467 return bgp_coalesce_config_vty(vty, argv[0], 1);
1468}
1469
1470DEFUN (no_bgp_coalesce_time,
1471 no_bgp_coalesce_time_cmd,
1472 "no coalesce-time <0-4294967295>",
1473 "Subgroup coalesce timer\n"
1474 "Subgroup coalesce timer value (in ms)\n")
1475{
1476 return bgp_coalesce_config_vty(vty, argv[0], 0);
1477}
1478
5e242b0d
DS
1479/* Maximum-paths configuration */
1480DEFUN (bgp_maxpaths,
1481 bgp_maxpaths_cmd,
a565fbdd 1482 "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
5e242b0d
DS
1483 "Forward packets over multiple paths\n"
1484 "Number of paths\n")
1485{
1486 return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1);
1487}
1488
165b5fff
JB
1489DEFUN (bgp_maxpaths_ibgp,
1490 bgp_maxpaths_ibgp_cmd,
a565fbdd 1491 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
165b5fff
JB
1492 "Forward packets over multiple paths\n"
1493 "iBGP-multipath\n"
1494 "Number of paths\n")
1495{
5e242b0d
DS
1496 return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1);
1497}
165b5fff 1498
5e242b0d
DS
1499DEFUN (bgp_maxpaths_ibgp_cluster,
1500 bgp_maxpaths_ibgp_cluster_cmd,
a565fbdd 1501 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length",
5e242b0d
DS
1502 "Forward packets over multiple paths\n"
1503 "iBGP-multipath\n"
1504 "Number of paths\n"
1505 "Match the cluster length\n")
1506{
1507 return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0],
1508 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1);
165b5fff
JB
1509}
1510
1511DEFUN (no_bgp_maxpaths,
1512 no_bgp_maxpaths_cmd,
1513 "no maximum-paths",
1514 NO_STR
1515 "Forward packets over multiple paths\n"
1516 "Number of paths\n")
1517{
5e242b0d 1518 return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0);
165b5fff
JB
1519}
1520
1521ALIAS (no_bgp_maxpaths,
1522 no_bgp_maxpaths_arg_cmd,
a565fbdd 1523 "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
165b5fff
JB
1524 NO_STR
1525 "Forward packets over multiple paths\n"
1526 "Number of paths\n")
1527
1528DEFUN (no_bgp_maxpaths_ibgp,
1529 no_bgp_maxpaths_ibgp_cmd,
1530 "no maximum-paths ibgp",
1531 NO_STR
1532 "Forward packets over multiple paths\n"
1533 "iBGP-multipath\n"
1534 "Number of paths\n")
1535{
5e242b0d 1536 return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0);
165b5fff
JB
1537}
1538
1539ALIAS (no_bgp_maxpaths_ibgp,
1540 no_bgp_maxpaths_ibgp_arg_cmd,
a565fbdd 1541 "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
165b5fff
JB
1542 NO_STR
1543 "Forward packets over multiple paths\n"
1544 "iBGP-multipath\n"
1545 "Number of paths\n")
1546
5e242b0d
DS
1547ALIAS (no_bgp_maxpaths_ibgp,
1548 no_bgp_maxpaths_ibgp_cluster_cmd,
a565fbdd 1549 "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length",
5e242b0d
DS
1550 NO_STR
1551 "Forward packets over multiple paths\n"
1552 "iBGP-multipath\n"
1553 "Number of paths\n"
1554 "Match the cluster length\n")
1555
165b5fff
JB
1556int
1557bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
1558 safi_t safi, int *write)
1559{
d5b77cc2 1560 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != MULTIPATH_NUM)
165b5fff
JB
1561 {
1562 bgp_config_write_family_header (vty, afi, safi, write);
0b960b4d 1563 vty_out (vty, " maximum-paths %d%s",
165b5fff
JB
1564 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
1565 }
1566
d5b77cc2 1567 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != MULTIPATH_NUM)
165b5fff
JB
1568 {
1569 bgp_config_write_family_header (vty, afi, safi, write);
0b960b4d 1570 vty_out (vty, " maximum-paths ibgp %d",
5e242b0d
DS
1571 bgp->maxpaths[afi][safi].maxpaths_ibgp);
1572 if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags,
1573 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN))
1574 vty_out (vty, " equal-cluster-length");
1575 vty_out (vty, "%s", VTY_NEWLINE);
165b5fff
JB
1576 }
1577
1578 return 0;
1579}
6b0655a2 1580
718e3744 1581/* BGP timers. */
1582
1583DEFUN (bgp_timers,
1584 bgp_timers_cmd,
1585 "timers bgp <0-65535> <0-65535>",
1586 "Adjust routing timers\n"
1587 "BGP timers\n"
1588 "Keepalive interval\n"
1589 "Holdtime\n")
1590{
1591 struct bgp *bgp;
1592 unsigned long keepalive = 0;
1593 unsigned long holdtime = 0;
1594
1595 bgp = vty->index;
1596
1597 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
1598 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
1599
1600 /* Holdtime value check. */
1601 if (holdtime < 3 && holdtime != 0)
1602 {
1603 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
1604 VTY_NEWLINE);
1605 return CMD_WARNING;
1606 }
1607
1608 bgp_timers_set (bgp, keepalive, holdtime);
1609
1610 return CMD_SUCCESS;
1611}
1612
1613DEFUN (no_bgp_timers,
1614 no_bgp_timers_cmd,
1615 "no timers bgp",
1616 NO_STR
1617 "Adjust routing timers\n"
1618 "BGP timers\n")
1619{
1620 struct bgp *bgp;
1621
1622 bgp = vty->index;
1623 bgp_timers_unset (bgp);
1624
1625 return CMD_SUCCESS;
1626}
1627
1628ALIAS (no_bgp_timers,
1629 no_bgp_timers_arg_cmd,
1630 "no timers bgp <0-65535> <0-65535>",
1631 NO_STR
1632 "Adjust routing timers\n"
1633 "BGP timers\n"
1634 "Keepalive interval\n"
1635 "Holdtime\n")
6b0655a2 1636
718e3744 1637DEFUN (bgp_client_to_client_reflection,
1638 bgp_client_to_client_reflection_cmd,
1639 "bgp client-to-client reflection",
1640 "BGP specific commands\n"
1641 "Configure client to client route reflection\n"
1642 "reflection of routes allowed\n")
1643{
1644 struct bgp *bgp;
1645
1646 bgp = vty->index;
1647 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
f31fa004 1648 bgp_clear_star_soft_out (vty, bgp->name);
7aafcaca 1649
718e3744 1650 return CMD_SUCCESS;
1651}
1652
1653DEFUN (no_bgp_client_to_client_reflection,
1654 no_bgp_client_to_client_reflection_cmd,
1655 "no bgp client-to-client reflection",
1656 NO_STR
1657 "BGP specific commands\n"
1658 "Configure client to client route reflection\n"
1659 "reflection of routes allowed\n")
1660{
1661 struct bgp *bgp;
1662
1663 bgp = vty->index;
1664 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
f31fa004 1665 bgp_clear_star_soft_out (vty, bgp->name);
7aafcaca 1666
718e3744 1667 return CMD_SUCCESS;
1668}
1669
1670/* "bgp always-compare-med" configuration. */
1671DEFUN (bgp_always_compare_med,
1672 bgp_always_compare_med_cmd,
1673 "bgp always-compare-med",
1674 "BGP specific commands\n"
1675 "Allow comparing MED from different neighbors\n")
1676{
1677 struct bgp *bgp;
1678
1679 bgp = vty->index;
1680 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
7aafcaca
DS
1681 bgp_recalculate_all_bestpaths (bgp);
1682
718e3744 1683 return CMD_SUCCESS;
1684}
1685
1686DEFUN (no_bgp_always_compare_med,
1687 no_bgp_always_compare_med_cmd,
1688 "no bgp always-compare-med",
1689 NO_STR
1690 "BGP specific commands\n"
1691 "Allow comparing MED from different neighbors\n")
1692{
1693 struct bgp *bgp;
1694
1695 bgp = vty->index;
1696 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
7aafcaca
DS
1697 bgp_recalculate_all_bestpaths (bgp);
1698
718e3744 1699 return CMD_SUCCESS;
1700}
6b0655a2 1701
718e3744 1702/* "bgp deterministic-med" configuration. */
1703DEFUN (bgp_deterministic_med,
1704 bgp_deterministic_med_cmd,
1705 "bgp deterministic-med",
1706 "BGP specific commands\n"
1707 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1708{
1709 struct bgp *bgp;
1710
1711 bgp = vty->index;
1475ac87
DW
1712
1713 if (!bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED))
1714 {
1715 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
1716 bgp_recalculate_all_bestpaths (bgp);
1717 }
7aafcaca 1718
718e3744 1719 return CMD_SUCCESS;
1720}
1721
1722DEFUN (no_bgp_deterministic_med,
1723 no_bgp_deterministic_med_cmd,
1724 "no bgp deterministic-med",
1725 NO_STR
1726 "BGP specific commands\n"
1727 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1728{
1729 struct bgp *bgp;
06370dac
DW
1730 int bestpath_per_as_used;
1731 afi_t afi;
1732 safi_t safi;
1733 struct peer *peer;
1734 struct listnode *node, *nnode;
718e3744 1735
1736 bgp = vty->index;
1475ac87
DW
1737
1738 if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED))
1739 {
06370dac
DW
1740 bestpath_per_as_used = 0;
1741
1742 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
1743 {
1744 for (afi = AFI_IP; afi < AFI_MAX; afi++)
1745 for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
1746 if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS))
1747 {
1748 bestpath_per_as_used = 1;
1749 break;
1750 }
1751
1752 if (bestpath_per_as_used)
1753 break;
1754 }
1755
1756 if (bestpath_per_as_used)
1757 {
1758 vty_out (vty, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s",
1759 VTY_NEWLINE);
1760 return CMD_WARNING;
1761 }
1762 else
1763 {
1764 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
1765 bgp_recalculate_all_bestpaths (bgp);
1766 }
1475ac87 1767 }
7aafcaca 1768
718e3744 1769 return CMD_SUCCESS;
1770}
538621f2 1771
1772/* "bgp graceful-restart" configuration. */
1773DEFUN (bgp_graceful_restart,
1774 bgp_graceful_restart_cmd,
1775 "bgp graceful-restart",
1776 "BGP specific commands\n"
1777 "Graceful restart capability parameters\n")
1778{
1779 struct bgp *bgp;
1780
1781 bgp = vty->index;
1782 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
1783 return CMD_SUCCESS;
1784}
1785
1786DEFUN (no_bgp_graceful_restart,
1787 no_bgp_graceful_restart_cmd,
1788 "no bgp graceful-restart",
1789 NO_STR
1790 "BGP specific commands\n"
1791 "Graceful restart capability parameters\n")
1792{
1793 struct bgp *bgp;
1794
1795 bgp = vty->index;
1796 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
1797 return CMD_SUCCESS;
1798}
1799
93406d87 1800DEFUN (bgp_graceful_restart_stalepath_time,
1801 bgp_graceful_restart_stalepath_time_cmd,
1802 "bgp graceful-restart stalepath-time <1-3600>",
1803 "BGP specific commands\n"
1804 "Graceful restart capability parameters\n"
1805 "Set the max time to hold onto restarting peer's stale paths\n"
1806 "Delay value (seconds)\n")
1807{
1808 struct bgp *bgp;
1809 u_int32_t stalepath;
1810
1811 bgp = vty->index;
1812 if (! bgp)
1813 return CMD_WARNING;
1814
1815 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
1816 bgp->stalepath_time = stalepath;
1817 return CMD_SUCCESS;
1818}
1819
eb6f1b41
PG
1820DEFUN (bgp_graceful_restart_restart_time,
1821 bgp_graceful_restart_restart_time_cmd,
1822 "bgp graceful-restart restart-time <1-3600>",
1823 "BGP specific commands\n"
1824 "Graceful restart capability parameters\n"
1825 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1826 "Delay value (seconds)\n")
1827{
1828 struct bgp *bgp;
1829 u_int32_t restart;
1830
1831 bgp = vty->index;
1832 if (! bgp)
1833 return CMD_WARNING;
1834
1835 VTY_GET_INTEGER_RANGE ("restart-time", restart, argv[0], 1, 3600);
1836 bgp->restart_time = restart;
1837 return CMD_SUCCESS;
1838}
1839
93406d87 1840DEFUN (no_bgp_graceful_restart_stalepath_time,
1841 no_bgp_graceful_restart_stalepath_time_cmd,
1842 "no bgp graceful-restart stalepath-time",
1843 NO_STR
1844 "BGP specific commands\n"
1845 "Graceful restart capability parameters\n"
1846 "Set the max time to hold onto restarting peer's stale paths\n")
1847{
1848 struct bgp *bgp;
1849
1850 bgp = vty->index;
1851 if (! bgp)
1852 return CMD_WARNING;
1853
1854 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1855 return CMD_SUCCESS;
1856}
1857
eb6f1b41
PG
1858DEFUN (no_bgp_graceful_restart_restart_time,
1859 no_bgp_graceful_restart_restart_time_cmd,
1860 "no bgp graceful-restart restart-time",
1861 NO_STR
1862 "BGP specific commands\n"
1863 "Graceful restart capability parameters\n"
1864 "Set the time to wait to delete stale routes before a BGP open message is received\n")
1865{
1866 struct bgp *bgp;
1867
1868 bgp = vty->index;
1869 if (! bgp)
1870 return CMD_WARNING;
1871
1872 bgp->restart_time = BGP_DEFAULT_RESTART_TIME;
1873 return CMD_SUCCESS;
1874}
1875
93406d87 1876ALIAS (no_bgp_graceful_restart_stalepath_time,
1877 no_bgp_graceful_restart_stalepath_time_val_cmd,
1878 "no bgp graceful-restart stalepath-time <1-3600>",
1879 NO_STR
1880 "BGP specific commands\n"
1881 "Graceful restart capability parameters\n"
1882 "Set the max time to hold onto restarting peer's stale paths\n"
1883 "Delay value (seconds)\n")
1884
eb6f1b41
PG
1885ALIAS (no_bgp_graceful_restart_restart_time,
1886 no_bgp_graceful_restart_restart_time_val_cmd,
1887 "no bgp graceful-restart restart-time <1-3600>",
1888 NO_STR
1889 "BGP specific commands\n"
1890 "Graceful restart capability parameters\n"
1891 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1892 "Delay value (seconds)\n")
1893
718e3744 1894/* "bgp fast-external-failover" configuration. */
1895DEFUN (bgp_fast_external_failover,
1896 bgp_fast_external_failover_cmd,
1897 "bgp fast-external-failover",
1898 BGP_STR
1899 "Immediately reset session if a link to a directly connected external peer goes down\n")
1900{
1901 struct bgp *bgp;
1902
1903 bgp = vty->index;
1904 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1905 return CMD_SUCCESS;
1906}
1907
1908DEFUN (no_bgp_fast_external_failover,
1909 no_bgp_fast_external_failover_cmd,
1910 "no bgp fast-external-failover",
1911 NO_STR
1912 BGP_STR
1913 "Immediately reset session if a link to a directly connected external peer goes down\n")
1914{
1915 struct bgp *bgp;
1916
1917 bgp = vty->index;
1918 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1919 return CMD_SUCCESS;
1920}
6b0655a2 1921
718e3744 1922/* "bgp enforce-first-as" configuration. */
1923DEFUN (bgp_enforce_first_as,
1924 bgp_enforce_first_as_cmd,
1925 "bgp enforce-first-as",
1926 BGP_STR
1927 "Enforce the first AS for EBGP routes\n")
1928{
1929 struct bgp *bgp;
1930
1931 bgp = vty->index;
1932 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
f31fa004 1933 bgp_clear_star_soft_in (vty, bgp->name);
7aafcaca 1934
718e3744 1935 return CMD_SUCCESS;
1936}
1937
1938DEFUN (no_bgp_enforce_first_as,
1939 no_bgp_enforce_first_as_cmd,
1940 "no bgp enforce-first-as",
1941 NO_STR
1942 BGP_STR
1943 "Enforce the first AS for EBGP routes\n")
1944{
1945 struct bgp *bgp;
1946
1947 bgp = vty->index;
1948 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
f31fa004 1949 bgp_clear_star_soft_in (vty, bgp->name);
7aafcaca 1950
718e3744 1951 return CMD_SUCCESS;
1952}
6b0655a2 1953
718e3744 1954/* "bgp bestpath compare-routerid" configuration. */
1955DEFUN (bgp_bestpath_compare_router_id,
1956 bgp_bestpath_compare_router_id_cmd,
1957 "bgp bestpath compare-routerid",
1958 "BGP specific commands\n"
1959 "Change the default bestpath selection\n"
1960 "Compare router-id for identical EBGP paths\n")
1961{
1962 struct bgp *bgp;
1963
1964 bgp = vty->index;
1965 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
7aafcaca
DS
1966 bgp_recalculate_all_bestpaths (bgp);
1967
718e3744 1968 return CMD_SUCCESS;
1969}
1970
1971DEFUN (no_bgp_bestpath_compare_router_id,
1972 no_bgp_bestpath_compare_router_id_cmd,
1973 "no bgp bestpath compare-routerid",
1974 NO_STR
1975 "BGP specific commands\n"
1976 "Change the default bestpath selection\n"
1977 "Compare router-id for identical EBGP paths\n")
1978{
1979 struct bgp *bgp;
1980
1981 bgp = vty->index;
1982 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
7aafcaca
DS
1983 bgp_recalculate_all_bestpaths (bgp);
1984
718e3744 1985 return CMD_SUCCESS;
1986}
6b0655a2 1987
718e3744 1988/* "bgp bestpath as-path ignore" configuration. */
1989DEFUN (bgp_bestpath_aspath_ignore,
1990 bgp_bestpath_aspath_ignore_cmd,
1991 "bgp bestpath as-path ignore",
1992 "BGP specific commands\n"
1993 "Change the default bestpath selection\n"
1994 "AS-path attribute\n"
1995 "Ignore as-path length in selecting a route\n")
1996{
1997 struct bgp *bgp;
1998
1999 bgp = vty->index;
2000 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
7aafcaca
DS
2001 bgp_recalculate_all_bestpaths (bgp);
2002
718e3744 2003 return CMD_SUCCESS;
2004}
2005
2006DEFUN (no_bgp_bestpath_aspath_ignore,
2007 no_bgp_bestpath_aspath_ignore_cmd,
2008 "no bgp bestpath as-path ignore",
2009 NO_STR
2010 "BGP specific commands\n"
2011 "Change the default bestpath selection\n"
2012 "AS-path attribute\n"
2013 "Ignore as-path length in selecting a route\n")
2014{
2015 struct bgp *bgp;
2016
2017 bgp = vty->index;
2018 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
7aafcaca
DS
2019 bgp_recalculate_all_bestpaths (bgp);
2020
718e3744 2021 return CMD_SUCCESS;
2022}
6b0655a2 2023
6811845b 2024/* "bgp bestpath as-path confed" configuration. */
2025DEFUN (bgp_bestpath_aspath_confed,
2026 bgp_bestpath_aspath_confed_cmd,
2027 "bgp bestpath as-path confed",
2028 "BGP specific commands\n"
2029 "Change the default bestpath selection\n"
2030 "AS-path attribute\n"
2031 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2032{
2033 struct bgp *bgp;
2034
2035 bgp = vty->index;
2036 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
7aafcaca
DS
2037 bgp_recalculate_all_bestpaths (bgp);
2038
6811845b 2039 return CMD_SUCCESS;
2040}
2041
2042DEFUN (no_bgp_bestpath_aspath_confed,
2043 no_bgp_bestpath_aspath_confed_cmd,
2044 "no bgp bestpath as-path confed",
2045 NO_STR
2046 "BGP specific commands\n"
2047 "Change the default bestpath selection\n"
2048 "AS-path attribute\n"
2049 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2050{
2051 struct bgp *bgp;
2052
2053 bgp = vty->index;
2054 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
7aafcaca
DS
2055 bgp_recalculate_all_bestpaths (bgp);
2056
6811845b 2057 return CMD_SUCCESS;
2058}
6b0655a2 2059
2fdd455c
PM
2060/* "bgp bestpath as-path multipath-relax" configuration. */
2061DEFUN (bgp_bestpath_aspath_multipath_relax,
2062 bgp_bestpath_aspath_multipath_relax_cmd,
219178b6 2063 "bgp bestpath as-path multipath-relax {as-set|no-as-set}",
16fc1eec
DS
2064 "BGP specific commands\n"
2065 "Change the default bestpath selection\n"
2066 "AS-path attribute\n"
2067 "Allow load sharing across routes that have different AS paths (but same length)\n"
219178b6 2068 "Generate an AS_SET\n"
16fc1eec
DS
2069 "Do not generate an AS_SET\n")
2070{
2071 struct bgp *bgp;
2072
2073 bgp = vty->index;
2074 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
219178b6
DW
2075
2076 /* no-as-set is now the default behavior so we can silently
2077 * ignore it */
2078 if (argv[0] != NULL && strncmp (argv[0], "a", 1) == 0)
2079 bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET);
2080 else
2081 bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET) ;
2082
7aafcaca
DS
2083 bgp_recalculate_all_bestpaths (bgp);
2084
16fc1eec
DS
2085 return CMD_SUCCESS;
2086}
2087
219178b6
DW
2088DEFUN (no_bgp_bestpath_aspath_multipath_relax,
2089 no_bgp_bestpath_aspath_multipath_relax_cmd,
2090 "no bgp bestpath as-path multipath-relax {as-set|no-as-set}",
16fc1eec
DS
2091 NO_STR
2092 "BGP specific commands\n"
2093 "Change the default bestpath selection\n"
2094 "AS-path attribute\n"
2095 "Allow load sharing across routes that have different AS paths (but same length)\n"
219178b6 2096 "Generate an AS_SET\n"
16fc1eec
DS
2097 "Do not generate an AS_SET\n")
2098{
2099 struct bgp *bgp;
2100
2101 bgp = vty->index;
2102 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
219178b6 2103 bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET);
7aafcaca
DS
2104 bgp_recalculate_all_bestpaths (bgp);
2105
2fdd455c
PM
2106 return CMD_SUCCESS;
2107}
6b0655a2 2108
848973c7 2109/* "bgp log-neighbor-changes" configuration. */
2110DEFUN (bgp_log_neighbor_changes,
2111 bgp_log_neighbor_changes_cmd,
2112 "bgp log-neighbor-changes",
2113 "BGP specific commands\n"
2114 "Log neighbor up/down and reset reason\n")
2115{
2116 struct bgp *bgp;
2117
2118 bgp = vty->index;
2119 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
2120 return CMD_SUCCESS;
2121}
2122
2123DEFUN (no_bgp_log_neighbor_changes,
2124 no_bgp_log_neighbor_changes_cmd,
2125 "no bgp log-neighbor-changes",
2126 NO_STR
2127 "BGP specific commands\n"
2128 "Log neighbor up/down and reset reason\n")
2129{
2130 struct bgp *bgp;
2131
2132 bgp = vty->index;
2133 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
2134 return CMD_SUCCESS;
2135}
6b0655a2 2136
718e3744 2137/* "bgp bestpath med" configuration. */
2138DEFUN (bgp_bestpath_med,
2139 bgp_bestpath_med_cmd,
2140 "bgp bestpath med (confed|missing-as-worst)",
2141 "BGP specific commands\n"
2142 "Change the default bestpath selection\n"
2143 "MED attribute\n"
2144 "Compare MED among confederation paths\n"
2145 "Treat missing MED as the least preferred one\n")
2146{
2147 struct bgp *bgp;
2148
2149 bgp = vty->index;
2150
2151 if (strncmp (argv[0], "confed", 1) == 0)
2152 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
2153 else
2154 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
2155
7aafcaca
DS
2156 bgp_recalculate_all_bestpaths (bgp);
2157
718e3744 2158 return CMD_SUCCESS;
2159}
2160
2161DEFUN (bgp_bestpath_med2,
2162 bgp_bestpath_med2_cmd,
2163 "bgp bestpath med confed missing-as-worst",
2164 "BGP specific commands\n"
2165 "Change the default bestpath selection\n"
2166 "MED attribute\n"
2167 "Compare MED among confederation paths\n"
2168 "Treat missing MED as the least preferred one\n")
2169{
2170 struct bgp *bgp;
2171
2172 bgp = vty->index;
2173 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
2174 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
7aafcaca
DS
2175 bgp_recalculate_all_bestpaths (bgp);
2176
718e3744 2177 return CMD_SUCCESS;
2178}
2179
2180ALIAS (bgp_bestpath_med2,
2181 bgp_bestpath_med3_cmd,
2182 "bgp bestpath med missing-as-worst confed",
2183 "BGP specific commands\n"
2184 "Change the default bestpath selection\n"
2185 "MED attribute\n"
2186 "Treat missing MED as the least preferred one\n"
2187 "Compare MED among confederation paths\n")
2188
2189DEFUN (no_bgp_bestpath_med,
2190 no_bgp_bestpath_med_cmd,
2191 "no bgp bestpath med (confed|missing-as-worst)",
2192 NO_STR
2193 "BGP specific commands\n"
2194 "Change the default bestpath selection\n"
2195 "MED attribute\n"
2196 "Compare MED among confederation paths\n"
2197 "Treat missing MED as the least preferred one\n")
2198{
2199 struct bgp *bgp;
2200
2201 bgp = vty->index;
2202
2203 if (strncmp (argv[0], "confed", 1) == 0)
2204 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
2205 else
2206 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
2207
7aafcaca
DS
2208 bgp_recalculate_all_bestpaths (bgp);
2209
718e3744 2210 return CMD_SUCCESS;
2211}
2212
2213DEFUN (no_bgp_bestpath_med2,
2214 no_bgp_bestpath_med2_cmd,
2215 "no bgp bestpath med confed missing-as-worst",
2216 NO_STR
2217 "BGP specific commands\n"
2218 "Change the default bestpath selection\n"
2219 "MED attribute\n"
2220 "Compare MED among confederation paths\n"
2221 "Treat missing MED as the least preferred one\n")
2222{
2223 struct bgp *bgp;
2224
2225 bgp = vty->index;
2226 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
2227 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
7aafcaca
DS
2228 bgp_recalculate_all_bestpaths (bgp);
2229
718e3744 2230 return CMD_SUCCESS;
2231}
2232
2233ALIAS (no_bgp_bestpath_med2,
2234 no_bgp_bestpath_med3_cmd,
2235 "no bgp bestpath med missing-as-worst confed",
2236 NO_STR
2237 "BGP specific commands\n"
2238 "Change the default bestpath selection\n"
2239 "MED attribute\n"
2240 "Treat missing MED as the least preferred one\n"
2241 "Compare MED among confederation paths\n")
6b0655a2 2242
718e3744 2243/* "no bgp default ipv4-unicast". */
2244DEFUN (no_bgp_default_ipv4_unicast,
2245 no_bgp_default_ipv4_unicast_cmd,
2246 "no bgp default ipv4-unicast",
2247 NO_STR
2248 "BGP specific commands\n"
2249 "Configure BGP defaults\n"
2250 "Activate ipv4-unicast for a peer by default\n")
2251{
2252 struct bgp *bgp;
2253
2254 bgp = vty->index;
2255 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
2256 return CMD_SUCCESS;
2257}
2258
2259DEFUN (bgp_default_ipv4_unicast,
2260 bgp_default_ipv4_unicast_cmd,
2261 "bgp default ipv4-unicast",
2262 "BGP specific commands\n"
2263 "Configure BGP defaults\n"
2264 "Activate ipv4-unicast for a peer by default\n")
2265{
2266 struct bgp *bgp;
2267
2268 bgp = vty->index;
2269 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
2270 return CMD_SUCCESS;
2271}
6b0655a2 2272
04b6bdc0
DW
2273/* Display hostname in certain command outputs */
2274DEFUN (bgp_default_show_hostname,
2275 bgp_default_show_hostname_cmd,
2276 "bgp default show-hostname",
2277 "BGP specific commands\n"
2278 "Configure BGP defaults\n"
2279 "Show hostname in certain command ouputs\n")
2280{
2281 struct bgp *bgp;
2282
2283 bgp = vty->index;
2284 bgp_flag_set (bgp, BGP_FLAG_SHOW_HOSTNAME);
2285 return CMD_SUCCESS;
2286}
2287
2288DEFUN (no_bgp_default_show_hostname,
2289 no_bgp_default_show_hostname_cmd,
2290 "no bgp default show-hostname",
2291 NO_STR
2292 "BGP specific commands\n"
2293 "Configure BGP defaults\n"
2294 "Show hostname in certain command ouputs\n")
2295{
2296 struct bgp *bgp;
2297
2298 bgp = vty->index;
2299 bgp_flag_unset (bgp, BGP_FLAG_SHOW_HOSTNAME);
2300 return CMD_SUCCESS;
2301}
2302
8233ef81 2303/* "bgp network import-check" configuration. */
718e3744 2304DEFUN (bgp_network_import_check,
2305 bgp_network_import_check_cmd,
5623e905 2306 "bgp network import-check",
718e3744 2307 "BGP specific commands\n"
2308 "BGP network command\n"
5623e905 2309 "Check BGP network route exists in IGP\n")
718e3744 2310{
2311 struct bgp *bgp;
2312
2313 bgp = vty->index;
078430f6
DS
2314 if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK))
2315 {
2316 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
5623e905 2317 bgp_static_redo_import_check(bgp);
078430f6
DS
2318 }
2319
718e3744 2320 return CMD_SUCCESS;
2321}
2322
8233ef81
DW
2323ALIAS_HIDDEN (bgp_network_import_check,
2324 bgp_network_import_check_exact_cmd,
2325 "bgp network import-check exact",
2326 "BGP specific commands\n"
2327 "BGP network command\n"
2328 "Check BGP network route exists in IGP\n"
2329 "Match route precisely\n")
2330
718e3744 2331DEFUN (no_bgp_network_import_check,
2332 no_bgp_network_import_check_cmd,
5623e905 2333 "no bgp network import-check",
718e3744 2334 NO_STR
2335 "BGP specific commands\n"
2336 "BGP network command\n"
2337 "Check BGP network route exists in IGP\n")
2338{
2339 struct bgp *bgp;
2340
2341 bgp = vty->index;
078430f6
DS
2342 if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK))
2343 {
2344 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
078430f6
DS
2345 bgp_static_redo_import_check(bgp);
2346 }
5623e905 2347
718e3744 2348 return CMD_SUCCESS;
2349}
6b0655a2 2350
718e3744 2351DEFUN (bgp_default_local_preference,
2352 bgp_default_local_preference_cmd,
2353 "bgp default local-preference <0-4294967295>",
2354 "BGP specific commands\n"
2355 "Configure BGP defaults\n"
2356 "local preference (higher=more preferred)\n"
2357 "Configure default local preference value\n")
2358{
2359 struct bgp *bgp;
2360 u_int32_t local_pref;
2361
2362 bgp = vty->index;
2363
2364 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
2365
2366 bgp_default_local_preference_set (bgp, local_pref);
f31fa004 2367 bgp_clear_star_soft_in (vty, bgp->name);
718e3744 2368
2369 return CMD_SUCCESS;
2370}
2371
2372DEFUN (no_bgp_default_local_preference,
2373 no_bgp_default_local_preference_cmd,
2374 "no bgp default local-preference",
2375 NO_STR
2376 "BGP specific commands\n"
2377 "Configure BGP defaults\n"
2378 "local preference (higher=more preferred)\n")
2379{
2380 struct bgp *bgp;
2381
2382 bgp = vty->index;
2383 bgp_default_local_preference_unset (bgp);
f31fa004 2384 bgp_clear_star_soft_in (vty, bgp->name);
7aafcaca 2385
718e3744 2386 return CMD_SUCCESS;
2387}
2388
2389ALIAS (no_bgp_default_local_preference,
2390 no_bgp_default_local_preference_val_cmd,
2391 "no bgp default local-preference <0-4294967295>",
2392 NO_STR
2393 "BGP specific commands\n"
2394 "Configure BGP defaults\n"
2395 "local preference (higher=more preferred)\n"
2396 "Configure default local preference value\n")
6b0655a2 2397
3f9c7369
DS
2398DEFUN (bgp_default_subgroup_pkt_queue_max,
2399 bgp_default_subgroup_pkt_queue_max_cmd,
2400 "bgp default subgroup-pkt-queue-max <20-100>",
2401 "BGP specific commands\n"
2402 "Configure BGP defaults\n"
2403 "subgroup-pkt-queue-max\n"
2404 "Configure subgroup packet queue max\n")
8bd9d948 2405{
3f9c7369
DS
2406 struct bgp *bgp;
2407 u_int32_t max_size;
8bd9d948 2408
3f9c7369
DS
2409 bgp = vty->index;
2410
2411 VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[0]);
2412
2413 bgp_default_subgroup_pkt_queue_max_set (bgp, max_size);
2414
2415 return CMD_SUCCESS;
2416}
2417
2418DEFUN (no_bgp_default_subgroup_pkt_queue_max,
2419 no_bgp_default_subgroup_pkt_queue_max_cmd,
2420 "no bgp default subgroup-pkt-queue-max",
2421 NO_STR
2422 "BGP specific commands\n"
2423 "Configure BGP defaults\n"
2424 "subgroup-pkt-queue-max\n")
2425{
2426 struct bgp *bgp;
2427
2428 bgp = vty->index;
2429 bgp_default_subgroup_pkt_queue_max_unset (bgp);
2430 return CMD_SUCCESS;
8bd9d948
DS
2431}
2432
813d4307
DW
2433ALIAS (no_bgp_default_subgroup_pkt_queue_max,
2434 no_bgp_default_subgroup_pkt_queue_max_val_cmd,
2435 "no bgp default subgroup-pkt-queue-max <20-100>",
2436 NO_STR
2437 "BGP specific commands\n"
2438 "Configure BGP defaults\n"
2439 "subgroup-pkt-queue-max\n"
2440 "Configure subgroup packet queue max\n")
2441
8bd9d948
DS
2442DEFUN (bgp_rr_allow_outbound_policy,
2443 bgp_rr_allow_outbound_policy_cmd,
2444 "bgp route-reflector allow-outbound-policy",
2445 "BGP specific commands\n"
2446 "Allow modifications made by out route-map\n"
2447 "on ibgp neighbors\n")
2448{
2449 struct bgp *bgp;
8bd9d948
DS
2450
2451 bgp = vty->index;
2452
2453 if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))
2454 {
2455 bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
3f9c7369 2456 update_group_announce_rrclients(bgp);
f31fa004 2457 bgp_clear_star_soft_out (vty, bgp->name);
8bd9d948
DS
2458 }
2459
2460 return CMD_SUCCESS;
2461}
2462
2463DEFUN (no_bgp_rr_allow_outbound_policy,
2464 no_bgp_rr_allow_outbound_policy_cmd,
2465 "no bgp route-reflector allow-outbound-policy",
2466 NO_STR
2467 "BGP specific commands\n"
2468 "Allow modifications made by out route-map\n"
2469 "on ibgp neighbors\n")
2470{
2471 struct bgp *bgp;
8bd9d948
DS
2472
2473 bgp = vty->index;
2474
2475 if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))
2476 {
2477 bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
3f9c7369 2478 update_group_announce_rrclients(bgp);
f31fa004 2479 bgp_clear_star_soft_out (vty, bgp->name);
8bd9d948
DS
2480 }
2481
2482 return CMD_SUCCESS;
2483}
2484
f14e6fdb
DS
2485DEFUN (bgp_listen_limit,
2486 bgp_listen_limit_cmd,
2487 "bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE,
2488 "BGP specific commands\n"
2489 "Configure BGP defaults\n"
2490 "maximum number of BGP Dynamic Neighbors that can be created\n"
2491 "Configure Dynamic Neighbors listen limit value\n")
2492{
2493 struct bgp *bgp;
2494 int listen_limit;
2495
2496 bgp = vty->index;
2497
2498 VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[0],
2499 BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN,
2500 BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX);
2501
2502 bgp_listen_limit_set (bgp, listen_limit);
2503
2504 return CMD_SUCCESS;
2505}
2506
2507DEFUN (no_bgp_listen_limit,
2508 no_bgp_listen_limit_cmd,
2509 "no bgp listen limit",
2510 "BGP specific commands\n"
2511 "Configure BGP defaults\n"
2512 "unset maximum number of BGP Dynamic Neighbors that can be created\n"
2513 "Configure Dynamic Neighbors listen limit value to default\n")
2514{
2515 struct bgp *bgp;
2516
2517 bgp = vty->index;
2518 bgp_listen_limit_unset (bgp);
2519 return CMD_SUCCESS;
2520}
2521
813d4307
DW
2522ALIAS (no_bgp_listen_limit,
2523 no_bgp_listen_limit_val_cmd,
2524 "no bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE,
2525 NO_STR
2526 "BGP specific commands\n"
2527 "Configure BGP defaults\n"
2528 "maximum number of BGP Dynamic Neighbors that can be created\n"
2529 "Configure Dynamic Neighbors listen limit value\n")
f14e6fdb 2530
20eb8864 2531/*
2532 * Check if this listen range is already configured. Check for exact
2533 * match or overlap based on input.
2534 */
2535static struct peer_group *
2536listen_range_exists (struct bgp *bgp, struct prefix *range, int exact)
2537{
2538 struct listnode *node, *nnode;
2539 struct listnode *node1, *nnode1;
2540 struct peer_group *group;
2541 struct prefix *lr;
2542 afi_t afi;
2543 int match;
2544
2545 afi = family2afi(range->family);
2546 for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group))
2547 {
2548 for (ALL_LIST_ELEMENTS (group->listen_range[afi], node1,
2549 nnode1, lr))
2550 {
2551 if (exact)
2552 match = prefix_same (range, lr);
2553 else
2554 match = (prefix_match (range, lr) || prefix_match (lr, range));
2555 if (match)
2556 return group;
2557 }
2558 }
2559
2560 return NULL;
2561}
2562
f14e6fdb
DS
2563DEFUN (bgp_listen_range,
2564 bgp_listen_range_cmd,
2565 LISTEN_RANGE_CMD "peer-group WORD" ,
2566 "BGP specific commands\n"
2567 "Configure BGP Dynamic Neighbors\n"
2568 "add a listening range for Dynamic Neighbors\n"
2569 LISTEN_RANGE_ADDR_STR)
2570{
2571 struct bgp *bgp;
2572 struct prefix range;
20eb8864 2573 struct peer_group *group, *existing_group;
f14e6fdb
DS
2574 afi_t afi;
2575 int ret;
2576
2577 bgp = vty->index;
2578
2579 //VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]);
2580
2581 /* Convert IP prefix string to struct prefix. */
2582 ret = str2prefix (argv[0], &range);
2583 if (! ret)
2584 {
2585 vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE);
2586 return CMD_WARNING;
2587 }
2588
2589 afi = family2afi(range.family);
2590
2591#ifdef HAVE_IPV6
2592 if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6))
2593 {
2594 vty_out (vty, "%% Malformed listen range (link-local address)%s",
2595 VTY_NEWLINE);
2596 return CMD_WARNING;
2597 }
2598#endif /* HAVE_IPV6 */
2599
2600 apply_mask (&range);
2601
20eb8864 2602 /* Check if same listen range is already configured. */
2603 existing_group = listen_range_exists (bgp, &range, 1);
2604 if (existing_group)
2605 {
2606 if (strcmp (existing_group->name, argv[1]) == 0)
2607 return CMD_SUCCESS;
2608 else
2609 {
2610 vty_out (vty, "%% Same listen range is attached to peer-group %s%s",
2611 existing_group->name, VTY_NEWLINE);
2612 return CMD_WARNING;
2613 }
2614 }
2615
2616 /* Check if an overlapping listen range exists. */
2617 if (listen_range_exists (bgp, &range, 0))
2618 {
2619 vty_out (vty, "%% Listen range overlaps with existing listen range%s",
2620 VTY_NEWLINE);
2621 return CMD_WARNING;
2622 }
f14e6fdb
DS
2623
2624 group = peer_group_lookup (bgp, argv[1]);
2625 if (! group)
2626 {
2627 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
2628 return CMD_WARNING;
2629 }
2630
2631 ret = peer_group_listen_range_add(group, &range);
2632 return bgp_vty_return (vty, ret);
2633}
2634
2635DEFUN (no_bgp_listen_range,
2636 no_bgp_listen_range_cmd,
2637 "no bgp listen range A.B.C.D/M peer-group WORD" ,
2638 "BGP specific commands\n"
2639 "Configure BGP defaults\n"
2640 "delete a listening range for Dynamic Neighbors\n"
2641 "Remove Dynamic Neighbors listening range\n")
2642{
2643 struct bgp *bgp;
2644 struct prefix range;
2645 struct peer_group *group;
2646 afi_t afi;
2647 int ret;
2648
2649 bgp = vty->index;
2650
2651 // VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]);
2652
2653 /* Convert IP prefix string to struct prefix. */
2654 ret = str2prefix (argv[0], &range);
2655 if (! ret)
2656 {
2657 vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE);
2658 return CMD_WARNING;
2659 }
2660
2661 afi = family2afi(range.family);
2662
2663#ifdef HAVE_IPV6
2664 if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6))
2665 {
2666 vty_out (vty, "%% Malformed listen range (link-local address)%s",
2667 VTY_NEWLINE);
2668 return CMD_WARNING;
2669 }
2670#endif /* HAVE_IPV6 */
2671
2672 apply_mask (&range);
2673
2674
2675 group = peer_group_lookup (bgp, argv[1]);
2676 if (! group)
2677 {
2678 vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE);
2679 return CMD_WARNING;
2680 }
2681
2682 ret = peer_group_listen_range_del(group, &range);
2683 return bgp_vty_return (vty, ret);
2684}
2685
2686int
2687bgp_config_write_listen (struct vty *vty, struct bgp *bgp)
2688{
2689 struct peer_group *group;
2690 struct listnode *node, *nnode, *rnode, *nrnode;
2691 struct prefix *range;
2692 afi_t afi;
4690c7d7 2693 char buf[PREFIX2STR_BUFFER];
f14e6fdb
DS
2694
2695 if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT)
2696 vty_out (vty, " bgp listen limit %d%s",
2697 bgp->dynamic_neighbors_limit, VTY_NEWLINE);
2698
2699 for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group))
2700 {
2701 for (afi = AFI_IP; afi < AFI_MAX; afi++)
2702 {
2703 for (ALL_LIST_ELEMENTS (group->listen_range[afi], rnode, nrnode, range))
2704 {
2705 prefix2str(range, buf, sizeof(buf));
2706 vty_out(vty, " bgp listen range %s peer-group %s%s",
2707 buf, group->name, VTY_NEWLINE);
2708 }
2709 }
2710 }
2711
2712 return 0;
2713}
2714
2715
907f92c8
DS
2716DEFUN (bgp_disable_connected_route_check,
2717 bgp_disable_connected_route_check_cmd,
2718 "bgp disable-ebgp-connected-route-check",
2719 "BGP specific commands\n"
2720 "Disable checking if nexthop is connected on ebgp sessions\n")
2721{
2722 struct bgp *bgp;
2723
2724 bgp = vty->index;
2725 bgp_flag_set (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK);
f31fa004 2726 bgp_clear_star_soft_in (vty, bgp->name);
7aafcaca 2727
907f92c8
DS
2728 return CMD_SUCCESS;
2729}
2730
2731DEFUN (no_bgp_disable_connected_route_check,
2732 no_bgp_disable_connected_route_check_cmd,
2733 "no bgp disable-ebgp-connected-route-check",
2734 NO_STR
2735 "BGP specific commands\n"
2736 "Disable checking if nexthop is connected on ebgp sessions\n")
2737{
2738 struct bgp *bgp;
2739
2740 bgp = vty->index;
2741 bgp_flag_unset (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK);
f31fa004 2742 bgp_clear_star_soft_in (vty, bgp->name);
7aafcaca 2743
907f92c8
DS
2744 return CMD_SUCCESS;
2745}
2746
2747
718e3744 2748static int
fd79ac91 2749peer_remote_as_vty (struct vty *vty, const char *peer_str,
2750 const char *as_str, afi_t afi, safi_t safi)
718e3744 2751{
2752 int ret;
2753 struct bgp *bgp;
2754 as_t as;
0299c004 2755 int as_type = AS_SPECIFIED;
718e3744 2756 union sockunion su;
2757
2758 bgp = vty->index;
2759
0299c004
DS
2760 if (strncmp(as_str, "internal", strlen("internal")) == 0)
2761 {
2762 as = 0;
2763 as_type = AS_INTERNAL;
2764 }
2765 else if (strncmp(as_str, "external", strlen("external")) == 0)
2766 {
2767 as = 0;
2768 as_type = AS_EXTERNAL;
2769 }
2770 else
2771 {
2772 /* Get AS number. */
2773 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
2774 }
718e3744 2775
2776 /* If peer is peer group, call proper function. */
2777 ret = str2sockunion (peer_str, &su);
2778 if (ret < 0)
2779 {
a80beece 2780 /* Check for peer by interface */
0299c004 2781 ret = peer_remote_as (bgp, NULL, peer_str, &as, as_type, afi, safi);
718e3744 2782 if (ret < 0)
a80beece 2783 {
0299c004 2784 ret = peer_group_remote_as (bgp, peer_str, &as, as_type);
a80beece
DS
2785 if (ret < 0)
2786 {
2787 vty_out (vty, "%% Create the peer-group or interface first%s",
2788 VTY_NEWLINE);
2789 return CMD_WARNING;
2790 }
2791 return CMD_SUCCESS;
2792 }
718e3744 2793 }
a80beece 2794 else
718e3744 2795 {
6aeb9e78 2796 if (peer_address_self_check (bgp, &su))
a80beece
DS
2797 {
2798 vty_out (vty, "%% Can not configure the local system as neighbor%s",
2799 VTY_NEWLINE);
2800 return CMD_WARNING;
2801 }
0299c004 2802 ret = peer_remote_as (bgp, &su, NULL, &as, as_type, afi, safi);
718e3744 2803 }
2804
718e3744 2805 /* This peer belongs to peer group. */
2806 switch (ret)
2807 {
2808 case BGP_ERR_PEER_GROUP_MEMBER:
aea339f7 2809 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
718e3744 2810 return CMD_WARNING;
718e3744 2811 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
aea339f7 2812 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);
718e3744 2813 return CMD_WARNING;
718e3744 2814 }
2815 return bgp_vty_return (vty, ret);
2816}
2817
2818DEFUN (neighbor_remote_as,
2819 neighbor_remote_as_cmd,
0299c004 2820 NEIGHBOR_CMD2 "remote-as (" CMD_AS_RANGE "|external|internal)",
718e3744 2821 NEIGHBOR_STR
2822 NEIGHBOR_ADDR_STR2
2823 "Specify a BGP neighbor\n"
2824 AS_STR)
2825{
2826 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
2827}
6b0655a2 2828
4c48cf63
DW
2829static int
2830peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi,
b3a39dc5
DD
2831 safi_t safi, int v6only, const char *peer_group_name,
2832 const char *as_str)
a80beece 2833{
b3a39dc5
DD
2834 as_t as = 0;
2835 int as_type = AS_UNSPECIFIED;
a80beece
DS
2836 struct bgp *bgp;
2837 struct peer *peer;
2838 struct peer_group *group;
4c48cf63
DW
2839 int ret = 0;
2840 union sockunion su;
a80beece
DS
2841
2842 bgp = vty->index;
4c48cf63
DW
2843 group = peer_group_lookup (bgp, conf_if);
2844
a80beece
DS
2845 if (group)
2846 {
2847 vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE);
2848 return CMD_WARNING;
2849 }
2850
b3a39dc5
DD
2851 if (as_str)
2852 {
2853 if (strncmp(as_str, "internal", strlen("internal")) == 0)
2854 {
2855 as_type = AS_INTERNAL;
2856 }
2857 else if (strncmp(as_str, "external", strlen("external")) == 0)
2858 {
2859 as_type = AS_EXTERNAL;
2860 }
2861 else
2862 {
2863 /* Get AS number. */
2864 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
2865 as_type = AS_SPECIFIED;
2866 }
2867 }
2868
4c48cf63
DW
2869 peer = peer_lookup_by_conf_if (bgp, conf_if);
2870 if (!peer)
2871 {
2872 if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4)
2873 && afi == AFI_IP && safi == SAFI_UNICAST)
b3a39dc5
DD
2874 peer = peer_create (NULL, conf_if, bgp, bgp->as, as, as_type, 0, 0,
2875 NULL);
4c48cf63 2876 else
b3a39dc5
DD
2877 peer = peer_create (NULL, conf_if, bgp, bgp->as, as, as_type, afi, safi,
2878 NULL);
4c48cf63
DW
2879
2880 if (peer && v6only)
2881 SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY);
4a04e5f7 2882
2883 /* Request zebra to initiate IPv6 RAs on this interface. We do this
2884 * any unnumbered peer in order to not worry about run-time transitions
2885 * (e.g., peering is initially IPv4, but the IPv4 /30 or /31 address
2886 * gets deleted later etc.)
2887 */
2888 if (peer->ifp)
b3a39dc5
DD
2889 {
2890 bgp_zebra_initiate_radv (bgp, peer);
2891 }
2892 peer_flag_set (peer, PEER_FLAG_CAPABILITY_ENHE);
4c48cf63
DW
2893 }
2894 else if ((v6only && !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) ||
2895 (!v6only && CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)))
2896 {
2897 if (v6only)
2898 SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY);
2899 else
2900 UNSET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY);
2901
2902 /* v6only flag changed. Reset bgp seesion */
2903 if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status))
2904 {
2905 peer->last_reset = PEER_DOWN_V6ONLY_CHANGE;
2906 bgp_notify_send (peer, BGP_NOTIFY_CEASE,
2907 BGP_NOTIFY_CEASE_CONFIG_CHANGE);
2908 }
2909 else
2910 bgp_session_reset(peer);
2911 }
2912
a80beece
DS
2913 if (!peer)
2914 return CMD_WARNING;
2915
4c48cf63
DW
2916 if (peer_group_name)
2917 {
2918 group = peer_group_lookup (bgp, peer_group_name);
2919 if (! group)
2920 {
2921 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
2922 return CMD_WARNING;
2923 }
2924
2925 ret = peer_group_bind (bgp, &su, peer, group, &as);
2926 }
2927
2928 return bgp_vty_return (vty, ret);
a80beece
DS
2929}
2930
4c48cf63
DW
2931DEFUN (neighbor_interface_config,
2932 neighbor_interface_config_cmd,
2933 "neighbor WORD interface",
2934 NEIGHBOR_STR
2935 "Interface name or neighbor tag\n"
2936 "Enable BGP on interface\n")
2937{
2938 if (argc == 2)
b3a39dc5
DD
2939 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0,
2940 argv[1], NULL);
4c48cf63 2941 else
b3a39dc5
DD
2942 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0,
2943 NULL, NULL);
4c48cf63
DW
2944}
2945
2946ALIAS (neighbor_interface_config,
2947 neighbor_interface_config_peergroup_cmd,
2948 "neighbor WORD interface peer-group WORD",
2949 NEIGHBOR_STR
2950 "Interface name or neighbor tag\n"
2951 "Enable BGP on interface\n"
2952 "Member of the peer-group\n"
2953 "peer-group name\n")
2954
2955DEFUN (neighbor_interface_config_v6only,
2956 neighbor_interface_config_v6only_cmd,
2957 "neighbor WORD interface v6only",
2958 NEIGHBOR_STR
2959 "Interface name or neighbor tag\n"
2960 "Enable BGP on interface\n"
2961 "Enable BGP with v6 link-local only\n")
2962{
2963 if (argc == 2)
b3a39dc5
DD
2964 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1,
2965 argv[1], NULL);
4c48cf63 2966 else
b3a39dc5
DD
2967 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1,
2968 NULL, NULL);
4c48cf63
DW
2969}
2970
2971ALIAS (neighbor_interface_config_v6only,
2972 neighbor_interface_config_v6only_peergroup_cmd,
2973 "neighbor WORD interface v6only peer-group WORD",
2974 NEIGHBOR_STR
2975 "Interface name or neighbor tag\n"
2976 "Enable BGP on interface\n"
2977 "Enable BGP with v6 link-local only\n"
2978 "Member of the peer-group\n"
2979 "peer-group name\n")
a80beece 2980
b3a39dc5
DD
2981DEFUN (neighbor_interface_config_remote_as,
2982 neighbor_interface_config_remote_as_cmd,
2983 "neighbor WORD interface remote-as (" CMD_AS_RANGE "|external|internal)",
2984 NEIGHBOR_STR
2985 "Interface name or neighbor tag\n"
2986 "Enable BGP on interface\n"
2987 AS_STR)
2988{
2989 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0,
2990 NULL, argv[1]);
2991}
2992
2993DEFUN (neighbor_interface_v6only_config_remote_as,
2994 neighbor_interface_v6only_config_remote_as_cmd,
2995 "neighbor WORD interface v6only remote-as (" CMD_AS_RANGE "|external|internal)",
2996 NEIGHBOR_STR
2997 "Interface name or neighbor tag\n"
2998 "Enable BGP on interface\n"
2999 AS_STR)
3000{
3001 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1,
3002 NULL, argv[1]);
3003}
3004
718e3744 3005DEFUN (neighbor_peer_group,
3006 neighbor_peer_group_cmd,
3007 "neighbor WORD peer-group",
3008 NEIGHBOR_STR
a80beece 3009 "Interface name or neighbor tag\n"
718e3744 3010 "Configure peer-group\n")
3011{
3012 struct bgp *bgp;
a80beece 3013 struct peer *peer;
718e3744 3014 struct peer_group *group;
3015
3016 bgp = vty->index;
a80beece
DS
3017 peer = peer_lookup_by_conf_if (bgp, argv[0]);
3018 if (peer)
3019 {
3020 vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE);
3021 return CMD_WARNING;
3022 }
718e3744 3023
3024 group = peer_group_get (bgp, argv[0]);
3025 if (! group)
3026 return CMD_WARNING;
3027
3028 return CMD_SUCCESS;
3029}
3030
3031DEFUN (no_neighbor,
3032 no_neighbor_cmd,
3033 NO_NEIGHBOR_CMD2,
3034 NO_STR
3035 NEIGHBOR_STR
3036 NEIGHBOR_ADDR_STR2)
3037{
3038 int ret;
3039 union sockunion su;
3040 struct peer_group *group;
3041 struct peer *peer;
1ff9a340 3042 struct peer *other;
718e3744 3043
3044 ret = str2sockunion (argv[0], &su);
3045 if (ret < 0)
3046 {
a80beece
DS
3047 /* look up for neighbor by interface name config. */
3048 peer = peer_lookup_by_conf_if (vty->index, argv[0]);
3049 if (peer)
3050 {
4a04e5f7 3051 /* Request zebra to terminate IPv6 RAs on this interface. */
3052 if (peer->ifp)
3053 bgp_zebra_terminate_radv (peer->bgp, peer);
a80beece
DS
3054 peer_delete (peer);
3055 return CMD_SUCCESS;
3056 }
3057
718e3744 3058 group = peer_group_lookup (vty->index, argv[0]);
3059 if (group)
3060 peer_group_delete (group);
3061 else
3062 {
3063 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
3064 return CMD_WARNING;
3065 }
3066 }
3067 else
3068 {
3069 peer = peer_lookup (vty->index, &su);
3070 if (peer)
1ff9a340 3071 {
f14e6fdb
DS
3072 if (peer_dynamic_neighbor (peer))
3073 {
3074 vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
3075 VTY_NEWLINE);
3076 return CMD_WARNING;
3077 }
3078
1ff9a340
DS
3079 other = peer->doppelganger;
3080 peer_delete (peer);
3081 if (other && other->status != Deleted)
3082 peer_delete(other);
3083 }
718e3744 3084 }
3085
3086 return CMD_SUCCESS;
3087}
3088
3089ALIAS (no_neighbor,
3090 no_neighbor_remote_as_cmd,
0299c004 3091 NO_NEIGHBOR_CMD "remote-as (" CMD_AS_RANGE "|internal|external)",
718e3744 3092 NO_STR
3093 NEIGHBOR_STR
3094 NEIGHBOR_ADDR_STR
3095 "Specify a BGP neighbor\n"
3096 AS_STR)
3097
a80beece
DS
3098DEFUN (no_neighbor_interface_config,
3099 no_neighbor_interface_config_cmd,
4c48cf63 3100 "no neighbor WORD interface",
a80beece
DS
3101 NO_STR
3102 NEIGHBOR_STR
3103 "Interface name\n"
3104 "Configure BGP on interface\n")
3105{
3106 struct peer *peer;
3107
3108 /* look up for neighbor by interface name config. */
3109 peer = peer_lookup_by_conf_if (vty->index, argv[0]);
3110 if (peer)
3111 {
4a04e5f7 3112 /* Request zebra to terminate IPv6 RAs on this interface. */
3113 if (peer->ifp)
3114 bgp_zebra_terminate_radv (peer->bgp, peer);
a80beece
DS
3115 peer_delete (peer);
3116 }
3117 else
3118 {
3119 vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE);
3120 return CMD_WARNING;
3121 }
3122 return CMD_SUCCESS;
3123}
3124
4c48cf63
DW
3125ALIAS (no_neighbor_interface_config,
3126 no_neighbor_interface_config_peergroup_cmd,
3127 "no neighbor WORD interface peer-group WORD",
3128 NO_STR
3129 NEIGHBOR_STR
3130 "Interface name\n"
3131 "Configure BGP on interface\n"
3132 "Member of the peer-group\n"
3133 "peer-group name\n")
3134
3135ALIAS (no_neighbor_interface_config,
3136 no_neighbor_interface_config_v6only_cmd,
3137 "no neighbor WORD interface v6only",
3138 NO_STR
3139 NEIGHBOR_STR
3140 "Interface name\n"
3141 "Configure BGP on interface\n"
3142 "Enable BGP with v6 link-local only\n")
3143
3144ALIAS (no_neighbor_interface_config,
3145 no_neighbor_interface_config_v6only_peergroup_cmd,
3146 "no neighbor WORD interface v6only peer-group WORD",
3147 NO_STR
3148 NEIGHBOR_STR
3149 "Interface name\n"
3150 "Configure BGP on interface\n"
3151 "Enable BGP with v6 link-local only\n"
3152 "Member of the peer-group\n"
3153 "peer-group name\n")
3154
b3a39dc5
DD
3155ALIAS (no_neighbor_interface_config,
3156 no_neighbor_interface_config_remote_as_cmd,
3157 "no neighbor WORD interface remote-as (" CMD_AS_RANGE "|internal|external)",
3158 NO_STR
3159 NEIGHBOR_STR
3160 "Interface name\n"
3161 "Configure BGP on interface\n"
3162 AS_STR)
3163
3164ALIAS (no_neighbor_interface_config,
3165 no_neighbor_interface_config_v6only_remote_as_cmd,
3166 "no neighbor WORD interface v6only remote-as (" CMD_AS_RANGE "|internal|external)",
3167 NO_STR
3168 NEIGHBOR_STR
3169 "Interface name\n"
3170 "Configure BGP on interface\n"
3171 "Enable BGP with v6 link-local only\n"
3172 AS_STR)
4c48cf63 3173
718e3744 3174DEFUN (no_neighbor_peer_group,
3175 no_neighbor_peer_group_cmd,
3176 "no neighbor WORD peer-group",
3177 NO_STR
3178 NEIGHBOR_STR
3179 "Neighbor tag\n"
3180 "Configure peer-group\n")
3181{
3182 struct peer_group *group;
3183
3184 group = peer_group_lookup (vty->index, argv[0]);
3185 if (group)
3186 peer_group_delete (group);
3187 else
3188 {
3189 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
3190 return CMD_WARNING;
3191 }
3192 return CMD_SUCCESS;
3193}
3194
a80beece
DS
3195DEFUN (no_neighbor_interface_peer_group_remote_as,
3196 no_neighbor_interface_peer_group_remote_as_cmd,
0299c004 3197 "no neighbor WORD remote-as (" CMD_AS_RANGE "|internal|external)",
718e3744 3198 NO_STR
3199 NEIGHBOR_STR
a80beece 3200 "Interface name or neighbor tag\n"
718e3744 3201 "Specify a BGP neighbor\n"
3202 AS_STR)
3203{
3204 struct peer_group *group;
a80beece
DS
3205 struct peer *peer;
3206
3207 /* look up for neighbor by interface name config. */
3208 peer = peer_lookup_by_conf_if (vty->index, argv[0]);
3209 if (peer)
3210 {
0299c004 3211 peer_as_change (peer, 0, AS_SPECIFIED);
a80beece
DS
3212 return CMD_SUCCESS;
3213 }
718e3744 3214
3215 group = peer_group_lookup (vty->index, argv[0]);
3216 if (group)
3217 peer_group_remote_as_delete (group);
3218 else
3219 {
a80beece 3220 vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE);
718e3744 3221 return CMD_WARNING;
3222 }
3223 return CMD_SUCCESS;
3224}
6b0655a2 3225
718e3744 3226DEFUN (neighbor_local_as,
3227 neighbor_local_as_cmd,
320da874 3228 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
718e3744 3229 NEIGHBOR_STR
3230 NEIGHBOR_ADDR_STR2
3231 "Specify a local-as number\n"
3232 "AS number used as local AS\n")
3233{
3234 struct peer *peer;
3235 int ret;
3236
3237 peer = peer_and_group_lookup_vty (vty, argv[0]);
3238 if (! peer)
3239 return CMD_WARNING;
3240
9d3f9705 3241 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
718e3744 3242 return bgp_vty_return (vty, ret);
3243}
3244
3245DEFUN (neighbor_local_as_no_prepend,
3246 neighbor_local_as_no_prepend_cmd,
320da874 3247 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
718e3744 3248 NEIGHBOR_STR
3249 NEIGHBOR_ADDR_STR2
3250 "Specify a local-as number\n"
3251 "AS number used as local AS\n"
3252 "Do not prepend local-as to updates from ebgp peers\n")
3253{
3254 struct peer *peer;
3255 int ret;
3256
3257 peer = peer_and_group_lookup_vty (vty, argv[0]);
3258 if (! peer)
3259 return CMD_WARNING;
3260
9d3f9705 3261 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
718e3744 3262 return bgp_vty_return (vty, ret);
3263}
3264
9d3f9705
AC
3265DEFUN (neighbor_local_as_no_prepend_replace_as,
3266 neighbor_local_as_no_prepend_replace_as_cmd,
3267 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
3268 NEIGHBOR_STR
3269 NEIGHBOR_ADDR_STR2
3270 "Specify a local-as number\n"
3271 "AS number used as local AS\n"
3272 "Do not prepend local-as to updates from ebgp peers\n"
3273 "Do not prepend local-as to updates from ibgp peers\n")
3274{
3275 struct peer *peer;
3276 int ret;
3277
3278 peer = peer_and_group_lookup_vty (vty, argv[0]);
3279 if (! peer)
3280 return CMD_WARNING;
3281
3282 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
3283 return bgp_vty_return (vty, ret);
3284}
3285
3286
718e3744 3287DEFUN (no_neighbor_local_as,
3288 no_neighbor_local_as_cmd,
3289 NO_NEIGHBOR_CMD2 "local-as",
3290 NO_STR
3291 NEIGHBOR_STR
3292 NEIGHBOR_ADDR_STR2
3293 "Specify a local-as number\n")
3294{
3295 struct peer *peer;
3296 int ret;
3297
3298 peer = peer_and_group_lookup_vty (vty, argv[0]);
3299 if (! peer)
3300 return CMD_WARNING;
3301
3302 ret = peer_local_as_unset (peer);
3303 return bgp_vty_return (vty, ret);
3304}
3305
3306ALIAS (no_neighbor_local_as,
3307 no_neighbor_local_as_val_cmd,
320da874 3308 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
718e3744 3309 NO_STR
3310 NEIGHBOR_STR
3311 NEIGHBOR_ADDR_STR2
3312 "Specify a local-as number\n"
3313 "AS number used as local AS\n")
3314
3315ALIAS (no_neighbor_local_as,
3316 no_neighbor_local_as_val2_cmd,
320da874 3317 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
718e3744 3318 NO_STR
3319 NEIGHBOR_STR
3320 NEIGHBOR_ADDR_STR2
3321 "Specify a local-as number\n"
3322 "AS number used as local AS\n"
3323 "Do not prepend local-as to updates from ebgp peers\n")
9d3f9705
AC
3324
3325ALIAS (no_neighbor_local_as,
3326 no_neighbor_local_as_val3_cmd,
3327 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
3328 NO_STR
3329 NEIGHBOR_STR
3330 NEIGHBOR_ADDR_STR2
3331 "Specify a local-as number\n"
3332 "AS number used as local AS\n"
3333 "Do not prepend local-as to updates from ebgp peers\n"
3334 "Do not prepend local-as to updates from ibgp peers\n")
6b0655a2 3335
3f9c7369
DS
3336DEFUN (neighbor_solo,
3337 neighbor_solo_cmd,
3338 NEIGHBOR_CMD2 "solo",
3339 NEIGHBOR_STR
3340 NEIGHBOR_ADDR_STR2
3341 "Solo peer - part of its own update group\n")
3342{
3343 struct peer *peer;
3344 int ret;
3345
3346 peer = peer_and_group_lookup_vty (vty, argv[0]);
3347 if (! peer)
3348 return CMD_WARNING;
3349
3350 ret = update_group_adjust_soloness(peer, 1);
3351 return bgp_vty_return (vty, ret);
3352}
3353
3354DEFUN (no_neighbor_solo,
3355 no_neighbor_solo_cmd,
3356 NO_NEIGHBOR_CMD2 "solo",
3357 NO_STR
3358 NEIGHBOR_STR
3359 NEIGHBOR_ADDR_STR2
3360 "Solo peer - part of its own update group\n")
3361{
3362 struct peer *peer;
3363 int ret;
3364
3365 peer = peer_and_group_lookup_vty (vty, argv[0]);
3366 if (! peer)
3367 return CMD_WARNING;
3368
3369 ret = update_group_adjust_soloness(peer, 0);
3370 return bgp_vty_return (vty, ret);
3371}
3372
0df7c91f
PJ
3373DEFUN (neighbor_password,
3374 neighbor_password_cmd,
3375 NEIGHBOR_CMD2 "password LINE",
3376 NEIGHBOR_STR
3377 NEIGHBOR_ADDR_STR2
3378 "Set a password\n"
3379 "The password\n")
3380{
3381 struct peer *peer;
3382 int ret;
3383
3384 peer = peer_and_group_lookup_vty (vty, argv[0]);
3385 if (! peer)
3386 return CMD_WARNING;
3387
3388 ret = peer_password_set (peer, argv[1]);
3389 return bgp_vty_return (vty, ret);
3390}
3391
3392DEFUN (no_neighbor_password,
3393 no_neighbor_password_cmd,
3394 NO_NEIGHBOR_CMD2 "password",
3395 NO_STR
3396 NEIGHBOR_STR
3397 NEIGHBOR_ADDR_STR2
3398 "Set a password\n")
3399{
3400 struct peer *peer;
3401 int ret;
3402
3403 peer = peer_and_group_lookup_vty (vty, argv[0]);
3404 if (! peer)
3405 return CMD_WARNING;
3406
3407 ret = peer_password_unset (peer);
3408 return bgp_vty_return (vty, ret);
3409}
6b0655a2 3410
813d4307
DW
3411ALIAS (no_neighbor_password,
3412 no_neighbor_password_val_cmd,
3413 NO_NEIGHBOR_CMD2 "password LINE",
3414 NO_STR
3415 NEIGHBOR_STR
3416 NEIGHBOR_ADDR_STR2
3417 "Set a password\n"
3418 "The password\n")
3419
718e3744 3420DEFUN (neighbor_activate,
3421 neighbor_activate_cmd,
3422 NEIGHBOR_CMD2 "activate",
3423 NEIGHBOR_STR
3424 NEIGHBOR_ADDR_STR2
3425 "Enable the Address Family for this Neighbor\n")
3426{
c8560b44 3427 int ret;
718e3744 3428 struct peer *peer;
3429
3430 peer = peer_and_group_lookup_vty (vty, argv[0]);
3431 if (! peer)
3432 return CMD_WARNING;
3433
c8560b44 3434 ret = peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
718e3744 3435
c8560b44
DW
3436 if (ret)
3437 return CMD_WARNING;
718e3744 3438 return CMD_SUCCESS;
3439}
3440
3441DEFUN (no_neighbor_activate,
3442 no_neighbor_activate_cmd,
3443 NO_NEIGHBOR_CMD2 "activate",
3444 NO_STR
3445 NEIGHBOR_STR
3446 NEIGHBOR_ADDR_STR2
3447 "Enable the Address Family for this Neighbor\n")
3448{
3449 int ret;
3450 struct peer *peer;
3451
3452 /* Lookup peer. */
3453 peer = peer_and_group_lookup_vty (vty, argv[0]);
3454 if (! peer)
3455 return CMD_WARNING;
3456
3457 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
3458
c8560b44
DW
3459 if (ret)
3460 return CMD_WARNING;
3461 return CMD_SUCCESS;
718e3744 3462}
6b0655a2 3463
718e3744 3464DEFUN (neighbor_set_peer_group,
3465 neighbor_set_peer_group_cmd,
a80beece 3466 NEIGHBOR_CMD2 "peer-group WORD",
718e3744 3467 NEIGHBOR_STR
a80beece 3468 NEIGHBOR_ADDR_STR2
718e3744 3469 "Member of the peer-group\n"
3470 "peer-group name\n")
3471{
3472 int ret;
3473 as_t as;
3474 union sockunion su;
3475 struct bgp *bgp;
a80beece 3476 struct peer *peer;
718e3744 3477 struct peer_group *group;
3478
3479 bgp = vty->index;
a80beece 3480 peer = NULL;
718e3744 3481
3482 ret = str2sockunion (argv[0], &su);
3483 if (ret < 0)
3484 {
a80beece
DS
3485 peer = peer_lookup_by_conf_if (bgp, argv[0]);
3486 if (!peer)
3487 {
3488 vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE);
3489 return CMD_WARNING;
3490 }
3491 }
3492 else
3493 {
6aeb9e78 3494 if (peer_address_self_check (bgp, &su))
a80beece
DS
3495 {
3496 vty_out (vty, "%% Can not configure the local system as neighbor%s",
3497 VTY_NEWLINE);
3498 return CMD_WARNING;
3499 }
f14e6fdb
DS
3500
3501 /* Disallow for dynamic neighbor. */
3502 peer = peer_lookup (bgp, &su);
3503 if (peer && peer_dynamic_neighbor (peer))
3504 {
3505 vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
3506 VTY_NEWLINE);
3507 return CMD_WARNING;
3508 }
718e3744 3509 }
3510
3511 group = peer_group_lookup (bgp, argv[1]);
3512 if (! group)
3513 {
3514 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
3515 return CMD_WARNING;
3516 }
3517
c8560b44 3518 ret = peer_group_bind (bgp, &su, peer, group, &as);
718e3744 3519
3520 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
3521 {
aea339f7 3522 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);
718e3744 3523 return CMD_WARNING;
3524 }
3525
3526 return bgp_vty_return (vty, ret);
3527}
3528
3529DEFUN (no_neighbor_set_peer_group,
3530 no_neighbor_set_peer_group_cmd,
a80beece 3531 NO_NEIGHBOR_CMD2 "peer-group WORD",
718e3744 3532 NO_STR
3533 NEIGHBOR_STR
a80beece 3534 NEIGHBOR_ADDR_STR2
718e3744 3535 "Member of the peer-group\n"
3536 "peer-group name\n")
3537{
3538 int ret;
3539 struct bgp *bgp;
3540 struct peer *peer;
3541 struct peer_group *group;
3542
3543 bgp = vty->index;
3544
3545 peer = peer_lookup_vty (vty, argv[0]);
3546 if (! peer)
3547 return CMD_WARNING;
3548
3549 group = peer_group_lookup (bgp, argv[1]);
3550 if (! group)
3551 {
3552 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
3553 return CMD_WARNING;
3554 }
3555
c8560b44 3556 ret = peer_group_unbind (bgp, peer, group);
718e3744 3557
3558 return bgp_vty_return (vty, ret);
3559}
6b0655a2 3560
94f2b392 3561static int
fd79ac91 3562peer_flag_modify_vty (struct vty *vty, const char *ip_str,
3563 u_int16_t flag, int set)
718e3744 3564{
3565 int ret;
3566 struct peer *peer;
3567
3568 peer = peer_and_group_lookup_vty (vty, ip_str);
3569 if (! peer)
3570 return CMD_WARNING;
3571
8cdabf90
SK
3572 /*
3573 * If 'neighbor <interface>', then this is for directly connected peers,
3574 * we should not accept disable-connected-check.
3575 */
3576 if (peer->conf_if && (flag == PEER_FLAG_DISABLE_CONNECTED_CHECK)) {
3577 vty_out (vty, "%s is directly connected peer, cannot accept disable-"
3578 "connected-check%s", ip_str, VTY_NEWLINE);
3579 return CMD_WARNING;
3580 }
3581
718e3744 3582 if (set)
3583 ret = peer_flag_set (peer, flag);
3584 else
3585 ret = peer_flag_unset (peer, flag);
3586
3587 return bgp_vty_return (vty, ret);
3588}
3589
94f2b392 3590static int
fd79ac91 3591peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
718e3744 3592{
3593 return peer_flag_modify_vty (vty, ip_str, flag, 1);
3594}
3595
94f2b392 3596static int
fd79ac91 3597peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
718e3744 3598{
3599 return peer_flag_modify_vty (vty, ip_str, flag, 0);
3600}
3601
3602/* neighbor passive. */
3603DEFUN (neighbor_passive,
3604 neighbor_passive_cmd,
3605 NEIGHBOR_CMD2 "passive",
3606 NEIGHBOR_STR
3607 NEIGHBOR_ADDR_STR2
3608 "Don't send open messages to this neighbor\n")
3609{
3610 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
3611}
3612
3613DEFUN (no_neighbor_passive,
3614 no_neighbor_passive_cmd,
3615 NO_NEIGHBOR_CMD2 "passive",
3616 NO_STR
3617 NEIGHBOR_STR
3618 NEIGHBOR_ADDR_STR2
3619 "Don't send open messages to this neighbor\n")
3620{
3621 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
3622}
6b0655a2 3623
718e3744 3624/* neighbor shutdown. */
3625DEFUN (neighbor_shutdown,
3626 neighbor_shutdown_cmd,
3627 NEIGHBOR_CMD2 "shutdown",
3628 NEIGHBOR_STR
3629 NEIGHBOR_ADDR_STR2
3630 "Administratively shut down this neighbor\n")
3631{
3632 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
3633}
3634
3635DEFUN (no_neighbor_shutdown,
3636 no_neighbor_shutdown_cmd,
3637 NO_NEIGHBOR_CMD2 "shutdown",
3638 NO_STR
3639 NEIGHBOR_STR
3640 NEIGHBOR_ADDR_STR2
3641 "Administratively shut down this neighbor\n")
3642{
3643 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
3644}
6b0655a2 3645
718e3744 3646/* neighbor capability dynamic. */
3647DEFUN (neighbor_capability_dynamic,
3648 neighbor_capability_dynamic_cmd,
3649 NEIGHBOR_CMD2 "capability dynamic",
3650 NEIGHBOR_STR
3651 NEIGHBOR_ADDR_STR2
3652 "Advertise capability to the peer\n"
3653 "Advertise dynamic capability to this neighbor\n")
3654{
3655 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
3656}
3657
3658DEFUN (no_neighbor_capability_dynamic,
3659 no_neighbor_capability_dynamic_cmd,
3660 NO_NEIGHBOR_CMD2 "capability dynamic",
3661 NO_STR
3662 NEIGHBOR_STR
3663 NEIGHBOR_ADDR_STR2
3664 "Advertise capability to the peer\n"
3665 "Advertise dynamic capability to this neighbor\n")
3666{
3667 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
3668}
6b0655a2 3669
718e3744 3670/* neighbor dont-capability-negotiate */
3671DEFUN (neighbor_dont_capability_negotiate,
3672 neighbor_dont_capability_negotiate_cmd,
3673 NEIGHBOR_CMD2 "dont-capability-negotiate",
3674 NEIGHBOR_STR
3675 NEIGHBOR_ADDR_STR2
3676 "Do not perform capability negotiation\n")
3677{
3678 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
3679}
3680
3681DEFUN (no_neighbor_dont_capability_negotiate,
3682 no_neighbor_dont_capability_negotiate_cmd,
3683 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
3684 NO_STR
3685 NEIGHBOR_STR
3686 NEIGHBOR_ADDR_STR2
3687 "Do not perform capability negotiation\n")
3688{
3689 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
3690}
6b0655a2 3691
8a92a8a0
DS
3692/* neighbor capability extended next hop encoding */
3693DEFUN (neighbor_capability_enhe,
3694 neighbor_capability_enhe_cmd,
3695 NEIGHBOR_CMD2 "capability extended-nexthop",
3696 NEIGHBOR_STR
3697 NEIGHBOR_ADDR_STR2
3698 "Advertise capability to the peer\n"
3699 "Advertise extended next-hop capability to the peer\n")
3700{
3701 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE);
3702}
3703
3704DEFUN (no_neighbor_capability_enhe,
3705 no_neighbor_capability_enhe_cmd,
3706 NO_NEIGHBOR_CMD2 "capability extended-nexthop",
3707 NO_STR
3708 NEIGHBOR_STR
3709 NEIGHBOR_ADDR_STR2
3710 "Advertise capability to the peer\n"
3711 "Advertise extended next-hop capability to the peer\n")
3712{
3713 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE);
3714}
3715
94f2b392 3716static int
fd79ac91 3717peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
fee0f4c6 3718 safi_t safi, u_int32_t flag, int set)
718e3744 3719{
3720 int ret;
3721 struct peer *peer;
3722
3723 peer = peer_and_group_lookup_vty (vty, peer_str);
3724 if (! peer)
3725 return CMD_WARNING;
3726
3727 if (set)
3728 ret = peer_af_flag_set (peer, afi, safi, flag);
3729 else
3730 ret = peer_af_flag_unset (peer, afi, safi, flag);
3731
3732 return bgp_vty_return (vty, ret);
3733}
3734
94f2b392 3735static int
fd79ac91 3736peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
fee0f4c6 3737 safi_t safi, u_int32_t flag)
718e3744 3738{
3739 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
3740}
3741
94f2b392 3742static int
fd79ac91 3743peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
fee0f4c6 3744 safi_t safi, u_int32_t flag)
718e3744 3745{
3746 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
3747}
6b0655a2 3748
718e3744 3749/* neighbor capability orf prefix-list. */
3750DEFUN (neighbor_capability_orf_prefix,
3751 neighbor_capability_orf_prefix_cmd,
3752 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
3753 NEIGHBOR_STR
3754 NEIGHBOR_ADDR_STR2
3755 "Advertise capability to the peer\n"
3756 "Advertise ORF capability to the peer\n"
3757 "Advertise prefixlist ORF capability to this neighbor\n"
3758 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3759 "Capability to RECEIVE the ORF from this neighbor\n"
3760 "Capability to SEND the ORF to this neighbor\n")
3761{
3762 u_int16_t flag = 0;
3763
3764 if (strncmp (argv[1], "s", 1) == 0)
3765 flag = PEER_FLAG_ORF_PREFIX_SM;
3766 else if (strncmp (argv[1], "r", 1) == 0)
3767 flag = PEER_FLAG_ORF_PREFIX_RM;
3768 else if (strncmp (argv[1], "b", 1) == 0)
3769 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
3770 else
3771 return CMD_WARNING;
3772
3773 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3774 bgp_node_safi (vty), flag);
3775}
3776
3777DEFUN (no_neighbor_capability_orf_prefix,
3778 no_neighbor_capability_orf_prefix_cmd,
3779 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
3780 NO_STR
3781 NEIGHBOR_STR
3782 NEIGHBOR_ADDR_STR2
3783 "Advertise capability to the peer\n"
3784 "Advertise ORF capability to the peer\n"
3785 "Advertise prefixlist ORF capability to this neighbor\n"
3786 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3787 "Capability to RECEIVE the ORF from this neighbor\n"
3788 "Capability to SEND the ORF to this neighbor\n")
3789{
3790 u_int16_t flag = 0;
3791
3792 if (strncmp (argv[1], "s", 1) == 0)
3793 flag = PEER_FLAG_ORF_PREFIX_SM;
3794 else if (strncmp (argv[1], "r", 1) == 0)
3795 flag = PEER_FLAG_ORF_PREFIX_RM;
3796 else if (strncmp (argv[1], "b", 1) == 0)
3797 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
3798 else
3799 return CMD_WARNING;
3800
3801 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3802 bgp_node_safi (vty), flag);
3803}
6b0655a2 3804
718e3744 3805/* neighbor next-hop-self. */
3806DEFUN (neighbor_nexthop_self,
3807 neighbor_nexthop_self_cmd,
a538debe 3808 NEIGHBOR_CMD2 "next-hop-self",
718e3744 3809 NEIGHBOR_STR
3810 NEIGHBOR_ADDR_STR2
a538debe 3811 "Disable the next hop calculation for this neighbor\n")
718e3744 3812{
a538debe
DS
3813 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3814 bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
3815}
9e7a53c1 3816
a538debe
DS
3817/* neighbor next-hop-self. */
3818DEFUN (neighbor_nexthop_self_force,
3819 neighbor_nexthop_self_force_cmd,
3820 NEIGHBOR_CMD2 "next-hop-self force",
3821 NEIGHBOR_STR
3822 NEIGHBOR_ADDR_STR2
3823 "Disable the next hop calculation for this neighbor\n"
3824 "Set the next hop to self for reflected routes\n")
3825{
3826 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3827 bgp_node_safi (vty),
88b8ed8d 3828 PEER_FLAG_FORCE_NEXTHOP_SELF);
718e3744 3829}
3830
3831DEFUN (no_neighbor_nexthop_self,
3832 no_neighbor_nexthop_self_cmd,
a538debe 3833 NO_NEIGHBOR_CMD2 "next-hop-self",
718e3744 3834 NO_STR
3835 NEIGHBOR_STR
3836 NEIGHBOR_ADDR_STR2
a538debe 3837 "Disable the next hop calculation for this neighbor\n")
718e3744 3838{
3839 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
9e7a53c1 3840 bgp_node_safi (vty),
88b8ed8d 3841 PEER_FLAG_NEXTHOP_SELF);
718e3744 3842}
6b0655a2 3843
88b8ed8d 3844DEFUN (no_neighbor_nexthop_self_force,
a538debe
DS
3845 no_neighbor_nexthop_self_force_cmd,
3846 NO_NEIGHBOR_CMD2 "next-hop-self force",
3847 NO_STR
3848 NEIGHBOR_STR
3849 NEIGHBOR_ADDR_STR2
3850 "Disable the next hop calculation for this neighbor\n"
3851 "Set the next hop to self for reflected routes\n")
88b8ed8d
DW
3852{
3853 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3854 bgp_node_safi (vty),
3855 PEER_FLAG_FORCE_NEXTHOP_SELF);
3856}
a538debe 3857
c7122e14
DS
3858/* neighbor as-override */
3859DEFUN (neighbor_as_override,
3860 neighbor_as_override_cmd,
3861 NEIGHBOR_CMD2 "as-override",
3862 NEIGHBOR_STR
3863 NEIGHBOR_ADDR_STR2
3864 "Override ASNs in outbound updates if aspath equals remote-as\n")
3865{
3866 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3867 bgp_node_safi (vty),
3868 PEER_FLAG_AS_OVERRIDE);
3869}
3870
3871DEFUN (no_neighbor_as_override,
3872 no_neighbor_as_override_cmd,
3873 NO_NEIGHBOR_CMD2 "as-override",
3874 NO_STR
3875 NEIGHBOR_STR
3876 NEIGHBOR_ADDR_STR2
3877 "Override ASNs in outbound updates if aspath equals remote-as\n")
3878{
3879 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3880 bgp_node_safi (vty),
3881 PEER_FLAG_AS_OVERRIDE);
3882}
3883
718e3744 3884/* neighbor remove-private-AS. */
3885DEFUN (neighbor_remove_private_as,
3886 neighbor_remove_private_as_cmd,
3887 NEIGHBOR_CMD2 "remove-private-AS",
3888 NEIGHBOR_STR
3889 NEIGHBOR_ADDR_STR2
5000f21c 3890 "Remove private ASNs in outbound updates\n")
718e3744 3891{
3892 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3893 bgp_node_safi (vty),
3894 PEER_FLAG_REMOVE_PRIVATE_AS);
3895}
3896
5000f21c
DS
3897DEFUN (neighbor_remove_private_as_all,
3898 neighbor_remove_private_as_all_cmd,
3899 NEIGHBOR_CMD2 "remove-private-AS all",
3900 NEIGHBOR_STR
3901 NEIGHBOR_ADDR_STR2
3902 "Remove private ASNs in outbound updates\n"
3903 "Apply to all AS numbers")
3904{
5000f21c
DS
3905 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3906 bgp_node_safi (vty),
5000f21c
DS
3907 PEER_FLAG_REMOVE_PRIVATE_AS_ALL);
3908}
3909
3910DEFUN (neighbor_remove_private_as_replace_as,
3911 neighbor_remove_private_as_replace_as_cmd,
3912 NEIGHBOR_CMD2 "remove-private-AS replace-AS",
3913 NEIGHBOR_STR
3914 NEIGHBOR_ADDR_STR2
3915 "Remove private ASNs in outbound updates\n"
3916 "Replace private ASNs with our ASN in outbound updates\n")
3917{
5000f21c
DS
3918 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3919 bgp_node_safi (vty),
5000f21c
DS
3920 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE);
3921}
3922
3923DEFUN (neighbor_remove_private_as_all_replace_as,
3924 neighbor_remove_private_as_all_replace_as_cmd,
3925 NEIGHBOR_CMD2 "remove-private-AS all replace-AS",
3926 NEIGHBOR_STR
3927 NEIGHBOR_ADDR_STR2
3928 "Remove private ASNs in outbound updates\n"
3929 "Apply to all AS numbers"
3930 "Replace private ASNs with our ASN in outbound updates\n")
3931{
3932 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3933 bgp_node_safi (vty),
88b8ed8d 3934 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE);
5000f21c
DS
3935}
3936
718e3744 3937DEFUN (no_neighbor_remove_private_as,
3938 no_neighbor_remove_private_as_cmd,
3939 NO_NEIGHBOR_CMD2 "remove-private-AS",
3940 NO_STR
3941 NEIGHBOR_STR
3942 NEIGHBOR_ADDR_STR2
5000f21c 3943 "Remove private ASNs in outbound updates\n")
718e3744 3944{
3945 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3946 bgp_node_safi (vty),
88b8ed8d 3947 PEER_FLAG_REMOVE_PRIVATE_AS);
718e3744 3948}
6b0655a2 3949
88b8ed8d 3950DEFUN (no_neighbor_remove_private_as_all,
5000f21c
DS
3951 no_neighbor_remove_private_as_all_cmd,
3952 NO_NEIGHBOR_CMD2 "remove-private-AS all",
3953 NO_STR
3954 NEIGHBOR_STR
3955 NEIGHBOR_ADDR_STR2
3956 "Remove private ASNs in outbound updates\n"
3957 "Apply to all AS numbers")
88b8ed8d
DW
3958{
3959 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3960 bgp_node_safi (vty),
3961 PEER_FLAG_REMOVE_PRIVATE_AS_ALL);
3962}
5000f21c 3963
88b8ed8d 3964DEFUN (no_neighbor_remove_private_as_replace_as,
5000f21c
DS
3965 no_neighbor_remove_private_as_replace_as_cmd,
3966 NO_NEIGHBOR_CMD2 "remove-private-AS replace-AS",
3967 NO_STR
3968 NEIGHBOR_STR
3969 NEIGHBOR_ADDR_STR2
3970 "Remove private ASNs in outbound updates\n"
3971 "Replace private ASNs with our ASN in outbound updates\n")
88b8ed8d
DW
3972{
3973 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3974 bgp_node_safi (vty),
3975 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE);
3976}
5000f21c 3977
88b8ed8d 3978DEFUN (no_neighbor_remove_private_as_all_replace_as,
5000f21c
DS
3979 no_neighbor_remove_private_as_all_replace_as_cmd,
3980 NO_NEIGHBOR_CMD2 "remove-private-AS all replace-AS",
3981 NO_STR
3982 NEIGHBOR_STR
3983 NEIGHBOR_ADDR_STR2
3984 "Remove private ASNs in outbound updates\n"
3985 "Apply to all AS numbers"
3986 "Replace private ASNs with our ASN in outbound updates\n")
88b8ed8d
DW
3987{
3988 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3989 bgp_node_safi (vty),
3990 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE);
3991}
5000f21c
DS
3992
3993
718e3744 3994/* neighbor send-community. */
3995DEFUN (neighbor_send_community,
3996 neighbor_send_community_cmd,
3997 NEIGHBOR_CMD2 "send-community",
3998 NEIGHBOR_STR
3999 NEIGHBOR_ADDR_STR2
4000 "Send Community attribute to this neighbor\n")
4001{
4002 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4003 bgp_node_safi (vty),
4004 PEER_FLAG_SEND_COMMUNITY);
4005}
4006
4007DEFUN (no_neighbor_send_community,
4008 no_neighbor_send_community_cmd,
4009 NO_NEIGHBOR_CMD2 "send-community",
4010 NO_STR
4011 NEIGHBOR_STR
4012 NEIGHBOR_ADDR_STR2
4013 "Send Community attribute to this neighbor\n")
4014{
4015 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4016 bgp_node_safi (vty),
4017 PEER_FLAG_SEND_COMMUNITY);
4018}
6b0655a2 4019
718e3744 4020/* neighbor send-community extended. */
4021DEFUN (neighbor_send_community_type,
4022 neighbor_send_community_type_cmd,
4023 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
4024 NEIGHBOR_STR
4025 NEIGHBOR_ADDR_STR2
4026 "Send Community attribute to this neighbor\n"
4027 "Send Standard and Extended Community attributes\n"
4028 "Send Extended Community attributes\n"
4029 "Send Standard Community attributes\n")
4030{
4031 if (strncmp (argv[1], "s", 1) == 0)
4032 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4033 bgp_node_safi (vty),
4034 PEER_FLAG_SEND_COMMUNITY);
4035 if (strncmp (argv[1], "e", 1) == 0)
4036 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4037 bgp_node_safi (vty),
4038 PEER_FLAG_SEND_EXT_COMMUNITY);
4039
4040 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4041 bgp_node_safi (vty),
4042 (PEER_FLAG_SEND_COMMUNITY|
4043 PEER_FLAG_SEND_EXT_COMMUNITY));
4044}
4045
4046DEFUN (no_neighbor_send_community_type,
4047 no_neighbor_send_community_type_cmd,
4048 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
4049 NO_STR
4050 NEIGHBOR_STR
4051 NEIGHBOR_ADDR_STR2
4052 "Send Community attribute to this neighbor\n"
4053 "Send Standard and Extended Community attributes\n"
4054 "Send Extended Community attributes\n"
4055 "Send Standard Community attributes\n")
4056{
4057 if (strncmp (argv[1], "s", 1) == 0)
4058 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4059 bgp_node_safi (vty),
4060 PEER_FLAG_SEND_COMMUNITY);
4061 if (strncmp (argv[1], "e", 1) == 0)
4062 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4063 bgp_node_safi (vty),
4064 PEER_FLAG_SEND_EXT_COMMUNITY);
4065
4066 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4067 bgp_node_safi (vty),
4068 (PEER_FLAG_SEND_COMMUNITY |
4069 PEER_FLAG_SEND_EXT_COMMUNITY));
4070}
6b0655a2 4071
718e3744 4072/* neighbor soft-reconfig. */
4073DEFUN (neighbor_soft_reconfiguration,
4074 neighbor_soft_reconfiguration_cmd,
4075 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
4076 NEIGHBOR_STR
4077 NEIGHBOR_ADDR_STR2
4078 "Per neighbor soft reconfiguration\n"
4079 "Allow inbound soft reconfiguration for this neighbor\n")
4080{
4081 return peer_af_flag_set_vty (vty, argv[0],
4082 bgp_node_afi (vty), bgp_node_safi (vty),
4083 PEER_FLAG_SOFT_RECONFIG);
4084}
4085
4086DEFUN (no_neighbor_soft_reconfiguration,
4087 no_neighbor_soft_reconfiguration_cmd,
4088 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
4089 NO_STR
4090 NEIGHBOR_STR
4091 NEIGHBOR_ADDR_STR2
4092 "Per neighbor soft reconfiguration\n"
4093 "Allow inbound soft reconfiguration for this neighbor\n")
4094{
4095 return peer_af_flag_unset_vty (vty, argv[0],
4096 bgp_node_afi (vty), bgp_node_safi (vty),
4097 PEER_FLAG_SOFT_RECONFIG);
4098}
6b0655a2 4099
718e3744 4100DEFUN (neighbor_route_reflector_client,
4101 neighbor_route_reflector_client_cmd,
4102 NEIGHBOR_CMD2 "route-reflector-client",
4103 NEIGHBOR_STR
4104 NEIGHBOR_ADDR_STR2
4105 "Configure a neighbor as Route Reflector client\n")
4106{
4107 struct peer *peer;
4108
4109
4110 peer = peer_and_group_lookup_vty (vty, argv[0]);
4111 if (! peer)
4112 return CMD_WARNING;
4113
4114 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4115 bgp_node_safi (vty),
4116 PEER_FLAG_REFLECTOR_CLIENT);
4117}
4118
4119DEFUN (no_neighbor_route_reflector_client,
4120 no_neighbor_route_reflector_client_cmd,
4121 NO_NEIGHBOR_CMD2 "route-reflector-client",
4122 NO_STR
4123 NEIGHBOR_STR
4124 NEIGHBOR_ADDR_STR2
4125 "Configure a neighbor as Route Reflector client\n")
4126{
4127 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4128 bgp_node_safi (vty),
4129 PEER_FLAG_REFLECTOR_CLIENT);
4130}
6b0655a2 4131
718e3744 4132/* neighbor route-server-client. */
4133DEFUN (neighbor_route_server_client,
4134 neighbor_route_server_client_cmd,
4135 NEIGHBOR_CMD2 "route-server-client",
4136 NEIGHBOR_STR
4137 NEIGHBOR_ADDR_STR2
4138 "Configure a neighbor as Route Server client\n")
4139{
2a3d5731
DW
4140 struct peer *peer;
4141
4142 peer = peer_and_group_lookup_vty (vty, argv[0]);
4143 if (! peer)
4144 return CMD_WARNING;
4145 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4146 bgp_node_safi (vty),
4147 PEER_FLAG_RSERVER_CLIENT);
718e3744 4148}
4149
4150DEFUN (no_neighbor_route_server_client,
4151 no_neighbor_route_server_client_cmd,
4152 NO_NEIGHBOR_CMD2 "route-server-client",
4153 NO_STR
4154 NEIGHBOR_STR
4155 NEIGHBOR_ADDR_STR2
4156 "Configure a neighbor as Route Server client\n")
fee0f4c6 4157{
2a3d5731
DW
4158 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4159 bgp_node_safi (vty),
4160 PEER_FLAG_RSERVER_CLIENT);
fee0f4c6 4161}
6b0655a2 4162
fee0f4c6 4163DEFUN (neighbor_nexthop_local_unchanged,
4164 neighbor_nexthop_local_unchanged_cmd,
4165 NEIGHBOR_CMD2 "nexthop-local unchanged",
4166 NEIGHBOR_STR
4167 NEIGHBOR_ADDR_STR2
4168 "Configure treatment of outgoing link-local nexthop attribute\n"
4169 "Leave link-local nexthop unchanged for this peer\n")
4170{
4171 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4172 bgp_node_safi (vty),
4173 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
4174}
6b0655a2 4175
fee0f4c6 4176DEFUN (no_neighbor_nexthop_local_unchanged,
4177 no_neighbor_nexthop_local_unchanged_cmd,
4178 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
4179 NO_STR
4180 NEIGHBOR_STR
4181 NEIGHBOR_ADDR_STR2
4182 "Configure treatment of outgoing link-local-nexthop attribute\n"
4183 "Leave link-local nexthop unchanged for this peer\n")
718e3744 4184{
4185 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4186 bgp_node_safi (vty),
fee0f4c6 4187 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
718e3744 4188}
6b0655a2 4189
718e3744 4190DEFUN (neighbor_attr_unchanged,
4191 neighbor_attr_unchanged_cmd,
4192 NEIGHBOR_CMD2 "attribute-unchanged",
4193 NEIGHBOR_STR
4194 NEIGHBOR_ADDR_STR2
4195 "BGP attribute is propagated unchanged to this neighbor\n")
4196{
4197 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4198 bgp_node_safi (vty),
4199 (PEER_FLAG_AS_PATH_UNCHANGED |
4200 PEER_FLAG_NEXTHOP_UNCHANGED |
4201 PEER_FLAG_MED_UNCHANGED));
4202}
4203
4204DEFUN (neighbor_attr_unchanged1,
4205 neighbor_attr_unchanged1_cmd,
4206 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
4207 NEIGHBOR_STR
4208 NEIGHBOR_ADDR_STR2
4209 "BGP attribute is propagated unchanged to this neighbor\n"
4210 "As-path attribute\n"
4211 "Nexthop attribute\n"
4212 "Med attribute\n")
4213{
4214 u_int16_t flags = 0;
4215
4216 if (strncmp (argv[1], "as-path", 1) == 0)
4217 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4218 else if (strncmp (argv[1], "next-hop", 1) == 0)
4219 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4220 else if (strncmp (argv[1], "med", 1) == 0)
4221 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4222
4223 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4224 bgp_node_safi (vty), flags);
4225}
4226
4227DEFUN (neighbor_attr_unchanged2,
4228 neighbor_attr_unchanged2_cmd,
4229 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
4230 NEIGHBOR_STR
4231 NEIGHBOR_ADDR_STR2
4232 "BGP attribute is propagated unchanged to this neighbor\n"
4233 "As-path attribute\n"
4234 "Nexthop attribute\n"
4235 "Med attribute\n")
4236{
4237 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
4238
4239 if (strncmp (argv[1], "next-hop", 1) == 0)
4240 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4241 else if (strncmp (argv[1], "med", 1) == 0)
4242 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4243
4244 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4245 bgp_node_safi (vty), flags);
4246
4247}
4248
4249DEFUN (neighbor_attr_unchanged3,
4250 neighbor_attr_unchanged3_cmd,
4251 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
4252 NEIGHBOR_STR
4253 NEIGHBOR_ADDR_STR2
4254 "BGP attribute is propagated unchanged to this neighbor\n"
4255 "Nexthop attribute\n"
4256 "As-path attribute\n"
4257 "Med attribute\n")
4258{
4259 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
4260
4261 if (strncmp (argv[1], "as-path", 1) == 0)
4262 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4263 else if (strncmp (argv[1], "med", 1) == 0)
4264 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4265
4266 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4267 bgp_node_safi (vty), flags);
4268}
4269
4270DEFUN (neighbor_attr_unchanged4,
4271 neighbor_attr_unchanged4_cmd,
4272 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
4273 NEIGHBOR_STR
4274 NEIGHBOR_ADDR_STR2
4275 "BGP attribute is propagated unchanged to this neighbor\n"
4276 "Med attribute\n"
4277 "As-path attribute\n"
4278 "Nexthop attribute\n")
4279{
4280 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
4281
4282 if (strncmp (argv[1], "as-path", 1) == 0)
4283 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4284 else if (strncmp (argv[1], "next-hop", 1) == 0)
4285 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4286
4287 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4288 bgp_node_safi (vty), flags);
4289}
4290
4291ALIAS (neighbor_attr_unchanged,
4292 neighbor_attr_unchanged5_cmd,
4293 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
4294 NEIGHBOR_STR
4295 NEIGHBOR_ADDR_STR2
4296 "BGP attribute is propagated unchanged to this neighbor\n"
4297 "As-path attribute\n"
4298 "Nexthop attribute\n"
4299 "Med attribute\n")
4300
4301ALIAS (neighbor_attr_unchanged,
4302 neighbor_attr_unchanged6_cmd,
4303 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
4304 NEIGHBOR_STR
4305 NEIGHBOR_ADDR_STR2
4306 "BGP attribute is propagated unchanged to this neighbor\n"
4307 "As-path attribute\n"
4308 "Med attribute\n"
4309 "Nexthop attribute\n")
4310
4311ALIAS (neighbor_attr_unchanged,
4312 neighbor_attr_unchanged7_cmd,
4313 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
4314 NEIGHBOR_STR
4315 NEIGHBOR_ADDR_STR2
4316 "BGP attribute is propagated unchanged to this neighbor\n"
4317 "Nexthop attribute\n"
4318 "Med attribute\n"
4319 "As-path attribute\n")
4320
4321ALIAS (neighbor_attr_unchanged,
4322 neighbor_attr_unchanged8_cmd,
4323 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
4324 NEIGHBOR_STR
4325 NEIGHBOR_ADDR_STR2
4326 "BGP attribute is propagated unchanged to this neighbor\n"
4327 "Nexthop attribute\n"
4328 "As-path attribute\n"
4329 "Med attribute\n")
4330
4331ALIAS (neighbor_attr_unchanged,
4332 neighbor_attr_unchanged9_cmd,
4333 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
4334 NEIGHBOR_STR
4335 NEIGHBOR_ADDR_STR2
4336 "BGP attribute is propagated unchanged to this neighbor\n"
4337 "Med attribute\n"
4338 "Nexthop attribute\n"
4339 "As-path attribute\n")
4340
4341ALIAS (neighbor_attr_unchanged,
4342 neighbor_attr_unchanged10_cmd,
4343 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
4344 NEIGHBOR_STR
4345 NEIGHBOR_ADDR_STR2
4346 "BGP attribute is propagated unchanged to this neighbor\n"
4347 "Med attribute\n"
4348 "As-path attribute\n"
4349 "Nexthop attribute\n")
4350
4351DEFUN (no_neighbor_attr_unchanged,
4352 no_neighbor_attr_unchanged_cmd,
4353 NO_NEIGHBOR_CMD2 "attribute-unchanged",
4354 NO_STR
4355 NEIGHBOR_STR
4356 NEIGHBOR_ADDR_STR2
4357 "BGP attribute is propagated unchanged to this neighbor\n")
4358{
4359 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4360 bgp_node_safi (vty),
4361 (PEER_FLAG_AS_PATH_UNCHANGED |
4362 PEER_FLAG_NEXTHOP_UNCHANGED |
4363 PEER_FLAG_MED_UNCHANGED));
4364}
4365
4366DEFUN (no_neighbor_attr_unchanged1,
4367 no_neighbor_attr_unchanged1_cmd,
4368 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
4369 NO_STR
4370 NEIGHBOR_STR
4371 NEIGHBOR_ADDR_STR2
4372 "BGP attribute is propagated unchanged to this neighbor\n"
4373 "As-path attribute\n"
4374 "Nexthop attribute\n"
4375 "Med attribute\n")
4376{
4377 u_int16_t flags = 0;
4378
4379 if (strncmp (argv[1], "as-path", 1) == 0)
4380 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4381 else if (strncmp (argv[1], "next-hop", 1) == 0)
4382 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4383 else if (strncmp (argv[1], "med", 1) == 0)
4384 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4385
4386 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4387 bgp_node_safi (vty), flags);
4388}
4389
4390DEFUN (no_neighbor_attr_unchanged2,
4391 no_neighbor_attr_unchanged2_cmd,
4392 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
4393 NO_STR
4394 NEIGHBOR_STR
4395 NEIGHBOR_ADDR_STR2
4396 "BGP attribute is propagated unchanged to this neighbor\n"
4397 "As-path attribute\n"
4398 "Nexthop attribute\n"
4399 "Med attribute\n")
4400{
4401 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
4402
4403 if (strncmp (argv[1], "next-hop", 1) == 0)
4404 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4405 else if (strncmp (argv[1], "med", 1) == 0)
4406 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4407
4408 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4409 bgp_node_safi (vty), flags);
4410}
4411
4412DEFUN (no_neighbor_attr_unchanged3,
4413 no_neighbor_attr_unchanged3_cmd,
4414 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
4415 NO_STR
4416 NEIGHBOR_STR
4417 NEIGHBOR_ADDR_STR2
4418 "BGP attribute is propagated unchanged to this neighbor\n"
4419 "Nexthop attribute\n"
4420 "As-path attribute\n"
4421 "Med attribute\n")
4422{
4423 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
4424
4425 if (strncmp (argv[1], "as-path", 1) == 0)
4426 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4427 else if (strncmp (argv[1], "med", 1) == 0)
4428 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4429
4430 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4431 bgp_node_safi (vty), flags);
4432}
4433
4434DEFUN (no_neighbor_attr_unchanged4,
4435 no_neighbor_attr_unchanged4_cmd,
4436 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
4437 NO_STR
4438 NEIGHBOR_STR
4439 NEIGHBOR_ADDR_STR2
4440 "BGP attribute is propagated unchanged to this neighbor\n"
4441 "Med attribute\n"
4442 "As-path attribute\n"
4443 "Nexthop attribute\n")
4444{
4445 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
4446
4447 if (strncmp (argv[1], "as-path", 1) == 0)
4448 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4449 else if (strncmp (argv[1], "next-hop", 1) == 0)
4450 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4451
4452 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4453 bgp_node_safi (vty), flags);
4454}
4455
4456ALIAS (no_neighbor_attr_unchanged,
4457 no_neighbor_attr_unchanged5_cmd,
4458 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
4459 NO_STR
4460 NEIGHBOR_STR
4461 NEIGHBOR_ADDR_STR2
4462 "BGP attribute is propagated unchanged to this neighbor\n"
4463 "As-path attribute\n"
4464 "Nexthop attribute\n"
4465 "Med attribute\n")
4466
4467ALIAS (no_neighbor_attr_unchanged,
4468 no_neighbor_attr_unchanged6_cmd,
4469 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
4470 NO_STR
4471 NEIGHBOR_STR
4472 NEIGHBOR_ADDR_STR2
4473 "BGP attribute is propagated unchanged to this neighbor\n"
4474 "As-path attribute\n"
4475 "Med attribute\n"
4476 "Nexthop attribute\n")
4477
4478ALIAS (no_neighbor_attr_unchanged,
4479 no_neighbor_attr_unchanged7_cmd,
4480 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
4481 NO_STR
4482 NEIGHBOR_STR
4483 NEIGHBOR_ADDR_STR2
4484 "BGP attribute is propagated unchanged to this neighbor\n"
4485 "Nexthop attribute\n"
4486 "Med attribute\n"
4487 "As-path attribute\n")
4488
4489ALIAS (no_neighbor_attr_unchanged,
4490 no_neighbor_attr_unchanged8_cmd,
4491 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
4492 NO_STR
4493 NEIGHBOR_STR
4494 NEIGHBOR_ADDR_STR2
4495 "BGP attribute is propagated unchanged to this neighbor\n"
4496 "Nexthop attribute\n"
4497 "As-path attribute\n"
4498 "Med attribute\n")
4499
4500ALIAS (no_neighbor_attr_unchanged,
4501 no_neighbor_attr_unchanged9_cmd,
4502 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
4503 NO_STR
4504 NEIGHBOR_STR
4505 NEIGHBOR_ADDR_STR2
4506 "BGP attribute is propagated unchanged to this neighbor\n"
4507 "Med attribute\n"
4508 "Nexthop attribute\n"
4509 "As-path attribute\n")
4510
4511ALIAS (no_neighbor_attr_unchanged,
4512 no_neighbor_attr_unchanged10_cmd,
4513 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
4514 NO_STR
4515 NEIGHBOR_STR
4516 NEIGHBOR_ADDR_STR2
4517 "BGP attribute is propagated unchanged to this neighbor\n"
4518 "Med attribute\n"
4519 "As-path attribute\n"
4520 "Nexthop attribute\n")
4521
718e3744 4522/* EBGP multihop configuration. */
94f2b392 4523static int
fd79ac91 4524peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
4525 const char *ttl_str)
718e3744 4526{
4527 struct peer *peer;
fd79ac91 4528 unsigned int ttl;
718e3744 4529
4530 peer = peer_and_group_lookup_vty (vty, ip_str);
4531 if (! peer)
4532 return CMD_WARNING;
4533
63fa10b5
QY
4534 if (peer->conf_if)
4535 return bgp_vty_return (vty, BGP_ERR_INVALID_FOR_DIRECT_PEER);
4536
718e3744 4537 if (! ttl_str)
9b1be336 4538 ttl = MAXTTL;
718e3744 4539 else
9b1be336 4540 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, MAXTTL);
718e3744 4541
89b6d1f8 4542 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
718e3744 4543}
4544
94f2b392 4545static int
fd79ac91 4546peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
718e3744 4547{
4548 struct peer *peer;
4549
4550 peer = peer_and_group_lookup_vty (vty, ip_str);
4551 if (! peer)
4552 return CMD_WARNING;
4553
89b6d1f8 4554 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
718e3744 4555}
4556
4557/* neighbor ebgp-multihop. */
4558DEFUN (neighbor_ebgp_multihop,
4559 neighbor_ebgp_multihop_cmd,
4560 NEIGHBOR_CMD2 "ebgp-multihop",
4561 NEIGHBOR_STR
4562 NEIGHBOR_ADDR_STR2
4563 "Allow EBGP neighbors not on directly connected networks\n")
4564{
4565 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
4566}
4567
4568DEFUN (neighbor_ebgp_multihop_ttl,
4569 neighbor_ebgp_multihop_ttl_cmd,
9b1be336 4570 NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL),
718e3744 4571 NEIGHBOR_STR
4572 NEIGHBOR_ADDR_STR2
4573 "Allow EBGP neighbors not on directly connected networks\n"
4574 "maximum hop count\n")
4575{
4576 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
4577}
4578
4579DEFUN (no_neighbor_ebgp_multihop,
4580 no_neighbor_ebgp_multihop_cmd,
4581 NO_NEIGHBOR_CMD2 "ebgp-multihop",
4582 NO_STR
4583 NEIGHBOR_STR
4584 NEIGHBOR_ADDR_STR2
4585 "Allow EBGP neighbors not on directly connected networks\n")
4586{
4587 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
4588}
4589
4590ALIAS (no_neighbor_ebgp_multihop,
4591 no_neighbor_ebgp_multihop_ttl_cmd,
9b1be336 4592 NO_NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL),
718e3744 4593 NO_STR
4594 NEIGHBOR_STR
4595 NEIGHBOR_ADDR_STR2
4596 "Allow EBGP neighbors not on directly connected networks\n"
4597 "maximum hop count\n")
6b0655a2 4598
6ffd2079 4599/* disable-connected-check */
4600DEFUN (neighbor_disable_connected_check,
4601 neighbor_disable_connected_check_cmd,
4602 NEIGHBOR_CMD2 "disable-connected-check",
4603 NEIGHBOR_STR
4604 NEIGHBOR_ADDR_STR2
4605 "one-hop away EBGP peer using loopback address\n")
4606{
4607 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
4608}
4609
4610DEFUN (no_neighbor_disable_connected_check,
4611 no_neighbor_disable_connected_check_cmd,
4612 NO_NEIGHBOR_CMD2 "disable-connected-check",
4613 NO_STR
4614 NEIGHBOR_STR
4615 NEIGHBOR_ADDR_STR2
4616 "one-hop away EBGP peer using loopback address\n")
4617{
4618 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
4619}
4620
718e3744 4621/* Enforce multihop. */
6ffd2079 4622ALIAS (neighbor_disable_connected_check,
718e3744 4623 neighbor_enforce_multihop_cmd,
4624 NEIGHBOR_CMD2 "enforce-multihop",
4625 NEIGHBOR_STR
4626 NEIGHBOR_ADDR_STR2
e8e1946e 4627 "Enforce EBGP neighbors perform multihop\n")
718e3744 4628
6ffd2079 4629/* Enforce multihop. */
4630ALIAS (no_neighbor_disable_connected_check,
718e3744 4631 no_neighbor_enforce_multihop_cmd,
4632 NO_NEIGHBOR_CMD2 "enforce-multihop",
4633 NO_STR
4634 NEIGHBOR_STR
4635 NEIGHBOR_ADDR_STR2
e8e1946e 4636 "Enforce EBGP neighbors perform multihop\n")
6b0655a2 4637
718e3744 4638DEFUN (neighbor_description,
4639 neighbor_description_cmd,
4640 NEIGHBOR_CMD2 "description .LINE",
4641 NEIGHBOR_STR
4642 NEIGHBOR_ADDR_STR2
4643 "Neighbor specific description\n"
4644 "Up to 80 characters describing this neighbor\n")
4645{
4646 struct peer *peer;
718e3744 4647 char *str;
718e3744 4648
4649 peer = peer_and_group_lookup_vty (vty, argv[0]);
4650 if (! peer)
4651 return CMD_WARNING;
4652
4653 if (argc == 1)
4654 return CMD_SUCCESS;
4655
3b8b1855 4656 str = argv_concat(argv, argc, 1);
718e3744 4657
4658 peer_description_set (peer, str);
4659
3b8b1855 4660 XFREE (MTYPE_TMP, str);
718e3744 4661
4662 return CMD_SUCCESS;
4663}
4664
4665DEFUN (no_neighbor_description,
4666 no_neighbor_description_cmd,
4667 NO_NEIGHBOR_CMD2 "description",
4668 NO_STR
4669 NEIGHBOR_STR
4670 NEIGHBOR_ADDR_STR2
4671 "Neighbor specific description\n")
4672{
4673 struct peer *peer;
4674
4675 peer = peer_and_group_lookup_vty (vty, argv[0]);
4676 if (! peer)
4677 return CMD_WARNING;
4678
4679 peer_description_unset (peer);
4680
4681 return CMD_SUCCESS;
4682}
4683
4684ALIAS (no_neighbor_description,
4685 no_neighbor_description_val_cmd,
4686 NO_NEIGHBOR_CMD2 "description .LINE",
4687 NO_STR
4688 NEIGHBOR_STR
4689 NEIGHBOR_ADDR_STR2
4690 "Neighbor specific description\n"
4691 "Up to 80 characters describing this neighbor\n")
6b0655a2 4692
718e3744 4693/* Neighbor update-source. */
94f2b392 4694static int
fd79ac91 4695peer_update_source_vty (struct vty *vty, const char *peer_str,
4696 const char *source_str)
718e3744 4697{
4698 struct peer *peer;
718e3744 4699
4700 peer = peer_and_group_lookup_vty (vty, peer_str);
4701 if (! peer)
4702 return CMD_WARNING;
4703
a80beece
DS
4704 if (peer->conf_if)
4705 return CMD_WARNING;
4706
718e3744 4707 if (source_str)
4708 {
c63b83fe
JBD
4709 union sockunion su;
4710 int ret = str2sockunion (source_str, &su);
4711
4712 if (ret == 0)
4713 peer_update_source_addr_set (peer, &su);
718e3744 4714 else
4715 peer_update_source_if_set (peer, source_str);
4716 }
4717 else
4718 peer_update_source_unset (peer);
4719
4720 return CMD_SUCCESS;
4721}
4722
dcb52bd5
DS
4723#define BGP_UPDATE_SOURCE_STR "A.B.C.D|X:X::X:X|WORD"
4724#define BGP_UPDATE_SOURCE_REQ_STR "(" BGP_UPDATE_SOURCE_STR ")"
4725#define BGP_UPDATE_SOURCE_OPT_STR "{" BGP_UPDATE_SOURCE_STR "}"
369688c0
PJ
4726#define BGP_UPDATE_SOURCE_HELP_STR \
4727 "IPv4 address\n" \
9a1a331d
PJ
4728 "IPv6 address\n" \
4729 "Interface name (requires zebra to be running)\n"
369688c0 4730
718e3744 4731DEFUN (neighbor_update_source,
4732 neighbor_update_source_cmd,
dcb52bd5 4733 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_REQ_STR,
718e3744 4734 NEIGHBOR_STR
4735 NEIGHBOR_ADDR_STR2
4736 "Source of routing updates\n"
369688c0 4737 BGP_UPDATE_SOURCE_HELP_STR)
718e3744 4738{
4739 return peer_update_source_vty (vty, argv[0], argv[1]);
4740}
4741
4742DEFUN (no_neighbor_update_source,
4743 no_neighbor_update_source_cmd,
dcb52bd5 4744 NO_NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_OPT_STR,
718e3744 4745 NO_STR
4746 NEIGHBOR_STR
4747 NEIGHBOR_ADDR_STR2
dcb52bd5
DS
4748 "Source of routing updates\n"
4749 BGP_UPDATE_SOURCE_HELP_STR)
718e3744 4750{
4751 return peer_update_source_vty (vty, argv[0], NULL);
4752}
6b0655a2 4753
94f2b392 4754static int
fd79ac91 4755peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
4756 afi_t afi, safi_t safi,
4757 const char *rmap, int set)
718e3744 4758{
4759 int ret;
4760 struct peer *peer;
4761
4762 peer = peer_and_group_lookup_vty (vty, peer_str);
4763 if (! peer)
4764 return CMD_WARNING;
4765
4766 if (set)
4767 ret = peer_default_originate_set (peer, afi, safi, rmap);
4768 else
4769 ret = peer_default_originate_unset (peer, afi, safi);
4770
4771 return bgp_vty_return (vty, ret);
4772}
4773
4774/* neighbor default-originate. */
4775DEFUN (neighbor_default_originate,
4776 neighbor_default_originate_cmd,
4777 NEIGHBOR_CMD2 "default-originate",
4778 NEIGHBOR_STR
4779 NEIGHBOR_ADDR_STR2
4780 "Originate default route to this neighbor\n")
4781{
4782 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
4783 bgp_node_safi (vty), NULL, 1);
4784}
4785
4786DEFUN (neighbor_default_originate_rmap,
4787 neighbor_default_originate_rmap_cmd,
4788 NEIGHBOR_CMD2 "default-originate route-map WORD",
4789 NEIGHBOR_STR
4790 NEIGHBOR_ADDR_STR2
4791 "Originate default route to this neighbor\n"
4792 "Route-map to specify criteria to originate default\n"
4793 "route-map name\n")
4794{
4795 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
4796 bgp_node_safi (vty), argv[1], 1);
4797}
4798
4799DEFUN (no_neighbor_default_originate,
4800 no_neighbor_default_originate_cmd,
4801 NO_NEIGHBOR_CMD2 "default-originate",
4802 NO_STR
4803 NEIGHBOR_STR
4804 NEIGHBOR_ADDR_STR2
4805 "Originate default route to this neighbor\n")
4806{
4807 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
4808 bgp_node_safi (vty), NULL, 0);
4809}
4810
4811ALIAS (no_neighbor_default_originate,
4812 no_neighbor_default_originate_rmap_cmd,
4813 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
4814 NO_STR
4815 NEIGHBOR_STR
4816 NEIGHBOR_ADDR_STR2
4817 "Originate default route to this neighbor\n"
4818 "Route-map to specify criteria to originate default\n"
4819 "route-map name\n")
6b0655a2 4820
718e3744 4821/* Set neighbor's BGP port. */
94f2b392 4822static int
fd79ac91 4823peer_port_vty (struct vty *vty, const char *ip_str, int afi,
4824 const char *port_str)
718e3744 4825{
4826 struct peer *peer;
4827 u_int16_t port;
4828 struct servent *sp;
4829
4830 peer = peer_lookup_vty (vty, ip_str);
4831 if (! peer)
4832 return CMD_WARNING;
4833
4834 if (! port_str)
4835 {
4836 sp = getservbyname ("bgp", "tcp");
4837 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
4838 }
4839 else
4840 {
4841 VTY_GET_INTEGER("port", port, port_str);
4842 }
4843
4844 peer_port_set (peer, port);
4845
4846 return CMD_SUCCESS;
4847}
4848
f418446b 4849/* Set specified peer's BGP port. */
718e3744 4850DEFUN (neighbor_port,
4851 neighbor_port_cmd,
4852 NEIGHBOR_CMD "port <0-65535>",
4853 NEIGHBOR_STR
4854 NEIGHBOR_ADDR_STR
4855 "Neighbor's BGP port\n"
4856 "TCP port number\n")
4857{
4858 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
4859}
4860
4861DEFUN (no_neighbor_port,
4862 no_neighbor_port_cmd,
4863 NO_NEIGHBOR_CMD "port",
4864 NO_STR
4865 NEIGHBOR_STR
4866 NEIGHBOR_ADDR_STR
4867 "Neighbor's BGP port\n")
4868{
4869 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
4870}
4871
4872ALIAS (no_neighbor_port,
4873 no_neighbor_port_val_cmd,
4874 NO_NEIGHBOR_CMD "port <0-65535>",
4875 NO_STR
4876 NEIGHBOR_STR
4877 NEIGHBOR_ADDR_STR
4878 "Neighbor's BGP port\n"
4879 "TCP port number\n")
6b0655a2 4880
718e3744 4881/* neighbor weight. */
94f2b392 4882static int
fd79ac91 4883peer_weight_set_vty (struct vty *vty, const char *ip_str,
4884 const char *weight_str)
718e3744 4885{
1f9a9fff 4886 int ret;
718e3744 4887 struct peer *peer;
4888 unsigned long weight;
4889
4890 peer = peer_and_group_lookup_vty (vty, ip_str);
4891 if (! peer)
4892 return CMD_WARNING;
4893
4894 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
4895
1f9a9fff
PJ
4896 ret = peer_weight_set (peer, weight);
4897 return bgp_vty_return (vty, ret);
718e3744 4898}
4899
94f2b392 4900static int
fd79ac91 4901peer_weight_unset_vty (struct vty *vty, const char *ip_str)
718e3744 4902{
1f9a9fff 4903 int ret;
718e3744 4904 struct peer *peer;
4905
4906 peer = peer_and_group_lookup_vty (vty, ip_str);
4907 if (! peer)
4908 return CMD_WARNING;
4909
1f9a9fff
PJ
4910 ret = peer_weight_unset (peer);
4911 return bgp_vty_return (vty, ret);
718e3744 4912}
4913
4914DEFUN (neighbor_weight,
4915 neighbor_weight_cmd,
4916 NEIGHBOR_CMD2 "weight <0-65535>",
4917 NEIGHBOR_STR
4918 NEIGHBOR_ADDR_STR2
4919 "Set default weight for routes from this neighbor\n"
4920 "default weight\n")
4921{
4922 return peer_weight_set_vty (vty, argv[0], argv[1]);
4923}
4924
4925DEFUN (no_neighbor_weight,
4926 no_neighbor_weight_cmd,
4927 NO_NEIGHBOR_CMD2 "weight",
4928 NO_STR
4929 NEIGHBOR_STR
4930 NEIGHBOR_ADDR_STR2
4931 "Set default weight for routes from this neighbor\n")
4932{
4933 return peer_weight_unset_vty (vty, argv[0]);
4934}
4935
4936ALIAS (no_neighbor_weight,
4937 no_neighbor_weight_val_cmd,
4938 NO_NEIGHBOR_CMD2 "weight <0-65535>",
4939 NO_STR
4940 NEIGHBOR_STR
4941 NEIGHBOR_ADDR_STR2
4942 "Set default weight for routes from this neighbor\n"
4943 "default weight\n")
6b0655a2 4944
718e3744 4945/* Override capability negotiation. */
4946DEFUN (neighbor_override_capability,
4947 neighbor_override_capability_cmd,
4948 NEIGHBOR_CMD2 "override-capability",
4949 NEIGHBOR_STR
4950 NEIGHBOR_ADDR_STR2
4951 "Override capability negotiation result\n")
4952{
4953 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
4954}
4955
4956DEFUN (no_neighbor_override_capability,
4957 no_neighbor_override_capability_cmd,
4958 NO_NEIGHBOR_CMD2 "override-capability",
4959 NO_STR
4960 NEIGHBOR_STR
4961 NEIGHBOR_ADDR_STR2
4962 "Override capability negotiation result\n")
4963{
4964 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
4965}
6b0655a2 4966
718e3744 4967DEFUN (neighbor_strict_capability,
4968 neighbor_strict_capability_cmd,
4969 NEIGHBOR_CMD "strict-capability-match",
4970 NEIGHBOR_STR
4971 NEIGHBOR_ADDR_STR
4972 "Strict capability negotiation match\n")
4973{
4974 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
4975}
4976
4977DEFUN (no_neighbor_strict_capability,
4978 no_neighbor_strict_capability_cmd,
4979 NO_NEIGHBOR_CMD "strict-capability-match",
4980 NO_STR
4981 NEIGHBOR_STR
4982 NEIGHBOR_ADDR_STR
4983 "Strict capability negotiation match\n")
4984{
4985 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
4986}
6b0655a2 4987
94f2b392 4988static int
fd79ac91 4989peer_timers_set_vty (struct vty *vty, const char *ip_str,
4990 const char *keep_str, const char *hold_str)
718e3744 4991{
4992 int ret;
4993 struct peer *peer;
4994 u_int32_t keepalive;
4995 u_int32_t holdtime;
4996
4997 peer = peer_and_group_lookup_vty (vty, ip_str);
4998 if (! peer)
4999 return CMD_WARNING;
5000
5001 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
5002 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
5003
5004 ret = peer_timers_set (peer, keepalive, holdtime);
5005
5006 return bgp_vty_return (vty, ret);
5007}
6b0655a2 5008
94f2b392 5009static int
fd79ac91 5010peer_timers_unset_vty (struct vty *vty, const char *ip_str)
718e3744 5011{
5012 int ret;
5013 struct peer *peer;
5014
0c412461 5015 peer = peer_and_group_lookup_vty (vty, ip_str);
718e3744 5016 if (! peer)
5017 return CMD_WARNING;
5018
5019 ret = peer_timers_unset (peer);
5020
5021 return bgp_vty_return (vty, ret);
5022}
5023
5024DEFUN (neighbor_timers,
5025 neighbor_timers_cmd,
5026 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
5027 NEIGHBOR_STR
5028 NEIGHBOR_ADDR_STR2
5029 "BGP per neighbor timers\n"
5030 "Keepalive interval\n"
5031 "Holdtime\n")
5032{
5033 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
5034}
5035
5036DEFUN (no_neighbor_timers,
5037 no_neighbor_timers_cmd,
5038 NO_NEIGHBOR_CMD2 "timers",
5039 NO_STR
5040 NEIGHBOR_STR
5041 NEIGHBOR_ADDR_STR2
5042 "BGP per neighbor timers\n")
5043{
5044 return peer_timers_unset_vty (vty, argv[0]);
5045}
6b0655a2 5046
813d4307
DW
5047ALIAS (no_neighbor_timers,
5048 no_neighbor_timers_val_cmd,
5049 NO_NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
5050 NO_STR
5051 NEIGHBOR_STR
5052 NEIGHBOR_ADDR_STR2
5053 "BGP per neighbor timers\n"
5054 "Keepalive interval\n"
5055 "Holdtime\n")
5056
94f2b392 5057static int
fd79ac91 5058peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
5059 const char *time_str)
718e3744 5060{
5061 int ret;
5062 struct peer *peer;
5063 u_int32_t connect;
5064
966f821c 5065 peer = peer_and_group_lookup_vty (vty, ip_str);
718e3744 5066 if (! peer)
5067 return CMD_WARNING;
5068
5069 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
5070
5071 ret = peer_timers_connect_set (peer, connect);
5072
966f821c 5073 return bgp_vty_return (vty, ret);
718e3744 5074}
5075
94f2b392 5076static int
fd79ac91 5077peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
718e3744 5078{
5079 int ret;
5080 struct peer *peer;
5081
5082 peer = peer_and_group_lookup_vty (vty, ip_str);
5083 if (! peer)
5084 return CMD_WARNING;
5085
5086 ret = peer_timers_connect_unset (peer);
5087
966f821c 5088 return bgp_vty_return (vty, ret);
718e3744 5089}
5090
5091DEFUN (neighbor_timers_connect,
5092 neighbor_timers_connect_cmd,
8e0d0089 5093 NEIGHBOR_CMD2 "timers connect <1-65535>",
718e3744 5094 NEIGHBOR_STR
966f821c 5095 NEIGHBOR_ADDR_STR2
718e3744 5096 "BGP per neighbor timers\n"
5097 "BGP connect timer\n"
5098 "Connect timer\n")
5099{
5100 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
5101}
5102
5103DEFUN (no_neighbor_timers_connect,
5104 no_neighbor_timers_connect_cmd,
966f821c 5105 NO_NEIGHBOR_CMD2 "timers connect",
718e3744 5106 NO_STR
5107 NEIGHBOR_STR
966f821c 5108 NEIGHBOR_ADDR_STR2
718e3744 5109 "BGP per neighbor timers\n"
5110 "BGP connect timer\n")
5111{
5112 return peer_timers_connect_unset_vty (vty, argv[0]);
5113}
5114
5115ALIAS (no_neighbor_timers_connect,
5116 no_neighbor_timers_connect_val_cmd,
8e0d0089 5117 NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
718e3744 5118 NO_STR
5119 NEIGHBOR_STR
966f821c 5120 NEIGHBOR_ADDR_STR2
718e3744 5121 "BGP per neighbor timers\n"
5122 "BGP connect timer\n"
5123 "Connect timer\n")
6b0655a2 5124
94f2b392 5125static int
fd79ac91 5126peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
5127 const char *time_str, int set)
718e3744 5128{
5129 int ret;
5130 struct peer *peer;
5131 u_int32_t routeadv = 0;
5132
966f821c 5133 peer = peer_and_group_lookup_vty (vty, ip_str);
718e3744 5134 if (! peer)
5135 return CMD_WARNING;
5136
5137 if (time_str)
5138 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
5139
5140 if (set)
5141 ret = peer_advertise_interval_set (peer, routeadv);
5142 else
5143 ret = peer_advertise_interval_unset (peer);
5144
966f821c 5145 return bgp_vty_return (vty, ret);
718e3744 5146}
5147
5148DEFUN (neighbor_advertise_interval,
5149 neighbor_advertise_interval_cmd,
966f821c 5150 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
718e3744 5151 NEIGHBOR_STR
966f821c 5152 NEIGHBOR_ADDR_STR2
718e3744 5153 "Minimum interval between sending BGP routing updates\n"
5154 "time in seconds\n")
5155{
5156 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
5157}
5158
5159DEFUN (no_neighbor_advertise_interval,
5160 no_neighbor_advertise_interval_cmd,
966f821c 5161 NO_NEIGHBOR_CMD2 "advertisement-interval",
718e3744 5162 NO_STR
5163 NEIGHBOR_STR
966f821c 5164 NEIGHBOR_ADDR_STR2
718e3744 5165 "Minimum interval between sending BGP routing updates\n")
5166{
5167 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
5168}
5169
5170ALIAS (no_neighbor_advertise_interval,
5171 no_neighbor_advertise_interval_val_cmd,
966f821c 5172 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
718e3744 5173 NO_STR
5174 NEIGHBOR_STR
966f821c 5175 NEIGHBOR_ADDR_STR2
718e3744 5176 "Minimum interval between sending BGP routing updates\n"
5177 "time in seconds\n")
6b0655a2 5178
518f0eb1
DS
5179/* Time to wait before processing route-map updates */
5180DEFUN (bgp_set_route_map_delay_timer,
5181 bgp_set_route_map_delay_timer_cmd,
5182 "bgp route-map delay-timer <0-600>",
5183 SET_STR
5184 "BGP route-map delay timer\n"
5185 "Time in secs to wait before processing route-map changes\n"
f414725f 5186 "0 disables the timer, no route updates happen when route-maps change\n")
518f0eb1
DS
5187{
5188 u_int32_t rmap_delay_timer;
518f0eb1 5189
518f0eb1
DS
5190 if (argv[0])
5191 {
5192 VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600);
5fe9f963 5193 bm->rmap_update_timer = rmap_delay_timer;
518f0eb1
DS
5194
5195 /* if the dynamic update handling is being disabled, and a timer is
5196 * running, stop the timer and act as if the timer has already fired.
5197 */
5fe9f963 5198 if (!rmap_delay_timer && bm->t_rmap_update )
518f0eb1 5199 {
5fe9f963 5200 BGP_TIMER_OFF(bm->t_rmap_update);
5201 thread_execute (bm->master, bgp_route_map_update_timer, NULL, 0);
518f0eb1
DS
5202 }
5203 return CMD_SUCCESS;
5204 }
5205 else
ffd0c037 5206 return CMD_WARNING;
518f0eb1
DS
5207}
5208
5209DEFUN (no_bgp_set_route_map_delay_timer,
5210 no_bgp_set_route_map_delay_timer_cmd,
5211 "no bgp route-map delay-timer",
5212 NO_STR
5213 "Default BGP route-map delay timer\n"
f414725f 5214 "Reset to default time to wait for processing route-map changes\n")
518f0eb1 5215{
518f0eb1 5216
5fe9f963 5217 bm->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER;
518f0eb1
DS
5218
5219 return CMD_SUCCESS;
5220}
5221
f414725f
DS
5222ALIAS (no_bgp_set_route_map_delay_timer,
5223 no_bgp_set_route_map_delay_timer_val_cmd,
5224 "no bgp route-map delay-timer <0-600>",
5225 NO_STR
5226 "Default BGP route-map delay timer\n"
5227 "Reset to default time to wait for processing route-map changes\n"
5228 "0 disables the timer, no route updates happen when route-maps change\n")
5229
718e3744 5230/* neighbor interface */
94f2b392 5231static int
fd79ac91 5232peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
718e3744 5233{
718e3744 5234 struct peer *peer;
5235
5236 peer = peer_lookup_vty (vty, ip_str);
a80beece 5237 if (! peer || peer->conf_if)
718e3744 5238 return CMD_WARNING;
5239
5240 if (str)
ffd0c037 5241 peer_interface_set (peer, str);
718e3744 5242 else
ffd0c037 5243 peer_interface_unset (peer);
718e3744 5244
5245 return CMD_SUCCESS;
5246}
5247
5248DEFUN (neighbor_interface,
5249 neighbor_interface_cmd,
5250 NEIGHBOR_CMD "interface WORD",
5251 NEIGHBOR_STR
5252 NEIGHBOR_ADDR_STR
5253 "Interface\n"
5254 "Interface name\n")
5255{
8ffedcea
DS
5256 if (argc == 3)
5257 return peer_interface_vty (vty, argv[0], argv[1]);
5258 else
5259 return peer_interface_vty (vty, argv[0], argv[1]);
718e3744 5260}
5261
5262DEFUN (no_neighbor_interface,
5263 no_neighbor_interface_cmd,
8ffedcea 5264 NO_NEIGHBOR_CMD2 "interface WORD",
718e3744 5265 NO_STR
5266 NEIGHBOR_STR
5267 NEIGHBOR_ADDR_STR
5268 "Interface\n"
5269 "Interface name\n")
5270{
5271 return peer_interface_vty (vty, argv[0], NULL);
5272}
6b0655a2 5273
718e3744 5274/* Set distribute list to the peer. */
94f2b392 5275static int
fd79ac91 5276peer_distribute_set_vty (struct vty *vty, const char *ip_str,
5277 afi_t afi, safi_t safi,
5278 const char *name_str, const char *direct_str)
718e3744 5279{
5280 int ret;
5281 struct peer *peer;
5282 int direct = FILTER_IN;
5283
5284 peer = peer_and_group_lookup_vty (vty, ip_str);
5285 if (! peer)
5286 return CMD_WARNING;
5287
5288 /* Check filter direction. */
5289 if (strncmp (direct_str, "i", 1) == 0)
5290 direct = FILTER_IN;
5291 else if (strncmp (direct_str, "o", 1) == 0)
5292 direct = FILTER_OUT;
5293
5294 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
5295
5296 return bgp_vty_return (vty, ret);
5297}
5298
94f2b392 5299static int
fd79ac91 5300peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
5301 safi_t safi, const char *direct_str)
718e3744 5302{
5303 int ret;
5304 struct peer *peer;
5305 int direct = FILTER_IN;
5306
5307 peer = peer_and_group_lookup_vty (vty, ip_str);
5308 if (! peer)
5309 return CMD_WARNING;
5310
5311 /* Check filter direction. */
5312 if (strncmp (direct_str, "i", 1) == 0)
5313 direct = FILTER_IN;
5314 else if (strncmp (direct_str, "o", 1) == 0)
5315 direct = FILTER_OUT;
5316
5317 ret = peer_distribute_unset (peer, afi, safi, direct);
5318
5319 return bgp_vty_return (vty, ret);
5320}
5321
5322DEFUN (neighbor_distribute_list,
5323 neighbor_distribute_list_cmd,
5324 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
5325 NEIGHBOR_STR
5326 NEIGHBOR_ADDR_STR2
5327 "Filter updates to/from this neighbor\n"
5328 "IP access-list number\n"
5329 "IP access-list number (expanded range)\n"
5330 "IP Access-list name\n"
5331 "Filter incoming updates\n"
5332 "Filter outgoing updates\n")
5333{
5334 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
5335 bgp_node_safi (vty), argv[1], argv[2]);
5336}
5337
5338DEFUN (no_neighbor_distribute_list,
5339 no_neighbor_distribute_list_cmd,
5340 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
5341 NO_STR
5342 NEIGHBOR_STR
5343 NEIGHBOR_ADDR_STR2
5344 "Filter updates to/from this neighbor\n"
5345 "IP access-list number\n"
5346 "IP access-list number (expanded range)\n"
5347 "IP Access-list name\n"
5348 "Filter incoming updates\n"
5349 "Filter outgoing updates\n")
5350{
5351 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
5352 bgp_node_safi (vty), argv[2]);
5353}
6b0655a2 5354
718e3744 5355/* Set prefix list to the peer. */
94f2b392 5356static int
fd79ac91 5357peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
5358 safi_t safi, const char *name_str,
5359 const char *direct_str)
718e3744 5360{
5361 int ret;
5362 struct peer *peer;
5363 int direct = FILTER_IN;
5364
5365 peer = peer_and_group_lookup_vty (vty, ip_str);
5366 if (! peer)
5367 return CMD_WARNING;
5368
5369 /* Check filter direction. */
5370 if (strncmp (direct_str, "i", 1) == 0)
5371 direct = FILTER_IN;
5372 else if (strncmp (direct_str, "o", 1) == 0)
5373 direct = FILTER_OUT;
5374
5375 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
5376
5377 return bgp_vty_return (vty, ret);
5378}
5379
94f2b392 5380static int
fd79ac91 5381peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
5382 safi_t safi, const char *direct_str)
718e3744 5383{
5384 int ret;
5385 struct peer *peer;
5386 int direct = FILTER_IN;
5387
5388 peer = peer_and_group_lookup_vty (vty, ip_str);
5389 if (! peer)
5390 return CMD_WARNING;
5391
5392 /* Check filter direction. */
5393 if (strncmp (direct_str, "i", 1) == 0)
5394 direct = FILTER_IN;
5395 else if (strncmp (direct_str, "o", 1) == 0)
5396 direct = FILTER_OUT;
5397
5398 ret = peer_prefix_list_unset (peer, afi, safi, direct);
5399
5400 return bgp_vty_return (vty, ret);
5401}
5402
5403DEFUN (neighbor_prefix_list,
5404 neighbor_prefix_list_cmd,
5405 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
5406 NEIGHBOR_STR
5407 NEIGHBOR_ADDR_STR2
5408 "Filter updates to/from this neighbor\n"
5409 "Name of a prefix list\n"
5410 "Filter incoming updates\n"
5411 "Filter outgoing updates\n")
5412{
5413 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
5414 bgp_node_safi (vty), argv[1], argv[2]);
5415}
5416
5417DEFUN (no_neighbor_prefix_list,
5418 no_neighbor_prefix_list_cmd,
5419 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
5420 NO_STR
5421 NEIGHBOR_STR
5422 NEIGHBOR_ADDR_STR2
5423 "Filter updates to/from this neighbor\n"
5424 "Name of a prefix list\n"
5425 "Filter incoming updates\n"
5426 "Filter outgoing updates\n")
5427{
5428 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
5429 bgp_node_safi (vty), argv[2]);
5430}
6b0655a2 5431
94f2b392 5432static int
fd79ac91 5433peer_aslist_set_vty (struct vty *vty, const char *ip_str,
5434 afi_t afi, safi_t safi,
5435 const char *name_str, const char *direct_str)
718e3744 5436{
5437 int ret;
5438 struct peer *peer;
5439 int direct = FILTER_IN;
5440
5441 peer = peer_and_group_lookup_vty (vty, ip_str);
5442 if (! peer)
5443 return CMD_WARNING;
5444
5445 /* Check filter direction. */
5446 if (strncmp (direct_str, "i", 1) == 0)
5447 direct = FILTER_IN;
5448 else if (strncmp (direct_str, "o", 1) == 0)
5449 direct = FILTER_OUT;
5450
5451 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
5452
5453 return bgp_vty_return (vty, ret);
5454}
5455
94f2b392 5456static int
fd79ac91 5457peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
5458 afi_t afi, safi_t safi,
5459 const char *direct_str)
718e3744 5460{
5461 int ret;
5462 struct peer *peer;
5463 int direct = FILTER_IN;
5464
5465 peer = peer_and_group_lookup_vty (vty, ip_str);
5466 if (! peer)
5467 return CMD_WARNING;
5468
5469 /* Check filter direction. */
5470 if (strncmp (direct_str, "i", 1) == 0)
5471 direct = FILTER_IN;
5472 else if (strncmp (direct_str, "o", 1) == 0)
5473 direct = FILTER_OUT;
5474
5475 ret = peer_aslist_unset (peer, afi, safi, direct);
5476
5477 return bgp_vty_return (vty, ret);
5478}
5479
5480DEFUN (neighbor_filter_list,
5481 neighbor_filter_list_cmd,
5482 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
5483 NEIGHBOR_STR
5484 NEIGHBOR_ADDR_STR2
5485 "Establish BGP filters\n"
5486 "AS path access-list name\n"
5487 "Filter incoming routes\n"
5488 "Filter outgoing routes\n")
5489{
5490 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
5491 bgp_node_safi (vty), argv[1], argv[2]);
5492}
5493
5494DEFUN (no_neighbor_filter_list,
5495 no_neighbor_filter_list_cmd,
5496 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
5497 NO_STR
5498 NEIGHBOR_STR
5499 NEIGHBOR_ADDR_STR2
5500 "Establish BGP filters\n"
5501 "AS path access-list name\n"
5502 "Filter incoming routes\n"
5503 "Filter outgoing routes\n")
5504{
5505 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
5506 bgp_node_safi (vty), argv[2]);
5507}
6b0655a2 5508
718e3744 5509/* Set route-map to the peer. */
94f2b392 5510static int
fd79ac91 5511peer_route_map_set_vty (struct vty *vty, const char *ip_str,
5512 afi_t afi, safi_t safi,
5513 const char *name_str, const char *direct_str)
718e3744 5514{
5515 int ret;
5516 struct peer *peer;
fee0f4c6 5517 int direct = RMAP_IN;
718e3744 5518
5519 peer = peer_and_group_lookup_vty (vty, ip_str);
5520 if (! peer)
5521 return CMD_WARNING;
5522
5523 /* Check filter direction. */
fee0f4c6 5524 if (strncmp (direct_str, "in", 2) == 0)
5525 direct = RMAP_IN;
718e3744 5526 else if (strncmp (direct_str, "o", 1) == 0)
fee0f4c6 5527 direct = RMAP_OUT;
718e3744 5528
5529 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
5530
5531 return bgp_vty_return (vty, ret);
5532}
5533
94f2b392 5534static int
fd79ac91 5535peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
5536 safi_t safi, const char *direct_str)
718e3744 5537{
5538 int ret;
5539 struct peer *peer;
fee0f4c6 5540 int direct = RMAP_IN;
718e3744 5541
5542 peer = peer_and_group_lookup_vty (vty, ip_str);
5543 if (! peer)
5544 return CMD_WARNING;
5545
5546 /* Check filter direction. */
fee0f4c6 5547 if (strncmp (direct_str, "in", 2) == 0)
5548 direct = RMAP_IN;
718e3744 5549 else if (strncmp (direct_str, "o", 1) == 0)
fee0f4c6 5550 direct = RMAP_OUT;
718e3744 5551
5552 ret = peer_route_map_unset (peer, afi, safi, direct);
5553
5554 return bgp_vty_return (vty, ret);
5555}
5556
5557DEFUN (neighbor_route_map,
5558 neighbor_route_map_cmd,
2a3d5731 5559 NEIGHBOR_CMD2 "route-map WORD (in|out)",
718e3744 5560 NEIGHBOR_STR
5561 NEIGHBOR_ADDR_STR2
5562 "Apply route map to neighbor\n"
5563 "Name of route map\n"
5564 "Apply map to incoming routes\n"
2a3d5731 5565 "Apply map to outbound routes\n")
718e3744 5566{
5567 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
5568 bgp_node_safi (vty), argv[1], argv[2]);
5569}
5570
5571DEFUN (no_neighbor_route_map,
5572 no_neighbor_route_map_cmd,
2a3d5731 5573 NO_NEIGHBOR_CMD2 "route-map WORD (in|out)",
718e3744 5574 NO_STR
5575 NEIGHBOR_STR
5576 NEIGHBOR_ADDR_STR2
5577 "Apply route map to neighbor\n"
5578 "Name of route map\n"
5579 "Apply map to incoming routes\n"
2a3d5731 5580 "Apply map to outbound routes\n")
718e3744 5581{
5582 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
5583 bgp_node_safi (vty), argv[2]);
5584}
6b0655a2 5585
718e3744 5586/* Set unsuppress-map to the peer. */
94f2b392 5587static int
fd79ac91 5588peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
5589 safi_t safi, const char *name_str)
718e3744 5590{
5591 int ret;
5592 struct peer *peer;
5593
5594 peer = peer_and_group_lookup_vty (vty, ip_str);
5595 if (! peer)
5596 return CMD_WARNING;
5597
5598 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
5599
5600 return bgp_vty_return (vty, ret);
5601}
5602
5603/* Unset route-map from the peer. */
94f2b392 5604static int
fd79ac91 5605peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
718e3744 5606 safi_t safi)
5607{
5608 int ret;
5609 struct peer *peer;
5610
5611 peer = peer_and_group_lookup_vty (vty, ip_str);
5612 if (! peer)
5613 return CMD_WARNING;
5614
5615 ret = peer_unsuppress_map_unset (peer, afi, safi);
5616
5617 return bgp_vty_return (vty, ret);
5618}
5619
5620DEFUN (neighbor_unsuppress_map,
5621 neighbor_unsuppress_map_cmd,
5622 NEIGHBOR_CMD2 "unsuppress-map WORD",
5623 NEIGHBOR_STR
5624 NEIGHBOR_ADDR_STR2
5625 "Route-map to selectively unsuppress suppressed routes\n"
5626 "Name of route map\n")
5627{
5628 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
5629 bgp_node_safi (vty), argv[1]);
5630}
5631
5632DEFUN (no_neighbor_unsuppress_map,
5633 no_neighbor_unsuppress_map_cmd,
5634 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
5635 NO_STR
5636 NEIGHBOR_STR
5637 NEIGHBOR_ADDR_STR2
5638 "Route-map to selectively unsuppress suppressed routes\n"
5639 "Name of route map\n")
5640{
5641 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
5642 bgp_node_safi (vty));
5643}
6b0655a2 5644
94f2b392 5645static int
fd79ac91 5646peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
5647 safi_t safi, const char *num_str,
0a486e5f 5648 const char *threshold_str, int warning,
5649 const char *restart_str)
718e3744 5650{
5651 int ret;
5652 struct peer *peer;
5653 u_int32_t max;
e0701b79 5654 u_char threshold;
0a486e5f 5655 u_int16_t restart;
718e3744 5656
5657 peer = peer_and_group_lookup_vty (vty, ip_str);
5658 if (! peer)
5659 return CMD_WARNING;
5660
e6ec1c36 5661 VTY_GET_INTEGER ("maximum number", max, num_str);
e0701b79 5662 if (threshold_str)
5663 threshold = atoi (threshold_str);
5664 else
5665 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
718e3744 5666
0a486e5f 5667 if (restart_str)
5668 restart = atoi (restart_str);
5669 else
5670 restart = 0;
5671
5672 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
718e3744 5673
5674 return bgp_vty_return (vty, ret);
5675}
5676
94f2b392 5677static int
fd79ac91 5678peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
718e3744 5679 safi_t safi)
5680{
5681 int ret;
5682 struct peer *peer;
5683
5684 peer = peer_and_group_lookup_vty (vty, ip_str);
5685 if (! peer)
5686 return CMD_WARNING;
5687
5688 ret = peer_maximum_prefix_unset (peer, afi, safi);
5689
5690 return bgp_vty_return (vty, ret);
5691}
5692
5693/* Maximum number of prefix configuration. prefix count is different
5694 for each peer configuration. So this configuration can be set for
5695 each peer configuration. */
5696DEFUN (neighbor_maximum_prefix,
5697 neighbor_maximum_prefix_cmd,
5698 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
5699 NEIGHBOR_STR
5700 NEIGHBOR_ADDR_STR2
5701 "Maximum number of prefix accept from this peer\n"
5702 "maximum no. of prefix limit\n")
5703{
5704 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 5705 bgp_node_safi (vty), argv[1], NULL, 0,
5706 NULL);
718e3744 5707}
5708
e0701b79 5709DEFUN (neighbor_maximum_prefix_threshold,
5710 neighbor_maximum_prefix_threshold_cmd,
5711 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
5712 NEIGHBOR_STR
5713 NEIGHBOR_ADDR_STR2
5714 "Maximum number of prefix accept from this peer\n"
5715 "maximum no. of prefix limit\n"
5716 "Threshold value (%) at which to generate a warning msg\n")
5717{
5718 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 5719 bgp_node_safi (vty), argv[1], argv[2], 0,
5720 NULL);
5721}
e0701b79 5722
718e3744 5723DEFUN (neighbor_maximum_prefix_warning,
5724 neighbor_maximum_prefix_warning_cmd,
5725 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
5726 NEIGHBOR_STR
5727 NEIGHBOR_ADDR_STR2
5728 "Maximum number of prefix accept from this peer\n"
5729 "maximum no. of prefix limit\n"
5730 "Only give warning message when limit is exceeded\n")
5731{
5732 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 5733 bgp_node_safi (vty), argv[1], NULL, 1,
5734 NULL);
718e3744 5735}
5736
e0701b79 5737DEFUN (neighbor_maximum_prefix_threshold_warning,
5738 neighbor_maximum_prefix_threshold_warning_cmd,
5739 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
5740 NEIGHBOR_STR
5741 NEIGHBOR_ADDR_STR2
5742 "Maximum number of prefix accept from this peer\n"
5743 "maximum no. of prefix limit\n"
5744 "Threshold value (%) at which to generate a warning msg\n"
5745 "Only give warning message when limit is exceeded\n")
5746{
5747 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 5748 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
5749}
5750
5751DEFUN (neighbor_maximum_prefix_restart,
5752 neighbor_maximum_prefix_restart_cmd,
5753 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
5754 NEIGHBOR_STR
5755 NEIGHBOR_ADDR_STR2
5756 "Maximum number of prefix accept from this peer\n"
5757 "maximum no. of prefix limit\n"
5758 "Restart bgp connection after limit is exceeded\n"
5759 "Restart interval in minutes")
5760{
5761 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
5762 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
5763}
5764
5765DEFUN (neighbor_maximum_prefix_threshold_restart,
5766 neighbor_maximum_prefix_threshold_restart_cmd,
5767 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
5768 NEIGHBOR_STR
5769 NEIGHBOR_ADDR_STR2
5770 "Maximum number of prefix accept from this peer\n"
5771 "maximum no. of prefix limit\n"
5772 "Threshold value (%) at which to generate a warning msg\n"
5773 "Restart bgp connection after limit is exceeded\n"
5774 "Restart interval in minutes")
5775{
5776 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
5777 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
5778}
e0701b79 5779
718e3744 5780DEFUN (no_neighbor_maximum_prefix,
5781 no_neighbor_maximum_prefix_cmd,
5782 NO_NEIGHBOR_CMD2 "maximum-prefix",
5783 NO_STR
5784 NEIGHBOR_STR
5785 NEIGHBOR_ADDR_STR2
5786 "Maximum number of prefix accept from this peer\n")
5787{
5788 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
5789 bgp_node_safi (vty));
5790}
5791
5792ALIAS (no_neighbor_maximum_prefix,
5793 no_neighbor_maximum_prefix_val_cmd,
5794 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
5795 NO_STR
5796 NEIGHBOR_STR
5797 NEIGHBOR_ADDR_STR2
5798 "Maximum number of prefix accept from this peer\n"
5799 "maximum no. of prefix limit\n")
5800
5801ALIAS (no_neighbor_maximum_prefix,
0a486e5f 5802 no_neighbor_maximum_prefix_threshold_cmd,
813d4307 5803 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
0a486e5f 5804 NO_STR
5805 NEIGHBOR_STR
5806 NEIGHBOR_ADDR_STR2
5807 "Maximum number of prefix accept from this peer\n"
5808 "maximum no. of prefix limit\n"
5809 "Threshold value (%) at which to generate a warning msg\n")
5810
5811ALIAS (no_neighbor_maximum_prefix,
5812 no_neighbor_maximum_prefix_warning_cmd,
5813 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
5814 NO_STR
5815 NEIGHBOR_STR
5816 NEIGHBOR_ADDR_STR2
5817 "Maximum number of prefix accept from this peer\n"
5818 "maximum no. of prefix limit\n"
e8e1946e 5819 "Only give warning message when limit is exceeded\n")
0a486e5f 5820
5821ALIAS (no_neighbor_maximum_prefix,
5822 no_neighbor_maximum_prefix_threshold_warning_cmd,
e0701b79 5823 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
5824 NO_STR
5825 NEIGHBOR_STR
5826 NEIGHBOR_ADDR_STR2
5827 "Maximum number of prefix accept from this peer\n"
5828 "maximum no. of prefix limit\n"
5829 "Threshold value (%) at which to generate a warning msg\n"
e8e1946e 5830 "Only give warning message when limit is exceeded\n")
e0701b79 5831
5832ALIAS (no_neighbor_maximum_prefix,
0a486e5f 5833 no_neighbor_maximum_prefix_restart_cmd,
5834 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
718e3744 5835 NO_STR
5836 NEIGHBOR_STR
5837 NEIGHBOR_ADDR_STR2
5838 "Maximum number of prefix accept from this peer\n"
5839 "maximum no. of prefix limit\n"
0a486e5f 5840 "Restart bgp connection after limit is exceeded\n"
5841 "Restart interval in minutes")
5842
5843ALIAS (no_neighbor_maximum_prefix,
5844 no_neighbor_maximum_prefix_threshold_restart_cmd,
5845 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
5846 NO_STR
5847 NEIGHBOR_STR
5848 NEIGHBOR_ADDR_STR2
5849 "Maximum number of prefix accept from this peer\n"
5850 "maximum no. of prefix limit\n"
5851 "Threshold value (%) at which to generate a warning msg\n"
5852 "Restart bgp connection after limit is exceeded\n"
5853 "Restart interval in minutes")
6b0655a2 5854
718e3744 5855/* "neighbor allowas-in" */
5856DEFUN (neighbor_allowas_in,
5857 neighbor_allowas_in_cmd,
5858 NEIGHBOR_CMD2 "allowas-in",
5859 NEIGHBOR_STR
5860 NEIGHBOR_ADDR_STR2
5861 "Accept as-path with my AS present in it\n")
5862{
5863 int ret;
5864 struct peer *peer;
fd79ac91 5865 unsigned int allow_num;
718e3744 5866
5867 peer = peer_and_group_lookup_vty (vty, argv[0]);
5868 if (! peer)
5869 return CMD_WARNING;
5870
5871 if (argc == 1)
5872 allow_num = 3;
5873 else
5874 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
5875
5876 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
5877 allow_num);
5878
5879 return bgp_vty_return (vty, ret);
5880}
5881
5882ALIAS (neighbor_allowas_in,
5883 neighbor_allowas_in_arg_cmd,
5884 NEIGHBOR_CMD2 "allowas-in <1-10>",
5885 NEIGHBOR_STR
5886 NEIGHBOR_ADDR_STR2
5887 "Accept as-path with my AS present in it\n"
5888 "Number of occurances of AS number\n")
5889
5890DEFUN (no_neighbor_allowas_in,
5891 no_neighbor_allowas_in_cmd,
5892 NO_NEIGHBOR_CMD2 "allowas-in",
5893 NO_STR
5894 NEIGHBOR_STR
5895 NEIGHBOR_ADDR_STR2
5896 "allow local ASN appears in aspath attribute\n")
5897{
5898 int ret;
5899 struct peer *peer;
5900
5901 peer = peer_and_group_lookup_vty (vty, argv[0]);
5902 if (! peer)
5903 return CMD_WARNING;
5904
5905 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
5906
5907 return bgp_vty_return (vty, ret);
5908}
6b0655a2 5909
813d4307
DW
5910ALIAS (no_neighbor_allowas_in,
5911 no_neighbor_allowas_in_val_cmd,
5912 NO_NEIGHBOR_CMD2 "allowas-in <1-10>",
5913 NO_STR
5914 NEIGHBOR_STR
5915 NEIGHBOR_ADDR_STR2
5916 "allow local ASN appears in aspath attribute\n"
5917 "Number of occurances of AS number\n")
5918
fa411a21
NH
5919DEFUN (neighbor_ttl_security,
5920 neighbor_ttl_security_cmd,
5921 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
5922 NEIGHBOR_STR
5923 NEIGHBOR_ADDR_STR2
5924 "Specify the maximum number of hops to the BGP peer\n")
5925{
5926 struct peer *peer;
89b6d1f8 5927 int gtsm_hops;
fa411a21
NH
5928
5929 peer = peer_and_group_lookup_vty (vty, argv[0]);
5930 if (! peer)
5931 return CMD_WARNING;
5932
5933 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
5934
8cdabf90
SK
5935 /*
5936 * If 'neighbor swpX', then this is for directly connected peers,
5937 * we should not accept a ttl-security hops value greater than 1.
5938 */
5939 if (peer->conf_if && (gtsm_hops > 1)) {
5940 vty_out (vty, "%s is directly connected peer, hops cannot exceed 1%s",
5941 argv[0], VTY_NEWLINE);
5942 return CMD_WARNING;
5943 }
5944
89b6d1f8 5945 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
fa411a21
NH
5946}
5947
5948DEFUN (no_neighbor_ttl_security,
5949 no_neighbor_ttl_security_cmd,
5950 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
5951 NO_STR
5952 NEIGHBOR_STR
5953 NEIGHBOR_ADDR_STR2
5954 "Specify the maximum number of hops to the BGP peer\n")
5955{
5956 struct peer *peer;
fa411a21
NH
5957
5958 peer = peer_and_group_lookup_vty (vty, argv[0]);
5959 if (! peer)
5960 return CMD_WARNING;
5961
89b6d1f8 5962 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
fa411a21 5963}
6b0655a2 5964
adbac85e
DW
5965DEFUN (neighbor_addpath_tx_all_paths,
5966 neighbor_addpath_tx_all_paths_cmd,
5967 NEIGHBOR_CMD2 "addpath-tx-all-paths",
5968 NEIGHBOR_STR
5969 NEIGHBOR_ADDR_STR2
5970 "Use addpath to advertise all paths to a neighbor\n")
5971{
5972 struct peer *peer;
5973
adbac85e
DW
5974 peer = peer_and_group_lookup_vty (vty, argv[0]);
5975 if (! peer)
5976 return CMD_WARNING;
5977
5978 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
5979 bgp_node_safi (vty),
5980 PEER_FLAG_ADDPATH_TX_ALL_PATHS);
5981}
5982
5983DEFUN (no_neighbor_addpath_tx_all_paths,
5984 no_neighbor_addpath_tx_all_paths_cmd,
5985 NO_NEIGHBOR_CMD2 "addpath-tx-all-paths",
5986 NO_STR
5987 NEIGHBOR_STR
5988 NEIGHBOR_ADDR_STR2
5989 "Use addpath to advertise all paths to a neighbor\n")
5990{
5991 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
5992 bgp_node_safi (vty),
5993 PEER_FLAG_ADDPATH_TX_ALL_PATHS);
5994}
5995
06370dac
DW
5996DEFUN (neighbor_addpath_tx_bestpath_per_as,
5997 neighbor_addpath_tx_bestpath_per_as_cmd,
5998 NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS",
5999 NEIGHBOR_STR
6000 NEIGHBOR_ADDR_STR2
6001 "Use addpath to advertise the bestpath per each neighboring AS\n")
6002{
6003 struct peer *peer;
6004
6005 peer = peer_and_group_lookup_vty (vty, argv[0]);
6006 if (! peer)
6007 return CMD_WARNING;
6008
6009 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
6010 bgp_node_safi (vty),
6011 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS);
6012}
6013
6014DEFUN (no_neighbor_addpath_tx_bestpath_per_as,
6015 no_neighbor_addpath_tx_bestpath_per_as_cmd,
6016 NO_NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS",
6017 NO_STR
6018 NEIGHBOR_STR
6019 NEIGHBOR_ADDR_STR2
6020 "Use addpath to advertise the bestpath per each neighboring AS\n")
6021{
6022 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
6023 bgp_node_safi (vty),
6024 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS);
6025}
6026
6027
718e3744 6028/* Address family configuration. */
6029DEFUN (address_family_ipv4,
6030 address_family_ipv4_cmd,
6031 "address-family ipv4",
6032 "Enter Address Family command mode\n"
6033 "Address family\n")
6034{
6035 vty->node = BGP_IPV4_NODE;
6036 return CMD_SUCCESS;
6037}
6038
6039DEFUN (address_family_ipv4_safi,
6040 address_family_ipv4_safi_cmd,
6041 "address-family ipv4 (unicast|multicast)",
6042 "Enter Address Family command mode\n"
6043 "Address family\n"
6044 "Address Family modifier\n"
6045 "Address Family modifier\n")
6046{
6047 if (strncmp (argv[0], "m", 1) == 0)
6048 vty->node = BGP_IPV4M_NODE;
6049 else
6050 vty->node = BGP_IPV4_NODE;
6051
6052 return CMD_SUCCESS;
6053}
6054
25ffbdc1 6055DEFUN (address_family_ipv6,
6056 address_family_ipv6_cmd,
6057 "address-family ipv6",
718e3744 6058 "Enter Address Family command mode\n"
25ffbdc1 6059 "Address family\n")
718e3744 6060{
6061 vty->node = BGP_IPV6_NODE;
6062 return CMD_SUCCESS;
6063}
6064
25ffbdc1 6065DEFUN (address_family_ipv6_safi,
6066 address_family_ipv6_safi_cmd,
6067 "address-family ipv6 (unicast|multicast)",
718e3744 6068 "Enter Address Family command mode\n"
25ffbdc1 6069 "Address family\n"
6070 "Address Family modifier\n"
6071 "Address Family modifier\n")
6072{
6073 if (strncmp (argv[0], "m", 1) == 0)
6074 vty->node = BGP_IPV6M_NODE;
6075 else
6076 vty->node = BGP_IPV6_NODE;
6077
6078 return CMD_SUCCESS;
6079}
718e3744 6080
6081DEFUN (address_family_vpnv4,
6082 address_family_vpnv4_cmd,
6083 "address-family vpnv4",
6084 "Enter Address Family command mode\n"
6085 "Address family\n")
6086{
6087 vty->node = BGP_VPNV4_NODE;
6088 return CMD_SUCCESS;
6089}
6090
6091ALIAS (address_family_vpnv4,
6092 address_family_vpnv4_unicast_cmd,
6093 "address-family vpnv4 unicast",
6094 "Enter Address Family command mode\n"
6095 "Address family\n"
6096 "Address Family Modifier\n")
6097
8ecd3266 6098DEFUN (address_family_vpnv6,
6099 address_family_vpnv6_cmd,
6100 "address-family vpnv6",
6101 "Enter Address Family command mode\n"
6102 "Address family\n")
6103{
6104 vty->node = BGP_VPNV6_NODE;
6105 return CMD_SUCCESS;
6106}
6107
6108ALIAS (address_family_vpnv6,
6109 address_family_vpnv6_unicast_cmd,
6110 "address-family vpnv6 unicast",
6111 "Enter Address Family command mode\n"
6112 "Address family\n"
6113 "Address Family Modifier\n")
6114
8b1fb8be
LB
6115DEFUN (address_family_encap,
6116 address_family_encap_cmd,
6117 "address-family encap",
6118 "Enter Address Family command mode\n"
6119 "Address family\n")
6120{
6121 vty->node = BGP_ENCAP_NODE;
6122 return CMD_SUCCESS;
6123}
6124
6125ALIAS (address_family_encap,
6126 address_family_encapv4_cmd,
6127 "address-family encapv4",
6128 "Enter Address Family command mode\n"
6129 "Address family\n")
6130
6131DEFUN (address_family_encapv6,
6132 address_family_encapv6_cmd,
6133 "address-family encapv6",
6134 "Enter Address Family command mode\n"
6135 "Address family\n")
6136{
6137 vty->node = BGP_ENCAPV6_NODE;
6138 return CMD_SUCCESS;
6139}
6140
718e3744 6141DEFUN (exit_address_family,
6142 exit_address_family_cmd,
6143 "exit-address-family",
6144 "Exit from Address Family configuration mode\n")
6145{
a8a80d53 6146 if (vty->node == BGP_IPV4_NODE
6147 || vty->node == BGP_IPV4M_NODE
718e3744 6148 || vty->node == BGP_VPNV4_NODE
25ffbdc1 6149 || vty->node == BGP_IPV6_NODE
8ecd3266 6150 || vty->node == BGP_IPV6M_NODE
8b1fb8be
LB
6151 || vty->node == BGP_VPNV6_NODE
6152 || vty->node == BGP_ENCAP_NODE
6153 || vty->node == BGP_ENCAPV6_NODE)
718e3744 6154 vty->node = BGP_NODE;
6155 return CMD_SUCCESS;
6156}
6b0655a2 6157
8ad7271d
DS
6158/* Recalculate bestpath and re-advertise a prefix */
6159static int
01080f7c 6160bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str,
8ad7271d
DS
6161 afi_t afi, safi_t safi, struct prefix_rd *prd)
6162{
6163 int ret;
6164 struct prefix match;
6165 struct bgp_node *rn;
6166 struct bgp_node *rm;
8ad7271d
DS
6167 struct bgp *bgp;
6168 struct bgp_table *table;
6169 struct bgp_table *rib;
6170
6171 /* BGP structure lookup. */
6172 if (view_name)
6173 {
6174 bgp = bgp_lookup_by_name (view_name);
6175 if (bgp == NULL)
6176 {
6aeb9e78 6177 vty_out (vty, "%% Can't find BGP instance %s%s", view_name, VTY_NEWLINE);
8ad7271d
DS
6178 return CMD_WARNING;
6179 }
6180 }
6181 else
6182 {
6183 bgp = bgp_get_default ();
6184 if (bgp == NULL)
6185 {
6186 vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE);
6187 return CMD_WARNING;
6188 }
6189 }
6190
6191 /* Check IP address argument. */
6192 ret = str2prefix (ip_str, &match);
6193 if (! ret)
6194 {
6195 vty_out (vty, "%% address is malformed%s", VTY_NEWLINE);
6196 return CMD_WARNING;
6197 }
6198
6199 match.family = afi2family (afi);
6200 rib = bgp->rib[afi][safi];
6201
6202 if (safi == SAFI_MPLS_VPN)
6203 {
6204 for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn))
6205 {
6206 if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0)
6207 continue;
6208
6209 if ((table = rn->info) != NULL)
6210 {
6211 if ((rm = bgp_node_match (table, &match)) != NULL)
6212 {
6213 if (rm->p.prefixlen == match.prefixlen)
6214 {
6215 SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR);
6216 bgp_process (bgp, rm, afi, safi);
6217 }
6218 bgp_unlock_node (rm);
6219 }
6220 }
6221 }
6222 }
6223 else
6224 {
6225 if ((rn = bgp_node_match (rib, &match)) != NULL)
6226 {
6227 if (rn->p.prefixlen == match.prefixlen)
6228 {
6229 SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR);
6230 bgp_process (bgp, rn, afi, safi);
6231 }
6232 bgp_unlock_node (rn);
6233 }
6234 }
6235
6236 return CMD_SUCCESS;
6237}
6238
718e3744 6239DEFUN (clear_ip_bgp_all,
6240 clear_ip_bgp_all_cmd,
6241 "clear ip bgp *",
6242 CLEAR_STR
6243 IP_STR
6244 BGP_STR
6245 "Clear all peers\n")
6246{
6aeb9e78
DS
6247 if (argc == 2)
6248 return bgp_clear_vty (vty, argv[1], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
718e3744 6249
6250 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
6251}
6252
01080f7c 6253ALIAS (clear_ip_bgp_all,
6254 clear_ip_bgp_instance_all_cmd,
6255 "clear ip bgp " BGP_INSTANCE_CMD " *",
6256 CLEAR_STR
6257 IP_STR
6258 BGP_STR
6259 BGP_INSTANCE_HELP_STR
6260 "Clear all peers\n")
6261
718e3744 6262ALIAS (clear_ip_bgp_all,
6263 clear_bgp_all_cmd,
6264 "clear bgp *",
6265 CLEAR_STR
6266 BGP_STR
6267 "Clear all peers\n")
6268
6269ALIAS (clear_ip_bgp_all,
01080f7c 6270 clear_bgp_instance_all_cmd,
6271 "clear bgp " BGP_INSTANCE_CMD " *",
718e3744 6272 CLEAR_STR
6273 BGP_STR
01080f7c 6274 BGP_INSTANCE_HELP_STR
718e3744 6275 "Clear all peers\n")
6276
6277ALIAS (clear_ip_bgp_all,
01080f7c 6278 clear_bgp_ipv6_all_cmd,
6279 "clear bgp ipv6 *",
718e3744 6280 CLEAR_STR
718e3744 6281 BGP_STR
01080f7c 6282 "Address family\n"
718e3744 6283 "Clear all peers\n")
6284
6285ALIAS (clear_ip_bgp_all,
01080f7c 6286 clear_bgp_instance_ipv6_all_cmd,
6287 "clear bgp " BGP_INSTANCE_CMD " ipv6 *",
718e3744 6288 CLEAR_STR
6289 BGP_STR
8386ac43 6290 BGP_INSTANCE_HELP_STR
01080f7c 6291 "Address family\n"
718e3744 6292 "Clear all peers\n")
6293
6294DEFUN (clear_ip_bgp_peer,
6295 clear_ip_bgp_peer_cmd,
a80beece 6296 "clear ip bgp (A.B.C.D|X:X::X:X|WORD)",
718e3744 6297 CLEAR_STR
6298 IP_STR
6299 BGP_STR
6300 "BGP neighbor IP address to clear\n"
a80beece
DS
6301 "BGP IPv6 neighbor to clear\n"
6302 "BGP neighbor on interface to clear\n")
718e3744 6303{
01080f7c 6304 if (argc == 3)
6305 return bgp_clear_vty (vty, argv[1], 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[2]);
6306
718e3744 6307 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
6308}
6309
01080f7c 6310ALIAS (clear_ip_bgp_peer,
6311 clear_ip_bgp_instance_peer_cmd,
6312 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)",
6313 CLEAR_STR
6314 IP_STR
6315 BGP_STR
6316 BGP_INSTANCE_HELP_STR
6317 "BGP neighbor IP address to clear\n"
6318 "BGP IPv6 neighbor to clear\n"
6319 "BGP neighbor on interface to clear\n")
6320
718e3744 6321ALIAS (clear_ip_bgp_peer,
6322 clear_bgp_peer_cmd,
a80beece 6323 "clear bgp (A.B.C.D|X:X::X:X|WORD)",
718e3744 6324 CLEAR_STR
6325 BGP_STR
6326 "BGP neighbor address to clear\n"
a80beece
DS
6327 "BGP IPv6 neighbor to clear\n"
6328 "BGP neighbor on interface to clear\n")
718e3744 6329
01080f7c 6330ALIAS (clear_ip_bgp_peer,
6331 clear_bgp_instance_peer_cmd,
6332 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)",
6333 CLEAR_STR
6334 BGP_STR
6335 BGP_INSTANCE_HELP_STR
6336 "BGP neighbor IP address to clear\n"
6337 "BGP IPv6 neighbor to clear\n"
6338 "BGP neighbor on interface to clear\n")
6339
718e3744 6340ALIAS (clear_ip_bgp_peer,
6341 clear_bgp_ipv6_peer_cmd,
a80beece 6342 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)",
718e3744 6343 CLEAR_STR
6344 BGP_STR
6345 "Address family\n"
6346 "BGP neighbor address to clear\n"
a80beece
DS
6347 "BGP IPv6 neighbor to clear\n"
6348 "BGP neighbor on interface to clear\n")
718e3744 6349
01080f7c 6350ALIAS (clear_ip_bgp_peer,
6351 clear_bgp_instance_ipv6_peer_cmd,
6352 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD)",
6353 CLEAR_STR
6354 BGP_STR
6355 BGP_INSTANCE_HELP_STR
6356 "Address family\n"
6357 "BGP neighbor IP address to clear\n"
6358 "BGP IPv6 neighbor to clear\n"
6359 "BGP neighbor on interface to clear\n")
6360
718e3744 6361DEFUN (clear_ip_bgp_peer_group,
6362 clear_ip_bgp_peer_group_cmd,
6363 "clear ip bgp peer-group WORD",
6364 CLEAR_STR
6365 IP_STR
6366 BGP_STR
6367 "Clear all members of peer-group\n"
6368 "BGP peer-group name\n")
6369{
01080f7c 6370 if (argc == 3)
6371 return bgp_clear_vty (vty, argv[1], 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[2]);
6372
718e3744 6373 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
6374}
6375
01080f7c 6376ALIAS (clear_ip_bgp_peer_group,
6377 clear_ip_bgp_instance_peer_group_cmd,
6378 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD",
6379 CLEAR_STR
6380 IP_STR
6381 BGP_STR
6382 BGP_INSTANCE_HELP_STR
6383 "Clear all members of peer-group\n"
6384 "BGP peer-group name\n")
6385
718e3744 6386ALIAS (clear_ip_bgp_peer_group,
6387 clear_bgp_peer_group_cmd,
6388 "clear bgp peer-group WORD",
6389 CLEAR_STR
6390 BGP_STR
6391 "Clear all members of peer-group\n"
6392 "BGP peer-group name\n")
6393
01080f7c 6394ALIAS (clear_ip_bgp_peer_group,
6395 clear_bgp_instance_peer_group_cmd,
6396 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD",
6397 CLEAR_STR
6398 BGP_STR
6399 BGP_INSTANCE_HELP_STR
6400 "Clear all members of peer-group\n"
6401 "BGP peer-group name\n")
6402
718e3744 6403ALIAS (clear_ip_bgp_peer_group,
6404 clear_bgp_ipv6_peer_group_cmd,
6405 "clear bgp ipv6 peer-group WORD",
6406 CLEAR_STR
6407 BGP_STR
6408 "Address family\n"
6409 "Clear all members of peer-group\n"
6410 "BGP peer-group name\n")
6411
01080f7c 6412ALIAS (clear_ip_bgp_peer_group,
6413 clear_bgp_instance_ipv6_peer_group_cmd,
6414 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD",
6415 CLEAR_STR
6416 BGP_STR
6417 BGP_INSTANCE_HELP_STR
6418 "Address family\n"
6419 "Clear all members of peer-group\n"
6420 "BGP peer-group name\n")
6421
718e3744 6422DEFUN (clear_ip_bgp_external,
6423 clear_ip_bgp_external_cmd,
6424 "clear ip bgp external",
6425 CLEAR_STR
6426 IP_STR
6427 BGP_STR
6428 "Clear all external peers\n")
6429{
01080f7c 6430 if (argc == 2)
6431 return bgp_clear_vty (vty, argv[1], 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
6432
718e3744 6433 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
6434}
6435
01080f7c 6436ALIAS (clear_ip_bgp_external,
6437 clear_ip_bgp_instance_external_cmd,
6438 "clear ip bgp " BGP_INSTANCE_CMD " external",
6439 CLEAR_STR
6440 IP_STR
6441 BGP_STR
6442 BGP_INSTANCE_HELP_STR
6443 "Clear all external peers\n")
6444
718e3744 6445ALIAS (clear_ip_bgp_external,
6446 clear_bgp_external_cmd,
6447 "clear bgp external",
6448 CLEAR_STR
6449 BGP_STR
6450 "Clear all external peers\n")
6451
01080f7c 6452ALIAS (clear_ip_bgp_external,
6453 clear_bgp_instance_external_cmd,
6454 "clear bgp " BGP_INSTANCE_CMD " external",
6455 CLEAR_STR
6456 BGP_STR
6457 BGP_INSTANCE_HELP_STR
6458 "Clear all external peers\n")
6459
718e3744 6460ALIAS (clear_ip_bgp_external,
6461 clear_bgp_ipv6_external_cmd,
6462 "clear bgp ipv6 external",
6463 CLEAR_STR
6464 BGP_STR
6465 "Address family\n"
6466 "Clear all external peers\n")
6467
01080f7c 6468ALIAS (clear_ip_bgp_external,
6469 clear_bgp_instance_ipv6_external_cmd,
6470 "clear bgp " BGP_INSTANCE_CMD " ipv6 external",
6471 CLEAR_STR
6472 BGP_STR
6473 BGP_INSTANCE_HELP_STR
6474 "Address family\n"
6475 "Clear all external peers\n")
6476
8ad7271d
DS
6477DEFUN (clear_ip_bgp_prefix,
6478 clear_ip_bgp_prefix_cmd,
6479 "clear ip bgp prefix A.B.C.D/M",
6480 CLEAR_STR
6481 IP_STR
6482 BGP_STR
6483 "Clear bestpath and re-advertise\n"
6484 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6485{
01080f7c 6486 if (argc == 3)
6487 return bgp_clear_prefix (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL);
6488
8ad7271d
DS
6489 return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL);
6490}
6491
01080f7c 6492ALIAS (clear_ip_bgp_prefix,
6493 clear_ip_bgp_instance_prefix_cmd,
6494 "clear ip bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M",
6495 CLEAR_STR
6496 IP_STR
6497 BGP_STR
6498 BGP_INSTANCE_HELP_STR
6499 "Clear bestpath and re-advertise\n"
6500 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6501
8ad7271d
DS
6502ALIAS (clear_ip_bgp_prefix,
6503 clear_bgp_prefix_cmd,
6504 "clear bgp prefix A.B.C.D/M",
6505 CLEAR_STR
6506 BGP_STR
6507 "Clear bestpath and re-advertise\n"
6508 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6509
01080f7c 6510ALIAS (clear_ip_bgp_prefix,
6511 clear_bgp_instance_prefix_cmd,
6512 "clear bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M",
6513 CLEAR_STR
6514 BGP_STR
6515 BGP_INSTANCE_HELP_STR
6516 "Clear bestpath and re-advertise\n"
6517 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
8ad7271d 6518
718e3744 6519DEFUN (clear_ip_bgp_as,
6520 clear_ip_bgp_as_cmd,
320da874 6521 "clear ip bgp " CMD_AS_RANGE,
718e3744 6522 CLEAR_STR
6523 IP_STR
6524 BGP_STR
6525 "Clear peers with the AS number\n")
6526{
01080f7c 6527 if (argc == 3)
6528 return bgp_clear_vty (vty, argv[1], 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[2]);
6529
718e3744 6530 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
6531}
6532
01080f7c 6533ALIAS (clear_ip_bgp_as,
6534 clear_ip_bgp_instance_as_cmd,
6535 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE,
6536 CLEAR_STR
6537 IP_STR
6538 BGP_STR
6539 BGP_INSTANCE_HELP_STR
6540 "Clear peers with the AS number\n")
6541
718e3744 6542ALIAS (clear_ip_bgp_as,
6543 clear_bgp_as_cmd,
320da874 6544 "clear bgp " CMD_AS_RANGE,
718e3744 6545 CLEAR_STR
6546 BGP_STR
6547 "Clear peers with the AS number\n")
6548
01080f7c 6549ALIAS (clear_ip_bgp_as,
6550 clear_bgp_instance_as_cmd,
6551 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE,
6552 CLEAR_STR
6553 BGP_STR
6554 BGP_INSTANCE_HELP_STR
6555 "Clear peers with the AS number\n")
6556
718e3744 6557ALIAS (clear_ip_bgp_as,
6558 clear_bgp_ipv6_as_cmd,
320da874 6559 "clear bgp ipv6 " CMD_AS_RANGE,
718e3744 6560 CLEAR_STR
6561 BGP_STR
6562 "Address family\n"
6563 "Clear peers with the AS number\n")
6b0655a2 6564
01080f7c 6565ALIAS (clear_ip_bgp_as,
6566 clear_bgp_instance_ipv6_as_cmd,
6567 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE,
6568 CLEAR_STR
6569 BGP_STR
6570 BGP_INSTANCE_HELP_STR
6571 "Address family\n"
6572 "Clear peers with the AS number\n")
6573
718e3744 6574/* Outbound soft-reconfiguration */
6575DEFUN (clear_ip_bgp_all_soft_out,
6576 clear_ip_bgp_all_soft_out_cmd,
6577 "clear ip bgp * soft out",
6578 CLEAR_STR
6579 IP_STR
6580 BGP_STR
6581 "Clear all peers\n"
e0bce756
DS
6582 BGP_SOFT_STR
6583 BGP_SOFT_OUT_STR)
718e3744 6584{
6aeb9e78
DS
6585 if (argc == 2)
6586 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
718e3744 6587 BGP_CLEAR_SOFT_OUT, NULL);
6588
6589 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6590 BGP_CLEAR_SOFT_OUT, NULL);
6591}
6592
01080f7c 6593ALIAS (clear_ip_bgp_all_soft_out,
6594 clear_ip_bgp_instance_all_soft_out_cmd,
6595 "clear ip bgp " BGP_INSTANCE_CMD " * soft out",
6596 CLEAR_STR
6597 IP_STR
6598 BGP_STR
6599 BGP_INSTANCE_HELP_STR
6600 "Clear all peers\n"
6601 BGP_SOFT_STR
6602 BGP_SOFT_OUT_STR)
6603
718e3744 6604ALIAS (clear_ip_bgp_all_soft_out,
6605 clear_ip_bgp_all_out_cmd,
6606 "clear ip bgp * out",
6607 CLEAR_STR
6608 IP_STR
6609 BGP_STR
6610 "Clear all peers\n"
e0bce756 6611 BGP_SOFT_OUT_STR)
718e3744 6612
6613ALIAS (clear_ip_bgp_all_soft_out,
01080f7c 6614 clear_ip_bgp_instance_all_out_cmd,
6615 "clear ip bgp " BGP_INSTANCE_CMD " * out",
718e3744 6616 CLEAR_STR
6617 IP_STR
6618 BGP_STR
8386ac43 6619 BGP_INSTANCE_HELP_STR
718e3744 6620 "Clear all peers\n"
e0bce756 6621 BGP_SOFT_OUT_STR)
718e3744 6622
6623DEFUN (clear_ip_bgp_all_ipv4_soft_out,
6624 clear_ip_bgp_all_ipv4_soft_out_cmd,
6625 "clear ip bgp * ipv4 (unicast|multicast) soft out",
6626 CLEAR_STR
6627 IP_STR
6628 BGP_STR
6629 "Clear all peers\n"
6630 "Address family\n"
6631 "Address Family modifier\n"
6632 "Address Family modifier\n"
e0bce756
DS
6633 BGP_SOFT_STR
6634 BGP_SOFT_OUT_STR)
718e3744 6635{
6636 if (strncmp (argv[0], "m", 1) == 0)
6637 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6638 BGP_CLEAR_SOFT_OUT, NULL);
6639
6640 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6641 BGP_CLEAR_SOFT_OUT, NULL);
6642}
6643
01080f7c 6644DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
6645 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
6646 "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft out",
6647 CLEAR_STR
6648 IP_STR
6649 BGP_STR
6650 BGP_INSTANCE_HELP_STR
6651 "Clear all peers\n"
6652 "Address family\n"
6653 "Address Family modifier\n"
6654 "Address Family modifier\n"
6655 BGP_SOFT_OUT_STR)
6656{
6657 if (strncmp (argv[2], "m", 1) == 0)
6658 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all,
6659 BGP_CLEAR_SOFT_OUT, NULL);
6660
6661 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6662 BGP_CLEAR_SOFT_OUT, NULL);
6663}
6664
718e3744 6665ALIAS (clear_ip_bgp_all_ipv4_soft_out,
6666 clear_ip_bgp_all_ipv4_out_cmd,
6667 "clear ip bgp * ipv4 (unicast|multicast) out",
6668 CLEAR_STR
6669 IP_STR
6670 BGP_STR
6671 "Clear all peers\n"
6672 "Address family\n"
6673 "Address Family modifier\n"
6674 "Address Family modifier\n"
e0bce756 6675 BGP_SOFT_OUT_STR)
718e3744 6676
01080f7c 6677ALIAS (clear_ip_bgp_instance_all_ipv4_soft_out,
6678 clear_ip_bgp_instance_all_ipv4_out_cmd,
6679 "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) out",
718e3744 6680 CLEAR_STR
6681 IP_STR
6682 BGP_STR
8386ac43 6683 BGP_INSTANCE_HELP_STR
718e3744 6684 "Clear all peers\n"
6685 "Address family\n"
6686 "Address Family modifier\n"
6687 "Address Family modifier\n"
e0bce756 6688 BGP_SOFT_OUT_STR)
718e3744 6689
6690DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
6691 clear_ip_bgp_all_vpnv4_soft_out_cmd,
6692 "clear ip bgp * vpnv4 unicast soft out",
6693 CLEAR_STR
6694 IP_STR
6695 BGP_STR
6696 "Clear all peers\n"
6697 "Address family\n"
6698 "Address Family Modifier\n"
e0bce756
DS
6699 BGP_SOFT_STR
6700 BGP_SOFT_OUT_STR)
718e3744 6701{
6702 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6703 BGP_CLEAR_SOFT_OUT, NULL);
6704}
6705
6706ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
6707 clear_ip_bgp_all_vpnv4_out_cmd,
6708 "clear ip bgp * vpnv4 unicast out",
6709 CLEAR_STR
6710 IP_STR
6711 BGP_STR
6712 "Clear all peers\n"
6713 "Address family\n"
6714 "Address Family Modifier\n"
e0bce756 6715 BGP_SOFT_OUT_STR)
718e3744 6716
587ff0fd
LB
6717DEFUN (clear_ip_bgp_all_encap_soft_out,
6718 clear_ip_bgp_all_encap_soft_out_cmd,
6719 "clear ip bgp * encap unicast soft out",
6720 CLEAR_STR
6721 IP_STR
6722 BGP_STR
6723 "Clear all peers\n"
6724 "Address family\n"
6725 "Address Family Modifier\n"
6726 "Soft reconfig\n"
6727 "Soft reconfig outbound update\n")
6728{
6729 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
6730 BGP_CLEAR_SOFT_OUT, NULL);
6731}
6732
6733ALIAS (clear_ip_bgp_all_encap_soft_out,
6734 clear_ip_bgp_all_encap_out_cmd,
6735 "clear ip bgp * encap unicast out",
6736 CLEAR_STR
6737 IP_STR
6738 BGP_STR
6739 "Clear all peers\n"
6740 "Address family\n"
6741 "Address Family Modifier\n"
6742 "Soft reconfig outbound update\n")
6743
718e3744 6744DEFUN (clear_bgp_all_soft_out,
6745 clear_bgp_all_soft_out_cmd,
6746 "clear bgp * soft out",
6747 CLEAR_STR
6748 BGP_STR
6749 "Clear all peers\n"
e0bce756
DS
6750 BGP_SOFT_STR
6751 BGP_SOFT_OUT_STR)
718e3744 6752{
6aeb9e78
DS
6753 if (argc == 2)
6754 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all,
718e3744 6755 BGP_CLEAR_SOFT_OUT, NULL);
6756
6757 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6758 BGP_CLEAR_SOFT_OUT, NULL);
6759}
6760
6761ALIAS (clear_bgp_all_soft_out,
6762 clear_bgp_instance_all_soft_out_cmd,
8386ac43 6763 "clear bgp " BGP_INSTANCE_CMD " * soft out",
718e3744 6764 CLEAR_STR
6765 BGP_STR
8386ac43 6766 BGP_INSTANCE_HELP_STR
718e3744 6767 "Clear all peers\n"
e0bce756
DS
6768 BGP_SOFT_STR
6769 BGP_SOFT_OUT_STR)
718e3744 6770
6771ALIAS (clear_bgp_all_soft_out,
6772 clear_bgp_all_out_cmd,
6773 "clear bgp * out",
6774 CLEAR_STR
6775 BGP_STR
6776 "Clear all peers\n"
e0bce756 6777 BGP_SOFT_OUT_STR)
718e3744 6778
01080f7c 6779ALIAS (clear_bgp_all_soft_out,
6780 clear_bgp_instance_all_out_cmd,
6781 "clear bgp " BGP_INSTANCE_CMD " * out",
6782 CLEAR_STR
6783 BGP_STR
6784 BGP_INSTANCE_HELP_STR
6785 "Clear all peers\n"
6786 BGP_SOFT_OUT_STR)
6787
718e3744 6788ALIAS (clear_bgp_all_soft_out,
6789 clear_bgp_ipv6_all_soft_out_cmd,
6790 "clear bgp ipv6 * soft out",
6791 CLEAR_STR
6792 BGP_STR
6793 "Address family\n"
6794 "Clear all peers\n"
e0bce756
DS
6795 BGP_SOFT_STR
6796 BGP_SOFT_OUT_STR)
718e3744 6797
01080f7c 6798ALIAS (clear_bgp_all_soft_out,
6799 clear_bgp_instance_ipv6_all_soft_out_cmd,
6800 "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft out",
6801 CLEAR_STR
6802 BGP_STR
6803 BGP_INSTANCE_HELP_STR
6804 "Address family\n"
6805 "Clear all peers\n"
6806 BGP_SOFT_STR
6807 BGP_SOFT_OUT_STR)
6808
718e3744 6809ALIAS (clear_bgp_all_soft_out,
6810 clear_bgp_ipv6_all_out_cmd,
6811 "clear bgp ipv6 * out",
6812 CLEAR_STR
6813 BGP_STR
6814 "Address family\n"
6815 "Clear all peers\n"
e0bce756 6816 BGP_SOFT_OUT_STR)
718e3744 6817
01080f7c 6818ALIAS (clear_bgp_all_soft_out,
6819 clear_bgp_instance_ipv6_all_out_cmd,
6820 "clear bgp " BGP_INSTANCE_CMD " ipv6 * out",
6821 CLEAR_STR
6822 BGP_STR
6823 BGP_INSTANCE_HELP_STR
6824 "Address family\n"
6825 "Clear all peers\n"
6826 BGP_SOFT_OUT_STR)
6827
8ad7271d
DS
6828DEFUN (clear_bgp_ipv6_safi_prefix,
6829 clear_bgp_ipv6_safi_prefix_cmd,
6830 "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M",
6831 CLEAR_STR
6832 BGP_STR
6833 "Address family\n"
6834 "Address Family Modifier\n"
6835 "Clear bestpath and re-advertise\n"
6836 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6837{
6838 if (strncmp (argv[0], "m", 1) == 0)
6839 return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL);
6840 else
6841 return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL);
6842}
6843
01080f7c 6844DEFUN (clear_bgp_instance_ipv6_safi_prefix,
6845 clear_bgp_instance_ipv6_safi_prefix_cmd,
6846 "clear bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) prefix X:X::X:X/M",
6847 CLEAR_STR
6848 BGP_STR
6849 BGP_INSTANCE_HELP_STR
6850 "Address family\n"
6851 "Address Family Modifier\n"
6852 "Clear bestpath and re-advertise\n"
6853 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6854{
6855 if (strncmp (argv[2], "m", 1) == 0)
6856 return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_MULTICAST, NULL);
6857 else
6858 return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_UNICAST, NULL);
6859}
6860
718e3744 6861DEFUN (clear_ip_bgp_peer_soft_out,
6862 clear_ip_bgp_peer_soft_out_cmd,
db64ea86 6863 "clear ip bgp (A.B.C.D|WORD) soft out",
718e3744 6864 CLEAR_STR
6865 IP_STR
6866 BGP_STR
6867 "BGP neighbor address to clear\n"
db64ea86 6868 "BGP neighbor on interface to clear\n"
e0bce756
DS
6869 BGP_SOFT_STR
6870 BGP_SOFT_OUT_STR)
718e3744 6871{
01080f7c 6872 if (argc == 3)
6873 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
6874 BGP_CLEAR_SOFT_OUT, argv[2]);
6875
718e3744 6876 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6877 BGP_CLEAR_SOFT_OUT, argv[0]);
6878}
6879
01080f7c 6880ALIAS (clear_ip_bgp_peer_soft_out,
6881 clear_ip_bgp_instance_peer_soft_out_cmd,
6882 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft out",
6883 CLEAR_STR
6884 IP_STR
6885 BGP_STR
6886 BGP_INSTANCE_HELP_STR
6887 "BGP neighbor address to clear\n"
6888 "BGP neighbor on interface to clear\n"
6889 BGP_SOFT_STR
6890 BGP_SOFT_OUT_STR)
6891
718e3744 6892ALIAS (clear_ip_bgp_peer_soft_out,
6893 clear_ip_bgp_peer_out_cmd,
db64ea86 6894 "clear ip bgp (A.B.C.D|WORD) out",
718e3744 6895 CLEAR_STR
6896 IP_STR
6897 BGP_STR
6898 "BGP neighbor address to clear\n"
db64ea86 6899 "BGP neighbor on interface to clear\n"
e0bce756 6900 BGP_SOFT_OUT_STR)
718e3744 6901
01080f7c 6902ALIAS (clear_ip_bgp_peer_soft_out,
6903 clear_ip_bgp_instance_peer_out_cmd,
6904 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) out",
6905 CLEAR_STR
6906 IP_STR
6907 BGP_STR
6908 BGP_INSTANCE_HELP_STR
6909 "BGP neighbor address to clear\n"
6910 "BGP neighbor on interface to clear\n"
6911 BGP_SOFT_OUT_STR)
6912
718e3744 6913DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
6914 clear_ip_bgp_peer_ipv4_soft_out_cmd,
db64ea86 6915 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out",
718e3744 6916 CLEAR_STR
6917 IP_STR
6918 BGP_STR
6919 "BGP neighbor address to clear\n"
db64ea86 6920 "BGP neighbor on interface to clear\n"
718e3744 6921 "Address family\n"
6922 "Address Family modifier\n"
6923 "Address Family modifier\n"
e0bce756
DS
6924 BGP_SOFT_STR
6925 BGP_SOFT_OUT_STR)
718e3744 6926{
6927 if (strncmp (argv[1], "m", 1) == 0)
6928 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6929 BGP_CLEAR_SOFT_OUT, argv[0]);
6930
6931 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6932 BGP_CLEAR_SOFT_OUT, argv[0]);
6933}
6934
01080f7c 6935DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out,
6936 clear_ip_bgp_instance_peer_ipv4_soft_out_cmd,
6937 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out",
6938 CLEAR_STR
6939 IP_STR
6940 BGP_STR
6941 BGP_INSTANCE_HELP_STR
6942 "BGP neighbor address to clear\n"
6943 "BGP neighbor on interface to clear\n"
6944 "Address family\n"
6945 "Address Family modifier\n"
6946 "Address Family modifier\n"
6947 BGP_SOFT_STR
6948 BGP_SOFT_OUT_STR)
6949{
6950 if (strncmp (argv[3], "m", 1) == 0)
6951 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer,
6952 BGP_CLEAR_SOFT_OUT, argv[2]);
6953
6954 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
6955 BGP_CLEAR_SOFT_OUT, argv[2]);
6956}
6957
718e3744 6958ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
6959 clear_ip_bgp_peer_ipv4_out_cmd,
db64ea86 6960 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out",
718e3744 6961 CLEAR_STR
6962 IP_STR
6963 BGP_STR
6964 "BGP neighbor address to clear\n"
db64ea86 6965 "BGP neighbor on interface to clear\n"
718e3744 6966 "Address family\n"
6967 "Address Family modifier\n"
6968 "Address Family modifier\n"
e0bce756 6969 BGP_SOFT_OUT_STR)
718e3744 6970
01080f7c 6971ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_out,
6972 clear_ip_bgp_instance_peer_ipv4_out_cmd,
6973 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) out",
6974 CLEAR_STR
6975 IP_STR
6976 BGP_STR
6977 BGP_INSTANCE_HELP_STR
6978 "BGP neighbor address to clear\n"
6979 "BGP neighbor on interface to clear\n"
6980 "Address family\n"
6981 "Address Family modifier\n"
6982 "Address Family modifier\n"
6983 BGP_SOFT_OUT_STR)
6984
db64ea86 6985/* NOTE: WORD peers have not been tested for vpnv4 */
718e3744 6986DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
6987 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
db64ea86 6988 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft out",
718e3744 6989 CLEAR_STR
6990 IP_STR
6991 BGP_STR
6992 "BGP neighbor address to clear\n"
db64ea86 6993 "BGP neighbor on interface to clear\n"
718e3744 6994 "Address family\n"
6995 "Address Family Modifier\n"
e0bce756
DS
6996 BGP_SOFT_STR
6997 BGP_SOFT_OUT_STR)
718e3744 6998{
6999 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
7000 BGP_CLEAR_SOFT_OUT, argv[0]);
7001}
7002
7003ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
7004 clear_ip_bgp_peer_vpnv4_out_cmd,
db64ea86 7005 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out",
718e3744 7006 CLEAR_STR
7007 IP_STR
7008 BGP_STR
7009 "BGP neighbor address to clear\n"
db64ea86 7010 "BGP neighbor on interface to clear\n"
718e3744 7011 "Address family\n"
7012 "Address Family Modifier\n"
e0bce756 7013 BGP_SOFT_OUT_STR)
718e3744 7014
587ff0fd
LB
7015DEFUN (clear_ip_bgp_peer_encap_soft_out,
7016 clear_ip_bgp_peer_encap_soft_out_cmd,
7017 "clear ip bgp A.B.C.D encap unicast soft out",
7018 CLEAR_STR
7019 IP_STR
7020 BGP_STR
7021 "BGP neighbor address to clear\n"
7022 "Address family\n"
7023 "Address Family Modifier\n"
7024 "Soft reconfig\n"
7025 "Soft reconfig outbound update\n")
7026{
7027 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
7028 BGP_CLEAR_SOFT_OUT, argv[0]);
7029}
7030
7031ALIAS (clear_ip_bgp_peer_encap_soft_out,
7032 clear_ip_bgp_peer_encap_out_cmd,
7033 "clear ip bgp A.B.C.D encap unicast out",
7034 CLEAR_STR
7035 IP_STR
7036 BGP_STR
7037 "BGP neighbor address to clear\n"
7038 "Address family\n"
7039 "Address Family Modifier\n"
7040 "Soft reconfig outbound update\n")
7041
718e3744 7042DEFUN (clear_bgp_peer_soft_out,
7043 clear_bgp_peer_soft_out_cmd,
a80beece 7044 "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out",
718e3744 7045 CLEAR_STR
7046 BGP_STR
7047 "BGP neighbor address to clear\n"
7048 "BGP IPv6 neighbor to clear\n"
a80beece 7049 "BGP neighbor on interface to clear\n"
e0bce756
DS
7050 BGP_SOFT_STR
7051 BGP_SOFT_OUT_STR)
718e3744 7052{
01080f7c 7053 if (argc == 3)
7054 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer,
7055 BGP_CLEAR_SOFT_OUT, argv[2]);
7056
718e3744 7057 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
7058 BGP_CLEAR_SOFT_OUT, argv[0]);
7059}
7060
01080f7c 7061ALIAS (clear_bgp_peer_soft_out,
7062 clear_bgp_instance_peer_soft_out_cmd,
7063 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft out",
7064 CLEAR_STR
7065 BGP_STR
7066 BGP_INSTANCE_HELP_STR
7067 "BGP neighbor address to clear\n"
7068 "BGP IPv6 neighbor to clear\n"
7069 "BGP neighbor on interface to clear\n"
7070 BGP_SOFT_STR
7071 BGP_SOFT_OUT_STR)
7072
718e3744 7073ALIAS (clear_bgp_peer_soft_out,
7074 clear_bgp_ipv6_peer_soft_out_cmd,
a80beece 7075 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out",
718e3744 7076 CLEAR_STR
7077 BGP_STR
7078 "Address family\n"
7079 "BGP neighbor address to clear\n"
7080 "BGP IPv6 neighbor to clear\n"
a80beece 7081 "BGP neighbor on interface to clear\n"
e0bce756
DS
7082 BGP_SOFT_STR
7083 BGP_SOFT_OUT_STR)
718e3744 7084
01080f7c 7085ALIAS (clear_bgp_peer_soft_out,
7086 clear_bgp_instance_ipv6_peer_soft_out_cmd,
7087 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft out",
7088 CLEAR_STR
7089 BGP_STR
7090 BGP_INSTANCE_HELP_STR
7091 "Address family\n"
7092 "BGP neighbor address to clear\n"
7093 "BGP IPv6 neighbor to clear\n"
7094 "BGP neighbor on interface to clear\n"
7095 BGP_SOFT_STR
7096 BGP_SOFT_OUT_STR)
7097
718e3744 7098ALIAS (clear_bgp_peer_soft_out,
7099 clear_bgp_peer_out_cmd,
a80beece 7100 "clear bgp (A.B.C.D|X:X::X:X|WORD) out",
718e3744 7101 CLEAR_STR
7102 BGP_STR
7103 "BGP neighbor address to clear\n"
7104 "BGP IPv6 neighbor to clear\n"
a80beece 7105 "BGP neighbor on interface to clear\n"
e0bce756 7106 BGP_SOFT_OUT_STR)
718e3744 7107
01080f7c 7108ALIAS (clear_bgp_peer_soft_out,
7109 clear_bgp_instance_peer_out_cmd,
7110 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) out",
7111 CLEAR_STR
7112 BGP_STR
7113 BGP_INSTANCE_HELP_STR
7114 "BGP neighbor address to clear\n"
7115 "BGP IPv6 neighbor to clear\n"
7116 "BGP neighbor on interface to clear\n"
7117 BGP_SOFT_OUT_STR)
7118
718e3744 7119ALIAS (clear_bgp_peer_soft_out,
7120 clear_bgp_ipv6_peer_out_cmd,
a80beece 7121 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out",
718e3744 7122 CLEAR_STR
7123 BGP_STR
7124 "Address family\n"
7125 "BGP neighbor address to clear\n"
7126 "BGP IPv6 neighbor to clear\n"
a80beece 7127 "BGP neighbor on interface to clear\n"
e0bce756 7128 BGP_SOFT_OUT_STR)
718e3744 7129
01080f7c 7130ALIAS (clear_bgp_peer_soft_out,
7131 clear_bgp_instance_ipv6_peer_out_cmd,
7132 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) out",
7133 CLEAR_STR
7134 BGP_STR
7135 BGP_INSTANCE_HELP_STR
7136 "Address family\n"
7137 "BGP neighbor address to clear\n"
7138 "BGP IPv6 neighbor to clear\n"
7139 "BGP neighbor on interface to clear\n"
7140 BGP_SOFT_OUT_STR)
7141
718e3744 7142DEFUN (clear_ip_bgp_peer_group_soft_out,
7143 clear_ip_bgp_peer_group_soft_out_cmd,
7144 "clear ip bgp peer-group WORD soft out",
7145 CLEAR_STR
7146 IP_STR
7147 BGP_STR
7148 "Clear all members of peer-group\n"
7149 "BGP peer-group name\n"
e0bce756
DS
7150 BGP_SOFT_STR
7151 BGP_SOFT_OUT_STR)
718e3744 7152{
01080f7c 7153 if (argc == 3)
7154 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
7155 BGP_CLEAR_SOFT_OUT, argv[2]);
7156
718e3744 7157 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
7158 BGP_CLEAR_SOFT_OUT, argv[0]);
7159}
7160
01080f7c 7161ALIAS (clear_ip_bgp_peer_group_soft_out,
7162 clear_ip_bgp_instance_peer_group_soft_out_cmd,
7163 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft out",
7164 CLEAR_STR
7165 IP_STR
7166 BGP_STR
7167 BGP_INSTANCE_HELP_STR
7168 "Clear all members of peer-group\n"
7169 "BGP peer-group name\n"
7170 BGP_SOFT_STR
7171 BGP_SOFT_OUT_STR)
7172
718e3744 7173ALIAS (clear_ip_bgp_peer_group_soft_out,
7174 clear_ip_bgp_peer_group_out_cmd,
7175 "clear ip bgp peer-group WORD out",
7176 CLEAR_STR
7177 IP_STR
7178 BGP_STR
7179 "Clear all members of peer-group\n"
7180 "BGP peer-group name\n"
e0bce756 7181 BGP_SOFT_OUT_STR)
718e3744 7182
01080f7c 7183ALIAS (clear_ip_bgp_peer_group_soft_out,
7184 clear_ip_bgp_instance_peer_group_out_cmd,
7185 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD out",
7186 CLEAR_STR
7187 IP_STR
7188 BGP_STR
7189 BGP_INSTANCE_HELP_STR
7190 "Clear all members of peer-group\n"
7191 "BGP peer-group name\n"
7192 BGP_SOFT_OUT_STR)
7193
718e3744 7194DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
7195 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
7196 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
7197 CLEAR_STR
7198 IP_STR
7199 BGP_STR
7200 "Clear all members of peer-group\n"
7201 "BGP peer-group name\n"
7202 "Address family\n"
7203 "Address Family modifier\n"
7204 "Address Family modifier\n"
e0bce756
DS
7205 BGP_SOFT_STR
7206 BGP_SOFT_OUT_STR)
718e3744 7207{
7208 if (strncmp (argv[1], "m", 1) == 0)
7209 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
7210 BGP_CLEAR_SOFT_OUT, argv[0]);
7211
7212 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
7213 BGP_CLEAR_SOFT_OUT, argv[0]);
7214}
7215
01080f7c 7216DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out,
7217 clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd,
7218 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft out",
7219 CLEAR_STR
7220 IP_STR
7221 BGP_STR
7222 BGP_INSTANCE_HELP_STR
7223 "Clear all members of peer-group\n"
7224 "BGP peer-group name\n"
7225 "Address family\n"
7226 "Address Family modifier\n"
7227 "Address Family modifier\n"
7228 BGP_SOFT_STR
7229 BGP_SOFT_OUT_STR)
7230{
7231 if (strncmp (argv[3], "m", 1) == 0)
7232 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group,
7233 BGP_CLEAR_SOFT_OUT, argv[2]);
7234
7235 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
7236 BGP_CLEAR_SOFT_OUT, argv[2]);
7237}
7238
718e3744 7239ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
7240 clear_ip_bgp_peer_group_ipv4_out_cmd,
7241 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
7242 CLEAR_STR
7243 IP_STR
7244 BGP_STR
7245 "Clear all members of peer-group\n"
7246 "BGP peer-group name\n"
7247 "Address family\n"
7248 "Address Family modifier\n"
7249 "Address Family modifier\n"
e0bce756 7250 BGP_SOFT_OUT_STR)
718e3744 7251
01080f7c 7252ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_out,
7253 clear_ip_bgp_instance_peer_group_ipv4_out_cmd,
7254 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) out",
7255 CLEAR_STR
7256 IP_STR
7257 BGP_STR
7258 BGP_INSTANCE_HELP_STR
7259 "Clear all members of peer-group\n"
7260 "BGP peer-group name\n"
7261 "Address family\n"
7262 "Address Family modifier\n"
7263 "Address Family modifier\n"
7264 BGP_SOFT_OUT_STR)
7265
718e3744 7266DEFUN (clear_bgp_peer_group_soft_out,
7267 clear_bgp_peer_group_soft_out_cmd,
7268 "clear bgp peer-group WORD soft out",
7269 CLEAR_STR
7270 BGP_STR
7271 "Clear all members of peer-group\n"
7272 "BGP peer-group name\n"
e0bce756
DS
7273 BGP_SOFT_STR
7274 BGP_SOFT_OUT_STR)
718e3744 7275{
01080f7c 7276 if (argc == 3)
7277 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group,
7278 BGP_CLEAR_SOFT_OUT, argv[2]);
7279
718e3744 7280 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
7281 BGP_CLEAR_SOFT_OUT, argv[0]);
7282}
7283
01080f7c 7284ALIAS (clear_bgp_peer_group_soft_out,
7285 clear_bgp_instance_peer_group_soft_out_cmd,
7286 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft out",
7287 CLEAR_STR
7288 BGP_STR
7289 BGP_INSTANCE_HELP_STR
7290 "Clear all members of peer-group\n"
7291 "BGP peer-group name\n"
7292 BGP_SOFT_STR
7293 BGP_SOFT_OUT_STR)
7294
718e3744 7295ALIAS (clear_bgp_peer_group_soft_out,
7296 clear_bgp_ipv6_peer_group_soft_out_cmd,
7297 "clear bgp ipv6 peer-group WORD soft out",
7298 CLEAR_STR
7299 BGP_STR
7300 "Address family\n"
7301 "Clear all members of peer-group\n"
7302 "BGP peer-group name\n"
e0bce756
DS
7303 BGP_SOFT_STR
7304 BGP_SOFT_OUT_STR)
718e3744 7305
01080f7c 7306ALIAS (clear_bgp_peer_group_soft_out,
7307 clear_bgp_instance_ipv6_peer_group_soft_out_cmd,
7308 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft out",
7309 CLEAR_STR
7310 BGP_STR
7311 BGP_INSTANCE_HELP_STR
7312 "Address family\n"
7313 "Clear all members of peer-group\n"
7314 "BGP peer-group name\n"
7315 BGP_SOFT_STR
7316 BGP_SOFT_OUT_STR)
7317
718e3744 7318ALIAS (clear_bgp_peer_group_soft_out,
7319 clear_bgp_peer_group_out_cmd,
7320 "clear bgp peer-group WORD out",
7321 CLEAR_STR
7322 BGP_STR
7323 "Clear all members of peer-group\n"
7324 "BGP peer-group name\n"
e0bce756 7325 BGP_SOFT_OUT_STR)
718e3744 7326
01080f7c 7327ALIAS (clear_bgp_peer_group_soft_out,
7328 clear_bgp_instance_peer_group_out_cmd,
7329 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD out",
7330 CLEAR_STR
7331 BGP_STR
7332 BGP_INSTANCE_HELP_STR
7333 "Clear all members of peer-group\n"
7334 "BGP peer-group name\n"
7335 BGP_SOFT_OUT_STR)
7336
718e3744 7337ALIAS (clear_bgp_peer_group_soft_out,
7338 clear_bgp_ipv6_peer_group_out_cmd,
7339 "clear bgp ipv6 peer-group WORD out",
7340 CLEAR_STR
7341 BGP_STR
7342 "Address family\n"
7343 "Clear all members of peer-group\n"
7344 "BGP peer-group name\n"
e0bce756 7345 BGP_SOFT_OUT_STR)
718e3744 7346
01080f7c 7347ALIAS (clear_bgp_peer_group_soft_out,
7348 clear_bgp_instance_ipv6_peer_group_out_cmd,
7349 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD out",
7350 CLEAR_STR
7351 BGP_STR
7352 BGP_INSTANCE_HELP_STR
7353 "Address family\n"
7354 "Clear all members of peer-group\n"
7355 "BGP peer-group name\n"
7356 BGP_SOFT_OUT_STR)
7357
718e3744 7358DEFUN (clear_ip_bgp_external_soft_out,
7359 clear_ip_bgp_external_soft_out_cmd,
7360 "clear ip bgp external soft out",
7361 CLEAR_STR
7362 IP_STR
7363 BGP_STR
7364 "Clear all external peers\n"
e0bce756
DS
7365 BGP_SOFT_STR
7366 BGP_SOFT_OUT_STR)
01080f7c 7367{
7368 if (argc == 2)
7369 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
7370 BGP_CLEAR_SOFT_OUT, NULL);
7371
7372 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
7373 BGP_CLEAR_SOFT_OUT, NULL);
7374}
7375
7376ALIAS (clear_ip_bgp_external_soft_out,
7377 clear_ip_bgp_instance_external_soft_out_cmd,
7378 "clear ip bgp " BGP_INSTANCE_CMD " external soft out",
7379 CLEAR_STR
7380 IP_STR
7381 BGP_STR
7382 BGP_INSTANCE_HELP_STR
7383 "Clear all external peers\n"
7384 BGP_SOFT_STR
7385 BGP_SOFT_OUT_STR)
7386
7387ALIAS (clear_ip_bgp_external_soft_out,
7388 clear_ip_bgp_external_out_cmd,
7389 "clear ip bgp external out",
7390 CLEAR_STR
7391 IP_STR
7392 BGP_STR
7393 "Clear all external peers\n"
7394 BGP_SOFT_OUT_STR)
718e3744 7395
7396ALIAS (clear_ip_bgp_external_soft_out,
01080f7c 7397 clear_ip_bgp_instance_external_out_cmd,
7398 "clear ip bgp " BGP_INSTANCE_CMD " external out",
718e3744 7399 CLEAR_STR
7400 IP_STR
7401 BGP_STR
01080f7c 7402 BGP_INSTANCE_HELP_STR
718e3744 7403 "Clear all external peers\n"
e0bce756 7404 BGP_SOFT_OUT_STR)
718e3744 7405
7406DEFUN (clear_ip_bgp_external_ipv4_soft_out,
7407 clear_ip_bgp_external_ipv4_soft_out_cmd,
7408 "clear ip bgp external ipv4 (unicast|multicast) soft out",
7409 CLEAR_STR
7410 IP_STR
7411 BGP_STR
7412 "Clear all external peers\n"
7413 "Address family\n"
7414 "Address Family modifier\n"
7415 "Address Family modifier\n"
e0bce756
DS
7416 BGP_SOFT_STR
7417 BGP_SOFT_OUT_STR)
718e3744 7418{
7419 if (strncmp (argv[0], "m", 1) == 0)
7420 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
7421 BGP_CLEAR_SOFT_OUT, NULL);
7422
7423 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
7424 BGP_CLEAR_SOFT_OUT, NULL);
7425}
7426
01080f7c 7427DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out,
7428 clear_ip_bgp_instance_external_ipv4_soft_out_cmd,
7429 "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft out",
7430 CLEAR_STR
7431 IP_STR
7432 BGP_STR
7433 BGP_INSTANCE_HELP_STR
7434 "Clear all external peers\n"
7435 "Address family\n"
7436 "Address Family modifier\n"
7437 "Address Family modifier\n"
7438 BGP_SOFT_STR
7439 BGP_SOFT_OUT_STR)
7440{
7441 if (strncmp (argv[2], "m", 1) == 0)
7442 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external,
7443 BGP_CLEAR_SOFT_OUT, NULL);
7444
7445 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
7446 BGP_CLEAR_SOFT_OUT, NULL);
7447}
7448
718e3744 7449ALIAS (clear_ip_bgp_external_ipv4_soft_out,
7450 clear_ip_bgp_external_ipv4_out_cmd,
7451 "clear ip bgp external ipv4 (unicast|multicast) out",
7452 CLEAR_STR
7453 IP_STR
7454 BGP_STR
7455 "Clear all external peers\n"
7456 "Address family\n"
7457 "Address Family modifier\n"
7458 "Address Family modifier\n"
e0bce756 7459 BGP_SOFT_OUT_STR)
718e3744 7460
01080f7c 7461ALIAS (clear_ip_bgp_instance_external_ipv4_soft_out,
7462 clear_ip_bgp_instance_external_ipv4_out_cmd,
7463 "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) out",
7464 CLEAR_STR
7465 IP_STR
7466 BGP_STR
7467 BGP_INSTANCE_HELP_STR
7468 "Clear all external peers\n"
7469 "Address family\n"
7470 "Address Family modifier\n"
7471 "Address Family modifier\n"
7472 BGP_SOFT_OUT_STR)
7473
718e3744 7474DEFUN (clear_bgp_external_soft_out,
7475 clear_bgp_external_soft_out_cmd,
7476 "clear bgp external soft out",
7477 CLEAR_STR
7478 BGP_STR
7479 "Clear all external peers\n"
e0bce756
DS
7480 BGP_SOFT_STR
7481 BGP_SOFT_OUT_STR)
718e3744 7482{
01080f7c 7483 if (argc == 2)
7484 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external,
7485 BGP_CLEAR_SOFT_OUT, NULL);
7486
718e3744 7487 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
7488 BGP_CLEAR_SOFT_OUT, NULL);
7489}
7490
01080f7c 7491ALIAS (clear_bgp_external_soft_out,
7492 clear_bgp_instance_external_soft_out_cmd,
7493 "clear bgp " BGP_INSTANCE_CMD " external soft out",
7494 CLEAR_STR
7495 BGP_STR
7496 BGP_INSTANCE_HELP_STR
7497 "Clear all external peers\n"
7498 BGP_SOFT_STR
7499 BGP_SOFT_OUT_STR)
7500
718e3744 7501ALIAS (clear_bgp_external_soft_out,
7502 clear_bgp_ipv6_external_soft_out_cmd,
7503 "clear bgp ipv6 external soft out",
7504 CLEAR_STR
7505 BGP_STR
7506 "Address family\n"
7507 "Clear all external peers\n"
e0bce756
DS
7508 BGP_SOFT_STR
7509 BGP_SOFT_OUT_STR)
718e3744 7510
01080f7c 7511ALIAS (clear_bgp_external_soft_out,
7512 clear_bgp_instance_ipv6_external_soft_out_cmd,
7513 "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft out",
7514 CLEAR_STR
7515 BGP_STR
7516 BGP_INSTANCE_HELP_STR
7517 "Address family\n"
7518 "Clear all external peers\n"
7519 BGP_SOFT_STR
7520 BGP_SOFT_OUT_STR)
7521
718e3744 7522ALIAS (clear_bgp_external_soft_out,
7523 clear_bgp_external_out_cmd,
7524 "clear bgp external out",
7525 CLEAR_STR
7526 BGP_STR
7527 "Clear all external peers\n"
e0bce756 7528 BGP_SOFT_OUT_STR)
718e3744 7529
01080f7c 7530ALIAS (clear_bgp_external_soft_out,
7531 clear_bgp_instance_external_out_cmd,
7532 "clear bgp " BGP_INSTANCE_CMD " external out",
7533 CLEAR_STR
7534 BGP_STR
7535 BGP_INSTANCE_HELP_STR
7536 "Clear all external peers\n"
7537 BGP_SOFT_OUT_STR)
7538
718e3744 7539ALIAS (clear_bgp_external_soft_out,
7540 clear_bgp_ipv6_external_out_cmd,
7541 "clear bgp ipv6 external WORD out",
7542 CLEAR_STR
7543 BGP_STR
7544 "Address family\n"
7545 "Clear all external peers\n"
e0bce756 7546 BGP_SOFT_OUT_STR)
718e3744 7547
01080f7c 7548ALIAS (clear_bgp_external_soft_out,
7549 clear_bgp_instance_ipv6_external_out_cmd,
7550 "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD out",
7551 CLEAR_STR
7552 BGP_STR
7553 BGP_INSTANCE_HELP_STR
7554 "Address family\n"
7555 "Clear all external peers\n"
7556 BGP_SOFT_OUT_STR)
7557
718e3744 7558DEFUN (clear_ip_bgp_as_soft_out,
7559 clear_ip_bgp_as_soft_out_cmd,
320da874 7560 "clear ip bgp " CMD_AS_RANGE " soft out",
718e3744 7561 CLEAR_STR
7562 IP_STR
7563 BGP_STR
7564 "Clear peers with the AS number\n"
e0bce756
DS
7565 BGP_SOFT_STR
7566 BGP_SOFT_OUT_STR)
718e3744 7567{
01080f7c 7568 if (argc == 3)
7569 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
7570 BGP_CLEAR_SOFT_OUT, argv[2]);
7571
718e3744 7572 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
7573 BGP_CLEAR_SOFT_OUT, argv[0]);
7574}
7575
01080f7c 7576ALIAS (clear_ip_bgp_as_soft_out,
7577 clear_ip_bgp_instance_as_soft_out_cmd,
7578 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out",
7579 CLEAR_STR
7580 IP_STR
7581 BGP_STR
7582 BGP_INSTANCE_HELP_STR
7583 "Clear peers with the AS number\n"
7584 BGP_SOFT_STR
7585 BGP_SOFT_OUT_STR)
7586
718e3744 7587ALIAS (clear_ip_bgp_as_soft_out,
7588 clear_ip_bgp_as_out_cmd,
320da874 7589 "clear ip bgp " CMD_AS_RANGE " out",
718e3744 7590 CLEAR_STR
7591 IP_STR
7592 BGP_STR
7593 "Clear peers with the AS number\n"
e0bce756 7594 BGP_SOFT_OUT_STR)
718e3744 7595
01080f7c 7596ALIAS (clear_ip_bgp_as_soft_out,
7597 clear_ip_bgp_instance_as_out_cmd,
7598 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out",
7599 CLEAR_STR
7600 IP_STR
7601 BGP_STR
7602 BGP_INSTANCE_HELP_STR
7603 "Clear peers with the AS number\n"
7604 BGP_SOFT_OUT_STR)
7605
718e3744 7606DEFUN (clear_ip_bgp_as_ipv4_soft_out,
7607 clear_ip_bgp_as_ipv4_soft_out_cmd,
320da874 7608 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
718e3744 7609 CLEAR_STR
7610 IP_STR
7611 BGP_STR
7612 "Clear peers with the AS number\n"
7613 "Address family\n"
7614 "Address Family modifier\n"
7615 "Address Family modifier\n"
e0bce756
DS
7616 BGP_SOFT_STR
7617 BGP_SOFT_OUT_STR)
718e3744 7618{
7619 if (strncmp (argv[1], "m", 1) == 0)
7620 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
7621 BGP_CLEAR_SOFT_OUT, argv[0]);
7622
7623 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
7624 BGP_CLEAR_SOFT_OUT, argv[0]);
7625}
7626
01080f7c 7627DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out,
7628 clear_ip_bgp_instance_as_ipv4_soft_out_cmd,
7629 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
7630 CLEAR_STR
7631 IP_STR
7632 BGP_STR
7633 BGP_INSTANCE_HELP_STR
7634 "Clear peers with the AS number\n"
7635 "Address family\n"
7636 "Address Family modifier\n"
7637 "Address Family modifier\n"
7638 BGP_SOFT_STR
7639 BGP_SOFT_OUT_STR)
7640{
7641 if (strncmp (argv[3], "m", 1) == 0)
7642 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as,
7643 BGP_CLEAR_SOFT_OUT, argv[2]);
7644
7645 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
7646 BGP_CLEAR_SOFT_OUT, argv[2]);
7647}
7648
718e3744 7649ALIAS (clear_ip_bgp_as_ipv4_soft_out,
7650 clear_ip_bgp_as_ipv4_out_cmd,
320da874 7651 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
718e3744 7652 CLEAR_STR
7653 IP_STR
7654 BGP_STR
7655 "Clear peers with the AS number\n"
7656 "Address family\n"
7657 "Address Family modifier\n"
7658 "Address Family modifier\n"
e0bce756 7659 BGP_SOFT_OUT_STR)
718e3744 7660
01080f7c 7661ALIAS (clear_ip_bgp_instance_as_ipv4_soft_out,
7662 clear_ip_bgp_instance_as_ipv4_out_cmd,
7663 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
7664 CLEAR_STR
7665 IP_STR
7666 BGP_STR
7667 BGP_INSTANCE_HELP_STR
7668 "Clear peers with the AS number\n"
7669 "Address family\n"
7670 "Address Family modifier\n"
7671 "Address Family modifier\n"
7672 BGP_SOFT_OUT_STR)
7673
718e3744 7674DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
7675 clear_ip_bgp_as_vpnv4_soft_out_cmd,
320da874 7676 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
718e3744 7677 CLEAR_STR
7678 IP_STR
7679 BGP_STR
7680 "Clear peers with the AS number\n"
7681 "Address family\n"
7682 "Address Family modifier\n"
e0bce756
DS
7683 BGP_SOFT_STR
7684 BGP_SOFT_OUT_STR)
718e3744 7685{
7686 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
7687 BGP_CLEAR_SOFT_OUT, argv[0]);
7688}
7689
7690ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
7691 clear_ip_bgp_as_vpnv4_out_cmd,
320da874 7692 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
718e3744 7693 CLEAR_STR
7694 IP_STR
7695 BGP_STR
7696 "Clear peers with the AS number\n"
7697 "Address family\n"
7698 "Address Family modifier\n"
e0bce756 7699 BGP_SOFT_OUT_STR)
718e3744 7700
587ff0fd
LB
7701DEFUN (clear_ip_bgp_as_encap_soft_out,
7702 clear_ip_bgp_as_encap_soft_out_cmd,
7703 "clear ip bgp " CMD_AS_RANGE " encap unicast soft out",
7704 CLEAR_STR
7705 IP_STR
7706 BGP_STR
7707 "Clear peers with the AS number\n"
7708 "Address family\n"
7709 "Address Family modifier\n"
7710 "Soft reconfig\n"
7711 "Soft reconfig outbound update\n")
7712{
7713 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
7714 BGP_CLEAR_SOFT_OUT, argv[0]);
7715}
7716
7717ALIAS (clear_ip_bgp_as_encap_soft_out,
7718 clear_ip_bgp_as_encap_out_cmd,
7719 "clear ip bgp " CMD_AS_RANGE " encap unicast out",
7720 CLEAR_STR
7721 IP_STR
7722 BGP_STR
7723 "Clear peers with the AS number\n"
7724 "Address family\n"
7725 "Address Family modifier\n"
7726 "Soft reconfig outbound update\n")
7727
718e3744 7728DEFUN (clear_bgp_as_soft_out,
7729 clear_bgp_as_soft_out_cmd,
320da874 7730 "clear bgp " CMD_AS_RANGE " soft out",
718e3744 7731 CLEAR_STR
7732 BGP_STR
7733 "Clear peers with the AS number\n"
e0bce756
DS
7734 BGP_SOFT_STR
7735 BGP_SOFT_OUT_STR)
718e3744 7736{
01080f7c 7737 if (argc == 3)
7738 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as,
7739 BGP_CLEAR_SOFT_OUT, argv[2]);
7740
718e3744 7741 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
7742 BGP_CLEAR_SOFT_OUT, argv[0]);
7743}
7744
01080f7c 7745ALIAS (clear_bgp_as_soft_out,
7746 clear_bgp_instance_as_soft_out_cmd,
7747 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out",
7748 CLEAR_STR
7749 BGP_STR
7750 BGP_INSTANCE_HELP_STR
7751 "Clear peers with the AS number\n"
7752 BGP_SOFT_STR
7753 BGP_SOFT_OUT_STR)
7754
718e3744 7755ALIAS (clear_bgp_as_soft_out,
7756 clear_bgp_ipv6_as_soft_out_cmd,
320da874 7757 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
718e3744 7758 CLEAR_STR
7759 BGP_STR
7760 "Address family\n"
7761 "Clear peers with the AS number\n"
e0bce756
DS
7762 BGP_SOFT_STR
7763 BGP_SOFT_OUT_STR)
718e3744 7764
01080f7c 7765ALIAS (clear_bgp_as_soft_out,
7766 clear_bgp_instance_ipv6_as_soft_out_cmd,
7767 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft out",
7768 CLEAR_STR
7769 BGP_STR
7770 BGP_INSTANCE_HELP_STR
7771 "Address family\n"
7772 "Clear peers with the AS number\n"
7773 BGP_SOFT_STR
7774 BGP_SOFT_OUT_STR)
7775
718e3744 7776ALIAS (clear_bgp_as_soft_out,
7777 clear_bgp_as_out_cmd,
320da874 7778 "clear bgp " CMD_AS_RANGE " out",
718e3744 7779 CLEAR_STR
7780 BGP_STR
7781 "Clear peers with the AS number\n"
e0bce756 7782 BGP_SOFT_OUT_STR)
718e3744 7783
01080f7c 7784ALIAS (clear_bgp_as_soft_out,
7785 clear_bgp_instance_as_out_cmd,
7786 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out",
7787 CLEAR_STR
7788 BGP_STR
7789 BGP_INSTANCE_HELP_STR
7790 "Clear peers with the AS number\n"
7791 BGP_SOFT_OUT_STR)
7792
718e3744 7793ALIAS (clear_bgp_as_soft_out,
7794 clear_bgp_ipv6_as_out_cmd,
320da874 7795 "clear bgp ipv6 " CMD_AS_RANGE " out",
718e3744 7796 CLEAR_STR
7797 BGP_STR
7798 "Address family\n"
7799 "Clear peers with the AS number\n"
e0bce756 7800 BGP_SOFT_OUT_STR)
6b0655a2 7801
01080f7c 7802ALIAS (clear_bgp_as_soft_out,
7803 clear_bgp_instance_ipv6_as_out_cmd,
7804 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " out",
7805 CLEAR_STR
7806 BGP_STR
7807 BGP_INSTANCE_HELP_STR
7808 "Address family\n"
7809 "Clear peers with the AS number\n"
7810 BGP_SOFT_OUT_STR)
7811
718e3744 7812/* Inbound soft-reconfiguration */
7813DEFUN (clear_ip_bgp_all_soft_in,
7814 clear_ip_bgp_all_soft_in_cmd,
7815 "clear ip bgp * soft in",
7816 CLEAR_STR
7817 IP_STR
7818 BGP_STR
7819 "Clear all peers\n"
e0bce756
DS
7820 BGP_SOFT_STR
7821 BGP_SOFT_IN_STR)
718e3744 7822{
6aeb9e78
DS
7823 if (argc == 2)
7824 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
718e3744 7825 BGP_CLEAR_SOFT_IN, NULL);
7826
7827 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7828 BGP_CLEAR_SOFT_IN, NULL);
7829}
7830
7831ALIAS (clear_ip_bgp_all_soft_in,
7832 clear_ip_bgp_instance_all_soft_in_cmd,
8386ac43 7833 "clear ip bgp " BGP_INSTANCE_CMD " * soft in",
718e3744 7834 CLEAR_STR
7835 IP_STR
7836 BGP_STR
8386ac43 7837 BGP_INSTANCE_HELP_STR
718e3744 7838 "Clear all peers\n"
e0bce756
DS
7839 BGP_SOFT_STR
7840 BGP_SOFT_IN_STR)
718e3744 7841
7842ALIAS (clear_ip_bgp_all_soft_in,
7843 clear_ip_bgp_all_in_cmd,
7844 "clear ip bgp * in",
7845 CLEAR_STR
7846 IP_STR
7847 BGP_STR
7848 "Clear all peers\n"
e0bce756 7849 BGP_SOFT_IN_STR)
718e3744 7850
01080f7c 7851ALIAS (clear_ip_bgp_all_soft_in,
7852 clear_ip_bgp_instance_all_in_cmd,
7853 "clear ip bgp " BGP_INSTANCE_CMD " * in",
7854 CLEAR_STR
7855 IP_STR
7856 BGP_STR
7857 BGP_INSTANCE_HELP_STR
7858 "Clear all peers\n"
7859 BGP_SOFT_IN_STR)
7860
718e3744 7861DEFUN (clear_ip_bgp_all_in_prefix_filter,
7862 clear_ip_bgp_all_in_prefix_filter_cmd,
7863 "clear ip bgp * in prefix-filter",
7864 CLEAR_STR
7865 IP_STR
7866 BGP_STR
7867 "Clear all peers\n"
e0bce756 7868 BGP_SOFT_IN_STR
718e3744 7869 "Push out prefix-list ORF and do inbound soft reconfig\n")
7870{
6aeb9e78
DS
7871 if (argc== 2)
7872 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
718e3744 7873 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
7874
7875 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7876 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
7877}
7878
718e3744 7879DEFUN (clear_ip_bgp_all_ipv4_soft_in,
7880 clear_ip_bgp_all_ipv4_soft_in_cmd,
7881 "clear ip bgp * ipv4 (unicast|multicast) soft in",
7882 CLEAR_STR
7883 IP_STR
7884 BGP_STR
7885 "Clear all peers\n"
7886 "Address family\n"
7887 "Address Family modifier\n"
7888 "Address Family modifier\n"
e0bce756
DS
7889 BGP_SOFT_STR
7890 BGP_SOFT_IN_STR)
718e3744 7891{
7892 if (strncmp (argv[0], "m", 1) == 0)
7893 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
7894 BGP_CLEAR_SOFT_IN, NULL);
7895
7896 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7897 BGP_CLEAR_SOFT_IN, NULL);
7898}
7899
718e3744 7900DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
7901 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
8386ac43 7902 "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft in",
718e3744 7903 CLEAR_STR
7904 IP_STR
7905 BGP_STR
8386ac43 7906 BGP_INSTANCE_HELP_STR
718e3744 7907 "Clear all peers\n"
7908 "Address family\n"
7909 "Address Family modifier\n"
7910 "Address Family modifier\n"
e0bce756
DS
7911 BGP_SOFT_STR
7912 BGP_SOFT_IN_STR)
718e3744 7913{
6aeb9e78
DS
7914 if (strncmp (argv[2], "m", 1) == 0)
7915 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all,
718e3744 7916 BGP_CLEAR_SOFT_IN, NULL);
7917
6aeb9e78 7918 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
718e3744 7919 BGP_CLEAR_SOFT_IN, NULL);
7920}
7921
01080f7c 7922ALIAS (clear_ip_bgp_all_ipv4_soft_in,
7923 clear_ip_bgp_all_ipv4_in_cmd,
7924 "clear ip bgp * ipv4 (unicast|multicast) in",
718e3744 7925 CLEAR_STR
7926 IP_STR
7927 BGP_STR
7928 "Clear all peers\n"
7929 "Address family\n"
7930 "Address Family modifier\n"
7931 "Address Family modifier\n"
01080f7c 7932 BGP_SOFT_IN_STR)
718e3744 7933
01080f7c 7934ALIAS (clear_ip_bgp_instance_all_ipv4_soft_in,
7935 clear_ip_bgp_instance_all_ipv4_in_cmd,
7936 "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) in",
7937 CLEAR_STR
7938 IP_STR
7939 BGP_STR
7940 BGP_INSTANCE_HELP_STR
7941 "Clear all peers\n"
7942 "Address family\n"
7943 "Address Family modifier\n"
7944 "Address Family modifier\n"
7945 BGP_SOFT_IN_STR)
718e3744 7946
01080f7c 7947DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
7948 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
7949 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
718e3744 7950 CLEAR_STR
7951 IP_STR
7952 BGP_STR
7953 "Clear all peers\n"
7954 "Address family\n"
7955 "Address Family modifier\n"
7956 "Address Family modifier\n"
e0bce756 7957 BGP_SOFT_IN_STR
718e3744 7958 "Push out prefix-list ORF and do inbound soft reconfig\n")
7959{
01080f7c 7960 if (strncmp (argv[0], "m", 1) == 0)
7961 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
7962 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
718e3744 7963
01080f7c 7964 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7965 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
718e3744 7966}
7967
7968DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
7969 clear_ip_bgp_all_vpnv4_soft_in_cmd,
7970 "clear ip bgp * vpnv4 unicast soft in",
7971 CLEAR_STR
7972 IP_STR
7973 BGP_STR
7974 "Clear all peers\n"
7975 "Address family\n"
7976 "Address Family Modifier\n"
e0bce756
DS
7977 BGP_SOFT_STR
7978 BGP_SOFT_IN_STR)
718e3744 7979{
7980 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
7981 BGP_CLEAR_SOFT_IN, NULL);
7982}
7983
7984ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
7985 clear_ip_bgp_all_vpnv4_in_cmd,
7986 "clear ip bgp * vpnv4 unicast in",
7987 CLEAR_STR
7988 IP_STR
7989 BGP_STR
7990 "Clear all peers\n"
7991 "Address family\n"
7992 "Address Family Modifier\n"
e0bce756 7993 BGP_SOFT_IN_STR)
718e3744 7994
587ff0fd
LB
7995DEFUN (clear_ip_bgp_all_encap_soft_in,
7996 clear_ip_bgp_all_encap_soft_in_cmd,
7997 "clear ip bgp * encap unicast soft in",
7998 CLEAR_STR
7999 IP_STR
8000 BGP_STR
8001 "Clear all peers\n"
8002 "Address family\n"
8003 "Address Family Modifier\n"
8004 "Soft reconfig\n"
8005 "Soft reconfig inbound update\n")
8006{
8007 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
8008 BGP_CLEAR_SOFT_IN, NULL);
8009}
8010
8011ALIAS (clear_ip_bgp_all_encap_soft_in,
8012 clear_ip_bgp_all_encap_in_cmd,
8013 "clear ip bgp * encap unicast in",
8014 CLEAR_STR
8015 IP_STR
8016 BGP_STR
8017 "Clear all peers\n"
8018 "Address family\n"
8019 "Address Family Modifier\n"
8020 "Soft reconfig inbound update\n")
8021
718e3744 8022DEFUN (clear_bgp_all_soft_in,
8023 clear_bgp_all_soft_in_cmd,
8024 "clear bgp * soft in",
8025 CLEAR_STR
8026 BGP_STR
8027 "Clear all peers\n"
e0bce756
DS
8028 BGP_SOFT_STR
8029 BGP_SOFT_IN_STR)
718e3744 8030{
6aeb9e78
DS
8031 if (argc == 2)
8032 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all,
718e3744 8033 BGP_CLEAR_SOFT_IN, NULL);
8034
8035 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
8036 BGP_CLEAR_SOFT_IN, NULL);
8037}
8038
8039ALIAS (clear_bgp_all_soft_in,
8040 clear_bgp_instance_all_soft_in_cmd,
8386ac43 8041 "clear bgp " BGP_INSTANCE_CMD " * soft in",
718e3744 8042 CLEAR_STR
8043 BGP_STR
8386ac43 8044 BGP_INSTANCE_HELP_STR
718e3744 8045 "Clear all peers\n"
e0bce756
DS
8046 BGP_SOFT_STR
8047 BGP_SOFT_IN_STR)
718e3744 8048
8049ALIAS (clear_bgp_all_soft_in,
8050 clear_bgp_ipv6_all_soft_in_cmd,
8051 "clear bgp ipv6 * soft in",
8052 CLEAR_STR
8053 BGP_STR
8054 "Address family\n"
8055 "Clear all peers\n"
e0bce756
DS
8056 BGP_SOFT_STR
8057 BGP_SOFT_IN_STR)
718e3744 8058
01080f7c 8059ALIAS (clear_bgp_all_soft_in,
8060 clear_bgp_instance_ipv6_all_soft_in_cmd,
8061 "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft in",
8062 CLEAR_STR
8063 BGP_STR
8064 BGP_INSTANCE_HELP_STR
8065 "Address family\n"
8066 "Clear all peers\n"
8067 BGP_SOFT_STR
8068 BGP_SOFT_IN_STR)
8069
718e3744 8070ALIAS (clear_bgp_all_soft_in,
8071 clear_bgp_all_in_cmd,
8072 "clear bgp * in",
8073 CLEAR_STR
8074 BGP_STR
8075 "Clear all peers\n"
e0bce756 8076 BGP_SOFT_IN_STR)
718e3744 8077
01080f7c 8078ALIAS (clear_bgp_all_soft_in,
8079 clear_bgp_instance_all_in_cmd,
8080 "clear bgp " BGP_INSTANCE_CMD " * in",
8081 CLEAR_STR
8082 BGP_STR
8083 BGP_INSTANCE_HELP_STR
8084 "Clear all peers\n"
8085 BGP_SOFT_IN_STR)
8086
718e3744 8087ALIAS (clear_bgp_all_soft_in,
8088 clear_bgp_ipv6_all_in_cmd,
8089 "clear bgp ipv6 * in",
8090 CLEAR_STR
8091 BGP_STR
8092 "Address family\n"
8093 "Clear all peers\n"
e0bce756 8094 BGP_SOFT_IN_STR)
718e3744 8095
01080f7c 8096ALIAS (clear_bgp_all_soft_in,
8097 clear_bgp_instance_ipv6_all_in_cmd,
8098 "clear bgp " BGP_INSTANCE_CMD " ipv6 * in",
8099 CLEAR_STR
8100 BGP_STR
8101 BGP_INSTANCE_HELP_STR
8102 "Address family\n"
8103 "Clear all peers\n"
8104 BGP_SOFT_IN_STR)
8105
718e3744 8106DEFUN (clear_bgp_all_in_prefix_filter,
8107 clear_bgp_all_in_prefix_filter_cmd,
8108 "clear bgp * in prefix-filter",
8109 CLEAR_STR
8110 BGP_STR
8111 "Clear all peers\n"
e0bce756 8112 BGP_SOFT_IN_STR
718e3744 8113 "Push out prefix-list ORF and do inbound soft reconfig\n")
8114{
8115 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
8116 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
8117}
8118
8119ALIAS (clear_bgp_all_in_prefix_filter,
8120 clear_bgp_ipv6_all_in_prefix_filter_cmd,
8121 "clear bgp ipv6 * in prefix-filter",
8122 CLEAR_STR
8123 BGP_STR
8124 "Address family\n"
8125 "Clear all peers\n"
e0bce756 8126 BGP_SOFT_IN_STR
718e3744 8127 "Push out prefix-list ORF and do inbound soft reconfig\n")
8128
8129DEFUN (clear_ip_bgp_peer_soft_in,
8130 clear_ip_bgp_peer_soft_in_cmd,
db64ea86 8131 "clear ip bgp (A.B.C.D|WORD) soft in",
718e3744 8132 CLEAR_STR
8133 IP_STR
8134 BGP_STR
8135 "BGP neighbor address to clear\n"
db64ea86 8136 "BGP neighbor on interface to clear\n"
e0bce756
DS
8137 BGP_SOFT_STR
8138 BGP_SOFT_IN_STR)
718e3744 8139{
01080f7c 8140 if (argc == 3)
8141 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
8142 BGP_CLEAR_SOFT_IN, argv[2]);
8143
718e3744 8144 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
8145 BGP_CLEAR_SOFT_IN, argv[0]);
8146}
8147
01080f7c 8148ALIAS (clear_ip_bgp_peer_soft_in,
8149 clear_ip_bgp_instance_peer_soft_in_cmd,
8150 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft in",
8151 CLEAR_STR
8152 IP_STR
8153 BGP_STR
8154 BGP_INSTANCE_HELP_STR
8155 "BGP neighbor address to clear\n"
8156 "BGP neighbor on interface to clear\n"
8157 BGP_SOFT_STR
8158 BGP_SOFT_IN_STR)
8159
718e3744 8160ALIAS (clear_ip_bgp_peer_soft_in,
8161 clear_ip_bgp_peer_in_cmd,
db64ea86 8162 "clear ip bgp (A.B.C.D|WORD) in",
718e3744 8163 CLEAR_STR
8164 IP_STR
8165 BGP_STR
8166 "BGP neighbor address to clear\n"
db64ea86 8167 "BGP neighbor on interface to clear\n"
e0bce756 8168 BGP_SOFT_IN_STR)
01080f7c 8169
8170ALIAS (clear_ip_bgp_peer_soft_in,
8171 clear_ip_bgp_instance_peer_in_cmd,
8172 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) in",
8173 CLEAR_STR
8174 IP_STR
8175 BGP_STR
8176 BGP_INSTANCE_HELP_STR
8177 "BGP neighbor address to clear\n"
8178 "BGP neighbor on interface to clear\n"
8179 BGP_SOFT_IN_STR)
8180
718e3744 8181DEFUN (clear_ip_bgp_peer_in_prefix_filter,
8182 clear_ip_bgp_peer_in_prefix_filter_cmd,
db64ea86 8183 "clear ip bgp (A.B.C.D|WORD) in prefix-filter",
718e3744 8184 CLEAR_STR
8185 IP_STR
8186 BGP_STR
8187 "BGP neighbor address to clear\n"
db64ea86 8188 "BGP neighbor on interface to clear\n"
e0bce756 8189 BGP_SOFT_IN_STR
718e3744 8190 "Push out the existing ORF prefix-list\n")
8191{
8192 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
8193 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8194}
8195
8196DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
8197 clear_ip_bgp_peer_ipv4_soft_in_cmd,
db64ea86 8198 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in",
718e3744 8199 CLEAR_STR
8200 IP_STR
8201 BGP_STR
8202 "BGP neighbor address to clear\n"
db64ea86 8203 "BGP neighbor on interface to clear\n"
718e3744 8204 "Address family\n"
8205 "Address Family modifier\n"
8206 "Address Family modifier\n"
e0bce756
DS
8207 BGP_SOFT_STR
8208 BGP_SOFT_IN_STR)
718e3744 8209{
8210 if (strncmp (argv[1], "m", 1) == 0)
8211 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
8212 BGP_CLEAR_SOFT_IN, argv[0]);
8213
8214 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
8215 BGP_CLEAR_SOFT_IN, argv[0]);
8216}
8217
01080f7c 8218DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in,
8219 clear_ip_bgp_instance_peer_ipv4_soft_in_cmd,
8220 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in",
8221 CLEAR_STR
8222 IP_STR
8223 BGP_STR
8224 BGP_INSTANCE_HELP_STR
8225 "BGP neighbor address to clear\n"
8226 "BGP neighbor on interface to clear\n"
8227 "Address family\n"
8228 "Address Family modifier\n"
8229 "Address Family modifier\n"
8230 BGP_SOFT_STR
8231 BGP_SOFT_IN_STR)
8232{
8233 if (strncmp (argv[3], "m", 1) == 0)
8234 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer,
8235 BGP_CLEAR_SOFT_IN, argv[2]);
8236
8237 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
8238 BGP_CLEAR_SOFT_IN, argv[2]);
8239}
8240
718e3744 8241ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
8242 clear_ip_bgp_peer_ipv4_in_cmd,
db64ea86 8243 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in",
718e3744 8244 CLEAR_STR
8245 IP_STR
8246 BGP_STR
8247 "BGP neighbor address to clear\n"
db64ea86 8248 "BGP neighbor on interface to clear\n"
718e3744 8249 "Address family\n"
8250 "Address Family modifier\n"
8251 "Address Family modifier\n"
e0bce756 8252 BGP_SOFT_IN_STR)
718e3744 8253
01080f7c 8254ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_in,
8255 clear_ip_bgp_instance_peer_ipv4_in_cmd,
8256 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) in",
8257 CLEAR_STR
8258 IP_STR
8259 BGP_STR
8260 BGP_INSTANCE_HELP_STR
8261 "BGP neighbor address to clear\n"
8262 "BGP neighbor on interface to clear\n"
8263 "Address family\n"
8264 "Address Family modifier\n"
8265 "Address Family modifier\n"
8266 BGP_SOFT_IN_STR)
8267
718e3744 8268DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
8269 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
db64ea86 8270 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in prefix-filter",
718e3744 8271 CLEAR_STR
8272 IP_STR
8273 BGP_STR
8274 "BGP neighbor address to clear\n"
db64ea86 8275 "BGP neighbor on interface to clear\n"
718e3744 8276 "Address family\n"
8277 "Address Family modifier\n"
8278 "Address Family modifier\n"
e0bce756 8279 BGP_SOFT_IN_STR
718e3744 8280 "Push out the existing ORF prefix-list\n")
8281{
8282 if (strncmp (argv[1], "m", 1) == 0)
8283 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
8284 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8285
8286 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
8287 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8288}
8289
8290DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
8291 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
db64ea86 8292 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft in",
718e3744 8293 CLEAR_STR
8294 IP_STR
8295 BGP_STR
8296 "BGP neighbor address to clear\n"
db64ea86 8297 "BGP neighbor on interface to clear\n"
718e3744 8298 "Address family\n"
8299 "Address Family Modifier\n"
e0bce756
DS
8300 BGP_SOFT_STR
8301 BGP_SOFT_IN_STR)
718e3744 8302{
8303 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
8304 BGP_CLEAR_SOFT_IN, argv[0]);
8305}
8306
8307ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
8308 clear_ip_bgp_peer_vpnv4_in_cmd,
db64ea86 8309 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in",
718e3744 8310 CLEAR_STR
8311 IP_STR
8312 BGP_STR
8313 "BGP neighbor address to clear\n"
db64ea86 8314 "BGP neighbor on interface to clear\n"
718e3744 8315 "Address family\n"
8316 "Address Family Modifier\n"
e0bce756 8317 BGP_SOFT_IN_STR)
718e3744 8318
587ff0fd
LB
8319DEFUN (clear_ip_bgp_peer_encap_soft_in,
8320 clear_ip_bgp_peer_encap_soft_in_cmd,
8321 "clear ip bgp A.B.C.D encap unicast soft in",
8322 CLEAR_STR
8323 IP_STR
8324 BGP_STR
8325 "BGP neighbor address to clear\n"
8326 "Address family\n"
8327 "Address Family Modifier\n"
8328 "Soft reconfig\n"
8329 "Soft reconfig inbound update\n")
8330{
8331 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
8332 BGP_CLEAR_SOFT_IN, argv[0]);
8333}
8334
8335ALIAS (clear_ip_bgp_peer_encap_soft_in,
8336 clear_ip_bgp_peer_encap_in_cmd,
8337 "clear ip bgp A.B.C.D encap unicast in",
8338 CLEAR_STR
8339 IP_STR
8340 BGP_STR
8341 "BGP neighbor address to clear\n"
8342 "Address family\n"
8343 "Address Family Modifier\n"
8344 "Soft reconfig inbound update\n")
8345
718e3744 8346DEFUN (clear_bgp_peer_soft_in,
8347 clear_bgp_peer_soft_in_cmd,
a80beece 8348 "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in",
718e3744 8349 CLEAR_STR
8350 BGP_STR
8351 "BGP neighbor address to clear\n"
8352 "BGP IPv6 neighbor to clear\n"
a80beece 8353 "BGP neighbor on interface to clear\n"
e0bce756
DS
8354 BGP_SOFT_STR
8355 BGP_SOFT_IN_STR)
718e3744 8356{
01080f7c 8357 if (argc == 3)
8358 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer,
8359 BGP_CLEAR_SOFT_IN, argv[2]);
8360
718e3744 8361 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
8362 BGP_CLEAR_SOFT_IN, argv[0]);
8363}
8364
01080f7c 8365ALIAS (clear_bgp_peer_soft_in,
8366 clear_bgp_instance_peer_soft_in_cmd,
8367 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft in",
8368 CLEAR_STR
8369 BGP_STR
8370 BGP_INSTANCE_HELP_STR
8371 "BGP neighbor address to clear\n"
8372 "BGP IPv6 neighbor to clear\n"
8373 "BGP neighbor on interface to clear\n"
8374 BGP_SOFT_STR
8375 BGP_SOFT_IN_STR)
8376
718e3744 8377ALIAS (clear_bgp_peer_soft_in,
8378 clear_bgp_ipv6_peer_soft_in_cmd,
a80beece 8379 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in",
718e3744 8380 CLEAR_STR
8381 BGP_STR
8382 "Address family\n"
8383 "BGP neighbor address to clear\n"
8384 "BGP IPv6 neighbor to clear\n"
a80beece 8385 "BGP neighbor on interface to clear\n"
e0bce756
DS
8386 BGP_SOFT_STR
8387 BGP_SOFT_IN_STR)
718e3744 8388
01080f7c 8389ALIAS (clear_bgp_peer_soft_in,
8390 clear_bgp_instance_ipv6_peer_soft_in_cmd,
8391 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft in",
8392 CLEAR_STR
8393 BGP_STR
8394 BGP_INSTANCE_HELP_STR
8395 "Address family\n"
8396 "BGP neighbor address to clear\n"
8397 "BGP IPv6 neighbor to clear\n"
8398 "BGP neighbor on interface to clear\n"
8399 BGP_SOFT_STR
8400 BGP_SOFT_IN_STR)
8401
718e3744 8402ALIAS (clear_bgp_peer_soft_in,
8403 clear_bgp_peer_in_cmd,
a80beece 8404 "clear bgp (A.B.C.D|X:X::X:X|WORD) in",
718e3744 8405 CLEAR_STR
8406 BGP_STR
8407 "BGP neighbor address to clear\n"
8408 "BGP IPv6 neighbor to clear\n"
a80beece 8409 "BGP neighbor on interface to clear\n"
e0bce756 8410 BGP_SOFT_IN_STR)
718e3744 8411
01080f7c 8412ALIAS (clear_bgp_peer_soft_in,
8413 clear_bgp_instance_peer_in_cmd,
8414 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) in",
8415 CLEAR_STR
8416 BGP_STR
8417 BGP_INSTANCE_HELP_STR
8418 "BGP neighbor address to clear\n"
8419 "BGP IPv6 neighbor to clear\n"
8420 "BGP neighbor on interface to clear\n"
8421 BGP_SOFT_IN_STR)
8422
718e3744 8423ALIAS (clear_bgp_peer_soft_in,
8424 clear_bgp_ipv6_peer_in_cmd,
a80beece 8425 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in",
718e3744 8426 CLEAR_STR
8427 BGP_STR
8428 "Address family\n"
8429 "BGP neighbor address to clear\n"
8430 "BGP IPv6 neighbor to clear\n"
a80beece 8431 "BGP neighbor on interface to clear\n"
e0bce756 8432 BGP_SOFT_IN_STR)
718e3744 8433
01080f7c 8434ALIAS (clear_bgp_peer_soft_in,
8435 clear_bgp_instance_ipv6_peer_in_cmd,
8436 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) in",
8437 CLEAR_STR
8438 BGP_STR
8439 BGP_INSTANCE_HELP_STR
8440 "Address family\n"
8441 "BGP neighbor address to clear\n"
8442 "BGP IPv6 neighbor to clear\n"
8443 "BGP neighbor on interface to clear\n"
8444 BGP_SOFT_IN_STR)
8445
718e3744 8446DEFUN (clear_bgp_peer_in_prefix_filter,
8447 clear_bgp_peer_in_prefix_filter_cmd,
a80beece 8448 "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter",
718e3744 8449 CLEAR_STR
8450 BGP_STR
8451 "BGP neighbor address to clear\n"
8452 "BGP IPv6 neighbor to clear\n"
a80beece 8453 "BGP neighbor on interface to clear\n"
e0bce756 8454 BGP_SOFT_IN_STR
718e3744 8455 "Push out the existing ORF prefix-list\n")
8456{
8457 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
8458 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8459}
8460
8461ALIAS (clear_bgp_peer_in_prefix_filter,
8462 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
a80beece 8463 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter",
718e3744 8464 CLEAR_STR
8465 BGP_STR
8466 "Address family\n"
8467 "BGP neighbor address to clear\n"
8468 "BGP IPv6 neighbor to clear\n"
a80beece 8469 "BGP neighbor on interface to clear\n"
e0bce756 8470 BGP_SOFT_IN_STR
718e3744 8471 "Push out the existing ORF prefix-list\n")
8472
8473DEFUN (clear_ip_bgp_peer_group_soft_in,
8474 clear_ip_bgp_peer_group_soft_in_cmd,
8475 "clear ip bgp peer-group WORD soft in",
8476 CLEAR_STR
8477 IP_STR
8478 BGP_STR
8479 "Clear all members of peer-group\n"
8480 "BGP peer-group name\n"
e0bce756
DS
8481 BGP_SOFT_STR
8482 BGP_SOFT_IN_STR)
718e3744 8483{
01080f7c 8484 if (argc == 3)
8485 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
8486 BGP_CLEAR_SOFT_IN, argv[2]);
8487
718e3744 8488 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
8489 BGP_CLEAR_SOFT_IN, argv[0]);
8490}
8491
01080f7c 8492ALIAS (clear_ip_bgp_peer_group_soft_in,
8493 clear_ip_bgp_instance_peer_group_soft_in_cmd,
8494 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft in",
8495 CLEAR_STR
8496 IP_STR
8497 BGP_STR
8498 BGP_INSTANCE_HELP_STR
8499 "Clear all members of peer-group\n"
8500 "BGP peer-group name\n"
8501 BGP_SOFT_STR
8502 BGP_SOFT_IN_STR)
8503
718e3744 8504ALIAS (clear_ip_bgp_peer_group_soft_in,
8505 clear_ip_bgp_peer_group_in_cmd,
8506 "clear ip bgp peer-group WORD in",
8507 CLEAR_STR
8508 IP_STR
8509 BGP_STR
8510 "Clear all members of peer-group\n"
8511 "BGP peer-group name\n"
e0bce756 8512 BGP_SOFT_IN_STR)
718e3744 8513
01080f7c 8514ALIAS (clear_ip_bgp_peer_group_soft_in,
8515 clear_ip_bgp_instance_peer_group_in_cmd,
8516 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD in",
8517 CLEAR_STR
8518 IP_STR
8519 BGP_STR
8520 BGP_INSTANCE_HELP_STR
8521 "Clear all members of peer-group\n"
8522 "BGP peer-group name\n"
8523 BGP_SOFT_IN_STR)
8524
718e3744 8525DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
8526 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
8527 "clear ip bgp peer-group WORD in prefix-filter",
8528 CLEAR_STR
8529 IP_STR
8530 BGP_STR
8531 "Clear all members of peer-group\n"
8532 "BGP peer-group name\n"
e0bce756 8533 BGP_SOFT_IN_STR
718e3744 8534 "Push out prefix-list ORF and do inbound soft reconfig\n")
8535{
8536 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
8537 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8538}
8539
8540DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
8541 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
8542 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
8543 CLEAR_STR
8544 IP_STR
8545 BGP_STR
8546 "Clear all members of peer-group\n"
8547 "BGP peer-group name\n"
8548 "Address family\n"
8549 "Address Family modifier\n"
8550 "Address Family modifier\n"
e0bce756
DS
8551 BGP_SOFT_STR
8552 BGP_SOFT_IN_STR)
718e3744 8553{
8554 if (strncmp (argv[1], "m", 1) == 0)
8555 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
8556 BGP_CLEAR_SOFT_IN, argv[0]);
8557
8558 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
8559 BGP_CLEAR_SOFT_IN, argv[0]);
8560}
8561
01080f7c 8562DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in,
8563 clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd,
8564 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft in",
8565 CLEAR_STR
8566 IP_STR
8567 BGP_STR
8568 BGP_INSTANCE_HELP_STR
8569 "Clear all members of peer-group\n"
8570 "BGP peer-group name\n"
8571 "Address family\n"
8572 "Address Family modifier\n"
8573 "Address Family modifier\n"
8574 BGP_SOFT_STR
8575 BGP_SOFT_IN_STR)
8576{
8577 if (strncmp (argv[3], "m", 1) == 0)
8578 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group,
8579 BGP_CLEAR_SOFT_IN, argv[2]);
8580
8581 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
8582 BGP_CLEAR_SOFT_IN, argv[2]);
8583}
8584
718e3744 8585ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
8586 clear_ip_bgp_peer_group_ipv4_in_cmd,
8587 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
8588 CLEAR_STR
8589 IP_STR
8590 BGP_STR
8591 "Clear all members of peer-group\n"
8592 "BGP peer-group name\n"
8593 "Address family\n"
8594 "Address Family modifier\n"
8595 "Address Family modifier\n"
e0bce756 8596 BGP_SOFT_IN_STR)
718e3744 8597
01080f7c 8598ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_in,
8599 clear_ip_bgp_instance_peer_group_ipv4_in_cmd,
8600 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) in",
8601 CLEAR_STR
8602 IP_STR
8603 BGP_STR
8604 BGP_INSTANCE_HELP_STR
8605 "Clear all members of peer-group\n"
8606 "BGP peer-group name\n"
8607 "Address family\n"
8608 "Address Family modifier\n"
8609 "Address Family modifier\n"
8610 BGP_SOFT_IN_STR)
8611
718e3744 8612DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
8613 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
8614 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
8615 CLEAR_STR
8616 IP_STR
8617 BGP_STR
8618 "Clear all members of peer-group\n"
8619 "BGP peer-group name\n"
8620 "Address family\n"
8621 "Address Family modifier\n"
8622 "Address Family modifier\n"
e0bce756 8623 BGP_SOFT_IN_STR
718e3744 8624 "Push out prefix-list ORF and do inbound soft reconfig\n")
8625{
8626 if (strncmp (argv[1], "m", 1) == 0)
8627 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
8628 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8629
8630 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
8631 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8632}
8633
8634DEFUN (clear_bgp_peer_group_soft_in,
8635 clear_bgp_peer_group_soft_in_cmd,
8636 "clear bgp peer-group WORD soft in",
8637 CLEAR_STR
8638 BGP_STR
8639 "Clear all members of peer-group\n"
8640 "BGP peer-group name\n"
e0bce756
DS
8641 BGP_SOFT_STR
8642 BGP_SOFT_IN_STR)
718e3744 8643{
01080f7c 8644 if (argc == 3)
8645 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group,
8646 BGP_CLEAR_SOFT_IN, argv[2]);
8647
718e3744 8648 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
8649 BGP_CLEAR_SOFT_IN, argv[0]);
8650}
8651
01080f7c 8652ALIAS (clear_bgp_peer_group_soft_in,
8653 clear_bgp_instance_peer_group_soft_in_cmd,
8654 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft in",
8655 CLEAR_STR
8656 BGP_STR
8657 BGP_INSTANCE_HELP_STR
8658 "Clear all members of peer-group\n"
8659 "BGP peer-group name\n"
8660 BGP_SOFT_STR
8661 BGP_SOFT_IN_STR)
8662
718e3744 8663ALIAS (clear_bgp_peer_group_soft_in,
8664 clear_bgp_ipv6_peer_group_soft_in_cmd,
8665 "clear bgp ipv6 peer-group WORD soft in",
8666 CLEAR_STR
8667 BGP_STR
8668 "Address family\n"
8669 "Clear all members of peer-group\n"
8670 "BGP peer-group name\n"
e0bce756
DS
8671 BGP_SOFT_STR
8672 BGP_SOFT_IN_STR)
718e3744 8673
01080f7c 8674ALIAS (clear_bgp_peer_group_soft_in,
8675 clear_bgp_instance_ipv6_peer_group_soft_in_cmd,
8676 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft in",
8677 CLEAR_STR
8678 BGP_STR
8679 BGP_INSTANCE_HELP_STR
8680 "Address family\n"
8681 "Clear all members of peer-group\n"
8682 "BGP peer-group name\n"
8683 BGP_SOFT_STR
8684 BGP_SOFT_IN_STR)
8685
718e3744 8686ALIAS (clear_bgp_peer_group_soft_in,
8687 clear_bgp_peer_group_in_cmd,
8688 "clear bgp peer-group WORD in",
8689 CLEAR_STR
8690 BGP_STR
8691 "Clear all members of peer-group\n"
8692 "BGP peer-group name\n"
e0bce756 8693 BGP_SOFT_IN_STR)
718e3744 8694
01080f7c 8695ALIAS (clear_bgp_peer_group_soft_in,
8696 clear_bgp_instance_peer_group_in_cmd,
8697 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD in",
8698 CLEAR_STR
8699 BGP_STR
8700 BGP_INSTANCE_HELP_STR
8701 "Clear all members of peer-group\n"
8702 "BGP peer-group name\n"
8703 BGP_SOFT_IN_STR)
8704
718e3744 8705ALIAS (clear_bgp_peer_group_soft_in,
8706 clear_bgp_ipv6_peer_group_in_cmd,
8707 "clear bgp ipv6 peer-group WORD in",
8708 CLEAR_STR
8709 BGP_STR
8710 "Address family\n"
8711 "Clear all members of peer-group\n"
8712 "BGP peer-group name\n"
e0bce756 8713 BGP_SOFT_IN_STR)
718e3744 8714
01080f7c 8715ALIAS (clear_bgp_peer_group_soft_in,
8716 clear_bgp_instance_ipv6_peer_group_in_cmd,
8717 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD in",
8718 CLEAR_STR
8719 BGP_STR
8720 BGP_INSTANCE_HELP_STR
8721 "Address family\n"
8722 "Clear all members of peer-group\n"
8723 "BGP peer-group name\n"
8724 BGP_SOFT_IN_STR)
8725
718e3744 8726DEFUN (clear_bgp_peer_group_in_prefix_filter,
8727 clear_bgp_peer_group_in_prefix_filter_cmd,
8728 "clear bgp peer-group WORD in prefix-filter",
8729 CLEAR_STR
8730 BGP_STR
8731 "Clear all members of peer-group\n"
8732 "BGP peer-group name\n"
e0bce756 8733 BGP_SOFT_IN_STR
718e3744 8734 "Push out prefix-list ORF and do inbound soft reconfig\n")
8735{
8736 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
8737 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8738}
8739
8740ALIAS (clear_bgp_peer_group_in_prefix_filter,
8741 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
8742 "clear bgp ipv6 peer-group WORD in prefix-filter",
8743 CLEAR_STR
8744 BGP_STR
8745 "Address family\n"
8746 "Clear all members of peer-group\n"
8747 "BGP peer-group name\n"
e0bce756 8748 BGP_SOFT_IN_STR
718e3744 8749 "Push out prefix-list ORF and do inbound soft reconfig\n")
8750
8751DEFUN (clear_ip_bgp_external_soft_in,
8752 clear_ip_bgp_external_soft_in_cmd,
8753 "clear ip bgp external soft in",
8754 CLEAR_STR
8755 IP_STR
8756 BGP_STR
8757 "Clear all external peers\n"
e0bce756
DS
8758 BGP_SOFT_STR
8759 BGP_SOFT_IN_STR)
718e3744 8760{
01080f7c 8761 if (argc == 2)
8762 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
8763 BGP_CLEAR_SOFT_IN, NULL);
8764
718e3744 8765 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
8766 BGP_CLEAR_SOFT_IN, NULL);
8767}
8768
01080f7c 8769ALIAS (clear_ip_bgp_external_soft_in,
8770 clear_ip_bgp_instance_external_soft_in_cmd,
8771 "clear ip bgp " BGP_INSTANCE_CMD " external soft in",
8772 CLEAR_STR
8773 IP_STR
8774 BGP_STR
8775 BGP_INSTANCE_HELP_STR
8776 "Clear all external peers\n"
8777 BGP_SOFT_STR
8778 BGP_SOFT_IN_STR)
8779
718e3744 8780ALIAS (clear_ip_bgp_external_soft_in,
8781 clear_ip_bgp_external_in_cmd,
8782 "clear ip bgp external in",
8783 CLEAR_STR
8784 IP_STR
8785 BGP_STR
8786 "Clear all external peers\n"
e0bce756 8787 BGP_SOFT_IN_STR)
718e3744 8788
01080f7c 8789ALIAS (clear_ip_bgp_external_soft_in,
8790 clear_ip_bgp_instance_external_in_cmd,
8791 "clear ip bgp " BGP_INSTANCE_CMD " external in",
8792 CLEAR_STR
8793 IP_STR
8794 BGP_STR
8795 BGP_INSTANCE_HELP_STR
8796 "Clear all external peers\n"
8797 BGP_SOFT_IN_STR)
8798
718e3744 8799DEFUN (clear_ip_bgp_external_in_prefix_filter,
8800 clear_ip_bgp_external_in_prefix_filter_cmd,
8801 "clear ip bgp external in prefix-filter",
8802 CLEAR_STR
8803 IP_STR
8804 BGP_STR
8805 "Clear all external peers\n"
e0bce756 8806 BGP_SOFT_IN_STR
718e3744 8807 "Push out prefix-list ORF and do inbound soft reconfig\n")
8808{
8809 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
8810 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
8811}
8812
8813DEFUN (clear_ip_bgp_external_ipv4_soft_in,
8814 clear_ip_bgp_external_ipv4_soft_in_cmd,
8815 "clear ip bgp external ipv4 (unicast|multicast) soft in",
8816 CLEAR_STR
8817 IP_STR
8818 BGP_STR
8819 "Clear all external peers\n"
8820 "Address family\n"
8821 "Address Family modifier\n"
8822 "Address Family modifier\n"
e0bce756
DS
8823 BGP_SOFT_STR
8824 BGP_SOFT_IN_STR)
718e3744 8825{
8826 if (strncmp (argv[0], "m", 1) == 0)
8827 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
8828 BGP_CLEAR_SOFT_IN, NULL);
8829
8830 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
8831 BGP_CLEAR_SOFT_IN, NULL);
8832}
8833
01080f7c 8834DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in,
8835 clear_ip_bgp_instance_external_ipv4_soft_in_cmd,
8836 "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft in",
8837 CLEAR_STR
8838 IP_STR
8839 BGP_STR
8840 BGP_INSTANCE_HELP_STR
8841 "Clear all external peers\n"
8842 "Address family\n"
8843 "Address Family modifier\n"
8844 "Address Family modifier\n"
8845 BGP_SOFT_STR
8846 BGP_SOFT_IN_STR)
8847{
8848 if (strncmp (argv[2], "m", 1) == 0)
8849 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external,
8850 BGP_CLEAR_SOFT_IN, NULL);
8851
8852 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
8853 BGP_CLEAR_SOFT_IN, NULL);
8854}
8855
718e3744 8856ALIAS (clear_ip_bgp_external_ipv4_soft_in,
8857 clear_ip_bgp_external_ipv4_in_cmd,
8858 "clear ip bgp external ipv4 (unicast|multicast) in",
8859 CLEAR_STR
8860 IP_STR
8861 BGP_STR
8862 "Clear all external peers\n"
8863 "Address family\n"
8864 "Address Family modifier\n"
8865 "Address Family modifier\n"
e0bce756 8866 BGP_SOFT_IN_STR)
718e3744 8867
01080f7c 8868ALIAS (clear_ip_bgp_instance_external_ipv4_soft_in,
8869 clear_ip_bgp_instance_external_ipv4_in_cmd,
8870 "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) in",
8871 CLEAR_STR
8872 IP_STR
8873 BGP_STR
8874 BGP_INSTANCE_HELP_STR
8875 "Clear all external peers\n"
8876 "Address family\n"
8877 "Address Family modifier\n"
8878 "Address Family modifier\n"
8879 BGP_SOFT_IN_STR)
8880
718e3744 8881DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
8882 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
8883 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
8884 CLEAR_STR
8885 IP_STR
8886 BGP_STR
8887 "Clear all external peers\n"
8888 "Address family\n"
8889 "Address Family modifier\n"
8890 "Address Family modifier\n"
e0bce756 8891 BGP_SOFT_IN_STR
718e3744 8892 "Push out prefix-list ORF and do inbound soft reconfig\n")
8893{
8894 if (strncmp (argv[0], "m", 1) == 0)
8895 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
8896 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
8897
8898 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
8899 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
8900}
8901
8902DEFUN (clear_bgp_external_soft_in,
8903 clear_bgp_external_soft_in_cmd,
8904 "clear bgp external soft in",
8905 CLEAR_STR
8906 BGP_STR
8907 "Clear all external peers\n"
e0bce756
DS
8908 BGP_SOFT_STR
8909 BGP_SOFT_IN_STR)
718e3744 8910{
01080f7c 8911 if (argc == 2)
8912 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external,
8913 BGP_CLEAR_SOFT_IN, NULL);
8914
718e3744 8915 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
8916 BGP_CLEAR_SOFT_IN, NULL);
8917}
8918
01080f7c 8919ALIAS (clear_bgp_external_soft_in,
8920 clear_bgp_instance_external_soft_in_cmd,
8921 "clear bgp " BGP_INSTANCE_CMD " external soft in",
8922 CLEAR_STR
8923 BGP_STR
8924 BGP_INSTANCE_HELP_STR
8925 "Clear all external peers\n"
8926 BGP_SOFT_STR
8927 BGP_SOFT_IN_STR)
8928
718e3744 8929ALIAS (clear_bgp_external_soft_in,
8930 clear_bgp_ipv6_external_soft_in_cmd,
8931 "clear bgp ipv6 external soft in",
8932 CLEAR_STR
8933 BGP_STR
8934 "Address family\n"
8935 "Clear all external peers\n"
e0bce756
DS
8936 BGP_SOFT_STR
8937 BGP_SOFT_IN_STR)
718e3744 8938
01080f7c 8939ALIAS (clear_bgp_external_soft_in,
8940 clear_bgp_instance_ipv6_external_soft_in_cmd,
8941 "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft in",
8942 CLEAR_STR
8943 BGP_STR
8944 BGP_INSTANCE_HELP_STR
8945 "Address family\n"
8946 "Clear all external peers\n"
8947 BGP_SOFT_STR
8948 BGP_SOFT_IN_STR)
8949
718e3744 8950ALIAS (clear_bgp_external_soft_in,
8951 clear_bgp_external_in_cmd,
8952 "clear bgp external in",
8953 CLEAR_STR
8954 BGP_STR
8955 "Clear all external peers\n"
e0bce756 8956 BGP_SOFT_IN_STR)
718e3744 8957
01080f7c 8958ALIAS (clear_bgp_external_soft_in,
8959 clear_bgp_instance_external_in_cmd,
8960 "clear bgp " BGP_INSTANCE_CMD " external in",
8961 CLEAR_STR
8962 BGP_STR
8963 BGP_INSTANCE_HELP_STR
8964 "Clear all external peers\n"
8965 BGP_SOFT_IN_STR)
8966
718e3744 8967ALIAS (clear_bgp_external_soft_in,
8968 clear_bgp_ipv6_external_in_cmd,
8969 "clear bgp ipv6 external WORD in",
8970 CLEAR_STR
8971 BGP_STR
8972 "Address family\n"
8973 "Clear all external peers\n"
e0bce756 8974 BGP_SOFT_IN_STR)
718e3744 8975
01080f7c 8976ALIAS (clear_bgp_external_soft_in,
8977 clear_bgp_instance_ipv6_external_in_cmd,
8978 "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD in",
8979 CLEAR_STR
8980 BGP_STR
8981 BGP_INSTANCE_HELP_STR
8982 "Address family\n"
8983 "Clear all external peers\n"
8984 BGP_SOFT_IN_STR)
8985
718e3744 8986DEFUN (clear_bgp_external_in_prefix_filter,
8987 clear_bgp_external_in_prefix_filter_cmd,
8988 "clear bgp external in prefix-filter",
8989 CLEAR_STR
8990 BGP_STR
8991 "Clear all external peers\n"
e0bce756 8992 BGP_SOFT_IN_STR
718e3744 8993 "Push out prefix-list ORF and do inbound soft reconfig\n")
8994{
8995 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
8996 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
8997}
8998
8999ALIAS (clear_bgp_external_in_prefix_filter,
9000 clear_bgp_ipv6_external_in_prefix_filter_cmd,
9001 "clear bgp ipv6 external in prefix-filter",
9002 CLEAR_STR
9003 BGP_STR
9004 "Address family\n"
9005 "Clear all external peers\n"
e0bce756 9006 BGP_SOFT_IN_STR
718e3744 9007 "Push out prefix-list ORF and do inbound soft reconfig\n")
9008
9009DEFUN (clear_ip_bgp_as_soft_in,
9010 clear_ip_bgp_as_soft_in_cmd,
320da874 9011 "clear ip bgp " CMD_AS_RANGE " soft in",
718e3744 9012 CLEAR_STR
9013 IP_STR
9014 BGP_STR
9015 "Clear peers with the AS number\n"
e0bce756
DS
9016 BGP_SOFT_STR
9017 BGP_SOFT_IN_STR)
718e3744 9018{
01080f7c 9019 if (argc == 3)
9020 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
9021 BGP_CLEAR_SOFT_IN, argv[2]);
9022
718e3744 9023 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
9024 BGP_CLEAR_SOFT_IN, argv[0]);
9025}
9026
9027ALIAS (clear_ip_bgp_as_soft_in,
01080f7c 9028 clear_ip_bgp_instance_as_soft_in_cmd,
9029 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in",
9030 CLEAR_STR
9031 IP_STR
9032 BGP_STR
9033 BGP_INSTANCE_HELP_STR
9034 "Clear peers with the AS number\n"
9035 BGP_SOFT_STR
9036 BGP_SOFT_IN_STR)
9037
9038ALIAS (clear_ip_bgp_as_soft_in,
9039 clear_ip_bgp_as_in_cmd,
9040 "clear ip bgp " CMD_AS_RANGE " in",
9041 CLEAR_STR
9042 IP_STR
9043 BGP_STR
9044 "Clear peers with the AS number\n"
9045 BGP_SOFT_IN_STR)
9046
9047ALIAS (clear_ip_bgp_as_soft_in,
9048 clear_ip_bgp_instance_as_in_cmd,
9049 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in",
718e3744 9050 CLEAR_STR
9051 IP_STR
9052 BGP_STR
01080f7c 9053 BGP_INSTANCE_HELP_STR
718e3744 9054 "Clear peers with the AS number\n"
e0bce756 9055 BGP_SOFT_IN_STR)
718e3744 9056
9057DEFUN (clear_ip_bgp_as_in_prefix_filter,
9058 clear_ip_bgp_as_in_prefix_filter_cmd,
320da874 9059 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
718e3744 9060 CLEAR_STR
9061 IP_STR
9062 BGP_STR
9063 "Clear peers with the AS number\n"
e0bce756 9064 BGP_SOFT_IN_STR
718e3744 9065 "Push out prefix-list ORF and do inbound soft reconfig\n")
9066{
9067 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
9068 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
9069}
9070
9071DEFUN (clear_ip_bgp_as_ipv4_soft_in,
9072 clear_ip_bgp_as_ipv4_soft_in_cmd,
320da874 9073 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
718e3744 9074 CLEAR_STR
9075 IP_STR
9076 BGP_STR
9077 "Clear peers with the AS number\n"
9078 "Address family\n"
9079 "Address Family modifier\n"
9080 "Address Family modifier\n"
e0bce756
DS
9081 BGP_SOFT_STR
9082 BGP_SOFT_IN_STR)
718e3744 9083{
9084 if (strncmp (argv[1], "m", 1) == 0)
9085 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
9086 BGP_CLEAR_SOFT_IN, argv[0]);
9087
9088 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
9089 BGP_CLEAR_SOFT_IN, argv[0]);
9090}
9091
01080f7c 9092DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in,
9093 clear_ip_bgp_instance_as_ipv4_soft_in_cmd,
9094 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
9095 CLEAR_STR
9096 IP_STR
9097 BGP_STR
9098 BGP_INSTANCE_HELP_STR
9099 "Clear peers with the AS number\n"
9100 "Address family\n"
9101 "Address Family modifier\n"
9102 "Address Family modifier\n"
9103 BGP_SOFT_STR
9104 BGP_SOFT_IN_STR)
9105{
9106 if (strncmp (argv[3], "m", 1) == 0)
9107 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as,
9108 BGP_CLEAR_SOFT_IN, argv[2]);
9109
9110 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
9111 BGP_CLEAR_SOFT_IN, argv[2]);
9112}
9113
718e3744 9114ALIAS (clear_ip_bgp_as_ipv4_soft_in,
9115 clear_ip_bgp_as_ipv4_in_cmd,
320da874 9116 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
718e3744 9117 CLEAR_STR
9118 IP_STR
9119 BGP_STR
9120 "Clear peers with the AS number\n"
9121 "Address family\n"
9122 "Address Family modifier\n"
9123 "Address Family modifier\n"
e0bce756 9124 BGP_SOFT_IN_STR)
718e3744 9125
01080f7c 9126ALIAS (clear_ip_bgp_instance_as_ipv4_soft_in,
9127 clear_ip_bgp_instance_as_ipv4_in_cmd,
9128 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
9129 CLEAR_STR
9130 IP_STR
9131 BGP_STR
9132 BGP_INSTANCE_HELP_STR
9133 "Clear peers with the AS number\n"
9134 "Address family\n"
9135 "Address Family modifier\n"
9136 "Address Family modifier\n"
9137 BGP_SOFT_IN_STR)
9138
718e3744 9139DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
9140 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
320da874 9141 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
718e3744 9142 CLEAR_STR
9143 IP_STR
9144 BGP_STR
9145 "Clear peers with the AS number\n"
9146 "Address family\n"
9147 "Address Family modifier\n"
9148 "Address Family modifier\n"
e0bce756 9149 BGP_SOFT_IN_STR
718e3744 9150 "Push out prefix-list ORF and do inbound soft reconfig\n")
9151{
9152 if (strncmp (argv[1], "m", 1) == 0)
9153 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
9154 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
9155
9156 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
9157 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
9158}
9159
9160DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
9161 clear_ip_bgp_as_vpnv4_soft_in_cmd,
320da874 9162 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
718e3744 9163 CLEAR_STR
9164 IP_STR
9165 BGP_STR
9166 "Clear peers with the AS number\n"
9167 "Address family\n"
9168 "Address Family modifier\n"
e0bce756
DS
9169 BGP_SOFT_STR
9170 BGP_SOFT_IN_STR)
718e3744 9171{
9172 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
9173 BGP_CLEAR_SOFT_IN, argv[0]);
9174}
9175
9176ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
9177 clear_ip_bgp_as_vpnv4_in_cmd,
320da874 9178 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
718e3744 9179 CLEAR_STR
9180 IP_STR
9181 BGP_STR
9182 "Clear peers with the AS number\n"
9183 "Address family\n"
9184 "Address Family modifier\n"
e0bce756 9185 BGP_SOFT_IN_STR)
718e3744 9186
587ff0fd
LB
9187DEFUN (clear_ip_bgp_as_encap_soft_in,
9188 clear_ip_bgp_as_encap_soft_in_cmd,
9189 "clear ip bgp " CMD_AS_RANGE " encap unicast soft in",
9190 CLEAR_STR
9191 IP_STR
9192 BGP_STR
9193 "Clear peers with the AS number\n"
9194 "Address family\n"
9195 "Address Family modifier\n"
9196 "Soft reconfig\n"
9197 "Soft reconfig inbound update\n")
9198{
9199 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
9200 BGP_CLEAR_SOFT_IN, argv[0]);
9201}
9202
9203ALIAS (clear_ip_bgp_as_encap_soft_in,
9204 clear_ip_bgp_as_encap_in_cmd,
9205 "clear ip bgp " CMD_AS_RANGE " encap unicast in",
9206 CLEAR_STR
9207 IP_STR
9208 BGP_STR
9209 "Clear peers with the AS number\n"
9210 "Address family\n"
9211 "Address Family modifier\n"
9212 "Soft reconfig inbound update\n")
9213
718e3744 9214DEFUN (clear_bgp_as_soft_in,
9215 clear_bgp_as_soft_in_cmd,
320da874 9216 "clear bgp " CMD_AS_RANGE " soft in",
718e3744 9217 CLEAR_STR
9218 BGP_STR
9219 "Clear peers with the AS number\n"
e0bce756
DS
9220 BGP_SOFT_STR
9221 BGP_SOFT_IN_STR)
718e3744 9222{
01080f7c 9223 if (argc == 3)
9224 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as,
9225 BGP_CLEAR_SOFT_IN, argv[2]);
9226
718e3744 9227 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
9228 BGP_CLEAR_SOFT_IN, argv[0]);
9229}
9230
01080f7c 9231ALIAS (clear_bgp_as_soft_in,
9232 clear_bgp_instance_as_soft_in_cmd,
9233 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in",
9234 CLEAR_STR
9235 BGP_STR
9236 BGP_INSTANCE_HELP_STR
9237 "Clear peers with the AS number\n"
9238 BGP_SOFT_STR
9239 BGP_SOFT_IN_STR)
9240
718e3744 9241ALIAS (clear_bgp_as_soft_in,
9242 clear_bgp_ipv6_as_soft_in_cmd,
320da874 9243 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
718e3744 9244 CLEAR_STR
9245 BGP_STR
9246 "Address family\n"
9247 "Clear peers with the AS number\n"
e0bce756
DS
9248 BGP_SOFT_STR
9249 BGP_SOFT_IN_STR)
718e3744 9250
01080f7c 9251ALIAS (clear_bgp_as_soft_in,
9252 clear_bgp_instance_ipv6_as_soft_in_cmd,
9253 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft in",
9254 CLEAR_STR
9255 BGP_STR
9256 BGP_INSTANCE_HELP_STR
9257 "Address family\n"
9258 "Clear peers with the AS number\n"
9259 BGP_SOFT_STR
9260 BGP_SOFT_IN_STR)
9261
718e3744 9262ALIAS (clear_bgp_as_soft_in,
9263 clear_bgp_as_in_cmd,
320da874 9264 "clear bgp " CMD_AS_RANGE " in",
718e3744 9265 CLEAR_STR
9266 BGP_STR
9267 "Clear peers with the AS number\n"
e0bce756 9268 BGP_SOFT_IN_STR)
718e3744 9269
01080f7c 9270ALIAS (clear_bgp_as_soft_in,
9271 clear_bgp_instance_as_in_cmd,
9272 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in",
9273 CLEAR_STR
9274 BGP_STR
9275 BGP_INSTANCE_HELP_STR
9276 "Clear peers with the AS number\n"
9277 BGP_SOFT_IN_STR)
9278
718e3744 9279ALIAS (clear_bgp_as_soft_in,
9280 clear_bgp_ipv6_as_in_cmd,
320da874 9281 "clear bgp ipv6 " CMD_AS_RANGE " in",
718e3744 9282 CLEAR_STR
9283 BGP_STR
9284 "Address family\n"
9285 "Clear peers with the AS number\n"
e0bce756 9286 BGP_SOFT_IN_STR)
718e3744 9287
01080f7c 9288ALIAS (clear_bgp_as_soft_in,
9289 clear_bgp_instance_ipv6_as_in_cmd,
9290 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " in",
9291 CLEAR_STR
9292 BGP_STR
9293 BGP_INSTANCE_HELP_STR
9294 "Address family\n"
9295 "Clear peers with the AS number\n"
9296 BGP_SOFT_IN_STR)
9297
718e3744 9298DEFUN (clear_bgp_as_in_prefix_filter,
9299 clear_bgp_as_in_prefix_filter_cmd,
320da874 9300 "clear bgp " CMD_AS_RANGE " in prefix-filter",
718e3744 9301 CLEAR_STR
9302 BGP_STR
9303 "Clear peers with the AS number\n"
e0bce756 9304 BGP_SOFT_IN_STR
718e3744 9305 "Push out prefix-list ORF and do inbound soft reconfig\n")
9306{
9307 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
9308 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
9309}
9310
9311ALIAS (clear_bgp_as_in_prefix_filter,
9312 clear_bgp_ipv6_as_in_prefix_filter_cmd,
320da874 9313 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
718e3744 9314 CLEAR_STR
9315 BGP_STR
9316 "Address family\n"
9317 "Clear peers with the AS number\n"
e0bce756 9318 BGP_SOFT_IN_STR
718e3744 9319 "Push out prefix-list ORF and do inbound soft reconfig\n")
6b0655a2 9320
718e3744 9321/* Both soft-reconfiguration */
9322DEFUN (clear_ip_bgp_all_soft,
9323 clear_ip_bgp_all_soft_cmd,
9324 "clear ip bgp * soft",
9325 CLEAR_STR
9326 IP_STR
9327 BGP_STR
9328 "Clear all peers\n"
e0bce756 9329 BGP_SOFT_STR)
718e3744 9330{
6aeb9e78
DS
9331 if (argc == 2)
9332 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
718e3744 9333 BGP_CLEAR_SOFT_BOTH, NULL);
9334
9335 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
9336 BGP_CLEAR_SOFT_BOTH, NULL);
9337}
9338
9339ALIAS (clear_ip_bgp_all_soft,
9340 clear_ip_bgp_instance_all_soft_cmd,
8386ac43 9341 "clear ip bgp " BGP_INSTANCE_CMD " * soft",
718e3744 9342 CLEAR_STR
9343 IP_STR
9344 BGP_STR
8386ac43 9345 BGP_INSTANCE_HELP_STR
718e3744 9346 "Clear all peers\n"
e0bce756 9347 BGP_SOFT_STR)
718e3744 9348
9349
9350DEFUN (clear_ip_bgp_all_ipv4_soft,
9351 clear_ip_bgp_all_ipv4_soft_cmd,
9352 "clear ip bgp * ipv4 (unicast|multicast) soft",
9353 CLEAR_STR
9354 IP_STR
9355 BGP_STR
9356 "Clear all peers\n"
9357 "Address family\n"
9358 "Address Family Modifier\n"
9359 "Address Family Modifier\n"
e0bce756 9360 BGP_SOFT_STR)
718e3744 9361{
9362 if (strncmp (argv[0], "m", 1) == 0)
9363 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
9364 BGP_CLEAR_SOFT_BOTH, NULL);
9365
9366 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
9367 BGP_CLEAR_SOFT_BOTH, NULL);
9368}
9369
9370DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
9371 clear_ip_bgp_instance_all_ipv4_soft_cmd,
8386ac43 9372 "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft",
718e3744 9373 CLEAR_STR
9374 IP_STR
9375 BGP_STR
8386ac43 9376 BGP_INSTANCE_HELP_STR
718e3744 9377 "Clear all peers\n"
9378 "Address family\n"
9379 "Address Family Modifier\n"
9380 "Address Family Modifier\n"
e0bce756 9381 BGP_SOFT_STR)
718e3744 9382{
6aeb9e78
DS
9383 if (strncmp (argv[2], "m", 1) == 0)
9384 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all,
718e3744 9385 BGP_CLEAR_SOFT_BOTH, NULL);
9386
9387 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
9388 BGP_CLEAR_SOFT_BOTH, NULL);
9389}
9390
9391DEFUN (clear_ip_bgp_all_vpnv4_soft,
9392 clear_ip_bgp_all_vpnv4_soft_cmd,
9393 "clear ip bgp * vpnv4 unicast soft",
9394 CLEAR_STR
9395 IP_STR
9396 BGP_STR
9397 "Clear all peers\n"
9398 "Address family\n"
9399 "Address Family Modifier\n"
e0bce756 9400 BGP_SOFT_STR)
718e3744 9401{
9402 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
9403 BGP_CLEAR_SOFT_BOTH, argv[0]);
9404}
9405
587ff0fd
LB
9406DEFUN (clear_ip_bgp_all_encap_soft,
9407 clear_ip_bgp_all_encap_soft_cmd,
9408 "clear ip bgp * encap unicast soft",
9409 CLEAR_STR
9410 IP_STR
9411 BGP_STR
9412 "Clear all peers\n"
9413 "Address family\n"
9414 "Address Family Modifier\n"
9415 "Soft reconfig\n")
9416{
9417 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
9418 BGP_CLEAR_SOFT_BOTH, argv[0]);
9419}
9420
718e3744 9421DEFUN (clear_bgp_all_soft,
9422 clear_bgp_all_soft_cmd,
9423 "clear bgp * soft",
9424 CLEAR_STR
9425 BGP_STR
9426 "Clear all peers\n"
e0bce756 9427 BGP_SOFT_STR)
718e3744 9428{
6aeb9e78
DS
9429 if (argc == 2)
9430 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all,
01080f7c 9431 BGP_CLEAR_SOFT_BOTH, NULL);
718e3744 9432
9433 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
01080f7c 9434 BGP_CLEAR_SOFT_BOTH, NULL);
718e3744 9435}
9436
9437ALIAS (clear_bgp_all_soft,
9438 clear_bgp_instance_all_soft_cmd,
8386ac43 9439 "clear bgp " BGP_INSTANCE_CMD " * soft",
718e3744 9440 CLEAR_STR
9441 BGP_STR
8386ac43 9442 BGP_INSTANCE_HELP_STR
718e3744 9443 "Clear all peers\n"
e0bce756 9444 BGP_SOFT_STR)
718e3744 9445
9446ALIAS (clear_bgp_all_soft,
9447 clear_bgp_ipv6_all_soft_cmd,
9448 "clear bgp ipv6 * soft",
9449 CLEAR_STR
9450 BGP_STR
9451 "Address family\n"
9452 "Clear all peers\n"
e0bce756 9453 BGP_SOFT_STR)
718e3744 9454
01080f7c 9455ALIAS (clear_bgp_all_soft,
9456 clear_bgp_instance_ipv6_all_soft_cmd,
9457 "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft",
9458 CLEAR_STR
9459 BGP_STR
9460 BGP_INSTANCE_HELP_STR
9461 "Address family\n"
9462 "Clear all peers\n"
9463 BGP_SOFT_STR)
9464
718e3744 9465DEFUN (clear_ip_bgp_peer_soft,
9466 clear_ip_bgp_peer_soft_cmd,
db64ea86 9467 "clear ip bgp (A.B.C.D|WORD) soft",
718e3744 9468 CLEAR_STR
9469 IP_STR
9470 BGP_STR
9471 "BGP neighbor address to clear\n"
db64ea86 9472 "BGP neighbor on interface to clear\n"
e0bce756 9473 BGP_SOFT_STR)
718e3744 9474{
01080f7c 9475 if (argc == 3)
9476 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
9477 BGP_CLEAR_SOFT_BOTH, argv[2]);
9478
718e3744 9479 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
9480 BGP_CLEAR_SOFT_BOTH, argv[0]);
9481}
9482
01080f7c 9483ALIAS (clear_ip_bgp_peer_soft,
9484 clear_ip_bgp_instance_peer_soft_cmd,
9485 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft",
9486 CLEAR_STR
9487 IP_STR
9488 BGP_STR
9489 BGP_INSTANCE_HELP_STR
9490 "BGP neighbor address to clear\n"
9491 "BGP neighbor on interface to clear\n"
9492 BGP_SOFT_STR)
9493
718e3744 9494DEFUN (clear_ip_bgp_peer_ipv4_soft,
9495 clear_ip_bgp_peer_ipv4_soft_cmd,
db64ea86 9496 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft",
718e3744 9497 CLEAR_STR
9498 IP_STR
9499 BGP_STR
9500 "BGP neighbor address to clear\n"
db64ea86 9501 "BGP neighbor on interface to clear\n"
718e3744 9502 "Address family\n"
9503 "Address Family Modifier\n"
9504 "Address Family Modifier\n"
e0bce756 9505 BGP_SOFT_STR)
718e3744 9506{
9507 if (strncmp (argv[1], "m", 1) == 0)
9508 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
9509 BGP_CLEAR_SOFT_BOTH, argv[0]);
9510
9511 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
9512 BGP_CLEAR_SOFT_BOTH, argv[0]);
9513}
9514
01080f7c 9515DEFUN (clear_ip_bgp_instance_peer_ipv4_soft,
9516 clear_ip_bgp_instance_peer_ipv4_soft_cmd,
9517 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft",
9518 CLEAR_STR
9519 IP_STR
9520 BGP_STR
9521 BGP_INSTANCE_HELP_STR
9522 "BGP neighbor address to clear\n"
9523 "BGP neighbor on interface to clear\n"
9524 "Address family\n"
9525 "Address Family Modifier\n"
9526 "Address Family Modifier\n"
9527 BGP_SOFT_STR)
9528{
9529 if (strncmp (argv[3], "m", 1) == 0)
9530 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer,
9531 BGP_CLEAR_SOFT_BOTH, argv[2]);
9532
9533 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
9534 BGP_CLEAR_SOFT_BOTH, argv[2]);
9535}
9536
718e3744 9537DEFUN (clear_ip_bgp_peer_vpnv4_soft,
9538 clear_ip_bgp_peer_vpnv4_soft_cmd,
db64ea86 9539 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft",
718e3744 9540 CLEAR_STR
9541 IP_STR
9542 BGP_STR
9543 "BGP neighbor address to clear\n"
db64ea86 9544 "BGP neighbor on interface to clear\n"
718e3744 9545 "Address family\n"
9546 "Address Family Modifier\n"
e0bce756 9547 BGP_SOFT_STR)
718e3744 9548{
9549 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
9550 BGP_CLEAR_SOFT_BOTH, argv[0]);
9551}
9552
587ff0fd
LB
9553DEFUN (clear_ip_bgp_peer_encap_soft,
9554 clear_ip_bgp_peer_encap_soft_cmd,
9555 "clear ip bgp A.B.C.D encap unicast soft",
9556 CLEAR_STR
9557 IP_STR
9558 BGP_STR
9559 "BGP neighbor address to clear\n"
9560 "Address family\n"
9561 "Address Family Modifier\n"
9562 "Soft reconfig\n")
9563{
9564 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
9565 BGP_CLEAR_SOFT_BOTH, argv[0]);
9566}
9567
718e3744 9568DEFUN (clear_bgp_peer_soft,
9569 clear_bgp_peer_soft_cmd,
a80beece 9570 "clear bgp (A.B.C.D|X:X::X:X|WORD) soft",
718e3744 9571 CLEAR_STR
9572 BGP_STR
9573 "BGP neighbor address to clear\n"
9574 "BGP IPv6 neighbor to clear\n"
a80beece 9575 "BGP neighbor on interface to clear\n"
e0bce756 9576 BGP_SOFT_STR)
718e3744 9577{
01080f7c 9578 if (argc == 3)
9579 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer,
9580 BGP_CLEAR_SOFT_BOTH, argv[2]);
9581
718e3744 9582 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
9583 BGP_CLEAR_SOFT_BOTH, argv[0]);
9584}
9585
01080f7c 9586ALIAS (clear_bgp_peer_soft,
9587 clear_bgp_instance_peer_soft_cmd,
9588 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft",
9589 CLEAR_STR
9590 BGP_STR
9591 BGP_INSTANCE_HELP_STR
9592 "BGP neighbor address to clear\n"
9593 "BGP IPv6 neighbor to clear\n"
9594 "BGP neighbor on interface to clear\n"
9595 BGP_SOFT_STR)
9596
718e3744 9597ALIAS (clear_bgp_peer_soft,
9598 clear_bgp_ipv6_peer_soft_cmd,
a80beece 9599 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft",
718e3744 9600 CLEAR_STR
9601 BGP_STR
9602 "Address family\n"
9603 "BGP neighbor address to clear\n"
9604 "BGP IPv6 neighbor to clear\n"
a80beece 9605 "BGP neighbor on interface to clear\n"
e0bce756 9606 BGP_SOFT_STR)
718e3744 9607
01080f7c 9608ALIAS (clear_bgp_peer_soft,
9609 clear_bgp_instance_ipv6_peer_soft_cmd,
9610 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft",
9611 CLEAR_STR
9612 BGP_STR
9613 BGP_INSTANCE_HELP_STR
9614 "Address family\n"
9615 "BGP neighbor address to clear\n"
9616 "BGP IPv6 neighbor to clear\n"
9617 "BGP neighbor on interface to clear\n"
9618 BGP_SOFT_STR)
9619
718e3744 9620DEFUN (clear_ip_bgp_peer_group_soft,
9621 clear_ip_bgp_peer_group_soft_cmd,
9622 "clear ip bgp peer-group WORD soft",
9623 CLEAR_STR
9624 IP_STR
9625 BGP_STR
9626 "Clear all members of peer-group\n"
9627 "BGP peer-group name\n"
e0bce756 9628 BGP_SOFT_STR)
718e3744 9629{
01080f7c 9630 if (argc == 3)
9631 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
9632 BGP_CLEAR_SOFT_BOTH, argv[2]);
9633
718e3744 9634 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
9635 BGP_CLEAR_SOFT_BOTH, argv[0]);
9636}
9637
01080f7c 9638ALIAS (clear_ip_bgp_peer_group_soft,
9639 clear_ip_bgp_instance_peer_group_soft_cmd,
9640 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft",
9641 CLEAR_STR
9642 IP_STR
9643 BGP_STR
9644 BGP_INSTANCE_HELP_STR
9645 "Clear all members of peer-group\n"
9646 "BGP peer-group name\n"
9647 BGP_SOFT_STR)
9648
718e3744 9649DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
9650 clear_ip_bgp_peer_group_ipv4_soft_cmd,
9651 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
9652 CLEAR_STR
9653 IP_STR
9654 BGP_STR
9655 "Clear all members of peer-group\n"
9656 "BGP peer-group name\n"
9657 "Address family\n"
9658 "Address Family modifier\n"
9659 "Address Family modifier\n"
e0bce756 9660 BGP_SOFT_STR)
718e3744 9661{
9662 if (strncmp (argv[1], "m", 1) == 0)
9663 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
9664 BGP_CLEAR_SOFT_BOTH, argv[0]);
9665
9666 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
9667 BGP_CLEAR_SOFT_BOTH, argv[0]);
9668}
9669
01080f7c 9670DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft,
9671 clear_ip_bgp_instance_peer_group_ipv4_soft_cmd,
9672 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft",
9673 CLEAR_STR
9674 IP_STR
9675 BGP_STR
9676 BGP_INSTANCE_HELP_STR
9677 "Clear all members of peer-group\n"
9678 "BGP peer-group name\n"
9679 "Address family\n"
9680 "Address Family modifier\n"
9681 "Address Family modifier\n"
9682 BGP_SOFT_STR)
9683{
9684 if (strncmp (argv[3], "m", 1) == 0)
9685 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group,
9686 BGP_CLEAR_SOFT_BOTH, argv[2]);
9687
9688 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
9689 BGP_CLEAR_SOFT_BOTH, argv[2]);
9690}
9691
718e3744 9692DEFUN (clear_bgp_peer_group_soft,
9693 clear_bgp_peer_group_soft_cmd,
9694 "clear bgp peer-group WORD soft",
9695 CLEAR_STR
9696 BGP_STR
9697 "Clear all members of peer-group\n"
9698 "BGP peer-group name\n"
e0bce756 9699 BGP_SOFT_STR)
718e3744 9700{
01080f7c 9701 if (argc == 3)
9702 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group,
9703 BGP_CLEAR_SOFT_BOTH, argv[2]);
9704
718e3744 9705 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
9706 BGP_CLEAR_SOFT_BOTH, argv[0]);
9707}
9708
01080f7c 9709ALIAS (clear_bgp_peer_group_soft,
9710 clear_bgp_instance_peer_group_soft_cmd,
9711 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft",
9712 CLEAR_STR
9713 BGP_STR
9714 BGP_INSTANCE_HELP_STR
9715 "Clear all members of peer-group\n"
9716 "BGP peer-group name\n"
9717 BGP_SOFT_STR)
9718
718e3744 9719ALIAS (clear_bgp_peer_group_soft,
9720 clear_bgp_ipv6_peer_group_soft_cmd,
9721 "clear bgp ipv6 peer-group WORD soft",
9722 CLEAR_STR
9723 BGP_STR
9724 "Address family\n"
9725 "Clear all members of peer-group\n"
9726 "BGP peer-group name\n"
e0bce756 9727 BGP_SOFT_STR)
718e3744 9728
01080f7c 9729ALIAS (clear_bgp_peer_group_soft,
9730 clear_bgp_instance_ipv6_peer_group_soft_cmd,
9731 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft",
9732 CLEAR_STR
9733 BGP_STR
9734 BGP_INSTANCE_HELP_STR
9735 "Address family\n"
9736 "Clear all members of peer-group\n"
9737 "BGP peer-group name\n"
9738 BGP_SOFT_STR)
9739
718e3744 9740DEFUN (clear_ip_bgp_external_soft,
9741 clear_ip_bgp_external_soft_cmd,
9742 "clear ip bgp external soft",
9743 CLEAR_STR
9744 IP_STR
9745 BGP_STR
9746 "Clear all external peers\n"
e0bce756 9747 BGP_SOFT_STR)
718e3744 9748{
01080f7c 9749 if (argc == 2)
9750 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
9751 BGP_CLEAR_SOFT_BOTH, NULL);
9752
718e3744 9753 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
9754 BGP_CLEAR_SOFT_BOTH, NULL);
9755}
9756
01080f7c 9757ALIAS (clear_ip_bgp_external_soft,
9758 clear_ip_bgp_instance_external_soft_cmd,
9759 "clear ip bgp " BGP_INSTANCE_CMD " external soft",
9760 CLEAR_STR
9761 IP_STR
9762 BGP_STR
9763 BGP_INSTANCE_HELP_STR
9764 "Clear all external peers\n"
9765 BGP_SOFT_STR)
9766
718e3744 9767DEFUN (clear_ip_bgp_external_ipv4_soft,
9768 clear_ip_bgp_external_ipv4_soft_cmd,
9769 "clear ip bgp external ipv4 (unicast|multicast) soft",
9770 CLEAR_STR
9771 IP_STR
9772 BGP_STR
9773 "Clear all external peers\n"
9774 "Address family\n"
9775 "Address Family modifier\n"
9776 "Address Family modifier\n"
e0bce756 9777 BGP_SOFT_STR)
718e3744 9778{
9779 if (strncmp (argv[0], "m", 1) == 0)
9780 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
9781 BGP_CLEAR_SOFT_BOTH, NULL);
9782
9783 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
9784 BGP_CLEAR_SOFT_BOTH, NULL);
9785}
9786
01080f7c 9787DEFUN (clear_ip_bgp_instance_external_ipv4_soft,
9788 clear_ip_bgp_instance_external_ipv4_soft_cmd,
9789 "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft",
9790 CLEAR_STR
9791 IP_STR
9792 BGP_STR
9793 BGP_INSTANCE_HELP_STR
9794 "Clear all external peers\n"
9795 "Address family\n"
9796 "Address Family modifier\n"
9797 "Address Family modifier\n"
9798 BGP_SOFT_STR)
9799{
9800 if (strncmp (argv[2], "m", 1) == 0)
9801 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external,
9802 BGP_CLEAR_SOFT_BOTH, NULL);
9803
9804 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
9805 BGP_CLEAR_SOFT_BOTH, NULL);
9806}
9807
718e3744 9808DEFUN (clear_bgp_external_soft,
9809 clear_bgp_external_soft_cmd,
9810 "clear bgp external soft",
9811 CLEAR_STR
9812 BGP_STR
9813 "Clear all external peers\n"
e0bce756 9814 BGP_SOFT_STR)
718e3744 9815{
01080f7c 9816 if (argc == 2)
9817 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external,
9818 BGP_CLEAR_SOFT_BOTH, NULL);
9819
718e3744 9820 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
9821 BGP_CLEAR_SOFT_BOTH, NULL);
9822}
9823
01080f7c 9824ALIAS (clear_bgp_external_soft,
9825 clear_bgp_instance_external_soft_cmd,
9826 "clear bgp " BGP_INSTANCE_CMD " external soft",
9827 CLEAR_STR
9828 BGP_STR
9829 BGP_INSTANCE_HELP_STR
9830 "Clear all external peers\n"
9831 BGP_SOFT_STR)
9832
718e3744 9833ALIAS (clear_bgp_external_soft,
9834 clear_bgp_ipv6_external_soft_cmd,
9835 "clear bgp ipv6 external soft",
9836 CLEAR_STR
9837 BGP_STR
9838 "Address family\n"
9839 "Clear all external peers\n"
e0bce756 9840 BGP_SOFT_STR)
718e3744 9841
01080f7c 9842ALIAS (clear_bgp_external_soft,
9843 clear_bgp_instance_ipv6_external_soft_cmd,
9844 "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft",
9845 CLEAR_STR
9846 BGP_STR
9847 BGP_INSTANCE_HELP_STR
9848 "Address family\n"
9849 "Clear all external peers\n"
9850 BGP_SOFT_STR)
9851
718e3744 9852DEFUN (clear_ip_bgp_as_soft,
9853 clear_ip_bgp_as_soft_cmd,
320da874 9854 "clear ip bgp " CMD_AS_RANGE " soft",
718e3744 9855 CLEAR_STR
9856 IP_STR
9857 BGP_STR
9858 "Clear peers with the AS number\n"
e0bce756 9859 BGP_SOFT_STR)
718e3744 9860{
01080f7c 9861 if (argc == 3)
9862 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
9863 BGP_CLEAR_SOFT_BOTH, argv[2]);
9864
718e3744 9865 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
9866 BGP_CLEAR_SOFT_BOTH, argv[0]);
9867}
9868
01080f7c 9869ALIAS (clear_ip_bgp_as_soft,
9870 clear_ip_bgp_instance_as_soft_cmd,
9871 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft",
9872 CLEAR_STR
9873 IP_STR
9874 BGP_STR
9875 BGP_INSTANCE_HELP_STR
9876 "Clear peers with the AS number\n"
9877 BGP_SOFT_STR)
9878
718e3744 9879DEFUN (clear_ip_bgp_as_ipv4_soft,
9880 clear_ip_bgp_as_ipv4_soft_cmd,
320da874 9881 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
718e3744 9882 CLEAR_STR
9883 IP_STR
9884 BGP_STR
9885 "Clear peers with the AS number\n"
9886 "Address family\n"
9887 "Address Family Modifier\n"
9888 "Address Family Modifier\n"
e0bce756 9889 BGP_SOFT_STR)
718e3744 9890{
9891 if (strncmp (argv[1], "m", 1) == 0)
9892 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
9893 BGP_CLEAR_SOFT_BOTH, argv[0]);
9894
9895 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
9896 BGP_CLEAR_SOFT_BOTH, argv[0]);
9897}
9898
01080f7c 9899DEFUN (clear_ip_bgp_instance_as_ipv4_soft,
9900 clear_ip_bgp_instance_as_ipv4_soft_cmd,
9901 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
9902 CLEAR_STR
9903 IP_STR
9904 BGP_STR
9905 BGP_INSTANCE_HELP_STR
9906 "Clear peers with the AS number\n"
9907 "Address family\n"
9908 "Address Family Modifier\n"
9909 "Address Family Modifier\n"
9910 BGP_SOFT_STR)
9911{
9912 if (strncmp (argv[3], "m", 1) == 0)
9913 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as,
9914 BGP_CLEAR_SOFT_BOTH, argv[2]);
9915
9916 return bgp_clear_vty (vty, argv[1],AFI_IP, SAFI_UNICAST, clear_as,
9917 BGP_CLEAR_SOFT_BOTH, argv[2]);
9918}
9919
718e3744 9920DEFUN (clear_ip_bgp_as_vpnv4_soft,
9921 clear_ip_bgp_as_vpnv4_soft_cmd,
320da874 9922 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
718e3744 9923 CLEAR_STR
9924 IP_STR
9925 BGP_STR
9926 "Clear peers with the AS number\n"
9927 "Address family\n"
9928 "Address Family Modifier\n"
e0bce756 9929 BGP_SOFT_STR)
718e3744 9930{
9931 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
9932 BGP_CLEAR_SOFT_BOTH, argv[0]);
9933}
9934
587ff0fd
LB
9935DEFUN (clear_ip_bgp_as_encap_soft,
9936 clear_ip_bgp_as_encap_soft_cmd,
9937 "clear ip bgp " CMD_AS_RANGE " encap unicast soft",
9938 CLEAR_STR
9939 IP_STR
9940 BGP_STR
9941 "Clear peers with the AS number\n"
9942 "Address family\n"
9943 "Address Family Modifier\n"
9944 "Soft reconfig\n")
9945{
9946 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
9947 BGP_CLEAR_SOFT_BOTH, argv[0]);
9948}
9949
718e3744 9950DEFUN (clear_bgp_as_soft,
9951 clear_bgp_as_soft_cmd,
320da874 9952 "clear bgp " CMD_AS_RANGE " soft",
718e3744 9953 CLEAR_STR
9954 BGP_STR
9955 "Clear peers with the AS number\n"
e0bce756 9956 BGP_SOFT_STR)
718e3744 9957{
01080f7c 9958 if (argc == 3)
9959 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as,
9960 BGP_CLEAR_SOFT_BOTH, argv[2]);
9961
718e3744 9962 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
9963 BGP_CLEAR_SOFT_BOTH, argv[0]);
9964}
9965
01080f7c 9966ALIAS (clear_bgp_as_soft,
9967 clear_bgp_instance_as_soft_cmd,
9968 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft",
9969 CLEAR_STR
9970 BGP_STR
9971 BGP_INSTANCE_HELP_STR
9972 "Clear peers with the AS number\n"
9973 BGP_SOFT_STR)
9974
718e3744 9975ALIAS (clear_bgp_as_soft,
9976 clear_bgp_ipv6_as_soft_cmd,
320da874 9977 "clear bgp ipv6 " CMD_AS_RANGE " soft",
718e3744 9978 CLEAR_STR
9979 BGP_STR
9980 "Address family\n"
9981 "Clear peers with the AS number\n"
e0bce756 9982 BGP_SOFT_STR)
6b0655a2 9983
01080f7c 9984ALIAS (clear_bgp_as_soft,
9985 clear_bgp_instance_ipv6_as_soft_cmd,
9986 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft",
9987 CLEAR_STR
9988 BGP_STR
9989 BGP_INSTANCE_HELP_STR
9990 "Address family\n"
9991 "Clear peers with the AS number\n"
9992 BGP_SOFT_STR)
9993
e0081f70
ML
9994DEFUN (show_bgp_views,
9995 show_bgp_views_cmd,
9996 "show bgp views",
9997 SHOW_STR
9998 BGP_STR
9999 "Show the defined BGP views\n")
10000{
10001 struct list *inst = bm->bgp;
10002 struct listnode *node;
10003 struct bgp *bgp;
10004
10005 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
10006 {
8386ac43 10007 vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE);
e0081f70
ML
10008 return CMD_WARNING;
10009 }
10010
10011 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
10012 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
8386ac43 10013 {
10014 /* Skip VRFs. */
10015 if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF)
10016 continue;
10017 vty_out (vty, "\t%s (AS%u)%s",
10018 bgp->name ? bgp->name : "(null)",
10019 bgp->as, VTY_NEWLINE);
10020 }
e0081f70
ML
10021
10022 return CMD_SUCCESS;
10023}
10024
8386ac43 10025DEFUN (show_bgp_vrfs,
10026 show_bgp_vrfs_cmd,
10027 "show bgp vrfs {json}",
10028 SHOW_STR
10029 BGP_STR
10030 "Show BGP VRFs\n"
10031 "JavaScript Object Notation\n")
10032{
10033 struct list *inst = bm->bgp;
10034 struct listnode *node;
10035 struct bgp *bgp;
10036 u_char uj = use_json(argc, argv);
10037 json_object *json = NULL;
10038 json_object *json_vrfs = NULL;
10039 int count = 0;
10040 static char header[] = "Type Id RouterId #PeersCfg #PeersEstb Name";
10041
10042 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
10043 {
10044 vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE);
10045 return CMD_WARNING;
10046 }
10047
10048 if (uj)
10049 {
10050 json = json_object_new_object();
10051 json_vrfs = json_object_new_object();
10052 }
10053
10054 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
10055 {
10056 const char *name, *type;
10057 struct peer *peer;
10058 struct listnode *node, *nnode;
10059 int peers_cfg, peers_estb;
10060 json_object *json_vrf = NULL;
5c81a5f3 10061 int vrf_id_ui;
8386ac43 10062
10063 /* Skip Views. */
10064 if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
10065 continue;
10066
10067 count++;
10068 if (!uj && count == 1)
10069 vty_out (vty, "%s%s", header, VTY_NEWLINE);
10070
10071 peers_cfg = peers_estb = 0;
10072 if (uj)
10073 json_vrf = json_object_new_object();
10074
10075
10076 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
10077 {
10078 if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
10079 continue;
10080 peers_cfg++;
10081 if (peer->status == Established)
10082 peers_estb++;
10083 }
10084
10085 if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
10086 {
10087 name = "Default";
10088 type = "DFLT";
10089 }
10090 else
10091 {
10092 name = bgp->name;
10093 type = "VRF";
10094 }
10095
5c81a5f3 10096 vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id;
8386ac43 10097 if (uj)
10098 {
10099 json_object_string_add(json_vrf, "type", type);
5c81a5f3 10100 json_object_int_add(json_vrf, "vrfId", vrf_id_ui);
8386ac43 10101 json_object_string_add(json_vrf, "routerId", inet_ntoa (bgp->router_id));
10102 json_object_int_add(json_vrf, "numConfiguredPeers", peers_cfg);
10103 json_object_int_add(json_vrf, "numEstablishedPeers", peers_estb);
10104
10105 json_object_object_add(json_vrfs, name, json_vrf);
10106 }
10107 else
5c81a5f3 10108 vty_out (vty, "%4s %-5d %-16s %9u %10u %s%s",
10109 type, vrf_id_ui, inet_ntoa (bgp->router_id),
8386ac43 10110 peers_cfg, peers_estb, name,
10111 VTY_NEWLINE);
10112 }
10113
10114 if (uj)
10115 {
10116 json_object_object_add(json, "vrfs", json_vrfs);
10117
10118 json_object_int_add(json, "totalVrfs", count);
10119
10120 vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
10121 json_object_free(json);
10122 }
10123 else
10124 {
10125 if (count)
10126 vty_out (vty, "%sTotal number of VRFs (including default): %d%s",
10127 VTY_NEWLINE, count, VTY_NEWLINE);
10128 }
10129
10130 return CMD_SUCCESS;
10131}
10132
4bf6a362
PJ
10133DEFUN (show_bgp_memory,
10134 show_bgp_memory_cmd,
10135 "show bgp memory",
10136 SHOW_STR
10137 BGP_STR
10138 "Global BGP memory statistics\n")
10139{
10140 char memstrbuf[MTYPE_MEMSTR_LEN];
10141 unsigned long count;
10142
10143 /* RIB related usage stats */
10144 count = mtype_stats_alloc (MTYPE_BGP_NODE);
10145 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
10146 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10147 count * sizeof (struct bgp_node)),
10148 VTY_NEWLINE);
10149
10150 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
10151 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
10152 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10153 count * sizeof (struct bgp_info)),
10154 VTY_NEWLINE);
fb982c25
PJ
10155 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
10156 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
10157 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10158 count * sizeof (struct bgp_info_extra)),
10159 VTY_NEWLINE);
4bf6a362
PJ
10160
10161 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
10162 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
10163 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10164 count * sizeof (struct bgp_static)),
10165 VTY_NEWLINE);
3f9c7369
DS
10166
10167 if ((count = mtype_stats_alloc (MTYPE_BGP_PACKET)))
10168 vty_out (vty, "%ld Packets, using %s of memory%s", count,
10169 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10170 count * sizeof (struct bpacket)),
10171 VTY_NEWLINE);
4bf6a362
PJ
10172
10173 /* Adj-In/Out */
10174 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
10175 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
10176 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10177 count * sizeof (struct bgp_adj_in)),
10178 VTY_NEWLINE);
10179 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
10180 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
10181 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10182 count * sizeof (struct bgp_adj_out)),
10183 VTY_NEWLINE);
10184
10185 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
10186 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
10187 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10188 count * sizeof (struct bgp_nexthop_cache)),
10189 VTY_NEWLINE);
10190
10191 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
10192 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
10193 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10194 count * sizeof (struct bgp_damp_info)),
10195 VTY_NEWLINE);
10196
10197 /* Attributes */
10198 count = attr_count();
10199 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
10200 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10201 count * sizeof(struct attr)),
10202 VTY_NEWLINE);
fb982c25
PJ
10203 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
10204 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
10205 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10206 count * sizeof(struct attr_extra)),
10207 VTY_NEWLINE);
4bf6a362
PJ
10208
10209 if ((count = attr_unknown_count()))
10210 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
10211
10212 /* AS_PATH attributes */
10213 count = aspath_count ();
10214 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
10215 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10216 count * sizeof (struct aspath)),
10217 VTY_NEWLINE);
10218
10219 count = mtype_stats_alloc (MTYPE_AS_SEG);
10220 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
10221 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10222 count * sizeof (struct assegment)),
10223 VTY_NEWLINE);
10224
10225 /* Other attributes */
10226 if ((count = community_count ()))
10227 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
10228 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10229 count * sizeof (struct community)),
10230 VTY_NEWLINE);
10231 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
10232 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
10233 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10234 count * sizeof (struct ecommunity)),
10235 VTY_NEWLINE);
10236
10237 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
10238 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
10239 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10240 count * sizeof (struct cluster_list)),
10241 VTY_NEWLINE);
10242
10243 /* Peer related usage */
10244 count = mtype_stats_alloc (MTYPE_BGP_PEER);
10245 vty_out (vty, "%ld peers, using %s of memory%s", count,
10246 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10247 count * sizeof (struct peer)),
10248 VTY_NEWLINE);
10249
4a1ab8e4 10250 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
4bf6a362
PJ
10251 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
10252 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10253 count * sizeof (struct peer_group)),
10254 VTY_NEWLINE);
10255
10256 /* Other */
10257 if ((count = mtype_stats_alloc (MTYPE_HASH)))
10258 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
10259 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10260 count * sizeof (struct hash)),
10261 VTY_NEWLINE);
10262 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
10263 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
10264 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10265 count * sizeof (struct hash_backet)),
10266 VTY_NEWLINE);
10267 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
10268 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
10269 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10270 count * sizeof (regex_t)),
10271 VTY_NEWLINE);
10272 return CMD_SUCCESS;
10273}
fee0f4c6 10274
718e3744 10275/* Show BGP peer's summary information. */
94f2b392 10276static int
b05a1c8b 10277bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi,
9f689658 10278 u_char use_json, json_object *json)
718e3744 10279{
10280 struct peer *peer;
1eb8ef25 10281 struct listnode *node, *nnode;
f14e6fdb
DS
10282 unsigned int count = 0, dn_count = 0;
10283 char timebuf[BGP_UPTIME_LEN], dn_flag[2];
718e3744 10284 int len;
ffd0c037
DS
10285 json_object *json_peer = NULL;
10286 json_object *json_peers = NULL;
718e3744 10287
10288 /* Header string for each address family. */
4a7ac06c 10289 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
47fc97cc 10290
b05a1c8b
DS
10291 if (use_json)
10292 {
9f689658
DD
10293 if (json == NULL)
10294 json = json_object_new_object();
10295
f1aa5d8a 10296 json_peers = json_object_new_object();
b05a1c8b
DS
10297 }
10298
1eb8ef25 10299 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
718e3744 10300 {
1ff9a340
DS
10301 if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
10302 continue;
10303
718e3744 10304 if (peer->afc[afi][safi])
10305 {
b05a1c8b 10306 if (!count)
4bf6a362
PJ
10307 {
10308 unsigned long ents;
10309 char memstrbuf[MTYPE_MEMSTR_LEN];
5c81a5f3 10310 int vrf_id_ui;
10311
10312 vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id;
b05a1c8b 10313
4bf6a362 10314 /* Usage summary and header */
b05a1c8b
DS
10315 if (use_json)
10316 {
62d6dca0 10317 json_object_string_add(json, "routerId", inet_ntoa (bgp->router_id));
f1aa5d8a 10318 json_object_int_add(json, "as", bgp->as);
9f689658
DD
10319 json_object_int_add(json, "vrfId", vrf_id_ui);
10320 json_object_string_add(json, "vrfName",
10321 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
10322 ? "Default" : bgp->name);
b05a1c8b
DS
10323 }
10324 else
10325 {
10326 vty_out (vty,
5c81a5f3 10327 "BGP router identifier %s, local AS number %u vrf-id %d",
10328 inet_ntoa (bgp->router_id), bgp->as, vrf_id_ui);
6aeb9e78 10329 vty_out (vty, "%s", VTY_NEWLINE);
b05a1c8b
DS
10330 }
10331
f188f2c4
DS
10332 if (bgp_update_delay_configured(bgp))
10333 {
b05a1c8b 10334 if (use_json)
f188f2c4 10335 {
62d6dca0 10336 json_object_int_add(json, "updateDelayLimit", bgp->v_update_delay);
b05a1c8b
DS
10337
10338 if (bgp->v_update_delay != bgp->v_establish_wait)
62d6dca0 10339 json_object_int_add(json, "updateDelayEstablishWait", bgp->v_establish_wait);
b05a1c8b
DS
10340
10341 if (bgp_update_delay_active(bgp))
10342 {
62d6dca0
DS
10343 json_object_string_add(json, "updateDelayFirstNeighbor", bgp->update_delay_begin_time);
10344 json_object_boolean_true_add(json, "updateDelayInProgress");
b05a1c8b
DS
10345 }
10346 else
10347 {
10348 if (bgp->update_delay_over)
10349 {
62d6dca0 10350 json_object_string_add(json, "updateDelayFirstNeighbor",
f1aa5d8a 10351 bgp->update_delay_begin_time);
62d6dca0 10352 json_object_string_add(json, "updateDelayBestpathResumed",
f1aa5d8a 10353 bgp->update_delay_end_time);
62d6dca0 10354 json_object_string_add(json, "updateDelayZebraUpdateResume",
f1aa5d8a 10355 bgp->update_delay_zebra_resume_time);
62d6dca0 10356 json_object_string_add(json, "updateDelayPeerUpdateResume",
f1aa5d8a 10357 bgp->update_delay_peers_resume_time);
b05a1c8b
DS
10358 }
10359 }
f188f2c4
DS
10360 }
10361 else
10362 {
b05a1c8b
DS
10363 vty_out (vty, "Read-only mode update-delay limit: %d seconds%s",
10364 bgp->v_update_delay, VTY_NEWLINE);
10365 if (bgp->v_update_delay != bgp->v_establish_wait)
10366 vty_out (vty, " Establish wait: %d seconds%s",
10367 bgp->v_establish_wait, VTY_NEWLINE);
10368
10369 if (bgp_update_delay_active(bgp))
f188f2c4
DS
10370 {
10371 vty_out (vty, " First neighbor established: %s%s",
10372 bgp->update_delay_begin_time, VTY_NEWLINE);
b05a1c8b
DS
10373 vty_out (vty, " Delay in progress%s", VTY_NEWLINE);
10374 }
10375 else
10376 {
10377 if (bgp->update_delay_over)
10378 {
10379 vty_out (vty, " First neighbor established: %s%s",
10380 bgp->update_delay_begin_time, VTY_NEWLINE);
10381 vty_out (vty, " Best-paths resumed: %s%s",
10382 bgp->update_delay_end_time, VTY_NEWLINE);
10383 vty_out (vty, " zebra update resumed: %s%s",
10384 bgp->update_delay_zebra_resume_time, VTY_NEWLINE);
10385 vty_out (vty, " peers update resumed: %s%s",
10386 bgp->update_delay_peers_resume_time, VTY_NEWLINE);
10387 }
f188f2c4
DS
10388 }
10389 }
10390 }
4bf6a362 10391
b05a1c8b
DS
10392 if (use_json)
10393 {
10394 if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active)
62d6dca0 10395 json_object_boolean_true_add(json, "maxMedOnStartup");
b05a1c8b 10396 if (bgp->v_maxmed_admin)
62d6dca0 10397 json_object_boolean_true_add(json, "maxMedAdministrative");
b05a1c8b 10398
62d6dca0 10399 json_object_int_add(json, "tableVersion", bgp_table_version(bgp->rib[afi][safi]));
b05a1c8b
DS
10400
10401 ents = bgp_table_count (bgp->rib[afi][safi]);
62d6dca0
DS
10402 json_object_int_add(json, "ribCount", ents);
10403 json_object_int_add(json, "ribMemory", ents * sizeof (struct bgp_node));
b05a1c8b
DS
10404
10405 ents = listcount (bgp->peer);
62d6dca0
DS
10406 json_object_int_add(json, "peerCount", ents);
10407 json_object_int_add(json, "peerMemory", ents * sizeof (struct peer));
b05a1c8b 10408
b05a1c8b
DS
10409 if ((ents = listcount (bgp->group)))
10410 {
62d6dca0
DS
10411 json_object_int_add(json, "peerGroupCount", ents);
10412 json_object_int_add(json, "peerGroupMemory", ents * sizeof (struct peer_group));
b05a1c8b 10413 }
3f9c7369 10414
b05a1c8b 10415 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
62d6dca0 10416 json_object_boolean_true_add(json, "dampeningEnabled");
b05a1c8b
DS
10417 }
10418 else
10419 {
10420 if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active)
10421 vty_out (vty, "Max-med on-startup active%s", VTY_NEWLINE);
10422 if (bgp->v_maxmed_admin)
10423 vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE);
10424
ffd0c037 10425 vty_out(vty, "BGP table version %" PRIu64 "%s",
b05a1c8b
DS
10426 bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE);
10427
10428 ents = bgp_table_count (bgp->rib[afi][safi]);
10429 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
10430 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10431 ents * sizeof (struct bgp_node)),
10432 VTY_NEWLINE);
10433
10434 /* Peer related usage */
10435 ents = listcount (bgp->peer);
10436 vty_out (vty, "Peers %ld, using %s of memory%s",
10437 ents,
10438 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10439 ents * sizeof (struct peer)),
10440 VTY_NEWLINE);
10441
b05a1c8b
DS
10442 if ((ents = listcount (bgp->group)))
10443 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
10444 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10445 ents * sizeof (struct peer_group)),
10446 VTY_NEWLINE);
10447
10448 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
10449 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
10450 vty_out (vty, "%s", VTY_NEWLINE);
10451 vty_out (vty, "%s%s", header, VTY_NEWLINE);
10452 }
4bf6a362
PJ
10453 }
10454
b05a1c8b 10455 count++;
718e3744 10456
b05a1c8b
DS
10457 if (use_json)
10458 {
10459 json_peer = json_object_new_object();
f14e6fdb 10460
b05a1c8b 10461 if (peer_dynamic_neighbor(peer))
62d6dca0 10462 json_object_boolean_true_add(json_peer, "dynamicPeer");
b05a1c8b 10463
04b6bdc0
DW
10464 if (peer->hostname)
10465 json_object_string_add(json_peer, "hostname", peer->hostname);
10466
10467 if (peer->domainname)
10468 json_object_string_add(json_peer, "domainname", peer->domainname);
10469
62d6dca0 10470 json_object_int_add(json_peer, "remoteAs", peer->as);
f1aa5d8a 10471 json_object_int_add(json_peer, "version", 4);
62d6dca0 10472 json_object_int_add(json_peer, "msgRcvd",
f1aa5d8a
DS
10473 peer->open_in + peer->update_in + peer->keepalive_in
10474 + peer->notify_in + peer->refresh_in
10475 + peer->dynamic_cap_in);
62d6dca0 10476 json_object_int_add(json_peer, "msgSent",
f1aa5d8a
DS
10477 peer->open_out + peer->update_out + peer->keepalive_out
10478 + peer->notify_out + peer->refresh_out
10479 + peer->dynamic_cap_out);
10480
62d6dca0 10481 json_object_int_add(json_peer, "tableVersion", peer->version[afi][safi]);
f1aa5d8a
DS
10482 json_object_int_add(json_peer, "outq", peer->obuf->count);
10483 json_object_int_add(json_peer, "inq", 0);
856ca177 10484 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, use_json, json_peer);
62d6dca0 10485 json_object_int_add(json_peer, "prefixReceivedCount", peer->pcount[afi][safi]);
b05a1c8b
DS
10486
10487 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
f1aa5d8a 10488 json_object_string_add(json_peer, "state", "Idle (Admin)");
b05a1c8b 10489 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
f1aa5d8a 10490 json_object_string_add(json_peer, "state", "Idle (PfxCt)");
b05a1c8b 10491 else
f1aa5d8a 10492 json_object_string_add(json_peer, "state", LOOKUP(bgp_status_msg, peer->status));
b05a1c8b 10493
f1aa5d8a 10494 if (peer->conf_if)
62d6dca0 10495 json_object_string_add(json_peer, "idType", "interface");
f1aa5d8a 10496 else if (peer->su.sa.sa_family == AF_INET)
62d6dca0 10497 json_object_string_add(json_peer, "idType", "ipv4");
f1aa5d8a 10498 else if (peer->su.sa.sa_family == AF_INET6)
62d6dca0 10499 json_object_string_add(json_peer, "idType", "ipv6");
b05a1c8b 10500
f1aa5d8a 10501 json_object_object_add(json_peers, peer->host, json_peer);
b05a1c8b
DS
10502 }
10503 else
10504 {
10505 memset(dn_flag, '\0', sizeof(dn_flag));
10506 if (peer_dynamic_neighbor(peer))
10507 {
10508 dn_count++;
10509 dn_flag[0] = '*';
10510 }
10511
04b6bdc0
DW
10512 if (peer->hostname && bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME))
10513 len = vty_out (vty, "%s%s(%s)", dn_flag, peer->hostname,
10514 peer->host);
10515 else
10516 len = vty_out (vty, "%s%s", dn_flag, peer->host);
b05a1c8b
DS
10517 len = 16 - len;
10518
10519 if (len < 1)
10520 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
10521 else
10522 vty_out (vty, "%*s", len, " ");
10523
10524 vty_out (vty, "4 ");
10525
ee046671 10526 vty_out (vty, "%5u %7d %7d %8" PRIu64 " %4d %4zd ",
b05a1c8b
DS
10527 peer->as,
10528 peer->open_in + peer->update_in + peer->keepalive_in
10529 + peer->notify_in + peer->refresh_in
10530 + peer->dynamic_cap_in,
10531 peer->open_out + peer->update_out + peer->keepalive_out
10532 + peer->notify_out + peer->refresh_out
10533 + peer->dynamic_cap_out,
10534 peer->version[afi][safi],
10535 0,
ffd0c037 10536 peer->obuf->count);
b05a1c8b 10537
f1aa5d8a 10538 vty_out (vty, "%-8s",
856ca177 10539 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL));
b05a1c8b
DS
10540
10541 if (peer->status == Established)
10542 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
10543 else
10544 {
10545 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
10546 vty_out (vty, " Idle (Admin)");
10547 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
10548 vty_out (vty, " Idle (PfxCt)");
10549 else
10550 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
10551 }
10552 vty_out (vty, "%s", VTY_NEWLINE);
10553 }
718e3744 10554 }
10555 }
10556
b05a1c8b
DS
10557 if (use_json)
10558 {
10559 json_object_object_add(json, "peers", json_peers);
14151a32 10560
62d6dca0
DS
10561 json_object_int_add(json, "totalPeers", count);
10562 json_object_int_add(json, "dynamicPeers", dn_count);
14151a32 10563
b05a1c8b 10564 vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
f1aa5d8a 10565 json_object_free(json);
b05a1c8b
DS
10566 }
10567 else
f14e6fdb 10568 {
b05a1c8b
DS
10569 if (count)
10570 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
10571 count, VTY_NEWLINE);
10572 else
9f689658
DD
10573 {
10574 if (use_json)
10575 vty_out(vty, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s",
10576 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
10577 else
10578 vty_out (vty, "No %s neighbor is configured%s",
10579 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
10580 }
b05a1c8b 10581
9f689658 10582 if (dn_count && ! use_json)
b05a1c8b
DS
10583 {
10584 vty_out(vty, "* - dynamic neighbor%s", VTY_NEWLINE);
10585 vty_out(vty,
10586 "%d dynamic neighbor(s), limit %d%s",
10587 dn_count, bgp->dynamic_neighbors_limit, VTY_NEWLINE);
10588 }
f14e6fdb
DS
10589 }
10590
718e3744 10591 return CMD_SUCCESS;
10592}
10593
47fc97cc
DS
10594static int
10595bgp_show_summary_vty (struct vty *vty, const char *name,
b05a1c8b 10596 afi_t afi, safi_t safi, u_char use_json)
718e3744 10597{
10598 struct bgp *bgp;
10599
10600 if (name)
10601 {
10602 bgp = bgp_lookup_by_name (name);
47fc97cc 10603
718e3744 10604 if (! bgp)
10605 {
47fc97cc 10606 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
718e3744 10607 return CMD_WARNING;
10608 }
10609
9f689658 10610 bgp_show_summary (vty, bgp, afi, safi, use_json, NULL);
718e3744 10611 return CMD_SUCCESS;
10612 }
47fc97cc 10613
718e3744 10614 bgp = bgp_get_default ();
10615
10616 if (bgp)
9f689658 10617 bgp_show_summary (vty, bgp, afi, safi, use_json, NULL);
47fc97cc 10618
718e3744 10619 return CMD_SUCCESS;
10620}
10621
f186de26 10622static void
10623bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi,
10624 u_char use_json)
10625{
10626 struct listnode *node, *nnode;
10627 struct bgp *bgp;
9f689658
DD
10628 json_object *json = NULL;
10629 int is_first = 1;
10630
10631 if (use_json)
10632 vty_out (vty, "{%s", VTY_NEWLINE);
f186de26 10633
10634 for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
10635 {
9f689658
DD
10636 if (use_json)
10637 {
10638 if (!(json = json_object_new_object()))
10639 {
10640 zlog_err("Unable to allocate memory for JSON object");
10641 vty_out (vty,
10642 "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s",
10643 VTY_NEWLINE);
10644 return;
10645 }
10646
10647 if (! is_first)
10648 vty_out (vty, ",%s", VTY_NEWLINE);
10649 else
10650 is_first = 0;
10651
10652 vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
10653 ? "Default" : bgp->name);
10654 }
10655 else
10656 {
10657 vty_out (vty, "%sInstance %s:%s",
10658 VTY_NEWLINE,
10659 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
10660 ? "Default" : bgp->name, VTY_NEWLINE);
10661 }
10662 bgp_show_summary (vty, bgp, afi, safi, use_json, json);
f186de26 10663 }
9f689658
DD
10664
10665 if (use_json)
10666 vty_out (vty, "}%s", VTY_NEWLINE);
10667
f186de26 10668}
10669
718e3744 10670/* `show ip bgp summary' commands. */
47fc97cc 10671DEFUN (show_ip_bgp_summary,
718e3744 10672 show_ip_bgp_summary_cmd,
b05a1c8b 10673 "show ip bgp summary {json}",
47fc97cc
DS
10674 SHOW_STR
10675 IP_STR
10676 BGP_STR
b05a1c8b
DS
10677 "Summary of BGP neighbor status\n"
10678 "JavaScript Object Notation\n")
47fc97cc 10679{
db7c8528
DS
10680 u_char uj = use_json(argc, argv);
10681 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj);
718e3744 10682}
10683
10684DEFUN (show_ip_bgp_instance_summary,
10685 show_ip_bgp_instance_summary_cmd,
8386ac43 10686 "show ip bgp " BGP_INSTANCE_CMD " summary {json}",
718e3744 10687 SHOW_STR
10688 IP_STR
10689 BGP_STR
8386ac43 10690 BGP_INSTANCE_HELP_STR
b05a1c8b
DS
10691 "Summary of BGP neighbor status\n"
10692 "JavaScript Object Notation\n")
718e3744 10693{
db7c8528 10694 u_char uj = use_json(argc, argv);
6aeb9e78 10695 return bgp_show_summary_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, uj);
718e3744 10696}
10697
f186de26 10698DEFUN (show_ip_bgp_instance_all_summary,
10699 show_ip_bgp_instance_all_summary_cmd,
10700 "show ip bgp " BGP_INSTANCE_ALL_CMD " summary {json}",
10701 SHOW_STR
10702 IP_STR
10703 BGP_STR
10704 BGP_INSTANCE_ALL_HELP_STR
10705 "Summary of BGP neighbor status\n"
10706 "JavaScript Object Notation\n")
10707{
10708 u_char uj = use_json(argc, argv);
10709
10710 bgp_show_all_instances_summary_vty (vty, AFI_IP, SAFI_UNICAST, uj);
10711 return CMD_SUCCESS;
10712}
10713
718e3744 10714DEFUN (show_ip_bgp_ipv4_summary,
10715 show_ip_bgp_ipv4_summary_cmd,
b05a1c8b 10716 "show ip bgp ipv4 (unicast|multicast) summary {json}",
718e3744 10717 SHOW_STR
10718 IP_STR
10719 BGP_STR
10720 "Address family\n"
10721 "Address Family modifier\n"
10722 "Address Family modifier\n"
b05a1c8b
DS
10723 "Summary of BGP neighbor status\n"
10724 "JavaScript Object Notation\n")
718e3744 10725{
db7c8528 10726 u_char uj = use_json(argc, argv);
718e3744 10727 if (strncmp (argv[0], "m", 1) == 0)
db7c8528 10728 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, uj);
718e3744 10729
db7c8528 10730 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj);
718e3744 10731}
10732
95cbbd2a
ML
10733ALIAS (show_ip_bgp_ipv4_summary,
10734 show_bgp_ipv4_safi_summary_cmd,
b05a1c8b 10735 "show bgp ipv4 (unicast|multicast) summary {json}",
95cbbd2a
ML
10736 SHOW_STR
10737 BGP_STR
10738 "Address family\n"
10739 "Address Family modifier\n"
10740 "Address Family modifier\n"
10741 "Summary of BGP neighbor status\n")
10742
718e3744 10743DEFUN (show_ip_bgp_instance_ipv4_summary,
10744 show_ip_bgp_instance_ipv4_summary_cmd,
b05a1c8b 10745 "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}",
718e3744 10746 SHOW_STR
10747 IP_STR
10748 BGP_STR
10749 "BGP view\n"
10750 "View name\n"
10751 "Address family\n"
10752 "Address Family modifier\n"
10753 "Address Family modifier\n"
b05a1c8b
DS
10754 "Summary of BGP neighbor status\n"
10755 "JavaScript Object Notation\n")
718e3744 10756{
db7c8528 10757 u_char uj = use_json(argc, argv);
718e3744 10758 if (strncmp (argv[1], "m", 1) == 0)
db7c8528 10759 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, uj);
718e3744 10760 else
db7c8528 10761 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, uj);
718e3744 10762}
10763
95cbbd2a
ML
10764ALIAS (show_ip_bgp_instance_ipv4_summary,
10765 show_bgp_instance_ipv4_safi_summary_cmd,
b05a1c8b 10766 "show bgp view WORD ipv4 (unicast|multicast) summary {json}",
95cbbd2a
ML
10767 SHOW_STR
10768 BGP_STR
10769 "BGP view\n"
10770 "View name\n"
10771 "Address family\n"
10772 "Address Family modifier\n"
10773 "Address Family modifier\n"
10774 "Summary of BGP neighbor status\n")
10775
718e3744 10776DEFUN (show_ip_bgp_vpnv4_all_summary,
10777 show_ip_bgp_vpnv4_all_summary_cmd,
b05a1c8b 10778 "show ip bgp vpnv4 all summary {json}",
718e3744 10779 SHOW_STR
10780 IP_STR
10781 BGP_STR
10782 "Display VPNv4 NLRI specific information\n"
10783 "Display information about all VPNv4 NLRIs\n"
b05a1c8b
DS
10784 "Summary of BGP neighbor status\n"
10785 "JavaScript Object Notation\n")
718e3744 10786{
db7c8528
DS
10787 u_char uj = use_json(argc, argv);
10788 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj);
718e3744 10789}
10790
10791DEFUN (show_ip_bgp_vpnv4_rd_summary,
10792 show_ip_bgp_vpnv4_rd_summary_cmd,
b05a1c8b 10793 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary {json}",
718e3744 10794 SHOW_STR
10795 IP_STR
10796 BGP_STR
10797 "Display VPNv4 NLRI specific information\n"
10798 "Display information for a route distinguisher\n"
10799 "VPN Route Distinguisher\n"
b05a1c8b
DS
10800 "Summary of BGP neighbor status\n"
10801 "JavaScript Object Notation\n")
718e3744 10802{
10803 int ret;
10804 struct prefix_rd prd;
db7c8528 10805 u_char uj = use_json(argc, argv);
718e3744 10806
10807 ret = str2prefix_rd (argv[0], &prd);
10808 if (! ret)
10809 {
10810 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
10811 return CMD_WARNING;
10812 }
10813
db7c8528 10814 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj);
718e3744 10815}
10816
10817#ifdef HAVE_IPV6
47fc97cc 10818DEFUN (show_bgp_summary,
718e3744 10819 show_bgp_summary_cmd,
b05a1c8b 10820 "show bgp summary {json}",
718e3744 10821 SHOW_STR
10822 BGP_STR
b05a1c8b
DS
10823 "Summary of BGP neighbor status\n"
10824 "JavaScript Object Notation\n")
718e3744 10825{
db7c8528 10826 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json(argc, argv));
718e3744 10827}
10828
10829DEFUN (show_bgp_instance_summary,
10830 show_bgp_instance_summary_cmd,
8386ac43 10831 "show bgp " BGP_INSTANCE_CMD " summary {json}",
718e3744 10832 SHOW_STR
10833 BGP_STR
8386ac43 10834 BGP_INSTANCE_HELP_STR
b05a1c8b
DS
10835 "Summary of BGP neighbor status\n"
10836 "JavaScript Object Notation\n")
718e3744 10837{
6aeb9e78 10838 return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, use_json(argc, argv));
718e3744 10839}
10840
f186de26 10841DEFUN (show_bgp_instance_all_summary,
10842 show_bgp_instance_all_summary_cmd,
10843 "show bgp " BGP_INSTANCE_ALL_CMD " summary {json}",
10844 SHOW_STR
10845 BGP_STR
10846 BGP_INSTANCE_ALL_HELP_STR
10847 "Summary of BGP neighbor status\n"
10848 "JavaScript Object Notation\n")
10849{
10850 u_char uj = use_json(argc, argv);
10851
10852 bgp_show_all_instances_summary_vty (vty, AFI_IP6, SAFI_UNICAST, uj);
10853 return CMD_SUCCESS;
10854}
10855
718e3744 10856ALIAS (show_bgp_summary,
10857 show_bgp_ipv6_summary_cmd,
b05a1c8b 10858 "show bgp ipv6 summary {json}",
718e3744 10859 SHOW_STR
10860 BGP_STR
10861 "Address family\n"
10862 "Summary of BGP neighbor status\n")
10863
10864ALIAS (show_bgp_instance_summary,
10865 show_bgp_instance_ipv6_summary_cmd,
8386ac43 10866 "show bgp " BGP_INSTANCE_CMD " ipv6 summary {json}",
718e3744 10867 SHOW_STR
10868 BGP_STR
8386ac43 10869 BGP_INSTANCE_HELP_STR
718e3744 10870 "Address family\n"
10871 "Summary of BGP neighbor status\n")
10872
95cbbd2a
ML
10873DEFUN (show_bgp_ipv6_safi_summary,
10874 show_bgp_ipv6_safi_summary_cmd,
b05a1c8b 10875 "show bgp ipv6 (unicast|multicast) summary {json}",
95cbbd2a
ML
10876 SHOW_STR
10877 BGP_STR
10878 "Address family\n"
10879 "Address Family modifier\n"
10880 "Address Family modifier\n"
b05a1c8b
DS
10881 "Summary of BGP neighbor status\n"
10882 "JavaScript Object Notation\n")
95cbbd2a 10883{
db7c8528 10884 u_char uj = use_json(argc, argv);
95cbbd2a 10885 if (strncmp (argv[0], "m", 1) == 0)
db7c8528 10886 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj);
95cbbd2a 10887
db7c8528 10888 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj);
95cbbd2a
ML
10889}
10890
10891DEFUN (show_bgp_instance_ipv6_safi_summary,
10892 show_bgp_instance_ipv6_safi_summary_cmd,
8386ac43 10893 "show bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) summary {json}",
95cbbd2a
ML
10894 SHOW_STR
10895 BGP_STR
8386ac43 10896 BGP_INSTANCE_HELP_STR
95cbbd2a
ML
10897 "Address family\n"
10898 "Address Family modifier\n"
10899 "Address Family modifier\n"
b05a1c8b
DS
10900 "Summary of BGP neighbor status\n"
10901 "JavaScript Object Notation\n")
95cbbd2a 10902{
db7c8528 10903 u_char uj = use_json(argc, argv);
6aeb9e78
DS
10904 if (strncmp (argv[2], "m", 1) == 0)
10905 return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_MULTICAST, uj);
95cbbd2a 10906
6aeb9e78 10907 return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, uj);
95cbbd2a
ML
10908}
10909
718e3744 10910/* old command */
10911DEFUN (show_ipv6_bgp_summary,
10912 show_ipv6_bgp_summary_cmd,
b05a1c8b 10913 "show ipv6 bgp summary {json}",
718e3744 10914 SHOW_STR
10915 IPV6_STR
10916 BGP_STR
b05a1c8b
DS
10917 "Summary of BGP neighbor status\n"
10918 "JavaScript Object Notation\n")
718e3744 10919{
db7c8528
DS
10920 u_char uj = use_json(argc, argv);
10921 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj);
718e3744 10922}
10923
10924/* old command */
10925DEFUN (show_ipv6_mbgp_summary,
10926 show_ipv6_mbgp_summary_cmd,
b05a1c8b 10927 "show ipv6 mbgp summary {json}",
718e3744 10928 SHOW_STR
10929 IPV6_STR
10930 MBGP_STR
b05a1c8b
DS
10931 "Summary of BGP neighbor status\n"
10932 "JavaScript Object Notation\n")
718e3744 10933{
db7c8528
DS
10934 u_char uj = use_json(argc, argv);
10935 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj);
718e3744 10936}
10937#endif /* HAVE_IPV6 */
6b0655a2 10938
fd79ac91 10939const char *
538621f2 10940afi_safi_print (afi_t afi, safi_t safi)
10941{
10942 if (afi == AFI_IP && safi == SAFI_UNICAST)
10943 return "IPv4 Unicast";
10944 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
10945 return "IPv4 Multicast";
10946 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
945c8fe9 10947 return "VPN-IPv4 Unicast";
8b1fb8be
LB
10948 else if (afi == AFI_IP && safi == SAFI_ENCAP)
10949 return "ENCAP-IPv4 Unicast";
538621f2 10950 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
10951 return "IPv6 Unicast";
10952 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
10953 return "IPv6 Multicast";
945c8fe9
LB
10954 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
10955 return "VPN-IPv6 Unicast";
8b1fb8be
LB
10956 else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
10957 return "ENCAP-IPv6 Unicast";
538621f2 10958 else
10959 return "Unknown";
10960}
10961
718e3744 10962/* Show BGP peer's information. */
10963enum show_type
10964{
10965 show_all,
10966 show_peer
10967};
10968
94f2b392 10969static void
856ca177
MS
10970bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, afi_t afi, safi_t safi,
10971 u_int16_t adv_smcap, u_int16_t adv_rmcap, u_int16_t rcv_smcap,
10972 u_int16_t rcv_rmcap, u_char use_json, json_object *json_pref)
718e3744 10973{
10974 /* Send-Mode */
10975 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
10976 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
10977 {
856ca177
MS
10978 if (use_json)
10979 {
10980 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
10981 json_object_string_add(json_pref, "sendMode", "advertisedAndReceived");
10982 else if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
10983 json_object_string_add(json_pref, "sendMode", "advertised");
10984 else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
10985 json_object_string_add(json_pref, "sendMode", "received");
10986 }
10987 else
10988 {
10989 vty_out (vty, " Send-mode: ");
10990 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
10991 vty_out (vty, "advertised");
10992 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
10993 vty_out (vty, "%sreceived",
10994 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
10995 ", " : "");
10996 vty_out (vty, "%s", VTY_NEWLINE);
10997 }
718e3744 10998 }
10999
11000 /* Receive-Mode */
11001 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
11002 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
11003 {
856ca177
MS
11004 if (use_json)
11005 {
11006 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
11007 json_object_string_add(json_pref, "recvMode", "advertisedAndReceived");
11008 else if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
11009 json_object_string_add(json_pref, "recvMode", "advertised");
11010 else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
11011 json_object_string_add(json_pref, "recvMode", "received");
11012 }
11013 else
11014 {
11015 vty_out (vty, " Receive-mode: ");
11016 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
11017 vty_out (vty, "advertised");
11018 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
11019 vty_out (vty, "%sreceived",
11020 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
11021 ", " : "");
11022 vty_out (vty, "%s", VTY_NEWLINE);
11023 }
718e3744 11024 }
11025}
11026
94f2b392 11027static void
856ca177
MS
11028bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi,
11029 u_char use_json, json_object *json_neigh)
718e3744 11030{
11031 struct bgp_filter *filter;
3f9c7369 11032 struct peer_af *paf;
718e3744 11033 char orf_pfx_name[BUFSIZ];
11034 int orf_pfx_count;
856ca177
MS
11035 json_object *json_af = NULL;
11036 json_object *json_prefA = NULL;
11037 json_object *json_prefB = NULL;
11038 json_object *json_addr = NULL;
718e3744 11039
856ca177
MS
11040 if (use_json)
11041 {
11042 json_addr = json_object_new_object();
11043 json_af = json_object_new_object();
11044 json_prefA = json_object_new_object();
11045 json_prefB = json_object_new_object();
11046 filter = &p->filter[afi][safi];
718e3744 11047
c8560b44 11048 if (peer_group_active(p))
856ca177 11049 json_object_string_add(json_addr, "peerGroupMember", p->group->name);
538621f2 11050
856ca177
MS
11051 paf = peer_af_find(p, afi, safi);
11052 if (paf && PAF_SUBGRP(paf))
11053 {
11054 json_object_int_add(json_addr, "updateGroupId", PAF_UPDGRP(paf)->id);
11055 json_object_int_add(json_addr, "subGroupId", PAF_SUBGRP(paf)->id);
11056 json_object_int_add(json_addr, "packetQueueLength", bpacket_queue_virtual_length(paf));
11057 }
11058
11059 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
11060 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
11061 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
11062 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
11063 {
11064 json_object_int_add(json_af, "orfType", ORF_TYPE_PREFIX);
11065 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
11066 PEER_CAP_ORF_PREFIX_SM_ADV,
11067 PEER_CAP_ORF_PREFIX_RM_ADV,
11068 PEER_CAP_ORF_PREFIX_SM_RCV,
11069 PEER_CAP_ORF_PREFIX_RM_RCV, use_json, json_prefA);
11070 json_object_object_add(json_af, "orfPrefixList", json_prefA);
11071 }
11072
11073 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
11074 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
11075 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
11076 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
11077 {
11078 json_object_int_add(json_af, "orfOldType", ORF_TYPE_PREFIX_OLD);
11079 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
11080 PEER_CAP_ORF_PREFIX_SM_ADV,
11081 PEER_CAP_ORF_PREFIX_RM_ADV,
11082 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
11083 PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, json_prefB);
11084 json_object_object_add(json_af, "orfOldPrefixList", json_prefB);
11085 }
11086
11087 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
11088 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
11089 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
11090 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
11091 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
11092 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
11093 json_object_object_add(json_addr, "afDependentCap", json_af);
11094
11095 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
11096 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json);
11097
11098 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
11099 || orf_pfx_count)
11100 {
11101 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
11102 json_object_boolean_true_add(json_neigh, "orfSent");
11103 if (orf_pfx_count)
11104 json_object_int_add(json_addr, "orfRecvCounter", orf_pfx_count);
11105 }
11106 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
11107 json_object_string_add(json_addr, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd");
11108
11109 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
11110 json_object_boolean_true_add(json_addr, "routeReflectorClient");
11111 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
11112 json_object_boolean_true_add(json_addr, "routeServerClient");
11113 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
11114 json_object_boolean_true_add(json_addr, "inboundSoftConfigPermit");
11115
88b8ed8d
DW
11116 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE))
11117 json_object_boolean_true_add(json_addr, "privateAsNumsAllReplacedInUpdatesToNbr");
11118 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE))
856ca177 11119 json_object_boolean_true_add(json_addr, "privateAsNumsReplacedInUpdatesToNbr");
88b8ed8d
DW
11120 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL))
11121 json_object_boolean_true_add(json_addr, "privateAsNumsAllRemovedInUpdatesToNbr");
856ca177
MS
11122 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
11123 json_object_boolean_true_add(json_addr, "privateAsNumsRemovedInUpdatesToNbr");
11124
adbac85e
DW
11125 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS))
11126 json_object_boolean_true_add(json_addr, "addpathTxAllPaths");
11127
06370dac
DW
11128 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS))
11129 json_object_boolean_true_add(json_addr, "addpathTxBestpathPerAS");
11130
856ca177
MS
11131 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE))
11132 json_object_string_add(json_addr, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs");
11133
11134 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) ||
11135 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF))
11136 json_object_boolean_true_add(json_addr, "routerAlwaysNextHop");
11137 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
11138 json_object_boolean_true_add(json_addr, "unchangedAsPathPropogatedToNbr");
11139 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
11140 json_object_boolean_true_add(json_addr, "unchangedNextHopPropogatedToNbr");
11141 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
11142 json_object_boolean_true_add(json_addr, "unchangedMedPropogatedToNbr");
718e3744 11143 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
856ca177
MS
11144 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11145 {
11146 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
11147 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11148 json_object_string_add(json_addr, "commAttriSentToNbr", "extendedAndStandard");
11149 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11150 json_object_string_add(json_addr, "commAttriSentToNbr", "extended");
11151 else
11152 json_object_string_add(json_addr, "commAttriSentToNbr", "standard");
11153 }
11154 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
11155 {
11156 if (p->default_rmap[afi][safi].name)
11157 json_object_string_add(json_addr, "defaultRouteMap", p->default_rmap[afi][safi].name);
11158
11159 if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE))
11160 json_object_boolean_true_add(json_addr, "defaultSent");
11161 else
11162 json_object_boolean_true_add(json_addr, "defaultNotSent");
11163 }
11164
11165 if (filter->plist[FILTER_IN].name
11166 || filter->dlist[FILTER_IN].name
11167 || filter->aslist[FILTER_IN].name
11168 || filter->map[RMAP_IN].name)
11169 json_object_boolean_true_add(json_addr, "inboundPathPolicyConfig");
11170 if (filter->plist[FILTER_OUT].name
11171 || filter->dlist[FILTER_OUT].name
11172 || filter->aslist[FILTER_OUT].name
11173 || filter->map[RMAP_OUT].name
11174 || filter->usmap.name)
11175 json_object_boolean_true_add(json_addr, "outboundPathPolicyConfig");
856ca177
MS
11176
11177 /* prefix-list */
11178 if (filter->plist[FILTER_IN].name)
11179 json_object_string_add(json_addr, "incomingUpdatePrefixFilterList", filter->plist[FILTER_IN].name);
11180 if (filter->plist[FILTER_OUT].name)
11181 json_object_string_add(json_addr, "outgoingUpdatePrefixFilterList", filter->plist[FILTER_OUT].name);
11182
11183 /* distribute-list */
11184 if (filter->dlist[FILTER_IN].name)
11185 json_object_string_add(json_addr, "incomingUpdateNetworkFilterList", filter->dlist[FILTER_IN].name);
11186 if (filter->dlist[FILTER_OUT].name)
11187 json_object_string_add(json_addr, "outgoingUpdateNetworkFilterList", filter->dlist[FILTER_OUT].name);
11188
11189 /* filter-list. */
11190 if (filter->aslist[FILTER_IN].name)
11191 json_object_string_add(json_addr, "incomingUpdateAsPathFilterList", filter->aslist[FILTER_IN].name);
11192 if (filter->aslist[FILTER_OUT].name)
11193 json_object_string_add(json_addr, "outgoingUpdateAsPathFilterList", filter->aslist[FILTER_OUT].name);
11194
11195 /* route-map. */
11196 if (filter->map[RMAP_IN].name)
11197 json_object_string_add(json_addr, "routeMapForIncomingAdvertisements", filter->map[RMAP_IN].name);
11198 if (filter->map[RMAP_OUT].name)
11199 json_object_string_add(json_addr, "routeMapForOutgoingAdvertisements", filter->map[RMAP_OUT].name);
856ca177
MS
11200
11201 /* unsuppress-map */
11202 if (filter->usmap.name)
11203 json_object_string_add(json_addr, "selectiveUnsuppressRouteMap", filter->usmap.name);
11204
11205 /* Receive prefix count */
11206 json_object_int_add(json_addr, "acceptedPrefixCounter", p->pcount[afi][safi]);
11207
11208 /* Maximum prefix */
11209 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
11210 {
11211 json_object_int_add(json_addr, "prefixAllowedMax", p->pmax[afi][safi]);
11212 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING))
11213 json_object_boolean_true_add(json_addr, "prefixAllowedMaxWarning");
11214 json_object_int_add(json_addr, "prefixAllowedWarningThresh", p->pmax_threshold[afi][safi]);
11215 if (p->pmax_restart[afi][safi])
11216 json_object_int_add(json_addr, "prefixAllowedRestartIntervalMsecs", p->pmax_restart[afi][safi] * 60000);
11217 }
11218 json_object_object_add(json_neigh, afi_safi_print (afi, safi), json_addr);
11219
11220 }
11221 else
11222 {
11223 filter = &p->filter[afi][safi];
11224
11225 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
11226 VTY_NEWLINE);
11227
c8560b44 11228 if (peer_group_active(p))
856ca177
MS
11229 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
11230
11231 paf = peer_af_find(p, afi, safi);
11232 if (paf && PAF_SUBGRP(paf))
11233 {
11234 vty_out (vty, " Update group %" PRIu64 ", subgroup %" PRIu64 "%s",
11235 PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE);
11236 vty_out (vty, " Packet Queue length %d%s",
11237 bpacket_queue_virtual_length(paf), VTY_NEWLINE);
11238 }
718e3744 11239 else
856ca177
MS
11240 {
11241 vty_out(vty, " Not part of any update group%s", VTY_NEWLINE);
11242 }
11243 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
11244 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
11245 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
11246 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
11247 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
11248 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
11249 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
11250
11251 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
11252 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
11253 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
11254 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
11255 {
11256 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
11257 ORF_TYPE_PREFIX, VTY_NEWLINE);
11258 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
11259 PEER_CAP_ORF_PREFIX_SM_ADV,
11260 PEER_CAP_ORF_PREFIX_RM_ADV,
11261 PEER_CAP_ORF_PREFIX_SM_RCV,
11262 PEER_CAP_ORF_PREFIX_RM_RCV, use_json, NULL);
11263 }
11264 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
11265 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
11266 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
11267 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
11268 {
11269 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
11270 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
11271 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
11272 PEER_CAP_ORF_PREFIX_SM_ADV,
11273 PEER_CAP_ORF_PREFIX_RM_ADV,
11274 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
11275 PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, NULL);
11276 }
718e3744 11277
856ca177
MS
11278 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
11279 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json);
718e3744 11280
856ca177
MS
11281 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
11282 || orf_pfx_count)
11283 {
11284 vty_out (vty, " Outbound Route Filter (ORF):");
11285 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
11286 vty_out (vty, " sent;");
11287 if (orf_pfx_count)
11288 vty_out (vty, " received (%d entries)", orf_pfx_count);
11289 vty_out (vty, "%s", VTY_NEWLINE);
11290 }
11291 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
11292 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
11293
11294 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
11295 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
11296 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
11297 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
11298 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
11299 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
11300
88b8ed8d
DW
11301 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE))
11302 vty_out (vty, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE);
11303 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE))
856ca177 11304 vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE);
88b8ed8d
DW
11305 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL))
11306 vty_out (vty, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE);
856ca177
MS
11307 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
11308 vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE);
11309
adbac85e
DW
11310 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS))
11311 vty_out (vty, " Advertise all paths via addpath%s", VTY_NEWLINE);
11312
06370dac
DW
11313 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS))
11314 vty_out (vty, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE);
11315
856ca177
MS
11316 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE))
11317 vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE);
11318
11319 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) ||
11320 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF))
11321 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
11322 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
11323 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
11324 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
11325 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
11326 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
11327 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
11328 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
11329 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11330 {
11331 vty_out (vty, " Community attribute sent to this neighbor");
11332 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
11333 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11334 vty_out (vty, "(both)%s", VTY_NEWLINE);
11335 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11336 vty_out (vty, "(extended)%s", VTY_NEWLINE);
11337 else
11338 vty_out (vty, "(standard)%s", VTY_NEWLINE);
11339 }
11340 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
11341 {
11342 vty_out (vty, " Default information originate,");
11343
11344 if (p->default_rmap[afi][safi].name)
11345 vty_out (vty, " default route-map %s%s,",
11346 p->default_rmap[afi][safi].map ? "*" : "",
11347 p->default_rmap[afi][safi].name);
11348 if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE))
11349 vty_out (vty, " default sent%s", VTY_NEWLINE);
11350 else
11351 vty_out (vty, " default not sent%s", VTY_NEWLINE);
11352 }
718e3744 11353
856ca177
MS
11354 if (filter->plist[FILTER_IN].name
11355 || filter->dlist[FILTER_IN].name
11356 || filter->aslist[FILTER_IN].name
11357 || filter->map[RMAP_IN].name)
11358 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
11359 if (filter->plist[FILTER_OUT].name
11360 || filter->dlist[FILTER_OUT].name
11361 || filter->aslist[FILTER_OUT].name
11362 || filter->map[RMAP_OUT].name
11363 || filter->usmap.name)
11364 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
856ca177
MS
11365
11366 /* prefix-list */
11367 if (filter->plist[FILTER_IN].name)
11368 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
11369 filter->plist[FILTER_IN].plist ? "*" : "",
11370 filter->plist[FILTER_IN].name,
11371 VTY_NEWLINE);
11372 if (filter->plist[FILTER_OUT].name)
11373 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
11374 filter->plist[FILTER_OUT].plist ? "*" : "",
11375 filter->plist[FILTER_OUT].name,
11376 VTY_NEWLINE);
11377
11378 /* distribute-list */
11379 if (filter->dlist[FILTER_IN].name)
11380 vty_out (vty, " Incoming update network filter list is %s%s%s",
11381 filter->dlist[FILTER_IN].alist ? "*" : "",
11382 filter->dlist[FILTER_IN].name,
11383 VTY_NEWLINE);
11384 if (filter->dlist[FILTER_OUT].name)
11385 vty_out (vty, " Outgoing update network filter list is %s%s%s",
11386 filter->dlist[FILTER_OUT].alist ? "*" : "",
11387 filter->dlist[FILTER_OUT].name,
11388 VTY_NEWLINE);
11389
11390 /* filter-list. */
11391 if (filter->aslist[FILTER_IN].name)
11392 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
11393 filter->aslist[FILTER_IN].aslist ? "*" : "",
11394 filter->aslist[FILTER_IN].name,
11395 VTY_NEWLINE);
11396 if (filter->aslist[FILTER_OUT].name)
11397 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
11398 filter->aslist[FILTER_OUT].aslist ? "*" : "",
11399 filter->aslist[FILTER_OUT].name,
11400 VTY_NEWLINE);
11401
11402 /* route-map. */
11403 if (filter->map[RMAP_IN].name)
11404 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
11405 filter->map[RMAP_IN].map ? "*" : "",
11406 filter->map[RMAP_IN].name,
11407 VTY_NEWLINE);
11408 if (filter->map[RMAP_OUT].name)
11409 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
11410 filter->map[RMAP_OUT].map ? "*" : "",
11411 filter->map[RMAP_OUT].name,
11412 VTY_NEWLINE);
856ca177
MS
11413
11414 /* unsuppress-map */
11415 if (filter->usmap.name)
11416 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
11417 filter->usmap.map ? "*" : "",
11418 filter->usmap.name, VTY_NEWLINE);
11419
11420 /* Receive prefix count */
11421 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
11422
11423 /* Maximum prefix */
11424 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
11425 {
11426 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
11427 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
11428 ? " (warning-only)" : "", VTY_NEWLINE);
11429 vty_out (vty, " Threshold for warning message %d%%",
11430 p->pmax_threshold[afi][safi]);
11431 if (p->pmax_restart[afi][safi])
11432 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
11433 vty_out (vty, "%s", VTY_NEWLINE);
11434 }
718e3744 11435
0a486e5f 11436 vty_out (vty, "%s", VTY_NEWLINE);
718e3744 11437 }
718e3744 11438}
11439
94f2b392 11440static void
e8f7da3a 11441bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *json)
718e3744 11442{
11443 struct bgp *bgp;
4690c7d7 11444 char buf1[PREFIX2STR_BUFFER], buf[SU_ADDRSTRLEN];
718e3744 11445 char timebuf[BGP_UPTIME_LEN];
f14e6fdb 11446 char dn_flag[2];
3a8c7ba1
DW
11447 const char *subcode_str;
11448 const char *code_str;
538621f2 11449 afi_t afi;
11450 safi_t safi;
d6661008
DS
11451 u_int16_t i;
11452 u_char *msg;
e8f7da3a 11453 json_object *json_neigh = NULL;
718e3744 11454
11455 bgp = p->bgp;
11456
e8f7da3a
DW
11457 if (use_json)
11458 json_neigh = json_object_new_object();
11459
856ca177 11460 if (!use_json)
f14e6fdb 11461 {
856ca177
MS
11462 if (p->conf_if) /* Configured interface name. */
11463 vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if,
11464 BGP_PEER_SU_UNSPEC(p) ? "None" :
11465 sockunion2str (&p->su, buf, SU_ADDRSTRLEN));
11466 else /* Configured IP address. */
11467 {
11468 memset(dn_flag, '\0', sizeof(dn_flag));
11469 if (peer_dynamic_neighbor(p))
11470 dn_flag[0] = '*';
f14e6fdb 11471
856ca177
MS
11472 vty_out (vty, "BGP neighbor is %s%s, ", dn_flag, p->host);
11473 }
f14e6fdb
DS
11474 }
11475
856ca177
MS
11476 if (use_json)
11477 {
11478 if (p->conf_if && BGP_PEER_SU_UNSPEC(p))
11479 json_object_string_add(json_neigh, "bgpNeighborAddr", "none");
11480 else if (p->conf_if && !BGP_PEER_SU_UNSPEC(p))
11481 json_object_string_add(json_neigh, "bgpNeighborAddr", sockunion2str (&p->su, buf, SU_ADDRSTRLEN));
11482
11483 json_object_int_add(json_neigh, "remoteAs", p->as);
11484
11485 if (p->change_local_as)
11486 json_object_int_add(json_neigh, "localAs", p->change_local_as);
11487 else
11488 json_object_int_add(json_neigh, "localAs", p->local_as);
11489
11490 if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND))
11491 json_object_boolean_true_add(json_neigh, "localAsNoPrepend");
66b199b2 11492
856ca177
MS
11493 if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS))
11494 json_object_boolean_true_add(json_neigh, "localAsReplaceAs");
11495 }
11496 else
11497 {
f8cfafda
DS
11498 if ((p->as_type == AS_SPECIFIED) ||
11499 (p->as_type == AS_EXTERNAL) ||
11500 (p->as_type == AS_INTERNAL))
11501 vty_out (vty, "remote AS %u, ", p->as);
11502 else
11503 vty_out (vty, "remote AS Unspecified, ");
856ca177
MS
11504 vty_out (vty, "local AS %u%s%s, ",
11505 p->change_local_as ? p->change_local_as : p->local_as,
11506 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
11507 " no-prepend" : "",
11508 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
11509 " replace-as" : "");
11510 }
66b199b2
DS
11511 /* peer type internal, external, confed-internal or confed-external */
11512 if (p->as == p->local_as)
11513 {
856ca177
MS
11514 if (use_json)
11515 {
11516 if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION))
11517 json_object_boolean_true_add(json_neigh, "nbrConfedInternalLink");
11518 else
11519 json_object_boolean_true_add(json_neigh, "nbrInternalLink");
11520 }
66b199b2 11521 else
856ca177
MS
11522 {
11523 if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION))
11524 vty_out (vty, "confed-internal link%s", VTY_NEWLINE);
11525 else
11526 vty_out (vty, "internal link%s", VTY_NEWLINE);
11527 }
66b199b2
DS
11528 }
11529 else
11530 {
856ca177
MS
11531 if (use_json)
11532 {
11533 if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION))
11534 json_object_boolean_true_add(json_neigh, "nbrConfedExternalLink");
11535 else
11536 json_object_boolean_true_add(json_neigh, "nbrExternalLink");
11537 }
66b199b2 11538 else
856ca177
MS
11539 {
11540 if (bgp_confederation_peers_check(bgp, p->as))
11541 vty_out (vty, "confed-external link%s", VTY_NEWLINE);
11542 else
11543 vty_out (vty, "external link%s", VTY_NEWLINE);
11544 }
66b199b2 11545 }
718e3744 11546
11547 /* Description. */
11548 if (p->desc)
856ca177
MS
11549 {
11550 if (use_json)
11551 json_object_string_add(json_neigh, "nbrDesc", p->desc);
11552 else
11553 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
11554 }
6410e93a 11555
04b6bdc0
DW
11556 if (p->hostname)
11557 {
d1570739
DW
11558 if (use_json)
11559 {
11560 if (p->hostname)
11561 json_object_string_add(json_neigh, "hostname", p->hostname);
11562
11563 if (p->domainname)
11564 json_object_string_add(json_neigh, "domainname", p->domainname);
11565 }
04b6bdc0 11566 else
d1570739
DW
11567 {
11568 if (p->domainname && (p->domainname[0] != '\0'))
11569 vty_out(vty, "Hostname: %s.%s%s", p->hostname, p->domainname,
11570 VTY_NEWLINE);
11571 else
11572 vty_out(vty, "Hostname: %s%s", p->hostname, VTY_NEWLINE);
11573 }
11574
04b6bdc0
DW
11575 }
11576
c744aa9f 11577 /* Peer-group */
718e3744 11578 if (p->group)
f14e6fdb 11579 {
856ca177
MS
11580 if (use_json)
11581 {
11582 json_object_string_add(json_neigh, "peerGroup", p->group->name);
11583
11584 if (dn_flag[0])
11585 {
40ee54a7 11586 struct prefix prefix, *range = NULL;
f14e6fdb 11587
40ee54a7
TT
11588 sockunion2hostprefix(&(p->su), &prefix);
11589 range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix);
856ca177
MS
11590
11591 if (range)
11592 {
11593 prefix2str(range, buf1, sizeof(buf1));
11594 json_object_string_add(json_neigh, "peerSubnetRangeGroup", buf1);
11595 }
11596 }
11597 }
11598 else
f14e6fdb 11599 {
856ca177
MS
11600 vty_out (vty, " Member of peer-group %s for session parameters%s",
11601 p->group->name, VTY_NEWLINE);
f14e6fdb 11602
856ca177 11603 if (dn_flag[0])
f14e6fdb 11604 {
40ee54a7 11605 struct prefix prefix, *range = NULL;
856ca177 11606
40ee54a7
TT
11607 sockunion2hostprefix(&(p->su), &prefix);
11608 range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix);
856ca177
MS
11609
11610 if (range)
11611 {
11612 prefix2str(range, buf1, sizeof(buf1));
11613 vty_out (vty, " Belongs to the subnet range group: %s%s", buf1, VTY_NEWLINE);
11614 }
f14e6fdb
DS
11615 }
11616 }
11617 }
718e3744 11618
856ca177
MS
11619 if (use_json)
11620 {
11621 /* Administrative shutdown. */
11622 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
11623 json_object_boolean_true_add(json_neigh, "adminShutDown");
718e3744 11624
856ca177
MS
11625 /* BGP Version. */
11626 json_object_int_add(json_neigh, "bgpVersion", 4);
11627 json_object_string_add(json_neigh, "remoteRouterId", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ));
718e3744 11628
856ca177
MS
11629 /* Confederation */
11630 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) && bgp_confederation_peers_check (bgp, p->as))
11631 json_object_boolean_true_add(json_neigh, "nbrCommonAdmin");
11632
11633 /* Status. */
11634 json_object_string_add(json_neigh, "bgpState", LOOKUP (bgp_status_msg, p->status));
11635
11636 if (p->status == Established)
11637 {
11638 time_t uptime;
11639 struct tm *tm;
11640
11641 uptime = bgp_clock();
11642 uptime -= p->uptime;
11643 tm = gmtime(&uptime);
11644
11645 json_object_int_add(json_neigh, "bgpTimerUp", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000));
11646 }
11647
11648 else if (p->status == Active)
11649 {
11650 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
11651 json_object_string_add(json_neigh, "bgpStateIs", "passive");
11652 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
11653 json_object_string_add(json_neigh, "bgpStateIs", "passiveNSF");
11654 }
11655
11656 /* read timer */
11657 time_t uptime;
11658 struct tm *tm;
11659
11660 uptime = bgp_clock();
11661 uptime -= p->readtime;
11662 tm = gmtime(&uptime);
11663 json_object_int_add(json_neigh, "bgpTimerLastRead", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000));
11664
11665 uptime = bgp_clock();
11666 uptime -= p->last_write;
11667 tm = gmtime(&uptime);
39e871e6
ST
11668 json_object_int_add(json_neigh, "bgpTimerLastWrite", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000));
11669
11670 uptime = bgp_clock();
11671 uptime -= p->update_time;
11672 tm = gmtime(&uptime);
11673 json_object_int_add(json_neigh, "bgpInUpdateElapsedTimeMsecs",
11674 (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000));
856ca177
MS
11675
11676 /* Configured timer values. */
11677 json_object_int_add(json_neigh, "bgpTimerHoldTimeMsecs", p->v_holdtime * 1000);
11678 json_object_int_add(json_neigh, "bgpTimerKeepAliveIntervalMsecs", p->v_keepalive * 1000);
11679
11680 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
11681 {
11682 json_object_int_add(json_neigh, "bgpTimerConfiguredHoldTimeMsecs", p->holdtime * 1000);
11683 json_object_int_add(json_neigh, "bgpTimerConfiguredKeepAliveIntervalMsecs", p->keepalive * 1000);
11684 }
93406d87 11685 }
856ca177
MS
11686 else
11687 {
11688 /* Administrative shutdown. */
11689 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
11690 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
11691
11692 /* BGP Version. */
11693 vty_out (vty, " BGP version 4");
11694 vty_out (vty, ", remote router ID %s%s", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
11695 VTY_NEWLINE);
11696
11697 /* Confederation */
11698 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
11699 && bgp_confederation_peers_check (bgp, p->as))
11700 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
718e3744 11701
856ca177
MS
11702 /* Status. */
11703 vty_out (vty, " BGP state = %s", LOOKUP (bgp_status_msg, p->status));
718e3744 11704
856ca177
MS
11705 if (p->status == Established)
11706 vty_out (vty, ", up for %8s", peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL));
11707
11708 else if (p->status == Active)
11709 {
11710 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
11711 vty_out (vty, " (passive)");
11712 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
11713 vty_out (vty, " (NSF passive)");
11714 }
11715 vty_out (vty, "%s", VTY_NEWLINE);
93406d87 11716
856ca177
MS
11717 /* read timer */
11718 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN, 0, NULL));
11719 vty_out (vty, ", Last write %s%s",
11720 peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN, 0, NULL), VTY_NEWLINE);
11721
11722 /* Configured timer values. */
11723 vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s",
11724 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
11725 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
11726 {
11727 vty_out (vty, " Configured hold time is %d", p->holdtime);
11728 vty_out (vty, ", keepalive interval is %d seconds%s",
11729 p->keepalive, VTY_NEWLINE);
11730 }
11731 }
718e3744 11732 /* Capability. */
11733 if (p->status == Established)
11734 {
538621f2 11735 if (p->cap
718e3744 11736 || p->afc_adv[AFI_IP][SAFI_UNICAST]
11737 || p->afc_recv[AFI_IP][SAFI_UNICAST]
11738 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
11739 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
11740#ifdef HAVE_IPV6
11741 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
11742 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
11743 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
11744 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
945c8fe9
LB
11745 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
11746 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
8b1fb8be
LB
11747 || p->afc_adv[AFI_IP6][SAFI_ENCAP]
11748 || p->afc_recv[AFI_IP6][SAFI_ENCAP]
718e3744 11749#endif /* HAVE_IPV6 */
8b1fb8be
LB
11750 || p->afc_adv[AFI_IP][SAFI_ENCAP]
11751 || p->afc_recv[AFI_IP][SAFI_ENCAP]
718e3744 11752 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
11753 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
11754 {
856ca177
MS
11755 if (use_json)
11756 {
11757 json_object *json_cap = NULL;
11758
11759 json_cap = json_object_new_object();
11760
11761 /* AS4 */
11762 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
11763 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
11764 {
11765 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) && CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
11766 json_object_string_add(json_cap, "4byteAs", "advertisedAndReceived");
11767 else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
11768 json_object_string_add(json_cap, "4byteAs", "advertised");
11769 else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
11770 json_object_string_add(json_cap, "4byteAs", "received");
11771 }
11772
11773 /* AddPath */
11774 if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV)
11775 || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV))
11776 {
11777 json_object *json_add = NULL;
11778 const char *print_store;
718e3744 11779
856ca177 11780 json_add = json_object_new_object();
a82478b9 11781
856ca177
MS
11782 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
11783 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
11784 {
11785 json_object *json_sub = NULL;
11786 json_sub = json_object_new_object();
11787 print_store = afi_safi_print (afi, safi);
11788
11789 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ||
11790 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV))
11791 {
11792 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) && CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV))
11793 json_object_boolean_true_add(json_sub, "txAdvertisedAndReceived");
11794 else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV))
11795 json_object_boolean_true_add(json_sub, "txAdvertised");
11796 else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV))
11797 json_object_boolean_true_add(json_sub, "txReceived");
11798 }
11799
11800 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ||
11801 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
11802 {
11803 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) && CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
11804 json_object_boolean_true_add(json_sub, "rxAdvertisedAndReceived");
11805 else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV))
11806 json_object_boolean_true_add(json_sub, "rxAdvertised");
11807 else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
11808 json_object_boolean_true_add(json_sub, "rxReceived");
11809 }
11810
11811 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ||
11812 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV) ||
11813 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ||
11814 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
11815 json_object_object_add(json_add, print_store, json_sub);
11816 }
a82478b9 11817
856ca177
MS
11818 json_object_object_add(json_cap, "addPath", json_add);
11819 }
11820
11821 /* Dynamic */
11822 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
11823 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
11824 {
11825 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) && CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
11826 json_object_string_add(json_cap, "dynamic", "advertisedAndReceived");
11827 else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
11828 json_object_string_add(json_cap, "dynamic", "advertised");
11829 else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
11830 json_object_string_add(json_cap, "dynamic", "received");
11831 }
11832
11833 /* Extended nexthop */
11834 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)
11835 || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV))
11836 {
11837 json_object *json_nxt = NULL;
11838 const char *print_store;
11839
11840 json_nxt = json_object_new_object();
11841
11842 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) && CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
11843 json_object_string_add(json_cap, "extendedNexthop", "advertisedAndReceived");
11844 else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV))
11845 json_object_string_add(json_cap, "extendedNexthop", "advertised");
11846 else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
11847 json_object_string_add(json_cap, "extendedNexthop", "received");
11848
11849 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
11850 {
11851 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
11852 {
11853 if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV))
11854 {
11855 print_store = afi_safi_print (AFI_IP, safi);
11856 json_object_string_add(json_nxt, print_store, "recieved");
11857 }
11858 }
11859 json_object_object_add(json_cap, "extendedNexthopFamililesByPeer", json_nxt);
11860 }
11861 }
11862
11863 /* Route Refresh */
11864 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
11865 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
11866 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
11867 {
11868 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) && (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)))
11869 {
11870 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV))
11871 json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOldNew");
11872 else
11873 {
11874 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
11875 json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOld");
11876 else
11877 json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedNew");
11878 }
11879 }
11880 else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
11881 json_object_string_add(json_cap, "routeRefresh", "advertised");
11882 else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
11883 json_object_string_add(json_cap, "routeRefresh", "received");
11884 }
11885
11886 /* Multiprotocol Extensions */
11887 json_object *json_multi = NULL;
11888 json_multi = json_object_new_object();
11889
11890 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
11891 {
11892 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
11893 {
11894 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
11895 {
11896 json_object *json_exten = NULL;
11897 json_exten = json_object_new_object();
11898
11899 if (p->afc_adv[afi][safi] && p->afc_recv[afi][safi])
11900 json_object_boolean_true_add(json_exten, "advertisedAndReceived");
11901 else if (p->afc_adv[afi][safi])
11902 json_object_boolean_true_add(json_exten, "advertised");
11903 else if (p->afc_recv[afi][safi])
11904 json_object_boolean_true_add(json_exten, "received");
11905
11906 json_object_object_add(json_multi, afi_safi_print (afi, safi), json_exten);
11907 }
11908 }
11909 }
11910 json_object_object_add(json_cap, "multiprotocolExtensions", json_multi);
11911
11912 /* Gracefull Restart */
11913 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
11914 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
11915 {
11916 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) && CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
11917 json_object_string_add(json_cap, "gracefulRestart", "advertisedAndReceived");
11918 else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
11919 json_object_string_add(json_cap, "gracefulRestartCapability", "advertised");
11920 else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
11921 json_object_string_add(json_cap, "gracefulRestartCapability", "received");
11922
11923 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
11924 {
11925 int restart_af_count = 0;
11926 json_object *json_restart = NULL;
11927 json_restart = json_object_new_object();
11928
11929 json_object_int_add(json_cap, "gracefulRestartRemoteTimerMsecs", p->v_gr_restart * 1000);
11930
11931 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
11932 {
11933 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
11934 {
11935 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
11936 {
11937 json_object *json_sub = NULL;
11938 json_sub = json_object_new_object();
11939
11940 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV))
11941 json_object_boolean_true_add(json_sub, "preserved");
11942 restart_af_count++;
11943 json_object_object_add(json_restart, afi_safi_print (afi, safi), json_sub);
11944 }
11945 }
11946 }
11947 if (! restart_af_count)
11948 json_object_string_add(json_cap, "addressFamiliesByPeer", "none");
11949 else
11950 json_object_object_add(json_cap, "addressFamiliesByPeer", json_restart);
11951 }
11952 }
11953 json_object_object_add(json_neigh, "neighborCapabilities", json_cap);
11954 }
11955 else
11956 {
11957 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
11958
11959 /* AS4 */
11960 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
11961 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
11962 {
11963 vty_out (vty, " 4 Byte AS:");
11964 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
11965 vty_out (vty, " advertised");
11966 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
11967 vty_out (vty, " %sreceived",
11968 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
11969 vty_out (vty, "%s", VTY_NEWLINE);
11970 }
11971
11972 /* AddPath */
11973 if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV)
11974 || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV))
11975 {
11976 vty_out (vty, " AddPath:%s", VTY_NEWLINE);
a82478b9 11977
856ca177
MS
11978 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
11979 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
a82478b9 11980 {
856ca177
MS
11981 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ||
11982 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV))
11983 {
11984 vty_out (vty, " %s: TX ", afi_safi_print (afi, safi));
a82478b9 11985
856ca177
MS
11986 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV))
11987 vty_out (vty, "advertised %s", afi_safi_print (afi, safi));
a82478b9 11988
856ca177
MS
11989 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV))
11990 vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" );
a82478b9 11991
856ca177
MS
11992 vty_out (vty, "%s", VTY_NEWLINE);
11993 }
a82478b9 11994
856ca177 11995 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ||
a82478b9 11996 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
856ca177
MS
11997 {
11998 vty_out (vty, " %s: RX ", afi_safi_print (afi, safi));
a82478b9 11999
856ca177
MS
12000 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV))
12001 vty_out (vty, "advertised %s", afi_safi_print (afi, safi));
a82478b9 12002
856ca177
MS
12003 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
12004 vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" );
a82478b9 12005
856ca177
MS
12006 vty_out (vty, "%s", VTY_NEWLINE);
12007 }
a82478b9 12008 }
856ca177 12009 }
a82478b9 12010
856ca177
MS
12011 /* Dynamic */
12012 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
12013 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
12014 {
12015 vty_out (vty, " Dynamic:");
12016 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
12017 vty_out (vty, " advertised");
12018 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
12019 vty_out (vty, " %sreceived",
12020 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
12021 vty_out (vty, "%s", VTY_NEWLINE);
12022 }
12023
12024 /* Extended nexthop */
12025 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)
12026 || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV))
12027 {
12028 vty_out (vty, " Extended nexthop:");
12029 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV))
12030 vty_out (vty, " advertised");
12031 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
12032 vty_out (vty, " %sreceived",
12033 CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) ? "and " : "");
12034 vty_out (vty, "%s", VTY_NEWLINE);
718e3744 12035
856ca177
MS
12036 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
12037 {
12038 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
12039 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12040 if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV))
12041 vty_out (vty, " %s%s",
12042 afi_safi_print (AFI_IP, safi), VTY_NEWLINE);
12043 }
12044 }
8a92a8a0 12045
856ca177
MS
12046 /* Route Refresh */
12047 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
12048 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
12049 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
12050 {
12051 vty_out (vty, " Route refresh:");
12052 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
12053 vty_out (vty, " advertised");
12054 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
12055 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
12056 vty_out (vty, " %sreceived(%s)",
12057 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
12058 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
12059 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
12060 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
8a92a8a0 12061
856ca177
MS
12062 vty_out (vty, "%s", VTY_NEWLINE);
12063 }
718e3744 12064
856ca177
MS
12065 /* Multiprotocol Extensions */
12066 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12067 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12068 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
12069 {
12070 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
12071 if (p->afc_adv[afi][safi])
12072 vty_out (vty, " advertised");
12073 if (p->afc_recv[afi][safi])
12074 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
12075 vty_out (vty, "%s", VTY_NEWLINE);
12076 }
538621f2 12077
04b6bdc0
DW
12078 /* Hostname capability */
12079 if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV) ||
12080 CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV))
12081 {
12082 vty_out (vty, " Hostname Capability:");
12083 if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV))
12084 vty_out (vty, " advertised");
12085 if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_RCV))
12086 vty_out (vty, " %sreceived",
12087 CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV) ? "and " : "");
12088 vty_out (vty, "%s", VTY_NEWLINE);
12089 }
12090
856ca177
MS
12091 /* Gracefull Restart */
12092 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
12093 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
12094 {
12095 vty_out (vty, " Graceful Restart Capabilty:");
12096 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
538621f2 12097 vty_out (vty, " advertised");
856ca177
MS
12098 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
12099 vty_out (vty, " %sreceived",
12100 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
12101 vty_out (vty, "%s", VTY_NEWLINE);
538621f2 12102
856ca177
MS
12103 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
12104 {
12105 int restart_af_count = 0;
12106
12107 vty_out (vty, " Remote Restart timer is %d seconds%s",
12108 p->v_gr_restart, VTY_NEWLINE);
12109 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
12110
12111 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12112 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12113 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
12114 {
12115 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
12116 afi_safi_print (afi, safi),
12117 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
12118 "preserved" : "not preserved");
12119 restart_af_count++;
12120 }
12121 if (! restart_af_count)
12122 vty_out (vty, "none");
12123 vty_out (vty, "%s", VTY_NEWLINE);
12124 }
12125 }
12126 }
718e3744 12127 }
12128 }
12129
93406d87 12130 /* graceful restart information */
12131 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
12132 || p->t_gr_restart
12133 || p->t_gr_stale)
12134 {
856ca177
MS
12135 json_object *json_grace = NULL;
12136 json_object *json_grace_send = NULL;
12137 json_object *json_grace_recv = NULL;
93406d87 12138 int eor_send_af_count = 0;
12139 int eor_receive_af_count = 0;
12140
856ca177
MS
12141 if (use_json)
12142 {
12143 json_grace = json_object_new_object();
12144 json_grace_send = json_object_new_object();
12145 json_grace_recv = json_object_new_object();
12146
12147 if (p->status == Established)
12148 {
12149 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12150 {
12151 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12152 {
12153 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
12154 {
12155 json_object_boolean_true_add(json_grace_send, afi_safi_print (afi, safi));
12156 eor_send_af_count++;
12157 }
12158 }
12159 }
12160 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12161 {
12162 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12163 {
12164 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
12165 {
12166 json_object_boolean_true_add(json_grace_recv, afi_safi_print (afi, safi));
12167 eor_receive_af_count++;
12168 }
12169 }
12170 }
12171 }
12172
12173 json_object_object_add(json_grace, "endOfRibSend", json_grace_send);
12174 json_object_object_add(json_grace, "endOfRibRecv", json_grace_recv);
12175
12176 if (p->t_gr_restart)
12177 json_object_int_add(json_grace, "gracefulRestartTimerMsecs", thread_timer_remain_second (p->t_gr_restart) * 1000);
12178
12179 if (p->t_gr_stale)
12180 json_object_int_add(json_grace, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p->t_gr_stale) * 1000);
12181
12182 json_object_object_add(json_neigh, "gracefulRestartInfo", json_grace);
12183 }
12184 else
12185 {
12186 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
12187 if (p->status == Established)
12188 {
12189 vty_out (vty, " End-of-RIB send: ");
12190 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12191 {
12192 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12193 {
12194 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
12195 {
12196 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
12197 afi_safi_print (afi, safi));
12198 eor_send_af_count++;
12199 }
12200 }
12201 }
12202 vty_out (vty, "%s", VTY_NEWLINE);
12203 vty_out (vty, " End-of-RIB received: ");
12204 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12205 {
12206 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12207 {
12208 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
12209 {
12210 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
12211 afi_safi_print (afi, safi));
12212 eor_receive_af_count++;
12213 }
12214 }
12215 }
12216 vty_out (vty, "%s", VTY_NEWLINE);
12217 }
93406d87 12218
856ca177
MS
12219 if (p->t_gr_restart)
12220 vty_out (vty, " The remaining time of restart timer is %ld%s",
12221 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
0b2aa3a0 12222
856ca177
MS
12223 if (p->t_gr_stale)
12224 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
12225 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
12226 }
12227 }
12228 if (use_json)
12229 {
12230 json_object *json_stat = NULL;
12231 json_stat = json_object_new_object();
12232 /* Packet counts. */
12233 json_object_int_add(json_stat, "depthInq", 0);
12234 json_object_int_add(json_stat, "depthOutq", (unsigned long) p->obuf->count);
12235 json_object_int_add(json_stat, "opensSent", p->open_out);
12236 json_object_int_add(json_stat, "opensRecv", p->open_in);
12237 json_object_int_add(json_stat, "notificationsSent", p->notify_out);
12238 json_object_int_add(json_stat, "notificationsRecv", p->notify_in);
12239 json_object_int_add(json_stat, "updatesSent", p->update_out);
12240 json_object_int_add(json_stat, "updatesRecv", p->update_in);
12241 json_object_int_add(json_stat, "keepalivesSent", p->keepalive_out);
12242 json_object_int_add(json_stat, "keepalivesRecv", p->keepalive_in);
12243 json_object_int_add(json_stat, "routeRefreshSent", p->refresh_out);
12244 json_object_int_add(json_stat, "routeRefreshRecv", p->refresh_in);
12245 json_object_int_add(json_stat, "capabilitySent", p->dynamic_cap_out);
12246 json_object_int_add(json_stat, "capabilityRecv", p->dynamic_cap_in);
12247 json_object_int_add(json_stat, "totalSent", p->open_out + p->notify_out + p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out);
12248 json_object_int_add(json_stat, "totalRecv", p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + p->dynamic_cap_in);
12249 json_object_object_add(json_neigh, "messageStats", json_stat);
12250 }
12251 else
12252 {
12253 /* Packet counts. */
12254 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
12255 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
12256 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
12257 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
12258 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
12259 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
12260 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
12261 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
12262 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
12263 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
12264 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
12265 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
12266 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
12267 p->dynamic_cap_in, VTY_NEWLINE);
718e3744 12268 }
12269
856ca177
MS
12270 if (use_json)
12271 {
12272 /* advertisement-interval */
12273 json_object_int_add(json_neigh, "minBtwnAdvertisementRunsTimerMsecs", p->v_routeadv * 1000);
718e3744 12274
856ca177
MS
12275 /* Update-source. */
12276 if (p->update_if || p->update_source)
12277 {
12278 if (p->update_if)
12279 json_object_string_add(json_neigh, "updateSource", p->update_if);
12280 else if (p->update_source)
12281 json_object_string_add(json_neigh, "updateSource", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
12282 }
12283
12284 /* Default weight */
12285 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
12286 json_object_int_add(json_neigh, "defaultWeight", p->weight);
12287
12288 }
12289 else
12290 {
12291 /* advertisement-interval */
12292 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
12293 p->v_routeadv, VTY_NEWLINE);
12294
12295 /* Update-source. */
12296 if (p->update_if || p->update_source)
12297 {
12298 vty_out (vty, " Update source is ");
12299 if (p->update_if)
12300 vty_out (vty, "%s", p->update_if);
12301 else if (p->update_source)
12302 vty_out (vty, "%s", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
12303 vty_out (vty, "%s", VTY_NEWLINE);
12304 }
12305
12306 /* Default weight */
12307 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
12308 vty_out (vty, " Default weight %d%s", p->weight, VTY_NEWLINE);
12309
12310 vty_out (vty, "%s", VTY_NEWLINE);
12311 }
718e3744 12312
12313 /* Address Family Information */
856ca177
MS
12314 json_object *json_hold = NULL;
12315
12316 if (use_json)
12317 json_hold = json_object_new_object();
12318
538621f2 12319 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12320 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12321 if (p->afc[afi][safi])
856ca177 12322 bgp_show_peer_afi (vty, p, afi, safi, use_json, json_hold);
718e3744 12323
856ca177
MS
12324 if (use_json)
12325 {
12326 json_object_int_add(json_hold, "connectionsEstablished", p->established);
12327 json_object_int_add(json_hold, "connectionsDropped", p->dropped);
12328 }
12329 else
12330 vty_out (vty, " Connections established %d; dropped %d%s", p->established, p->dropped,
12331 VTY_NEWLINE);
718e3744 12332
d6661008 12333 if (! p->last_reset)
856ca177
MS
12334 {
12335 if (use_json)
12336 json_object_string_add(json_hold, "lastReset", "never");
12337 else
12338 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
12339 }
e0701b79 12340 else
d6661008 12341 {
856ca177
MS
12342 if (use_json)
12343 {
12344 time_t uptime;
12345 struct tm *tm;
12346
12347 uptime = bgp_clock();
12348 uptime -= p->resettime;
12349 tm = gmtime(&uptime);
12350 json_object_int_add(json_hold, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000));
12351 json_object_string_add(json_hold, "lastResetDueTo", peer_down_str[(int) p->last_reset]);
12352 if (p->last_reset_cause_size)
12353 {
39e871e6
ST
12354 char errorcodesubcode_hexstr[5];
12355 sprintf(errorcodesubcode_hexstr, "%02X%02X", p->notify.code, p->notify.subcode);
12356 json_object_string_add(json_hold, "lastErrorCodeSubcode", errorcodesubcode_hexstr);
856ca177
MS
12357 }
12358 }
12359 else
d6661008 12360 {
3a8c7ba1
DW
12361 vty_out (vty, " Last reset %s, ",
12362 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN, 0, NULL));
12363
12364 if (p->last_reset == PEER_DOWN_NOTIFY_SEND ||
12365 p->last_reset == PEER_DOWN_NOTIFY_RECEIVED)
12366 {
12367 code_str = bgp_notify_code_str(p->notify.code);
12368 subcode_str = bgp_notify_subcode_str(p->notify.code, p->notify.subcode);
12369 vty_out (vty, "due to NOTIFICATION %s (%s%s)%s",
12370 p->last_reset == PEER_DOWN_NOTIFY_SEND ? "sent" : "received",
12371 code_str, subcode_str, VTY_NEWLINE);
12372 }
12373 else
12374 {
12375 vty_out (vty, "due to %s%s",
12376 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
12377 }
856ca177
MS
12378
12379 if (p->last_reset_cause_size)
d6661008 12380 {
856ca177
MS
12381 msg = p->last_reset_cause;
12382 vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE);
12383 for (i = 1; i <= p->last_reset_cause_size; i++)
12384 {
12385 vty_out(vty, "%02X", *msg++);
d6661008 12386
856ca177
MS
12387 if (i != p->last_reset_cause_size)
12388 {
12389 if (i % 16 == 0)
12390 {
12391 vty_out(vty, "%s ", VTY_NEWLINE);
12392 }
12393 else if (i % 4 == 0)
12394 {
12395 vty_out(vty, " ");
12396 }
12397 }
12398 }
12399 vty_out(vty, "%s", VTY_NEWLINE);
d6661008 12400 }
d6661008
DS
12401 }
12402 }
848973c7 12403
718e3744 12404 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
12405 {
856ca177
MS
12406 if (use_json)
12407 json_object_boolean_true_add(json_hold, "prefixesConfigExceedMax");
12408 else
12409 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
0a486e5f 12410
12411 if (p->t_pmax_restart)
856ca177
MS
12412 {
12413 if (use_json)
12414 {
e8f7da3a 12415 json_object_boolean_true_add(json_hold, "reducePrefixNumFrom");
856ca177
MS
12416 json_object_int_add(json_hold, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000);
12417 }
12418 else
12419 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
12420 p->host, thread_timer_remain_second (p->t_pmax_restart),
12421 VTY_NEWLINE);
12422 }
0a486e5f 12423 else
856ca177
MS
12424 {
12425 if (use_json)
e8f7da3a 12426 json_object_boolean_true_add(json_hold, "reducePrefixNumAndClearIpBgp");
856ca177
MS
12427 else
12428 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
12429 p->host, VTY_NEWLINE);
12430 }
718e3744 12431 }
12432
856ca177
MS
12433 if (use_json)
12434 json_object_object_add(json_neigh, "addressFamilyInfo", json_hold);
12435
f5a4827d 12436 /* EBGP Multihop and GTSM */
6d85b15b 12437 if (p->sort != BGP_PEER_IBGP)
f5a4827d 12438 {
856ca177
MS
12439 if (use_json)
12440 {
12441 if (p->gtsm_hops > 0)
12442 json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->gtsm_hops);
12443 else if (p->ttl > 1)
12444 json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->ttl);
12445 }
12446 else
12447 {
12448 if (p->gtsm_hops > 0)
12449 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
12450 p->gtsm_hops, VTY_NEWLINE);
12451 else if (p->ttl > 1)
12452 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
12453 p->ttl, VTY_NEWLINE);
12454 }
f5a4827d 12455 }
5d804b43
PM
12456 else
12457 {
12458 if (p->gtsm_hops > 0)
856ca177
MS
12459 {
12460 if (use_json)
12461 json_object_int_add(json_neigh, "internalBgpNbrMaxHopsAway", p->gtsm_hops);
12462 else
12463 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
12464 p->gtsm_hops, VTY_NEWLINE);
12465 }
5d804b43 12466 }
718e3744 12467
12468 /* Local address. */
12469 if (p->su_local)
12470 {
856ca177
MS
12471 if (use_json)
12472 {
12473 json_object_string_add(json_neigh, "hostLocal", sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN));
12474 json_object_int_add(json_neigh, "portLocal", ntohs (p->su_local->sin.sin_port));
12475 }
12476 else
12477 vty_out (vty, "Local host: %s, Local port: %d%s",
12478 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
12479 ntohs (p->su_local->sin.sin_port),
12480 VTY_NEWLINE);
718e3744 12481 }
12482
12483 /* Remote address. */
12484 if (p->su_remote)
12485 {
856ca177
MS
12486 if (use_json)
12487 {
12488 json_object_string_add(json_neigh, "hostForeign", sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN));
12489 json_object_int_add(json_neigh, "portForeign", ntohs (p->su_remote->sin.sin_port));
12490 }
12491 else
12492 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
718e3744 12493 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
12494 ntohs (p->su_remote->sin.sin_port),
12495 VTY_NEWLINE);
12496 }
12497
12498 /* Nexthop display. */
12499 if (p->su_local)
12500 {
856ca177
MS
12501 if (use_json)
12502 {
12503 json_object_string_add(json_neigh, "nexthop", inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ));
718e3744 12504#ifdef HAVE_IPV6
856ca177
MS
12505 json_object_string_add(json_neigh, "nexthopGlobal", inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ));
12506 json_object_string_add(json_neigh, "nexthopLocal", inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ));
12507 if (p->shared_network)
12508 json_object_string_add(json_neigh, "bgpConnection", "sharedNetwork");
12509 else
12510 json_object_string_add(json_neigh, "bgpConnection", "nonSharedNetwork");
12511#endif /* HAVE_IPV6 */
12512 }
12513 else
12514 {
12515 vty_out (vty, "Nexthop: %s%s",
12516 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
12517 VTY_NEWLINE);
12518#ifdef HAVE_IPV6
12519 vty_out (vty, "Nexthop global: %s%s",
12520 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
12521 VTY_NEWLINE);
12522 vty_out (vty, "Nexthop local: %s%s",
12523 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
12524 VTY_NEWLINE);
12525 vty_out (vty, "BGP connection: %s%s",
12526 p->shared_network ? "shared network" : "non shared network",
12527 VTY_NEWLINE);
718e3744 12528#endif /* HAVE_IPV6 */
856ca177 12529 }
718e3744 12530 }
12531
12532 /* Timer information. */
856ca177
MS
12533 if (use_json)
12534 {
39e871e6 12535 json_object_int_add(json_neigh, "connectRetryTimer", p->v_connect);
dd9275d6
ST
12536 if (p->status == Established && p->rtt)
12537 json_object_int_add(json_neigh, "estimatedRttInMsecs", p->rtt);
856ca177
MS
12538 if (p->t_start)
12539 json_object_int_add(json_neigh, "nextStartTimerDueInMsecs", thread_timer_remain_second (p->t_start) * 1000);
12540 if (p->t_connect)
12541 json_object_int_add(json_neigh, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p->t_connect) * 1000);
12542 if (p->t_routeadv)
12543 {
12544 json_object_int_add(json_neigh, "mraiInterval", p->v_routeadv);
12545 json_object_int_add(json_neigh, "mraiTimerExpireInMsecs", thread_timer_remain_second (p->t_routeadv) * 1000);
12546 }
cb1faec9 12547
856ca177
MS
12548 if (p->t_read)
12549 json_object_string_add(json_neigh, "readThread", "on");
12550 else
12551 json_object_string_add(json_neigh, "readThread", "off");
12552 if (p->t_write)
12553 json_object_string_add(json_neigh, "writeThread", "on");
12554 else
12555 json_object_string_add(json_neigh, "writeThread", "off");
12556 }
12557 else
12558 {
39e871e6
ST
12559 vty_out (vty, "BGP Connect Retry Timer in Seconds: %d%s",
12560 p->v_connect, VTY_NEWLINE);
dd9275d6
ST
12561 if (p->status == Established && p->rtt)
12562 vty_out (vty, "Estimated round trip time: %d ms%s",
12563 p->rtt, VTY_NEWLINE);
856ca177
MS
12564 if (p->t_start)
12565 vty_out (vty, "Next start timer due in %ld seconds%s",
12566 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
12567 if (p->t_connect)
12568 vty_out (vty, "Next connect timer due in %ld seconds%s",
12569 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
12570 if (p->t_routeadv)
12571 vty_out (vty, "MRAI (interval %u) timer expires in %ld seconds%s",
12572 p->v_routeadv, thread_timer_remain_second (p->t_routeadv),
12573 VTY_NEWLINE);
12574
12575 vty_out (vty, "Read thread: %s Write thread: %s%s",
12576 p->t_read ? "on" : "off",
12577 p->t_write ? "on" : "off",
12578 VTY_NEWLINE);
12579 }
718e3744 12580
12581 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
12582 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
856ca177
MS
12583 bgp_capability_vty_out (vty, p, use_json, json_neigh);
12584
12585 if (!use_json)
12586 vty_out (vty, "%s", VTY_NEWLINE);
c43ed2e4
DS
12587
12588 /* BFD information. */
856ca177
MS
12589 bgp_bfd_show_info(vty, p, use_json, json_neigh);
12590
12591 if (use_json)
12592 {
12593 if (p->conf_if) /* Configured interface name. */
12594 json_object_object_add(json, p->conf_if, json_neigh);
12595 else /* Configured IP address. */
12596 json_object_object_add(json, p->host, json_neigh);
12597 }
718e3744 12598}
12599
94f2b392 12600static int
856ca177
MS
12601bgp_show_neighbor (struct vty *vty, struct bgp *bgp, enum show_type type,
12602 union sockunion *su, const char *conf_if, u_char use_json, json_object *json)
718e3744 12603{
1eb8ef25 12604 struct listnode *node, *nnode;
718e3744 12605 struct peer *peer;
12606 int find = 0;
12607
1eb8ef25 12608 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
718e3744 12609 {
1ff9a340
DS
12610 if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
12611 continue;
12612
718e3744 12613 switch (type)
856ca177
MS
12614 {
12615 case show_all:
e8f7da3a 12616 bgp_show_peer (vty, peer, use_json, json);
856ca177
MS
12617 break;
12618 case show_peer:
12619 if (conf_if)
12620 {
4873b3b9
DW
12621 if ((peer->conf_if && !strcmp(peer->conf_if, conf_if)) ||
12622 (peer->hostname && !strcmp(peer->hostname, conf_if)))
856ca177
MS
12623 {
12624 find = 1;
e8f7da3a 12625 bgp_show_peer (vty, peer, use_json, json);
856ca177
MS
12626 }
12627 }
12628 else
12629 {
12630 if (sockunion_same (&peer->su, su))
12631 {
12632 find = 1;
e8f7da3a 12633 bgp_show_peer (vty, peer, use_json, json);
856ca177
MS
12634 }
12635 }
12636 break;
718e3744 12637 }
12638 }
12639
12640 if (type == show_peer && ! find)
856ca177
MS
12641 {
12642 if (use_json)
12643 json_object_boolean_true_add(json, "bgpNoSuchNeighbor");
12644 else
12645 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
12646 }
12647
12648 if (use_json)
12649 {
12650 vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
12651 json_object_free(json);
12652 }
12653 else
12654 {
12655 vty_out (vty, "%s", VTY_NEWLINE);
12656 }
12657
718e3744 12658 return CMD_SUCCESS;
12659}
12660
94f2b392 12661static int
fd79ac91 12662bgp_show_neighbor_vty (struct vty *vty, const char *name,
9f689658
DD
12663 enum show_type type, const char *ip_str, u_char use_json,
12664 json_object *json)
718e3744 12665{
12666 int ret;
12667 struct bgp *bgp;
12668 union sockunion su;
856ca177 12669
9f689658 12670 if (use_json && (json == NULL))
856ca177 12671 json = json_object_new_object();
718e3744 12672
718e3744 12673 if (name)
12674 {
12675 bgp = bgp_lookup_by_name (name);
718e3744 12676 if (! bgp)
12677 {
856ca177
MS
12678 if (use_json)
12679 {
12680 json_object_boolean_true_add(json, "bgpNoSuchInstance");
12681 vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
12682 json_object_free(json);
12683 }
12684 else
12685 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
12686
718e3744 12687 return CMD_WARNING;
12688 }
718e3744 12689 }
a80beece
DS
12690 else
12691 {
12692 bgp = bgp_get_default ();
12693 }
718e3744 12694
12695 if (bgp)
a80beece
DS
12696 {
12697 if (ip_str)
12698 {
12699 ret = str2sockunion (ip_str, &su);
12700 if (ret < 0)
856ca177 12701 bgp_show_neighbor (vty, bgp, type, NULL, ip_str, use_json, json);
a80beece 12702 else
856ca177 12703 bgp_show_neighbor (vty, bgp, type, &su, NULL, use_json, json);
a80beece
DS
12704 }
12705 else
12706 {
856ca177 12707 bgp_show_neighbor (vty, bgp, type, NULL, NULL, use_json, json);
a80beece
DS
12708 }
12709 }
718e3744 12710
12711 return CMD_SUCCESS;
12712}
12713
f186de26 12714static void
12715bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json)
12716{
12717 struct listnode *node, *nnode;
12718 struct bgp *bgp;
12719 json_object *json = NULL;
9f689658
DD
12720 int is_first = 1;
12721
12722 if (use_json)
12723 vty_out (vty, "{%s", VTY_NEWLINE);
f186de26 12724
12725 for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
12726 {
f186de26 12727 if (use_json)
9f689658
DD
12728 {
12729 if (!(json = json_object_new_object()))
12730 {
12731 zlog_err("Unable to allocate memory for JSON object");
12732 vty_out (vty,
12733 "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s",
12734 VTY_NEWLINE);
12735 return;
12736 }
12737
12738 json_object_int_add(json, "vrfId",
12739 (bgp->vrf_id == VRF_UNKNOWN)
12740 ? -1 : bgp->vrf_id);
12741 json_object_string_add(json, "vrfName",
12742 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
12743 ? "Default" : bgp->name);
12744
12745 if (! is_first)
12746 vty_out (vty, ",%s", VTY_NEWLINE);
12747 else
12748 is_first = 0;
12749
12750 vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
12751 ? "Default" : bgp->name);
12752 }
12753 else
12754 {
12755 vty_out (vty, "%sInstance %s:%s",
12756 VTY_NEWLINE,
12757 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
12758 ? "Default" : bgp->name,
12759 VTY_NEWLINE);
12760 }
f186de26 12761 bgp_show_neighbor (vty, bgp, show_all, NULL, NULL, use_json, json);
12762 }
9f689658
DD
12763
12764 if (use_json)
12765 vty_out (vty, "}%s", VTY_NEWLINE);
f186de26 12766}
12767
718e3744 12768/* "show ip bgp neighbors" commands. */
12769DEFUN (show_ip_bgp_neighbors,
12770 show_ip_bgp_neighbors_cmd,
856ca177 12771 "show ip bgp neighbors {json}",
718e3744 12772 SHOW_STR
12773 IP_STR
12774 BGP_STR
856ca177
MS
12775 "Detailed information on TCP and BGP neighbor connections\n"
12776 "JavaScript Object Notation\n")
718e3744 12777{
db7c8528 12778 u_char uj = use_json(argc, argv);
856ca177 12779
9f689658 12780 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL, uj, NULL);
718e3744 12781}
12782
12783ALIAS (show_ip_bgp_neighbors,
12784 show_ip_bgp_ipv4_neighbors_cmd,
856ca177 12785 "show ip bgp ipv4 (unicast|multicast) neighbors {json}",
718e3744 12786 SHOW_STR
12787 IP_STR
12788 BGP_STR
12789 "Address family\n"
12790 "Address Family modifier\n"
12791 "Address Family modifier\n"
856ca177
MS
12792 "Detailed information on TCP and BGP neighbor connections\n"
12793 "JavaScript Object Notation\n")
718e3744 12794
12795ALIAS (show_ip_bgp_neighbors,
12796 show_ip_bgp_vpnv4_all_neighbors_cmd,
856ca177 12797 "show ip bgp vpnv4 all neighbors {json}",
718e3744 12798 SHOW_STR
12799 IP_STR
12800 BGP_STR
12801 "Display VPNv4 NLRI specific information\n"
12802 "Display information about all VPNv4 NLRIs\n"
856ca177
MS
12803 "Detailed information on TCP and BGP neighbor connections\n"
12804 "JavaScript Object Notation\n")
718e3744 12805
12806ALIAS (show_ip_bgp_neighbors,
12807 show_ip_bgp_vpnv4_rd_neighbors_cmd,
856ca177 12808 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors {json}",
718e3744 12809 SHOW_STR
12810 IP_STR
12811 BGP_STR
12812 "Display VPNv4 NLRI specific information\n"
12813 "Display information for a route distinguisher\n"
12814 "VPN Route Distinguisher\n"
856ca177
MS
12815 "Detailed information on TCP and BGP neighbor connections\n"
12816 "JavaScript Object Notation\n")
718e3744 12817
12818ALIAS (show_ip_bgp_neighbors,
12819 show_bgp_neighbors_cmd,
856ca177 12820 "show bgp neighbors {json}",
718e3744 12821 SHOW_STR
12822 BGP_STR
856ca177
MS
12823 "Detailed information on TCP and BGP neighbor connections\n"
12824 "JavaScript Object Notation\n")
718e3744 12825
12826ALIAS (show_ip_bgp_neighbors,
12827 show_bgp_ipv6_neighbors_cmd,
856ca177 12828 "show bgp ipv6 neighbors {json}",
718e3744 12829 SHOW_STR
12830 BGP_STR
12831 "Address family\n"
856ca177
MS
12832 "Detailed information on TCP and BGP neighbor connections\n"
12833 "JavaScript Object Notation\n")
718e3744 12834
12835DEFUN (show_ip_bgp_neighbors_peer,
12836 show_ip_bgp_neighbors_peer_cmd,
856ca177 12837 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
718e3744 12838 SHOW_STR
12839 IP_STR
12840 BGP_STR
12841 "Detailed information on TCP and BGP neighbor connections\n"
12842 "Neighbor to display information about\n"
a80beece 12843 "Neighbor to display information about\n"
856ca177
MS
12844 "Neighbor on bgp configured interface\n"
12845 "JavaScript Object Notation\n")
718e3744 12846{
db7c8528 12847 u_char uj = use_json(argc, argv);
856ca177 12848
9f689658 12849 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 2], uj, NULL);
718e3744 12850}
12851
12852ALIAS (show_ip_bgp_neighbors_peer,
12853 show_ip_bgp_ipv4_neighbors_peer_cmd,
856ca177 12854 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
718e3744 12855 SHOW_STR
12856 IP_STR
12857 BGP_STR
12858 "Address family\n"
12859 "Address Family modifier\n"
12860 "Address Family modifier\n"
12861 "Detailed information on TCP and BGP neighbor connections\n"
12862 "Neighbor to display information about\n"
a80beece 12863 "Neighbor to display information about\n"
856ca177
MS
12864 "Neighbor on bgp configured interface\n"
12865 "JavaScript Object Notation\n")
718e3744 12866
12867ALIAS (show_ip_bgp_neighbors_peer,
12868 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
856ca177 12869 "show ip bgp vpnv4 all neighbors A.B.C.D {json}",
718e3744 12870 SHOW_STR
12871 IP_STR
12872 BGP_STR
12873 "Display VPNv4 NLRI specific information\n"
12874 "Display information about all VPNv4 NLRIs\n"
12875 "Detailed information on TCP and BGP neighbor connections\n"
856ca177
MS
12876 "Neighbor to display information about\n"
12877 "JavaScript Object Notation\n")
718e3744 12878
12879ALIAS (show_ip_bgp_neighbors_peer,
12880 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
856ca177 12881 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D {json}",
718e3744 12882 SHOW_STR
12883 IP_STR
12884 BGP_STR
12885 "Display VPNv4 NLRI specific information\n"
12886 "Display information about all VPNv4 NLRIs\n"
12887 "Detailed information on TCP and BGP neighbor connections\n"
856ca177
MS
12888 "Neighbor to display information about\n"
12889 "JavaScript Object Notation\n")
718e3744 12890
12891ALIAS (show_ip_bgp_neighbors_peer,
12892 show_bgp_neighbors_peer_cmd,
856ca177 12893 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
718e3744 12894 SHOW_STR
12895 BGP_STR
12896 "Detailed information on TCP and BGP neighbor connections\n"
12897 "Neighbor to display information about\n"
a80beece 12898 "Neighbor to display information about\n"
856ca177
MS
12899 "Neighbor on bgp configured interface\n"
12900 "JavaScript Object Notation\n")
718e3744 12901
12902ALIAS (show_ip_bgp_neighbors_peer,
12903 show_bgp_ipv6_neighbors_peer_cmd,
856ca177 12904 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
718e3744 12905 SHOW_STR
12906 BGP_STR
12907 "Address family\n"
12908 "Detailed information on TCP and BGP neighbor connections\n"
12909 "Neighbor to display information about\n"
a80beece 12910 "Neighbor to display information about\n"
856ca177
MS
12911 "Neighbor on bgp configured interface\n"
12912 "JavaScript Object Notation\n")
718e3744 12913
12914DEFUN (show_ip_bgp_instance_neighbors,
12915 show_ip_bgp_instance_neighbors_cmd,
8386ac43 12916 "show ip bgp " BGP_INSTANCE_CMD " neighbors {json}",
718e3744 12917 SHOW_STR
12918 IP_STR
12919 BGP_STR
8386ac43 12920 BGP_INSTANCE_HELP_STR
856ca177
MS
12921 "Detailed information on TCP and BGP neighbor connections\n"
12922 "JavaScript Object Notation\n")
718e3744 12923{
db7c8528 12924 u_char uj = use_json(argc, argv);
856ca177 12925
9f689658 12926 return bgp_show_neighbor_vty (vty, argv[1], show_all, NULL, uj, NULL);
718e3744 12927}
12928
f186de26 12929DEFUN (show_ip_bgp_instance_all_neighbors,
12930 show_ip_bgp_instance_all_neighbors_cmd,
12931 "show ip bgp " BGP_INSTANCE_ALL_CMD " neighbors {json}",
12932 SHOW_STR
12933 IP_STR
12934 BGP_STR
12935 BGP_INSTANCE_ALL_HELP_STR
12936 "Detailed information on TCP and BGP neighbor connections\n"
12937 "JavaScript Object Notation\n")
12938{
12939 u_char uj = use_json(argc, argv);
12940
12941 bgp_show_all_instances_neighbors_vty (vty, uj);
12942 return CMD_SUCCESS;
12943}
12944
bb46e94f 12945ALIAS (show_ip_bgp_instance_neighbors,
12946 show_bgp_instance_neighbors_cmd,
8386ac43 12947 "show bgp " BGP_INSTANCE_CMD " neighbors {json}",
bb46e94f 12948 SHOW_STR
12949 BGP_STR
8386ac43 12950 BGP_INSTANCE_HELP_STR
856ca177
MS
12951 "Detailed information on TCP and BGP neighbor connections\n"
12952 "JavaScript Object Notation\n")
bb46e94f 12953
12954ALIAS (show_ip_bgp_instance_neighbors,
12955 show_bgp_instance_ipv6_neighbors_cmd,
8386ac43 12956 "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors {json}",
bb46e94f 12957 SHOW_STR
12958 BGP_STR
8386ac43 12959 BGP_INSTANCE_HELP_STR
bb46e94f 12960 "Address family\n"
856ca177
MS
12961 "Detailed information on TCP and BGP neighbor connections\n"
12962 "JavaScript Object Notation\n")
bb46e94f 12963
718e3744 12964DEFUN (show_ip_bgp_instance_neighbors_peer,
12965 show_ip_bgp_instance_neighbors_peer_cmd,
8386ac43 12966 "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
718e3744 12967 SHOW_STR
12968 IP_STR
12969 BGP_STR
8386ac43 12970 BGP_INSTANCE_HELP_STR
718e3744 12971 "Detailed information on TCP and BGP neighbor connections\n"
12972 "Neighbor to display information about\n"
a80beece 12973 "Neighbor to display information about\n"
856ca177
MS
12974 "Neighbor on bgp configured interface\n"
12975 "JavaScript Object Notation\n")
718e3744 12976{
db7c8528 12977 u_char uj = use_json(argc, argv);
856ca177 12978
9f689658 12979 return bgp_show_neighbor_vty (vty, argv[1], show_peer, argv[2], uj, NULL);
718e3744 12980}
bb46e94f 12981
12982ALIAS (show_ip_bgp_instance_neighbors_peer,
12983 show_bgp_instance_neighbors_peer_cmd,
8386ac43 12984 "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
bb46e94f 12985 SHOW_STR
12986 BGP_STR
8386ac43 12987 BGP_INSTANCE_HELP_STR
bb46e94f 12988 "Detailed information on TCP and BGP neighbor connections\n"
12989 "Neighbor to display information about\n"
a80beece 12990 "Neighbor to display information about\n"
856ca177
MS
12991 "Neighbor on bgp configured interface\n"
12992 "JavaScript Object Notation\n")
bb46e94f 12993
12994ALIAS (show_ip_bgp_instance_neighbors_peer,
12995 show_bgp_instance_ipv6_neighbors_peer_cmd,
8386ac43 12996 "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
bb46e94f 12997 SHOW_STR
12998 BGP_STR
8386ac43 12999 BGP_INSTANCE_HELP_STR
bb46e94f 13000 "Address family\n"
13001 "Detailed information on TCP and BGP neighbor connections\n"
13002 "Neighbor to display information about\n"
a80beece 13003 "Neighbor to display information about\n"
856ca177
MS
13004 "Neighbor on bgp configured interface\n"
13005 "JavaScript Object Notation\n")
6b0655a2 13006
718e3744 13007/* Show BGP's AS paths internal data. There are both `show ip bgp
13008 paths' and `show ip mbgp paths'. Those functions results are the
13009 same.*/
13010DEFUN (show_ip_bgp_paths,
13011 show_ip_bgp_paths_cmd,
13012 "show ip bgp paths",
13013 SHOW_STR
13014 IP_STR
13015 BGP_STR
13016 "Path information\n")
13017{
13018 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
13019 aspath_print_all_vty (vty);
13020 return CMD_SUCCESS;
13021}
13022
13023DEFUN (show_ip_bgp_ipv4_paths,
13024 show_ip_bgp_ipv4_paths_cmd,
13025 "show ip bgp ipv4 (unicast|multicast) paths",
13026 SHOW_STR
13027 IP_STR
13028 BGP_STR
13029 "Address family\n"
13030 "Address Family modifier\n"
13031 "Address Family modifier\n"
13032 "Path information\n")
13033{
13034 vty_out (vty, "Address Refcnt Path\r\n");
13035 aspath_print_all_vty (vty);
13036
13037 return CMD_SUCCESS;
13038}
6b0655a2 13039
718e3744 13040#include "hash.h"
13041
94f2b392 13042static void
718e3744 13043community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
13044{
13045 struct community *com;
13046
13047 com = (struct community *) backet->data;
6c4f4e6e 13048 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
718e3744 13049 community_str (com), VTY_NEWLINE);
13050}
13051
13052/* Show BGP's community internal data. */
13053DEFUN (show_ip_bgp_community_info,
13054 show_ip_bgp_community_info_cmd,
13055 "show ip bgp community-info",
13056 SHOW_STR
13057 IP_STR
13058 BGP_STR
13059 "List all bgp community information\n")
13060{
13061 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
13062
13063 hash_iterate (community_hash (),
13064 (void (*) (struct hash_backet *, void *))
13065 community_show_all_iterator,
13066 vty);
13067
13068 return CMD_SUCCESS;
13069}
13070
13071DEFUN (show_ip_bgp_attr_info,
13072 show_ip_bgp_attr_info_cmd,
13073 "show ip bgp attribute-info",
13074 SHOW_STR
13075 IP_STR
13076 BGP_STR
13077 "List all bgp attribute information\n")
13078{
13079 attr_show_all (vty);
13080 return CMD_SUCCESS;
13081}
6b0655a2 13082
8386ac43 13083static int bgp_show_update_groups(struct vty *vty, const char *name,
13084 int afi, int safi,
f43e655e 13085 uint64_t subgrp_id)
3f9c7369
DS
13086{
13087 struct bgp *bgp;
13088
8386ac43 13089 if (name)
13090 bgp = bgp_lookup_by_name (name);
13091 else
13092 bgp = bgp_get_default ();
13093
3f9c7369 13094 if (bgp)
8fe8a7f6 13095 update_group_show(bgp, afi, safi, vty, subgrp_id);
3f9c7369
DS
13096 return CMD_SUCCESS;
13097}
13098
f186de26 13099static void
13100bgp_show_all_instances_updgrps_vty (struct vty *vty, afi_t afi, safi_t safi)
13101{
13102 struct listnode *node, *nnode;
13103 struct bgp *bgp;
13104
13105 for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
13106 {
13107 vty_out (vty, "%sInstance %s:%s",
13108 VTY_NEWLINE,
13109 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name,
13110 VTY_NEWLINE);
13111 update_group_show(bgp, afi, safi, vty, 0);
13112 }
13113}
13114
8fe8a7f6
DS
13115DEFUN (show_ip_bgp_updgrps,
13116 show_ip_bgp_updgrps_cmd,
13117 "show ip bgp update-groups",
13118 SHOW_STR
13119 IP_STR
13120 BGP_STR
13121 "Detailed info about dynamic update groups\n")
13122{
8386ac43 13123 return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, 0));
13124}
13125
13126DEFUN (show_ip_bgp_instance_updgrps,
13127 show_ip_bgp_instance_updgrps_cmd,
13128 "show ip bgp " BGP_INSTANCE_CMD " update-groups",
13129 SHOW_STR
13130 IP_STR
13131 BGP_STR
13132 BGP_INSTANCE_HELP_STR
13133 "Detailed info about dynamic update groups\n")
13134{
13135 return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, 0));
8fe8a7f6
DS
13136}
13137
f186de26 13138DEFUN (show_ip_bgp_instance_all_updgrps,
13139 show_ip_bgp_instance_all_updgrps_cmd,
13140 "show ip bgp " BGP_INSTANCE_ALL_CMD " update-groups",
13141 SHOW_STR
13142 IP_STR
13143 BGP_STR
13144 BGP_INSTANCE_ALL_HELP_STR
13145 "Detailed info about dynamic update groups\n")
13146{
13147 bgp_show_all_instances_updgrps_vty (vty, AFI_IP, SAFI_UNICAST);
13148 return CMD_SUCCESS;
13149}
13150
3f9c7369
DS
13151DEFUN (show_bgp_ipv6_updgrps,
13152 show_bgp_ipv6_updgrps_cmd,
8fe8a7f6 13153 "show bgp update-groups",
3f9c7369
DS
13154 SHOW_STR
13155 BGP_STR
8fe8a7f6 13156 "Detailed info about v6 dynamic update groups\n")
3f9c7369 13157{
8386ac43 13158 return (bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, 0));
13159}
13160
13161DEFUN (show_bgp_instance_ipv6_updgrps,
13162 show_bgp_instance_ipv6_updgrps_cmd,
13163 "show bgp " BGP_INSTANCE_CMD " update-groups",
13164 SHOW_STR
13165 BGP_STR
13166 BGP_INSTANCE_HELP_STR
13167 "Detailed info about v6 dynamic update groups\n")
13168{
13169 return (bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, 0));
3f9c7369
DS
13170}
13171
f186de26 13172DEFUN (show_bgp_instance_all_ipv6_updgrps,
13173 show_bgp_instance_all_ipv6_updgrps_cmd,
13174 "show bgp " BGP_INSTANCE_ALL_CMD " update-groups",
13175 SHOW_STR
13176 BGP_STR
13177 BGP_INSTANCE_ALL_HELP_STR
13178 "Detailed info about v6 dynamic update groups\n")
13179{
13180 bgp_show_all_instances_updgrps_vty (vty, AFI_IP6, SAFI_UNICAST);
13181 return CMD_SUCCESS;
13182}
13183
3f9c7369
DS
13184DEFUN (show_bgp_updgrps,
13185 show_bgp_updgrps_cmd,
8fe8a7f6 13186 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups",
3f9c7369
DS
13187 SHOW_STR
13188 BGP_STR
13189 "Address family\n"
13190 "Address family\n"
13191 "Address Family modifier\n"
13192 "Address Family modifier\n"
8fe8a7f6 13193 "Detailed info about dynamic update groups\n")
3f9c7369 13194{
3f9c7369
DS
13195 afi_t afi;
13196 safi_t safi;
13197
13198 afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
13199 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8386ac43 13200 return (bgp_show_update_groups(vty, NULL, afi, safi, 0));
8fe8a7f6
DS
13201}
13202
13203DEFUN (show_ip_bgp_updgrps_s,
13204 show_ip_bgp_updgrps_s_cmd,
13205 "show ip bgp update-groups SUBGROUP-ID",
13206 SHOW_STR
13207 IP_STR
13208 BGP_STR
13209 "Detailed info about dynamic update groups\n"
13210 "Specific subgroup to display detailed info for\n")
13211{
f43e655e 13212 uint64_t subgrp_id;
8fe8a7f6
DS
13213
13214 VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]);
8386ac43 13215 return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, subgrp_id));
13216}
13217
13218DEFUN (show_ip_bgp_instance_updgrps_s,
13219 show_ip_bgp_instance_updgrps_s_cmd,
13220 "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID",
13221 SHOW_STR
13222 IP_STR
13223 BGP_STR
13224 BGP_INSTANCE_HELP_STR
13225 "Detailed info about dynamic update groups\n"
13226 "Specific subgroup to display detailed info for\n")
13227{
f43e655e 13228 uint64_t subgrp_id;
8386ac43 13229
13230 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
13231 return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, subgrp_id));
8fe8a7f6
DS
13232}
13233
13234DEFUN (show_bgp_ipv6_updgrps_s,
13235 show_bgp_ipv6_updgrps_s_cmd,
13236 "show bgp update-groups SUBGROUP-ID",
13237 SHOW_STR
13238 BGP_STR
13239 "Detailed info about v6 dynamic update groups\n"
13240 "Specific subgroup to display detailed info for\n")
13241{
f43e655e 13242 uint64_t subgrp_id;
8fe8a7f6
DS
13243
13244 VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]);
8386ac43 13245 return(bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, subgrp_id));
13246}
13247
13248DEFUN (show_bgp_instance_ipv6_updgrps_s,
13249 show_bgp_instance_ipv6_updgrps_s_cmd,
13250 "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID",
13251 SHOW_STR
13252 BGP_STR
13253 "Detailed info about v6 dynamic update groups\n"
13254 "Specific subgroup to display detailed info for\n")
13255{
f43e655e 13256 uint64_t subgrp_id;
8386ac43 13257
13258 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
13259 return(bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, subgrp_id));
8fe8a7f6
DS
13260}
13261
13262DEFUN (show_bgp_updgrps_s,
13263 show_bgp_updgrps_s_cmd,
13264 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID",
13265 SHOW_STR
13266 BGP_STR
13267 "Address family\n"
13268 "Address family\n"
13269 "Address Family modifier\n"
13270 "Address Family modifier\n"
13271 "Detailed info about v6 dynamic update groups\n"
13272 "Specific subgroup to display detailed info for")
13273{
13274 afi_t afi;
13275 safi_t safi;
f43e655e 13276 uint64_t subgrp_id;
8fe8a7f6
DS
13277
13278 afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
13279 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
13280
13281 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
8386ac43 13282 return(bgp_show_update_groups(vty, NULL, afi, safi, subgrp_id));
3f9c7369
DS
13283}
13284
13285DEFUN (show_bgp_updgrps_stats,
13286 show_bgp_updgrps_stats_cmd,
13287 "show bgp update-groups statistics",
13288 SHOW_STR
13289 BGP_STR
13290 "BGP update groups\n"
13291 "Statistics\n")
13292{
13293 struct bgp *bgp;
13294
13295 bgp = bgp_get_default();
13296 if (bgp)
13297 update_group_show_stats(bgp, vty);
13298
13299 return CMD_SUCCESS;
13300}
13301
8386ac43 13302DEFUN (show_bgp_instance_updgrps_stats,
13303 show_bgp_instance_updgrps_stats_cmd,
13304 "show bgp " BGP_INSTANCE_CMD " update-groups statistics",
13305 SHOW_STR
13306 BGP_STR
13307 BGP_INSTANCE_HELP_STR
13308 "BGP update groups\n"
13309 "Statistics\n")
13310{
13311 struct bgp *bgp;
13312
13313 bgp = bgp_lookup_by_name (argv[1]);
13314 if (bgp)
13315 update_group_show_stats(bgp, vty);
13316
13317 return CMD_SUCCESS;
13318}
13319
3f9c7369 13320static void
8386ac43 13321show_bgp_updgrps_adj_info_aux (struct vty *vty, const char *name,
13322 afi_t afi, safi_t safi,
f43e655e 13323 const char *what, uint64_t subgrp_id)
3f9c7369
DS
13324{
13325 struct bgp *bgp;
8386ac43 13326
13327 if (name)
13328 bgp = bgp_lookup_by_name (name);
13329 else
13330 bgp = bgp_get_default ();
13331
3f9c7369
DS
13332 if (bgp)
13333 {
13334 if (!strcmp(what, "advertise-queue"))
13335 update_group_show_adj_queue(bgp, afi, safi, vty, subgrp_id);
13336 else if (!strcmp(what, "advertised-routes"))
13337 update_group_show_advertised(bgp, afi, safi, vty, subgrp_id);
13338 else if (!strcmp(what, "packet-queue"))
13339 update_group_show_packet_queue(bgp, afi, safi, vty, subgrp_id);
13340 }
13341}
13342
13343DEFUN (show_ip_bgp_updgrps_adj,
13344 show_ip_bgp_updgrps_adj_cmd,
13345 "show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)",
13346 SHOW_STR
13347 IP_STR
13348 BGP_STR
13349 "BGP update groups\n"
13350 "Advertisement queue\n"
13351 "Announced routes\n"
13352 "Packet queue\n")
8fe8a7f6 13353
3f9c7369 13354{
8386ac43 13355 show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[0], 0);
13356 return CMD_SUCCESS;
13357}
13358
13359DEFUN (show_ip_bgp_instance_updgrps_adj,
13360 show_ip_bgp_instance_updgrps_adj_cmd,
13361 "show ip bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)",
13362 SHOW_STR
13363 IP_STR
13364 BGP_STR
13365 BGP_INSTANCE_HELP_STR
13366 "BGP update groups\n"
13367 "Advertisement queue\n"
13368 "Announced routes\n"
13369 "Packet queue\n")
13370
13371{
13372 show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[2], 0);
3f9c7369
DS
13373 return CMD_SUCCESS;
13374}
13375
13376DEFUN (show_bgp_updgrps_afi_adj,
13377 show_bgp_updgrps_afi_adj_cmd,
13378 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)",
13379 SHOW_STR
13380 BGP_STR
13381 "Address family\n"
13382 "Address family\n"
13383 "Address Family modifier\n"
13384 "Address Family modifier\n"
13385 "BGP update groups\n"
13386 "Advertisement queue\n"
13387 "Announced routes\n"
8fe8a7f6
DS
13388 "Packet queue\n"
13389 "Specific subgroup info wanted for\n")
3f9c7369
DS
13390{
13391 afi_t afi;
13392 safi_t safi;
13393
13394 afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
13395 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8386ac43 13396 show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[2], 0);
8fe8a7f6 13397 return CMD_SUCCESS;
3f9c7369
DS
13398}
13399
13400DEFUN (show_bgp_updgrps_adj,
13401 show_bgp_updgrps_adj_cmd,
13402 "show bgp update-groups (advertise-queue|advertised-routes|packet-queue)",
13403 SHOW_STR
13404 BGP_STR
13405 "BGP update groups\n"
13406 "Advertisement queue\n"
13407 "Announced routes\n"
13408 "Packet queue\n")
13409{
8386ac43 13410 show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[0], 0);
13411 return CMD_SUCCESS;
13412}
13413
13414DEFUN (show_bgp_instance_updgrps_adj,
13415 show_bgp_instance_updgrps_adj_cmd,
13416 "show bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)",
13417 SHOW_STR
13418 BGP_STR
13419 BGP_INSTANCE_HELP_STR
13420 "BGP update groups\n"
13421 "Advertisement queue\n"
13422 "Announced routes\n"
13423 "Packet queue\n")
13424{
13425 show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[2], 0);
3f9c7369
DS
13426 return CMD_SUCCESS;
13427}
13428
13429DEFUN (show_ip_bgp_updgrps_adj_s,
8fe8a7f6 13430 show_ip_bgp_updgrps_adj_s_cmd,
3f9c7369
DS
13431 "show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
13432 SHOW_STR
13433 IP_STR
13434 BGP_STR
13435 "BGP update groups\n"
8fe8a7f6 13436 "Specific subgroup to display info for\n"
3f9c7369
DS
13437 "Advertisement queue\n"
13438 "Announced routes\n"
13439 "Packet queue\n")
3f9c7369 13440
3f9c7369 13441{
f43e655e 13442 uint64_t subgrp_id;
8fe8a7f6
DS
13443
13444 VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]);
13445
8386ac43 13446 show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[1], subgrp_id);
13447 return CMD_SUCCESS;
13448}
13449
13450DEFUN (show_ip_bgp_instance_updgrps_adj_s,
13451 show_ip_bgp_instance_updgrps_adj_s_cmd,
13452 "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
13453 SHOW_STR
13454 IP_STR
13455 BGP_STR
13456 BGP_INSTANCE_HELP_STR
13457 "BGP update groups\n"
13458 "Specific subgroup to display info for\n"
13459 "Advertisement queue\n"
13460 "Announced routes\n"
13461 "Packet queue\n")
13462
13463{
f43e655e 13464 uint64_t subgrp_id;
8386ac43 13465
13466 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
13467
13468 show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[3], subgrp_id);
3f9c7369
DS
13469 return CMD_SUCCESS;
13470}
13471
8fe8a7f6
DS
13472DEFUN (show_bgp_updgrps_afi_adj_s,
13473 show_bgp_updgrps_afi_adj_s_cmd,
3f9c7369
DS
13474 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
13475 SHOW_STR
13476 BGP_STR
13477 "Address family\n"
13478 "Address family\n"
13479 "Address Family modifier\n"
13480 "Address Family modifier\n"
13481 "BGP update groups\n"
8fe8a7f6 13482 "Specific subgroup to display info for\n"
3f9c7369
DS
13483 "Advertisement queue\n"
13484 "Announced routes\n"
8fe8a7f6
DS
13485 "Packet queue\n"
13486 "Specific subgroup info wanted for\n")
3f9c7369
DS
13487{
13488 afi_t afi;
13489 safi_t safi;
f43e655e 13490 uint64_t subgrp_id;
3f9c7369
DS
13491
13492 afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
13493 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8fe8a7f6
DS
13494 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
13495
8386ac43 13496 show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[3], subgrp_id);
8fe8a7f6 13497 return CMD_SUCCESS;
3f9c7369
DS
13498}
13499
8fe8a7f6
DS
13500DEFUN (show_bgp_updgrps_adj_s,
13501 show_bgp_updgrps_adj_s_cmd,
13502 "show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
13503 SHOW_STR
13504 BGP_STR
13505 "BGP update groups\n"
13506 "Specific subgroup to display info for\n"
13507 "Advertisement queue\n"
13508 "Announced routes\n"
13509 "Packet queue\n")
13510{
f43e655e 13511 uint64_t subgrp_id;
8fe8a7f6
DS
13512
13513 VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]);
13514
8386ac43 13515 show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[1], subgrp_id);
8fe8a7f6
DS
13516 return CMD_SUCCESS;
13517}
13518
8386ac43 13519DEFUN (show_bgp_instance_updgrps_adj_s,
13520 show_bgp_instance_updgrps_adj_s_cmd,
13521 "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
13522 SHOW_STR
13523 BGP_STR
13524 BGP_INSTANCE_HELP_STR
13525 "BGP update groups\n"
13526 "Specific subgroup to display info for\n"
13527 "Advertisement queue\n"
13528 "Announced routes\n"
13529 "Packet queue\n")
13530{
f43e655e 13531 uint64_t subgrp_id;
8386ac43 13532
13533 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
13534
13535 show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[3], subgrp_id);
13536 return CMD_SUCCESS;
13537}
13538
13539
8fe8a7f6 13540
f14e6fdb
DS
13541static int
13542bgp_show_one_peer_group (struct vty *vty, struct peer_group *group)
13543{
13544 struct listnode *node, *nnode;
13545 struct prefix *range;
13546 struct peer *conf;
13547 struct peer *peer;
4690c7d7 13548 char buf[PREFIX2STR_BUFFER];
f14e6fdb
DS
13549 afi_t afi;
13550 safi_t safi;
ffd0c037
DS
13551 const char *peer_status;
13552 const char *af_str;
f14e6fdb
DS
13553 int lr_count;
13554 int dynamic;
13555 int af_cfgd;
13556
13557 conf = group->conf;
13558
0299c004
DS
13559 if (conf->as_type == AS_SPECIFIED ||
13560 conf->as_type == AS_EXTERNAL) {
66b199b2 13561 vty_out (vty, "%sBGP peer-group %s, remote AS %d%s",
f14e6fdb 13562 VTY_NEWLINE, group->name, conf->as, VTY_NEWLINE);
0299c004 13563 } else if (conf->as_type == AS_INTERNAL) {
66b199b2 13564 vty_out (vty, "%sBGP peer-group %s, remote AS %d%s",
0299c004 13565 VTY_NEWLINE, group->name, group->bgp->as, VTY_NEWLINE);
66b199b2
DS
13566 } else {
13567 vty_out (vty, "%sBGP peer-group %s%s",
13568 VTY_NEWLINE, group->name, VTY_NEWLINE);
0299c004 13569 }
f14e6fdb 13570
0299c004 13571 if ((group->bgp->as == conf->as) || (conf->as_type == AS_INTERNAL))
f14e6fdb
DS
13572 vty_out (vty, " Peer-group type is internal%s", VTY_NEWLINE);
13573 else
13574 vty_out (vty, " Peer-group type is external%s", VTY_NEWLINE);
13575
13576 /* Display AFs configured. */
13577 vty_out (vty, " Configured address-families:");
13578 for (afi = AFI_IP; afi < AFI_MAX; afi++)
13579 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
13580 {
13581 if (conf->afc[afi][safi])
13582 {
13583 af_cfgd = 1;
13584 vty_out (vty, " %s;", afi_safi_print(afi, safi));
13585 }
13586 }
13587 if (!af_cfgd)
13588 vty_out (vty, " none%s", VTY_NEWLINE);
13589 else
13590 vty_out (vty, "%s", VTY_NEWLINE);
13591
13592 /* Display listen ranges (for dynamic neighbors), if any */
13593 for (afi = AFI_IP; afi < AFI_MAX; afi++)
13594 {
13595 if (afi == AFI_IP)
13596 af_str = "IPv4";
13597 else if (afi == AFI_IP6)
13598 af_str = "IPv6";
13599 lr_count = listcount(group->listen_range[afi]);
13600 if (lr_count)
13601 {
13602 vty_out(vty,
13603 " %d %s listen range(s)%s",
13604 lr_count, af_str, VTY_NEWLINE);
13605
13606
13607 for (ALL_LIST_ELEMENTS (group->listen_range[afi], node,
13608 nnode, range))
13609 {
13610 prefix2str(range, buf, sizeof(buf));
13611 vty_out(vty, " %s%s", buf, VTY_NEWLINE);
13612 }
13613 }
13614 }
13615
13616 /* Display group members and their status */
13617 if (listcount(group->peer))
13618 {
13619 vty_out (vty, " Peer-group members:%s", VTY_NEWLINE);
13620 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
13621 {
13622 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
13623 peer_status = "Idle (Admin)";
13624 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
13625 peer_status = "Idle (PfxCt)";
13626 else
13627 peer_status = LOOKUP(bgp_status_msg, peer->status);
13628
13629 dynamic = peer_dynamic_neighbor(peer);
13630 vty_out (vty, " %s %s %s %s",
13631 peer->host, dynamic ? "(dynamic)" : "",
13632 peer_status, VTY_NEWLINE);
13633 }
13634 }
13635
13636 return CMD_SUCCESS;
13637}
13638
13639/* Show BGP peer group's information. */
13640enum show_group_type
13641{
13642 show_all_groups,
13643 show_peer_group
13644};
13645
13646static int
13647bgp_show_peer_group (struct vty *vty, struct bgp *bgp,
13648 enum show_group_type type, const char *group_name)
13649{
13650 struct listnode *node, *nnode;
13651 struct peer_group *group;
13652 int find = 0;
13653
13654 for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group))
13655 {
13656 switch (type)
13657 {
13658 case show_all_groups:
13659 bgp_show_one_peer_group (vty, group);
13660 break;
13661 case show_peer_group:
13662 if (group_name && (strcmp(group->name, group_name) == 0))
13663 {
13664 find = 1;
13665 bgp_show_one_peer_group (vty, group);
13666 }
13667 break;
13668 }
13669 }
13670
13671 if (type == show_peer_group && ! find)
6d9e66dc 13672 vty_out (vty, "%% No such peer-group%s", VTY_NEWLINE);
f14e6fdb
DS
13673
13674 return CMD_SUCCESS;
13675}
13676
13677static int
13678bgp_show_peer_group_vty (struct vty *vty, const char *name,
13679 enum show_group_type type, const char *group_name)
13680{
13681 struct bgp *bgp;
13682 int ret = CMD_SUCCESS;
13683
13684 if (name)
8386ac43 13685 bgp = bgp_lookup_by_name (name);
13686 else
13687 bgp = bgp_get_default ();
f14e6fdb 13688
8386ac43 13689 if (! bgp)
13690 {
13691 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
13692 return CMD_WARNING;
f14e6fdb
DS
13693 }
13694
8386ac43 13695 ret = bgp_show_peer_group (vty, bgp, type, group_name);
f14e6fdb
DS
13696
13697 return ret;
13698}
13699
13700DEFUN (show_ip_bgp_peer_groups,
13701 show_ip_bgp_peer_groups_cmd,
13702 "show ip bgp peer-group",
13703 SHOW_STR
13704 IP_STR
13705 BGP_STR
13706 "Detailed information on all BGP peer groups\n")
13707{
13708 return bgp_show_peer_group_vty (vty, NULL, show_all_groups, NULL);
13709}
13710
13711DEFUN (show_ip_bgp_instance_peer_groups,
13712 show_ip_bgp_instance_peer_groups_cmd,
8386ac43 13713 "show ip bgp " BGP_INSTANCE_CMD " peer-group",
f14e6fdb
DS
13714 SHOW_STR
13715 IP_STR
13716 BGP_STR
8386ac43 13717 BGP_INSTANCE_HELP_STR
f14e6fdb
DS
13718 "Detailed information on all BGP peer groups\n")
13719{
8386ac43 13720 return bgp_show_peer_group_vty (vty, argv[1], show_all_groups, NULL);
f14e6fdb
DS
13721}
13722
13723DEFUN (show_ip_bgp_peer_group,
13724 show_ip_bgp_peer_group_cmd,
13725 "show ip bgp peer-group WORD",
13726 SHOW_STR
13727 IP_STR
13728 BGP_STR
13729 "BGP peer-group name\n"
13730 "Detailed information on a BGP peer group\n")
13731{
13732 return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[0]);
13733}
13734
13735DEFUN (show_ip_bgp_instance_peer_group,
13736 show_ip_bgp_instance_peer_group_cmd,
8386ac43 13737 "show ip bgp " BGP_INSTANCE_CMD " peer-group WORD",
f14e6fdb
DS
13738 SHOW_STR
13739 IP_STR
13740 BGP_STR
8386ac43 13741 BGP_INSTANCE_HELP_STR
f14e6fdb
DS
13742 "BGP peer-group name\n"
13743 "Detailed information on a BGP peer group\n")
13744{
8386ac43 13745 return bgp_show_peer_group_vty (vty, argv[1], show_peer_group, argv[2]);
f14e6fdb 13746}
3f9c7369 13747
718e3744 13748/* Redistribute VTY commands. */
13749
718e3744 13750DEFUN (bgp_redistribute_ipv4,
13751 bgp_redistribute_ipv4_cmd,
e0ca5fde 13752 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
718e3744 13753 "Redistribute information from another routing protocol\n"
e0ca5fde 13754 QUAGGA_IP_REDIST_HELP_STR_BGPD)
718e3744 13755{
13756 int type;
13757
e0ca5fde
DL
13758 type = proto_redistnum (AFI_IP, argv[0]);
13759 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13760 {
13761 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13762 return CMD_WARNING;
13763 }
7c8ff89e 13764 bgp_redist_add(vty->index, AFI_IP, type, 0);
6aeb9e78 13765 return bgp_redistribute_set (vty->index, AFI_IP, type, 0);
718e3744 13766}
13767
13768DEFUN (bgp_redistribute_ipv4_rmap,
13769 bgp_redistribute_ipv4_rmap_cmd,
e0ca5fde 13770 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
718e3744 13771 "Redistribute information from another routing protocol\n"
e0ca5fde 13772 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 13773 "Route map reference\n"
13774 "Pointer to route-map entries\n")
13775{
13776 int type;
7c8ff89e 13777 struct bgp_redist *red;
718e3744 13778
e0ca5fde
DL
13779 type = proto_redistnum (AFI_IP, argv[0]);
13780 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13781 {
13782 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13783 return CMD_WARNING;
13784 }
13785
7c8ff89e
DS
13786 red = bgp_redist_add(vty->index, AFI_IP, type, 0);
13787 bgp_redistribute_rmap_set (red, argv[1]);
6aeb9e78 13788 return bgp_redistribute_set (vty->index, AFI_IP, type, 0);
718e3744 13789}
13790
13791DEFUN (bgp_redistribute_ipv4_metric,
13792 bgp_redistribute_ipv4_metric_cmd,
e0ca5fde 13793 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 13794 "Redistribute information from another routing protocol\n"
e0ca5fde 13795 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 13796 "Metric for redistributed routes\n"
13797 "Default metric\n")
13798{
13799 int type;
13800 u_int32_t metric;
7c8ff89e 13801 struct bgp_redist *red;
718e3744 13802
e0ca5fde
DL
13803 type = proto_redistnum (AFI_IP, argv[0]);
13804 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13805 {
13806 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13807 return CMD_WARNING;
13808 }
13809 VTY_GET_INTEGER ("metric", metric, argv[1]);
13810
7c8ff89e 13811 red = bgp_redist_add(vty->index, AFI_IP, type, 0);
caf958b4 13812 bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric);
6aeb9e78 13813 return bgp_redistribute_set (vty->index, AFI_IP, type, 0);
718e3744 13814}
13815
13816DEFUN (bgp_redistribute_ipv4_rmap_metric,
13817 bgp_redistribute_ipv4_rmap_metric_cmd,
e0ca5fde 13818 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 13819 "Redistribute information from another routing protocol\n"
e0ca5fde 13820 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 13821 "Route map reference\n"
13822 "Pointer to route-map entries\n"
13823 "Metric for redistributed routes\n"
13824 "Default metric\n")
13825{
13826 int type;
13827 u_int32_t metric;
7c8ff89e 13828 struct bgp_redist *red;
718e3744 13829
e0ca5fde
DL
13830 type = proto_redistnum (AFI_IP, argv[0]);
13831 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13832 {
13833 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13834 return CMD_WARNING;
13835 }
13836 VTY_GET_INTEGER ("metric", metric, argv[2]);
13837
7c8ff89e
DS
13838 red = bgp_redist_add(vty->index, AFI_IP, type, 0);
13839 bgp_redistribute_rmap_set (red, argv[1]);
caf958b4 13840 bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric);
6aeb9e78 13841 return bgp_redistribute_set (vty->index, AFI_IP, type, 0);
718e3744 13842}
13843
13844DEFUN (bgp_redistribute_ipv4_metric_rmap,
13845 bgp_redistribute_ipv4_metric_rmap_cmd,
e0ca5fde 13846 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 13847 "Redistribute information from another routing protocol\n"
e0ca5fde 13848 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 13849 "Metric for redistributed routes\n"
13850 "Default metric\n"
13851 "Route map reference\n"
13852 "Pointer to route-map entries\n")
13853{
13854 int type;
13855 u_int32_t metric;
7c8ff89e 13856 struct bgp_redist *red;
718e3744 13857
e0ca5fde
DL
13858 type = proto_redistnum (AFI_IP, argv[0]);
13859 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13860 {
13861 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13862 return CMD_WARNING;
13863 }
13864 VTY_GET_INTEGER ("metric", metric, argv[1]);
13865
7c8ff89e 13866 red = bgp_redist_add(vty->index, AFI_IP, type, 0);
caf958b4 13867 bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric);
7c8ff89e 13868 bgp_redistribute_rmap_set (red, argv[2]);
6aeb9e78 13869 return bgp_redistribute_set (vty->index, AFI_IP, type, 0);
718e3744 13870}
13871
7c8ff89e
DS
13872DEFUN (bgp_redistribute_ipv4_ospf,
13873 bgp_redistribute_ipv4_ospf_cmd,
7a4bb9c5 13874 "redistribute (ospf|table) <1-65535>",
7c8ff89e
DS
13875 "Redistribute information from another routing protocol\n"
13876 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13877 "Non-main Kernel Routing Table\n"
13878 "Instance ID/Table ID\n")
7c8ff89e
DS
13879{
13880 u_short instance;
7a4bb9c5 13881 u_short protocol;
7c8ff89e 13882
7a4bb9c5
DS
13883 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
13884
13885 if (strncmp(argv[0], "o", 1) == 0)
13886 protocol = ZEBRA_ROUTE_OSPF;
13887 else
13888 protocol = ZEBRA_ROUTE_TABLE;
13889
13890 bgp_redist_add(vty->index, AFI_IP, protocol, instance);
6aeb9e78 13891 return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
13892}
13893
13894DEFUN (bgp_redistribute_ipv4_ospf_rmap,
13895 bgp_redistribute_ipv4_ospf_rmap_cmd,
7a4bb9c5 13896 "redistribute (ospf|table) <1-65535> route-map WORD",
7c8ff89e
DS
13897 "Redistribute information from another routing protocol\n"
13898 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13899 "Non-main Kernel Routing Table\n"
13900 "Instance ID/Table ID\n"
7c8ff89e
DS
13901 "Route map reference\n"
13902 "Pointer to route-map entries\n")
13903{
13904 struct bgp_redist *red;
13905 u_short instance;
7a4bb9c5 13906 int protocol;
7c8ff89e 13907
7a4bb9c5
DS
13908 if (strncmp(argv[0], "o", 1) == 0)
13909 protocol = ZEBRA_ROUTE_OSPF;
13910 else
13911 protocol = ZEBRA_ROUTE_TABLE;
13912
13913 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
13914 red = bgp_redist_add(vty->index, AFI_IP, protocol, instance);
13915 bgp_redistribute_rmap_set (red, argv[2]);
6aeb9e78 13916 return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
13917}
13918
13919DEFUN (bgp_redistribute_ipv4_ospf_metric,
13920 bgp_redistribute_ipv4_ospf_metric_cmd,
7a4bb9c5 13921 "redistribute (ospf|table) <1-65535> metric <0-4294967295>",
7c8ff89e
DS
13922 "Redistribute information from another routing protocol\n"
13923 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13924 "Non-main Kernel Routing Table\n"
13925 "Instance ID/Table ID\n"
7c8ff89e
DS
13926 "Metric for redistributed routes\n"
13927 "Default metric\n")
13928{
13929 u_int32_t metric;
13930 struct bgp_redist *red;
13931 u_short instance;
7a4bb9c5 13932 int protocol;
7c8ff89e 13933
7a4bb9c5
DS
13934 if (strncmp(argv[0], "o", 1) == 0)
13935 protocol = ZEBRA_ROUTE_OSPF;
13936 else
13937 protocol = ZEBRA_ROUTE_TABLE;
7c8ff89e 13938
7a4bb9c5
DS
13939 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
13940 VTY_GET_INTEGER ("metric", metric, argv[2]);
13941
13942 red = bgp_redist_add(vty->index, AFI_IP, protocol, instance);
caf958b4 13943 bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric);
6aeb9e78 13944 return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
13945}
13946
13947DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric,
13948 bgp_redistribute_ipv4_ospf_rmap_metric_cmd,
7a4bb9c5 13949 "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>",
7c8ff89e
DS
13950 "Redistribute information from another routing protocol\n"
13951 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13952 "Non-main Kernel Routing Table\n"
13953 "Instance ID/Table ID\n"
7c8ff89e
DS
13954 "Route map reference\n"
13955 "Pointer to route-map entries\n"
13956 "Metric for redistributed routes\n"
13957 "Default metric\n")
13958{
13959 u_int32_t metric;
13960 struct bgp_redist *red;
13961 u_short instance;
7a4bb9c5 13962 int protocol;
7c8ff89e 13963
7a4bb9c5
DS
13964 if (strncmp(argv[0], "o", 1) == 0)
13965 protocol = ZEBRA_ROUTE_OSPF;
13966 else
13967 protocol = ZEBRA_ROUTE_TABLE;
7c8ff89e 13968
7a4bb9c5
DS
13969 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
13970 VTY_GET_INTEGER ("metric", metric, argv[3]);
13971
13972 red = bgp_redist_add(vty->index, AFI_IP, protocol, instance);
13973 bgp_redistribute_rmap_set (red, argv[2]);
caf958b4 13974 bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric);
6aeb9e78 13975 return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
13976}
13977
13978DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap,
13979 bgp_redistribute_ipv4_ospf_metric_rmap_cmd,
7a4bb9c5 13980 "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD",
7c8ff89e
DS
13981 "Redistribute information from another routing protocol\n"
13982 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13983 "Non-main Kernel Routing Table\n"
13984 "Instance ID/Table ID\n"
7c8ff89e
DS
13985 "Metric for redistributed routes\n"
13986 "Default metric\n"
13987 "Route map reference\n"
13988 "Pointer to route-map entries\n")
13989{
13990 u_int32_t metric;
13991 struct bgp_redist *red;
13992 u_short instance;
7a4bb9c5 13993 int protocol;
7c8ff89e 13994
7a4bb9c5
DS
13995 if (strncmp(argv[0], "o", 1) == 0)
13996 protocol = ZEBRA_ROUTE_OSPF;
13997 else
13998 protocol = ZEBRA_ROUTE_TABLE;
7c8ff89e 13999
7a4bb9c5
DS
14000 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
14001 VTY_GET_INTEGER ("metric", metric, argv[2]);
14002
14003 red = bgp_redist_add(vty->index, AFI_IP, protocol, instance);
caf958b4 14004 bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric);
7a4bb9c5 14005 bgp_redistribute_rmap_set (red, argv[3]);
6aeb9e78 14006 return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
14007}
14008
14009DEFUN (no_bgp_redistribute_ipv4_ospf,
14010 no_bgp_redistribute_ipv4_ospf_cmd,
7a4bb9c5 14011 "no redistribute (ospf|table) <1-65535>",
7c8ff89e
DS
14012 NO_STR
14013 "Redistribute information from another routing protocol\n"
14014 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
14015 "Non-main Kernel Routing Table\n"
14016 "Instance ID/Table ID\n")
7c8ff89e
DS
14017{
14018 u_short instance;
7a4bb9c5
DS
14019 int protocol;
14020
14021 if (strncmp(argv[0], "o", 1) == 0)
14022 protocol = ZEBRA_ROUTE_OSPF;
14023 else
14024 protocol = ZEBRA_ROUTE_TABLE;
7c8ff89e 14025
7a4bb9c5
DS
14026 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
14027 return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
14028}
14029
14030ALIAS (no_bgp_redistribute_ipv4_ospf,
14031 no_bgp_redistribute_ipv4_ospf_rmap_cmd,
7a4bb9c5 14032 "no redistribute (ospf|table) <1-65535> route-map WORD",
7c8ff89e
DS
14033 NO_STR
14034 "Redistribute information from another routing protocol\n"
14035 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
14036 "Non-main Kernel Routing Table\n"
14037 "Instance ID/Table ID\n"
7c8ff89e
DS
14038 "Route map reference\n"
14039 "Pointer to route-map entries\n")
14040
14041ALIAS (no_bgp_redistribute_ipv4_ospf,
14042 no_bgp_redistribute_ipv4_ospf_metric_cmd,
7a4bb9c5 14043 "no redistribute (ospf|table) <1-65535> metric <0-4294967295>",
7c8ff89e
DS
14044 NO_STR
14045 "Redistribute information from another routing protocol\n"
14046 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
14047 "Non-main Kernel Routing Table\n"
14048 "Instance ID/Table ID\n"
7c8ff89e
DS
14049 "Metric for redistributed routes\n"
14050 "Default metric\n")
14051
14052ALIAS (no_bgp_redistribute_ipv4_ospf,
14053 no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd,
7a4bb9c5 14054 "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>",
7c8ff89e
DS
14055 NO_STR
14056 "Redistribute information from another routing protocol\n"
14057 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
14058 "Non-main Kernel Routing Table\n"
14059 "Instance ID/Table ID\n"
7c8ff89e
DS
14060 "Route map reference\n"
14061 "Pointer to route-map entries\n"
14062 "Metric for redistributed routes\n"
14063 "Default metric\n")
14064
14065ALIAS (no_bgp_redistribute_ipv4_ospf,
14066 no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd,
7a4bb9c5 14067 "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD",
7c8ff89e
DS
14068 NO_STR
14069 "Redistribute information from another routing protocol\n"
14070 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
14071 "Non-main Kernel Routing Table\n"
14072 "Instance ID/Table ID\n"
7c8ff89e
DS
14073 "Metric for redistributed routes\n"
14074 "Default metric\n"
14075 "Route map reference\n"
14076 "Pointer to route-map entries\n")
14077
718e3744 14078DEFUN (no_bgp_redistribute_ipv4,
14079 no_bgp_redistribute_ipv4_cmd,
e0ca5fde 14080 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
718e3744 14081 NO_STR
14082 "Redistribute information from another routing protocol\n"
e0ca5fde 14083 QUAGGA_IP_REDIST_HELP_STR_BGPD)
718e3744 14084{
14085 int type;
14086
e0ca5fde
DL
14087 type = proto_redistnum (AFI_IP, argv[0]);
14088 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14089 {
14090 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14091 return CMD_WARNING;
14092 }
7c8ff89e 14093 return bgp_redistribute_unset (vty->index, AFI_IP, type, 0);
718e3744 14094}
14095
503006bc 14096ALIAS (no_bgp_redistribute_ipv4,
718e3744 14097 no_bgp_redistribute_ipv4_rmap_cmd,
e0ca5fde 14098 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
718e3744 14099 NO_STR
14100 "Redistribute information from another routing protocol\n"
e0ca5fde 14101 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 14102 "Route map reference\n"
14103 "Pointer to route-map entries\n")
718e3744 14104
503006bc 14105ALIAS (no_bgp_redistribute_ipv4,
718e3744 14106 no_bgp_redistribute_ipv4_metric_cmd,
e0ca5fde 14107 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 14108 NO_STR
14109 "Redistribute information from another routing protocol\n"
e0ca5fde 14110 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 14111 "Metric for redistributed routes\n"
14112 "Default metric\n")
718e3744 14113
503006bc 14114ALIAS (no_bgp_redistribute_ipv4,
718e3744 14115 no_bgp_redistribute_ipv4_rmap_metric_cmd,
e0ca5fde 14116 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 14117 NO_STR
14118 "Redistribute information from another routing protocol\n"
e0ca5fde 14119 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 14120 "Route map reference\n"
14121 "Pointer to route-map entries\n"
14122 "Metric for redistributed routes\n"
14123 "Default metric\n")
718e3744 14124
503006bc 14125ALIAS (no_bgp_redistribute_ipv4,
718e3744 14126 no_bgp_redistribute_ipv4_metric_rmap_cmd,
e0ca5fde 14127 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 14128 NO_STR
14129 "Redistribute information from another routing protocol\n"
e0ca5fde 14130 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 14131 "Metric for redistributed routes\n"
14132 "Default metric\n"
14133 "Route map reference\n"
14134 "Pointer to route-map entries\n")
6b0655a2 14135
718e3744 14136#ifdef HAVE_IPV6
14137DEFUN (bgp_redistribute_ipv6,
14138 bgp_redistribute_ipv6_cmd,
e0ca5fde 14139 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
718e3744 14140 "Redistribute information from another routing protocol\n"
e0ca5fde 14141 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
718e3744 14142{
14143 int type;
14144
e0ca5fde
DL
14145 type = proto_redistnum (AFI_IP6, argv[0]);
14146 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14147 {
14148 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14149 return CMD_WARNING;
14150 }
14151
7c8ff89e 14152 bgp_redist_add(vty->index, AFI_IP6, type, 0);
6aeb9e78 14153 return bgp_redistribute_set (vty->index, AFI_IP6, type, 0);
718e3744 14154}
14155
14156DEFUN (bgp_redistribute_ipv6_rmap,
14157 bgp_redistribute_ipv6_rmap_cmd,
e0ca5fde 14158 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
718e3744 14159 "Redistribute information from another routing protocol\n"
e0ca5fde 14160 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14161 "Route map reference\n"
14162 "Pointer to route-map entries\n")
14163{
14164 int type;
7c8ff89e 14165 struct bgp_redist *red;
718e3744 14166
e0ca5fde
DL
14167 type = proto_redistnum (AFI_IP6, argv[0]);
14168 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14169 {
14170 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14171 return CMD_WARNING;
14172 }
14173
7c8ff89e
DS
14174 red = bgp_redist_add(vty->index, AFI_IP6, type, 0);
14175 bgp_redistribute_rmap_set (red, argv[1]);
6aeb9e78 14176 return bgp_redistribute_set (vty->index, AFI_IP6, type, 0);
718e3744 14177}
14178
14179DEFUN (bgp_redistribute_ipv6_metric,
14180 bgp_redistribute_ipv6_metric_cmd,
e0ca5fde 14181 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 14182 "Redistribute information from another routing protocol\n"
e0ca5fde 14183 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14184 "Metric for redistributed routes\n"
14185 "Default metric\n")
14186{
14187 int type;
14188 u_int32_t metric;
7c8ff89e 14189 struct bgp_redist *red;
718e3744 14190
e0ca5fde
DL
14191 type = proto_redistnum (AFI_IP6, argv[0]);
14192 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14193 {
14194 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14195 return CMD_WARNING;
14196 }
14197 VTY_GET_INTEGER ("metric", metric, argv[1]);
14198
7c8ff89e 14199 red = bgp_redist_add(vty->index, AFI_IP6, type, 0);
caf958b4 14200 bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric);
6aeb9e78 14201 return bgp_redistribute_set (vty->index, AFI_IP6, type, 0);
718e3744 14202}
14203
14204DEFUN (bgp_redistribute_ipv6_rmap_metric,
14205 bgp_redistribute_ipv6_rmap_metric_cmd,
e0ca5fde 14206 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 14207 "Redistribute information from another routing protocol\n"
e0ca5fde 14208 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14209 "Route map reference\n"
14210 "Pointer to route-map entries\n"
14211 "Metric for redistributed routes\n"
14212 "Default metric\n")
14213{
14214 int type;
14215 u_int32_t metric;
7c8ff89e 14216 struct bgp_redist *red;
718e3744 14217
e0ca5fde
DL
14218 type = proto_redistnum (AFI_IP6, argv[0]);
14219 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14220 {
14221 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14222 return CMD_WARNING;
14223 }
14224 VTY_GET_INTEGER ("metric", metric, argv[2]);
14225
7c8ff89e
DS
14226 red = bgp_redist_add(vty->index, AFI_IP6, type, 0);
14227 bgp_redistribute_rmap_set (red, argv[1]);
caf958b4 14228 bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric);
6aeb9e78 14229 return bgp_redistribute_set (vty->index, AFI_IP6, type, 0);
718e3744 14230}
14231
14232DEFUN (bgp_redistribute_ipv6_metric_rmap,
14233 bgp_redistribute_ipv6_metric_rmap_cmd,
e0ca5fde 14234 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 14235 "Redistribute information from another routing protocol\n"
e0ca5fde 14236 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14237 "Metric for redistributed routes\n"
14238 "Default metric\n"
14239 "Route map reference\n"
14240 "Pointer to route-map entries\n")
14241{
14242 int type;
14243 u_int32_t metric;
7c8ff89e 14244 struct bgp_redist *red;
718e3744 14245
e0ca5fde
DL
14246 type = proto_redistnum (AFI_IP6, argv[0]);
14247 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14248 {
14249 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14250 return CMD_WARNING;
14251 }
14252 VTY_GET_INTEGER ("metric", metric, argv[1]);
14253
7c8ff89e 14254 red = bgp_redist_add(vty->index, AFI_IP6, type, 0);
caf958b4 14255 bgp_redistribute_metric_set(vty->index, red, AFI_IP6, SAFI_UNICAST, metric);
7c8ff89e 14256 bgp_redistribute_rmap_set (red, argv[2]);
6aeb9e78 14257 return bgp_redistribute_set (vty->index, AFI_IP6, type, 0);
718e3744 14258}
14259
14260DEFUN (no_bgp_redistribute_ipv6,
14261 no_bgp_redistribute_ipv6_cmd,
e0ca5fde 14262 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
718e3744 14263 NO_STR
14264 "Redistribute information from another routing protocol\n"
e0ca5fde 14265 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
718e3744 14266{
14267 int type;
14268
e0ca5fde
DL
14269 type = proto_redistnum (AFI_IP6, argv[0]);
14270 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14271 {
14272 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14273 return CMD_WARNING;
14274 }
14275
7c8ff89e 14276 return bgp_redistribute_unset (vty->index, AFI_IP6, type, 0);
718e3744 14277}
14278
503006bc 14279ALIAS (no_bgp_redistribute_ipv6,
718e3744 14280 no_bgp_redistribute_ipv6_rmap_cmd,
e0ca5fde 14281 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
718e3744 14282 NO_STR
14283 "Redistribute information from another routing protocol\n"
e0ca5fde 14284 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14285 "Route map reference\n"
14286 "Pointer to route-map entries\n")
718e3744 14287
503006bc 14288ALIAS (no_bgp_redistribute_ipv6,
718e3744 14289 no_bgp_redistribute_ipv6_metric_cmd,
e0ca5fde 14290 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 14291 NO_STR
14292 "Redistribute information from another routing protocol\n"
e0ca5fde 14293 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14294 "Metric for redistributed routes\n"
14295 "Default metric\n")
718e3744 14296
503006bc 14297ALIAS (no_bgp_redistribute_ipv6,
718e3744 14298 no_bgp_redistribute_ipv6_rmap_metric_cmd,
e0ca5fde 14299 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 14300 NO_STR
14301 "Redistribute information from another routing protocol\n"
e0ca5fde 14302 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14303 "Route map reference\n"
14304 "Pointer to route-map entries\n"
14305 "Metric for redistributed routes\n"
14306 "Default metric\n")
718e3744 14307
503006bc 14308ALIAS (no_bgp_redistribute_ipv6,
718e3744 14309 no_bgp_redistribute_ipv6_metric_rmap_cmd,
e0ca5fde 14310 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 14311 NO_STR
14312 "Redistribute information from another routing protocol\n"
e0ca5fde 14313 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14314 "Metric for redistributed routes\n"
14315 "Default metric\n"
14316 "Route map reference\n"
14317 "Pointer to route-map entries\n")
14318#endif /* HAVE_IPV6 */
6b0655a2 14319
718e3744 14320int
14321bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
14322 safi_t safi, int *write)
14323{
14324 int i;
718e3744 14325
14326 /* Unicast redistribution only. */
14327 if (safi != SAFI_UNICAST)
14328 return 0;
14329
14330 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
14331 {
14332 /* Redistribute BGP does not make sense. */
7c8ff89e 14333 if (i != ZEBRA_ROUTE_BGP)
718e3744 14334 {
7c8ff89e
DS
14335 struct list *red_list;
14336 struct listnode *node;
14337 struct bgp_redist *red;
718e3744 14338
7c8ff89e
DS
14339 red_list = bgp->redist[afi][i];
14340 if (!red_list)
14341 continue;
718e3744 14342
7c8ff89e
DS
14343 for (ALL_LIST_ELEMENTS_RO(red_list, node, red))
14344 {
14345 /* Display "address-family" when it is not yet diplayed. */
14346 bgp_config_write_family_header (vty, afi, safi, write);
14347
14348 /* "redistribute" configuration. */
0b960b4d 14349 vty_out (vty, " redistribute %s", zebra_route_string(i));
7c8ff89e
DS
14350 if (red->instance)
14351 vty_out (vty, " %d", red->instance);
14352 if (red->redist_metric_flag)
14353 vty_out (vty, " metric %u", red->redist_metric);
14354 if (red->rmap.name)
14355 vty_out (vty, " route-map %s", red->rmap.name);
14356 vty_out (vty, "%s", VTY_NEWLINE);
14357 }
718e3744 14358 }
14359 }
14360 return *write;
14361}
6b0655a2 14362
718e3744 14363/* BGP node structure. */
7fc626de 14364static struct cmd_node bgp_node =
718e3744 14365{
14366 BGP_NODE,
14367 "%s(config-router)# ",
14368 1,
14369};
14370
7fc626de 14371static struct cmd_node bgp_ipv4_unicast_node =
718e3744 14372{
14373 BGP_IPV4_NODE,
14374 "%s(config-router-af)# ",
14375 1,
14376};
14377
7fc626de 14378static struct cmd_node bgp_ipv4_multicast_node =
718e3744 14379{
14380 BGP_IPV4M_NODE,
14381 "%s(config-router-af)# ",
14382 1,
14383};
14384
7fc626de 14385static struct cmd_node bgp_ipv6_unicast_node =
718e3744 14386{
14387 BGP_IPV6_NODE,
14388 "%s(config-router-af)# ",
14389 1,
14390};
14391
7fc626de 14392static struct cmd_node bgp_ipv6_multicast_node =
25ffbdc1 14393{
14394 BGP_IPV6M_NODE,
14395 "%s(config-router-af)# ",
14396 1,
14397};
14398
7fc626de 14399static struct cmd_node bgp_vpnv4_node =
718e3744 14400{
14401 BGP_VPNV4_NODE,
14402 "%s(config-router-af)# ",
14403 1
14404};
6b0655a2 14405
8ecd3266 14406static struct cmd_node bgp_vpnv6_node =
14407{
14408 BGP_VPNV6_NODE,
14409 "%s(config-router-af-vpnv6)# ",
14410 1
14411};
14412
8b1fb8be
LB
14413static struct cmd_node bgp_encap_node =
14414{
14415 BGP_ENCAP_NODE,
14416 "%s(config-router-af-encap)# ",
14417 1
14418};
14419
14420static struct cmd_node bgp_encapv6_node =
14421{
14422 BGP_ENCAPV6_NODE,
14423 "%s(config-router-af-encapv6)# ",
14424 1
14425};
14426
1f8ae70b 14427static void community_list_vty (void);
14428
718e3744 14429void
94f2b392 14430bgp_vty_init (void)
718e3744 14431{
718e3744 14432 /* Install bgp top node. */
14433 install_node (&bgp_node, bgp_config_write);
14434 install_node (&bgp_ipv4_unicast_node, NULL);
14435 install_node (&bgp_ipv4_multicast_node, NULL);
14436 install_node (&bgp_ipv6_unicast_node, NULL);
25ffbdc1 14437 install_node (&bgp_ipv6_multicast_node, NULL);
718e3744 14438 install_node (&bgp_vpnv4_node, NULL);
8ecd3266 14439 install_node (&bgp_vpnv6_node, NULL);
8b1fb8be
LB
14440 install_node (&bgp_encap_node, NULL);
14441 install_node (&bgp_encapv6_node, NULL);
718e3744 14442
14443 /* Install default VTY commands to new nodes. */
14444 install_default (BGP_NODE);
14445 install_default (BGP_IPV4_NODE);
14446 install_default (BGP_IPV4M_NODE);
14447 install_default (BGP_IPV6_NODE);
25ffbdc1 14448 install_default (BGP_IPV6M_NODE);
718e3744 14449 install_default (BGP_VPNV4_NODE);
8ecd3266 14450 install_default (BGP_VPNV6_NODE);
8b1fb8be
LB
14451 install_default (BGP_ENCAP_NODE);
14452 install_default (BGP_ENCAPV6_NODE);
718e3744 14453
14454 /* "bgp multiple-instance" commands. */
14455 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
14456 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
14457
14458 /* "bgp config-type" commands. */
14459 install_element (CONFIG_NODE, &bgp_config_type_cmd);
813d4307 14460 install_element (CONFIG_NODE, &no_bgp_config_type_val_cmd);
718e3744 14461
5fe9f963 14462 /* bgp route-map delay-timer commands. */
14463 install_element (CONFIG_NODE, &bgp_set_route_map_delay_timer_cmd);
14464 install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_cmd);
14465 install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_val_cmd);
14466
718e3744 14467 /* Dummy commands (Currently not supported) */
14468 install_element (BGP_NODE, &no_synchronization_cmd);
14469 install_element (BGP_NODE, &no_auto_summary_cmd);
14470
14471 /* "router bgp" commands. */
14472 install_element (CONFIG_NODE, &router_bgp_cmd);
6aeb9e78 14473 install_element (CONFIG_NODE, &router_bgp_instance_cmd);
2385a876 14474 install_element (CONFIG_NODE, &router_bgp_noasn_cmd);
718e3744 14475
14476 /* "no router bgp" commands. */
14477 install_element (CONFIG_NODE, &no_router_bgp_cmd);
6aeb9e78 14478 install_element (CONFIG_NODE, &no_router_bgp_instance_cmd);
7fb21a9f 14479 install_element (CONFIG_NODE, &no_router_bgp_noasn_cmd);
718e3744 14480
14481 /* "bgp router-id" commands. */
14482 install_element (BGP_NODE, &bgp_router_id_cmd);
14483 install_element (BGP_NODE, &no_bgp_router_id_cmd);
14484 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
14485
14486 /* "bgp cluster-id" commands. */
14487 install_element (BGP_NODE, &bgp_cluster_id_cmd);
14488 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
14489 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
813d4307
DW
14490 install_element (BGP_NODE, &no_bgp_cluster_id_ip_cmd);
14491 install_element (BGP_NODE, &no_bgp_cluster_id_decimal_cmd);
718e3744 14492
14493 /* "bgp confederation" commands. */
14494 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
14495 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
14496 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
14497
14498 /* "bgp confederation peers" commands. */
14499 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
14500 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
14501
abc920f8
DS
14502 /* bgp max-med command */
14503 install_element (BGP_NODE, &bgp_maxmed_admin_cmd);
14504 install_element (BGP_NODE, &no_bgp_maxmed_admin_cmd);
14505 install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd);
14506 install_element (BGP_NODE, &no_bgp_maxmed_admin_medv_cmd);
14507 install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd);
14508 install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd);
14509 install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_cmd);
14510 install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd);
14511 install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_medv_cmd);
14512
907f92c8
DS
14513 /* bgp disable-ebgp-connected-nh-check */
14514 install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd);
14515 install_element (BGP_NODE, &no_bgp_disable_connected_route_check_cmd);
14516
f188f2c4
DS
14517 /* bgp update-delay command */
14518 install_element (BGP_NODE, &bgp_update_delay_cmd);
14519 install_element (BGP_NODE, &no_bgp_update_delay_cmd);
14520 install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd);
14521 install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd);
14522
cb1faec9
DS
14523 install_element (BGP_NODE, &bgp_wpkt_quanta_cmd);
14524 install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd);
14525
3f9c7369
DS
14526 install_element (BGP_NODE, &bgp_coalesce_time_cmd);
14527 install_element (BGP_NODE, &no_bgp_coalesce_time_cmd);
14528
165b5fff
JB
14529 /* "maximum-paths" commands. */
14530 install_element (BGP_NODE, &bgp_maxpaths_cmd);
14531 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
14532 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
14533 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
14534 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
14535 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
431aa9f9
DS
14536 install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd);
14537 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd);
14538 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd);
165b5fff 14539 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
5e242b0d 14540 install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd);
165b5fff
JB
14541 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
14542 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
5e242b0d 14543 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 14544 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
5e242b0d 14545 install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 14546 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
5e242b0d 14547 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 14548 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
431aa9f9 14549 install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd);
5e242b0d 14550 install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd);
431aa9f9
DS
14551 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd);
14552 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
5e242b0d 14553 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 14554
718e3744 14555 /* "timers bgp" commands. */
14556 install_element (BGP_NODE, &bgp_timers_cmd);
14557 install_element (BGP_NODE, &no_bgp_timers_cmd);
14558 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
14559
5fe9f963 14560 /* route-map delay-timer commands - per instance for backwards compat. */
518f0eb1
DS
14561 install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd);
14562 install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd);
f414725f 14563 install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_val_cmd);
518f0eb1 14564
718e3744 14565 /* "bgp client-to-client reflection" commands */
14566 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
14567 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
14568
14569 /* "bgp always-compare-med" commands */
14570 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
14571 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
14572
14573 /* "bgp deterministic-med" commands */
14574 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
14575 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
538621f2 14576
538621f2 14577 /* "bgp graceful-restart" commands */
14578 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
14579 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
93406d87 14580 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
14581 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
14582 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
eb6f1b41
PG
14583 install_element (BGP_NODE, &bgp_graceful_restart_restart_time_cmd);
14584 install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_cmd);
14585 install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_val_cmd);
718e3744 14586
14587 /* "bgp fast-external-failover" commands */
14588 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
14589 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
14590
14591 /* "bgp enforce-first-as" commands */
14592 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
14593 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
14594
14595 /* "bgp bestpath compare-routerid" commands */
14596 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
14597 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
14598
14599 /* "bgp bestpath as-path ignore" commands */
14600 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
14601 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
14602
6811845b 14603 /* "bgp bestpath as-path confed" commands */
14604 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
14605 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
14606
2fdd455c
PM
14607 /* "bgp bestpath as-path multipath-relax" commands */
14608 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
14609 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
14610
848973c7 14611 /* "bgp log-neighbor-changes" commands */
14612 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
14613 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
14614
718e3744 14615 /* "bgp bestpath med" commands */
14616 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
14617 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
14618 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
14619 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
14620 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
14621 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
14622
14623 /* "no bgp default ipv4-unicast" commands. */
14624 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
14625 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
14626
14627 /* "bgp network import-check" commands. */
14628 install_element (BGP_NODE, &bgp_network_import_check_cmd);
8233ef81 14629 install_element (BGP_NODE, &bgp_network_import_check_exact_cmd);
718e3744 14630 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
14631
14632 /* "bgp default local-preference" commands. */
14633 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
14634 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
14635 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
14636
04b6bdc0
DW
14637 /* bgp default show-hostname */
14638 install_element (BGP_NODE, &bgp_default_show_hostname_cmd);
14639 install_element (BGP_NODE, &no_bgp_default_show_hostname_cmd);
14640
3f9c7369
DS
14641 /* "bgp default subgroup-pkt-queue-max" commands. */
14642 install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd);
14643 install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd);
813d4307 14644 install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_val_cmd);
3f9c7369 14645
8bd9d948
DS
14646 /* bgp ibgp-allow-policy-mods command */
14647 install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd);
14648 install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd);
14649
f14e6fdb
DS
14650 /* "bgp listen limit" commands. */
14651 install_element (BGP_NODE, &bgp_listen_limit_cmd);
14652 install_element (BGP_NODE, &no_bgp_listen_limit_cmd);
813d4307 14653 install_element (BGP_NODE, &no_bgp_listen_limit_val_cmd);
f14e6fdb
DS
14654
14655 /* "bgp listen range" commands. */
14656 install_element (BGP_NODE, &bgp_listen_range_cmd);
14657 install_element (BGP_NODE, &no_bgp_listen_range_cmd);
14658
718e3744 14659 /* "neighbor remote-as" commands. */
14660 install_element (BGP_NODE, &neighbor_remote_as_cmd);
a80beece 14661 install_element (BGP_NODE, &neighbor_interface_config_cmd);
4c48cf63
DW
14662 install_element (BGP_NODE, &neighbor_interface_config_v6only_cmd);
14663 install_element (BGP_NODE, &neighbor_interface_config_peergroup_cmd);
14664 install_element (BGP_NODE, &neighbor_interface_config_v6only_peergroup_cmd);
b3a39dc5
DD
14665 install_element (BGP_NODE, &neighbor_interface_config_remote_as_cmd);
14666 install_element (BGP_NODE, &neighbor_interface_v6only_config_remote_as_cmd);
718e3744 14667 install_element (BGP_NODE, &no_neighbor_cmd);
14668 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
a80beece 14669 install_element (BGP_NODE, &no_neighbor_interface_config_cmd);
4c48cf63
DW
14670 install_element (BGP_NODE, &no_neighbor_interface_config_v6only_cmd);
14671 install_element (BGP_NODE, &no_neighbor_interface_config_peergroup_cmd);
14672 install_element (BGP_NODE, &no_neighbor_interface_config_v6only_peergroup_cmd);
b3a39dc5
DD
14673 install_element (BGP_NODE, &no_neighbor_interface_config_remote_as_cmd);
14674 install_element (BGP_NODE, &no_neighbor_interface_config_v6only_remote_as_cmd);
718e3744 14675
14676 /* "neighbor peer-group" commands. */
14677 install_element (BGP_NODE, &neighbor_peer_group_cmd);
14678 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
a80beece 14679 install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd);
718e3744 14680
14681 /* "neighbor local-as" commands. */
14682 install_element (BGP_NODE, &neighbor_local_as_cmd);
14683 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
9d3f9705 14684 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
718e3744 14685 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
14686 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
14687 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
9d3f9705 14688 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
718e3744 14689
3f9c7369
DS
14690 /* "neighbor solo" commands. */
14691 install_element (BGP_NODE, &neighbor_solo_cmd);
14692 install_element (BGP_NODE, &no_neighbor_solo_cmd);
14693
0df7c91f
PJ
14694 /* "neighbor password" commands. */
14695 install_element (BGP_NODE, &neighbor_password_cmd);
14696 install_element (BGP_NODE, &no_neighbor_password_cmd);
813d4307 14697 install_element (BGP_NODE, &no_neighbor_password_val_cmd);
0df7c91f 14698
718e3744 14699 /* "neighbor activate" commands. */
14700 install_element (BGP_NODE, &neighbor_activate_cmd);
14701 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
14702 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
14703 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
25ffbdc1 14704 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
718e3744 14705 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
8ecd3266 14706 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
8b1fb8be
LB
14707 install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd);
14708 install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd);
718e3744 14709
14710 /* "no neighbor activate" commands. */
14711 install_element (BGP_NODE, &no_neighbor_activate_cmd);
14712 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
14713 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
14714 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
25ffbdc1 14715 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
718e3744 14716 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
8ecd3266 14717 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
8b1fb8be
LB
14718 install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd);
14719 install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd);
718e3744 14720
c8560b44
DW
14721 /* "neighbor peer-group" set commands.
14722 * Long term we should only accept this command under BGP_NODE and not all of
14723 * the afi/safi sub-contexts. For now though we need to accept it for backwards
14724 * compatibility. This changed when we stopped requiring that peers be assigned
14725 * to their peer-group under each address-family sub-context.
14726 */
718e3744 14727 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
14728 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
14729 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
14730 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
25ffbdc1 14731 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
a58545bb 14732 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
8ecd3266 14733 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
8b1fb8be
LB
14734 install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd);
14735 install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd);
c8560b44 14736
718e3744 14737 /* "no neighbor peer-group unset" commands. */
14738 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
14739 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
14740 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
14741 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
25ffbdc1 14742 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
a58545bb 14743 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
8ecd3266 14744 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
8b1fb8be
LB
14745 install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd);
14746 install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd);
a58545bb 14747
718e3744 14748 /* "neighbor softreconfiguration inbound" commands.*/
14749 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
14750 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
14751 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
14752 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
14753 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
14754 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
14755 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
14756 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
25ffbdc1 14757 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
14758 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
a58545bb 14759 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
14760 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
8ecd3266 14761 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
14762 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
8b1fb8be
LB
14763 install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd);
14764 install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd);
14765 install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd);
14766 install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
718e3744 14767
14768 /* "neighbor attribute-unchanged" commands. */
14769 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
14770 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
14771 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
14772 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
14773 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
14774 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
14775 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
14776 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
14777 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
14778 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
14779 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
14780 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
14781 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
14782 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
14783 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
14784 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
14785 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
14786 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
14787 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
14788 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
14789 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
14790 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
14791 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
14792 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
14793 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
14794 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
14795 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
14796 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
14797 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
14798 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
14799 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
14800 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
14801 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
14802 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
14803 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
14804 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
14805 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
14806 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
14807 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
14808 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
14809 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
14810 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
14811 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
14812 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
14813 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
14814 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
14815 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
14816 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
14817 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
14818 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
14819 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
14820 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
14821 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
14822 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
14823 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
14824 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
14825 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
14826 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
14827 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
14828 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
14829 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
14830 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
14831 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
14832 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
14833 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
14834 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
14835 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
14836 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
14837 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
14838 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
14839 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
14840 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
14841 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
14842 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
14843 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
14844 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
14845 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
14846 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
14847 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
14848 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
14849 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
14850 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
14851 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
14852 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
14853 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
14854 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
14855 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
14856 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
25ffbdc1 14857 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
14858 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
14859 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
14860 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
14861 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
14862 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
14863 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
14864 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
14865 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
14866 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
14867 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
14868 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
14869 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
14870 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
14871 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
14872 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
14873 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
14874 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
14875 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
14876 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
14877 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
14878 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
718e3744 14879 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
14880 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
14881 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
14882 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
14883 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
14884 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
14885 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
14886 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
14887 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
14888 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
14889 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
14890 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
14891 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
14892 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
14893 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
14894 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
14895 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
14896 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
14897 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
14898 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
14899 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
14900 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
8ecd3266 14901 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
14902 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
14903 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
14904 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
14905 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
14906 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
14907 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
14908 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
14909 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
14910 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
14911 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
14912 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
14913 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
14914 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
14915 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
14916 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
14917 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
14918 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
14919 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
14920 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
14921 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
14922 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
14923
8b1fb8be
LB
14924 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd);
14925 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd);
14926 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd);
14927 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd);
14928 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd);
14929 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd);
14930 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd);
14931 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd);
14932 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd);
14933 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd);
14934 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd);
14935 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd);
14936 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd);
14937 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd);
14938 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd);
14939 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd);
14940 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd);
14941 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd);
14942 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd);
14943 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd);
14944 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd);
14945 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd);
14946
14947 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd);
14948 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd);
14949 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd);
14950 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd);
14951 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd);
14952 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd);
14953 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd);
14954 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd);
14955 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd);
14956 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd);
14957 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd);
14958 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd);
14959 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
14960 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
14961 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
14962 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
14963 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
14964 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
14965 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
14966 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
14967 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
14968 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
718e3744 14969
fee0f4c6 14970 /* "nexthop-local unchanged" commands */
14971 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
14972 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
14973
718e3744 14974 /* "neighbor next-hop-self" commands. */
14975 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
14976 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
14977 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
14978 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
14979 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
14980 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
14981 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
14982 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
25ffbdc1 14983 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
14984 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
718e3744 14985 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
14986 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
8ecd3266 14987 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
14988 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
8b1fb8be
LB
14989 install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd);
14990 install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd);
14991 install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd);
14992 install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd);
718e3744 14993
a538debe
DS
14994 /* "neighbor next-hop-self force" commands. */
14995 install_element (BGP_NODE, &neighbor_nexthop_self_force_cmd);
14996 install_element (BGP_NODE, &no_neighbor_nexthop_self_force_cmd);
14997 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_force_cmd);
14998 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_force_cmd);
14999 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_force_cmd);
15000 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_force_cmd);
15001 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_force_cmd);
15002 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_force_cmd);
15003 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_force_cmd);
15004 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_force_cmd);
15005 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_force_cmd);
15006 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_force_cmd);
8ecd3266 15007 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_force_cmd);
15008 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_force_cmd);
a538debe 15009
c7122e14
DS
15010 /* "neighbor as-override" commands. */
15011 install_element (BGP_NODE, &neighbor_as_override_cmd);
15012 install_element (BGP_NODE, &no_neighbor_as_override_cmd);
15013 install_element (BGP_IPV4_NODE, &neighbor_as_override_cmd);
15014 install_element (BGP_IPV4_NODE, &no_neighbor_as_override_cmd);
15015 install_element (BGP_IPV4M_NODE, &neighbor_as_override_cmd);
15016 install_element (BGP_IPV4M_NODE, &no_neighbor_as_override_cmd);
15017 install_element (BGP_IPV6_NODE, &neighbor_as_override_cmd);
15018 install_element (BGP_IPV6_NODE, &no_neighbor_as_override_cmd);
15019 install_element (BGP_IPV6M_NODE, &neighbor_as_override_cmd);
15020 install_element (BGP_IPV6M_NODE, &no_neighbor_as_override_cmd);
15021 install_element (BGP_VPNV4_NODE, &neighbor_as_override_cmd);
15022 install_element (BGP_VPNV4_NODE, &no_neighbor_as_override_cmd);
8ecd3266 15023 install_element (BGP_VPNV6_NODE, &neighbor_as_override_cmd);
15024 install_element (BGP_VPNV6_NODE, &no_neighbor_as_override_cmd);
c7122e14 15025
718e3744 15026 /* "neighbor remove-private-AS" commands. */
15027 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
15028 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
15029 install_element (BGP_NODE, &neighbor_remove_private_as_all_cmd);
15030 install_element (BGP_NODE, &no_neighbor_remove_private_as_all_cmd);
15031 install_element (BGP_NODE, &neighbor_remove_private_as_replace_as_cmd);
15032 install_element (BGP_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
15033 install_element (BGP_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
15034 install_element (BGP_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
718e3744 15035 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
15036 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
15037 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_cmd);
15038 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_cmd);
15039 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_replace_as_cmd);
15040 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
15041 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
15042 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
718e3744 15043 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
15044 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
15045 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_cmd);
15046 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_cmd);
15047 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_replace_as_cmd);
15048 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
15049 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
15050 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
718e3744 15051 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
15052 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
15053 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_cmd);
15054 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_cmd);
15055 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_replace_as_cmd);
15056 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
15057 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
15058 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
25ffbdc1 15059 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
15060 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
15061 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_cmd);
15062 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_cmd);
15063 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_replace_as_cmd);
15064 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
15065 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
15066 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
718e3744 15067 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
15068 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
15069 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_cmd);
15070 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_cmd);
15071 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_replace_as_cmd);
15072 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
15073 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
15074 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
8ecd3266 15075 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
15076 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
15077 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_cmd);
15078 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_cmd);
15079 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_replace_as_cmd);
15080 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
15081 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
15082 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
8b1fb8be
LB
15083 install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd);
15084 install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd);
15085 install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd);
15086 install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd);
718e3744 15087
15088 /* "neighbor send-community" commands.*/
15089 install_element (BGP_NODE, &neighbor_send_community_cmd);
15090 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
15091 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
15092 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
15093 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
15094 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
15095 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
15096 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
15097 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
15098 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
15099 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
15100 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
15101 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
15102 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
15103 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
15104 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
25ffbdc1 15105 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
15106 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
15107 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
15108 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
718e3744 15109 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
15110 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
15111 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
15112 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
8ecd3266 15113 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
15114 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
15115 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
15116 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
8b1fb8be
LB
15117 install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd);
15118 install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd);
15119 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd);
15120 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd);
15121 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd);
15122 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd);
15123 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd);
15124 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd);
718e3744 15125
15126 /* "neighbor route-reflector" commands.*/
15127 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
15128 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
15129 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
15130 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
15131 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
15132 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
15133 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
15134 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
25ffbdc1 15135 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
15136 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
718e3744 15137 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
15138 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
8ecd3266 15139 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
15140 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
8b1fb8be
LB
15141 install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd);
15142 install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd);
15143 install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd);
15144 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd);
718e3744 15145
15146 /* "neighbor route-server" commands.*/
15147 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
15148 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
15149 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
15150 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
15151 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
15152 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
15153 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
15154 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
25ffbdc1 15155 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
15156 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
718e3744 15157 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
15158 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
8ecd3266 15159 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
15160 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
8b1fb8be
LB
15161 install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd);
15162 install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd);
15163 install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd);
15164 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd);
718e3744 15165
adbac85e
DW
15166 /* "neighbor addpath-tx-all-paths" commands.*/
15167 install_element (BGP_NODE, &neighbor_addpath_tx_all_paths_cmd);
15168 install_element (BGP_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
15169 install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_all_paths_cmd);
15170 install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
15171 install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_all_paths_cmd);
15172 install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
15173 install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_all_paths_cmd);
15174 install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
15175 install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_all_paths_cmd);
15176 install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
15177 install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_all_paths_cmd);
15178 install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
8ecd3266 15179 install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_all_paths_cmd);
15180 install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
adbac85e 15181
06370dac
DW
15182 /* "neighbor addpath-tx-bestpath-per-AS" commands.*/
15183 install_element (BGP_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15184 install_element (BGP_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
15185 install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15186 install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
15187 install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15188 install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
15189 install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15190 install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
15191 install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15192 install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
15193 install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15194 install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
8ecd3266 15195 install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15196 install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
06370dac 15197
718e3744 15198 /* "neighbor passive" commands. */
15199 install_element (BGP_NODE, &neighbor_passive_cmd);
15200 install_element (BGP_NODE, &no_neighbor_passive_cmd);
15201
d5a5c8f0 15202
718e3744 15203 /* "neighbor shutdown" commands. */
15204 install_element (BGP_NODE, &neighbor_shutdown_cmd);
15205 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
15206
8a92a8a0
DS
15207 /* "neighbor capability extended-nexthop" commands.*/
15208 install_element (BGP_NODE, &neighbor_capability_enhe_cmd);
15209 install_element (BGP_NODE, &no_neighbor_capability_enhe_cmd);
15210
718e3744 15211 /* "neighbor capability orf prefix-list" commands.*/
15212 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
15213 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
15214 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
15215 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
15216 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
15217 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
15218 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
15219 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
25ffbdc1 15220 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
15221 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
718e3744 15222
15223 /* "neighbor capability dynamic" commands.*/
15224 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
15225 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
15226
15227 /* "neighbor dont-capability-negotiate" commands. */
15228 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
15229 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
15230
15231 /* "neighbor ebgp-multihop" commands. */
15232 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
15233 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
15234 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
15235 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
15236
6ffd2079 15237 /* "neighbor disable-connected-check" commands. */
15238 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
15239 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
718e3744 15240 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
15241 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
15242
15243 /* "neighbor description" commands. */
15244 install_element (BGP_NODE, &neighbor_description_cmd);
15245 install_element (BGP_NODE, &no_neighbor_description_cmd);
15246 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
15247
15248 /* "neighbor update-source" commands. "*/
15249 install_element (BGP_NODE, &neighbor_update_source_cmd);
15250 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
15251
15252 /* "neighbor default-originate" commands. */
15253 install_element (BGP_NODE, &neighbor_default_originate_cmd);
15254 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
15255 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
15256 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
15257 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
15258 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
15259 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
15260 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
15261 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
15262 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
15263 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
15264 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
15265 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
15266 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
15267 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
15268 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
25ffbdc1 15269 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
15270 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
15271 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
15272 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
718e3744 15273
15274 /* "neighbor port" commands. */
15275 install_element (BGP_NODE, &neighbor_port_cmd);
15276 install_element (BGP_NODE, &no_neighbor_port_cmd);
15277 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
15278
15279 /* "neighbor weight" commands. */
15280 install_element (BGP_NODE, &neighbor_weight_cmd);
15281 install_element (BGP_NODE, &no_neighbor_weight_cmd);
15282 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
15283
15284 /* "neighbor override-capability" commands. */
15285 install_element (BGP_NODE, &neighbor_override_capability_cmd);
15286 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
15287
15288 /* "neighbor strict-capability-match" commands. */
15289 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
15290 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
15291
15292 /* "neighbor timers" commands. */
15293 install_element (BGP_NODE, &neighbor_timers_cmd);
15294 install_element (BGP_NODE, &no_neighbor_timers_cmd);
813d4307 15295 install_element (BGP_NODE, &no_neighbor_timers_val_cmd);
718e3744 15296
15297 /* "neighbor timers connect" commands. */
15298 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
15299 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
15300 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
15301
15302 /* "neighbor advertisement-interval" commands. */
15303 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
15304 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
15305 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
15306
718e3744 15307 /* "neighbor interface" commands. */
15308 install_element (BGP_NODE, &neighbor_interface_cmd);
15309 install_element (BGP_NODE, &no_neighbor_interface_cmd);
15310
15311 /* "neighbor distribute" commands. */
15312 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
15313 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
15314 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
15315 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
15316 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
15317 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
15318 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
15319 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
25ffbdc1 15320 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
15321 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
718e3744 15322 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
15323 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
8ecd3266 15324 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
15325 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
8b1fb8be
LB
15326 install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd);
15327 install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd);
15328 install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd);
15329 install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd);
718e3744 15330
15331 /* "neighbor prefix-list" commands. */
15332 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
15333 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
15334 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
15335 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
15336 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
15337 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
15338 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
15339 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
25ffbdc1 15340 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
15341 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
718e3744 15342 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
15343 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
8ecd3266 15344 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
15345 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
8b1fb8be
LB
15346 install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd);
15347 install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd);
15348 install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd);
15349 install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd);
718e3744 15350
15351 /* "neighbor filter-list" commands. */
15352 install_element (BGP_NODE, &neighbor_filter_list_cmd);
15353 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
15354 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
15355 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
15356 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
15357 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
15358 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
15359 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
25ffbdc1 15360 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
15361 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
718e3744 15362 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
15363 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
8ecd3266 15364 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
15365 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
8b1fb8be
LB
15366 install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd);
15367 install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd);
15368 install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd);
15369 install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd);
718e3744 15370
15371 /* "neighbor route-map" commands. */
15372 install_element (BGP_NODE, &neighbor_route_map_cmd);
15373 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
15374 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
15375 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
15376 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
15377 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
15378 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
15379 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
25ffbdc1 15380 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
15381 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
718e3744 15382 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
15383 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
8ecd3266 15384 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
15385 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
8b1fb8be
LB
15386 install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd);
15387 install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd);
15388 install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd);
15389 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd);
718e3744 15390
15391 /* "neighbor unsuppress-map" commands. */
15392 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
15393 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
15394 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
15395 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
15396 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
15397 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
15398 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
15399 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
25ffbdc1 15400 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
15401 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
a58545bb 15402 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
bb86c601 15403 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
8ecd3266 15404 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
bb86c601 15405 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
8b1fb8be
LB
15406 install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd);
15407 install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd);
15408 install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd);
15409 install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd);
718e3744 15410
15411 /* "neighbor maximum-prefix" commands. */
15412 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 15413 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 15414 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 15415 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 15416 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
15417 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15418 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
15419 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 15420 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15421 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15422 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15423 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15424 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15425 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 15426 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 15427 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 15428 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 15429 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
15430 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15431 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
15432 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 15433 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15434 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15435 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15436 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15437 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15438 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 15439 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 15440 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 15441 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 15442 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
15443 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15444 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
15445 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 15446 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15447 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15448 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15449 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15450 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15451 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 15452 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 15453 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 15454 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 15455 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
15456 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15457 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
15458 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 15459 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15460 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15461 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15462 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15463 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
25ffbdc1 15464 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
15465 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
15466 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
15467 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
15468 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
15469 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
15470 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
15471 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
15472 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15473 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15474 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15475 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15476 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15477 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 15478 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 15479 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 15480 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 15481 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
15482 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15483 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
15484 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 15485 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15486 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15487 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15488 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15489 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
8ecd3266 15490 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
15491 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
15492 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
15493 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
15494 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
15495 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
15496 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
15497 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
15498 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15499 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15500 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15501 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15502 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15503
8b1fb8be
LB
15504 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd);
15505 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd);
15506 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd);
15507 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
15508 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd);
15509 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
15510 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd);
15511 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd);
15512 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15513 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15514 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15515 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15516 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
15517
15518 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd);
15519 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
15520 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
15521 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
15522 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
15523 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
15524 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd);
15525 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
15526 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15527 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15528 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15529 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15530 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
15531
718e3744 15532 /* "neighbor allowas-in" */
15533 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
15534 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
15535 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15536 install_element (BGP_NODE, &no_neighbor_allowas_in_val_cmd);
718e3744 15537 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
15538 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
15539 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15540 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_val_cmd);
718e3744 15541 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
15542 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
15543 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15544 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_val_cmd);
718e3744 15545 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
15546 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
15547 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15548 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_val_cmd);
25ffbdc1 15549 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
15550 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
15551 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15552 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_val_cmd);
718e3744 15553 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
15554 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
15555 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15556 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_val_cmd);
8ecd3266 15557 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
15558 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
15559 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
15560 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_val_cmd);
8b1fb8be
LB
15561 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd);
15562 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd);
15563 install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd);
15564 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd);
15565 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd);
15566 install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd);
718e3744 15567
15568 /* address-family commands. */
15569 install_element (BGP_NODE, &address_family_ipv4_cmd);
15570 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
15571#ifdef HAVE_IPV6
15572 install_element (BGP_NODE, &address_family_ipv6_cmd);
25ffbdc1 15573 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
718e3744 15574#endif /* HAVE_IPV6 */
15575 install_element (BGP_NODE, &address_family_vpnv4_cmd);
15576 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
15577
8b1fb8be
LB
15578 install_element (BGP_NODE, &address_family_vpnv6_cmd);
15579 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
15580
15581 install_element (BGP_NODE, &address_family_encap_cmd);
15582 install_element (BGP_NODE, &address_family_encapv4_cmd);
15583#ifdef HAVE_IPV6
15584 install_element (BGP_NODE, &address_family_encapv6_cmd);
15585#endif
15586
718e3744 15587 /* "exit-address-family" command. */
15588 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
15589 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
15590 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
25ffbdc1 15591 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
718e3744 15592 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
8ecd3266 15593 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
8b1fb8be
LB
15594 install_element (BGP_ENCAP_NODE, &exit_address_family_cmd);
15595 install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd);
718e3744 15596
15597 /* "clear ip bgp commands" */
15598 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
15599 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
15600 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
01080f7c 15601 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_cmd);
718e3744 15602 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
01080f7c 15603 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_cmd);
718e3744 15604 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
01080f7c 15605 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_cmd);
718e3744 15606 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
01080f7c 15607 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_cmd);
15608
718e3744 15609 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
15610 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
15611 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
01080f7c 15612 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_cmd);
718e3744 15613 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
01080f7c 15614 install_element (ENABLE_NODE, &clear_bgp_instance_peer_cmd);
718e3744 15615 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
01080f7c 15616 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_cmd);
718e3744 15617 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
01080f7c 15618 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_cmd);
718e3744 15619 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
01080f7c 15620 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_cmd);
718e3744 15621 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
01080f7c 15622 install_element (ENABLE_NODE, &clear_bgp_instance_external_cmd);
718e3744 15623 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
01080f7c 15624 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_cmd);
718e3744 15625 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
01080f7c 15626 install_element (ENABLE_NODE, &clear_bgp_instance_as_cmd);
718e3744 15627 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
01080f7c 15628 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_cmd);
718e3744 15629
15630 /* "clear ip bgp neighbor soft in" */
15631 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
15632 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
15633 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
01080f7c 15634 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_cmd);
718e3744 15635 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
718e3744 15636 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
01080f7c 15637 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_in_cmd);
718e3744 15638 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
01080f7c 15639 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_in_cmd);
718e3744 15640 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
15641 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
01080f7c 15642 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_in_cmd);
718e3744 15643 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
01080f7c 15644 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_in_cmd);
718e3744 15645 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
15646 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
01080f7c 15647 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_in_cmd);
718e3744 15648 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
01080f7c 15649 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_in_cmd);
718e3744 15650 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
15651 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
01080f7c 15652 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_in_cmd);
718e3744 15653 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
01080f7c 15654 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_in_cmd);
718e3744 15655 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
15656 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
15657 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
15658 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
01080f7c 15659 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_cmd);
718e3744 15660 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
718e3744 15661 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
01080f7c 15662 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_in_cmd);
718e3744 15663 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
01080f7c 15664 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_in_cmd);
718e3744 15665 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
15666 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
01080f7c 15667 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd);
718e3744 15668 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
01080f7c 15669 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_in_cmd);
718e3744 15670 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
15671 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
01080f7c 15672 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_in_cmd);
718e3744 15673 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
01080f7c 15674 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_in_cmd);
718e3744 15675 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
15676 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
01080f7c 15677 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_in_cmd);
718e3744 15678 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
01080f7c 15679 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_in_cmd);
718e3744 15680 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
15681 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
15682 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
15683 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
15684 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
15685 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
15686 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
587ff0fd
LB
15687 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
15688 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
15689 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
15690 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
15691 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
15692 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
718e3744 15693 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
15694 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
15695 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
01080f7c 15696 install_element (ENABLE_NODE, &clear_bgp_instance_all_in_cmd);
718e3744 15697 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
15698 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
01080f7c 15699 install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_in_cmd);
718e3744 15700 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
01080f7c 15701 install_element (ENABLE_NODE, &clear_bgp_instance_peer_in_cmd);
718e3744 15702 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
15703 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
01080f7c 15704 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_in_cmd);
718e3744 15705 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
01080f7c 15706 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_in_cmd);
718e3744 15707 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
15708 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
01080f7c 15709 install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_in_cmd);
718e3744 15710 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
01080f7c 15711 install_element (ENABLE_NODE, &clear_bgp_instance_external_in_cmd);
718e3744 15712 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
15713 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
01080f7c 15714 install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_in_cmd);
718e3744 15715 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
01080f7c 15716 install_element (ENABLE_NODE, &clear_bgp_instance_as_in_cmd);
718e3744 15717 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
15718 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
01080f7c 15719 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_in_cmd);
718e3744 15720 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
01080f7c 15721 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_in_cmd);
718e3744 15722 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
15723 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
01080f7c 15724 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_in_cmd);
718e3744 15725 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
01080f7c 15726 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_in_cmd);
718e3744 15727 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
15728 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
01080f7c 15729 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_in_cmd);
718e3744 15730 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
01080f7c 15731 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_in_cmd);
718e3744 15732 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
15733 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
01080f7c 15734 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_in_cmd);
718e3744 15735 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
01080f7c 15736 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_in_cmd);
718e3744 15737 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
15738 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
01080f7c 15739 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_in_cmd);
718e3744 15740 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
01080f7c 15741 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_in_cmd);
718e3744 15742 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
718e3744 15743
8ad7271d
DS
15744 /* clear ip bgp prefix */
15745 install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd);
01080f7c 15746 install_element (ENABLE_NODE, &clear_ip_bgp_instance_prefix_cmd);
8ad7271d 15747 install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd);
01080f7c 15748 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_safi_prefix_cmd);
8ad7271d 15749
718e3744 15750 /* "clear ip bgp neighbor soft out" */
15751 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
15752 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
15753 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
01080f7c 15754 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_out_cmd);
718e3744 15755 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
01080f7c 15756 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_out_cmd);
718e3744 15757 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
01080f7c 15758 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_out_cmd);
718e3744 15759 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
01080f7c 15760 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_out_cmd);
718e3744 15761 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
01080f7c 15762 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_out_cmd);
718e3744 15763 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
01080f7c 15764 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_out_cmd);
718e3744 15765 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
01080f7c 15766 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_out_cmd);
718e3744 15767 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
01080f7c 15768 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_out_cmd);
718e3744 15769 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
01080f7c 15770 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_out_cmd);
718e3744 15771 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
15772 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
15773 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
01080f7c 15774 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_out_cmd);
718e3744 15775 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
01080f7c 15776 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_out_cmd);
718e3744 15777 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
01080f7c 15778 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_out_cmd);
718e3744 15779 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
01080f7c 15780 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd);
718e3744 15781 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
01080f7c 15782 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_out_cmd);
718e3744 15783 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
01080f7c 15784 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_out_cmd);
718e3744 15785 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
01080f7c 15786 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_out_cmd);
718e3744 15787 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
01080f7c 15788 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_out_cmd);
718e3744 15789 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
01080f7c 15790 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_out_cmd);
718e3744 15791 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
15792 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
15793 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
15794 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
15795 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
15796 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
587ff0fd
LB
15797 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
15798 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
15799 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
15800 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
15801 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
15802 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
718e3744 15803 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
15804 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
15805 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
01080f7c 15806 install_element (ENABLE_NODE, &clear_bgp_instance_all_out_cmd);
718e3744 15807 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
01080f7c 15808 install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_out_cmd);
718e3744 15809 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
01080f7c 15810 install_element (ENABLE_NODE, &clear_bgp_instance_peer_out_cmd);
718e3744 15811 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
01080f7c 15812 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_out_cmd);
718e3744 15813 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
01080f7c 15814 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_out_cmd);
718e3744 15815 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
01080f7c 15816 install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_out_cmd);
718e3744 15817 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
01080f7c 15818 install_element (ENABLE_NODE, &clear_bgp_instance_external_out_cmd);
718e3744 15819 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
01080f7c 15820 install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_out_cmd);
718e3744 15821 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
01080f7c 15822 install_element (ENABLE_NODE, &clear_bgp_instance_as_out_cmd);
718e3744 15823 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
01080f7c 15824 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_out_cmd);
718e3744 15825 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
01080f7c 15826 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_out_cmd);
718e3744 15827 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
01080f7c 15828 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_out_cmd);
718e3744 15829 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
01080f7c 15830 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_out_cmd);
718e3744 15831 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
01080f7c 15832 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_out_cmd);
718e3744 15833 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
01080f7c 15834 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_out_cmd);
718e3744 15835 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
01080f7c 15836 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_out_cmd);
718e3744 15837 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
01080f7c 15838 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_out_cmd);
718e3744 15839 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
01080f7c 15840 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_out_cmd);
718e3744 15841 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
01080f7c 15842 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_out_cmd);
718e3744 15843
15844 /* "clear ip bgp neighbor soft" */
15845 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
15846 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
15847 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
01080f7c 15848 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_cmd);
718e3744 15849 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
01080f7c 15850 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_cmd);
718e3744 15851 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
01080f7c 15852 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_cmd);
718e3744 15853 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
01080f7c 15854 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_cmd);
718e3744 15855 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
15856 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
15857 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
01080f7c 15858 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_cmd);
718e3744 15859 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
01080f7c 15860 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_cmd);
718e3744 15861 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
01080f7c 15862 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_cmd);
718e3744 15863 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
01080f7c 15864 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_cmd);
718e3744 15865 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
15866 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
15867 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
587ff0fd
LB
15868 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
15869 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
15870 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
718e3744 15871 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
15872 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
15873 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
01080f7c 15874 install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_cmd);
718e3744 15875 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
01080f7c 15876 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_cmd);
718e3744 15877 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
01080f7c 15878 install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_cmd);
718e3744 15879 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
01080f7c 15880 install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_cmd);
718e3744 15881 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
01080f7c 15882 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_cmd);
718e3744 15883 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
01080f7c 15884 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_cmd);
718e3744 15885 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
01080f7c 15886 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_cmd);
718e3744 15887 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
01080f7c 15888 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_cmd);
718e3744 15889 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
01080f7c 15890 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_cmd);
718e3744 15891
15892 /* "show ip bgp summary" commands. */
15893 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
3f9c7369 15894 install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd);
8386ac43 15895 install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_cmd);
f186de26 15896 install_element (VIEW_NODE, &show_ip_bgp_instance_all_updgrps_cmd);
3f9c7369
DS
15897 install_element (VIEW_NODE, &show_bgp_updgrps_cmd);
15898 install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_cmd);
8386ac43 15899 install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_cmd);
f186de26 15900 install_element (VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd);
8fe8a7f6 15901 install_element (VIEW_NODE, &show_ip_bgp_updgrps_s_cmd);
8386ac43 15902 install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_s_cmd);
8fe8a7f6
DS
15903 install_element (VIEW_NODE, &show_bgp_updgrps_s_cmd);
15904 install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_s_cmd);
8386ac43 15905 install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd);
3f9c7369 15906 install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd);
8386ac43 15907 install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_cmd);
3f9c7369 15908 install_element (VIEW_NODE, &show_bgp_updgrps_adj_cmd);
8386ac43 15909 install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_cmd);
3f9c7369 15910 install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_cmd);
8fe8a7f6 15911 install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_s_cmd);
8386ac43 15912 install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15913 install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd);
8386ac43 15914 install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15915 install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
718e3744 15916 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
f186de26 15917 install_element (VIEW_NODE, &show_ip_bgp_instance_all_summary_cmd);
718e3744 15918 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
95cbbd2a 15919 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
718e3744 15920 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
95cbbd2a 15921 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
718e3744 15922 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
15923 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
15924#ifdef HAVE_IPV6
15925 install_element (VIEW_NODE, &show_bgp_summary_cmd);
15926 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
f186de26 15927 install_element (VIEW_NODE, &show_bgp_instance_all_summary_cmd);
718e3744 15928 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
95cbbd2a 15929 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
718e3744 15930 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
95cbbd2a 15931 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
62687ff1
PJ
15932#endif /* HAVE_IPV6 */
15933 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
3f9c7369 15934 install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd);
8386ac43 15935 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_cmd);
f186de26 15936 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_updgrps_cmd);
3f9c7369
DS
15937 install_element (RESTRICTED_NODE, &show_bgp_updgrps_cmd);
15938 install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_cmd);
8386ac43 15939 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_cmd);
f186de26 15940 install_element (RESTRICTED_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd);
8fe8a7f6 15941 install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_s_cmd);
8386ac43 15942 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_s_cmd);
8fe8a7f6
DS
15943 install_element (RESTRICTED_NODE, &show_bgp_updgrps_s_cmd);
15944 install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_s_cmd);
8386ac43 15945 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd);
3f9c7369 15946 install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_cmd);
8386ac43 15947 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_cmd);
3f9c7369 15948 install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_cmd);
8386ac43 15949 install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_cmd);
3f9c7369 15950 install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_cmd);
8fe8a7f6 15951 install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_s_cmd);
8386ac43 15952 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15953 install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_s_cmd);
8386ac43 15954 install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15955 install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
62687ff1 15956 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
f186de26 15957 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_summary_cmd);
62687ff1 15958 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
95cbbd2a 15959 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
62687ff1 15960 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
95cbbd2a 15961 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
62687ff1
PJ
15962 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
15963 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
15964#ifdef HAVE_IPV6
15965 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
15966 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
f186de26 15967 install_element (RESTRICTED_NODE, &show_bgp_instance_all_summary_cmd);
62687ff1 15968 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
95cbbd2a 15969 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
62687ff1 15970 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
95cbbd2a 15971 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
718e3744 15972#endif /* HAVE_IPV6 */
15973 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
3f9c7369 15974 install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd);
8386ac43 15975 install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_cmd);
f186de26 15976 install_element (ENABLE_NODE, &show_ip_bgp_instance_all_updgrps_cmd);
3f9c7369
DS
15977 install_element (ENABLE_NODE, &show_bgp_updgrps_cmd);
15978 install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_cmd);
8386ac43 15979 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_cmd);
f186de26 15980 install_element (ENABLE_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd);
8fe8a7f6 15981 install_element (ENABLE_NODE, &show_ip_bgp_updgrps_s_cmd);
8386ac43 15982 install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_s_cmd);
8fe8a7f6
DS
15983 install_element (ENABLE_NODE, &show_bgp_updgrps_s_cmd);
15984 install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_s_cmd);
8386ac43 15985 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd);
3f9c7369 15986 install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_cmd);
8386ac43 15987 install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_cmd);
3f9c7369 15988 install_element (ENABLE_NODE, &show_bgp_updgrps_adj_cmd);
8386ac43 15989 install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_cmd);
3f9c7369 15990 install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_cmd);
8fe8a7f6 15991 install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_s_cmd);
8386ac43 15992 install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15993 install_element (ENABLE_NODE, &show_bgp_updgrps_adj_s_cmd);
8386ac43 15994 install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15995 install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
718e3744 15996 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
f186de26 15997 install_element (ENABLE_NODE, &show_ip_bgp_instance_all_summary_cmd);
718e3744 15998 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
95cbbd2a 15999 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
718e3744 16000 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
95cbbd2a 16001 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
718e3744 16002 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
16003 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
16004#ifdef HAVE_IPV6
16005 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
16006 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
f186de26 16007 install_element (ENABLE_NODE, &show_bgp_instance_all_summary_cmd);
718e3744 16008 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
95cbbd2a 16009 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
718e3744 16010 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
95cbbd2a 16011 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
718e3744 16012#endif /* HAVE_IPV6 */
16013
16014 /* "show ip bgp neighbors" commands. */
16015 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
16016 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
16017 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
16018 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
16019 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
16020 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
16021 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
16022 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
16023 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
f186de26 16024 install_element (VIEW_NODE, &show_ip_bgp_instance_all_neighbors_cmd);
718e3744 16025 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
62687ff1
PJ
16026 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
16027 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
16028 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
16029 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
16030 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
718e3744 16031 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
16032 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
16033 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
16034 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
16035 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
16036 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
16037 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
16038 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
16039 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
f186de26 16040 install_element (ENABLE_NODE, &show_ip_bgp_instance_all_neighbors_cmd);
718e3744 16041 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
16042
16043#ifdef HAVE_IPV6
16044 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
16045 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
16046 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
16047 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
bb46e94f 16048 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
16049 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
16050 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
16051 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
62687ff1
PJ
16052 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
16053 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
16054 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
16055 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
718e3744 16056 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
16057 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
16058 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
16059 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
bb46e94f 16060 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
16061 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
16062 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
16063 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
718e3744 16064
16065 /* Old commands. */
16066 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
16067 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
16068 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
16069 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
16070#endif /* HAVE_IPV6 */
fee0f4c6 16071
f14e6fdb
DS
16072 /* "show ip bgp peer-group" commands. */
16073 install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd);
16074 install_element (VIEW_NODE, &show_ip_bgp_instance_peer_groups_cmd);
16075 install_element (VIEW_NODE, &show_ip_bgp_peer_group_cmd);
16076 install_element (VIEW_NODE, &show_ip_bgp_instance_peer_group_cmd);
16077 install_element (ENABLE_NODE, &show_ip_bgp_peer_groups_cmd);
16078 install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_groups_cmd);
16079 install_element (ENABLE_NODE, &show_ip_bgp_peer_group_cmd);
16080 install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_group_cmd);
16081
718e3744 16082 /* "show ip bgp paths" commands. */
16083 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
16084 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
16085 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
16086 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
16087
16088 /* "show ip bgp community" commands. */
16089 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
16090 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
16091
16092 /* "show ip bgp attribute-info" commands. */
16093 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
16094 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
16095
16096 /* "redistribute" commands. */
16097 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
16098 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
16099 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
16100 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
16101 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
16102 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
16103 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
16104 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
16105 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
16106 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
7c8ff89e
DS
16107 install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_cmd);
16108 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_cmd);
16109 install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd);
16110 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd);
16111 install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd);
16112 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd);
16113 install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd);
16114 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd);
16115 install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd);
16116 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd);
919e0666
DW
16117 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_cmd);
16118 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_cmd);
16119 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_cmd);
16120 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
16121 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_cmd);
16122 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
16123 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
16124 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
16125 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
16126 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
16127 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_cmd);
16128 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_cmd);
16129 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd);
16130 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd);
16131 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd);
16132 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd);
16133 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd);
16134 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd);
16135 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd);
16136 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd);
718e3744 16137#ifdef HAVE_IPV6
16138 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
16139 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
16140 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
16141 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
16142 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
16143 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
16144 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
16145 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
16146 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
16147 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
16148#endif /* HAVE_IPV6 */
16149
fa411a21
NH
16150 /* ttl_security commands */
16151 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
16152 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
16153
4bf6a362
PJ
16154 /* "show bgp memory" commands. */
16155 install_element (VIEW_NODE, &show_bgp_memory_cmd);
62687ff1 16156 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
4bf6a362
PJ
16157 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
16158
e0081f70
ML
16159 /* "show bgp views" commands. */
16160 install_element (VIEW_NODE, &show_bgp_views_cmd);
16161 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
16162 install_element (ENABLE_NODE, &show_bgp_views_cmd);
16163
8386ac43 16164 /* "show bgp vrfs" commands. */
16165 install_element (VIEW_NODE, &show_bgp_vrfs_cmd);
16166 install_element (RESTRICTED_NODE, &show_bgp_vrfs_cmd);
16167 install_element (ENABLE_NODE, &show_bgp_vrfs_cmd);
16168
718e3744 16169 /* Community-list. */
16170 community_list_vty ();
16171}
6b0655a2 16172
718e3744 16173#include "memory.h"
16174#include "bgp_regex.h"
16175#include "bgp_clist.h"
16176#include "bgp_ecommunity.h"
16177
16178/* VTY functions. */
16179
16180/* Direction value to string conversion. */
94f2b392 16181static const char *
718e3744 16182community_direct_str (int direct)
16183{
16184 switch (direct)
16185 {
16186 case COMMUNITY_DENY:
16187 return "deny";
718e3744 16188 case COMMUNITY_PERMIT:
16189 return "permit";
718e3744 16190 default:
16191 return "unknown";
718e3744 16192 }
16193}
16194
16195/* Display error string. */
94f2b392 16196static void
718e3744 16197community_list_perror (struct vty *vty, int ret)
16198{
16199 switch (ret)
16200 {
16201 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
b729294c 16202 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
718e3744 16203 break;
16204 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
16205 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
16206 break;
16207 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
16208 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
16209 break;
16210 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
16211 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
16212 break;
16213 }
16214}
16215
16216/* VTY interface for community_set() function. */
94f2b392 16217static int
fd79ac91 16218community_list_set_vty (struct vty *vty, int argc, const char **argv,
16219 int style, int reject_all_digit_name)
718e3744 16220{
16221 int ret;
16222 int direct;
16223 char *str;
16224
16225 /* Check the list type. */
16226 if (strncmp (argv[1], "p", 1) == 0)
16227 direct = COMMUNITY_PERMIT;
16228 else if (strncmp (argv[1], "d", 1) == 0)
16229 direct = COMMUNITY_DENY;
16230 else
16231 {
16232 vty_out (vty, "%% Matching condition must be permit or deny%s",
16233 VTY_NEWLINE);
16234 return CMD_WARNING;
16235 }
16236
16237 /* All digit name check. */
16238 if (reject_all_digit_name && all_digit (argv[0]))
16239 {
16240 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
16241 return CMD_WARNING;
16242 }
16243
16244 /* Concat community string argument. */
16245 if (argc > 1)
16246 str = argv_concat (argv, argc, 2);
16247 else
16248 str = NULL;
16249
16250 /* When community_list_set() return nevetive value, it means
16251 malformed community string. */
16252 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
16253
16254 /* Free temporary community list string allocated by
16255 argv_concat(). */
16256 if (str)
16257 XFREE (MTYPE_TMP, str);
16258
16259 if (ret < 0)
16260 {
16261 /* Display error string. */
16262 community_list_perror (vty, ret);
16263 return CMD_WARNING;
16264 }
16265
16266 return CMD_SUCCESS;
16267}
16268
718e3744 16269/* Communiyt-list entry delete. */
94f2b392 16270static int
fee6e4e4 16271community_list_unset_vty (struct vty *vty, int argc, const char **argv,
813d4307 16272 int style, int delete_all)
718e3744 16273{
16274 int ret;
fee6e4e4 16275 int direct = 0;
16276 char *str = NULL;
718e3744 16277
fee6e4e4 16278 if (argc > 1)
718e3744 16279 {
fee6e4e4 16280 /* Check the list direct. */
16281 if (strncmp (argv[1], "p", 1) == 0)
16282 direct = COMMUNITY_PERMIT;
16283 else if (strncmp (argv[1], "d", 1) == 0)
16284 direct = COMMUNITY_DENY;
16285 else
16286 {
16287 vty_out (vty, "%% Matching condition must be permit or deny%s",
16288 VTY_NEWLINE);
16289 return CMD_WARNING;
16290 }
718e3744 16291
fee6e4e4 16292 /* Concat community string argument. */
16293 str = argv_concat (argv, argc, 2);
16294 }
718e3744 16295
16296 /* Unset community list. */
813d4307 16297 ret = community_list_unset (bgp_clist, argv[0], str, direct, style, delete_all);
718e3744 16298
16299 /* Free temporary community list string allocated by
16300 argv_concat(). */
fee6e4e4 16301 if (str)
16302 XFREE (MTYPE_TMP, str);
718e3744 16303
16304 if (ret < 0)
16305 {
16306 community_list_perror (vty, ret);
16307 return CMD_WARNING;
16308 }
16309
16310 return CMD_SUCCESS;
16311}
16312
16313/* "community-list" keyword help string. */
16314#define COMMUNITY_LIST_STR "Add a community list entry\n"
718e3744 16315
718e3744 16316DEFUN (ip_community_list_standard,
16317 ip_community_list_standard_cmd,
16318 "ip community-list <1-99> (deny|permit) .AA:NN",
16319 IP_STR
16320 COMMUNITY_LIST_STR
16321 "Community list number (standard)\n"
16322 "Specify community to reject\n"
16323 "Specify community to accept\n"
16324 COMMUNITY_VAL_STR)
16325{
16326 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
16327}
16328
16329ALIAS (ip_community_list_standard,
16330 ip_community_list_standard2_cmd,
16331 "ip community-list <1-99> (deny|permit)",
16332 IP_STR
16333 COMMUNITY_LIST_STR
16334 "Community list number (standard)\n"
16335 "Specify community to reject\n"
16336 "Specify community to accept\n")
16337
16338DEFUN (ip_community_list_expanded,
16339 ip_community_list_expanded_cmd,
fee6e4e4 16340 "ip community-list <100-500> (deny|permit) .LINE",
718e3744 16341 IP_STR
16342 COMMUNITY_LIST_STR
16343 "Community list number (expanded)\n"
16344 "Specify community to reject\n"
16345 "Specify community to accept\n"
16346 "An ordered list as a regular-expression\n")
16347{
16348 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
16349}
16350
16351DEFUN (ip_community_list_name_standard,
16352 ip_community_list_name_standard_cmd,
16353 "ip community-list standard WORD (deny|permit) .AA:NN",
16354 IP_STR
16355 COMMUNITY_LIST_STR
16356 "Add a standard community-list entry\n"
16357 "Community list name\n"
16358 "Specify community to reject\n"
16359 "Specify community to accept\n"
16360 COMMUNITY_VAL_STR)
16361{
16362 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
16363}
16364
16365ALIAS (ip_community_list_name_standard,
16366 ip_community_list_name_standard2_cmd,
16367 "ip community-list standard WORD (deny|permit)",
16368 IP_STR
16369 COMMUNITY_LIST_STR
16370 "Add a standard community-list entry\n"
16371 "Community list name\n"
16372 "Specify community to reject\n"
16373 "Specify community to accept\n")
16374
16375DEFUN (ip_community_list_name_expanded,
16376 ip_community_list_name_expanded_cmd,
16377 "ip community-list expanded WORD (deny|permit) .LINE",
16378 IP_STR
16379 COMMUNITY_LIST_STR
16380 "Add an expanded community-list entry\n"
16381 "Community list name\n"
16382 "Specify community to reject\n"
16383 "Specify community to accept\n"
16384 "An ordered list as a regular-expression\n")
16385{
16386 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
16387}
16388
fee6e4e4 16389DEFUN (no_ip_community_list_standard_all,
16390 no_ip_community_list_standard_all_cmd,
16391 "no ip community-list <1-99>",
16392 NO_STR
16393 IP_STR
16394 COMMUNITY_LIST_STR
16395 "Community list number (standard)\n")
16396{
813d4307
DW
16397 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
16398}
16399
16400DEFUN (no_ip_community_list_standard_direction,
16401 no_ip_community_list_standard_direction_cmd,
16402 "no ip community-list <1-99> (deny|permit)",
16403 NO_STR
16404 IP_STR
16405 COMMUNITY_LIST_STR
16406 "Community list number (standard)\n"
16407 "Specify community to reject\n"
16408 "Specify community to accept\n")
16409{
16410 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
fee6e4e4 16411}
16412
813d4307 16413
fee6e4e4 16414DEFUN (no_ip_community_list_expanded_all,
16415 no_ip_community_list_expanded_all_cmd,
16416 "no ip community-list <100-500>",
718e3744 16417 NO_STR
16418 IP_STR
16419 COMMUNITY_LIST_STR
718e3744 16420 "Community list number (expanded)\n")
16421{
813d4307 16422 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
718e3744 16423}
16424
fee6e4e4 16425DEFUN (no_ip_community_list_name_standard_all,
16426 no_ip_community_list_name_standard_all_cmd,
16427 "no ip community-list standard WORD",
718e3744 16428 NO_STR
16429 IP_STR
16430 COMMUNITY_LIST_STR
16431 "Add a standard community-list entry\n"
718e3744 16432 "Community list name\n")
16433{
813d4307 16434 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
718e3744 16435}
16436
fee6e4e4 16437DEFUN (no_ip_community_list_name_expanded_all,
16438 no_ip_community_list_name_expanded_all_cmd,
16439 "no ip community-list expanded WORD",
718e3744 16440 NO_STR
16441 IP_STR
16442 COMMUNITY_LIST_STR
fee6e4e4 16443 "Add an expanded community-list entry\n"
16444 "Community list name\n")
718e3744 16445{
813d4307 16446 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
718e3744 16447}
16448
16449DEFUN (no_ip_community_list_standard,
16450 no_ip_community_list_standard_cmd,
16451 "no ip community-list <1-99> (deny|permit) .AA:NN",
16452 NO_STR
16453 IP_STR
16454 COMMUNITY_LIST_STR
16455 "Community list number (standard)\n"
16456 "Specify community to reject\n"
16457 "Specify community to accept\n"
16458 COMMUNITY_VAL_STR)
16459{
813d4307 16460 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
718e3744 16461}
16462
16463DEFUN (no_ip_community_list_expanded,
16464 no_ip_community_list_expanded_cmd,
fee6e4e4 16465 "no ip community-list <100-500> (deny|permit) .LINE",
718e3744 16466 NO_STR
16467 IP_STR
16468 COMMUNITY_LIST_STR
16469 "Community list number (expanded)\n"
16470 "Specify community to reject\n"
16471 "Specify community to accept\n"
16472 "An ordered list as a regular-expression\n")
16473{
813d4307 16474 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
718e3744 16475}
16476
16477DEFUN (no_ip_community_list_name_standard,
16478 no_ip_community_list_name_standard_cmd,
16479 "no ip community-list standard WORD (deny|permit) .AA:NN",
16480 NO_STR
16481 IP_STR
16482 COMMUNITY_LIST_STR
16483 "Specify a standard community-list\n"
16484 "Community list name\n"
16485 "Specify community to reject\n"
16486 "Specify community to accept\n"
16487 COMMUNITY_VAL_STR)
16488{
813d4307
DW
16489 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
16490}
16491
16492DEFUN (no_ip_community_list_name_standard_brief,
16493 no_ip_community_list_name_standard_brief_cmd,
16494 "no ip community-list standard WORD (deny|permit)",
16495 NO_STR
16496 IP_STR
16497 COMMUNITY_LIST_STR
16498 "Specify a standard community-list\n"
16499 "Community list name\n"
16500 "Specify community to reject\n"
16501 "Specify community to accept\n")
16502{
16503 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
718e3744 16504}
16505
16506DEFUN (no_ip_community_list_name_expanded,
16507 no_ip_community_list_name_expanded_cmd,
16508 "no ip community-list expanded WORD (deny|permit) .LINE",
16509 NO_STR
16510 IP_STR
16511 COMMUNITY_LIST_STR
16512 "Specify an expanded community-list\n"
16513 "Community list name\n"
16514 "Specify community to reject\n"
16515 "Specify community to accept\n"
16516 "An ordered list as a regular-expression\n")
16517{
813d4307 16518 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
718e3744 16519}
16520
94f2b392 16521static void
718e3744 16522community_list_show (struct vty *vty, struct community_list *list)
16523{
16524 struct community_entry *entry;
16525
16526 for (entry = list->head; entry; entry = entry->next)
16527 {
16528 if (entry == list->head)
16529 {
16530 if (all_digit (list->name))
16531 vty_out (vty, "Community %s list %s%s",
16532 entry->style == COMMUNITY_LIST_STANDARD ?
16533 "standard" : "(expanded) access",
16534 list->name, VTY_NEWLINE);
16535 else
16536 vty_out (vty, "Named Community %s list %s%s",
16537 entry->style == COMMUNITY_LIST_STANDARD ?
16538 "standard" : "expanded",
16539 list->name, VTY_NEWLINE);
16540 }
16541 if (entry->any)
16542 vty_out (vty, " %s%s",
16543 community_direct_str (entry->direct), VTY_NEWLINE);
16544 else
16545 vty_out (vty, " %s %s%s",
16546 community_direct_str (entry->direct),
16547 entry->style == COMMUNITY_LIST_STANDARD
16548 ? community_str (entry->u.com) : entry->config,
16549 VTY_NEWLINE);
16550 }
16551}
16552
16553DEFUN (show_ip_community_list,
16554 show_ip_community_list_cmd,
16555 "show ip community-list",
16556 SHOW_STR
16557 IP_STR
16558 "List community-list\n")
16559{
16560 struct community_list *list;
16561 struct community_list_master *cm;
16562
fee6e4e4 16563 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
718e3744 16564 if (! cm)
16565 return CMD_SUCCESS;
16566
16567 for (list = cm->num.head; list; list = list->next)
16568 community_list_show (vty, list);
16569
16570 for (list = cm->str.head; list; list = list->next)
16571 community_list_show (vty, list);
16572
16573 return CMD_SUCCESS;
16574}
16575
16576DEFUN (show_ip_community_list_arg,
16577 show_ip_community_list_arg_cmd,
fee6e4e4 16578 "show ip community-list (<1-500>|WORD)",
718e3744 16579 SHOW_STR
16580 IP_STR
16581 "List community-list\n"
16582 "Community-list number\n"
16583 "Community-list name\n")
16584{
16585 struct community_list *list;
16586
fee6e4e4 16587 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
718e3744 16588 if (! list)
16589 {
b729294c 16590 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
718e3744 16591 return CMD_WARNING;
16592 }
16593
16594 community_list_show (vty, list);
16595
16596 return CMD_SUCCESS;
16597}
6b0655a2 16598
94f2b392 16599static int
fd79ac91 16600extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
16601 int style, int reject_all_digit_name)
718e3744 16602{
16603 int ret;
16604 int direct;
16605 char *str;
16606
16607 /* Check the list type. */
16608 if (strncmp (argv[1], "p", 1) == 0)
16609 direct = COMMUNITY_PERMIT;
16610 else if (strncmp (argv[1], "d", 1) == 0)
16611 direct = COMMUNITY_DENY;
16612 else
16613 {
16614 vty_out (vty, "%% Matching condition must be permit or deny%s",
16615 VTY_NEWLINE);
16616 return CMD_WARNING;
16617 }
16618
16619 /* All digit name check. */
16620 if (reject_all_digit_name && all_digit (argv[0]))
16621 {
16622 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
16623 return CMD_WARNING;
16624 }
16625
16626 /* Concat community string argument. */
16627 if (argc > 1)
16628 str = argv_concat (argv, argc, 2);
16629 else
16630 str = NULL;
16631
16632 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
16633
16634 /* Free temporary community list string allocated by
16635 argv_concat(). */
16636 if (str)
16637 XFREE (MTYPE_TMP, str);
16638
16639 if (ret < 0)
16640 {
16641 community_list_perror (vty, ret);
16642 return CMD_WARNING;
16643 }
16644 return CMD_SUCCESS;
16645}
16646
94f2b392 16647static int
fee6e4e4 16648extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
813d4307 16649 int style, int delete_all)
718e3744 16650{
16651 int ret;
fee6e4e4 16652 int direct = 0;
16653 char *str = NULL;
718e3744 16654
fee6e4e4 16655 if (argc > 1)
718e3744 16656 {
fee6e4e4 16657 /* Check the list direct. */
16658 if (strncmp (argv[1], "p", 1) == 0)
16659 direct = COMMUNITY_PERMIT;
16660 else if (strncmp (argv[1], "d", 1) == 0)
16661 direct = COMMUNITY_DENY;
16662 else
16663 {
16664 vty_out (vty, "%% Matching condition must be permit or deny%s",
16665 VTY_NEWLINE);
16666 return CMD_WARNING;
16667 }
718e3744 16668
fee6e4e4 16669 /* Concat community string argument. */
16670 str = argv_concat (argv, argc, 2);
718e3744 16671 }
16672
718e3744 16673 /* Unset community list. */
813d4307 16674 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style, delete_all);
718e3744 16675
16676 /* Free temporary community list string allocated by
16677 argv_concat(). */
fee6e4e4 16678 if (str)
16679 XFREE (MTYPE_TMP, str);
718e3744 16680
16681 if (ret < 0)
16682 {
16683 community_list_perror (vty, ret);
16684 return CMD_WARNING;
16685 }
16686
16687 return CMD_SUCCESS;
16688}
16689
16690/* "extcommunity-list" keyword help string. */
16691#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
16692#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
16693
16694DEFUN (ip_extcommunity_list_standard,
16695 ip_extcommunity_list_standard_cmd,
16696 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
16697 IP_STR
16698 EXTCOMMUNITY_LIST_STR
16699 "Extended Community list number (standard)\n"
16700 "Specify community to reject\n"
16701 "Specify community to accept\n"
16702 EXTCOMMUNITY_VAL_STR)
16703{
16704 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
16705}
16706
16707ALIAS (ip_extcommunity_list_standard,
16708 ip_extcommunity_list_standard2_cmd,
16709 "ip extcommunity-list <1-99> (deny|permit)",
16710 IP_STR
16711 EXTCOMMUNITY_LIST_STR
16712 "Extended Community list number (standard)\n"
16713 "Specify community to reject\n"
16714 "Specify community to accept\n")
16715
16716DEFUN (ip_extcommunity_list_expanded,
16717 ip_extcommunity_list_expanded_cmd,
fee6e4e4 16718 "ip extcommunity-list <100-500> (deny|permit) .LINE",
718e3744 16719 IP_STR
16720 EXTCOMMUNITY_LIST_STR
16721 "Extended Community list number (expanded)\n"
16722 "Specify community to reject\n"
16723 "Specify community to accept\n"
16724 "An ordered list as a regular-expression\n")
16725{
16726 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
16727}
16728
16729DEFUN (ip_extcommunity_list_name_standard,
16730 ip_extcommunity_list_name_standard_cmd,
16731 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
16732 IP_STR
16733 EXTCOMMUNITY_LIST_STR
16734 "Specify standard extcommunity-list\n"
16735 "Extended Community list name\n"
16736 "Specify community to reject\n"
16737 "Specify community to accept\n"
16738 EXTCOMMUNITY_VAL_STR)
16739{
16740 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
16741}
16742
16743ALIAS (ip_extcommunity_list_name_standard,
16744 ip_extcommunity_list_name_standard2_cmd,
16745 "ip extcommunity-list standard WORD (deny|permit)",
16746 IP_STR
16747 EXTCOMMUNITY_LIST_STR
16748 "Specify standard extcommunity-list\n"
16749 "Extended Community list name\n"
16750 "Specify community to reject\n"
16751 "Specify community to accept\n")
16752
16753DEFUN (ip_extcommunity_list_name_expanded,
16754 ip_extcommunity_list_name_expanded_cmd,
16755 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
16756 IP_STR
16757 EXTCOMMUNITY_LIST_STR
16758 "Specify expanded extcommunity-list\n"
16759 "Extended Community list name\n"
16760 "Specify community to reject\n"
16761 "Specify community to accept\n"
16762 "An ordered list as a regular-expression\n")
16763{
16764 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
16765}
16766
fee6e4e4 16767DEFUN (no_ip_extcommunity_list_standard_all,
16768 no_ip_extcommunity_list_standard_all_cmd,
16769 "no ip extcommunity-list <1-99>",
16770 NO_STR
16771 IP_STR
16772 EXTCOMMUNITY_LIST_STR
16773 "Extended Community list number (standard)\n")
16774{
813d4307
DW
16775 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
16776}
16777
16778DEFUN (no_ip_extcommunity_list_standard_direction,
16779 no_ip_extcommunity_list_standard_direction_cmd,
16780 "no ip extcommunity-list <1-99> (deny|permit)",
16781 NO_STR
16782 IP_STR
16783 EXTCOMMUNITY_LIST_STR
16784 "Extended Community list number (standard)\n"
16785 "Specify community to reject\n"
16786 "Specify community to accept\n")
16787{
16788 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
fee6e4e4 16789}
16790
16791DEFUN (no_ip_extcommunity_list_expanded_all,
16792 no_ip_extcommunity_list_expanded_all_cmd,
16793 "no ip extcommunity-list <100-500>",
718e3744 16794 NO_STR
16795 IP_STR
16796 EXTCOMMUNITY_LIST_STR
718e3744 16797 "Extended Community list number (expanded)\n")
16798{
813d4307 16799 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
718e3744 16800}
16801
fee6e4e4 16802DEFUN (no_ip_extcommunity_list_name_standard_all,
16803 no_ip_extcommunity_list_name_standard_all_cmd,
16804 "no ip extcommunity-list standard WORD",
718e3744 16805 NO_STR
16806 IP_STR
16807 EXTCOMMUNITY_LIST_STR
16808 "Specify standard extcommunity-list\n"
fee6e4e4 16809 "Extended Community list name\n")
16810{
813d4307 16811 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
fee6e4e4 16812}
16813
16814DEFUN (no_ip_extcommunity_list_name_expanded_all,
16815 no_ip_extcommunity_list_name_expanded_all_cmd,
16816 "no ip extcommunity-list expanded WORD",
16817 NO_STR
16818 IP_STR
16819 EXTCOMMUNITY_LIST_STR
718e3744 16820 "Specify expanded extcommunity-list\n"
16821 "Extended Community list name\n")
16822{
813d4307 16823 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
718e3744 16824}
16825
16826DEFUN (no_ip_extcommunity_list_standard,
16827 no_ip_extcommunity_list_standard_cmd,
16828 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
16829 NO_STR
16830 IP_STR
16831 EXTCOMMUNITY_LIST_STR
16832 "Extended Community list number (standard)\n"
16833 "Specify community to reject\n"
16834 "Specify community to accept\n"
16835 EXTCOMMUNITY_VAL_STR)
16836{
813d4307 16837 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
718e3744 16838}
16839
16840DEFUN (no_ip_extcommunity_list_expanded,
16841 no_ip_extcommunity_list_expanded_cmd,
fee6e4e4 16842 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
718e3744 16843 NO_STR
16844 IP_STR
16845 EXTCOMMUNITY_LIST_STR
16846 "Extended Community list number (expanded)\n"
16847 "Specify community to reject\n"
16848 "Specify community to accept\n"
16849 "An ordered list as a regular-expression\n")
16850{
813d4307 16851 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
718e3744 16852}
16853
16854DEFUN (no_ip_extcommunity_list_name_standard,
16855 no_ip_extcommunity_list_name_standard_cmd,
16856 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
16857 NO_STR
16858 IP_STR
16859 EXTCOMMUNITY_LIST_STR
16860 "Specify standard extcommunity-list\n"
16861 "Extended Community list name\n"
16862 "Specify community to reject\n"
16863 "Specify community to accept\n"
16864 EXTCOMMUNITY_VAL_STR)
16865{
813d4307
DW
16866 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
16867}
16868
16869DEFUN (no_ip_extcommunity_list_name_standard_brief,
16870 no_ip_extcommunity_list_name_standard_brief_cmd,
16871 "no ip extcommunity-list standard WORD (deny|permit)",
16872 NO_STR
16873 IP_STR
16874 EXTCOMMUNITY_LIST_STR
16875 "Specify standard extcommunity-list\n"
16876 "Extended Community list name\n"
16877 "Specify community to reject\n"
16878 "Specify community to accept\n")
16879{
16880 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
718e3744 16881}
16882
16883DEFUN (no_ip_extcommunity_list_name_expanded,
16884 no_ip_extcommunity_list_name_expanded_cmd,
16885 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
16886 NO_STR
16887 IP_STR
16888 EXTCOMMUNITY_LIST_STR
16889 "Specify expanded extcommunity-list\n"
16890 "Community list name\n"
16891 "Specify community to reject\n"
16892 "Specify community to accept\n"
16893 "An ordered list as a regular-expression\n")
16894{
813d4307 16895 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
718e3744 16896}
16897
94f2b392 16898static void
718e3744 16899extcommunity_list_show (struct vty *vty, struct community_list *list)
16900{
16901 struct community_entry *entry;
16902
16903 for (entry = list->head; entry; entry = entry->next)
16904 {
16905 if (entry == list->head)
16906 {
16907 if (all_digit (list->name))
16908 vty_out (vty, "Extended community %s list %s%s",
16909 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
16910 "standard" : "(expanded) access",
16911 list->name, VTY_NEWLINE);
16912 else
16913 vty_out (vty, "Named extended community %s list %s%s",
16914 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
16915 "standard" : "expanded",
16916 list->name, VTY_NEWLINE);
16917 }
16918 if (entry->any)
16919 vty_out (vty, " %s%s",
16920 community_direct_str (entry->direct), VTY_NEWLINE);
16921 else
16922 vty_out (vty, " %s %s%s",
16923 community_direct_str (entry->direct),
16924 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
16925 entry->u.ecom->str : entry->config,
16926 VTY_NEWLINE);
16927 }
16928}
16929
16930DEFUN (show_ip_extcommunity_list,
16931 show_ip_extcommunity_list_cmd,
16932 "show ip extcommunity-list",
16933 SHOW_STR
16934 IP_STR
16935 "List extended-community list\n")
16936{
16937 struct community_list *list;
16938 struct community_list_master *cm;
16939
fee6e4e4 16940 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
718e3744 16941 if (! cm)
16942 return CMD_SUCCESS;
16943
16944 for (list = cm->num.head; list; list = list->next)
16945 extcommunity_list_show (vty, list);
16946
16947 for (list = cm->str.head; list; list = list->next)
16948 extcommunity_list_show (vty, list);
16949
16950 return CMD_SUCCESS;
16951}
16952
16953DEFUN (show_ip_extcommunity_list_arg,
16954 show_ip_extcommunity_list_arg_cmd,
fee6e4e4 16955 "show ip extcommunity-list (<1-500>|WORD)",
718e3744 16956 SHOW_STR
16957 IP_STR
16958 "List extended-community list\n"
16959 "Extcommunity-list number\n"
16960 "Extcommunity-list name\n")
16961{
16962 struct community_list *list;
16963
fee6e4e4 16964 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
718e3744 16965 if (! list)
16966 {
b729294c 16967 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
718e3744 16968 return CMD_WARNING;
16969 }
16970
16971 extcommunity_list_show (vty, list);
16972
16973 return CMD_SUCCESS;
16974}
6b0655a2 16975
718e3744 16976/* Return configuration string of community-list entry. */
fd79ac91 16977static const char *
718e3744 16978community_list_config_str (struct community_entry *entry)
16979{
fd79ac91 16980 const char *str;
718e3744 16981
16982 if (entry->any)
16983 str = "";
16984 else
16985 {
16986 if (entry->style == COMMUNITY_LIST_STANDARD)
16987 str = community_str (entry->u.com);
16988 else
16989 str = entry->config;
16990 }
16991 return str;
16992}
16993
16994/* Display community-list and extcommunity-list configuration. */
94f2b392 16995static int
718e3744 16996community_list_config_write (struct vty *vty)
16997{
16998 struct community_list *list;
16999 struct community_entry *entry;
17000 struct community_list_master *cm;
17001 int write = 0;
17002
17003 /* Community-list. */
fee6e4e4 17004 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
718e3744 17005
17006 for (list = cm->num.head; list; list = list->next)
17007 for (entry = list->head; entry; entry = entry->next)
17008 {
fee6e4e4 17009 vty_out (vty, "ip community-list %s %s %s%s",
17010 list->name, community_direct_str (entry->direct),
17011 community_list_config_str (entry),
17012 VTY_NEWLINE);
718e3744 17013 write++;
17014 }
17015 for (list = cm->str.head; list; list = list->next)
17016 for (entry = list->head; entry; entry = entry->next)
17017 {
17018 vty_out (vty, "ip community-list %s %s %s %s%s",
17019 entry->style == COMMUNITY_LIST_STANDARD
17020 ? "standard" : "expanded",
17021 list->name, community_direct_str (entry->direct),
17022 community_list_config_str (entry),
17023 VTY_NEWLINE);
17024 write++;
17025 }
17026
17027 /* Extcommunity-list. */
fee6e4e4 17028 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
718e3744 17029
17030 for (list = cm->num.head; list; list = list->next)
17031 for (entry = list->head; entry; entry = entry->next)
17032 {
fee6e4e4 17033 vty_out (vty, "ip extcommunity-list %s %s %s%s",
17034 list->name, community_direct_str (entry->direct),
17035 community_list_config_str (entry), VTY_NEWLINE);
718e3744 17036 write++;
17037 }
17038 for (list = cm->str.head; list; list = list->next)
17039 for (entry = list->head; entry; entry = entry->next)
17040 {
17041 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
17042 entry->style == EXTCOMMUNITY_LIST_STANDARD
17043 ? "standard" : "expanded",
17044 list->name, community_direct_str (entry->direct),
17045 community_list_config_str (entry), VTY_NEWLINE);
17046 write++;
17047 }
17048 return write;
17049}
17050
7fc626de 17051static struct cmd_node community_list_node =
718e3744 17052{
17053 COMMUNITY_LIST_NODE,
17054 "",
17055 1 /* Export to vtysh. */
17056};
17057
94f2b392 17058static void
17059community_list_vty (void)
718e3744 17060{
17061 install_node (&community_list_node, community_list_config_write);
17062
17063 /* Community-list. */
718e3744 17064 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
17065 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
17066 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
17067 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
17068 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
17069 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
fee6e4e4 17070 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
813d4307 17071 install_element (CONFIG_NODE, &no_ip_community_list_standard_direction_cmd);
fee6e4e4 17072 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
17073 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
17074 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
718e3744 17075 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
17076 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
17077 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
813d4307 17078 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_brief_cmd);
718e3744 17079 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
17080 install_element (VIEW_NODE, &show_ip_community_list_cmd);
17081 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
17082 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
17083 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
17084
17085 /* Extcommunity-list. */
17086 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
17087 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
17088 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
17089 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
17090 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
17091 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
fee6e4e4 17092 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
813d4307 17093 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_direction_cmd);
fee6e4e4 17094 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
17095 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
17096 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
718e3744 17097 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
17098 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
17099 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
813d4307 17100 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_brief_cmd);
718e3744 17101 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
17102 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
17103 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
17104 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
17105 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
17106}