]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_vty.c
Merge remote-tracking branch 'origin/cmaster' into cmaster-next
[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"
4bf6a362 33#include "hash.h"
3f9c7369 34#include "queue.h"
cdb805bc
SK
35#include "if.h"
36#include "vrf.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{
8ecd3266 67 if (vty->node == BGP_IPV6_NODE ||
68 vty->node == BGP_IPV6M_NODE ||
8b1fb8be
LB
69 vty->node == BGP_VPNV6_NODE ||
70 vty->node == BGP_ENCAPV6_NODE)
718e3744 71 return AFI_IP6;
72 return AFI_IP;
73}
74
75/* Utility function to get subsequent address family from current
76 node. */
77safi_t
78bgp_node_safi (struct vty *vty)
79{
6407da5a 80 if (vty->node == BGP_VPNV4_NODE || vty->node == BGP_VPNV6_NODE)
8ecd3266 81 return SAFI_MPLS_VPN;
8b1fb8be
LB
82 if (vty->node == BGP_ENCAP_NODE || vty->node == BGP_ENCAPV6_NODE)
83 return SAFI_ENCAP;
25ffbdc1 84 if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE)
718e3744 85 return SAFI_MULTICAST;
86 return SAFI_UNICAST;
87}
88
8b1fb8be
LB
89int
90bgp_parse_afi(const char *str, afi_t *afi)
91{
92 if (!strcmp(str, "ipv4")) {
93 *afi = AFI_IP;
94 return 0;
95 }
96#ifdef HAVE_IPV6
97 if (!strcmp(str, "ipv6")) {
98 *afi = AFI_IP6;
99 return 0;
100 }
101#endif /* HAVE_IPV6 */
102 return -1;
103}
104
105int
106bgp_parse_safi(const char *str, safi_t *safi)
107{
108 if (!strcmp(str, "encap")) {
109 *safi = SAFI_ENCAP;
110 return 0;
111 }
112 if (!strcmp(str, "multicast")) {
113 *safi = SAFI_MULTICAST;
114 return 0;
115 }
116 if (!strcmp(str, "unicast")) {
117 *safi = SAFI_UNICAST;
118 return 0;
119 }
120 if (!strcmp(str, "vpn")) {
121 *safi = SAFI_MPLS_VPN;
122 return 0;
123 }
124 return -1;
125}
126
94f2b392 127static int
6aeb9e78 128peer_address_self_check (struct bgp *bgp, union sockunion *su)
718e3744 129{
130 struct interface *ifp = NULL;
131
132 if (su->sa.sa_family == AF_INET)
6aeb9e78 133 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr, bgp->vrf_id);
718e3744 134#ifdef HAVE_IPV6
135 else if (su->sa.sa_family == AF_INET6)
f2345335 136 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr,
6aeb9e78 137 su->sin6.sin6_scope_id, bgp->vrf_id);
718e3744 138#endif /* HAVE IPV6 */
139
140 if (ifp)
141 return 1;
142
143 return 0;
144}
145
146/* Utility function for looking up peer from VTY. */
f14e6fdb
DS
147/* This is used only for configuration, so disallow if attempted on
148 * a dynamic neighbor.
149 */
94f2b392 150static struct peer *
fd79ac91 151peer_lookup_vty (struct vty *vty, const char *ip_str)
718e3744 152{
153 int ret;
154 struct bgp *bgp;
155 union sockunion su;
156 struct peer *peer;
157
158 bgp = vty->index;
159
160 ret = str2sockunion (ip_str, &su);
161 if (ret < 0)
162 {
a80beece
DS
163 peer = peer_lookup_by_conf_if (bgp, ip_str);
164 if (!peer)
165 {
04b6bdc0
DW
166 if ((peer = peer_lookup_by_hostname(bgp, ip_str)) == NULL)
167 {
168 vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE);
169 return NULL;
170 }
a80beece 171 }
718e3744 172 }
a80beece 173 else
718e3744 174 {
a80beece
DS
175 peer = peer_lookup (bgp, &su);
176 if (! peer)
177 {
178 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
179 VTY_NEWLINE);
180 return NULL;
181 }
f14e6fdb
DS
182 if (peer_dynamic_neighbor (peer))
183 {
184 vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
185 VTY_NEWLINE);
186 return NULL;
187 }
188
718e3744 189 }
190 return peer;
191}
192
193/* Utility function for looking up peer or peer group. */
f14e6fdb
DS
194/* This is used only for configuration, so disallow if attempted on
195 * a dynamic neighbor.
196 */
c43ed2e4 197struct peer *
fd79ac91 198peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
718e3744 199{
200 int ret;
201 struct bgp *bgp;
202 union sockunion su;
f14e6fdb
DS
203 struct peer *peer = NULL;
204 struct peer_group *group = NULL;
718e3744 205
206 bgp = vty->index;
207
208 ret = str2sockunion (peer_str, &su);
209 if (ret == 0)
210 {
f14e6fdb 211 /* IP address, locate peer. */
718e3744 212 peer = peer_lookup (bgp, &su);
718e3744 213 }
214 else
215 {
f14e6fdb 216 /* Not IP, could match either peer configured on interface or a group. */
a80beece 217 peer = peer_lookup_by_conf_if (bgp, peer_str);
f14e6fdb
DS
218 if (!peer)
219 group = peer_group_lookup (bgp, peer_str);
220 }
a80beece 221
f14e6fdb
DS
222 if (peer)
223 {
224 if (peer_dynamic_neighbor (peer))
225 {
226 vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
227 VTY_NEWLINE);
228 return NULL;
229 }
230
231 return peer;
718e3744 232 }
233
f14e6fdb
DS
234 if (group)
235 return group->conf;
236
718e3744 237 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
238 VTY_NEWLINE);
239
240 return NULL;
241}
242
c43ed2e4 243int
718e3744 244bgp_vty_return (struct vty *vty, int ret)
245{
fd79ac91 246 const char *str = NULL;
718e3744 247
248 switch (ret)
249 {
250 case BGP_ERR_INVALID_VALUE:
251 str = "Invalid value";
252 break;
253 case BGP_ERR_INVALID_FLAG:
254 str = "Invalid flag";
255 break;
718e3744 256 case BGP_ERR_PEER_GROUP_SHUTDOWN:
257 str = "Peer-group has been shutdown. Activate the peer-group first";
258 break;
718e3744 259 case BGP_ERR_PEER_FLAG_CONFLICT:
260 str = "Can't set override-capability and strict-capability-match at the same time";
261 break;
718e3744 262 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
263 str = "Specify remote-as or peer-group remote AS first";
264 break;
265 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
266 str = "Cannot change the peer-group. Deconfigure first";
267 break;
268 case BGP_ERR_PEER_GROUP_MISMATCH:
4c48cf63 269 str = "Peer is not a member of this peer-group";
718e3744 270 break;
271 case BGP_ERR_PEER_FILTER_CONFLICT:
272 str = "Prefix/distribute list can not co-exist";
273 break;
274 case BGP_ERR_NOT_INTERNAL_PEER:
275 str = "Invalid command. Not an internal neighbor";
276 break;
277 case BGP_ERR_REMOVE_PRIVATE_AS:
5000f21c 278 str = "remove-private-AS cannot be configured for IBGP peers";
718e3744 279 break;
280 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
281 str = "Local-AS allowed only for EBGP peers";
282 break;
283 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
284 str = "Cannot have local-as same as BGP AS number";
285 break;
0df7c91f
PJ
286 case BGP_ERR_TCPSIG_FAILED:
287 str = "Error while applying TCP-Sig to session(s)";
288 break;
fa411a21
NH
289 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
290 str = "ebgp-multihop and ttl-security cannot be configured together";
291 break;
f5a4827d
SH
292 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
293 str = "ttl-security only allowed for EBGP peers";
294 break;
c7122e14
DS
295 case BGP_ERR_AS_OVERRIDE:
296 str = "as-override cannot be configured for IBGP peers";
297 break;
f14e6fdb
DS
298 case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT:
299 str = "Invalid limit for number of dynamic neighbors";
300 break;
301 case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS:
302 str = "Dynamic neighbor listen range already exists";
303 break;
304 case BGP_ERR_INVALID_FOR_DYNAMIC_PEER:
305 str = "Operation not allowed on a dynamic neighbor";
306 break;
63fa10b5
QY
307 case BGP_ERR_INVALID_FOR_DIRECT_PEER:
308 str = "Operation not allowed on a directly connected neighbor";
309 break;
718e3744 310 }
311 if (str)
312 {
313 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
314 return CMD_WARNING;
315 }
316 return CMD_SUCCESS;
317}
318
7aafcaca
DS
319/* BGP clear sort. */
320enum clear_sort
321{
322 clear_all,
323 clear_peer,
324 clear_group,
325 clear_external,
326 clear_as
327};
328
7aafcaca
DS
329static void
330bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
331 safi_t safi, int error)
332{
333 switch (error)
334 {
335 case BGP_ERR_AF_UNCONFIGURED:
336 vty_out (vty,
337 "%%BGP: Enable %s %s address family for the neighbor %s%s",
338 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
339 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
340 peer->host, VTY_NEWLINE);
341 break;
342 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
343 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);
344 break;
345 default:
346 break;
347 }
348}
349
350/* `clear ip bgp' functions. */
351static int
352bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
353 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
354{
355 int ret;
356 struct peer *peer;
357 struct listnode *node, *nnode;
358
359 /* Clear all neighbors. */
360 /*
361 * Pass along pointer to next node to peer_clear() when walking all nodes
362 * on the BGP instance as that may get freed if it is a doppelganger
363 */
364 if (sort == clear_all)
365 {
366 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
367 {
368 if (stype == BGP_CLEAR_SOFT_NONE)
369 ret = peer_clear (peer, &nnode);
370 else if (peer->afc[afi][safi])
371 ret = peer_clear_soft (peer, afi, safi, stype);
372 else
373 ret = 0;
374
375 if (ret < 0)
376 bgp_clear_vty_error (vty, peer, afi, safi, ret);
377 }
378
379 /* This is to apply read-only mode on this clear. */
380 if (stype == BGP_CLEAR_SOFT_NONE)
381 bgp->update_delay_over = 0;
382
383 return CMD_SUCCESS;
384 }
385
386 /* Clear specified neighbors. */
387 if (sort == clear_peer)
388 {
389 union sockunion su;
390 int ret;
391
392 /* Make sockunion for lookup. */
393 ret = str2sockunion (arg, &su);
394 if (ret < 0)
395 {
396 peer = peer_lookup_by_conf_if (bgp, arg);
397 if (!peer)
398 {
04b6bdc0
DW
399 peer = peer_lookup_by_hostname(bgp, arg);
400 if (!peer)
401 {
402 vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE);
403 return CMD_WARNING;
404 }
7aafcaca
DS
405 }
406 }
407 else
408 {
409 peer = peer_lookup (bgp, &su);
410 if (! peer)
411 {
412 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
413 return CMD_WARNING;
414 }
415 }
416
417 if (stype == BGP_CLEAR_SOFT_NONE)
418 ret = peer_clear (peer, NULL);
419 else
420 ret = peer_clear_soft (peer, afi, safi, stype);
421
422 if (ret < 0)
423 bgp_clear_vty_error (vty, peer, afi, safi, ret);
424
425 return CMD_SUCCESS;
426 }
427
428 /* Clear all peer-group members. */
429 if (sort == clear_group)
430 {
431 struct peer_group *group;
432
433 group = peer_group_lookup (bgp, arg);
434 if (! group)
435 {
436 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
437 return CMD_WARNING;
438 }
439
440 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
441 {
442 if (stype == BGP_CLEAR_SOFT_NONE)
443 {
18f1dc06 444 peer_clear (peer, NULL);
7aafcaca
DS
445 continue;
446 }
447
c8560b44 448 if (! peer->afc[afi][safi])
7aafcaca
DS
449 continue;
450
451 ret = peer_clear_soft (peer, afi, safi, stype);
452
453 if (ret < 0)
454 bgp_clear_vty_error (vty, peer, afi, safi, ret);
455 }
456 return CMD_SUCCESS;
457 }
458
459 if (sort == clear_external)
460 {
461 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
462 {
463 if (peer->sort == BGP_PEER_IBGP)
464 continue;
465
466 if (stype == BGP_CLEAR_SOFT_NONE)
467 ret = peer_clear (peer, &nnode);
468 else
469 ret = peer_clear_soft (peer, afi, safi, stype);
470
471 if (ret < 0)
472 bgp_clear_vty_error (vty, peer, afi, safi, ret);
473 }
474 return CMD_SUCCESS;
475 }
476
477 if (sort == clear_as)
478 {
479 as_t as;
480 int find = 0;
481
482 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
483
484 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
485 {
486 if (peer->as != as)
487 continue;
488
489 find = 1;
490 if (stype == BGP_CLEAR_SOFT_NONE)
491 ret = peer_clear (peer, &nnode);
492 else
493 ret = peer_clear_soft (peer, afi, safi, stype);
494
495 if (ret < 0)
496 bgp_clear_vty_error (vty, peer, afi, safi, ret);
497 }
498 if (! find)
499 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
500 VTY_NEWLINE);
501 return CMD_SUCCESS;
502 }
503
504 return CMD_SUCCESS;
505}
506
507static int
508bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
509 enum clear_sort sort, enum bgp_clear_type stype,
510 const char *arg)
511{
512 struct bgp *bgp;
513
514 /* BGP structure lookup. */
515 if (name)
516 {
517 bgp = bgp_lookup_by_name (name);
518 if (bgp == NULL)
519 {
6aeb9e78 520 vty_out (vty, "Can't find BGP instance %s%s", name, VTY_NEWLINE);
7aafcaca
DS
521 return CMD_WARNING;
522 }
523 }
524 else
525 {
526 bgp = bgp_get_default ();
527 if (bgp == NULL)
528 {
529 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
530 return CMD_WARNING;
531 }
532 }
533
534 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
535}
536
537/* clear soft inbound */
538static void
539bgp_clear_star_soft_in (struct vty *vty)
540{
541 bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
542 BGP_CLEAR_SOFT_IN, NULL);
543#ifdef HAVE_IPV6
544 bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
545 BGP_CLEAR_SOFT_IN, NULL);
546#endif /* HAVE_IPV6 */
547}
548
549/* clear soft outbound */
550static void
551bgp_clear_star_soft_out (struct vty *vty)
552{
553 bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
554 BGP_CLEAR_SOFT_OUT, NULL);
555#ifdef HAVE_IPV6
556 bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
557 BGP_CLEAR_SOFT_OUT, NULL);
558#endif /* HAVE_IPV6 */
559}
560
561
718e3744 562/* BGP global configuration. */
563
564DEFUN (bgp_multiple_instance_func,
565 bgp_multiple_instance_cmd,
566 "bgp multiple-instance",
567 BGP_STR
568 "Enable bgp multiple instance\n")
569{
570 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
571 return CMD_SUCCESS;
572}
573
574DEFUN (no_bgp_multiple_instance,
575 no_bgp_multiple_instance_cmd,
576 "no bgp multiple-instance",
577 NO_STR
578 BGP_STR
579 "BGP multiple instance\n")
580{
581 int ret;
582
583 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
584 if (ret < 0)
585 {
586 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
587 return CMD_WARNING;
588 }
589 return CMD_SUCCESS;
590}
591
592DEFUN (bgp_config_type,
593 bgp_config_type_cmd,
594 "bgp config-type (cisco|zebra)",
595 BGP_STR
596 "Configuration type\n"
597 "cisco\n"
598 "zebra\n")
599{
600 if (strncmp (argv[0], "c", 1) == 0)
601 bgp_option_set (BGP_OPT_CONFIG_CISCO);
602 else
603 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
604
605 return CMD_SUCCESS;
606}
607
608DEFUN (no_bgp_config_type,
609 no_bgp_config_type_cmd,
610 "no bgp config-type",
611 NO_STR
612 BGP_STR
613 "Display configuration type\n")
614{
615 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
616 return CMD_SUCCESS;
617}
618
813d4307
DW
619ALIAS (no_bgp_config_type,
620 no_bgp_config_type_val_cmd,
621 "no bgp config-type (cisco|zebra)",
622 NO_STR
623 BGP_STR
624 "Configuration type\n"
625 "cisco\n"
626 "zebra\n")
627
718e3744 628DEFUN (no_synchronization,
629 no_synchronization_cmd,
630 "no synchronization",
631 NO_STR
632 "Perform IGP synchronization\n")
633{
634 return CMD_SUCCESS;
635}
636
637DEFUN (no_auto_summary,
638 no_auto_summary_cmd,
639 "no auto-summary",
640 NO_STR
641 "Enable automatic network number summarization\n")
642{
643 return CMD_SUCCESS;
644}
3d515fd9 645
718e3744 646/* "router bgp" commands. */
647DEFUN (router_bgp,
648 router_bgp_cmd,
320da874 649 "router bgp " CMD_AS_RANGE,
718e3744 650 ROUTER_STR
651 BGP_STR
652 AS_STR)
653{
654 int ret;
655 as_t as;
656 struct bgp *bgp;
fd79ac91 657 const char *name = NULL;
ad4cbda1 658 enum bgp_instance_type inst_type;
718e3744 659
2385a876
DW
660 // "router bgp" without an ASN
661 if (argc < 1)
662 {
6aeb9e78 663 //Pending: Make VRF option available for ASN less config
2385a876 664 bgp = bgp_get_default();
718e3744 665
2385a876
DW
666 if (bgp == NULL)
667 {
668 vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE);
669 return CMD_WARNING;
670 }
718e3744 671
2385a876
DW
672 if (listcount(bm->bgp) > 1)
673 {
674 vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE);
675 return CMD_WARNING;
676 }
677 }
678
679 // "router bgp X"
680 else
718e3744 681 {
2385a876
DW
682 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
683
ad4cbda1 684 inst_type = BGP_INSTANCE_TYPE_DEFAULT;
6aeb9e78 685 if (argc == 3)
ad4cbda1 686 {
687 name = argv[2];
688 if (!strcmp(argv[1], "vrf"))
689 inst_type = BGP_INSTANCE_TYPE_VRF;
690 else if (!strcmp(argv[1], "view"))
691 inst_type = BGP_INSTANCE_TYPE_VIEW;
692 }
2385a876 693
ad4cbda1 694 ret = bgp_get (&bgp, &as, name, inst_type);
2385a876
DW
695 switch (ret)
696 {
697 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
698 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
699 VTY_NEWLINE);
700 return CMD_WARNING;
701 case BGP_ERR_AS_MISMATCH:
702 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
703 return CMD_WARNING;
704 case BGP_ERR_INSTANCE_MISMATCH:
6aeb9e78 705 vty_out (vty, "BGP instance name and AS number mismatch%s", VTY_NEWLINE);
2385a876
DW
706 vty_out (vty, "BGP instance is already running; AS is %u%s",
707 as, VTY_NEWLINE);
708 return CMD_WARNING;
709 }
6aeb9e78
DS
710
711 /* Pending: handle when user tries to change a view to vrf n vv. */
718e3744 712 }
713
714 vty->node = BGP_NODE;
715 vty->index = bgp;
716
717 return CMD_SUCCESS;
718}
719
720ALIAS (router_bgp,
6aeb9e78
DS
721 router_bgp_instance_cmd,
722 "router bgp " CMD_AS_RANGE " (view|vrf) WORD",
718e3744 723 ROUTER_STR
724 BGP_STR
725 AS_STR
6aeb9e78 726 "BGP view\nBGP VRF\n"
8386ac43 727 "View/VRF name\n")
6b0655a2 728
2385a876
DW
729ALIAS (router_bgp,
730 router_bgp_noasn_cmd,
731 "router bgp",
732 ROUTER_STR
733 BGP_STR)
734
718e3744 735/* "no router bgp" commands. */
736DEFUN (no_router_bgp,
737 no_router_bgp_cmd,
320da874 738 "no router bgp " CMD_AS_RANGE,
718e3744 739 NO_STR
740 ROUTER_STR
741 BGP_STR
742 AS_STR)
743{
744 as_t as;
745 struct bgp *bgp;
fd79ac91 746 const char *name = NULL;
718e3744 747
0b2aa3a0 748 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
718e3744 749
6aeb9e78
DS
750 if (argc == 3)
751 name = argv[2];
718e3744 752
753 /* Lookup bgp structure. */
754 bgp = bgp_lookup (as, name);
755 if (! bgp)
756 {
757 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
758 return CMD_WARNING;
759 }
760
761 bgp_delete (bgp);
762
763 return CMD_SUCCESS;
764}
765
766ALIAS (no_router_bgp,
6aeb9e78
DS
767 no_router_bgp_instance_cmd,
768 "no router bgp " CMD_AS_RANGE " (view|vrf) WORD",
718e3744 769 NO_STR
770 ROUTER_STR
771 BGP_STR
772 AS_STR
6aeb9e78 773 "BGP view\nBGP VRF\n"
8386ac43 774 "View/VRF name\n")
6b0655a2 775
718e3744 776/* BGP router-id. */
777
778DEFUN (bgp_router_id,
779 bgp_router_id_cmd,
780 "bgp router-id A.B.C.D",
781 BGP_STR
782 "Override configured router identifier\n"
783 "Manually configured router identifier\n")
784{
785 int ret;
786 struct in_addr id;
787 struct bgp *bgp;
788
789 bgp = vty->index;
790
791 ret = inet_aton (argv[0], &id);
792 if (! ret)
793 {
794 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
795 return CMD_WARNING;
796 }
797
c2d58d6d 798 if (IPV4_ADDR_SAME (&bgp->router_id_static, &id))
799 return CMD_SUCCESS;
800
18a6dce6 801 bgp->router_id_static = id;
718e3744 802 bgp_router_id_set (bgp, &id);
803
804 return CMD_SUCCESS;
805}
806
807DEFUN (no_bgp_router_id,
808 no_bgp_router_id_cmd,
809 "no bgp router-id",
810 NO_STR
811 BGP_STR
812 "Override configured router identifier\n")
813{
814 int ret;
815 struct in_addr id;
816 struct bgp *bgp;
cdb805bc
SK
817 struct interface *ifp;
818 struct listnode *node;
819 struct connected *ifc;
820 struct prefix *p;
718e3744 821
822 bgp = vty->index;
823
824 if (argc == 1)
825 {
826 ret = inet_aton (argv[0], &id);
827 if (! ret)
cdb805bc
SK
828 {
829 ifp = if_lookup_by_name_vrf(argv[0], bgp->vrf_id);
830 if (!ifp) {
831 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
832 return CMD_WARNING;
833 }
834 for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc))
835 {
836 p = ifc->address;
837 if (p && (p->family == AF_INET))
838 {
839 id = p->u.prefix4;
840 break;
841 }
842 }
843 }
718e3744 844
18a6dce6 845 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
cdb805bc
SK
846 {
847 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
848 return CMD_WARNING;
849 }
718e3744 850 }
851
18a6dce6 852 bgp->router_id_static.s_addr = 0;
6aeb9e78 853 bgp_router_id_set (bgp, &bgp->router_id_zebra);
718e3744 854
855 return CMD_SUCCESS;
856}
857
858ALIAS (no_bgp_router_id,
859 no_bgp_router_id_val_cmd,
860 "no bgp router-id A.B.C.D",
861 NO_STR
862 BGP_STR
863 "Override configured router identifier\n"
864 "Manually configured router identifier\n")
6b0655a2 865
cdb805bc
SK
866DEFUN (bgp_router_id_interface,
867 bgp_router_id_interface_cmd,
868 "bgp router-id IFNAME",
869 BGP_STR
870 "Override configured router identifier\n"
871 "Interface name\n")
872{
873 struct bgp *bgp;
874 struct interface *ifp;
875 struct connected *ifc;
876 struct listnode *node;
877 struct prefix *p;
878 struct vrf *vrf;
879
880 bgp = vty->index;
881 p = NULL;
882
883 ifp = if_lookup_by_name_vrf(argv[0], bgp->vrf_id);
884 if (!ifp)
885 {
886 vrf = vrf_lookup(bgp->vrf_id);
887 vty_out (vty, "%% Couldnt find interface %s in VRF %s%s", argv[0], vrf? vrf->name:"", VTY_NEWLINE);
888 return CMD_WARNING;
889 }
890
891 for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc))
892 {
893 p = ifc->address;
894
895 if (p && (p->family == AF_INET))
896 {
897 if (IPV4_ADDR_SAME (&bgp->router_id_static, &p->u.prefix4))
898 return CMD_SUCCESS;
899 bgp->router_id_static = p->u.prefix4;
900 bgp_router_id_set (bgp, &p->u.prefix4);
901 return CMD_SUCCESS;
902 }
903 }
904 vty_out (vty, "%% Couldnt assign the router-id%s", VTY_NEWLINE);
905 return CMD_WARNING;
906}
907
908ALIAS (no_bgp_router_id,
909 no_bgp_router_id_interface_cmd,
910 "no bgp router-id IFNAME",
911 NO_STR
912 BGP_STR
913 "Override configured router identifier\n"
914 "Interface name\n")
915
718e3744 916/* BGP Cluster ID. */
917
918DEFUN (bgp_cluster_id,
919 bgp_cluster_id_cmd,
920 "bgp cluster-id A.B.C.D",
921 BGP_STR
922 "Configure Route-Reflector Cluster-id\n"
923 "Route-Reflector Cluster-id in IP address format\n")
924{
925 int ret;
926 struct bgp *bgp;
927 struct in_addr cluster;
928
929 bgp = vty->index;
930
931 ret = inet_aton (argv[0], &cluster);
932 if (! ret)
933 {
934 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
935 return CMD_WARNING;
936 }
937
938 bgp_cluster_id_set (bgp, &cluster);
7aafcaca 939 bgp_clear_star_soft_out (vty);
718e3744 940
941 return CMD_SUCCESS;
942}
943
944ALIAS (bgp_cluster_id,
945 bgp_cluster_id32_cmd,
946 "bgp cluster-id <1-4294967295>",
947 BGP_STR
948 "Configure Route-Reflector Cluster-id\n"
949 "Route-Reflector Cluster-id as 32 bit quantity\n")
950
951DEFUN (no_bgp_cluster_id,
952 no_bgp_cluster_id_cmd,
953 "no bgp cluster-id",
954 NO_STR
955 BGP_STR
956 "Configure Route-Reflector Cluster-id\n")
957{
958 int ret;
959 struct bgp *bgp;
960 struct in_addr cluster;
961
962 bgp = vty->index;
963
964 if (argc == 1)
965 {
966 ret = inet_aton (argv[0], &cluster);
967 if (! ret)
968 {
969 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
970 return CMD_WARNING;
971 }
972 }
973
974 bgp_cluster_id_unset (bgp);
7aafcaca 975 bgp_clear_star_soft_out (vty);
718e3744 976
977 return CMD_SUCCESS;
978}
979
980ALIAS (no_bgp_cluster_id,
813d4307 981 no_bgp_cluster_id_ip_cmd,
718e3744 982 "no bgp cluster-id A.B.C.D",
983 NO_STR
984 BGP_STR
985 "Configure Route-Reflector Cluster-id\n"
986 "Route-Reflector Cluster-id in IP address format\n")
6b0655a2 987
813d4307
DW
988ALIAS (no_bgp_cluster_id,
989 no_bgp_cluster_id_decimal_cmd,
990 "no bgp cluster-id <1-4294967295>",
991 NO_STR
992 BGP_STR
993 "Configure Route-Reflector Cluster-id\n"
994 "Route-Reflector Cluster-id as 32 bit quantity\n")
995
718e3744 996DEFUN (bgp_confederation_identifier,
997 bgp_confederation_identifier_cmd,
320da874 998 "bgp confederation identifier " CMD_AS_RANGE,
718e3744 999 "BGP specific commands\n"
1000 "AS confederation parameters\n"
1001 "AS number\n"
1002 "Set routing domain confederation AS\n")
1003{
1004 struct bgp *bgp;
1005 as_t as;
1006
1007 bgp = vty->index;
1008
0b2aa3a0 1009 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
718e3744 1010
1011 bgp_confederation_id_set (bgp, as);
1012
1013 return CMD_SUCCESS;
1014}
1015
1016DEFUN (no_bgp_confederation_identifier,
1017 no_bgp_confederation_identifier_cmd,
1018 "no bgp confederation identifier",
1019 NO_STR
1020 "BGP specific commands\n"
1021 "AS confederation parameters\n"
1022 "AS number\n")
1023{
1024 struct bgp *bgp;
718e3744 1025
1026 bgp = vty->index;
1027
718e3744 1028 bgp_confederation_id_unset (bgp);
1029
1030 return CMD_SUCCESS;
1031}
1032
1033ALIAS (no_bgp_confederation_identifier,
1034 no_bgp_confederation_identifier_arg_cmd,
320da874 1035 "no bgp confederation identifier " CMD_AS_RANGE,
718e3744 1036 NO_STR
1037 "BGP specific commands\n"
1038 "AS confederation parameters\n"
1039 "AS number\n"
1040 "Set routing domain confederation AS\n")
6b0655a2 1041
718e3744 1042DEFUN (bgp_confederation_peers,
1043 bgp_confederation_peers_cmd,
320da874 1044 "bgp confederation peers ." CMD_AS_RANGE,
718e3744 1045 "BGP specific commands\n"
1046 "AS confederation parameters\n"
1047 "Peer ASs in BGP confederation\n"
1048 AS_STR)
1049{
1050 struct bgp *bgp;
1051 as_t as;
1052 int i;
1053
1054 bgp = vty->index;
1055
1056 for (i = 0; i < argc; i++)
1057 {
0b2aa3a0 1058 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
718e3744 1059
1060 if (bgp->as == as)
1061 {
1062 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
1063 VTY_NEWLINE);
1064 continue;
1065 }
1066
1067 bgp_confederation_peers_add (bgp, as);
1068 }
1069 return CMD_SUCCESS;
1070}
1071
1072DEFUN (no_bgp_confederation_peers,
1073 no_bgp_confederation_peers_cmd,
320da874 1074 "no bgp confederation peers ." CMD_AS_RANGE,
718e3744 1075 NO_STR
1076 "BGP specific commands\n"
1077 "AS confederation parameters\n"
1078 "Peer ASs in BGP confederation\n"
1079 AS_STR)
1080{
1081 struct bgp *bgp;
1082 as_t as;
1083 int i;
1084
1085 bgp = vty->index;
1086
1087 for (i = 0; i < argc; i++)
1088 {
0b2aa3a0
PJ
1089 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
1090
718e3744 1091 bgp_confederation_peers_remove (bgp, as);
1092 }
1093 return CMD_SUCCESS;
1094}
6b0655a2 1095
5e242b0d
DS
1096/**
1097 * Central routine for maximum-paths configuration.
1098 * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP
1099 * @set: 1 for setting values, 0 for removing the max-paths config.
1100 */
ffd0c037
DS
1101static int
1102bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths,
5e242b0d 1103 u_int16_t options, int set)
165b5fff
JB
1104{
1105 struct bgp *bgp;
ffd0c037 1106 u_int16_t maxpaths = 0;
165b5fff 1107 int ret;
5e242b0d
DS
1108 afi_t afi;
1109 safi_t safi;
165b5fff
JB
1110
1111 bgp = vty->index;
5e242b0d
DS
1112 afi = bgp_node_afi (vty);
1113 safi = bgp_node_safi (vty);
165b5fff 1114
5e242b0d
DS
1115 if (set)
1116 {
73ac8160 1117 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1,
5b964da3 1118 MULTIPATH_NUM);
5e242b0d
DS
1119 ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths,
1120 options);
1121 }
1122 else
1123 ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type);
165b5fff 1124
165b5fff
JB
1125 if (ret < 0)
1126 {
1127 vty_out (vty,
5e242b0d
DS
1128 "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s",
1129 (set == 1) ? "" : "un",
1130 (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp",
1131 maxpaths, afi, safi, VTY_NEWLINE);
165b5fff
JB
1132 return CMD_WARNING;
1133 }
1134
7aafcaca
DS
1135 bgp_recalculate_all_bestpaths (bgp);
1136
165b5fff
JB
1137 return CMD_SUCCESS;
1138}
1139
abc920f8
DS
1140DEFUN (bgp_maxmed_admin,
1141 bgp_maxmed_admin_cmd,
1142 "bgp max-med administrative ",
1143 BGP_STR
1144 "Advertise routes with max-med\n"
1145 "Administratively applied, for an indefinite period\n")
1146{
1147 struct bgp *bgp;
1148
1149 bgp = vty->index;
1150
1151 bgp->v_maxmed_admin = 1;
1152 bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT;
1153
1154 bgp_maxmed_update(bgp);
1155
1156 return CMD_SUCCESS;
1157}
1158
1159DEFUN (bgp_maxmed_admin_medv,
1160 bgp_maxmed_admin_medv_cmd,
1161 "bgp max-med administrative <0-4294967294>",
1162 BGP_STR
1163 "Advertise routes with max-med\n"
1164 "Administratively applied, for an indefinite period\n"
1165 "Max MED value to be used\n")
1166{
1167 struct bgp *bgp;
1168
1169 bgp = vty->index;
1170
1171 bgp->v_maxmed_admin = 1;
1172 VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[0]);
1173
1174 bgp_maxmed_update(bgp);
1175
1176 return CMD_SUCCESS;
1177}
1178
1179DEFUN (no_bgp_maxmed_admin,
1180 no_bgp_maxmed_admin_cmd,
1181 "no bgp max-med administrative",
1182 NO_STR
1183 BGP_STR
1184 "Advertise routes with max-med\n"
1185 "Administratively applied, for an indefinite period\n")
1186{
1187 struct bgp *bgp;
1188
1189 bgp = vty->index;
1190
1191 bgp->v_maxmed_admin = BGP_MAXMED_ADMIN_UNCONFIGURED;
1192 bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT;
1193
1194 bgp_maxmed_update(bgp);
1195
1196 return CMD_SUCCESS;
1197}
1198
1199ALIAS (no_bgp_maxmed_admin,
1200 no_bgp_maxmed_admin_medv_cmd,
1201 "no bgp max-med administrative <0-4294967294>",
1202 NO_STR
1203 BGP_STR
1204 "Advertise routes with max-med\n"
1205 "Administratively applied, for an indefinite period\n"
1206 "Max MED value to be used\n")
1207
1208
1209DEFUN (bgp_maxmed_onstartup,
1210 bgp_maxmed_onstartup_cmd,
1211 "bgp max-med on-startup <5-86400>",
1212 BGP_STR
1213 "Advertise routes with max-med\n"
1214 "Effective on a startup\n"
1215 "Time (seconds) period for max-med\n")
1216{
1217 struct bgp *bgp;
1218
1219 bgp = vty->index;
1220
1221 if (argc != 1)
1222 {
1223 vty_out (vty, "%% Must supply max-med on-startup period");
1224 return CMD_WARNING;
1225 }
1226
1227 VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]);
1228 bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT;
1229
1230 bgp_maxmed_update(bgp);
1231
1232 return CMD_SUCCESS;
1233}
1234
1235DEFUN (bgp_maxmed_onstartup_medv,
1236 bgp_maxmed_onstartup_medv_cmd,
1237 "bgp max-med on-startup <5-86400> <0-4294967294>",
1238 BGP_STR
1239 "Advertise routes with max-med\n"
1240 "Effective on a startup\n"
1241 "Time (seconds) period for max-med\n"
1242 "Max MED value to be used\n")
1243{
1244 struct bgp *bgp;
1245
1246 bgp = vty->index;
1247
1248 if (argc != 2)
1249 {
1250 vty_out (vty, "%% Must supply max-med on-startup period and med value");
1251 return CMD_WARNING;
1252 }
1253
1254 VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]);
1255 VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[1]);
1256
1257 bgp_maxmed_update(bgp);
1258
1259 return CMD_SUCCESS;
1260}
1261
1262DEFUN (no_bgp_maxmed_onstartup,
1263 no_bgp_maxmed_onstartup_cmd,
1264 "no bgp max-med on-startup",
1265 NO_STR
1266 BGP_STR
1267 "Advertise routes with max-med\n"
1268 "Effective on a startup\n")
1269{
1270 struct bgp *bgp;
1271
1272 bgp = vty->index;
1273
1274 /* Cancel max-med onstartup if its on */
1275 if (bgp->t_maxmed_onstartup)
1276 {
1277 THREAD_TIMER_OFF (bgp->t_maxmed_onstartup);
1278 bgp->maxmed_onstartup_over = 1;
1279 }
1280
1281 bgp->v_maxmed_onstartup = BGP_MAXMED_ONSTARTUP_UNCONFIGURED;
1282 bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT;
1283
1284 bgp_maxmed_update(bgp);
1285
1286 return CMD_SUCCESS;
1287}
1288
1289ALIAS (no_bgp_maxmed_onstartup,
1290 no_bgp_maxmed_onstartup_period_cmd,
1291 "no bgp max-med on-startup <5-86400>",
1292 NO_STR
1293 BGP_STR
1294 "Advertise routes with max-med\n"
1295 "Effective on a startup\n"
1296 "Time (seconds) period for max-med\n")
1297
1298ALIAS (no_bgp_maxmed_onstartup,
1299 no_bgp_maxmed_onstartup_period_medv_cmd,
1300 "no bgp max-med on-startup <5-86400> <0-4294967294>",
1301 NO_STR
1302 BGP_STR
1303 "Advertise routes with max-med\n"
1304 "Effective on a startup\n"
1305 "Time (seconds) period for max-med\n"
1306 "Max MED value to be used\n")
1307
f188f2c4
DS
1308static int
1309bgp_update_delay_config_vty (struct vty *vty, const char *delay,
1310 const char *wait)
1311{
1312 struct bgp *bgp;
1313 u_int16_t update_delay;
1314 u_int16_t establish_wait;
1315
1316
1317 bgp = vty->index;
1318
1319 VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay,
1320 BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX);
1321
1322 if (!wait) /* update-delay <delay> */
1323 {
1324 bgp->v_update_delay = update_delay;
1325 bgp->v_establish_wait = bgp->v_update_delay;
1326 return CMD_SUCCESS;
1327 }
1328
1329 /* update-delay <delay> <establish-wait> */
1330 establish_wait = atoi (wait);
1331 if (update_delay < establish_wait)
1332 {
1333 vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s",
1334 VTY_NEWLINE);
1335 return CMD_WARNING;
1336 }
1337
1338 bgp->v_update_delay = update_delay;
1339 bgp->v_establish_wait = establish_wait;
1340
1341 return CMD_SUCCESS;
1342}
1343
1344static int
1345bgp_update_delay_deconfig_vty (struct vty *vty)
1346{
1347 struct bgp *bgp;
1348
1349 bgp = vty->index;
1350
1351 bgp->v_update_delay = BGP_UPDATE_DELAY_DEF;
1352 bgp->v_establish_wait = bgp->v_update_delay;
1353
1354 return CMD_SUCCESS;
1355}
1356
1357int
1358bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp)
1359{
1360 if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF)
1361 {
1362 vty_out (vty, " update-delay %d", bgp->v_update_delay);
1363 if (bgp->v_update_delay != bgp->v_establish_wait)
1364 vty_out (vty, " %d", bgp->v_establish_wait);
1365 vty_out (vty, "%s", VTY_NEWLINE);
1366 }
1367
1368 return 0;
1369}
1370
1371
1372/* Update-delay configuration */
1373DEFUN (bgp_update_delay,
1374 bgp_update_delay_cmd,
1375 "update-delay <0-3600>",
1376 "Force initial delay for best-path and updates\n"
1377 "Seconds\n")
1378{
1379 return bgp_update_delay_config_vty(vty, argv[0], NULL);
1380}
1381
1382DEFUN (bgp_update_delay_establish_wait,
1383 bgp_update_delay_establish_wait_cmd,
1384 "update-delay <0-3600> <1-3600>",
1385 "Force initial delay for best-path and updates\n"
1386 "Seconds\n"
1387 "Wait for peers to be established\n"
1388 "Seconds\n")
1389{
1390 return bgp_update_delay_config_vty(vty, argv[0], argv[1]);
1391}
1392
1393/* Update-delay deconfiguration */
1394DEFUN (no_bgp_update_delay,
1395 no_bgp_update_delay_cmd,
1396 "no update-delay <0-3600>",
1397 "Force initial delay for best-path and updates\n"
1398 "Seconds\n")
1399{
1400 return bgp_update_delay_deconfig_vty(vty);
1401}
1402
1403ALIAS (no_bgp_update_delay,
1404 no_bgp_update_delay_establish_wait_cmd,
1405 "no update-delay <0-3600> <1-3600>",
1406 "Force initial delay for best-path and updates\n"
1407 "Seconds\n"
1408 "Wait for peers to be established\n"
1409 "Seconds\n")
5e242b0d 1410
ffd0c037
DS
1411static int
1412bgp_wpkt_quanta_config_vty (struct vty *vty, const char *num, char set)
cb1faec9
DS
1413{
1414 struct bgp *bgp;
cb1faec9
DS
1415
1416 bgp = vty->index;
1417
1418 if (set)
1419 VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num,
4543bbb4 1420 1, 10000);
cb1faec9
DS
1421 else
1422 bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX;
1423
1424 return CMD_SUCCESS;
1425}
1426
1427int
1428bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp)
1429{
1430 if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX)
1431 vty_out (vty, " write-quanta %d%s",
1432 bgp->wpkt_quanta, VTY_NEWLINE);
1433
1434 return 0;
1435}
1436
1437
1438/* Update-delay configuration */
1439DEFUN (bgp_wpkt_quanta,
1440 bgp_wpkt_quanta_cmd,
4543bbb4 1441 "write-quanta <1-10000>",
cb1faec9
DS
1442 "How many packets to write to peer socket per run\n"
1443 "Number of packets\n")
1444{
1445 return bgp_wpkt_quanta_config_vty(vty, argv[0], 1);
1446}
1447
1448/* Update-delay deconfiguration */
1449DEFUN (no_bgp_wpkt_quanta,
1450 no_bgp_wpkt_quanta_cmd,
4543bbb4 1451 "no write-quanta <1-10000>",
cb1faec9
DS
1452 "How many packets to write to peer socket per run\n"
1453 "Number of packets\n")
1454{
1455 return bgp_wpkt_quanta_config_vty(vty, argv[0], 0);
1456}
1457
ffd0c037 1458static int
3f9c7369
DS
1459bgp_coalesce_config_vty (struct vty *vty, const char *num, char set)
1460{
1461 struct bgp *bgp;
1462
1463 bgp = vty->index;
1464
1465 if (set)
1466 VTY_GET_INTEGER_RANGE ("coalesce-time", bgp->coalesce_time, num,
1467 0, 4294967295);
1468 else
1469 bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME;
1470
1471 return CMD_SUCCESS;
1472}
1473
1474int
1475bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp)
1476{
1477 if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME)
1478 vty_out (vty, " coalesce-time %d%s",
1479 bgp->coalesce_time, VTY_NEWLINE);
1480
1481 return 0;
1482}
1483
1484
1485DEFUN (bgp_coalesce_time,
1486 bgp_coalesce_time_cmd,
1487 "coalesce-time <0-4294967295>",
1488 "Subgroup coalesce timer\n"
1489 "Subgroup coalesce timer value (in ms)\n")
1490{
1491 return bgp_coalesce_config_vty(vty, argv[0], 1);
1492}
1493
1494DEFUN (no_bgp_coalesce_time,
1495 no_bgp_coalesce_time_cmd,
1496 "no coalesce-time <0-4294967295>",
1497 "Subgroup coalesce timer\n"
1498 "Subgroup coalesce timer value (in ms)\n")
1499{
1500 return bgp_coalesce_config_vty(vty, argv[0], 0);
1501}
1502
5e242b0d
DS
1503/* Maximum-paths configuration */
1504DEFUN (bgp_maxpaths,
1505 bgp_maxpaths_cmd,
a565fbdd 1506 "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
5e242b0d
DS
1507 "Forward packets over multiple paths\n"
1508 "Number of paths\n")
1509{
1510 return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1);
1511}
1512
165b5fff
JB
1513DEFUN (bgp_maxpaths_ibgp,
1514 bgp_maxpaths_ibgp_cmd,
a565fbdd 1515 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
165b5fff
JB
1516 "Forward packets over multiple paths\n"
1517 "iBGP-multipath\n"
1518 "Number of paths\n")
1519{
5e242b0d
DS
1520 return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1);
1521}
165b5fff 1522
5e242b0d
DS
1523DEFUN (bgp_maxpaths_ibgp_cluster,
1524 bgp_maxpaths_ibgp_cluster_cmd,
a565fbdd 1525 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length",
5e242b0d
DS
1526 "Forward packets over multiple paths\n"
1527 "iBGP-multipath\n"
1528 "Number of paths\n"
1529 "Match the cluster length\n")
1530{
1531 return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0],
1532 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1);
165b5fff
JB
1533}
1534
1535DEFUN (no_bgp_maxpaths,
1536 no_bgp_maxpaths_cmd,
1537 "no maximum-paths",
1538 NO_STR
1539 "Forward packets over multiple paths\n"
1540 "Number of paths\n")
1541{
5e242b0d 1542 return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0);
165b5fff
JB
1543}
1544
1545ALIAS (no_bgp_maxpaths,
1546 no_bgp_maxpaths_arg_cmd,
a565fbdd 1547 "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
165b5fff
JB
1548 NO_STR
1549 "Forward packets over multiple paths\n"
1550 "Number of paths\n")
1551
1552DEFUN (no_bgp_maxpaths_ibgp,
1553 no_bgp_maxpaths_ibgp_cmd,
1554 "no maximum-paths ibgp",
1555 NO_STR
1556 "Forward packets over multiple paths\n"
1557 "iBGP-multipath\n"
1558 "Number of paths\n")
1559{
5e242b0d 1560 return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0);
165b5fff
JB
1561}
1562
1563ALIAS (no_bgp_maxpaths_ibgp,
1564 no_bgp_maxpaths_ibgp_arg_cmd,
a565fbdd 1565 "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
165b5fff
JB
1566 NO_STR
1567 "Forward packets over multiple paths\n"
1568 "iBGP-multipath\n"
1569 "Number of paths\n")
1570
5e242b0d
DS
1571ALIAS (no_bgp_maxpaths_ibgp,
1572 no_bgp_maxpaths_ibgp_cluster_cmd,
a565fbdd 1573 "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length",
5e242b0d
DS
1574 NO_STR
1575 "Forward packets over multiple paths\n"
1576 "iBGP-multipath\n"
1577 "Number of paths\n"
1578 "Match the cluster length\n")
1579
165b5fff
JB
1580int
1581bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
1582 safi_t safi, int *write)
1583{
d5b77cc2 1584 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != MULTIPATH_NUM)
165b5fff
JB
1585 {
1586 bgp_config_write_family_header (vty, afi, safi, write);
0b960b4d 1587 vty_out (vty, " maximum-paths %d%s",
165b5fff
JB
1588 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
1589 }
1590
d5b77cc2 1591 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != MULTIPATH_NUM)
165b5fff
JB
1592 {
1593 bgp_config_write_family_header (vty, afi, safi, write);
0b960b4d 1594 vty_out (vty, " maximum-paths ibgp %d",
5e242b0d
DS
1595 bgp->maxpaths[afi][safi].maxpaths_ibgp);
1596 if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags,
1597 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN))
1598 vty_out (vty, " equal-cluster-length");
1599 vty_out (vty, "%s", VTY_NEWLINE);
165b5fff
JB
1600 }
1601
1602 return 0;
1603}
6b0655a2 1604
718e3744 1605/* BGP timers. */
1606
1607DEFUN (bgp_timers,
1608 bgp_timers_cmd,
1609 "timers bgp <0-65535> <0-65535>",
1610 "Adjust routing timers\n"
1611 "BGP timers\n"
1612 "Keepalive interval\n"
1613 "Holdtime\n")
1614{
1615 struct bgp *bgp;
1616 unsigned long keepalive = 0;
1617 unsigned long holdtime = 0;
1618
1619 bgp = vty->index;
1620
1621 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
1622 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
1623
1624 /* Holdtime value check. */
1625 if (holdtime < 3 && holdtime != 0)
1626 {
1627 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
1628 VTY_NEWLINE);
1629 return CMD_WARNING;
1630 }
1631
1632 bgp_timers_set (bgp, keepalive, holdtime);
1633
1634 return CMD_SUCCESS;
1635}
1636
1637DEFUN (no_bgp_timers,
1638 no_bgp_timers_cmd,
1639 "no timers bgp",
1640 NO_STR
1641 "Adjust routing timers\n"
1642 "BGP timers\n")
1643{
1644 struct bgp *bgp;
1645
1646 bgp = vty->index;
1647 bgp_timers_unset (bgp);
1648
1649 return CMD_SUCCESS;
1650}
1651
1652ALIAS (no_bgp_timers,
1653 no_bgp_timers_arg_cmd,
1654 "no timers bgp <0-65535> <0-65535>",
1655 NO_STR
1656 "Adjust routing timers\n"
1657 "BGP timers\n"
1658 "Keepalive interval\n"
1659 "Holdtime\n")
6b0655a2 1660
718e3744 1661DEFUN (bgp_client_to_client_reflection,
1662 bgp_client_to_client_reflection_cmd,
1663 "bgp client-to-client reflection",
1664 "BGP specific commands\n"
1665 "Configure client to client route reflection\n"
1666 "reflection of routes allowed\n")
1667{
1668 struct bgp *bgp;
1669
1670 bgp = vty->index;
1671 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
7aafcaca
DS
1672 bgp_clear_star_soft_out (vty);
1673
718e3744 1674 return CMD_SUCCESS;
1675}
1676
1677DEFUN (no_bgp_client_to_client_reflection,
1678 no_bgp_client_to_client_reflection_cmd,
1679 "no bgp client-to-client reflection",
1680 NO_STR
1681 "BGP specific commands\n"
1682 "Configure client to client route reflection\n"
1683 "reflection of routes allowed\n")
1684{
1685 struct bgp *bgp;
1686
1687 bgp = vty->index;
1688 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
7aafcaca
DS
1689 bgp_clear_star_soft_out (vty);
1690
718e3744 1691 return CMD_SUCCESS;
1692}
1693
1694/* "bgp always-compare-med" configuration. */
1695DEFUN (bgp_always_compare_med,
1696 bgp_always_compare_med_cmd,
1697 "bgp always-compare-med",
1698 "BGP specific commands\n"
1699 "Allow comparing MED from different neighbors\n")
1700{
1701 struct bgp *bgp;
1702
1703 bgp = vty->index;
1704 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
7aafcaca
DS
1705 bgp_recalculate_all_bestpaths (bgp);
1706
718e3744 1707 return CMD_SUCCESS;
1708}
1709
1710DEFUN (no_bgp_always_compare_med,
1711 no_bgp_always_compare_med_cmd,
1712 "no bgp always-compare-med",
1713 NO_STR
1714 "BGP specific commands\n"
1715 "Allow comparing MED from different neighbors\n")
1716{
1717 struct bgp *bgp;
1718
1719 bgp = vty->index;
1720 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
7aafcaca
DS
1721 bgp_recalculate_all_bestpaths (bgp);
1722
718e3744 1723 return CMD_SUCCESS;
1724}
6b0655a2 1725
718e3744 1726/* "bgp deterministic-med" configuration. */
1727DEFUN (bgp_deterministic_med,
1728 bgp_deterministic_med_cmd,
1729 "bgp deterministic-med",
1730 "BGP specific commands\n"
1731 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1732{
1733 struct bgp *bgp;
1734
1735 bgp = vty->index;
1475ac87
DW
1736
1737 if (!bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED))
1738 {
1739 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
1740 bgp_recalculate_all_bestpaths (bgp);
1741 }
7aafcaca 1742
718e3744 1743 return CMD_SUCCESS;
1744}
1745
1746DEFUN (no_bgp_deterministic_med,
1747 no_bgp_deterministic_med_cmd,
1748 "no bgp deterministic-med",
1749 NO_STR
1750 "BGP specific commands\n"
1751 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1752{
1753 struct bgp *bgp;
06370dac
DW
1754 int bestpath_per_as_used;
1755 afi_t afi;
1756 safi_t safi;
1757 struct peer *peer;
1758 struct listnode *node, *nnode;
718e3744 1759
1760 bgp = vty->index;
1475ac87
DW
1761
1762 if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED))
1763 {
06370dac
DW
1764 bestpath_per_as_used = 0;
1765
1766 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
1767 {
1768 for (afi = AFI_IP; afi < AFI_MAX; afi++)
1769 for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
1770 if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS))
1771 {
1772 bestpath_per_as_used = 1;
1773 break;
1774 }
1775
1776 if (bestpath_per_as_used)
1777 break;
1778 }
1779
1780 if (bestpath_per_as_used)
1781 {
1782 vty_out (vty, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s",
1783 VTY_NEWLINE);
1784 return CMD_WARNING;
1785 }
1786 else
1787 {
1788 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
1789 bgp_recalculate_all_bestpaths (bgp);
1790 }
1475ac87 1791 }
7aafcaca 1792
718e3744 1793 return CMD_SUCCESS;
1794}
538621f2 1795
1796/* "bgp graceful-restart" configuration. */
1797DEFUN (bgp_graceful_restart,
1798 bgp_graceful_restart_cmd,
1799 "bgp graceful-restart",
1800 "BGP specific commands\n"
1801 "Graceful restart capability parameters\n")
1802{
1803 struct bgp *bgp;
1804
1805 bgp = vty->index;
1806 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
1807 return CMD_SUCCESS;
1808}
1809
1810DEFUN (no_bgp_graceful_restart,
1811 no_bgp_graceful_restart_cmd,
1812 "no bgp graceful-restart",
1813 NO_STR
1814 "BGP specific commands\n"
1815 "Graceful restart capability parameters\n")
1816{
1817 struct bgp *bgp;
1818
1819 bgp = vty->index;
1820 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
1821 return CMD_SUCCESS;
1822}
1823
93406d87 1824DEFUN (bgp_graceful_restart_stalepath_time,
1825 bgp_graceful_restart_stalepath_time_cmd,
1826 "bgp graceful-restart stalepath-time <1-3600>",
1827 "BGP specific commands\n"
1828 "Graceful restart capability parameters\n"
1829 "Set the max time to hold onto restarting peer's stale paths\n"
1830 "Delay value (seconds)\n")
1831{
1832 struct bgp *bgp;
1833 u_int32_t stalepath;
1834
1835 bgp = vty->index;
1836 if (! bgp)
1837 return CMD_WARNING;
1838
1839 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
1840 bgp->stalepath_time = stalepath;
1841 return CMD_SUCCESS;
1842}
1843
1844DEFUN (no_bgp_graceful_restart_stalepath_time,
1845 no_bgp_graceful_restart_stalepath_time_cmd,
1846 "no bgp graceful-restart stalepath-time",
1847 NO_STR
1848 "BGP specific commands\n"
1849 "Graceful restart capability parameters\n"
1850 "Set the max time to hold onto restarting peer's stale paths\n")
1851{
1852 struct bgp *bgp;
1853
1854 bgp = vty->index;
1855 if (! bgp)
1856 return CMD_WARNING;
1857
1858 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1859 return CMD_SUCCESS;
1860}
1861
1862ALIAS (no_bgp_graceful_restart_stalepath_time,
1863 no_bgp_graceful_restart_stalepath_time_val_cmd,
1864 "no bgp graceful-restart stalepath-time <1-3600>",
1865 NO_STR
1866 "BGP specific commands\n"
1867 "Graceful restart capability parameters\n"
1868 "Set the max time to hold onto restarting peer's stale paths\n"
1869 "Delay value (seconds)\n")
1870
718e3744 1871/* "bgp fast-external-failover" configuration. */
1872DEFUN (bgp_fast_external_failover,
1873 bgp_fast_external_failover_cmd,
1874 "bgp fast-external-failover",
1875 BGP_STR
1876 "Immediately reset session if a link to a directly connected external peer goes down\n")
1877{
1878 struct bgp *bgp;
1879
1880 bgp = vty->index;
1881 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1882 return CMD_SUCCESS;
1883}
1884
1885DEFUN (no_bgp_fast_external_failover,
1886 no_bgp_fast_external_failover_cmd,
1887 "no bgp fast-external-failover",
1888 NO_STR
1889 BGP_STR
1890 "Immediately reset session if a link to a directly connected external peer goes down\n")
1891{
1892 struct bgp *bgp;
1893
1894 bgp = vty->index;
1895 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1896 return CMD_SUCCESS;
1897}
6b0655a2 1898
718e3744 1899/* "bgp enforce-first-as" configuration. */
1900DEFUN (bgp_enforce_first_as,
1901 bgp_enforce_first_as_cmd,
1902 "bgp enforce-first-as",
1903 BGP_STR
1904 "Enforce the first AS for EBGP routes\n")
1905{
1906 struct bgp *bgp;
1907
1908 bgp = vty->index;
1909 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
7aafcaca
DS
1910 bgp_clear_star_soft_in (vty);
1911
718e3744 1912 return CMD_SUCCESS;
1913}
1914
1915DEFUN (no_bgp_enforce_first_as,
1916 no_bgp_enforce_first_as_cmd,
1917 "no bgp enforce-first-as",
1918 NO_STR
1919 BGP_STR
1920 "Enforce the first AS for EBGP routes\n")
1921{
1922 struct bgp *bgp;
1923
1924 bgp = vty->index;
1925 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
7aafcaca
DS
1926 bgp_clear_star_soft_in (vty);
1927
718e3744 1928 return CMD_SUCCESS;
1929}
6b0655a2 1930
718e3744 1931/* "bgp bestpath compare-routerid" configuration. */
1932DEFUN (bgp_bestpath_compare_router_id,
1933 bgp_bestpath_compare_router_id_cmd,
1934 "bgp bestpath compare-routerid",
1935 "BGP specific commands\n"
1936 "Change the default bestpath selection\n"
1937 "Compare router-id for identical EBGP paths\n")
1938{
1939 struct bgp *bgp;
1940
1941 bgp = vty->index;
1942 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
7aafcaca
DS
1943 bgp_recalculate_all_bestpaths (bgp);
1944
718e3744 1945 return CMD_SUCCESS;
1946}
1947
1948DEFUN (no_bgp_bestpath_compare_router_id,
1949 no_bgp_bestpath_compare_router_id_cmd,
1950 "no bgp bestpath compare-routerid",
1951 NO_STR
1952 "BGP specific commands\n"
1953 "Change the default bestpath selection\n"
1954 "Compare router-id for identical EBGP paths\n")
1955{
1956 struct bgp *bgp;
1957
1958 bgp = vty->index;
1959 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
7aafcaca
DS
1960 bgp_recalculate_all_bestpaths (bgp);
1961
718e3744 1962 return CMD_SUCCESS;
1963}
6b0655a2 1964
718e3744 1965/* "bgp bestpath as-path ignore" configuration. */
1966DEFUN (bgp_bestpath_aspath_ignore,
1967 bgp_bestpath_aspath_ignore_cmd,
1968 "bgp bestpath as-path ignore",
1969 "BGP specific commands\n"
1970 "Change the default bestpath selection\n"
1971 "AS-path attribute\n"
1972 "Ignore as-path length in selecting a route\n")
1973{
1974 struct bgp *bgp;
1975
1976 bgp = vty->index;
1977 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
7aafcaca
DS
1978 bgp_recalculate_all_bestpaths (bgp);
1979
718e3744 1980 return CMD_SUCCESS;
1981}
1982
1983DEFUN (no_bgp_bestpath_aspath_ignore,
1984 no_bgp_bestpath_aspath_ignore_cmd,
1985 "no bgp bestpath as-path ignore",
1986 NO_STR
1987 "BGP specific commands\n"
1988 "Change the default bestpath selection\n"
1989 "AS-path attribute\n"
1990 "Ignore as-path length in selecting a route\n")
1991{
1992 struct bgp *bgp;
1993
1994 bgp = vty->index;
1995 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
7aafcaca
DS
1996 bgp_recalculate_all_bestpaths (bgp);
1997
718e3744 1998 return CMD_SUCCESS;
1999}
6b0655a2 2000
6811845b 2001/* "bgp bestpath as-path confed" configuration. */
2002DEFUN (bgp_bestpath_aspath_confed,
2003 bgp_bestpath_aspath_confed_cmd,
2004 "bgp bestpath as-path confed",
2005 "BGP specific commands\n"
2006 "Change the default bestpath selection\n"
2007 "AS-path attribute\n"
2008 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2009{
2010 struct bgp *bgp;
2011
2012 bgp = vty->index;
2013 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
7aafcaca
DS
2014 bgp_recalculate_all_bestpaths (bgp);
2015
6811845b 2016 return CMD_SUCCESS;
2017}
2018
2019DEFUN (no_bgp_bestpath_aspath_confed,
2020 no_bgp_bestpath_aspath_confed_cmd,
2021 "no bgp bestpath as-path confed",
2022 NO_STR
2023 "BGP specific commands\n"
2024 "Change the default bestpath selection\n"
2025 "AS-path attribute\n"
2026 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2027{
2028 struct bgp *bgp;
2029
2030 bgp = vty->index;
2031 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
7aafcaca
DS
2032 bgp_recalculate_all_bestpaths (bgp);
2033
6811845b 2034 return CMD_SUCCESS;
2035}
6b0655a2 2036
2fdd455c
PM
2037/* "bgp bestpath as-path multipath-relax" configuration. */
2038DEFUN (bgp_bestpath_aspath_multipath_relax,
2039 bgp_bestpath_aspath_multipath_relax_cmd,
219178b6 2040 "bgp bestpath as-path multipath-relax {as-set|no-as-set}",
16fc1eec
DS
2041 "BGP specific commands\n"
2042 "Change the default bestpath selection\n"
2043 "AS-path attribute\n"
2044 "Allow load sharing across routes that have different AS paths (but same length)\n"
219178b6 2045 "Generate an AS_SET\n"
16fc1eec
DS
2046 "Do not generate an AS_SET\n")
2047{
2048 struct bgp *bgp;
2049
2050 bgp = vty->index;
2051 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
219178b6
DW
2052
2053 /* no-as-set is now the default behavior so we can silently
2054 * ignore it */
2055 if (argv[0] != NULL && strncmp (argv[0], "a", 1) == 0)
2056 bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET);
2057 else
2058 bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET) ;
2059
7aafcaca
DS
2060 bgp_recalculate_all_bestpaths (bgp);
2061
16fc1eec
DS
2062 return CMD_SUCCESS;
2063}
2064
219178b6
DW
2065DEFUN (no_bgp_bestpath_aspath_multipath_relax,
2066 no_bgp_bestpath_aspath_multipath_relax_cmd,
2067 "no bgp bestpath as-path multipath-relax {as-set|no-as-set}",
16fc1eec
DS
2068 NO_STR
2069 "BGP specific commands\n"
2070 "Change the default bestpath selection\n"
2071 "AS-path attribute\n"
2072 "Allow load sharing across routes that have different AS paths (but same length)\n"
219178b6 2073 "Generate an AS_SET\n"
16fc1eec
DS
2074 "Do not generate an AS_SET\n")
2075{
2076 struct bgp *bgp;
2077
2078 bgp = vty->index;
2079 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
219178b6 2080 bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET);
7aafcaca
DS
2081 bgp_recalculate_all_bestpaths (bgp);
2082
2fdd455c
PM
2083 return CMD_SUCCESS;
2084}
6b0655a2 2085
848973c7 2086/* "bgp log-neighbor-changes" configuration. */
2087DEFUN (bgp_log_neighbor_changes,
2088 bgp_log_neighbor_changes_cmd,
2089 "bgp log-neighbor-changes",
2090 "BGP specific commands\n"
2091 "Log neighbor up/down and reset reason\n")
2092{
2093 struct bgp *bgp;
2094
2095 bgp = vty->index;
2096 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
2097 return CMD_SUCCESS;
2098}
2099
2100DEFUN (no_bgp_log_neighbor_changes,
2101 no_bgp_log_neighbor_changes_cmd,
2102 "no bgp log-neighbor-changes",
2103 NO_STR
2104 "BGP specific commands\n"
2105 "Log neighbor up/down and reset reason\n")
2106{
2107 struct bgp *bgp;
2108
2109 bgp = vty->index;
2110 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
2111 return CMD_SUCCESS;
2112}
6b0655a2 2113
718e3744 2114/* "bgp bestpath med" configuration. */
2115DEFUN (bgp_bestpath_med,
2116 bgp_bestpath_med_cmd,
2117 "bgp bestpath med (confed|missing-as-worst)",
2118 "BGP specific commands\n"
2119 "Change the default bestpath selection\n"
2120 "MED attribute\n"
2121 "Compare MED among confederation paths\n"
2122 "Treat missing MED as the least preferred one\n")
2123{
2124 struct bgp *bgp;
2125
2126 bgp = vty->index;
2127
2128 if (strncmp (argv[0], "confed", 1) == 0)
2129 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
2130 else
2131 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
2132
7aafcaca
DS
2133 bgp_recalculate_all_bestpaths (bgp);
2134
718e3744 2135 return CMD_SUCCESS;
2136}
2137
2138DEFUN (bgp_bestpath_med2,
2139 bgp_bestpath_med2_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 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
2151 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
7aafcaca
DS
2152 bgp_recalculate_all_bestpaths (bgp);
2153
718e3744 2154 return CMD_SUCCESS;
2155}
2156
2157ALIAS (bgp_bestpath_med2,
2158 bgp_bestpath_med3_cmd,
2159 "bgp bestpath med missing-as-worst confed",
2160 "BGP specific commands\n"
2161 "Change the default bestpath selection\n"
2162 "MED attribute\n"
2163 "Treat missing MED as the least preferred one\n"
2164 "Compare MED among confederation paths\n")
2165
2166DEFUN (no_bgp_bestpath_med,
2167 no_bgp_bestpath_med_cmd,
2168 "no bgp bestpath med (confed|missing-as-worst)",
2169 NO_STR
2170 "BGP specific commands\n"
2171 "Change the default bestpath selection\n"
2172 "MED attribute\n"
2173 "Compare MED among confederation paths\n"
2174 "Treat missing MED as the least preferred one\n")
2175{
2176 struct bgp *bgp;
2177
2178 bgp = vty->index;
2179
2180 if (strncmp (argv[0], "confed", 1) == 0)
2181 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
2182 else
2183 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
2184
7aafcaca
DS
2185 bgp_recalculate_all_bestpaths (bgp);
2186
718e3744 2187 return CMD_SUCCESS;
2188}
2189
2190DEFUN (no_bgp_bestpath_med2,
2191 no_bgp_bestpath_med2_cmd,
2192 "no bgp bestpath med confed missing-as-worst",
2193 NO_STR
2194 "BGP specific commands\n"
2195 "Change the default bestpath selection\n"
2196 "MED attribute\n"
2197 "Compare MED among confederation paths\n"
2198 "Treat missing MED as the least preferred one\n")
2199{
2200 struct bgp *bgp;
2201
2202 bgp = vty->index;
2203 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
2204 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
7aafcaca
DS
2205 bgp_recalculate_all_bestpaths (bgp);
2206
718e3744 2207 return CMD_SUCCESS;
2208}
2209
2210ALIAS (no_bgp_bestpath_med2,
2211 no_bgp_bestpath_med3_cmd,
2212 "no bgp bestpath med missing-as-worst confed",
2213 NO_STR
2214 "BGP specific commands\n"
2215 "Change the default bestpath selection\n"
2216 "MED attribute\n"
2217 "Treat missing MED as the least preferred one\n"
2218 "Compare MED among confederation paths\n")
6b0655a2 2219
718e3744 2220/* "no bgp default ipv4-unicast". */
2221DEFUN (no_bgp_default_ipv4_unicast,
2222 no_bgp_default_ipv4_unicast_cmd,
2223 "no bgp default ipv4-unicast",
2224 NO_STR
2225 "BGP specific commands\n"
2226 "Configure BGP defaults\n"
2227 "Activate ipv4-unicast for a peer by default\n")
2228{
2229 struct bgp *bgp;
2230
2231 bgp = vty->index;
2232 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
2233 return CMD_SUCCESS;
2234}
2235
2236DEFUN (bgp_default_ipv4_unicast,
2237 bgp_default_ipv4_unicast_cmd,
2238 "bgp default ipv4-unicast",
2239 "BGP specific commands\n"
2240 "Configure BGP defaults\n"
2241 "Activate ipv4-unicast for a peer by default\n")
2242{
2243 struct bgp *bgp;
2244
2245 bgp = vty->index;
2246 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
2247 return CMD_SUCCESS;
2248}
6b0655a2 2249
04b6bdc0
DW
2250/* Display hostname in certain command outputs */
2251DEFUN (bgp_default_show_hostname,
2252 bgp_default_show_hostname_cmd,
2253 "bgp default show-hostname",
2254 "BGP specific commands\n"
2255 "Configure BGP defaults\n"
2256 "Show hostname in certain command ouputs\n")
2257{
2258 struct bgp *bgp;
2259
2260 bgp = vty->index;
2261 bgp_flag_set (bgp, BGP_FLAG_SHOW_HOSTNAME);
2262 return CMD_SUCCESS;
2263}
2264
2265DEFUN (no_bgp_default_show_hostname,
2266 no_bgp_default_show_hostname_cmd,
2267 "no bgp default show-hostname",
2268 NO_STR
2269 "BGP specific commands\n"
2270 "Configure BGP defaults\n"
2271 "Show hostname in certain command ouputs\n")
2272{
2273 struct bgp *bgp;
2274
2275 bgp = vty->index;
2276 bgp_flag_unset (bgp, BGP_FLAG_SHOW_HOSTNAME);
2277 return CMD_SUCCESS;
2278}
2279
8233ef81 2280/* "bgp network import-check" configuration. */
718e3744 2281DEFUN (bgp_network_import_check,
2282 bgp_network_import_check_cmd,
5623e905 2283 "bgp network import-check",
718e3744 2284 "BGP specific commands\n"
2285 "BGP network command\n"
5623e905 2286 "Check BGP network route exists in IGP\n")
718e3744 2287{
2288 struct bgp *bgp;
2289
2290 bgp = vty->index;
078430f6
DS
2291 if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK))
2292 {
2293 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
5623e905 2294 bgp_static_redo_import_check(bgp);
078430f6
DS
2295 }
2296
718e3744 2297 return CMD_SUCCESS;
2298}
2299
8233ef81
DW
2300ALIAS_HIDDEN (bgp_network_import_check,
2301 bgp_network_import_check_exact_cmd,
2302 "bgp network import-check exact",
2303 "BGP specific commands\n"
2304 "BGP network command\n"
2305 "Check BGP network route exists in IGP\n"
2306 "Match route precisely\n")
2307
718e3744 2308DEFUN (no_bgp_network_import_check,
2309 no_bgp_network_import_check_cmd,
5623e905 2310 "no bgp network import-check",
718e3744 2311 NO_STR
2312 "BGP specific commands\n"
2313 "BGP network command\n"
2314 "Check BGP network route exists in IGP\n")
2315{
2316 struct bgp *bgp;
2317
2318 bgp = vty->index;
078430f6
DS
2319 if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK))
2320 {
2321 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
078430f6
DS
2322 bgp_static_redo_import_check(bgp);
2323 }
5623e905 2324
718e3744 2325 return CMD_SUCCESS;
2326}
6b0655a2 2327
718e3744 2328DEFUN (bgp_default_local_preference,
2329 bgp_default_local_preference_cmd,
2330 "bgp default local-preference <0-4294967295>",
2331 "BGP specific commands\n"
2332 "Configure BGP defaults\n"
2333 "local preference (higher=more preferred)\n"
2334 "Configure default local preference value\n")
2335{
2336 struct bgp *bgp;
2337 u_int32_t local_pref;
2338
2339 bgp = vty->index;
2340
2341 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
2342
2343 bgp_default_local_preference_set (bgp, local_pref);
7aafcaca 2344 bgp_clear_star_soft_in (vty);
718e3744 2345
2346 return CMD_SUCCESS;
2347}
2348
2349DEFUN (no_bgp_default_local_preference,
2350 no_bgp_default_local_preference_cmd,
2351 "no bgp default local-preference",
2352 NO_STR
2353 "BGP specific commands\n"
2354 "Configure BGP defaults\n"
2355 "local preference (higher=more preferred)\n")
2356{
2357 struct bgp *bgp;
2358
2359 bgp = vty->index;
2360 bgp_default_local_preference_unset (bgp);
7aafcaca
DS
2361 bgp_clear_star_soft_in (vty);
2362
718e3744 2363 return CMD_SUCCESS;
2364}
2365
2366ALIAS (no_bgp_default_local_preference,
2367 no_bgp_default_local_preference_val_cmd,
2368 "no bgp default local-preference <0-4294967295>",
2369 NO_STR
2370 "BGP specific commands\n"
2371 "Configure BGP defaults\n"
2372 "local preference (higher=more preferred)\n"
2373 "Configure default local preference value\n")
6b0655a2 2374
3f9c7369
DS
2375DEFUN (bgp_default_subgroup_pkt_queue_max,
2376 bgp_default_subgroup_pkt_queue_max_cmd,
2377 "bgp default subgroup-pkt-queue-max <20-100>",
2378 "BGP specific commands\n"
2379 "Configure BGP defaults\n"
2380 "subgroup-pkt-queue-max\n"
2381 "Configure subgroup packet queue max\n")
8bd9d948 2382{
3f9c7369
DS
2383 struct bgp *bgp;
2384 u_int32_t max_size;
8bd9d948 2385
3f9c7369
DS
2386 bgp = vty->index;
2387
2388 VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[0]);
2389
2390 bgp_default_subgroup_pkt_queue_max_set (bgp, max_size);
2391
2392 return CMD_SUCCESS;
2393}
2394
2395DEFUN (no_bgp_default_subgroup_pkt_queue_max,
2396 no_bgp_default_subgroup_pkt_queue_max_cmd,
2397 "no bgp default subgroup-pkt-queue-max",
2398 NO_STR
2399 "BGP specific commands\n"
2400 "Configure BGP defaults\n"
2401 "subgroup-pkt-queue-max\n")
2402{
2403 struct bgp *bgp;
2404
2405 bgp = vty->index;
2406 bgp_default_subgroup_pkt_queue_max_unset (bgp);
2407 return CMD_SUCCESS;
8bd9d948
DS
2408}
2409
813d4307
DW
2410ALIAS (no_bgp_default_subgroup_pkt_queue_max,
2411 no_bgp_default_subgroup_pkt_queue_max_val_cmd,
2412 "no bgp default subgroup-pkt-queue-max <20-100>",
2413 NO_STR
2414 "BGP specific commands\n"
2415 "Configure BGP defaults\n"
2416 "subgroup-pkt-queue-max\n"
2417 "Configure subgroup packet queue max\n")
2418
8bd9d948
DS
2419DEFUN (bgp_rr_allow_outbound_policy,
2420 bgp_rr_allow_outbound_policy_cmd,
2421 "bgp route-reflector allow-outbound-policy",
2422 "BGP specific commands\n"
2423 "Allow modifications made by out route-map\n"
2424 "on ibgp neighbors\n")
2425{
2426 struct bgp *bgp;
8bd9d948
DS
2427
2428 bgp = vty->index;
2429
2430 if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))
2431 {
2432 bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
3f9c7369 2433 update_group_announce_rrclients(bgp);
7aafcaca 2434 bgp_clear_star_soft_out (vty);
8bd9d948
DS
2435 }
2436
2437 return CMD_SUCCESS;
2438}
2439
2440DEFUN (no_bgp_rr_allow_outbound_policy,
2441 no_bgp_rr_allow_outbound_policy_cmd,
2442 "no bgp route-reflector allow-outbound-policy",
2443 NO_STR
2444 "BGP specific commands\n"
2445 "Allow modifications made by out route-map\n"
2446 "on ibgp neighbors\n")
2447{
2448 struct bgp *bgp;
8bd9d948
DS
2449
2450 bgp = vty->index;
2451
2452 if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))
2453 {
2454 bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
3f9c7369 2455 update_group_announce_rrclients(bgp);
7aafcaca 2456 bgp_clear_star_soft_out (vty);
8bd9d948
DS
2457 }
2458
2459 return CMD_SUCCESS;
2460}
2461
f14e6fdb
DS
2462DEFUN (bgp_listen_limit,
2463 bgp_listen_limit_cmd,
2464 "bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE,
2465 "BGP specific commands\n"
2466 "Configure BGP defaults\n"
2467 "maximum number of BGP Dynamic Neighbors that can be created\n"
2468 "Configure Dynamic Neighbors listen limit value\n")
2469{
2470 struct bgp *bgp;
2471 int listen_limit;
2472
2473 bgp = vty->index;
2474
2475 VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[0],
2476 BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN,
2477 BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX);
2478
2479 bgp_listen_limit_set (bgp, listen_limit);
2480
2481 return CMD_SUCCESS;
2482}
2483
2484DEFUN (no_bgp_listen_limit,
2485 no_bgp_listen_limit_cmd,
2486 "no bgp listen limit",
2487 "BGP specific commands\n"
2488 "Configure BGP defaults\n"
2489 "unset maximum number of BGP Dynamic Neighbors that can be created\n"
2490 "Configure Dynamic Neighbors listen limit value to default\n")
2491{
2492 struct bgp *bgp;
2493
2494 bgp = vty->index;
2495 bgp_listen_limit_unset (bgp);
2496 return CMD_SUCCESS;
2497}
2498
813d4307
DW
2499ALIAS (no_bgp_listen_limit,
2500 no_bgp_listen_limit_val_cmd,
2501 "no bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE,
2502 NO_STR
2503 "BGP specific commands\n"
2504 "Configure BGP defaults\n"
2505 "maximum number of BGP Dynamic Neighbors that can be created\n"
2506 "Configure Dynamic Neighbors listen limit value\n")
f14e6fdb 2507
20eb8864 2508/*
2509 * Check if this listen range is already configured. Check for exact
2510 * match or overlap based on input.
2511 */
2512static struct peer_group *
2513listen_range_exists (struct bgp *bgp, struct prefix *range, int exact)
2514{
2515 struct listnode *node, *nnode;
2516 struct listnode *node1, *nnode1;
2517 struct peer_group *group;
2518 struct prefix *lr;
2519 afi_t afi;
2520 int match;
2521
2522 afi = family2afi(range->family);
2523 for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group))
2524 {
2525 for (ALL_LIST_ELEMENTS (group->listen_range[afi], node1,
2526 nnode1, lr))
2527 {
2528 if (exact)
2529 match = prefix_same (range, lr);
2530 else
2531 match = (prefix_match (range, lr) || prefix_match (lr, range));
2532 if (match)
2533 return group;
2534 }
2535 }
2536
2537 return NULL;
2538}
2539
f14e6fdb
DS
2540DEFUN (bgp_listen_range,
2541 bgp_listen_range_cmd,
2542 LISTEN_RANGE_CMD "peer-group WORD" ,
2543 "BGP specific commands\n"
2544 "Configure BGP Dynamic Neighbors\n"
2545 "add a listening range for Dynamic Neighbors\n"
2546 LISTEN_RANGE_ADDR_STR)
2547{
2548 struct bgp *bgp;
2549 struct prefix range;
20eb8864 2550 struct peer_group *group, *existing_group;
f14e6fdb
DS
2551 afi_t afi;
2552 int ret;
2553
2554 bgp = vty->index;
2555
2556 //VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]);
2557
2558 /* Convert IP prefix string to struct prefix. */
2559 ret = str2prefix (argv[0], &range);
2560 if (! ret)
2561 {
2562 vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE);
2563 return CMD_WARNING;
2564 }
2565
2566 afi = family2afi(range.family);
2567
2568#ifdef HAVE_IPV6
2569 if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6))
2570 {
2571 vty_out (vty, "%% Malformed listen range (link-local address)%s",
2572 VTY_NEWLINE);
2573 return CMD_WARNING;
2574 }
2575#endif /* HAVE_IPV6 */
2576
2577 apply_mask (&range);
2578
20eb8864 2579 /* Check if same listen range is already configured. */
2580 existing_group = listen_range_exists (bgp, &range, 1);
2581 if (existing_group)
2582 {
2583 if (strcmp (existing_group->name, argv[1]) == 0)
2584 return CMD_SUCCESS;
2585 else
2586 {
2587 vty_out (vty, "%% Same listen range is attached to peer-group %s%s",
2588 existing_group->name, VTY_NEWLINE);
2589 return CMD_WARNING;
2590 }
2591 }
2592
2593 /* Check if an overlapping listen range exists. */
2594 if (listen_range_exists (bgp, &range, 0))
2595 {
2596 vty_out (vty, "%% Listen range overlaps with existing listen range%s",
2597 VTY_NEWLINE);
2598 return CMD_WARNING;
2599 }
f14e6fdb
DS
2600
2601 group = peer_group_lookup (bgp, argv[1]);
2602 if (! group)
2603 {
2604 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
2605 return CMD_WARNING;
2606 }
2607
2608 ret = peer_group_listen_range_add(group, &range);
2609 return bgp_vty_return (vty, ret);
2610}
2611
2612DEFUN (no_bgp_listen_range,
2613 no_bgp_listen_range_cmd,
2614 "no bgp listen range A.B.C.D/M peer-group WORD" ,
2615 "BGP specific commands\n"
2616 "Configure BGP defaults\n"
2617 "delete a listening range for Dynamic Neighbors\n"
2618 "Remove Dynamic Neighbors listening range\n")
2619{
2620 struct bgp *bgp;
2621 struct prefix range;
2622 struct peer_group *group;
2623 afi_t afi;
2624 int ret;
2625
2626 bgp = vty->index;
2627
2628 // VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]);
2629
2630 /* Convert IP prefix string to struct prefix. */
2631 ret = str2prefix (argv[0], &range);
2632 if (! ret)
2633 {
2634 vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE);
2635 return CMD_WARNING;
2636 }
2637
2638 afi = family2afi(range.family);
2639
2640#ifdef HAVE_IPV6
2641 if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6))
2642 {
2643 vty_out (vty, "%% Malformed listen range (link-local address)%s",
2644 VTY_NEWLINE);
2645 return CMD_WARNING;
2646 }
2647#endif /* HAVE_IPV6 */
2648
2649 apply_mask (&range);
2650
2651
2652 group = peer_group_lookup (bgp, argv[1]);
2653 if (! group)
2654 {
2655 vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE);
2656 return CMD_WARNING;
2657 }
2658
2659 ret = peer_group_listen_range_del(group, &range);
2660 return bgp_vty_return (vty, ret);
2661}
2662
2663int
2664bgp_config_write_listen (struct vty *vty, struct bgp *bgp)
2665{
2666 struct peer_group *group;
2667 struct listnode *node, *nnode, *rnode, *nrnode;
2668 struct prefix *range;
2669 afi_t afi;
4690c7d7 2670 char buf[PREFIX2STR_BUFFER];
f14e6fdb
DS
2671
2672 if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT)
2673 vty_out (vty, " bgp listen limit %d%s",
2674 bgp->dynamic_neighbors_limit, VTY_NEWLINE);
2675
2676 for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group))
2677 {
2678 for (afi = AFI_IP; afi < AFI_MAX; afi++)
2679 {
2680 for (ALL_LIST_ELEMENTS (group->listen_range[afi], rnode, nrnode, range))
2681 {
2682 prefix2str(range, buf, sizeof(buf));
2683 vty_out(vty, " bgp listen range %s peer-group %s%s",
2684 buf, group->name, VTY_NEWLINE);
2685 }
2686 }
2687 }
2688
2689 return 0;
2690}
2691
2692
907f92c8
DS
2693DEFUN (bgp_disable_connected_route_check,
2694 bgp_disable_connected_route_check_cmd,
2695 "bgp disable-ebgp-connected-route-check",
2696 "BGP specific commands\n"
2697 "Disable checking if nexthop is connected on ebgp sessions\n")
2698{
2699 struct bgp *bgp;
2700
2701 bgp = vty->index;
2702 bgp_flag_set (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK);
7aafcaca
DS
2703 bgp_clear_star_soft_in (vty);
2704
907f92c8
DS
2705 return CMD_SUCCESS;
2706}
2707
2708DEFUN (no_bgp_disable_connected_route_check,
2709 no_bgp_disable_connected_route_check_cmd,
2710 "no bgp disable-ebgp-connected-route-check",
2711 NO_STR
2712 "BGP specific commands\n"
2713 "Disable checking if nexthop is connected on ebgp sessions\n")
2714{
2715 struct bgp *bgp;
2716
2717 bgp = vty->index;
2718 bgp_flag_unset (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK);
7aafcaca
DS
2719 bgp_clear_star_soft_in (vty);
2720
907f92c8
DS
2721 return CMD_SUCCESS;
2722}
2723
2724
718e3744 2725static int
fd79ac91 2726peer_remote_as_vty (struct vty *vty, const char *peer_str,
2727 const char *as_str, afi_t afi, safi_t safi)
718e3744 2728{
2729 int ret;
2730 struct bgp *bgp;
2731 as_t as;
0299c004 2732 int as_type = AS_SPECIFIED;
718e3744 2733 union sockunion su;
2734
2735 bgp = vty->index;
2736
0299c004
DS
2737 if (strncmp(as_str, "internal", strlen("internal")) == 0)
2738 {
2739 as = 0;
2740 as_type = AS_INTERNAL;
2741 }
2742 else if (strncmp(as_str, "external", strlen("external")) == 0)
2743 {
2744 as = 0;
2745 as_type = AS_EXTERNAL;
2746 }
2747 else
2748 {
2749 /* Get AS number. */
2750 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
2751 }
718e3744 2752
2753 /* If peer is peer group, call proper function. */
2754 ret = str2sockunion (peer_str, &su);
2755 if (ret < 0)
2756 {
a80beece 2757 /* Check for peer by interface */
0299c004 2758 ret = peer_remote_as (bgp, NULL, peer_str, &as, as_type, afi, safi);
718e3744 2759 if (ret < 0)
a80beece 2760 {
0299c004 2761 ret = peer_group_remote_as (bgp, peer_str, &as, as_type);
a80beece
DS
2762 if (ret < 0)
2763 {
2764 vty_out (vty, "%% Create the peer-group or interface first%s",
2765 VTY_NEWLINE);
2766 return CMD_WARNING;
2767 }
2768 return CMD_SUCCESS;
2769 }
718e3744 2770 }
a80beece 2771 else
718e3744 2772 {
6aeb9e78 2773 if (peer_address_self_check (bgp, &su))
a80beece
DS
2774 {
2775 vty_out (vty, "%% Can not configure the local system as neighbor%s",
2776 VTY_NEWLINE);
2777 return CMD_WARNING;
2778 }
0299c004 2779 ret = peer_remote_as (bgp, &su, NULL, &as, as_type, afi, safi);
718e3744 2780 }
2781
718e3744 2782 /* This peer belongs to peer group. */
2783 switch (ret)
2784 {
2785 case BGP_ERR_PEER_GROUP_MEMBER:
aea339f7 2786 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
718e3744 2787 return CMD_WARNING;
718e3744 2788 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
aea339f7 2789 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 2790 return CMD_WARNING;
718e3744 2791 }
2792 return bgp_vty_return (vty, ret);
2793}
2794
2795DEFUN (neighbor_remote_as,
2796 neighbor_remote_as_cmd,
0299c004 2797 NEIGHBOR_CMD2 "remote-as (" CMD_AS_RANGE "|external|internal)",
718e3744 2798 NEIGHBOR_STR
2799 NEIGHBOR_ADDR_STR2
2800 "Specify a BGP neighbor\n"
2801 AS_STR)
2802{
2803 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
2804}
6b0655a2 2805
4c48cf63
DW
2806static int
2807peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi,
2808 safi_t safi, int v6only, const char *peer_group_name)
a80beece 2809{
4c48cf63 2810 as_t as;
a80beece
DS
2811 struct bgp *bgp;
2812 struct peer *peer;
2813 struct peer_group *group;
4c48cf63
DW
2814 int ret = 0;
2815 union sockunion su;
a80beece
DS
2816
2817 bgp = vty->index;
4c48cf63
DW
2818 group = peer_group_lookup (bgp, conf_if);
2819
a80beece
DS
2820 if (group)
2821 {
2822 vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE);
2823 return CMD_WARNING;
2824 }
2825
4c48cf63
DW
2826 peer = peer_lookup_by_conf_if (bgp, conf_if);
2827 if (!peer)
2828 {
2829 if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4)
2830 && afi == AFI_IP && safi == SAFI_UNICAST)
f813b13b 2831 peer = peer_create (NULL, conf_if, bgp, bgp->as, 0, AS_UNSPECIFIED, 0, 0, NULL);
4c48cf63 2832 else
f813b13b 2833 peer = peer_create (NULL, conf_if, bgp, bgp->as, 0, AS_UNSPECIFIED, afi, safi, NULL);
4c48cf63
DW
2834
2835 if (peer && v6only)
2836 SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY);
4a04e5f7 2837
2838 /* Request zebra to initiate IPv6 RAs on this interface. We do this
2839 * any unnumbered peer in order to not worry about run-time transitions
2840 * (e.g., peering is initially IPv4, but the IPv4 /30 or /31 address
2841 * gets deleted later etc.)
2842 */
2843 if (peer->ifp)
2844 bgp_zebra_initiate_radv (bgp, peer);
4c48cf63
DW
2845 }
2846 else if ((v6only && !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) ||
2847 (!v6only && CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)))
2848 {
2849 if (v6only)
2850 SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY);
2851 else
2852 UNSET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY);
2853
2854 /* v6only flag changed. Reset bgp seesion */
2855 if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status))
2856 {
2857 peer->last_reset = PEER_DOWN_V6ONLY_CHANGE;
2858 bgp_notify_send (peer, BGP_NOTIFY_CEASE,
2859 BGP_NOTIFY_CEASE_CONFIG_CHANGE);
2860 }
2861 else
2862 bgp_session_reset(peer);
2863 }
2864
a80beece
DS
2865 if (!peer)
2866 return CMD_WARNING;
2867
4c48cf63
DW
2868 if (peer_group_name)
2869 {
2870 group = peer_group_lookup (bgp, peer_group_name);
2871 if (! group)
2872 {
2873 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
2874 return CMD_WARNING;
2875 }
2876
2877 ret = peer_group_bind (bgp, &su, peer, group, &as);
2878 }
2879
2880 return bgp_vty_return (vty, ret);
a80beece
DS
2881}
2882
4c48cf63
DW
2883DEFUN (neighbor_interface_config,
2884 neighbor_interface_config_cmd,
2885 "neighbor WORD interface",
2886 NEIGHBOR_STR
2887 "Interface name or neighbor tag\n"
2888 "Enable BGP on interface\n")
2889{
2890 if (argc == 2)
2891 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0, argv[1]);
2892 else
2893 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0, NULL);
2894}
2895
2896ALIAS (neighbor_interface_config,
2897 neighbor_interface_config_peergroup_cmd,
2898 "neighbor WORD interface peer-group WORD",
2899 NEIGHBOR_STR
2900 "Interface name or neighbor tag\n"
2901 "Enable BGP on interface\n"
2902 "Member of the peer-group\n"
2903 "peer-group name\n")
2904
2905DEFUN (neighbor_interface_config_v6only,
2906 neighbor_interface_config_v6only_cmd,
2907 "neighbor WORD interface v6only",
2908 NEIGHBOR_STR
2909 "Interface name or neighbor tag\n"
2910 "Enable BGP on interface\n"
2911 "Enable BGP with v6 link-local only\n")
2912{
2913 if (argc == 2)
2914 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1, argv[1]);
2915 else
2916 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1, NULL);
2917}
2918
2919ALIAS (neighbor_interface_config_v6only,
2920 neighbor_interface_config_v6only_peergroup_cmd,
2921 "neighbor WORD interface v6only peer-group WORD",
2922 NEIGHBOR_STR
2923 "Interface name or neighbor tag\n"
2924 "Enable BGP on interface\n"
2925 "Enable BGP with v6 link-local only\n"
2926 "Member of the peer-group\n"
2927 "peer-group name\n")
a80beece 2928
718e3744 2929DEFUN (neighbor_peer_group,
2930 neighbor_peer_group_cmd,
2931 "neighbor WORD peer-group",
2932 NEIGHBOR_STR
a80beece 2933 "Interface name or neighbor tag\n"
718e3744 2934 "Configure peer-group\n")
2935{
2936 struct bgp *bgp;
a80beece 2937 struct peer *peer;
718e3744 2938 struct peer_group *group;
2939
2940 bgp = vty->index;
a80beece
DS
2941 peer = peer_lookup_by_conf_if (bgp, argv[0]);
2942 if (peer)
2943 {
2944 vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE);
2945 return CMD_WARNING;
2946 }
718e3744 2947
2948 group = peer_group_get (bgp, argv[0]);
2949 if (! group)
2950 return CMD_WARNING;
2951
2952 return CMD_SUCCESS;
2953}
2954
2955DEFUN (no_neighbor,
2956 no_neighbor_cmd,
2957 NO_NEIGHBOR_CMD2,
2958 NO_STR
2959 NEIGHBOR_STR
2960 NEIGHBOR_ADDR_STR2)
2961{
2962 int ret;
2963 union sockunion su;
2964 struct peer_group *group;
2965 struct peer *peer;
1ff9a340 2966 struct peer *other;
718e3744 2967
2968 ret = str2sockunion (argv[0], &su);
2969 if (ret < 0)
2970 {
a80beece
DS
2971 /* look up for neighbor by interface name config. */
2972 peer = peer_lookup_by_conf_if (vty->index, argv[0]);
2973 if (peer)
2974 {
4a04e5f7 2975 /* Request zebra to terminate IPv6 RAs on this interface. */
2976 if (peer->ifp)
2977 bgp_zebra_terminate_radv (peer->bgp, peer);
a80beece
DS
2978 peer_delete (peer);
2979 return CMD_SUCCESS;
2980 }
2981
718e3744 2982 group = peer_group_lookup (vty->index, argv[0]);
2983 if (group)
2984 peer_group_delete (group);
2985 else
2986 {
2987 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
2988 return CMD_WARNING;
2989 }
2990 }
2991 else
2992 {
2993 peer = peer_lookup (vty->index, &su);
2994 if (peer)
1ff9a340 2995 {
f14e6fdb
DS
2996 if (peer_dynamic_neighbor (peer))
2997 {
2998 vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
2999 VTY_NEWLINE);
3000 return CMD_WARNING;
3001 }
3002
1ff9a340
DS
3003 other = peer->doppelganger;
3004 peer_delete (peer);
3005 if (other && other->status != Deleted)
3006 peer_delete(other);
3007 }
718e3744 3008 }
3009
3010 return CMD_SUCCESS;
3011}
3012
3013ALIAS (no_neighbor,
3014 no_neighbor_remote_as_cmd,
0299c004 3015 NO_NEIGHBOR_CMD "remote-as (" CMD_AS_RANGE "|internal|external)",
718e3744 3016 NO_STR
3017 NEIGHBOR_STR
3018 NEIGHBOR_ADDR_STR
3019 "Specify a BGP neighbor\n"
3020 AS_STR)
3021
a80beece
DS
3022DEFUN (no_neighbor_interface_config,
3023 no_neighbor_interface_config_cmd,
4c48cf63 3024 "no neighbor WORD interface",
a80beece
DS
3025 NO_STR
3026 NEIGHBOR_STR
3027 "Interface name\n"
3028 "Configure BGP on interface\n")
3029{
3030 struct peer *peer;
3031
3032 /* look up for neighbor by interface name config. */
3033 peer = peer_lookup_by_conf_if (vty->index, argv[0]);
3034 if (peer)
3035 {
4a04e5f7 3036 /* Request zebra to terminate IPv6 RAs on this interface. */
3037 if (peer->ifp)
3038 bgp_zebra_terminate_radv (peer->bgp, peer);
a80beece
DS
3039 peer_delete (peer);
3040 }
3041 else
3042 {
3043 vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE);
3044 return CMD_WARNING;
3045 }
3046 return CMD_SUCCESS;
3047}
3048
4c48cf63
DW
3049ALIAS (no_neighbor_interface_config,
3050 no_neighbor_interface_config_peergroup_cmd,
3051 "no neighbor WORD interface peer-group WORD",
3052 NO_STR
3053 NEIGHBOR_STR
3054 "Interface name\n"
3055 "Configure BGP on interface\n"
3056 "Member of the peer-group\n"
3057 "peer-group name\n")
3058
3059ALIAS (no_neighbor_interface_config,
3060 no_neighbor_interface_config_v6only_cmd,
3061 "no neighbor WORD interface v6only",
3062 NO_STR
3063 NEIGHBOR_STR
3064 "Interface name\n"
3065 "Configure BGP on interface\n"
3066 "Enable BGP with v6 link-local only\n")
3067
3068ALIAS (no_neighbor_interface_config,
3069 no_neighbor_interface_config_v6only_peergroup_cmd,
3070 "no neighbor WORD interface v6only peer-group WORD",
3071 NO_STR
3072 NEIGHBOR_STR
3073 "Interface name\n"
3074 "Configure BGP on interface\n"
3075 "Enable BGP with v6 link-local only\n"
3076 "Member of the peer-group\n"
3077 "peer-group name\n")
3078
3079
718e3744 3080DEFUN (no_neighbor_peer_group,
3081 no_neighbor_peer_group_cmd,
3082 "no neighbor WORD peer-group",
3083 NO_STR
3084 NEIGHBOR_STR
3085 "Neighbor tag\n"
3086 "Configure peer-group\n")
3087{
3088 struct peer_group *group;
3089
3090 group = peer_group_lookup (vty->index, argv[0]);
3091 if (group)
3092 peer_group_delete (group);
3093 else
3094 {
3095 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
3096 return CMD_WARNING;
3097 }
3098 return CMD_SUCCESS;
3099}
3100
a80beece
DS
3101DEFUN (no_neighbor_interface_peer_group_remote_as,
3102 no_neighbor_interface_peer_group_remote_as_cmd,
0299c004 3103 "no neighbor WORD remote-as (" CMD_AS_RANGE "|internal|external)",
718e3744 3104 NO_STR
3105 NEIGHBOR_STR
a80beece 3106 "Interface name or neighbor tag\n"
718e3744 3107 "Specify a BGP neighbor\n"
3108 AS_STR)
3109{
3110 struct peer_group *group;
a80beece
DS
3111 struct peer *peer;
3112
3113 /* look up for neighbor by interface name config. */
3114 peer = peer_lookup_by_conf_if (vty->index, argv[0]);
3115 if (peer)
3116 {
0299c004 3117 peer_as_change (peer, 0, AS_SPECIFIED);
a80beece
DS
3118 return CMD_SUCCESS;
3119 }
718e3744 3120
3121 group = peer_group_lookup (vty->index, argv[0]);
3122 if (group)
3123 peer_group_remote_as_delete (group);
3124 else
3125 {
a80beece 3126 vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE);
718e3744 3127 return CMD_WARNING;
3128 }
3129 return CMD_SUCCESS;
3130}
6b0655a2 3131
718e3744 3132DEFUN (neighbor_local_as,
3133 neighbor_local_as_cmd,
320da874 3134 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
718e3744 3135 NEIGHBOR_STR
3136 NEIGHBOR_ADDR_STR2
3137 "Specify a local-as number\n"
3138 "AS number used as local AS\n")
3139{
3140 struct peer *peer;
3141 int ret;
3142
3143 peer = peer_and_group_lookup_vty (vty, argv[0]);
3144 if (! peer)
3145 return CMD_WARNING;
3146
9d3f9705 3147 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
718e3744 3148 return bgp_vty_return (vty, ret);
3149}
3150
3151DEFUN (neighbor_local_as_no_prepend,
3152 neighbor_local_as_no_prepend_cmd,
320da874 3153 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
718e3744 3154 NEIGHBOR_STR
3155 NEIGHBOR_ADDR_STR2
3156 "Specify a local-as number\n"
3157 "AS number used as local AS\n"
3158 "Do not prepend local-as to updates from ebgp peers\n")
3159{
3160 struct peer *peer;
3161 int ret;
3162
3163 peer = peer_and_group_lookup_vty (vty, argv[0]);
3164 if (! peer)
3165 return CMD_WARNING;
3166
9d3f9705 3167 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
718e3744 3168 return bgp_vty_return (vty, ret);
3169}
3170
9d3f9705
AC
3171DEFUN (neighbor_local_as_no_prepend_replace_as,
3172 neighbor_local_as_no_prepend_replace_as_cmd,
3173 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
3174 NEIGHBOR_STR
3175 NEIGHBOR_ADDR_STR2
3176 "Specify a local-as number\n"
3177 "AS number used as local AS\n"
3178 "Do not prepend local-as to updates from ebgp peers\n"
3179 "Do not prepend local-as to updates from ibgp peers\n")
3180{
3181 struct peer *peer;
3182 int ret;
3183
3184 peer = peer_and_group_lookup_vty (vty, argv[0]);
3185 if (! peer)
3186 return CMD_WARNING;
3187
3188 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
3189 return bgp_vty_return (vty, ret);
3190}
3191
3192
718e3744 3193DEFUN (no_neighbor_local_as,
3194 no_neighbor_local_as_cmd,
3195 NO_NEIGHBOR_CMD2 "local-as",
3196 NO_STR
3197 NEIGHBOR_STR
3198 NEIGHBOR_ADDR_STR2
3199 "Specify a local-as number\n")
3200{
3201 struct peer *peer;
3202 int ret;
3203
3204 peer = peer_and_group_lookup_vty (vty, argv[0]);
3205 if (! peer)
3206 return CMD_WARNING;
3207
3208 ret = peer_local_as_unset (peer);
3209 return bgp_vty_return (vty, ret);
3210}
3211
3212ALIAS (no_neighbor_local_as,
3213 no_neighbor_local_as_val_cmd,
320da874 3214 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
718e3744 3215 NO_STR
3216 NEIGHBOR_STR
3217 NEIGHBOR_ADDR_STR2
3218 "Specify a local-as number\n"
3219 "AS number used as local AS\n")
3220
3221ALIAS (no_neighbor_local_as,
3222 no_neighbor_local_as_val2_cmd,
320da874 3223 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
718e3744 3224 NO_STR
3225 NEIGHBOR_STR
3226 NEIGHBOR_ADDR_STR2
3227 "Specify a local-as number\n"
3228 "AS number used as local AS\n"
3229 "Do not prepend local-as to updates from ebgp peers\n")
9d3f9705
AC
3230
3231ALIAS (no_neighbor_local_as,
3232 no_neighbor_local_as_val3_cmd,
3233 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
3234 NO_STR
3235 NEIGHBOR_STR
3236 NEIGHBOR_ADDR_STR2
3237 "Specify a local-as number\n"
3238 "AS number used as local AS\n"
3239 "Do not prepend local-as to updates from ebgp peers\n"
3240 "Do not prepend local-as to updates from ibgp peers\n")
6b0655a2 3241
3f9c7369
DS
3242DEFUN (neighbor_solo,
3243 neighbor_solo_cmd,
3244 NEIGHBOR_CMD2 "solo",
3245 NEIGHBOR_STR
3246 NEIGHBOR_ADDR_STR2
3247 "Solo peer - part of its own update group\n")
3248{
3249 struct peer *peer;
3250 int ret;
3251
3252 peer = peer_and_group_lookup_vty (vty, argv[0]);
3253 if (! peer)
3254 return CMD_WARNING;
3255
3256 ret = update_group_adjust_soloness(peer, 1);
3257 return bgp_vty_return (vty, ret);
3258}
3259
3260DEFUN (no_neighbor_solo,
3261 no_neighbor_solo_cmd,
3262 NO_NEIGHBOR_CMD2 "solo",
3263 NO_STR
3264 NEIGHBOR_STR
3265 NEIGHBOR_ADDR_STR2
3266 "Solo peer - part of its own update group\n")
3267{
3268 struct peer *peer;
3269 int ret;
3270
3271 peer = peer_and_group_lookup_vty (vty, argv[0]);
3272 if (! peer)
3273 return CMD_WARNING;
3274
3275 ret = update_group_adjust_soloness(peer, 0);
3276 return bgp_vty_return (vty, ret);
3277}
3278
0df7c91f
PJ
3279DEFUN (neighbor_password,
3280 neighbor_password_cmd,
3281 NEIGHBOR_CMD2 "password LINE",
3282 NEIGHBOR_STR
3283 NEIGHBOR_ADDR_STR2
3284 "Set a password\n"
3285 "The password\n")
3286{
3287 struct peer *peer;
3288 int ret;
3289
3290 peer = peer_and_group_lookup_vty (vty, argv[0]);
3291 if (! peer)
3292 return CMD_WARNING;
3293
3294 ret = peer_password_set (peer, argv[1]);
3295 return bgp_vty_return (vty, ret);
3296}
3297
3298DEFUN (no_neighbor_password,
3299 no_neighbor_password_cmd,
3300 NO_NEIGHBOR_CMD2 "password",
3301 NO_STR
3302 NEIGHBOR_STR
3303 NEIGHBOR_ADDR_STR2
3304 "Set a password\n")
3305{
3306 struct peer *peer;
3307 int ret;
3308
3309 peer = peer_and_group_lookup_vty (vty, argv[0]);
3310 if (! peer)
3311 return CMD_WARNING;
3312
3313 ret = peer_password_unset (peer);
3314 return bgp_vty_return (vty, ret);
3315}
6b0655a2 3316
813d4307
DW
3317ALIAS (no_neighbor_password,
3318 no_neighbor_password_val_cmd,
3319 NO_NEIGHBOR_CMD2 "password LINE",
3320 NO_STR
3321 NEIGHBOR_STR
3322 NEIGHBOR_ADDR_STR2
3323 "Set a password\n"
3324 "The password\n")
3325
718e3744 3326DEFUN (neighbor_activate,
3327 neighbor_activate_cmd,
3328 NEIGHBOR_CMD2 "activate",
3329 NEIGHBOR_STR
3330 NEIGHBOR_ADDR_STR2
3331 "Enable the Address Family for this Neighbor\n")
3332{
c8560b44 3333 int ret;
718e3744 3334 struct peer *peer;
3335
3336 peer = peer_and_group_lookup_vty (vty, argv[0]);
3337 if (! peer)
3338 return CMD_WARNING;
3339
c8560b44 3340 ret = peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
718e3744 3341
c8560b44
DW
3342 if (ret)
3343 return CMD_WARNING;
718e3744 3344 return CMD_SUCCESS;
3345}
3346
3347DEFUN (no_neighbor_activate,
3348 no_neighbor_activate_cmd,
3349 NO_NEIGHBOR_CMD2 "activate",
3350 NO_STR
3351 NEIGHBOR_STR
3352 NEIGHBOR_ADDR_STR2
3353 "Enable the Address Family for this Neighbor\n")
3354{
3355 int ret;
3356 struct peer *peer;
3357
3358 /* Lookup peer. */
3359 peer = peer_and_group_lookup_vty (vty, argv[0]);
3360 if (! peer)
3361 return CMD_WARNING;
3362
3363 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
3364
c8560b44
DW
3365 if (ret)
3366 return CMD_WARNING;
3367 return CMD_SUCCESS;
718e3744 3368}
6b0655a2 3369
718e3744 3370DEFUN (neighbor_set_peer_group,
3371 neighbor_set_peer_group_cmd,
a80beece 3372 NEIGHBOR_CMD2 "peer-group WORD",
718e3744 3373 NEIGHBOR_STR
a80beece 3374 NEIGHBOR_ADDR_STR2
718e3744 3375 "Member of the peer-group\n"
3376 "peer-group name\n")
3377{
3378 int ret;
3379 as_t as;
3380 union sockunion su;
3381 struct bgp *bgp;
a80beece 3382 struct peer *peer;
718e3744 3383 struct peer_group *group;
3384
3385 bgp = vty->index;
a80beece 3386 peer = NULL;
718e3744 3387
3388 ret = str2sockunion (argv[0], &su);
3389 if (ret < 0)
3390 {
a80beece
DS
3391 peer = peer_lookup_by_conf_if (bgp, argv[0]);
3392 if (!peer)
3393 {
3394 vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE);
3395 return CMD_WARNING;
3396 }
3397 }
3398 else
3399 {
6aeb9e78 3400 if (peer_address_self_check (bgp, &su))
a80beece
DS
3401 {
3402 vty_out (vty, "%% Can not configure the local system as neighbor%s",
3403 VTY_NEWLINE);
3404 return CMD_WARNING;
3405 }
f14e6fdb
DS
3406
3407 /* Disallow for dynamic neighbor. */
3408 peer = peer_lookup (bgp, &su);
3409 if (peer && peer_dynamic_neighbor (peer))
3410 {
3411 vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
3412 VTY_NEWLINE);
3413 return CMD_WARNING;
3414 }
718e3744 3415 }
3416
3417 group = peer_group_lookup (bgp, argv[1]);
3418 if (! group)
3419 {
3420 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
3421 return CMD_WARNING;
3422 }
3423
c8560b44 3424 ret = peer_group_bind (bgp, &su, peer, group, &as);
718e3744 3425
3426 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
3427 {
aea339f7 3428 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 3429 return CMD_WARNING;
3430 }
3431
3432 return bgp_vty_return (vty, ret);
3433}
3434
3435DEFUN (no_neighbor_set_peer_group,
3436 no_neighbor_set_peer_group_cmd,
a80beece 3437 NO_NEIGHBOR_CMD2 "peer-group WORD",
718e3744 3438 NO_STR
3439 NEIGHBOR_STR
a80beece 3440 NEIGHBOR_ADDR_STR2
718e3744 3441 "Member of the peer-group\n"
3442 "peer-group name\n")
3443{
3444 int ret;
3445 struct bgp *bgp;
3446 struct peer *peer;
3447 struct peer_group *group;
3448
3449 bgp = vty->index;
3450
3451 peer = peer_lookup_vty (vty, argv[0]);
3452 if (! peer)
3453 return CMD_WARNING;
3454
3455 group = peer_group_lookup (bgp, argv[1]);
3456 if (! group)
3457 {
3458 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
3459 return CMD_WARNING;
3460 }
3461
c8560b44 3462 ret = peer_group_unbind (bgp, peer, group);
718e3744 3463
3464 return bgp_vty_return (vty, ret);
3465}
6b0655a2 3466
94f2b392 3467static int
fd79ac91 3468peer_flag_modify_vty (struct vty *vty, const char *ip_str,
3469 u_int16_t flag, int set)
718e3744 3470{
3471 int ret;
3472 struct peer *peer;
3473
3474 peer = peer_and_group_lookup_vty (vty, ip_str);
3475 if (! peer)
3476 return CMD_WARNING;
3477
8cdabf90
SK
3478 /*
3479 * If 'neighbor <interface>', then this is for directly connected peers,
3480 * we should not accept disable-connected-check.
3481 */
3482 if (peer->conf_if && (flag == PEER_FLAG_DISABLE_CONNECTED_CHECK)) {
3483 vty_out (vty, "%s is directly connected peer, cannot accept disable-"
3484 "connected-check%s", ip_str, VTY_NEWLINE);
3485 return CMD_WARNING;
3486 }
3487
718e3744 3488 if (set)
3489 ret = peer_flag_set (peer, flag);
3490 else
3491 ret = peer_flag_unset (peer, flag);
3492
3493 return bgp_vty_return (vty, ret);
3494}
3495
94f2b392 3496static int
fd79ac91 3497peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
718e3744 3498{
3499 return peer_flag_modify_vty (vty, ip_str, flag, 1);
3500}
3501
94f2b392 3502static int
fd79ac91 3503peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
718e3744 3504{
3505 return peer_flag_modify_vty (vty, ip_str, flag, 0);
3506}
3507
3508/* neighbor passive. */
3509DEFUN (neighbor_passive,
3510 neighbor_passive_cmd,
3511 NEIGHBOR_CMD2 "passive",
3512 NEIGHBOR_STR
3513 NEIGHBOR_ADDR_STR2
3514 "Don't send open messages to this neighbor\n")
3515{
3516 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
3517}
3518
3519DEFUN (no_neighbor_passive,
3520 no_neighbor_passive_cmd,
3521 NO_NEIGHBOR_CMD2 "passive",
3522 NO_STR
3523 NEIGHBOR_STR
3524 NEIGHBOR_ADDR_STR2
3525 "Don't send open messages to this neighbor\n")
3526{
3527 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
3528}
6b0655a2 3529
718e3744 3530/* neighbor shutdown. */
3531DEFUN (neighbor_shutdown,
3532 neighbor_shutdown_cmd,
3533 NEIGHBOR_CMD2 "shutdown",
3534 NEIGHBOR_STR
3535 NEIGHBOR_ADDR_STR2
3536 "Administratively shut down this neighbor\n")
3537{
3538 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
3539}
3540
3541DEFUN (no_neighbor_shutdown,
3542 no_neighbor_shutdown_cmd,
3543 NO_NEIGHBOR_CMD2 "shutdown",
3544 NO_STR
3545 NEIGHBOR_STR
3546 NEIGHBOR_ADDR_STR2
3547 "Administratively shut down this neighbor\n")
3548{
3549 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
3550}
6b0655a2 3551
718e3744 3552/* neighbor capability dynamic. */
3553DEFUN (neighbor_capability_dynamic,
3554 neighbor_capability_dynamic_cmd,
3555 NEIGHBOR_CMD2 "capability dynamic",
3556 NEIGHBOR_STR
3557 NEIGHBOR_ADDR_STR2
3558 "Advertise capability to the peer\n"
3559 "Advertise dynamic capability to this neighbor\n")
3560{
3561 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
3562}
3563
3564DEFUN (no_neighbor_capability_dynamic,
3565 no_neighbor_capability_dynamic_cmd,
3566 NO_NEIGHBOR_CMD2 "capability dynamic",
3567 NO_STR
3568 NEIGHBOR_STR
3569 NEIGHBOR_ADDR_STR2
3570 "Advertise capability to the peer\n"
3571 "Advertise dynamic capability to this neighbor\n")
3572{
3573 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
3574}
6b0655a2 3575
718e3744 3576/* neighbor dont-capability-negotiate */
3577DEFUN (neighbor_dont_capability_negotiate,
3578 neighbor_dont_capability_negotiate_cmd,
3579 NEIGHBOR_CMD2 "dont-capability-negotiate",
3580 NEIGHBOR_STR
3581 NEIGHBOR_ADDR_STR2
3582 "Do not perform capability negotiation\n")
3583{
3584 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
3585}
3586
3587DEFUN (no_neighbor_dont_capability_negotiate,
3588 no_neighbor_dont_capability_negotiate_cmd,
3589 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
3590 NO_STR
3591 NEIGHBOR_STR
3592 NEIGHBOR_ADDR_STR2
3593 "Do not perform capability negotiation\n")
3594{
3595 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
3596}
6b0655a2 3597
8a92a8a0
DS
3598/* neighbor capability extended next hop encoding */
3599DEFUN (neighbor_capability_enhe,
3600 neighbor_capability_enhe_cmd,
3601 NEIGHBOR_CMD2 "capability extended-nexthop",
3602 NEIGHBOR_STR
3603 NEIGHBOR_ADDR_STR2
3604 "Advertise capability to the peer\n"
3605 "Advertise extended next-hop capability to the peer\n")
3606{
3607 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE);
3608}
3609
3610DEFUN (no_neighbor_capability_enhe,
3611 no_neighbor_capability_enhe_cmd,
3612 NO_NEIGHBOR_CMD2 "capability extended-nexthop",
3613 NO_STR
3614 NEIGHBOR_STR
3615 NEIGHBOR_ADDR_STR2
3616 "Advertise capability to the peer\n"
3617 "Advertise extended next-hop capability to the peer\n")
3618{
3619 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE);
3620}
3621
94f2b392 3622static int
fd79ac91 3623peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
fee0f4c6 3624 safi_t safi, u_int32_t flag, int set)
718e3744 3625{
3626 int ret;
3627 struct peer *peer;
3628
3629 peer = peer_and_group_lookup_vty (vty, peer_str);
3630 if (! peer)
3631 return CMD_WARNING;
3632
3633 if (set)
3634 ret = peer_af_flag_set (peer, afi, safi, flag);
3635 else
3636 ret = peer_af_flag_unset (peer, afi, safi, flag);
3637
3638 return bgp_vty_return (vty, ret);
3639}
3640
94f2b392 3641static int
fd79ac91 3642peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
fee0f4c6 3643 safi_t safi, u_int32_t flag)
718e3744 3644{
3645 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
3646}
3647
94f2b392 3648static int
fd79ac91 3649peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
fee0f4c6 3650 safi_t safi, u_int32_t flag)
718e3744 3651{
3652 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
3653}
6b0655a2 3654
718e3744 3655/* neighbor capability orf prefix-list. */
3656DEFUN (neighbor_capability_orf_prefix,
3657 neighbor_capability_orf_prefix_cmd,
3658 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
3659 NEIGHBOR_STR
3660 NEIGHBOR_ADDR_STR2
3661 "Advertise capability to the peer\n"
3662 "Advertise ORF capability to the peer\n"
3663 "Advertise prefixlist ORF capability to this neighbor\n"
3664 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3665 "Capability to RECEIVE the ORF from this neighbor\n"
3666 "Capability to SEND the ORF to this neighbor\n")
3667{
3668 u_int16_t flag = 0;
3669
3670 if (strncmp (argv[1], "s", 1) == 0)
3671 flag = PEER_FLAG_ORF_PREFIX_SM;
3672 else if (strncmp (argv[1], "r", 1) == 0)
3673 flag = PEER_FLAG_ORF_PREFIX_RM;
3674 else if (strncmp (argv[1], "b", 1) == 0)
3675 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
3676 else
3677 return CMD_WARNING;
3678
3679 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3680 bgp_node_safi (vty), flag);
3681}
3682
3683DEFUN (no_neighbor_capability_orf_prefix,
3684 no_neighbor_capability_orf_prefix_cmd,
3685 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
3686 NO_STR
3687 NEIGHBOR_STR
3688 NEIGHBOR_ADDR_STR2
3689 "Advertise capability to the peer\n"
3690 "Advertise ORF capability to the peer\n"
3691 "Advertise prefixlist ORF capability to this neighbor\n"
3692 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3693 "Capability to RECEIVE the ORF from this neighbor\n"
3694 "Capability to SEND the ORF to this neighbor\n")
3695{
3696 u_int16_t flag = 0;
3697
3698 if (strncmp (argv[1], "s", 1) == 0)
3699 flag = PEER_FLAG_ORF_PREFIX_SM;
3700 else if (strncmp (argv[1], "r", 1) == 0)
3701 flag = PEER_FLAG_ORF_PREFIX_RM;
3702 else if (strncmp (argv[1], "b", 1) == 0)
3703 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
3704 else
3705 return CMD_WARNING;
3706
3707 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3708 bgp_node_safi (vty), flag);
3709}
6b0655a2 3710
718e3744 3711/* neighbor next-hop-self. */
3712DEFUN (neighbor_nexthop_self,
3713 neighbor_nexthop_self_cmd,
a538debe 3714 NEIGHBOR_CMD2 "next-hop-self",
718e3744 3715 NEIGHBOR_STR
3716 NEIGHBOR_ADDR_STR2
a538debe 3717 "Disable the next hop calculation for this neighbor\n")
718e3744 3718{
a538debe
DS
3719 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3720 bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
3721}
9e7a53c1 3722
a538debe
DS
3723/* neighbor next-hop-self. */
3724DEFUN (neighbor_nexthop_self_force,
3725 neighbor_nexthop_self_force_cmd,
3726 NEIGHBOR_CMD2 "next-hop-self force",
3727 NEIGHBOR_STR
3728 NEIGHBOR_ADDR_STR2
3729 "Disable the next hop calculation for this neighbor\n"
3730 "Set the next hop to self for reflected routes\n")
3731{
3732 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3733 bgp_node_safi (vty),
88b8ed8d 3734 PEER_FLAG_FORCE_NEXTHOP_SELF);
718e3744 3735}
3736
3737DEFUN (no_neighbor_nexthop_self,
3738 no_neighbor_nexthop_self_cmd,
a538debe 3739 NO_NEIGHBOR_CMD2 "next-hop-self",
718e3744 3740 NO_STR
3741 NEIGHBOR_STR
3742 NEIGHBOR_ADDR_STR2
a538debe 3743 "Disable the next hop calculation for this neighbor\n")
718e3744 3744{
3745 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
9e7a53c1 3746 bgp_node_safi (vty),
88b8ed8d 3747 PEER_FLAG_NEXTHOP_SELF);
718e3744 3748}
6b0655a2 3749
88b8ed8d 3750DEFUN (no_neighbor_nexthop_self_force,
a538debe
DS
3751 no_neighbor_nexthop_self_force_cmd,
3752 NO_NEIGHBOR_CMD2 "next-hop-self force",
3753 NO_STR
3754 NEIGHBOR_STR
3755 NEIGHBOR_ADDR_STR2
3756 "Disable the next hop calculation for this neighbor\n"
3757 "Set the next hop to self for reflected routes\n")
88b8ed8d
DW
3758{
3759 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3760 bgp_node_safi (vty),
3761 PEER_FLAG_FORCE_NEXTHOP_SELF);
3762}
a538debe 3763
c7122e14
DS
3764/* neighbor as-override */
3765DEFUN (neighbor_as_override,
3766 neighbor_as_override_cmd,
3767 NEIGHBOR_CMD2 "as-override",
3768 NEIGHBOR_STR
3769 NEIGHBOR_ADDR_STR2
3770 "Override ASNs in outbound updates if aspath equals remote-as\n")
3771{
3772 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3773 bgp_node_safi (vty),
3774 PEER_FLAG_AS_OVERRIDE);
3775}
3776
3777DEFUN (no_neighbor_as_override,
3778 no_neighbor_as_override_cmd,
3779 NO_NEIGHBOR_CMD2 "as-override",
3780 NO_STR
3781 NEIGHBOR_STR
3782 NEIGHBOR_ADDR_STR2
3783 "Override ASNs in outbound updates if aspath equals remote-as\n")
3784{
3785 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3786 bgp_node_safi (vty),
3787 PEER_FLAG_AS_OVERRIDE);
3788}
3789
718e3744 3790/* neighbor remove-private-AS. */
3791DEFUN (neighbor_remove_private_as,
3792 neighbor_remove_private_as_cmd,
3793 NEIGHBOR_CMD2 "remove-private-AS",
3794 NEIGHBOR_STR
3795 NEIGHBOR_ADDR_STR2
5000f21c 3796 "Remove private ASNs in outbound updates\n")
718e3744 3797{
3798 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3799 bgp_node_safi (vty),
3800 PEER_FLAG_REMOVE_PRIVATE_AS);
3801}
3802
5000f21c
DS
3803DEFUN (neighbor_remove_private_as_all,
3804 neighbor_remove_private_as_all_cmd,
3805 NEIGHBOR_CMD2 "remove-private-AS all",
3806 NEIGHBOR_STR
3807 NEIGHBOR_ADDR_STR2
3808 "Remove private ASNs in outbound updates\n"
3809 "Apply to all AS numbers")
3810{
5000f21c
DS
3811 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3812 bgp_node_safi (vty),
5000f21c
DS
3813 PEER_FLAG_REMOVE_PRIVATE_AS_ALL);
3814}
3815
3816DEFUN (neighbor_remove_private_as_replace_as,
3817 neighbor_remove_private_as_replace_as_cmd,
3818 NEIGHBOR_CMD2 "remove-private-AS replace-AS",
3819 NEIGHBOR_STR
3820 NEIGHBOR_ADDR_STR2
3821 "Remove private ASNs in outbound updates\n"
3822 "Replace private ASNs with our ASN in outbound updates\n")
3823{
5000f21c
DS
3824 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3825 bgp_node_safi (vty),
5000f21c
DS
3826 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE);
3827}
3828
3829DEFUN (neighbor_remove_private_as_all_replace_as,
3830 neighbor_remove_private_as_all_replace_as_cmd,
3831 NEIGHBOR_CMD2 "remove-private-AS all replace-AS",
3832 NEIGHBOR_STR
3833 NEIGHBOR_ADDR_STR2
3834 "Remove private ASNs in outbound updates\n"
3835 "Apply to all AS numbers"
3836 "Replace private ASNs with our ASN in outbound updates\n")
3837{
3838 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3839 bgp_node_safi (vty),
88b8ed8d 3840 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE);
5000f21c
DS
3841}
3842
718e3744 3843DEFUN (no_neighbor_remove_private_as,
3844 no_neighbor_remove_private_as_cmd,
3845 NO_NEIGHBOR_CMD2 "remove-private-AS",
3846 NO_STR
3847 NEIGHBOR_STR
3848 NEIGHBOR_ADDR_STR2
5000f21c 3849 "Remove private ASNs in outbound updates\n")
718e3744 3850{
3851 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3852 bgp_node_safi (vty),
88b8ed8d 3853 PEER_FLAG_REMOVE_PRIVATE_AS);
718e3744 3854}
6b0655a2 3855
88b8ed8d 3856DEFUN (no_neighbor_remove_private_as_all,
5000f21c
DS
3857 no_neighbor_remove_private_as_all_cmd,
3858 NO_NEIGHBOR_CMD2 "remove-private-AS all",
3859 NO_STR
3860 NEIGHBOR_STR
3861 NEIGHBOR_ADDR_STR2
3862 "Remove private ASNs in outbound updates\n"
3863 "Apply to all AS numbers")
88b8ed8d
DW
3864{
3865 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3866 bgp_node_safi (vty),
3867 PEER_FLAG_REMOVE_PRIVATE_AS_ALL);
3868}
5000f21c 3869
88b8ed8d 3870DEFUN (no_neighbor_remove_private_as_replace_as,
5000f21c
DS
3871 no_neighbor_remove_private_as_replace_as_cmd,
3872 NO_NEIGHBOR_CMD2 "remove-private-AS replace-AS",
3873 NO_STR
3874 NEIGHBOR_STR
3875 NEIGHBOR_ADDR_STR2
3876 "Remove private ASNs in outbound updates\n"
3877 "Replace private ASNs with our ASN in outbound updates\n")
88b8ed8d
DW
3878{
3879 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3880 bgp_node_safi (vty),
3881 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE);
3882}
5000f21c 3883
88b8ed8d 3884DEFUN (no_neighbor_remove_private_as_all_replace_as,
5000f21c
DS
3885 no_neighbor_remove_private_as_all_replace_as_cmd,
3886 NO_NEIGHBOR_CMD2 "remove-private-AS all replace-AS",
3887 NO_STR
3888 NEIGHBOR_STR
3889 NEIGHBOR_ADDR_STR2
3890 "Remove private ASNs in outbound updates\n"
3891 "Apply to all AS numbers"
3892 "Replace private ASNs with our ASN in outbound updates\n")
88b8ed8d
DW
3893{
3894 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3895 bgp_node_safi (vty),
3896 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE);
3897}
5000f21c
DS
3898
3899
718e3744 3900/* neighbor send-community. */
3901DEFUN (neighbor_send_community,
3902 neighbor_send_community_cmd,
3903 NEIGHBOR_CMD2 "send-community",
3904 NEIGHBOR_STR
3905 NEIGHBOR_ADDR_STR2
3906 "Send Community attribute to this neighbor\n")
3907{
3908 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3909 bgp_node_safi (vty),
3910 PEER_FLAG_SEND_COMMUNITY);
3911}
3912
3913DEFUN (no_neighbor_send_community,
3914 no_neighbor_send_community_cmd,
3915 NO_NEIGHBOR_CMD2 "send-community",
3916 NO_STR
3917 NEIGHBOR_STR
3918 NEIGHBOR_ADDR_STR2
3919 "Send Community attribute to this neighbor\n")
3920{
3921 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3922 bgp_node_safi (vty),
3923 PEER_FLAG_SEND_COMMUNITY);
3924}
6b0655a2 3925
718e3744 3926/* neighbor send-community extended. */
3927DEFUN (neighbor_send_community_type,
3928 neighbor_send_community_type_cmd,
3929 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
3930 NEIGHBOR_STR
3931 NEIGHBOR_ADDR_STR2
3932 "Send Community attribute to this neighbor\n"
3933 "Send Standard and Extended Community attributes\n"
3934 "Send Extended Community attributes\n"
3935 "Send Standard Community attributes\n")
3936{
3937 if (strncmp (argv[1], "s", 1) == 0)
3938 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3939 bgp_node_safi (vty),
3940 PEER_FLAG_SEND_COMMUNITY);
3941 if (strncmp (argv[1], "e", 1) == 0)
3942 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3943 bgp_node_safi (vty),
3944 PEER_FLAG_SEND_EXT_COMMUNITY);
3945
3946 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3947 bgp_node_safi (vty),
3948 (PEER_FLAG_SEND_COMMUNITY|
3949 PEER_FLAG_SEND_EXT_COMMUNITY));
3950}
3951
3952DEFUN (no_neighbor_send_community_type,
3953 no_neighbor_send_community_type_cmd,
3954 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
3955 NO_STR
3956 NEIGHBOR_STR
3957 NEIGHBOR_ADDR_STR2
3958 "Send Community attribute to this neighbor\n"
3959 "Send Standard and Extended Community attributes\n"
3960 "Send Extended Community attributes\n"
3961 "Send Standard Community attributes\n")
3962{
3963 if (strncmp (argv[1], "s", 1) == 0)
3964 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3965 bgp_node_safi (vty),
3966 PEER_FLAG_SEND_COMMUNITY);
3967 if (strncmp (argv[1], "e", 1) == 0)
3968 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3969 bgp_node_safi (vty),
3970 PEER_FLAG_SEND_EXT_COMMUNITY);
3971
3972 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3973 bgp_node_safi (vty),
3974 (PEER_FLAG_SEND_COMMUNITY |
3975 PEER_FLAG_SEND_EXT_COMMUNITY));
3976}
6b0655a2 3977
718e3744 3978/* neighbor soft-reconfig. */
3979DEFUN (neighbor_soft_reconfiguration,
3980 neighbor_soft_reconfiguration_cmd,
3981 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
3982 NEIGHBOR_STR
3983 NEIGHBOR_ADDR_STR2
3984 "Per neighbor soft reconfiguration\n"
3985 "Allow inbound soft reconfiguration for this neighbor\n")
3986{
3987 return peer_af_flag_set_vty (vty, argv[0],
3988 bgp_node_afi (vty), bgp_node_safi (vty),
3989 PEER_FLAG_SOFT_RECONFIG);
3990}
3991
3992DEFUN (no_neighbor_soft_reconfiguration,
3993 no_neighbor_soft_reconfiguration_cmd,
3994 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
3995 NO_STR
3996 NEIGHBOR_STR
3997 NEIGHBOR_ADDR_STR2
3998 "Per neighbor soft reconfiguration\n"
3999 "Allow inbound soft reconfiguration for this neighbor\n")
4000{
4001 return peer_af_flag_unset_vty (vty, argv[0],
4002 bgp_node_afi (vty), bgp_node_safi (vty),
4003 PEER_FLAG_SOFT_RECONFIG);
4004}
6b0655a2 4005
718e3744 4006DEFUN (neighbor_route_reflector_client,
4007 neighbor_route_reflector_client_cmd,
4008 NEIGHBOR_CMD2 "route-reflector-client",
4009 NEIGHBOR_STR
4010 NEIGHBOR_ADDR_STR2
4011 "Configure a neighbor as Route Reflector client\n")
4012{
4013 struct peer *peer;
4014
4015
4016 peer = peer_and_group_lookup_vty (vty, argv[0]);
4017 if (! peer)
4018 return CMD_WARNING;
4019
4020 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4021 bgp_node_safi (vty),
4022 PEER_FLAG_REFLECTOR_CLIENT);
4023}
4024
4025DEFUN (no_neighbor_route_reflector_client,
4026 no_neighbor_route_reflector_client_cmd,
4027 NO_NEIGHBOR_CMD2 "route-reflector-client",
4028 NO_STR
4029 NEIGHBOR_STR
4030 NEIGHBOR_ADDR_STR2
4031 "Configure a neighbor as Route Reflector client\n")
4032{
4033 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4034 bgp_node_safi (vty),
4035 PEER_FLAG_REFLECTOR_CLIENT);
4036}
6b0655a2 4037
718e3744 4038/* neighbor route-server-client. */
4039DEFUN (neighbor_route_server_client,
4040 neighbor_route_server_client_cmd,
4041 NEIGHBOR_CMD2 "route-server-client",
4042 NEIGHBOR_STR
4043 NEIGHBOR_ADDR_STR2
4044 "Configure a neighbor as Route Server client\n")
4045{
2a3d5731
DW
4046 struct peer *peer;
4047
4048 peer = peer_and_group_lookup_vty (vty, argv[0]);
4049 if (! peer)
4050 return CMD_WARNING;
4051 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4052 bgp_node_safi (vty),
4053 PEER_FLAG_RSERVER_CLIENT);
718e3744 4054}
4055
4056DEFUN (no_neighbor_route_server_client,
4057 no_neighbor_route_server_client_cmd,
4058 NO_NEIGHBOR_CMD2 "route-server-client",
4059 NO_STR
4060 NEIGHBOR_STR
4061 NEIGHBOR_ADDR_STR2
4062 "Configure a neighbor as Route Server client\n")
fee0f4c6 4063{
2a3d5731
DW
4064 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4065 bgp_node_safi (vty),
4066 PEER_FLAG_RSERVER_CLIENT);
fee0f4c6 4067}
6b0655a2 4068
fee0f4c6 4069DEFUN (neighbor_nexthop_local_unchanged,
4070 neighbor_nexthop_local_unchanged_cmd,
4071 NEIGHBOR_CMD2 "nexthop-local unchanged",
4072 NEIGHBOR_STR
4073 NEIGHBOR_ADDR_STR2
4074 "Configure treatment of outgoing link-local nexthop attribute\n"
4075 "Leave link-local nexthop unchanged for this peer\n")
4076{
4077 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4078 bgp_node_safi (vty),
4079 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
4080}
6b0655a2 4081
fee0f4c6 4082DEFUN (no_neighbor_nexthop_local_unchanged,
4083 no_neighbor_nexthop_local_unchanged_cmd,
4084 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
4085 NO_STR
4086 NEIGHBOR_STR
4087 NEIGHBOR_ADDR_STR2
4088 "Configure treatment of outgoing link-local-nexthop attribute\n"
4089 "Leave link-local nexthop unchanged for this peer\n")
718e3744 4090{
4091 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4092 bgp_node_safi (vty),
fee0f4c6 4093 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
718e3744 4094}
6b0655a2 4095
718e3744 4096DEFUN (neighbor_attr_unchanged,
4097 neighbor_attr_unchanged_cmd,
4098 NEIGHBOR_CMD2 "attribute-unchanged",
4099 NEIGHBOR_STR
4100 NEIGHBOR_ADDR_STR2
4101 "BGP attribute is propagated unchanged to this neighbor\n")
4102{
4103 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4104 bgp_node_safi (vty),
4105 (PEER_FLAG_AS_PATH_UNCHANGED |
4106 PEER_FLAG_NEXTHOP_UNCHANGED |
4107 PEER_FLAG_MED_UNCHANGED));
4108}
4109
4110DEFUN (neighbor_attr_unchanged1,
4111 neighbor_attr_unchanged1_cmd,
4112 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
4113 NEIGHBOR_STR
4114 NEIGHBOR_ADDR_STR2
4115 "BGP attribute is propagated unchanged to this neighbor\n"
4116 "As-path attribute\n"
4117 "Nexthop attribute\n"
4118 "Med attribute\n")
4119{
4120 u_int16_t flags = 0;
4121
4122 if (strncmp (argv[1], "as-path", 1) == 0)
4123 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4124 else if (strncmp (argv[1], "next-hop", 1) == 0)
4125 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4126 else if (strncmp (argv[1], "med", 1) == 0)
4127 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4128
4129 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4130 bgp_node_safi (vty), flags);
4131}
4132
4133DEFUN (neighbor_attr_unchanged2,
4134 neighbor_attr_unchanged2_cmd,
4135 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
4136 NEIGHBOR_STR
4137 NEIGHBOR_ADDR_STR2
4138 "BGP attribute is propagated unchanged to this neighbor\n"
4139 "As-path attribute\n"
4140 "Nexthop attribute\n"
4141 "Med attribute\n")
4142{
4143 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
4144
4145 if (strncmp (argv[1], "next-hop", 1) == 0)
4146 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4147 else if (strncmp (argv[1], "med", 1) == 0)
4148 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4149
4150 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4151 bgp_node_safi (vty), flags);
4152
4153}
4154
4155DEFUN (neighbor_attr_unchanged3,
4156 neighbor_attr_unchanged3_cmd,
4157 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
4158 NEIGHBOR_STR
4159 NEIGHBOR_ADDR_STR2
4160 "BGP attribute is propagated unchanged to this neighbor\n"
4161 "Nexthop attribute\n"
4162 "As-path attribute\n"
4163 "Med attribute\n")
4164{
4165 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
4166
4167 if (strncmp (argv[1], "as-path", 1) == 0)
4168 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4169 else if (strncmp (argv[1], "med", 1) == 0)
4170 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4171
4172 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4173 bgp_node_safi (vty), flags);
4174}
4175
4176DEFUN (neighbor_attr_unchanged4,
4177 neighbor_attr_unchanged4_cmd,
4178 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
4179 NEIGHBOR_STR
4180 NEIGHBOR_ADDR_STR2
4181 "BGP attribute is propagated unchanged to this neighbor\n"
4182 "Med attribute\n"
4183 "As-path attribute\n"
4184 "Nexthop attribute\n")
4185{
4186 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
4187
4188 if (strncmp (argv[1], "as-path", 1) == 0)
4189 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4190 else if (strncmp (argv[1], "next-hop", 1) == 0)
4191 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4192
4193 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4194 bgp_node_safi (vty), flags);
4195}
4196
4197ALIAS (neighbor_attr_unchanged,
4198 neighbor_attr_unchanged5_cmd,
4199 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
4200 NEIGHBOR_STR
4201 NEIGHBOR_ADDR_STR2
4202 "BGP attribute is propagated unchanged to this neighbor\n"
4203 "As-path attribute\n"
4204 "Nexthop attribute\n"
4205 "Med attribute\n")
4206
4207ALIAS (neighbor_attr_unchanged,
4208 neighbor_attr_unchanged6_cmd,
4209 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
4210 NEIGHBOR_STR
4211 NEIGHBOR_ADDR_STR2
4212 "BGP attribute is propagated unchanged to this neighbor\n"
4213 "As-path attribute\n"
4214 "Med attribute\n"
4215 "Nexthop attribute\n")
4216
4217ALIAS (neighbor_attr_unchanged,
4218 neighbor_attr_unchanged7_cmd,
4219 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
4220 NEIGHBOR_STR
4221 NEIGHBOR_ADDR_STR2
4222 "BGP attribute is propagated unchanged to this neighbor\n"
4223 "Nexthop attribute\n"
4224 "Med attribute\n"
4225 "As-path attribute\n")
4226
4227ALIAS (neighbor_attr_unchanged,
4228 neighbor_attr_unchanged8_cmd,
4229 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
4230 NEIGHBOR_STR
4231 NEIGHBOR_ADDR_STR2
4232 "BGP attribute is propagated unchanged to this neighbor\n"
4233 "Nexthop attribute\n"
4234 "As-path attribute\n"
4235 "Med attribute\n")
4236
4237ALIAS (neighbor_attr_unchanged,
4238 neighbor_attr_unchanged9_cmd,
4239 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
4240 NEIGHBOR_STR
4241 NEIGHBOR_ADDR_STR2
4242 "BGP attribute is propagated unchanged to this neighbor\n"
4243 "Med attribute\n"
4244 "Nexthop attribute\n"
4245 "As-path attribute\n")
4246
4247ALIAS (neighbor_attr_unchanged,
4248 neighbor_attr_unchanged10_cmd,
4249 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
4250 NEIGHBOR_STR
4251 NEIGHBOR_ADDR_STR2
4252 "BGP attribute is propagated unchanged to this neighbor\n"
4253 "Med attribute\n"
4254 "As-path attribute\n"
4255 "Nexthop attribute\n")
4256
4257DEFUN (no_neighbor_attr_unchanged,
4258 no_neighbor_attr_unchanged_cmd,
4259 NO_NEIGHBOR_CMD2 "attribute-unchanged",
4260 NO_STR
4261 NEIGHBOR_STR
4262 NEIGHBOR_ADDR_STR2
4263 "BGP attribute is propagated unchanged to this neighbor\n")
4264{
4265 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4266 bgp_node_safi (vty),
4267 (PEER_FLAG_AS_PATH_UNCHANGED |
4268 PEER_FLAG_NEXTHOP_UNCHANGED |
4269 PEER_FLAG_MED_UNCHANGED));
4270}
4271
4272DEFUN (no_neighbor_attr_unchanged1,
4273 no_neighbor_attr_unchanged1_cmd,
4274 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
4275 NO_STR
4276 NEIGHBOR_STR
4277 NEIGHBOR_ADDR_STR2
4278 "BGP attribute is propagated unchanged to this neighbor\n"
4279 "As-path attribute\n"
4280 "Nexthop attribute\n"
4281 "Med attribute\n")
4282{
4283 u_int16_t flags = 0;
4284
4285 if (strncmp (argv[1], "as-path", 1) == 0)
4286 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4287 else if (strncmp (argv[1], "next-hop", 1) == 0)
4288 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4289 else if (strncmp (argv[1], "med", 1) == 0)
4290 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4291
4292 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4293 bgp_node_safi (vty), flags);
4294}
4295
4296DEFUN (no_neighbor_attr_unchanged2,
4297 no_neighbor_attr_unchanged2_cmd,
4298 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
4299 NO_STR
4300 NEIGHBOR_STR
4301 NEIGHBOR_ADDR_STR2
4302 "BGP attribute is propagated unchanged to this neighbor\n"
4303 "As-path attribute\n"
4304 "Nexthop attribute\n"
4305 "Med attribute\n")
4306{
4307 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
4308
4309 if (strncmp (argv[1], "next-hop", 1) == 0)
4310 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4311 else if (strncmp (argv[1], "med", 1) == 0)
4312 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4313
4314 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4315 bgp_node_safi (vty), flags);
4316}
4317
4318DEFUN (no_neighbor_attr_unchanged3,
4319 no_neighbor_attr_unchanged3_cmd,
4320 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
4321 NO_STR
4322 NEIGHBOR_STR
4323 NEIGHBOR_ADDR_STR2
4324 "BGP attribute is propagated unchanged to this neighbor\n"
4325 "Nexthop attribute\n"
4326 "As-path attribute\n"
4327 "Med attribute\n")
4328{
4329 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
4330
4331 if (strncmp (argv[1], "as-path", 1) == 0)
4332 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4333 else if (strncmp (argv[1], "med", 1) == 0)
4334 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4335
4336 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4337 bgp_node_safi (vty), flags);
4338}
4339
4340DEFUN (no_neighbor_attr_unchanged4,
4341 no_neighbor_attr_unchanged4_cmd,
4342 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
4343 NO_STR
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{
4351 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
4352
4353 if (strncmp (argv[1], "as-path", 1) == 0)
4354 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4355 else if (strncmp (argv[1], "next-hop", 1) == 0)
4356 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4357
4358 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4359 bgp_node_safi (vty), flags);
4360}
4361
4362ALIAS (no_neighbor_attr_unchanged,
4363 no_neighbor_attr_unchanged5_cmd,
4364 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
4365 NO_STR
4366 NEIGHBOR_STR
4367 NEIGHBOR_ADDR_STR2
4368 "BGP attribute is propagated unchanged to this neighbor\n"
4369 "As-path attribute\n"
4370 "Nexthop attribute\n"
4371 "Med attribute\n")
4372
4373ALIAS (no_neighbor_attr_unchanged,
4374 no_neighbor_attr_unchanged6_cmd,
4375 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
4376 NO_STR
4377 NEIGHBOR_STR
4378 NEIGHBOR_ADDR_STR2
4379 "BGP attribute is propagated unchanged to this neighbor\n"
4380 "As-path attribute\n"
4381 "Med attribute\n"
4382 "Nexthop attribute\n")
4383
4384ALIAS (no_neighbor_attr_unchanged,
4385 no_neighbor_attr_unchanged7_cmd,
4386 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
4387 NO_STR
4388 NEIGHBOR_STR
4389 NEIGHBOR_ADDR_STR2
4390 "BGP attribute is propagated unchanged to this neighbor\n"
4391 "Nexthop attribute\n"
4392 "Med attribute\n"
4393 "As-path attribute\n")
4394
4395ALIAS (no_neighbor_attr_unchanged,
4396 no_neighbor_attr_unchanged8_cmd,
4397 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
4398 NO_STR
4399 NEIGHBOR_STR
4400 NEIGHBOR_ADDR_STR2
4401 "BGP attribute is propagated unchanged to this neighbor\n"
4402 "Nexthop attribute\n"
4403 "As-path attribute\n"
4404 "Med attribute\n")
4405
4406ALIAS (no_neighbor_attr_unchanged,
4407 no_neighbor_attr_unchanged9_cmd,
4408 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
4409 NO_STR
4410 NEIGHBOR_STR
4411 NEIGHBOR_ADDR_STR2
4412 "BGP attribute is propagated unchanged to this neighbor\n"
4413 "Med attribute\n"
4414 "Nexthop attribute\n"
4415 "As-path attribute\n")
4416
4417ALIAS (no_neighbor_attr_unchanged,
4418 no_neighbor_attr_unchanged10_cmd,
4419 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
4420 NO_STR
4421 NEIGHBOR_STR
4422 NEIGHBOR_ADDR_STR2
4423 "BGP attribute is propagated unchanged to this neighbor\n"
4424 "Med attribute\n"
4425 "As-path attribute\n"
4426 "Nexthop attribute\n")
4427
718e3744 4428/* EBGP multihop configuration. */
94f2b392 4429static int
fd79ac91 4430peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
4431 const char *ttl_str)
718e3744 4432{
4433 struct peer *peer;
fd79ac91 4434 unsigned int ttl;
718e3744 4435
4436 peer = peer_and_group_lookup_vty (vty, ip_str);
4437 if (! peer)
4438 return CMD_WARNING;
4439
63fa10b5
QY
4440 if (peer->conf_if)
4441 return bgp_vty_return (vty, BGP_ERR_INVALID_FOR_DIRECT_PEER);
4442
718e3744 4443 if (! ttl_str)
9b1be336 4444 ttl = MAXTTL;
718e3744 4445 else
9b1be336 4446 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, MAXTTL);
718e3744 4447
89b6d1f8 4448 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
718e3744 4449}
4450
94f2b392 4451static int
fd79ac91 4452peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
718e3744 4453{
4454 struct peer *peer;
4455
4456 peer = peer_and_group_lookup_vty (vty, ip_str);
4457 if (! peer)
4458 return CMD_WARNING;
4459
89b6d1f8 4460 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
718e3744 4461}
4462
4463/* neighbor ebgp-multihop. */
4464DEFUN (neighbor_ebgp_multihop,
4465 neighbor_ebgp_multihop_cmd,
4466 NEIGHBOR_CMD2 "ebgp-multihop",
4467 NEIGHBOR_STR
4468 NEIGHBOR_ADDR_STR2
4469 "Allow EBGP neighbors not on directly connected networks\n")
4470{
4471 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
4472}
4473
4474DEFUN (neighbor_ebgp_multihop_ttl,
4475 neighbor_ebgp_multihop_ttl_cmd,
9b1be336 4476 NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL),
718e3744 4477 NEIGHBOR_STR
4478 NEIGHBOR_ADDR_STR2
4479 "Allow EBGP neighbors not on directly connected networks\n"
4480 "maximum hop count\n")
4481{
4482 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
4483}
4484
4485DEFUN (no_neighbor_ebgp_multihop,
4486 no_neighbor_ebgp_multihop_cmd,
4487 NO_NEIGHBOR_CMD2 "ebgp-multihop",
4488 NO_STR
4489 NEIGHBOR_STR
4490 NEIGHBOR_ADDR_STR2
4491 "Allow EBGP neighbors not on directly connected networks\n")
4492{
4493 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
4494}
4495
4496ALIAS (no_neighbor_ebgp_multihop,
4497 no_neighbor_ebgp_multihop_ttl_cmd,
9b1be336 4498 NO_NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL),
718e3744 4499 NO_STR
4500 NEIGHBOR_STR
4501 NEIGHBOR_ADDR_STR2
4502 "Allow EBGP neighbors not on directly connected networks\n"
4503 "maximum hop count\n")
6b0655a2 4504
6ffd2079 4505/* disable-connected-check */
4506DEFUN (neighbor_disable_connected_check,
4507 neighbor_disable_connected_check_cmd,
4508 NEIGHBOR_CMD2 "disable-connected-check",
4509 NEIGHBOR_STR
4510 NEIGHBOR_ADDR_STR2
4511 "one-hop away EBGP peer using loopback address\n")
4512{
4513 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
4514}
4515
4516DEFUN (no_neighbor_disable_connected_check,
4517 no_neighbor_disable_connected_check_cmd,
4518 NO_NEIGHBOR_CMD2 "disable-connected-check",
4519 NO_STR
4520 NEIGHBOR_STR
4521 NEIGHBOR_ADDR_STR2
4522 "one-hop away EBGP peer using loopback address\n")
4523{
4524 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
4525}
4526
718e3744 4527/* Enforce multihop. */
6ffd2079 4528ALIAS (neighbor_disable_connected_check,
718e3744 4529 neighbor_enforce_multihop_cmd,
4530 NEIGHBOR_CMD2 "enforce-multihop",
4531 NEIGHBOR_STR
4532 NEIGHBOR_ADDR_STR2
e8e1946e 4533 "Enforce EBGP neighbors perform multihop\n")
718e3744 4534
6ffd2079 4535/* Enforce multihop. */
4536ALIAS (no_neighbor_disable_connected_check,
718e3744 4537 no_neighbor_enforce_multihop_cmd,
4538 NO_NEIGHBOR_CMD2 "enforce-multihop",
4539 NO_STR
4540 NEIGHBOR_STR
4541 NEIGHBOR_ADDR_STR2
e8e1946e 4542 "Enforce EBGP neighbors perform multihop\n")
6b0655a2 4543
718e3744 4544DEFUN (neighbor_description,
4545 neighbor_description_cmd,
4546 NEIGHBOR_CMD2 "description .LINE",
4547 NEIGHBOR_STR
4548 NEIGHBOR_ADDR_STR2
4549 "Neighbor specific description\n"
4550 "Up to 80 characters describing this neighbor\n")
4551{
4552 struct peer *peer;
718e3744 4553 char *str;
718e3744 4554
4555 peer = peer_and_group_lookup_vty (vty, argv[0]);
4556 if (! peer)
4557 return CMD_WARNING;
4558
4559 if (argc == 1)
4560 return CMD_SUCCESS;
4561
3b8b1855 4562 str = argv_concat(argv, argc, 1);
718e3744 4563
4564 peer_description_set (peer, str);
4565
3b8b1855 4566 XFREE (MTYPE_TMP, str);
718e3744 4567
4568 return CMD_SUCCESS;
4569}
4570
4571DEFUN (no_neighbor_description,
4572 no_neighbor_description_cmd,
4573 NO_NEIGHBOR_CMD2 "description",
4574 NO_STR
4575 NEIGHBOR_STR
4576 NEIGHBOR_ADDR_STR2
4577 "Neighbor specific description\n")
4578{
4579 struct peer *peer;
4580
4581 peer = peer_and_group_lookup_vty (vty, argv[0]);
4582 if (! peer)
4583 return CMD_WARNING;
4584
4585 peer_description_unset (peer);
4586
4587 return CMD_SUCCESS;
4588}
4589
4590ALIAS (no_neighbor_description,
4591 no_neighbor_description_val_cmd,
4592 NO_NEIGHBOR_CMD2 "description .LINE",
4593 NO_STR
4594 NEIGHBOR_STR
4595 NEIGHBOR_ADDR_STR2
4596 "Neighbor specific description\n"
4597 "Up to 80 characters describing this neighbor\n")
6b0655a2 4598
718e3744 4599/* Neighbor update-source. */
94f2b392 4600static int
fd79ac91 4601peer_update_source_vty (struct vty *vty, const char *peer_str,
4602 const char *source_str)
718e3744 4603{
4604 struct peer *peer;
718e3744 4605
4606 peer = peer_and_group_lookup_vty (vty, peer_str);
4607 if (! peer)
4608 return CMD_WARNING;
4609
a80beece
DS
4610 if (peer->conf_if)
4611 return CMD_WARNING;
4612
718e3744 4613 if (source_str)
4614 {
c63b83fe
JBD
4615 union sockunion su;
4616 int ret = str2sockunion (source_str, &su);
4617
4618 if (ret == 0)
4619 peer_update_source_addr_set (peer, &su);
718e3744 4620 else
4621 peer_update_source_if_set (peer, source_str);
4622 }
4623 else
4624 peer_update_source_unset (peer);
4625
4626 return CMD_SUCCESS;
4627}
4628
dcb52bd5
DS
4629#define BGP_UPDATE_SOURCE_STR "A.B.C.D|X:X::X:X|WORD"
4630#define BGP_UPDATE_SOURCE_REQ_STR "(" BGP_UPDATE_SOURCE_STR ")"
4631#define BGP_UPDATE_SOURCE_OPT_STR "{" BGP_UPDATE_SOURCE_STR "}"
369688c0
PJ
4632#define BGP_UPDATE_SOURCE_HELP_STR \
4633 "IPv4 address\n" \
9a1a331d
PJ
4634 "IPv6 address\n" \
4635 "Interface name (requires zebra to be running)\n"
369688c0 4636
718e3744 4637DEFUN (neighbor_update_source,
4638 neighbor_update_source_cmd,
dcb52bd5 4639 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_REQ_STR,
718e3744 4640 NEIGHBOR_STR
4641 NEIGHBOR_ADDR_STR2
4642 "Source of routing updates\n"
369688c0 4643 BGP_UPDATE_SOURCE_HELP_STR)
718e3744 4644{
4645 return peer_update_source_vty (vty, argv[0], argv[1]);
4646}
4647
4648DEFUN (no_neighbor_update_source,
4649 no_neighbor_update_source_cmd,
dcb52bd5 4650 NO_NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_OPT_STR,
718e3744 4651 NO_STR
4652 NEIGHBOR_STR
4653 NEIGHBOR_ADDR_STR2
dcb52bd5
DS
4654 "Source of routing updates\n"
4655 BGP_UPDATE_SOURCE_HELP_STR)
718e3744 4656{
4657 return peer_update_source_vty (vty, argv[0], NULL);
4658}
6b0655a2 4659
94f2b392 4660static int
fd79ac91 4661peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
4662 afi_t afi, safi_t safi,
4663 const char *rmap, int set)
718e3744 4664{
4665 int ret;
4666 struct peer *peer;
4667
4668 peer = peer_and_group_lookup_vty (vty, peer_str);
4669 if (! peer)
4670 return CMD_WARNING;
4671
4672 if (set)
4673 ret = peer_default_originate_set (peer, afi, safi, rmap);
4674 else
4675 ret = peer_default_originate_unset (peer, afi, safi);
4676
4677 return bgp_vty_return (vty, ret);
4678}
4679
4680/* neighbor default-originate. */
4681DEFUN (neighbor_default_originate,
4682 neighbor_default_originate_cmd,
4683 NEIGHBOR_CMD2 "default-originate",
4684 NEIGHBOR_STR
4685 NEIGHBOR_ADDR_STR2
4686 "Originate default route to this neighbor\n")
4687{
4688 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
4689 bgp_node_safi (vty), NULL, 1);
4690}
4691
4692DEFUN (neighbor_default_originate_rmap,
4693 neighbor_default_originate_rmap_cmd,
4694 NEIGHBOR_CMD2 "default-originate route-map WORD",
4695 NEIGHBOR_STR
4696 NEIGHBOR_ADDR_STR2
4697 "Originate default route to this neighbor\n"
4698 "Route-map to specify criteria to originate default\n"
4699 "route-map name\n")
4700{
4701 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
4702 bgp_node_safi (vty), argv[1], 1);
4703}
4704
4705DEFUN (no_neighbor_default_originate,
4706 no_neighbor_default_originate_cmd,
4707 NO_NEIGHBOR_CMD2 "default-originate",
4708 NO_STR
4709 NEIGHBOR_STR
4710 NEIGHBOR_ADDR_STR2
4711 "Originate default route to this neighbor\n")
4712{
4713 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
4714 bgp_node_safi (vty), NULL, 0);
4715}
4716
4717ALIAS (no_neighbor_default_originate,
4718 no_neighbor_default_originate_rmap_cmd,
4719 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
4720 NO_STR
4721 NEIGHBOR_STR
4722 NEIGHBOR_ADDR_STR2
4723 "Originate default route to this neighbor\n"
4724 "Route-map to specify criteria to originate default\n"
4725 "route-map name\n")
6b0655a2 4726
718e3744 4727/* Set neighbor's BGP port. */
94f2b392 4728static int
fd79ac91 4729peer_port_vty (struct vty *vty, const char *ip_str, int afi,
4730 const char *port_str)
718e3744 4731{
4732 struct peer *peer;
4733 u_int16_t port;
4734 struct servent *sp;
4735
4736 peer = peer_lookup_vty (vty, ip_str);
4737 if (! peer)
4738 return CMD_WARNING;
4739
4740 if (! port_str)
4741 {
4742 sp = getservbyname ("bgp", "tcp");
4743 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
4744 }
4745 else
4746 {
4747 VTY_GET_INTEGER("port", port, port_str);
4748 }
4749
4750 peer_port_set (peer, port);
4751
4752 return CMD_SUCCESS;
4753}
4754
f418446b 4755/* Set specified peer's BGP port. */
718e3744 4756DEFUN (neighbor_port,
4757 neighbor_port_cmd,
4758 NEIGHBOR_CMD "port <0-65535>",
4759 NEIGHBOR_STR
4760 NEIGHBOR_ADDR_STR
4761 "Neighbor's BGP port\n"
4762 "TCP port number\n")
4763{
4764 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
4765}
4766
4767DEFUN (no_neighbor_port,
4768 no_neighbor_port_cmd,
4769 NO_NEIGHBOR_CMD "port",
4770 NO_STR
4771 NEIGHBOR_STR
4772 NEIGHBOR_ADDR_STR
4773 "Neighbor's BGP port\n")
4774{
4775 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
4776}
4777
4778ALIAS (no_neighbor_port,
4779 no_neighbor_port_val_cmd,
4780 NO_NEIGHBOR_CMD "port <0-65535>",
4781 NO_STR
4782 NEIGHBOR_STR
4783 NEIGHBOR_ADDR_STR
4784 "Neighbor's BGP port\n"
4785 "TCP port number\n")
6b0655a2 4786
718e3744 4787/* neighbor weight. */
94f2b392 4788static int
fd79ac91 4789peer_weight_set_vty (struct vty *vty, const char *ip_str,
4790 const char *weight_str)
718e3744 4791{
1f9a9fff 4792 int ret;
718e3744 4793 struct peer *peer;
4794 unsigned long weight;
4795
4796 peer = peer_and_group_lookup_vty (vty, ip_str);
4797 if (! peer)
4798 return CMD_WARNING;
4799
4800 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
4801
1f9a9fff
PJ
4802 ret = peer_weight_set (peer, weight);
4803 return bgp_vty_return (vty, ret);
718e3744 4804}
4805
94f2b392 4806static int
fd79ac91 4807peer_weight_unset_vty (struct vty *vty, const char *ip_str)
718e3744 4808{
1f9a9fff 4809 int ret;
718e3744 4810 struct peer *peer;
4811
4812 peer = peer_and_group_lookup_vty (vty, ip_str);
4813 if (! peer)
4814 return CMD_WARNING;
4815
1f9a9fff
PJ
4816 ret = peer_weight_unset (peer);
4817 return bgp_vty_return (vty, ret);
718e3744 4818}
4819
4820DEFUN (neighbor_weight,
4821 neighbor_weight_cmd,
4822 NEIGHBOR_CMD2 "weight <0-65535>",
4823 NEIGHBOR_STR
4824 NEIGHBOR_ADDR_STR2
4825 "Set default weight for routes from this neighbor\n"
4826 "default weight\n")
4827{
4828 return peer_weight_set_vty (vty, argv[0], argv[1]);
4829}
4830
4831DEFUN (no_neighbor_weight,
4832 no_neighbor_weight_cmd,
4833 NO_NEIGHBOR_CMD2 "weight",
4834 NO_STR
4835 NEIGHBOR_STR
4836 NEIGHBOR_ADDR_STR2
4837 "Set default weight for routes from this neighbor\n")
4838{
4839 return peer_weight_unset_vty (vty, argv[0]);
4840}
4841
4842ALIAS (no_neighbor_weight,
4843 no_neighbor_weight_val_cmd,
4844 NO_NEIGHBOR_CMD2 "weight <0-65535>",
4845 NO_STR
4846 NEIGHBOR_STR
4847 NEIGHBOR_ADDR_STR2
4848 "Set default weight for routes from this neighbor\n"
4849 "default weight\n")
6b0655a2 4850
718e3744 4851/* Override capability negotiation. */
4852DEFUN (neighbor_override_capability,
4853 neighbor_override_capability_cmd,
4854 NEIGHBOR_CMD2 "override-capability",
4855 NEIGHBOR_STR
4856 NEIGHBOR_ADDR_STR2
4857 "Override capability negotiation result\n")
4858{
4859 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
4860}
4861
4862DEFUN (no_neighbor_override_capability,
4863 no_neighbor_override_capability_cmd,
4864 NO_NEIGHBOR_CMD2 "override-capability",
4865 NO_STR
4866 NEIGHBOR_STR
4867 NEIGHBOR_ADDR_STR2
4868 "Override capability negotiation result\n")
4869{
4870 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
4871}
6b0655a2 4872
718e3744 4873DEFUN (neighbor_strict_capability,
4874 neighbor_strict_capability_cmd,
4875 NEIGHBOR_CMD "strict-capability-match",
4876 NEIGHBOR_STR
4877 NEIGHBOR_ADDR_STR
4878 "Strict capability negotiation match\n")
4879{
4880 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
4881}
4882
4883DEFUN (no_neighbor_strict_capability,
4884 no_neighbor_strict_capability_cmd,
4885 NO_NEIGHBOR_CMD "strict-capability-match",
4886 NO_STR
4887 NEIGHBOR_STR
4888 NEIGHBOR_ADDR_STR
4889 "Strict capability negotiation match\n")
4890{
4891 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
4892}
6b0655a2 4893
94f2b392 4894static int
fd79ac91 4895peer_timers_set_vty (struct vty *vty, const char *ip_str,
4896 const char *keep_str, const char *hold_str)
718e3744 4897{
4898 int ret;
4899 struct peer *peer;
4900 u_int32_t keepalive;
4901 u_int32_t holdtime;
4902
4903 peer = peer_and_group_lookup_vty (vty, ip_str);
4904 if (! peer)
4905 return CMD_WARNING;
4906
4907 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
4908 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
4909
4910 ret = peer_timers_set (peer, keepalive, holdtime);
4911
4912 return bgp_vty_return (vty, ret);
4913}
6b0655a2 4914
94f2b392 4915static int
fd79ac91 4916peer_timers_unset_vty (struct vty *vty, const char *ip_str)
718e3744 4917{
4918 int ret;
4919 struct peer *peer;
4920
0c412461 4921 peer = peer_and_group_lookup_vty (vty, ip_str);
718e3744 4922 if (! peer)
4923 return CMD_WARNING;
4924
4925 ret = peer_timers_unset (peer);
4926
4927 return bgp_vty_return (vty, ret);
4928}
4929
4930DEFUN (neighbor_timers,
4931 neighbor_timers_cmd,
4932 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
4933 NEIGHBOR_STR
4934 NEIGHBOR_ADDR_STR2
4935 "BGP per neighbor timers\n"
4936 "Keepalive interval\n"
4937 "Holdtime\n")
4938{
4939 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
4940}
4941
4942DEFUN (no_neighbor_timers,
4943 no_neighbor_timers_cmd,
4944 NO_NEIGHBOR_CMD2 "timers",
4945 NO_STR
4946 NEIGHBOR_STR
4947 NEIGHBOR_ADDR_STR2
4948 "BGP per neighbor timers\n")
4949{
4950 return peer_timers_unset_vty (vty, argv[0]);
4951}
6b0655a2 4952
813d4307
DW
4953ALIAS (no_neighbor_timers,
4954 no_neighbor_timers_val_cmd,
4955 NO_NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
4956 NO_STR
4957 NEIGHBOR_STR
4958 NEIGHBOR_ADDR_STR2
4959 "BGP per neighbor timers\n"
4960 "Keepalive interval\n"
4961 "Holdtime\n")
4962
94f2b392 4963static int
fd79ac91 4964peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
4965 const char *time_str)
718e3744 4966{
4967 int ret;
4968 struct peer *peer;
4969 u_int32_t connect;
4970
966f821c 4971 peer = peer_and_group_lookup_vty (vty, ip_str);
718e3744 4972 if (! peer)
4973 return CMD_WARNING;
4974
4975 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
4976
4977 ret = peer_timers_connect_set (peer, connect);
4978
966f821c 4979 return bgp_vty_return (vty, ret);
718e3744 4980}
4981
94f2b392 4982static int
fd79ac91 4983peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
718e3744 4984{
4985 int ret;
4986 struct peer *peer;
4987
4988 peer = peer_and_group_lookup_vty (vty, ip_str);
4989 if (! peer)
4990 return CMD_WARNING;
4991
4992 ret = peer_timers_connect_unset (peer);
4993
966f821c 4994 return bgp_vty_return (vty, ret);
718e3744 4995}
4996
4997DEFUN (neighbor_timers_connect,
4998 neighbor_timers_connect_cmd,
8e0d0089 4999 NEIGHBOR_CMD2 "timers connect <1-65535>",
718e3744 5000 NEIGHBOR_STR
966f821c 5001 NEIGHBOR_ADDR_STR2
718e3744 5002 "BGP per neighbor timers\n"
5003 "BGP connect timer\n"
5004 "Connect timer\n")
5005{
5006 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
5007}
5008
5009DEFUN (no_neighbor_timers_connect,
5010 no_neighbor_timers_connect_cmd,
966f821c 5011 NO_NEIGHBOR_CMD2 "timers connect",
718e3744 5012 NO_STR
5013 NEIGHBOR_STR
966f821c 5014 NEIGHBOR_ADDR_STR2
718e3744 5015 "BGP per neighbor timers\n"
5016 "BGP connect timer\n")
5017{
5018 return peer_timers_connect_unset_vty (vty, argv[0]);
5019}
5020
5021ALIAS (no_neighbor_timers_connect,
5022 no_neighbor_timers_connect_val_cmd,
8e0d0089 5023 NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
718e3744 5024 NO_STR
5025 NEIGHBOR_STR
966f821c 5026 NEIGHBOR_ADDR_STR2
718e3744 5027 "BGP per neighbor timers\n"
5028 "BGP connect timer\n"
5029 "Connect timer\n")
6b0655a2 5030
94f2b392 5031static int
fd79ac91 5032peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
5033 const char *time_str, int set)
718e3744 5034{
5035 int ret;
5036 struct peer *peer;
5037 u_int32_t routeadv = 0;
5038
966f821c 5039 peer = peer_and_group_lookup_vty (vty, ip_str);
718e3744 5040 if (! peer)
5041 return CMD_WARNING;
5042
5043 if (time_str)
5044 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
5045
5046 if (set)
5047 ret = peer_advertise_interval_set (peer, routeadv);
5048 else
5049 ret = peer_advertise_interval_unset (peer);
5050
966f821c 5051 return bgp_vty_return (vty, ret);
718e3744 5052}
5053
5054DEFUN (neighbor_advertise_interval,
5055 neighbor_advertise_interval_cmd,
966f821c 5056 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
718e3744 5057 NEIGHBOR_STR
966f821c 5058 NEIGHBOR_ADDR_STR2
718e3744 5059 "Minimum interval between sending BGP routing updates\n"
5060 "time in seconds\n")
5061{
5062 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
5063}
5064
5065DEFUN (no_neighbor_advertise_interval,
5066 no_neighbor_advertise_interval_cmd,
966f821c 5067 NO_NEIGHBOR_CMD2 "advertisement-interval",
718e3744 5068 NO_STR
5069 NEIGHBOR_STR
966f821c 5070 NEIGHBOR_ADDR_STR2
718e3744 5071 "Minimum interval between sending BGP routing updates\n")
5072{
5073 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
5074}
5075
5076ALIAS (no_neighbor_advertise_interval,
5077 no_neighbor_advertise_interval_val_cmd,
966f821c 5078 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
718e3744 5079 NO_STR
5080 NEIGHBOR_STR
966f821c 5081 NEIGHBOR_ADDR_STR2
718e3744 5082 "Minimum interval between sending BGP routing updates\n"
5083 "time in seconds\n")
6b0655a2 5084
518f0eb1
DS
5085/* Time to wait before processing route-map updates */
5086DEFUN (bgp_set_route_map_delay_timer,
5087 bgp_set_route_map_delay_timer_cmd,
5088 "bgp route-map delay-timer <0-600>",
5089 SET_STR
5090 "BGP route-map delay timer\n"
5091 "Time in secs to wait before processing route-map changes\n"
f414725f 5092 "0 disables the timer, no route updates happen when route-maps change\n")
518f0eb1
DS
5093{
5094 u_int32_t rmap_delay_timer;
518f0eb1 5095
518f0eb1
DS
5096 if (argv[0])
5097 {
5098 VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600);
5fe9f963 5099 bm->rmap_update_timer = rmap_delay_timer;
518f0eb1
DS
5100
5101 /* if the dynamic update handling is being disabled, and a timer is
5102 * running, stop the timer and act as if the timer has already fired.
5103 */
5fe9f963 5104 if (!rmap_delay_timer && bm->t_rmap_update )
518f0eb1 5105 {
5fe9f963 5106 BGP_TIMER_OFF(bm->t_rmap_update);
5107 thread_execute (bm->master, bgp_route_map_update_timer, NULL, 0);
518f0eb1
DS
5108 }
5109 return CMD_SUCCESS;
5110 }
5111 else
ffd0c037 5112 return CMD_WARNING;
518f0eb1
DS
5113}
5114
5115DEFUN (no_bgp_set_route_map_delay_timer,
5116 no_bgp_set_route_map_delay_timer_cmd,
5117 "no bgp route-map delay-timer",
5118 NO_STR
5119 "Default BGP route-map delay timer\n"
f414725f 5120 "Reset to default time to wait for processing route-map changes\n")
518f0eb1 5121{
518f0eb1 5122
5fe9f963 5123 bm->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER;
518f0eb1
DS
5124
5125 return CMD_SUCCESS;
5126}
5127
f414725f
DS
5128ALIAS (no_bgp_set_route_map_delay_timer,
5129 no_bgp_set_route_map_delay_timer_val_cmd,
5130 "no bgp route-map delay-timer <0-600>",
5131 NO_STR
5132 "Default BGP route-map delay timer\n"
5133 "Reset to default time to wait for processing route-map changes\n"
5134 "0 disables the timer, no route updates happen when route-maps change\n")
5135
718e3744 5136/* neighbor interface */
94f2b392 5137static int
fd79ac91 5138peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
718e3744 5139{
718e3744 5140 struct peer *peer;
5141
5142 peer = peer_lookup_vty (vty, ip_str);
a80beece 5143 if (! peer || peer->conf_if)
718e3744 5144 return CMD_WARNING;
5145
5146 if (str)
ffd0c037 5147 peer_interface_set (peer, str);
718e3744 5148 else
ffd0c037 5149 peer_interface_unset (peer);
718e3744 5150
5151 return CMD_SUCCESS;
5152}
5153
5154DEFUN (neighbor_interface,
5155 neighbor_interface_cmd,
5156 NEIGHBOR_CMD "interface WORD",
5157 NEIGHBOR_STR
5158 NEIGHBOR_ADDR_STR
5159 "Interface\n"
5160 "Interface name\n")
5161{
8ffedcea
DS
5162 if (argc == 3)
5163 return peer_interface_vty (vty, argv[0], argv[1]);
5164 else
5165 return peer_interface_vty (vty, argv[0], argv[1]);
718e3744 5166}
5167
5168DEFUN (no_neighbor_interface,
5169 no_neighbor_interface_cmd,
8ffedcea 5170 NO_NEIGHBOR_CMD2 "interface WORD",
718e3744 5171 NO_STR
5172 NEIGHBOR_STR
5173 NEIGHBOR_ADDR_STR
5174 "Interface\n"
5175 "Interface name\n")
5176{
5177 return peer_interface_vty (vty, argv[0], NULL);
5178}
6b0655a2 5179
718e3744 5180/* Set distribute list to the peer. */
94f2b392 5181static int
fd79ac91 5182peer_distribute_set_vty (struct vty *vty, const char *ip_str,
5183 afi_t afi, safi_t safi,
5184 const char *name_str, const char *direct_str)
718e3744 5185{
5186 int ret;
5187 struct peer *peer;
5188 int direct = FILTER_IN;
5189
5190 peer = peer_and_group_lookup_vty (vty, ip_str);
5191 if (! peer)
5192 return CMD_WARNING;
5193
5194 /* Check filter direction. */
5195 if (strncmp (direct_str, "i", 1) == 0)
5196 direct = FILTER_IN;
5197 else if (strncmp (direct_str, "o", 1) == 0)
5198 direct = FILTER_OUT;
5199
5200 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
5201
5202 return bgp_vty_return (vty, ret);
5203}
5204
94f2b392 5205static int
fd79ac91 5206peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
5207 safi_t safi, const char *direct_str)
718e3744 5208{
5209 int ret;
5210 struct peer *peer;
5211 int direct = FILTER_IN;
5212
5213 peer = peer_and_group_lookup_vty (vty, ip_str);
5214 if (! peer)
5215 return CMD_WARNING;
5216
5217 /* Check filter direction. */
5218 if (strncmp (direct_str, "i", 1) == 0)
5219 direct = FILTER_IN;
5220 else if (strncmp (direct_str, "o", 1) == 0)
5221 direct = FILTER_OUT;
5222
5223 ret = peer_distribute_unset (peer, afi, safi, direct);
5224
5225 return bgp_vty_return (vty, ret);
5226}
5227
5228DEFUN (neighbor_distribute_list,
5229 neighbor_distribute_list_cmd,
5230 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
5231 NEIGHBOR_STR
5232 NEIGHBOR_ADDR_STR2
5233 "Filter updates to/from this neighbor\n"
5234 "IP access-list number\n"
5235 "IP access-list number (expanded range)\n"
5236 "IP Access-list name\n"
5237 "Filter incoming updates\n"
5238 "Filter outgoing updates\n")
5239{
5240 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
5241 bgp_node_safi (vty), argv[1], argv[2]);
5242}
5243
5244DEFUN (no_neighbor_distribute_list,
5245 no_neighbor_distribute_list_cmd,
5246 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
5247 NO_STR
5248 NEIGHBOR_STR
5249 NEIGHBOR_ADDR_STR2
5250 "Filter updates to/from this neighbor\n"
5251 "IP access-list number\n"
5252 "IP access-list number (expanded range)\n"
5253 "IP Access-list name\n"
5254 "Filter incoming updates\n"
5255 "Filter outgoing updates\n")
5256{
5257 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
5258 bgp_node_safi (vty), argv[2]);
5259}
6b0655a2 5260
718e3744 5261/* Set prefix list to the peer. */
94f2b392 5262static int
fd79ac91 5263peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
5264 safi_t safi, const char *name_str,
5265 const char *direct_str)
718e3744 5266{
5267 int ret;
5268 struct peer *peer;
5269 int direct = FILTER_IN;
5270
5271 peer = peer_and_group_lookup_vty (vty, ip_str);
5272 if (! peer)
5273 return CMD_WARNING;
5274
5275 /* Check filter direction. */
5276 if (strncmp (direct_str, "i", 1) == 0)
5277 direct = FILTER_IN;
5278 else if (strncmp (direct_str, "o", 1) == 0)
5279 direct = FILTER_OUT;
5280
5281 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
5282
5283 return bgp_vty_return (vty, ret);
5284}
5285
94f2b392 5286static int
fd79ac91 5287peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
5288 safi_t safi, const char *direct_str)
718e3744 5289{
5290 int ret;
5291 struct peer *peer;
5292 int direct = FILTER_IN;
5293
5294 peer = peer_and_group_lookup_vty (vty, ip_str);
5295 if (! peer)
5296 return CMD_WARNING;
5297
5298 /* Check filter direction. */
5299 if (strncmp (direct_str, "i", 1) == 0)
5300 direct = FILTER_IN;
5301 else if (strncmp (direct_str, "o", 1) == 0)
5302 direct = FILTER_OUT;
5303
5304 ret = peer_prefix_list_unset (peer, afi, safi, direct);
5305
5306 return bgp_vty_return (vty, ret);
5307}
5308
5309DEFUN (neighbor_prefix_list,
5310 neighbor_prefix_list_cmd,
5311 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
5312 NEIGHBOR_STR
5313 NEIGHBOR_ADDR_STR2
5314 "Filter updates to/from this neighbor\n"
5315 "Name of a prefix list\n"
5316 "Filter incoming updates\n"
5317 "Filter outgoing updates\n")
5318{
5319 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
5320 bgp_node_safi (vty), argv[1], argv[2]);
5321}
5322
5323DEFUN (no_neighbor_prefix_list,
5324 no_neighbor_prefix_list_cmd,
5325 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
5326 NO_STR
5327 NEIGHBOR_STR
5328 NEIGHBOR_ADDR_STR2
5329 "Filter updates to/from this neighbor\n"
5330 "Name of a prefix list\n"
5331 "Filter incoming updates\n"
5332 "Filter outgoing updates\n")
5333{
5334 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
5335 bgp_node_safi (vty), argv[2]);
5336}
6b0655a2 5337
94f2b392 5338static int
fd79ac91 5339peer_aslist_set_vty (struct vty *vty, const char *ip_str,
5340 afi_t afi, safi_t safi,
5341 const char *name_str, const char *direct_str)
718e3744 5342{
5343 int ret;
5344 struct peer *peer;
5345 int direct = FILTER_IN;
5346
5347 peer = peer_and_group_lookup_vty (vty, ip_str);
5348 if (! peer)
5349 return CMD_WARNING;
5350
5351 /* Check filter direction. */
5352 if (strncmp (direct_str, "i", 1) == 0)
5353 direct = FILTER_IN;
5354 else if (strncmp (direct_str, "o", 1) == 0)
5355 direct = FILTER_OUT;
5356
5357 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
5358
5359 return bgp_vty_return (vty, ret);
5360}
5361
94f2b392 5362static int
fd79ac91 5363peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
5364 afi_t afi, safi_t safi,
5365 const char *direct_str)
718e3744 5366{
5367 int ret;
5368 struct peer *peer;
5369 int direct = FILTER_IN;
5370
5371 peer = peer_and_group_lookup_vty (vty, ip_str);
5372 if (! peer)
5373 return CMD_WARNING;
5374
5375 /* Check filter direction. */
5376 if (strncmp (direct_str, "i", 1) == 0)
5377 direct = FILTER_IN;
5378 else if (strncmp (direct_str, "o", 1) == 0)
5379 direct = FILTER_OUT;
5380
5381 ret = peer_aslist_unset (peer, afi, safi, direct);
5382
5383 return bgp_vty_return (vty, ret);
5384}
5385
5386DEFUN (neighbor_filter_list,
5387 neighbor_filter_list_cmd,
5388 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
5389 NEIGHBOR_STR
5390 NEIGHBOR_ADDR_STR2
5391 "Establish BGP filters\n"
5392 "AS path access-list name\n"
5393 "Filter incoming routes\n"
5394 "Filter outgoing routes\n")
5395{
5396 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
5397 bgp_node_safi (vty), argv[1], argv[2]);
5398}
5399
5400DEFUN (no_neighbor_filter_list,
5401 no_neighbor_filter_list_cmd,
5402 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
5403 NO_STR
5404 NEIGHBOR_STR
5405 NEIGHBOR_ADDR_STR2
5406 "Establish BGP filters\n"
5407 "AS path access-list name\n"
5408 "Filter incoming routes\n"
5409 "Filter outgoing routes\n")
5410{
5411 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
5412 bgp_node_safi (vty), argv[2]);
5413}
6b0655a2 5414
718e3744 5415/* Set route-map to the peer. */
94f2b392 5416static int
fd79ac91 5417peer_route_map_set_vty (struct vty *vty, const char *ip_str,
5418 afi_t afi, safi_t safi,
5419 const char *name_str, const char *direct_str)
718e3744 5420{
5421 int ret;
5422 struct peer *peer;
fee0f4c6 5423 int direct = RMAP_IN;
718e3744 5424
5425 peer = peer_and_group_lookup_vty (vty, ip_str);
5426 if (! peer)
5427 return CMD_WARNING;
5428
5429 /* Check filter direction. */
fee0f4c6 5430 if (strncmp (direct_str, "in", 2) == 0)
5431 direct = RMAP_IN;
718e3744 5432 else if (strncmp (direct_str, "o", 1) == 0)
fee0f4c6 5433 direct = RMAP_OUT;
718e3744 5434
5435 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
5436
5437 return bgp_vty_return (vty, ret);
5438}
5439
94f2b392 5440static int
fd79ac91 5441peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
5442 safi_t safi, const char *direct_str)
718e3744 5443{
5444 int ret;
5445 struct peer *peer;
fee0f4c6 5446 int direct = RMAP_IN;
718e3744 5447
5448 peer = peer_and_group_lookup_vty (vty, ip_str);
5449 if (! peer)
5450 return CMD_WARNING;
5451
5452 /* Check filter direction. */
fee0f4c6 5453 if (strncmp (direct_str, "in", 2) == 0)
5454 direct = RMAP_IN;
718e3744 5455 else if (strncmp (direct_str, "o", 1) == 0)
fee0f4c6 5456 direct = RMAP_OUT;
718e3744 5457
5458 ret = peer_route_map_unset (peer, afi, safi, direct);
5459
5460 return bgp_vty_return (vty, ret);
5461}
5462
5463DEFUN (neighbor_route_map,
5464 neighbor_route_map_cmd,
2a3d5731 5465 NEIGHBOR_CMD2 "route-map WORD (in|out)",
718e3744 5466 NEIGHBOR_STR
5467 NEIGHBOR_ADDR_STR2
5468 "Apply route map to neighbor\n"
5469 "Name of route map\n"
5470 "Apply map to incoming routes\n"
2a3d5731 5471 "Apply map to outbound routes\n")
718e3744 5472{
5473 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
5474 bgp_node_safi (vty), argv[1], argv[2]);
5475}
5476
5477DEFUN (no_neighbor_route_map,
5478 no_neighbor_route_map_cmd,
2a3d5731 5479 NO_NEIGHBOR_CMD2 "route-map WORD (in|out)",
718e3744 5480 NO_STR
5481 NEIGHBOR_STR
5482 NEIGHBOR_ADDR_STR2
5483 "Apply route map to neighbor\n"
5484 "Name of route map\n"
5485 "Apply map to incoming routes\n"
2a3d5731 5486 "Apply map to outbound routes\n")
718e3744 5487{
5488 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
5489 bgp_node_safi (vty), argv[2]);
5490}
6b0655a2 5491
718e3744 5492/* Set unsuppress-map to the peer. */
94f2b392 5493static int
fd79ac91 5494peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
5495 safi_t safi, const char *name_str)
718e3744 5496{
5497 int ret;
5498 struct peer *peer;
5499
5500 peer = peer_and_group_lookup_vty (vty, ip_str);
5501 if (! peer)
5502 return CMD_WARNING;
5503
5504 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
5505
5506 return bgp_vty_return (vty, ret);
5507}
5508
5509/* Unset route-map from the peer. */
94f2b392 5510static int
fd79ac91 5511peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
718e3744 5512 safi_t safi)
5513{
5514 int ret;
5515 struct peer *peer;
5516
5517 peer = peer_and_group_lookup_vty (vty, ip_str);
5518 if (! peer)
5519 return CMD_WARNING;
5520
5521 ret = peer_unsuppress_map_unset (peer, afi, safi);
5522
5523 return bgp_vty_return (vty, ret);
5524}
5525
5526DEFUN (neighbor_unsuppress_map,
5527 neighbor_unsuppress_map_cmd,
5528 NEIGHBOR_CMD2 "unsuppress-map WORD",
5529 NEIGHBOR_STR
5530 NEIGHBOR_ADDR_STR2
5531 "Route-map to selectively unsuppress suppressed routes\n"
5532 "Name of route map\n")
5533{
5534 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
5535 bgp_node_safi (vty), argv[1]);
5536}
5537
5538DEFUN (no_neighbor_unsuppress_map,
5539 no_neighbor_unsuppress_map_cmd,
5540 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
5541 NO_STR
5542 NEIGHBOR_STR
5543 NEIGHBOR_ADDR_STR2
5544 "Route-map to selectively unsuppress suppressed routes\n"
5545 "Name of route map\n")
5546{
5547 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
5548 bgp_node_safi (vty));
5549}
6b0655a2 5550
94f2b392 5551static int
fd79ac91 5552peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
5553 safi_t safi, const char *num_str,
0a486e5f 5554 const char *threshold_str, int warning,
5555 const char *restart_str)
718e3744 5556{
5557 int ret;
5558 struct peer *peer;
5559 u_int32_t max;
e0701b79 5560 u_char threshold;
0a486e5f 5561 u_int16_t restart;
718e3744 5562
5563 peer = peer_and_group_lookup_vty (vty, ip_str);
5564 if (! peer)
5565 return CMD_WARNING;
5566
e6ec1c36 5567 VTY_GET_INTEGER ("maximum number", max, num_str);
e0701b79 5568 if (threshold_str)
5569 threshold = atoi (threshold_str);
5570 else
5571 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
718e3744 5572
0a486e5f 5573 if (restart_str)
5574 restart = atoi (restart_str);
5575 else
5576 restart = 0;
5577
5578 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
718e3744 5579
5580 return bgp_vty_return (vty, ret);
5581}
5582
94f2b392 5583static int
fd79ac91 5584peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
718e3744 5585 safi_t safi)
5586{
5587 int ret;
5588 struct peer *peer;
5589
5590 peer = peer_and_group_lookup_vty (vty, ip_str);
5591 if (! peer)
5592 return CMD_WARNING;
5593
5594 ret = peer_maximum_prefix_unset (peer, afi, safi);
5595
5596 return bgp_vty_return (vty, ret);
5597}
5598
5599/* Maximum number of prefix configuration. prefix count is different
5600 for each peer configuration. So this configuration can be set for
5601 each peer configuration. */
5602DEFUN (neighbor_maximum_prefix,
5603 neighbor_maximum_prefix_cmd,
5604 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
5605 NEIGHBOR_STR
5606 NEIGHBOR_ADDR_STR2
5607 "Maximum number of prefix accept from this peer\n"
5608 "maximum no. of prefix limit\n")
5609{
5610 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 5611 bgp_node_safi (vty), argv[1], NULL, 0,
5612 NULL);
718e3744 5613}
5614
e0701b79 5615DEFUN (neighbor_maximum_prefix_threshold,
5616 neighbor_maximum_prefix_threshold_cmd,
5617 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
5618 NEIGHBOR_STR
5619 NEIGHBOR_ADDR_STR2
5620 "Maximum number of prefix accept from this peer\n"
5621 "maximum no. of prefix limit\n"
5622 "Threshold value (%) at which to generate a warning msg\n")
5623{
5624 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 5625 bgp_node_safi (vty), argv[1], argv[2], 0,
5626 NULL);
5627}
e0701b79 5628
718e3744 5629DEFUN (neighbor_maximum_prefix_warning,
5630 neighbor_maximum_prefix_warning_cmd,
5631 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
5632 NEIGHBOR_STR
5633 NEIGHBOR_ADDR_STR2
5634 "Maximum number of prefix accept from this peer\n"
5635 "maximum no. of prefix limit\n"
5636 "Only give warning message when limit is exceeded\n")
5637{
5638 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 5639 bgp_node_safi (vty), argv[1], NULL, 1,
5640 NULL);
718e3744 5641}
5642
e0701b79 5643DEFUN (neighbor_maximum_prefix_threshold_warning,
5644 neighbor_maximum_prefix_threshold_warning_cmd,
5645 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
5646 NEIGHBOR_STR
5647 NEIGHBOR_ADDR_STR2
5648 "Maximum number of prefix accept from this peer\n"
5649 "maximum no. of prefix limit\n"
5650 "Threshold value (%) at which to generate a warning msg\n"
5651 "Only give warning message when limit is exceeded\n")
5652{
5653 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 5654 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
5655}
5656
5657DEFUN (neighbor_maximum_prefix_restart,
5658 neighbor_maximum_prefix_restart_cmd,
5659 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
5660 NEIGHBOR_STR
5661 NEIGHBOR_ADDR_STR2
5662 "Maximum number of prefix accept from this peer\n"
5663 "maximum no. of prefix limit\n"
5664 "Restart bgp connection after limit is exceeded\n"
5665 "Restart interval in minutes")
5666{
5667 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
5668 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
5669}
5670
5671DEFUN (neighbor_maximum_prefix_threshold_restart,
5672 neighbor_maximum_prefix_threshold_restart_cmd,
5673 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
5674 NEIGHBOR_STR
5675 NEIGHBOR_ADDR_STR2
5676 "Maximum number of prefix accept from this peer\n"
5677 "maximum no. of prefix limit\n"
5678 "Threshold value (%) at which to generate a warning msg\n"
5679 "Restart bgp connection after limit is exceeded\n"
5680 "Restart interval in minutes")
5681{
5682 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
5683 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
5684}
e0701b79 5685
718e3744 5686DEFUN (no_neighbor_maximum_prefix,
5687 no_neighbor_maximum_prefix_cmd,
5688 NO_NEIGHBOR_CMD2 "maximum-prefix",
5689 NO_STR
5690 NEIGHBOR_STR
5691 NEIGHBOR_ADDR_STR2
5692 "Maximum number of prefix accept from this peer\n")
5693{
5694 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
5695 bgp_node_safi (vty));
5696}
5697
5698ALIAS (no_neighbor_maximum_prefix,
5699 no_neighbor_maximum_prefix_val_cmd,
5700 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
5701 NO_STR
5702 NEIGHBOR_STR
5703 NEIGHBOR_ADDR_STR2
5704 "Maximum number of prefix accept from this peer\n"
5705 "maximum no. of prefix limit\n")
5706
5707ALIAS (no_neighbor_maximum_prefix,
0a486e5f 5708 no_neighbor_maximum_prefix_threshold_cmd,
813d4307 5709 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
0a486e5f 5710 NO_STR
5711 NEIGHBOR_STR
5712 NEIGHBOR_ADDR_STR2
5713 "Maximum number of prefix accept from this peer\n"
5714 "maximum no. of prefix limit\n"
5715 "Threshold value (%) at which to generate a warning msg\n")
5716
5717ALIAS (no_neighbor_maximum_prefix,
5718 no_neighbor_maximum_prefix_warning_cmd,
5719 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
5720 NO_STR
5721 NEIGHBOR_STR
5722 NEIGHBOR_ADDR_STR2
5723 "Maximum number of prefix accept from this peer\n"
5724 "maximum no. of prefix limit\n"
e8e1946e 5725 "Only give warning message when limit is exceeded\n")
0a486e5f 5726
5727ALIAS (no_neighbor_maximum_prefix,
5728 no_neighbor_maximum_prefix_threshold_warning_cmd,
e0701b79 5729 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
5730 NO_STR
5731 NEIGHBOR_STR
5732 NEIGHBOR_ADDR_STR2
5733 "Maximum number of prefix accept from this peer\n"
5734 "maximum no. of prefix limit\n"
5735 "Threshold value (%) at which to generate a warning msg\n"
e8e1946e 5736 "Only give warning message when limit is exceeded\n")
e0701b79 5737
5738ALIAS (no_neighbor_maximum_prefix,
0a486e5f 5739 no_neighbor_maximum_prefix_restart_cmd,
5740 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
718e3744 5741 NO_STR
5742 NEIGHBOR_STR
5743 NEIGHBOR_ADDR_STR2
5744 "Maximum number of prefix accept from this peer\n"
5745 "maximum no. of prefix limit\n"
0a486e5f 5746 "Restart bgp connection after limit is exceeded\n"
5747 "Restart interval in minutes")
5748
5749ALIAS (no_neighbor_maximum_prefix,
5750 no_neighbor_maximum_prefix_threshold_restart_cmd,
5751 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
5752 NO_STR
5753 NEIGHBOR_STR
5754 NEIGHBOR_ADDR_STR2
5755 "Maximum number of prefix accept from this peer\n"
5756 "maximum no. of prefix limit\n"
5757 "Threshold value (%) at which to generate a warning msg\n"
5758 "Restart bgp connection after limit is exceeded\n"
5759 "Restart interval in minutes")
6b0655a2 5760
718e3744 5761/* "neighbor allowas-in" */
5762DEFUN (neighbor_allowas_in,
5763 neighbor_allowas_in_cmd,
5764 NEIGHBOR_CMD2 "allowas-in",
5765 NEIGHBOR_STR
5766 NEIGHBOR_ADDR_STR2
5767 "Accept as-path with my AS present in it\n")
5768{
5769 int ret;
5770 struct peer *peer;
fd79ac91 5771 unsigned int allow_num;
718e3744 5772
5773 peer = peer_and_group_lookup_vty (vty, argv[0]);
5774 if (! peer)
5775 return CMD_WARNING;
5776
5777 if (argc == 1)
5778 allow_num = 3;
5779 else
5780 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
5781
5782 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
5783 allow_num);
5784
5785 return bgp_vty_return (vty, ret);
5786}
5787
5788ALIAS (neighbor_allowas_in,
5789 neighbor_allowas_in_arg_cmd,
5790 NEIGHBOR_CMD2 "allowas-in <1-10>",
5791 NEIGHBOR_STR
5792 NEIGHBOR_ADDR_STR2
5793 "Accept as-path with my AS present in it\n"
5794 "Number of occurances of AS number\n")
5795
5796DEFUN (no_neighbor_allowas_in,
5797 no_neighbor_allowas_in_cmd,
5798 NO_NEIGHBOR_CMD2 "allowas-in",
5799 NO_STR
5800 NEIGHBOR_STR
5801 NEIGHBOR_ADDR_STR2
5802 "allow local ASN appears in aspath attribute\n")
5803{
5804 int ret;
5805 struct peer *peer;
5806
5807 peer = peer_and_group_lookup_vty (vty, argv[0]);
5808 if (! peer)
5809 return CMD_WARNING;
5810
5811 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
5812
5813 return bgp_vty_return (vty, ret);
5814}
6b0655a2 5815
813d4307
DW
5816ALIAS (no_neighbor_allowas_in,
5817 no_neighbor_allowas_in_val_cmd,
5818 NO_NEIGHBOR_CMD2 "allowas-in <1-10>",
5819 NO_STR
5820 NEIGHBOR_STR
5821 NEIGHBOR_ADDR_STR2
5822 "allow local ASN appears in aspath attribute\n"
5823 "Number of occurances of AS number\n")
5824
fa411a21
NH
5825DEFUN (neighbor_ttl_security,
5826 neighbor_ttl_security_cmd,
5827 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
5828 NEIGHBOR_STR
5829 NEIGHBOR_ADDR_STR2
5830 "Specify the maximum number of hops to the BGP peer\n")
5831{
5832 struct peer *peer;
89b6d1f8 5833 int gtsm_hops;
fa411a21
NH
5834
5835 peer = peer_and_group_lookup_vty (vty, argv[0]);
5836 if (! peer)
5837 return CMD_WARNING;
5838
5839 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
5840
8cdabf90
SK
5841 /*
5842 * If 'neighbor swpX', then this is for directly connected peers,
5843 * we should not accept a ttl-security hops value greater than 1.
5844 */
5845 if (peer->conf_if && (gtsm_hops > 1)) {
5846 vty_out (vty, "%s is directly connected peer, hops cannot exceed 1%s",
5847 argv[0], VTY_NEWLINE);
5848 return CMD_WARNING;
5849 }
5850
89b6d1f8 5851 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
fa411a21
NH
5852}
5853
5854DEFUN (no_neighbor_ttl_security,
5855 no_neighbor_ttl_security_cmd,
5856 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
5857 NO_STR
5858 NEIGHBOR_STR
5859 NEIGHBOR_ADDR_STR2
5860 "Specify the maximum number of hops to the BGP peer\n")
5861{
5862 struct peer *peer;
fa411a21
NH
5863
5864 peer = peer_and_group_lookup_vty (vty, argv[0]);
5865 if (! peer)
5866 return CMD_WARNING;
5867
89b6d1f8 5868 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
fa411a21 5869}
6b0655a2 5870
adbac85e
DW
5871DEFUN (neighbor_addpath_tx_all_paths,
5872 neighbor_addpath_tx_all_paths_cmd,
5873 NEIGHBOR_CMD2 "addpath-tx-all-paths",
5874 NEIGHBOR_STR
5875 NEIGHBOR_ADDR_STR2
5876 "Use addpath to advertise all paths to a neighbor\n")
5877{
5878 struct peer *peer;
5879
adbac85e
DW
5880 peer = peer_and_group_lookup_vty (vty, argv[0]);
5881 if (! peer)
5882 return CMD_WARNING;
5883
5884 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
5885 bgp_node_safi (vty),
5886 PEER_FLAG_ADDPATH_TX_ALL_PATHS);
5887}
5888
5889DEFUN (no_neighbor_addpath_tx_all_paths,
5890 no_neighbor_addpath_tx_all_paths_cmd,
5891 NO_NEIGHBOR_CMD2 "addpath-tx-all-paths",
5892 NO_STR
5893 NEIGHBOR_STR
5894 NEIGHBOR_ADDR_STR2
5895 "Use addpath to advertise all paths to a neighbor\n")
5896{
5897 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
5898 bgp_node_safi (vty),
5899 PEER_FLAG_ADDPATH_TX_ALL_PATHS);
5900}
5901
06370dac
DW
5902DEFUN (neighbor_addpath_tx_bestpath_per_as,
5903 neighbor_addpath_tx_bestpath_per_as_cmd,
5904 NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS",
5905 NEIGHBOR_STR
5906 NEIGHBOR_ADDR_STR2
5907 "Use addpath to advertise the bestpath per each neighboring AS\n")
5908{
5909 struct peer *peer;
5910
5911 peer = peer_and_group_lookup_vty (vty, argv[0]);
5912 if (! peer)
5913 return CMD_WARNING;
5914
5915 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
5916 bgp_node_safi (vty),
5917 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS);
5918}
5919
5920DEFUN (no_neighbor_addpath_tx_bestpath_per_as,
5921 no_neighbor_addpath_tx_bestpath_per_as_cmd,
5922 NO_NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS",
5923 NO_STR
5924 NEIGHBOR_STR
5925 NEIGHBOR_ADDR_STR2
5926 "Use addpath to advertise the bestpath per each neighboring AS\n")
5927{
5928 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
5929 bgp_node_safi (vty),
5930 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS);
5931}
5932
5933
718e3744 5934/* Address family configuration. */
5935DEFUN (address_family_ipv4,
5936 address_family_ipv4_cmd,
5937 "address-family ipv4",
5938 "Enter Address Family command mode\n"
5939 "Address family\n")
5940{
5941 vty->node = BGP_IPV4_NODE;
5942 return CMD_SUCCESS;
5943}
5944
5945DEFUN (address_family_ipv4_safi,
5946 address_family_ipv4_safi_cmd,
5947 "address-family ipv4 (unicast|multicast)",
5948 "Enter Address Family command mode\n"
5949 "Address family\n"
5950 "Address Family modifier\n"
5951 "Address Family modifier\n")
5952{
5953 if (strncmp (argv[0], "m", 1) == 0)
5954 vty->node = BGP_IPV4M_NODE;
5955 else
5956 vty->node = BGP_IPV4_NODE;
5957
5958 return CMD_SUCCESS;
5959}
5960
25ffbdc1 5961DEFUN (address_family_ipv6,
5962 address_family_ipv6_cmd,
5963 "address-family ipv6",
718e3744 5964 "Enter Address Family command mode\n"
25ffbdc1 5965 "Address family\n")
718e3744 5966{
5967 vty->node = BGP_IPV6_NODE;
5968 return CMD_SUCCESS;
5969}
5970
25ffbdc1 5971DEFUN (address_family_ipv6_safi,
5972 address_family_ipv6_safi_cmd,
5973 "address-family ipv6 (unicast|multicast)",
718e3744 5974 "Enter Address Family command mode\n"
25ffbdc1 5975 "Address family\n"
5976 "Address Family modifier\n"
5977 "Address Family modifier\n")
5978{
5979 if (strncmp (argv[0], "m", 1) == 0)
5980 vty->node = BGP_IPV6M_NODE;
5981 else
5982 vty->node = BGP_IPV6_NODE;
5983
5984 return CMD_SUCCESS;
5985}
718e3744 5986
5987DEFUN (address_family_vpnv4,
5988 address_family_vpnv4_cmd,
5989 "address-family vpnv4",
5990 "Enter Address Family command mode\n"
5991 "Address family\n")
5992{
5993 vty->node = BGP_VPNV4_NODE;
5994 return CMD_SUCCESS;
5995}
5996
5997ALIAS (address_family_vpnv4,
5998 address_family_vpnv4_unicast_cmd,
5999 "address-family vpnv4 unicast",
6000 "Enter Address Family command mode\n"
6001 "Address family\n"
6002 "Address Family Modifier\n")
6003
8ecd3266 6004DEFUN (address_family_vpnv6,
6005 address_family_vpnv6_cmd,
6006 "address-family vpnv6",
6007 "Enter Address Family command mode\n"
6008 "Address family\n")
6009{
6010 vty->node = BGP_VPNV6_NODE;
6011 return CMD_SUCCESS;
6012}
6013
6014ALIAS (address_family_vpnv6,
6015 address_family_vpnv6_unicast_cmd,
6016 "address-family vpnv6 unicast",
6017 "Enter Address Family command mode\n"
6018 "Address family\n"
6019 "Address Family Modifier\n")
6020
8b1fb8be
LB
6021DEFUN (address_family_encap,
6022 address_family_encap_cmd,
6023 "address-family encap",
6024 "Enter Address Family command mode\n"
6025 "Address family\n")
6026{
6027 vty->node = BGP_ENCAP_NODE;
6028 return CMD_SUCCESS;
6029}
6030
6031ALIAS (address_family_encap,
6032 address_family_encapv4_cmd,
6033 "address-family encapv4",
6034 "Enter Address Family command mode\n"
6035 "Address family\n")
6036
6037DEFUN (address_family_encapv6,
6038 address_family_encapv6_cmd,
6039 "address-family encapv6",
6040 "Enter Address Family command mode\n"
6041 "Address family\n")
6042{
6043 vty->node = BGP_ENCAPV6_NODE;
6044 return CMD_SUCCESS;
6045}
6046
718e3744 6047DEFUN (exit_address_family,
6048 exit_address_family_cmd,
6049 "exit-address-family",
6050 "Exit from Address Family configuration mode\n")
6051{
a8a80d53 6052 if (vty->node == BGP_IPV4_NODE
6053 || vty->node == BGP_IPV4M_NODE
718e3744 6054 || vty->node == BGP_VPNV4_NODE
25ffbdc1 6055 || vty->node == BGP_IPV6_NODE
8ecd3266 6056 || vty->node == BGP_IPV6M_NODE
8b1fb8be
LB
6057 || vty->node == BGP_VPNV6_NODE
6058 || vty->node == BGP_ENCAP_NODE
6059 || vty->node == BGP_ENCAPV6_NODE)
718e3744 6060 vty->node = BGP_NODE;
6061 return CMD_SUCCESS;
6062}
6b0655a2 6063
8ad7271d
DS
6064/* Recalculate bestpath and re-advertise a prefix */
6065static int
01080f7c 6066bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str,
8ad7271d
DS
6067 afi_t afi, safi_t safi, struct prefix_rd *prd)
6068{
6069 int ret;
6070 struct prefix match;
6071 struct bgp_node *rn;
6072 struct bgp_node *rm;
8ad7271d
DS
6073 struct bgp *bgp;
6074 struct bgp_table *table;
6075 struct bgp_table *rib;
6076
6077 /* BGP structure lookup. */
6078 if (view_name)
6079 {
6080 bgp = bgp_lookup_by_name (view_name);
6081 if (bgp == NULL)
6082 {
6aeb9e78 6083 vty_out (vty, "%% Can't find BGP instance %s%s", view_name, VTY_NEWLINE);
8ad7271d
DS
6084 return CMD_WARNING;
6085 }
6086 }
6087 else
6088 {
6089 bgp = bgp_get_default ();
6090 if (bgp == NULL)
6091 {
6092 vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE);
6093 return CMD_WARNING;
6094 }
6095 }
6096
6097 /* Check IP address argument. */
6098 ret = str2prefix (ip_str, &match);
6099 if (! ret)
6100 {
6101 vty_out (vty, "%% address is malformed%s", VTY_NEWLINE);
6102 return CMD_WARNING;
6103 }
6104
6105 match.family = afi2family (afi);
6106 rib = bgp->rib[afi][safi];
6107
6108 if (safi == SAFI_MPLS_VPN)
6109 {
6110 for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn))
6111 {
6112 if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0)
6113 continue;
6114
6115 if ((table = rn->info) != NULL)
6116 {
6117 if ((rm = bgp_node_match (table, &match)) != NULL)
6118 {
6119 if (rm->p.prefixlen == match.prefixlen)
6120 {
6121 SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR);
6122 bgp_process (bgp, rm, afi, safi);
6123 }
6124 bgp_unlock_node (rm);
6125 }
6126 }
6127 }
6128 }
6129 else
6130 {
6131 if ((rn = bgp_node_match (rib, &match)) != NULL)
6132 {
6133 if (rn->p.prefixlen == match.prefixlen)
6134 {
6135 SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR);
6136 bgp_process (bgp, rn, afi, safi);
6137 }
6138 bgp_unlock_node (rn);
6139 }
6140 }
6141
6142 return CMD_SUCCESS;
6143}
6144
718e3744 6145DEFUN (clear_ip_bgp_all,
6146 clear_ip_bgp_all_cmd,
6147 "clear ip bgp *",
6148 CLEAR_STR
6149 IP_STR
6150 BGP_STR
6151 "Clear all peers\n")
6152{
6aeb9e78
DS
6153 if (argc == 2)
6154 return bgp_clear_vty (vty, argv[1], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
718e3744 6155
6156 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
6157}
6158
01080f7c 6159ALIAS (clear_ip_bgp_all,
6160 clear_ip_bgp_instance_all_cmd,
6161 "clear ip bgp " BGP_INSTANCE_CMD " *",
6162 CLEAR_STR
6163 IP_STR
6164 BGP_STR
6165 BGP_INSTANCE_HELP_STR
6166 "Clear all peers\n")
6167
718e3744 6168ALIAS (clear_ip_bgp_all,
6169 clear_bgp_all_cmd,
6170 "clear bgp *",
6171 CLEAR_STR
6172 BGP_STR
6173 "Clear all peers\n")
6174
6175ALIAS (clear_ip_bgp_all,
01080f7c 6176 clear_bgp_instance_all_cmd,
6177 "clear bgp " BGP_INSTANCE_CMD " *",
718e3744 6178 CLEAR_STR
6179 BGP_STR
01080f7c 6180 BGP_INSTANCE_HELP_STR
718e3744 6181 "Clear all peers\n")
6182
6183ALIAS (clear_ip_bgp_all,
01080f7c 6184 clear_bgp_ipv6_all_cmd,
6185 "clear bgp ipv6 *",
718e3744 6186 CLEAR_STR
718e3744 6187 BGP_STR
01080f7c 6188 "Address family\n"
718e3744 6189 "Clear all peers\n")
6190
6191ALIAS (clear_ip_bgp_all,
01080f7c 6192 clear_bgp_instance_ipv6_all_cmd,
6193 "clear bgp " BGP_INSTANCE_CMD " ipv6 *",
718e3744 6194 CLEAR_STR
6195 BGP_STR
8386ac43 6196 BGP_INSTANCE_HELP_STR
01080f7c 6197 "Address family\n"
718e3744 6198 "Clear all peers\n")
6199
6200DEFUN (clear_ip_bgp_peer,
6201 clear_ip_bgp_peer_cmd,
a80beece 6202 "clear ip bgp (A.B.C.D|X:X::X:X|WORD)",
718e3744 6203 CLEAR_STR
6204 IP_STR
6205 BGP_STR
6206 "BGP neighbor IP address to clear\n"
a80beece
DS
6207 "BGP IPv6 neighbor to clear\n"
6208 "BGP neighbor on interface to clear\n")
718e3744 6209{
01080f7c 6210 if (argc == 3)
6211 return bgp_clear_vty (vty, argv[1], 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[2]);
6212
718e3744 6213 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
6214}
6215
01080f7c 6216ALIAS (clear_ip_bgp_peer,
6217 clear_ip_bgp_instance_peer_cmd,
6218 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)",
6219 CLEAR_STR
6220 IP_STR
6221 BGP_STR
6222 BGP_INSTANCE_HELP_STR
6223 "BGP neighbor IP address to clear\n"
6224 "BGP IPv6 neighbor to clear\n"
6225 "BGP neighbor on interface to clear\n")
6226
718e3744 6227ALIAS (clear_ip_bgp_peer,
6228 clear_bgp_peer_cmd,
a80beece 6229 "clear bgp (A.B.C.D|X:X::X:X|WORD)",
718e3744 6230 CLEAR_STR
6231 BGP_STR
6232 "BGP neighbor address to clear\n"
a80beece
DS
6233 "BGP IPv6 neighbor to clear\n"
6234 "BGP neighbor on interface to clear\n")
718e3744 6235
01080f7c 6236ALIAS (clear_ip_bgp_peer,
6237 clear_bgp_instance_peer_cmd,
6238 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)",
6239 CLEAR_STR
6240 BGP_STR
6241 BGP_INSTANCE_HELP_STR
6242 "BGP neighbor IP address to clear\n"
6243 "BGP IPv6 neighbor to clear\n"
6244 "BGP neighbor on interface to clear\n")
6245
718e3744 6246ALIAS (clear_ip_bgp_peer,
6247 clear_bgp_ipv6_peer_cmd,
a80beece 6248 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)",
718e3744 6249 CLEAR_STR
6250 BGP_STR
6251 "Address family\n"
6252 "BGP neighbor address to clear\n"
a80beece
DS
6253 "BGP IPv6 neighbor to clear\n"
6254 "BGP neighbor on interface to clear\n")
718e3744 6255
01080f7c 6256ALIAS (clear_ip_bgp_peer,
6257 clear_bgp_instance_ipv6_peer_cmd,
6258 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD)",
6259 CLEAR_STR
6260 BGP_STR
6261 BGP_INSTANCE_HELP_STR
6262 "Address family\n"
6263 "BGP neighbor IP address to clear\n"
6264 "BGP IPv6 neighbor to clear\n"
6265 "BGP neighbor on interface to clear\n")
6266
718e3744 6267DEFUN (clear_ip_bgp_peer_group,
6268 clear_ip_bgp_peer_group_cmd,
6269 "clear ip bgp peer-group WORD",
6270 CLEAR_STR
6271 IP_STR
6272 BGP_STR
6273 "Clear all members of peer-group\n"
6274 "BGP peer-group name\n")
6275{
01080f7c 6276 if (argc == 3)
6277 return bgp_clear_vty (vty, argv[1], 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[2]);
6278
718e3744 6279 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
6280}
6281
01080f7c 6282ALIAS (clear_ip_bgp_peer_group,
6283 clear_ip_bgp_instance_peer_group_cmd,
6284 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD",
6285 CLEAR_STR
6286 IP_STR
6287 BGP_STR
6288 BGP_INSTANCE_HELP_STR
6289 "Clear all members of peer-group\n"
6290 "BGP peer-group name\n")
6291
718e3744 6292ALIAS (clear_ip_bgp_peer_group,
6293 clear_bgp_peer_group_cmd,
6294 "clear bgp peer-group WORD",
6295 CLEAR_STR
6296 BGP_STR
6297 "Clear all members of peer-group\n"
6298 "BGP peer-group name\n")
6299
01080f7c 6300ALIAS (clear_ip_bgp_peer_group,
6301 clear_bgp_instance_peer_group_cmd,
6302 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD",
6303 CLEAR_STR
6304 BGP_STR
6305 BGP_INSTANCE_HELP_STR
6306 "Clear all members of peer-group\n"
6307 "BGP peer-group name\n")
6308
718e3744 6309ALIAS (clear_ip_bgp_peer_group,
6310 clear_bgp_ipv6_peer_group_cmd,
6311 "clear bgp ipv6 peer-group WORD",
6312 CLEAR_STR
6313 BGP_STR
6314 "Address family\n"
6315 "Clear all members of peer-group\n"
6316 "BGP peer-group name\n")
6317
01080f7c 6318ALIAS (clear_ip_bgp_peer_group,
6319 clear_bgp_instance_ipv6_peer_group_cmd,
6320 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD",
6321 CLEAR_STR
6322 BGP_STR
6323 BGP_INSTANCE_HELP_STR
6324 "Address family\n"
6325 "Clear all members of peer-group\n"
6326 "BGP peer-group name\n")
6327
718e3744 6328DEFUN (clear_ip_bgp_external,
6329 clear_ip_bgp_external_cmd,
6330 "clear ip bgp external",
6331 CLEAR_STR
6332 IP_STR
6333 BGP_STR
6334 "Clear all external peers\n")
6335{
01080f7c 6336 if (argc == 2)
6337 return bgp_clear_vty (vty, argv[1], 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
6338
718e3744 6339 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
6340}
6341
01080f7c 6342ALIAS (clear_ip_bgp_external,
6343 clear_ip_bgp_instance_external_cmd,
6344 "clear ip bgp " BGP_INSTANCE_CMD " external",
6345 CLEAR_STR
6346 IP_STR
6347 BGP_STR
6348 BGP_INSTANCE_HELP_STR
6349 "Clear all external peers\n")
6350
718e3744 6351ALIAS (clear_ip_bgp_external,
6352 clear_bgp_external_cmd,
6353 "clear bgp external",
6354 CLEAR_STR
6355 BGP_STR
6356 "Clear all external peers\n")
6357
01080f7c 6358ALIAS (clear_ip_bgp_external,
6359 clear_bgp_instance_external_cmd,
6360 "clear bgp " BGP_INSTANCE_CMD " external",
6361 CLEAR_STR
6362 BGP_STR
6363 BGP_INSTANCE_HELP_STR
6364 "Clear all external peers\n")
6365
718e3744 6366ALIAS (clear_ip_bgp_external,
6367 clear_bgp_ipv6_external_cmd,
6368 "clear bgp ipv6 external",
6369 CLEAR_STR
6370 BGP_STR
6371 "Address family\n"
6372 "Clear all external peers\n")
6373
01080f7c 6374ALIAS (clear_ip_bgp_external,
6375 clear_bgp_instance_ipv6_external_cmd,
6376 "clear bgp " BGP_INSTANCE_CMD " ipv6 external",
6377 CLEAR_STR
6378 BGP_STR
6379 BGP_INSTANCE_HELP_STR
6380 "Address family\n"
6381 "Clear all external peers\n")
6382
8ad7271d
DS
6383DEFUN (clear_ip_bgp_prefix,
6384 clear_ip_bgp_prefix_cmd,
6385 "clear ip bgp prefix A.B.C.D/M",
6386 CLEAR_STR
6387 IP_STR
6388 BGP_STR
6389 "Clear bestpath and re-advertise\n"
6390 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6391{
01080f7c 6392 if (argc == 3)
6393 return bgp_clear_prefix (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL);
6394
8ad7271d
DS
6395 return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL);
6396}
6397
01080f7c 6398ALIAS (clear_ip_bgp_prefix,
6399 clear_ip_bgp_instance_prefix_cmd,
6400 "clear ip bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M",
6401 CLEAR_STR
6402 IP_STR
6403 BGP_STR
6404 BGP_INSTANCE_HELP_STR
6405 "Clear bestpath and re-advertise\n"
6406 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6407
8ad7271d
DS
6408ALIAS (clear_ip_bgp_prefix,
6409 clear_bgp_prefix_cmd,
6410 "clear bgp prefix A.B.C.D/M",
6411 CLEAR_STR
6412 BGP_STR
6413 "Clear bestpath and re-advertise\n"
6414 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6415
01080f7c 6416ALIAS (clear_ip_bgp_prefix,
6417 clear_bgp_instance_prefix_cmd,
6418 "clear bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M",
6419 CLEAR_STR
6420 BGP_STR
6421 BGP_INSTANCE_HELP_STR
6422 "Clear bestpath and re-advertise\n"
6423 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
8ad7271d 6424
718e3744 6425DEFUN (clear_ip_bgp_as,
6426 clear_ip_bgp_as_cmd,
320da874 6427 "clear ip bgp " CMD_AS_RANGE,
718e3744 6428 CLEAR_STR
6429 IP_STR
6430 BGP_STR
6431 "Clear peers with the AS number\n")
6432{
01080f7c 6433 if (argc == 3)
6434 return bgp_clear_vty (vty, argv[1], 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[2]);
6435
718e3744 6436 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
6437}
6438
01080f7c 6439ALIAS (clear_ip_bgp_as,
6440 clear_ip_bgp_instance_as_cmd,
6441 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE,
6442 CLEAR_STR
6443 IP_STR
6444 BGP_STR
6445 BGP_INSTANCE_HELP_STR
6446 "Clear peers with the AS number\n")
6447
718e3744 6448ALIAS (clear_ip_bgp_as,
6449 clear_bgp_as_cmd,
320da874 6450 "clear bgp " CMD_AS_RANGE,
718e3744 6451 CLEAR_STR
6452 BGP_STR
6453 "Clear peers with the AS number\n")
6454
01080f7c 6455ALIAS (clear_ip_bgp_as,
6456 clear_bgp_instance_as_cmd,
6457 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE,
6458 CLEAR_STR
6459 BGP_STR
6460 BGP_INSTANCE_HELP_STR
6461 "Clear peers with the AS number\n")
6462
718e3744 6463ALIAS (clear_ip_bgp_as,
6464 clear_bgp_ipv6_as_cmd,
320da874 6465 "clear bgp ipv6 " CMD_AS_RANGE,
718e3744 6466 CLEAR_STR
6467 BGP_STR
6468 "Address family\n"
6469 "Clear peers with the AS number\n")
6b0655a2 6470
01080f7c 6471ALIAS (clear_ip_bgp_as,
6472 clear_bgp_instance_ipv6_as_cmd,
6473 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE,
6474 CLEAR_STR
6475 BGP_STR
6476 BGP_INSTANCE_HELP_STR
6477 "Address family\n"
6478 "Clear peers with the AS number\n")
6479
718e3744 6480/* Outbound soft-reconfiguration */
6481DEFUN (clear_ip_bgp_all_soft_out,
6482 clear_ip_bgp_all_soft_out_cmd,
6483 "clear ip bgp * soft out",
6484 CLEAR_STR
6485 IP_STR
6486 BGP_STR
6487 "Clear all peers\n"
e0bce756
DS
6488 BGP_SOFT_STR
6489 BGP_SOFT_OUT_STR)
718e3744 6490{
6aeb9e78
DS
6491 if (argc == 2)
6492 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
718e3744 6493 BGP_CLEAR_SOFT_OUT, NULL);
6494
6495 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6496 BGP_CLEAR_SOFT_OUT, NULL);
6497}
6498
01080f7c 6499ALIAS (clear_ip_bgp_all_soft_out,
6500 clear_ip_bgp_instance_all_soft_out_cmd,
6501 "clear ip bgp " BGP_INSTANCE_CMD " * soft out",
6502 CLEAR_STR
6503 IP_STR
6504 BGP_STR
6505 BGP_INSTANCE_HELP_STR
6506 "Clear all peers\n"
6507 BGP_SOFT_STR
6508 BGP_SOFT_OUT_STR)
6509
718e3744 6510ALIAS (clear_ip_bgp_all_soft_out,
6511 clear_ip_bgp_all_out_cmd,
6512 "clear ip bgp * out",
6513 CLEAR_STR
6514 IP_STR
6515 BGP_STR
6516 "Clear all peers\n"
e0bce756 6517 BGP_SOFT_OUT_STR)
718e3744 6518
6519ALIAS (clear_ip_bgp_all_soft_out,
01080f7c 6520 clear_ip_bgp_instance_all_out_cmd,
6521 "clear ip bgp " BGP_INSTANCE_CMD " * out",
718e3744 6522 CLEAR_STR
6523 IP_STR
6524 BGP_STR
8386ac43 6525 BGP_INSTANCE_HELP_STR
718e3744 6526 "Clear all peers\n"
e0bce756 6527 BGP_SOFT_OUT_STR)
718e3744 6528
6529DEFUN (clear_ip_bgp_all_ipv4_soft_out,
6530 clear_ip_bgp_all_ipv4_soft_out_cmd,
6531 "clear ip bgp * ipv4 (unicast|multicast) soft out",
6532 CLEAR_STR
6533 IP_STR
6534 BGP_STR
6535 "Clear all peers\n"
6536 "Address family\n"
6537 "Address Family modifier\n"
6538 "Address Family modifier\n"
e0bce756
DS
6539 BGP_SOFT_STR
6540 BGP_SOFT_OUT_STR)
718e3744 6541{
6542 if (strncmp (argv[0], "m", 1) == 0)
6543 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6544 BGP_CLEAR_SOFT_OUT, NULL);
6545
6546 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6547 BGP_CLEAR_SOFT_OUT, NULL);
6548}
6549
01080f7c 6550DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
6551 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
6552 "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft out",
6553 CLEAR_STR
6554 IP_STR
6555 BGP_STR
6556 BGP_INSTANCE_HELP_STR
6557 "Clear all peers\n"
6558 "Address family\n"
6559 "Address Family modifier\n"
6560 "Address Family modifier\n"
6561 BGP_SOFT_OUT_STR)
6562{
6563 if (strncmp (argv[2], "m", 1) == 0)
6564 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all,
6565 BGP_CLEAR_SOFT_OUT, NULL);
6566
6567 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6568 BGP_CLEAR_SOFT_OUT, NULL);
6569}
6570
718e3744 6571ALIAS (clear_ip_bgp_all_ipv4_soft_out,
6572 clear_ip_bgp_all_ipv4_out_cmd,
6573 "clear ip bgp * ipv4 (unicast|multicast) out",
6574 CLEAR_STR
6575 IP_STR
6576 BGP_STR
6577 "Clear all peers\n"
6578 "Address family\n"
6579 "Address Family modifier\n"
6580 "Address Family modifier\n"
e0bce756 6581 BGP_SOFT_OUT_STR)
718e3744 6582
01080f7c 6583ALIAS (clear_ip_bgp_instance_all_ipv4_soft_out,
6584 clear_ip_bgp_instance_all_ipv4_out_cmd,
6585 "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) out",
718e3744 6586 CLEAR_STR
6587 IP_STR
6588 BGP_STR
8386ac43 6589 BGP_INSTANCE_HELP_STR
718e3744 6590 "Clear all peers\n"
6591 "Address family\n"
6592 "Address Family modifier\n"
6593 "Address Family modifier\n"
e0bce756 6594 BGP_SOFT_OUT_STR)
718e3744 6595
6596DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
6597 clear_ip_bgp_all_vpnv4_soft_out_cmd,
6598 "clear ip bgp * vpnv4 unicast soft out",
6599 CLEAR_STR
6600 IP_STR
6601 BGP_STR
6602 "Clear all peers\n"
6603 "Address family\n"
6604 "Address Family Modifier\n"
e0bce756
DS
6605 BGP_SOFT_STR
6606 BGP_SOFT_OUT_STR)
718e3744 6607{
6608 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6609 BGP_CLEAR_SOFT_OUT, NULL);
6610}
6611
6612ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
6613 clear_ip_bgp_all_vpnv4_out_cmd,
6614 "clear ip bgp * vpnv4 unicast out",
6615 CLEAR_STR
6616 IP_STR
6617 BGP_STR
6618 "Clear all peers\n"
6619 "Address family\n"
6620 "Address Family Modifier\n"
e0bce756 6621 BGP_SOFT_OUT_STR)
718e3744 6622
587ff0fd
LB
6623DEFUN (clear_ip_bgp_all_encap_soft_out,
6624 clear_ip_bgp_all_encap_soft_out_cmd,
6625 "clear ip bgp * encap unicast 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 "Soft reconfig\n"
6633 "Soft reconfig outbound update\n")
6634{
6635 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
6636 BGP_CLEAR_SOFT_OUT, NULL);
6637}
6638
6639ALIAS (clear_ip_bgp_all_encap_soft_out,
6640 clear_ip_bgp_all_encap_out_cmd,
6641 "clear ip bgp * encap unicast out",
6642 CLEAR_STR
6643 IP_STR
6644 BGP_STR
6645 "Clear all peers\n"
6646 "Address family\n"
6647 "Address Family Modifier\n"
6648 "Soft reconfig outbound update\n")
6649
718e3744 6650DEFUN (clear_bgp_all_soft_out,
6651 clear_bgp_all_soft_out_cmd,
6652 "clear bgp * soft out",
6653 CLEAR_STR
6654 BGP_STR
6655 "Clear all peers\n"
e0bce756
DS
6656 BGP_SOFT_STR
6657 BGP_SOFT_OUT_STR)
718e3744 6658{
6aeb9e78
DS
6659 if (argc == 2)
6660 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all,
718e3744 6661 BGP_CLEAR_SOFT_OUT, NULL);
6662
6663 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6664 BGP_CLEAR_SOFT_OUT, NULL);
6665}
6666
6667ALIAS (clear_bgp_all_soft_out,
6668 clear_bgp_instance_all_soft_out_cmd,
8386ac43 6669 "clear bgp " BGP_INSTANCE_CMD " * soft out",
718e3744 6670 CLEAR_STR
6671 BGP_STR
8386ac43 6672 BGP_INSTANCE_HELP_STR
718e3744 6673 "Clear all peers\n"
e0bce756
DS
6674 BGP_SOFT_STR
6675 BGP_SOFT_OUT_STR)
718e3744 6676
6677ALIAS (clear_bgp_all_soft_out,
6678 clear_bgp_all_out_cmd,
6679 "clear bgp * out",
6680 CLEAR_STR
6681 BGP_STR
6682 "Clear all peers\n"
e0bce756 6683 BGP_SOFT_OUT_STR)
718e3744 6684
01080f7c 6685ALIAS (clear_bgp_all_soft_out,
6686 clear_bgp_instance_all_out_cmd,
6687 "clear bgp " BGP_INSTANCE_CMD " * out",
6688 CLEAR_STR
6689 BGP_STR
6690 BGP_INSTANCE_HELP_STR
6691 "Clear all peers\n"
6692 BGP_SOFT_OUT_STR)
6693
718e3744 6694ALIAS (clear_bgp_all_soft_out,
6695 clear_bgp_ipv6_all_soft_out_cmd,
6696 "clear bgp ipv6 * soft out",
6697 CLEAR_STR
6698 BGP_STR
6699 "Address family\n"
6700 "Clear all peers\n"
e0bce756
DS
6701 BGP_SOFT_STR
6702 BGP_SOFT_OUT_STR)
718e3744 6703
01080f7c 6704ALIAS (clear_bgp_all_soft_out,
6705 clear_bgp_instance_ipv6_all_soft_out_cmd,
6706 "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft out",
6707 CLEAR_STR
6708 BGP_STR
6709 BGP_INSTANCE_HELP_STR
6710 "Address family\n"
6711 "Clear all peers\n"
6712 BGP_SOFT_STR
6713 BGP_SOFT_OUT_STR)
6714
718e3744 6715ALIAS (clear_bgp_all_soft_out,
6716 clear_bgp_ipv6_all_out_cmd,
6717 "clear bgp ipv6 * out",
6718 CLEAR_STR
6719 BGP_STR
6720 "Address family\n"
6721 "Clear all peers\n"
e0bce756 6722 BGP_SOFT_OUT_STR)
718e3744 6723
01080f7c 6724ALIAS (clear_bgp_all_soft_out,
6725 clear_bgp_instance_ipv6_all_out_cmd,
6726 "clear bgp " BGP_INSTANCE_CMD " ipv6 * out",
6727 CLEAR_STR
6728 BGP_STR
6729 BGP_INSTANCE_HELP_STR
6730 "Address family\n"
6731 "Clear all peers\n"
6732 BGP_SOFT_OUT_STR)
6733
8ad7271d
DS
6734DEFUN (clear_bgp_ipv6_safi_prefix,
6735 clear_bgp_ipv6_safi_prefix_cmd,
6736 "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M",
6737 CLEAR_STR
6738 BGP_STR
6739 "Address family\n"
6740 "Address Family Modifier\n"
6741 "Clear bestpath and re-advertise\n"
6742 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6743{
6744 if (strncmp (argv[0], "m", 1) == 0)
6745 return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL);
6746 else
6747 return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL);
6748}
6749
01080f7c 6750DEFUN (clear_bgp_instance_ipv6_safi_prefix,
6751 clear_bgp_instance_ipv6_safi_prefix_cmd,
6752 "clear bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) prefix X:X::X:X/M",
6753 CLEAR_STR
6754 BGP_STR
6755 BGP_INSTANCE_HELP_STR
6756 "Address family\n"
6757 "Address Family Modifier\n"
6758 "Clear bestpath and re-advertise\n"
6759 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6760{
6761 if (strncmp (argv[2], "m", 1) == 0)
6762 return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_MULTICAST, NULL);
6763 else
6764 return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_UNICAST, NULL);
6765}
6766
718e3744 6767DEFUN (clear_ip_bgp_peer_soft_out,
6768 clear_ip_bgp_peer_soft_out_cmd,
db64ea86 6769 "clear ip bgp (A.B.C.D|WORD) soft out",
718e3744 6770 CLEAR_STR
6771 IP_STR
6772 BGP_STR
6773 "BGP neighbor address to clear\n"
db64ea86 6774 "BGP neighbor on interface to clear\n"
e0bce756
DS
6775 BGP_SOFT_STR
6776 BGP_SOFT_OUT_STR)
718e3744 6777{
01080f7c 6778 if (argc == 3)
6779 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
6780 BGP_CLEAR_SOFT_OUT, argv[2]);
6781
718e3744 6782 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6783 BGP_CLEAR_SOFT_OUT, argv[0]);
6784}
6785
01080f7c 6786ALIAS (clear_ip_bgp_peer_soft_out,
6787 clear_ip_bgp_instance_peer_soft_out_cmd,
6788 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft out",
6789 CLEAR_STR
6790 IP_STR
6791 BGP_STR
6792 BGP_INSTANCE_HELP_STR
6793 "BGP neighbor address to clear\n"
6794 "BGP neighbor on interface to clear\n"
6795 BGP_SOFT_STR
6796 BGP_SOFT_OUT_STR)
6797
718e3744 6798ALIAS (clear_ip_bgp_peer_soft_out,
6799 clear_ip_bgp_peer_out_cmd,
db64ea86 6800 "clear ip bgp (A.B.C.D|WORD) out",
718e3744 6801 CLEAR_STR
6802 IP_STR
6803 BGP_STR
6804 "BGP neighbor address to clear\n"
db64ea86 6805 "BGP neighbor on interface to clear\n"
e0bce756 6806 BGP_SOFT_OUT_STR)
718e3744 6807
01080f7c 6808ALIAS (clear_ip_bgp_peer_soft_out,
6809 clear_ip_bgp_instance_peer_out_cmd,
6810 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) out",
6811 CLEAR_STR
6812 IP_STR
6813 BGP_STR
6814 BGP_INSTANCE_HELP_STR
6815 "BGP neighbor address to clear\n"
6816 "BGP neighbor on interface to clear\n"
6817 BGP_SOFT_OUT_STR)
6818
718e3744 6819DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
6820 clear_ip_bgp_peer_ipv4_soft_out_cmd,
db64ea86 6821 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out",
718e3744 6822 CLEAR_STR
6823 IP_STR
6824 BGP_STR
6825 "BGP neighbor address to clear\n"
db64ea86 6826 "BGP neighbor on interface to clear\n"
718e3744 6827 "Address family\n"
6828 "Address Family modifier\n"
6829 "Address Family modifier\n"
e0bce756
DS
6830 BGP_SOFT_STR
6831 BGP_SOFT_OUT_STR)
718e3744 6832{
6833 if (strncmp (argv[1], "m", 1) == 0)
6834 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6835 BGP_CLEAR_SOFT_OUT, argv[0]);
6836
6837 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6838 BGP_CLEAR_SOFT_OUT, argv[0]);
6839}
6840
01080f7c 6841DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out,
6842 clear_ip_bgp_instance_peer_ipv4_soft_out_cmd,
6843 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out",
6844 CLEAR_STR
6845 IP_STR
6846 BGP_STR
6847 BGP_INSTANCE_HELP_STR
6848 "BGP neighbor address to clear\n"
6849 "BGP neighbor on interface to clear\n"
6850 "Address family\n"
6851 "Address Family modifier\n"
6852 "Address Family modifier\n"
6853 BGP_SOFT_STR
6854 BGP_SOFT_OUT_STR)
6855{
6856 if (strncmp (argv[3], "m", 1) == 0)
6857 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer,
6858 BGP_CLEAR_SOFT_OUT, argv[2]);
6859
6860 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
6861 BGP_CLEAR_SOFT_OUT, argv[2]);
6862}
6863
718e3744 6864ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
6865 clear_ip_bgp_peer_ipv4_out_cmd,
db64ea86 6866 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out",
718e3744 6867 CLEAR_STR
6868 IP_STR
6869 BGP_STR
6870 "BGP neighbor address to clear\n"
db64ea86 6871 "BGP neighbor on interface to clear\n"
718e3744 6872 "Address family\n"
6873 "Address Family modifier\n"
6874 "Address Family modifier\n"
e0bce756 6875 BGP_SOFT_OUT_STR)
718e3744 6876
01080f7c 6877ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_out,
6878 clear_ip_bgp_instance_peer_ipv4_out_cmd,
6879 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) out",
6880 CLEAR_STR
6881 IP_STR
6882 BGP_STR
6883 BGP_INSTANCE_HELP_STR
6884 "BGP neighbor address to clear\n"
6885 "BGP neighbor on interface to clear\n"
6886 "Address family\n"
6887 "Address Family modifier\n"
6888 "Address Family modifier\n"
6889 BGP_SOFT_OUT_STR)
6890
db64ea86 6891/* NOTE: WORD peers have not been tested for vpnv4 */
718e3744 6892DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
6893 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
db64ea86 6894 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft 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"
718e3744 6900 "Address family\n"
6901 "Address Family Modifier\n"
e0bce756
DS
6902 BGP_SOFT_STR
6903 BGP_SOFT_OUT_STR)
718e3744 6904{
6905 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6906 BGP_CLEAR_SOFT_OUT, argv[0]);
6907}
6908
6909ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
6910 clear_ip_bgp_peer_vpnv4_out_cmd,
db64ea86 6911 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out",
718e3744 6912 CLEAR_STR
6913 IP_STR
6914 BGP_STR
6915 "BGP neighbor address to clear\n"
db64ea86 6916 "BGP neighbor on interface to clear\n"
718e3744 6917 "Address family\n"
6918 "Address Family Modifier\n"
e0bce756 6919 BGP_SOFT_OUT_STR)
718e3744 6920
587ff0fd
LB
6921DEFUN (clear_ip_bgp_peer_encap_soft_out,
6922 clear_ip_bgp_peer_encap_soft_out_cmd,
6923 "clear ip bgp A.B.C.D encap unicast soft out",
6924 CLEAR_STR
6925 IP_STR
6926 BGP_STR
6927 "BGP neighbor address to clear\n"
6928 "Address family\n"
6929 "Address Family Modifier\n"
6930 "Soft reconfig\n"
6931 "Soft reconfig outbound update\n")
6932{
6933 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
6934 BGP_CLEAR_SOFT_OUT, argv[0]);
6935}
6936
6937ALIAS (clear_ip_bgp_peer_encap_soft_out,
6938 clear_ip_bgp_peer_encap_out_cmd,
6939 "clear ip bgp A.B.C.D encap unicast out",
6940 CLEAR_STR
6941 IP_STR
6942 BGP_STR
6943 "BGP neighbor address to clear\n"
6944 "Address family\n"
6945 "Address Family Modifier\n"
6946 "Soft reconfig outbound update\n")
6947
718e3744 6948DEFUN (clear_bgp_peer_soft_out,
6949 clear_bgp_peer_soft_out_cmd,
a80beece 6950 "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out",
718e3744 6951 CLEAR_STR
6952 BGP_STR
6953 "BGP neighbor address to clear\n"
6954 "BGP IPv6 neighbor to clear\n"
a80beece 6955 "BGP neighbor on interface to clear\n"
e0bce756
DS
6956 BGP_SOFT_STR
6957 BGP_SOFT_OUT_STR)
718e3744 6958{
01080f7c 6959 if (argc == 3)
6960 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer,
6961 BGP_CLEAR_SOFT_OUT, argv[2]);
6962
718e3744 6963 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6964 BGP_CLEAR_SOFT_OUT, argv[0]);
6965}
6966
01080f7c 6967ALIAS (clear_bgp_peer_soft_out,
6968 clear_bgp_instance_peer_soft_out_cmd,
6969 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft out",
6970 CLEAR_STR
6971 BGP_STR
6972 BGP_INSTANCE_HELP_STR
6973 "BGP neighbor address to clear\n"
6974 "BGP IPv6 neighbor to clear\n"
6975 "BGP neighbor on interface to clear\n"
6976 BGP_SOFT_STR
6977 BGP_SOFT_OUT_STR)
6978
718e3744 6979ALIAS (clear_bgp_peer_soft_out,
6980 clear_bgp_ipv6_peer_soft_out_cmd,
a80beece 6981 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out",
718e3744 6982 CLEAR_STR
6983 BGP_STR
6984 "Address family\n"
6985 "BGP neighbor address to clear\n"
6986 "BGP IPv6 neighbor to clear\n"
a80beece 6987 "BGP neighbor on interface to clear\n"
e0bce756
DS
6988 BGP_SOFT_STR
6989 BGP_SOFT_OUT_STR)
718e3744 6990
01080f7c 6991ALIAS (clear_bgp_peer_soft_out,
6992 clear_bgp_instance_ipv6_peer_soft_out_cmd,
6993 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft out",
6994 CLEAR_STR
6995 BGP_STR
6996 BGP_INSTANCE_HELP_STR
6997 "Address family\n"
6998 "BGP neighbor address to clear\n"
6999 "BGP IPv6 neighbor to clear\n"
7000 "BGP neighbor on interface to clear\n"
7001 BGP_SOFT_STR
7002 BGP_SOFT_OUT_STR)
7003
718e3744 7004ALIAS (clear_bgp_peer_soft_out,
7005 clear_bgp_peer_out_cmd,
a80beece 7006 "clear bgp (A.B.C.D|X:X::X:X|WORD) out",
718e3744 7007 CLEAR_STR
7008 BGP_STR
7009 "BGP neighbor address to clear\n"
7010 "BGP IPv6 neighbor to clear\n"
a80beece 7011 "BGP neighbor on interface to clear\n"
e0bce756 7012 BGP_SOFT_OUT_STR)
718e3744 7013
01080f7c 7014ALIAS (clear_bgp_peer_soft_out,
7015 clear_bgp_instance_peer_out_cmd,
7016 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) out",
7017 CLEAR_STR
7018 BGP_STR
7019 BGP_INSTANCE_HELP_STR
7020 "BGP neighbor address to clear\n"
7021 "BGP IPv6 neighbor to clear\n"
7022 "BGP neighbor on interface to clear\n"
7023 BGP_SOFT_OUT_STR)
7024
718e3744 7025ALIAS (clear_bgp_peer_soft_out,
7026 clear_bgp_ipv6_peer_out_cmd,
a80beece 7027 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out",
718e3744 7028 CLEAR_STR
7029 BGP_STR
7030 "Address family\n"
7031 "BGP neighbor address to clear\n"
7032 "BGP IPv6 neighbor to clear\n"
a80beece 7033 "BGP neighbor on interface to clear\n"
e0bce756 7034 BGP_SOFT_OUT_STR)
718e3744 7035
01080f7c 7036ALIAS (clear_bgp_peer_soft_out,
7037 clear_bgp_instance_ipv6_peer_out_cmd,
7038 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) out",
7039 CLEAR_STR
7040 BGP_STR
7041 BGP_INSTANCE_HELP_STR
7042 "Address family\n"
7043 "BGP neighbor address to clear\n"
7044 "BGP IPv6 neighbor to clear\n"
7045 "BGP neighbor on interface to clear\n"
7046 BGP_SOFT_OUT_STR)
7047
718e3744 7048DEFUN (clear_ip_bgp_peer_group_soft_out,
7049 clear_ip_bgp_peer_group_soft_out_cmd,
7050 "clear ip bgp peer-group WORD soft out",
7051 CLEAR_STR
7052 IP_STR
7053 BGP_STR
7054 "Clear all members of peer-group\n"
7055 "BGP peer-group name\n"
e0bce756
DS
7056 BGP_SOFT_STR
7057 BGP_SOFT_OUT_STR)
718e3744 7058{
01080f7c 7059 if (argc == 3)
7060 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
7061 BGP_CLEAR_SOFT_OUT, argv[2]);
7062
718e3744 7063 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
7064 BGP_CLEAR_SOFT_OUT, argv[0]);
7065}
7066
01080f7c 7067ALIAS (clear_ip_bgp_peer_group_soft_out,
7068 clear_ip_bgp_instance_peer_group_soft_out_cmd,
7069 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft out",
7070 CLEAR_STR
7071 IP_STR
7072 BGP_STR
7073 BGP_INSTANCE_HELP_STR
7074 "Clear all members of peer-group\n"
7075 "BGP peer-group name\n"
7076 BGP_SOFT_STR
7077 BGP_SOFT_OUT_STR)
7078
718e3744 7079ALIAS (clear_ip_bgp_peer_group_soft_out,
7080 clear_ip_bgp_peer_group_out_cmd,
7081 "clear ip bgp peer-group WORD out",
7082 CLEAR_STR
7083 IP_STR
7084 BGP_STR
7085 "Clear all members of peer-group\n"
7086 "BGP peer-group name\n"
e0bce756 7087 BGP_SOFT_OUT_STR)
718e3744 7088
01080f7c 7089ALIAS (clear_ip_bgp_peer_group_soft_out,
7090 clear_ip_bgp_instance_peer_group_out_cmd,
7091 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD out",
7092 CLEAR_STR
7093 IP_STR
7094 BGP_STR
7095 BGP_INSTANCE_HELP_STR
7096 "Clear all members of peer-group\n"
7097 "BGP peer-group name\n"
7098 BGP_SOFT_OUT_STR)
7099
718e3744 7100DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
7101 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
7102 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
7103 CLEAR_STR
7104 IP_STR
7105 BGP_STR
7106 "Clear all members of peer-group\n"
7107 "BGP peer-group name\n"
7108 "Address family\n"
7109 "Address Family modifier\n"
7110 "Address Family modifier\n"
e0bce756
DS
7111 BGP_SOFT_STR
7112 BGP_SOFT_OUT_STR)
718e3744 7113{
7114 if (strncmp (argv[1], "m", 1) == 0)
7115 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
7116 BGP_CLEAR_SOFT_OUT, argv[0]);
7117
7118 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
7119 BGP_CLEAR_SOFT_OUT, argv[0]);
7120}
7121
01080f7c 7122DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out,
7123 clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd,
7124 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft out",
7125 CLEAR_STR
7126 IP_STR
7127 BGP_STR
7128 BGP_INSTANCE_HELP_STR
7129 "Clear all members of peer-group\n"
7130 "BGP peer-group name\n"
7131 "Address family\n"
7132 "Address Family modifier\n"
7133 "Address Family modifier\n"
7134 BGP_SOFT_STR
7135 BGP_SOFT_OUT_STR)
7136{
7137 if (strncmp (argv[3], "m", 1) == 0)
7138 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group,
7139 BGP_CLEAR_SOFT_OUT, argv[2]);
7140
7141 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
7142 BGP_CLEAR_SOFT_OUT, argv[2]);
7143}
7144
718e3744 7145ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
7146 clear_ip_bgp_peer_group_ipv4_out_cmd,
7147 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
7148 CLEAR_STR
7149 IP_STR
7150 BGP_STR
7151 "Clear all members of peer-group\n"
7152 "BGP peer-group name\n"
7153 "Address family\n"
7154 "Address Family modifier\n"
7155 "Address Family modifier\n"
e0bce756 7156 BGP_SOFT_OUT_STR)
718e3744 7157
01080f7c 7158ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_out,
7159 clear_ip_bgp_instance_peer_group_ipv4_out_cmd,
7160 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) out",
7161 CLEAR_STR
7162 IP_STR
7163 BGP_STR
7164 BGP_INSTANCE_HELP_STR
7165 "Clear all members of peer-group\n"
7166 "BGP peer-group name\n"
7167 "Address family\n"
7168 "Address Family modifier\n"
7169 "Address Family modifier\n"
7170 BGP_SOFT_OUT_STR)
7171
718e3744 7172DEFUN (clear_bgp_peer_group_soft_out,
7173 clear_bgp_peer_group_soft_out_cmd,
7174 "clear bgp peer-group WORD soft out",
7175 CLEAR_STR
7176 BGP_STR
7177 "Clear all members of peer-group\n"
7178 "BGP peer-group name\n"
e0bce756
DS
7179 BGP_SOFT_STR
7180 BGP_SOFT_OUT_STR)
718e3744 7181{
01080f7c 7182 if (argc == 3)
7183 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group,
7184 BGP_CLEAR_SOFT_OUT, argv[2]);
7185
718e3744 7186 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
7187 BGP_CLEAR_SOFT_OUT, argv[0]);
7188}
7189
01080f7c 7190ALIAS (clear_bgp_peer_group_soft_out,
7191 clear_bgp_instance_peer_group_soft_out_cmd,
7192 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft out",
7193 CLEAR_STR
7194 BGP_STR
7195 BGP_INSTANCE_HELP_STR
7196 "Clear all members of peer-group\n"
7197 "BGP peer-group name\n"
7198 BGP_SOFT_STR
7199 BGP_SOFT_OUT_STR)
7200
718e3744 7201ALIAS (clear_bgp_peer_group_soft_out,
7202 clear_bgp_ipv6_peer_group_soft_out_cmd,
7203 "clear bgp ipv6 peer-group WORD soft out",
7204 CLEAR_STR
7205 BGP_STR
7206 "Address family\n"
7207 "Clear all members of peer-group\n"
7208 "BGP peer-group name\n"
e0bce756
DS
7209 BGP_SOFT_STR
7210 BGP_SOFT_OUT_STR)
718e3744 7211
01080f7c 7212ALIAS (clear_bgp_peer_group_soft_out,
7213 clear_bgp_instance_ipv6_peer_group_soft_out_cmd,
7214 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft out",
7215 CLEAR_STR
7216 BGP_STR
7217 BGP_INSTANCE_HELP_STR
7218 "Address family\n"
7219 "Clear all members of peer-group\n"
7220 "BGP peer-group name\n"
7221 BGP_SOFT_STR
7222 BGP_SOFT_OUT_STR)
7223
718e3744 7224ALIAS (clear_bgp_peer_group_soft_out,
7225 clear_bgp_peer_group_out_cmd,
7226 "clear bgp peer-group WORD out",
7227 CLEAR_STR
7228 BGP_STR
7229 "Clear all members of peer-group\n"
7230 "BGP peer-group name\n"
e0bce756 7231 BGP_SOFT_OUT_STR)
718e3744 7232
01080f7c 7233ALIAS (clear_bgp_peer_group_soft_out,
7234 clear_bgp_instance_peer_group_out_cmd,
7235 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD out",
7236 CLEAR_STR
7237 BGP_STR
7238 BGP_INSTANCE_HELP_STR
7239 "Clear all members of peer-group\n"
7240 "BGP peer-group name\n"
7241 BGP_SOFT_OUT_STR)
7242
718e3744 7243ALIAS (clear_bgp_peer_group_soft_out,
7244 clear_bgp_ipv6_peer_group_out_cmd,
7245 "clear bgp ipv6 peer-group WORD out",
7246 CLEAR_STR
7247 BGP_STR
7248 "Address family\n"
7249 "Clear all members of peer-group\n"
7250 "BGP peer-group name\n"
e0bce756 7251 BGP_SOFT_OUT_STR)
718e3744 7252
01080f7c 7253ALIAS (clear_bgp_peer_group_soft_out,
7254 clear_bgp_instance_ipv6_peer_group_out_cmd,
7255 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD out",
7256 CLEAR_STR
7257 BGP_STR
7258 BGP_INSTANCE_HELP_STR
7259 "Address family\n"
7260 "Clear all members of peer-group\n"
7261 "BGP peer-group name\n"
7262 BGP_SOFT_OUT_STR)
7263
718e3744 7264DEFUN (clear_ip_bgp_external_soft_out,
7265 clear_ip_bgp_external_soft_out_cmd,
7266 "clear ip bgp external soft out",
7267 CLEAR_STR
7268 IP_STR
7269 BGP_STR
7270 "Clear all external peers\n"
e0bce756
DS
7271 BGP_SOFT_STR
7272 BGP_SOFT_OUT_STR)
01080f7c 7273{
7274 if (argc == 2)
7275 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
7276 BGP_CLEAR_SOFT_OUT, NULL);
7277
7278 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
7279 BGP_CLEAR_SOFT_OUT, NULL);
7280}
7281
7282ALIAS (clear_ip_bgp_external_soft_out,
7283 clear_ip_bgp_instance_external_soft_out_cmd,
7284 "clear ip bgp " BGP_INSTANCE_CMD " external soft out",
7285 CLEAR_STR
7286 IP_STR
7287 BGP_STR
7288 BGP_INSTANCE_HELP_STR
7289 "Clear all external peers\n"
7290 BGP_SOFT_STR
7291 BGP_SOFT_OUT_STR)
7292
7293ALIAS (clear_ip_bgp_external_soft_out,
7294 clear_ip_bgp_external_out_cmd,
7295 "clear ip bgp external out",
7296 CLEAR_STR
7297 IP_STR
7298 BGP_STR
7299 "Clear all external peers\n"
7300 BGP_SOFT_OUT_STR)
718e3744 7301
7302ALIAS (clear_ip_bgp_external_soft_out,
01080f7c 7303 clear_ip_bgp_instance_external_out_cmd,
7304 "clear ip bgp " BGP_INSTANCE_CMD " external out",
718e3744 7305 CLEAR_STR
7306 IP_STR
7307 BGP_STR
01080f7c 7308 BGP_INSTANCE_HELP_STR
718e3744 7309 "Clear all external peers\n"
e0bce756 7310 BGP_SOFT_OUT_STR)
718e3744 7311
7312DEFUN (clear_ip_bgp_external_ipv4_soft_out,
7313 clear_ip_bgp_external_ipv4_soft_out_cmd,
7314 "clear ip bgp external ipv4 (unicast|multicast) soft out",
7315 CLEAR_STR
7316 IP_STR
7317 BGP_STR
7318 "Clear all external peers\n"
7319 "Address family\n"
7320 "Address Family modifier\n"
7321 "Address Family modifier\n"
e0bce756
DS
7322 BGP_SOFT_STR
7323 BGP_SOFT_OUT_STR)
718e3744 7324{
7325 if (strncmp (argv[0], "m", 1) == 0)
7326 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
7327 BGP_CLEAR_SOFT_OUT, NULL);
7328
7329 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
7330 BGP_CLEAR_SOFT_OUT, NULL);
7331}
7332
01080f7c 7333DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out,
7334 clear_ip_bgp_instance_external_ipv4_soft_out_cmd,
7335 "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft out",
7336 CLEAR_STR
7337 IP_STR
7338 BGP_STR
7339 BGP_INSTANCE_HELP_STR
7340 "Clear all external peers\n"
7341 "Address family\n"
7342 "Address Family modifier\n"
7343 "Address Family modifier\n"
7344 BGP_SOFT_STR
7345 BGP_SOFT_OUT_STR)
7346{
7347 if (strncmp (argv[2], "m", 1) == 0)
7348 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external,
7349 BGP_CLEAR_SOFT_OUT, NULL);
7350
7351 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
7352 BGP_CLEAR_SOFT_OUT, NULL);
7353}
7354
718e3744 7355ALIAS (clear_ip_bgp_external_ipv4_soft_out,
7356 clear_ip_bgp_external_ipv4_out_cmd,
7357 "clear ip bgp external ipv4 (unicast|multicast) out",
7358 CLEAR_STR
7359 IP_STR
7360 BGP_STR
7361 "Clear all external peers\n"
7362 "Address family\n"
7363 "Address Family modifier\n"
7364 "Address Family modifier\n"
e0bce756 7365 BGP_SOFT_OUT_STR)
718e3744 7366
01080f7c 7367ALIAS (clear_ip_bgp_instance_external_ipv4_soft_out,
7368 clear_ip_bgp_instance_external_ipv4_out_cmd,
7369 "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) out",
7370 CLEAR_STR
7371 IP_STR
7372 BGP_STR
7373 BGP_INSTANCE_HELP_STR
7374 "Clear all external peers\n"
7375 "Address family\n"
7376 "Address Family modifier\n"
7377 "Address Family modifier\n"
7378 BGP_SOFT_OUT_STR)
7379
718e3744 7380DEFUN (clear_bgp_external_soft_out,
7381 clear_bgp_external_soft_out_cmd,
7382 "clear bgp external soft out",
7383 CLEAR_STR
7384 BGP_STR
7385 "Clear all external peers\n"
e0bce756
DS
7386 BGP_SOFT_STR
7387 BGP_SOFT_OUT_STR)
718e3744 7388{
01080f7c 7389 if (argc == 2)
7390 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external,
7391 BGP_CLEAR_SOFT_OUT, NULL);
7392
718e3744 7393 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
7394 BGP_CLEAR_SOFT_OUT, NULL);
7395}
7396
01080f7c 7397ALIAS (clear_bgp_external_soft_out,
7398 clear_bgp_instance_external_soft_out_cmd,
7399 "clear bgp " BGP_INSTANCE_CMD " external soft out",
7400 CLEAR_STR
7401 BGP_STR
7402 BGP_INSTANCE_HELP_STR
7403 "Clear all external peers\n"
7404 BGP_SOFT_STR
7405 BGP_SOFT_OUT_STR)
7406
718e3744 7407ALIAS (clear_bgp_external_soft_out,
7408 clear_bgp_ipv6_external_soft_out_cmd,
7409 "clear bgp ipv6 external soft out",
7410 CLEAR_STR
7411 BGP_STR
7412 "Address family\n"
7413 "Clear all external peers\n"
e0bce756
DS
7414 BGP_SOFT_STR
7415 BGP_SOFT_OUT_STR)
718e3744 7416
01080f7c 7417ALIAS (clear_bgp_external_soft_out,
7418 clear_bgp_instance_ipv6_external_soft_out_cmd,
7419 "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft out",
7420 CLEAR_STR
7421 BGP_STR
7422 BGP_INSTANCE_HELP_STR
7423 "Address family\n"
7424 "Clear all external peers\n"
7425 BGP_SOFT_STR
7426 BGP_SOFT_OUT_STR)
7427
718e3744 7428ALIAS (clear_bgp_external_soft_out,
7429 clear_bgp_external_out_cmd,
7430 "clear bgp external out",
7431 CLEAR_STR
7432 BGP_STR
7433 "Clear all external peers\n"
e0bce756 7434 BGP_SOFT_OUT_STR)
718e3744 7435
01080f7c 7436ALIAS (clear_bgp_external_soft_out,
7437 clear_bgp_instance_external_out_cmd,
7438 "clear bgp " BGP_INSTANCE_CMD " external out",
7439 CLEAR_STR
7440 BGP_STR
7441 BGP_INSTANCE_HELP_STR
7442 "Clear all external peers\n"
7443 BGP_SOFT_OUT_STR)
7444
718e3744 7445ALIAS (clear_bgp_external_soft_out,
7446 clear_bgp_ipv6_external_out_cmd,
7447 "clear bgp ipv6 external WORD out",
7448 CLEAR_STR
7449 BGP_STR
7450 "Address family\n"
7451 "Clear all external peers\n"
e0bce756 7452 BGP_SOFT_OUT_STR)
718e3744 7453
01080f7c 7454ALIAS (clear_bgp_external_soft_out,
7455 clear_bgp_instance_ipv6_external_out_cmd,
7456 "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD out",
7457 CLEAR_STR
7458 BGP_STR
7459 BGP_INSTANCE_HELP_STR
7460 "Address family\n"
7461 "Clear all external peers\n"
7462 BGP_SOFT_OUT_STR)
7463
718e3744 7464DEFUN (clear_ip_bgp_as_soft_out,
7465 clear_ip_bgp_as_soft_out_cmd,
320da874 7466 "clear ip bgp " CMD_AS_RANGE " soft out",
718e3744 7467 CLEAR_STR
7468 IP_STR
7469 BGP_STR
7470 "Clear peers with the AS number\n"
e0bce756
DS
7471 BGP_SOFT_STR
7472 BGP_SOFT_OUT_STR)
718e3744 7473{
01080f7c 7474 if (argc == 3)
7475 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
7476 BGP_CLEAR_SOFT_OUT, argv[2]);
7477
718e3744 7478 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
7479 BGP_CLEAR_SOFT_OUT, argv[0]);
7480}
7481
01080f7c 7482ALIAS (clear_ip_bgp_as_soft_out,
7483 clear_ip_bgp_instance_as_soft_out_cmd,
7484 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out",
7485 CLEAR_STR
7486 IP_STR
7487 BGP_STR
7488 BGP_INSTANCE_HELP_STR
7489 "Clear peers with the AS number\n"
7490 BGP_SOFT_STR
7491 BGP_SOFT_OUT_STR)
7492
718e3744 7493ALIAS (clear_ip_bgp_as_soft_out,
7494 clear_ip_bgp_as_out_cmd,
320da874 7495 "clear ip bgp " CMD_AS_RANGE " out",
718e3744 7496 CLEAR_STR
7497 IP_STR
7498 BGP_STR
7499 "Clear peers with the AS number\n"
e0bce756 7500 BGP_SOFT_OUT_STR)
718e3744 7501
01080f7c 7502ALIAS (clear_ip_bgp_as_soft_out,
7503 clear_ip_bgp_instance_as_out_cmd,
7504 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out",
7505 CLEAR_STR
7506 IP_STR
7507 BGP_STR
7508 BGP_INSTANCE_HELP_STR
7509 "Clear peers with the AS number\n"
7510 BGP_SOFT_OUT_STR)
7511
718e3744 7512DEFUN (clear_ip_bgp_as_ipv4_soft_out,
7513 clear_ip_bgp_as_ipv4_soft_out_cmd,
320da874 7514 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
718e3744 7515 CLEAR_STR
7516 IP_STR
7517 BGP_STR
7518 "Clear peers with the AS number\n"
7519 "Address family\n"
7520 "Address Family modifier\n"
7521 "Address Family modifier\n"
e0bce756
DS
7522 BGP_SOFT_STR
7523 BGP_SOFT_OUT_STR)
718e3744 7524{
7525 if (strncmp (argv[1], "m", 1) == 0)
7526 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
7527 BGP_CLEAR_SOFT_OUT, argv[0]);
7528
7529 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
7530 BGP_CLEAR_SOFT_OUT, argv[0]);
7531}
7532
01080f7c 7533DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out,
7534 clear_ip_bgp_instance_as_ipv4_soft_out_cmd,
7535 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
7536 CLEAR_STR
7537 IP_STR
7538 BGP_STR
7539 BGP_INSTANCE_HELP_STR
7540 "Clear peers with the AS number\n"
7541 "Address family\n"
7542 "Address Family modifier\n"
7543 "Address Family modifier\n"
7544 BGP_SOFT_STR
7545 BGP_SOFT_OUT_STR)
7546{
7547 if (strncmp (argv[3], "m", 1) == 0)
7548 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as,
7549 BGP_CLEAR_SOFT_OUT, argv[2]);
7550
7551 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
7552 BGP_CLEAR_SOFT_OUT, argv[2]);
7553}
7554
718e3744 7555ALIAS (clear_ip_bgp_as_ipv4_soft_out,
7556 clear_ip_bgp_as_ipv4_out_cmd,
320da874 7557 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
718e3744 7558 CLEAR_STR
7559 IP_STR
7560 BGP_STR
7561 "Clear peers with the AS number\n"
7562 "Address family\n"
7563 "Address Family modifier\n"
7564 "Address Family modifier\n"
e0bce756 7565 BGP_SOFT_OUT_STR)
718e3744 7566
01080f7c 7567ALIAS (clear_ip_bgp_instance_as_ipv4_soft_out,
7568 clear_ip_bgp_instance_as_ipv4_out_cmd,
7569 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
7570 CLEAR_STR
7571 IP_STR
7572 BGP_STR
7573 BGP_INSTANCE_HELP_STR
7574 "Clear peers with the AS number\n"
7575 "Address family\n"
7576 "Address Family modifier\n"
7577 "Address Family modifier\n"
7578 BGP_SOFT_OUT_STR)
7579
718e3744 7580DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
7581 clear_ip_bgp_as_vpnv4_soft_out_cmd,
320da874 7582 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
718e3744 7583 CLEAR_STR
7584 IP_STR
7585 BGP_STR
7586 "Clear peers with the AS number\n"
7587 "Address family\n"
7588 "Address Family modifier\n"
e0bce756
DS
7589 BGP_SOFT_STR
7590 BGP_SOFT_OUT_STR)
718e3744 7591{
7592 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
7593 BGP_CLEAR_SOFT_OUT, argv[0]);
7594}
7595
7596ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
7597 clear_ip_bgp_as_vpnv4_out_cmd,
320da874 7598 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
718e3744 7599 CLEAR_STR
7600 IP_STR
7601 BGP_STR
7602 "Clear peers with the AS number\n"
7603 "Address family\n"
7604 "Address Family modifier\n"
e0bce756 7605 BGP_SOFT_OUT_STR)
718e3744 7606
587ff0fd
LB
7607DEFUN (clear_ip_bgp_as_encap_soft_out,
7608 clear_ip_bgp_as_encap_soft_out_cmd,
7609 "clear ip bgp " CMD_AS_RANGE " encap unicast soft out",
7610 CLEAR_STR
7611 IP_STR
7612 BGP_STR
7613 "Clear peers with the AS number\n"
7614 "Address family\n"
7615 "Address Family modifier\n"
7616 "Soft reconfig\n"
7617 "Soft reconfig outbound update\n")
7618{
7619 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
7620 BGP_CLEAR_SOFT_OUT, argv[0]);
7621}
7622
7623ALIAS (clear_ip_bgp_as_encap_soft_out,
7624 clear_ip_bgp_as_encap_out_cmd,
7625 "clear ip bgp " CMD_AS_RANGE " encap unicast out",
7626 CLEAR_STR
7627 IP_STR
7628 BGP_STR
7629 "Clear peers with the AS number\n"
7630 "Address family\n"
7631 "Address Family modifier\n"
7632 "Soft reconfig outbound update\n")
7633
718e3744 7634DEFUN (clear_bgp_as_soft_out,
7635 clear_bgp_as_soft_out_cmd,
320da874 7636 "clear bgp " CMD_AS_RANGE " soft out",
718e3744 7637 CLEAR_STR
7638 BGP_STR
7639 "Clear peers with the AS number\n"
e0bce756
DS
7640 BGP_SOFT_STR
7641 BGP_SOFT_OUT_STR)
718e3744 7642{
01080f7c 7643 if (argc == 3)
7644 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as,
7645 BGP_CLEAR_SOFT_OUT, argv[2]);
7646
718e3744 7647 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
7648 BGP_CLEAR_SOFT_OUT, argv[0]);
7649}
7650
01080f7c 7651ALIAS (clear_bgp_as_soft_out,
7652 clear_bgp_instance_as_soft_out_cmd,
7653 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out",
7654 CLEAR_STR
7655 BGP_STR
7656 BGP_INSTANCE_HELP_STR
7657 "Clear peers with the AS number\n"
7658 BGP_SOFT_STR
7659 BGP_SOFT_OUT_STR)
7660
718e3744 7661ALIAS (clear_bgp_as_soft_out,
7662 clear_bgp_ipv6_as_soft_out_cmd,
320da874 7663 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
718e3744 7664 CLEAR_STR
7665 BGP_STR
7666 "Address family\n"
7667 "Clear peers with the AS number\n"
e0bce756
DS
7668 BGP_SOFT_STR
7669 BGP_SOFT_OUT_STR)
718e3744 7670
01080f7c 7671ALIAS (clear_bgp_as_soft_out,
7672 clear_bgp_instance_ipv6_as_soft_out_cmd,
7673 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft out",
7674 CLEAR_STR
7675 BGP_STR
7676 BGP_INSTANCE_HELP_STR
7677 "Address family\n"
7678 "Clear peers with the AS number\n"
7679 BGP_SOFT_STR
7680 BGP_SOFT_OUT_STR)
7681
718e3744 7682ALIAS (clear_bgp_as_soft_out,
7683 clear_bgp_as_out_cmd,
320da874 7684 "clear bgp " CMD_AS_RANGE " out",
718e3744 7685 CLEAR_STR
7686 BGP_STR
7687 "Clear peers with the AS number\n"
e0bce756 7688 BGP_SOFT_OUT_STR)
718e3744 7689
01080f7c 7690ALIAS (clear_bgp_as_soft_out,
7691 clear_bgp_instance_as_out_cmd,
7692 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out",
7693 CLEAR_STR
7694 BGP_STR
7695 BGP_INSTANCE_HELP_STR
7696 "Clear peers with the AS number\n"
7697 BGP_SOFT_OUT_STR)
7698
718e3744 7699ALIAS (clear_bgp_as_soft_out,
7700 clear_bgp_ipv6_as_out_cmd,
320da874 7701 "clear bgp ipv6 " CMD_AS_RANGE " out",
718e3744 7702 CLEAR_STR
7703 BGP_STR
7704 "Address family\n"
7705 "Clear peers with the AS number\n"
e0bce756 7706 BGP_SOFT_OUT_STR)
6b0655a2 7707
01080f7c 7708ALIAS (clear_bgp_as_soft_out,
7709 clear_bgp_instance_ipv6_as_out_cmd,
7710 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " out",
7711 CLEAR_STR
7712 BGP_STR
7713 BGP_INSTANCE_HELP_STR
7714 "Address family\n"
7715 "Clear peers with the AS number\n"
7716 BGP_SOFT_OUT_STR)
7717
718e3744 7718/* Inbound soft-reconfiguration */
7719DEFUN (clear_ip_bgp_all_soft_in,
7720 clear_ip_bgp_all_soft_in_cmd,
7721 "clear ip bgp * soft in",
7722 CLEAR_STR
7723 IP_STR
7724 BGP_STR
7725 "Clear all peers\n"
e0bce756
DS
7726 BGP_SOFT_STR
7727 BGP_SOFT_IN_STR)
718e3744 7728{
6aeb9e78
DS
7729 if (argc == 2)
7730 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
718e3744 7731 BGP_CLEAR_SOFT_IN, NULL);
7732
7733 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7734 BGP_CLEAR_SOFT_IN, NULL);
7735}
7736
7737ALIAS (clear_ip_bgp_all_soft_in,
7738 clear_ip_bgp_instance_all_soft_in_cmd,
8386ac43 7739 "clear ip bgp " BGP_INSTANCE_CMD " * soft in",
718e3744 7740 CLEAR_STR
7741 IP_STR
7742 BGP_STR
8386ac43 7743 BGP_INSTANCE_HELP_STR
718e3744 7744 "Clear all peers\n"
e0bce756
DS
7745 BGP_SOFT_STR
7746 BGP_SOFT_IN_STR)
718e3744 7747
7748ALIAS (clear_ip_bgp_all_soft_in,
7749 clear_ip_bgp_all_in_cmd,
7750 "clear ip bgp * in",
7751 CLEAR_STR
7752 IP_STR
7753 BGP_STR
7754 "Clear all peers\n"
e0bce756 7755 BGP_SOFT_IN_STR)
718e3744 7756
01080f7c 7757ALIAS (clear_ip_bgp_all_soft_in,
7758 clear_ip_bgp_instance_all_in_cmd,
7759 "clear ip bgp " BGP_INSTANCE_CMD " * in",
7760 CLEAR_STR
7761 IP_STR
7762 BGP_STR
7763 BGP_INSTANCE_HELP_STR
7764 "Clear all peers\n"
7765 BGP_SOFT_IN_STR)
7766
718e3744 7767DEFUN (clear_ip_bgp_all_in_prefix_filter,
7768 clear_ip_bgp_all_in_prefix_filter_cmd,
7769 "clear ip bgp * in prefix-filter",
7770 CLEAR_STR
7771 IP_STR
7772 BGP_STR
7773 "Clear all peers\n"
e0bce756 7774 BGP_SOFT_IN_STR
718e3744 7775 "Push out prefix-list ORF and do inbound soft reconfig\n")
7776{
6aeb9e78
DS
7777 if (argc== 2)
7778 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
718e3744 7779 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
7780
7781 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7782 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
7783}
7784
718e3744 7785DEFUN (clear_ip_bgp_all_ipv4_soft_in,
7786 clear_ip_bgp_all_ipv4_soft_in_cmd,
7787 "clear ip bgp * ipv4 (unicast|multicast) soft in",
7788 CLEAR_STR
7789 IP_STR
7790 BGP_STR
7791 "Clear all peers\n"
7792 "Address family\n"
7793 "Address Family modifier\n"
7794 "Address Family modifier\n"
e0bce756
DS
7795 BGP_SOFT_STR
7796 BGP_SOFT_IN_STR)
718e3744 7797{
7798 if (strncmp (argv[0], "m", 1) == 0)
7799 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
7800 BGP_CLEAR_SOFT_IN, NULL);
7801
7802 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7803 BGP_CLEAR_SOFT_IN, NULL);
7804}
7805
718e3744 7806DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
7807 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
8386ac43 7808 "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft in",
718e3744 7809 CLEAR_STR
7810 IP_STR
7811 BGP_STR
8386ac43 7812 BGP_INSTANCE_HELP_STR
718e3744 7813 "Clear all peers\n"
7814 "Address family\n"
7815 "Address Family modifier\n"
7816 "Address Family modifier\n"
e0bce756
DS
7817 BGP_SOFT_STR
7818 BGP_SOFT_IN_STR)
718e3744 7819{
6aeb9e78
DS
7820 if (strncmp (argv[2], "m", 1) == 0)
7821 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all,
718e3744 7822 BGP_CLEAR_SOFT_IN, NULL);
7823
6aeb9e78 7824 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
718e3744 7825 BGP_CLEAR_SOFT_IN, NULL);
7826}
7827
01080f7c 7828ALIAS (clear_ip_bgp_all_ipv4_soft_in,
7829 clear_ip_bgp_all_ipv4_in_cmd,
7830 "clear ip bgp * ipv4 (unicast|multicast) in",
718e3744 7831 CLEAR_STR
7832 IP_STR
7833 BGP_STR
7834 "Clear all peers\n"
7835 "Address family\n"
7836 "Address Family modifier\n"
7837 "Address Family modifier\n"
01080f7c 7838 BGP_SOFT_IN_STR)
718e3744 7839
01080f7c 7840ALIAS (clear_ip_bgp_instance_all_ipv4_soft_in,
7841 clear_ip_bgp_instance_all_ipv4_in_cmd,
7842 "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) in",
7843 CLEAR_STR
7844 IP_STR
7845 BGP_STR
7846 BGP_INSTANCE_HELP_STR
7847 "Clear all peers\n"
7848 "Address family\n"
7849 "Address Family modifier\n"
7850 "Address Family modifier\n"
7851 BGP_SOFT_IN_STR)
718e3744 7852
01080f7c 7853DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
7854 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
7855 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
718e3744 7856 CLEAR_STR
7857 IP_STR
7858 BGP_STR
7859 "Clear all peers\n"
7860 "Address family\n"
7861 "Address Family modifier\n"
7862 "Address Family modifier\n"
e0bce756 7863 BGP_SOFT_IN_STR
718e3744 7864 "Push out prefix-list ORF and do inbound soft reconfig\n")
7865{
01080f7c 7866 if (strncmp (argv[0], "m", 1) == 0)
7867 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
7868 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
718e3744 7869
01080f7c 7870 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7871 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
718e3744 7872}
7873
7874DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
7875 clear_ip_bgp_all_vpnv4_soft_in_cmd,
7876 "clear ip bgp * vpnv4 unicast soft in",
7877 CLEAR_STR
7878 IP_STR
7879 BGP_STR
7880 "Clear all peers\n"
7881 "Address family\n"
7882 "Address Family Modifier\n"
e0bce756
DS
7883 BGP_SOFT_STR
7884 BGP_SOFT_IN_STR)
718e3744 7885{
7886 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
7887 BGP_CLEAR_SOFT_IN, NULL);
7888}
7889
7890ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
7891 clear_ip_bgp_all_vpnv4_in_cmd,
7892 "clear ip bgp * vpnv4 unicast in",
7893 CLEAR_STR
7894 IP_STR
7895 BGP_STR
7896 "Clear all peers\n"
7897 "Address family\n"
7898 "Address Family Modifier\n"
e0bce756 7899 BGP_SOFT_IN_STR)
718e3744 7900
587ff0fd
LB
7901DEFUN (clear_ip_bgp_all_encap_soft_in,
7902 clear_ip_bgp_all_encap_soft_in_cmd,
7903 "clear ip bgp * encap unicast soft in",
7904 CLEAR_STR
7905 IP_STR
7906 BGP_STR
7907 "Clear all peers\n"
7908 "Address family\n"
7909 "Address Family Modifier\n"
7910 "Soft reconfig\n"
7911 "Soft reconfig inbound update\n")
7912{
7913 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
7914 BGP_CLEAR_SOFT_IN, NULL);
7915}
7916
7917ALIAS (clear_ip_bgp_all_encap_soft_in,
7918 clear_ip_bgp_all_encap_in_cmd,
7919 "clear ip bgp * encap unicast in",
7920 CLEAR_STR
7921 IP_STR
7922 BGP_STR
7923 "Clear all peers\n"
7924 "Address family\n"
7925 "Address Family Modifier\n"
7926 "Soft reconfig inbound update\n")
7927
718e3744 7928DEFUN (clear_bgp_all_soft_in,
7929 clear_bgp_all_soft_in_cmd,
7930 "clear bgp * soft in",
7931 CLEAR_STR
7932 BGP_STR
7933 "Clear all peers\n"
e0bce756
DS
7934 BGP_SOFT_STR
7935 BGP_SOFT_IN_STR)
718e3744 7936{
6aeb9e78
DS
7937 if (argc == 2)
7938 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all,
718e3744 7939 BGP_CLEAR_SOFT_IN, NULL);
7940
7941 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
7942 BGP_CLEAR_SOFT_IN, NULL);
7943}
7944
7945ALIAS (clear_bgp_all_soft_in,
7946 clear_bgp_instance_all_soft_in_cmd,
8386ac43 7947 "clear bgp " BGP_INSTANCE_CMD " * soft in",
718e3744 7948 CLEAR_STR
7949 BGP_STR
8386ac43 7950 BGP_INSTANCE_HELP_STR
718e3744 7951 "Clear all peers\n"
e0bce756
DS
7952 BGP_SOFT_STR
7953 BGP_SOFT_IN_STR)
718e3744 7954
7955ALIAS (clear_bgp_all_soft_in,
7956 clear_bgp_ipv6_all_soft_in_cmd,
7957 "clear bgp ipv6 * soft in",
7958 CLEAR_STR
7959 BGP_STR
7960 "Address family\n"
7961 "Clear all peers\n"
e0bce756
DS
7962 BGP_SOFT_STR
7963 BGP_SOFT_IN_STR)
718e3744 7964
01080f7c 7965ALIAS (clear_bgp_all_soft_in,
7966 clear_bgp_instance_ipv6_all_soft_in_cmd,
7967 "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft in",
7968 CLEAR_STR
7969 BGP_STR
7970 BGP_INSTANCE_HELP_STR
7971 "Address family\n"
7972 "Clear all peers\n"
7973 BGP_SOFT_STR
7974 BGP_SOFT_IN_STR)
7975
718e3744 7976ALIAS (clear_bgp_all_soft_in,
7977 clear_bgp_all_in_cmd,
7978 "clear bgp * in",
7979 CLEAR_STR
7980 BGP_STR
7981 "Clear all peers\n"
e0bce756 7982 BGP_SOFT_IN_STR)
718e3744 7983
01080f7c 7984ALIAS (clear_bgp_all_soft_in,
7985 clear_bgp_instance_all_in_cmd,
7986 "clear bgp " BGP_INSTANCE_CMD " * in",
7987 CLEAR_STR
7988 BGP_STR
7989 BGP_INSTANCE_HELP_STR
7990 "Clear all peers\n"
7991 BGP_SOFT_IN_STR)
7992
718e3744 7993ALIAS (clear_bgp_all_soft_in,
7994 clear_bgp_ipv6_all_in_cmd,
7995 "clear bgp ipv6 * in",
7996 CLEAR_STR
7997 BGP_STR
7998 "Address family\n"
7999 "Clear all peers\n"
e0bce756 8000 BGP_SOFT_IN_STR)
718e3744 8001
01080f7c 8002ALIAS (clear_bgp_all_soft_in,
8003 clear_bgp_instance_ipv6_all_in_cmd,
8004 "clear bgp " BGP_INSTANCE_CMD " ipv6 * in",
8005 CLEAR_STR
8006 BGP_STR
8007 BGP_INSTANCE_HELP_STR
8008 "Address family\n"
8009 "Clear all peers\n"
8010 BGP_SOFT_IN_STR)
8011
718e3744 8012DEFUN (clear_bgp_all_in_prefix_filter,
8013 clear_bgp_all_in_prefix_filter_cmd,
8014 "clear bgp * in prefix-filter",
8015 CLEAR_STR
8016 BGP_STR
8017 "Clear all peers\n"
e0bce756 8018 BGP_SOFT_IN_STR
718e3744 8019 "Push out prefix-list ORF and do inbound soft reconfig\n")
8020{
8021 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
8022 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
8023}
8024
8025ALIAS (clear_bgp_all_in_prefix_filter,
8026 clear_bgp_ipv6_all_in_prefix_filter_cmd,
8027 "clear bgp ipv6 * in prefix-filter",
8028 CLEAR_STR
8029 BGP_STR
8030 "Address family\n"
8031 "Clear all peers\n"
e0bce756 8032 BGP_SOFT_IN_STR
718e3744 8033 "Push out prefix-list ORF and do inbound soft reconfig\n")
8034
8035DEFUN (clear_ip_bgp_peer_soft_in,
8036 clear_ip_bgp_peer_soft_in_cmd,
db64ea86 8037 "clear ip bgp (A.B.C.D|WORD) soft in",
718e3744 8038 CLEAR_STR
8039 IP_STR
8040 BGP_STR
8041 "BGP neighbor address to clear\n"
db64ea86 8042 "BGP neighbor on interface to clear\n"
e0bce756
DS
8043 BGP_SOFT_STR
8044 BGP_SOFT_IN_STR)
718e3744 8045{
01080f7c 8046 if (argc == 3)
8047 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
8048 BGP_CLEAR_SOFT_IN, argv[2]);
8049
718e3744 8050 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
8051 BGP_CLEAR_SOFT_IN, argv[0]);
8052}
8053
01080f7c 8054ALIAS (clear_ip_bgp_peer_soft_in,
8055 clear_ip_bgp_instance_peer_soft_in_cmd,
8056 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft in",
8057 CLEAR_STR
8058 IP_STR
8059 BGP_STR
8060 BGP_INSTANCE_HELP_STR
8061 "BGP neighbor address to clear\n"
8062 "BGP neighbor on interface to clear\n"
8063 BGP_SOFT_STR
8064 BGP_SOFT_IN_STR)
8065
718e3744 8066ALIAS (clear_ip_bgp_peer_soft_in,
8067 clear_ip_bgp_peer_in_cmd,
db64ea86 8068 "clear ip bgp (A.B.C.D|WORD) in",
718e3744 8069 CLEAR_STR
8070 IP_STR
8071 BGP_STR
8072 "BGP neighbor address to clear\n"
db64ea86 8073 "BGP neighbor on interface to clear\n"
e0bce756 8074 BGP_SOFT_IN_STR)
01080f7c 8075
8076ALIAS (clear_ip_bgp_peer_soft_in,
8077 clear_ip_bgp_instance_peer_in_cmd,
8078 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) in",
8079 CLEAR_STR
8080 IP_STR
8081 BGP_STR
8082 BGP_INSTANCE_HELP_STR
8083 "BGP neighbor address to clear\n"
8084 "BGP neighbor on interface to clear\n"
8085 BGP_SOFT_IN_STR)
8086
718e3744 8087DEFUN (clear_ip_bgp_peer_in_prefix_filter,
8088 clear_ip_bgp_peer_in_prefix_filter_cmd,
db64ea86 8089 "clear ip bgp (A.B.C.D|WORD) in prefix-filter",
718e3744 8090 CLEAR_STR
8091 IP_STR
8092 BGP_STR
8093 "BGP neighbor address to clear\n"
db64ea86 8094 "BGP neighbor on interface to clear\n"
e0bce756 8095 BGP_SOFT_IN_STR
718e3744 8096 "Push out the existing ORF prefix-list\n")
8097{
8098 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
8099 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8100}
8101
8102DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
8103 clear_ip_bgp_peer_ipv4_soft_in_cmd,
db64ea86 8104 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in",
718e3744 8105 CLEAR_STR
8106 IP_STR
8107 BGP_STR
8108 "BGP neighbor address to clear\n"
db64ea86 8109 "BGP neighbor on interface to clear\n"
718e3744 8110 "Address family\n"
8111 "Address Family modifier\n"
8112 "Address Family modifier\n"
e0bce756
DS
8113 BGP_SOFT_STR
8114 BGP_SOFT_IN_STR)
718e3744 8115{
8116 if (strncmp (argv[1], "m", 1) == 0)
8117 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
8118 BGP_CLEAR_SOFT_IN, argv[0]);
8119
8120 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
8121 BGP_CLEAR_SOFT_IN, argv[0]);
8122}
8123
01080f7c 8124DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in,
8125 clear_ip_bgp_instance_peer_ipv4_soft_in_cmd,
8126 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in",
8127 CLEAR_STR
8128 IP_STR
8129 BGP_STR
8130 BGP_INSTANCE_HELP_STR
8131 "BGP neighbor address to clear\n"
8132 "BGP neighbor on interface to clear\n"
8133 "Address family\n"
8134 "Address Family modifier\n"
8135 "Address Family modifier\n"
8136 BGP_SOFT_STR
8137 BGP_SOFT_IN_STR)
8138{
8139 if (strncmp (argv[3], "m", 1) == 0)
8140 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer,
8141 BGP_CLEAR_SOFT_IN, argv[2]);
8142
8143 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
8144 BGP_CLEAR_SOFT_IN, argv[2]);
8145}
8146
718e3744 8147ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
8148 clear_ip_bgp_peer_ipv4_in_cmd,
db64ea86 8149 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in",
718e3744 8150 CLEAR_STR
8151 IP_STR
8152 BGP_STR
8153 "BGP neighbor address to clear\n"
db64ea86 8154 "BGP neighbor on interface to clear\n"
718e3744 8155 "Address family\n"
8156 "Address Family modifier\n"
8157 "Address Family modifier\n"
e0bce756 8158 BGP_SOFT_IN_STR)
718e3744 8159
01080f7c 8160ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_in,
8161 clear_ip_bgp_instance_peer_ipv4_in_cmd,
8162 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) in",
8163 CLEAR_STR
8164 IP_STR
8165 BGP_STR
8166 BGP_INSTANCE_HELP_STR
8167 "BGP neighbor address to clear\n"
8168 "BGP neighbor on interface to clear\n"
8169 "Address family\n"
8170 "Address Family modifier\n"
8171 "Address Family modifier\n"
8172 BGP_SOFT_IN_STR)
8173
718e3744 8174DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
8175 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
db64ea86 8176 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in prefix-filter",
718e3744 8177 CLEAR_STR
8178 IP_STR
8179 BGP_STR
8180 "BGP neighbor address to clear\n"
db64ea86 8181 "BGP neighbor on interface to clear\n"
718e3744 8182 "Address family\n"
8183 "Address Family modifier\n"
8184 "Address Family modifier\n"
e0bce756 8185 BGP_SOFT_IN_STR
718e3744 8186 "Push out the existing ORF prefix-list\n")
8187{
8188 if (strncmp (argv[1], "m", 1) == 0)
8189 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
8190 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
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_vpnv4_soft_in,
8197 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
db64ea86 8198 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast 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"
e0bce756
DS
8206 BGP_SOFT_STR
8207 BGP_SOFT_IN_STR)
718e3744 8208{
8209 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
8210 BGP_CLEAR_SOFT_IN, argv[0]);
8211}
8212
8213ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
8214 clear_ip_bgp_peer_vpnv4_in_cmd,
db64ea86 8215 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in",
718e3744 8216 CLEAR_STR
8217 IP_STR
8218 BGP_STR
8219 "BGP neighbor address to clear\n"
db64ea86 8220 "BGP neighbor on interface to clear\n"
718e3744 8221 "Address family\n"
8222 "Address Family Modifier\n"
e0bce756 8223 BGP_SOFT_IN_STR)
718e3744 8224
587ff0fd
LB
8225DEFUN (clear_ip_bgp_peer_encap_soft_in,
8226 clear_ip_bgp_peer_encap_soft_in_cmd,
8227 "clear ip bgp A.B.C.D encap unicast soft in",
8228 CLEAR_STR
8229 IP_STR
8230 BGP_STR
8231 "BGP neighbor address to clear\n"
8232 "Address family\n"
8233 "Address Family Modifier\n"
8234 "Soft reconfig\n"
8235 "Soft reconfig inbound update\n")
8236{
8237 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
8238 BGP_CLEAR_SOFT_IN, argv[0]);
8239}
8240
8241ALIAS (clear_ip_bgp_peer_encap_soft_in,
8242 clear_ip_bgp_peer_encap_in_cmd,
8243 "clear ip bgp A.B.C.D encap unicast in",
8244 CLEAR_STR
8245 IP_STR
8246 BGP_STR
8247 "BGP neighbor address to clear\n"
8248 "Address family\n"
8249 "Address Family Modifier\n"
8250 "Soft reconfig inbound update\n")
8251
718e3744 8252DEFUN (clear_bgp_peer_soft_in,
8253 clear_bgp_peer_soft_in_cmd,
a80beece 8254 "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in",
718e3744 8255 CLEAR_STR
8256 BGP_STR
8257 "BGP neighbor address to clear\n"
8258 "BGP IPv6 neighbor to clear\n"
a80beece 8259 "BGP neighbor on interface to clear\n"
e0bce756
DS
8260 BGP_SOFT_STR
8261 BGP_SOFT_IN_STR)
718e3744 8262{
01080f7c 8263 if (argc == 3)
8264 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer,
8265 BGP_CLEAR_SOFT_IN, argv[2]);
8266
718e3744 8267 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
8268 BGP_CLEAR_SOFT_IN, argv[0]);
8269}
8270
01080f7c 8271ALIAS (clear_bgp_peer_soft_in,
8272 clear_bgp_instance_peer_soft_in_cmd,
8273 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft in",
8274 CLEAR_STR
8275 BGP_STR
8276 BGP_INSTANCE_HELP_STR
8277 "BGP neighbor address to clear\n"
8278 "BGP IPv6 neighbor to clear\n"
8279 "BGP neighbor on interface to clear\n"
8280 BGP_SOFT_STR
8281 BGP_SOFT_IN_STR)
8282
718e3744 8283ALIAS (clear_bgp_peer_soft_in,
8284 clear_bgp_ipv6_peer_soft_in_cmd,
a80beece 8285 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in",
718e3744 8286 CLEAR_STR
8287 BGP_STR
8288 "Address family\n"
8289 "BGP neighbor address to clear\n"
8290 "BGP IPv6 neighbor to clear\n"
a80beece 8291 "BGP neighbor on interface to clear\n"
e0bce756
DS
8292 BGP_SOFT_STR
8293 BGP_SOFT_IN_STR)
718e3744 8294
01080f7c 8295ALIAS (clear_bgp_peer_soft_in,
8296 clear_bgp_instance_ipv6_peer_soft_in_cmd,
8297 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft in",
8298 CLEAR_STR
8299 BGP_STR
8300 BGP_INSTANCE_HELP_STR
8301 "Address family\n"
8302 "BGP neighbor address to clear\n"
8303 "BGP IPv6 neighbor to clear\n"
8304 "BGP neighbor on interface to clear\n"
8305 BGP_SOFT_STR
8306 BGP_SOFT_IN_STR)
8307
718e3744 8308ALIAS (clear_bgp_peer_soft_in,
8309 clear_bgp_peer_in_cmd,
a80beece 8310 "clear bgp (A.B.C.D|X:X::X:X|WORD) in",
718e3744 8311 CLEAR_STR
8312 BGP_STR
8313 "BGP neighbor address to clear\n"
8314 "BGP IPv6 neighbor to clear\n"
a80beece 8315 "BGP neighbor on interface to clear\n"
e0bce756 8316 BGP_SOFT_IN_STR)
718e3744 8317
01080f7c 8318ALIAS (clear_bgp_peer_soft_in,
8319 clear_bgp_instance_peer_in_cmd,
8320 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) in",
8321 CLEAR_STR
8322 BGP_STR
8323 BGP_INSTANCE_HELP_STR
8324 "BGP neighbor address to clear\n"
8325 "BGP IPv6 neighbor to clear\n"
8326 "BGP neighbor on interface to clear\n"
8327 BGP_SOFT_IN_STR)
8328
718e3744 8329ALIAS (clear_bgp_peer_soft_in,
8330 clear_bgp_ipv6_peer_in_cmd,
a80beece 8331 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in",
718e3744 8332 CLEAR_STR
8333 BGP_STR
8334 "Address family\n"
8335 "BGP neighbor address to clear\n"
8336 "BGP IPv6 neighbor to clear\n"
a80beece 8337 "BGP neighbor on interface to clear\n"
e0bce756 8338 BGP_SOFT_IN_STR)
718e3744 8339
01080f7c 8340ALIAS (clear_bgp_peer_soft_in,
8341 clear_bgp_instance_ipv6_peer_in_cmd,
8342 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) in",
8343 CLEAR_STR
8344 BGP_STR
8345 BGP_INSTANCE_HELP_STR
8346 "Address family\n"
8347 "BGP neighbor address to clear\n"
8348 "BGP IPv6 neighbor to clear\n"
8349 "BGP neighbor on interface to clear\n"
8350 BGP_SOFT_IN_STR)
8351
718e3744 8352DEFUN (clear_bgp_peer_in_prefix_filter,
8353 clear_bgp_peer_in_prefix_filter_cmd,
a80beece 8354 "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter",
718e3744 8355 CLEAR_STR
8356 BGP_STR
8357 "BGP neighbor address to clear\n"
8358 "BGP IPv6 neighbor to clear\n"
a80beece 8359 "BGP neighbor on interface to clear\n"
e0bce756 8360 BGP_SOFT_IN_STR
718e3744 8361 "Push out the existing ORF prefix-list\n")
8362{
8363 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
8364 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8365}
8366
8367ALIAS (clear_bgp_peer_in_prefix_filter,
8368 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
a80beece 8369 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter",
718e3744 8370 CLEAR_STR
8371 BGP_STR
8372 "Address family\n"
8373 "BGP neighbor address to clear\n"
8374 "BGP IPv6 neighbor to clear\n"
a80beece 8375 "BGP neighbor on interface to clear\n"
e0bce756 8376 BGP_SOFT_IN_STR
718e3744 8377 "Push out the existing ORF prefix-list\n")
8378
8379DEFUN (clear_ip_bgp_peer_group_soft_in,
8380 clear_ip_bgp_peer_group_soft_in_cmd,
8381 "clear ip bgp peer-group WORD soft in",
8382 CLEAR_STR
8383 IP_STR
8384 BGP_STR
8385 "Clear all members of peer-group\n"
8386 "BGP peer-group name\n"
e0bce756
DS
8387 BGP_SOFT_STR
8388 BGP_SOFT_IN_STR)
718e3744 8389{
01080f7c 8390 if (argc == 3)
8391 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
8392 BGP_CLEAR_SOFT_IN, argv[2]);
8393
718e3744 8394 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
8395 BGP_CLEAR_SOFT_IN, argv[0]);
8396}
8397
01080f7c 8398ALIAS (clear_ip_bgp_peer_group_soft_in,
8399 clear_ip_bgp_instance_peer_group_soft_in_cmd,
8400 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft in",
8401 CLEAR_STR
8402 IP_STR
8403 BGP_STR
8404 BGP_INSTANCE_HELP_STR
8405 "Clear all members of peer-group\n"
8406 "BGP peer-group name\n"
8407 BGP_SOFT_STR
8408 BGP_SOFT_IN_STR)
8409
718e3744 8410ALIAS (clear_ip_bgp_peer_group_soft_in,
8411 clear_ip_bgp_peer_group_in_cmd,
8412 "clear ip bgp peer-group WORD in",
8413 CLEAR_STR
8414 IP_STR
8415 BGP_STR
8416 "Clear all members of peer-group\n"
8417 "BGP peer-group name\n"
e0bce756 8418 BGP_SOFT_IN_STR)
718e3744 8419
01080f7c 8420ALIAS (clear_ip_bgp_peer_group_soft_in,
8421 clear_ip_bgp_instance_peer_group_in_cmd,
8422 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD in",
8423 CLEAR_STR
8424 IP_STR
8425 BGP_STR
8426 BGP_INSTANCE_HELP_STR
8427 "Clear all members of peer-group\n"
8428 "BGP peer-group name\n"
8429 BGP_SOFT_IN_STR)
8430
718e3744 8431DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
8432 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
8433 "clear ip bgp peer-group WORD in prefix-filter",
8434 CLEAR_STR
8435 IP_STR
8436 BGP_STR
8437 "Clear all members of peer-group\n"
8438 "BGP peer-group name\n"
e0bce756 8439 BGP_SOFT_IN_STR
718e3744 8440 "Push out prefix-list ORF and do inbound soft reconfig\n")
8441{
8442 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
8443 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8444}
8445
8446DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
8447 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
8448 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
8449 CLEAR_STR
8450 IP_STR
8451 BGP_STR
8452 "Clear all members of peer-group\n"
8453 "BGP peer-group name\n"
8454 "Address family\n"
8455 "Address Family modifier\n"
8456 "Address Family modifier\n"
e0bce756
DS
8457 BGP_SOFT_STR
8458 BGP_SOFT_IN_STR)
718e3744 8459{
8460 if (strncmp (argv[1], "m", 1) == 0)
8461 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
8462 BGP_CLEAR_SOFT_IN, argv[0]);
8463
8464 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
8465 BGP_CLEAR_SOFT_IN, argv[0]);
8466}
8467
01080f7c 8468DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in,
8469 clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd,
8470 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft in",
8471 CLEAR_STR
8472 IP_STR
8473 BGP_STR
8474 BGP_INSTANCE_HELP_STR
8475 "Clear all members of peer-group\n"
8476 "BGP peer-group name\n"
8477 "Address family\n"
8478 "Address Family modifier\n"
8479 "Address Family modifier\n"
8480 BGP_SOFT_STR
8481 BGP_SOFT_IN_STR)
8482{
8483 if (strncmp (argv[3], "m", 1) == 0)
8484 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group,
8485 BGP_CLEAR_SOFT_IN, argv[2]);
8486
8487 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
8488 BGP_CLEAR_SOFT_IN, argv[2]);
8489}
8490
718e3744 8491ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
8492 clear_ip_bgp_peer_group_ipv4_in_cmd,
8493 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
8494 CLEAR_STR
8495 IP_STR
8496 BGP_STR
8497 "Clear all members of peer-group\n"
8498 "BGP peer-group name\n"
8499 "Address family\n"
8500 "Address Family modifier\n"
8501 "Address Family modifier\n"
e0bce756 8502 BGP_SOFT_IN_STR)
718e3744 8503
01080f7c 8504ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_in,
8505 clear_ip_bgp_instance_peer_group_ipv4_in_cmd,
8506 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) in",
8507 CLEAR_STR
8508 IP_STR
8509 BGP_STR
8510 BGP_INSTANCE_HELP_STR
8511 "Clear all members of peer-group\n"
8512 "BGP peer-group name\n"
8513 "Address family\n"
8514 "Address Family modifier\n"
8515 "Address Family modifier\n"
8516 BGP_SOFT_IN_STR)
8517
718e3744 8518DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
8519 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
8520 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
8521 CLEAR_STR
8522 IP_STR
8523 BGP_STR
8524 "Clear all members of peer-group\n"
8525 "BGP peer-group name\n"
8526 "Address family\n"
8527 "Address Family modifier\n"
8528 "Address Family modifier\n"
e0bce756 8529 BGP_SOFT_IN_STR
718e3744 8530 "Push out prefix-list ORF and do inbound soft reconfig\n")
8531{
8532 if (strncmp (argv[1], "m", 1) == 0)
8533 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
8534 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
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_bgp_peer_group_soft_in,
8541 clear_bgp_peer_group_soft_in_cmd,
8542 "clear bgp peer-group WORD soft in",
8543 CLEAR_STR
8544 BGP_STR
8545 "Clear all members of peer-group\n"
8546 "BGP peer-group name\n"
e0bce756
DS
8547 BGP_SOFT_STR
8548 BGP_SOFT_IN_STR)
718e3744 8549{
01080f7c 8550 if (argc == 3)
8551 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group,
8552 BGP_CLEAR_SOFT_IN, argv[2]);
8553
718e3744 8554 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
8555 BGP_CLEAR_SOFT_IN, argv[0]);
8556}
8557
01080f7c 8558ALIAS (clear_bgp_peer_group_soft_in,
8559 clear_bgp_instance_peer_group_soft_in_cmd,
8560 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft in",
8561 CLEAR_STR
8562 BGP_STR
8563 BGP_INSTANCE_HELP_STR
8564 "Clear all members of peer-group\n"
8565 "BGP peer-group name\n"
8566 BGP_SOFT_STR
8567 BGP_SOFT_IN_STR)
8568
718e3744 8569ALIAS (clear_bgp_peer_group_soft_in,
8570 clear_bgp_ipv6_peer_group_soft_in_cmd,
8571 "clear bgp ipv6 peer-group WORD soft in",
8572 CLEAR_STR
8573 BGP_STR
8574 "Address family\n"
8575 "Clear all members of peer-group\n"
8576 "BGP peer-group name\n"
e0bce756
DS
8577 BGP_SOFT_STR
8578 BGP_SOFT_IN_STR)
718e3744 8579
01080f7c 8580ALIAS (clear_bgp_peer_group_soft_in,
8581 clear_bgp_instance_ipv6_peer_group_soft_in_cmd,
8582 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft in",
8583 CLEAR_STR
8584 BGP_STR
8585 BGP_INSTANCE_HELP_STR
8586 "Address family\n"
8587 "Clear all members of peer-group\n"
8588 "BGP peer-group name\n"
8589 BGP_SOFT_STR
8590 BGP_SOFT_IN_STR)
8591
718e3744 8592ALIAS (clear_bgp_peer_group_soft_in,
8593 clear_bgp_peer_group_in_cmd,
8594 "clear bgp peer-group WORD in",
8595 CLEAR_STR
8596 BGP_STR
8597 "Clear all members of peer-group\n"
8598 "BGP peer-group name\n"
e0bce756 8599 BGP_SOFT_IN_STR)
718e3744 8600
01080f7c 8601ALIAS (clear_bgp_peer_group_soft_in,
8602 clear_bgp_instance_peer_group_in_cmd,
8603 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD in",
8604 CLEAR_STR
8605 BGP_STR
8606 BGP_INSTANCE_HELP_STR
8607 "Clear all members of peer-group\n"
8608 "BGP peer-group name\n"
8609 BGP_SOFT_IN_STR)
8610
718e3744 8611ALIAS (clear_bgp_peer_group_soft_in,
8612 clear_bgp_ipv6_peer_group_in_cmd,
8613 "clear bgp ipv6 peer-group WORD in",
8614 CLEAR_STR
8615 BGP_STR
8616 "Address family\n"
8617 "Clear all members of peer-group\n"
8618 "BGP peer-group name\n"
e0bce756 8619 BGP_SOFT_IN_STR)
718e3744 8620
01080f7c 8621ALIAS (clear_bgp_peer_group_soft_in,
8622 clear_bgp_instance_ipv6_peer_group_in_cmd,
8623 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD in",
8624 CLEAR_STR
8625 BGP_STR
8626 BGP_INSTANCE_HELP_STR
8627 "Address family\n"
8628 "Clear all members of peer-group\n"
8629 "BGP peer-group name\n"
8630 BGP_SOFT_IN_STR)
8631
718e3744 8632DEFUN (clear_bgp_peer_group_in_prefix_filter,
8633 clear_bgp_peer_group_in_prefix_filter_cmd,
8634 "clear bgp peer-group WORD in prefix-filter",
8635 CLEAR_STR
8636 BGP_STR
8637 "Clear all members of peer-group\n"
8638 "BGP peer-group name\n"
e0bce756 8639 BGP_SOFT_IN_STR
718e3744 8640 "Push out prefix-list ORF and do inbound soft reconfig\n")
8641{
8642 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
8643 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8644}
8645
8646ALIAS (clear_bgp_peer_group_in_prefix_filter,
8647 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
8648 "clear bgp ipv6 peer-group WORD in prefix-filter",
8649 CLEAR_STR
8650 BGP_STR
8651 "Address family\n"
8652 "Clear all members of peer-group\n"
8653 "BGP peer-group name\n"
e0bce756 8654 BGP_SOFT_IN_STR
718e3744 8655 "Push out prefix-list ORF and do inbound soft reconfig\n")
8656
8657DEFUN (clear_ip_bgp_external_soft_in,
8658 clear_ip_bgp_external_soft_in_cmd,
8659 "clear ip bgp external soft in",
8660 CLEAR_STR
8661 IP_STR
8662 BGP_STR
8663 "Clear all external peers\n"
e0bce756
DS
8664 BGP_SOFT_STR
8665 BGP_SOFT_IN_STR)
718e3744 8666{
01080f7c 8667 if (argc == 2)
8668 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
8669 BGP_CLEAR_SOFT_IN, NULL);
8670
718e3744 8671 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
8672 BGP_CLEAR_SOFT_IN, NULL);
8673}
8674
01080f7c 8675ALIAS (clear_ip_bgp_external_soft_in,
8676 clear_ip_bgp_instance_external_soft_in_cmd,
8677 "clear ip bgp " BGP_INSTANCE_CMD " external soft in",
8678 CLEAR_STR
8679 IP_STR
8680 BGP_STR
8681 BGP_INSTANCE_HELP_STR
8682 "Clear all external peers\n"
8683 BGP_SOFT_STR
8684 BGP_SOFT_IN_STR)
8685
718e3744 8686ALIAS (clear_ip_bgp_external_soft_in,
8687 clear_ip_bgp_external_in_cmd,
8688 "clear ip bgp external in",
8689 CLEAR_STR
8690 IP_STR
8691 BGP_STR
8692 "Clear all external peers\n"
e0bce756 8693 BGP_SOFT_IN_STR)
718e3744 8694
01080f7c 8695ALIAS (clear_ip_bgp_external_soft_in,
8696 clear_ip_bgp_instance_external_in_cmd,
8697 "clear ip bgp " BGP_INSTANCE_CMD " external in",
8698 CLEAR_STR
8699 IP_STR
8700 BGP_STR
8701 BGP_INSTANCE_HELP_STR
8702 "Clear all external peers\n"
8703 BGP_SOFT_IN_STR)
8704
718e3744 8705DEFUN (clear_ip_bgp_external_in_prefix_filter,
8706 clear_ip_bgp_external_in_prefix_filter_cmd,
8707 "clear ip bgp external in prefix-filter",
8708 CLEAR_STR
8709 IP_STR
8710 BGP_STR
8711 "Clear all external peers\n"
e0bce756 8712 BGP_SOFT_IN_STR
718e3744 8713 "Push out prefix-list ORF and do inbound soft reconfig\n")
8714{
8715 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
8716 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
8717}
8718
8719DEFUN (clear_ip_bgp_external_ipv4_soft_in,
8720 clear_ip_bgp_external_ipv4_soft_in_cmd,
8721 "clear ip bgp external ipv4 (unicast|multicast) soft in",
8722 CLEAR_STR
8723 IP_STR
8724 BGP_STR
8725 "Clear all external peers\n"
8726 "Address family\n"
8727 "Address Family modifier\n"
8728 "Address Family modifier\n"
e0bce756
DS
8729 BGP_SOFT_STR
8730 BGP_SOFT_IN_STR)
718e3744 8731{
8732 if (strncmp (argv[0], "m", 1) == 0)
8733 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
8734 BGP_CLEAR_SOFT_IN, NULL);
8735
8736 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
8737 BGP_CLEAR_SOFT_IN, NULL);
8738}
8739
01080f7c 8740DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in,
8741 clear_ip_bgp_instance_external_ipv4_soft_in_cmd,
8742 "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft in",
8743 CLEAR_STR
8744 IP_STR
8745 BGP_STR
8746 BGP_INSTANCE_HELP_STR
8747 "Clear all external peers\n"
8748 "Address family\n"
8749 "Address Family modifier\n"
8750 "Address Family modifier\n"
8751 BGP_SOFT_STR
8752 BGP_SOFT_IN_STR)
8753{
8754 if (strncmp (argv[2], "m", 1) == 0)
8755 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external,
8756 BGP_CLEAR_SOFT_IN, NULL);
8757
8758 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
8759 BGP_CLEAR_SOFT_IN, NULL);
8760}
8761
718e3744 8762ALIAS (clear_ip_bgp_external_ipv4_soft_in,
8763 clear_ip_bgp_external_ipv4_in_cmd,
8764 "clear ip bgp external ipv4 (unicast|multicast) in",
8765 CLEAR_STR
8766 IP_STR
8767 BGP_STR
8768 "Clear all external peers\n"
8769 "Address family\n"
8770 "Address Family modifier\n"
8771 "Address Family modifier\n"
e0bce756 8772 BGP_SOFT_IN_STR)
718e3744 8773
01080f7c 8774ALIAS (clear_ip_bgp_instance_external_ipv4_soft_in,
8775 clear_ip_bgp_instance_external_ipv4_in_cmd,
8776 "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) in",
8777 CLEAR_STR
8778 IP_STR
8779 BGP_STR
8780 BGP_INSTANCE_HELP_STR
8781 "Clear all external peers\n"
8782 "Address family\n"
8783 "Address Family modifier\n"
8784 "Address Family modifier\n"
8785 BGP_SOFT_IN_STR)
8786
718e3744 8787DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
8788 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
8789 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
8790 CLEAR_STR
8791 IP_STR
8792 BGP_STR
8793 "Clear all external peers\n"
8794 "Address family\n"
8795 "Address Family modifier\n"
8796 "Address Family modifier\n"
e0bce756 8797 BGP_SOFT_IN_STR
718e3744 8798 "Push out prefix-list ORF and do inbound soft reconfig\n")
8799{
8800 if (strncmp (argv[0], "m", 1) == 0)
8801 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
8802 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
8803
8804 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
8805 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
8806}
8807
8808DEFUN (clear_bgp_external_soft_in,
8809 clear_bgp_external_soft_in_cmd,
8810 "clear bgp external soft in",
8811 CLEAR_STR
8812 BGP_STR
8813 "Clear all external peers\n"
e0bce756
DS
8814 BGP_SOFT_STR
8815 BGP_SOFT_IN_STR)
718e3744 8816{
01080f7c 8817 if (argc == 2)
8818 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external,
8819 BGP_CLEAR_SOFT_IN, NULL);
8820
718e3744 8821 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
8822 BGP_CLEAR_SOFT_IN, NULL);
8823}
8824
01080f7c 8825ALIAS (clear_bgp_external_soft_in,
8826 clear_bgp_instance_external_soft_in_cmd,
8827 "clear bgp " BGP_INSTANCE_CMD " external soft in",
8828 CLEAR_STR
8829 BGP_STR
8830 BGP_INSTANCE_HELP_STR
8831 "Clear all external peers\n"
8832 BGP_SOFT_STR
8833 BGP_SOFT_IN_STR)
8834
718e3744 8835ALIAS (clear_bgp_external_soft_in,
8836 clear_bgp_ipv6_external_soft_in_cmd,
8837 "clear bgp ipv6 external soft in",
8838 CLEAR_STR
8839 BGP_STR
8840 "Address family\n"
8841 "Clear all external peers\n"
e0bce756
DS
8842 BGP_SOFT_STR
8843 BGP_SOFT_IN_STR)
718e3744 8844
01080f7c 8845ALIAS (clear_bgp_external_soft_in,
8846 clear_bgp_instance_ipv6_external_soft_in_cmd,
8847 "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft in",
8848 CLEAR_STR
8849 BGP_STR
8850 BGP_INSTANCE_HELP_STR
8851 "Address family\n"
8852 "Clear all external peers\n"
8853 BGP_SOFT_STR
8854 BGP_SOFT_IN_STR)
8855
718e3744 8856ALIAS (clear_bgp_external_soft_in,
8857 clear_bgp_external_in_cmd,
8858 "clear bgp external in",
8859 CLEAR_STR
8860 BGP_STR
8861 "Clear all external peers\n"
e0bce756 8862 BGP_SOFT_IN_STR)
718e3744 8863
01080f7c 8864ALIAS (clear_bgp_external_soft_in,
8865 clear_bgp_instance_external_in_cmd,
8866 "clear bgp " BGP_INSTANCE_CMD " external in",
8867 CLEAR_STR
8868 BGP_STR
8869 BGP_INSTANCE_HELP_STR
8870 "Clear all external peers\n"
8871 BGP_SOFT_IN_STR)
8872
718e3744 8873ALIAS (clear_bgp_external_soft_in,
8874 clear_bgp_ipv6_external_in_cmd,
8875 "clear bgp ipv6 external WORD in",
8876 CLEAR_STR
8877 BGP_STR
8878 "Address family\n"
8879 "Clear all external peers\n"
e0bce756 8880 BGP_SOFT_IN_STR)
718e3744 8881
01080f7c 8882ALIAS (clear_bgp_external_soft_in,
8883 clear_bgp_instance_ipv6_external_in_cmd,
8884 "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD in",
8885 CLEAR_STR
8886 BGP_STR
8887 BGP_INSTANCE_HELP_STR
8888 "Address family\n"
8889 "Clear all external peers\n"
8890 BGP_SOFT_IN_STR)
8891
718e3744 8892DEFUN (clear_bgp_external_in_prefix_filter,
8893 clear_bgp_external_in_prefix_filter_cmd,
8894 "clear bgp external in prefix-filter",
8895 CLEAR_STR
8896 BGP_STR
8897 "Clear all external peers\n"
e0bce756 8898 BGP_SOFT_IN_STR
718e3744 8899 "Push out prefix-list ORF and do inbound soft reconfig\n")
8900{
8901 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
8902 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
8903}
8904
8905ALIAS (clear_bgp_external_in_prefix_filter,
8906 clear_bgp_ipv6_external_in_prefix_filter_cmd,
8907 "clear bgp ipv6 external in prefix-filter",
8908 CLEAR_STR
8909 BGP_STR
8910 "Address family\n"
8911 "Clear all external peers\n"
e0bce756 8912 BGP_SOFT_IN_STR
718e3744 8913 "Push out prefix-list ORF and do inbound soft reconfig\n")
8914
8915DEFUN (clear_ip_bgp_as_soft_in,
8916 clear_ip_bgp_as_soft_in_cmd,
320da874 8917 "clear ip bgp " CMD_AS_RANGE " soft in",
718e3744 8918 CLEAR_STR
8919 IP_STR
8920 BGP_STR
8921 "Clear peers with the AS number\n"
e0bce756
DS
8922 BGP_SOFT_STR
8923 BGP_SOFT_IN_STR)
718e3744 8924{
01080f7c 8925 if (argc == 3)
8926 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
8927 BGP_CLEAR_SOFT_IN, argv[2]);
8928
718e3744 8929 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
8930 BGP_CLEAR_SOFT_IN, argv[0]);
8931}
8932
8933ALIAS (clear_ip_bgp_as_soft_in,
01080f7c 8934 clear_ip_bgp_instance_as_soft_in_cmd,
8935 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in",
8936 CLEAR_STR
8937 IP_STR
8938 BGP_STR
8939 BGP_INSTANCE_HELP_STR
8940 "Clear peers with the AS number\n"
8941 BGP_SOFT_STR
8942 BGP_SOFT_IN_STR)
8943
8944ALIAS (clear_ip_bgp_as_soft_in,
8945 clear_ip_bgp_as_in_cmd,
8946 "clear ip bgp " CMD_AS_RANGE " in",
8947 CLEAR_STR
8948 IP_STR
8949 BGP_STR
8950 "Clear peers with the AS number\n"
8951 BGP_SOFT_IN_STR)
8952
8953ALIAS (clear_ip_bgp_as_soft_in,
8954 clear_ip_bgp_instance_as_in_cmd,
8955 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in",
718e3744 8956 CLEAR_STR
8957 IP_STR
8958 BGP_STR
01080f7c 8959 BGP_INSTANCE_HELP_STR
718e3744 8960 "Clear peers with the AS number\n"
e0bce756 8961 BGP_SOFT_IN_STR)
718e3744 8962
8963DEFUN (clear_ip_bgp_as_in_prefix_filter,
8964 clear_ip_bgp_as_in_prefix_filter_cmd,
320da874 8965 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
718e3744 8966 CLEAR_STR
8967 IP_STR
8968 BGP_STR
8969 "Clear peers with the AS number\n"
e0bce756 8970 BGP_SOFT_IN_STR
718e3744 8971 "Push out prefix-list ORF and do inbound soft reconfig\n")
8972{
8973 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
8974 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8975}
8976
8977DEFUN (clear_ip_bgp_as_ipv4_soft_in,
8978 clear_ip_bgp_as_ipv4_soft_in_cmd,
320da874 8979 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
718e3744 8980 CLEAR_STR
8981 IP_STR
8982 BGP_STR
8983 "Clear peers with the AS number\n"
8984 "Address family\n"
8985 "Address Family modifier\n"
8986 "Address Family modifier\n"
e0bce756
DS
8987 BGP_SOFT_STR
8988 BGP_SOFT_IN_STR)
718e3744 8989{
8990 if (strncmp (argv[1], "m", 1) == 0)
8991 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
8992 BGP_CLEAR_SOFT_IN, argv[0]);
8993
8994 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
8995 BGP_CLEAR_SOFT_IN, argv[0]);
8996}
8997
01080f7c 8998DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in,
8999 clear_ip_bgp_instance_as_ipv4_soft_in_cmd,
9000 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
9001 CLEAR_STR
9002 IP_STR
9003 BGP_STR
9004 BGP_INSTANCE_HELP_STR
9005 "Clear peers with the AS number\n"
9006 "Address family\n"
9007 "Address Family modifier\n"
9008 "Address Family modifier\n"
9009 BGP_SOFT_STR
9010 BGP_SOFT_IN_STR)
9011{
9012 if (strncmp (argv[3], "m", 1) == 0)
9013 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as,
9014 BGP_CLEAR_SOFT_IN, argv[2]);
9015
9016 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
9017 BGP_CLEAR_SOFT_IN, argv[2]);
9018}
9019
718e3744 9020ALIAS (clear_ip_bgp_as_ipv4_soft_in,
9021 clear_ip_bgp_as_ipv4_in_cmd,
320da874 9022 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
718e3744 9023 CLEAR_STR
9024 IP_STR
9025 BGP_STR
9026 "Clear peers with the AS number\n"
9027 "Address family\n"
9028 "Address Family modifier\n"
9029 "Address Family modifier\n"
e0bce756 9030 BGP_SOFT_IN_STR)
718e3744 9031
01080f7c 9032ALIAS (clear_ip_bgp_instance_as_ipv4_soft_in,
9033 clear_ip_bgp_instance_as_ipv4_in_cmd,
9034 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
9035 CLEAR_STR
9036 IP_STR
9037 BGP_STR
9038 BGP_INSTANCE_HELP_STR
9039 "Clear peers with the AS number\n"
9040 "Address family\n"
9041 "Address Family modifier\n"
9042 "Address Family modifier\n"
9043 BGP_SOFT_IN_STR)
9044
718e3744 9045DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
9046 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
320da874 9047 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
718e3744 9048 CLEAR_STR
9049 IP_STR
9050 BGP_STR
9051 "Clear peers with the AS number\n"
9052 "Address family\n"
9053 "Address Family modifier\n"
9054 "Address Family modifier\n"
e0bce756 9055 BGP_SOFT_IN_STR
718e3744 9056 "Push out prefix-list ORF and do inbound soft reconfig\n")
9057{
9058 if (strncmp (argv[1], "m", 1) == 0)
9059 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
9060 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
9061
9062 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
9063 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
9064}
9065
9066DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
9067 clear_ip_bgp_as_vpnv4_soft_in_cmd,
320da874 9068 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
718e3744 9069 CLEAR_STR
9070 IP_STR
9071 BGP_STR
9072 "Clear peers with the AS number\n"
9073 "Address family\n"
9074 "Address Family modifier\n"
e0bce756
DS
9075 BGP_SOFT_STR
9076 BGP_SOFT_IN_STR)
718e3744 9077{
9078 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
9079 BGP_CLEAR_SOFT_IN, argv[0]);
9080}
9081
9082ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
9083 clear_ip_bgp_as_vpnv4_in_cmd,
320da874 9084 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
718e3744 9085 CLEAR_STR
9086 IP_STR
9087 BGP_STR
9088 "Clear peers with the AS number\n"
9089 "Address family\n"
9090 "Address Family modifier\n"
e0bce756 9091 BGP_SOFT_IN_STR)
718e3744 9092
587ff0fd
LB
9093DEFUN (clear_ip_bgp_as_encap_soft_in,
9094 clear_ip_bgp_as_encap_soft_in_cmd,
9095 "clear ip bgp " CMD_AS_RANGE " encap unicast soft in",
9096 CLEAR_STR
9097 IP_STR
9098 BGP_STR
9099 "Clear peers with the AS number\n"
9100 "Address family\n"
9101 "Address Family modifier\n"
9102 "Soft reconfig\n"
9103 "Soft reconfig inbound update\n")
9104{
9105 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
9106 BGP_CLEAR_SOFT_IN, argv[0]);
9107}
9108
9109ALIAS (clear_ip_bgp_as_encap_soft_in,
9110 clear_ip_bgp_as_encap_in_cmd,
9111 "clear ip bgp " CMD_AS_RANGE " encap unicast in",
9112 CLEAR_STR
9113 IP_STR
9114 BGP_STR
9115 "Clear peers with the AS number\n"
9116 "Address family\n"
9117 "Address Family modifier\n"
9118 "Soft reconfig inbound update\n")
9119
718e3744 9120DEFUN (clear_bgp_as_soft_in,
9121 clear_bgp_as_soft_in_cmd,
320da874 9122 "clear bgp " CMD_AS_RANGE " soft in",
718e3744 9123 CLEAR_STR
9124 BGP_STR
9125 "Clear peers with the AS number\n"
e0bce756
DS
9126 BGP_SOFT_STR
9127 BGP_SOFT_IN_STR)
718e3744 9128{
01080f7c 9129 if (argc == 3)
9130 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as,
9131 BGP_CLEAR_SOFT_IN, argv[2]);
9132
718e3744 9133 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
9134 BGP_CLEAR_SOFT_IN, argv[0]);
9135}
9136
01080f7c 9137ALIAS (clear_bgp_as_soft_in,
9138 clear_bgp_instance_as_soft_in_cmd,
9139 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in",
9140 CLEAR_STR
9141 BGP_STR
9142 BGP_INSTANCE_HELP_STR
9143 "Clear peers with the AS number\n"
9144 BGP_SOFT_STR
9145 BGP_SOFT_IN_STR)
9146
718e3744 9147ALIAS (clear_bgp_as_soft_in,
9148 clear_bgp_ipv6_as_soft_in_cmd,
320da874 9149 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
718e3744 9150 CLEAR_STR
9151 BGP_STR
9152 "Address family\n"
9153 "Clear peers with the AS number\n"
e0bce756
DS
9154 BGP_SOFT_STR
9155 BGP_SOFT_IN_STR)
718e3744 9156
01080f7c 9157ALIAS (clear_bgp_as_soft_in,
9158 clear_bgp_instance_ipv6_as_soft_in_cmd,
9159 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft in",
9160 CLEAR_STR
9161 BGP_STR
9162 BGP_INSTANCE_HELP_STR
9163 "Address family\n"
9164 "Clear peers with the AS number\n"
9165 BGP_SOFT_STR
9166 BGP_SOFT_IN_STR)
9167
718e3744 9168ALIAS (clear_bgp_as_soft_in,
9169 clear_bgp_as_in_cmd,
320da874 9170 "clear bgp " CMD_AS_RANGE " in",
718e3744 9171 CLEAR_STR
9172 BGP_STR
9173 "Clear peers with the AS number\n"
e0bce756 9174 BGP_SOFT_IN_STR)
718e3744 9175
01080f7c 9176ALIAS (clear_bgp_as_soft_in,
9177 clear_bgp_instance_as_in_cmd,
9178 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in",
9179 CLEAR_STR
9180 BGP_STR
9181 BGP_INSTANCE_HELP_STR
9182 "Clear peers with the AS number\n"
9183 BGP_SOFT_IN_STR)
9184
718e3744 9185ALIAS (clear_bgp_as_soft_in,
9186 clear_bgp_ipv6_as_in_cmd,
320da874 9187 "clear bgp ipv6 " CMD_AS_RANGE " in",
718e3744 9188 CLEAR_STR
9189 BGP_STR
9190 "Address family\n"
9191 "Clear peers with the AS number\n"
e0bce756 9192 BGP_SOFT_IN_STR)
718e3744 9193
01080f7c 9194ALIAS (clear_bgp_as_soft_in,
9195 clear_bgp_instance_ipv6_as_in_cmd,
9196 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " in",
9197 CLEAR_STR
9198 BGP_STR
9199 BGP_INSTANCE_HELP_STR
9200 "Address family\n"
9201 "Clear peers with the AS number\n"
9202 BGP_SOFT_IN_STR)
9203
718e3744 9204DEFUN (clear_bgp_as_in_prefix_filter,
9205 clear_bgp_as_in_prefix_filter_cmd,
320da874 9206 "clear bgp " CMD_AS_RANGE " in prefix-filter",
718e3744 9207 CLEAR_STR
9208 BGP_STR
9209 "Clear peers with the AS number\n"
e0bce756 9210 BGP_SOFT_IN_STR
718e3744 9211 "Push out prefix-list ORF and do inbound soft reconfig\n")
9212{
9213 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
9214 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
9215}
9216
9217ALIAS (clear_bgp_as_in_prefix_filter,
9218 clear_bgp_ipv6_as_in_prefix_filter_cmd,
320da874 9219 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
718e3744 9220 CLEAR_STR
9221 BGP_STR
9222 "Address family\n"
9223 "Clear peers with the AS number\n"
e0bce756 9224 BGP_SOFT_IN_STR
718e3744 9225 "Push out prefix-list ORF and do inbound soft reconfig\n")
6b0655a2 9226
718e3744 9227/* Both soft-reconfiguration */
9228DEFUN (clear_ip_bgp_all_soft,
9229 clear_ip_bgp_all_soft_cmd,
9230 "clear ip bgp * soft",
9231 CLEAR_STR
9232 IP_STR
9233 BGP_STR
9234 "Clear all peers\n"
e0bce756 9235 BGP_SOFT_STR)
718e3744 9236{
6aeb9e78
DS
9237 if (argc == 2)
9238 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
718e3744 9239 BGP_CLEAR_SOFT_BOTH, NULL);
9240
9241 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
9242 BGP_CLEAR_SOFT_BOTH, NULL);
9243}
9244
9245ALIAS (clear_ip_bgp_all_soft,
9246 clear_ip_bgp_instance_all_soft_cmd,
8386ac43 9247 "clear ip bgp " BGP_INSTANCE_CMD " * soft",
718e3744 9248 CLEAR_STR
9249 IP_STR
9250 BGP_STR
8386ac43 9251 BGP_INSTANCE_HELP_STR
718e3744 9252 "Clear all peers\n"
e0bce756 9253 BGP_SOFT_STR)
718e3744 9254
9255
9256DEFUN (clear_ip_bgp_all_ipv4_soft,
9257 clear_ip_bgp_all_ipv4_soft_cmd,
9258 "clear ip bgp * ipv4 (unicast|multicast) soft",
9259 CLEAR_STR
9260 IP_STR
9261 BGP_STR
9262 "Clear all peers\n"
9263 "Address family\n"
9264 "Address Family Modifier\n"
9265 "Address Family Modifier\n"
e0bce756 9266 BGP_SOFT_STR)
718e3744 9267{
9268 if (strncmp (argv[0], "m", 1) == 0)
9269 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
9270 BGP_CLEAR_SOFT_BOTH, NULL);
9271
9272 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
9273 BGP_CLEAR_SOFT_BOTH, NULL);
9274}
9275
9276DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
9277 clear_ip_bgp_instance_all_ipv4_soft_cmd,
8386ac43 9278 "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft",
718e3744 9279 CLEAR_STR
9280 IP_STR
9281 BGP_STR
8386ac43 9282 BGP_INSTANCE_HELP_STR
718e3744 9283 "Clear all peers\n"
9284 "Address family\n"
9285 "Address Family Modifier\n"
9286 "Address Family Modifier\n"
e0bce756 9287 BGP_SOFT_STR)
718e3744 9288{
6aeb9e78
DS
9289 if (strncmp (argv[2], "m", 1) == 0)
9290 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all,
718e3744 9291 BGP_CLEAR_SOFT_BOTH, NULL);
9292
9293 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
9294 BGP_CLEAR_SOFT_BOTH, NULL);
9295}
9296
9297DEFUN (clear_ip_bgp_all_vpnv4_soft,
9298 clear_ip_bgp_all_vpnv4_soft_cmd,
9299 "clear ip bgp * vpnv4 unicast soft",
9300 CLEAR_STR
9301 IP_STR
9302 BGP_STR
9303 "Clear all peers\n"
9304 "Address family\n"
9305 "Address Family Modifier\n"
e0bce756 9306 BGP_SOFT_STR)
718e3744 9307{
9308 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
9309 BGP_CLEAR_SOFT_BOTH, argv[0]);
9310}
9311
587ff0fd
LB
9312DEFUN (clear_ip_bgp_all_encap_soft,
9313 clear_ip_bgp_all_encap_soft_cmd,
9314 "clear ip bgp * encap unicast soft",
9315 CLEAR_STR
9316 IP_STR
9317 BGP_STR
9318 "Clear all peers\n"
9319 "Address family\n"
9320 "Address Family Modifier\n"
9321 "Soft reconfig\n")
9322{
9323 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
9324 BGP_CLEAR_SOFT_BOTH, argv[0]);
9325}
9326
718e3744 9327DEFUN (clear_bgp_all_soft,
9328 clear_bgp_all_soft_cmd,
9329 "clear bgp * soft",
9330 CLEAR_STR
9331 BGP_STR
9332 "Clear all peers\n"
e0bce756 9333 BGP_SOFT_STR)
718e3744 9334{
6aeb9e78
DS
9335 if (argc == 2)
9336 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all,
01080f7c 9337 BGP_CLEAR_SOFT_BOTH, NULL);
718e3744 9338
9339 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
01080f7c 9340 BGP_CLEAR_SOFT_BOTH, NULL);
718e3744 9341}
9342
9343ALIAS (clear_bgp_all_soft,
9344 clear_bgp_instance_all_soft_cmd,
8386ac43 9345 "clear bgp " BGP_INSTANCE_CMD " * soft",
718e3744 9346 CLEAR_STR
9347 BGP_STR
8386ac43 9348 BGP_INSTANCE_HELP_STR
718e3744 9349 "Clear all peers\n"
e0bce756 9350 BGP_SOFT_STR)
718e3744 9351
9352ALIAS (clear_bgp_all_soft,
9353 clear_bgp_ipv6_all_soft_cmd,
9354 "clear bgp ipv6 * soft",
9355 CLEAR_STR
9356 BGP_STR
9357 "Address family\n"
9358 "Clear all peers\n"
e0bce756 9359 BGP_SOFT_STR)
718e3744 9360
01080f7c 9361ALIAS (clear_bgp_all_soft,
9362 clear_bgp_instance_ipv6_all_soft_cmd,
9363 "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft",
9364 CLEAR_STR
9365 BGP_STR
9366 BGP_INSTANCE_HELP_STR
9367 "Address family\n"
9368 "Clear all peers\n"
9369 BGP_SOFT_STR)
9370
718e3744 9371DEFUN (clear_ip_bgp_peer_soft,
9372 clear_ip_bgp_peer_soft_cmd,
db64ea86 9373 "clear ip bgp (A.B.C.D|WORD) soft",
718e3744 9374 CLEAR_STR
9375 IP_STR
9376 BGP_STR
9377 "BGP neighbor address to clear\n"
db64ea86 9378 "BGP neighbor on interface to clear\n"
e0bce756 9379 BGP_SOFT_STR)
718e3744 9380{
01080f7c 9381 if (argc == 3)
9382 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
9383 BGP_CLEAR_SOFT_BOTH, argv[2]);
9384
718e3744 9385 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
9386 BGP_CLEAR_SOFT_BOTH, argv[0]);
9387}
9388
01080f7c 9389ALIAS (clear_ip_bgp_peer_soft,
9390 clear_ip_bgp_instance_peer_soft_cmd,
9391 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft",
9392 CLEAR_STR
9393 IP_STR
9394 BGP_STR
9395 BGP_INSTANCE_HELP_STR
9396 "BGP neighbor address to clear\n"
9397 "BGP neighbor on interface to clear\n"
9398 BGP_SOFT_STR)
9399
718e3744 9400DEFUN (clear_ip_bgp_peer_ipv4_soft,
9401 clear_ip_bgp_peer_ipv4_soft_cmd,
db64ea86 9402 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft",
718e3744 9403 CLEAR_STR
9404 IP_STR
9405 BGP_STR
9406 "BGP neighbor address to clear\n"
db64ea86 9407 "BGP neighbor on interface to clear\n"
718e3744 9408 "Address family\n"
9409 "Address Family Modifier\n"
9410 "Address Family Modifier\n"
e0bce756 9411 BGP_SOFT_STR)
718e3744 9412{
9413 if (strncmp (argv[1], "m", 1) == 0)
9414 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
9415 BGP_CLEAR_SOFT_BOTH, argv[0]);
9416
9417 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
9418 BGP_CLEAR_SOFT_BOTH, argv[0]);
9419}
9420
01080f7c 9421DEFUN (clear_ip_bgp_instance_peer_ipv4_soft,
9422 clear_ip_bgp_instance_peer_ipv4_soft_cmd,
9423 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft",
9424 CLEAR_STR
9425 IP_STR
9426 BGP_STR
9427 BGP_INSTANCE_HELP_STR
9428 "BGP neighbor address to clear\n"
9429 "BGP neighbor on interface to clear\n"
9430 "Address family\n"
9431 "Address Family Modifier\n"
9432 "Address Family Modifier\n"
9433 BGP_SOFT_STR)
9434{
9435 if (strncmp (argv[3], "m", 1) == 0)
9436 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer,
9437 BGP_CLEAR_SOFT_BOTH, argv[2]);
9438
9439 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
9440 BGP_CLEAR_SOFT_BOTH, argv[2]);
9441}
9442
718e3744 9443DEFUN (clear_ip_bgp_peer_vpnv4_soft,
9444 clear_ip_bgp_peer_vpnv4_soft_cmd,
db64ea86 9445 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft",
718e3744 9446 CLEAR_STR
9447 IP_STR
9448 BGP_STR
9449 "BGP neighbor address to clear\n"
db64ea86 9450 "BGP neighbor on interface to clear\n"
718e3744 9451 "Address family\n"
9452 "Address Family Modifier\n"
e0bce756 9453 BGP_SOFT_STR)
718e3744 9454{
9455 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
9456 BGP_CLEAR_SOFT_BOTH, argv[0]);
9457}
9458
587ff0fd
LB
9459DEFUN (clear_ip_bgp_peer_encap_soft,
9460 clear_ip_bgp_peer_encap_soft_cmd,
9461 "clear ip bgp A.B.C.D encap unicast soft",
9462 CLEAR_STR
9463 IP_STR
9464 BGP_STR
9465 "BGP neighbor address to clear\n"
9466 "Address family\n"
9467 "Address Family Modifier\n"
9468 "Soft reconfig\n")
9469{
9470 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
9471 BGP_CLEAR_SOFT_BOTH, argv[0]);
9472}
9473
718e3744 9474DEFUN (clear_bgp_peer_soft,
9475 clear_bgp_peer_soft_cmd,
a80beece 9476 "clear bgp (A.B.C.D|X:X::X:X|WORD) soft",
718e3744 9477 CLEAR_STR
9478 BGP_STR
9479 "BGP neighbor address to clear\n"
9480 "BGP IPv6 neighbor to clear\n"
a80beece 9481 "BGP neighbor on interface to clear\n"
e0bce756 9482 BGP_SOFT_STR)
718e3744 9483{
01080f7c 9484 if (argc == 3)
9485 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer,
9486 BGP_CLEAR_SOFT_BOTH, argv[2]);
9487
718e3744 9488 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
9489 BGP_CLEAR_SOFT_BOTH, argv[0]);
9490}
9491
01080f7c 9492ALIAS (clear_bgp_peer_soft,
9493 clear_bgp_instance_peer_soft_cmd,
9494 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft",
9495 CLEAR_STR
9496 BGP_STR
9497 BGP_INSTANCE_HELP_STR
9498 "BGP neighbor address to clear\n"
9499 "BGP IPv6 neighbor to clear\n"
9500 "BGP neighbor on interface to clear\n"
9501 BGP_SOFT_STR)
9502
718e3744 9503ALIAS (clear_bgp_peer_soft,
9504 clear_bgp_ipv6_peer_soft_cmd,
a80beece 9505 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft",
718e3744 9506 CLEAR_STR
9507 BGP_STR
9508 "Address family\n"
9509 "BGP neighbor address to clear\n"
9510 "BGP IPv6 neighbor to clear\n"
a80beece 9511 "BGP neighbor on interface to clear\n"
e0bce756 9512 BGP_SOFT_STR)
718e3744 9513
01080f7c 9514ALIAS (clear_bgp_peer_soft,
9515 clear_bgp_instance_ipv6_peer_soft_cmd,
9516 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft",
9517 CLEAR_STR
9518 BGP_STR
9519 BGP_INSTANCE_HELP_STR
9520 "Address family\n"
9521 "BGP neighbor address to clear\n"
9522 "BGP IPv6 neighbor to clear\n"
9523 "BGP neighbor on interface to clear\n"
9524 BGP_SOFT_STR)
9525
718e3744 9526DEFUN (clear_ip_bgp_peer_group_soft,
9527 clear_ip_bgp_peer_group_soft_cmd,
9528 "clear ip bgp peer-group WORD soft",
9529 CLEAR_STR
9530 IP_STR
9531 BGP_STR
9532 "Clear all members of peer-group\n"
9533 "BGP peer-group name\n"
e0bce756 9534 BGP_SOFT_STR)
718e3744 9535{
01080f7c 9536 if (argc == 3)
9537 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
9538 BGP_CLEAR_SOFT_BOTH, argv[2]);
9539
718e3744 9540 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
9541 BGP_CLEAR_SOFT_BOTH, argv[0]);
9542}
9543
01080f7c 9544ALIAS (clear_ip_bgp_peer_group_soft,
9545 clear_ip_bgp_instance_peer_group_soft_cmd,
9546 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft",
9547 CLEAR_STR
9548 IP_STR
9549 BGP_STR
9550 BGP_INSTANCE_HELP_STR
9551 "Clear all members of peer-group\n"
9552 "BGP peer-group name\n"
9553 BGP_SOFT_STR)
9554
718e3744 9555DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
9556 clear_ip_bgp_peer_group_ipv4_soft_cmd,
9557 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
9558 CLEAR_STR
9559 IP_STR
9560 BGP_STR
9561 "Clear all members of peer-group\n"
9562 "BGP peer-group name\n"
9563 "Address family\n"
9564 "Address Family modifier\n"
9565 "Address Family modifier\n"
e0bce756 9566 BGP_SOFT_STR)
718e3744 9567{
9568 if (strncmp (argv[1], "m", 1) == 0)
9569 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
9570 BGP_CLEAR_SOFT_BOTH, argv[0]);
9571
9572 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
9573 BGP_CLEAR_SOFT_BOTH, argv[0]);
9574}
9575
01080f7c 9576DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft,
9577 clear_ip_bgp_instance_peer_group_ipv4_soft_cmd,
9578 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft",
9579 CLEAR_STR
9580 IP_STR
9581 BGP_STR
9582 BGP_INSTANCE_HELP_STR
9583 "Clear all members of peer-group\n"
9584 "BGP peer-group name\n"
9585 "Address family\n"
9586 "Address Family modifier\n"
9587 "Address Family modifier\n"
9588 BGP_SOFT_STR)
9589{
9590 if (strncmp (argv[3], "m", 1) == 0)
9591 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group,
9592 BGP_CLEAR_SOFT_BOTH, argv[2]);
9593
9594 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
9595 BGP_CLEAR_SOFT_BOTH, argv[2]);
9596}
9597
718e3744 9598DEFUN (clear_bgp_peer_group_soft,
9599 clear_bgp_peer_group_soft_cmd,
9600 "clear bgp peer-group WORD soft",
9601 CLEAR_STR
9602 BGP_STR
9603 "Clear all members of peer-group\n"
9604 "BGP peer-group name\n"
e0bce756 9605 BGP_SOFT_STR)
718e3744 9606{
01080f7c 9607 if (argc == 3)
9608 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group,
9609 BGP_CLEAR_SOFT_BOTH, argv[2]);
9610
718e3744 9611 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
9612 BGP_CLEAR_SOFT_BOTH, argv[0]);
9613}
9614
01080f7c 9615ALIAS (clear_bgp_peer_group_soft,
9616 clear_bgp_instance_peer_group_soft_cmd,
9617 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft",
9618 CLEAR_STR
9619 BGP_STR
9620 BGP_INSTANCE_HELP_STR
9621 "Clear all members of peer-group\n"
9622 "BGP peer-group name\n"
9623 BGP_SOFT_STR)
9624
718e3744 9625ALIAS (clear_bgp_peer_group_soft,
9626 clear_bgp_ipv6_peer_group_soft_cmd,
9627 "clear bgp ipv6 peer-group WORD soft",
9628 CLEAR_STR
9629 BGP_STR
9630 "Address family\n"
9631 "Clear all members of peer-group\n"
9632 "BGP peer-group name\n"
e0bce756 9633 BGP_SOFT_STR)
718e3744 9634
01080f7c 9635ALIAS (clear_bgp_peer_group_soft,
9636 clear_bgp_instance_ipv6_peer_group_soft_cmd,
9637 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft",
9638 CLEAR_STR
9639 BGP_STR
9640 BGP_INSTANCE_HELP_STR
9641 "Address family\n"
9642 "Clear all members of peer-group\n"
9643 "BGP peer-group name\n"
9644 BGP_SOFT_STR)
9645
718e3744 9646DEFUN (clear_ip_bgp_external_soft,
9647 clear_ip_bgp_external_soft_cmd,
9648 "clear ip bgp external soft",
9649 CLEAR_STR
9650 IP_STR
9651 BGP_STR
9652 "Clear all external peers\n"
e0bce756 9653 BGP_SOFT_STR)
718e3744 9654{
01080f7c 9655 if (argc == 2)
9656 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
9657 BGP_CLEAR_SOFT_BOTH, NULL);
9658
718e3744 9659 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
9660 BGP_CLEAR_SOFT_BOTH, NULL);
9661}
9662
01080f7c 9663ALIAS (clear_ip_bgp_external_soft,
9664 clear_ip_bgp_instance_external_soft_cmd,
9665 "clear ip bgp " BGP_INSTANCE_CMD " external soft",
9666 CLEAR_STR
9667 IP_STR
9668 BGP_STR
9669 BGP_INSTANCE_HELP_STR
9670 "Clear all external peers\n"
9671 BGP_SOFT_STR)
9672
718e3744 9673DEFUN (clear_ip_bgp_external_ipv4_soft,
9674 clear_ip_bgp_external_ipv4_soft_cmd,
9675 "clear ip bgp external ipv4 (unicast|multicast) soft",
9676 CLEAR_STR
9677 IP_STR
9678 BGP_STR
9679 "Clear all external peers\n"
9680 "Address family\n"
9681 "Address Family modifier\n"
9682 "Address Family modifier\n"
e0bce756 9683 BGP_SOFT_STR)
718e3744 9684{
9685 if (strncmp (argv[0], "m", 1) == 0)
9686 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
9687 BGP_CLEAR_SOFT_BOTH, NULL);
9688
9689 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
9690 BGP_CLEAR_SOFT_BOTH, NULL);
9691}
9692
01080f7c 9693DEFUN (clear_ip_bgp_instance_external_ipv4_soft,
9694 clear_ip_bgp_instance_external_ipv4_soft_cmd,
9695 "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft",
9696 CLEAR_STR
9697 IP_STR
9698 BGP_STR
9699 BGP_INSTANCE_HELP_STR
9700 "Clear all external peers\n"
9701 "Address family\n"
9702 "Address Family modifier\n"
9703 "Address Family modifier\n"
9704 BGP_SOFT_STR)
9705{
9706 if (strncmp (argv[2], "m", 1) == 0)
9707 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external,
9708 BGP_CLEAR_SOFT_BOTH, NULL);
9709
9710 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
9711 BGP_CLEAR_SOFT_BOTH, NULL);
9712}
9713
718e3744 9714DEFUN (clear_bgp_external_soft,
9715 clear_bgp_external_soft_cmd,
9716 "clear bgp external soft",
9717 CLEAR_STR
9718 BGP_STR
9719 "Clear all external peers\n"
e0bce756 9720 BGP_SOFT_STR)
718e3744 9721{
01080f7c 9722 if (argc == 2)
9723 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external,
9724 BGP_CLEAR_SOFT_BOTH, NULL);
9725
718e3744 9726 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
9727 BGP_CLEAR_SOFT_BOTH, NULL);
9728}
9729
01080f7c 9730ALIAS (clear_bgp_external_soft,
9731 clear_bgp_instance_external_soft_cmd,
9732 "clear bgp " BGP_INSTANCE_CMD " external soft",
9733 CLEAR_STR
9734 BGP_STR
9735 BGP_INSTANCE_HELP_STR
9736 "Clear all external peers\n"
9737 BGP_SOFT_STR)
9738
718e3744 9739ALIAS (clear_bgp_external_soft,
9740 clear_bgp_ipv6_external_soft_cmd,
9741 "clear bgp ipv6 external soft",
9742 CLEAR_STR
9743 BGP_STR
9744 "Address family\n"
9745 "Clear all external peers\n"
e0bce756 9746 BGP_SOFT_STR)
718e3744 9747
01080f7c 9748ALIAS (clear_bgp_external_soft,
9749 clear_bgp_instance_ipv6_external_soft_cmd,
9750 "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft",
9751 CLEAR_STR
9752 BGP_STR
9753 BGP_INSTANCE_HELP_STR
9754 "Address family\n"
9755 "Clear all external peers\n"
9756 BGP_SOFT_STR)
9757
718e3744 9758DEFUN (clear_ip_bgp_as_soft,
9759 clear_ip_bgp_as_soft_cmd,
320da874 9760 "clear ip bgp " CMD_AS_RANGE " soft",
718e3744 9761 CLEAR_STR
9762 IP_STR
9763 BGP_STR
9764 "Clear peers with the AS number\n"
e0bce756 9765 BGP_SOFT_STR)
718e3744 9766{
01080f7c 9767 if (argc == 3)
9768 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
9769 BGP_CLEAR_SOFT_BOTH, argv[2]);
9770
718e3744 9771 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
9772 BGP_CLEAR_SOFT_BOTH, argv[0]);
9773}
9774
01080f7c 9775ALIAS (clear_ip_bgp_as_soft,
9776 clear_ip_bgp_instance_as_soft_cmd,
9777 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft",
9778 CLEAR_STR
9779 IP_STR
9780 BGP_STR
9781 BGP_INSTANCE_HELP_STR
9782 "Clear peers with the AS number\n"
9783 BGP_SOFT_STR)
9784
718e3744 9785DEFUN (clear_ip_bgp_as_ipv4_soft,
9786 clear_ip_bgp_as_ipv4_soft_cmd,
320da874 9787 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
718e3744 9788 CLEAR_STR
9789 IP_STR
9790 BGP_STR
9791 "Clear peers with the AS number\n"
9792 "Address family\n"
9793 "Address Family Modifier\n"
9794 "Address Family Modifier\n"
e0bce756 9795 BGP_SOFT_STR)
718e3744 9796{
9797 if (strncmp (argv[1], "m", 1) == 0)
9798 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
9799 BGP_CLEAR_SOFT_BOTH, argv[0]);
9800
9801 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
9802 BGP_CLEAR_SOFT_BOTH, argv[0]);
9803}
9804
01080f7c 9805DEFUN (clear_ip_bgp_instance_as_ipv4_soft,
9806 clear_ip_bgp_instance_as_ipv4_soft_cmd,
9807 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
9808 CLEAR_STR
9809 IP_STR
9810 BGP_STR
9811 BGP_INSTANCE_HELP_STR
9812 "Clear peers with the AS number\n"
9813 "Address family\n"
9814 "Address Family Modifier\n"
9815 "Address Family Modifier\n"
9816 BGP_SOFT_STR)
9817{
9818 if (strncmp (argv[3], "m", 1) == 0)
9819 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as,
9820 BGP_CLEAR_SOFT_BOTH, argv[2]);
9821
9822 return bgp_clear_vty (vty, argv[1],AFI_IP, SAFI_UNICAST, clear_as,
9823 BGP_CLEAR_SOFT_BOTH, argv[2]);
9824}
9825
718e3744 9826DEFUN (clear_ip_bgp_as_vpnv4_soft,
9827 clear_ip_bgp_as_vpnv4_soft_cmd,
320da874 9828 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
718e3744 9829 CLEAR_STR
9830 IP_STR
9831 BGP_STR
9832 "Clear peers with the AS number\n"
9833 "Address family\n"
9834 "Address Family Modifier\n"
e0bce756 9835 BGP_SOFT_STR)
718e3744 9836{
9837 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
9838 BGP_CLEAR_SOFT_BOTH, argv[0]);
9839}
9840
587ff0fd
LB
9841DEFUN (clear_ip_bgp_as_encap_soft,
9842 clear_ip_bgp_as_encap_soft_cmd,
9843 "clear ip bgp " CMD_AS_RANGE " encap unicast soft",
9844 CLEAR_STR
9845 IP_STR
9846 BGP_STR
9847 "Clear peers with the AS number\n"
9848 "Address family\n"
9849 "Address Family Modifier\n"
9850 "Soft reconfig\n")
9851{
9852 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
9853 BGP_CLEAR_SOFT_BOTH, argv[0]);
9854}
9855
718e3744 9856DEFUN (clear_bgp_as_soft,
9857 clear_bgp_as_soft_cmd,
320da874 9858 "clear bgp " CMD_AS_RANGE " soft",
718e3744 9859 CLEAR_STR
9860 BGP_STR
9861 "Clear peers with the AS number\n"
e0bce756 9862 BGP_SOFT_STR)
718e3744 9863{
01080f7c 9864 if (argc == 3)
9865 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as,
9866 BGP_CLEAR_SOFT_BOTH, argv[2]);
9867
718e3744 9868 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
9869 BGP_CLEAR_SOFT_BOTH, argv[0]);
9870}
9871
01080f7c 9872ALIAS (clear_bgp_as_soft,
9873 clear_bgp_instance_as_soft_cmd,
9874 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft",
9875 CLEAR_STR
9876 BGP_STR
9877 BGP_INSTANCE_HELP_STR
9878 "Clear peers with the AS number\n"
9879 BGP_SOFT_STR)
9880
718e3744 9881ALIAS (clear_bgp_as_soft,
9882 clear_bgp_ipv6_as_soft_cmd,
320da874 9883 "clear bgp ipv6 " CMD_AS_RANGE " soft",
718e3744 9884 CLEAR_STR
9885 BGP_STR
9886 "Address family\n"
9887 "Clear peers with the AS number\n"
e0bce756 9888 BGP_SOFT_STR)
6b0655a2 9889
01080f7c 9890ALIAS (clear_bgp_as_soft,
9891 clear_bgp_instance_ipv6_as_soft_cmd,
9892 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft",
9893 CLEAR_STR
9894 BGP_STR
9895 BGP_INSTANCE_HELP_STR
9896 "Address family\n"
9897 "Clear peers with the AS number\n"
9898 BGP_SOFT_STR)
9899
e0081f70
ML
9900DEFUN (show_bgp_views,
9901 show_bgp_views_cmd,
9902 "show bgp views",
9903 SHOW_STR
9904 BGP_STR
9905 "Show the defined BGP views\n")
9906{
9907 struct list *inst = bm->bgp;
9908 struct listnode *node;
9909 struct bgp *bgp;
9910
9911 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
9912 {
8386ac43 9913 vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE);
e0081f70
ML
9914 return CMD_WARNING;
9915 }
9916
9917 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
9918 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
8386ac43 9919 {
9920 /* Skip VRFs. */
9921 if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF)
9922 continue;
9923 vty_out (vty, "\t%s (AS%u)%s",
9924 bgp->name ? bgp->name : "(null)",
9925 bgp->as, VTY_NEWLINE);
9926 }
e0081f70
ML
9927
9928 return CMD_SUCCESS;
9929}
9930
8386ac43 9931DEFUN (show_bgp_vrfs,
9932 show_bgp_vrfs_cmd,
9933 "show bgp vrfs {json}",
9934 SHOW_STR
9935 BGP_STR
9936 "Show BGP VRFs\n"
9937 "JavaScript Object Notation\n")
9938{
9939 struct list *inst = bm->bgp;
9940 struct listnode *node;
9941 struct bgp *bgp;
9942 u_char uj = use_json(argc, argv);
9943 json_object *json = NULL;
9944 json_object *json_vrfs = NULL;
9945 int count = 0;
9946 static char header[] = "Type Id RouterId #PeersCfg #PeersEstb Name";
9947
9948 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
9949 {
9950 vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE);
9951 return CMD_WARNING;
9952 }
9953
9954 if (uj)
9955 {
9956 json = json_object_new_object();
9957 json_vrfs = json_object_new_object();
9958 }
9959
9960 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
9961 {
9962 const char *name, *type;
9963 struct peer *peer;
9964 struct listnode *node, *nnode;
9965 int peers_cfg, peers_estb;
9966 json_object *json_vrf = NULL;
5c81a5f3 9967 int vrf_id_ui;
8386ac43 9968
9969 /* Skip Views. */
9970 if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
9971 continue;
9972
9973 count++;
9974 if (!uj && count == 1)
9975 vty_out (vty, "%s%s", header, VTY_NEWLINE);
9976
9977 peers_cfg = peers_estb = 0;
9978 if (uj)
9979 json_vrf = json_object_new_object();
9980
9981
9982 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
9983 {
9984 if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
9985 continue;
9986 peers_cfg++;
9987 if (peer->status == Established)
9988 peers_estb++;
9989 }
9990
9991 if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
9992 {
9993 name = "Default";
9994 type = "DFLT";
9995 }
9996 else
9997 {
9998 name = bgp->name;
9999 type = "VRF";
10000 }
10001
5c81a5f3 10002 vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id;
8386ac43 10003 if (uj)
10004 {
10005 json_object_string_add(json_vrf, "type", type);
5c81a5f3 10006 json_object_int_add(json_vrf, "vrfId", vrf_id_ui);
8386ac43 10007 json_object_string_add(json_vrf, "routerId", inet_ntoa (bgp->router_id));
10008 json_object_int_add(json_vrf, "numConfiguredPeers", peers_cfg);
10009 json_object_int_add(json_vrf, "numEstablishedPeers", peers_estb);
10010
10011 json_object_object_add(json_vrfs, name, json_vrf);
10012 }
10013 else
5c81a5f3 10014 vty_out (vty, "%4s %-5d %-16s %9u %10u %s%s",
10015 type, vrf_id_ui, inet_ntoa (bgp->router_id),
8386ac43 10016 peers_cfg, peers_estb, name,
10017 VTY_NEWLINE);
10018 }
10019
10020 if (uj)
10021 {
10022 json_object_object_add(json, "vrfs", json_vrfs);
10023
10024 json_object_int_add(json, "totalVrfs", count);
10025
10026 vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
10027 json_object_free(json);
10028 }
10029 else
10030 {
10031 if (count)
10032 vty_out (vty, "%sTotal number of VRFs (including default): %d%s",
10033 VTY_NEWLINE, count, VTY_NEWLINE);
10034 }
10035
10036 return CMD_SUCCESS;
10037}
10038
4bf6a362
PJ
10039DEFUN (show_bgp_memory,
10040 show_bgp_memory_cmd,
10041 "show bgp memory",
10042 SHOW_STR
10043 BGP_STR
10044 "Global BGP memory statistics\n")
10045{
10046 char memstrbuf[MTYPE_MEMSTR_LEN];
10047 unsigned long count;
10048
10049 /* RIB related usage stats */
10050 count = mtype_stats_alloc (MTYPE_BGP_NODE);
10051 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
10052 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10053 count * sizeof (struct bgp_node)),
10054 VTY_NEWLINE);
10055
10056 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
10057 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
10058 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10059 count * sizeof (struct bgp_info)),
10060 VTY_NEWLINE);
fb982c25
PJ
10061 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
10062 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
10063 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10064 count * sizeof (struct bgp_info_extra)),
10065 VTY_NEWLINE);
4bf6a362
PJ
10066
10067 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
10068 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
10069 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10070 count * sizeof (struct bgp_static)),
10071 VTY_NEWLINE);
3f9c7369
DS
10072
10073 if ((count = mtype_stats_alloc (MTYPE_BGP_PACKET)))
10074 vty_out (vty, "%ld Packets, using %s of memory%s", count,
10075 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10076 count * sizeof (struct bpacket)),
10077 VTY_NEWLINE);
4bf6a362
PJ
10078
10079 /* Adj-In/Out */
10080 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
10081 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
10082 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10083 count * sizeof (struct bgp_adj_in)),
10084 VTY_NEWLINE);
10085 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
10086 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
10087 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10088 count * sizeof (struct bgp_adj_out)),
10089 VTY_NEWLINE);
10090
10091 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
10092 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
10093 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10094 count * sizeof (struct bgp_nexthop_cache)),
10095 VTY_NEWLINE);
10096
10097 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
10098 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
10099 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10100 count * sizeof (struct bgp_damp_info)),
10101 VTY_NEWLINE);
10102
10103 /* Attributes */
10104 count = attr_count();
10105 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
10106 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10107 count * sizeof(struct attr)),
10108 VTY_NEWLINE);
fb982c25
PJ
10109 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
10110 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
10111 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10112 count * sizeof(struct attr_extra)),
10113 VTY_NEWLINE);
4bf6a362
PJ
10114
10115 if ((count = attr_unknown_count()))
10116 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
10117
10118 /* AS_PATH attributes */
10119 count = aspath_count ();
10120 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
10121 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10122 count * sizeof (struct aspath)),
10123 VTY_NEWLINE);
10124
10125 count = mtype_stats_alloc (MTYPE_AS_SEG);
10126 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
10127 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10128 count * sizeof (struct assegment)),
10129 VTY_NEWLINE);
10130
10131 /* Other attributes */
10132 if ((count = community_count ()))
10133 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
10134 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10135 count * sizeof (struct community)),
10136 VTY_NEWLINE);
10137 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
10138 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
10139 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10140 count * sizeof (struct ecommunity)),
10141 VTY_NEWLINE);
10142
10143 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
10144 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
10145 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10146 count * sizeof (struct cluster_list)),
10147 VTY_NEWLINE);
10148
10149 /* Peer related usage */
10150 count = mtype_stats_alloc (MTYPE_BGP_PEER);
10151 vty_out (vty, "%ld peers, using %s of memory%s", count,
10152 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10153 count * sizeof (struct peer)),
10154 VTY_NEWLINE);
10155
6e919709 10156 if ((count = mtype_stats_alloc (MTYPE_BGP_PEER_GROUP)))
4bf6a362
PJ
10157 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
10158 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10159 count * sizeof (struct peer_group)),
10160 VTY_NEWLINE);
10161
10162 /* Other */
10163 if ((count = mtype_stats_alloc (MTYPE_HASH)))
10164 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
10165 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10166 count * sizeof (struct hash)),
10167 VTY_NEWLINE);
10168 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
10169 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
10170 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10171 count * sizeof (struct hash_backet)),
10172 VTY_NEWLINE);
10173 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
10174 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
10175 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10176 count * sizeof (regex_t)),
10177 VTY_NEWLINE);
10178 return CMD_SUCCESS;
10179}
fee0f4c6 10180
718e3744 10181/* Show BGP peer's summary information. */
94f2b392 10182static int
b05a1c8b 10183bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi,
9f689658 10184 u_char use_json, json_object *json)
718e3744 10185{
10186 struct peer *peer;
1eb8ef25 10187 struct listnode *node, *nnode;
f14e6fdb
DS
10188 unsigned int count = 0, dn_count = 0;
10189 char timebuf[BGP_UPTIME_LEN], dn_flag[2];
718e3744 10190 int len;
ffd0c037
DS
10191 json_object *json_peer = NULL;
10192 json_object *json_peers = NULL;
718e3744 10193
10194 /* Header string for each address family. */
4a7ac06c 10195 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
47fc97cc 10196
b05a1c8b
DS
10197 if (use_json)
10198 {
9f689658
DD
10199 if (json == NULL)
10200 json = json_object_new_object();
10201
f1aa5d8a 10202 json_peers = json_object_new_object();
b05a1c8b
DS
10203 }
10204
1eb8ef25 10205 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
718e3744 10206 {
1ff9a340
DS
10207 if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
10208 continue;
10209
718e3744 10210 if (peer->afc[afi][safi])
10211 {
b05a1c8b 10212 if (!count)
4bf6a362
PJ
10213 {
10214 unsigned long ents;
10215 char memstrbuf[MTYPE_MEMSTR_LEN];
5c81a5f3 10216 int vrf_id_ui;
10217
10218 vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id;
b05a1c8b 10219
4bf6a362 10220 /* Usage summary and header */
b05a1c8b
DS
10221 if (use_json)
10222 {
62d6dca0 10223 json_object_string_add(json, "routerId", inet_ntoa (bgp->router_id));
f1aa5d8a 10224 json_object_int_add(json, "as", bgp->as);
9f689658
DD
10225 json_object_int_add(json, "vrfId", vrf_id_ui);
10226 json_object_string_add(json, "vrfName",
10227 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
10228 ? "Default" : bgp->name);
b05a1c8b
DS
10229 }
10230 else
10231 {
10232 vty_out (vty,
5c81a5f3 10233 "BGP router identifier %s, local AS number %u vrf-id %d",
10234 inet_ntoa (bgp->router_id), bgp->as, vrf_id_ui);
6aeb9e78 10235 vty_out (vty, "%s", VTY_NEWLINE);
b05a1c8b
DS
10236 }
10237
f188f2c4
DS
10238 if (bgp_update_delay_configured(bgp))
10239 {
b05a1c8b 10240 if (use_json)
f188f2c4 10241 {
62d6dca0 10242 json_object_int_add(json, "updateDelayLimit", bgp->v_update_delay);
b05a1c8b
DS
10243
10244 if (bgp->v_update_delay != bgp->v_establish_wait)
62d6dca0 10245 json_object_int_add(json, "updateDelayEstablishWait", bgp->v_establish_wait);
b05a1c8b
DS
10246
10247 if (bgp_update_delay_active(bgp))
10248 {
62d6dca0
DS
10249 json_object_string_add(json, "updateDelayFirstNeighbor", bgp->update_delay_begin_time);
10250 json_object_boolean_true_add(json, "updateDelayInProgress");
b05a1c8b
DS
10251 }
10252 else
10253 {
10254 if (bgp->update_delay_over)
10255 {
62d6dca0 10256 json_object_string_add(json, "updateDelayFirstNeighbor",
f1aa5d8a 10257 bgp->update_delay_begin_time);
62d6dca0 10258 json_object_string_add(json, "updateDelayBestpathResumed",
f1aa5d8a 10259 bgp->update_delay_end_time);
62d6dca0 10260 json_object_string_add(json, "updateDelayZebraUpdateResume",
f1aa5d8a 10261 bgp->update_delay_zebra_resume_time);
62d6dca0 10262 json_object_string_add(json, "updateDelayPeerUpdateResume",
f1aa5d8a 10263 bgp->update_delay_peers_resume_time);
b05a1c8b
DS
10264 }
10265 }
f188f2c4
DS
10266 }
10267 else
10268 {
b05a1c8b
DS
10269 vty_out (vty, "Read-only mode update-delay limit: %d seconds%s",
10270 bgp->v_update_delay, VTY_NEWLINE);
10271 if (bgp->v_update_delay != bgp->v_establish_wait)
10272 vty_out (vty, " Establish wait: %d seconds%s",
10273 bgp->v_establish_wait, VTY_NEWLINE);
10274
10275 if (bgp_update_delay_active(bgp))
f188f2c4
DS
10276 {
10277 vty_out (vty, " First neighbor established: %s%s",
10278 bgp->update_delay_begin_time, VTY_NEWLINE);
b05a1c8b
DS
10279 vty_out (vty, " Delay in progress%s", VTY_NEWLINE);
10280 }
10281 else
10282 {
10283 if (bgp->update_delay_over)
10284 {
10285 vty_out (vty, " First neighbor established: %s%s",
10286 bgp->update_delay_begin_time, VTY_NEWLINE);
10287 vty_out (vty, " Best-paths resumed: %s%s",
10288 bgp->update_delay_end_time, VTY_NEWLINE);
10289 vty_out (vty, " zebra update resumed: %s%s",
10290 bgp->update_delay_zebra_resume_time, VTY_NEWLINE);
10291 vty_out (vty, " peers update resumed: %s%s",
10292 bgp->update_delay_peers_resume_time, VTY_NEWLINE);
10293 }
f188f2c4
DS
10294 }
10295 }
10296 }
4bf6a362 10297
b05a1c8b
DS
10298 if (use_json)
10299 {
10300 if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active)
62d6dca0 10301 json_object_boolean_true_add(json, "maxMedOnStartup");
b05a1c8b 10302 if (bgp->v_maxmed_admin)
62d6dca0 10303 json_object_boolean_true_add(json, "maxMedAdministrative");
b05a1c8b 10304
62d6dca0 10305 json_object_int_add(json, "tableVersion", bgp_table_version(bgp->rib[afi][safi]));
b05a1c8b
DS
10306
10307 ents = bgp_table_count (bgp->rib[afi][safi]);
62d6dca0
DS
10308 json_object_int_add(json, "ribCount", ents);
10309 json_object_int_add(json, "ribMemory", ents * sizeof (struct bgp_node));
b05a1c8b
DS
10310
10311 ents = listcount (bgp->peer);
62d6dca0
DS
10312 json_object_int_add(json, "peerCount", ents);
10313 json_object_int_add(json, "peerMemory", ents * sizeof (struct peer));
b05a1c8b 10314
b05a1c8b
DS
10315 if ((ents = listcount (bgp->group)))
10316 {
62d6dca0
DS
10317 json_object_int_add(json, "peerGroupCount", ents);
10318 json_object_int_add(json, "peerGroupMemory", ents * sizeof (struct peer_group));
b05a1c8b 10319 }
3f9c7369 10320
b05a1c8b 10321 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
62d6dca0 10322 json_object_boolean_true_add(json, "dampeningEnabled");
b05a1c8b
DS
10323 }
10324 else
10325 {
10326 if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active)
10327 vty_out (vty, "Max-med on-startup active%s", VTY_NEWLINE);
10328 if (bgp->v_maxmed_admin)
10329 vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE);
10330
ffd0c037 10331 vty_out(vty, "BGP table version %" PRIu64 "%s",
b05a1c8b
DS
10332 bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE);
10333
10334 ents = bgp_table_count (bgp->rib[afi][safi]);
10335 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
10336 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10337 ents * sizeof (struct bgp_node)),
10338 VTY_NEWLINE);
10339
10340 /* Peer related usage */
10341 ents = listcount (bgp->peer);
10342 vty_out (vty, "Peers %ld, using %s of memory%s",
10343 ents,
10344 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10345 ents * sizeof (struct peer)),
10346 VTY_NEWLINE);
10347
b05a1c8b
DS
10348 if ((ents = listcount (bgp->group)))
10349 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
10350 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10351 ents * sizeof (struct peer_group)),
10352 VTY_NEWLINE);
10353
10354 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
10355 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
10356 vty_out (vty, "%s", VTY_NEWLINE);
10357 vty_out (vty, "%s%s", header, VTY_NEWLINE);
10358 }
4bf6a362
PJ
10359 }
10360
b05a1c8b 10361 count++;
718e3744 10362
b05a1c8b
DS
10363 if (use_json)
10364 {
10365 json_peer = json_object_new_object();
f14e6fdb 10366
b05a1c8b 10367 if (peer_dynamic_neighbor(peer))
62d6dca0 10368 json_object_boolean_true_add(json_peer, "dynamicPeer");
b05a1c8b 10369
04b6bdc0
DW
10370 if (peer->hostname)
10371 json_object_string_add(json_peer, "hostname", peer->hostname);
10372
10373 if (peer->domainname)
10374 json_object_string_add(json_peer, "domainname", peer->domainname);
10375
62d6dca0 10376 json_object_int_add(json_peer, "remoteAs", peer->as);
f1aa5d8a 10377 json_object_int_add(json_peer, "version", 4);
62d6dca0 10378 json_object_int_add(json_peer, "msgRcvd",
f1aa5d8a
DS
10379 peer->open_in + peer->update_in + peer->keepalive_in
10380 + peer->notify_in + peer->refresh_in
10381 + peer->dynamic_cap_in);
62d6dca0 10382 json_object_int_add(json_peer, "msgSent",
f1aa5d8a
DS
10383 peer->open_out + peer->update_out + peer->keepalive_out
10384 + peer->notify_out + peer->refresh_out
10385 + peer->dynamic_cap_out);
10386
62d6dca0 10387 json_object_int_add(json_peer, "tableVersion", peer->version[afi][safi]);
f1aa5d8a
DS
10388 json_object_int_add(json_peer, "outq", peer->obuf->count);
10389 json_object_int_add(json_peer, "inq", 0);
856ca177 10390 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, use_json, json_peer);
62d6dca0 10391 json_object_int_add(json_peer, "prefixReceivedCount", peer->pcount[afi][safi]);
b05a1c8b
DS
10392
10393 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
f1aa5d8a 10394 json_object_string_add(json_peer, "state", "Idle (Admin)");
b05a1c8b 10395 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
f1aa5d8a 10396 json_object_string_add(json_peer, "state", "Idle (PfxCt)");
b05a1c8b 10397 else
f1aa5d8a 10398 json_object_string_add(json_peer, "state", LOOKUP(bgp_status_msg, peer->status));
b05a1c8b 10399
f1aa5d8a 10400 if (peer->conf_if)
62d6dca0 10401 json_object_string_add(json_peer, "idType", "interface");
f1aa5d8a 10402 else if (peer->su.sa.sa_family == AF_INET)
62d6dca0 10403 json_object_string_add(json_peer, "idType", "ipv4");
f1aa5d8a 10404 else if (peer->su.sa.sa_family == AF_INET6)
62d6dca0 10405 json_object_string_add(json_peer, "idType", "ipv6");
b05a1c8b 10406
f1aa5d8a 10407 json_object_object_add(json_peers, peer->host, json_peer);
b05a1c8b
DS
10408 }
10409 else
10410 {
10411 memset(dn_flag, '\0', sizeof(dn_flag));
10412 if (peer_dynamic_neighbor(peer))
10413 {
10414 dn_count++;
10415 dn_flag[0] = '*';
10416 }
10417
04b6bdc0
DW
10418 if (peer->hostname && bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME))
10419 len = vty_out (vty, "%s%s(%s)", dn_flag, peer->hostname,
10420 peer->host);
10421 else
10422 len = vty_out (vty, "%s%s", dn_flag, peer->host);
b05a1c8b
DS
10423 len = 16 - len;
10424
10425 if (len < 1)
10426 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
10427 else
10428 vty_out (vty, "%*s", len, " ");
10429
10430 vty_out (vty, "4 ");
10431
ee046671 10432 vty_out (vty, "%5u %7d %7d %8" PRIu64 " %4d %4zd ",
b05a1c8b
DS
10433 peer->as,
10434 peer->open_in + peer->update_in + peer->keepalive_in
10435 + peer->notify_in + peer->refresh_in
10436 + peer->dynamic_cap_in,
10437 peer->open_out + peer->update_out + peer->keepalive_out
10438 + peer->notify_out + peer->refresh_out
10439 + peer->dynamic_cap_out,
10440 peer->version[afi][safi],
10441 0,
ffd0c037 10442 peer->obuf->count);
b05a1c8b 10443
f1aa5d8a 10444 vty_out (vty, "%-8s",
856ca177 10445 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL));
b05a1c8b
DS
10446
10447 if (peer->status == Established)
10448 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
10449 else
10450 {
10451 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
10452 vty_out (vty, " Idle (Admin)");
10453 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
10454 vty_out (vty, " Idle (PfxCt)");
10455 else
10456 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
10457 }
10458 vty_out (vty, "%s", VTY_NEWLINE);
10459 }
718e3744 10460 }
10461 }
10462
b05a1c8b
DS
10463 if (use_json)
10464 {
10465 json_object_object_add(json, "peers", json_peers);
14151a32 10466
62d6dca0
DS
10467 json_object_int_add(json, "totalPeers", count);
10468 json_object_int_add(json, "dynamicPeers", dn_count);
14151a32 10469
b05a1c8b 10470 vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
f1aa5d8a 10471 json_object_free(json);
b05a1c8b
DS
10472 }
10473 else
f14e6fdb 10474 {
b05a1c8b
DS
10475 if (count)
10476 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
10477 count, VTY_NEWLINE);
10478 else
9f689658
DD
10479 {
10480 if (use_json)
10481 vty_out(vty, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s",
10482 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
10483 else
10484 vty_out (vty, "No %s neighbor is configured%s",
10485 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
10486 }
b05a1c8b 10487
9f689658 10488 if (dn_count && ! use_json)
b05a1c8b
DS
10489 {
10490 vty_out(vty, "* - dynamic neighbor%s", VTY_NEWLINE);
10491 vty_out(vty,
10492 "%d dynamic neighbor(s), limit %d%s",
10493 dn_count, bgp->dynamic_neighbors_limit, VTY_NEWLINE);
10494 }
f14e6fdb
DS
10495 }
10496
718e3744 10497 return CMD_SUCCESS;
10498}
10499
47fc97cc
DS
10500static int
10501bgp_show_summary_vty (struct vty *vty, const char *name,
b05a1c8b 10502 afi_t afi, safi_t safi, u_char use_json)
718e3744 10503{
10504 struct bgp *bgp;
10505
10506 if (name)
10507 {
10508 bgp = bgp_lookup_by_name (name);
47fc97cc 10509
718e3744 10510 if (! bgp)
10511 {
47fc97cc 10512 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
718e3744 10513 return CMD_WARNING;
10514 }
10515
9f689658 10516 bgp_show_summary (vty, bgp, afi, safi, use_json, NULL);
718e3744 10517 return CMD_SUCCESS;
10518 }
47fc97cc 10519
718e3744 10520 bgp = bgp_get_default ();
10521
10522 if (bgp)
9f689658 10523 bgp_show_summary (vty, bgp, afi, safi, use_json, NULL);
47fc97cc 10524
718e3744 10525 return CMD_SUCCESS;
10526}
10527
f186de26 10528static void
10529bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi,
10530 u_char use_json)
10531{
10532 struct listnode *node, *nnode;
10533 struct bgp *bgp;
9f689658
DD
10534 json_object *json = NULL;
10535 int is_first = 1;
10536
10537 if (use_json)
10538 vty_out (vty, "{%s", VTY_NEWLINE);
f186de26 10539
10540 for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
10541 {
9f689658
DD
10542 if (use_json)
10543 {
10544 if (!(json = json_object_new_object()))
10545 {
10546 zlog_err("Unable to allocate memory for JSON object");
10547 vty_out (vty,
10548 "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s",
10549 VTY_NEWLINE);
10550 return;
10551 }
10552
10553 if (! is_first)
10554 vty_out (vty, ",%s", VTY_NEWLINE);
10555 else
10556 is_first = 0;
10557
10558 vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
10559 ? "Default" : bgp->name);
10560 }
10561 else
10562 {
10563 vty_out (vty, "%sInstance %s:%s",
10564 VTY_NEWLINE,
10565 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
10566 ? "Default" : bgp->name, VTY_NEWLINE);
10567 }
10568 bgp_show_summary (vty, bgp, afi, safi, use_json, json);
f186de26 10569 }
9f689658
DD
10570
10571 if (use_json)
10572 vty_out (vty, "}%s", VTY_NEWLINE);
10573
f186de26 10574}
10575
718e3744 10576/* `show ip bgp summary' commands. */
47fc97cc 10577DEFUN (show_ip_bgp_summary,
718e3744 10578 show_ip_bgp_summary_cmd,
b05a1c8b 10579 "show ip bgp summary {json}",
47fc97cc
DS
10580 SHOW_STR
10581 IP_STR
10582 BGP_STR
b05a1c8b
DS
10583 "Summary of BGP neighbor status\n"
10584 "JavaScript Object Notation\n")
47fc97cc 10585{
db7c8528
DS
10586 u_char uj = use_json(argc, argv);
10587 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj);
718e3744 10588}
10589
10590DEFUN (show_ip_bgp_instance_summary,
10591 show_ip_bgp_instance_summary_cmd,
8386ac43 10592 "show ip bgp " BGP_INSTANCE_CMD " summary {json}",
718e3744 10593 SHOW_STR
10594 IP_STR
10595 BGP_STR
8386ac43 10596 BGP_INSTANCE_HELP_STR
b05a1c8b
DS
10597 "Summary of BGP neighbor status\n"
10598 "JavaScript Object Notation\n")
718e3744 10599{
db7c8528 10600 u_char uj = use_json(argc, argv);
6aeb9e78 10601 return bgp_show_summary_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, uj);
718e3744 10602}
10603
f186de26 10604DEFUN (show_ip_bgp_instance_all_summary,
10605 show_ip_bgp_instance_all_summary_cmd,
10606 "show ip bgp " BGP_INSTANCE_ALL_CMD " summary {json}",
10607 SHOW_STR
10608 IP_STR
10609 BGP_STR
10610 BGP_INSTANCE_ALL_HELP_STR
10611 "Summary of BGP neighbor status\n"
10612 "JavaScript Object Notation\n")
10613{
10614 u_char uj = use_json(argc, argv);
10615
10616 bgp_show_all_instances_summary_vty (vty, AFI_IP, SAFI_UNICAST, uj);
10617 return CMD_SUCCESS;
10618}
10619
718e3744 10620DEFUN (show_ip_bgp_ipv4_summary,
10621 show_ip_bgp_ipv4_summary_cmd,
b05a1c8b 10622 "show ip bgp ipv4 (unicast|multicast) summary {json}",
718e3744 10623 SHOW_STR
10624 IP_STR
10625 BGP_STR
10626 "Address family\n"
10627 "Address Family modifier\n"
10628 "Address Family modifier\n"
b05a1c8b
DS
10629 "Summary of BGP neighbor status\n"
10630 "JavaScript Object Notation\n")
718e3744 10631{
db7c8528 10632 u_char uj = use_json(argc, argv);
718e3744 10633 if (strncmp (argv[0], "m", 1) == 0)
db7c8528 10634 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, uj);
718e3744 10635
db7c8528 10636 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj);
718e3744 10637}
10638
95cbbd2a
ML
10639ALIAS (show_ip_bgp_ipv4_summary,
10640 show_bgp_ipv4_safi_summary_cmd,
b05a1c8b 10641 "show bgp ipv4 (unicast|multicast) summary {json}",
95cbbd2a
ML
10642 SHOW_STR
10643 BGP_STR
10644 "Address family\n"
10645 "Address Family modifier\n"
10646 "Address Family modifier\n"
10647 "Summary of BGP neighbor status\n")
10648
718e3744 10649DEFUN (show_ip_bgp_instance_ipv4_summary,
10650 show_ip_bgp_instance_ipv4_summary_cmd,
b05a1c8b 10651 "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}",
718e3744 10652 SHOW_STR
10653 IP_STR
10654 BGP_STR
10655 "BGP view\n"
10656 "View name\n"
10657 "Address family\n"
10658 "Address Family modifier\n"
10659 "Address Family modifier\n"
b05a1c8b
DS
10660 "Summary of BGP neighbor status\n"
10661 "JavaScript Object Notation\n")
718e3744 10662{
db7c8528 10663 u_char uj = use_json(argc, argv);
718e3744 10664 if (strncmp (argv[1], "m", 1) == 0)
db7c8528 10665 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, uj);
718e3744 10666 else
db7c8528 10667 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, uj);
718e3744 10668}
10669
95cbbd2a
ML
10670ALIAS (show_ip_bgp_instance_ipv4_summary,
10671 show_bgp_instance_ipv4_safi_summary_cmd,
b05a1c8b 10672 "show bgp view WORD ipv4 (unicast|multicast) summary {json}",
95cbbd2a
ML
10673 SHOW_STR
10674 BGP_STR
10675 "BGP view\n"
10676 "View name\n"
10677 "Address family\n"
10678 "Address Family modifier\n"
10679 "Address Family modifier\n"
10680 "Summary of BGP neighbor status\n")
10681
718e3744 10682DEFUN (show_ip_bgp_vpnv4_all_summary,
10683 show_ip_bgp_vpnv4_all_summary_cmd,
b05a1c8b 10684 "show ip bgp vpnv4 all summary {json}",
718e3744 10685 SHOW_STR
10686 IP_STR
10687 BGP_STR
10688 "Display VPNv4 NLRI specific information\n"
10689 "Display information about all VPNv4 NLRIs\n"
b05a1c8b
DS
10690 "Summary of BGP neighbor status\n"
10691 "JavaScript Object Notation\n")
718e3744 10692{
db7c8528
DS
10693 u_char uj = use_json(argc, argv);
10694 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj);
718e3744 10695}
10696
10697DEFUN (show_ip_bgp_vpnv4_rd_summary,
10698 show_ip_bgp_vpnv4_rd_summary_cmd,
b05a1c8b 10699 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary {json}",
718e3744 10700 SHOW_STR
10701 IP_STR
10702 BGP_STR
10703 "Display VPNv4 NLRI specific information\n"
10704 "Display information for a route distinguisher\n"
10705 "VPN Route Distinguisher\n"
b05a1c8b
DS
10706 "Summary of BGP neighbor status\n"
10707 "JavaScript Object Notation\n")
718e3744 10708{
10709 int ret;
10710 struct prefix_rd prd;
db7c8528 10711 u_char uj = use_json(argc, argv);
718e3744 10712
10713 ret = str2prefix_rd (argv[0], &prd);
10714 if (! ret)
10715 {
10716 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
10717 return CMD_WARNING;
10718 }
10719
db7c8528 10720 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj);
718e3744 10721}
10722
10723#ifdef HAVE_IPV6
47fc97cc 10724DEFUN (show_bgp_summary,
718e3744 10725 show_bgp_summary_cmd,
b05a1c8b 10726 "show bgp summary {json}",
718e3744 10727 SHOW_STR
10728 BGP_STR
b05a1c8b
DS
10729 "Summary of BGP neighbor status\n"
10730 "JavaScript Object Notation\n")
718e3744 10731{
db7c8528 10732 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json(argc, argv));
718e3744 10733}
10734
10735DEFUN (show_bgp_instance_summary,
10736 show_bgp_instance_summary_cmd,
8386ac43 10737 "show bgp " BGP_INSTANCE_CMD " summary {json}",
718e3744 10738 SHOW_STR
10739 BGP_STR
8386ac43 10740 BGP_INSTANCE_HELP_STR
b05a1c8b
DS
10741 "Summary of BGP neighbor status\n"
10742 "JavaScript Object Notation\n")
718e3744 10743{
6aeb9e78 10744 return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, use_json(argc, argv));
718e3744 10745}
10746
f186de26 10747DEFUN (show_bgp_instance_all_summary,
10748 show_bgp_instance_all_summary_cmd,
10749 "show bgp " BGP_INSTANCE_ALL_CMD " summary {json}",
10750 SHOW_STR
10751 BGP_STR
10752 BGP_INSTANCE_ALL_HELP_STR
10753 "Summary of BGP neighbor status\n"
10754 "JavaScript Object Notation\n")
10755{
10756 u_char uj = use_json(argc, argv);
10757
10758 bgp_show_all_instances_summary_vty (vty, AFI_IP6, SAFI_UNICAST, uj);
10759 return CMD_SUCCESS;
10760}
10761
718e3744 10762ALIAS (show_bgp_summary,
10763 show_bgp_ipv6_summary_cmd,
b05a1c8b 10764 "show bgp ipv6 summary {json}",
718e3744 10765 SHOW_STR
10766 BGP_STR
10767 "Address family\n"
10768 "Summary of BGP neighbor status\n")
10769
10770ALIAS (show_bgp_instance_summary,
10771 show_bgp_instance_ipv6_summary_cmd,
8386ac43 10772 "show bgp " BGP_INSTANCE_CMD " ipv6 summary {json}",
718e3744 10773 SHOW_STR
10774 BGP_STR
8386ac43 10775 BGP_INSTANCE_HELP_STR
718e3744 10776 "Address family\n"
10777 "Summary of BGP neighbor status\n")
10778
95cbbd2a
ML
10779DEFUN (show_bgp_ipv6_safi_summary,
10780 show_bgp_ipv6_safi_summary_cmd,
b05a1c8b 10781 "show bgp ipv6 (unicast|multicast) summary {json}",
95cbbd2a
ML
10782 SHOW_STR
10783 BGP_STR
10784 "Address family\n"
10785 "Address Family modifier\n"
10786 "Address Family modifier\n"
b05a1c8b
DS
10787 "Summary of BGP neighbor status\n"
10788 "JavaScript Object Notation\n")
95cbbd2a 10789{
db7c8528 10790 u_char uj = use_json(argc, argv);
95cbbd2a 10791 if (strncmp (argv[0], "m", 1) == 0)
db7c8528 10792 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj);
95cbbd2a 10793
db7c8528 10794 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj);
95cbbd2a
ML
10795}
10796
10797DEFUN (show_bgp_instance_ipv6_safi_summary,
10798 show_bgp_instance_ipv6_safi_summary_cmd,
8386ac43 10799 "show bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) summary {json}",
95cbbd2a
ML
10800 SHOW_STR
10801 BGP_STR
8386ac43 10802 BGP_INSTANCE_HELP_STR
95cbbd2a
ML
10803 "Address family\n"
10804 "Address Family modifier\n"
10805 "Address Family modifier\n"
b05a1c8b
DS
10806 "Summary of BGP neighbor status\n"
10807 "JavaScript Object Notation\n")
95cbbd2a 10808{
db7c8528 10809 u_char uj = use_json(argc, argv);
6aeb9e78
DS
10810 if (strncmp (argv[2], "m", 1) == 0)
10811 return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_MULTICAST, uj);
95cbbd2a 10812
6aeb9e78 10813 return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, uj);
95cbbd2a
ML
10814}
10815
718e3744 10816/* old command */
10817DEFUN (show_ipv6_bgp_summary,
10818 show_ipv6_bgp_summary_cmd,
b05a1c8b 10819 "show ipv6 bgp summary {json}",
718e3744 10820 SHOW_STR
10821 IPV6_STR
10822 BGP_STR
b05a1c8b
DS
10823 "Summary of BGP neighbor status\n"
10824 "JavaScript Object Notation\n")
718e3744 10825{
db7c8528
DS
10826 u_char uj = use_json(argc, argv);
10827 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj);
718e3744 10828}
10829
10830/* old command */
10831DEFUN (show_ipv6_mbgp_summary,
10832 show_ipv6_mbgp_summary_cmd,
b05a1c8b 10833 "show ipv6 mbgp summary {json}",
718e3744 10834 SHOW_STR
10835 IPV6_STR
10836 MBGP_STR
b05a1c8b
DS
10837 "Summary of BGP neighbor status\n"
10838 "JavaScript Object Notation\n")
718e3744 10839{
db7c8528
DS
10840 u_char uj = use_json(argc, argv);
10841 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj);
718e3744 10842}
10843#endif /* HAVE_IPV6 */
6b0655a2 10844
fd79ac91 10845const char *
538621f2 10846afi_safi_print (afi_t afi, safi_t safi)
10847{
10848 if (afi == AFI_IP && safi == SAFI_UNICAST)
10849 return "IPv4 Unicast";
10850 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
10851 return "IPv4 Multicast";
10852 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
945c8fe9 10853 return "VPN-IPv4 Unicast";
8b1fb8be
LB
10854 else if (afi == AFI_IP && safi == SAFI_ENCAP)
10855 return "ENCAP-IPv4 Unicast";
538621f2 10856 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
10857 return "IPv6 Unicast";
10858 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
10859 return "IPv6 Multicast";
945c8fe9
LB
10860 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
10861 return "VPN-IPv6 Unicast";
8b1fb8be
LB
10862 else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
10863 return "ENCAP-IPv6 Unicast";
538621f2 10864 else
10865 return "Unknown";
10866}
10867
718e3744 10868/* Show BGP peer's information. */
10869enum show_type
10870{
10871 show_all,
10872 show_peer
10873};
10874
94f2b392 10875static void
856ca177
MS
10876bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, afi_t afi, safi_t safi,
10877 u_int16_t adv_smcap, u_int16_t adv_rmcap, u_int16_t rcv_smcap,
10878 u_int16_t rcv_rmcap, u_char use_json, json_object *json_pref)
718e3744 10879{
10880 /* Send-Mode */
10881 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
10882 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
10883 {
856ca177
MS
10884 if (use_json)
10885 {
10886 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
10887 json_object_string_add(json_pref, "sendMode", "advertisedAndReceived");
10888 else if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
10889 json_object_string_add(json_pref, "sendMode", "advertised");
10890 else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
10891 json_object_string_add(json_pref, "sendMode", "received");
10892 }
10893 else
10894 {
10895 vty_out (vty, " Send-mode: ");
10896 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
10897 vty_out (vty, "advertised");
10898 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
10899 vty_out (vty, "%sreceived",
10900 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
10901 ", " : "");
10902 vty_out (vty, "%s", VTY_NEWLINE);
10903 }
718e3744 10904 }
10905
10906 /* Receive-Mode */
10907 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
10908 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
10909 {
856ca177
MS
10910 if (use_json)
10911 {
10912 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
10913 json_object_string_add(json_pref, "recvMode", "advertisedAndReceived");
10914 else if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
10915 json_object_string_add(json_pref, "recvMode", "advertised");
10916 else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
10917 json_object_string_add(json_pref, "recvMode", "received");
10918 }
10919 else
10920 {
10921 vty_out (vty, " Receive-mode: ");
10922 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
10923 vty_out (vty, "advertised");
10924 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
10925 vty_out (vty, "%sreceived",
10926 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
10927 ", " : "");
10928 vty_out (vty, "%s", VTY_NEWLINE);
10929 }
718e3744 10930 }
10931}
10932
94f2b392 10933static void
856ca177
MS
10934bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi,
10935 u_char use_json, json_object *json_neigh)
718e3744 10936{
10937 struct bgp_filter *filter;
3f9c7369 10938 struct peer_af *paf;
718e3744 10939 char orf_pfx_name[BUFSIZ];
10940 int orf_pfx_count;
856ca177
MS
10941 json_object *json_af = NULL;
10942 json_object *json_prefA = NULL;
10943 json_object *json_prefB = NULL;
10944 json_object *json_addr = NULL;
718e3744 10945
856ca177
MS
10946 if (use_json)
10947 {
10948 json_addr = json_object_new_object();
10949 json_af = json_object_new_object();
10950 json_prefA = json_object_new_object();
10951 json_prefB = json_object_new_object();
10952 filter = &p->filter[afi][safi];
718e3744 10953
c8560b44 10954 if (peer_group_active(p))
856ca177 10955 json_object_string_add(json_addr, "peerGroupMember", p->group->name);
538621f2 10956
856ca177
MS
10957 paf = peer_af_find(p, afi, safi);
10958 if (paf && PAF_SUBGRP(paf))
10959 {
10960 json_object_int_add(json_addr, "updateGroupId", PAF_UPDGRP(paf)->id);
10961 json_object_int_add(json_addr, "subGroupId", PAF_SUBGRP(paf)->id);
10962 json_object_int_add(json_addr, "packetQueueLength", bpacket_queue_virtual_length(paf));
10963 }
10964
10965 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
10966 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
10967 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
10968 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
10969 {
10970 json_object_int_add(json_af, "orfType", ORF_TYPE_PREFIX);
10971 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
10972 PEER_CAP_ORF_PREFIX_SM_ADV,
10973 PEER_CAP_ORF_PREFIX_RM_ADV,
10974 PEER_CAP_ORF_PREFIX_SM_RCV,
10975 PEER_CAP_ORF_PREFIX_RM_RCV, use_json, json_prefA);
10976 json_object_object_add(json_af, "orfPrefixList", json_prefA);
10977 }
10978
10979 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
10980 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
10981 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
10982 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
10983 {
10984 json_object_int_add(json_af, "orfOldType", ORF_TYPE_PREFIX_OLD);
10985 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
10986 PEER_CAP_ORF_PREFIX_SM_ADV,
10987 PEER_CAP_ORF_PREFIX_RM_ADV,
10988 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
10989 PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, json_prefB);
10990 json_object_object_add(json_af, "orfOldPrefixList", json_prefB);
10991 }
10992
10993 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
10994 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
10995 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
10996 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
10997 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
10998 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
10999 json_object_object_add(json_addr, "afDependentCap", json_af);
11000
11001 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
11002 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json);
11003
11004 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
11005 || orf_pfx_count)
11006 {
11007 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
11008 json_object_boolean_true_add(json_neigh, "orfSent");
11009 if (orf_pfx_count)
11010 json_object_int_add(json_addr, "orfRecvCounter", orf_pfx_count);
11011 }
11012 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
11013 json_object_string_add(json_addr, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd");
11014
11015 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
11016 json_object_boolean_true_add(json_addr, "routeReflectorClient");
11017 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
11018 json_object_boolean_true_add(json_addr, "routeServerClient");
11019 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
11020 json_object_boolean_true_add(json_addr, "inboundSoftConfigPermit");
11021
88b8ed8d
DW
11022 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE))
11023 json_object_boolean_true_add(json_addr, "privateAsNumsAllReplacedInUpdatesToNbr");
11024 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE))
856ca177 11025 json_object_boolean_true_add(json_addr, "privateAsNumsReplacedInUpdatesToNbr");
88b8ed8d
DW
11026 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL))
11027 json_object_boolean_true_add(json_addr, "privateAsNumsAllRemovedInUpdatesToNbr");
856ca177
MS
11028 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
11029 json_object_boolean_true_add(json_addr, "privateAsNumsRemovedInUpdatesToNbr");
11030
adbac85e
DW
11031 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS))
11032 json_object_boolean_true_add(json_addr, "addpathTxAllPaths");
11033
06370dac
DW
11034 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS))
11035 json_object_boolean_true_add(json_addr, "addpathTxBestpathPerAS");
11036
856ca177
MS
11037 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE))
11038 json_object_string_add(json_addr, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs");
11039
11040 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) ||
11041 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF))
11042 json_object_boolean_true_add(json_addr, "routerAlwaysNextHop");
11043 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
11044 json_object_boolean_true_add(json_addr, "unchangedAsPathPropogatedToNbr");
11045 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
11046 json_object_boolean_true_add(json_addr, "unchangedNextHopPropogatedToNbr");
11047 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
11048 json_object_boolean_true_add(json_addr, "unchangedMedPropogatedToNbr");
718e3744 11049 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
856ca177
MS
11050 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11051 {
11052 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
11053 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11054 json_object_string_add(json_addr, "commAttriSentToNbr", "extendedAndStandard");
11055 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11056 json_object_string_add(json_addr, "commAttriSentToNbr", "extended");
11057 else
11058 json_object_string_add(json_addr, "commAttriSentToNbr", "standard");
11059 }
11060 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
11061 {
11062 if (p->default_rmap[afi][safi].name)
11063 json_object_string_add(json_addr, "defaultRouteMap", p->default_rmap[afi][safi].name);
11064
11065 if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE))
11066 json_object_boolean_true_add(json_addr, "defaultSent");
11067 else
11068 json_object_boolean_true_add(json_addr, "defaultNotSent");
11069 }
11070
11071 if (filter->plist[FILTER_IN].name
11072 || filter->dlist[FILTER_IN].name
11073 || filter->aslist[FILTER_IN].name
11074 || filter->map[RMAP_IN].name)
11075 json_object_boolean_true_add(json_addr, "inboundPathPolicyConfig");
11076 if (filter->plist[FILTER_OUT].name
11077 || filter->dlist[FILTER_OUT].name
11078 || filter->aslist[FILTER_OUT].name
11079 || filter->map[RMAP_OUT].name
11080 || filter->usmap.name)
11081 json_object_boolean_true_add(json_addr, "outboundPathPolicyConfig");
856ca177
MS
11082
11083 /* prefix-list */
11084 if (filter->plist[FILTER_IN].name)
11085 json_object_string_add(json_addr, "incomingUpdatePrefixFilterList", filter->plist[FILTER_IN].name);
11086 if (filter->plist[FILTER_OUT].name)
11087 json_object_string_add(json_addr, "outgoingUpdatePrefixFilterList", filter->plist[FILTER_OUT].name);
11088
11089 /* distribute-list */
11090 if (filter->dlist[FILTER_IN].name)
11091 json_object_string_add(json_addr, "incomingUpdateNetworkFilterList", filter->dlist[FILTER_IN].name);
11092 if (filter->dlist[FILTER_OUT].name)
11093 json_object_string_add(json_addr, "outgoingUpdateNetworkFilterList", filter->dlist[FILTER_OUT].name);
11094
11095 /* filter-list. */
11096 if (filter->aslist[FILTER_IN].name)
11097 json_object_string_add(json_addr, "incomingUpdateAsPathFilterList", filter->aslist[FILTER_IN].name);
11098 if (filter->aslist[FILTER_OUT].name)
11099 json_object_string_add(json_addr, "outgoingUpdateAsPathFilterList", filter->aslist[FILTER_OUT].name);
11100
11101 /* route-map. */
11102 if (filter->map[RMAP_IN].name)
11103 json_object_string_add(json_addr, "routeMapForIncomingAdvertisements", filter->map[RMAP_IN].name);
11104 if (filter->map[RMAP_OUT].name)
11105 json_object_string_add(json_addr, "routeMapForOutgoingAdvertisements", filter->map[RMAP_OUT].name);
856ca177
MS
11106
11107 /* unsuppress-map */
11108 if (filter->usmap.name)
11109 json_object_string_add(json_addr, "selectiveUnsuppressRouteMap", filter->usmap.name);
11110
11111 /* Receive prefix count */
11112 json_object_int_add(json_addr, "acceptedPrefixCounter", p->pcount[afi][safi]);
11113
11114 /* Maximum prefix */
11115 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
11116 {
11117 json_object_int_add(json_addr, "prefixAllowedMax", p->pmax[afi][safi]);
11118 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING))
11119 json_object_boolean_true_add(json_addr, "prefixAllowedMaxWarning");
11120 json_object_int_add(json_addr, "prefixAllowedWarningThresh", p->pmax_threshold[afi][safi]);
11121 if (p->pmax_restart[afi][safi])
11122 json_object_int_add(json_addr, "prefixAllowedRestartIntervalMsecs", p->pmax_restart[afi][safi] * 60000);
11123 }
11124 json_object_object_add(json_neigh, afi_safi_print (afi, safi), json_addr);
11125
11126 }
11127 else
11128 {
11129 filter = &p->filter[afi][safi];
11130
11131 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
11132 VTY_NEWLINE);
11133
c8560b44 11134 if (peer_group_active(p))
856ca177
MS
11135 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
11136
11137 paf = peer_af_find(p, afi, safi);
11138 if (paf && PAF_SUBGRP(paf))
11139 {
11140 vty_out (vty, " Update group %" PRIu64 ", subgroup %" PRIu64 "%s",
11141 PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE);
11142 vty_out (vty, " Packet Queue length %d%s",
11143 bpacket_queue_virtual_length(paf), VTY_NEWLINE);
11144 }
718e3744 11145 else
856ca177
MS
11146 {
11147 vty_out(vty, " Not part of any update group%s", VTY_NEWLINE);
11148 }
11149 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
11150 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
11151 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
11152 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
11153 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
11154 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
11155 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
11156
11157 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
11158 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
11159 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
11160 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
11161 {
11162 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
11163 ORF_TYPE_PREFIX, VTY_NEWLINE);
11164 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
11165 PEER_CAP_ORF_PREFIX_SM_ADV,
11166 PEER_CAP_ORF_PREFIX_RM_ADV,
11167 PEER_CAP_ORF_PREFIX_SM_RCV,
11168 PEER_CAP_ORF_PREFIX_RM_RCV, use_json, NULL);
11169 }
11170 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
11171 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
11172 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
11173 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
11174 {
11175 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
11176 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
11177 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
11178 PEER_CAP_ORF_PREFIX_SM_ADV,
11179 PEER_CAP_ORF_PREFIX_RM_ADV,
11180 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
11181 PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, NULL);
11182 }
718e3744 11183
856ca177
MS
11184 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
11185 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json);
718e3744 11186
856ca177
MS
11187 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
11188 || orf_pfx_count)
11189 {
11190 vty_out (vty, " Outbound Route Filter (ORF):");
11191 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
11192 vty_out (vty, " sent;");
11193 if (orf_pfx_count)
11194 vty_out (vty, " received (%d entries)", orf_pfx_count);
11195 vty_out (vty, "%s", VTY_NEWLINE);
11196 }
11197 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
11198 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
11199
11200 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
11201 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
11202 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
11203 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
11204 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
11205 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
11206
88b8ed8d
DW
11207 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE))
11208 vty_out (vty, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE);
11209 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE))
856ca177 11210 vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE);
88b8ed8d
DW
11211 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL))
11212 vty_out (vty, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE);
856ca177
MS
11213 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
11214 vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE);
11215
adbac85e
DW
11216 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS))
11217 vty_out (vty, " Advertise all paths via addpath%s", VTY_NEWLINE);
11218
06370dac
DW
11219 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS))
11220 vty_out (vty, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE);
11221
856ca177
MS
11222 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE))
11223 vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE);
11224
11225 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) ||
11226 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF))
11227 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
11228 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
11229 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
11230 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
11231 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
11232 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
11233 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
11234 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
11235 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11236 {
11237 vty_out (vty, " Community attribute sent to this neighbor");
11238 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
11239 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11240 vty_out (vty, "(both)%s", VTY_NEWLINE);
11241 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11242 vty_out (vty, "(extended)%s", VTY_NEWLINE);
11243 else
11244 vty_out (vty, "(standard)%s", VTY_NEWLINE);
11245 }
11246 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
11247 {
11248 vty_out (vty, " Default information originate,");
11249
11250 if (p->default_rmap[afi][safi].name)
11251 vty_out (vty, " default route-map %s%s,",
11252 p->default_rmap[afi][safi].map ? "*" : "",
11253 p->default_rmap[afi][safi].name);
11254 if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE))
11255 vty_out (vty, " default sent%s", VTY_NEWLINE);
11256 else
11257 vty_out (vty, " default not sent%s", VTY_NEWLINE);
11258 }
718e3744 11259
856ca177
MS
11260 if (filter->plist[FILTER_IN].name
11261 || filter->dlist[FILTER_IN].name
11262 || filter->aslist[FILTER_IN].name
11263 || filter->map[RMAP_IN].name)
11264 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
11265 if (filter->plist[FILTER_OUT].name
11266 || filter->dlist[FILTER_OUT].name
11267 || filter->aslist[FILTER_OUT].name
11268 || filter->map[RMAP_OUT].name
11269 || filter->usmap.name)
11270 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
856ca177
MS
11271
11272 /* prefix-list */
11273 if (filter->plist[FILTER_IN].name)
11274 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
11275 filter->plist[FILTER_IN].plist ? "*" : "",
11276 filter->plist[FILTER_IN].name,
11277 VTY_NEWLINE);
11278 if (filter->plist[FILTER_OUT].name)
11279 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
11280 filter->plist[FILTER_OUT].plist ? "*" : "",
11281 filter->plist[FILTER_OUT].name,
11282 VTY_NEWLINE);
11283
11284 /* distribute-list */
11285 if (filter->dlist[FILTER_IN].name)
11286 vty_out (vty, " Incoming update network filter list is %s%s%s",
11287 filter->dlist[FILTER_IN].alist ? "*" : "",
11288 filter->dlist[FILTER_IN].name,
11289 VTY_NEWLINE);
11290 if (filter->dlist[FILTER_OUT].name)
11291 vty_out (vty, " Outgoing update network filter list is %s%s%s",
11292 filter->dlist[FILTER_OUT].alist ? "*" : "",
11293 filter->dlist[FILTER_OUT].name,
11294 VTY_NEWLINE);
11295
11296 /* filter-list. */
11297 if (filter->aslist[FILTER_IN].name)
11298 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
11299 filter->aslist[FILTER_IN].aslist ? "*" : "",
11300 filter->aslist[FILTER_IN].name,
11301 VTY_NEWLINE);
11302 if (filter->aslist[FILTER_OUT].name)
11303 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
11304 filter->aslist[FILTER_OUT].aslist ? "*" : "",
11305 filter->aslist[FILTER_OUT].name,
11306 VTY_NEWLINE);
11307
11308 /* route-map. */
11309 if (filter->map[RMAP_IN].name)
11310 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
11311 filter->map[RMAP_IN].map ? "*" : "",
11312 filter->map[RMAP_IN].name,
11313 VTY_NEWLINE);
11314 if (filter->map[RMAP_OUT].name)
11315 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
11316 filter->map[RMAP_OUT].map ? "*" : "",
11317 filter->map[RMAP_OUT].name,
11318 VTY_NEWLINE);
856ca177
MS
11319
11320 /* unsuppress-map */
11321 if (filter->usmap.name)
11322 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
11323 filter->usmap.map ? "*" : "",
11324 filter->usmap.name, VTY_NEWLINE);
11325
11326 /* Receive prefix count */
11327 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
11328
11329 /* Maximum prefix */
11330 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
11331 {
11332 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
11333 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
11334 ? " (warning-only)" : "", VTY_NEWLINE);
11335 vty_out (vty, " Threshold for warning message %d%%",
11336 p->pmax_threshold[afi][safi]);
11337 if (p->pmax_restart[afi][safi])
11338 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
11339 vty_out (vty, "%s", VTY_NEWLINE);
11340 }
718e3744 11341
0a486e5f 11342 vty_out (vty, "%s", VTY_NEWLINE);
718e3744 11343 }
718e3744 11344}
11345
94f2b392 11346static void
e8f7da3a 11347bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *json)
718e3744 11348{
11349 struct bgp *bgp;
4690c7d7 11350 char buf1[PREFIX2STR_BUFFER], buf[SU_ADDRSTRLEN];
718e3744 11351 char timebuf[BGP_UPTIME_LEN];
f14e6fdb 11352 char dn_flag[2];
3a8c7ba1
DW
11353 const char *subcode_str;
11354 const char *code_str;
538621f2 11355 afi_t afi;
11356 safi_t safi;
d6661008
DS
11357 u_int16_t i;
11358 u_char *msg;
e8f7da3a 11359 json_object *json_neigh = NULL;
718e3744 11360
11361 bgp = p->bgp;
11362
e8f7da3a
DW
11363 if (use_json)
11364 json_neigh = json_object_new_object();
11365
856ca177 11366 if (!use_json)
f14e6fdb 11367 {
856ca177
MS
11368 if (p->conf_if) /* Configured interface name. */
11369 vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if,
11370 BGP_PEER_SU_UNSPEC(p) ? "None" :
11371 sockunion2str (&p->su, buf, SU_ADDRSTRLEN));
11372 else /* Configured IP address. */
11373 {
11374 memset(dn_flag, '\0', sizeof(dn_flag));
11375 if (peer_dynamic_neighbor(p))
11376 dn_flag[0] = '*';
f14e6fdb 11377
856ca177
MS
11378 vty_out (vty, "BGP neighbor is %s%s, ", dn_flag, p->host);
11379 }
f14e6fdb
DS
11380 }
11381
856ca177
MS
11382 if (use_json)
11383 {
11384 if (p->conf_if && BGP_PEER_SU_UNSPEC(p))
11385 json_object_string_add(json_neigh, "bgpNeighborAddr", "none");
11386 else if (p->conf_if && !BGP_PEER_SU_UNSPEC(p))
11387 json_object_string_add(json_neigh, "bgpNeighborAddr", sockunion2str (&p->su, buf, SU_ADDRSTRLEN));
11388
11389 json_object_int_add(json_neigh, "remoteAs", p->as);
11390
11391 if (p->change_local_as)
11392 json_object_int_add(json_neigh, "localAs", p->change_local_as);
11393 else
11394 json_object_int_add(json_neigh, "localAs", p->local_as);
11395
11396 if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND))
11397 json_object_boolean_true_add(json_neigh, "localAsNoPrepend");
66b199b2 11398
856ca177
MS
11399 if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS))
11400 json_object_boolean_true_add(json_neigh, "localAsReplaceAs");
11401 }
11402 else
11403 {
f8cfafda
DS
11404 if ((p->as_type == AS_SPECIFIED) ||
11405 (p->as_type == AS_EXTERNAL) ||
11406 (p->as_type == AS_INTERNAL))
11407 vty_out (vty, "remote AS %u, ", p->as);
11408 else
11409 vty_out (vty, "remote AS Unspecified, ");
856ca177
MS
11410 vty_out (vty, "local AS %u%s%s, ",
11411 p->change_local_as ? p->change_local_as : p->local_as,
11412 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
11413 " no-prepend" : "",
11414 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
11415 " replace-as" : "");
11416 }
66b199b2
DS
11417 /* peer type internal, external, confed-internal or confed-external */
11418 if (p->as == p->local_as)
11419 {
856ca177
MS
11420 if (use_json)
11421 {
11422 if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION))
11423 json_object_boolean_true_add(json_neigh, "nbrConfedInternalLink");
11424 else
11425 json_object_boolean_true_add(json_neigh, "nbrInternalLink");
11426 }
66b199b2 11427 else
856ca177
MS
11428 {
11429 if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION))
11430 vty_out (vty, "confed-internal link%s", VTY_NEWLINE);
11431 else
11432 vty_out (vty, "internal link%s", VTY_NEWLINE);
11433 }
66b199b2
DS
11434 }
11435 else
11436 {
856ca177
MS
11437 if (use_json)
11438 {
11439 if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION))
11440 json_object_boolean_true_add(json_neigh, "nbrConfedExternalLink");
11441 else
11442 json_object_boolean_true_add(json_neigh, "nbrExternalLink");
11443 }
66b199b2 11444 else
856ca177
MS
11445 {
11446 if (bgp_confederation_peers_check(bgp, p->as))
11447 vty_out (vty, "confed-external link%s", VTY_NEWLINE);
11448 else
11449 vty_out (vty, "external link%s", VTY_NEWLINE);
11450 }
66b199b2 11451 }
718e3744 11452
11453 /* Description. */
11454 if (p->desc)
856ca177
MS
11455 {
11456 if (use_json)
11457 json_object_string_add(json_neigh, "nbrDesc", p->desc);
11458 else
11459 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
11460 }
6410e93a 11461
04b6bdc0
DW
11462 if (p->hostname)
11463 {
d1570739
DW
11464 if (use_json)
11465 {
11466 if (p->hostname)
11467 json_object_string_add(json_neigh, "hostname", p->hostname);
11468
11469 if (p->domainname)
11470 json_object_string_add(json_neigh, "domainname", p->domainname);
11471 }
04b6bdc0 11472 else
d1570739
DW
11473 {
11474 if (p->domainname && (p->domainname[0] != '\0'))
11475 vty_out(vty, "Hostname: %s.%s%s", p->hostname, p->domainname,
11476 VTY_NEWLINE);
11477 else
11478 vty_out(vty, "Hostname: %s%s", p->hostname, VTY_NEWLINE);
11479 }
11480
04b6bdc0
DW
11481 }
11482
c744aa9f 11483 /* Peer-group */
718e3744 11484 if (p->group)
f14e6fdb 11485 {
856ca177
MS
11486 if (use_json)
11487 {
11488 json_object_string_add(json_neigh, "peerGroup", p->group->name);
11489
11490 if (dn_flag[0])
11491 {
40ee54a7 11492 struct prefix prefix, *range = NULL;
f14e6fdb 11493
40ee54a7
TT
11494 sockunion2hostprefix(&(p->su), &prefix);
11495 range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix);
856ca177
MS
11496
11497 if (range)
11498 {
11499 prefix2str(range, buf1, sizeof(buf1));
11500 json_object_string_add(json_neigh, "peerSubnetRangeGroup", buf1);
11501 }
11502 }
11503 }
11504 else
f14e6fdb 11505 {
856ca177
MS
11506 vty_out (vty, " Member of peer-group %s for session parameters%s",
11507 p->group->name, VTY_NEWLINE);
f14e6fdb 11508
856ca177 11509 if (dn_flag[0])
f14e6fdb 11510 {
40ee54a7 11511 struct prefix prefix, *range = NULL;
856ca177 11512
40ee54a7
TT
11513 sockunion2hostprefix(&(p->su), &prefix);
11514 range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix);
856ca177
MS
11515
11516 if (range)
11517 {
11518 prefix2str(range, buf1, sizeof(buf1));
11519 vty_out (vty, " Belongs to the subnet range group: %s%s", buf1, VTY_NEWLINE);
11520 }
f14e6fdb
DS
11521 }
11522 }
11523 }
718e3744 11524
856ca177
MS
11525 if (use_json)
11526 {
11527 /* Administrative shutdown. */
11528 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
11529 json_object_boolean_true_add(json_neigh, "adminShutDown");
718e3744 11530
856ca177
MS
11531 /* BGP Version. */
11532 json_object_int_add(json_neigh, "bgpVersion", 4);
11533 json_object_string_add(json_neigh, "remoteRouterId", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ));
718e3744 11534
856ca177
MS
11535 /* Confederation */
11536 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) && bgp_confederation_peers_check (bgp, p->as))
11537 json_object_boolean_true_add(json_neigh, "nbrCommonAdmin");
11538
11539 /* Status. */
11540 json_object_string_add(json_neigh, "bgpState", LOOKUP (bgp_status_msg, p->status));
11541
11542 if (p->status == Established)
11543 {
11544 time_t uptime;
11545 struct tm *tm;
11546
11547 uptime = bgp_clock();
11548 uptime -= p->uptime;
11549 tm = gmtime(&uptime);
11550
11551 json_object_int_add(json_neigh, "bgpTimerUp", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000));
11552 }
11553
11554 else if (p->status == Active)
11555 {
11556 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
11557 json_object_string_add(json_neigh, "bgpStateIs", "passive");
11558 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
11559 json_object_string_add(json_neigh, "bgpStateIs", "passiveNSF");
11560 }
11561
11562 /* read timer */
11563 time_t uptime;
11564 struct tm *tm;
11565
11566 uptime = bgp_clock();
11567 uptime -= p->readtime;
11568 tm = gmtime(&uptime);
11569 json_object_int_add(json_neigh, "bgpTimerLastRead", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000));
11570
11571 uptime = bgp_clock();
11572 uptime -= p->last_write;
11573 tm = gmtime(&uptime);
39e871e6
ST
11574 json_object_int_add(json_neigh, "bgpTimerLastWrite", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000));
11575
11576 uptime = bgp_clock();
11577 uptime -= p->update_time;
11578 tm = gmtime(&uptime);
11579 json_object_int_add(json_neigh, "bgpInUpdateElapsedTimeMsecs",
11580 (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000));
856ca177
MS
11581
11582 /* Configured timer values. */
11583 json_object_int_add(json_neigh, "bgpTimerHoldTimeMsecs", p->v_holdtime * 1000);
11584 json_object_int_add(json_neigh, "bgpTimerKeepAliveIntervalMsecs", p->v_keepalive * 1000);
11585
11586 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
11587 {
11588 json_object_int_add(json_neigh, "bgpTimerConfiguredHoldTimeMsecs", p->holdtime * 1000);
11589 json_object_int_add(json_neigh, "bgpTimerConfiguredKeepAliveIntervalMsecs", p->keepalive * 1000);
11590 }
93406d87 11591 }
856ca177
MS
11592 else
11593 {
11594 /* Administrative shutdown. */
11595 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
11596 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
11597
11598 /* BGP Version. */
11599 vty_out (vty, " BGP version 4");
11600 vty_out (vty, ", remote router ID %s%s", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
11601 VTY_NEWLINE);
11602
11603 /* Confederation */
11604 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
11605 && bgp_confederation_peers_check (bgp, p->as))
11606 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
718e3744 11607
856ca177
MS
11608 /* Status. */
11609 vty_out (vty, " BGP state = %s", LOOKUP (bgp_status_msg, p->status));
718e3744 11610
856ca177
MS
11611 if (p->status == Established)
11612 vty_out (vty, ", up for %8s", peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL));
11613
11614 else if (p->status == Active)
11615 {
11616 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
11617 vty_out (vty, " (passive)");
11618 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
11619 vty_out (vty, " (NSF passive)");
11620 }
11621 vty_out (vty, "%s", VTY_NEWLINE);
93406d87 11622
856ca177
MS
11623 /* read timer */
11624 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN, 0, NULL));
11625 vty_out (vty, ", Last write %s%s",
11626 peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN, 0, NULL), VTY_NEWLINE);
11627
11628 /* Configured timer values. */
11629 vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s",
11630 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
11631 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
11632 {
11633 vty_out (vty, " Configured hold time is %d", p->holdtime);
11634 vty_out (vty, ", keepalive interval is %d seconds%s",
11635 p->keepalive, VTY_NEWLINE);
11636 }
11637 }
718e3744 11638 /* Capability. */
11639 if (p->status == Established)
11640 {
538621f2 11641 if (p->cap
718e3744 11642 || p->afc_adv[AFI_IP][SAFI_UNICAST]
11643 || p->afc_recv[AFI_IP][SAFI_UNICAST]
11644 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
11645 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
11646#ifdef HAVE_IPV6
11647 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
11648 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
11649 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
11650 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
945c8fe9
LB
11651 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
11652 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
8b1fb8be
LB
11653 || p->afc_adv[AFI_IP6][SAFI_ENCAP]
11654 || p->afc_recv[AFI_IP6][SAFI_ENCAP]
718e3744 11655#endif /* HAVE_IPV6 */
8b1fb8be
LB
11656 || p->afc_adv[AFI_IP][SAFI_ENCAP]
11657 || p->afc_recv[AFI_IP][SAFI_ENCAP]
718e3744 11658 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
11659 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
11660 {
856ca177
MS
11661 if (use_json)
11662 {
11663 json_object *json_cap = NULL;
11664
11665 json_cap = json_object_new_object();
11666
11667 /* AS4 */
11668 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
11669 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
11670 {
11671 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) && CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
11672 json_object_string_add(json_cap, "4byteAs", "advertisedAndReceived");
11673 else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
11674 json_object_string_add(json_cap, "4byteAs", "advertised");
11675 else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
11676 json_object_string_add(json_cap, "4byteAs", "received");
11677 }
11678
11679 /* AddPath */
11680 if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV)
11681 || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV))
11682 {
11683 json_object *json_add = NULL;
11684 const char *print_store;
718e3744 11685
856ca177 11686 json_add = json_object_new_object();
a82478b9 11687
856ca177
MS
11688 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
11689 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
11690 {
11691 json_object *json_sub = NULL;
11692 json_sub = json_object_new_object();
11693 print_store = afi_safi_print (afi, safi);
11694
11695 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ||
11696 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV))
11697 {
11698 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))
11699 json_object_boolean_true_add(json_sub, "txAdvertisedAndReceived");
11700 else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV))
11701 json_object_boolean_true_add(json_sub, "txAdvertised");
11702 else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV))
11703 json_object_boolean_true_add(json_sub, "txReceived");
11704 }
11705
11706 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ||
11707 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
11708 {
11709 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))
11710 json_object_boolean_true_add(json_sub, "rxAdvertisedAndReceived");
11711 else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV))
11712 json_object_boolean_true_add(json_sub, "rxAdvertised");
11713 else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
11714 json_object_boolean_true_add(json_sub, "rxReceived");
11715 }
11716
11717 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ||
11718 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV) ||
11719 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ||
11720 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
11721 json_object_object_add(json_add, print_store, json_sub);
11722 }
a82478b9 11723
856ca177
MS
11724 json_object_object_add(json_cap, "addPath", json_add);
11725 }
11726
11727 /* Dynamic */
11728 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
11729 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
11730 {
11731 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) && CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
11732 json_object_string_add(json_cap, "dynamic", "advertisedAndReceived");
11733 else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
11734 json_object_string_add(json_cap, "dynamic", "advertised");
11735 else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
11736 json_object_string_add(json_cap, "dynamic", "received");
11737 }
11738
11739 /* Extended nexthop */
11740 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)
11741 || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV))
11742 {
11743 json_object *json_nxt = NULL;
11744 const char *print_store;
11745
11746 json_nxt = json_object_new_object();
11747
11748 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) && CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
11749 json_object_string_add(json_cap, "extendedNexthop", "advertisedAndReceived");
11750 else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV))
11751 json_object_string_add(json_cap, "extendedNexthop", "advertised");
11752 else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
11753 json_object_string_add(json_cap, "extendedNexthop", "received");
11754
11755 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
11756 {
11757 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
11758 {
11759 if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV))
11760 {
11761 print_store = afi_safi_print (AFI_IP, safi);
11762 json_object_string_add(json_nxt, print_store, "recieved");
11763 }
11764 }
11765 json_object_object_add(json_cap, "extendedNexthopFamililesByPeer", json_nxt);
11766 }
11767 }
11768
11769 /* Route Refresh */
11770 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
11771 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
11772 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
11773 {
11774 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)))
11775 {
11776 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV))
11777 json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOldNew");
11778 else
11779 {
11780 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
11781 json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOld");
11782 else
11783 json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedNew");
11784 }
11785 }
11786 else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
11787 json_object_string_add(json_cap, "routeRefresh", "advertised");
11788 else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
11789 json_object_string_add(json_cap, "routeRefresh", "received");
11790 }
11791
11792 /* Multiprotocol Extensions */
11793 json_object *json_multi = NULL;
11794 json_multi = json_object_new_object();
11795
11796 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
11797 {
11798 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
11799 {
11800 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
11801 {
11802 json_object *json_exten = NULL;
11803 json_exten = json_object_new_object();
11804
11805 if (p->afc_adv[afi][safi] && p->afc_recv[afi][safi])
11806 json_object_boolean_true_add(json_exten, "advertisedAndReceived");
11807 else if (p->afc_adv[afi][safi])
11808 json_object_boolean_true_add(json_exten, "advertised");
11809 else if (p->afc_recv[afi][safi])
11810 json_object_boolean_true_add(json_exten, "received");
11811
11812 json_object_object_add(json_multi, afi_safi_print (afi, safi), json_exten);
11813 }
11814 }
11815 }
11816 json_object_object_add(json_cap, "multiprotocolExtensions", json_multi);
11817
11818 /* Gracefull Restart */
11819 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
11820 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
11821 {
11822 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) && CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
11823 json_object_string_add(json_cap, "gracefulRestart", "advertisedAndReceived");
11824 else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
11825 json_object_string_add(json_cap, "gracefulRestartCapability", "advertised");
11826 else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
11827 json_object_string_add(json_cap, "gracefulRestartCapability", "received");
11828
11829 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
11830 {
11831 int restart_af_count = 0;
11832 json_object *json_restart = NULL;
11833 json_restart = json_object_new_object();
11834
11835 json_object_int_add(json_cap, "gracefulRestartRemoteTimerMsecs", p->v_gr_restart * 1000);
11836
11837 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
11838 {
11839 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
11840 {
11841 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
11842 {
11843 json_object *json_sub = NULL;
11844 json_sub = json_object_new_object();
11845
11846 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV))
11847 json_object_boolean_true_add(json_sub, "preserved");
11848 restart_af_count++;
11849 json_object_object_add(json_restart, afi_safi_print (afi, safi), json_sub);
11850 }
11851 }
11852 }
11853 if (! restart_af_count)
11854 json_object_string_add(json_cap, "addressFamiliesByPeer", "none");
11855 else
11856 json_object_object_add(json_cap, "addressFamiliesByPeer", json_restart);
11857 }
11858 }
11859 json_object_object_add(json_neigh, "neighborCapabilities", json_cap);
11860 }
11861 else
11862 {
11863 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
11864
11865 /* AS4 */
11866 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
11867 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
11868 {
11869 vty_out (vty, " 4 Byte AS:");
11870 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
11871 vty_out (vty, " advertised");
11872 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
11873 vty_out (vty, " %sreceived",
11874 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
11875 vty_out (vty, "%s", VTY_NEWLINE);
11876 }
11877
11878 /* AddPath */
11879 if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV)
11880 || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV))
11881 {
11882 vty_out (vty, " AddPath:%s", VTY_NEWLINE);
a82478b9 11883
856ca177
MS
11884 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
11885 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
a82478b9 11886 {
856ca177
MS
11887 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ||
11888 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV))
11889 {
11890 vty_out (vty, " %s: TX ", afi_safi_print (afi, safi));
a82478b9 11891
856ca177
MS
11892 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV))
11893 vty_out (vty, "advertised %s", afi_safi_print (afi, safi));
a82478b9 11894
856ca177
MS
11895 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV))
11896 vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" );
a82478b9 11897
856ca177
MS
11898 vty_out (vty, "%s", VTY_NEWLINE);
11899 }
a82478b9 11900
856ca177 11901 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ||
a82478b9 11902 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
856ca177
MS
11903 {
11904 vty_out (vty, " %s: RX ", afi_safi_print (afi, safi));
a82478b9 11905
856ca177
MS
11906 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV))
11907 vty_out (vty, "advertised %s", afi_safi_print (afi, safi));
a82478b9 11908
856ca177
MS
11909 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
11910 vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" );
a82478b9 11911
856ca177
MS
11912 vty_out (vty, "%s", VTY_NEWLINE);
11913 }
a82478b9 11914 }
856ca177 11915 }
a82478b9 11916
856ca177
MS
11917 /* Dynamic */
11918 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
11919 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
11920 {
11921 vty_out (vty, " Dynamic:");
11922 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
11923 vty_out (vty, " advertised");
11924 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
11925 vty_out (vty, " %sreceived",
11926 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
11927 vty_out (vty, "%s", VTY_NEWLINE);
11928 }
11929
11930 /* Extended nexthop */
11931 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)
11932 || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV))
11933 {
11934 vty_out (vty, " Extended nexthop:");
11935 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV))
11936 vty_out (vty, " advertised");
11937 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
11938 vty_out (vty, " %sreceived",
11939 CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) ? "and " : "");
11940 vty_out (vty, "%s", VTY_NEWLINE);
718e3744 11941
856ca177
MS
11942 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
11943 {
11944 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
11945 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
11946 if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV))
11947 vty_out (vty, " %s%s",
11948 afi_safi_print (AFI_IP, safi), VTY_NEWLINE);
11949 }
11950 }
8a92a8a0 11951
856ca177
MS
11952 /* Route Refresh */
11953 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
11954 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
11955 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
11956 {
11957 vty_out (vty, " Route refresh:");
11958 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
11959 vty_out (vty, " advertised");
11960 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
11961 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
11962 vty_out (vty, " %sreceived(%s)",
11963 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
11964 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
11965 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
11966 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
8a92a8a0 11967
856ca177
MS
11968 vty_out (vty, "%s", VTY_NEWLINE);
11969 }
718e3744 11970
856ca177
MS
11971 /* Multiprotocol Extensions */
11972 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
11973 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
11974 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
11975 {
11976 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
11977 if (p->afc_adv[afi][safi])
11978 vty_out (vty, " advertised");
11979 if (p->afc_recv[afi][safi])
11980 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
11981 vty_out (vty, "%s", VTY_NEWLINE);
11982 }
538621f2 11983
04b6bdc0
DW
11984 /* Hostname capability */
11985 if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV) ||
11986 CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV))
11987 {
11988 vty_out (vty, " Hostname Capability:");
11989 if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV))
11990 vty_out (vty, " advertised");
11991 if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_RCV))
11992 vty_out (vty, " %sreceived",
11993 CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV) ? "and " : "");
11994 vty_out (vty, "%s", VTY_NEWLINE);
11995 }
11996
856ca177
MS
11997 /* Gracefull Restart */
11998 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
11999 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
12000 {
12001 vty_out (vty, " Graceful Restart Capabilty:");
12002 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
538621f2 12003 vty_out (vty, " advertised");
856ca177
MS
12004 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
12005 vty_out (vty, " %sreceived",
12006 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
12007 vty_out (vty, "%s", VTY_NEWLINE);
538621f2 12008
856ca177
MS
12009 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
12010 {
12011 int restart_af_count = 0;
12012
12013 vty_out (vty, " Remote Restart timer is %d seconds%s",
12014 p->v_gr_restart, VTY_NEWLINE);
12015 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
12016
12017 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12018 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12019 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
12020 {
12021 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
12022 afi_safi_print (afi, safi),
12023 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
12024 "preserved" : "not preserved");
12025 restart_af_count++;
12026 }
12027 if (! restart_af_count)
12028 vty_out (vty, "none");
12029 vty_out (vty, "%s", VTY_NEWLINE);
12030 }
12031 }
12032 }
718e3744 12033 }
12034 }
12035
93406d87 12036 /* graceful restart information */
12037 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
12038 || p->t_gr_restart
12039 || p->t_gr_stale)
12040 {
856ca177
MS
12041 json_object *json_grace = NULL;
12042 json_object *json_grace_send = NULL;
12043 json_object *json_grace_recv = NULL;
93406d87 12044 int eor_send_af_count = 0;
12045 int eor_receive_af_count = 0;
12046
856ca177
MS
12047 if (use_json)
12048 {
12049 json_grace = json_object_new_object();
12050 json_grace_send = json_object_new_object();
12051 json_grace_recv = json_object_new_object();
12052
12053 if (p->status == Established)
12054 {
12055 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12056 {
12057 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12058 {
12059 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
12060 {
12061 json_object_boolean_true_add(json_grace_send, afi_safi_print (afi, safi));
12062 eor_send_af_count++;
12063 }
12064 }
12065 }
12066 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12067 {
12068 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12069 {
12070 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
12071 {
12072 json_object_boolean_true_add(json_grace_recv, afi_safi_print (afi, safi));
12073 eor_receive_af_count++;
12074 }
12075 }
12076 }
12077 }
12078
12079 json_object_object_add(json_grace, "endOfRibSend", json_grace_send);
12080 json_object_object_add(json_grace, "endOfRibRecv", json_grace_recv);
12081
12082 if (p->t_gr_restart)
12083 json_object_int_add(json_grace, "gracefulRestartTimerMsecs", thread_timer_remain_second (p->t_gr_restart) * 1000);
12084
12085 if (p->t_gr_stale)
12086 json_object_int_add(json_grace, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p->t_gr_stale) * 1000);
12087
12088 json_object_object_add(json_neigh, "gracefulRestartInfo", json_grace);
12089 }
12090 else
12091 {
12092 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
12093 if (p->status == Established)
12094 {
12095 vty_out (vty, " End-of-RIB send: ");
12096 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12097 {
12098 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12099 {
12100 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
12101 {
12102 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
12103 afi_safi_print (afi, safi));
12104 eor_send_af_count++;
12105 }
12106 }
12107 }
12108 vty_out (vty, "%s", VTY_NEWLINE);
12109 vty_out (vty, " End-of-RIB received: ");
12110 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12111 {
12112 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12113 {
12114 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
12115 {
12116 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
12117 afi_safi_print (afi, safi));
12118 eor_receive_af_count++;
12119 }
12120 }
12121 }
12122 vty_out (vty, "%s", VTY_NEWLINE);
12123 }
93406d87 12124
856ca177
MS
12125 if (p->t_gr_restart)
12126 vty_out (vty, " The remaining time of restart timer is %ld%s",
12127 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
0b2aa3a0 12128
856ca177
MS
12129 if (p->t_gr_stale)
12130 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
12131 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
12132 }
12133 }
12134 if (use_json)
12135 {
12136 json_object *json_stat = NULL;
12137 json_stat = json_object_new_object();
12138 /* Packet counts. */
12139 json_object_int_add(json_stat, "depthInq", 0);
12140 json_object_int_add(json_stat, "depthOutq", (unsigned long) p->obuf->count);
12141 json_object_int_add(json_stat, "opensSent", p->open_out);
12142 json_object_int_add(json_stat, "opensRecv", p->open_in);
12143 json_object_int_add(json_stat, "notificationsSent", p->notify_out);
12144 json_object_int_add(json_stat, "notificationsRecv", p->notify_in);
12145 json_object_int_add(json_stat, "updatesSent", p->update_out);
12146 json_object_int_add(json_stat, "updatesRecv", p->update_in);
12147 json_object_int_add(json_stat, "keepalivesSent", p->keepalive_out);
12148 json_object_int_add(json_stat, "keepalivesRecv", p->keepalive_in);
12149 json_object_int_add(json_stat, "routeRefreshSent", p->refresh_out);
12150 json_object_int_add(json_stat, "routeRefreshRecv", p->refresh_in);
12151 json_object_int_add(json_stat, "capabilitySent", p->dynamic_cap_out);
12152 json_object_int_add(json_stat, "capabilityRecv", p->dynamic_cap_in);
12153 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);
12154 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);
12155 json_object_object_add(json_neigh, "messageStats", json_stat);
12156 }
12157 else
12158 {
12159 /* Packet counts. */
12160 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
12161 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
12162 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
12163 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
12164 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
12165 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
12166 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
12167 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
12168 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
12169 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
12170 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
12171 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
12172 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
12173 p->dynamic_cap_in, VTY_NEWLINE);
718e3744 12174 }
12175
856ca177
MS
12176 if (use_json)
12177 {
12178 /* advertisement-interval */
12179 json_object_int_add(json_neigh, "minBtwnAdvertisementRunsTimerMsecs", p->v_routeadv * 1000);
718e3744 12180
856ca177
MS
12181 /* Update-source. */
12182 if (p->update_if || p->update_source)
12183 {
12184 if (p->update_if)
12185 json_object_string_add(json_neigh, "updateSource", p->update_if);
12186 else if (p->update_source)
12187 json_object_string_add(json_neigh, "updateSource", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
12188 }
12189
12190 /* Default weight */
12191 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
12192 json_object_int_add(json_neigh, "defaultWeight", p->weight);
12193
12194 }
12195 else
12196 {
12197 /* advertisement-interval */
12198 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
12199 p->v_routeadv, VTY_NEWLINE);
12200
12201 /* Update-source. */
12202 if (p->update_if || p->update_source)
12203 {
12204 vty_out (vty, " Update source is ");
12205 if (p->update_if)
12206 vty_out (vty, "%s", p->update_if);
12207 else if (p->update_source)
12208 vty_out (vty, "%s", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
12209 vty_out (vty, "%s", VTY_NEWLINE);
12210 }
12211
12212 /* Default weight */
12213 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
12214 vty_out (vty, " Default weight %d%s", p->weight, VTY_NEWLINE);
12215
12216 vty_out (vty, "%s", VTY_NEWLINE);
12217 }
718e3744 12218
12219 /* Address Family Information */
856ca177
MS
12220 json_object *json_hold = NULL;
12221
12222 if (use_json)
12223 json_hold = json_object_new_object();
12224
538621f2 12225 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12226 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12227 if (p->afc[afi][safi])
856ca177 12228 bgp_show_peer_afi (vty, p, afi, safi, use_json, json_hold);
718e3744 12229
856ca177
MS
12230 if (use_json)
12231 {
12232 json_object_int_add(json_hold, "connectionsEstablished", p->established);
12233 json_object_int_add(json_hold, "connectionsDropped", p->dropped);
12234 }
12235 else
12236 vty_out (vty, " Connections established %d; dropped %d%s", p->established, p->dropped,
12237 VTY_NEWLINE);
718e3744 12238
d6661008 12239 if (! p->last_reset)
856ca177
MS
12240 {
12241 if (use_json)
12242 json_object_string_add(json_hold, "lastReset", "never");
12243 else
12244 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
12245 }
e0701b79 12246 else
d6661008 12247 {
856ca177
MS
12248 if (use_json)
12249 {
12250 time_t uptime;
12251 struct tm *tm;
12252
12253 uptime = bgp_clock();
12254 uptime -= p->resettime;
12255 tm = gmtime(&uptime);
12256 json_object_int_add(json_hold, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000));
12257 json_object_string_add(json_hold, "lastResetDueTo", peer_down_str[(int) p->last_reset]);
12258 if (p->last_reset_cause_size)
12259 {
39e871e6
ST
12260 char errorcodesubcode_hexstr[5];
12261 sprintf(errorcodesubcode_hexstr, "%02X%02X", p->notify.code, p->notify.subcode);
12262 json_object_string_add(json_hold, "lastErrorCodeSubcode", errorcodesubcode_hexstr);
856ca177
MS
12263 }
12264 }
12265 else
d6661008 12266 {
3a8c7ba1
DW
12267 vty_out (vty, " Last reset %s, ",
12268 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN, 0, NULL));
12269
12270 if (p->last_reset == PEER_DOWN_NOTIFY_SEND ||
12271 p->last_reset == PEER_DOWN_NOTIFY_RECEIVED)
12272 {
12273 code_str = bgp_notify_code_str(p->notify.code);
12274 subcode_str = bgp_notify_subcode_str(p->notify.code, p->notify.subcode);
12275 vty_out (vty, "due to NOTIFICATION %s (%s%s)%s",
12276 p->last_reset == PEER_DOWN_NOTIFY_SEND ? "sent" : "received",
12277 code_str, subcode_str, VTY_NEWLINE);
12278 }
12279 else
12280 {
12281 vty_out (vty, "due to %s%s",
12282 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
12283 }
856ca177
MS
12284
12285 if (p->last_reset_cause_size)
d6661008 12286 {
856ca177
MS
12287 msg = p->last_reset_cause;
12288 vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE);
12289 for (i = 1; i <= p->last_reset_cause_size; i++)
12290 {
12291 vty_out(vty, "%02X", *msg++);
d6661008 12292
856ca177
MS
12293 if (i != p->last_reset_cause_size)
12294 {
12295 if (i % 16 == 0)
12296 {
12297 vty_out(vty, "%s ", VTY_NEWLINE);
12298 }
12299 else if (i % 4 == 0)
12300 {
12301 vty_out(vty, " ");
12302 }
12303 }
12304 }
12305 vty_out(vty, "%s", VTY_NEWLINE);
d6661008 12306 }
d6661008
DS
12307 }
12308 }
848973c7 12309
718e3744 12310 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
12311 {
856ca177
MS
12312 if (use_json)
12313 json_object_boolean_true_add(json_hold, "prefixesConfigExceedMax");
12314 else
12315 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
0a486e5f 12316
12317 if (p->t_pmax_restart)
856ca177
MS
12318 {
12319 if (use_json)
12320 {
e8f7da3a 12321 json_object_boolean_true_add(json_hold, "reducePrefixNumFrom");
856ca177
MS
12322 json_object_int_add(json_hold, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000);
12323 }
12324 else
12325 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
12326 p->host, thread_timer_remain_second (p->t_pmax_restart),
12327 VTY_NEWLINE);
12328 }
0a486e5f 12329 else
856ca177
MS
12330 {
12331 if (use_json)
e8f7da3a 12332 json_object_boolean_true_add(json_hold, "reducePrefixNumAndClearIpBgp");
856ca177
MS
12333 else
12334 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
12335 p->host, VTY_NEWLINE);
12336 }
718e3744 12337 }
12338
856ca177
MS
12339 if (use_json)
12340 json_object_object_add(json_neigh, "addressFamilyInfo", json_hold);
12341
f5a4827d 12342 /* EBGP Multihop and GTSM */
6d85b15b 12343 if (p->sort != BGP_PEER_IBGP)
f5a4827d 12344 {
856ca177
MS
12345 if (use_json)
12346 {
12347 if (p->gtsm_hops > 0)
12348 json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->gtsm_hops);
12349 else if (p->ttl > 1)
12350 json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->ttl);
12351 }
12352 else
12353 {
12354 if (p->gtsm_hops > 0)
12355 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
12356 p->gtsm_hops, VTY_NEWLINE);
12357 else if (p->ttl > 1)
12358 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
12359 p->ttl, VTY_NEWLINE);
12360 }
f5a4827d 12361 }
5d804b43
PM
12362 else
12363 {
12364 if (p->gtsm_hops > 0)
856ca177
MS
12365 {
12366 if (use_json)
12367 json_object_int_add(json_neigh, "internalBgpNbrMaxHopsAway", p->gtsm_hops);
12368 else
12369 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
12370 p->gtsm_hops, VTY_NEWLINE);
12371 }
5d804b43 12372 }
718e3744 12373
12374 /* Local address. */
12375 if (p->su_local)
12376 {
856ca177
MS
12377 if (use_json)
12378 {
12379 json_object_string_add(json_neigh, "hostLocal", sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN));
12380 json_object_int_add(json_neigh, "portLocal", ntohs (p->su_local->sin.sin_port));
12381 }
12382 else
12383 vty_out (vty, "Local host: %s, Local port: %d%s",
12384 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
12385 ntohs (p->su_local->sin.sin_port),
12386 VTY_NEWLINE);
718e3744 12387 }
12388
12389 /* Remote address. */
12390 if (p->su_remote)
12391 {
856ca177
MS
12392 if (use_json)
12393 {
12394 json_object_string_add(json_neigh, "hostForeign", sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN));
12395 json_object_int_add(json_neigh, "portForeign", ntohs (p->su_remote->sin.sin_port));
12396 }
12397 else
12398 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
718e3744 12399 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
12400 ntohs (p->su_remote->sin.sin_port),
12401 VTY_NEWLINE);
12402 }
12403
12404 /* Nexthop display. */
12405 if (p->su_local)
12406 {
856ca177
MS
12407 if (use_json)
12408 {
12409 json_object_string_add(json_neigh, "nexthop", inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ));
718e3744 12410#ifdef HAVE_IPV6
856ca177
MS
12411 json_object_string_add(json_neigh, "nexthopGlobal", inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ));
12412 json_object_string_add(json_neigh, "nexthopLocal", inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ));
12413 if (p->shared_network)
12414 json_object_string_add(json_neigh, "bgpConnection", "sharedNetwork");
12415 else
12416 json_object_string_add(json_neigh, "bgpConnection", "nonSharedNetwork");
12417#endif /* HAVE_IPV6 */
12418 }
12419 else
12420 {
12421 vty_out (vty, "Nexthop: %s%s",
12422 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
12423 VTY_NEWLINE);
12424#ifdef HAVE_IPV6
12425 vty_out (vty, "Nexthop global: %s%s",
12426 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
12427 VTY_NEWLINE);
12428 vty_out (vty, "Nexthop local: %s%s",
12429 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
12430 VTY_NEWLINE);
12431 vty_out (vty, "BGP connection: %s%s",
12432 p->shared_network ? "shared network" : "non shared network",
12433 VTY_NEWLINE);
718e3744 12434#endif /* HAVE_IPV6 */
856ca177 12435 }
718e3744 12436 }
12437
12438 /* Timer information. */
856ca177
MS
12439 if (use_json)
12440 {
39e871e6 12441 json_object_int_add(json_neigh, "connectRetryTimer", p->v_connect);
dd9275d6
ST
12442 if (p->status == Established && p->rtt)
12443 json_object_int_add(json_neigh, "estimatedRttInMsecs", p->rtt);
856ca177
MS
12444 if (p->t_start)
12445 json_object_int_add(json_neigh, "nextStartTimerDueInMsecs", thread_timer_remain_second (p->t_start) * 1000);
12446 if (p->t_connect)
12447 json_object_int_add(json_neigh, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p->t_connect) * 1000);
12448 if (p->t_routeadv)
12449 {
12450 json_object_int_add(json_neigh, "mraiInterval", p->v_routeadv);
12451 json_object_int_add(json_neigh, "mraiTimerExpireInMsecs", thread_timer_remain_second (p->t_routeadv) * 1000);
12452 }
cb1faec9 12453
856ca177
MS
12454 if (p->t_read)
12455 json_object_string_add(json_neigh, "readThread", "on");
12456 else
12457 json_object_string_add(json_neigh, "readThread", "off");
12458 if (p->t_write)
12459 json_object_string_add(json_neigh, "writeThread", "on");
12460 else
12461 json_object_string_add(json_neigh, "writeThread", "off");
12462 }
12463 else
12464 {
39e871e6
ST
12465 vty_out (vty, "BGP Connect Retry Timer in Seconds: %d%s",
12466 p->v_connect, VTY_NEWLINE);
dd9275d6
ST
12467 if (p->status == Established && p->rtt)
12468 vty_out (vty, "Estimated round trip time: %d ms%s",
12469 p->rtt, VTY_NEWLINE);
856ca177
MS
12470 if (p->t_start)
12471 vty_out (vty, "Next start timer due in %ld seconds%s",
12472 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
12473 if (p->t_connect)
12474 vty_out (vty, "Next connect timer due in %ld seconds%s",
12475 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
12476 if (p->t_routeadv)
12477 vty_out (vty, "MRAI (interval %u) timer expires in %ld seconds%s",
12478 p->v_routeadv, thread_timer_remain_second (p->t_routeadv),
12479 VTY_NEWLINE);
12480
12481 vty_out (vty, "Read thread: %s Write thread: %s%s",
12482 p->t_read ? "on" : "off",
12483 p->t_write ? "on" : "off",
12484 VTY_NEWLINE);
12485 }
718e3744 12486
12487 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
12488 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
856ca177
MS
12489 bgp_capability_vty_out (vty, p, use_json, json_neigh);
12490
12491 if (!use_json)
12492 vty_out (vty, "%s", VTY_NEWLINE);
c43ed2e4
DS
12493
12494 /* BFD information. */
856ca177
MS
12495 bgp_bfd_show_info(vty, p, use_json, json_neigh);
12496
12497 if (use_json)
12498 {
12499 if (p->conf_if) /* Configured interface name. */
12500 json_object_object_add(json, p->conf_if, json_neigh);
12501 else /* Configured IP address. */
12502 json_object_object_add(json, p->host, json_neigh);
12503 }
718e3744 12504}
12505
94f2b392 12506static int
856ca177
MS
12507bgp_show_neighbor (struct vty *vty, struct bgp *bgp, enum show_type type,
12508 union sockunion *su, const char *conf_if, u_char use_json, json_object *json)
718e3744 12509{
1eb8ef25 12510 struct listnode *node, *nnode;
718e3744 12511 struct peer *peer;
12512 int find = 0;
12513
1eb8ef25 12514 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
718e3744 12515 {
1ff9a340
DS
12516 if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
12517 continue;
12518
718e3744 12519 switch (type)
856ca177
MS
12520 {
12521 case show_all:
e8f7da3a 12522 bgp_show_peer (vty, peer, use_json, json);
856ca177
MS
12523 break;
12524 case show_peer:
12525 if (conf_if)
12526 {
4873b3b9
DW
12527 if ((peer->conf_if && !strcmp(peer->conf_if, conf_if)) ||
12528 (peer->hostname && !strcmp(peer->hostname, conf_if)))
856ca177
MS
12529 {
12530 find = 1;
e8f7da3a 12531 bgp_show_peer (vty, peer, use_json, json);
856ca177
MS
12532 }
12533 }
12534 else
12535 {
12536 if (sockunion_same (&peer->su, su))
12537 {
12538 find = 1;
e8f7da3a 12539 bgp_show_peer (vty, peer, use_json, json);
856ca177
MS
12540 }
12541 }
12542 break;
718e3744 12543 }
12544 }
12545
12546 if (type == show_peer && ! find)
856ca177
MS
12547 {
12548 if (use_json)
12549 json_object_boolean_true_add(json, "bgpNoSuchNeighbor");
12550 else
12551 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
12552 }
12553
12554 if (use_json)
12555 {
12556 vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
12557 json_object_free(json);
12558 }
12559 else
12560 {
12561 vty_out (vty, "%s", VTY_NEWLINE);
12562 }
12563
718e3744 12564 return CMD_SUCCESS;
12565}
12566
94f2b392 12567static int
fd79ac91 12568bgp_show_neighbor_vty (struct vty *vty, const char *name,
9f689658
DD
12569 enum show_type type, const char *ip_str, u_char use_json,
12570 json_object *json)
718e3744 12571{
12572 int ret;
12573 struct bgp *bgp;
12574 union sockunion su;
856ca177 12575
9f689658 12576 if (use_json && (json == NULL))
856ca177 12577 json = json_object_new_object();
718e3744 12578
718e3744 12579 if (name)
12580 {
12581 bgp = bgp_lookup_by_name (name);
718e3744 12582 if (! bgp)
12583 {
856ca177
MS
12584 if (use_json)
12585 {
12586 json_object_boolean_true_add(json, "bgpNoSuchInstance");
12587 vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
12588 json_object_free(json);
12589 }
12590 else
12591 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
12592
718e3744 12593 return CMD_WARNING;
12594 }
718e3744 12595 }
a80beece
DS
12596 else
12597 {
12598 bgp = bgp_get_default ();
12599 }
718e3744 12600
12601 if (bgp)
a80beece
DS
12602 {
12603 if (ip_str)
12604 {
12605 ret = str2sockunion (ip_str, &su);
12606 if (ret < 0)
856ca177 12607 bgp_show_neighbor (vty, bgp, type, NULL, ip_str, use_json, json);
a80beece 12608 else
856ca177 12609 bgp_show_neighbor (vty, bgp, type, &su, NULL, use_json, json);
a80beece
DS
12610 }
12611 else
12612 {
856ca177 12613 bgp_show_neighbor (vty, bgp, type, NULL, NULL, use_json, json);
a80beece
DS
12614 }
12615 }
718e3744 12616
12617 return CMD_SUCCESS;
12618}
12619
f186de26 12620static void
12621bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json)
12622{
12623 struct listnode *node, *nnode;
12624 struct bgp *bgp;
12625 json_object *json = NULL;
9f689658
DD
12626 int is_first = 1;
12627
12628 if (use_json)
12629 vty_out (vty, "{%s", VTY_NEWLINE);
f186de26 12630
12631 for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
12632 {
f186de26 12633 if (use_json)
9f689658
DD
12634 {
12635 if (!(json = json_object_new_object()))
12636 {
12637 zlog_err("Unable to allocate memory for JSON object");
12638 vty_out (vty,
12639 "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s",
12640 VTY_NEWLINE);
12641 return;
12642 }
12643
12644 json_object_int_add(json, "vrfId",
12645 (bgp->vrf_id == VRF_UNKNOWN)
12646 ? -1 : bgp->vrf_id);
12647 json_object_string_add(json, "vrfName",
12648 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
12649 ? "Default" : bgp->name);
12650
12651 if (! is_first)
12652 vty_out (vty, ",%s", VTY_NEWLINE);
12653 else
12654 is_first = 0;
12655
12656 vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
12657 ? "Default" : bgp->name);
12658 }
12659 else
12660 {
12661 vty_out (vty, "%sInstance %s:%s",
12662 VTY_NEWLINE,
12663 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
12664 ? "Default" : bgp->name,
12665 VTY_NEWLINE);
12666 }
f186de26 12667 bgp_show_neighbor (vty, bgp, show_all, NULL, NULL, use_json, json);
12668 }
9f689658
DD
12669
12670 if (use_json)
12671 vty_out (vty, "}%s", VTY_NEWLINE);
f186de26 12672}
12673
718e3744 12674/* "show ip bgp neighbors" commands. */
12675DEFUN (show_ip_bgp_neighbors,
12676 show_ip_bgp_neighbors_cmd,
856ca177 12677 "show ip bgp neighbors {json}",
718e3744 12678 SHOW_STR
12679 IP_STR
12680 BGP_STR
856ca177
MS
12681 "Detailed information on TCP and BGP neighbor connections\n"
12682 "JavaScript Object Notation\n")
718e3744 12683{
db7c8528 12684 u_char uj = use_json(argc, argv);
856ca177 12685
9f689658 12686 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL, uj, NULL);
718e3744 12687}
12688
12689ALIAS (show_ip_bgp_neighbors,
12690 show_ip_bgp_ipv4_neighbors_cmd,
856ca177 12691 "show ip bgp ipv4 (unicast|multicast) neighbors {json}",
718e3744 12692 SHOW_STR
12693 IP_STR
12694 BGP_STR
12695 "Address family\n"
12696 "Address Family modifier\n"
12697 "Address Family modifier\n"
856ca177
MS
12698 "Detailed information on TCP and BGP neighbor connections\n"
12699 "JavaScript Object Notation\n")
718e3744 12700
12701ALIAS (show_ip_bgp_neighbors,
12702 show_ip_bgp_vpnv4_all_neighbors_cmd,
856ca177 12703 "show ip bgp vpnv4 all neighbors {json}",
718e3744 12704 SHOW_STR
12705 IP_STR
12706 BGP_STR
12707 "Display VPNv4 NLRI specific information\n"
12708 "Display information about all VPNv4 NLRIs\n"
856ca177
MS
12709 "Detailed information on TCP and BGP neighbor connections\n"
12710 "JavaScript Object Notation\n")
718e3744 12711
12712ALIAS (show_ip_bgp_neighbors,
12713 show_ip_bgp_vpnv4_rd_neighbors_cmd,
856ca177 12714 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors {json}",
718e3744 12715 SHOW_STR
12716 IP_STR
12717 BGP_STR
12718 "Display VPNv4 NLRI specific information\n"
12719 "Display information for a route distinguisher\n"
12720 "VPN Route Distinguisher\n"
856ca177
MS
12721 "Detailed information on TCP and BGP neighbor connections\n"
12722 "JavaScript Object Notation\n")
718e3744 12723
12724ALIAS (show_ip_bgp_neighbors,
12725 show_bgp_neighbors_cmd,
856ca177 12726 "show bgp neighbors {json}",
718e3744 12727 SHOW_STR
12728 BGP_STR
856ca177
MS
12729 "Detailed information on TCP and BGP neighbor connections\n"
12730 "JavaScript Object Notation\n")
718e3744 12731
12732ALIAS (show_ip_bgp_neighbors,
12733 show_bgp_ipv6_neighbors_cmd,
856ca177 12734 "show bgp ipv6 neighbors {json}",
718e3744 12735 SHOW_STR
12736 BGP_STR
12737 "Address family\n"
856ca177
MS
12738 "Detailed information on TCP and BGP neighbor connections\n"
12739 "JavaScript Object Notation\n")
718e3744 12740
12741DEFUN (show_ip_bgp_neighbors_peer,
12742 show_ip_bgp_neighbors_peer_cmd,
856ca177 12743 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
718e3744 12744 SHOW_STR
12745 IP_STR
12746 BGP_STR
12747 "Detailed information on TCP and BGP neighbor connections\n"
12748 "Neighbor to display information about\n"
a80beece 12749 "Neighbor to display information about\n"
856ca177
MS
12750 "Neighbor on bgp configured interface\n"
12751 "JavaScript Object Notation\n")
718e3744 12752{
db7c8528 12753 u_char uj = use_json(argc, argv);
856ca177 12754
9f689658 12755 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 2], uj, NULL);
718e3744 12756}
12757
12758ALIAS (show_ip_bgp_neighbors_peer,
12759 show_ip_bgp_ipv4_neighbors_peer_cmd,
856ca177 12760 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
718e3744 12761 SHOW_STR
12762 IP_STR
12763 BGP_STR
12764 "Address family\n"
12765 "Address Family modifier\n"
12766 "Address Family modifier\n"
12767 "Detailed information on TCP and BGP neighbor connections\n"
12768 "Neighbor to display information about\n"
a80beece 12769 "Neighbor to display information about\n"
856ca177
MS
12770 "Neighbor on bgp configured interface\n"
12771 "JavaScript Object Notation\n")
718e3744 12772
12773ALIAS (show_ip_bgp_neighbors_peer,
12774 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
856ca177 12775 "show ip bgp vpnv4 all neighbors A.B.C.D {json}",
718e3744 12776 SHOW_STR
12777 IP_STR
12778 BGP_STR
12779 "Display VPNv4 NLRI specific information\n"
12780 "Display information about all VPNv4 NLRIs\n"
12781 "Detailed information on TCP and BGP neighbor connections\n"
856ca177
MS
12782 "Neighbor to display information about\n"
12783 "JavaScript Object Notation\n")
718e3744 12784
12785ALIAS (show_ip_bgp_neighbors_peer,
12786 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
856ca177 12787 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D {json}",
718e3744 12788 SHOW_STR
12789 IP_STR
12790 BGP_STR
12791 "Display VPNv4 NLRI specific information\n"
12792 "Display information about all VPNv4 NLRIs\n"
12793 "Detailed information on TCP and BGP neighbor connections\n"
856ca177
MS
12794 "Neighbor to display information about\n"
12795 "JavaScript Object Notation\n")
718e3744 12796
12797ALIAS (show_ip_bgp_neighbors_peer,
12798 show_bgp_neighbors_peer_cmd,
856ca177 12799 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
718e3744 12800 SHOW_STR
12801 BGP_STR
12802 "Detailed information on TCP and BGP neighbor connections\n"
12803 "Neighbor to display information about\n"
a80beece 12804 "Neighbor to display information about\n"
856ca177
MS
12805 "Neighbor on bgp configured interface\n"
12806 "JavaScript Object Notation\n")
718e3744 12807
12808ALIAS (show_ip_bgp_neighbors_peer,
12809 show_bgp_ipv6_neighbors_peer_cmd,
856ca177 12810 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
718e3744 12811 SHOW_STR
12812 BGP_STR
12813 "Address family\n"
12814 "Detailed information on TCP and BGP neighbor connections\n"
12815 "Neighbor to display information about\n"
a80beece 12816 "Neighbor to display information about\n"
856ca177
MS
12817 "Neighbor on bgp configured interface\n"
12818 "JavaScript Object Notation\n")
718e3744 12819
12820DEFUN (show_ip_bgp_instance_neighbors,
12821 show_ip_bgp_instance_neighbors_cmd,
8386ac43 12822 "show ip bgp " BGP_INSTANCE_CMD " neighbors {json}",
718e3744 12823 SHOW_STR
12824 IP_STR
12825 BGP_STR
8386ac43 12826 BGP_INSTANCE_HELP_STR
856ca177
MS
12827 "Detailed information on TCP and BGP neighbor connections\n"
12828 "JavaScript Object Notation\n")
718e3744 12829{
db7c8528 12830 u_char uj = use_json(argc, argv);
856ca177 12831
9f689658 12832 return bgp_show_neighbor_vty (vty, argv[1], show_all, NULL, uj, NULL);
718e3744 12833}
12834
f186de26 12835DEFUN (show_ip_bgp_instance_all_neighbors,
12836 show_ip_bgp_instance_all_neighbors_cmd,
12837 "show ip bgp " BGP_INSTANCE_ALL_CMD " neighbors {json}",
12838 SHOW_STR
12839 IP_STR
12840 BGP_STR
12841 BGP_INSTANCE_ALL_HELP_STR
12842 "Detailed information on TCP and BGP neighbor connections\n"
12843 "JavaScript Object Notation\n")
12844{
12845 u_char uj = use_json(argc, argv);
12846
12847 bgp_show_all_instances_neighbors_vty (vty, uj);
12848 return CMD_SUCCESS;
12849}
12850
bb46e94f 12851ALIAS (show_ip_bgp_instance_neighbors,
12852 show_bgp_instance_neighbors_cmd,
8386ac43 12853 "show bgp " BGP_INSTANCE_CMD " neighbors {json}",
bb46e94f 12854 SHOW_STR
12855 BGP_STR
8386ac43 12856 BGP_INSTANCE_HELP_STR
856ca177
MS
12857 "Detailed information on TCP and BGP neighbor connections\n"
12858 "JavaScript Object Notation\n")
bb46e94f 12859
12860ALIAS (show_ip_bgp_instance_neighbors,
12861 show_bgp_instance_ipv6_neighbors_cmd,
8386ac43 12862 "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors {json}",
bb46e94f 12863 SHOW_STR
12864 BGP_STR
8386ac43 12865 BGP_INSTANCE_HELP_STR
bb46e94f 12866 "Address family\n"
856ca177
MS
12867 "Detailed information on TCP and BGP neighbor connections\n"
12868 "JavaScript Object Notation\n")
bb46e94f 12869
718e3744 12870DEFUN (show_ip_bgp_instance_neighbors_peer,
12871 show_ip_bgp_instance_neighbors_peer_cmd,
8386ac43 12872 "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
718e3744 12873 SHOW_STR
12874 IP_STR
12875 BGP_STR
8386ac43 12876 BGP_INSTANCE_HELP_STR
718e3744 12877 "Detailed information on TCP and BGP neighbor connections\n"
12878 "Neighbor to display information about\n"
a80beece 12879 "Neighbor to display information about\n"
856ca177
MS
12880 "Neighbor on bgp configured interface\n"
12881 "JavaScript Object Notation\n")
718e3744 12882{
db7c8528 12883 u_char uj = use_json(argc, argv);
856ca177 12884
9f689658 12885 return bgp_show_neighbor_vty (vty, argv[1], show_peer, argv[2], uj, NULL);
718e3744 12886}
bb46e94f 12887
12888ALIAS (show_ip_bgp_instance_neighbors_peer,
12889 show_bgp_instance_neighbors_peer_cmd,
8386ac43 12890 "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
bb46e94f 12891 SHOW_STR
12892 BGP_STR
8386ac43 12893 BGP_INSTANCE_HELP_STR
bb46e94f 12894 "Detailed information on TCP and BGP neighbor connections\n"
12895 "Neighbor to display information about\n"
a80beece 12896 "Neighbor to display information about\n"
856ca177
MS
12897 "Neighbor on bgp configured interface\n"
12898 "JavaScript Object Notation\n")
bb46e94f 12899
12900ALIAS (show_ip_bgp_instance_neighbors_peer,
12901 show_bgp_instance_ipv6_neighbors_peer_cmd,
8386ac43 12902 "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
bb46e94f 12903 SHOW_STR
12904 BGP_STR
8386ac43 12905 BGP_INSTANCE_HELP_STR
bb46e94f 12906 "Address family\n"
12907 "Detailed information on TCP and BGP neighbor connections\n"
12908 "Neighbor to display information about\n"
a80beece 12909 "Neighbor to display information about\n"
856ca177
MS
12910 "Neighbor on bgp configured interface\n"
12911 "JavaScript Object Notation\n")
6b0655a2 12912
718e3744 12913/* Show BGP's AS paths internal data. There are both `show ip bgp
12914 paths' and `show ip mbgp paths'. Those functions results are the
12915 same.*/
12916DEFUN (show_ip_bgp_paths,
12917 show_ip_bgp_paths_cmd,
12918 "show ip bgp paths",
12919 SHOW_STR
12920 IP_STR
12921 BGP_STR
12922 "Path information\n")
12923{
12924 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
12925 aspath_print_all_vty (vty);
12926 return CMD_SUCCESS;
12927}
12928
12929DEFUN (show_ip_bgp_ipv4_paths,
12930 show_ip_bgp_ipv4_paths_cmd,
12931 "show ip bgp ipv4 (unicast|multicast) paths",
12932 SHOW_STR
12933 IP_STR
12934 BGP_STR
12935 "Address family\n"
12936 "Address Family modifier\n"
12937 "Address Family modifier\n"
12938 "Path information\n")
12939{
12940 vty_out (vty, "Address Refcnt Path\r\n");
12941 aspath_print_all_vty (vty);
12942
12943 return CMD_SUCCESS;
12944}
6b0655a2 12945
718e3744 12946#include "hash.h"
12947
94f2b392 12948static void
718e3744 12949community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
12950{
12951 struct community *com;
12952
12953 com = (struct community *) backet->data;
6c4f4e6e 12954 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
718e3744 12955 community_str (com), VTY_NEWLINE);
12956}
12957
12958/* Show BGP's community internal data. */
12959DEFUN (show_ip_bgp_community_info,
12960 show_ip_bgp_community_info_cmd,
12961 "show ip bgp community-info",
12962 SHOW_STR
12963 IP_STR
12964 BGP_STR
12965 "List all bgp community information\n")
12966{
12967 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
12968
12969 hash_iterate (community_hash (),
12970 (void (*) (struct hash_backet *, void *))
12971 community_show_all_iterator,
12972 vty);
12973
12974 return CMD_SUCCESS;
12975}
12976
12977DEFUN (show_ip_bgp_attr_info,
12978 show_ip_bgp_attr_info_cmd,
12979 "show ip bgp attribute-info",
12980 SHOW_STR
12981 IP_STR
12982 BGP_STR
12983 "List all bgp attribute information\n")
12984{
12985 attr_show_all (vty);
12986 return CMD_SUCCESS;
12987}
6b0655a2 12988
8386ac43 12989static int bgp_show_update_groups(struct vty *vty, const char *name,
12990 int afi, int safi,
50ef26d4 12991 u_int64_t subgrp_id)
3f9c7369
DS
12992{
12993 struct bgp *bgp;
12994
8386ac43 12995 if (name)
12996 bgp = bgp_lookup_by_name (name);
12997 else
12998 bgp = bgp_get_default ();
12999
3f9c7369 13000 if (bgp)
8fe8a7f6 13001 update_group_show(bgp, afi, safi, vty, subgrp_id);
3f9c7369
DS
13002 return CMD_SUCCESS;
13003}
13004
f186de26 13005static void
13006bgp_show_all_instances_updgrps_vty (struct vty *vty, afi_t afi, safi_t safi)
13007{
13008 struct listnode *node, *nnode;
13009 struct bgp *bgp;
13010
13011 for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
13012 {
13013 vty_out (vty, "%sInstance %s:%s",
13014 VTY_NEWLINE,
13015 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name,
13016 VTY_NEWLINE);
13017 update_group_show(bgp, afi, safi, vty, 0);
13018 }
13019}
13020
8fe8a7f6
DS
13021DEFUN (show_ip_bgp_updgrps,
13022 show_ip_bgp_updgrps_cmd,
13023 "show ip bgp update-groups",
13024 SHOW_STR
13025 IP_STR
13026 BGP_STR
13027 "Detailed info about dynamic update groups\n")
13028{
8386ac43 13029 return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, 0));
13030}
13031
13032DEFUN (show_ip_bgp_instance_updgrps,
13033 show_ip_bgp_instance_updgrps_cmd,
13034 "show ip bgp " BGP_INSTANCE_CMD " update-groups",
13035 SHOW_STR
13036 IP_STR
13037 BGP_STR
13038 BGP_INSTANCE_HELP_STR
13039 "Detailed info about dynamic update groups\n")
13040{
13041 return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, 0));
8fe8a7f6
DS
13042}
13043
f186de26 13044DEFUN (show_ip_bgp_instance_all_updgrps,
13045 show_ip_bgp_instance_all_updgrps_cmd,
13046 "show ip bgp " BGP_INSTANCE_ALL_CMD " update-groups",
13047 SHOW_STR
13048 IP_STR
13049 BGP_STR
13050 BGP_INSTANCE_ALL_HELP_STR
13051 "Detailed info about dynamic update groups\n")
13052{
13053 bgp_show_all_instances_updgrps_vty (vty, AFI_IP, SAFI_UNICAST);
13054 return CMD_SUCCESS;
13055}
13056
3f9c7369
DS
13057DEFUN (show_bgp_ipv6_updgrps,
13058 show_bgp_ipv6_updgrps_cmd,
8fe8a7f6 13059 "show bgp update-groups",
3f9c7369
DS
13060 SHOW_STR
13061 BGP_STR
8fe8a7f6 13062 "Detailed info about v6 dynamic update groups\n")
3f9c7369 13063{
8386ac43 13064 return (bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, 0));
13065}
13066
13067DEFUN (show_bgp_instance_ipv6_updgrps,
13068 show_bgp_instance_ipv6_updgrps_cmd,
13069 "show bgp " BGP_INSTANCE_CMD " update-groups",
13070 SHOW_STR
13071 BGP_STR
13072 BGP_INSTANCE_HELP_STR
13073 "Detailed info about v6 dynamic update groups\n")
13074{
13075 return (bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, 0));
3f9c7369
DS
13076}
13077
f186de26 13078DEFUN (show_bgp_instance_all_ipv6_updgrps,
13079 show_bgp_instance_all_ipv6_updgrps_cmd,
13080 "show bgp " BGP_INSTANCE_ALL_CMD " update-groups",
13081 SHOW_STR
13082 BGP_STR
13083 BGP_INSTANCE_ALL_HELP_STR
13084 "Detailed info about v6 dynamic update groups\n")
13085{
13086 bgp_show_all_instances_updgrps_vty (vty, AFI_IP6, SAFI_UNICAST);
13087 return CMD_SUCCESS;
13088}
13089
3f9c7369
DS
13090DEFUN (show_bgp_updgrps,
13091 show_bgp_updgrps_cmd,
8fe8a7f6 13092 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups",
3f9c7369
DS
13093 SHOW_STR
13094 BGP_STR
13095 "Address family\n"
13096 "Address family\n"
13097 "Address Family modifier\n"
13098 "Address Family modifier\n"
8fe8a7f6 13099 "Detailed info about dynamic update groups\n")
3f9c7369 13100{
3f9c7369
DS
13101 afi_t afi;
13102 safi_t safi;
13103
13104 afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
13105 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8386ac43 13106 return (bgp_show_update_groups(vty, NULL, afi, safi, 0));
8fe8a7f6
DS
13107}
13108
13109DEFUN (show_ip_bgp_updgrps_s,
13110 show_ip_bgp_updgrps_s_cmd,
13111 "show ip bgp update-groups SUBGROUP-ID",
13112 SHOW_STR
13113 IP_STR
13114 BGP_STR
13115 "Detailed info about dynamic update groups\n"
13116 "Specific subgroup to display detailed info for\n")
13117{
13118 u_int64_t subgrp_id;
13119
13120 VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]);
8386ac43 13121 return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, subgrp_id));
13122}
13123
13124DEFUN (show_ip_bgp_instance_updgrps_s,
13125 show_ip_bgp_instance_updgrps_s_cmd,
13126 "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID",
13127 SHOW_STR
13128 IP_STR
13129 BGP_STR
13130 BGP_INSTANCE_HELP_STR
13131 "Detailed info about dynamic update groups\n"
13132 "Specific subgroup to display detailed info for\n")
13133{
13134 u_int64_t subgrp_id;
13135
13136 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
13137 return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, subgrp_id));
8fe8a7f6
DS
13138}
13139
13140DEFUN (show_bgp_ipv6_updgrps_s,
13141 show_bgp_ipv6_updgrps_s_cmd,
13142 "show bgp update-groups SUBGROUP-ID",
13143 SHOW_STR
13144 BGP_STR
13145 "Detailed info about v6 dynamic update groups\n"
13146 "Specific subgroup to display detailed info for\n")
13147{
13148 u_int64_t subgrp_id;
13149
13150 VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]);
8386ac43 13151 return(bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, subgrp_id));
13152}
13153
13154DEFUN (show_bgp_instance_ipv6_updgrps_s,
13155 show_bgp_instance_ipv6_updgrps_s_cmd,
13156 "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID",
13157 SHOW_STR
13158 BGP_STR
13159 "Detailed info about v6 dynamic update groups\n"
13160 "Specific subgroup to display detailed info for\n")
13161{
13162 u_int64_t subgrp_id;
13163
13164 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
13165 return(bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, subgrp_id));
8fe8a7f6
DS
13166}
13167
13168DEFUN (show_bgp_updgrps_s,
13169 show_bgp_updgrps_s_cmd,
13170 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID",
13171 SHOW_STR
13172 BGP_STR
13173 "Address family\n"
13174 "Address family\n"
13175 "Address Family modifier\n"
13176 "Address Family modifier\n"
13177 "Detailed info about v6 dynamic update groups\n"
13178 "Specific subgroup to display detailed info for")
13179{
13180 afi_t afi;
13181 safi_t safi;
13182 u_int64_t subgrp_id;
13183
13184 afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
13185 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
13186
13187 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
8386ac43 13188 return(bgp_show_update_groups(vty, NULL, afi, safi, subgrp_id));
3f9c7369
DS
13189}
13190
13191DEFUN (show_bgp_updgrps_stats,
13192 show_bgp_updgrps_stats_cmd,
13193 "show bgp update-groups statistics",
13194 SHOW_STR
13195 BGP_STR
13196 "BGP update groups\n"
13197 "Statistics\n")
13198{
13199 struct bgp *bgp;
13200
13201 bgp = bgp_get_default();
13202 if (bgp)
13203 update_group_show_stats(bgp, vty);
13204
13205 return CMD_SUCCESS;
13206}
13207
8386ac43 13208DEFUN (show_bgp_instance_updgrps_stats,
13209 show_bgp_instance_updgrps_stats_cmd,
13210 "show bgp " BGP_INSTANCE_CMD " update-groups statistics",
13211 SHOW_STR
13212 BGP_STR
13213 BGP_INSTANCE_HELP_STR
13214 "BGP update groups\n"
13215 "Statistics\n")
13216{
13217 struct bgp *bgp;
13218
13219 bgp = bgp_lookup_by_name (argv[1]);
13220 if (bgp)
13221 update_group_show_stats(bgp, vty);
13222
13223 return CMD_SUCCESS;
13224}
13225
3f9c7369 13226static void
8386ac43 13227show_bgp_updgrps_adj_info_aux (struct vty *vty, const char *name,
13228 afi_t afi, safi_t safi,
3f9c7369
DS
13229 const char *what, u_int64_t subgrp_id)
13230{
13231 struct bgp *bgp;
8386ac43 13232
13233 if (name)
13234 bgp = bgp_lookup_by_name (name);
13235 else
13236 bgp = bgp_get_default ();
13237
3f9c7369
DS
13238 if (bgp)
13239 {
13240 if (!strcmp(what, "advertise-queue"))
13241 update_group_show_adj_queue(bgp, afi, safi, vty, subgrp_id);
13242 else if (!strcmp(what, "advertised-routes"))
13243 update_group_show_advertised(bgp, afi, safi, vty, subgrp_id);
13244 else if (!strcmp(what, "packet-queue"))
13245 update_group_show_packet_queue(bgp, afi, safi, vty, subgrp_id);
13246 }
13247}
13248
13249DEFUN (show_ip_bgp_updgrps_adj,
13250 show_ip_bgp_updgrps_adj_cmd,
13251 "show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)",
13252 SHOW_STR
13253 IP_STR
13254 BGP_STR
13255 "BGP update groups\n"
13256 "Advertisement queue\n"
13257 "Announced routes\n"
13258 "Packet queue\n")
8fe8a7f6 13259
3f9c7369 13260{
8386ac43 13261 show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[0], 0);
13262 return CMD_SUCCESS;
13263}
13264
13265DEFUN (show_ip_bgp_instance_updgrps_adj,
13266 show_ip_bgp_instance_updgrps_adj_cmd,
13267 "show ip bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)",
13268 SHOW_STR
13269 IP_STR
13270 BGP_STR
13271 BGP_INSTANCE_HELP_STR
13272 "BGP update groups\n"
13273 "Advertisement queue\n"
13274 "Announced routes\n"
13275 "Packet queue\n")
13276
13277{
13278 show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[2], 0);
3f9c7369
DS
13279 return CMD_SUCCESS;
13280}
13281
13282DEFUN (show_bgp_updgrps_afi_adj,
13283 show_bgp_updgrps_afi_adj_cmd,
13284 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)",
13285 SHOW_STR
13286 BGP_STR
13287 "Address family\n"
13288 "Address family\n"
13289 "Address Family modifier\n"
13290 "Address Family modifier\n"
13291 "BGP update groups\n"
13292 "Advertisement queue\n"
13293 "Announced routes\n"
8fe8a7f6
DS
13294 "Packet queue\n"
13295 "Specific subgroup info wanted for\n")
3f9c7369
DS
13296{
13297 afi_t afi;
13298 safi_t safi;
13299
13300 afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
13301 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8386ac43 13302 show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[2], 0);
8fe8a7f6 13303 return CMD_SUCCESS;
3f9c7369
DS
13304}
13305
13306DEFUN (show_bgp_updgrps_adj,
13307 show_bgp_updgrps_adj_cmd,
13308 "show bgp update-groups (advertise-queue|advertised-routes|packet-queue)",
13309 SHOW_STR
13310 BGP_STR
13311 "BGP update groups\n"
13312 "Advertisement queue\n"
13313 "Announced routes\n"
13314 "Packet queue\n")
13315{
8386ac43 13316 show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[0], 0);
13317 return CMD_SUCCESS;
13318}
13319
13320DEFUN (show_bgp_instance_updgrps_adj,
13321 show_bgp_instance_updgrps_adj_cmd,
13322 "show bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)",
13323 SHOW_STR
13324 BGP_STR
13325 BGP_INSTANCE_HELP_STR
13326 "BGP update groups\n"
13327 "Advertisement queue\n"
13328 "Announced routes\n"
13329 "Packet queue\n")
13330{
13331 show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[2], 0);
3f9c7369
DS
13332 return CMD_SUCCESS;
13333}
13334
13335DEFUN (show_ip_bgp_updgrps_adj_s,
8fe8a7f6 13336 show_ip_bgp_updgrps_adj_s_cmd,
3f9c7369
DS
13337 "show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
13338 SHOW_STR
13339 IP_STR
13340 BGP_STR
13341 "BGP update groups\n"
8fe8a7f6 13342 "Specific subgroup to display info for\n"
3f9c7369
DS
13343 "Advertisement queue\n"
13344 "Announced routes\n"
13345 "Packet queue\n")
3f9c7369 13346
3f9c7369 13347{
8fe8a7f6
DS
13348 u_int64_t subgrp_id;
13349
13350 VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]);
13351
8386ac43 13352 show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[1], subgrp_id);
13353 return CMD_SUCCESS;
13354}
13355
13356DEFUN (show_ip_bgp_instance_updgrps_adj_s,
13357 show_ip_bgp_instance_updgrps_adj_s_cmd,
13358 "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
13359 SHOW_STR
13360 IP_STR
13361 BGP_STR
13362 BGP_INSTANCE_HELP_STR
13363 "BGP update groups\n"
13364 "Specific subgroup to display info for\n"
13365 "Advertisement queue\n"
13366 "Announced routes\n"
13367 "Packet queue\n")
13368
13369{
13370 u_int64_t subgrp_id;
13371
13372 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
13373
13374 show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[3], subgrp_id);
3f9c7369
DS
13375 return CMD_SUCCESS;
13376}
13377
8fe8a7f6
DS
13378DEFUN (show_bgp_updgrps_afi_adj_s,
13379 show_bgp_updgrps_afi_adj_s_cmd,
3f9c7369
DS
13380 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
13381 SHOW_STR
13382 BGP_STR
13383 "Address family\n"
13384 "Address family\n"
13385 "Address Family modifier\n"
13386 "Address Family modifier\n"
13387 "BGP update groups\n"
8fe8a7f6 13388 "Specific subgroup to display info for\n"
3f9c7369
DS
13389 "Advertisement queue\n"
13390 "Announced routes\n"
8fe8a7f6
DS
13391 "Packet queue\n"
13392 "Specific subgroup info wanted for\n")
3f9c7369
DS
13393{
13394 afi_t afi;
13395 safi_t safi;
8fe8a7f6 13396 u_int64_t subgrp_id;
3f9c7369
DS
13397
13398 afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
13399 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8fe8a7f6
DS
13400 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
13401
8386ac43 13402 show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[3], subgrp_id);
8fe8a7f6 13403 return CMD_SUCCESS;
3f9c7369
DS
13404}
13405
8fe8a7f6
DS
13406DEFUN (show_bgp_updgrps_adj_s,
13407 show_bgp_updgrps_adj_s_cmd,
13408 "show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
13409 SHOW_STR
13410 BGP_STR
13411 "BGP update groups\n"
13412 "Specific subgroup to display info for\n"
13413 "Advertisement queue\n"
13414 "Announced routes\n"
13415 "Packet queue\n")
13416{
13417 u_int64_t subgrp_id;
13418
13419 VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]);
13420
8386ac43 13421 show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[1], subgrp_id);
8fe8a7f6
DS
13422 return CMD_SUCCESS;
13423}
13424
8386ac43 13425DEFUN (show_bgp_instance_updgrps_adj_s,
13426 show_bgp_instance_updgrps_adj_s_cmd,
13427 "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
13428 SHOW_STR
13429 BGP_STR
13430 BGP_INSTANCE_HELP_STR
13431 "BGP update groups\n"
13432 "Specific subgroup to display info for\n"
13433 "Advertisement queue\n"
13434 "Announced routes\n"
13435 "Packet queue\n")
13436{
13437 u_int64_t subgrp_id;
13438
13439 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
13440
13441 show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[3], subgrp_id);
13442 return CMD_SUCCESS;
13443}
13444
13445
8fe8a7f6 13446
f14e6fdb
DS
13447static int
13448bgp_show_one_peer_group (struct vty *vty, struct peer_group *group)
13449{
13450 struct listnode *node, *nnode;
13451 struct prefix *range;
13452 struct peer *conf;
13453 struct peer *peer;
4690c7d7 13454 char buf[PREFIX2STR_BUFFER];
f14e6fdb
DS
13455 afi_t afi;
13456 safi_t safi;
ffd0c037
DS
13457 const char *peer_status;
13458 const char *af_str;
f14e6fdb
DS
13459 int lr_count;
13460 int dynamic;
13461 int af_cfgd;
13462
13463 conf = group->conf;
13464
0299c004
DS
13465 if (conf->as_type == AS_SPECIFIED ||
13466 conf->as_type == AS_EXTERNAL) {
66b199b2 13467 vty_out (vty, "%sBGP peer-group %s, remote AS %d%s",
f14e6fdb 13468 VTY_NEWLINE, group->name, conf->as, VTY_NEWLINE);
0299c004 13469 } else if (conf->as_type == AS_INTERNAL) {
66b199b2 13470 vty_out (vty, "%sBGP peer-group %s, remote AS %d%s",
0299c004 13471 VTY_NEWLINE, group->name, group->bgp->as, VTY_NEWLINE);
66b199b2
DS
13472 } else {
13473 vty_out (vty, "%sBGP peer-group %s%s",
13474 VTY_NEWLINE, group->name, VTY_NEWLINE);
0299c004 13475 }
f14e6fdb 13476
0299c004 13477 if ((group->bgp->as == conf->as) || (conf->as_type == AS_INTERNAL))
f14e6fdb
DS
13478 vty_out (vty, " Peer-group type is internal%s", VTY_NEWLINE);
13479 else
13480 vty_out (vty, " Peer-group type is external%s", VTY_NEWLINE);
13481
13482 /* Display AFs configured. */
13483 vty_out (vty, " Configured address-families:");
13484 for (afi = AFI_IP; afi < AFI_MAX; afi++)
13485 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
13486 {
13487 if (conf->afc[afi][safi])
13488 {
13489 af_cfgd = 1;
13490 vty_out (vty, " %s;", afi_safi_print(afi, safi));
13491 }
13492 }
13493 if (!af_cfgd)
13494 vty_out (vty, " none%s", VTY_NEWLINE);
13495 else
13496 vty_out (vty, "%s", VTY_NEWLINE);
13497
13498 /* Display listen ranges (for dynamic neighbors), if any */
13499 for (afi = AFI_IP; afi < AFI_MAX; afi++)
13500 {
13501 if (afi == AFI_IP)
13502 af_str = "IPv4";
13503 else if (afi == AFI_IP6)
13504 af_str = "IPv6";
13505 lr_count = listcount(group->listen_range[afi]);
13506 if (lr_count)
13507 {
13508 vty_out(vty,
13509 " %d %s listen range(s)%s",
13510 lr_count, af_str, VTY_NEWLINE);
13511
13512
13513 for (ALL_LIST_ELEMENTS (group->listen_range[afi], node,
13514 nnode, range))
13515 {
13516 prefix2str(range, buf, sizeof(buf));
13517 vty_out(vty, " %s%s", buf, VTY_NEWLINE);
13518 }
13519 }
13520 }
13521
13522 /* Display group members and their status */
13523 if (listcount(group->peer))
13524 {
13525 vty_out (vty, " Peer-group members:%s", VTY_NEWLINE);
13526 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
13527 {
13528 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
13529 peer_status = "Idle (Admin)";
13530 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
13531 peer_status = "Idle (PfxCt)";
13532 else
13533 peer_status = LOOKUP(bgp_status_msg, peer->status);
13534
13535 dynamic = peer_dynamic_neighbor(peer);
13536 vty_out (vty, " %s %s %s %s",
13537 peer->host, dynamic ? "(dynamic)" : "",
13538 peer_status, VTY_NEWLINE);
13539 }
13540 }
13541
13542 return CMD_SUCCESS;
13543}
13544
13545/* Show BGP peer group's information. */
13546enum show_group_type
13547{
13548 show_all_groups,
13549 show_peer_group
13550};
13551
13552static int
13553bgp_show_peer_group (struct vty *vty, struct bgp *bgp,
13554 enum show_group_type type, const char *group_name)
13555{
13556 struct listnode *node, *nnode;
13557 struct peer_group *group;
13558 int find = 0;
13559
13560 for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group))
13561 {
13562 switch (type)
13563 {
13564 case show_all_groups:
13565 bgp_show_one_peer_group (vty, group);
13566 break;
13567 case show_peer_group:
13568 if (group_name && (strcmp(group->name, group_name) == 0))
13569 {
13570 find = 1;
13571 bgp_show_one_peer_group (vty, group);
13572 }
13573 break;
13574 }
13575 }
13576
13577 if (type == show_peer_group && ! find)
13578 vty_out (vty, "%% No such peer-groupr%s", VTY_NEWLINE);
13579
13580 return CMD_SUCCESS;
13581}
13582
13583static int
13584bgp_show_peer_group_vty (struct vty *vty, const char *name,
13585 enum show_group_type type, const char *group_name)
13586{
13587 struct bgp *bgp;
13588 int ret = CMD_SUCCESS;
13589
13590 if (name)
8386ac43 13591 bgp = bgp_lookup_by_name (name);
13592 else
13593 bgp = bgp_get_default ();
f14e6fdb 13594
8386ac43 13595 if (! bgp)
13596 {
13597 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
13598 return CMD_WARNING;
f14e6fdb
DS
13599 }
13600
8386ac43 13601 ret = bgp_show_peer_group (vty, bgp, type, group_name);
f14e6fdb
DS
13602
13603 return ret;
13604}
13605
13606DEFUN (show_ip_bgp_peer_groups,
13607 show_ip_bgp_peer_groups_cmd,
13608 "show ip bgp peer-group",
13609 SHOW_STR
13610 IP_STR
13611 BGP_STR
13612 "Detailed information on all BGP peer groups\n")
13613{
13614 return bgp_show_peer_group_vty (vty, NULL, show_all_groups, NULL);
13615}
13616
13617DEFUN (show_ip_bgp_instance_peer_groups,
13618 show_ip_bgp_instance_peer_groups_cmd,
8386ac43 13619 "show ip bgp " BGP_INSTANCE_CMD " peer-group",
f14e6fdb
DS
13620 SHOW_STR
13621 IP_STR
13622 BGP_STR
8386ac43 13623 BGP_INSTANCE_HELP_STR
f14e6fdb
DS
13624 "Detailed information on all BGP peer groups\n")
13625{
8386ac43 13626 return bgp_show_peer_group_vty (vty, argv[1], show_all_groups, NULL);
f14e6fdb
DS
13627}
13628
13629DEFUN (show_ip_bgp_peer_group,
13630 show_ip_bgp_peer_group_cmd,
13631 "show ip bgp peer-group WORD",
13632 SHOW_STR
13633 IP_STR
13634 BGP_STR
13635 "BGP peer-group name\n"
13636 "Detailed information on a BGP peer group\n")
13637{
13638 return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[0]);
13639}
13640
13641DEFUN (show_ip_bgp_instance_peer_group,
13642 show_ip_bgp_instance_peer_group_cmd,
8386ac43 13643 "show ip bgp " BGP_INSTANCE_CMD " peer-group WORD",
f14e6fdb
DS
13644 SHOW_STR
13645 IP_STR
13646 BGP_STR
8386ac43 13647 BGP_INSTANCE_HELP_STR
f14e6fdb
DS
13648 "BGP peer-group name\n"
13649 "Detailed information on a BGP peer group\n")
13650{
8386ac43 13651 return bgp_show_peer_group_vty (vty, argv[1], show_peer_group, argv[2]);
f14e6fdb 13652}
3f9c7369 13653
718e3744 13654/* Redistribute VTY commands. */
13655
718e3744 13656DEFUN (bgp_redistribute_ipv4,
13657 bgp_redistribute_ipv4_cmd,
e0ca5fde 13658 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
718e3744 13659 "Redistribute information from another routing protocol\n"
e0ca5fde 13660 QUAGGA_IP_REDIST_HELP_STR_BGPD)
718e3744 13661{
13662 int type;
13663
e0ca5fde
DL
13664 type = proto_redistnum (AFI_IP, argv[0]);
13665 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13666 {
13667 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13668 return CMD_WARNING;
13669 }
7c8ff89e 13670 bgp_redist_add(vty->index, AFI_IP, type, 0);
6aeb9e78 13671 return bgp_redistribute_set (vty->index, AFI_IP, type, 0);
718e3744 13672}
13673
13674DEFUN (bgp_redistribute_ipv4_rmap,
13675 bgp_redistribute_ipv4_rmap_cmd,
e0ca5fde 13676 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
718e3744 13677 "Redistribute information from another routing protocol\n"
e0ca5fde 13678 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 13679 "Route map reference\n"
13680 "Pointer to route-map entries\n")
13681{
13682 int type;
7c8ff89e 13683 struct bgp_redist *red;
718e3744 13684
e0ca5fde
DL
13685 type = proto_redistnum (AFI_IP, argv[0]);
13686 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13687 {
13688 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13689 return CMD_WARNING;
13690 }
13691
7c8ff89e
DS
13692 red = bgp_redist_add(vty->index, AFI_IP, type, 0);
13693 bgp_redistribute_rmap_set (red, argv[1]);
6aeb9e78 13694 return bgp_redistribute_set (vty->index, AFI_IP, type, 0);
718e3744 13695}
13696
13697DEFUN (bgp_redistribute_ipv4_metric,
13698 bgp_redistribute_ipv4_metric_cmd,
e0ca5fde 13699 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 13700 "Redistribute information from another routing protocol\n"
e0ca5fde 13701 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 13702 "Metric for redistributed routes\n"
13703 "Default metric\n")
13704{
13705 int type;
13706 u_int32_t metric;
7c8ff89e 13707 struct bgp_redist *red;
718e3744 13708
e0ca5fde
DL
13709 type = proto_redistnum (AFI_IP, argv[0]);
13710 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13711 {
13712 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13713 return CMD_WARNING;
13714 }
13715 VTY_GET_INTEGER ("metric", metric, argv[1]);
13716
7c8ff89e 13717 red = bgp_redist_add(vty->index, AFI_IP, type, 0);
caf958b4 13718 bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric);
6aeb9e78 13719 return bgp_redistribute_set (vty->index, AFI_IP, type, 0);
718e3744 13720}
13721
13722DEFUN (bgp_redistribute_ipv4_rmap_metric,
13723 bgp_redistribute_ipv4_rmap_metric_cmd,
e0ca5fde 13724 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 13725 "Redistribute information from another routing protocol\n"
e0ca5fde 13726 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 13727 "Route map reference\n"
13728 "Pointer to route-map entries\n"
13729 "Metric for redistributed routes\n"
13730 "Default metric\n")
13731{
13732 int type;
13733 u_int32_t metric;
7c8ff89e 13734 struct bgp_redist *red;
718e3744 13735
e0ca5fde
DL
13736 type = proto_redistnum (AFI_IP, argv[0]);
13737 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13738 {
13739 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13740 return CMD_WARNING;
13741 }
13742 VTY_GET_INTEGER ("metric", metric, argv[2]);
13743
7c8ff89e
DS
13744 red = bgp_redist_add(vty->index, AFI_IP, type, 0);
13745 bgp_redistribute_rmap_set (red, argv[1]);
caf958b4 13746 bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric);
6aeb9e78 13747 return bgp_redistribute_set (vty->index, AFI_IP, type, 0);
718e3744 13748}
13749
13750DEFUN (bgp_redistribute_ipv4_metric_rmap,
13751 bgp_redistribute_ipv4_metric_rmap_cmd,
e0ca5fde 13752 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 13753 "Redistribute information from another routing protocol\n"
e0ca5fde 13754 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 13755 "Metric for redistributed routes\n"
13756 "Default metric\n"
13757 "Route map reference\n"
13758 "Pointer to route-map entries\n")
13759{
13760 int type;
13761 u_int32_t metric;
7c8ff89e 13762 struct bgp_redist *red;
718e3744 13763
e0ca5fde
DL
13764 type = proto_redistnum (AFI_IP, argv[0]);
13765 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13766 {
13767 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13768 return CMD_WARNING;
13769 }
13770 VTY_GET_INTEGER ("metric", metric, argv[1]);
13771
7c8ff89e 13772 red = bgp_redist_add(vty->index, AFI_IP, type, 0);
caf958b4 13773 bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric);
7c8ff89e 13774 bgp_redistribute_rmap_set (red, argv[2]);
6aeb9e78 13775 return bgp_redistribute_set (vty->index, AFI_IP, type, 0);
718e3744 13776}
13777
7c8ff89e
DS
13778DEFUN (bgp_redistribute_ipv4_ospf,
13779 bgp_redistribute_ipv4_ospf_cmd,
7a4bb9c5 13780 "redistribute (ospf|table) <1-65535>",
7c8ff89e
DS
13781 "Redistribute information from another routing protocol\n"
13782 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13783 "Non-main Kernel Routing Table\n"
13784 "Instance ID/Table ID\n")
7c8ff89e
DS
13785{
13786 u_short instance;
7a4bb9c5 13787 u_short protocol;
7c8ff89e 13788
7a4bb9c5
DS
13789 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
13790
13791 if (strncmp(argv[0], "o", 1) == 0)
13792 protocol = ZEBRA_ROUTE_OSPF;
13793 else
13794 protocol = ZEBRA_ROUTE_TABLE;
13795
13796 bgp_redist_add(vty->index, AFI_IP, protocol, instance);
6aeb9e78 13797 return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
13798}
13799
13800DEFUN (bgp_redistribute_ipv4_ospf_rmap,
13801 bgp_redistribute_ipv4_ospf_rmap_cmd,
7a4bb9c5 13802 "redistribute (ospf|table) <1-65535> route-map WORD",
7c8ff89e
DS
13803 "Redistribute information from another routing protocol\n"
13804 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13805 "Non-main Kernel Routing Table\n"
13806 "Instance ID/Table ID\n"
7c8ff89e
DS
13807 "Route map reference\n"
13808 "Pointer to route-map entries\n")
13809{
13810 struct bgp_redist *red;
13811 u_short instance;
7a4bb9c5 13812 int protocol;
7c8ff89e 13813
7a4bb9c5
DS
13814 if (strncmp(argv[0], "o", 1) == 0)
13815 protocol = ZEBRA_ROUTE_OSPF;
13816 else
13817 protocol = ZEBRA_ROUTE_TABLE;
13818
13819 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
13820 red = bgp_redist_add(vty->index, AFI_IP, protocol, instance);
13821 bgp_redistribute_rmap_set (red, argv[2]);
6aeb9e78 13822 return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
13823}
13824
13825DEFUN (bgp_redistribute_ipv4_ospf_metric,
13826 bgp_redistribute_ipv4_ospf_metric_cmd,
7a4bb9c5 13827 "redistribute (ospf|table) <1-65535> metric <0-4294967295>",
7c8ff89e
DS
13828 "Redistribute information from another routing protocol\n"
13829 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13830 "Non-main Kernel Routing Table\n"
13831 "Instance ID/Table ID\n"
7c8ff89e
DS
13832 "Metric for redistributed routes\n"
13833 "Default metric\n")
13834{
13835 u_int32_t metric;
13836 struct bgp_redist *red;
13837 u_short instance;
7a4bb9c5 13838 int protocol;
7c8ff89e 13839
7a4bb9c5
DS
13840 if (strncmp(argv[0], "o", 1) == 0)
13841 protocol = ZEBRA_ROUTE_OSPF;
13842 else
13843 protocol = ZEBRA_ROUTE_TABLE;
7c8ff89e 13844
7a4bb9c5
DS
13845 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
13846 VTY_GET_INTEGER ("metric", metric, argv[2]);
13847
13848 red = bgp_redist_add(vty->index, AFI_IP, protocol, instance);
caf958b4 13849 bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric);
6aeb9e78 13850 return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
13851}
13852
13853DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric,
13854 bgp_redistribute_ipv4_ospf_rmap_metric_cmd,
7a4bb9c5 13855 "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>",
7c8ff89e
DS
13856 "Redistribute information from another routing protocol\n"
13857 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13858 "Non-main Kernel Routing Table\n"
13859 "Instance ID/Table ID\n"
7c8ff89e
DS
13860 "Route map reference\n"
13861 "Pointer to route-map entries\n"
13862 "Metric for redistributed routes\n"
13863 "Default metric\n")
13864{
13865 u_int32_t metric;
13866 struct bgp_redist *red;
13867 u_short instance;
7a4bb9c5 13868 int protocol;
7c8ff89e 13869
7a4bb9c5
DS
13870 if (strncmp(argv[0], "o", 1) == 0)
13871 protocol = ZEBRA_ROUTE_OSPF;
13872 else
13873 protocol = ZEBRA_ROUTE_TABLE;
7c8ff89e 13874
7a4bb9c5
DS
13875 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
13876 VTY_GET_INTEGER ("metric", metric, argv[3]);
13877
13878 red = bgp_redist_add(vty->index, AFI_IP, protocol, instance);
13879 bgp_redistribute_rmap_set (red, argv[2]);
caf958b4 13880 bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric);
6aeb9e78 13881 return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
13882}
13883
13884DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap,
13885 bgp_redistribute_ipv4_ospf_metric_rmap_cmd,
7a4bb9c5 13886 "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD",
7c8ff89e
DS
13887 "Redistribute information from another routing protocol\n"
13888 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13889 "Non-main Kernel Routing Table\n"
13890 "Instance ID/Table ID\n"
7c8ff89e
DS
13891 "Metric for redistributed routes\n"
13892 "Default metric\n"
13893 "Route map reference\n"
13894 "Pointer to route-map entries\n")
13895{
13896 u_int32_t metric;
13897 struct bgp_redist *red;
13898 u_short instance;
7a4bb9c5 13899 int protocol;
7c8ff89e 13900
7a4bb9c5
DS
13901 if (strncmp(argv[0], "o", 1) == 0)
13902 protocol = ZEBRA_ROUTE_OSPF;
13903 else
13904 protocol = ZEBRA_ROUTE_TABLE;
7c8ff89e 13905
7a4bb9c5
DS
13906 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
13907 VTY_GET_INTEGER ("metric", metric, argv[2]);
13908
13909 red = bgp_redist_add(vty->index, AFI_IP, protocol, instance);
caf958b4 13910 bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric);
7a4bb9c5 13911 bgp_redistribute_rmap_set (red, argv[3]);
6aeb9e78 13912 return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
13913}
13914
13915DEFUN (no_bgp_redistribute_ipv4_ospf,
13916 no_bgp_redistribute_ipv4_ospf_cmd,
7a4bb9c5 13917 "no redistribute (ospf|table) <1-65535>",
7c8ff89e
DS
13918 NO_STR
13919 "Redistribute information from another routing protocol\n"
13920 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13921 "Non-main Kernel Routing Table\n"
13922 "Instance ID/Table ID\n")
7c8ff89e
DS
13923{
13924 u_short instance;
7a4bb9c5
DS
13925 int protocol;
13926
13927 if (strncmp(argv[0], "o", 1) == 0)
13928 protocol = ZEBRA_ROUTE_OSPF;
13929 else
13930 protocol = ZEBRA_ROUTE_TABLE;
7c8ff89e 13931
7a4bb9c5
DS
13932 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
13933 return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
13934}
13935
13936ALIAS (no_bgp_redistribute_ipv4_ospf,
13937 no_bgp_redistribute_ipv4_ospf_rmap_cmd,
7a4bb9c5 13938 "no redistribute (ospf|table) <1-65535> route-map WORD",
7c8ff89e
DS
13939 NO_STR
13940 "Redistribute information from another routing protocol\n"
13941 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13942 "Non-main Kernel Routing Table\n"
13943 "Instance ID/Table ID\n"
7c8ff89e
DS
13944 "Route map reference\n"
13945 "Pointer to route-map entries\n")
13946
13947ALIAS (no_bgp_redistribute_ipv4_ospf,
13948 no_bgp_redistribute_ipv4_ospf_metric_cmd,
7a4bb9c5 13949 "no redistribute (ospf|table) <1-65535> metric <0-4294967295>",
7c8ff89e
DS
13950 NO_STR
13951 "Redistribute information from another routing protocol\n"
13952 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13953 "Non-main Kernel Routing Table\n"
13954 "Instance ID/Table ID\n"
7c8ff89e
DS
13955 "Metric for redistributed routes\n"
13956 "Default metric\n")
13957
13958ALIAS (no_bgp_redistribute_ipv4_ospf,
13959 no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd,
7a4bb9c5 13960 "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>",
7c8ff89e
DS
13961 NO_STR
13962 "Redistribute information from another routing protocol\n"
13963 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13964 "Non-main Kernel Routing Table\n"
13965 "Instance ID/Table ID\n"
7c8ff89e
DS
13966 "Route map reference\n"
13967 "Pointer to route-map entries\n"
13968 "Metric for redistributed routes\n"
13969 "Default metric\n")
13970
13971ALIAS (no_bgp_redistribute_ipv4_ospf,
13972 no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd,
7a4bb9c5 13973 "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD",
7c8ff89e
DS
13974 NO_STR
13975 "Redistribute information from another routing protocol\n"
13976 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13977 "Non-main Kernel Routing Table\n"
13978 "Instance ID/Table ID\n"
7c8ff89e
DS
13979 "Metric for redistributed routes\n"
13980 "Default metric\n"
13981 "Route map reference\n"
13982 "Pointer to route-map entries\n")
13983
718e3744 13984DEFUN (no_bgp_redistribute_ipv4,
13985 no_bgp_redistribute_ipv4_cmd,
e0ca5fde 13986 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
718e3744 13987 NO_STR
13988 "Redistribute information from another routing protocol\n"
e0ca5fde 13989 QUAGGA_IP_REDIST_HELP_STR_BGPD)
718e3744 13990{
13991 int type;
13992
e0ca5fde
DL
13993 type = proto_redistnum (AFI_IP, argv[0]);
13994 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13995 {
13996 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13997 return CMD_WARNING;
13998 }
7c8ff89e 13999 return bgp_redistribute_unset (vty->index, AFI_IP, type, 0);
718e3744 14000}
14001
503006bc 14002ALIAS (no_bgp_redistribute_ipv4,
718e3744 14003 no_bgp_redistribute_ipv4_rmap_cmd,
e0ca5fde 14004 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
718e3744 14005 NO_STR
14006 "Redistribute information from another routing protocol\n"
e0ca5fde 14007 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 14008 "Route map reference\n"
14009 "Pointer to route-map entries\n")
718e3744 14010
503006bc 14011ALIAS (no_bgp_redistribute_ipv4,
718e3744 14012 no_bgp_redistribute_ipv4_metric_cmd,
e0ca5fde 14013 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 14014 NO_STR
14015 "Redistribute information from another routing protocol\n"
e0ca5fde 14016 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 14017 "Metric for redistributed routes\n"
14018 "Default metric\n")
718e3744 14019
503006bc 14020ALIAS (no_bgp_redistribute_ipv4,
718e3744 14021 no_bgp_redistribute_ipv4_rmap_metric_cmd,
e0ca5fde 14022 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 14023 NO_STR
14024 "Redistribute information from another routing protocol\n"
e0ca5fde 14025 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 14026 "Route map reference\n"
14027 "Pointer to route-map entries\n"
14028 "Metric for redistributed routes\n"
14029 "Default metric\n")
718e3744 14030
503006bc 14031ALIAS (no_bgp_redistribute_ipv4,
718e3744 14032 no_bgp_redistribute_ipv4_metric_rmap_cmd,
e0ca5fde 14033 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 14034 NO_STR
14035 "Redistribute information from another routing protocol\n"
e0ca5fde 14036 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 14037 "Metric for redistributed routes\n"
14038 "Default metric\n"
14039 "Route map reference\n"
14040 "Pointer to route-map entries\n")
6b0655a2 14041
718e3744 14042#ifdef HAVE_IPV6
14043DEFUN (bgp_redistribute_ipv6,
14044 bgp_redistribute_ipv6_cmd,
e0ca5fde 14045 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
718e3744 14046 "Redistribute information from another routing protocol\n"
e0ca5fde 14047 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
718e3744 14048{
14049 int type;
14050
e0ca5fde
DL
14051 type = proto_redistnum (AFI_IP6, argv[0]);
14052 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14053 {
14054 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14055 return CMD_WARNING;
14056 }
14057
7c8ff89e 14058 bgp_redist_add(vty->index, AFI_IP6, type, 0);
6aeb9e78 14059 return bgp_redistribute_set (vty->index, AFI_IP6, type, 0);
718e3744 14060}
14061
14062DEFUN (bgp_redistribute_ipv6_rmap,
14063 bgp_redistribute_ipv6_rmap_cmd,
e0ca5fde 14064 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
718e3744 14065 "Redistribute information from another routing protocol\n"
e0ca5fde 14066 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14067 "Route map reference\n"
14068 "Pointer to route-map entries\n")
14069{
14070 int type;
7c8ff89e 14071 struct bgp_redist *red;
718e3744 14072
e0ca5fde
DL
14073 type = proto_redistnum (AFI_IP6, argv[0]);
14074 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14075 {
14076 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14077 return CMD_WARNING;
14078 }
14079
7c8ff89e
DS
14080 red = bgp_redist_add(vty->index, AFI_IP6, type, 0);
14081 bgp_redistribute_rmap_set (red, argv[1]);
6aeb9e78 14082 return bgp_redistribute_set (vty->index, AFI_IP6, type, 0);
718e3744 14083}
14084
14085DEFUN (bgp_redistribute_ipv6_metric,
14086 bgp_redistribute_ipv6_metric_cmd,
e0ca5fde 14087 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 14088 "Redistribute information from another routing protocol\n"
e0ca5fde 14089 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14090 "Metric for redistributed routes\n"
14091 "Default metric\n")
14092{
14093 int type;
14094 u_int32_t metric;
7c8ff89e 14095 struct bgp_redist *red;
718e3744 14096
e0ca5fde
DL
14097 type = proto_redistnum (AFI_IP6, argv[0]);
14098 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14099 {
14100 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14101 return CMD_WARNING;
14102 }
14103 VTY_GET_INTEGER ("metric", metric, argv[1]);
14104
7c8ff89e 14105 red = bgp_redist_add(vty->index, AFI_IP6, type, 0);
caf958b4 14106 bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric);
6aeb9e78 14107 return bgp_redistribute_set (vty->index, AFI_IP6, type, 0);
718e3744 14108}
14109
14110DEFUN (bgp_redistribute_ipv6_rmap_metric,
14111 bgp_redistribute_ipv6_rmap_metric_cmd,
e0ca5fde 14112 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 14113 "Redistribute information from another routing protocol\n"
e0ca5fde 14114 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14115 "Route map reference\n"
14116 "Pointer to route-map entries\n"
14117 "Metric for redistributed routes\n"
14118 "Default metric\n")
14119{
14120 int type;
14121 u_int32_t metric;
7c8ff89e 14122 struct bgp_redist *red;
718e3744 14123
e0ca5fde
DL
14124 type = proto_redistnum (AFI_IP6, argv[0]);
14125 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14126 {
14127 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14128 return CMD_WARNING;
14129 }
14130 VTY_GET_INTEGER ("metric", metric, argv[2]);
14131
7c8ff89e
DS
14132 red = bgp_redist_add(vty->index, AFI_IP6, type, 0);
14133 bgp_redistribute_rmap_set (red, argv[1]);
caf958b4 14134 bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric);
6aeb9e78 14135 return bgp_redistribute_set (vty->index, AFI_IP6, type, 0);
718e3744 14136}
14137
14138DEFUN (bgp_redistribute_ipv6_metric_rmap,
14139 bgp_redistribute_ipv6_metric_rmap_cmd,
e0ca5fde 14140 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 14141 "Redistribute information from another routing protocol\n"
e0ca5fde 14142 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14143 "Metric for redistributed routes\n"
14144 "Default metric\n"
14145 "Route map reference\n"
14146 "Pointer to route-map entries\n")
14147{
14148 int type;
14149 u_int32_t metric;
7c8ff89e 14150 struct bgp_redist *red;
718e3744 14151
e0ca5fde
DL
14152 type = proto_redistnum (AFI_IP6, argv[0]);
14153 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14154 {
14155 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14156 return CMD_WARNING;
14157 }
14158 VTY_GET_INTEGER ("metric", metric, argv[1]);
14159
7c8ff89e 14160 red = bgp_redist_add(vty->index, AFI_IP6, type, 0);
caf958b4 14161 bgp_redistribute_metric_set(vty->index, red, AFI_IP6, SAFI_UNICAST, metric);
7c8ff89e 14162 bgp_redistribute_rmap_set (red, argv[2]);
6aeb9e78 14163 return bgp_redistribute_set (vty->index, AFI_IP6, type, 0);
718e3744 14164}
14165
14166DEFUN (no_bgp_redistribute_ipv6,
14167 no_bgp_redistribute_ipv6_cmd,
e0ca5fde 14168 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
718e3744 14169 NO_STR
14170 "Redistribute information from another routing protocol\n"
e0ca5fde 14171 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
718e3744 14172{
14173 int type;
14174
e0ca5fde
DL
14175 type = proto_redistnum (AFI_IP6, argv[0]);
14176 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14177 {
14178 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14179 return CMD_WARNING;
14180 }
14181
7c8ff89e 14182 return bgp_redistribute_unset (vty->index, AFI_IP6, type, 0);
718e3744 14183}
14184
503006bc 14185ALIAS (no_bgp_redistribute_ipv6,
718e3744 14186 no_bgp_redistribute_ipv6_rmap_cmd,
e0ca5fde 14187 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
718e3744 14188 NO_STR
14189 "Redistribute information from another routing protocol\n"
e0ca5fde 14190 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14191 "Route map reference\n"
14192 "Pointer to route-map entries\n")
718e3744 14193
503006bc 14194ALIAS (no_bgp_redistribute_ipv6,
718e3744 14195 no_bgp_redistribute_ipv6_metric_cmd,
e0ca5fde 14196 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 14197 NO_STR
14198 "Redistribute information from another routing protocol\n"
e0ca5fde 14199 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14200 "Metric for redistributed routes\n"
14201 "Default metric\n")
718e3744 14202
503006bc 14203ALIAS (no_bgp_redistribute_ipv6,
718e3744 14204 no_bgp_redistribute_ipv6_rmap_metric_cmd,
e0ca5fde 14205 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 14206 NO_STR
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")
718e3744 14213
503006bc 14214ALIAS (no_bgp_redistribute_ipv6,
718e3744 14215 no_bgp_redistribute_ipv6_metric_rmap_cmd,
e0ca5fde 14216 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 14217 NO_STR
14218 "Redistribute information from another routing protocol\n"
e0ca5fde 14219 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14220 "Metric for redistributed routes\n"
14221 "Default metric\n"
14222 "Route map reference\n"
14223 "Pointer to route-map entries\n")
14224#endif /* HAVE_IPV6 */
6b0655a2 14225
718e3744 14226int
14227bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
14228 safi_t safi, int *write)
14229{
14230 int i;
718e3744 14231
14232 /* Unicast redistribution only. */
14233 if (safi != SAFI_UNICAST)
14234 return 0;
14235
14236 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
14237 {
14238 /* Redistribute BGP does not make sense. */
7c8ff89e 14239 if (i != ZEBRA_ROUTE_BGP)
718e3744 14240 {
7c8ff89e
DS
14241 struct list *red_list;
14242 struct listnode *node;
14243 struct bgp_redist *red;
718e3744 14244
7c8ff89e
DS
14245 red_list = bgp->redist[afi][i];
14246 if (!red_list)
14247 continue;
718e3744 14248
7c8ff89e
DS
14249 for (ALL_LIST_ELEMENTS_RO(red_list, node, red))
14250 {
14251 /* Display "address-family" when it is not yet diplayed. */
14252 bgp_config_write_family_header (vty, afi, safi, write);
14253
14254 /* "redistribute" configuration. */
0b960b4d 14255 vty_out (vty, " redistribute %s", zebra_route_string(i));
7c8ff89e
DS
14256 if (red->instance)
14257 vty_out (vty, " %d", red->instance);
14258 if (red->redist_metric_flag)
14259 vty_out (vty, " metric %u", red->redist_metric);
14260 if (red->rmap.name)
14261 vty_out (vty, " route-map %s", red->rmap.name);
14262 vty_out (vty, "%s", VTY_NEWLINE);
14263 }
718e3744 14264 }
14265 }
14266 return *write;
14267}
6b0655a2 14268
718e3744 14269/* BGP node structure. */
7fc626de 14270static struct cmd_node bgp_node =
718e3744 14271{
14272 BGP_NODE,
14273 "%s(config-router)# ",
14274 1,
14275};
14276
7fc626de 14277static struct cmd_node bgp_ipv4_unicast_node =
718e3744 14278{
14279 BGP_IPV4_NODE,
14280 "%s(config-router-af)# ",
14281 1,
14282};
14283
7fc626de 14284static struct cmd_node bgp_ipv4_multicast_node =
718e3744 14285{
14286 BGP_IPV4M_NODE,
14287 "%s(config-router-af)# ",
14288 1,
14289};
14290
7fc626de 14291static struct cmd_node bgp_ipv6_unicast_node =
718e3744 14292{
14293 BGP_IPV6_NODE,
14294 "%s(config-router-af)# ",
14295 1,
14296};
14297
7fc626de 14298static struct cmd_node bgp_ipv6_multicast_node =
25ffbdc1 14299{
14300 BGP_IPV6M_NODE,
14301 "%s(config-router-af)# ",
14302 1,
14303};
14304
7fc626de 14305static struct cmd_node bgp_vpnv4_node =
718e3744 14306{
14307 BGP_VPNV4_NODE,
14308 "%s(config-router-af)# ",
14309 1
14310};
6b0655a2 14311
8ecd3266 14312static struct cmd_node bgp_vpnv6_node =
14313{
14314 BGP_VPNV6_NODE,
14315 "%s(config-router-af-vpnv6)# ",
14316 1
14317};
14318
8b1fb8be
LB
14319static struct cmd_node bgp_encap_node =
14320{
14321 BGP_ENCAP_NODE,
14322 "%s(config-router-af-encap)# ",
14323 1
14324};
14325
14326static struct cmd_node bgp_encapv6_node =
14327{
14328 BGP_ENCAPV6_NODE,
14329 "%s(config-router-af-encapv6)# ",
14330 1
14331};
14332
1f8ae70b 14333static void community_list_vty (void);
14334
718e3744 14335void
94f2b392 14336bgp_vty_init (void)
718e3744 14337{
718e3744 14338 /* Install bgp top node. */
14339 install_node (&bgp_node, bgp_config_write);
14340 install_node (&bgp_ipv4_unicast_node, NULL);
14341 install_node (&bgp_ipv4_multicast_node, NULL);
14342 install_node (&bgp_ipv6_unicast_node, NULL);
25ffbdc1 14343 install_node (&bgp_ipv6_multicast_node, NULL);
718e3744 14344 install_node (&bgp_vpnv4_node, NULL);
8ecd3266 14345 install_node (&bgp_vpnv6_node, NULL);
8b1fb8be
LB
14346 install_node (&bgp_encap_node, NULL);
14347 install_node (&bgp_encapv6_node, NULL);
718e3744 14348
14349 /* Install default VTY commands to new nodes. */
14350 install_default (BGP_NODE);
14351 install_default (BGP_IPV4_NODE);
14352 install_default (BGP_IPV4M_NODE);
14353 install_default (BGP_IPV6_NODE);
25ffbdc1 14354 install_default (BGP_IPV6M_NODE);
718e3744 14355 install_default (BGP_VPNV4_NODE);
8ecd3266 14356 install_default (BGP_VPNV6_NODE);
8b1fb8be
LB
14357 install_default (BGP_ENCAP_NODE);
14358 install_default (BGP_ENCAPV6_NODE);
718e3744 14359
14360 /* "bgp multiple-instance" commands. */
14361 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
14362 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
14363
14364 /* "bgp config-type" commands. */
14365 install_element (CONFIG_NODE, &bgp_config_type_cmd);
813d4307 14366 install_element (CONFIG_NODE, &no_bgp_config_type_val_cmd);
718e3744 14367
5fe9f963 14368 /* bgp route-map delay-timer commands. */
14369 install_element (CONFIG_NODE, &bgp_set_route_map_delay_timer_cmd);
14370 install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_cmd);
14371 install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_val_cmd);
14372
718e3744 14373 /* Dummy commands (Currently not supported) */
14374 install_element (BGP_NODE, &no_synchronization_cmd);
14375 install_element (BGP_NODE, &no_auto_summary_cmd);
14376
14377 /* "router bgp" commands. */
14378 install_element (CONFIG_NODE, &router_bgp_cmd);
6aeb9e78 14379 install_element (CONFIG_NODE, &router_bgp_instance_cmd);
2385a876 14380 install_element (CONFIG_NODE, &router_bgp_noasn_cmd);
718e3744 14381
14382 /* "no router bgp" commands. */
14383 install_element (CONFIG_NODE, &no_router_bgp_cmd);
6aeb9e78 14384 install_element (CONFIG_NODE, &no_router_bgp_instance_cmd);
718e3744 14385
14386 /* "bgp router-id" commands. */
14387 install_element (BGP_NODE, &bgp_router_id_cmd);
14388 install_element (BGP_NODE, &no_bgp_router_id_cmd);
14389 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
cdb805bc
SK
14390 install_element (BGP_NODE, &bgp_router_id_interface_cmd);
14391 install_element (BGP_NODE, &no_bgp_router_id_interface_cmd);
718e3744 14392
14393 /* "bgp cluster-id" commands. */
14394 install_element (BGP_NODE, &bgp_cluster_id_cmd);
14395 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
14396 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
813d4307
DW
14397 install_element (BGP_NODE, &no_bgp_cluster_id_ip_cmd);
14398 install_element (BGP_NODE, &no_bgp_cluster_id_decimal_cmd);
718e3744 14399
14400 /* "bgp confederation" commands. */
14401 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
14402 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
14403 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
14404
14405 /* "bgp confederation peers" commands. */
14406 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
14407 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
14408
abc920f8
DS
14409 /* bgp max-med command */
14410 install_element (BGP_NODE, &bgp_maxmed_admin_cmd);
14411 install_element (BGP_NODE, &no_bgp_maxmed_admin_cmd);
14412 install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd);
14413 install_element (BGP_NODE, &no_bgp_maxmed_admin_medv_cmd);
14414 install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd);
14415 install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd);
14416 install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_cmd);
14417 install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd);
14418 install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_medv_cmd);
14419
907f92c8
DS
14420 /* bgp disable-ebgp-connected-nh-check */
14421 install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd);
14422 install_element (BGP_NODE, &no_bgp_disable_connected_route_check_cmd);
14423
f188f2c4
DS
14424 /* bgp update-delay command */
14425 install_element (BGP_NODE, &bgp_update_delay_cmd);
14426 install_element (BGP_NODE, &no_bgp_update_delay_cmd);
14427 install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd);
14428 install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd);
14429
cb1faec9
DS
14430 install_element (BGP_NODE, &bgp_wpkt_quanta_cmd);
14431 install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd);
14432
3f9c7369
DS
14433 install_element (BGP_NODE, &bgp_coalesce_time_cmd);
14434 install_element (BGP_NODE, &no_bgp_coalesce_time_cmd);
14435
165b5fff
JB
14436 /* "maximum-paths" commands. */
14437 install_element (BGP_NODE, &bgp_maxpaths_cmd);
14438 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
14439 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
14440 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
14441 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
14442 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
431aa9f9
DS
14443 install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd);
14444 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd);
14445 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd);
165b5fff 14446 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
5e242b0d 14447 install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd);
165b5fff
JB
14448 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
14449 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
5e242b0d 14450 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 14451 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
5e242b0d 14452 install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 14453 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
5e242b0d 14454 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 14455 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
431aa9f9 14456 install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd);
5e242b0d 14457 install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd);
431aa9f9
DS
14458 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd);
14459 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
5e242b0d 14460 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 14461
718e3744 14462 /* "timers bgp" commands. */
14463 install_element (BGP_NODE, &bgp_timers_cmd);
14464 install_element (BGP_NODE, &no_bgp_timers_cmd);
14465 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
14466
5fe9f963 14467 /* route-map delay-timer commands - per instance for backwards compat. */
518f0eb1
DS
14468 install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd);
14469 install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd);
f414725f 14470 install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_val_cmd);
518f0eb1 14471
718e3744 14472 /* "bgp client-to-client reflection" commands */
14473 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
14474 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
14475
14476 /* "bgp always-compare-med" commands */
14477 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
14478 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
14479
14480 /* "bgp deterministic-med" commands */
14481 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
14482 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
538621f2 14483
538621f2 14484 /* "bgp graceful-restart" commands */
14485 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
14486 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
93406d87 14487 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
14488 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
14489 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
718e3744 14490
14491 /* "bgp fast-external-failover" commands */
14492 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
14493 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
14494
14495 /* "bgp enforce-first-as" commands */
14496 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
14497 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
14498
14499 /* "bgp bestpath compare-routerid" commands */
14500 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
14501 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
14502
14503 /* "bgp bestpath as-path ignore" commands */
14504 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
14505 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
14506
6811845b 14507 /* "bgp bestpath as-path confed" commands */
14508 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
14509 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
14510
2fdd455c
PM
14511 /* "bgp bestpath as-path multipath-relax" commands */
14512 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
14513 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
14514
848973c7 14515 /* "bgp log-neighbor-changes" commands */
14516 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
14517 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
14518
718e3744 14519 /* "bgp bestpath med" commands */
14520 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
14521 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
14522 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
14523 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
14524 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
14525 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
14526
14527 /* "no bgp default ipv4-unicast" commands. */
14528 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
14529 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
14530
14531 /* "bgp network import-check" commands. */
14532 install_element (BGP_NODE, &bgp_network_import_check_cmd);
8233ef81 14533 install_element (BGP_NODE, &bgp_network_import_check_exact_cmd);
718e3744 14534 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
14535
14536 /* "bgp default local-preference" commands. */
14537 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
14538 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
14539 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
14540
04b6bdc0
DW
14541 /* bgp default show-hostname */
14542 install_element (BGP_NODE, &bgp_default_show_hostname_cmd);
14543 install_element (BGP_NODE, &no_bgp_default_show_hostname_cmd);
14544
3f9c7369
DS
14545 /* "bgp default subgroup-pkt-queue-max" commands. */
14546 install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd);
14547 install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd);
813d4307 14548 install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_val_cmd);
3f9c7369 14549
8bd9d948
DS
14550 /* bgp ibgp-allow-policy-mods command */
14551 install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd);
14552 install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd);
14553
f14e6fdb
DS
14554 /* "bgp listen limit" commands. */
14555 install_element (BGP_NODE, &bgp_listen_limit_cmd);
14556 install_element (BGP_NODE, &no_bgp_listen_limit_cmd);
813d4307 14557 install_element (BGP_NODE, &no_bgp_listen_limit_val_cmd);
f14e6fdb
DS
14558
14559 /* "bgp listen range" commands. */
14560 install_element (BGP_NODE, &bgp_listen_range_cmd);
14561 install_element (BGP_NODE, &no_bgp_listen_range_cmd);
14562
718e3744 14563 /* "neighbor remote-as" commands. */
14564 install_element (BGP_NODE, &neighbor_remote_as_cmd);
a80beece 14565 install_element (BGP_NODE, &neighbor_interface_config_cmd);
4c48cf63
DW
14566 install_element (BGP_NODE, &neighbor_interface_config_v6only_cmd);
14567 install_element (BGP_NODE, &neighbor_interface_config_peergroup_cmd);
14568 install_element (BGP_NODE, &neighbor_interface_config_v6only_peergroup_cmd);
718e3744 14569 install_element (BGP_NODE, &no_neighbor_cmd);
14570 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
a80beece 14571 install_element (BGP_NODE, &no_neighbor_interface_config_cmd);
4c48cf63
DW
14572 install_element (BGP_NODE, &no_neighbor_interface_config_v6only_cmd);
14573 install_element (BGP_NODE, &no_neighbor_interface_config_peergroup_cmd);
14574 install_element (BGP_NODE, &no_neighbor_interface_config_v6only_peergroup_cmd);
718e3744 14575
14576 /* "neighbor peer-group" commands. */
14577 install_element (BGP_NODE, &neighbor_peer_group_cmd);
14578 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
a80beece 14579 install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd);
718e3744 14580
14581 /* "neighbor local-as" commands. */
14582 install_element (BGP_NODE, &neighbor_local_as_cmd);
14583 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
9d3f9705 14584 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
718e3744 14585 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
14586 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
14587 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
9d3f9705 14588 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
718e3744 14589
3f9c7369
DS
14590 /* "neighbor solo" commands. */
14591 install_element (BGP_NODE, &neighbor_solo_cmd);
14592 install_element (BGP_NODE, &no_neighbor_solo_cmd);
14593
0df7c91f
PJ
14594 /* "neighbor password" commands. */
14595 install_element (BGP_NODE, &neighbor_password_cmd);
14596 install_element (BGP_NODE, &no_neighbor_password_cmd);
813d4307 14597 install_element (BGP_NODE, &no_neighbor_password_val_cmd);
0df7c91f 14598
718e3744 14599 /* "neighbor activate" commands. */
14600 install_element (BGP_NODE, &neighbor_activate_cmd);
14601 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
14602 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
14603 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
25ffbdc1 14604 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
718e3744 14605 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
8ecd3266 14606 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
8b1fb8be
LB
14607 install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd);
14608 install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd);
718e3744 14609
14610 /* "no neighbor activate" commands. */
14611 install_element (BGP_NODE, &no_neighbor_activate_cmd);
14612 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
14613 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
14614 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
25ffbdc1 14615 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
718e3744 14616 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
8ecd3266 14617 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
8b1fb8be
LB
14618 install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd);
14619 install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd);
718e3744 14620
c8560b44
DW
14621 /* "neighbor peer-group" set commands.
14622 * Long term we should only accept this command under BGP_NODE and not all of
14623 * the afi/safi sub-contexts. For now though we need to accept it for backwards
14624 * compatibility. This changed when we stopped requiring that peers be assigned
14625 * to their peer-group under each address-family sub-context.
14626 */
718e3744 14627 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
14628 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
14629 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
14630 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
25ffbdc1 14631 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
a58545bb 14632 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
8ecd3266 14633 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
8b1fb8be
LB
14634 install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd);
14635 install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd);
c8560b44 14636
718e3744 14637 /* "no neighbor peer-group unset" commands. */
14638 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
14639 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
14640 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
14641 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
25ffbdc1 14642 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
a58545bb 14643 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
8ecd3266 14644 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
8b1fb8be
LB
14645 install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd);
14646 install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd);
a58545bb 14647
718e3744 14648 /* "neighbor softreconfiguration inbound" commands.*/
14649 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
14650 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
14651 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
14652 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
14653 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
14654 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
14655 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
14656 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
25ffbdc1 14657 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
14658 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
a58545bb 14659 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
14660 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
8ecd3266 14661 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
14662 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
8b1fb8be
LB
14663 install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd);
14664 install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd);
14665 install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd);
14666 install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
718e3744 14667
14668 /* "neighbor attribute-unchanged" commands. */
14669 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
14670 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
14671 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
14672 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
14673 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
14674 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
14675 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
14676 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
14677 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
14678 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
14679 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
14680 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
14681 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
14682 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
14683 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
14684 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
14685 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
14686 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
14687 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
14688 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
14689 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
14690 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
14691 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
14692 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
14693 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
14694 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
14695 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
14696 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
14697 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
14698 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
14699 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
14700 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
14701 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
14702 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
14703 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
14704 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
14705 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
14706 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
14707 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
14708 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
14709 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
14710 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
14711 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
14712 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
14713 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
14714 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
14715 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
14716 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
14717 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
14718 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
14719 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
14720 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
14721 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
14722 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
14723 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
14724 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
14725 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
14726 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
14727 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
14728 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
14729 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
14730 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
14731 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
14732 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
14733 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
14734 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
14735 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
14736 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
14737 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
14738 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
14739 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
14740 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
14741 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
14742 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
14743 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
14744 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
14745 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
14746 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
14747 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
14748 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
14749 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
14750 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
14751 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
14752 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
14753 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
14754 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
14755 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
14756 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
25ffbdc1 14757 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
14758 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
14759 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
14760 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
14761 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
14762 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
14763 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
14764 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
14765 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
14766 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
14767 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
14768 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
14769 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
14770 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
14771 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
14772 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
14773 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
14774 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
14775 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
14776 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
14777 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
14778 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
718e3744 14779 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
14780 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
14781 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
14782 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
14783 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
14784 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
14785 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
14786 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
14787 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
14788 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
14789 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
14790 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
14791 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
14792 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
14793 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
14794 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
14795 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
14796 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
14797 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
14798 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
14799 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
14800 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
8ecd3266 14801 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
14802 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
14803 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
14804 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
14805 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
14806 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
14807 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
14808 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
14809 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
14810 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
14811 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
14812 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
14813 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
14814 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
14815 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
14816 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
14817 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
14818 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
14819 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
14820 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
14821 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
14822 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
14823
8b1fb8be
LB
14824 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd);
14825 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd);
14826 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd);
14827 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd);
14828 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd);
14829 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd);
14830 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd);
14831 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd);
14832 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd);
14833 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd);
14834 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd);
14835 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd);
14836 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd);
14837 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd);
14838 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd);
14839 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd);
14840 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd);
14841 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd);
14842 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd);
14843 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd);
14844 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd);
14845 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd);
14846
14847 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd);
14848 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd);
14849 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd);
14850 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd);
14851 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd);
14852 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd);
14853 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd);
14854 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd);
14855 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd);
14856 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd);
14857 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd);
14858 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd);
14859 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
14860 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
14861 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
14862 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
14863 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
14864 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
14865 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
14866 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
14867 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
14868 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
718e3744 14869
fee0f4c6 14870 /* "nexthop-local unchanged" commands */
14871 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
14872 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
14873
718e3744 14874 /* "neighbor next-hop-self" commands. */
14875 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
14876 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
14877 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
14878 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
14879 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
14880 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
14881 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
14882 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
25ffbdc1 14883 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
14884 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
718e3744 14885 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
14886 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
8ecd3266 14887 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
14888 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
8b1fb8be
LB
14889 install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd);
14890 install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd);
14891 install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd);
14892 install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd);
718e3744 14893
a538debe
DS
14894 /* "neighbor next-hop-self force" commands. */
14895 install_element (BGP_NODE, &neighbor_nexthop_self_force_cmd);
14896 install_element (BGP_NODE, &no_neighbor_nexthop_self_force_cmd);
14897 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_force_cmd);
14898 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_force_cmd);
14899 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_force_cmd);
14900 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_force_cmd);
14901 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_force_cmd);
14902 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_force_cmd);
14903 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_force_cmd);
14904 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_force_cmd);
14905 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_force_cmd);
14906 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_force_cmd);
8ecd3266 14907 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_force_cmd);
14908 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_force_cmd);
a538debe 14909
c7122e14
DS
14910 /* "neighbor as-override" commands. */
14911 install_element (BGP_NODE, &neighbor_as_override_cmd);
14912 install_element (BGP_NODE, &no_neighbor_as_override_cmd);
14913 install_element (BGP_IPV4_NODE, &neighbor_as_override_cmd);
14914 install_element (BGP_IPV4_NODE, &no_neighbor_as_override_cmd);
14915 install_element (BGP_IPV4M_NODE, &neighbor_as_override_cmd);
14916 install_element (BGP_IPV4M_NODE, &no_neighbor_as_override_cmd);
14917 install_element (BGP_IPV6_NODE, &neighbor_as_override_cmd);
14918 install_element (BGP_IPV6_NODE, &no_neighbor_as_override_cmd);
14919 install_element (BGP_IPV6M_NODE, &neighbor_as_override_cmd);
14920 install_element (BGP_IPV6M_NODE, &no_neighbor_as_override_cmd);
14921 install_element (BGP_VPNV4_NODE, &neighbor_as_override_cmd);
14922 install_element (BGP_VPNV4_NODE, &no_neighbor_as_override_cmd);
8ecd3266 14923 install_element (BGP_VPNV6_NODE, &neighbor_as_override_cmd);
14924 install_element (BGP_VPNV6_NODE, &no_neighbor_as_override_cmd);
c7122e14 14925
718e3744 14926 /* "neighbor remove-private-AS" commands. */
14927 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
14928 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
14929 install_element (BGP_NODE, &neighbor_remove_private_as_all_cmd);
14930 install_element (BGP_NODE, &no_neighbor_remove_private_as_all_cmd);
14931 install_element (BGP_NODE, &neighbor_remove_private_as_replace_as_cmd);
14932 install_element (BGP_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
14933 install_element (BGP_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
14934 install_element (BGP_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
718e3744 14935 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
14936 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
14937 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_cmd);
14938 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_cmd);
14939 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_replace_as_cmd);
14940 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
14941 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
14942 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
718e3744 14943 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
14944 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
14945 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_cmd);
14946 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_cmd);
14947 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_replace_as_cmd);
14948 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
14949 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
14950 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
718e3744 14951 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
14952 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
14953 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_cmd);
14954 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_cmd);
14955 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_replace_as_cmd);
14956 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
14957 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
14958 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
25ffbdc1 14959 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
14960 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
14961 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_cmd);
14962 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_cmd);
14963 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_replace_as_cmd);
14964 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
14965 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
14966 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
718e3744 14967 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
14968 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
14969 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_cmd);
14970 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_cmd);
14971 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_replace_as_cmd);
14972 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
14973 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
14974 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
8ecd3266 14975 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
14976 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
14977 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_cmd);
14978 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_cmd);
14979 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_replace_as_cmd);
14980 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
14981 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
14982 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
8b1fb8be
LB
14983 install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd);
14984 install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd);
14985 install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd);
14986 install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd);
718e3744 14987
14988 /* "neighbor send-community" commands.*/
14989 install_element (BGP_NODE, &neighbor_send_community_cmd);
14990 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
14991 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
14992 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
14993 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
14994 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
14995 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
14996 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
14997 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
14998 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
14999 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
15000 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
15001 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
15002 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
15003 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
15004 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
25ffbdc1 15005 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
15006 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
15007 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
15008 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
718e3744 15009 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
15010 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
15011 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
15012 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
8ecd3266 15013 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
15014 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
15015 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
15016 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
8b1fb8be
LB
15017 install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd);
15018 install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd);
15019 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd);
15020 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd);
15021 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd);
15022 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd);
15023 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd);
15024 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd);
718e3744 15025
15026 /* "neighbor route-reflector" commands.*/
15027 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
15028 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
15029 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
15030 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
15031 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
15032 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
15033 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
15034 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
25ffbdc1 15035 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
15036 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
718e3744 15037 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
15038 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
8ecd3266 15039 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
15040 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
8b1fb8be
LB
15041 install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd);
15042 install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd);
15043 install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd);
15044 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd);
718e3744 15045
15046 /* "neighbor route-server" commands.*/
15047 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
15048 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
15049 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
15050 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
15051 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
15052 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
15053 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
15054 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
25ffbdc1 15055 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
15056 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
718e3744 15057 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
15058 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
8ecd3266 15059 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
15060 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
8b1fb8be
LB
15061 install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd);
15062 install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd);
15063 install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd);
15064 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd);
718e3744 15065
adbac85e
DW
15066 /* "neighbor addpath-tx-all-paths" commands.*/
15067 install_element (BGP_NODE, &neighbor_addpath_tx_all_paths_cmd);
15068 install_element (BGP_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
15069 install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_all_paths_cmd);
15070 install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
15071 install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_all_paths_cmd);
15072 install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
15073 install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_all_paths_cmd);
15074 install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
15075 install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_all_paths_cmd);
15076 install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
15077 install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_all_paths_cmd);
15078 install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
8ecd3266 15079 install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_all_paths_cmd);
15080 install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
adbac85e 15081
06370dac
DW
15082 /* "neighbor addpath-tx-bestpath-per-AS" commands.*/
15083 install_element (BGP_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15084 install_element (BGP_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
15085 install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15086 install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
15087 install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15088 install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
15089 install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15090 install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
15091 install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15092 install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
15093 install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15094 install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
8ecd3266 15095 install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15096 install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
06370dac 15097
718e3744 15098 /* "neighbor passive" commands. */
15099 install_element (BGP_NODE, &neighbor_passive_cmd);
15100 install_element (BGP_NODE, &no_neighbor_passive_cmd);
15101
d5a5c8f0 15102
718e3744 15103 /* "neighbor shutdown" commands. */
15104 install_element (BGP_NODE, &neighbor_shutdown_cmd);
15105 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
15106
8a92a8a0
DS
15107 /* "neighbor capability extended-nexthop" commands.*/
15108 install_element (BGP_NODE, &neighbor_capability_enhe_cmd);
15109 install_element (BGP_NODE, &no_neighbor_capability_enhe_cmd);
15110
718e3744 15111 /* "neighbor capability orf prefix-list" commands.*/
15112 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
15113 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
15114 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
15115 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
15116 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
15117 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
15118 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
15119 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
25ffbdc1 15120 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
15121 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
718e3744 15122
15123 /* "neighbor capability dynamic" commands.*/
15124 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
15125 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
15126
15127 /* "neighbor dont-capability-negotiate" commands. */
15128 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
15129 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
15130
15131 /* "neighbor ebgp-multihop" commands. */
15132 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
15133 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
15134 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
15135 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
15136
6ffd2079 15137 /* "neighbor disable-connected-check" commands. */
15138 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
15139 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
718e3744 15140 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
15141 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
15142
15143 /* "neighbor description" commands. */
15144 install_element (BGP_NODE, &neighbor_description_cmd);
15145 install_element (BGP_NODE, &no_neighbor_description_cmd);
15146 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
15147
15148 /* "neighbor update-source" commands. "*/
15149 install_element (BGP_NODE, &neighbor_update_source_cmd);
15150 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
15151
15152 /* "neighbor default-originate" commands. */
15153 install_element (BGP_NODE, &neighbor_default_originate_cmd);
15154 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
15155 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
15156 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
15157 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
15158 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
15159 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
15160 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
15161 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
15162 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
15163 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
15164 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
15165 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
15166 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
15167 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
15168 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
25ffbdc1 15169 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
15170 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
15171 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
15172 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
718e3744 15173
15174 /* "neighbor port" commands. */
15175 install_element (BGP_NODE, &neighbor_port_cmd);
15176 install_element (BGP_NODE, &no_neighbor_port_cmd);
15177 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
15178
15179 /* "neighbor weight" commands. */
15180 install_element (BGP_NODE, &neighbor_weight_cmd);
15181 install_element (BGP_NODE, &no_neighbor_weight_cmd);
15182 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
15183
15184 /* "neighbor override-capability" commands. */
15185 install_element (BGP_NODE, &neighbor_override_capability_cmd);
15186 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
15187
15188 /* "neighbor strict-capability-match" commands. */
15189 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
15190 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
15191
15192 /* "neighbor timers" commands. */
15193 install_element (BGP_NODE, &neighbor_timers_cmd);
15194 install_element (BGP_NODE, &no_neighbor_timers_cmd);
813d4307 15195 install_element (BGP_NODE, &no_neighbor_timers_val_cmd);
718e3744 15196
15197 /* "neighbor timers connect" commands. */
15198 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
15199 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
15200 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
15201
15202 /* "neighbor advertisement-interval" commands. */
15203 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
15204 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
15205 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
15206
718e3744 15207 /* "neighbor interface" commands. */
15208 install_element (BGP_NODE, &neighbor_interface_cmd);
15209 install_element (BGP_NODE, &no_neighbor_interface_cmd);
15210
15211 /* "neighbor distribute" commands. */
15212 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
15213 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
15214 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
15215 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
15216 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
15217 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
15218 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
15219 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
25ffbdc1 15220 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
15221 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
718e3744 15222 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
15223 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
8ecd3266 15224 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
15225 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
8b1fb8be
LB
15226 install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd);
15227 install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd);
15228 install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd);
15229 install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd);
718e3744 15230
15231 /* "neighbor prefix-list" commands. */
15232 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
15233 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
15234 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
15235 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
15236 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
15237 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
15238 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
15239 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
25ffbdc1 15240 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
15241 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
718e3744 15242 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
15243 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
8ecd3266 15244 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
15245 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
8b1fb8be
LB
15246 install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd);
15247 install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd);
15248 install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd);
15249 install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd);
718e3744 15250
15251 /* "neighbor filter-list" commands. */
15252 install_element (BGP_NODE, &neighbor_filter_list_cmd);
15253 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
15254 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
15255 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
15256 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
15257 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
15258 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
15259 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
25ffbdc1 15260 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
15261 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
718e3744 15262 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
15263 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
8ecd3266 15264 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
15265 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
8b1fb8be
LB
15266 install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd);
15267 install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd);
15268 install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd);
15269 install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd);
718e3744 15270
15271 /* "neighbor route-map" commands. */
15272 install_element (BGP_NODE, &neighbor_route_map_cmd);
15273 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
15274 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
15275 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
15276 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
15277 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
15278 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
15279 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
25ffbdc1 15280 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
15281 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
718e3744 15282 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
15283 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
8ecd3266 15284 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
15285 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
8b1fb8be
LB
15286 install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd);
15287 install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd);
15288 install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd);
15289 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd);
718e3744 15290
15291 /* "neighbor unsuppress-map" commands. */
15292 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
15293 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
15294 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
15295 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
15296 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
15297 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
15298 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
15299 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
25ffbdc1 15300 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
15301 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
a58545bb 15302 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
bb86c601 15303 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
8ecd3266 15304 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
bb86c601 15305 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
8b1fb8be
LB
15306 install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd);
15307 install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd);
15308 install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd);
15309 install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd);
718e3744 15310
15311 /* "neighbor maximum-prefix" commands. */
15312 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 15313 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 15314 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 15315 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 15316 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
15317 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15318 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
15319 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 15320 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15321 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15322 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15323 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15324 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15325 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 15326 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 15327 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 15328 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 15329 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
15330 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15331 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
15332 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 15333 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15334 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15335 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15336 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15337 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15338 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 15339 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 15340 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 15341 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 15342 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
15343 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15344 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
15345 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 15346 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15347 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15348 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15349 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15350 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15351 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 15352 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 15353 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 15354 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 15355 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
15356 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15357 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
15358 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 15359 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15360 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15361 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15362 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15363 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
25ffbdc1 15364 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
15365 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
15366 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
15367 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
15368 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
15369 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
15370 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
15371 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
15372 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15373 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15374 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15375 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15376 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15377 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 15378 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 15379 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 15380 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 15381 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
15382 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15383 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
15384 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 15385 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15386 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15387 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15388 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15389 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
8ecd3266 15390 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
15391 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
15392 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
15393 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
15394 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
15395 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
15396 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
15397 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
15398 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15399 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15400 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15401 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15402 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15403
8b1fb8be
LB
15404 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd);
15405 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd);
15406 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd);
15407 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
15408 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd);
15409 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
15410 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd);
15411 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd);
15412 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15413 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15414 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15415 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15416 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
15417
15418 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd);
15419 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
15420 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
15421 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
15422 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
15423 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
15424 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd);
15425 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
15426 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15427 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15428 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15429 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15430 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
15431
718e3744 15432 /* "neighbor allowas-in" */
15433 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
15434 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
15435 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15436 install_element (BGP_NODE, &no_neighbor_allowas_in_val_cmd);
718e3744 15437 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
15438 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
15439 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15440 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_val_cmd);
718e3744 15441 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
15442 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
15443 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15444 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_val_cmd);
718e3744 15445 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
15446 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
15447 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15448 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_val_cmd);
25ffbdc1 15449 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
15450 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
15451 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15452 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_val_cmd);
718e3744 15453 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
15454 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
15455 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15456 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_val_cmd);
8ecd3266 15457 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
15458 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
15459 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
15460 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_val_cmd);
8b1fb8be
LB
15461 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd);
15462 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd);
15463 install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd);
15464 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd);
15465 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd);
15466 install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd);
718e3744 15467
15468 /* address-family commands. */
15469 install_element (BGP_NODE, &address_family_ipv4_cmd);
15470 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
15471#ifdef HAVE_IPV6
15472 install_element (BGP_NODE, &address_family_ipv6_cmd);
25ffbdc1 15473 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
718e3744 15474#endif /* HAVE_IPV6 */
15475 install_element (BGP_NODE, &address_family_vpnv4_cmd);
15476 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
15477
8b1fb8be
LB
15478 install_element (BGP_NODE, &address_family_vpnv6_cmd);
15479 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
15480
15481 install_element (BGP_NODE, &address_family_encap_cmd);
15482 install_element (BGP_NODE, &address_family_encapv4_cmd);
15483#ifdef HAVE_IPV6
15484 install_element (BGP_NODE, &address_family_encapv6_cmd);
15485#endif
15486
718e3744 15487 /* "exit-address-family" command. */
15488 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
15489 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
15490 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
25ffbdc1 15491 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
718e3744 15492 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
8ecd3266 15493 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
8b1fb8be
LB
15494 install_element (BGP_ENCAP_NODE, &exit_address_family_cmd);
15495 install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd);
718e3744 15496
15497 /* "clear ip bgp commands" */
15498 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
15499 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
15500 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
01080f7c 15501 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_cmd);
718e3744 15502 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
01080f7c 15503 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_cmd);
718e3744 15504 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
01080f7c 15505 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_cmd);
718e3744 15506 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
01080f7c 15507 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_cmd);
15508
718e3744 15509 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
15510 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
15511 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
01080f7c 15512 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_cmd);
718e3744 15513 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
01080f7c 15514 install_element (ENABLE_NODE, &clear_bgp_instance_peer_cmd);
718e3744 15515 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
01080f7c 15516 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_cmd);
718e3744 15517 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
01080f7c 15518 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_cmd);
718e3744 15519 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
01080f7c 15520 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_cmd);
718e3744 15521 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
01080f7c 15522 install_element (ENABLE_NODE, &clear_bgp_instance_external_cmd);
718e3744 15523 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
01080f7c 15524 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_cmd);
718e3744 15525 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
01080f7c 15526 install_element (ENABLE_NODE, &clear_bgp_instance_as_cmd);
718e3744 15527 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
01080f7c 15528 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_cmd);
718e3744 15529
15530 /* "clear ip bgp neighbor soft in" */
15531 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
15532 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
15533 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
01080f7c 15534 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_cmd);
718e3744 15535 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
718e3744 15536 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
01080f7c 15537 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_in_cmd);
718e3744 15538 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
01080f7c 15539 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_in_cmd);
718e3744 15540 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
15541 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
01080f7c 15542 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_in_cmd);
718e3744 15543 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
01080f7c 15544 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_in_cmd);
718e3744 15545 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
15546 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
01080f7c 15547 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_in_cmd);
718e3744 15548 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
01080f7c 15549 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_in_cmd);
718e3744 15550 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
15551 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
01080f7c 15552 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_in_cmd);
718e3744 15553 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
01080f7c 15554 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_in_cmd);
718e3744 15555 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
15556 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
15557 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
15558 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
01080f7c 15559 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_cmd);
718e3744 15560 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
718e3744 15561 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
01080f7c 15562 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_in_cmd);
718e3744 15563 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
01080f7c 15564 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_in_cmd);
718e3744 15565 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
15566 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
01080f7c 15567 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd);
718e3744 15568 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
01080f7c 15569 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_in_cmd);
718e3744 15570 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
15571 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
01080f7c 15572 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_in_cmd);
718e3744 15573 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
01080f7c 15574 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_in_cmd);
718e3744 15575 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
15576 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
01080f7c 15577 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_in_cmd);
718e3744 15578 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
01080f7c 15579 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_in_cmd);
718e3744 15580 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
15581 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
15582 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
15583 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
15584 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
15585 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
15586 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
587ff0fd
LB
15587 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
15588 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
15589 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
15590 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
15591 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
15592 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
718e3744 15593 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
15594 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
15595 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
01080f7c 15596 install_element (ENABLE_NODE, &clear_bgp_instance_all_in_cmd);
718e3744 15597 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
15598 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
01080f7c 15599 install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_in_cmd);
718e3744 15600 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
01080f7c 15601 install_element (ENABLE_NODE, &clear_bgp_instance_peer_in_cmd);
718e3744 15602 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
15603 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
01080f7c 15604 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_in_cmd);
718e3744 15605 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
01080f7c 15606 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_in_cmd);
718e3744 15607 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
15608 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
01080f7c 15609 install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_in_cmd);
718e3744 15610 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
01080f7c 15611 install_element (ENABLE_NODE, &clear_bgp_instance_external_in_cmd);
718e3744 15612 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
15613 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
01080f7c 15614 install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_in_cmd);
718e3744 15615 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
01080f7c 15616 install_element (ENABLE_NODE, &clear_bgp_instance_as_in_cmd);
718e3744 15617 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
15618 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
01080f7c 15619 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_in_cmd);
718e3744 15620 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
01080f7c 15621 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_in_cmd);
718e3744 15622 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
15623 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
01080f7c 15624 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_in_cmd);
718e3744 15625 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
01080f7c 15626 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_in_cmd);
718e3744 15627 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
15628 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
01080f7c 15629 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_in_cmd);
718e3744 15630 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
01080f7c 15631 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_in_cmd);
718e3744 15632 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
15633 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
01080f7c 15634 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_in_cmd);
718e3744 15635 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
01080f7c 15636 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_in_cmd);
718e3744 15637 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
15638 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
01080f7c 15639 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_in_cmd);
718e3744 15640 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
01080f7c 15641 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_in_cmd);
718e3744 15642 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
718e3744 15643
8ad7271d
DS
15644 /* clear ip bgp prefix */
15645 install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd);
01080f7c 15646 install_element (ENABLE_NODE, &clear_ip_bgp_instance_prefix_cmd);
8ad7271d 15647 install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd);
01080f7c 15648 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_safi_prefix_cmd);
8ad7271d 15649
718e3744 15650 /* "clear ip bgp neighbor soft out" */
15651 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
15652 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
15653 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
01080f7c 15654 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_out_cmd);
718e3744 15655 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
01080f7c 15656 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_out_cmd);
718e3744 15657 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
01080f7c 15658 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_out_cmd);
718e3744 15659 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
01080f7c 15660 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_out_cmd);
718e3744 15661 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
01080f7c 15662 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_out_cmd);
718e3744 15663 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
01080f7c 15664 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_out_cmd);
718e3744 15665 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
01080f7c 15666 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_out_cmd);
718e3744 15667 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
01080f7c 15668 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_out_cmd);
718e3744 15669 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
01080f7c 15670 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_out_cmd);
718e3744 15671 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
15672 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
15673 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
01080f7c 15674 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_out_cmd);
718e3744 15675 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
01080f7c 15676 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_out_cmd);
718e3744 15677 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
01080f7c 15678 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_out_cmd);
718e3744 15679 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
01080f7c 15680 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd);
718e3744 15681 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
01080f7c 15682 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_out_cmd);
718e3744 15683 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
01080f7c 15684 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_out_cmd);
718e3744 15685 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
01080f7c 15686 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_out_cmd);
718e3744 15687 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
01080f7c 15688 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_out_cmd);
718e3744 15689 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
01080f7c 15690 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_out_cmd);
718e3744 15691 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
15692 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
15693 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
15694 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
15695 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
15696 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
587ff0fd
LB
15697 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
15698 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
15699 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
15700 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
15701 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
15702 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
718e3744 15703 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
15704 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
15705 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
01080f7c 15706 install_element (ENABLE_NODE, &clear_bgp_instance_all_out_cmd);
718e3744 15707 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
01080f7c 15708 install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_out_cmd);
718e3744 15709 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
01080f7c 15710 install_element (ENABLE_NODE, &clear_bgp_instance_peer_out_cmd);
718e3744 15711 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
01080f7c 15712 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_out_cmd);
718e3744 15713 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
01080f7c 15714 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_out_cmd);
718e3744 15715 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
01080f7c 15716 install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_out_cmd);
718e3744 15717 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
01080f7c 15718 install_element (ENABLE_NODE, &clear_bgp_instance_external_out_cmd);
718e3744 15719 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
01080f7c 15720 install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_out_cmd);
718e3744 15721 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
01080f7c 15722 install_element (ENABLE_NODE, &clear_bgp_instance_as_out_cmd);
718e3744 15723 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
01080f7c 15724 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_out_cmd);
718e3744 15725 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
01080f7c 15726 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_out_cmd);
718e3744 15727 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
01080f7c 15728 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_out_cmd);
718e3744 15729 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
01080f7c 15730 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_out_cmd);
718e3744 15731 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
01080f7c 15732 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_out_cmd);
718e3744 15733 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
01080f7c 15734 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_out_cmd);
718e3744 15735 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
01080f7c 15736 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_out_cmd);
718e3744 15737 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
01080f7c 15738 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_out_cmd);
718e3744 15739 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
01080f7c 15740 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_out_cmd);
718e3744 15741 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
01080f7c 15742 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_out_cmd);
718e3744 15743
15744 /* "clear ip bgp neighbor soft" */
15745 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
15746 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
15747 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
01080f7c 15748 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_cmd);
718e3744 15749 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
01080f7c 15750 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_cmd);
718e3744 15751 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
01080f7c 15752 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_cmd);
718e3744 15753 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
01080f7c 15754 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_cmd);
718e3744 15755 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
15756 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
15757 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
01080f7c 15758 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_cmd);
718e3744 15759 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
01080f7c 15760 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_cmd);
718e3744 15761 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
01080f7c 15762 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_cmd);
718e3744 15763 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
01080f7c 15764 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_cmd);
718e3744 15765 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
15766 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
15767 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
587ff0fd
LB
15768 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
15769 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
15770 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
718e3744 15771 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
15772 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
15773 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
01080f7c 15774 install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_cmd);
718e3744 15775 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
01080f7c 15776 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_cmd);
718e3744 15777 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
01080f7c 15778 install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_cmd);
718e3744 15779 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
01080f7c 15780 install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_cmd);
718e3744 15781 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
01080f7c 15782 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_cmd);
718e3744 15783 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
01080f7c 15784 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_cmd);
718e3744 15785 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
01080f7c 15786 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_cmd);
718e3744 15787 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
01080f7c 15788 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_cmd);
718e3744 15789 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
01080f7c 15790 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_cmd);
718e3744 15791
15792 /* "show ip bgp summary" commands. */
15793 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
3f9c7369 15794 install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd);
8386ac43 15795 install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_cmd);
f186de26 15796 install_element (VIEW_NODE, &show_ip_bgp_instance_all_updgrps_cmd);
3f9c7369
DS
15797 install_element (VIEW_NODE, &show_bgp_updgrps_cmd);
15798 install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_cmd);
8386ac43 15799 install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_cmd);
f186de26 15800 install_element (VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd);
8fe8a7f6 15801 install_element (VIEW_NODE, &show_ip_bgp_updgrps_s_cmd);
8386ac43 15802 install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_s_cmd);
8fe8a7f6
DS
15803 install_element (VIEW_NODE, &show_bgp_updgrps_s_cmd);
15804 install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_s_cmd);
8386ac43 15805 install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd);
3f9c7369 15806 install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd);
8386ac43 15807 install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_cmd);
3f9c7369 15808 install_element (VIEW_NODE, &show_bgp_updgrps_adj_cmd);
8386ac43 15809 install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_cmd);
3f9c7369 15810 install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_cmd);
8fe8a7f6 15811 install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_s_cmd);
8386ac43 15812 install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15813 install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd);
8386ac43 15814 install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15815 install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
718e3744 15816 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
f186de26 15817 install_element (VIEW_NODE, &show_ip_bgp_instance_all_summary_cmd);
718e3744 15818 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
95cbbd2a 15819 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
718e3744 15820 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
95cbbd2a 15821 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
718e3744 15822 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
15823 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
15824#ifdef HAVE_IPV6
15825 install_element (VIEW_NODE, &show_bgp_summary_cmd);
15826 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
f186de26 15827 install_element (VIEW_NODE, &show_bgp_instance_all_summary_cmd);
718e3744 15828 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
95cbbd2a 15829 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
718e3744 15830 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
95cbbd2a 15831 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
62687ff1
PJ
15832#endif /* HAVE_IPV6 */
15833 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
3f9c7369 15834 install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd);
8386ac43 15835 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_cmd);
f186de26 15836 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_updgrps_cmd);
3f9c7369
DS
15837 install_element (RESTRICTED_NODE, &show_bgp_updgrps_cmd);
15838 install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_cmd);
8386ac43 15839 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_cmd);
f186de26 15840 install_element (RESTRICTED_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd);
8fe8a7f6 15841 install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_s_cmd);
8386ac43 15842 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_s_cmd);
8fe8a7f6
DS
15843 install_element (RESTRICTED_NODE, &show_bgp_updgrps_s_cmd);
15844 install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_s_cmd);
8386ac43 15845 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd);
3f9c7369 15846 install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_cmd);
8386ac43 15847 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_cmd);
3f9c7369 15848 install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_cmd);
8386ac43 15849 install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_cmd);
3f9c7369 15850 install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_cmd);
8fe8a7f6 15851 install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_s_cmd);
8386ac43 15852 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15853 install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_s_cmd);
8386ac43 15854 install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15855 install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
62687ff1 15856 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
f186de26 15857 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_summary_cmd);
62687ff1 15858 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
95cbbd2a 15859 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
62687ff1 15860 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
95cbbd2a 15861 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
62687ff1
PJ
15862 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
15863 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
15864#ifdef HAVE_IPV6
15865 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
15866 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
f186de26 15867 install_element (RESTRICTED_NODE, &show_bgp_instance_all_summary_cmd);
62687ff1 15868 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
95cbbd2a 15869 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
62687ff1 15870 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
95cbbd2a 15871 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
718e3744 15872#endif /* HAVE_IPV6 */
15873 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
3f9c7369 15874 install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd);
8386ac43 15875 install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_cmd);
f186de26 15876 install_element (ENABLE_NODE, &show_ip_bgp_instance_all_updgrps_cmd);
3f9c7369
DS
15877 install_element (ENABLE_NODE, &show_bgp_updgrps_cmd);
15878 install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_cmd);
8386ac43 15879 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_cmd);
f186de26 15880 install_element (ENABLE_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd);
8fe8a7f6 15881 install_element (ENABLE_NODE, &show_ip_bgp_updgrps_s_cmd);
8386ac43 15882 install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_s_cmd);
8fe8a7f6
DS
15883 install_element (ENABLE_NODE, &show_bgp_updgrps_s_cmd);
15884 install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_s_cmd);
8386ac43 15885 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd);
3f9c7369 15886 install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_cmd);
8386ac43 15887 install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_cmd);
3f9c7369 15888 install_element (ENABLE_NODE, &show_bgp_updgrps_adj_cmd);
8386ac43 15889 install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_cmd);
3f9c7369 15890 install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_cmd);
8fe8a7f6 15891 install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_s_cmd);
8386ac43 15892 install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15893 install_element (ENABLE_NODE, &show_bgp_updgrps_adj_s_cmd);
8386ac43 15894 install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15895 install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
718e3744 15896 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
f186de26 15897 install_element (ENABLE_NODE, &show_ip_bgp_instance_all_summary_cmd);
718e3744 15898 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
95cbbd2a 15899 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
718e3744 15900 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
95cbbd2a 15901 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
718e3744 15902 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
15903 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
15904#ifdef HAVE_IPV6
15905 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
15906 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
f186de26 15907 install_element (ENABLE_NODE, &show_bgp_instance_all_summary_cmd);
718e3744 15908 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
95cbbd2a 15909 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
718e3744 15910 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
95cbbd2a 15911 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
718e3744 15912#endif /* HAVE_IPV6 */
15913
15914 /* "show ip bgp neighbors" commands. */
15915 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
15916 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
15917 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
15918 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
15919 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
15920 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
15921 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
15922 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
15923 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
f186de26 15924 install_element (VIEW_NODE, &show_ip_bgp_instance_all_neighbors_cmd);
718e3744 15925 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
62687ff1
PJ
15926 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
15927 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
15928 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
15929 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
15930 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
718e3744 15931 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
15932 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
15933 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
15934 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
15935 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
15936 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
15937 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
15938 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
15939 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
f186de26 15940 install_element (ENABLE_NODE, &show_ip_bgp_instance_all_neighbors_cmd);
718e3744 15941 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
15942
15943#ifdef HAVE_IPV6
15944 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
15945 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
15946 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
15947 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
bb46e94f 15948 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
15949 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
15950 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
15951 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
62687ff1
PJ
15952 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
15953 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
15954 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
15955 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
718e3744 15956 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
15957 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
15958 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
15959 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
bb46e94f 15960 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
15961 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
15962 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
15963 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
718e3744 15964
15965 /* Old commands. */
15966 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
15967 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
15968 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
15969 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
15970#endif /* HAVE_IPV6 */
fee0f4c6 15971
f14e6fdb
DS
15972 /* "show ip bgp peer-group" commands. */
15973 install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd);
15974 install_element (VIEW_NODE, &show_ip_bgp_instance_peer_groups_cmd);
15975 install_element (VIEW_NODE, &show_ip_bgp_peer_group_cmd);
15976 install_element (VIEW_NODE, &show_ip_bgp_instance_peer_group_cmd);
15977 install_element (ENABLE_NODE, &show_ip_bgp_peer_groups_cmd);
15978 install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_groups_cmd);
15979 install_element (ENABLE_NODE, &show_ip_bgp_peer_group_cmd);
15980 install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_group_cmd);
15981
718e3744 15982 /* "show ip bgp paths" commands. */
15983 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
15984 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
15985 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
15986 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
15987
15988 /* "show ip bgp community" commands. */
15989 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
15990 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
15991
15992 /* "show ip bgp attribute-info" commands. */
15993 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
15994 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
15995
15996 /* "redistribute" commands. */
15997 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
15998 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
15999 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
16000 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
16001 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
16002 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
16003 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
16004 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
16005 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
16006 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
7c8ff89e
DS
16007 install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_cmd);
16008 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_cmd);
16009 install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd);
16010 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd);
16011 install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd);
16012 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd);
16013 install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd);
16014 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd);
16015 install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd);
16016 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd);
919e0666
DW
16017 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_cmd);
16018 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_cmd);
16019 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_cmd);
16020 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
16021 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_cmd);
16022 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
16023 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
16024 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
16025 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
16026 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
16027 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_cmd);
16028 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_cmd);
16029 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd);
16030 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd);
16031 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd);
16032 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd);
16033 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd);
16034 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd);
16035 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd);
16036 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd);
718e3744 16037#ifdef HAVE_IPV6
16038 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
16039 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
16040 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
16041 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
16042 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
16043 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
16044 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
16045 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
16046 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
16047 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
16048#endif /* HAVE_IPV6 */
16049
fa411a21
NH
16050 /* ttl_security commands */
16051 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
16052 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
16053
4bf6a362
PJ
16054 /* "show bgp memory" commands. */
16055 install_element (VIEW_NODE, &show_bgp_memory_cmd);
62687ff1 16056 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
4bf6a362
PJ
16057 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
16058
e0081f70
ML
16059 /* "show bgp views" commands. */
16060 install_element (VIEW_NODE, &show_bgp_views_cmd);
16061 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
16062 install_element (ENABLE_NODE, &show_bgp_views_cmd);
16063
8386ac43 16064 /* "show bgp vrfs" commands. */
16065 install_element (VIEW_NODE, &show_bgp_vrfs_cmd);
16066 install_element (RESTRICTED_NODE, &show_bgp_vrfs_cmd);
16067 install_element (ENABLE_NODE, &show_bgp_vrfs_cmd);
16068
718e3744 16069 /* Community-list. */
16070 community_list_vty ();
16071}
6b0655a2 16072
718e3744 16073#include "memory.h"
16074#include "bgp_regex.h"
16075#include "bgp_clist.h"
16076#include "bgp_ecommunity.h"
16077
16078/* VTY functions. */
16079
16080/* Direction value to string conversion. */
94f2b392 16081static const char *
718e3744 16082community_direct_str (int direct)
16083{
16084 switch (direct)
16085 {
16086 case COMMUNITY_DENY:
16087 return "deny";
718e3744 16088 case COMMUNITY_PERMIT:
16089 return "permit";
718e3744 16090 default:
16091 return "unknown";
718e3744 16092 }
16093}
16094
16095/* Display error string. */
94f2b392 16096static void
718e3744 16097community_list_perror (struct vty *vty, int ret)
16098{
16099 switch (ret)
16100 {
16101 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
b729294c 16102 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
718e3744 16103 break;
16104 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
16105 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
16106 break;
16107 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
16108 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
16109 break;
16110 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
16111 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
16112 break;
16113 }
16114}
16115
16116/* VTY interface for community_set() function. */
94f2b392 16117static int
fd79ac91 16118community_list_set_vty (struct vty *vty, int argc, const char **argv,
16119 int style, int reject_all_digit_name)
718e3744 16120{
16121 int ret;
16122 int direct;
16123 char *str;
16124
16125 /* Check the list type. */
16126 if (strncmp (argv[1], "p", 1) == 0)
16127 direct = COMMUNITY_PERMIT;
16128 else if (strncmp (argv[1], "d", 1) == 0)
16129 direct = COMMUNITY_DENY;
16130 else
16131 {
16132 vty_out (vty, "%% Matching condition must be permit or deny%s",
16133 VTY_NEWLINE);
16134 return CMD_WARNING;
16135 }
16136
16137 /* All digit name check. */
16138 if (reject_all_digit_name && all_digit (argv[0]))
16139 {
16140 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
16141 return CMD_WARNING;
16142 }
16143
16144 /* Concat community string argument. */
16145 if (argc > 1)
16146 str = argv_concat (argv, argc, 2);
16147 else
16148 str = NULL;
16149
16150 /* When community_list_set() return nevetive value, it means
16151 malformed community string. */
16152 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
16153
16154 /* Free temporary community list string allocated by
16155 argv_concat(). */
16156 if (str)
16157 XFREE (MTYPE_TMP, str);
16158
16159 if (ret < 0)
16160 {
16161 /* Display error string. */
16162 community_list_perror (vty, ret);
16163 return CMD_WARNING;
16164 }
16165
16166 return CMD_SUCCESS;
16167}
16168
718e3744 16169/* Communiyt-list entry delete. */
94f2b392 16170static int
fee6e4e4 16171community_list_unset_vty (struct vty *vty, int argc, const char **argv,
813d4307 16172 int style, int delete_all)
718e3744 16173{
16174 int ret;
fee6e4e4 16175 int direct = 0;
16176 char *str = NULL;
718e3744 16177
fee6e4e4 16178 if (argc > 1)
718e3744 16179 {
fee6e4e4 16180 /* Check the list direct. */
16181 if (strncmp (argv[1], "p", 1) == 0)
16182 direct = COMMUNITY_PERMIT;
16183 else if (strncmp (argv[1], "d", 1) == 0)
16184 direct = COMMUNITY_DENY;
16185 else
16186 {
16187 vty_out (vty, "%% Matching condition must be permit or deny%s",
16188 VTY_NEWLINE);
16189 return CMD_WARNING;
16190 }
718e3744 16191
fee6e4e4 16192 /* Concat community string argument. */
16193 str = argv_concat (argv, argc, 2);
16194 }
718e3744 16195
16196 /* Unset community list. */
813d4307 16197 ret = community_list_unset (bgp_clist, argv[0], str, direct, style, delete_all);
718e3744 16198
16199 /* Free temporary community list string allocated by
16200 argv_concat(). */
fee6e4e4 16201 if (str)
16202 XFREE (MTYPE_TMP, str);
718e3744 16203
16204 if (ret < 0)
16205 {
16206 community_list_perror (vty, ret);
16207 return CMD_WARNING;
16208 }
16209
16210 return CMD_SUCCESS;
16211}
16212
16213/* "community-list" keyword help string. */
16214#define COMMUNITY_LIST_STR "Add a community list entry\n"
718e3744 16215
718e3744 16216DEFUN (ip_community_list_standard,
16217 ip_community_list_standard_cmd,
16218 "ip community-list <1-99> (deny|permit) .AA:NN",
16219 IP_STR
16220 COMMUNITY_LIST_STR
16221 "Community list number (standard)\n"
16222 "Specify community to reject\n"
16223 "Specify community to accept\n"
16224 COMMUNITY_VAL_STR)
16225{
16226 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
16227}
16228
16229ALIAS (ip_community_list_standard,
16230 ip_community_list_standard2_cmd,
16231 "ip community-list <1-99> (deny|permit)",
16232 IP_STR
16233 COMMUNITY_LIST_STR
16234 "Community list number (standard)\n"
16235 "Specify community to reject\n"
16236 "Specify community to accept\n")
16237
16238DEFUN (ip_community_list_expanded,
16239 ip_community_list_expanded_cmd,
fee6e4e4 16240 "ip community-list <100-500> (deny|permit) .LINE",
718e3744 16241 IP_STR
16242 COMMUNITY_LIST_STR
16243 "Community list number (expanded)\n"
16244 "Specify community to reject\n"
16245 "Specify community to accept\n"
16246 "An ordered list as a regular-expression\n")
16247{
16248 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
16249}
16250
16251DEFUN (ip_community_list_name_standard,
16252 ip_community_list_name_standard_cmd,
16253 "ip community-list standard WORD (deny|permit) .AA:NN",
16254 IP_STR
16255 COMMUNITY_LIST_STR
16256 "Add a standard community-list entry\n"
16257 "Community list name\n"
16258 "Specify community to reject\n"
16259 "Specify community to accept\n"
16260 COMMUNITY_VAL_STR)
16261{
16262 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
16263}
16264
16265ALIAS (ip_community_list_name_standard,
16266 ip_community_list_name_standard2_cmd,
16267 "ip community-list standard WORD (deny|permit)",
16268 IP_STR
16269 COMMUNITY_LIST_STR
16270 "Add a standard community-list entry\n"
16271 "Community list name\n"
16272 "Specify community to reject\n"
16273 "Specify community to accept\n")
16274
16275DEFUN (ip_community_list_name_expanded,
16276 ip_community_list_name_expanded_cmd,
16277 "ip community-list expanded WORD (deny|permit) .LINE",
16278 IP_STR
16279 COMMUNITY_LIST_STR
16280 "Add an expanded community-list entry\n"
16281 "Community list name\n"
16282 "Specify community to reject\n"
16283 "Specify community to accept\n"
16284 "An ordered list as a regular-expression\n")
16285{
16286 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
16287}
16288
fee6e4e4 16289DEFUN (no_ip_community_list_standard_all,
16290 no_ip_community_list_standard_all_cmd,
16291 "no ip community-list <1-99>",
16292 NO_STR
16293 IP_STR
16294 COMMUNITY_LIST_STR
16295 "Community list number (standard)\n")
16296{
813d4307
DW
16297 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
16298}
16299
16300DEFUN (no_ip_community_list_standard_direction,
16301 no_ip_community_list_standard_direction_cmd,
16302 "no ip community-list <1-99> (deny|permit)",
16303 NO_STR
16304 IP_STR
16305 COMMUNITY_LIST_STR
16306 "Community list number (standard)\n"
16307 "Specify community to reject\n"
16308 "Specify community to accept\n")
16309{
16310 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
fee6e4e4 16311}
16312
813d4307 16313
fee6e4e4 16314DEFUN (no_ip_community_list_expanded_all,
16315 no_ip_community_list_expanded_all_cmd,
16316 "no ip community-list <100-500>",
718e3744 16317 NO_STR
16318 IP_STR
16319 COMMUNITY_LIST_STR
718e3744 16320 "Community list number (expanded)\n")
16321{
813d4307 16322 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
718e3744 16323}
16324
fee6e4e4 16325DEFUN (no_ip_community_list_name_standard_all,
16326 no_ip_community_list_name_standard_all_cmd,
16327 "no ip community-list standard WORD",
718e3744 16328 NO_STR
16329 IP_STR
16330 COMMUNITY_LIST_STR
16331 "Add a standard community-list entry\n"
718e3744 16332 "Community list name\n")
16333{
813d4307 16334 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
718e3744 16335}
16336
fee6e4e4 16337DEFUN (no_ip_community_list_name_expanded_all,
16338 no_ip_community_list_name_expanded_all_cmd,
16339 "no ip community-list expanded WORD",
718e3744 16340 NO_STR
16341 IP_STR
16342 COMMUNITY_LIST_STR
fee6e4e4 16343 "Add an expanded community-list entry\n"
16344 "Community list name\n")
718e3744 16345{
813d4307 16346 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
718e3744 16347}
16348
16349DEFUN (no_ip_community_list_standard,
16350 no_ip_community_list_standard_cmd,
16351 "no ip community-list <1-99> (deny|permit) .AA:NN",
16352 NO_STR
16353 IP_STR
16354 COMMUNITY_LIST_STR
16355 "Community list number (standard)\n"
16356 "Specify community to reject\n"
16357 "Specify community to accept\n"
16358 COMMUNITY_VAL_STR)
16359{
813d4307 16360 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
718e3744 16361}
16362
16363DEFUN (no_ip_community_list_expanded,
16364 no_ip_community_list_expanded_cmd,
fee6e4e4 16365 "no ip community-list <100-500> (deny|permit) .LINE",
718e3744 16366 NO_STR
16367 IP_STR
16368 COMMUNITY_LIST_STR
16369 "Community list number (expanded)\n"
16370 "Specify community to reject\n"
16371 "Specify community to accept\n"
16372 "An ordered list as a regular-expression\n")
16373{
813d4307 16374 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
718e3744 16375}
16376
16377DEFUN (no_ip_community_list_name_standard,
16378 no_ip_community_list_name_standard_cmd,
16379 "no ip community-list standard WORD (deny|permit) .AA:NN",
16380 NO_STR
16381 IP_STR
16382 COMMUNITY_LIST_STR
16383 "Specify a standard community-list\n"
16384 "Community list name\n"
16385 "Specify community to reject\n"
16386 "Specify community to accept\n"
16387 COMMUNITY_VAL_STR)
16388{
813d4307
DW
16389 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
16390}
16391
16392DEFUN (no_ip_community_list_name_standard_brief,
16393 no_ip_community_list_name_standard_brief_cmd,
16394 "no ip community-list standard WORD (deny|permit)",
16395 NO_STR
16396 IP_STR
16397 COMMUNITY_LIST_STR
16398 "Specify a standard community-list\n"
16399 "Community list name\n"
16400 "Specify community to reject\n"
16401 "Specify community to accept\n")
16402{
16403 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
718e3744 16404}
16405
16406DEFUN (no_ip_community_list_name_expanded,
16407 no_ip_community_list_name_expanded_cmd,
16408 "no ip community-list expanded WORD (deny|permit) .LINE",
16409 NO_STR
16410 IP_STR
16411 COMMUNITY_LIST_STR
16412 "Specify an expanded community-list\n"
16413 "Community list name\n"
16414 "Specify community to reject\n"
16415 "Specify community to accept\n"
16416 "An ordered list as a regular-expression\n")
16417{
813d4307 16418 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
718e3744 16419}
16420
94f2b392 16421static void
718e3744 16422community_list_show (struct vty *vty, struct community_list *list)
16423{
16424 struct community_entry *entry;
16425
16426 for (entry = list->head; entry; entry = entry->next)
16427 {
16428 if (entry == list->head)
16429 {
16430 if (all_digit (list->name))
16431 vty_out (vty, "Community %s list %s%s",
16432 entry->style == COMMUNITY_LIST_STANDARD ?
16433 "standard" : "(expanded) access",
16434 list->name, VTY_NEWLINE);
16435 else
16436 vty_out (vty, "Named Community %s list %s%s",
16437 entry->style == COMMUNITY_LIST_STANDARD ?
16438 "standard" : "expanded",
16439 list->name, VTY_NEWLINE);
16440 }
16441 if (entry->any)
16442 vty_out (vty, " %s%s",
16443 community_direct_str (entry->direct), VTY_NEWLINE);
16444 else
16445 vty_out (vty, " %s %s%s",
16446 community_direct_str (entry->direct),
16447 entry->style == COMMUNITY_LIST_STANDARD
16448 ? community_str (entry->u.com) : entry->config,
16449 VTY_NEWLINE);
16450 }
16451}
16452
16453DEFUN (show_ip_community_list,
16454 show_ip_community_list_cmd,
16455 "show ip community-list",
16456 SHOW_STR
16457 IP_STR
16458 "List community-list\n")
16459{
16460 struct community_list *list;
16461 struct community_list_master *cm;
16462
fee6e4e4 16463 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
718e3744 16464 if (! cm)
16465 return CMD_SUCCESS;
16466
16467 for (list = cm->num.head; list; list = list->next)
16468 community_list_show (vty, list);
16469
16470 for (list = cm->str.head; list; list = list->next)
16471 community_list_show (vty, list);
16472
16473 return CMD_SUCCESS;
16474}
16475
16476DEFUN (show_ip_community_list_arg,
16477 show_ip_community_list_arg_cmd,
fee6e4e4 16478 "show ip community-list (<1-500>|WORD)",
718e3744 16479 SHOW_STR
16480 IP_STR
16481 "List community-list\n"
16482 "Community-list number\n"
16483 "Community-list name\n")
16484{
16485 struct community_list *list;
16486
fee6e4e4 16487 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
718e3744 16488 if (! list)
16489 {
b729294c 16490 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
718e3744 16491 return CMD_WARNING;
16492 }
16493
16494 community_list_show (vty, list);
16495
16496 return CMD_SUCCESS;
16497}
6b0655a2 16498
94f2b392 16499static int
fd79ac91 16500extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
16501 int style, int reject_all_digit_name)
718e3744 16502{
16503 int ret;
16504 int direct;
16505 char *str;
16506
16507 /* Check the list type. */
16508 if (strncmp (argv[1], "p", 1) == 0)
16509 direct = COMMUNITY_PERMIT;
16510 else if (strncmp (argv[1], "d", 1) == 0)
16511 direct = COMMUNITY_DENY;
16512 else
16513 {
16514 vty_out (vty, "%% Matching condition must be permit or deny%s",
16515 VTY_NEWLINE);
16516 return CMD_WARNING;
16517 }
16518
16519 /* All digit name check. */
16520 if (reject_all_digit_name && all_digit (argv[0]))
16521 {
16522 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
16523 return CMD_WARNING;
16524 }
16525
16526 /* Concat community string argument. */
16527 if (argc > 1)
16528 str = argv_concat (argv, argc, 2);
16529 else
16530 str = NULL;
16531
16532 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
16533
16534 /* Free temporary community list string allocated by
16535 argv_concat(). */
16536 if (str)
16537 XFREE (MTYPE_TMP, str);
16538
16539 if (ret < 0)
16540 {
16541 community_list_perror (vty, ret);
16542 return CMD_WARNING;
16543 }
16544 return CMD_SUCCESS;
16545}
16546
94f2b392 16547static int
fee6e4e4 16548extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
813d4307 16549 int style, int delete_all)
718e3744 16550{
16551 int ret;
fee6e4e4 16552 int direct = 0;
16553 char *str = NULL;
718e3744 16554
fee6e4e4 16555 if (argc > 1)
718e3744 16556 {
fee6e4e4 16557 /* Check the list direct. */
16558 if (strncmp (argv[1], "p", 1) == 0)
16559 direct = COMMUNITY_PERMIT;
16560 else if (strncmp (argv[1], "d", 1) == 0)
16561 direct = COMMUNITY_DENY;
16562 else
16563 {
16564 vty_out (vty, "%% Matching condition must be permit or deny%s",
16565 VTY_NEWLINE);
16566 return CMD_WARNING;
16567 }
718e3744 16568
fee6e4e4 16569 /* Concat community string argument. */
16570 str = argv_concat (argv, argc, 2);
718e3744 16571 }
16572
718e3744 16573 /* Unset community list. */
813d4307 16574 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style, delete_all);
718e3744 16575
16576 /* Free temporary community list string allocated by
16577 argv_concat(). */
fee6e4e4 16578 if (str)
16579 XFREE (MTYPE_TMP, str);
718e3744 16580
16581 if (ret < 0)
16582 {
16583 community_list_perror (vty, ret);
16584 return CMD_WARNING;
16585 }
16586
16587 return CMD_SUCCESS;
16588}
16589
16590/* "extcommunity-list" keyword help string. */
16591#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
16592#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
16593
16594DEFUN (ip_extcommunity_list_standard,
16595 ip_extcommunity_list_standard_cmd,
16596 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
16597 IP_STR
16598 EXTCOMMUNITY_LIST_STR
16599 "Extended Community list number (standard)\n"
16600 "Specify community to reject\n"
16601 "Specify community to accept\n"
16602 EXTCOMMUNITY_VAL_STR)
16603{
16604 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
16605}
16606
16607ALIAS (ip_extcommunity_list_standard,
16608 ip_extcommunity_list_standard2_cmd,
16609 "ip extcommunity-list <1-99> (deny|permit)",
16610 IP_STR
16611 EXTCOMMUNITY_LIST_STR
16612 "Extended Community list number (standard)\n"
16613 "Specify community to reject\n"
16614 "Specify community to accept\n")
16615
16616DEFUN (ip_extcommunity_list_expanded,
16617 ip_extcommunity_list_expanded_cmd,
fee6e4e4 16618 "ip extcommunity-list <100-500> (deny|permit) .LINE",
718e3744 16619 IP_STR
16620 EXTCOMMUNITY_LIST_STR
16621 "Extended Community list number (expanded)\n"
16622 "Specify community to reject\n"
16623 "Specify community to accept\n"
16624 "An ordered list as a regular-expression\n")
16625{
16626 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
16627}
16628
16629DEFUN (ip_extcommunity_list_name_standard,
16630 ip_extcommunity_list_name_standard_cmd,
16631 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
16632 IP_STR
16633 EXTCOMMUNITY_LIST_STR
16634 "Specify standard extcommunity-list\n"
16635 "Extended Community list name\n"
16636 "Specify community to reject\n"
16637 "Specify community to accept\n"
16638 EXTCOMMUNITY_VAL_STR)
16639{
16640 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
16641}
16642
16643ALIAS (ip_extcommunity_list_name_standard,
16644 ip_extcommunity_list_name_standard2_cmd,
16645 "ip extcommunity-list standard WORD (deny|permit)",
16646 IP_STR
16647 EXTCOMMUNITY_LIST_STR
16648 "Specify standard extcommunity-list\n"
16649 "Extended Community list name\n"
16650 "Specify community to reject\n"
16651 "Specify community to accept\n")
16652
16653DEFUN (ip_extcommunity_list_name_expanded,
16654 ip_extcommunity_list_name_expanded_cmd,
16655 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
16656 IP_STR
16657 EXTCOMMUNITY_LIST_STR
16658 "Specify expanded extcommunity-list\n"
16659 "Extended Community list name\n"
16660 "Specify community to reject\n"
16661 "Specify community to accept\n"
16662 "An ordered list as a regular-expression\n")
16663{
16664 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
16665}
16666
fee6e4e4 16667DEFUN (no_ip_extcommunity_list_standard_all,
16668 no_ip_extcommunity_list_standard_all_cmd,
16669 "no ip extcommunity-list <1-99>",
16670 NO_STR
16671 IP_STR
16672 EXTCOMMUNITY_LIST_STR
16673 "Extended Community list number (standard)\n")
16674{
813d4307
DW
16675 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
16676}
16677
16678DEFUN (no_ip_extcommunity_list_standard_direction,
16679 no_ip_extcommunity_list_standard_direction_cmd,
16680 "no ip extcommunity-list <1-99> (deny|permit)",
16681 NO_STR
16682 IP_STR
16683 EXTCOMMUNITY_LIST_STR
16684 "Extended Community list number (standard)\n"
16685 "Specify community to reject\n"
16686 "Specify community to accept\n")
16687{
16688 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
fee6e4e4 16689}
16690
16691DEFUN (no_ip_extcommunity_list_expanded_all,
16692 no_ip_extcommunity_list_expanded_all_cmd,
16693 "no ip extcommunity-list <100-500>",
718e3744 16694 NO_STR
16695 IP_STR
16696 EXTCOMMUNITY_LIST_STR
718e3744 16697 "Extended Community list number (expanded)\n")
16698{
813d4307 16699 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
718e3744 16700}
16701
fee6e4e4 16702DEFUN (no_ip_extcommunity_list_name_standard_all,
16703 no_ip_extcommunity_list_name_standard_all_cmd,
16704 "no ip extcommunity-list standard WORD",
718e3744 16705 NO_STR
16706 IP_STR
16707 EXTCOMMUNITY_LIST_STR
16708 "Specify standard extcommunity-list\n"
fee6e4e4 16709 "Extended Community list name\n")
16710{
813d4307 16711 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
fee6e4e4 16712}
16713
16714DEFUN (no_ip_extcommunity_list_name_expanded_all,
16715 no_ip_extcommunity_list_name_expanded_all_cmd,
16716 "no ip extcommunity-list expanded WORD",
16717 NO_STR
16718 IP_STR
16719 EXTCOMMUNITY_LIST_STR
718e3744 16720 "Specify expanded extcommunity-list\n"
16721 "Extended Community list name\n")
16722{
813d4307 16723 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
718e3744 16724}
16725
16726DEFUN (no_ip_extcommunity_list_standard,
16727 no_ip_extcommunity_list_standard_cmd,
16728 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
16729 NO_STR
16730 IP_STR
16731 EXTCOMMUNITY_LIST_STR
16732 "Extended Community list number (standard)\n"
16733 "Specify community to reject\n"
16734 "Specify community to accept\n"
16735 EXTCOMMUNITY_VAL_STR)
16736{
813d4307 16737 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
718e3744 16738}
16739
16740DEFUN (no_ip_extcommunity_list_expanded,
16741 no_ip_extcommunity_list_expanded_cmd,
fee6e4e4 16742 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
718e3744 16743 NO_STR
16744 IP_STR
16745 EXTCOMMUNITY_LIST_STR
16746 "Extended Community list number (expanded)\n"
16747 "Specify community to reject\n"
16748 "Specify community to accept\n"
16749 "An ordered list as a regular-expression\n")
16750{
813d4307 16751 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
718e3744 16752}
16753
16754DEFUN (no_ip_extcommunity_list_name_standard,
16755 no_ip_extcommunity_list_name_standard_cmd,
16756 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
16757 NO_STR
16758 IP_STR
16759 EXTCOMMUNITY_LIST_STR
16760 "Specify standard extcommunity-list\n"
16761 "Extended Community list name\n"
16762 "Specify community to reject\n"
16763 "Specify community to accept\n"
16764 EXTCOMMUNITY_VAL_STR)
16765{
813d4307
DW
16766 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
16767}
16768
16769DEFUN (no_ip_extcommunity_list_name_standard_brief,
16770 no_ip_extcommunity_list_name_standard_brief_cmd,
16771 "no ip extcommunity-list standard WORD (deny|permit)",
16772 NO_STR
16773 IP_STR
16774 EXTCOMMUNITY_LIST_STR
16775 "Specify standard extcommunity-list\n"
16776 "Extended Community list name\n"
16777 "Specify community to reject\n"
16778 "Specify community to accept\n")
16779{
16780 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
718e3744 16781}
16782
16783DEFUN (no_ip_extcommunity_list_name_expanded,
16784 no_ip_extcommunity_list_name_expanded_cmd,
16785 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
16786 NO_STR
16787 IP_STR
16788 EXTCOMMUNITY_LIST_STR
16789 "Specify expanded extcommunity-list\n"
16790 "Community list name\n"
16791 "Specify community to reject\n"
16792 "Specify community to accept\n"
16793 "An ordered list as a regular-expression\n")
16794{
813d4307 16795 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
718e3744 16796}
16797
94f2b392 16798static void
718e3744 16799extcommunity_list_show (struct vty *vty, struct community_list *list)
16800{
16801 struct community_entry *entry;
16802
16803 for (entry = list->head; entry; entry = entry->next)
16804 {
16805 if (entry == list->head)
16806 {
16807 if (all_digit (list->name))
16808 vty_out (vty, "Extended community %s list %s%s",
16809 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
16810 "standard" : "(expanded) access",
16811 list->name, VTY_NEWLINE);
16812 else
16813 vty_out (vty, "Named extended community %s list %s%s",
16814 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
16815 "standard" : "expanded",
16816 list->name, VTY_NEWLINE);
16817 }
16818 if (entry->any)
16819 vty_out (vty, " %s%s",
16820 community_direct_str (entry->direct), VTY_NEWLINE);
16821 else
16822 vty_out (vty, " %s %s%s",
16823 community_direct_str (entry->direct),
16824 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
16825 entry->u.ecom->str : entry->config,
16826 VTY_NEWLINE);
16827 }
16828}
16829
16830DEFUN (show_ip_extcommunity_list,
16831 show_ip_extcommunity_list_cmd,
16832 "show ip extcommunity-list",
16833 SHOW_STR
16834 IP_STR
16835 "List extended-community list\n")
16836{
16837 struct community_list *list;
16838 struct community_list_master *cm;
16839
fee6e4e4 16840 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
718e3744 16841 if (! cm)
16842 return CMD_SUCCESS;
16843
16844 for (list = cm->num.head; list; list = list->next)
16845 extcommunity_list_show (vty, list);
16846
16847 for (list = cm->str.head; list; list = list->next)
16848 extcommunity_list_show (vty, list);
16849
16850 return CMD_SUCCESS;
16851}
16852
16853DEFUN (show_ip_extcommunity_list_arg,
16854 show_ip_extcommunity_list_arg_cmd,
fee6e4e4 16855 "show ip extcommunity-list (<1-500>|WORD)",
718e3744 16856 SHOW_STR
16857 IP_STR
16858 "List extended-community list\n"
16859 "Extcommunity-list number\n"
16860 "Extcommunity-list name\n")
16861{
16862 struct community_list *list;
16863
fee6e4e4 16864 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
718e3744 16865 if (! list)
16866 {
b729294c 16867 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
718e3744 16868 return CMD_WARNING;
16869 }
16870
16871 extcommunity_list_show (vty, list);
16872
16873 return CMD_SUCCESS;
16874}
6b0655a2 16875
718e3744 16876/* Return configuration string of community-list entry. */
fd79ac91 16877static const char *
718e3744 16878community_list_config_str (struct community_entry *entry)
16879{
fd79ac91 16880 const char *str;
718e3744 16881
16882 if (entry->any)
16883 str = "";
16884 else
16885 {
16886 if (entry->style == COMMUNITY_LIST_STANDARD)
16887 str = community_str (entry->u.com);
16888 else
16889 str = entry->config;
16890 }
16891 return str;
16892}
16893
16894/* Display community-list and extcommunity-list configuration. */
94f2b392 16895static int
718e3744 16896community_list_config_write (struct vty *vty)
16897{
16898 struct community_list *list;
16899 struct community_entry *entry;
16900 struct community_list_master *cm;
16901 int write = 0;
16902
16903 /* Community-list. */
fee6e4e4 16904 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
718e3744 16905
16906 for (list = cm->num.head; list; list = list->next)
16907 for (entry = list->head; entry; entry = entry->next)
16908 {
fee6e4e4 16909 vty_out (vty, "ip community-list %s %s %s%s",
16910 list->name, community_direct_str (entry->direct),
16911 community_list_config_str (entry),
16912 VTY_NEWLINE);
718e3744 16913 write++;
16914 }
16915 for (list = cm->str.head; list; list = list->next)
16916 for (entry = list->head; entry; entry = entry->next)
16917 {
16918 vty_out (vty, "ip community-list %s %s %s %s%s",
16919 entry->style == COMMUNITY_LIST_STANDARD
16920 ? "standard" : "expanded",
16921 list->name, community_direct_str (entry->direct),
16922 community_list_config_str (entry),
16923 VTY_NEWLINE);
16924 write++;
16925 }
16926
16927 /* Extcommunity-list. */
fee6e4e4 16928 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
718e3744 16929
16930 for (list = cm->num.head; list; list = list->next)
16931 for (entry = list->head; entry; entry = entry->next)
16932 {
fee6e4e4 16933 vty_out (vty, "ip extcommunity-list %s %s %s%s",
16934 list->name, community_direct_str (entry->direct),
16935 community_list_config_str (entry), VTY_NEWLINE);
718e3744 16936 write++;
16937 }
16938 for (list = cm->str.head; list; list = list->next)
16939 for (entry = list->head; entry; entry = entry->next)
16940 {
16941 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
16942 entry->style == EXTCOMMUNITY_LIST_STANDARD
16943 ? "standard" : "expanded",
16944 list->name, community_direct_str (entry->direct),
16945 community_list_config_str (entry), VTY_NEWLINE);
16946 write++;
16947 }
16948 return write;
16949}
16950
7fc626de 16951static struct cmd_node community_list_node =
718e3744 16952{
16953 COMMUNITY_LIST_NODE,
16954 "",
16955 1 /* Export to vtysh. */
16956};
16957
94f2b392 16958static void
16959community_list_vty (void)
718e3744 16960{
16961 install_node (&community_list_node, community_list_config_write);
16962
16963 /* Community-list. */
718e3744 16964 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
16965 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
16966 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
16967 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
16968 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
16969 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
fee6e4e4 16970 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
813d4307 16971 install_element (CONFIG_NODE, &no_ip_community_list_standard_direction_cmd);
fee6e4e4 16972 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
16973 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
16974 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
718e3744 16975 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
16976 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
16977 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
813d4307 16978 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_brief_cmd);
718e3744 16979 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
16980 install_element (VIEW_NODE, &show_ip_community_list_cmd);
16981 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
16982 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
16983 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
16984
16985 /* Extcommunity-list. */
16986 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
16987 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
16988 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
16989 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
16990 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
16991 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
fee6e4e4 16992 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
813d4307 16993 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_direction_cmd);
fee6e4e4 16994 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
16995 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
16996 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
718e3744 16997 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
16998 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
16999 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
813d4307 17000 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_brief_cmd);
718e3744 17001 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
17002 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
17003 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
17004 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
17005 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
17006}