]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_vty.c
lib: add new extensible memory-type handling
[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"
039f3a34 35#include "filter.h"
718e3744 36
37#include "bgpd/bgpd.h"
4bf6a362 38#include "bgpd/bgp_advertise.h"
718e3744 39#include "bgpd/bgp_attr.h"
40#include "bgpd/bgp_aspath.h"
41#include "bgpd/bgp_community.h"
4bf6a362
PJ
42#include "bgpd/bgp_ecommunity.h"
43#include "bgpd/bgp_damp.h"
718e3744 44#include "bgpd/bgp_debug.h"
e0701b79 45#include "bgpd/bgp_fsm.h"
718e3744 46#include "bgpd/bgp_mplsvpn.h"
4bf6a362 47#include "bgpd/bgp_nexthop.h"
718e3744 48#include "bgpd/bgp_open.h"
4bf6a362 49#include "bgpd/bgp_regex.h"
718e3744 50#include "bgpd/bgp_route.h"
51#include "bgpd/bgp_zebra.h"
fee0f4c6 52#include "bgpd/bgp_table.h"
94f2b392 53#include "bgpd/bgp_vty.h"
165b5fff 54#include "bgpd/bgp_mpath.h"
cb1faec9 55#include "bgpd/bgp_packet.h"
3f9c7369 56#include "bgpd/bgp_updgrp.h"
c43ed2e4 57#include "bgpd/bgp_bfd.h"
718e3744 58
20eb8864 59static struct peer_group *
60listen_range_exists (struct bgp *bgp, struct prefix *range, int exact);
61
718e3744 62/* Utility function to get address family from current node. */
63afi_t
64bgp_node_afi (struct vty *vty)
65{
4e851f1f
LB
66 afi_t afi;
67 switch (vty->node)
68 {
69 case BGP_IPV6_NODE:
70 case BGP_IPV6M_NODE:
71 case BGP_VPNV6_NODE:
72 case BGP_ENCAPV6_NODE:
73 afi = AFI_IP6;
74 break;
75 default:
76 afi = AFI_IP;
77 break;
78 }
79 return afi;
718e3744 80}
81
82/* Utility function to get subsequent address family from current
83 node. */
84safi_t
85bgp_node_safi (struct vty *vty)
86{
4e851f1f
LB
87 safi_t safi;
88 switch (vty->node)
89 {
90 case BGP_ENCAP_NODE:
91 case BGP_ENCAPV6_NODE:
92 safi = SAFI_ENCAP;
93 break;
94 case BGP_VPNV4_NODE:
95 case BGP_VPNV6_NODE:
96 safi = SAFI_MPLS_VPN;
97 break;
98 case BGP_IPV4M_NODE:
99 case BGP_IPV6M_NODE:
100 safi = SAFI_MULTICAST;
101 break;
102 default:
103 safi = SAFI_UNICAST;
104 break;
105 }
106 return safi;
718e3744 107}
108
8b1fb8be
LB
109int
110bgp_parse_afi(const char *str, afi_t *afi)
111{
112 if (!strcmp(str, "ipv4")) {
113 *afi = AFI_IP;
114 return 0;
115 }
116#ifdef HAVE_IPV6
117 if (!strcmp(str, "ipv6")) {
118 *afi = AFI_IP6;
119 return 0;
120 }
121#endif /* HAVE_IPV6 */
122 return -1;
123}
124
125int
126bgp_parse_safi(const char *str, safi_t *safi)
127{
128 if (!strcmp(str, "encap")) {
129 *safi = SAFI_ENCAP;
130 return 0;
131 }
132 if (!strcmp(str, "multicast")) {
133 *safi = SAFI_MULTICAST;
134 return 0;
135 }
136 if (!strcmp(str, "unicast")) {
137 *safi = SAFI_UNICAST;
138 return 0;
139 }
140 if (!strcmp(str, "vpn")) {
141 *safi = SAFI_MPLS_VPN;
142 return 0;
143 }
144 return -1;
145}
146
94f2b392 147static int
6aeb9e78 148peer_address_self_check (struct bgp *bgp, union sockunion *su)
718e3744 149{
150 struct interface *ifp = NULL;
151
152 if (su->sa.sa_family == AF_INET)
6aeb9e78 153 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr, bgp->vrf_id);
718e3744 154#ifdef HAVE_IPV6
155 else if (su->sa.sa_family == AF_INET6)
f2345335 156 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr,
6aeb9e78 157 su->sin6.sin6_scope_id, bgp->vrf_id);
718e3744 158#endif /* HAVE IPV6 */
159
160 if (ifp)
161 return 1;
162
163 return 0;
164}
165
166/* Utility function for looking up peer from VTY. */
f14e6fdb
DS
167/* This is used only for configuration, so disallow if attempted on
168 * a dynamic neighbor.
169 */
94f2b392 170static struct peer *
fd79ac91 171peer_lookup_vty (struct vty *vty, const char *ip_str)
718e3744 172{
173 int ret;
174 struct bgp *bgp;
175 union sockunion su;
176 struct peer *peer;
177
178 bgp = vty->index;
179
180 ret = str2sockunion (ip_str, &su);
181 if (ret < 0)
182 {
a80beece
DS
183 peer = peer_lookup_by_conf_if (bgp, ip_str);
184 if (!peer)
185 {
04b6bdc0
DW
186 if ((peer = peer_lookup_by_hostname(bgp, ip_str)) == NULL)
187 {
188 vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE);
189 return NULL;
190 }
a80beece 191 }
718e3744 192 }
a80beece 193 else
718e3744 194 {
a80beece
DS
195 peer = peer_lookup (bgp, &su);
196 if (! peer)
197 {
198 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
199 VTY_NEWLINE);
200 return NULL;
201 }
f14e6fdb
DS
202 if (peer_dynamic_neighbor (peer))
203 {
204 vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
205 VTY_NEWLINE);
206 return NULL;
207 }
208
718e3744 209 }
210 return peer;
211}
212
213/* Utility function for looking up peer or peer group. */
f14e6fdb
DS
214/* This is used only for configuration, so disallow if attempted on
215 * a dynamic neighbor.
216 */
c43ed2e4 217struct peer *
fd79ac91 218peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
718e3744 219{
220 int ret;
221 struct bgp *bgp;
222 union sockunion su;
f14e6fdb
DS
223 struct peer *peer = NULL;
224 struct peer_group *group = NULL;
718e3744 225
226 bgp = vty->index;
227
228 ret = str2sockunion (peer_str, &su);
229 if (ret == 0)
230 {
f14e6fdb 231 /* IP address, locate peer. */
718e3744 232 peer = peer_lookup (bgp, &su);
718e3744 233 }
234 else
235 {
f14e6fdb 236 /* Not IP, could match either peer configured on interface or a group. */
a80beece 237 peer = peer_lookup_by_conf_if (bgp, peer_str);
f14e6fdb
DS
238 if (!peer)
239 group = peer_group_lookup (bgp, peer_str);
240 }
a80beece 241
f14e6fdb
DS
242 if (peer)
243 {
244 if (peer_dynamic_neighbor (peer))
245 {
246 vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
247 VTY_NEWLINE);
248 return NULL;
249 }
250
251 return peer;
718e3744 252 }
253
f14e6fdb
DS
254 if (group)
255 return group->conf;
256
718e3744 257 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
258 VTY_NEWLINE);
259
260 return NULL;
261}
262
c43ed2e4 263int
718e3744 264bgp_vty_return (struct vty *vty, int ret)
265{
fd79ac91 266 const char *str = NULL;
718e3744 267
268 switch (ret)
269 {
270 case BGP_ERR_INVALID_VALUE:
271 str = "Invalid value";
272 break;
273 case BGP_ERR_INVALID_FLAG:
274 str = "Invalid flag";
275 break;
718e3744 276 case BGP_ERR_PEER_GROUP_SHUTDOWN:
277 str = "Peer-group has been shutdown. Activate the peer-group first";
278 break;
718e3744 279 case BGP_ERR_PEER_FLAG_CONFLICT:
280 str = "Can't set override-capability and strict-capability-match at the same time";
281 break;
718e3744 282 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
283 str = "Specify remote-as or peer-group remote AS first";
284 break;
285 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
286 str = "Cannot change the peer-group. Deconfigure first";
287 break;
288 case BGP_ERR_PEER_GROUP_MISMATCH:
4c48cf63 289 str = "Peer is not a member of this peer-group";
718e3744 290 break;
291 case BGP_ERR_PEER_FILTER_CONFLICT:
292 str = "Prefix/distribute list can not co-exist";
293 break;
294 case BGP_ERR_NOT_INTERNAL_PEER:
295 str = "Invalid command. Not an internal neighbor";
296 break;
297 case BGP_ERR_REMOVE_PRIVATE_AS:
5000f21c 298 str = "remove-private-AS cannot be configured for IBGP peers";
718e3744 299 break;
300 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
301 str = "Local-AS allowed only for EBGP peers";
302 break;
303 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
304 str = "Cannot have local-as same as BGP AS number";
305 break;
0df7c91f
PJ
306 case BGP_ERR_TCPSIG_FAILED:
307 str = "Error while applying TCP-Sig to session(s)";
308 break;
fa411a21
NH
309 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
310 str = "ebgp-multihop and ttl-security cannot be configured together";
311 break;
f5a4827d
SH
312 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
313 str = "ttl-security only allowed for EBGP peers";
314 break;
c7122e14
DS
315 case BGP_ERR_AS_OVERRIDE:
316 str = "as-override cannot be configured for IBGP peers";
317 break;
f14e6fdb
DS
318 case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT:
319 str = "Invalid limit for number of dynamic neighbors";
320 break;
321 case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS:
322 str = "Dynamic neighbor listen range already exists";
323 break;
324 case BGP_ERR_INVALID_FOR_DYNAMIC_PEER:
325 str = "Operation not allowed on a dynamic neighbor";
326 break;
63fa10b5
QY
327 case BGP_ERR_INVALID_FOR_DIRECT_PEER:
328 str = "Operation not allowed on a directly connected neighbor";
329 break;
718e3744 330 }
331 if (str)
332 {
333 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
334 return CMD_WARNING;
335 }
336 return CMD_SUCCESS;
337}
338
7aafcaca
DS
339/* BGP clear sort. */
340enum clear_sort
341{
342 clear_all,
343 clear_peer,
344 clear_group,
345 clear_external,
346 clear_as
347};
348
7aafcaca
DS
349static void
350bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
351 safi_t safi, int error)
352{
353 switch (error)
354 {
355 case BGP_ERR_AF_UNCONFIGURED:
356 vty_out (vty,
357 "%%BGP: Enable %s %s address family for the neighbor %s%s",
358 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
359 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
360 peer->host, VTY_NEWLINE);
361 break;
362 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
363 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);
364 break;
365 default:
366 break;
367 }
368}
369
370/* `clear ip bgp' functions. */
371static int
372bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
373 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
374{
375 int ret;
376 struct peer *peer;
377 struct listnode *node, *nnode;
378
379 /* Clear all neighbors. */
380 /*
381 * Pass along pointer to next node to peer_clear() when walking all nodes
382 * on the BGP instance as that may get freed if it is a doppelganger
383 */
384 if (sort == clear_all)
385 {
386 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
387 {
388 if (stype == BGP_CLEAR_SOFT_NONE)
389 ret = peer_clear (peer, &nnode);
390 else if (peer->afc[afi][safi])
391 ret = peer_clear_soft (peer, afi, safi, stype);
392 else
393 ret = 0;
394
395 if (ret < 0)
396 bgp_clear_vty_error (vty, peer, afi, safi, ret);
397 }
398
399 /* This is to apply read-only mode on this clear. */
400 if (stype == BGP_CLEAR_SOFT_NONE)
401 bgp->update_delay_over = 0;
402
403 return CMD_SUCCESS;
404 }
405
406 /* Clear specified neighbors. */
407 if (sort == clear_peer)
408 {
409 union sockunion su;
410 int ret;
411
412 /* Make sockunion for lookup. */
413 ret = str2sockunion (arg, &su);
414 if (ret < 0)
415 {
416 peer = peer_lookup_by_conf_if (bgp, arg);
417 if (!peer)
418 {
04b6bdc0
DW
419 peer = peer_lookup_by_hostname(bgp, arg);
420 if (!peer)
421 {
422 vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE);
423 return CMD_WARNING;
424 }
7aafcaca
DS
425 }
426 }
427 else
428 {
429 peer = peer_lookup (bgp, &su);
430 if (! peer)
431 {
432 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
433 return CMD_WARNING;
434 }
435 }
436
437 if (stype == BGP_CLEAR_SOFT_NONE)
438 ret = peer_clear (peer, NULL);
439 else
440 ret = peer_clear_soft (peer, afi, safi, stype);
441
442 if (ret < 0)
443 bgp_clear_vty_error (vty, peer, afi, safi, ret);
444
445 return CMD_SUCCESS;
446 }
447
448 /* Clear all peer-group members. */
449 if (sort == clear_group)
450 {
451 struct peer_group *group;
452
453 group = peer_group_lookup (bgp, arg);
454 if (! group)
455 {
456 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
457 return CMD_WARNING;
458 }
459
460 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
461 {
462 if (stype == BGP_CLEAR_SOFT_NONE)
463 {
18f1dc06 464 peer_clear (peer, NULL);
7aafcaca
DS
465 continue;
466 }
467
c8560b44 468 if (! peer->afc[afi][safi])
7aafcaca
DS
469 continue;
470
471 ret = peer_clear_soft (peer, afi, safi, stype);
472
473 if (ret < 0)
474 bgp_clear_vty_error (vty, peer, afi, safi, ret);
475 }
476 return CMD_SUCCESS;
477 }
478
479 if (sort == clear_external)
480 {
481 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
482 {
483 if (peer->sort == BGP_PEER_IBGP)
484 continue;
485
486 if (stype == BGP_CLEAR_SOFT_NONE)
487 ret = peer_clear (peer, &nnode);
488 else
489 ret = peer_clear_soft (peer, afi, safi, stype);
490
491 if (ret < 0)
492 bgp_clear_vty_error (vty, peer, afi, safi, ret);
493 }
494 return CMD_SUCCESS;
495 }
496
497 if (sort == clear_as)
498 {
499 as_t as;
500 int find = 0;
501
502 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
503
504 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
505 {
506 if (peer->as != as)
507 continue;
508
509 find = 1;
510 if (stype == BGP_CLEAR_SOFT_NONE)
511 ret = peer_clear (peer, &nnode);
512 else
513 ret = peer_clear_soft (peer, afi, safi, stype);
514
515 if (ret < 0)
516 bgp_clear_vty_error (vty, peer, afi, safi, ret);
517 }
518 if (! find)
519 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
520 VTY_NEWLINE);
521 return CMD_SUCCESS;
522 }
523
524 return CMD_SUCCESS;
525}
526
527static int
528bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
529 enum clear_sort sort, enum bgp_clear_type stype,
530 const char *arg)
531{
532 struct bgp *bgp;
533
534 /* BGP structure lookup. */
535 if (name)
536 {
537 bgp = bgp_lookup_by_name (name);
538 if (bgp == NULL)
539 {
6aeb9e78 540 vty_out (vty, "Can't find BGP instance %s%s", name, VTY_NEWLINE);
7aafcaca
DS
541 return CMD_WARNING;
542 }
543 }
544 else
545 {
f31fa004 546 bgp = bgp_get_default ();
7aafcaca
DS
547 if (bgp == NULL)
548 {
549 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
550 return CMD_WARNING;
551 }
552 }
553
554 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
555}
556
557/* clear soft inbound */
558static void
f31fa004 559bgp_clear_star_soft_in (struct vty *vty, const char *name)
7aafcaca 560{
f31fa004 561 bgp_clear_vty (vty,name, AFI_IP, SAFI_UNICAST, clear_all,
7aafcaca 562 BGP_CLEAR_SOFT_IN, NULL);
f31fa004 563 bgp_clear_vty (vty, name, AFI_IP6, SAFI_UNICAST, clear_all,
7aafcaca 564 BGP_CLEAR_SOFT_IN, NULL);
7aafcaca
DS
565}
566
567/* clear soft outbound */
568static void
f31fa004 569bgp_clear_star_soft_out (struct vty *vty, const char *name)
7aafcaca 570{
f31fa004 571 bgp_clear_vty (vty, name, AFI_IP, SAFI_UNICAST, clear_all,
7aafcaca 572 BGP_CLEAR_SOFT_OUT, NULL);
f31fa004 573 bgp_clear_vty (vty, name, AFI_IP6, SAFI_UNICAST, clear_all,
7aafcaca 574 BGP_CLEAR_SOFT_OUT, NULL);
7aafcaca
DS
575}
576
577
718e3744 578/* BGP global configuration. */
579
580DEFUN (bgp_multiple_instance_func,
581 bgp_multiple_instance_cmd,
582 "bgp multiple-instance",
583 BGP_STR
584 "Enable bgp multiple instance\n")
585{
586 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
587 return CMD_SUCCESS;
588}
589
590DEFUN (no_bgp_multiple_instance,
591 no_bgp_multiple_instance_cmd,
592 "no bgp multiple-instance",
593 NO_STR
594 BGP_STR
595 "BGP multiple instance\n")
596{
597 int ret;
598
599 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
600 if (ret < 0)
601 {
602 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
603 return CMD_WARNING;
604 }
605 return CMD_SUCCESS;
606}
607
608DEFUN (bgp_config_type,
609 bgp_config_type_cmd,
610 "bgp config-type (cisco|zebra)",
611 BGP_STR
612 "Configuration type\n"
613 "cisco\n"
614 "zebra\n")
615{
616 if (strncmp (argv[0], "c", 1) == 0)
617 bgp_option_set (BGP_OPT_CONFIG_CISCO);
618 else
619 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
620
621 return CMD_SUCCESS;
622}
623
624DEFUN (no_bgp_config_type,
625 no_bgp_config_type_cmd,
626 "no bgp config-type",
627 NO_STR
628 BGP_STR
629 "Display configuration type\n")
630{
631 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
632 return CMD_SUCCESS;
633}
634
813d4307
DW
635ALIAS (no_bgp_config_type,
636 no_bgp_config_type_val_cmd,
637 "no bgp config-type (cisco|zebra)",
638 NO_STR
639 BGP_STR
640 "Configuration type\n"
641 "cisco\n"
642 "zebra\n")
643
718e3744 644DEFUN (no_synchronization,
645 no_synchronization_cmd,
646 "no synchronization",
647 NO_STR
648 "Perform IGP synchronization\n")
649{
650 return CMD_SUCCESS;
651}
652
653DEFUN (no_auto_summary,
654 no_auto_summary_cmd,
655 "no auto-summary",
656 NO_STR
657 "Enable automatic network number summarization\n")
658{
659 return CMD_SUCCESS;
660}
3d515fd9 661
718e3744 662/* "router bgp" commands. */
663DEFUN (router_bgp,
664 router_bgp_cmd,
320da874 665 "router bgp " CMD_AS_RANGE,
718e3744 666 ROUTER_STR
667 BGP_STR
668 AS_STR)
669{
670 int ret;
671 as_t as;
672 struct bgp *bgp;
fd79ac91 673 const char *name = NULL;
ad4cbda1 674 enum bgp_instance_type inst_type;
718e3744 675
2385a876
DW
676 // "router bgp" without an ASN
677 if (argc < 1)
678 {
6aeb9e78 679 //Pending: Make VRF option available for ASN less config
2385a876 680 bgp = bgp_get_default();
718e3744 681
2385a876
DW
682 if (bgp == NULL)
683 {
684 vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE);
685 return CMD_WARNING;
686 }
718e3744 687
2385a876
DW
688 if (listcount(bm->bgp) > 1)
689 {
690 vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE);
691 return CMD_WARNING;
692 }
693 }
694
695 // "router bgp X"
696 else
718e3744 697 {
2385a876
DW
698 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
699
ad4cbda1 700 inst_type = BGP_INSTANCE_TYPE_DEFAULT;
6aeb9e78 701 if (argc == 3)
ad4cbda1 702 {
703 name = argv[2];
704 if (!strcmp(argv[1], "vrf"))
705 inst_type = BGP_INSTANCE_TYPE_VRF;
706 else if (!strcmp(argv[1], "view"))
707 inst_type = BGP_INSTANCE_TYPE_VIEW;
708 }
2385a876 709
ad4cbda1 710 ret = bgp_get (&bgp, &as, name, inst_type);
2385a876
DW
711 switch (ret)
712 {
713 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
714 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
715 VTY_NEWLINE);
716 return CMD_WARNING;
717 case BGP_ERR_AS_MISMATCH:
718 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
719 return CMD_WARNING;
720 case BGP_ERR_INSTANCE_MISMATCH:
6aeb9e78 721 vty_out (vty, "BGP instance name and AS number mismatch%s", VTY_NEWLINE);
2385a876
DW
722 vty_out (vty, "BGP instance is already running; AS is %u%s",
723 as, VTY_NEWLINE);
724 return CMD_WARNING;
725 }
6aeb9e78
DS
726
727 /* Pending: handle when user tries to change a view to vrf n vv. */
718e3744 728 }
729
730 vty->node = BGP_NODE;
731 vty->index = bgp;
732
733 return CMD_SUCCESS;
734}
735
736ALIAS (router_bgp,
6aeb9e78
DS
737 router_bgp_instance_cmd,
738 "router bgp " CMD_AS_RANGE " (view|vrf) WORD",
718e3744 739 ROUTER_STR
740 BGP_STR
741 AS_STR
6aeb9e78 742 "BGP view\nBGP VRF\n"
8386ac43 743 "View/VRF name\n")
6b0655a2 744
2385a876
DW
745ALIAS (router_bgp,
746 router_bgp_noasn_cmd,
747 "router bgp",
748 ROUTER_STR
749 BGP_STR)
750
718e3744 751/* "no router bgp" commands. */
752DEFUN (no_router_bgp,
753 no_router_bgp_cmd,
320da874 754 "no router bgp " CMD_AS_RANGE,
718e3744 755 NO_STR
756 ROUTER_STR
757 BGP_STR
758 AS_STR)
759{
760 as_t as;
761 struct bgp *bgp;
fd79ac91 762 const char *name = NULL;
718e3744 763
718e3744 764
7fb21a9f
QY
765 // "no router bgp" without an ASN
766 if (argc < 1)
767 {
768 //Pending: Make VRF option available for ASN less config
769 bgp = bgp_get_default();
718e3744 770
7fb21a9f
QY
771 if (bgp == NULL)
772 {
773 vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE);
774 return CMD_WARNING;
775 }
776
777 if (listcount(bm->bgp) > 1)
778 {
779 vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE);
780 return CMD_WARNING;
781 }
782 }
783 else
718e3744 784 {
7fb21a9f
QY
785 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
786
787 if (argc == 3)
788 name = argv[2];
789
790 /* Lookup bgp structure. */
791 bgp = bgp_lookup (as, name);
792 if (! bgp)
793 {
794 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
795 return CMD_WARNING;
796 }
718e3744 797 }
798
799 bgp_delete (bgp);
800
801 return CMD_SUCCESS;
802}
803
804ALIAS (no_router_bgp,
6aeb9e78
DS
805 no_router_bgp_instance_cmd,
806 "no router bgp " CMD_AS_RANGE " (view|vrf) WORD",
718e3744 807 NO_STR
808 ROUTER_STR
809 BGP_STR
810 AS_STR
6aeb9e78 811 "BGP view\nBGP VRF\n"
8386ac43 812 "View/VRF name\n")
6b0655a2 813
7fb21a9f
QY
814ALIAS (no_router_bgp,
815 no_router_bgp_noasn_cmd,
816 "no router bgp",
817 NO_STR
818 ROUTER_STR
819 BGP_STR)
820
718e3744 821/* BGP router-id. */
822
823DEFUN (bgp_router_id,
824 bgp_router_id_cmd,
825 "bgp router-id A.B.C.D",
826 BGP_STR
827 "Override configured router identifier\n"
828 "Manually configured router identifier\n")
829{
830 int ret;
831 struct in_addr id;
832 struct bgp *bgp;
833
834 bgp = vty->index;
835
836 ret = inet_aton (argv[0], &id);
837 if (! ret)
838 {
839 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
840 return CMD_WARNING;
841 }
842
0e6cb743 843 bgp_router_id_static_set (bgp, id);
718e3744 844
845 return CMD_SUCCESS;
846}
847
848DEFUN (no_bgp_router_id,
849 no_bgp_router_id_cmd,
850 "no bgp router-id",
851 NO_STR
852 BGP_STR
853 "Override configured router identifier\n")
854{
855 int ret;
856 struct in_addr id;
857 struct bgp *bgp;
858
859 bgp = vty->index;
860
861 if (argc == 1)
862 {
863 ret = inet_aton (argv[0], &id);
864 if (! ret)
e018c7cc
SK
865 {
866 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
867 return CMD_WARNING;
868 }
718e3744 869
18a6dce6 870 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
e018c7cc
SK
871 {
872 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
873 return CMD_WARNING;
874 }
718e3744 875 }
876
0e6cb743
DL
877 id.s_addr = 0;
878 bgp_router_id_static_set (bgp, id);
718e3744 879
880 return CMD_SUCCESS;
881}
882
883ALIAS (no_bgp_router_id,
884 no_bgp_router_id_val_cmd,
885 "no bgp router-id A.B.C.D",
886 NO_STR
887 BGP_STR
888 "Override configured router identifier\n"
889 "Manually configured router identifier\n")
6b0655a2 890
718e3744 891/* BGP Cluster ID. */
892
893DEFUN (bgp_cluster_id,
894 bgp_cluster_id_cmd,
895 "bgp cluster-id A.B.C.D",
896 BGP_STR
897 "Configure Route-Reflector Cluster-id\n"
898 "Route-Reflector Cluster-id in IP address format\n")
899{
900 int ret;
901 struct bgp *bgp;
902 struct in_addr cluster;
903
904 bgp = vty->index;
905
906 ret = inet_aton (argv[0], &cluster);
907 if (! ret)
908 {
909 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
910 return CMD_WARNING;
911 }
912
913 bgp_cluster_id_set (bgp, &cluster);
f31fa004 914 bgp_clear_star_soft_out (vty, bgp->name);
718e3744 915
916 return CMD_SUCCESS;
917}
918
919ALIAS (bgp_cluster_id,
920 bgp_cluster_id32_cmd,
921 "bgp cluster-id <1-4294967295>",
922 BGP_STR
923 "Configure Route-Reflector Cluster-id\n"
924 "Route-Reflector Cluster-id as 32 bit quantity\n")
925
926DEFUN (no_bgp_cluster_id,
927 no_bgp_cluster_id_cmd,
928 "no bgp cluster-id",
929 NO_STR
930 BGP_STR
931 "Configure Route-Reflector Cluster-id\n")
932{
933 int ret;
934 struct bgp *bgp;
935 struct in_addr cluster;
936
937 bgp = vty->index;
938
939 if (argc == 1)
940 {
941 ret = inet_aton (argv[0], &cluster);
942 if (! ret)
943 {
944 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
945 return CMD_WARNING;
946 }
947 }
948
949 bgp_cluster_id_unset (bgp);
f31fa004 950 bgp_clear_star_soft_out (vty, bgp->name);
718e3744 951
952 return CMD_SUCCESS;
953}
954
955ALIAS (no_bgp_cluster_id,
813d4307 956 no_bgp_cluster_id_ip_cmd,
718e3744 957 "no bgp cluster-id A.B.C.D",
958 NO_STR
959 BGP_STR
960 "Configure Route-Reflector Cluster-id\n"
961 "Route-Reflector Cluster-id in IP address format\n")
6b0655a2 962
813d4307
DW
963ALIAS (no_bgp_cluster_id,
964 no_bgp_cluster_id_decimal_cmd,
965 "no bgp cluster-id <1-4294967295>",
966 NO_STR
967 BGP_STR
968 "Configure Route-Reflector Cluster-id\n"
969 "Route-Reflector Cluster-id as 32 bit quantity\n")
970
718e3744 971DEFUN (bgp_confederation_identifier,
972 bgp_confederation_identifier_cmd,
320da874 973 "bgp confederation identifier " CMD_AS_RANGE,
718e3744 974 "BGP specific commands\n"
975 "AS confederation parameters\n"
976 "AS number\n"
977 "Set routing domain confederation AS\n")
978{
979 struct bgp *bgp;
980 as_t as;
981
982 bgp = vty->index;
983
0b2aa3a0 984 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
718e3744 985
986 bgp_confederation_id_set (bgp, as);
987
988 return CMD_SUCCESS;
989}
990
991DEFUN (no_bgp_confederation_identifier,
992 no_bgp_confederation_identifier_cmd,
993 "no bgp confederation identifier",
994 NO_STR
995 "BGP specific commands\n"
996 "AS confederation parameters\n"
997 "AS number\n")
998{
999 struct bgp *bgp;
718e3744 1000
1001 bgp = vty->index;
1002
718e3744 1003 bgp_confederation_id_unset (bgp);
1004
1005 return CMD_SUCCESS;
1006}
1007
1008ALIAS (no_bgp_confederation_identifier,
1009 no_bgp_confederation_identifier_arg_cmd,
320da874 1010 "no bgp confederation identifier " CMD_AS_RANGE,
718e3744 1011 NO_STR
1012 "BGP specific commands\n"
1013 "AS confederation parameters\n"
1014 "AS number\n"
1015 "Set routing domain confederation AS\n")
6b0655a2 1016
718e3744 1017DEFUN (bgp_confederation_peers,
1018 bgp_confederation_peers_cmd,
320da874 1019 "bgp confederation peers ." CMD_AS_RANGE,
718e3744 1020 "BGP specific commands\n"
1021 "AS confederation parameters\n"
1022 "Peer ASs in BGP confederation\n"
1023 AS_STR)
1024{
1025 struct bgp *bgp;
1026 as_t as;
1027 int i;
1028
1029 bgp = vty->index;
1030
1031 for (i = 0; i < argc; i++)
1032 {
0b2aa3a0 1033 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
718e3744 1034
1035 if (bgp->as == as)
1036 {
1037 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
1038 VTY_NEWLINE);
1039 continue;
1040 }
1041
1042 bgp_confederation_peers_add (bgp, as);
1043 }
1044 return CMD_SUCCESS;
1045}
1046
1047DEFUN (no_bgp_confederation_peers,
1048 no_bgp_confederation_peers_cmd,
320da874 1049 "no bgp confederation peers ." CMD_AS_RANGE,
718e3744 1050 NO_STR
1051 "BGP specific commands\n"
1052 "AS confederation parameters\n"
1053 "Peer ASs in BGP confederation\n"
1054 AS_STR)
1055{
1056 struct bgp *bgp;
1057 as_t as;
1058 int i;
1059
1060 bgp = vty->index;
1061
1062 for (i = 0; i < argc; i++)
1063 {
0b2aa3a0
PJ
1064 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
1065
718e3744 1066 bgp_confederation_peers_remove (bgp, as);
1067 }
1068 return CMD_SUCCESS;
1069}
6b0655a2 1070
5e242b0d
DS
1071/**
1072 * Central routine for maximum-paths configuration.
1073 * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP
1074 * @set: 1 for setting values, 0 for removing the max-paths config.
1075 */
ffd0c037
DS
1076static int
1077bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths,
5e242b0d 1078 u_int16_t options, int set)
165b5fff
JB
1079{
1080 struct bgp *bgp;
ffd0c037 1081 u_int16_t maxpaths = 0;
165b5fff 1082 int ret;
5e242b0d
DS
1083 afi_t afi;
1084 safi_t safi;
165b5fff
JB
1085
1086 bgp = vty->index;
5e242b0d
DS
1087 afi = bgp_node_afi (vty);
1088 safi = bgp_node_safi (vty);
165b5fff 1089
5e242b0d
DS
1090 if (set)
1091 {
73ac8160 1092 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1,
5b964da3 1093 MULTIPATH_NUM);
5e242b0d
DS
1094 ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths,
1095 options);
1096 }
1097 else
1098 ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type);
165b5fff 1099
165b5fff
JB
1100 if (ret < 0)
1101 {
1102 vty_out (vty,
5e242b0d
DS
1103 "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s",
1104 (set == 1) ? "" : "un",
1105 (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp",
1106 maxpaths, afi, safi, VTY_NEWLINE);
165b5fff
JB
1107 return CMD_WARNING;
1108 }
1109
7aafcaca
DS
1110 bgp_recalculate_all_bestpaths (bgp);
1111
165b5fff
JB
1112 return CMD_SUCCESS;
1113}
1114
abc920f8
DS
1115DEFUN (bgp_maxmed_admin,
1116 bgp_maxmed_admin_cmd,
1117 "bgp max-med administrative ",
1118 BGP_STR
1119 "Advertise routes with max-med\n"
1120 "Administratively applied, for an indefinite period\n")
1121{
1122 struct bgp *bgp;
1123
1124 bgp = vty->index;
1125
1126 bgp->v_maxmed_admin = 1;
1127 bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT;
1128
1129 bgp_maxmed_update(bgp);
1130
1131 return CMD_SUCCESS;
1132}
1133
1134DEFUN (bgp_maxmed_admin_medv,
1135 bgp_maxmed_admin_medv_cmd,
1136 "bgp max-med administrative <0-4294967294>",
1137 BGP_STR
1138 "Advertise routes with max-med\n"
1139 "Administratively applied, for an indefinite period\n"
1140 "Max MED value to be used\n")
1141{
1142 struct bgp *bgp;
1143
1144 bgp = vty->index;
1145
1146 bgp->v_maxmed_admin = 1;
1147 VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[0]);
1148
1149 bgp_maxmed_update(bgp);
1150
1151 return CMD_SUCCESS;
1152}
1153
1154DEFUN (no_bgp_maxmed_admin,
1155 no_bgp_maxmed_admin_cmd,
1156 "no bgp max-med administrative",
1157 NO_STR
1158 BGP_STR
1159 "Advertise routes with max-med\n"
1160 "Administratively applied, for an indefinite period\n")
1161{
1162 struct bgp *bgp;
1163
1164 bgp = vty->index;
1165
1166 bgp->v_maxmed_admin = BGP_MAXMED_ADMIN_UNCONFIGURED;
1167 bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT;
1168
1169 bgp_maxmed_update(bgp);
1170
1171 return CMD_SUCCESS;
1172}
1173
1174ALIAS (no_bgp_maxmed_admin,
1175 no_bgp_maxmed_admin_medv_cmd,
1176 "no bgp max-med administrative <0-4294967294>",
1177 NO_STR
1178 BGP_STR
1179 "Advertise routes with max-med\n"
1180 "Administratively applied, for an indefinite period\n"
1181 "Max MED value to be used\n")
1182
1183
1184DEFUN (bgp_maxmed_onstartup,
1185 bgp_maxmed_onstartup_cmd,
1186 "bgp max-med on-startup <5-86400>",
1187 BGP_STR
1188 "Advertise routes with max-med\n"
1189 "Effective on a startup\n"
1190 "Time (seconds) period for max-med\n")
1191{
1192 struct bgp *bgp;
1193
1194 bgp = vty->index;
1195
1196 if (argc != 1)
1197 {
1198 vty_out (vty, "%% Must supply max-med on-startup period");
1199 return CMD_WARNING;
1200 }
1201
1202 VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]);
1203 bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT;
1204
1205 bgp_maxmed_update(bgp);
1206
1207 return CMD_SUCCESS;
1208}
1209
1210DEFUN (bgp_maxmed_onstartup_medv,
1211 bgp_maxmed_onstartup_medv_cmd,
1212 "bgp max-med on-startup <5-86400> <0-4294967294>",
1213 BGP_STR
1214 "Advertise routes with max-med\n"
1215 "Effective on a startup\n"
1216 "Time (seconds) period for max-med\n"
1217 "Max MED value to be used\n")
1218{
1219 struct bgp *bgp;
1220
1221 bgp = vty->index;
1222
1223 if (argc != 2)
1224 {
1225 vty_out (vty, "%% Must supply max-med on-startup period and med value");
1226 return CMD_WARNING;
1227 }
1228
1229 VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]);
1230 VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[1]);
1231
1232 bgp_maxmed_update(bgp);
1233
1234 return CMD_SUCCESS;
1235}
1236
1237DEFUN (no_bgp_maxmed_onstartup,
1238 no_bgp_maxmed_onstartup_cmd,
1239 "no bgp max-med on-startup",
1240 NO_STR
1241 BGP_STR
1242 "Advertise routes with max-med\n"
1243 "Effective on a startup\n")
1244{
1245 struct bgp *bgp;
1246
1247 bgp = vty->index;
1248
1249 /* Cancel max-med onstartup if its on */
1250 if (bgp->t_maxmed_onstartup)
1251 {
1252 THREAD_TIMER_OFF (bgp->t_maxmed_onstartup);
1253 bgp->maxmed_onstartup_over = 1;
1254 }
1255
1256 bgp->v_maxmed_onstartup = BGP_MAXMED_ONSTARTUP_UNCONFIGURED;
1257 bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT;
1258
1259 bgp_maxmed_update(bgp);
1260
1261 return CMD_SUCCESS;
1262}
1263
1264ALIAS (no_bgp_maxmed_onstartup,
1265 no_bgp_maxmed_onstartup_period_cmd,
1266 "no bgp max-med on-startup <5-86400>",
1267 NO_STR
1268 BGP_STR
1269 "Advertise routes with max-med\n"
1270 "Effective on a startup\n"
1271 "Time (seconds) period for max-med\n")
1272
1273ALIAS (no_bgp_maxmed_onstartup,
1274 no_bgp_maxmed_onstartup_period_medv_cmd,
1275 "no bgp max-med on-startup <5-86400> <0-4294967294>",
1276 NO_STR
1277 BGP_STR
1278 "Advertise routes with max-med\n"
1279 "Effective on a startup\n"
1280 "Time (seconds) period for max-med\n"
1281 "Max MED value to be used\n")
1282
f188f2c4
DS
1283static int
1284bgp_update_delay_config_vty (struct vty *vty, const char *delay,
1285 const char *wait)
1286{
1287 struct bgp *bgp;
1288 u_int16_t update_delay;
1289 u_int16_t establish_wait;
1290
1291
1292 bgp = vty->index;
1293
1294 VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay,
1295 BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX);
1296
1297 if (!wait) /* update-delay <delay> */
1298 {
1299 bgp->v_update_delay = update_delay;
1300 bgp->v_establish_wait = bgp->v_update_delay;
1301 return CMD_SUCCESS;
1302 }
1303
1304 /* update-delay <delay> <establish-wait> */
1305 establish_wait = atoi (wait);
1306 if (update_delay < establish_wait)
1307 {
1308 vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s",
1309 VTY_NEWLINE);
1310 return CMD_WARNING;
1311 }
1312
1313 bgp->v_update_delay = update_delay;
1314 bgp->v_establish_wait = establish_wait;
1315
1316 return CMD_SUCCESS;
1317}
1318
1319static int
1320bgp_update_delay_deconfig_vty (struct vty *vty)
1321{
1322 struct bgp *bgp;
1323
1324 bgp = vty->index;
1325
1326 bgp->v_update_delay = BGP_UPDATE_DELAY_DEF;
1327 bgp->v_establish_wait = bgp->v_update_delay;
1328
1329 return CMD_SUCCESS;
1330}
1331
1332int
1333bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp)
1334{
1335 if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF)
1336 {
1337 vty_out (vty, " update-delay %d", bgp->v_update_delay);
1338 if (bgp->v_update_delay != bgp->v_establish_wait)
1339 vty_out (vty, " %d", bgp->v_establish_wait);
1340 vty_out (vty, "%s", VTY_NEWLINE);
1341 }
1342
1343 return 0;
1344}
1345
1346
1347/* Update-delay configuration */
1348DEFUN (bgp_update_delay,
1349 bgp_update_delay_cmd,
1350 "update-delay <0-3600>",
1351 "Force initial delay for best-path and updates\n"
1352 "Seconds\n")
1353{
1354 return bgp_update_delay_config_vty(vty, argv[0], NULL);
1355}
1356
1357DEFUN (bgp_update_delay_establish_wait,
1358 bgp_update_delay_establish_wait_cmd,
1359 "update-delay <0-3600> <1-3600>",
1360 "Force initial delay for best-path and updates\n"
1361 "Seconds\n"
1362 "Wait for peers to be established\n"
1363 "Seconds\n")
1364{
1365 return bgp_update_delay_config_vty(vty, argv[0], argv[1]);
1366}
1367
1368/* Update-delay deconfiguration */
1369DEFUN (no_bgp_update_delay,
1370 no_bgp_update_delay_cmd,
1371 "no update-delay <0-3600>",
1372 "Force initial delay for best-path and updates\n"
1373 "Seconds\n")
1374{
1375 return bgp_update_delay_deconfig_vty(vty);
1376}
1377
1378ALIAS (no_bgp_update_delay,
1379 no_bgp_update_delay_establish_wait_cmd,
1380 "no update-delay <0-3600> <1-3600>",
1381 "Force initial delay for best-path and updates\n"
1382 "Seconds\n"
1383 "Wait for peers to be established\n"
1384 "Seconds\n")
5e242b0d 1385
ffd0c037
DS
1386static int
1387bgp_wpkt_quanta_config_vty (struct vty *vty, const char *num, char set)
cb1faec9
DS
1388{
1389 struct bgp *bgp;
cb1faec9
DS
1390
1391 bgp = vty->index;
1392
1393 if (set)
1394 VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num,
4543bbb4 1395 1, 10000);
cb1faec9
DS
1396 else
1397 bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX;
1398
1399 return CMD_SUCCESS;
1400}
1401
1402int
1403bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp)
1404{
1405 if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX)
1406 vty_out (vty, " write-quanta %d%s",
1407 bgp->wpkt_quanta, VTY_NEWLINE);
1408
1409 return 0;
1410}
1411
1412
1413/* Update-delay configuration */
1414DEFUN (bgp_wpkt_quanta,
1415 bgp_wpkt_quanta_cmd,
4543bbb4 1416 "write-quanta <1-10000>",
cb1faec9
DS
1417 "How many packets to write to peer socket per run\n"
1418 "Number of packets\n")
1419{
1420 return bgp_wpkt_quanta_config_vty(vty, argv[0], 1);
1421}
1422
1423/* Update-delay deconfiguration */
1424DEFUN (no_bgp_wpkt_quanta,
1425 no_bgp_wpkt_quanta_cmd,
4543bbb4 1426 "no write-quanta <1-10000>",
cb1faec9
DS
1427 "How many packets to write to peer socket per run\n"
1428 "Number of packets\n")
1429{
1430 return bgp_wpkt_quanta_config_vty(vty, argv[0], 0);
1431}
1432
ffd0c037 1433static int
3f9c7369
DS
1434bgp_coalesce_config_vty (struct vty *vty, const char *num, char set)
1435{
1436 struct bgp *bgp;
1437
1438 bgp = vty->index;
1439
1440 if (set)
1441 VTY_GET_INTEGER_RANGE ("coalesce-time", bgp->coalesce_time, num,
1442 0, 4294967295);
1443 else
1444 bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME;
1445
1446 return CMD_SUCCESS;
1447}
1448
1449int
1450bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp)
1451{
1452 if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME)
1453 vty_out (vty, " coalesce-time %d%s",
1454 bgp->coalesce_time, VTY_NEWLINE);
1455
1456 return 0;
1457}
1458
1459
1460DEFUN (bgp_coalesce_time,
1461 bgp_coalesce_time_cmd,
1462 "coalesce-time <0-4294967295>",
1463 "Subgroup coalesce timer\n"
1464 "Subgroup coalesce timer value (in ms)\n")
1465{
1466 return bgp_coalesce_config_vty(vty, argv[0], 1);
1467}
1468
1469DEFUN (no_bgp_coalesce_time,
1470 no_bgp_coalesce_time_cmd,
1471 "no coalesce-time <0-4294967295>",
1472 "Subgroup coalesce timer\n"
1473 "Subgroup coalesce timer value (in ms)\n")
1474{
1475 return bgp_coalesce_config_vty(vty, argv[0], 0);
1476}
1477
5e242b0d
DS
1478/* Maximum-paths configuration */
1479DEFUN (bgp_maxpaths,
1480 bgp_maxpaths_cmd,
a565fbdd 1481 "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
5e242b0d
DS
1482 "Forward packets over multiple paths\n"
1483 "Number of paths\n")
1484{
1485 return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1);
1486}
1487
165b5fff
JB
1488DEFUN (bgp_maxpaths_ibgp,
1489 bgp_maxpaths_ibgp_cmd,
a565fbdd 1490 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
165b5fff
JB
1491 "Forward packets over multiple paths\n"
1492 "iBGP-multipath\n"
1493 "Number of paths\n")
1494{
5e242b0d
DS
1495 return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1);
1496}
165b5fff 1497
5e242b0d
DS
1498DEFUN (bgp_maxpaths_ibgp_cluster,
1499 bgp_maxpaths_ibgp_cluster_cmd,
a565fbdd 1500 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length",
5e242b0d
DS
1501 "Forward packets over multiple paths\n"
1502 "iBGP-multipath\n"
1503 "Number of paths\n"
1504 "Match the cluster length\n")
1505{
1506 return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0],
1507 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1);
165b5fff
JB
1508}
1509
1510DEFUN (no_bgp_maxpaths,
1511 no_bgp_maxpaths_cmd,
1512 "no maximum-paths",
1513 NO_STR
1514 "Forward packets over multiple paths\n"
1515 "Number of paths\n")
1516{
5e242b0d 1517 return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0);
165b5fff
JB
1518}
1519
1520ALIAS (no_bgp_maxpaths,
1521 no_bgp_maxpaths_arg_cmd,
a565fbdd 1522 "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
165b5fff
JB
1523 NO_STR
1524 "Forward packets over multiple paths\n"
1525 "Number of paths\n")
1526
1527DEFUN (no_bgp_maxpaths_ibgp,
1528 no_bgp_maxpaths_ibgp_cmd,
1529 "no maximum-paths ibgp",
1530 NO_STR
1531 "Forward packets over multiple paths\n"
1532 "iBGP-multipath\n"
1533 "Number of paths\n")
1534{
5e242b0d 1535 return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0);
165b5fff
JB
1536}
1537
1538ALIAS (no_bgp_maxpaths_ibgp,
1539 no_bgp_maxpaths_ibgp_arg_cmd,
a565fbdd 1540 "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
165b5fff
JB
1541 NO_STR
1542 "Forward packets over multiple paths\n"
1543 "iBGP-multipath\n"
1544 "Number of paths\n")
1545
5e242b0d
DS
1546ALIAS (no_bgp_maxpaths_ibgp,
1547 no_bgp_maxpaths_ibgp_cluster_cmd,
a565fbdd 1548 "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length",
5e242b0d
DS
1549 NO_STR
1550 "Forward packets over multiple paths\n"
1551 "iBGP-multipath\n"
1552 "Number of paths\n"
1553 "Match the cluster length\n")
1554
165b5fff
JB
1555int
1556bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
1557 safi_t safi, int *write)
1558{
d5b77cc2 1559 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != MULTIPATH_NUM)
165b5fff
JB
1560 {
1561 bgp_config_write_family_header (vty, afi, safi, write);
0b960b4d 1562 vty_out (vty, " maximum-paths %d%s",
165b5fff
JB
1563 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
1564 }
1565
d5b77cc2 1566 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != MULTIPATH_NUM)
165b5fff
JB
1567 {
1568 bgp_config_write_family_header (vty, afi, safi, write);
0b960b4d 1569 vty_out (vty, " maximum-paths ibgp %d",
5e242b0d
DS
1570 bgp->maxpaths[afi][safi].maxpaths_ibgp);
1571 if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags,
1572 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN))
1573 vty_out (vty, " equal-cluster-length");
1574 vty_out (vty, "%s", VTY_NEWLINE);
165b5fff
JB
1575 }
1576
1577 return 0;
1578}
6b0655a2 1579
718e3744 1580/* BGP timers. */
1581
1582DEFUN (bgp_timers,
1583 bgp_timers_cmd,
1584 "timers bgp <0-65535> <0-65535>",
1585 "Adjust routing timers\n"
1586 "BGP timers\n"
1587 "Keepalive interval\n"
1588 "Holdtime\n")
1589{
1590 struct bgp *bgp;
1591 unsigned long keepalive = 0;
1592 unsigned long holdtime = 0;
1593
1594 bgp = vty->index;
1595
1596 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
1597 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
1598
1599 /* Holdtime value check. */
1600 if (holdtime < 3 && holdtime != 0)
1601 {
1602 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
1603 VTY_NEWLINE);
1604 return CMD_WARNING;
1605 }
1606
1607 bgp_timers_set (bgp, keepalive, holdtime);
1608
1609 return CMD_SUCCESS;
1610}
1611
1612DEFUN (no_bgp_timers,
1613 no_bgp_timers_cmd,
1614 "no timers bgp",
1615 NO_STR
1616 "Adjust routing timers\n"
1617 "BGP timers\n")
1618{
1619 struct bgp *bgp;
1620
1621 bgp = vty->index;
1622 bgp_timers_unset (bgp);
1623
1624 return CMD_SUCCESS;
1625}
1626
1627ALIAS (no_bgp_timers,
1628 no_bgp_timers_arg_cmd,
1629 "no timers bgp <0-65535> <0-65535>",
1630 NO_STR
1631 "Adjust routing timers\n"
1632 "BGP timers\n"
1633 "Keepalive interval\n"
1634 "Holdtime\n")
6b0655a2 1635
718e3744 1636DEFUN (bgp_client_to_client_reflection,
1637 bgp_client_to_client_reflection_cmd,
1638 "bgp client-to-client reflection",
1639 "BGP specific commands\n"
1640 "Configure client to client route reflection\n"
1641 "reflection of routes allowed\n")
1642{
1643 struct bgp *bgp;
1644
1645 bgp = vty->index;
1646 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
f31fa004 1647 bgp_clear_star_soft_out (vty, bgp->name);
7aafcaca 1648
718e3744 1649 return CMD_SUCCESS;
1650}
1651
1652DEFUN (no_bgp_client_to_client_reflection,
1653 no_bgp_client_to_client_reflection_cmd,
1654 "no bgp client-to-client reflection",
1655 NO_STR
1656 "BGP specific commands\n"
1657 "Configure client to client route reflection\n"
1658 "reflection of routes allowed\n")
1659{
1660 struct bgp *bgp;
1661
1662 bgp = vty->index;
1663 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
f31fa004 1664 bgp_clear_star_soft_out (vty, bgp->name);
7aafcaca 1665
718e3744 1666 return CMD_SUCCESS;
1667}
1668
1669/* "bgp always-compare-med" configuration. */
1670DEFUN (bgp_always_compare_med,
1671 bgp_always_compare_med_cmd,
1672 "bgp always-compare-med",
1673 "BGP specific commands\n"
1674 "Allow comparing MED from different neighbors\n")
1675{
1676 struct bgp *bgp;
1677
1678 bgp = vty->index;
1679 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
7aafcaca
DS
1680 bgp_recalculate_all_bestpaths (bgp);
1681
718e3744 1682 return CMD_SUCCESS;
1683}
1684
1685DEFUN (no_bgp_always_compare_med,
1686 no_bgp_always_compare_med_cmd,
1687 "no bgp always-compare-med",
1688 NO_STR
1689 "BGP specific commands\n"
1690 "Allow comparing MED from different neighbors\n")
1691{
1692 struct bgp *bgp;
1693
1694 bgp = vty->index;
1695 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
7aafcaca
DS
1696 bgp_recalculate_all_bestpaths (bgp);
1697
718e3744 1698 return CMD_SUCCESS;
1699}
6b0655a2 1700
718e3744 1701/* "bgp deterministic-med" configuration. */
1702DEFUN (bgp_deterministic_med,
1703 bgp_deterministic_med_cmd,
1704 "bgp deterministic-med",
1705 "BGP specific commands\n"
1706 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1707{
1708 struct bgp *bgp;
1709
1710 bgp = vty->index;
1475ac87
DW
1711
1712 if (!bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED))
1713 {
1714 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
1715 bgp_recalculate_all_bestpaths (bgp);
1716 }
7aafcaca 1717
718e3744 1718 return CMD_SUCCESS;
1719}
1720
1721DEFUN (no_bgp_deterministic_med,
1722 no_bgp_deterministic_med_cmd,
1723 "no bgp deterministic-med",
1724 NO_STR
1725 "BGP specific commands\n"
1726 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1727{
1728 struct bgp *bgp;
06370dac
DW
1729 int bestpath_per_as_used;
1730 afi_t afi;
1731 safi_t safi;
1732 struct peer *peer;
1733 struct listnode *node, *nnode;
718e3744 1734
1735 bgp = vty->index;
1475ac87
DW
1736
1737 if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED))
1738 {
06370dac
DW
1739 bestpath_per_as_used = 0;
1740
1741 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
1742 {
1743 for (afi = AFI_IP; afi < AFI_MAX; afi++)
1744 for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
1745 if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS))
1746 {
1747 bestpath_per_as_used = 1;
1748 break;
1749 }
1750
1751 if (bestpath_per_as_used)
1752 break;
1753 }
1754
1755 if (bestpath_per_as_used)
1756 {
1757 vty_out (vty, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s",
1758 VTY_NEWLINE);
1759 return CMD_WARNING;
1760 }
1761 else
1762 {
1763 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
1764 bgp_recalculate_all_bestpaths (bgp);
1765 }
1475ac87 1766 }
7aafcaca 1767
718e3744 1768 return CMD_SUCCESS;
1769}
538621f2 1770
1771/* "bgp graceful-restart" configuration. */
1772DEFUN (bgp_graceful_restart,
1773 bgp_graceful_restart_cmd,
1774 "bgp graceful-restart",
1775 "BGP specific commands\n"
1776 "Graceful restart capability parameters\n")
1777{
1778 struct bgp *bgp;
1779
1780 bgp = vty->index;
1781 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
1782 return CMD_SUCCESS;
1783}
1784
1785DEFUN (no_bgp_graceful_restart,
1786 no_bgp_graceful_restart_cmd,
1787 "no bgp graceful-restart",
1788 NO_STR
1789 "BGP specific commands\n"
1790 "Graceful restart capability parameters\n")
1791{
1792 struct bgp *bgp;
1793
1794 bgp = vty->index;
1795 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
1796 return CMD_SUCCESS;
1797}
1798
93406d87 1799DEFUN (bgp_graceful_restart_stalepath_time,
1800 bgp_graceful_restart_stalepath_time_cmd,
1801 "bgp graceful-restart stalepath-time <1-3600>",
1802 "BGP specific commands\n"
1803 "Graceful restart capability parameters\n"
1804 "Set the max time to hold onto restarting peer's stale paths\n"
1805 "Delay value (seconds)\n")
1806{
1807 struct bgp *bgp;
1808 u_int32_t stalepath;
1809
1810 bgp = vty->index;
1811 if (! bgp)
1812 return CMD_WARNING;
1813
1814 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
1815 bgp->stalepath_time = stalepath;
1816 return CMD_SUCCESS;
1817}
1818
eb6f1b41
PG
1819DEFUN (bgp_graceful_restart_restart_time,
1820 bgp_graceful_restart_restart_time_cmd,
1821 "bgp graceful-restart restart-time <1-3600>",
1822 "BGP specific commands\n"
1823 "Graceful restart capability parameters\n"
1824 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1825 "Delay value (seconds)\n")
1826{
1827 struct bgp *bgp;
1828 u_int32_t restart;
1829
1830 bgp = vty->index;
1831 if (! bgp)
1832 return CMD_WARNING;
1833
1834 VTY_GET_INTEGER_RANGE ("restart-time", restart, argv[0], 1, 3600);
1835 bgp->restart_time = restart;
1836 return CMD_SUCCESS;
1837}
1838
93406d87 1839DEFUN (no_bgp_graceful_restart_stalepath_time,
1840 no_bgp_graceful_restart_stalepath_time_cmd,
1841 "no bgp graceful-restart stalepath-time",
1842 NO_STR
1843 "BGP specific commands\n"
1844 "Graceful restart capability parameters\n"
1845 "Set the max time to hold onto restarting peer's stale paths\n")
1846{
1847 struct bgp *bgp;
1848
1849 bgp = vty->index;
1850 if (! bgp)
1851 return CMD_WARNING;
1852
1853 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1854 return CMD_SUCCESS;
1855}
1856
eb6f1b41
PG
1857DEFUN (no_bgp_graceful_restart_restart_time,
1858 no_bgp_graceful_restart_restart_time_cmd,
1859 "no bgp graceful-restart restart-time",
1860 NO_STR
1861 "BGP specific commands\n"
1862 "Graceful restart capability parameters\n"
1863 "Set the time to wait to delete stale routes before a BGP open message is received\n")
1864{
1865 struct bgp *bgp;
1866
1867 bgp = vty->index;
1868 if (! bgp)
1869 return CMD_WARNING;
1870
1871 bgp->restart_time = BGP_DEFAULT_RESTART_TIME;
1872 return CMD_SUCCESS;
1873}
1874
93406d87 1875ALIAS (no_bgp_graceful_restart_stalepath_time,
1876 no_bgp_graceful_restart_stalepath_time_val_cmd,
1877 "no bgp graceful-restart stalepath-time <1-3600>",
1878 NO_STR
1879 "BGP specific commands\n"
1880 "Graceful restart capability parameters\n"
1881 "Set the max time to hold onto restarting peer's stale paths\n"
1882 "Delay value (seconds)\n")
1883
eb6f1b41
PG
1884ALIAS (no_bgp_graceful_restart_restart_time,
1885 no_bgp_graceful_restart_restart_time_val_cmd,
1886 "no bgp graceful-restart restart-time <1-3600>",
1887 NO_STR
1888 "BGP specific commands\n"
1889 "Graceful restart capability parameters\n"
1890 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1891 "Delay value (seconds)\n")
1892
718e3744 1893/* "bgp fast-external-failover" configuration. */
1894DEFUN (bgp_fast_external_failover,
1895 bgp_fast_external_failover_cmd,
1896 "bgp fast-external-failover",
1897 BGP_STR
1898 "Immediately reset session if a link to a directly connected external peer goes down\n")
1899{
1900 struct bgp *bgp;
1901
1902 bgp = vty->index;
1903 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1904 return CMD_SUCCESS;
1905}
1906
1907DEFUN (no_bgp_fast_external_failover,
1908 no_bgp_fast_external_failover_cmd,
1909 "no bgp fast-external-failover",
1910 NO_STR
1911 BGP_STR
1912 "Immediately reset session if a link to a directly connected external peer goes down\n")
1913{
1914 struct bgp *bgp;
1915
1916 bgp = vty->index;
1917 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1918 return CMD_SUCCESS;
1919}
6b0655a2 1920
718e3744 1921/* "bgp enforce-first-as" configuration. */
1922DEFUN (bgp_enforce_first_as,
1923 bgp_enforce_first_as_cmd,
1924 "bgp enforce-first-as",
1925 BGP_STR
1926 "Enforce the first AS for EBGP routes\n")
1927{
1928 struct bgp *bgp;
1929
1930 bgp = vty->index;
1931 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
f31fa004 1932 bgp_clear_star_soft_in (vty, bgp->name);
7aafcaca 1933
718e3744 1934 return CMD_SUCCESS;
1935}
1936
1937DEFUN (no_bgp_enforce_first_as,
1938 no_bgp_enforce_first_as_cmd,
1939 "no bgp enforce-first-as",
1940 NO_STR
1941 BGP_STR
1942 "Enforce the first AS for EBGP routes\n")
1943{
1944 struct bgp *bgp;
1945
1946 bgp = vty->index;
1947 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
f31fa004 1948 bgp_clear_star_soft_in (vty, bgp->name);
7aafcaca 1949
718e3744 1950 return CMD_SUCCESS;
1951}
6b0655a2 1952
718e3744 1953/* "bgp bestpath compare-routerid" configuration. */
1954DEFUN (bgp_bestpath_compare_router_id,
1955 bgp_bestpath_compare_router_id_cmd,
1956 "bgp bestpath compare-routerid",
1957 "BGP specific commands\n"
1958 "Change the default bestpath selection\n"
1959 "Compare router-id for identical EBGP paths\n")
1960{
1961 struct bgp *bgp;
1962
1963 bgp = vty->index;
1964 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
7aafcaca
DS
1965 bgp_recalculate_all_bestpaths (bgp);
1966
718e3744 1967 return CMD_SUCCESS;
1968}
1969
1970DEFUN (no_bgp_bestpath_compare_router_id,
1971 no_bgp_bestpath_compare_router_id_cmd,
1972 "no bgp bestpath compare-routerid",
1973 NO_STR
1974 "BGP specific commands\n"
1975 "Change the default bestpath selection\n"
1976 "Compare router-id for identical EBGP paths\n")
1977{
1978 struct bgp *bgp;
1979
1980 bgp = vty->index;
1981 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
7aafcaca
DS
1982 bgp_recalculate_all_bestpaths (bgp);
1983
718e3744 1984 return CMD_SUCCESS;
1985}
6b0655a2 1986
718e3744 1987/* "bgp bestpath as-path ignore" configuration. */
1988DEFUN (bgp_bestpath_aspath_ignore,
1989 bgp_bestpath_aspath_ignore_cmd,
1990 "bgp bestpath as-path ignore",
1991 "BGP specific commands\n"
1992 "Change the default bestpath selection\n"
1993 "AS-path attribute\n"
1994 "Ignore as-path length in selecting a route\n")
1995{
1996 struct bgp *bgp;
1997
1998 bgp = vty->index;
1999 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
7aafcaca
DS
2000 bgp_recalculate_all_bestpaths (bgp);
2001
718e3744 2002 return CMD_SUCCESS;
2003}
2004
2005DEFUN (no_bgp_bestpath_aspath_ignore,
2006 no_bgp_bestpath_aspath_ignore_cmd,
2007 "no bgp bestpath as-path ignore",
2008 NO_STR
2009 "BGP specific commands\n"
2010 "Change the default bestpath selection\n"
2011 "AS-path attribute\n"
2012 "Ignore as-path length in selecting a route\n")
2013{
2014 struct bgp *bgp;
2015
2016 bgp = vty->index;
2017 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
7aafcaca
DS
2018 bgp_recalculate_all_bestpaths (bgp);
2019
718e3744 2020 return CMD_SUCCESS;
2021}
6b0655a2 2022
6811845b 2023/* "bgp bestpath as-path confed" configuration. */
2024DEFUN (bgp_bestpath_aspath_confed,
2025 bgp_bestpath_aspath_confed_cmd,
2026 "bgp bestpath as-path confed",
2027 "BGP specific commands\n"
2028 "Change the default bestpath selection\n"
2029 "AS-path attribute\n"
2030 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2031{
2032 struct bgp *bgp;
2033
2034 bgp = vty->index;
2035 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
7aafcaca
DS
2036 bgp_recalculate_all_bestpaths (bgp);
2037
6811845b 2038 return CMD_SUCCESS;
2039}
2040
2041DEFUN (no_bgp_bestpath_aspath_confed,
2042 no_bgp_bestpath_aspath_confed_cmd,
2043 "no bgp bestpath as-path confed",
2044 NO_STR
2045 "BGP specific commands\n"
2046 "Change the default bestpath selection\n"
2047 "AS-path attribute\n"
2048 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2049{
2050 struct bgp *bgp;
2051
2052 bgp = vty->index;
2053 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
7aafcaca
DS
2054 bgp_recalculate_all_bestpaths (bgp);
2055
6811845b 2056 return CMD_SUCCESS;
2057}
6b0655a2 2058
2fdd455c
PM
2059/* "bgp bestpath as-path multipath-relax" configuration. */
2060DEFUN (bgp_bestpath_aspath_multipath_relax,
2061 bgp_bestpath_aspath_multipath_relax_cmd,
219178b6 2062 "bgp bestpath as-path multipath-relax {as-set|no-as-set}",
16fc1eec
DS
2063 "BGP specific commands\n"
2064 "Change the default bestpath selection\n"
2065 "AS-path attribute\n"
2066 "Allow load sharing across routes that have different AS paths (but same length)\n"
219178b6 2067 "Generate an AS_SET\n"
16fc1eec
DS
2068 "Do not generate an AS_SET\n")
2069{
2070 struct bgp *bgp;
2071
2072 bgp = vty->index;
2073 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
219178b6
DW
2074
2075 /* no-as-set is now the default behavior so we can silently
2076 * ignore it */
2077 if (argv[0] != NULL && strncmp (argv[0], "a", 1) == 0)
2078 bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET);
2079 else
2080 bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET) ;
2081
7aafcaca
DS
2082 bgp_recalculate_all_bestpaths (bgp);
2083
16fc1eec
DS
2084 return CMD_SUCCESS;
2085}
2086
219178b6
DW
2087DEFUN (no_bgp_bestpath_aspath_multipath_relax,
2088 no_bgp_bestpath_aspath_multipath_relax_cmd,
2089 "no bgp bestpath as-path multipath-relax {as-set|no-as-set}",
16fc1eec
DS
2090 NO_STR
2091 "BGP specific commands\n"
2092 "Change the default bestpath selection\n"
2093 "AS-path attribute\n"
2094 "Allow load sharing across routes that have different AS paths (but same length)\n"
219178b6 2095 "Generate an AS_SET\n"
16fc1eec
DS
2096 "Do not generate an AS_SET\n")
2097{
2098 struct bgp *bgp;
2099
2100 bgp = vty->index;
2101 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
219178b6 2102 bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET);
7aafcaca
DS
2103 bgp_recalculate_all_bestpaths (bgp);
2104
2fdd455c
PM
2105 return CMD_SUCCESS;
2106}
6b0655a2 2107
848973c7 2108/* "bgp log-neighbor-changes" configuration. */
2109DEFUN (bgp_log_neighbor_changes,
2110 bgp_log_neighbor_changes_cmd,
2111 "bgp log-neighbor-changes",
2112 "BGP specific commands\n"
2113 "Log neighbor up/down and reset reason\n")
2114{
2115 struct bgp *bgp;
2116
2117 bgp = vty->index;
2118 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
2119 return CMD_SUCCESS;
2120}
2121
2122DEFUN (no_bgp_log_neighbor_changes,
2123 no_bgp_log_neighbor_changes_cmd,
2124 "no bgp log-neighbor-changes",
2125 NO_STR
2126 "BGP specific commands\n"
2127 "Log neighbor up/down and reset reason\n")
2128{
2129 struct bgp *bgp;
2130
2131 bgp = vty->index;
2132 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
2133 return CMD_SUCCESS;
2134}
6b0655a2 2135
718e3744 2136/* "bgp bestpath med" configuration. */
2137DEFUN (bgp_bestpath_med,
2138 bgp_bestpath_med_cmd,
2139 "bgp bestpath med (confed|missing-as-worst)",
2140 "BGP specific commands\n"
2141 "Change the default bestpath selection\n"
2142 "MED attribute\n"
2143 "Compare MED among confederation paths\n"
2144 "Treat missing MED as the least preferred one\n")
2145{
2146 struct bgp *bgp;
2147
2148 bgp = vty->index;
2149
2150 if (strncmp (argv[0], "confed", 1) == 0)
2151 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
2152 else
2153 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
2154
7aafcaca
DS
2155 bgp_recalculate_all_bestpaths (bgp);
2156
718e3744 2157 return CMD_SUCCESS;
2158}
2159
2160DEFUN (bgp_bestpath_med2,
2161 bgp_bestpath_med2_cmd,
2162 "bgp bestpath med confed missing-as-worst",
2163 "BGP specific commands\n"
2164 "Change the default bestpath selection\n"
2165 "MED attribute\n"
2166 "Compare MED among confederation paths\n"
2167 "Treat missing MED as the least preferred one\n")
2168{
2169 struct bgp *bgp;
2170
2171 bgp = vty->index;
2172 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
2173 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
7aafcaca
DS
2174 bgp_recalculate_all_bestpaths (bgp);
2175
718e3744 2176 return CMD_SUCCESS;
2177}
2178
2179ALIAS (bgp_bestpath_med2,
2180 bgp_bestpath_med3_cmd,
2181 "bgp bestpath med missing-as-worst confed",
2182 "BGP specific commands\n"
2183 "Change the default bestpath selection\n"
2184 "MED attribute\n"
2185 "Treat missing MED as the least preferred one\n"
2186 "Compare MED among confederation paths\n")
2187
2188DEFUN (no_bgp_bestpath_med,
2189 no_bgp_bestpath_med_cmd,
2190 "no bgp bestpath med (confed|missing-as-worst)",
2191 NO_STR
2192 "BGP specific commands\n"
2193 "Change the default bestpath selection\n"
2194 "MED attribute\n"
2195 "Compare MED among confederation paths\n"
2196 "Treat missing MED as the least preferred one\n")
2197{
2198 struct bgp *bgp;
2199
2200 bgp = vty->index;
2201
2202 if (strncmp (argv[0], "confed", 1) == 0)
2203 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
2204 else
2205 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
2206
7aafcaca
DS
2207 bgp_recalculate_all_bestpaths (bgp);
2208
718e3744 2209 return CMD_SUCCESS;
2210}
2211
2212DEFUN (no_bgp_bestpath_med2,
2213 no_bgp_bestpath_med2_cmd,
2214 "no bgp bestpath med confed missing-as-worst",
2215 NO_STR
2216 "BGP specific commands\n"
2217 "Change the default bestpath selection\n"
2218 "MED attribute\n"
2219 "Compare MED among confederation paths\n"
2220 "Treat missing MED as the least preferred one\n")
2221{
2222 struct bgp *bgp;
2223
2224 bgp = vty->index;
2225 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
2226 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
7aafcaca
DS
2227 bgp_recalculate_all_bestpaths (bgp);
2228
718e3744 2229 return CMD_SUCCESS;
2230}
2231
2232ALIAS (no_bgp_bestpath_med2,
2233 no_bgp_bestpath_med3_cmd,
2234 "no bgp bestpath med missing-as-worst confed",
2235 NO_STR
2236 "BGP specific commands\n"
2237 "Change the default bestpath selection\n"
2238 "MED attribute\n"
2239 "Treat missing MED as the least preferred one\n"
2240 "Compare MED among confederation paths\n")
6b0655a2 2241
718e3744 2242/* "no bgp default ipv4-unicast". */
2243DEFUN (no_bgp_default_ipv4_unicast,
2244 no_bgp_default_ipv4_unicast_cmd,
2245 "no bgp default ipv4-unicast",
2246 NO_STR
2247 "BGP specific commands\n"
2248 "Configure BGP defaults\n"
2249 "Activate ipv4-unicast for a peer by default\n")
2250{
2251 struct bgp *bgp;
2252
2253 bgp = vty->index;
2254 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
2255 return CMD_SUCCESS;
2256}
2257
2258DEFUN (bgp_default_ipv4_unicast,
2259 bgp_default_ipv4_unicast_cmd,
2260 "bgp default ipv4-unicast",
2261 "BGP specific commands\n"
2262 "Configure BGP defaults\n"
2263 "Activate ipv4-unicast for a peer by default\n")
2264{
2265 struct bgp *bgp;
2266
2267 bgp = vty->index;
2268 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
2269 return CMD_SUCCESS;
2270}
6b0655a2 2271
04b6bdc0
DW
2272/* Display hostname in certain command outputs */
2273DEFUN (bgp_default_show_hostname,
2274 bgp_default_show_hostname_cmd,
2275 "bgp default show-hostname",
2276 "BGP specific commands\n"
2277 "Configure BGP defaults\n"
2278 "Show hostname in certain command ouputs\n")
2279{
2280 struct bgp *bgp;
2281
2282 bgp = vty->index;
2283 bgp_flag_set (bgp, BGP_FLAG_SHOW_HOSTNAME);
2284 return CMD_SUCCESS;
2285}
2286
2287DEFUN (no_bgp_default_show_hostname,
2288 no_bgp_default_show_hostname_cmd,
2289 "no bgp default show-hostname",
2290 NO_STR
2291 "BGP specific commands\n"
2292 "Configure BGP defaults\n"
2293 "Show hostname in certain command ouputs\n")
2294{
2295 struct bgp *bgp;
2296
2297 bgp = vty->index;
2298 bgp_flag_unset (bgp, BGP_FLAG_SHOW_HOSTNAME);
2299 return CMD_SUCCESS;
2300}
2301
8233ef81 2302/* "bgp network import-check" configuration. */
718e3744 2303DEFUN (bgp_network_import_check,
2304 bgp_network_import_check_cmd,
5623e905 2305 "bgp network import-check",
718e3744 2306 "BGP specific commands\n"
2307 "BGP network command\n"
5623e905 2308 "Check BGP network route exists in IGP\n")
718e3744 2309{
2310 struct bgp *bgp;
2311
2312 bgp = vty->index;
078430f6
DS
2313 if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK))
2314 {
2315 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
5623e905 2316 bgp_static_redo_import_check(bgp);
078430f6
DS
2317 }
2318
718e3744 2319 return CMD_SUCCESS;
2320}
2321
8233ef81
DW
2322ALIAS_HIDDEN (bgp_network_import_check,
2323 bgp_network_import_check_exact_cmd,
2324 "bgp network import-check exact",
2325 "BGP specific commands\n"
2326 "BGP network command\n"
2327 "Check BGP network route exists in IGP\n"
2328 "Match route precisely\n")
2329
718e3744 2330DEFUN (no_bgp_network_import_check,
2331 no_bgp_network_import_check_cmd,
5623e905 2332 "no bgp network import-check",
718e3744 2333 NO_STR
2334 "BGP specific commands\n"
2335 "BGP network command\n"
2336 "Check BGP network route exists in IGP\n")
2337{
2338 struct bgp *bgp;
2339
2340 bgp = vty->index;
078430f6
DS
2341 if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK))
2342 {
2343 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
078430f6
DS
2344 bgp_static_redo_import_check(bgp);
2345 }
5623e905 2346
718e3744 2347 return CMD_SUCCESS;
2348}
6b0655a2 2349
718e3744 2350DEFUN (bgp_default_local_preference,
2351 bgp_default_local_preference_cmd,
2352 "bgp default local-preference <0-4294967295>",
2353 "BGP specific commands\n"
2354 "Configure BGP defaults\n"
2355 "local preference (higher=more preferred)\n"
2356 "Configure default local preference value\n")
2357{
2358 struct bgp *bgp;
2359 u_int32_t local_pref;
2360
2361 bgp = vty->index;
2362
2363 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
2364
2365 bgp_default_local_preference_set (bgp, local_pref);
f31fa004 2366 bgp_clear_star_soft_in (vty, bgp->name);
718e3744 2367
2368 return CMD_SUCCESS;
2369}
2370
2371DEFUN (no_bgp_default_local_preference,
2372 no_bgp_default_local_preference_cmd,
2373 "no bgp default local-preference",
2374 NO_STR
2375 "BGP specific commands\n"
2376 "Configure BGP defaults\n"
2377 "local preference (higher=more preferred)\n")
2378{
2379 struct bgp *bgp;
2380
2381 bgp = vty->index;
2382 bgp_default_local_preference_unset (bgp);
f31fa004 2383 bgp_clear_star_soft_in (vty, bgp->name);
7aafcaca 2384
718e3744 2385 return CMD_SUCCESS;
2386}
2387
2388ALIAS (no_bgp_default_local_preference,
2389 no_bgp_default_local_preference_val_cmd,
2390 "no bgp default local-preference <0-4294967295>",
2391 NO_STR
2392 "BGP specific commands\n"
2393 "Configure BGP defaults\n"
2394 "local preference (higher=more preferred)\n"
2395 "Configure default local preference value\n")
6b0655a2 2396
3f9c7369
DS
2397DEFUN (bgp_default_subgroup_pkt_queue_max,
2398 bgp_default_subgroup_pkt_queue_max_cmd,
2399 "bgp default subgroup-pkt-queue-max <20-100>",
2400 "BGP specific commands\n"
2401 "Configure BGP defaults\n"
2402 "subgroup-pkt-queue-max\n"
2403 "Configure subgroup packet queue max\n")
8bd9d948 2404{
3f9c7369
DS
2405 struct bgp *bgp;
2406 u_int32_t max_size;
8bd9d948 2407
3f9c7369
DS
2408 bgp = vty->index;
2409
2410 VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[0]);
2411
2412 bgp_default_subgroup_pkt_queue_max_set (bgp, max_size);
2413
2414 return CMD_SUCCESS;
2415}
2416
2417DEFUN (no_bgp_default_subgroup_pkt_queue_max,
2418 no_bgp_default_subgroup_pkt_queue_max_cmd,
2419 "no bgp default subgroup-pkt-queue-max",
2420 NO_STR
2421 "BGP specific commands\n"
2422 "Configure BGP defaults\n"
2423 "subgroup-pkt-queue-max\n")
2424{
2425 struct bgp *bgp;
2426
2427 bgp = vty->index;
2428 bgp_default_subgroup_pkt_queue_max_unset (bgp);
2429 return CMD_SUCCESS;
8bd9d948
DS
2430}
2431
813d4307
DW
2432ALIAS (no_bgp_default_subgroup_pkt_queue_max,
2433 no_bgp_default_subgroup_pkt_queue_max_val_cmd,
2434 "no bgp default subgroup-pkt-queue-max <20-100>",
2435 NO_STR
2436 "BGP specific commands\n"
2437 "Configure BGP defaults\n"
2438 "subgroup-pkt-queue-max\n"
2439 "Configure subgroup packet queue max\n")
2440
8bd9d948
DS
2441DEFUN (bgp_rr_allow_outbound_policy,
2442 bgp_rr_allow_outbound_policy_cmd,
2443 "bgp route-reflector allow-outbound-policy",
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_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
3f9c7369 2455 update_group_announce_rrclients(bgp);
f31fa004 2456 bgp_clear_star_soft_out (vty, bgp->name);
8bd9d948
DS
2457 }
2458
2459 return CMD_SUCCESS;
2460}
2461
2462DEFUN (no_bgp_rr_allow_outbound_policy,
2463 no_bgp_rr_allow_outbound_policy_cmd,
2464 "no bgp route-reflector allow-outbound-policy",
2465 NO_STR
2466 "BGP specific commands\n"
2467 "Allow modifications made by out route-map\n"
2468 "on ibgp neighbors\n")
2469{
2470 struct bgp *bgp;
8bd9d948
DS
2471
2472 bgp = vty->index;
2473
2474 if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))
2475 {
2476 bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
3f9c7369 2477 update_group_announce_rrclients(bgp);
f31fa004 2478 bgp_clear_star_soft_out (vty, bgp->name);
8bd9d948
DS
2479 }
2480
2481 return CMD_SUCCESS;
2482}
2483
f14e6fdb
DS
2484DEFUN (bgp_listen_limit,
2485 bgp_listen_limit_cmd,
2486 "bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE,
2487 "BGP specific commands\n"
2488 "Configure BGP defaults\n"
2489 "maximum number of BGP Dynamic Neighbors that can be created\n"
2490 "Configure Dynamic Neighbors listen limit value\n")
2491{
2492 struct bgp *bgp;
2493 int listen_limit;
2494
2495 bgp = vty->index;
2496
2497 VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[0],
2498 BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN,
2499 BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX);
2500
2501 bgp_listen_limit_set (bgp, listen_limit);
2502
2503 return CMD_SUCCESS;
2504}
2505
2506DEFUN (no_bgp_listen_limit,
2507 no_bgp_listen_limit_cmd,
2508 "no bgp listen limit",
2509 "BGP specific commands\n"
2510 "Configure BGP defaults\n"
2511 "unset maximum number of BGP Dynamic Neighbors that can be created\n"
2512 "Configure Dynamic Neighbors listen limit value to default\n")
2513{
2514 struct bgp *bgp;
2515
2516 bgp = vty->index;
2517 bgp_listen_limit_unset (bgp);
2518 return CMD_SUCCESS;
2519}
2520
813d4307
DW
2521ALIAS (no_bgp_listen_limit,
2522 no_bgp_listen_limit_val_cmd,
2523 "no bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE,
2524 NO_STR
2525 "BGP specific commands\n"
2526 "Configure BGP defaults\n"
2527 "maximum number of BGP Dynamic Neighbors that can be created\n"
2528 "Configure Dynamic Neighbors listen limit value\n")
f14e6fdb 2529
20eb8864 2530/*
2531 * Check if this listen range is already configured. Check for exact
2532 * match or overlap based on input.
2533 */
2534static struct peer_group *
2535listen_range_exists (struct bgp *bgp, struct prefix *range, int exact)
2536{
2537 struct listnode *node, *nnode;
2538 struct listnode *node1, *nnode1;
2539 struct peer_group *group;
2540 struct prefix *lr;
2541 afi_t afi;
2542 int match;
2543
2544 afi = family2afi(range->family);
2545 for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group))
2546 {
2547 for (ALL_LIST_ELEMENTS (group->listen_range[afi], node1,
2548 nnode1, lr))
2549 {
2550 if (exact)
2551 match = prefix_same (range, lr);
2552 else
2553 match = (prefix_match (range, lr) || prefix_match (lr, range));
2554 if (match)
2555 return group;
2556 }
2557 }
2558
2559 return NULL;
2560}
2561
f14e6fdb
DS
2562DEFUN (bgp_listen_range,
2563 bgp_listen_range_cmd,
2564 LISTEN_RANGE_CMD "peer-group WORD" ,
2565 "BGP specific commands\n"
2566 "Configure BGP Dynamic Neighbors\n"
2567 "add a listening range for Dynamic Neighbors\n"
2568 LISTEN_RANGE_ADDR_STR)
2569{
2570 struct bgp *bgp;
2571 struct prefix range;
20eb8864 2572 struct peer_group *group, *existing_group;
f14e6fdb
DS
2573 afi_t afi;
2574 int ret;
2575
2576 bgp = vty->index;
2577
2578 //VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]);
2579
2580 /* Convert IP prefix string to struct prefix. */
2581 ret = str2prefix (argv[0], &range);
2582 if (! ret)
2583 {
2584 vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE);
2585 return CMD_WARNING;
2586 }
2587
2588 afi = family2afi(range.family);
2589
2590#ifdef HAVE_IPV6
2591 if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6))
2592 {
2593 vty_out (vty, "%% Malformed listen range (link-local address)%s",
2594 VTY_NEWLINE);
2595 return CMD_WARNING;
2596 }
2597#endif /* HAVE_IPV6 */
2598
2599 apply_mask (&range);
2600
20eb8864 2601 /* Check if same listen range is already configured. */
2602 existing_group = listen_range_exists (bgp, &range, 1);
2603 if (existing_group)
2604 {
2605 if (strcmp (existing_group->name, argv[1]) == 0)
2606 return CMD_SUCCESS;
2607 else
2608 {
2609 vty_out (vty, "%% Same listen range is attached to peer-group %s%s",
2610 existing_group->name, VTY_NEWLINE);
2611 return CMD_WARNING;
2612 }
2613 }
2614
2615 /* Check if an overlapping listen range exists. */
2616 if (listen_range_exists (bgp, &range, 0))
2617 {
2618 vty_out (vty, "%% Listen range overlaps with existing listen range%s",
2619 VTY_NEWLINE);
2620 return CMD_WARNING;
2621 }
f14e6fdb
DS
2622
2623 group = peer_group_lookup (bgp, argv[1]);
2624 if (! group)
2625 {
2626 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
2627 return CMD_WARNING;
2628 }
2629
2630 ret = peer_group_listen_range_add(group, &range);
2631 return bgp_vty_return (vty, ret);
2632}
2633
2634DEFUN (no_bgp_listen_range,
2635 no_bgp_listen_range_cmd,
2636 "no bgp listen range A.B.C.D/M peer-group WORD" ,
2637 "BGP specific commands\n"
2638 "Configure BGP defaults\n"
2639 "delete a listening range for Dynamic Neighbors\n"
2640 "Remove Dynamic Neighbors listening range\n")
2641{
2642 struct bgp *bgp;
2643 struct prefix range;
2644 struct peer_group *group;
2645 afi_t afi;
2646 int ret;
2647
2648 bgp = vty->index;
2649
2650 // VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]);
2651
2652 /* Convert IP prefix string to struct prefix. */
2653 ret = str2prefix (argv[0], &range);
2654 if (! ret)
2655 {
2656 vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE);
2657 return CMD_WARNING;
2658 }
2659
2660 afi = family2afi(range.family);
2661
2662#ifdef HAVE_IPV6
2663 if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6))
2664 {
2665 vty_out (vty, "%% Malformed listen range (link-local address)%s",
2666 VTY_NEWLINE);
2667 return CMD_WARNING;
2668 }
2669#endif /* HAVE_IPV6 */
2670
2671 apply_mask (&range);
2672
2673
2674 group = peer_group_lookup (bgp, argv[1]);
2675 if (! group)
2676 {
2677 vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE);
2678 return CMD_WARNING;
2679 }
2680
2681 ret = peer_group_listen_range_del(group, &range);
2682 return bgp_vty_return (vty, ret);
2683}
2684
2685int
2686bgp_config_write_listen (struct vty *vty, struct bgp *bgp)
2687{
2688 struct peer_group *group;
2689 struct listnode *node, *nnode, *rnode, *nrnode;
2690 struct prefix *range;
2691 afi_t afi;
4690c7d7 2692 char buf[PREFIX2STR_BUFFER];
f14e6fdb
DS
2693
2694 if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT)
2695 vty_out (vty, " bgp listen limit %d%s",
2696 bgp->dynamic_neighbors_limit, VTY_NEWLINE);
2697
2698 for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group))
2699 {
2700 for (afi = AFI_IP; afi < AFI_MAX; afi++)
2701 {
2702 for (ALL_LIST_ELEMENTS (group->listen_range[afi], rnode, nrnode, range))
2703 {
2704 prefix2str(range, buf, sizeof(buf));
2705 vty_out(vty, " bgp listen range %s peer-group %s%s",
2706 buf, group->name, VTY_NEWLINE);
2707 }
2708 }
2709 }
2710
2711 return 0;
2712}
2713
2714
907f92c8
DS
2715DEFUN (bgp_disable_connected_route_check,
2716 bgp_disable_connected_route_check_cmd,
2717 "bgp disable-ebgp-connected-route-check",
2718 "BGP specific commands\n"
2719 "Disable checking if nexthop is connected on ebgp sessions\n")
2720{
2721 struct bgp *bgp;
2722
2723 bgp = vty->index;
2724 bgp_flag_set (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK);
f31fa004 2725 bgp_clear_star_soft_in (vty, bgp->name);
7aafcaca 2726
907f92c8
DS
2727 return CMD_SUCCESS;
2728}
2729
2730DEFUN (no_bgp_disable_connected_route_check,
2731 no_bgp_disable_connected_route_check_cmd,
2732 "no bgp disable-ebgp-connected-route-check",
2733 NO_STR
2734 "BGP specific commands\n"
2735 "Disable checking if nexthop is connected on ebgp sessions\n")
2736{
2737 struct bgp *bgp;
2738
2739 bgp = vty->index;
2740 bgp_flag_unset (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK);
f31fa004 2741 bgp_clear_star_soft_in (vty, bgp->name);
7aafcaca 2742
907f92c8
DS
2743 return CMD_SUCCESS;
2744}
2745
2746
718e3744 2747static int
fd79ac91 2748peer_remote_as_vty (struct vty *vty, const char *peer_str,
2749 const char *as_str, afi_t afi, safi_t safi)
718e3744 2750{
2751 int ret;
2752 struct bgp *bgp;
2753 as_t as;
0299c004 2754 int as_type = AS_SPECIFIED;
718e3744 2755 union sockunion su;
2756
2757 bgp = vty->index;
2758
0299c004
DS
2759 if (strncmp(as_str, "internal", strlen("internal")) == 0)
2760 {
2761 as = 0;
2762 as_type = AS_INTERNAL;
2763 }
2764 else if (strncmp(as_str, "external", strlen("external")) == 0)
2765 {
2766 as = 0;
2767 as_type = AS_EXTERNAL;
2768 }
2769 else
2770 {
2771 /* Get AS number. */
2772 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
2773 }
718e3744 2774
2775 /* If peer is peer group, call proper function. */
2776 ret = str2sockunion (peer_str, &su);
2777 if (ret < 0)
2778 {
a80beece 2779 /* Check for peer by interface */
0299c004 2780 ret = peer_remote_as (bgp, NULL, peer_str, &as, as_type, afi, safi);
718e3744 2781 if (ret < 0)
a80beece 2782 {
0299c004 2783 ret = peer_group_remote_as (bgp, peer_str, &as, as_type);
a80beece
DS
2784 if (ret < 0)
2785 {
2786 vty_out (vty, "%% Create the peer-group or interface first%s",
2787 VTY_NEWLINE);
2788 return CMD_WARNING;
2789 }
2790 return CMD_SUCCESS;
2791 }
718e3744 2792 }
a80beece 2793 else
718e3744 2794 {
6aeb9e78 2795 if (peer_address_self_check (bgp, &su))
a80beece
DS
2796 {
2797 vty_out (vty, "%% Can not configure the local system as neighbor%s",
2798 VTY_NEWLINE);
2799 return CMD_WARNING;
2800 }
0299c004 2801 ret = peer_remote_as (bgp, &su, NULL, &as, as_type, afi, safi);
718e3744 2802 }
2803
718e3744 2804 /* This peer belongs to peer group. */
2805 switch (ret)
2806 {
2807 case BGP_ERR_PEER_GROUP_MEMBER:
aea339f7 2808 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
718e3744 2809 return CMD_WARNING;
718e3744 2810 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
aea339f7 2811 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 2812 return CMD_WARNING;
718e3744 2813 }
2814 return bgp_vty_return (vty, ret);
2815}
2816
2817DEFUN (neighbor_remote_as,
2818 neighbor_remote_as_cmd,
0299c004 2819 NEIGHBOR_CMD2 "remote-as (" CMD_AS_RANGE "|external|internal)",
718e3744 2820 NEIGHBOR_STR
2821 NEIGHBOR_ADDR_STR2
2822 "Specify a BGP neighbor\n"
2823 AS_STR)
2824{
2825 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
2826}
6b0655a2 2827
4c48cf63
DW
2828static int
2829peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi,
b3a39dc5
DD
2830 safi_t safi, int v6only, const char *peer_group_name,
2831 const char *as_str)
a80beece 2832{
b3a39dc5
DD
2833 as_t as = 0;
2834 int as_type = AS_UNSPECIFIED;
a80beece
DS
2835 struct bgp *bgp;
2836 struct peer *peer;
2837 struct peer_group *group;
4c48cf63
DW
2838 int ret = 0;
2839 union sockunion su;
a80beece
DS
2840
2841 bgp = vty->index;
4c48cf63
DW
2842 group = peer_group_lookup (bgp, conf_if);
2843
a80beece
DS
2844 if (group)
2845 {
2846 vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE);
2847 return CMD_WARNING;
2848 }
2849
b3a39dc5
DD
2850 if (as_str)
2851 {
2852 if (strncmp(as_str, "internal", strlen("internal")) == 0)
2853 {
2854 as_type = AS_INTERNAL;
2855 }
2856 else if (strncmp(as_str, "external", strlen("external")) == 0)
2857 {
2858 as_type = AS_EXTERNAL;
2859 }
2860 else
2861 {
2862 /* Get AS number. */
2863 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
2864 as_type = AS_SPECIFIED;
2865 }
2866 }
2867
4c48cf63
DW
2868 peer = peer_lookup_by_conf_if (bgp, conf_if);
2869 if (!peer)
2870 {
2871 if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4)
2872 && afi == AFI_IP && safi == SAFI_UNICAST)
b3a39dc5
DD
2873 peer = peer_create (NULL, conf_if, bgp, bgp->as, as, as_type, 0, 0,
2874 NULL);
4c48cf63 2875 else
b3a39dc5
DD
2876 peer = peer_create (NULL, conf_if, bgp, bgp->as, as, as_type, afi, safi,
2877 NULL);
4c48cf63
DW
2878
2879 if (peer && v6only)
2880 SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY);
4a04e5f7 2881
2882 /* Request zebra to initiate IPv6 RAs on this interface. We do this
2883 * any unnumbered peer in order to not worry about run-time transitions
2884 * (e.g., peering is initially IPv4, but the IPv4 /30 or /31 address
2885 * gets deleted later etc.)
2886 */
2887 if (peer->ifp)
b3a39dc5
DD
2888 {
2889 bgp_zebra_initiate_radv (bgp, peer);
2890 }
2891 peer_flag_set (peer, PEER_FLAG_CAPABILITY_ENHE);
4c48cf63
DW
2892 }
2893 else if ((v6only && !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) ||
2894 (!v6only && CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)))
2895 {
2896 if (v6only)
2897 SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY);
2898 else
2899 UNSET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY);
2900
2901 /* v6only flag changed. Reset bgp seesion */
2902 if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status))
2903 {
2904 peer->last_reset = PEER_DOWN_V6ONLY_CHANGE;
2905 bgp_notify_send (peer, BGP_NOTIFY_CEASE,
2906 BGP_NOTIFY_CEASE_CONFIG_CHANGE);
2907 }
2908 else
2909 bgp_session_reset(peer);
2910 }
2911
a80beece
DS
2912 if (!peer)
2913 return CMD_WARNING;
2914
4c48cf63
DW
2915 if (peer_group_name)
2916 {
2917 group = peer_group_lookup (bgp, peer_group_name);
2918 if (! group)
2919 {
2920 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
2921 return CMD_WARNING;
2922 }
2923
2924 ret = peer_group_bind (bgp, &su, peer, group, &as);
2925 }
2926
2927 return bgp_vty_return (vty, ret);
a80beece
DS
2928}
2929
4c48cf63
DW
2930DEFUN (neighbor_interface_config,
2931 neighbor_interface_config_cmd,
2932 "neighbor WORD interface",
2933 NEIGHBOR_STR
2934 "Interface name or neighbor tag\n"
2935 "Enable BGP on interface\n")
2936{
2937 if (argc == 2)
b3a39dc5
DD
2938 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0,
2939 argv[1], NULL);
4c48cf63 2940 else
b3a39dc5
DD
2941 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0,
2942 NULL, NULL);
4c48cf63
DW
2943}
2944
2945ALIAS (neighbor_interface_config,
2946 neighbor_interface_config_peergroup_cmd,
2947 "neighbor WORD interface peer-group WORD",
2948 NEIGHBOR_STR
2949 "Interface name or neighbor tag\n"
2950 "Enable BGP on interface\n"
2951 "Member of the peer-group\n"
2952 "peer-group name\n")
2953
2954DEFUN (neighbor_interface_config_v6only,
2955 neighbor_interface_config_v6only_cmd,
2956 "neighbor WORD interface v6only",
2957 NEIGHBOR_STR
2958 "Interface name or neighbor tag\n"
2959 "Enable BGP on interface\n"
2960 "Enable BGP with v6 link-local only\n")
2961{
2962 if (argc == 2)
b3a39dc5
DD
2963 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1,
2964 argv[1], NULL);
4c48cf63 2965 else
b3a39dc5
DD
2966 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1,
2967 NULL, NULL);
4c48cf63
DW
2968}
2969
2970ALIAS (neighbor_interface_config_v6only,
2971 neighbor_interface_config_v6only_peergroup_cmd,
2972 "neighbor WORD interface v6only peer-group WORD",
2973 NEIGHBOR_STR
2974 "Interface name or neighbor tag\n"
2975 "Enable BGP on interface\n"
2976 "Enable BGP with v6 link-local only\n"
2977 "Member of the peer-group\n"
2978 "peer-group name\n")
a80beece 2979
b3a39dc5
DD
2980DEFUN (neighbor_interface_config_remote_as,
2981 neighbor_interface_config_remote_as_cmd,
2982 "neighbor WORD interface remote-as (" CMD_AS_RANGE "|external|internal)",
2983 NEIGHBOR_STR
2984 "Interface name or neighbor tag\n"
2985 "Enable BGP on interface\n"
2986 AS_STR)
2987{
2988 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0,
2989 NULL, argv[1]);
2990}
2991
2992DEFUN (neighbor_interface_v6only_config_remote_as,
2993 neighbor_interface_v6only_config_remote_as_cmd,
2994 "neighbor WORD interface v6only remote-as (" CMD_AS_RANGE "|external|internal)",
2995 NEIGHBOR_STR
2996 "Interface name or neighbor tag\n"
2997 "Enable BGP on interface\n"
2998 AS_STR)
2999{
3000 return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1,
3001 NULL, argv[1]);
3002}
3003
718e3744 3004DEFUN (neighbor_peer_group,
3005 neighbor_peer_group_cmd,
3006 "neighbor WORD peer-group",
3007 NEIGHBOR_STR
a80beece 3008 "Interface name or neighbor tag\n"
718e3744 3009 "Configure peer-group\n")
3010{
3011 struct bgp *bgp;
a80beece 3012 struct peer *peer;
718e3744 3013 struct peer_group *group;
3014
3015 bgp = vty->index;
a80beece
DS
3016 peer = peer_lookup_by_conf_if (bgp, argv[0]);
3017 if (peer)
3018 {
3019 vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE);
3020 return CMD_WARNING;
3021 }
718e3744 3022
3023 group = peer_group_get (bgp, argv[0]);
3024 if (! group)
3025 return CMD_WARNING;
3026
3027 return CMD_SUCCESS;
3028}
3029
3030DEFUN (no_neighbor,
3031 no_neighbor_cmd,
3032 NO_NEIGHBOR_CMD2,
3033 NO_STR
3034 NEIGHBOR_STR
3035 NEIGHBOR_ADDR_STR2)
3036{
3037 int ret;
3038 union sockunion su;
3039 struct peer_group *group;
3040 struct peer *peer;
1ff9a340 3041 struct peer *other;
718e3744 3042
3043 ret = str2sockunion (argv[0], &su);
3044 if (ret < 0)
3045 {
a80beece
DS
3046 /* look up for neighbor by interface name config. */
3047 peer = peer_lookup_by_conf_if (vty->index, argv[0]);
3048 if (peer)
3049 {
4a04e5f7 3050 /* Request zebra to terminate IPv6 RAs on this interface. */
3051 if (peer->ifp)
3052 bgp_zebra_terminate_radv (peer->bgp, peer);
a80beece
DS
3053 peer_delete (peer);
3054 return CMD_SUCCESS;
3055 }
3056
718e3744 3057 group = peer_group_lookup (vty->index, argv[0]);
3058 if (group)
3059 peer_group_delete (group);
3060 else
3061 {
3062 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
3063 return CMD_WARNING;
3064 }
3065 }
3066 else
3067 {
3068 peer = peer_lookup (vty->index, &su);
3069 if (peer)
1ff9a340 3070 {
f14e6fdb
DS
3071 if (peer_dynamic_neighbor (peer))
3072 {
3073 vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
3074 VTY_NEWLINE);
3075 return CMD_WARNING;
3076 }
3077
1ff9a340
DS
3078 other = peer->doppelganger;
3079 peer_delete (peer);
3080 if (other && other->status != Deleted)
3081 peer_delete(other);
3082 }
718e3744 3083 }
3084
3085 return CMD_SUCCESS;
3086}
3087
3088ALIAS (no_neighbor,
3089 no_neighbor_remote_as_cmd,
0299c004 3090 NO_NEIGHBOR_CMD "remote-as (" CMD_AS_RANGE "|internal|external)",
718e3744 3091 NO_STR
3092 NEIGHBOR_STR
3093 NEIGHBOR_ADDR_STR
3094 "Specify a BGP neighbor\n"
3095 AS_STR)
3096
a80beece
DS
3097DEFUN (no_neighbor_interface_config,
3098 no_neighbor_interface_config_cmd,
4c48cf63 3099 "no neighbor WORD interface",
a80beece
DS
3100 NO_STR
3101 NEIGHBOR_STR
3102 "Interface name\n"
3103 "Configure BGP on interface\n")
3104{
3105 struct peer *peer;
3106
3107 /* look up for neighbor by interface name config. */
3108 peer = peer_lookup_by_conf_if (vty->index, argv[0]);
3109 if (peer)
3110 {
4a04e5f7 3111 /* Request zebra to terminate IPv6 RAs on this interface. */
3112 if (peer->ifp)
3113 bgp_zebra_terminate_radv (peer->bgp, peer);
a80beece
DS
3114 peer_delete (peer);
3115 }
3116 else
3117 {
3118 vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE);
3119 return CMD_WARNING;
3120 }
3121 return CMD_SUCCESS;
3122}
3123
4c48cf63
DW
3124ALIAS (no_neighbor_interface_config,
3125 no_neighbor_interface_config_peergroup_cmd,
3126 "no neighbor WORD interface peer-group WORD",
3127 NO_STR
3128 NEIGHBOR_STR
3129 "Interface name\n"
3130 "Configure BGP on interface\n"
3131 "Member of the peer-group\n"
3132 "peer-group name\n")
3133
3134ALIAS (no_neighbor_interface_config,
3135 no_neighbor_interface_config_v6only_cmd,
3136 "no neighbor WORD interface v6only",
3137 NO_STR
3138 NEIGHBOR_STR
3139 "Interface name\n"
3140 "Configure BGP on interface\n"
3141 "Enable BGP with v6 link-local only\n")
3142
3143ALIAS (no_neighbor_interface_config,
3144 no_neighbor_interface_config_v6only_peergroup_cmd,
3145 "no neighbor WORD interface v6only peer-group WORD",
3146 NO_STR
3147 NEIGHBOR_STR
3148 "Interface name\n"
3149 "Configure BGP on interface\n"
3150 "Enable BGP with v6 link-local only\n"
3151 "Member of the peer-group\n"
3152 "peer-group name\n")
3153
b3a39dc5
DD
3154ALIAS (no_neighbor_interface_config,
3155 no_neighbor_interface_config_remote_as_cmd,
3156 "no neighbor WORD interface remote-as (" CMD_AS_RANGE "|internal|external)",
3157 NO_STR
3158 NEIGHBOR_STR
3159 "Interface name\n"
3160 "Configure BGP on interface\n"
3161 AS_STR)
3162
3163ALIAS (no_neighbor_interface_config,
3164 no_neighbor_interface_config_v6only_remote_as_cmd,
3165 "no neighbor WORD interface v6only remote-as (" CMD_AS_RANGE "|internal|external)",
3166 NO_STR
3167 NEIGHBOR_STR
3168 "Interface name\n"
3169 "Configure BGP on interface\n"
3170 "Enable BGP with v6 link-local only\n"
3171 AS_STR)
4c48cf63 3172
718e3744 3173DEFUN (no_neighbor_peer_group,
3174 no_neighbor_peer_group_cmd,
3175 "no neighbor WORD peer-group",
3176 NO_STR
3177 NEIGHBOR_STR
3178 "Neighbor tag\n"
3179 "Configure peer-group\n")
3180{
3181 struct peer_group *group;
3182
3183 group = peer_group_lookup (vty->index, argv[0]);
3184 if (group)
3185 peer_group_delete (group);
3186 else
3187 {
3188 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
3189 return CMD_WARNING;
3190 }
3191 return CMD_SUCCESS;
3192}
3193
a80beece
DS
3194DEFUN (no_neighbor_interface_peer_group_remote_as,
3195 no_neighbor_interface_peer_group_remote_as_cmd,
0299c004 3196 "no neighbor WORD remote-as (" CMD_AS_RANGE "|internal|external)",
718e3744 3197 NO_STR
3198 NEIGHBOR_STR
a80beece 3199 "Interface name or neighbor tag\n"
718e3744 3200 "Specify a BGP neighbor\n"
3201 AS_STR)
3202{
3203 struct peer_group *group;
a80beece
DS
3204 struct peer *peer;
3205
3206 /* look up for neighbor by interface name config. */
3207 peer = peer_lookup_by_conf_if (vty->index, argv[0]);
3208 if (peer)
3209 {
0299c004 3210 peer_as_change (peer, 0, AS_SPECIFIED);
a80beece
DS
3211 return CMD_SUCCESS;
3212 }
718e3744 3213
3214 group = peer_group_lookup (vty->index, argv[0]);
3215 if (group)
3216 peer_group_remote_as_delete (group);
3217 else
3218 {
a80beece 3219 vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE);
718e3744 3220 return CMD_WARNING;
3221 }
3222 return CMD_SUCCESS;
3223}
6b0655a2 3224
718e3744 3225DEFUN (neighbor_local_as,
3226 neighbor_local_as_cmd,
320da874 3227 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
718e3744 3228 NEIGHBOR_STR
3229 NEIGHBOR_ADDR_STR2
3230 "Specify a local-as number\n"
3231 "AS number used as local AS\n")
3232{
3233 struct peer *peer;
3234 int ret;
3235
3236 peer = peer_and_group_lookup_vty (vty, argv[0]);
3237 if (! peer)
3238 return CMD_WARNING;
3239
9d3f9705 3240 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
718e3744 3241 return bgp_vty_return (vty, ret);
3242}
3243
3244DEFUN (neighbor_local_as_no_prepend,
3245 neighbor_local_as_no_prepend_cmd,
320da874 3246 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
718e3744 3247 NEIGHBOR_STR
3248 NEIGHBOR_ADDR_STR2
3249 "Specify a local-as number\n"
3250 "AS number used as local AS\n"
3251 "Do not prepend local-as to updates from ebgp peers\n")
3252{
3253 struct peer *peer;
3254 int ret;
3255
3256 peer = peer_and_group_lookup_vty (vty, argv[0]);
3257 if (! peer)
3258 return CMD_WARNING;
3259
9d3f9705 3260 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
718e3744 3261 return bgp_vty_return (vty, ret);
3262}
3263
9d3f9705
AC
3264DEFUN (neighbor_local_as_no_prepend_replace_as,
3265 neighbor_local_as_no_prepend_replace_as_cmd,
3266 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
3267 NEIGHBOR_STR
3268 NEIGHBOR_ADDR_STR2
3269 "Specify a local-as number\n"
3270 "AS number used as local AS\n"
3271 "Do not prepend local-as to updates from ebgp peers\n"
3272 "Do not prepend local-as to updates from ibgp peers\n")
3273{
3274 struct peer *peer;
3275 int ret;
3276
3277 peer = peer_and_group_lookup_vty (vty, argv[0]);
3278 if (! peer)
3279 return CMD_WARNING;
3280
3281 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
3282 return bgp_vty_return (vty, ret);
3283}
3284
3285
718e3744 3286DEFUN (no_neighbor_local_as,
3287 no_neighbor_local_as_cmd,
3288 NO_NEIGHBOR_CMD2 "local-as",
3289 NO_STR
3290 NEIGHBOR_STR
3291 NEIGHBOR_ADDR_STR2
3292 "Specify a local-as number\n")
3293{
3294 struct peer *peer;
3295 int ret;
3296
3297 peer = peer_and_group_lookup_vty (vty, argv[0]);
3298 if (! peer)
3299 return CMD_WARNING;
3300
3301 ret = peer_local_as_unset (peer);
3302 return bgp_vty_return (vty, ret);
3303}
3304
3305ALIAS (no_neighbor_local_as,
3306 no_neighbor_local_as_val_cmd,
320da874 3307 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
718e3744 3308 NO_STR
3309 NEIGHBOR_STR
3310 NEIGHBOR_ADDR_STR2
3311 "Specify a local-as number\n"
3312 "AS number used as local AS\n")
3313
3314ALIAS (no_neighbor_local_as,
3315 no_neighbor_local_as_val2_cmd,
320da874 3316 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
718e3744 3317 NO_STR
3318 NEIGHBOR_STR
3319 NEIGHBOR_ADDR_STR2
3320 "Specify a local-as number\n"
3321 "AS number used as local AS\n"
3322 "Do not prepend local-as to updates from ebgp peers\n")
9d3f9705
AC
3323
3324ALIAS (no_neighbor_local_as,
3325 no_neighbor_local_as_val3_cmd,
3326 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
3327 NO_STR
3328 NEIGHBOR_STR
3329 NEIGHBOR_ADDR_STR2
3330 "Specify a local-as number\n"
3331 "AS number used as local AS\n"
3332 "Do not prepend local-as to updates from ebgp peers\n"
3333 "Do not prepend local-as to updates from ibgp peers\n")
6b0655a2 3334
3f9c7369
DS
3335DEFUN (neighbor_solo,
3336 neighbor_solo_cmd,
3337 NEIGHBOR_CMD2 "solo",
3338 NEIGHBOR_STR
3339 NEIGHBOR_ADDR_STR2
3340 "Solo peer - part of its own update group\n")
3341{
3342 struct peer *peer;
3343 int ret;
3344
3345 peer = peer_and_group_lookup_vty (vty, argv[0]);
3346 if (! peer)
3347 return CMD_WARNING;
3348
3349 ret = update_group_adjust_soloness(peer, 1);
3350 return bgp_vty_return (vty, ret);
3351}
3352
3353DEFUN (no_neighbor_solo,
3354 no_neighbor_solo_cmd,
3355 NO_NEIGHBOR_CMD2 "solo",
3356 NO_STR
3357 NEIGHBOR_STR
3358 NEIGHBOR_ADDR_STR2
3359 "Solo peer - part of its own update group\n")
3360{
3361 struct peer *peer;
3362 int ret;
3363
3364 peer = peer_and_group_lookup_vty (vty, argv[0]);
3365 if (! peer)
3366 return CMD_WARNING;
3367
3368 ret = update_group_adjust_soloness(peer, 0);
3369 return bgp_vty_return (vty, ret);
3370}
3371
0df7c91f
PJ
3372DEFUN (neighbor_password,
3373 neighbor_password_cmd,
3374 NEIGHBOR_CMD2 "password LINE",
3375 NEIGHBOR_STR
3376 NEIGHBOR_ADDR_STR2
3377 "Set a password\n"
3378 "The password\n")
3379{
3380 struct peer *peer;
3381 int ret;
3382
3383 peer = peer_and_group_lookup_vty (vty, argv[0]);
3384 if (! peer)
3385 return CMD_WARNING;
3386
3387 ret = peer_password_set (peer, argv[1]);
3388 return bgp_vty_return (vty, ret);
3389}
3390
3391DEFUN (no_neighbor_password,
3392 no_neighbor_password_cmd,
3393 NO_NEIGHBOR_CMD2 "password",
3394 NO_STR
3395 NEIGHBOR_STR
3396 NEIGHBOR_ADDR_STR2
3397 "Set a password\n")
3398{
3399 struct peer *peer;
3400 int ret;
3401
3402 peer = peer_and_group_lookup_vty (vty, argv[0]);
3403 if (! peer)
3404 return CMD_WARNING;
3405
3406 ret = peer_password_unset (peer);
3407 return bgp_vty_return (vty, ret);
3408}
6b0655a2 3409
813d4307
DW
3410ALIAS (no_neighbor_password,
3411 no_neighbor_password_val_cmd,
3412 NO_NEIGHBOR_CMD2 "password LINE",
3413 NO_STR
3414 NEIGHBOR_STR
3415 NEIGHBOR_ADDR_STR2
3416 "Set a password\n"
3417 "The password\n")
3418
718e3744 3419DEFUN (neighbor_activate,
3420 neighbor_activate_cmd,
3421 NEIGHBOR_CMD2 "activate",
3422 NEIGHBOR_STR
3423 NEIGHBOR_ADDR_STR2
3424 "Enable the Address Family for this Neighbor\n")
3425{
c8560b44 3426 int ret;
718e3744 3427 struct peer *peer;
3428
3429 peer = peer_and_group_lookup_vty (vty, argv[0]);
3430 if (! peer)
3431 return CMD_WARNING;
3432
c8560b44 3433 ret = peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
718e3744 3434
c8560b44
DW
3435 if (ret)
3436 return CMD_WARNING;
718e3744 3437 return CMD_SUCCESS;
3438}
3439
3440DEFUN (no_neighbor_activate,
3441 no_neighbor_activate_cmd,
3442 NO_NEIGHBOR_CMD2 "activate",
3443 NO_STR
3444 NEIGHBOR_STR
3445 NEIGHBOR_ADDR_STR2
3446 "Enable the Address Family for this Neighbor\n")
3447{
3448 int ret;
3449 struct peer *peer;
3450
3451 /* Lookup peer. */
3452 peer = peer_and_group_lookup_vty (vty, argv[0]);
3453 if (! peer)
3454 return CMD_WARNING;
3455
3456 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
3457
c8560b44
DW
3458 if (ret)
3459 return CMD_WARNING;
3460 return CMD_SUCCESS;
718e3744 3461}
6b0655a2 3462
718e3744 3463DEFUN (neighbor_set_peer_group,
3464 neighbor_set_peer_group_cmd,
a80beece 3465 NEIGHBOR_CMD2 "peer-group WORD",
718e3744 3466 NEIGHBOR_STR
a80beece 3467 NEIGHBOR_ADDR_STR2
718e3744 3468 "Member of the peer-group\n"
3469 "peer-group name\n")
3470{
3471 int ret;
3472 as_t as;
3473 union sockunion su;
3474 struct bgp *bgp;
a80beece 3475 struct peer *peer;
718e3744 3476 struct peer_group *group;
3477
3478 bgp = vty->index;
a80beece 3479 peer = NULL;
718e3744 3480
3481 ret = str2sockunion (argv[0], &su);
3482 if (ret < 0)
3483 {
a80beece
DS
3484 peer = peer_lookup_by_conf_if (bgp, argv[0]);
3485 if (!peer)
3486 {
3487 vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE);
3488 return CMD_WARNING;
3489 }
3490 }
3491 else
3492 {
6aeb9e78 3493 if (peer_address_self_check (bgp, &su))
a80beece
DS
3494 {
3495 vty_out (vty, "%% Can not configure the local system as neighbor%s",
3496 VTY_NEWLINE);
3497 return CMD_WARNING;
3498 }
f14e6fdb
DS
3499
3500 /* Disallow for dynamic neighbor. */
3501 peer = peer_lookup (bgp, &su);
3502 if (peer && peer_dynamic_neighbor (peer))
3503 {
3504 vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s",
3505 VTY_NEWLINE);
3506 return CMD_WARNING;
3507 }
718e3744 3508 }
3509
3510 group = peer_group_lookup (bgp, argv[1]);
3511 if (! group)
3512 {
3513 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
3514 return CMD_WARNING;
3515 }
3516
c8560b44 3517 ret = peer_group_bind (bgp, &su, peer, group, &as);
718e3744 3518
3519 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
3520 {
aea339f7 3521 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 3522 return CMD_WARNING;
3523 }
3524
3525 return bgp_vty_return (vty, ret);
3526}
3527
3528DEFUN (no_neighbor_set_peer_group,
3529 no_neighbor_set_peer_group_cmd,
a80beece 3530 NO_NEIGHBOR_CMD2 "peer-group WORD",
718e3744 3531 NO_STR
3532 NEIGHBOR_STR
a80beece 3533 NEIGHBOR_ADDR_STR2
718e3744 3534 "Member of the peer-group\n"
3535 "peer-group name\n")
3536{
3537 int ret;
3538 struct bgp *bgp;
3539 struct peer *peer;
3540 struct peer_group *group;
3541
3542 bgp = vty->index;
3543
3544 peer = peer_lookup_vty (vty, argv[0]);
3545 if (! peer)
3546 return CMD_WARNING;
3547
3548 group = peer_group_lookup (bgp, argv[1]);
3549 if (! group)
3550 {
3551 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
3552 return CMD_WARNING;
3553 }
3554
c8560b44 3555 ret = peer_group_unbind (bgp, peer, group);
718e3744 3556
3557 return bgp_vty_return (vty, ret);
3558}
6b0655a2 3559
94f2b392 3560static int
fd79ac91 3561peer_flag_modify_vty (struct vty *vty, const char *ip_str,
3562 u_int16_t flag, int set)
718e3744 3563{
3564 int ret;
3565 struct peer *peer;
3566
3567 peer = peer_and_group_lookup_vty (vty, ip_str);
3568 if (! peer)
3569 return CMD_WARNING;
3570
8cdabf90
SK
3571 /*
3572 * If 'neighbor <interface>', then this is for directly connected peers,
3573 * we should not accept disable-connected-check.
3574 */
3575 if (peer->conf_if && (flag == PEER_FLAG_DISABLE_CONNECTED_CHECK)) {
3576 vty_out (vty, "%s is directly connected peer, cannot accept disable-"
3577 "connected-check%s", ip_str, VTY_NEWLINE);
3578 return CMD_WARNING;
3579 }
3580
718e3744 3581 if (set)
3582 ret = peer_flag_set (peer, flag);
3583 else
3584 ret = peer_flag_unset (peer, flag);
3585
3586 return bgp_vty_return (vty, ret);
3587}
3588
94f2b392 3589static int
fd79ac91 3590peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
718e3744 3591{
3592 return peer_flag_modify_vty (vty, ip_str, flag, 1);
3593}
3594
94f2b392 3595static int
fd79ac91 3596peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
718e3744 3597{
3598 return peer_flag_modify_vty (vty, ip_str, flag, 0);
3599}
3600
3601/* neighbor passive. */
3602DEFUN (neighbor_passive,
3603 neighbor_passive_cmd,
3604 NEIGHBOR_CMD2 "passive",
3605 NEIGHBOR_STR
3606 NEIGHBOR_ADDR_STR2
3607 "Don't send open messages to this neighbor\n")
3608{
3609 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
3610}
3611
3612DEFUN (no_neighbor_passive,
3613 no_neighbor_passive_cmd,
3614 NO_NEIGHBOR_CMD2 "passive",
3615 NO_STR
3616 NEIGHBOR_STR
3617 NEIGHBOR_ADDR_STR2
3618 "Don't send open messages to this neighbor\n")
3619{
3620 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
3621}
6b0655a2 3622
718e3744 3623/* neighbor shutdown. */
3624DEFUN (neighbor_shutdown,
3625 neighbor_shutdown_cmd,
3626 NEIGHBOR_CMD2 "shutdown",
3627 NEIGHBOR_STR
3628 NEIGHBOR_ADDR_STR2
3629 "Administratively shut down this neighbor\n")
3630{
3631 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
3632}
3633
3634DEFUN (no_neighbor_shutdown,
3635 no_neighbor_shutdown_cmd,
3636 NO_NEIGHBOR_CMD2 "shutdown",
3637 NO_STR
3638 NEIGHBOR_STR
3639 NEIGHBOR_ADDR_STR2
3640 "Administratively shut down this neighbor\n")
3641{
3642 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
3643}
6b0655a2 3644
718e3744 3645/* neighbor capability dynamic. */
3646DEFUN (neighbor_capability_dynamic,
3647 neighbor_capability_dynamic_cmd,
3648 NEIGHBOR_CMD2 "capability dynamic",
3649 NEIGHBOR_STR
3650 NEIGHBOR_ADDR_STR2
3651 "Advertise capability to the peer\n"
3652 "Advertise dynamic capability to this neighbor\n")
3653{
3654 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
3655}
3656
3657DEFUN (no_neighbor_capability_dynamic,
3658 no_neighbor_capability_dynamic_cmd,
3659 NO_NEIGHBOR_CMD2 "capability dynamic",
3660 NO_STR
3661 NEIGHBOR_STR
3662 NEIGHBOR_ADDR_STR2
3663 "Advertise capability to the peer\n"
3664 "Advertise dynamic capability to this neighbor\n")
3665{
3666 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
3667}
6b0655a2 3668
718e3744 3669/* neighbor dont-capability-negotiate */
3670DEFUN (neighbor_dont_capability_negotiate,
3671 neighbor_dont_capability_negotiate_cmd,
3672 NEIGHBOR_CMD2 "dont-capability-negotiate",
3673 NEIGHBOR_STR
3674 NEIGHBOR_ADDR_STR2
3675 "Do not perform capability negotiation\n")
3676{
3677 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
3678}
3679
3680DEFUN (no_neighbor_dont_capability_negotiate,
3681 no_neighbor_dont_capability_negotiate_cmd,
3682 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
3683 NO_STR
3684 NEIGHBOR_STR
3685 NEIGHBOR_ADDR_STR2
3686 "Do not perform capability negotiation\n")
3687{
3688 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
3689}
6b0655a2 3690
8a92a8a0
DS
3691/* neighbor capability extended next hop encoding */
3692DEFUN (neighbor_capability_enhe,
3693 neighbor_capability_enhe_cmd,
3694 NEIGHBOR_CMD2 "capability extended-nexthop",
3695 NEIGHBOR_STR
3696 NEIGHBOR_ADDR_STR2
3697 "Advertise capability to the peer\n"
3698 "Advertise extended next-hop capability to the peer\n")
3699{
3700 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE);
3701}
3702
3703DEFUN (no_neighbor_capability_enhe,
3704 no_neighbor_capability_enhe_cmd,
3705 NO_NEIGHBOR_CMD2 "capability extended-nexthop",
3706 NO_STR
3707 NEIGHBOR_STR
3708 NEIGHBOR_ADDR_STR2
3709 "Advertise capability to the peer\n"
3710 "Advertise extended next-hop capability to the peer\n")
3711{
3712 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE);
3713}
3714
94f2b392 3715static int
fd79ac91 3716peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
fee0f4c6 3717 safi_t safi, u_int32_t flag, int set)
718e3744 3718{
3719 int ret;
3720 struct peer *peer;
3721
3722 peer = peer_and_group_lookup_vty (vty, peer_str);
3723 if (! peer)
3724 return CMD_WARNING;
3725
3726 if (set)
3727 ret = peer_af_flag_set (peer, afi, safi, flag);
3728 else
3729 ret = peer_af_flag_unset (peer, afi, safi, flag);
3730
3731 return bgp_vty_return (vty, ret);
3732}
3733
94f2b392 3734static int
fd79ac91 3735peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
fee0f4c6 3736 safi_t safi, u_int32_t flag)
718e3744 3737{
3738 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
3739}
3740
94f2b392 3741static int
fd79ac91 3742peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
fee0f4c6 3743 safi_t safi, u_int32_t flag)
718e3744 3744{
3745 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
3746}
6b0655a2 3747
718e3744 3748/* neighbor capability orf prefix-list. */
3749DEFUN (neighbor_capability_orf_prefix,
3750 neighbor_capability_orf_prefix_cmd,
3751 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
3752 NEIGHBOR_STR
3753 NEIGHBOR_ADDR_STR2
3754 "Advertise capability to the peer\n"
3755 "Advertise ORF capability to the peer\n"
3756 "Advertise prefixlist ORF capability to this neighbor\n"
3757 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3758 "Capability to RECEIVE the ORF from this neighbor\n"
3759 "Capability to SEND the ORF to this neighbor\n")
3760{
3761 u_int16_t flag = 0;
3762
3763 if (strncmp (argv[1], "s", 1) == 0)
3764 flag = PEER_FLAG_ORF_PREFIX_SM;
3765 else if (strncmp (argv[1], "r", 1) == 0)
3766 flag = PEER_FLAG_ORF_PREFIX_RM;
3767 else if (strncmp (argv[1], "b", 1) == 0)
3768 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
3769 else
3770 return CMD_WARNING;
3771
3772 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3773 bgp_node_safi (vty), flag);
3774}
3775
3776DEFUN (no_neighbor_capability_orf_prefix,
3777 no_neighbor_capability_orf_prefix_cmd,
3778 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
3779 NO_STR
3780 NEIGHBOR_STR
3781 NEIGHBOR_ADDR_STR2
3782 "Advertise capability to the peer\n"
3783 "Advertise ORF capability to the peer\n"
3784 "Advertise prefixlist ORF capability to this neighbor\n"
3785 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3786 "Capability to RECEIVE the ORF from this neighbor\n"
3787 "Capability to SEND the ORF to this neighbor\n")
3788{
3789 u_int16_t flag = 0;
3790
3791 if (strncmp (argv[1], "s", 1) == 0)
3792 flag = PEER_FLAG_ORF_PREFIX_SM;
3793 else if (strncmp (argv[1], "r", 1) == 0)
3794 flag = PEER_FLAG_ORF_PREFIX_RM;
3795 else if (strncmp (argv[1], "b", 1) == 0)
3796 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
3797 else
3798 return CMD_WARNING;
3799
3800 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3801 bgp_node_safi (vty), flag);
3802}
6b0655a2 3803
718e3744 3804/* neighbor next-hop-self. */
3805DEFUN (neighbor_nexthop_self,
3806 neighbor_nexthop_self_cmd,
a538debe 3807 NEIGHBOR_CMD2 "next-hop-self",
718e3744 3808 NEIGHBOR_STR
3809 NEIGHBOR_ADDR_STR2
a538debe 3810 "Disable the next hop calculation for this neighbor\n")
718e3744 3811{
a538debe
DS
3812 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3813 bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
3814}
9e7a53c1 3815
a538debe
DS
3816/* neighbor next-hop-self. */
3817DEFUN (neighbor_nexthop_self_force,
3818 neighbor_nexthop_self_force_cmd,
3819 NEIGHBOR_CMD2 "next-hop-self force",
3820 NEIGHBOR_STR
3821 NEIGHBOR_ADDR_STR2
3822 "Disable the next hop calculation for this neighbor\n"
3823 "Set the next hop to self for reflected routes\n")
3824{
3825 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3826 bgp_node_safi (vty),
88b8ed8d 3827 PEER_FLAG_FORCE_NEXTHOP_SELF);
718e3744 3828}
3829
3830DEFUN (no_neighbor_nexthop_self,
3831 no_neighbor_nexthop_self_cmd,
a538debe 3832 NO_NEIGHBOR_CMD2 "next-hop-self",
718e3744 3833 NO_STR
3834 NEIGHBOR_STR
3835 NEIGHBOR_ADDR_STR2
a538debe 3836 "Disable the next hop calculation for this neighbor\n")
718e3744 3837{
3838 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
9e7a53c1 3839 bgp_node_safi (vty),
88b8ed8d 3840 PEER_FLAG_NEXTHOP_SELF);
718e3744 3841}
6b0655a2 3842
88b8ed8d 3843DEFUN (no_neighbor_nexthop_self_force,
a538debe
DS
3844 no_neighbor_nexthop_self_force_cmd,
3845 NO_NEIGHBOR_CMD2 "next-hop-self force",
3846 NO_STR
3847 NEIGHBOR_STR
3848 NEIGHBOR_ADDR_STR2
3849 "Disable the next hop calculation for this neighbor\n"
3850 "Set the next hop to self for reflected routes\n")
88b8ed8d
DW
3851{
3852 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3853 bgp_node_safi (vty),
3854 PEER_FLAG_FORCE_NEXTHOP_SELF);
3855}
a538debe 3856
c7122e14
DS
3857/* neighbor as-override */
3858DEFUN (neighbor_as_override,
3859 neighbor_as_override_cmd,
3860 NEIGHBOR_CMD2 "as-override",
3861 NEIGHBOR_STR
3862 NEIGHBOR_ADDR_STR2
3863 "Override ASNs in outbound updates if aspath equals remote-as\n")
3864{
3865 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3866 bgp_node_safi (vty),
3867 PEER_FLAG_AS_OVERRIDE);
3868}
3869
3870DEFUN (no_neighbor_as_override,
3871 no_neighbor_as_override_cmd,
3872 NO_NEIGHBOR_CMD2 "as-override",
3873 NO_STR
3874 NEIGHBOR_STR
3875 NEIGHBOR_ADDR_STR2
3876 "Override ASNs in outbound updates if aspath equals remote-as\n")
3877{
3878 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3879 bgp_node_safi (vty),
3880 PEER_FLAG_AS_OVERRIDE);
3881}
3882
718e3744 3883/* neighbor remove-private-AS. */
3884DEFUN (neighbor_remove_private_as,
3885 neighbor_remove_private_as_cmd,
3886 NEIGHBOR_CMD2 "remove-private-AS",
3887 NEIGHBOR_STR
3888 NEIGHBOR_ADDR_STR2
5000f21c 3889 "Remove private ASNs in outbound updates\n")
718e3744 3890{
3891 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3892 bgp_node_safi (vty),
3893 PEER_FLAG_REMOVE_PRIVATE_AS);
3894}
3895
5000f21c
DS
3896DEFUN (neighbor_remove_private_as_all,
3897 neighbor_remove_private_as_all_cmd,
3898 NEIGHBOR_CMD2 "remove-private-AS all",
3899 NEIGHBOR_STR
3900 NEIGHBOR_ADDR_STR2
3901 "Remove private ASNs in outbound updates\n"
3902 "Apply to all AS numbers")
3903{
5000f21c
DS
3904 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3905 bgp_node_safi (vty),
5000f21c
DS
3906 PEER_FLAG_REMOVE_PRIVATE_AS_ALL);
3907}
3908
3909DEFUN (neighbor_remove_private_as_replace_as,
3910 neighbor_remove_private_as_replace_as_cmd,
3911 NEIGHBOR_CMD2 "remove-private-AS replace-AS",
3912 NEIGHBOR_STR
3913 NEIGHBOR_ADDR_STR2
3914 "Remove private ASNs in outbound updates\n"
3915 "Replace private ASNs with our ASN in outbound updates\n")
3916{
5000f21c
DS
3917 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3918 bgp_node_safi (vty),
5000f21c
DS
3919 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE);
3920}
3921
3922DEFUN (neighbor_remove_private_as_all_replace_as,
3923 neighbor_remove_private_as_all_replace_as_cmd,
3924 NEIGHBOR_CMD2 "remove-private-AS all replace-AS",
3925 NEIGHBOR_STR
3926 NEIGHBOR_ADDR_STR2
3927 "Remove private ASNs in outbound updates\n"
3928 "Apply to all AS numbers"
3929 "Replace private ASNs with our ASN in outbound updates\n")
3930{
3931 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3932 bgp_node_safi (vty),
88b8ed8d 3933 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE);
5000f21c
DS
3934}
3935
718e3744 3936DEFUN (no_neighbor_remove_private_as,
3937 no_neighbor_remove_private_as_cmd,
3938 NO_NEIGHBOR_CMD2 "remove-private-AS",
3939 NO_STR
3940 NEIGHBOR_STR
3941 NEIGHBOR_ADDR_STR2
5000f21c 3942 "Remove private ASNs in outbound updates\n")
718e3744 3943{
3944 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3945 bgp_node_safi (vty),
88b8ed8d 3946 PEER_FLAG_REMOVE_PRIVATE_AS);
718e3744 3947}
6b0655a2 3948
88b8ed8d 3949DEFUN (no_neighbor_remove_private_as_all,
5000f21c
DS
3950 no_neighbor_remove_private_as_all_cmd,
3951 NO_NEIGHBOR_CMD2 "remove-private-AS all",
3952 NO_STR
3953 NEIGHBOR_STR
3954 NEIGHBOR_ADDR_STR2
3955 "Remove private ASNs in outbound updates\n"
3956 "Apply to all AS numbers")
88b8ed8d
DW
3957{
3958 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3959 bgp_node_safi (vty),
3960 PEER_FLAG_REMOVE_PRIVATE_AS_ALL);
3961}
5000f21c 3962
88b8ed8d 3963DEFUN (no_neighbor_remove_private_as_replace_as,
5000f21c
DS
3964 no_neighbor_remove_private_as_replace_as_cmd,
3965 NO_NEIGHBOR_CMD2 "remove-private-AS replace-AS",
3966 NO_STR
3967 NEIGHBOR_STR
3968 NEIGHBOR_ADDR_STR2
3969 "Remove private ASNs in outbound updates\n"
3970 "Replace private ASNs with our ASN in outbound updates\n")
88b8ed8d
DW
3971{
3972 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3973 bgp_node_safi (vty),
3974 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE);
3975}
5000f21c 3976
88b8ed8d 3977DEFUN (no_neighbor_remove_private_as_all_replace_as,
5000f21c
DS
3978 no_neighbor_remove_private_as_all_replace_as_cmd,
3979 NO_NEIGHBOR_CMD2 "remove-private-AS all replace-AS",
3980 NO_STR
3981 NEIGHBOR_STR
3982 NEIGHBOR_ADDR_STR2
3983 "Remove private ASNs in outbound updates\n"
3984 "Apply to all AS numbers"
3985 "Replace private ASNs with our ASN in outbound updates\n")
88b8ed8d
DW
3986{
3987 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3988 bgp_node_safi (vty),
3989 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE);
3990}
5000f21c
DS
3991
3992
718e3744 3993/* neighbor send-community. */
3994DEFUN (neighbor_send_community,
3995 neighbor_send_community_cmd,
3996 NEIGHBOR_CMD2 "send-community",
3997 NEIGHBOR_STR
3998 NEIGHBOR_ADDR_STR2
3999 "Send Community attribute to this neighbor\n")
4000{
4001 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4002 bgp_node_safi (vty),
4003 PEER_FLAG_SEND_COMMUNITY);
4004}
4005
4006DEFUN (no_neighbor_send_community,
4007 no_neighbor_send_community_cmd,
4008 NO_NEIGHBOR_CMD2 "send-community",
4009 NO_STR
4010 NEIGHBOR_STR
4011 NEIGHBOR_ADDR_STR2
4012 "Send Community attribute to this neighbor\n")
4013{
4014 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4015 bgp_node_safi (vty),
4016 PEER_FLAG_SEND_COMMUNITY);
4017}
6b0655a2 4018
718e3744 4019/* neighbor send-community extended. */
4020DEFUN (neighbor_send_community_type,
4021 neighbor_send_community_type_cmd,
4022 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
4023 NEIGHBOR_STR
4024 NEIGHBOR_ADDR_STR2
4025 "Send Community attribute to this neighbor\n"
4026 "Send Standard and Extended Community attributes\n"
4027 "Send Extended Community attributes\n"
4028 "Send Standard Community attributes\n")
4029{
4030 if (strncmp (argv[1], "s", 1) == 0)
4031 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4032 bgp_node_safi (vty),
4033 PEER_FLAG_SEND_COMMUNITY);
4034 if (strncmp (argv[1], "e", 1) == 0)
4035 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4036 bgp_node_safi (vty),
4037 PEER_FLAG_SEND_EXT_COMMUNITY);
4038
4039 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4040 bgp_node_safi (vty),
4041 (PEER_FLAG_SEND_COMMUNITY|
4042 PEER_FLAG_SEND_EXT_COMMUNITY));
4043}
4044
4045DEFUN (no_neighbor_send_community_type,
4046 no_neighbor_send_community_type_cmd,
4047 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
4048 NO_STR
4049 NEIGHBOR_STR
4050 NEIGHBOR_ADDR_STR2
4051 "Send Community attribute to this neighbor\n"
4052 "Send Standard and Extended Community attributes\n"
4053 "Send Extended Community attributes\n"
4054 "Send Standard Community attributes\n")
4055{
4056 if (strncmp (argv[1], "s", 1) == 0)
4057 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4058 bgp_node_safi (vty),
4059 PEER_FLAG_SEND_COMMUNITY);
4060 if (strncmp (argv[1], "e", 1) == 0)
4061 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4062 bgp_node_safi (vty),
4063 PEER_FLAG_SEND_EXT_COMMUNITY);
4064
4065 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4066 bgp_node_safi (vty),
4067 (PEER_FLAG_SEND_COMMUNITY |
4068 PEER_FLAG_SEND_EXT_COMMUNITY));
4069}
6b0655a2 4070
718e3744 4071/* neighbor soft-reconfig. */
4072DEFUN (neighbor_soft_reconfiguration,
4073 neighbor_soft_reconfiguration_cmd,
4074 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
4075 NEIGHBOR_STR
4076 NEIGHBOR_ADDR_STR2
4077 "Per neighbor soft reconfiguration\n"
4078 "Allow inbound soft reconfiguration for this neighbor\n")
4079{
4080 return peer_af_flag_set_vty (vty, argv[0],
4081 bgp_node_afi (vty), bgp_node_safi (vty),
4082 PEER_FLAG_SOFT_RECONFIG);
4083}
4084
4085DEFUN (no_neighbor_soft_reconfiguration,
4086 no_neighbor_soft_reconfiguration_cmd,
4087 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
4088 NO_STR
4089 NEIGHBOR_STR
4090 NEIGHBOR_ADDR_STR2
4091 "Per neighbor soft reconfiguration\n"
4092 "Allow inbound soft reconfiguration for this neighbor\n")
4093{
4094 return peer_af_flag_unset_vty (vty, argv[0],
4095 bgp_node_afi (vty), bgp_node_safi (vty),
4096 PEER_FLAG_SOFT_RECONFIG);
4097}
6b0655a2 4098
718e3744 4099DEFUN (neighbor_route_reflector_client,
4100 neighbor_route_reflector_client_cmd,
4101 NEIGHBOR_CMD2 "route-reflector-client",
4102 NEIGHBOR_STR
4103 NEIGHBOR_ADDR_STR2
4104 "Configure a neighbor as Route Reflector client\n")
4105{
4106 struct peer *peer;
4107
4108
4109 peer = peer_and_group_lookup_vty (vty, argv[0]);
4110 if (! peer)
4111 return CMD_WARNING;
4112
4113 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4114 bgp_node_safi (vty),
4115 PEER_FLAG_REFLECTOR_CLIENT);
4116}
4117
4118DEFUN (no_neighbor_route_reflector_client,
4119 no_neighbor_route_reflector_client_cmd,
4120 NO_NEIGHBOR_CMD2 "route-reflector-client",
4121 NO_STR
4122 NEIGHBOR_STR
4123 NEIGHBOR_ADDR_STR2
4124 "Configure a neighbor as Route Reflector client\n")
4125{
4126 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4127 bgp_node_safi (vty),
4128 PEER_FLAG_REFLECTOR_CLIENT);
4129}
6b0655a2 4130
718e3744 4131/* neighbor route-server-client. */
4132DEFUN (neighbor_route_server_client,
4133 neighbor_route_server_client_cmd,
4134 NEIGHBOR_CMD2 "route-server-client",
4135 NEIGHBOR_STR
4136 NEIGHBOR_ADDR_STR2
4137 "Configure a neighbor as Route Server client\n")
4138{
2a3d5731
DW
4139 struct peer *peer;
4140
4141 peer = peer_and_group_lookup_vty (vty, argv[0]);
4142 if (! peer)
4143 return CMD_WARNING;
4144 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4145 bgp_node_safi (vty),
4146 PEER_FLAG_RSERVER_CLIENT);
718e3744 4147}
4148
4149DEFUN (no_neighbor_route_server_client,
4150 no_neighbor_route_server_client_cmd,
4151 NO_NEIGHBOR_CMD2 "route-server-client",
4152 NO_STR
4153 NEIGHBOR_STR
4154 NEIGHBOR_ADDR_STR2
4155 "Configure a neighbor as Route Server client\n")
fee0f4c6 4156{
2a3d5731
DW
4157 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4158 bgp_node_safi (vty),
4159 PEER_FLAG_RSERVER_CLIENT);
fee0f4c6 4160}
6b0655a2 4161
fee0f4c6 4162DEFUN (neighbor_nexthop_local_unchanged,
4163 neighbor_nexthop_local_unchanged_cmd,
4164 NEIGHBOR_CMD2 "nexthop-local unchanged",
4165 NEIGHBOR_STR
4166 NEIGHBOR_ADDR_STR2
4167 "Configure treatment of outgoing link-local nexthop attribute\n"
4168 "Leave link-local nexthop unchanged for this peer\n")
4169{
4170 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4171 bgp_node_safi (vty),
4172 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
4173}
6b0655a2 4174
fee0f4c6 4175DEFUN (no_neighbor_nexthop_local_unchanged,
4176 no_neighbor_nexthop_local_unchanged_cmd,
4177 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
4178 NO_STR
4179 NEIGHBOR_STR
4180 NEIGHBOR_ADDR_STR2
4181 "Configure treatment of outgoing link-local-nexthop attribute\n"
4182 "Leave link-local nexthop unchanged for this peer\n")
718e3744 4183{
4184 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4185 bgp_node_safi (vty),
fee0f4c6 4186 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
718e3744 4187}
6b0655a2 4188
718e3744 4189DEFUN (neighbor_attr_unchanged,
4190 neighbor_attr_unchanged_cmd,
4191 NEIGHBOR_CMD2 "attribute-unchanged",
4192 NEIGHBOR_STR
4193 NEIGHBOR_ADDR_STR2
4194 "BGP attribute is propagated unchanged to this neighbor\n")
4195{
4196 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4197 bgp_node_safi (vty),
4198 (PEER_FLAG_AS_PATH_UNCHANGED |
4199 PEER_FLAG_NEXTHOP_UNCHANGED |
4200 PEER_FLAG_MED_UNCHANGED));
4201}
4202
4203DEFUN (neighbor_attr_unchanged1,
4204 neighbor_attr_unchanged1_cmd,
4205 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
4206 NEIGHBOR_STR
4207 NEIGHBOR_ADDR_STR2
4208 "BGP attribute is propagated unchanged to this neighbor\n"
4209 "As-path attribute\n"
4210 "Nexthop attribute\n"
4211 "Med attribute\n")
4212{
4213 u_int16_t flags = 0;
4214
4215 if (strncmp (argv[1], "as-path", 1) == 0)
4216 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4217 else if (strncmp (argv[1], "next-hop", 1) == 0)
4218 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4219 else if (strncmp (argv[1], "med", 1) == 0)
4220 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4221
4222 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4223 bgp_node_safi (vty), flags);
4224}
4225
4226DEFUN (neighbor_attr_unchanged2,
4227 neighbor_attr_unchanged2_cmd,
4228 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
4229 NEIGHBOR_STR
4230 NEIGHBOR_ADDR_STR2
4231 "BGP attribute is propagated unchanged to this neighbor\n"
4232 "As-path attribute\n"
4233 "Nexthop attribute\n"
4234 "Med attribute\n")
4235{
4236 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
4237
4238 if (strncmp (argv[1], "next-hop", 1) == 0)
4239 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4240 else if (strncmp (argv[1], "med", 1) == 0)
4241 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4242
4243 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4244 bgp_node_safi (vty), flags);
4245
4246}
4247
4248DEFUN (neighbor_attr_unchanged3,
4249 neighbor_attr_unchanged3_cmd,
4250 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
4251 NEIGHBOR_STR
4252 NEIGHBOR_ADDR_STR2
4253 "BGP attribute is propagated unchanged to this neighbor\n"
4254 "Nexthop attribute\n"
4255 "As-path attribute\n"
4256 "Med attribute\n")
4257{
4258 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
4259
4260 if (strncmp (argv[1], "as-path", 1) == 0)
4261 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4262 else if (strncmp (argv[1], "med", 1) == 0)
4263 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4264
4265 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4266 bgp_node_safi (vty), flags);
4267}
4268
4269DEFUN (neighbor_attr_unchanged4,
4270 neighbor_attr_unchanged4_cmd,
4271 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
4272 NEIGHBOR_STR
4273 NEIGHBOR_ADDR_STR2
4274 "BGP attribute is propagated unchanged to this neighbor\n"
4275 "Med attribute\n"
4276 "As-path attribute\n"
4277 "Nexthop attribute\n")
4278{
4279 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
4280
4281 if (strncmp (argv[1], "as-path", 1) == 0)
4282 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4283 else if (strncmp (argv[1], "next-hop", 1) == 0)
4284 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4285
4286 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
4287 bgp_node_safi (vty), flags);
4288}
4289
4290ALIAS (neighbor_attr_unchanged,
4291 neighbor_attr_unchanged5_cmd,
4292 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
4293 NEIGHBOR_STR
4294 NEIGHBOR_ADDR_STR2
4295 "BGP attribute is propagated unchanged to this neighbor\n"
4296 "As-path attribute\n"
4297 "Nexthop attribute\n"
4298 "Med attribute\n")
4299
4300ALIAS (neighbor_attr_unchanged,
4301 neighbor_attr_unchanged6_cmd,
4302 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
4303 NEIGHBOR_STR
4304 NEIGHBOR_ADDR_STR2
4305 "BGP attribute is propagated unchanged to this neighbor\n"
4306 "As-path attribute\n"
4307 "Med attribute\n"
4308 "Nexthop attribute\n")
4309
4310ALIAS (neighbor_attr_unchanged,
4311 neighbor_attr_unchanged7_cmd,
4312 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
4313 NEIGHBOR_STR
4314 NEIGHBOR_ADDR_STR2
4315 "BGP attribute is propagated unchanged to this neighbor\n"
4316 "Nexthop attribute\n"
4317 "Med attribute\n"
4318 "As-path attribute\n")
4319
4320ALIAS (neighbor_attr_unchanged,
4321 neighbor_attr_unchanged8_cmd,
4322 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
4323 NEIGHBOR_STR
4324 NEIGHBOR_ADDR_STR2
4325 "BGP attribute is propagated unchanged to this neighbor\n"
4326 "Nexthop attribute\n"
4327 "As-path attribute\n"
4328 "Med attribute\n")
4329
4330ALIAS (neighbor_attr_unchanged,
4331 neighbor_attr_unchanged9_cmd,
4332 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
4333 NEIGHBOR_STR
4334 NEIGHBOR_ADDR_STR2
4335 "BGP attribute is propagated unchanged to this neighbor\n"
4336 "Med attribute\n"
4337 "Nexthop attribute\n"
4338 "As-path attribute\n")
4339
4340ALIAS (neighbor_attr_unchanged,
4341 neighbor_attr_unchanged10_cmd,
4342 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
4343 NEIGHBOR_STR
4344 NEIGHBOR_ADDR_STR2
4345 "BGP attribute is propagated unchanged to this neighbor\n"
4346 "Med attribute\n"
4347 "As-path attribute\n"
4348 "Nexthop attribute\n")
4349
4350DEFUN (no_neighbor_attr_unchanged,
4351 no_neighbor_attr_unchanged_cmd,
4352 NO_NEIGHBOR_CMD2 "attribute-unchanged",
4353 NO_STR
4354 NEIGHBOR_STR
4355 NEIGHBOR_ADDR_STR2
4356 "BGP attribute is propagated unchanged to this neighbor\n")
4357{
4358 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4359 bgp_node_safi (vty),
4360 (PEER_FLAG_AS_PATH_UNCHANGED |
4361 PEER_FLAG_NEXTHOP_UNCHANGED |
4362 PEER_FLAG_MED_UNCHANGED));
4363}
4364
4365DEFUN (no_neighbor_attr_unchanged1,
4366 no_neighbor_attr_unchanged1_cmd,
4367 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
4368 NO_STR
4369 NEIGHBOR_STR
4370 NEIGHBOR_ADDR_STR2
4371 "BGP attribute is propagated unchanged to this neighbor\n"
4372 "As-path attribute\n"
4373 "Nexthop attribute\n"
4374 "Med attribute\n")
4375{
4376 u_int16_t flags = 0;
4377
4378 if (strncmp (argv[1], "as-path", 1) == 0)
4379 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4380 else if (strncmp (argv[1], "next-hop", 1) == 0)
4381 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4382 else if (strncmp (argv[1], "med", 1) == 0)
4383 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4384
4385 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4386 bgp_node_safi (vty), flags);
4387}
4388
4389DEFUN (no_neighbor_attr_unchanged2,
4390 no_neighbor_attr_unchanged2_cmd,
4391 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
4392 NO_STR
4393 NEIGHBOR_STR
4394 NEIGHBOR_ADDR_STR2
4395 "BGP attribute is propagated unchanged to this neighbor\n"
4396 "As-path attribute\n"
4397 "Nexthop attribute\n"
4398 "Med attribute\n")
4399{
4400 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
4401
4402 if (strncmp (argv[1], "next-hop", 1) == 0)
4403 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4404 else if (strncmp (argv[1], "med", 1) == 0)
4405 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4406
4407 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4408 bgp_node_safi (vty), flags);
4409}
4410
4411DEFUN (no_neighbor_attr_unchanged3,
4412 no_neighbor_attr_unchanged3_cmd,
4413 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
4414 NO_STR
4415 NEIGHBOR_STR
4416 NEIGHBOR_ADDR_STR2
4417 "BGP attribute is propagated unchanged to this neighbor\n"
4418 "Nexthop attribute\n"
4419 "As-path attribute\n"
4420 "Med attribute\n")
4421{
4422 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
4423
4424 if (strncmp (argv[1], "as-path", 1) == 0)
4425 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4426 else if (strncmp (argv[1], "med", 1) == 0)
4427 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
4428
4429 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4430 bgp_node_safi (vty), flags);
4431}
4432
4433DEFUN (no_neighbor_attr_unchanged4,
4434 no_neighbor_attr_unchanged4_cmd,
4435 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
4436 NO_STR
4437 NEIGHBOR_STR
4438 NEIGHBOR_ADDR_STR2
4439 "BGP attribute is propagated unchanged to this neighbor\n"
4440 "Med attribute\n"
4441 "As-path attribute\n"
4442 "Nexthop attribute\n")
4443{
4444 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
4445
4446 if (strncmp (argv[1], "as-path", 1) == 0)
4447 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
4448 else if (strncmp (argv[1], "next-hop", 1) == 0)
4449 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
4450
4451 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
4452 bgp_node_safi (vty), flags);
4453}
4454
4455ALIAS (no_neighbor_attr_unchanged,
4456 no_neighbor_attr_unchanged5_cmd,
4457 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
4458 NO_STR
4459 NEIGHBOR_STR
4460 NEIGHBOR_ADDR_STR2
4461 "BGP attribute is propagated unchanged to this neighbor\n"
4462 "As-path attribute\n"
4463 "Nexthop attribute\n"
4464 "Med attribute\n")
4465
4466ALIAS (no_neighbor_attr_unchanged,
4467 no_neighbor_attr_unchanged6_cmd,
4468 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
4469 NO_STR
4470 NEIGHBOR_STR
4471 NEIGHBOR_ADDR_STR2
4472 "BGP attribute is propagated unchanged to this neighbor\n"
4473 "As-path attribute\n"
4474 "Med attribute\n"
4475 "Nexthop attribute\n")
4476
4477ALIAS (no_neighbor_attr_unchanged,
4478 no_neighbor_attr_unchanged7_cmd,
4479 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
4480 NO_STR
4481 NEIGHBOR_STR
4482 NEIGHBOR_ADDR_STR2
4483 "BGP attribute is propagated unchanged to this neighbor\n"
4484 "Nexthop attribute\n"
4485 "Med attribute\n"
4486 "As-path attribute\n")
4487
4488ALIAS (no_neighbor_attr_unchanged,
4489 no_neighbor_attr_unchanged8_cmd,
4490 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
4491 NO_STR
4492 NEIGHBOR_STR
4493 NEIGHBOR_ADDR_STR2
4494 "BGP attribute is propagated unchanged to this neighbor\n"
4495 "Nexthop attribute\n"
4496 "As-path attribute\n"
4497 "Med attribute\n")
4498
4499ALIAS (no_neighbor_attr_unchanged,
4500 no_neighbor_attr_unchanged9_cmd,
4501 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
4502 NO_STR
4503 NEIGHBOR_STR
4504 NEIGHBOR_ADDR_STR2
4505 "BGP attribute is propagated unchanged to this neighbor\n"
4506 "Med attribute\n"
4507 "Nexthop attribute\n"
4508 "As-path attribute\n")
4509
4510ALIAS (no_neighbor_attr_unchanged,
4511 no_neighbor_attr_unchanged10_cmd,
4512 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
4513 NO_STR
4514 NEIGHBOR_STR
4515 NEIGHBOR_ADDR_STR2
4516 "BGP attribute is propagated unchanged to this neighbor\n"
4517 "Med attribute\n"
4518 "As-path attribute\n"
4519 "Nexthop attribute\n")
4520
718e3744 4521/* EBGP multihop configuration. */
94f2b392 4522static int
fd79ac91 4523peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
4524 const char *ttl_str)
718e3744 4525{
4526 struct peer *peer;
fd79ac91 4527 unsigned int ttl;
718e3744 4528
4529 peer = peer_and_group_lookup_vty (vty, ip_str);
4530 if (! peer)
4531 return CMD_WARNING;
4532
63fa10b5
QY
4533 if (peer->conf_if)
4534 return bgp_vty_return (vty, BGP_ERR_INVALID_FOR_DIRECT_PEER);
4535
718e3744 4536 if (! ttl_str)
9b1be336 4537 ttl = MAXTTL;
718e3744 4538 else
9b1be336 4539 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, MAXTTL);
718e3744 4540
89b6d1f8 4541 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
718e3744 4542}
4543
94f2b392 4544static int
fd79ac91 4545peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
718e3744 4546{
4547 struct peer *peer;
4548
4549 peer = peer_and_group_lookup_vty (vty, ip_str);
4550 if (! peer)
4551 return CMD_WARNING;
4552
89b6d1f8 4553 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
718e3744 4554}
4555
4556/* neighbor ebgp-multihop. */
4557DEFUN (neighbor_ebgp_multihop,
4558 neighbor_ebgp_multihop_cmd,
4559 NEIGHBOR_CMD2 "ebgp-multihop",
4560 NEIGHBOR_STR
4561 NEIGHBOR_ADDR_STR2
4562 "Allow EBGP neighbors not on directly connected networks\n")
4563{
4564 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
4565}
4566
4567DEFUN (neighbor_ebgp_multihop_ttl,
4568 neighbor_ebgp_multihop_ttl_cmd,
9b1be336 4569 NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL),
718e3744 4570 NEIGHBOR_STR
4571 NEIGHBOR_ADDR_STR2
4572 "Allow EBGP neighbors not on directly connected networks\n"
4573 "maximum hop count\n")
4574{
4575 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
4576}
4577
4578DEFUN (no_neighbor_ebgp_multihop,
4579 no_neighbor_ebgp_multihop_cmd,
4580 NO_NEIGHBOR_CMD2 "ebgp-multihop",
4581 NO_STR
4582 NEIGHBOR_STR
4583 NEIGHBOR_ADDR_STR2
4584 "Allow EBGP neighbors not on directly connected networks\n")
4585{
4586 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
4587}
4588
4589ALIAS (no_neighbor_ebgp_multihop,
4590 no_neighbor_ebgp_multihop_ttl_cmd,
9b1be336 4591 NO_NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL),
718e3744 4592 NO_STR
4593 NEIGHBOR_STR
4594 NEIGHBOR_ADDR_STR2
4595 "Allow EBGP neighbors not on directly connected networks\n"
4596 "maximum hop count\n")
6b0655a2 4597
6ffd2079 4598/* disable-connected-check */
4599DEFUN (neighbor_disable_connected_check,
4600 neighbor_disable_connected_check_cmd,
4601 NEIGHBOR_CMD2 "disable-connected-check",
4602 NEIGHBOR_STR
4603 NEIGHBOR_ADDR_STR2
4604 "one-hop away EBGP peer using loopback address\n")
4605{
4606 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
4607}
4608
4609DEFUN (no_neighbor_disable_connected_check,
4610 no_neighbor_disable_connected_check_cmd,
4611 NO_NEIGHBOR_CMD2 "disable-connected-check",
4612 NO_STR
4613 NEIGHBOR_STR
4614 NEIGHBOR_ADDR_STR2
4615 "one-hop away EBGP peer using loopback address\n")
4616{
4617 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
4618}
4619
718e3744 4620/* Enforce multihop. */
6ffd2079 4621ALIAS (neighbor_disable_connected_check,
718e3744 4622 neighbor_enforce_multihop_cmd,
4623 NEIGHBOR_CMD2 "enforce-multihop",
4624 NEIGHBOR_STR
4625 NEIGHBOR_ADDR_STR2
e8e1946e 4626 "Enforce EBGP neighbors perform multihop\n")
718e3744 4627
6ffd2079 4628/* Enforce multihop. */
4629ALIAS (no_neighbor_disable_connected_check,
718e3744 4630 no_neighbor_enforce_multihop_cmd,
4631 NO_NEIGHBOR_CMD2 "enforce-multihop",
4632 NO_STR
4633 NEIGHBOR_STR
4634 NEIGHBOR_ADDR_STR2
e8e1946e 4635 "Enforce EBGP neighbors perform multihop\n")
6b0655a2 4636
718e3744 4637DEFUN (neighbor_description,
4638 neighbor_description_cmd,
4639 NEIGHBOR_CMD2 "description .LINE",
4640 NEIGHBOR_STR
4641 NEIGHBOR_ADDR_STR2
4642 "Neighbor specific description\n"
4643 "Up to 80 characters describing this neighbor\n")
4644{
4645 struct peer *peer;
718e3744 4646 char *str;
718e3744 4647
4648 peer = peer_and_group_lookup_vty (vty, argv[0]);
4649 if (! peer)
4650 return CMD_WARNING;
4651
4652 if (argc == 1)
4653 return CMD_SUCCESS;
4654
3b8b1855 4655 str = argv_concat(argv, argc, 1);
718e3744 4656
4657 peer_description_set (peer, str);
4658
3b8b1855 4659 XFREE (MTYPE_TMP, str);
718e3744 4660
4661 return CMD_SUCCESS;
4662}
4663
4664DEFUN (no_neighbor_description,
4665 no_neighbor_description_cmd,
4666 NO_NEIGHBOR_CMD2 "description",
4667 NO_STR
4668 NEIGHBOR_STR
4669 NEIGHBOR_ADDR_STR2
4670 "Neighbor specific description\n")
4671{
4672 struct peer *peer;
4673
4674 peer = peer_and_group_lookup_vty (vty, argv[0]);
4675 if (! peer)
4676 return CMD_WARNING;
4677
4678 peer_description_unset (peer);
4679
4680 return CMD_SUCCESS;
4681}
4682
4683ALIAS (no_neighbor_description,
4684 no_neighbor_description_val_cmd,
4685 NO_NEIGHBOR_CMD2 "description .LINE",
4686 NO_STR
4687 NEIGHBOR_STR
4688 NEIGHBOR_ADDR_STR2
4689 "Neighbor specific description\n"
4690 "Up to 80 characters describing this neighbor\n")
6b0655a2 4691
718e3744 4692/* Neighbor update-source. */
94f2b392 4693static int
fd79ac91 4694peer_update_source_vty (struct vty *vty, const char *peer_str,
4695 const char *source_str)
718e3744 4696{
4697 struct peer *peer;
718e3744 4698
4699 peer = peer_and_group_lookup_vty (vty, peer_str);
4700 if (! peer)
4701 return CMD_WARNING;
4702
a80beece
DS
4703 if (peer->conf_if)
4704 return CMD_WARNING;
4705
718e3744 4706 if (source_str)
4707 {
c63b83fe
JBD
4708 union sockunion su;
4709 int ret = str2sockunion (source_str, &su);
4710
4711 if (ret == 0)
4712 peer_update_source_addr_set (peer, &su);
718e3744 4713 else
4714 peer_update_source_if_set (peer, source_str);
4715 }
4716 else
4717 peer_update_source_unset (peer);
4718
4719 return CMD_SUCCESS;
4720}
4721
dcb52bd5
DS
4722#define BGP_UPDATE_SOURCE_STR "A.B.C.D|X:X::X:X|WORD"
4723#define BGP_UPDATE_SOURCE_REQ_STR "(" BGP_UPDATE_SOURCE_STR ")"
4724#define BGP_UPDATE_SOURCE_OPT_STR "{" BGP_UPDATE_SOURCE_STR "}"
369688c0
PJ
4725#define BGP_UPDATE_SOURCE_HELP_STR \
4726 "IPv4 address\n" \
9a1a331d
PJ
4727 "IPv6 address\n" \
4728 "Interface name (requires zebra to be running)\n"
369688c0 4729
718e3744 4730DEFUN (neighbor_update_source,
4731 neighbor_update_source_cmd,
dcb52bd5 4732 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_REQ_STR,
718e3744 4733 NEIGHBOR_STR
4734 NEIGHBOR_ADDR_STR2
4735 "Source of routing updates\n"
369688c0 4736 BGP_UPDATE_SOURCE_HELP_STR)
718e3744 4737{
4738 return peer_update_source_vty (vty, argv[0], argv[1]);
4739}
4740
4741DEFUN (no_neighbor_update_source,
4742 no_neighbor_update_source_cmd,
dcb52bd5 4743 NO_NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_OPT_STR,
718e3744 4744 NO_STR
4745 NEIGHBOR_STR
4746 NEIGHBOR_ADDR_STR2
dcb52bd5
DS
4747 "Source of routing updates\n"
4748 BGP_UPDATE_SOURCE_HELP_STR)
718e3744 4749{
4750 return peer_update_source_vty (vty, argv[0], NULL);
4751}
6b0655a2 4752
94f2b392 4753static int
fd79ac91 4754peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
4755 afi_t afi, safi_t safi,
4756 const char *rmap, int set)
718e3744 4757{
4758 int ret;
4759 struct peer *peer;
4760
4761 peer = peer_and_group_lookup_vty (vty, peer_str);
4762 if (! peer)
4763 return CMD_WARNING;
4764
4765 if (set)
4766 ret = peer_default_originate_set (peer, afi, safi, rmap);
4767 else
4768 ret = peer_default_originate_unset (peer, afi, safi);
4769
4770 return bgp_vty_return (vty, ret);
4771}
4772
4773/* neighbor default-originate. */
4774DEFUN (neighbor_default_originate,
4775 neighbor_default_originate_cmd,
4776 NEIGHBOR_CMD2 "default-originate",
4777 NEIGHBOR_STR
4778 NEIGHBOR_ADDR_STR2
4779 "Originate default route to this neighbor\n")
4780{
4781 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
4782 bgp_node_safi (vty), NULL, 1);
4783}
4784
4785DEFUN (neighbor_default_originate_rmap,
4786 neighbor_default_originate_rmap_cmd,
4787 NEIGHBOR_CMD2 "default-originate route-map WORD",
4788 NEIGHBOR_STR
4789 NEIGHBOR_ADDR_STR2
4790 "Originate default route to this neighbor\n"
4791 "Route-map to specify criteria to originate default\n"
4792 "route-map name\n")
4793{
4794 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
4795 bgp_node_safi (vty), argv[1], 1);
4796}
4797
4798DEFUN (no_neighbor_default_originate,
4799 no_neighbor_default_originate_cmd,
4800 NO_NEIGHBOR_CMD2 "default-originate",
4801 NO_STR
4802 NEIGHBOR_STR
4803 NEIGHBOR_ADDR_STR2
4804 "Originate default route to this neighbor\n")
4805{
4806 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
4807 bgp_node_safi (vty), NULL, 0);
4808}
4809
4810ALIAS (no_neighbor_default_originate,
4811 no_neighbor_default_originate_rmap_cmd,
4812 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
4813 NO_STR
4814 NEIGHBOR_STR
4815 NEIGHBOR_ADDR_STR2
4816 "Originate default route to this neighbor\n"
4817 "Route-map to specify criteria to originate default\n"
4818 "route-map name\n")
6b0655a2 4819
718e3744 4820/* Set neighbor's BGP port. */
94f2b392 4821static int
fd79ac91 4822peer_port_vty (struct vty *vty, const char *ip_str, int afi,
4823 const char *port_str)
718e3744 4824{
4825 struct peer *peer;
4826 u_int16_t port;
4827 struct servent *sp;
4828
4829 peer = peer_lookup_vty (vty, ip_str);
4830 if (! peer)
4831 return CMD_WARNING;
4832
4833 if (! port_str)
4834 {
4835 sp = getservbyname ("bgp", "tcp");
4836 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
4837 }
4838 else
4839 {
4840 VTY_GET_INTEGER("port", port, port_str);
4841 }
4842
4843 peer_port_set (peer, port);
4844
4845 return CMD_SUCCESS;
4846}
4847
f418446b 4848/* Set specified peer's BGP port. */
718e3744 4849DEFUN (neighbor_port,
4850 neighbor_port_cmd,
4851 NEIGHBOR_CMD "port <0-65535>",
4852 NEIGHBOR_STR
4853 NEIGHBOR_ADDR_STR
4854 "Neighbor's BGP port\n"
4855 "TCP port number\n")
4856{
4857 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
4858}
4859
4860DEFUN (no_neighbor_port,
4861 no_neighbor_port_cmd,
4862 NO_NEIGHBOR_CMD "port",
4863 NO_STR
4864 NEIGHBOR_STR
4865 NEIGHBOR_ADDR_STR
4866 "Neighbor's BGP port\n")
4867{
4868 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
4869}
4870
4871ALIAS (no_neighbor_port,
4872 no_neighbor_port_val_cmd,
4873 NO_NEIGHBOR_CMD "port <0-65535>",
4874 NO_STR
4875 NEIGHBOR_STR
4876 NEIGHBOR_ADDR_STR
4877 "Neighbor's BGP port\n"
4878 "TCP port number\n")
6b0655a2 4879
718e3744 4880/* neighbor weight. */
94f2b392 4881static int
fd79ac91 4882peer_weight_set_vty (struct vty *vty, const char *ip_str,
4883 const char *weight_str)
718e3744 4884{
1f9a9fff 4885 int ret;
718e3744 4886 struct peer *peer;
4887 unsigned long weight;
4888
4889 peer = peer_and_group_lookup_vty (vty, ip_str);
4890 if (! peer)
4891 return CMD_WARNING;
4892
4893 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
4894
1f9a9fff
PJ
4895 ret = peer_weight_set (peer, weight);
4896 return bgp_vty_return (vty, ret);
718e3744 4897}
4898
94f2b392 4899static int
fd79ac91 4900peer_weight_unset_vty (struct vty *vty, const char *ip_str)
718e3744 4901{
1f9a9fff 4902 int ret;
718e3744 4903 struct peer *peer;
4904
4905 peer = peer_and_group_lookup_vty (vty, ip_str);
4906 if (! peer)
4907 return CMD_WARNING;
4908
1f9a9fff
PJ
4909 ret = peer_weight_unset (peer);
4910 return bgp_vty_return (vty, ret);
718e3744 4911}
4912
4913DEFUN (neighbor_weight,
4914 neighbor_weight_cmd,
4915 NEIGHBOR_CMD2 "weight <0-65535>",
4916 NEIGHBOR_STR
4917 NEIGHBOR_ADDR_STR2
4918 "Set default weight for routes from this neighbor\n"
4919 "default weight\n")
4920{
4921 return peer_weight_set_vty (vty, argv[0], argv[1]);
4922}
4923
4924DEFUN (no_neighbor_weight,
4925 no_neighbor_weight_cmd,
4926 NO_NEIGHBOR_CMD2 "weight",
4927 NO_STR
4928 NEIGHBOR_STR
4929 NEIGHBOR_ADDR_STR2
4930 "Set default weight for routes from this neighbor\n")
4931{
4932 return peer_weight_unset_vty (vty, argv[0]);
4933}
4934
4935ALIAS (no_neighbor_weight,
4936 no_neighbor_weight_val_cmd,
4937 NO_NEIGHBOR_CMD2 "weight <0-65535>",
4938 NO_STR
4939 NEIGHBOR_STR
4940 NEIGHBOR_ADDR_STR2
4941 "Set default weight for routes from this neighbor\n"
4942 "default weight\n")
6b0655a2 4943
718e3744 4944/* Override capability negotiation. */
4945DEFUN (neighbor_override_capability,
4946 neighbor_override_capability_cmd,
4947 NEIGHBOR_CMD2 "override-capability",
4948 NEIGHBOR_STR
4949 NEIGHBOR_ADDR_STR2
4950 "Override capability negotiation result\n")
4951{
4952 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
4953}
4954
4955DEFUN (no_neighbor_override_capability,
4956 no_neighbor_override_capability_cmd,
4957 NO_NEIGHBOR_CMD2 "override-capability",
4958 NO_STR
4959 NEIGHBOR_STR
4960 NEIGHBOR_ADDR_STR2
4961 "Override capability negotiation result\n")
4962{
4963 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
4964}
6b0655a2 4965
718e3744 4966DEFUN (neighbor_strict_capability,
4967 neighbor_strict_capability_cmd,
4968 NEIGHBOR_CMD "strict-capability-match",
4969 NEIGHBOR_STR
4970 NEIGHBOR_ADDR_STR
4971 "Strict capability negotiation match\n")
4972{
4973 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
4974}
4975
4976DEFUN (no_neighbor_strict_capability,
4977 no_neighbor_strict_capability_cmd,
4978 NO_NEIGHBOR_CMD "strict-capability-match",
4979 NO_STR
4980 NEIGHBOR_STR
4981 NEIGHBOR_ADDR_STR
4982 "Strict capability negotiation match\n")
4983{
4984 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
4985}
6b0655a2 4986
94f2b392 4987static int
fd79ac91 4988peer_timers_set_vty (struct vty *vty, const char *ip_str,
4989 const char *keep_str, const char *hold_str)
718e3744 4990{
4991 int ret;
4992 struct peer *peer;
4993 u_int32_t keepalive;
4994 u_int32_t holdtime;
4995
4996 peer = peer_and_group_lookup_vty (vty, ip_str);
4997 if (! peer)
4998 return CMD_WARNING;
4999
5000 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
5001 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
5002
5003 ret = peer_timers_set (peer, keepalive, holdtime);
5004
5005 return bgp_vty_return (vty, ret);
5006}
6b0655a2 5007
94f2b392 5008static int
fd79ac91 5009peer_timers_unset_vty (struct vty *vty, const char *ip_str)
718e3744 5010{
5011 int ret;
5012 struct peer *peer;
5013
0c412461 5014 peer = peer_and_group_lookup_vty (vty, ip_str);
718e3744 5015 if (! peer)
5016 return CMD_WARNING;
5017
5018 ret = peer_timers_unset (peer);
5019
5020 return bgp_vty_return (vty, ret);
5021}
5022
5023DEFUN (neighbor_timers,
5024 neighbor_timers_cmd,
5025 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
5026 NEIGHBOR_STR
5027 NEIGHBOR_ADDR_STR2
5028 "BGP per neighbor timers\n"
5029 "Keepalive interval\n"
5030 "Holdtime\n")
5031{
5032 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
5033}
5034
5035DEFUN (no_neighbor_timers,
5036 no_neighbor_timers_cmd,
5037 NO_NEIGHBOR_CMD2 "timers",
5038 NO_STR
5039 NEIGHBOR_STR
5040 NEIGHBOR_ADDR_STR2
5041 "BGP per neighbor timers\n")
5042{
5043 return peer_timers_unset_vty (vty, argv[0]);
5044}
6b0655a2 5045
813d4307
DW
5046ALIAS (no_neighbor_timers,
5047 no_neighbor_timers_val_cmd,
5048 NO_NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
5049 NO_STR
5050 NEIGHBOR_STR
5051 NEIGHBOR_ADDR_STR2
5052 "BGP per neighbor timers\n"
5053 "Keepalive interval\n"
5054 "Holdtime\n")
5055
94f2b392 5056static int
fd79ac91 5057peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
5058 const char *time_str)
718e3744 5059{
5060 int ret;
5061 struct peer *peer;
5062 u_int32_t connect;
5063
966f821c 5064 peer = peer_and_group_lookup_vty (vty, ip_str);
718e3744 5065 if (! peer)
5066 return CMD_WARNING;
5067
5068 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
5069
5070 ret = peer_timers_connect_set (peer, connect);
5071
966f821c 5072 return bgp_vty_return (vty, ret);
718e3744 5073}
5074
94f2b392 5075static int
fd79ac91 5076peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
718e3744 5077{
5078 int ret;
5079 struct peer *peer;
5080
5081 peer = peer_and_group_lookup_vty (vty, ip_str);
5082 if (! peer)
5083 return CMD_WARNING;
5084
5085 ret = peer_timers_connect_unset (peer);
5086
966f821c 5087 return bgp_vty_return (vty, ret);
718e3744 5088}
5089
5090DEFUN (neighbor_timers_connect,
5091 neighbor_timers_connect_cmd,
8e0d0089 5092 NEIGHBOR_CMD2 "timers connect <1-65535>",
718e3744 5093 NEIGHBOR_STR
966f821c 5094 NEIGHBOR_ADDR_STR2
718e3744 5095 "BGP per neighbor timers\n"
5096 "BGP connect timer\n"
5097 "Connect timer\n")
5098{
5099 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
5100}
5101
5102DEFUN (no_neighbor_timers_connect,
5103 no_neighbor_timers_connect_cmd,
966f821c 5104 NO_NEIGHBOR_CMD2 "timers connect",
718e3744 5105 NO_STR
5106 NEIGHBOR_STR
966f821c 5107 NEIGHBOR_ADDR_STR2
718e3744 5108 "BGP per neighbor timers\n"
5109 "BGP connect timer\n")
5110{
5111 return peer_timers_connect_unset_vty (vty, argv[0]);
5112}
5113
5114ALIAS (no_neighbor_timers_connect,
5115 no_neighbor_timers_connect_val_cmd,
8e0d0089 5116 NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
718e3744 5117 NO_STR
5118 NEIGHBOR_STR
966f821c 5119 NEIGHBOR_ADDR_STR2
718e3744 5120 "BGP per neighbor timers\n"
5121 "BGP connect timer\n"
5122 "Connect timer\n")
6b0655a2 5123
94f2b392 5124static int
fd79ac91 5125peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
5126 const char *time_str, int set)
718e3744 5127{
5128 int ret;
5129 struct peer *peer;
5130 u_int32_t routeadv = 0;
5131
966f821c 5132 peer = peer_and_group_lookup_vty (vty, ip_str);
718e3744 5133 if (! peer)
5134 return CMD_WARNING;
5135
5136 if (time_str)
5137 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
5138
5139 if (set)
5140 ret = peer_advertise_interval_set (peer, routeadv);
5141 else
5142 ret = peer_advertise_interval_unset (peer);
5143
966f821c 5144 return bgp_vty_return (vty, ret);
718e3744 5145}
5146
5147DEFUN (neighbor_advertise_interval,
5148 neighbor_advertise_interval_cmd,
966f821c 5149 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
718e3744 5150 NEIGHBOR_STR
966f821c 5151 NEIGHBOR_ADDR_STR2
718e3744 5152 "Minimum interval between sending BGP routing updates\n"
5153 "time in seconds\n")
5154{
5155 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
5156}
5157
5158DEFUN (no_neighbor_advertise_interval,
5159 no_neighbor_advertise_interval_cmd,
966f821c 5160 NO_NEIGHBOR_CMD2 "advertisement-interval",
718e3744 5161 NO_STR
5162 NEIGHBOR_STR
966f821c 5163 NEIGHBOR_ADDR_STR2
718e3744 5164 "Minimum interval between sending BGP routing updates\n")
5165{
5166 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
5167}
5168
5169ALIAS (no_neighbor_advertise_interval,
5170 no_neighbor_advertise_interval_val_cmd,
966f821c 5171 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
718e3744 5172 NO_STR
5173 NEIGHBOR_STR
966f821c 5174 NEIGHBOR_ADDR_STR2
718e3744 5175 "Minimum interval between sending BGP routing updates\n"
5176 "time in seconds\n")
6b0655a2 5177
518f0eb1
DS
5178/* Time to wait before processing route-map updates */
5179DEFUN (bgp_set_route_map_delay_timer,
5180 bgp_set_route_map_delay_timer_cmd,
5181 "bgp route-map delay-timer <0-600>",
5182 SET_STR
5183 "BGP route-map delay timer\n"
5184 "Time in secs to wait before processing route-map changes\n"
f414725f 5185 "0 disables the timer, no route updates happen when route-maps change\n")
518f0eb1
DS
5186{
5187 u_int32_t rmap_delay_timer;
518f0eb1 5188
518f0eb1
DS
5189 if (argv[0])
5190 {
5191 VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600);
5fe9f963 5192 bm->rmap_update_timer = rmap_delay_timer;
518f0eb1
DS
5193
5194 /* if the dynamic update handling is being disabled, and a timer is
5195 * running, stop the timer and act as if the timer has already fired.
5196 */
5fe9f963 5197 if (!rmap_delay_timer && bm->t_rmap_update )
518f0eb1 5198 {
5fe9f963 5199 BGP_TIMER_OFF(bm->t_rmap_update);
5200 thread_execute (bm->master, bgp_route_map_update_timer, NULL, 0);
518f0eb1
DS
5201 }
5202 return CMD_SUCCESS;
5203 }
5204 else
ffd0c037 5205 return CMD_WARNING;
518f0eb1
DS
5206}
5207
5208DEFUN (no_bgp_set_route_map_delay_timer,
5209 no_bgp_set_route_map_delay_timer_cmd,
5210 "no bgp route-map delay-timer",
5211 NO_STR
5212 "Default BGP route-map delay timer\n"
f414725f 5213 "Reset to default time to wait for processing route-map changes\n")
518f0eb1 5214{
518f0eb1 5215
5fe9f963 5216 bm->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER;
518f0eb1
DS
5217
5218 return CMD_SUCCESS;
5219}
5220
f414725f
DS
5221ALIAS (no_bgp_set_route_map_delay_timer,
5222 no_bgp_set_route_map_delay_timer_val_cmd,
5223 "no bgp route-map delay-timer <0-600>",
5224 NO_STR
5225 "Default BGP route-map delay timer\n"
5226 "Reset to default time to wait for processing route-map changes\n"
5227 "0 disables the timer, no route updates happen when route-maps change\n")
5228
718e3744 5229/* neighbor interface */
94f2b392 5230static int
fd79ac91 5231peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
718e3744 5232{
718e3744 5233 struct peer *peer;
5234
5235 peer = peer_lookup_vty (vty, ip_str);
a80beece 5236 if (! peer || peer->conf_if)
718e3744 5237 return CMD_WARNING;
5238
5239 if (str)
ffd0c037 5240 peer_interface_set (peer, str);
718e3744 5241 else
ffd0c037 5242 peer_interface_unset (peer);
718e3744 5243
5244 return CMD_SUCCESS;
5245}
5246
5247DEFUN (neighbor_interface,
5248 neighbor_interface_cmd,
5249 NEIGHBOR_CMD "interface WORD",
5250 NEIGHBOR_STR
5251 NEIGHBOR_ADDR_STR
5252 "Interface\n"
5253 "Interface name\n")
5254{
8ffedcea
DS
5255 if (argc == 3)
5256 return peer_interface_vty (vty, argv[0], argv[1]);
5257 else
5258 return peer_interface_vty (vty, argv[0], argv[1]);
718e3744 5259}
5260
5261DEFUN (no_neighbor_interface,
5262 no_neighbor_interface_cmd,
8ffedcea 5263 NO_NEIGHBOR_CMD2 "interface WORD",
718e3744 5264 NO_STR
5265 NEIGHBOR_STR
5266 NEIGHBOR_ADDR_STR
5267 "Interface\n"
5268 "Interface name\n")
5269{
5270 return peer_interface_vty (vty, argv[0], NULL);
5271}
6b0655a2 5272
718e3744 5273/* Set distribute list to the peer. */
94f2b392 5274static int
fd79ac91 5275peer_distribute_set_vty (struct vty *vty, const char *ip_str,
5276 afi_t afi, safi_t safi,
5277 const char *name_str, const char *direct_str)
718e3744 5278{
5279 int ret;
5280 struct peer *peer;
5281 int direct = FILTER_IN;
5282
5283 peer = peer_and_group_lookup_vty (vty, ip_str);
5284 if (! peer)
5285 return CMD_WARNING;
5286
5287 /* Check filter direction. */
5288 if (strncmp (direct_str, "i", 1) == 0)
5289 direct = FILTER_IN;
5290 else if (strncmp (direct_str, "o", 1) == 0)
5291 direct = FILTER_OUT;
5292
5293 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
5294
5295 return bgp_vty_return (vty, ret);
5296}
5297
94f2b392 5298static int
fd79ac91 5299peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
5300 safi_t safi, const char *direct_str)
718e3744 5301{
5302 int ret;
5303 struct peer *peer;
5304 int direct = FILTER_IN;
5305
5306 peer = peer_and_group_lookup_vty (vty, ip_str);
5307 if (! peer)
5308 return CMD_WARNING;
5309
5310 /* Check filter direction. */
5311 if (strncmp (direct_str, "i", 1) == 0)
5312 direct = FILTER_IN;
5313 else if (strncmp (direct_str, "o", 1) == 0)
5314 direct = FILTER_OUT;
5315
5316 ret = peer_distribute_unset (peer, afi, safi, direct);
5317
5318 return bgp_vty_return (vty, ret);
5319}
5320
5321DEFUN (neighbor_distribute_list,
5322 neighbor_distribute_list_cmd,
5323 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
5324 NEIGHBOR_STR
5325 NEIGHBOR_ADDR_STR2
5326 "Filter updates to/from this neighbor\n"
5327 "IP access-list number\n"
5328 "IP access-list number (expanded range)\n"
5329 "IP Access-list name\n"
5330 "Filter incoming updates\n"
5331 "Filter outgoing updates\n")
5332{
5333 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
5334 bgp_node_safi (vty), argv[1], argv[2]);
5335}
5336
5337DEFUN (no_neighbor_distribute_list,
5338 no_neighbor_distribute_list_cmd,
5339 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
5340 NO_STR
5341 NEIGHBOR_STR
5342 NEIGHBOR_ADDR_STR2
5343 "Filter updates to/from this neighbor\n"
5344 "IP access-list number\n"
5345 "IP access-list number (expanded range)\n"
5346 "IP Access-list name\n"
5347 "Filter incoming updates\n"
5348 "Filter outgoing updates\n")
5349{
5350 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
5351 bgp_node_safi (vty), argv[2]);
5352}
6b0655a2 5353
718e3744 5354/* Set prefix list to the peer. */
94f2b392 5355static int
fd79ac91 5356peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
5357 safi_t safi, const char *name_str,
5358 const char *direct_str)
718e3744 5359{
5360 int ret;
5361 struct peer *peer;
5362 int direct = FILTER_IN;
5363
5364 peer = peer_and_group_lookup_vty (vty, ip_str);
5365 if (! peer)
5366 return CMD_WARNING;
5367
5368 /* Check filter direction. */
5369 if (strncmp (direct_str, "i", 1) == 0)
5370 direct = FILTER_IN;
5371 else if (strncmp (direct_str, "o", 1) == 0)
5372 direct = FILTER_OUT;
5373
5374 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
5375
5376 return bgp_vty_return (vty, ret);
5377}
5378
94f2b392 5379static int
fd79ac91 5380peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
5381 safi_t safi, const char *direct_str)
718e3744 5382{
5383 int ret;
5384 struct peer *peer;
5385 int direct = FILTER_IN;
5386
5387 peer = peer_and_group_lookup_vty (vty, ip_str);
5388 if (! peer)
5389 return CMD_WARNING;
5390
5391 /* Check filter direction. */
5392 if (strncmp (direct_str, "i", 1) == 0)
5393 direct = FILTER_IN;
5394 else if (strncmp (direct_str, "o", 1) == 0)
5395 direct = FILTER_OUT;
5396
5397 ret = peer_prefix_list_unset (peer, afi, safi, direct);
5398
5399 return bgp_vty_return (vty, ret);
5400}
5401
5402DEFUN (neighbor_prefix_list,
5403 neighbor_prefix_list_cmd,
5404 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
5405 NEIGHBOR_STR
5406 NEIGHBOR_ADDR_STR2
5407 "Filter updates to/from this neighbor\n"
5408 "Name of a prefix list\n"
5409 "Filter incoming updates\n"
5410 "Filter outgoing updates\n")
5411{
5412 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
5413 bgp_node_safi (vty), argv[1], argv[2]);
5414}
5415
5416DEFUN (no_neighbor_prefix_list,
5417 no_neighbor_prefix_list_cmd,
5418 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
5419 NO_STR
5420 NEIGHBOR_STR
5421 NEIGHBOR_ADDR_STR2
5422 "Filter updates to/from this neighbor\n"
5423 "Name of a prefix list\n"
5424 "Filter incoming updates\n"
5425 "Filter outgoing updates\n")
5426{
5427 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
5428 bgp_node_safi (vty), argv[2]);
5429}
6b0655a2 5430
94f2b392 5431static int
fd79ac91 5432peer_aslist_set_vty (struct vty *vty, const char *ip_str,
5433 afi_t afi, safi_t safi,
5434 const char *name_str, const char *direct_str)
718e3744 5435{
5436 int ret;
5437 struct peer *peer;
5438 int direct = FILTER_IN;
5439
5440 peer = peer_and_group_lookup_vty (vty, ip_str);
5441 if (! peer)
5442 return CMD_WARNING;
5443
5444 /* Check filter direction. */
5445 if (strncmp (direct_str, "i", 1) == 0)
5446 direct = FILTER_IN;
5447 else if (strncmp (direct_str, "o", 1) == 0)
5448 direct = FILTER_OUT;
5449
5450 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
5451
5452 return bgp_vty_return (vty, ret);
5453}
5454
94f2b392 5455static int
fd79ac91 5456peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
5457 afi_t afi, safi_t safi,
5458 const char *direct_str)
718e3744 5459{
5460 int ret;
5461 struct peer *peer;
5462 int direct = FILTER_IN;
5463
5464 peer = peer_and_group_lookup_vty (vty, ip_str);
5465 if (! peer)
5466 return CMD_WARNING;
5467
5468 /* Check filter direction. */
5469 if (strncmp (direct_str, "i", 1) == 0)
5470 direct = FILTER_IN;
5471 else if (strncmp (direct_str, "o", 1) == 0)
5472 direct = FILTER_OUT;
5473
5474 ret = peer_aslist_unset (peer, afi, safi, direct);
5475
5476 return bgp_vty_return (vty, ret);
5477}
5478
5479DEFUN (neighbor_filter_list,
5480 neighbor_filter_list_cmd,
5481 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
5482 NEIGHBOR_STR
5483 NEIGHBOR_ADDR_STR2
5484 "Establish BGP filters\n"
5485 "AS path access-list name\n"
5486 "Filter incoming routes\n"
5487 "Filter outgoing routes\n")
5488{
5489 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
5490 bgp_node_safi (vty), argv[1], argv[2]);
5491}
5492
5493DEFUN (no_neighbor_filter_list,
5494 no_neighbor_filter_list_cmd,
5495 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
5496 NO_STR
5497 NEIGHBOR_STR
5498 NEIGHBOR_ADDR_STR2
5499 "Establish BGP filters\n"
5500 "AS path access-list name\n"
5501 "Filter incoming routes\n"
5502 "Filter outgoing routes\n")
5503{
5504 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
5505 bgp_node_safi (vty), argv[2]);
5506}
6b0655a2 5507
718e3744 5508/* Set route-map to the peer. */
94f2b392 5509static int
fd79ac91 5510peer_route_map_set_vty (struct vty *vty, const char *ip_str,
5511 afi_t afi, safi_t safi,
5512 const char *name_str, const char *direct_str)
718e3744 5513{
5514 int ret;
5515 struct peer *peer;
fee0f4c6 5516 int direct = RMAP_IN;
718e3744 5517
5518 peer = peer_and_group_lookup_vty (vty, ip_str);
5519 if (! peer)
5520 return CMD_WARNING;
5521
5522 /* Check filter direction. */
fee0f4c6 5523 if (strncmp (direct_str, "in", 2) == 0)
5524 direct = RMAP_IN;
718e3744 5525 else if (strncmp (direct_str, "o", 1) == 0)
fee0f4c6 5526 direct = RMAP_OUT;
718e3744 5527
5528 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
5529
5530 return bgp_vty_return (vty, ret);
5531}
5532
94f2b392 5533static int
fd79ac91 5534peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
5535 safi_t safi, const char *direct_str)
718e3744 5536{
5537 int ret;
5538 struct peer *peer;
fee0f4c6 5539 int direct = RMAP_IN;
718e3744 5540
5541 peer = peer_and_group_lookup_vty (vty, ip_str);
5542 if (! peer)
5543 return CMD_WARNING;
5544
5545 /* Check filter direction. */
fee0f4c6 5546 if (strncmp (direct_str, "in", 2) == 0)
5547 direct = RMAP_IN;
718e3744 5548 else if (strncmp (direct_str, "o", 1) == 0)
fee0f4c6 5549 direct = RMAP_OUT;
718e3744 5550
5551 ret = peer_route_map_unset (peer, afi, safi, direct);
5552
5553 return bgp_vty_return (vty, ret);
5554}
5555
5556DEFUN (neighbor_route_map,
5557 neighbor_route_map_cmd,
2a3d5731 5558 NEIGHBOR_CMD2 "route-map WORD (in|out)",
718e3744 5559 NEIGHBOR_STR
5560 NEIGHBOR_ADDR_STR2
5561 "Apply route map to neighbor\n"
5562 "Name of route map\n"
5563 "Apply map to incoming routes\n"
2a3d5731 5564 "Apply map to outbound routes\n")
718e3744 5565{
5566 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
5567 bgp_node_safi (vty), argv[1], argv[2]);
5568}
5569
5570DEFUN (no_neighbor_route_map,
5571 no_neighbor_route_map_cmd,
2a3d5731 5572 NO_NEIGHBOR_CMD2 "route-map WORD (in|out)",
718e3744 5573 NO_STR
5574 NEIGHBOR_STR
5575 NEIGHBOR_ADDR_STR2
5576 "Apply route map to neighbor\n"
5577 "Name of route map\n"
5578 "Apply map to incoming routes\n"
2a3d5731 5579 "Apply map to outbound routes\n")
718e3744 5580{
5581 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
5582 bgp_node_safi (vty), argv[2]);
5583}
6b0655a2 5584
718e3744 5585/* Set unsuppress-map to the peer. */
94f2b392 5586static int
fd79ac91 5587peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
5588 safi_t safi, const char *name_str)
718e3744 5589{
5590 int ret;
5591 struct peer *peer;
5592
5593 peer = peer_and_group_lookup_vty (vty, ip_str);
5594 if (! peer)
5595 return CMD_WARNING;
5596
5597 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
5598
5599 return bgp_vty_return (vty, ret);
5600}
5601
5602/* Unset route-map from the peer. */
94f2b392 5603static int
fd79ac91 5604peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
718e3744 5605 safi_t safi)
5606{
5607 int ret;
5608 struct peer *peer;
5609
5610 peer = peer_and_group_lookup_vty (vty, ip_str);
5611 if (! peer)
5612 return CMD_WARNING;
5613
5614 ret = peer_unsuppress_map_unset (peer, afi, safi);
5615
5616 return bgp_vty_return (vty, ret);
5617}
5618
5619DEFUN (neighbor_unsuppress_map,
5620 neighbor_unsuppress_map_cmd,
5621 NEIGHBOR_CMD2 "unsuppress-map WORD",
5622 NEIGHBOR_STR
5623 NEIGHBOR_ADDR_STR2
5624 "Route-map to selectively unsuppress suppressed routes\n"
5625 "Name of route map\n")
5626{
5627 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
5628 bgp_node_safi (vty), argv[1]);
5629}
5630
5631DEFUN (no_neighbor_unsuppress_map,
5632 no_neighbor_unsuppress_map_cmd,
5633 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
5634 NO_STR
5635 NEIGHBOR_STR
5636 NEIGHBOR_ADDR_STR2
5637 "Route-map to selectively unsuppress suppressed routes\n"
5638 "Name of route map\n")
5639{
5640 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
5641 bgp_node_safi (vty));
5642}
6b0655a2 5643
94f2b392 5644static int
fd79ac91 5645peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
5646 safi_t safi, const char *num_str,
0a486e5f 5647 const char *threshold_str, int warning,
5648 const char *restart_str)
718e3744 5649{
5650 int ret;
5651 struct peer *peer;
5652 u_int32_t max;
e0701b79 5653 u_char threshold;
0a486e5f 5654 u_int16_t restart;
718e3744 5655
5656 peer = peer_and_group_lookup_vty (vty, ip_str);
5657 if (! peer)
5658 return CMD_WARNING;
5659
e6ec1c36 5660 VTY_GET_INTEGER ("maximum number", max, num_str);
e0701b79 5661 if (threshold_str)
5662 threshold = atoi (threshold_str);
5663 else
5664 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
718e3744 5665
0a486e5f 5666 if (restart_str)
5667 restart = atoi (restart_str);
5668 else
5669 restart = 0;
5670
5671 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
718e3744 5672
5673 return bgp_vty_return (vty, ret);
5674}
5675
94f2b392 5676static int
fd79ac91 5677peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
718e3744 5678 safi_t safi)
5679{
5680 int ret;
5681 struct peer *peer;
5682
5683 peer = peer_and_group_lookup_vty (vty, ip_str);
5684 if (! peer)
5685 return CMD_WARNING;
5686
5687 ret = peer_maximum_prefix_unset (peer, afi, safi);
5688
5689 return bgp_vty_return (vty, ret);
5690}
5691
5692/* Maximum number of prefix configuration. prefix count is different
5693 for each peer configuration. So this configuration can be set for
5694 each peer configuration. */
5695DEFUN (neighbor_maximum_prefix,
5696 neighbor_maximum_prefix_cmd,
5697 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
5698 NEIGHBOR_STR
5699 NEIGHBOR_ADDR_STR2
5700 "Maximum number of prefix accept from this peer\n"
5701 "maximum no. of prefix limit\n")
5702{
5703 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 5704 bgp_node_safi (vty), argv[1], NULL, 0,
5705 NULL);
718e3744 5706}
5707
e0701b79 5708DEFUN (neighbor_maximum_prefix_threshold,
5709 neighbor_maximum_prefix_threshold_cmd,
5710 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
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{
5717 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 5718 bgp_node_safi (vty), argv[1], argv[2], 0,
5719 NULL);
5720}
e0701b79 5721
718e3744 5722DEFUN (neighbor_maximum_prefix_warning,
5723 neighbor_maximum_prefix_warning_cmd,
5724 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
5725 NEIGHBOR_STR
5726 NEIGHBOR_ADDR_STR2
5727 "Maximum number of prefix accept from this peer\n"
5728 "maximum no. of prefix limit\n"
5729 "Only give warning message when limit is exceeded\n")
5730{
5731 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 5732 bgp_node_safi (vty), argv[1], NULL, 1,
5733 NULL);
718e3744 5734}
5735
e0701b79 5736DEFUN (neighbor_maximum_prefix_threshold_warning,
5737 neighbor_maximum_prefix_threshold_warning_cmd,
5738 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
5739 NEIGHBOR_STR
5740 NEIGHBOR_ADDR_STR2
5741 "Maximum number of prefix accept from this peer\n"
5742 "maximum no. of prefix limit\n"
5743 "Threshold value (%) at which to generate a warning msg\n"
5744 "Only give warning message when limit is exceeded\n")
5745{
5746 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 5747 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
5748}
5749
5750DEFUN (neighbor_maximum_prefix_restart,
5751 neighbor_maximum_prefix_restart_cmd,
5752 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
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 "Restart bgp connection after limit is exceeded\n"
5758 "Restart interval in minutes")
5759{
5760 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
5761 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
5762}
5763
5764DEFUN (neighbor_maximum_prefix_threshold_restart,
5765 neighbor_maximum_prefix_threshold_restart_cmd,
5766 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
5767 NEIGHBOR_STR
5768 NEIGHBOR_ADDR_STR2
5769 "Maximum number of prefix accept from this peer\n"
5770 "maximum no. of prefix limit\n"
5771 "Threshold value (%) at which to generate a warning msg\n"
5772 "Restart bgp connection after limit is exceeded\n"
5773 "Restart interval in minutes")
5774{
5775 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
5776 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
5777}
e0701b79 5778
718e3744 5779DEFUN (no_neighbor_maximum_prefix,
5780 no_neighbor_maximum_prefix_cmd,
5781 NO_NEIGHBOR_CMD2 "maximum-prefix",
5782 NO_STR
5783 NEIGHBOR_STR
5784 NEIGHBOR_ADDR_STR2
5785 "Maximum number of prefix accept from this peer\n")
5786{
5787 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
5788 bgp_node_safi (vty));
5789}
5790
5791ALIAS (no_neighbor_maximum_prefix,
5792 no_neighbor_maximum_prefix_val_cmd,
5793 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
5794 NO_STR
5795 NEIGHBOR_STR
5796 NEIGHBOR_ADDR_STR2
5797 "Maximum number of prefix accept from this peer\n"
5798 "maximum no. of prefix limit\n")
5799
5800ALIAS (no_neighbor_maximum_prefix,
0a486e5f 5801 no_neighbor_maximum_prefix_threshold_cmd,
813d4307 5802 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
0a486e5f 5803 NO_STR
5804 NEIGHBOR_STR
5805 NEIGHBOR_ADDR_STR2
5806 "Maximum number of prefix accept from this peer\n"
5807 "maximum no. of prefix limit\n"
5808 "Threshold value (%) at which to generate a warning msg\n")
5809
5810ALIAS (no_neighbor_maximum_prefix,
5811 no_neighbor_maximum_prefix_warning_cmd,
5812 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
5813 NO_STR
5814 NEIGHBOR_STR
5815 NEIGHBOR_ADDR_STR2
5816 "Maximum number of prefix accept from this peer\n"
5817 "maximum no. of prefix limit\n"
e8e1946e 5818 "Only give warning message when limit is exceeded\n")
0a486e5f 5819
5820ALIAS (no_neighbor_maximum_prefix,
5821 no_neighbor_maximum_prefix_threshold_warning_cmd,
e0701b79 5822 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
5823 NO_STR
5824 NEIGHBOR_STR
5825 NEIGHBOR_ADDR_STR2
5826 "Maximum number of prefix accept from this peer\n"
5827 "maximum no. of prefix limit\n"
5828 "Threshold value (%) at which to generate a warning msg\n"
e8e1946e 5829 "Only give warning message when limit is exceeded\n")
e0701b79 5830
5831ALIAS (no_neighbor_maximum_prefix,
0a486e5f 5832 no_neighbor_maximum_prefix_restart_cmd,
5833 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
718e3744 5834 NO_STR
5835 NEIGHBOR_STR
5836 NEIGHBOR_ADDR_STR2
5837 "Maximum number of prefix accept from this peer\n"
5838 "maximum no. of prefix limit\n"
0a486e5f 5839 "Restart bgp connection after limit is exceeded\n"
5840 "Restart interval in minutes")
5841
5842ALIAS (no_neighbor_maximum_prefix,
5843 no_neighbor_maximum_prefix_threshold_restart_cmd,
5844 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
5845 NO_STR
5846 NEIGHBOR_STR
5847 NEIGHBOR_ADDR_STR2
5848 "Maximum number of prefix accept from this peer\n"
5849 "maximum no. of prefix limit\n"
5850 "Threshold value (%) at which to generate a warning msg\n"
5851 "Restart bgp connection after limit is exceeded\n"
5852 "Restart interval in minutes")
6b0655a2 5853
718e3744 5854/* "neighbor allowas-in" */
5855DEFUN (neighbor_allowas_in,
5856 neighbor_allowas_in_cmd,
5857 NEIGHBOR_CMD2 "allowas-in",
5858 NEIGHBOR_STR
5859 NEIGHBOR_ADDR_STR2
5860 "Accept as-path with my AS present in it\n")
5861{
5862 int ret;
5863 struct peer *peer;
fd79ac91 5864 unsigned int allow_num;
718e3744 5865
5866 peer = peer_and_group_lookup_vty (vty, argv[0]);
5867 if (! peer)
5868 return CMD_WARNING;
5869
5870 if (argc == 1)
5871 allow_num = 3;
5872 else
5873 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
5874
5875 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
5876 allow_num);
5877
5878 return bgp_vty_return (vty, ret);
5879}
5880
5881ALIAS (neighbor_allowas_in,
5882 neighbor_allowas_in_arg_cmd,
5883 NEIGHBOR_CMD2 "allowas-in <1-10>",
5884 NEIGHBOR_STR
5885 NEIGHBOR_ADDR_STR2
5886 "Accept as-path with my AS present in it\n"
5887 "Number of occurances of AS number\n")
5888
5889DEFUN (no_neighbor_allowas_in,
5890 no_neighbor_allowas_in_cmd,
5891 NO_NEIGHBOR_CMD2 "allowas-in",
5892 NO_STR
5893 NEIGHBOR_STR
5894 NEIGHBOR_ADDR_STR2
5895 "allow local ASN appears in aspath attribute\n")
5896{
5897 int ret;
5898 struct peer *peer;
5899
5900 peer = peer_and_group_lookup_vty (vty, argv[0]);
5901 if (! peer)
5902 return CMD_WARNING;
5903
5904 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
5905
5906 return bgp_vty_return (vty, ret);
5907}
6b0655a2 5908
813d4307
DW
5909ALIAS (no_neighbor_allowas_in,
5910 no_neighbor_allowas_in_val_cmd,
5911 NO_NEIGHBOR_CMD2 "allowas-in <1-10>",
5912 NO_STR
5913 NEIGHBOR_STR
5914 NEIGHBOR_ADDR_STR2
5915 "allow local ASN appears in aspath attribute\n"
5916 "Number of occurances of AS number\n")
5917
fa411a21
NH
5918DEFUN (neighbor_ttl_security,
5919 neighbor_ttl_security_cmd,
5920 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
5921 NEIGHBOR_STR
5922 NEIGHBOR_ADDR_STR2
5923 "Specify the maximum number of hops to the BGP peer\n")
5924{
5925 struct peer *peer;
89b6d1f8 5926 int gtsm_hops;
fa411a21
NH
5927
5928 peer = peer_and_group_lookup_vty (vty, argv[0]);
5929 if (! peer)
5930 return CMD_WARNING;
5931
5932 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
5933
8cdabf90
SK
5934 /*
5935 * If 'neighbor swpX', then this is for directly connected peers,
5936 * we should not accept a ttl-security hops value greater than 1.
5937 */
5938 if (peer->conf_if && (gtsm_hops > 1)) {
5939 vty_out (vty, "%s is directly connected peer, hops cannot exceed 1%s",
5940 argv[0], VTY_NEWLINE);
5941 return CMD_WARNING;
5942 }
5943
89b6d1f8 5944 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
fa411a21
NH
5945}
5946
5947DEFUN (no_neighbor_ttl_security,
5948 no_neighbor_ttl_security_cmd,
5949 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
5950 NO_STR
5951 NEIGHBOR_STR
5952 NEIGHBOR_ADDR_STR2
5953 "Specify the maximum number of hops to the BGP peer\n")
5954{
5955 struct peer *peer;
fa411a21
NH
5956
5957 peer = peer_and_group_lookup_vty (vty, argv[0]);
5958 if (! peer)
5959 return CMD_WARNING;
5960
89b6d1f8 5961 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
fa411a21 5962}
6b0655a2 5963
adbac85e
DW
5964DEFUN (neighbor_addpath_tx_all_paths,
5965 neighbor_addpath_tx_all_paths_cmd,
5966 NEIGHBOR_CMD2 "addpath-tx-all-paths",
5967 NEIGHBOR_STR
5968 NEIGHBOR_ADDR_STR2
5969 "Use addpath to advertise all paths to a neighbor\n")
5970{
5971 struct peer *peer;
5972
adbac85e
DW
5973 peer = peer_and_group_lookup_vty (vty, argv[0]);
5974 if (! peer)
5975 return CMD_WARNING;
5976
5977 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
5978 bgp_node_safi (vty),
5979 PEER_FLAG_ADDPATH_TX_ALL_PATHS);
5980}
5981
5982DEFUN (no_neighbor_addpath_tx_all_paths,
5983 no_neighbor_addpath_tx_all_paths_cmd,
5984 NO_NEIGHBOR_CMD2 "addpath-tx-all-paths",
5985 NO_STR
5986 NEIGHBOR_STR
5987 NEIGHBOR_ADDR_STR2
5988 "Use addpath to advertise all paths to a neighbor\n")
5989{
5990 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
5991 bgp_node_safi (vty),
5992 PEER_FLAG_ADDPATH_TX_ALL_PATHS);
5993}
5994
06370dac
DW
5995DEFUN (neighbor_addpath_tx_bestpath_per_as,
5996 neighbor_addpath_tx_bestpath_per_as_cmd,
5997 NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS",
5998 NEIGHBOR_STR
5999 NEIGHBOR_ADDR_STR2
6000 "Use addpath to advertise the bestpath per each neighboring AS\n")
6001{
6002 struct peer *peer;
6003
6004 peer = peer_and_group_lookup_vty (vty, argv[0]);
6005 if (! peer)
6006 return CMD_WARNING;
6007
6008 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
6009 bgp_node_safi (vty),
6010 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS);
6011}
6012
6013DEFUN (no_neighbor_addpath_tx_bestpath_per_as,
6014 no_neighbor_addpath_tx_bestpath_per_as_cmd,
6015 NO_NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS",
6016 NO_STR
6017 NEIGHBOR_STR
6018 NEIGHBOR_ADDR_STR2
6019 "Use addpath to advertise the bestpath per each neighboring AS\n")
6020{
6021 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
6022 bgp_node_safi (vty),
6023 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS);
6024}
6025
6026
718e3744 6027/* Address family configuration. */
6028DEFUN (address_family_ipv4,
6029 address_family_ipv4_cmd,
6030 "address-family ipv4",
6031 "Enter Address Family command mode\n"
6032 "Address family\n")
6033{
6034 vty->node = BGP_IPV4_NODE;
6035 return CMD_SUCCESS;
6036}
6037
6038DEFUN (address_family_ipv4_safi,
6039 address_family_ipv4_safi_cmd,
6040 "address-family ipv4 (unicast|multicast)",
6041 "Enter Address Family command mode\n"
6042 "Address family\n"
6043 "Address Family modifier\n"
6044 "Address Family modifier\n")
6045{
6046 if (strncmp (argv[0], "m", 1) == 0)
6047 vty->node = BGP_IPV4M_NODE;
6048 else
6049 vty->node = BGP_IPV4_NODE;
6050
6051 return CMD_SUCCESS;
6052}
6053
25ffbdc1 6054DEFUN (address_family_ipv6,
6055 address_family_ipv6_cmd,
6056 "address-family ipv6",
718e3744 6057 "Enter Address Family command mode\n"
25ffbdc1 6058 "Address family\n")
718e3744 6059{
6060 vty->node = BGP_IPV6_NODE;
6061 return CMD_SUCCESS;
6062}
6063
25ffbdc1 6064DEFUN (address_family_ipv6_safi,
6065 address_family_ipv6_safi_cmd,
6066 "address-family ipv6 (unicast|multicast)",
718e3744 6067 "Enter Address Family command mode\n"
25ffbdc1 6068 "Address family\n"
6069 "Address Family modifier\n"
6070 "Address Family modifier\n")
6071{
6072 if (strncmp (argv[0], "m", 1) == 0)
6073 vty->node = BGP_IPV6M_NODE;
6074 else
6075 vty->node = BGP_IPV6_NODE;
6076
6077 return CMD_SUCCESS;
6078}
718e3744 6079
6080DEFUN (address_family_vpnv4,
6081 address_family_vpnv4_cmd,
6082 "address-family vpnv4",
6083 "Enter Address Family command mode\n"
6084 "Address family\n")
6085{
6086 vty->node = BGP_VPNV4_NODE;
6087 return CMD_SUCCESS;
6088}
6089
6090ALIAS (address_family_vpnv4,
6091 address_family_vpnv4_unicast_cmd,
6092 "address-family vpnv4 unicast",
6093 "Enter Address Family command mode\n"
6094 "Address family\n"
6095 "Address Family Modifier\n")
6096
8ecd3266 6097DEFUN (address_family_vpnv6,
6098 address_family_vpnv6_cmd,
6099 "address-family vpnv6",
6100 "Enter Address Family command mode\n"
6101 "Address family\n")
6102{
6103 vty->node = BGP_VPNV6_NODE;
6104 return CMD_SUCCESS;
6105}
6106
6107ALIAS (address_family_vpnv6,
6108 address_family_vpnv6_unicast_cmd,
6109 "address-family vpnv6 unicast",
6110 "Enter Address Family command mode\n"
6111 "Address family\n"
6112 "Address Family Modifier\n")
6113
8b1fb8be
LB
6114DEFUN (address_family_encap,
6115 address_family_encap_cmd,
6116 "address-family encap",
6117 "Enter Address Family command mode\n"
6118 "Address family\n")
6119{
6120 vty->node = BGP_ENCAP_NODE;
6121 return CMD_SUCCESS;
6122}
6123
6124ALIAS (address_family_encap,
6125 address_family_encapv4_cmd,
6126 "address-family encapv4",
6127 "Enter Address Family command mode\n"
6128 "Address family\n")
6129
6130DEFUN (address_family_encapv6,
6131 address_family_encapv6_cmd,
6132 "address-family encapv6",
6133 "Enter Address Family command mode\n"
6134 "Address family\n")
6135{
6136 vty->node = BGP_ENCAPV6_NODE;
6137 return CMD_SUCCESS;
6138}
6139
718e3744 6140DEFUN (exit_address_family,
6141 exit_address_family_cmd,
6142 "exit-address-family",
6143 "Exit from Address Family configuration mode\n")
6144{
a8a80d53 6145 if (vty->node == BGP_IPV4_NODE
6146 || vty->node == BGP_IPV4M_NODE
718e3744 6147 || vty->node == BGP_VPNV4_NODE
25ffbdc1 6148 || vty->node == BGP_IPV6_NODE
8ecd3266 6149 || vty->node == BGP_IPV6M_NODE
8b1fb8be
LB
6150 || vty->node == BGP_VPNV6_NODE
6151 || vty->node == BGP_ENCAP_NODE
6152 || vty->node == BGP_ENCAPV6_NODE)
718e3744 6153 vty->node = BGP_NODE;
6154 return CMD_SUCCESS;
6155}
6b0655a2 6156
8ad7271d
DS
6157/* Recalculate bestpath and re-advertise a prefix */
6158static int
01080f7c 6159bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str,
8ad7271d
DS
6160 afi_t afi, safi_t safi, struct prefix_rd *prd)
6161{
6162 int ret;
6163 struct prefix match;
6164 struct bgp_node *rn;
6165 struct bgp_node *rm;
8ad7271d
DS
6166 struct bgp *bgp;
6167 struct bgp_table *table;
6168 struct bgp_table *rib;
6169
6170 /* BGP structure lookup. */
6171 if (view_name)
6172 {
6173 bgp = bgp_lookup_by_name (view_name);
6174 if (bgp == NULL)
6175 {
6aeb9e78 6176 vty_out (vty, "%% Can't find BGP instance %s%s", view_name, VTY_NEWLINE);
8ad7271d
DS
6177 return CMD_WARNING;
6178 }
6179 }
6180 else
6181 {
6182 bgp = bgp_get_default ();
6183 if (bgp == NULL)
6184 {
6185 vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE);
6186 return CMD_WARNING;
6187 }
6188 }
6189
6190 /* Check IP address argument. */
6191 ret = str2prefix (ip_str, &match);
6192 if (! ret)
6193 {
6194 vty_out (vty, "%% address is malformed%s", VTY_NEWLINE);
6195 return CMD_WARNING;
6196 }
6197
6198 match.family = afi2family (afi);
6199 rib = bgp->rib[afi][safi];
6200
6201 if (safi == SAFI_MPLS_VPN)
6202 {
6203 for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn))
6204 {
6205 if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0)
6206 continue;
6207
6208 if ((table = rn->info) != NULL)
6209 {
6210 if ((rm = bgp_node_match (table, &match)) != NULL)
6211 {
6212 if (rm->p.prefixlen == match.prefixlen)
6213 {
6214 SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR);
6215 bgp_process (bgp, rm, afi, safi);
6216 }
6217 bgp_unlock_node (rm);
6218 }
6219 }
6220 }
6221 }
6222 else
6223 {
6224 if ((rn = bgp_node_match (rib, &match)) != NULL)
6225 {
6226 if (rn->p.prefixlen == match.prefixlen)
6227 {
6228 SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR);
6229 bgp_process (bgp, rn, afi, safi);
6230 }
6231 bgp_unlock_node (rn);
6232 }
6233 }
6234
6235 return CMD_SUCCESS;
6236}
6237
718e3744 6238DEFUN (clear_ip_bgp_all,
6239 clear_ip_bgp_all_cmd,
6240 "clear ip bgp *",
6241 CLEAR_STR
6242 IP_STR
6243 BGP_STR
6244 "Clear all peers\n")
6245{
6aeb9e78
DS
6246 if (argc == 2)
6247 return bgp_clear_vty (vty, argv[1], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
718e3744 6248
6249 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
6250}
6251
01080f7c 6252ALIAS (clear_ip_bgp_all,
6253 clear_ip_bgp_instance_all_cmd,
6254 "clear ip bgp " BGP_INSTANCE_CMD " *",
6255 CLEAR_STR
6256 IP_STR
6257 BGP_STR
6258 BGP_INSTANCE_HELP_STR
6259 "Clear all peers\n")
6260
718e3744 6261ALIAS (clear_ip_bgp_all,
6262 clear_bgp_all_cmd,
6263 "clear bgp *",
6264 CLEAR_STR
6265 BGP_STR
6266 "Clear all peers\n")
6267
6268ALIAS (clear_ip_bgp_all,
01080f7c 6269 clear_bgp_instance_all_cmd,
6270 "clear bgp " BGP_INSTANCE_CMD " *",
718e3744 6271 CLEAR_STR
6272 BGP_STR
01080f7c 6273 BGP_INSTANCE_HELP_STR
718e3744 6274 "Clear all peers\n")
6275
6276ALIAS (clear_ip_bgp_all,
01080f7c 6277 clear_bgp_ipv6_all_cmd,
6278 "clear bgp ipv6 *",
718e3744 6279 CLEAR_STR
718e3744 6280 BGP_STR
01080f7c 6281 "Address family\n"
718e3744 6282 "Clear all peers\n")
6283
6284ALIAS (clear_ip_bgp_all,
01080f7c 6285 clear_bgp_instance_ipv6_all_cmd,
6286 "clear bgp " BGP_INSTANCE_CMD " ipv6 *",
718e3744 6287 CLEAR_STR
6288 BGP_STR
8386ac43 6289 BGP_INSTANCE_HELP_STR
01080f7c 6290 "Address family\n"
718e3744 6291 "Clear all peers\n")
6292
6293DEFUN (clear_ip_bgp_peer,
6294 clear_ip_bgp_peer_cmd,
a80beece 6295 "clear ip bgp (A.B.C.D|X:X::X:X|WORD)",
718e3744 6296 CLEAR_STR
6297 IP_STR
6298 BGP_STR
6299 "BGP neighbor IP address to clear\n"
a80beece
DS
6300 "BGP IPv6 neighbor to clear\n"
6301 "BGP neighbor on interface to clear\n")
718e3744 6302{
01080f7c 6303 if (argc == 3)
6304 return bgp_clear_vty (vty, argv[1], 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[2]);
6305
718e3744 6306 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
6307}
6308
01080f7c 6309ALIAS (clear_ip_bgp_peer,
6310 clear_ip_bgp_instance_peer_cmd,
6311 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)",
6312 CLEAR_STR
6313 IP_STR
6314 BGP_STR
6315 BGP_INSTANCE_HELP_STR
6316 "BGP neighbor IP address to clear\n"
6317 "BGP IPv6 neighbor to clear\n"
6318 "BGP neighbor on interface to clear\n")
6319
718e3744 6320ALIAS (clear_ip_bgp_peer,
6321 clear_bgp_peer_cmd,
a80beece 6322 "clear bgp (A.B.C.D|X:X::X:X|WORD)",
718e3744 6323 CLEAR_STR
6324 BGP_STR
6325 "BGP neighbor address to clear\n"
a80beece
DS
6326 "BGP IPv6 neighbor to clear\n"
6327 "BGP neighbor on interface to clear\n")
718e3744 6328
01080f7c 6329ALIAS (clear_ip_bgp_peer,
6330 clear_bgp_instance_peer_cmd,
6331 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)",
6332 CLEAR_STR
6333 BGP_STR
6334 BGP_INSTANCE_HELP_STR
6335 "BGP neighbor IP address to clear\n"
6336 "BGP IPv6 neighbor to clear\n"
6337 "BGP neighbor on interface to clear\n")
6338
718e3744 6339ALIAS (clear_ip_bgp_peer,
6340 clear_bgp_ipv6_peer_cmd,
a80beece 6341 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)",
718e3744 6342 CLEAR_STR
6343 BGP_STR
6344 "Address family\n"
6345 "BGP neighbor address to clear\n"
a80beece
DS
6346 "BGP IPv6 neighbor to clear\n"
6347 "BGP neighbor on interface to clear\n")
718e3744 6348
01080f7c 6349ALIAS (clear_ip_bgp_peer,
6350 clear_bgp_instance_ipv6_peer_cmd,
6351 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD)",
6352 CLEAR_STR
6353 BGP_STR
6354 BGP_INSTANCE_HELP_STR
6355 "Address family\n"
6356 "BGP neighbor IP address to clear\n"
6357 "BGP IPv6 neighbor to clear\n"
6358 "BGP neighbor on interface to clear\n")
6359
718e3744 6360DEFUN (clear_ip_bgp_peer_group,
6361 clear_ip_bgp_peer_group_cmd,
6362 "clear ip bgp peer-group WORD",
6363 CLEAR_STR
6364 IP_STR
6365 BGP_STR
6366 "Clear all members of peer-group\n"
6367 "BGP peer-group name\n")
6368{
01080f7c 6369 if (argc == 3)
6370 return bgp_clear_vty (vty, argv[1], 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[2]);
6371
718e3744 6372 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
6373}
6374
01080f7c 6375ALIAS (clear_ip_bgp_peer_group,
6376 clear_ip_bgp_instance_peer_group_cmd,
6377 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD",
6378 CLEAR_STR
6379 IP_STR
6380 BGP_STR
6381 BGP_INSTANCE_HELP_STR
6382 "Clear all members of peer-group\n"
6383 "BGP peer-group name\n")
6384
718e3744 6385ALIAS (clear_ip_bgp_peer_group,
6386 clear_bgp_peer_group_cmd,
6387 "clear bgp peer-group WORD",
6388 CLEAR_STR
6389 BGP_STR
6390 "Clear all members of peer-group\n"
6391 "BGP peer-group name\n")
6392
01080f7c 6393ALIAS (clear_ip_bgp_peer_group,
6394 clear_bgp_instance_peer_group_cmd,
6395 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD",
6396 CLEAR_STR
6397 BGP_STR
6398 BGP_INSTANCE_HELP_STR
6399 "Clear all members of peer-group\n"
6400 "BGP peer-group name\n")
6401
718e3744 6402ALIAS (clear_ip_bgp_peer_group,
6403 clear_bgp_ipv6_peer_group_cmd,
6404 "clear bgp ipv6 peer-group WORD",
6405 CLEAR_STR
6406 BGP_STR
6407 "Address family\n"
6408 "Clear all members of peer-group\n"
6409 "BGP peer-group name\n")
6410
01080f7c 6411ALIAS (clear_ip_bgp_peer_group,
6412 clear_bgp_instance_ipv6_peer_group_cmd,
6413 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD",
6414 CLEAR_STR
6415 BGP_STR
6416 BGP_INSTANCE_HELP_STR
6417 "Address family\n"
6418 "Clear all members of peer-group\n"
6419 "BGP peer-group name\n")
6420
718e3744 6421DEFUN (clear_ip_bgp_external,
6422 clear_ip_bgp_external_cmd,
6423 "clear ip bgp external",
6424 CLEAR_STR
6425 IP_STR
6426 BGP_STR
6427 "Clear all external peers\n")
6428{
01080f7c 6429 if (argc == 2)
6430 return bgp_clear_vty (vty, argv[1], 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
6431
718e3744 6432 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
6433}
6434
01080f7c 6435ALIAS (clear_ip_bgp_external,
6436 clear_ip_bgp_instance_external_cmd,
6437 "clear ip bgp " BGP_INSTANCE_CMD " external",
6438 CLEAR_STR
6439 IP_STR
6440 BGP_STR
6441 BGP_INSTANCE_HELP_STR
6442 "Clear all external peers\n")
6443
718e3744 6444ALIAS (clear_ip_bgp_external,
6445 clear_bgp_external_cmd,
6446 "clear bgp external",
6447 CLEAR_STR
6448 BGP_STR
6449 "Clear all external peers\n")
6450
01080f7c 6451ALIAS (clear_ip_bgp_external,
6452 clear_bgp_instance_external_cmd,
6453 "clear bgp " BGP_INSTANCE_CMD " external",
6454 CLEAR_STR
6455 BGP_STR
6456 BGP_INSTANCE_HELP_STR
6457 "Clear all external peers\n")
6458
718e3744 6459ALIAS (clear_ip_bgp_external,
6460 clear_bgp_ipv6_external_cmd,
6461 "clear bgp ipv6 external",
6462 CLEAR_STR
6463 BGP_STR
6464 "Address family\n"
6465 "Clear all external peers\n")
6466
01080f7c 6467ALIAS (clear_ip_bgp_external,
6468 clear_bgp_instance_ipv6_external_cmd,
6469 "clear bgp " BGP_INSTANCE_CMD " ipv6 external",
6470 CLEAR_STR
6471 BGP_STR
6472 BGP_INSTANCE_HELP_STR
6473 "Address family\n"
6474 "Clear all external peers\n")
6475
8ad7271d
DS
6476DEFUN (clear_ip_bgp_prefix,
6477 clear_ip_bgp_prefix_cmd,
6478 "clear ip bgp prefix A.B.C.D/M",
6479 CLEAR_STR
6480 IP_STR
6481 BGP_STR
6482 "Clear bestpath and re-advertise\n"
6483 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6484{
01080f7c 6485 if (argc == 3)
6486 return bgp_clear_prefix (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL);
6487
8ad7271d
DS
6488 return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL);
6489}
6490
01080f7c 6491ALIAS (clear_ip_bgp_prefix,
6492 clear_ip_bgp_instance_prefix_cmd,
6493 "clear ip bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M",
6494 CLEAR_STR
6495 IP_STR
6496 BGP_STR
6497 BGP_INSTANCE_HELP_STR
6498 "Clear bestpath and re-advertise\n"
6499 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6500
8ad7271d
DS
6501ALIAS (clear_ip_bgp_prefix,
6502 clear_bgp_prefix_cmd,
6503 "clear bgp prefix A.B.C.D/M",
6504 CLEAR_STR
6505 BGP_STR
6506 "Clear bestpath and re-advertise\n"
6507 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6508
01080f7c 6509ALIAS (clear_ip_bgp_prefix,
6510 clear_bgp_instance_prefix_cmd,
6511 "clear bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M",
6512 CLEAR_STR
6513 BGP_STR
6514 BGP_INSTANCE_HELP_STR
6515 "Clear bestpath and re-advertise\n"
6516 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
8ad7271d 6517
718e3744 6518DEFUN (clear_ip_bgp_as,
6519 clear_ip_bgp_as_cmd,
320da874 6520 "clear ip bgp " CMD_AS_RANGE,
718e3744 6521 CLEAR_STR
6522 IP_STR
6523 BGP_STR
6524 "Clear peers with the AS number\n")
6525{
01080f7c 6526 if (argc == 3)
6527 return bgp_clear_vty (vty, argv[1], 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[2]);
6528
718e3744 6529 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
6530}
6531
01080f7c 6532ALIAS (clear_ip_bgp_as,
6533 clear_ip_bgp_instance_as_cmd,
6534 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE,
6535 CLEAR_STR
6536 IP_STR
6537 BGP_STR
6538 BGP_INSTANCE_HELP_STR
6539 "Clear peers with the AS number\n")
6540
718e3744 6541ALIAS (clear_ip_bgp_as,
6542 clear_bgp_as_cmd,
320da874 6543 "clear bgp " CMD_AS_RANGE,
718e3744 6544 CLEAR_STR
6545 BGP_STR
6546 "Clear peers with the AS number\n")
6547
01080f7c 6548ALIAS (clear_ip_bgp_as,
6549 clear_bgp_instance_as_cmd,
6550 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE,
6551 CLEAR_STR
6552 BGP_STR
6553 BGP_INSTANCE_HELP_STR
6554 "Clear peers with the AS number\n")
6555
718e3744 6556ALIAS (clear_ip_bgp_as,
6557 clear_bgp_ipv6_as_cmd,
320da874 6558 "clear bgp ipv6 " CMD_AS_RANGE,
718e3744 6559 CLEAR_STR
6560 BGP_STR
6561 "Address family\n"
6562 "Clear peers with the AS number\n")
6b0655a2 6563
01080f7c 6564ALIAS (clear_ip_bgp_as,
6565 clear_bgp_instance_ipv6_as_cmd,
6566 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE,
6567 CLEAR_STR
6568 BGP_STR
6569 BGP_INSTANCE_HELP_STR
6570 "Address family\n"
6571 "Clear peers with the AS number\n")
6572
718e3744 6573/* Outbound soft-reconfiguration */
6574DEFUN (clear_ip_bgp_all_soft_out,
6575 clear_ip_bgp_all_soft_out_cmd,
6576 "clear ip bgp * soft out",
6577 CLEAR_STR
6578 IP_STR
6579 BGP_STR
6580 "Clear all peers\n"
e0bce756
DS
6581 BGP_SOFT_STR
6582 BGP_SOFT_OUT_STR)
718e3744 6583{
6aeb9e78
DS
6584 if (argc == 2)
6585 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
718e3744 6586 BGP_CLEAR_SOFT_OUT, NULL);
6587
6588 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6589 BGP_CLEAR_SOFT_OUT, NULL);
6590}
6591
01080f7c 6592ALIAS (clear_ip_bgp_all_soft_out,
6593 clear_ip_bgp_instance_all_soft_out_cmd,
6594 "clear ip bgp " BGP_INSTANCE_CMD " * soft out",
6595 CLEAR_STR
6596 IP_STR
6597 BGP_STR
6598 BGP_INSTANCE_HELP_STR
6599 "Clear all peers\n"
6600 BGP_SOFT_STR
6601 BGP_SOFT_OUT_STR)
6602
718e3744 6603ALIAS (clear_ip_bgp_all_soft_out,
6604 clear_ip_bgp_all_out_cmd,
6605 "clear ip bgp * out",
6606 CLEAR_STR
6607 IP_STR
6608 BGP_STR
6609 "Clear all peers\n"
e0bce756 6610 BGP_SOFT_OUT_STR)
718e3744 6611
6612ALIAS (clear_ip_bgp_all_soft_out,
01080f7c 6613 clear_ip_bgp_instance_all_out_cmd,
6614 "clear ip bgp " BGP_INSTANCE_CMD " * out",
718e3744 6615 CLEAR_STR
6616 IP_STR
6617 BGP_STR
8386ac43 6618 BGP_INSTANCE_HELP_STR
718e3744 6619 "Clear all peers\n"
e0bce756 6620 BGP_SOFT_OUT_STR)
718e3744 6621
6622DEFUN (clear_ip_bgp_all_ipv4_soft_out,
6623 clear_ip_bgp_all_ipv4_soft_out_cmd,
6624 "clear ip bgp * ipv4 (unicast|multicast) soft out",
6625 CLEAR_STR
6626 IP_STR
6627 BGP_STR
6628 "Clear all peers\n"
6629 "Address family\n"
6630 "Address Family modifier\n"
6631 "Address Family modifier\n"
e0bce756
DS
6632 BGP_SOFT_STR
6633 BGP_SOFT_OUT_STR)
718e3744 6634{
6635 if (strncmp (argv[0], "m", 1) == 0)
6636 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6637 BGP_CLEAR_SOFT_OUT, NULL);
6638
6639 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6640 BGP_CLEAR_SOFT_OUT, NULL);
6641}
6642
01080f7c 6643DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
6644 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
6645 "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft out",
6646 CLEAR_STR
6647 IP_STR
6648 BGP_STR
6649 BGP_INSTANCE_HELP_STR
6650 "Clear all peers\n"
6651 "Address family\n"
6652 "Address Family modifier\n"
6653 "Address Family modifier\n"
6654 BGP_SOFT_OUT_STR)
6655{
6656 if (strncmp (argv[2], "m", 1) == 0)
6657 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all,
6658 BGP_CLEAR_SOFT_OUT, NULL);
6659
6660 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6661 BGP_CLEAR_SOFT_OUT, NULL);
6662}
6663
718e3744 6664ALIAS (clear_ip_bgp_all_ipv4_soft_out,
6665 clear_ip_bgp_all_ipv4_out_cmd,
6666 "clear ip bgp * ipv4 (unicast|multicast) out",
6667 CLEAR_STR
6668 IP_STR
6669 BGP_STR
6670 "Clear all peers\n"
6671 "Address family\n"
6672 "Address Family modifier\n"
6673 "Address Family modifier\n"
e0bce756 6674 BGP_SOFT_OUT_STR)
718e3744 6675
01080f7c 6676ALIAS (clear_ip_bgp_instance_all_ipv4_soft_out,
6677 clear_ip_bgp_instance_all_ipv4_out_cmd,
6678 "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) out",
718e3744 6679 CLEAR_STR
6680 IP_STR
6681 BGP_STR
8386ac43 6682 BGP_INSTANCE_HELP_STR
718e3744 6683 "Clear all peers\n"
6684 "Address family\n"
6685 "Address Family modifier\n"
6686 "Address Family modifier\n"
e0bce756 6687 BGP_SOFT_OUT_STR)
718e3744 6688
6689DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
6690 clear_ip_bgp_all_vpnv4_soft_out_cmd,
6691 "clear ip bgp * vpnv4 unicast soft out",
6692 CLEAR_STR
6693 IP_STR
6694 BGP_STR
6695 "Clear all peers\n"
6696 "Address family\n"
6697 "Address Family Modifier\n"
e0bce756
DS
6698 BGP_SOFT_STR
6699 BGP_SOFT_OUT_STR)
718e3744 6700{
6701 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6702 BGP_CLEAR_SOFT_OUT, NULL);
6703}
6704
6705ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
6706 clear_ip_bgp_all_vpnv4_out_cmd,
6707 "clear ip bgp * vpnv4 unicast out",
6708 CLEAR_STR
6709 IP_STR
6710 BGP_STR
6711 "Clear all peers\n"
6712 "Address family\n"
6713 "Address Family Modifier\n"
e0bce756 6714 BGP_SOFT_OUT_STR)
718e3744 6715
587ff0fd
LB
6716DEFUN (clear_ip_bgp_all_encap_soft_out,
6717 clear_ip_bgp_all_encap_soft_out_cmd,
6718 "clear ip bgp * encap unicast soft out",
6719 CLEAR_STR
6720 IP_STR
6721 BGP_STR
6722 "Clear all peers\n"
6723 "Address family\n"
6724 "Address Family Modifier\n"
6725 "Soft reconfig\n"
6726 "Soft reconfig outbound update\n")
6727{
6728 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
6729 BGP_CLEAR_SOFT_OUT, NULL);
6730}
6731
6732ALIAS (clear_ip_bgp_all_encap_soft_out,
6733 clear_ip_bgp_all_encap_out_cmd,
6734 "clear ip bgp * encap unicast out",
6735 CLEAR_STR
6736 IP_STR
6737 BGP_STR
6738 "Clear all peers\n"
6739 "Address family\n"
6740 "Address Family Modifier\n"
6741 "Soft reconfig outbound update\n")
6742
718e3744 6743DEFUN (clear_bgp_all_soft_out,
6744 clear_bgp_all_soft_out_cmd,
6745 "clear bgp * soft out",
6746 CLEAR_STR
6747 BGP_STR
6748 "Clear all peers\n"
e0bce756
DS
6749 BGP_SOFT_STR
6750 BGP_SOFT_OUT_STR)
718e3744 6751{
6aeb9e78
DS
6752 if (argc == 2)
6753 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all,
718e3744 6754 BGP_CLEAR_SOFT_OUT, NULL);
6755
6756 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6757 BGP_CLEAR_SOFT_OUT, NULL);
6758}
6759
6760ALIAS (clear_bgp_all_soft_out,
6761 clear_bgp_instance_all_soft_out_cmd,
8386ac43 6762 "clear bgp " BGP_INSTANCE_CMD " * soft out",
718e3744 6763 CLEAR_STR
6764 BGP_STR
8386ac43 6765 BGP_INSTANCE_HELP_STR
718e3744 6766 "Clear all peers\n"
e0bce756
DS
6767 BGP_SOFT_STR
6768 BGP_SOFT_OUT_STR)
718e3744 6769
6770ALIAS (clear_bgp_all_soft_out,
6771 clear_bgp_all_out_cmd,
6772 "clear bgp * out",
6773 CLEAR_STR
6774 BGP_STR
6775 "Clear all peers\n"
e0bce756 6776 BGP_SOFT_OUT_STR)
718e3744 6777
01080f7c 6778ALIAS (clear_bgp_all_soft_out,
6779 clear_bgp_instance_all_out_cmd,
6780 "clear bgp " BGP_INSTANCE_CMD " * out",
6781 CLEAR_STR
6782 BGP_STR
6783 BGP_INSTANCE_HELP_STR
6784 "Clear all peers\n"
6785 BGP_SOFT_OUT_STR)
6786
718e3744 6787ALIAS (clear_bgp_all_soft_out,
6788 clear_bgp_ipv6_all_soft_out_cmd,
6789 "clear bgp ipv6 * soft out",
6790 CLEAR_STR
6791 BGP_STR
6792 "Address family\n"
6793 "Clear all peers\n"
e0bce756
DS
6794 BGP_SOFT_STR
6795 BGP_SOFT_OUT_STR)
718e3744 6796
01080f7c 6797ALIAS (clear_bgp_all_soft_out,
6798 clear_bgp_instance_ipv6_all_soft_out_cmd,
6799 "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft out",
6800 CLEAR_STR
6801 BGP_STR
6802 BGP_INSTANCE_HELP_STR
6803 "Address family\n"
6804 "Clear all peers\n"
6805 BGP_SOFT_STR
6806 BGP_SOFT_OUT_STR)
6807
718e3744 6808ALIAS (clear_bgp_all_soft_out,
6809 clear_bgp_ipv6_all_out_cmd,
6810 "clear bgp ipv6 * out",
6811 CLEAR_STR
6812 BGP_STR
6813 "Address family\n"
6814 "Clear all peers\n"
e0bce756 6815 BGP_SOFT_OUT_STR)
718e3744 6816
01080f7c 6817ALIAS (clear_bgp_all_soft_out,
6818 clear_bgp_instance_ipv6_all_out_cmd,
6819 "clear bgp " BGP_INSTANCE_CMD " ipv6 * out",
6820 CLEAR_STR
6821 BGP_STR
6822 BGP_INSTANCE_HELP_STR
6823 "Address family\n"
6824 "Clear all peers\n"
6825 BGP_SOFT_OUT_STR)
6826
8ad7271d
DS
6827DEFUN (clear_bgp_ipv6_safi_prefix,
6828 clear_bgp_ipv6_safi_prefix_cmd,
6829 "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M",
6830 CLEAR_STR
6831 BGP_STR
6832 "Address family\n"
6833 "Address Family Modifier\n"
6834 "Clear bestpath and re-advertise\n"
6835 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6836{
6837 if (strncmp (argv[0], "m", 1) == 0)
6838 return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL);
6839 else
6840 return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL);
6841}
6842
01080f7c 6843DEFUN (clear_bgp_instance_ipv6_safi_prefix,
6844 clear_bgp_instance_ipv6_safi_prefix_cmd,
6845 "clear bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) prefix X:X::X:X/M",
6846 CLEAR_STR
6847 BGP_STR
6848 BGP_INSTANCE_HELP_STR
6849 "Address family\n"
6850 "Address Family Modifier\n"
6851 "Clear bestpath and re-advertise\n"
6852 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6853{
6854 if (strncmp (argv[2], "m", 1) == 0)
6855 return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_MULTICAST, NULL);
6856 else
6857 return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_UNICAST, NULL);
6858}
6859
718e3744 6860DEFUN (clear_ip_bgp_peer_soft_out,
6861 clear_ip_bgp_peer_soft_out_cmd,
db64ea86 6862 "clear ip bgp (A.B.C.D|WORD) soft out",
718e3744 6863 CLEAR_STR
6864 IP_STR
6865 BGP_STR
6866 "BGP neighbor address to clear\n"
db64ea86 6867 "BGP neighbor on interface to clear\n"
e0bce756
DS
6868 BGP_SOFT_STR
6869 BGP_SOFT_OUT_STR)
718e3744 6870{
01080f7c 6871 if (argc == 3)
6872 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
6873 BGP_CLEAR_SOFT_OUT, argv[2]);
6874
718e3744 6875 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6876 BGP_CLEAR_SOFT_OUT, argv[0]);
6877}
6878
01080f7c 6879ALIAS (clear_ip_bgp_peer_soft_out,
6880 clear_ip_bgp_instance_peer_soft_out_cmd,
6881 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft out",
6882 CLEAR_STR
6883 IP_STR
6884 BGP_STR
6885 BGP_INSTANCE_HELP_STR
6886 "BGP neighbor address to clear\n"
6887 "BGP neighbor on interface to clear\n"
6888 BGP_SOFT_STR
6889 BGP_SOFT_OUT_STR)
6890
718e3744 6891ALIAS (clear_ip_bgp_peer_soft_out,
6892 clear_ip_bgp_peer_out_cmd,
db64ea86 6893 "clear ip bgp (A.B.C.D|WORD) out",
718e3744 6894 CLEAR_STR
6895 IP_STR
6896 BGP_STR
6897 "BGP neighbor address to clear\n"
db64ea86 6898 "BGP neighbor on interface to clear\n"
e0bce756 6899 BGP_SOFT_OUT_STR)
718e3744 6900
01080f7c 6901ALIAS (clear_ip_bgp_peer_soft_out,
6902 clear_ip_bgp_instance_peer_out_cmd,
6903 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) out",
6904 CLEAR_STR
6905 IP_STR
6906 BGP_STR
6907 BGP_INSTANCE_HELP_STR
6908 "BGP neighbor address to clear\n"
6909 "BGP neighbor on interface to clear\n"
6910 BGP_SOFT_OUT_STR)
6911
718e3744 6912DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
6913 clear_ip_bgp_peer_ipv4_soft_out_cmd,
db64ea86 6914 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out",
718e3744 6915 CLEAR_STR
6916 IP_STR
6917 BGP_STR
6918 "BGP neighbor address to clear\n"
db64ea86 6919 "BGP neighbor on interface to clear\n"
718e3744 6920 "Address family\n"
6921 "Address Family modifier\n"
6922 "Address Family modifier\n"
e0bce756
DS
6923 BGP_SOFT_STR
6924 BGP_SOFT_OUT_STR)
718e3744 6925{
6926 if (strncmp (argv[1], "m", 1) == 0)
6927 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6928 BGP_CLEAR_SOFT_OUT, argv[0]);
6929
6930 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6931 BGP_CLEAR_SOFT_OUT, argv[0]);
6932}
6933
01080f7c 6934DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out,
6935 clear_ip_bgp_instance_peer_ipv4_soft_out_cmd,
6936 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out",
6937 CLEAR_STR
6938 IP_STR
6939 BGP_STR
6940 BGP_INSTANCE_HELP_STR
6941 "BGP neighbor address to clear\n"
6942 "BGP neighbor on interface to clear\n"
6943 "Address family\n"
6944 "Address Family modifier\n"
6945 "Address Family modifier\n"
6946 BGP_SOFT_STR
6947 BGP_SOFT_OUT_STR)
6948{
6949 if (strncmp (argv[3], "m", 1) == 0)
6950 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer,
6951 BGP_CLEAR_SOFT_OUT, argv[2]);
6952
6953 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
6954 BGP_CLEAR_SOFT_OUT, argv[2]);
6955}
6956
718e3744 6957ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
6958 clear_ip_bgp_peer_ipv4_out_cmd,
db64ea86 6959 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out",
718e3744 6960 CLEAR_STR
6961 IP_STR
6962 BGP_STR
6963 "BGP neighbor address to clear\n"
db64ea86 6964 "BGP neighbor on interface to clear\n"
718e3744 6965 "Address family\n"
6966 "Address Family modifier\n"
6967 "Address Family modifier\n"
e0bce756 6968 BGP_SOFT_OUT_STR)
718e3744 6969
01080f7c 6970ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_out,
6971 clear_ip_bgp_instance_peer_ipv4_out_cmd,
6972 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) out",
6973 CLEAR_STR
6974 IP_STR
6975 BGP_STR
6976 BGP_INSTANCE_HELP_STR
6977 "BGP neighbor address to clear\n"
6978 "BGP neighbor on interface to clear\n"
6979 "Address family\n"
6980 "Address Family modifier\n"
6981 "Address Family modifier\n"
6982 BGP_SOFT_OUT_STR)
6983
db64ea86 6984/* NOTE: WORD peers have not been tested for vpnv4 */
718e3744 6985DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
6986 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
db64ea86 6987 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft out",
718e3744 6988 CLEAR_STR
6989 IP_STR
6990 BGP_STR
6991 "BGP neighbor address to clear\n"
db64ea86 6992 "BGP neighbor on interface to clear\n"
718e3744 6993 "Address family\n"
6994 "Address Family Modifier\n"
e0bce756
DS
6995 BGP_SOFT_STR
6996 BGP_SOFT_OUT_STR)
718e3744 6997{
6998 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6999 BGP_CLEAR_SOFT_OUT, argv[0]);
7000}
7001
7002ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
7003 clear_ip_bgp_peer_vpnv4_out_cmd,
db64ea86 7004 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out",
718e3744 7005 CLEAR_STR
7006 IP_STR
7007 BGP_STR
7008 "BGP neighbor address to clear\n"
db64ea86 7009 "BGP neighbor on interface to clear\n"
718e3744 7010 "Address family\n"
7011 "Address Family Modifier\n"
e0bce756 7012 BGP_SOFT_OUT_STR)
718e3744 7013
587ff0fd
LB
7014DEFUN (clear_ip_bgp_peer_encap_soft_out,
7015 clear_ip_bgp_peer_encap_soft_out_cmd,
7016 "clear ip bgp A.B.C.D encap unicast soft out",
7017 CLEAR_STR
7018 IP_STR
7019 BGP_STR
7020 "BGP neighbor address to clear\n"
7021 "Address family\n"
7022 "Address Family Modifier\n"
7023 "Soft reconfig\n"
7024 "Soft reconfig outbound update\n")
7025{
7026 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
7027 BGP_CLEAR_SOFT_OUT, argv[0]);
7028}
7029
7030ALIAS (clear_ip_bgp_peer_encap_soft_out,
7031 clear_ip_bgp_peer_encap_out_cmd,
7032 "clear ip bgp A.B.C.D encap unicast out",
7033 CLEAR_STR
7034 IP_STR
7035 BGP_STR
7036 "BGP neighbor address to clear\n"
7037 "Address family\n"
7038 "Address Family Modifier\n"
7039 "Soft reconfig outbound update\n")
7040
718e3744 7041DEFUN (clear_bgp_peer_soft_out,
7042 clear_bgp_peer_soft_out_cmd,
a80beece 7043 "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out",
718e3744 7044 CLEAR_STR
7045 BGP_STR
7046 "BGP neighbor address to clear\n"
7047 "BGP IPv6 neighbor to clear\n"
a80beece 7048 "BGP neighbor on interface to clear\n"
e0bce756
DS
7049 BGP_SOFT_STR
7050 BGP_SOFT_OUT_STR)
718e3744 7051{
01080f7c 7052 if (argc == 3)
7053 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer,
7054 BGP_CLEAR_SOFT_OUT, argv[2]);
7055
718e3744 7056 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
7057 BGP_CLEAR_SOFT_OUT, argv[0]);
7058}
7059
01080f7c 7060ALIAS (clear_bgp_peer_soft_out,
7061 clear_bgp_instance_peer_soft_out_cmd,
7062 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft out",
7063 CLEAR_STR
7064 BGP_STR
7065 BGP_INSTANCE_HELP_STR
7066 "BGP neighbor address to clear\n"
7067 "BGP IPv6 neighbor to clear\n"
7068 "BGP neighbor on interface to clear\n"
7069 BGP_SOFT_STR
7070 BGP_SOFT_OUT_STR)
7071
718e3744 7072ALIAS (clear_bgp_peer_soft_out,
7073 clear_bgp_ipv6_peer_soft_out_cmd,
a80beece 7074 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out",
718e3744 7075 CLEAR_STR
7076 BGP_STR
7077 "Address family\n"
7078 "BGP neighbor address to clear\n"
7079 "BGP IPv6 neighbor to clear\n"
a80beece 7080 "BGP neighbor on interface to clear\n"
e0bce756
DS
7081 BGP_SOFT_STR
7082 BGP_SOFT_OUT_STR)
718e3744 7083
01080f7c 7084ALIAS (clear_bgp_peer_soft_out,
7085 clear_bgp_instance_ipv6_peer_soft_out_cmd,
7086 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft out",
7087 CLEAR_STR
7088 BGP_STR
7089 BGP_INSTANCE_HELP_STR
7090 "Address family\n"
7091 "BGP neighbor address to clear\n"
7092 "BGP IPv6 neighbor to clear\n"
7093 "BGP neighbor on interface to clear\n"
7094 BGP_SOFT_STR
7095 BGP_SOFT_OUT_STR)
7096
718e3744 7097ALIAS (clear_bgp_peer_soft_out,
7098 clear_bgp_peer_out_cmd,
a80beece 7099 "clear bgp (A.B.C.D|X:X::X:X|WORD) out",
718e3744 7100 CLEAR_STR
7101 BGP_STR
7102 "BGP neighbor address to clear\n"
7103 "BGP IPv6 neighbor to clear\n"
a80beece 7104 "BGP neighbor on interface to clear\n"
e0bce756 7105 BGP_SOFT_OUT_STR)
718e3744 7106
01080f7c 7107ALIAS (clear_bgp_peer_soft_out,
7108 clear_bgp_instance_peer_out_cmd,
7109 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) out",
7110 CLEAR_STR
7111 BGP_STR
7112 BGP_INSTANCE_HELP_STR
7113 "BGP neighbor address to clear\n"
7114 "BGP IPv6 neighbor to clear\n"
7115 "BGP neighbor on interface to clear\n"
7116 BGP_SOFT_OUT_STR)
7117
718e3744 7118ALIAS (clear_bgp_peer_soft_out,
7119 clear_bgp_ipv6_peer_out_cmd,
a80beece 7120 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out",
718e3744 7121 CLEAR_STR
7122 BGP_STR
7123 "Address family\n"
7124 "BGP neighbor address to clear\n"
7125 "BGP IPv6 neighbor to clear\n"
a80beece 7126 "BGP neighbor on interface to clear\n"
e0bce756 7127 BGP_SOFT_OUT_STR)
718e3744 7128
01080f7c 7129ALIAS (clear_bgp_peer_soft_out,
7130 clear_bgp_instance_ipv6_peer_out_cmd,
7131 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) out",
7132 CLEAR_STR
7133 BGP_STR
7134 BGP_INSTANCE_HELP_STR
7135 "Address family\n"
7136 "BGP neighbor address to clear\n"
7137 "BGP IPv6 neighbor to clear\n"
7138 "BGP neighbor on interface to clear\n"
7139 BGP_SOFT_OUT_STR)
7140
718e3744 7141DEFUN (clear_ip_bgp_peer_group_soft_out,
7142 clear_ip_bgp_peer_group_soft_out_cmd,
7143 "clear ip bgp peer-group WORD soft out",
7144 CLEAR_STR
7145 IP_STR
7146 BGP_STR
7147 "Clear all members of peer-group\n"
7148 "BGP peer-group name\n"
e0bce756
DS
7149 BGP_SOFT_STR
7150 BGP_SOFT_OUT_STR)
718e3744 7151{
01080f7c 7152 if (argc == 3)
7153 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
7154 BGP_CLEAR_SOFT_OUT, argv[2]);
7155
718e3744 7156 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
7157 BGP_CLEAR_SOFT_OUT, argv[0]);
7158}
7159
01080f7c 7160ALIAS (clear_ip_bgp_peer_group_soft_out,
7161 clear_ip_bgp_instance_peer_group_soft_out_cmd,
7162 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft out",
7163 CLEAR_STR
7164 IP_STR
7165 BGP_STR
7166 BGP_INSTANCE_HELP_STR
7167 "Clear all members of peer-group\n"
7168 "BGP peer-group name\n"
7169 BGP_SOFT_STR
7170 BGP_SOFT_OUT_STR)
7171
718e3744 7172ALIAS (clear_ip_bgp_peer_group_soft_out,
7173 clear_ip_bgp_peer_group_out_cmd,
7174 "clear ip bgp peer-group WORD out",
7175 CLEAR_STR
7176 IP_STR
7177 BGP_STR
7178 "Clear all members of peer-group\n"
7179 "BGP peer-group name\n"
e0bce756 7180 BGP_SOFT_OUT_STR)
718e3744 7181
01080f7c 7182ALIAS (clear_ip_bgp_peer_group_soft_out,
7183 clear_ip_bgp_instance_peer_group_out_cmd,
7184 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD out",
7185 CLEAR_STR
7186 IP_STR
7187 BGP_STR
7188 BGP_INSTANCE_HELP_STR
7189 "Clear all members of peer-group\n"
7190 "BGP peer-group name\n"
7191 BGP_SOFT_OUT_STR)
7192
718e3744 7193DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
7194 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
7195 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
7196 CLEAR_STR
7197 IP_STR
7198 BGP_STR
7199 "Clear all members of peer-group\n"
7200 "BGP peer-group name\n"
7201 "Address family\n"
7202 "Address Family modifier\n"
7203 "Address Family modifier\n"
e0bce756
DS
7204 BGP_SOFT_STR
7205 BGP_SOFT_OUT_STR)
718e3744 7206{
7207 if (strncmp (argv[1], "m", 1) == 0)
7208 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
7209 BGP_CLEAR_SOFT_OUT, argv[0]);
7210
7211 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
7212 BGP_CLEAR_SOFT_OUT, argv[0]);
7213}
7214
01080f7c 7215DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out,
7216 clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd,
7217 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft out",
7218 CLEAR_STR
7219 IP_STR
7220 BGP_STR
7221 BGP_INSTANCE_HELP_STR
7222 "Clear all members of peer-group\n"
7223 "BGP peer-group name\n"
7224 "Address family\n"
7225 "Address Family modifier\n"
7226 "Address Family modifier\n"
7227 BGP_SOFT_STR
7228 BGP_SOFT_OUT_STR)
7229{
7230 if (strncmp (argv[3], "m", 1) == 0)
7231 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group,
7232 BGP_CLEAR_SOFT_OUT, argv[2]);
7233
7234 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
7235 BGP_CLEAR_SOFT_OUT, argv[2]);
7236}
7237
718e3744 7238ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
7239 clear_ip_bgp_peer_group_ipv4_out_cmd,
7240 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
7241 CLEAR_STR
7242 IP_STR
7243 BGP_STR
7244 "Clear all members of peer-group\n"
7245 "BGP peer-group name\n"
7246 "Address family\n"
7247 "Address Family modifier\n"
7248 "Address Family modifier\n"
e0bce756 7249 BGP_SOFT_OUT_STR)
718e3744 7250
01080f7c 7251ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_out,
7252 clear_ip_bgp_instance_peer_group_ipv4_out_cmd,
7253 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) out",
7254 CLEAR_STR
7255 IP_STR
7256 BGP_STR
7257 BGP_INSTANCE_HELP_STR
7258 "Clear all members of peer-group\n"
7259 "BGP peer-group name\n"
7260 "Address family\n"
7261 "Address Family modifier\n"
7262 "Address Family modifier\n"
7263 BGP_SOFT_OUT_STR)
7264
718e3744 7265DEFUN (clear_bgp_peer_group_soft_out,
7266 clear_bgp_peer_group_soft_out_cmd,
7267 "clear bgp peer-group WORD soft out",
7268 CLEAR_STR
7269 BGP_STR
7270 "Clear all members of peer-group\n"
7271 "BGP peer-group name\n"
e0bce756
DS
7272 BGP_SOFT_STR
7273 BGP_SOFT_OUT_STR)
718e3744 7274{
01080f7c 7275 if (argc == 3)
7276 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group,
7277 BGP_CLEAR_SOFT_OUT, argv[2]);
7278
718e3744 7279 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
7280 BGP_CLEAR_SOFT_OUT, argv[0]);
7281}
7282
01080f7c 7283ALIAS (clear_bgp_peer_group_soft_out,
7284 clear_bgp_instance_peer_group_soft_out_cmd,
7285 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft out",
7286 CLEAR_STR
7287 BGP_STR
7288 BGP_INSTANCE_HELP_STR
7289 "Clear all members of peer-group\n"
7290 "BGP peer-group name\n"
7291 BGP_SOFT_STR
7292 BGP_SOFT_OUT_STR)
7293
718e3744 7294ALIAS (clear_bgp_peer_group_soft_out,
7295 clear_bgp_ipv6_peer_group_soft_out_cmd,
7296 "clear bgp ipv6 peer-group WORD soft out",
7297 CLEAR_STR
7298 BGP_STR
7299 "Address family\n"
7300 "Clear all members of peer-group\n"
7301 "BGP peer-group name\n"
e0bce756
DS
7302 BGP_SOFT_STR
7303 BGP_SOFT_OUT_STR)
718e3744 7304
01080f7c 7305ALIAS (clear_bgp_peer_group_soft_out,
7306 clear_bgp_instance_ipv6_peer_group_soft_out_cmd,
7307 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft out",
7308 CLEAR_STR
7309 BGP_STR
7310 BGP_INSTANCE_HELP_STR
7311 "Address family\n"
7312 "Clear all members of peer-group\n"
7313 "BGP peer-group name\n"
7314 BGP_SOFT_STR
7315 BGP_SOFT_OUT_STR)
7316
718e3744 7317ALIAS (clear_bgp_peer_group_soft_out,
7318 clear_bgp_peer_group_out_cmd,
7319 "clear bgp peer-group WORD out",
7320 CLEAR_STR
7321 BGP_STR
7322 "Clear all members of peer-group\n"
7323 "BGP peer-group name\n"
e0bce756 7324 BGP_SOFT_OUT_STR)
718e3744 7325
01080f7c 7326ALIAS (clear_bgp_peer_group_soft_out,
7327 clear_bgp_instance_peer_group_out_cmd,
7328 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD out",
7329 CLEAR_STR
7330 BGP_STR
7331 BGP_INSTANCE_HELP_STR
7332 "Clear all members of peer-group\n"
7333 "BGP peer-group name\n"
7334 BGP_SOFT_OUT_STR)
7335
718e3744 7336ALIAS (clear_bgp_peer_group_soft_out,
7337 clear_bgp_ipv6_peer_group_out_cmd,
7338 "clear bgp ipv6 peer-group WORD out",
7339 CLEAR_STR
7340 BGP_STR
7341 "Address family\n"
7342 "Clear all members of peer-group\n"
7343 "BGP peer-group name\n"
e0bce756 7344 BGP_SOFT_OUT_STR)
718e3744 7345
01080f7c 7346ALIAS (clear_bgp_peer_group_soft_out,
7347 clear_bgp_instance_ipv6_peer_group_out_cmd,
7348 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD out",
7349 CLEAR_STR
7350 BGP_STR
7351 BGP_INSTANCE_HELP_STR
7352 "Address family\n"
7353 "Clear all members of peer-group\n"
7354 "BGP peer-group name\n"
7355 BGP_SOFT_OUT_STR)
7356
718e3744 7357DEFUN (clear_ip_bgp_external_soft_out,
7358 clear_ip_bgp_external_soft_out_cmd,
7359 "clear ip bgp external soft out",
7360 CLEAR_STR
7361 IP_STR
7362 BGP_STR
7363 "Clear all external peers\n"
e0bce756
DS
7364 BGP_SOFT_STR
7365 BGP_SOFT_OUT_STR)
01080f7c 7366{
7367 if (argc == 2)
7368 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
7369 BGP_CLEAR_SOFT_OUT, NULL);
7370
7371 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
7372 BGP_CLEAR_SOFT_OUT, NULL);
7373}
7374
7375ALIAS (clear_ip_bgp_external_soft_out,
7376 clear_ip_bgp_instance_external_soft_out_cmd,
7377 "clear ip bgp " BGP_INSTANCE_CMD " external soft out",
7378 CLEAR_STR
7379 IP_STR
7380 BGP_STR
7381 BGP_INSTANCE_HELP_STR
7382 "Clear all external peers\n"
7383 BGP_SOFT_STR
7384 BGP_SOFT_OUT_STR)
7385
7386ALIAS (clear_ip_bgp_external_soft_out,
7387 clear_ip_bgp_external_out_cmd,
7388 "clear ip bgp external out",
7389 CLEAR_STR
7390 IP_STR
7391 BGP_STR
7392 "Clear all external peers\n"
7393 BGP_SOFT_OUT_STR)
718e3744 7394
7395ALIAS (clear_ip_bgp_external_soft_out,
01080f7c 7396 clear_ip_bgp_instance_external_out_cmd,
7397 "clear ip bgp " BGP_INSTANCE_CMD " external out",
718e3744 7398 CLEAR_STR
7399 IP_STR
7400 BGP_STR
01080f7c 7401 BGP_INSTANCE_HELP_STR
718e3744 7402 "Clear all external peers\n"
e0bce756 7403 BGP_SOFT_OUT_STR)
718e3744 7404
7405DEFUN (clear_ip_bgp_external_ipv4_soft_out,
7406 clear_ip_bgp_external_ipv4_soft_out_cmd,
7407 "clear ip bgp external ipv4 (unicast|multicast) soft out",
7408 CLEAR_STR
7409 IP_STR
7410 BGP_STR
7411 "Clear all external peers\n"
7412 "Address family\n"
7413 "Address Family modifier\n"
7414 "Address Family modifier\n"
e0bce756
DS
7415 BGP_SOFT_STR
7416 BGP_SOFT_OUT_STR)
718e3744 7417{
7418 if (strncmp (argv[0], "m", 1) == 0)
7419 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
7420 BGP_CLEAR_SOFT_OUT, NULL);
7421
7422 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
7423 BGP_CLEAR_SOFT_OUT, NULL);
7424}
7425
01080f7c 7426DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out,
7427 clear_ip_bgp_instance_external_ipv4_soft_out_cmd,
7428 "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft out",
7429 CLEAR_STR
7430 IP_STR
7431 BGP_STR
7432 BGP_INSTANCE_HELP_STR
7433 "Clear all external peers\n"
7434 "Address family\n"
7435 "Address Family modifier\n"
7436 "Address Family modifier\n"
7437 BGP_SOFT_STR
7438 BGP_SOFT_OUT_STR)
7439{
7440 if (strncmp (argv[2], "m", 1) == 0)
7441 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external,
7442 BGP_CLEAR_SOFT_OUT, NULL);
7443
7444 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
7445 BGP_CLEAR_SOFT_OUT, NULL);
7446}
7447
718e3744 7448ALIAS (clear_ip_bgp_external_ipv4_soft_out,
7449 clear_ip_bgp_external_ipv4_out_cmd,
7450 "clear ip bgp external ipv4 (unicast|multicast) out",
7451 CLEAR_STR
7452 IP_STR
7453 BGP_STR
7454 "Clear all external peers\n"
7455 "Address family\n"
7456 "Address Family modifier\n"
7457 "Address Family modifier\n"
e0bce756 7458 BGP_SOFT_OUT_STR)
718e3744 7459
01080f7c 7460ALIAS (clear_ip_bgp_instance_external_ipv4_soft_out,
7461 clear_ip_bgp_instance_external_ipv4_out_cmd,
7462 "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) out",
7463 CLEAR_STR
7464 IP_STR
7465 BGP_STR
7466 BGP_INSTANCE_HELP_STR
7467 "Clear all external peers\n"
7468 "Address family\n"
7469 "Address Family modifier\n"
7470 "Address Family modifier\n"
7471 BGP_SOFT_OUT_STR)
7472
718e3744 7473DEFUN (clear_bgp_external_soft_out,
7474 clear_bgp_external_soft_out_cmd,
7475 "clear bgp external soft out",
7476 CLEAR_STR
7477 BGP_STR
7478 "Clear all external peers\n"
e0bce756
DS
7479 BGP_SOFT_STR
7480 BGP_SOFT_OUT_STR)
718e3744 7481{
01080f7c 7482 if (argc == 2)
7483 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external,
7484 BGP_CLEAR_SOFT_OUT, NULL);
7485
718e3744 7486 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
7487 BGP_CLEAR_SOFT_OUT, NULL);
7488}
7489
01080f7c 7490ALIAS (clear_bgp_external_soft_out,
7491 clear_bgp_instance_external_soft_out_cmd,
7492 "clear bgp " BGP_INSTANCE_CMD " external soft out",
7493 CLEAR_STR
7494 BGP_STR
7495 BGP_INSTANCE_HELP_STR
7496 "Clear all external peers\n"
7497 BGP_SOFT_STR
7498 BGP_SOFT_OUT_STR)
7499
718e3744 7500ALIAS (clear_bgp_external_soft_out,
7501 clear_bgp_ipv6_external_soft_out_cmd,
7502 "clear bgp ipv6 external soft out",
7503 CLEAR_STR
7504 BGP_STR
7505 "Address family\n"
7506 "Clear all external peers\n"
e0bce756
DS
7507 BGP_SOFT_STR
7508 BGP_SOFT_OUT_STR)
718e3744 7509
01080f7c 7510ALIAS (clear_bgp_external_soft_out,
7511 clear_bgp_instance_ipv6_external_soft_out_cmd,
7512 "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft out",
7513 CLEAR_STR
7514 BGP_STR
7515 BGP_INSTANCE_HELP_STR
7516 "Address family\n"
7517 "Clear all external peers\n"
7518 BGP_SOFT_STR
7519 BGP_SOFT_OUT_STR)
7520
718e3744 7521ALIAS (clear_bgp_external_soft_out,
7522 clear_bgp_external_out_cmd,
7523 "clear bgp external out",
7524 CLEAR_STR
7525 BGP_STR
7526 "Clear all external peers\n"
e0bce756 7527 BGP_SOFT_OUT_STR)
718e3744 7528
01080f7c 7529ALIAS (clear_bgp_external_soft_out,
7530 clear_bgp_instance_external_out_cmd,
7531 "clear bgp " BGP_INSTANCE_CMD " external out",
7532 CLEAR_STR
7533 BGP_STR
7534 BGP_INSTANCE_HELP_STR
7535 "Clear all external peers\n"
7536 BGP_SOFT_OUT_STR)
7537
718e3744 7538ALIAS (clear_bgp_external_soft_out,
7539 clear_bgp_ipv6_external_out_cmd,
7540 "clear bgp ipv6 external WORD out",
7541 CLEAR_STR
7542 BGP_STR
7543 "Address family\n"
7544 "Clear all external peers\n"
e0bce756 7545 BGP_SOFT_OUT_STR)
718e3744 7546
01080f7c 7547ALIAS (clear_bgp_external_soft_out,
7548 clear_bgp_instance_ipv6_external_out_cmd,
7549 "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD out",
7550 CLEAR_STR
7551 BGP_STR
7552 BGP_INSTANCE_HELP_STR
7553 "Address family\n"
7554 "Clear all external peers\n"
7555 BGP_SOFT_OUT_STR)
7556
718e3744 7557DEFUN (clear_ip_bgp_as_soft_out,
7558 clear_ip_bgp_as_soft_out_cmd,
320da874 7559 "clear ip bgp " CMD_AS_RANGE " soft out",
718e3744 7560 CLEAR_STR
7561 IP_STR
7562 BGP_STR
7563 "Clear peers with the AS number\n"
e0bce756
DS
7564 BGP_SOFT_STR
7565 BGP_SOFT_OUT_STR)
718e3744 7566{
01080f7c 7567 if (argc == 3)
7568 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
7569 BGP_CLEAR_SOFT_OUT, argv[2]);
7570
718e3744 7571 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
7572 BGP_CLEAR_SOFT_OUT, argv[0]);
7573}
7574
01080f7c 7575ALIAS (clear_ip_bgp_as_soft_out,
7576 clear_ip_bgp_instance_as_soft_out_cmd,
7577 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out",
7578 CLEAR_STR
7579 IP_STR
7580 BGP_STR
7581 BGP_INSTANCE_HELP_STR
7582 "Clear peers with the AS number\n"
7583 BGP_SOFT_STR
7584 BGP_SOFT_OUT_STR)
7585
718e3744 7586ALIAS (clear_ip_bgp_as_soft_out,
7587 clear_ip_bgp_as_out_cmd,
320da874 7588 "clear ip bgp " CMD_AS_RANGE " out",
718e3744 7589 CLEAR_STR
7590 IP_STR
7591 BGP_STR
7592 "Clear peers with the AS number\n"
e0bce756 7593 BGP_SOFT_OUT_STR)
718e3744 7594
01080f7c 7595ALIAS (clear_ip_bgp_as_soft_out,
7596 clear_ip_bgp_instance_as_out_cmd,
7597 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out",
7598 CLEAR_STR
7599 IP_STR
7600 BGP_STR
7601 BGP_INSTANCE_HELP_STR
7602 "Clear peers with the AS number\n"
7603 BGP_SOFT_OUT_STR)
7604
718e3744 7605DEFUN (clear_ip_bgp_as_ipv4_soft_out,
7606 clear_ip_bgp_as_ipv4_soft_out_cmd,
320da874 7607 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
718e3744 7608 CLEAR_STR
7609 IP_STR
7610 BGP_STR
7611 "Clear peers with the AS number\n"
7612 "Address family\n"
7613 "Address Family modifier\n"
7614 "Address Family modifier\n"
e0bce756
DS
7615 BGP_SOFT_STR
7616 BGP_SOFT_OUT_STR)
718e3744 7617{
7618 if (strncmp (argv[1], "m", 1) == 0)
7619 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
7620 BGP_CLEAR_SOFT_OUT, argv[0]);
7621
7622 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
7623 BGP_CLEAR_SOFT_OUT, argv[0]);
7624}
7625
01080f7c 7626DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out,
7627 clear_ip_bgp_instance_as_ipv4_soft_out_cmd,
7628 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
7629 CLEAR_STR
7630 IP_STR
7631 BGP_STR
7632 BGP_INSTANCE_HELP_STR
7633 "Clear peers with the AS number\n"
7634 "Address family\n"
7635 "Address Family modifier\n"
7636 "Address Family modifier\n"
7637 BGP_SOFT_STR
7638 BGP_SOFT_OUT_STR)
7639{
7640 if (strncmp (argv[3], "m", 1) == 0)
7641 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as,
7642 BGP_CLEAR_SOFT_OUT, argv[2]);
7643
7644 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
7645 BGP_CLEAR_SOFT_OUT, argv[2]);
7646}
7647
718e3744 7648ALIAS (clear_ip_bgp_as_ipv4_soft_out,
7649 clear_ip_bgp_as_ipv4_out_cmd,
320da874 7650 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
718e3744 7651 CLEAR_STR
7652 IP_STR
7653 BGP_STR
7654 "Clear peers with the AS number\n"
7655 "Address family\n"
7656 "Address Family modifier\n"
7657 "Address Family modifier\n"
e0bce756 7658 BGP_SOFT_OUT_STR)
718e3744 7659
01080f7c 7660ALIAS (clear_ip_bgp_instance_as_ipv4_soft_out,
7661 clear_ip_bgp_instance_as_ipv4_out_cmd,
7662 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
7663 CLEAR_STR
7664 IP_STR
7665 BGP_STR
7666 BGP_INSTANCE_HELP_STR
7667 "Clear peers with the AS number\n"
7668 "Address family\n"
7669 "Address Family modifier\n"
7670 "Address Family modifier\n"
7671 BGP_SOFT_OUT_STR)
7672
718e3744 7673DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
7674 clear_ip_bgp_as_vpnv4_soft_out_cmd,
320da874 7675 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
718e3744 7676 CLEAR_STR
7677 IP_STR
7678 BGP_STR
7679 "Clear peers with the AS number\n"
7680 "Address family\n"
7681 "Address Family modifier\n"
e0bce756
DS
7682 BGP_SOFT_STR
7683 BGP_SOFT_OUT_STR)
718e3744 7684{
7685 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
7686 BGP_CLEAR_SOFT_OUT, argv[0]);
7687}
7688
7689ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
7690 clear_ip_bgp_as_vpnv4_out_cmd,
320da874 7691 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
718e3744 7692 CLEAR_STR
7693 IP_STR
7694 BGP_STR
7695 "Clear peers with the AS number\n"
7696 "Address family\n"
7697 "Address Family modifier\n"
e0bce756 7698 BGP_SOFT_OUT_STR)
718e3744 7699
587ff0fd
LB
7700DEFUN (clear_ip_bgp_as_encap_soft_out,
7701 clear_ip_bgp_as_encap_soft_out_cmd,
7702 "clear ip bgp " CMD_AS_RANGE " encap unicast soft out",
7703 CLEAR_STR
7704 IP_STR
7705 BGP_STR
7706 "Clear peers with the AS number\n"
7707 "Address family\n"
7708 "Address Family modifier\n"
7709 "Soft reconfig\n"
7710 "Soft reconfig outbound update\n")
7711{
7712 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
7713 BGP_CLEAR_SOFT_OUT, argv[0]);
7714}
7715
7716ALIAS (clear_ip_bgp_as_encap_soft_out,
7717 clear_ip_bgp_as_encap_out_cmd,
7718 "clear ip bgp " CMD_AS_RANGE " encap unicast out",
7719 CLEAR_STR
7720 IP_STR
7721 BGP_STR
7722 "Clear peers with the AS number\n"
7723 "Address family\n"
7724 "Address Family modifier\n"
7725 "Soft reconfig outbound update\n")
7726
718e3744 7727DEFUN (clear_bgp_as_soft_out,
7728 clear_bgp_as_soft_out_cmd,
320da874 7729 "clear bgp " CMD_AS_RANGE " soft out",
718e3744 7730 CLEAR_STR
7731 BGP_STR
7732 "Clear peers with the AS number\n"
e0bce756
DS
7733 BGP_SOFT_STR
7734 BGP_SOFT_OUT_STR)
718e3744 7735{
01080f7c 7736 if (argc == 3)
7737 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as,
7738 BGP_CLEAR_SOFT_OUT, argv[2]);
7739
718e3744 7740 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
7741 BGP_CLEAR_SOFT_OUT, argv[0]);
7742}
7743
01080f7c 7744ALIAS (clear_bgp_as_soft_out,
7745 clear_bgp_instance_as_soft_out_cmd,
7746 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out",
7747 CLEAR_STR
7748 BGP_STR
7749 BGP_INSTANCE_HELP_STR
7750 "Clear peers with the AS number\n"
7751 BGP_SOFT_STR
7752 BGP_SOFT_OUT_STR)
7753
718e3744 7754ALIAS (clear_bgp_as_soft_out,
7755 clear_bgp_ipv6_as_soft_out_cmd,
320da874 7756 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
718e3744 7757 CLEAR_STR
7758 BGP_STR
7759 "Address family\n"
7760 "Clear peers with the AS number\n"
e0bce756
DS
7761 BGP_SOFT_STR
7762 BGP_SOFT_OUT_STR)
718e3744 7763
01080f7c 7764ALIAS (clear_bgp_as_soft_out,
7765 clear_bgp_instance_ipv6_as_soft_out_cmd,
7766 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft out",
7767 CLEAR_STR
7768 BGP_STR
7769 BGP_INSTANCE_HELP_STR
7770 "Address family\n"
7771 "Clear peers with the AS number\n"
7772 BGP_SOFT_STR
7773 BGP_SOFT_OUT_STR)
7774
718e3744 7775ALIAS (clear_bgp_as_soft_out,
7776 clear_bgp_as_out_cmd,
320da874 7777 "clear bgp " CMD_AS_RANGE " out",
718e3744 7778 CLEAR_STR
7779 BGP_STR
7780 "Clear peers with the AS number\n"
e0bce756 7781 BGP_SOFT_OUT_STR)
718e3744 7782
01080f7c 7783ALIAS (clear_bgp_as_soft_out,
7784 clear_bgp_instance_as_out_cmd,
7785 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out",
7786 CLEAR_STR
7787 BGP_STR
7788 BGP_INSTANCE_HELP_STR
7789 "Clear peers with the AS number\n"
7790 BGP_SOFT_OUT_STR)
7791
718e3744 7792ALIAS (clear_bgp_as_soft_out,
7793 clear_bgp_ipv6_as_out_cmd,
320da874 7794 "clear bgp ipv6 " CMD_AS_RANGE " out",
718e3744 7795 CLEAR_STR
7796 BGP_STR
7797 "Address family\n"
7798 "Clear peers with the AS number\n"
e0bce756 7799 BGP_SOFT_OUT_STR)
6b0655a2 7800
01080f7c 7801ALIAS (clear_bgp_as_soft_out,
7802 clear_bgp_instance_ipv6_as_out_cmd,
7803 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " out",
7804 CLEAR_STR
7805 BGP_STR
7806 BGP_INSTANCE_HELP_STR
7807 "Address family\n"
7808 "Clear peers with the AS number\n"
7809 BGP_SOFT_OUT_STR)
7810
718e3744 7811/* Inbound soft-reconfiguration */
7812DEFUN (clear_ip_bgp_all_soft_in,
7813 clear_ip_bgp_all_soft_in_cmd,
7814 "clear ip bgp * soft in",
7815 CLEAR_STR
7816 IP_STR
7817 BGP_STR
7818 "Clear all peers\n"
e0bce756
DS
7819 BGP_SOFT_STR
7820 BGP_SOFT_IN_STR)
718e3744 7821{
6aeb9e78
DS
7822 if (argc == 2)
7823 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
718e3744 7824 BGP_CLEAR_SOFT_IN, NULL);
7825
7826 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7827 BGP_CLEAR_SOFT_IN, NULL);
7828}
7829
7830ALIAS (clear_ip_bgp_all_soft_in,
7831 clear_ip_bgp_instance_all_soft_in_cmd,
8386ac43 7832 "clear ip bgp " BGP_INSTANCE_CMD " * soft in",
718e3744 7833 CLEAR_STR
7834 IP_STR
7835 BGP_STR
8386ac43 7836 BGP_INSTANCE_HELP_STR
718e3744 7837 "Clear all peers\n"
e0bce756
DS
7838 BGP_SOFT_STR
7839 BGP_SOFT_IN_STR)
718e3744 7840
7841ALIAS (clear_ip_bgp_all_soft_in,
7842 clear_ip_bgp_all_in_cmd,
7843 "clear ip bgp * in",
7844 CLEAR_STR
7845 IP_STR
7846 BGP_STR
7847 "Clear all peers\n"
e0bce756 7848 BGP_SOFT_IN_STR)
718e3744 7849
01080f7c 7850ALIAS (clear_ip_bgp_all_soft_in,
7851 clear_ip_bgp_instance_all_in_cmd,
7852 "clear ip bgp " BGP_INSTANCE_CMD " * in",
7853 CLEAR_STR
7854 IP_STR
7855 BGP_STR
7856 BGP_INSTANCE_HELP_STR
7857 "Clear all peers\n"
7858 BGP_SOFT_IN_STR)
7859
718e3744 7860DEFUN (clear_ip_bgp_all_in_prefix_filter,
7861 clear_ip_bgp_all_in_prefix_filter_cmd,
7862 "clear ip bgp * in prefix-filter",
7863 CLEAR_STR
7864 IP_STR
7865 BGP_STR
7866 "Clear all peers\n"
e0bce756 7867 BGP_SOFT_IN_STR
718e3744 7868 "Push out prefix-list ORF and do inbound soft reconfig\n")
7869{
6aeb9e78
DS
7870 if (argc== 2)
7871 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
718e3744 7872 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
7873
7874 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7875 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
7876}
7877
718e3744 7878DEFUN (clear_ip_bgp_all_ipv4_soft_in,
7879 clear_ip_bgp_all_ipv4_soft_in_cmd,
7880 "clear ip bgp * ipv4 (unicast|multicast) soft in",
7881 CLEAR_STR
7882 IP_STR
7883 BGP_STR
7884 "Clear all peers\n"
7885 "Address family\n"
7886 "Address Family modifier\n"
7887 "Address Family modifier\n"
e0bce756
DS
7888 BGP_SOFT_STR
7889 BGP_SOFT_IN_STR)
718e3744 7890{
7891 if (strncmp (argv[0], "m", 1) == 0)
7892 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
7893 BGP_CLEAR_SOFT_IN, NULL);
7894
7895 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7896 BGP_CLEAR_SOFT_IN, NULL);
7897}
7898
718e3744 7899DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
7900 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
8386ac43 7901 "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft in",
718e3744 7902 CLEAR_STR
7903 IP_STR
7904 BGP_STR
8386ac43 7905 BGP_INSTANCE_HELP_STR
718e3744 7906 "Clear all peers\n"
7907 "Address family\n"
7908 "Address Family modifier\n"
7909 "Address Family modifier\n"
e0bce756
DS
7910 BGP_SOFT_STR
7911 BGP_SOFT_IN_STR)
718e3744 7912{
6aeb9e78
DS
7913 if (strncmp (argv[2], "m", 1) == 0)
7914 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all,
718e3744 7915 BGP_CLEAR_SOFT_IN, NULL);
7916
6aeb9e78 7917 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
718e3744 7918 BGP_CLEAR_SOFT_IN, NULL);
7919}
7920
01080f7c 7921ALIAS (clear_ip_bgp_all_ipv4_soft_in,
7922 clear_ip_bgp_all_ipv4_in_cmd,
7923 "clear ip bgp * ipv4 (unicast|multicast) in",
718e3744 7924 CLEAR_STR
7925 IP_STR
7926 BGP_STR
7927 "Clear all peers\n"
7928 "Address family\n"
7929 "Address Family modifier\n"
7930 "Address Family modifier\n"
01080f7c 7931 BGP_SOFT_IN_STR)
718e3744 7932
01080f7c 7933ALIAS (clear_ip_bgp_instance_all_ipv4_soft_in,
7934 clear_ip_bgp_instance_all_ipv4_in_cmd,
7935 "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) in",
7936 CLEAR_STR
7937 IP_STR
7938 BGP_STR
7939 BGP_INSTANCE_HELP_STR
7940 "Clear all peers\n"
7941 "Address family\n"
7942 "Address Family modifier\n"
7943 "Address Family modifier\n"
7944 BGP_SOFT_IN_STR)
718e3744 7945
01080f7c 7946DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
7947 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
7948 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
718e3744 7949 CLEAR_STR
7950 IP_STR
7951 BGP_STR
7952 "Clear all peers\n"
7953 "Address family\n"
7954 "Address Family modifier\n"
7955 "Address Family modifier\n"
e0bce756 7956 BGP_SOFT_IN_STR
718e3744 7957 "Push out prefix-list ORF and do inbound soft reconfig\n")
7958{
01080f7c 7959 if (strncmp (argv[0], "m", 1) == 0)
7960 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
7961 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
718e3744 7962
01080f7c 7963 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7964 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
718e3744 7965}
7966
7967DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
7968 clear_ip_bgp_all_vpnv4_soft_in_cmd,
7969 "clear ip bgp * vpnv4 unicast soft in",
7970 CLEAR_STR
7971 IP_STR
7972 BGP_STR
7973 "Clear all peers\n"
7974 "Address family\n"
7975 "Address Family Modifier\n"
e0bce756
DS
7976 BGP_SOFT_STR
7977 BGP_SOFT_IN_STR)
718e3744 7978{
7979 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
7980 BGP_CLEAR_SOFT_IN, NULL);
7981}
7982
7983ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
7984 clear_ip_bgp_all_vpnv4_in_cmd,
7985 "clear ip bgp * vpnv4 unicast in",
7986 CLEAR_STR
7987 IP_STR
7988 BGP_STR
7989 "Clear all peers\n"
7990 "Address family\n"
7991 "Address Family Modifier\n"
e0bce756 7992 BGP_SOFT_IN_STR)
718e3744 7993
587ff0fd
LB
7994DEFUN (clear_ip_bgp_all_encap_soft_in,
7995 clear_ip_bgp_all_encap_soft_in_cmd,
7996 "clear ip bgp * encap unicast soft in",
7997 CLEAR_STR
7998 IP_STR
7999 BGP_STR
8000 "Clear all peers\n"
8001 "Address family\n"
8002 "Address Family Modifier\n"
8003 "Soft reconfig\n"
8004 "Soft reconfig inbound update\n")
8005{
8006 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
8007 BGP_CLEAR_SOFT_IN, NULL);
8008}
8009
8010ALIAS (clear_ip_bgp_all_encap_soft_in,
8011 clear_ip_bgp_all_encap_in_cmd,
8012 "clear ip bgp * encap unicast in",
8013 CLEAR_STR
8014 IP_STR
8015 BGP_STR
8016 "Clear all peers\n"
8017 "Address family\n"
8018 "Address Family Modifier\n"
8019 "Soft reconfig inbound update\n")
8020
718e3744 8021DEFUN (clear_bgp_all_soft_in,
8022 clear_bgp_all_soft_in_cmd,
8023 "clear bgp * soft in",
8024 CLEAR_STR
8025 BGP_STR
8026 "Clear all peers\n"
e0bce756
DS
8027 BGP_SOFT_STR
8028 BGP_SOFT_IN_STR)
718e3744 8029{
6aeb9e78
DS
8030 if (argc == 2)
8031 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all,
718e3744 8032 BGP_CLEAR_SOFT_IN, NULL);
8033
8034 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
8035 BGP_CLEAR_SOFT_IN, NULL);
8036}
8037
8038ALIAS (clear_bgp_all_soft_in,
8039 clear_bgp_instance_all_soft_in_cmd,
8386ac43 8040 "clear bgp " BGP_INSTANCE_CMD " * soft in",
718e3744 8041 CLEAR_STR
8042 BGP_STR
8386ac43 8043 BGP_INSTANCE_HELP_STR
718e3744 8044 "Clear all peers\n"
e0bce756
DS
8045 BGP_SOFT_STR
8046 BGP_SOFT_IN_STR)
718e3744 8047
8048ALIAS (clear_bgp_all_soft_in,
8049 clear_bgp_ipv6_all_soft_in_cmd,
8050 "clear bgp ipv6 * soft in",
8051 CLEAR_STR
8052 BGP_STR
8053 "Address family\n"
8054 "Clear all peers\n"
e0bce756
DS
8055 BGP_SOFT_STR
8056 BGP_SOFT_IN_STR)
718e3744 8057
01080f7c 8058ALIAS (clear_bgp_all_soft_in,
8059 clear_bgp_instance_ipv6_all_soft_in_cmd,
8060 "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft in",
8061 CLEAR_STR
8062 BGP_STR
8063 BGP_INSTANCE_HELP_STR
8064 "Address family\n"
8065 "Clear all peers\n"
8066 BGP_SOFT_STR
8067 BGP_SOFT_IN_STR)
8068
718e3744 8069ALIAS (clear_bgp_all_soft_in,
8070 clear_bgp_all_in_cmd,
8071 "clear bgp * in",
8072 CLEAR_STR
8073 BGP_STR
8074 "Clear all peers\n"
e0bce756 8075 BGP_SOFT_IN_STR)
718e3744 8076
01080f7c 8077ALIAS (clear_bgp_all_soft_in,
8078 clear_bgp_instance_all_in_cmd,
8079 "clear bgp " BGP_INSTANCE_CMD " * in",
8080 CLEAR_STR
8081 BGP_STR
8082 BGP_INSTANCE_HELP_STR
8083 "Clear all peers\n"
8084 BGP_SOFT_IN_STR)
8085
718e3744 8086ALIAS (clear_bgp_all_soft_in,
8087 clear_bgp_ipv6_all_in_cmd,
8088 "clear bgp ipv6 * in",
8089 CLEAR_STR
8090 BGP_STR
8091 "Address family\n"
8092 "Clear all peers\n"
e0bce756 8093 BGP_SOFT_IN_STR)
718e3744 8094
01080f7c 8095ALIAS (clear_bgp_all_soft_in,
8096 clear_bgp_instance_ipv6_all_in_cmd,
8097 "clear bgp " BGP_INSTANCE_CMD " ipv6 * in",
8098 CLEAR_STR
8099 BGP_STR
8100 BGP_INSTANCE_HELP_STR
8101 "Address family\n"
8102 "Clear all peers\n"
8103 BGP_SOFT_IN_STR)
8104
718e3744 8105DEFUN (clear_bgp_all_in_prefix_filter,
8106 clear_bgp_all_in_prefix_filter_cmd,
8107 "clear bgp * in prefix-filter",
8108 CLEAR_STR
8109 BGP_STR
8110 "Clear all peers\n"
e0bce756 8111 BGP_SOFT_IN_STR
718e3744 8112 "Push out prefix-list ORF and do inbound soft reconfig\n")
8113{
8114 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
8115 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
8116}
8117
8118ALIAS (clear_bgp_all_in_prefix_filter,
8119 clear_bgp_ipv6_all_in_prefix_filter_cmd,
8120 "clear bgp ipv6 * in prefix-filter",
8121 CLEAR_STR
8122 BGP_STR
8123 "Address family\n"
8124 "Clear all peers\n"
e0bce756 8125 BGP_SOFT_IN_STR
718e3744 8126 "Push out prefix-list ORF and do inbound soft reconfig\n")
8127
8128DEFUN (clear_ip_bgp_peer_soft_in,
8129 clear_ip_bgp_peer_soft_in_cmd,
db64ea86 8130 "clear ip bgp (A.B.C.D|WORD) soft in",
718e3744 8131 CLEAR_STR
8132 IP_STR
8133 BGP_STR
8134 "BGP neighbor address to clear\n"
db64ea86 8135 "BGP neighbor on interface to clear\n"
e0bce756
DS
8136 BGP_SOFT_STR
8137 BGP_SOFT_IN_STR)
718e3744 8138{
01080f7c 8139 if (argc == 3)
8140 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
8141 BGP_CLEAR_SOFT_IN, argv[2]);
8142
718e3744 8143 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
8144 BGP_CLEAR_SOFT_IN, argv[0]);
8145}
8146
01080f7c 8147ALIAS (clear_ip_bgp_peer_soft_in,
8148 clear_ip_bgp_instance_peer_soft_in_cmd,
8149 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft in",
8150 CLEAR_STR
8151 IP_STR
8152 BGP_STR
8153 BGP_INSTANCE_HELP_STR
8154 "BGP neighbor address to clear\n"
8155 "BGP neighbor on interface to clear\n"
8156 BGP_SOFT_STR
8157 BGP_SOFT_IN_STR)
8158
718e3744 8159ALIAS (clear_ip_bgp_peer_soft_in,
8160 clear_ip_bgp_peer_in_cmd,
db64ea86 8161 "clear ip bgp (A.B.C.D|WORD) in",
718e3744 8162 CLEAR_STR
8163 IP_STR
8164 BGP_STR
8165 "BGP neighbor address to clear\n"
db64ea86 8166 "BGP neighbor on interface to clear\n"
e0bce756 8167 BGP_SOFT_IN_STR)
01080f7c 8168
8169ALIAS (clear_ip_bgp_peer_soft_in,
8170 clear_ip_bgp_instance_peer_in_cmd,
8171 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) in",
8172 CLEAR_STR
8173 IP_STR
8174 BGP_STR
8175 BGP_INSTANCE_HELP_STR
8176 "BGP neighbor address to clear\n"
8177 "BGP neighbor on interface to clear\n"
8178 BGP_SOFT_IN_STR)
8179
718e3744 8180DEFUN (clear_ip_bgp_peer_in_prefix_filter,
8181 clear_ip_bgp_peer_in_prefix_filter_cmd,
db64ea86 8182 "clear ip bgp (A.B.C.D|WORD) in prefix-filter",
718e3744 8183 CLEAR_STR
8184 IP_STR
8185 BGP_STR
8186 "BGP neighbor address to clear\n"
db64ea86 8187 "BGP neighbor on interface to clear\n"
e0bce756 8188 BGP_SOFT_IN_STR
718e3744 8189 "Push out the existing ORF prefix-list\n")
8190{
8191 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
8192 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8193}
8194
8195DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
8196 clear_ip_bgp_peer_ipv4_soft_in_cmd,
db64ea86 8197 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in",
718e3744 8198 CLEAR_STR
8199 IP_STR
8200 BGP_STR
8201 "BGP neighbor address to clear\n"
db64ea86 8202 "BGP neighbor on interface to clear\n"
718e3744 8203 "Address family\n"
8204 "Address Family modifier\n"
8205 "Address Family modifier\n"
e0bce756
DS
8206 BGP_SOFT_STR
8207 BGP_SOFT_IN_STR)
718e3744 8208{
8209 if (strncmp (argv[1], "m", 1) == 0)
8210 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
8211 BGP_CLEAR_SOFT_IN, argv[0]);
8212
8213 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
8214 BGP_CLEAR_SOFT_IN, argv[0]);
8215}
8216
01080f7c 8217DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in,
8218 clear_ip_bgp_instance_peer_ipv4_soft_in_cmd,
8219 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in",
8220 CLEAR_STR
8221 IP_STR
8222 BGP_STR
8223 BGP_INSTANCE_HELP_STR
8224 "BGP neighbor address to clear\n"
8225 "BGP neighbor on interface to clear\n"
8226 "Address family\n"
8227 "Address Family modifier\n"
8228 "Address Family modifier\n"
8229 BGP_SOFT_STR
8230 BGP_SOFT_IN_STR)
8231{
8232 if (strncmp (argv[3], "m", 1) == 0)
8233 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer,
8234 BGP_CLEAR_SOFT_IN, argv[2]);
8235
8236 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
8237 BGP_CLEAR_SOFT_IN, argv[2]);
8238}
8239
718e3744 8240ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
8241 clear_ip_bgp_peer_ipv4_in_cmd,
db64ea86 8242 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in",
718e3744 8243 CLEAR_STR
8244 IP_STR
8245 BGP_STR
8246 "BGP neighbor address to clear\n"
db64ea86 8247 "BGP neighbor on interface to clear\n"
718e3744 8248 "Address family\n"
8249 "Address Family modifier\n"
8250 "Address Family modifier\n"
e0bce756 8251 BGP_SOFT_IN_STR)
718e3744 8252
01080f7c 8253ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_in,
8254 clear_ip_bgp_instance_peer_ipv4_in_cmd,
8255 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) in",
8256 CLEAR_STR
8257 IP_STR
8258 BGP_STR
8259 BGP_INSTANCE_HELP_STR
8260 "BGP neighbor address to clear\n"
8261 "BGP neighbor on interface to clear\n"
8262 "Address family\n"
8263 "Address Family modifier\n"
8264 "Address Family modifier\n"
8265 BGP_SOFT_IN_STR)
8266
718e3744 8267DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
8268 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
db64ea86 8269 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in prefix-filter",
718e3744 8270 CLEAR_STR
8271 IP_STR
8272 BGP_STR
8273 "BGP neighbor address to clear\n"
db64ea86 8274 "BGP neighbor on interface to clear\n"
718e3744 8275 "Address family\n"
8276 "Address Family modifier\n"
8277 "Address Family modifier\n"
e0bce756 8278 BGP_SOFT_IN_STR
718e3744 8279 "Push out the existing ORF prefix-list\n")
8280{
8281 if (strncmp (argv[1], "m", 1) == 0)
8282 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
8283 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8284
8285 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
8286 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8287}
8288
8289DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
8290 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
db64ea86 8291 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft in",
718e3744 8292 CLEAR_STR
8293 IP_STR
8294 BGP_STR
8295 "BGP neighbor address to clear\n"
db64ea86 8296 "BGP neighbor on interface to clear\n"
718e3744 8297 "Address family\n"
8298 "Address Family Modifier\n"
e0bce756
DS
8299 BGP_SOFT_STR
8300 BGP_SOFT_IN_STR)
718e3744 8301{
8302 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
8303 BGP_CLEAR_SOFT_IN, argv[0]);
8304}
8305
8306ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
8307 clear_ip_bgp_peer_vpnv4_in_cmd,
db64ea86 8308 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in",
718e3744 8309 CLEAR_STR
8310 IP_STR
8311 BGP_STR
8312 "BGP neighbor address to clear\n"
db64ea86 8313 "BGP neighbor on interface to clear\n"
718e3744 8314 "Address family\n"
8315 "Address Family Modifier\n"
e0bce756 8316 BGP_SOFT_IN_STR)
718e3744 8317
587ff0fd
LB
8318DEFUN (clear_ip_bgp_peer_encap_soft_in,
8319 clear_ip_bgp_peer_encap_soft_in_cmd,
8320 "clear ip bgp A.B.C.D encap unicast soft in",
8321 CLEAR_STR
8322 IP_STR
8323 BGP_STR
8324 "BGP neighbor address to clear\n"
8325 "Address family\n"
8326 "Address Family Modifier\n"
8327 "Soft reconfig\n"
8328 "Soft reconfig inbound update\n")
8329{
8330 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
8331 BGP_CLEAR_SOFT_IN, argv[0]);
8332}
8333
8334ALIAS (clear_ip_bgp_peer_encap_soft_in,
8335 clear_ip_bgp_peer_encap_in_cmd,
8336 "clear ip bgp A.B.C.D encap unicast in",
8337 CLEAR_STR
8338 IP_STR
8339 BGP_STR
8340 "BGP neighbor address to clear\n"
8341 "Address family\n"
8342 "Address Family Modifier\n"
8343 "Soft reconfig inbound update\n")
8344
718e3744 8345DEFUN (clear_bgp_peer_soft_in,
8346 clear_bgp_peer_soft_in_cmd,
a80beece 8347 "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in",
718e3744 8348 CLEAR_STR
8349 BGP_STR
8350 "BGP neighbor address to clear\n"
8351 "BGP IPv6 neighbor to clear\n"
a80beece 8352 "BGP neighbor on interface to clear\n"
e0bce756
DS
8353 BGP_SOFT_STR
8354 BGP_SOFT_IN_STR)
718e3744 8355{
01080f7c 8356 if (argc == 3)
8357 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer,
8358 BGP_CLEAR_SOFT_IN, argv[2]);
8359
718e3744 8360 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
8361 BGP_CLEAR_SOFT_IN, argv[0]);
8362}
8363
01080f7c 8364ALIAS (clear_bgp_peer_soft_in,
8365 clear_bgp_instance_peer_soft_in_cmd,
8366 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft in",
8367 CLEAR_STR
8368 BGP_STR
8369 BGP_INSTANCE_HELP_STR
8370 "BGP neighbor address to clear\n"
8371 "BGP IPv6 neighbor to clear\n"
8372 "BGP neighbor on interface to clear\n"
8373 BGP_SOFT_STR
8374 BGP_SOFT_IN_STR)
8375
718e3744 8376ALIAS (clear_bgp_peer_soft_in,
8377 clear_bgp_ipv6_peer_soft_in_cmd,
a80beece 8378 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in",
718e3744 8379 CLEAR_STR
8380 BGP_STR
8381 "Address family\n"
8382 "BGP neighbor address to clear\n"
8383 "BGP IPv6 neighbor to clear\n"
a80beece 8384 "BGP neighbor on interface to clear\n"
e0bce756
DS
8385 BGP_SOFT_STR
8386 BGP_SOFT_IN_STR)
718e3744 8387
01080f7c 8388ALIAS (clear_bgp_peer_soft_in,
8389 clear_bgp_instance_ipv6_peer_soft_in_cmd,
8390 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft in",
8391 CLEAR_STR
8392 BGP_STR
8393 BGP_INSTANCE_HELP_STR
8394 "Address family\n"
8395 "BGP neighbor address to clear\n"
8396 "BGP IPv6 neighbor to clear\n"
8397 "BGP neighbor on interface to clear\n"
8398 BGP_SOFT_STR
8399 BGP_SOFT_IN_STR)
8400
718e3744 8401ALIAS (clear_bgp_peer_soft_in,
8402 clear_bgp_peer_in_cmd,
a80beece 8403 "clear bgp (A.B.C.D|X:X::X:X|WORD) in",
718e3744 8404 CLEAR_STR
8405 BGP_STR
8406 "BGP neighbor address to clear\n"
8407 "BGP IPv6 neighbor to clear\n"
a80beece 8408 "BGP neighbor on interface to clear\n"
e0bce756 8409 BGP_SOFT_IN_STR)
718e3744 8410
01080f7c 8411ALIAS (clear_bgp_peer_soft_in,
8412 clear_bgp_instance_peer_in_cmd,
8413 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) in",
8414 CLEAR_STR
8415 BGP_STR
8416 BGP_INSTANCE_HELP_STR
8417 "BGP neighbor address to clear\n"
8418 "BGP IPv6 neighbor to clear\n"
8419 "BGP neighbor on interface to clear\n"
8420 BGP_SOFT_IN_STR)
8421
718e3744 8422ALIAS (clear_bgp_peer_soft_in,
8423 clear_bgp_ipv6_peer_in_cmd,
a80beece 8424 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in",
718e3744 8425 CLEAR_STR
8426 BGP_STR
8427 "Address family\n"
8428 "BGP neighbor address to clear\n"
8429 "BGP IPv6 neighbor to clear\n"
a80beece 8430 "BGP neighbor on interface to clear\n"
e0bce756 8431 BGP_SOFT_IN_STR)
718e3744 8432
01080f7c 8433ALIAS (clear_bgp_peer_soft_in,
8434 clear_bgp_instance_ipv6_peer_in_cmd,
8435 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) in",
8436 CLEAR_STR
8437 BGP_STR
8438 BGP_INSTANCE_HELP_STR
8439 "Address family\n"
8440 "BGP neighbor address to clear\n"
8441 "BGP IPv6 neighbor to clear\n"
8442 "BGP neighbor on interface to clear\n"
8443 BGP_SOFT_IN_STR)
8444
718e3744 8445DEFUN (clear_bgp_peer_in_prefix_filter,
8446 clear_bgp_peer_in_prefix_filter_cmd,
a80beece 8447 "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter",
718e3744 8448 CLEAR_STR
8449 BGP_STR
8450 "BGP neighbor address to clear\n"
8451 "BGP IPv6 neighbor to clear\n"
a80beece 8452 "BGP neighbor on interface to clear\n"
e0bce756 8453 BGP_SOFT_IN_STR
718e3744 8454 "Push out the existing ORF prefix-list\n")
8455{
8456 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
8457 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8458}
8459
8460ALIAS (clear_bgp_peer_in_prefix_filter,
8461 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
a80beece 8462 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter",
718e3744 8463 CLEAR_STR
8464 BGP_STR
8465 "Address family\n"
8466 "BGP neighbor address to clear\n"
8467 "BGP IPv6 neighbor to clear\n"
a80beece 8468 "BGP neighbor on interface to clear\n"
e0bce756 8469 BGP_SOFT_IN_STR
718e3744 8470 "Push out the existing ORF prefix-list\n")
8471
8472DEFUN (clear_ip_bgp_peer_group_soft_in,
8473 clear_ip_bgp_peer_group_soft_in_cmd,
8474 "clear ip bgp peer-group WORD soft in",
8475 CLEAR_STR
8476 IP_STR
8477 BGP_STR
8478 "Clear all members of peer-group\n"
8479 "BGP peer-group name\n"
e0bce756
DS
8480 BGP_SOFT_STR
8481 BGP_SOFT_IN_STR)
718e3744 8482{
01080f7c 8483 if (argc == 3)
8484 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
8485 BGP_CLEAR_SOFT_IN, argv[2]);
8486
718e3744 8487 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
8488 BGP_CLEAR_SOFT_IN, argv[0]);
8489}
8490
01080f7c 8491ALIAS (clear_ip_bgp_peer_group_soft_in,
8492 clear_ip_bgp_instance_peer_group_soft_in_cmd,
8493 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft in",
8494 CLEAR_STR
8495 IP_STR
8496 BGP_STR
8497 BGP_INSTANCE_HELP_STR
8498 "Clear all members of peer-group\n"
8499 "BGP peer-group name\n"
8500 BGP_SOFT_STR
8501 BGP_SOFT_IN_STR)
8502
718e3744 8503ALIAS (clear_ip_bgp_peer_group_soft_in,
8504 clear_ip_bgp_peer_group_in_cmd,
8505 "clear ip bgp peer-group WORD in",
8506 CLEAR_STR
8507 IP_STR
8508 BGP_STR
8509 "Clear all members of peer-group\n"
8510 "BGP peer-group name\n"
e0bce756 8511 BGP_SOFT_IN_STR)
718e3744 8512
01080f7c 8513ALIAS (clear_ip_bgp_peer_group_soft_in,
8514 clear_ip_bgp_instance_peer_group_in_cmd,
8515 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD in",
8516 CLEAR_STR
8517 IP_STR
8518 BGP_STR
8519 BGP_INSTANCE_HELP_STR
8520 "Clear all members of peer-group\n"
8521 "BGP peer-group name\n"
8522 BGP_SOFT_IN_STR)
8523
718e3744 8524DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
8525 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
8526 "clear ip bgp peer-group WORD in prefix-filter",
8527 CLEAR_STR
8528 IP_STR
8529 BGP_STR
8530 "Clear all members of peer-group\n"
8531 "BGP peer-group name\n"
e0bce756 8532 BGP_SOFT_IN_STR
718e3744 8533 "Push out prefix-list ORF and do inbound soft reconfig\n")
8534{
8535 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
8536 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8537}
8538
8539DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
8540 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
8541 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
8542 CLEAR_STR
8543 IP_STR
8544 BGP_STR
8545 "Clear all members of peer-group\n"
8546 "BGP peer-group name\n"
8547 "Address family\n"
8548 "Address Family modifier\n"
8549 "Address Family modifier\n"
e0bce756
DS
8550 BGP_SOFT_STR
8551 BGP_SOFT_IN_STR)
718e3744 8552{
8553 if (strncmp (argv[1], "m", 1) == 0)
8554 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
8555 BGP_CLEAR_SOFT_IN, argv[0]);
8556
8557 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
8558 BGP_CLEAR_SOFT_IN, argv[0]);
8559}
8560
01080f7c 8561DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in,
8562 clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd,
8563 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft in",
8564 CLEAR_STR
8565 IP_STR
8566 BGP_STR
8567 BGP_INSTANCE_HELP_STR
8568 "Clear all members of peer-group\n"
8569 "BGP peer-group name\n"
8570 "Address family\n"
8571 "Address Family modifier\n"
8572 "Address Family modifier\n"
8573 BGP_SOFT_STR
8574 BGP_SOFT_IN_STR)
8575{
8576 if (strncmp (argv[3], "m", 1) == 0)
8577 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group,
8578 BGP_CLEAR_SOFT_IN, argv[2]);
8579
8580 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
8581 BGP_CLEAR_SOFT_IN, argv[2]);
8582}
8583
718e3744 8584ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
8585 clear_ip_bgp_peer_group_ipv4_in_cmd,
8586 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
8587 CLEAR_STR
8588 IP_STR
8589 BGP_STR
8590 "Clear all members of peer-group\n"
8591 "BGP peer-group name\n"
8592 "Address family\n"
8593 "Address Family modifier\n"
8594 "Address Family modifier\n"
e0bce756 8595 BGP_SOFT_IN_STR)
718e3744 8596
01080f7c 8597ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_in,
8598 clear_ip_bgp_instance_peer_group_ipv4_in_cmd,
8599 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) in",
8600 CLEAR_STR
8601 IP_STR
8602 BGP_STR
8603 BGP_INSTANCE_HELP_STR
8604 "Clear all members of peer-group\n"
8605 "BGP peer-group name\n"
8606 "Address family\n"
8607 "Address Family modifier\n"
8608 "Address Family modifier\n"
8609 BGP_SOFT_IN_STR)
8610
718e3744 8611DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
8612 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
8613 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
8614 CLEAR_STR
8615 IP_STR
8616 BGP_STR
8617 "Clear all members of peer-group\n"
8618 "BGP peer-group name\n"
8619 "Address family\n"
8620 "Address Family modifier\n"
8621 "Address Family modifier\n"
e0bce756 8622 BGP_SOFT_IN_STR
718e3744 8623 "Push out prefix-list ORF and do inbound soft reconfig\n")
8624{
8625 if (strncmp (argv[1], "m", 1) == 0)
8626 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
8627 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8628
8629 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
8630 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8631}
8632
8633DEFUN (clear_bgp_peer_group_soft_in,
8634 clear_bgp_peer_group_soft_in_cmd,
8635 "clear bgp peer-group WORD soft in",
8636 CLEAR_STR
8637 BGP_STR
8638 "Clear all members of peer-group\n"
8639 "BGP peer-group name\n"
e0bce756
DS
8640 BGP_SOFT_STR
8641 BGP_SOFT_IN_STR)
718e3744 8642{
01080f7c 8643 if (argc == 3)
8644 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group,
8645 BGP_CLEAR_SOFT_IN, argv[2]);
8646
718e3744 8647 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
8648 BGP_CLEAR_SOFT_IN, argv[0]);
8649}
8650
01080f7c 8651ALIAS (clear_bgp_peer_group_soft_in,
8652 clear_bgp_instance_peer_group_soft_in_cmd,
8653 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft in",
8654 CLEAR_STR
8655 BGP_STR
8656 BGP_INSTANCE_HELP_STR
8657 "Clear all members of peer-group\n"
8658 "BGP peer-group name\n"
8659 BGP_SOFT_STR
8660 BGP_SOFT_IN_STR)
8661
718e3744 8662ALIAS (clear_bgp_peer_group_soft_in,
8663 clear_bgp_ipv6_peer_group_soft_in_cmd,
8664 "clear bgp ipv6 peer-group WORD soft in",
8665 CLEAR_STR
8666 BGP_STR
8667 "Address family\n"
8668 "Clear all members of peer-group\n"
8669 "BGP peer-group name\n"
e0bce756
DS
8670 BGP_SOFT_STR
8671 BGP_SOFT_IN_STR)
718e3744 8672
01080f7c 8673ALIAS (clear_bgp_peer_group_soft_in,
8674 clear_bgp_instance_ipv6_peer_group_soft_in_cmd,
8675 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft in",
8676 CLEAR_STR
8677 BGP_STR
8678 BGP_INSTANCE_HELP_STR
8679 "Address family\n"
8680 "Clear all members of peer-group\n"
8681 "BGP peer-group name\n"
8682 BGP_SOFT_STR
8683 BGP_SOFT_IN_STR)
8684
718e3744 8685ALIAS (clear_bgp_peer_group_soft_in,
8686 clear_bgp_peer_group_in_cmd,
8687 "clear bgp peer-group WORD in",
8688 CLEAR_STR
8689 BGP_STR
8690 "Clear all members of peer-group\n"
8691 "BGP peer-group name\n"
e0bce756 8692 BGP_SOFT_IN_STR)
718e3744 8693
01080f7c 8694ALIAS (clear_bgp_peer_group_soft_in,
8695 clear_bgp_instance_peer_group_in_cmd,
8696 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD in",
8697 CLEAR_STR
8698 BGP_STR
8699 BGP_INSTANCE_HELP_STR
8700 "Clear all members of peer-group\n"
8701 "BGP peer-group name\n"
8702 BGP_SOFT_IN_STR)
8703
718e3744 8704ALIAS (clear_bgp_peer_group_soft_in,
8705 clear_bgp_ipv6_peer_group_in_cmd,
8706 "clear bgp ipv6 peer-group WORD in",
8707 CLEAR_STR
8708 BGP_STR
8709 "Address family\n"
8710 "Clear all members of peer-group\n"
8711 "BGP peer-group name\n"
e0bce756 8712 BGP_SOFT_IN_STR)
718e3744 8713
01080f7c 8714ALIAS (clear_bgp_peer_group_soft_in,
8715 clear_bgp_instance_ipv6_peer_group_in_cmd,
8716 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD in",
8717 CLEAR_STR
8718 BGP_STR
8719 BGP_INSTANCE_HELP_STR
8720 "Address family\n"
8721 "Clear all members of peer-group\n"
8722 "BGP peer-group name\n"
8723 BGP_SOFT_IN_STR)
8724
718e3744 8725DEFUN (clear_bgp_peer_group_in_prefix_filter,
8726 clear_bgp_peer_group_in_prefix_filter_cmd,
8727 "clear bgp peer-group WORD in prefix-filter",
8728 CLEAR_STR
8729 BGP_STR
8730 "Clear all members of peer-group\n"
8731 "BGP peer-group name\n"
e0bce756 8732 BGP_SOFT_IN_STR
718e3744 8733 "Push out prefix-list ORF and do inbound soft reconfig\n")
8734{
8735 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
8736 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
8737}
8738
8739ALIAS (clear_bgp_peer_group_in_prefix_filter,
8740 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
8741 "clear bgp ipv6 peer-group WORD in prefix-filter",
8742 CLEAR_STR
8743 BGP_STR
8744 "Address family\n"
8745 "Clear all members of peer-group\n"
8746 "BGP peer-group name\n"
e0bce756 8747 BGP_SOFT_IN_STR
718e3744 8748 "Push out prefix-list ORF and do inbound soft reconfig\n")
8749
8750DEFUN (clear_ip_bgp_external_soft_in,
8751 clear_ip_bgp_external_soft_in_cmd,
8752 "clear ip bgp external soft in",
8753 CLEAR_STR
8754 IP_STR
8755 BGP_STR
8756 "Clear all external peers\n"
e0bce756
DS
8757 BGP_SOFT_STR
8758 BGP_SOFT_IN_STR)
718e3744 8759{
01080f7c 8760 if (argc == 2)
8761 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
8762 BGP_CLEAR_SOFT_IN, NULL);
8763
718e3744 8764 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
8765 BGP_CLEAR_SOFT_IN, NULL);
8766}
8767
01080f7c 8768ALIAS (clear_ip_bgp_external_soft_in,
8769 clear_ip_bgp_instance_external_soft_in_cmd,
8770 "clear ip bgp " BGP_INSTANCE_CMD " external soft in",
8771 CLEAR_STR
8772 IP_STR
8773 BGP_STR
8774 BGP_INSTANCE_HELP_STR
8775 "Clear all external peers\n"
8776 BGP_SOFT_STR
8777 BGP_SOFT_IN_STR)
8778
718e3744 8779ALIAS (clear_ip_bgp_external_soft_in,
8780 clear_ip_bgp_external_in_cmd,
8781 "clear ip bgp external in",
8782 CLEAR_STR
8783 IP_STR
8784 BGP_STR
8785 "Clear all external peers\n"
e0bce756 8786 BGP_SOFT_IN_STR)
718e3744 8787
01080f7c 8788ALIAS (clear_ip_bgp_external_soft_in,
8789 clear_ip_bgp_instance_external_in_cmd,
8790 "clear ip bgp " BGP_INSTANCE_CMD " external in",
8791 CLEAR_STR
8792 IP_STR
8793 BGP_STR
8794 BGP_INSTANCE_HELP_STR
8795 "Clear all external peers\n"
8796 BGP_SOFT_IN_STR)
8797
718e3744 8798DEFUN (clear_ip_bgp_external_in_prefix_filter,
8799 clear_ip_bgp_external_in_prefix_filter_cmd,
8800 "clear ip bgp external in prefix-filter",
8801 CLEAR_STR
8802 IP_STR
8803 BGP_STR
8804 "Clear all external peers\n"
e0bce756 8805 BGP_SOFT_IN_STR
718e3744 8806 "Push out prefix-list ORF and do inbound soft reconfig\n")
8807{
8808 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
8809 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
8810}
8811
8812DEFUN (clear_ip_bgp_external_ipv4_soft_in,
8813 clear_ip_bgp_external_ipv4_soft_in_cmd,
8814 "clear ip bgp external ipv4 (unicast|multicast) soft in",
8815 CLEAR_STR
8816 IP_STR
8817 BGP_STR
8818 "Clear all external peers\n"
8819 "Address family\n"
8820 "Address Family modifier\n"
8821 "Address Family modifier\n"
e0bce756
DS
8822 BGP_SOFT_STR
8823 BGP_SOFT_IN_STR)
718e3744 8824{
8825 if (strncmp (argv[0], "m", 1) == 0)
8826 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
8827 BGP_CLEAR_SOFT_IN, NULL);
8828
8829 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
8830 BGP_CLEAR_SOFT_IN, NULL);
8831}
8832
01080f7c 8833DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in,
8834 clear_ip_bgp_instance_external_ipv4_soft_in_cmd,
8835 "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft in",
8836 CLEAR_STR
8837 IP_STR
8838 BGP_STR
8839 BGP_INSTANCE_HELP_STR
8840 "Clear all external peers\n"
8841 "Address family\n"
8842 "Address Family modifier\n"
8843 "Address Family modifier\n"
8844 BGP_SOFT_STR
8845 BGP_SOFT_IN_STR)
8846{
8847 if (strncmp (argv[2], "m", 1) == 0)
8848 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external,
8849 BGP_CLEAR_SOFT_IN, NULL);
8850
8851 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
8852 BGP_CLEAR_SOFT_IN, NULL);
8853}
8854
718e3744 8855ALIAS (clear_ip_bgp_external_ipv4_soft_in,
8856 clear_ip_bgp_external_ipv4_in_cmd,
8857 "clear ip bgp external ipv4 (unicast|multicast) in",
8858 CLEAR_STR
8859 IP_STR
8860 BGP_STR
8861 "Clear all external peers\n"
8862 "Address family\n"
8863 "Address Family modifier\n"
8864 "Address Family modifier\n"
e0bce756 8865 BGP_SOFT_IN_STR)
718e3744 8866
01080f7c 8867ALIAS (clear_ip_bgp_instance_external_ipv4_soft_in,
8868 clear_ip_bgp_instance_external_ipv4_in_cmd,
8869 "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) in",
8870 CLEAR_STR
8871 IP_STR
8872 BGP_STR
8873 BGP_INSTANCE_HELP_STR
8874 "Clear all external peers\n"
8875 "Address family\n"
8876 "Address Family modifier\n"
8877 "Address Family modifier\n"
8878 BGP_SOFT_IN_STR)
8879
718e3744 8880DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
8881 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
8882 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
8883 CLEAR_STR
8884 IP_STR
8885 BGP_STR
8886 "Clear all external peers\n"
8887 "Address family\n"
8888 "Address Family modifier\n"
8889 "Address Family modifier\n"
e0bce756 8890 BGP_SOFT_IN_STR
718e3744 8891 "Push out prefix-list ORF and do inbound soft reconfig\n")
8892{
8893 if (strncmp (argv[0], "m", 1) == 0)
8894 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
8895 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
8896
8897 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
8898 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
8899}
8900
8901DEFUN (clear_bgp_external_soft_in,
8902 clear_bgp_external_soft_in_cmd,
8903 "clear bgp external soft in",
8904 CLEAR_STR
8905 BGP_STR
8906 "Clear all external peers\n"
e0bce756
DS
8907 BGP_SOFT_STR
8908 BGP_SOFT_IN_STR)
718e3744 8909{
01080f7c 8910 if (argc == 2)
8911 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external,
8912 BGP_CLEAR_SOFT_IN, NULL);
8913
718e3744 8914 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
8915 BGP_CLEAR_SOFT_IN, NULL);
8916}
8917
01080f7c 8918ALIAS (clear_bgp_external_soft_in,
8919 clear_bgp_instance_external_soft_in_cmd,
8920 "clear bgp " BGP_INSTANCE_CMD " external soft in",
8921 CLEAR_STR
8922 BGP_STR
8923 BGP_INSTANCE_HELP_STR
8924 "Clear all external peers\n"
8925 BGP_SOFT_STR
8926 BGP_SOFT_IN_STR)
8927
718e3744 8928ALIAS (clear_bgp_external_soft_in,
8929 clear_bgp_ipv6_external_soft_in_cmd,
8930 "clear bgp ipv6 external soft in",
8931 CLEAR_STR
8932 BGP_STR
8933 "Address family\n"
8934 "Clear all external peers\n"
e0bce756
DS
8935 BGP_SOFT_STR
8936 BGP_SOFT_IN_STR)
718e3744 8937
01080f7c 8938ALIAS (clear_bgp_external_soft_in,
8939 clear_bgp_instance_ipv6_external_soft_in_cmd,
8940 "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft in",
8941 CLEAR_STR
8942 BGP_STR
8943 BGP_INSTANCE_HELP_STR
8944 "Address family\n"
8945 "Clear all external peers\n"
8946 BGP_SOFT_STR
8947 BGP_SOFT_IN_STR)
8948
718e3744 8949ALIAS (clear_bgp_external_soft_in,
8950 clear_bgp_external_in_cmd,
8951 "clear bgp external in",
8952 CLEAR_STR
8953 BGP_STR
8954 "Clear all external peers\n"
e0bce756 8955 BGP_SOFT_IN_STR)
718e3744 8956
01080f7c 8957ALIAS (clear_bgp_external_soft_in,
8958 clear_bgp_instance_external_in_cmd,
8959 "clear bgp " BGP_INSTANCE_CMD " external in",
8960 CLEAR_STR
8961 BGP_STR
8962 BGP_INSTANCE_HELP_STR
8963 "Clear all external peers\n"
8964 BGP_SOFT_IN_STR)
8965
718e3744 8966ALIAS (clear_bgp_external_soft_in,
8967 clear_bgp_ipv6_external_in_cmd,
8968 "clear bgp ipv6 external WORD in",
8969 CLEAR_STR
8970 BGP_STR
8971 "Address family\n"
8972 "Clear all external peers\n"
e0bce756 8973 BGP_SOFT_IN_STR)
718e3744 8974
01080f7c 8975ALIAS (clear_bgp_external_soft_in,
8976 clear_bgp_instance_ipv6_external_in_cmd,
8977 "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD in",
8978 CLEAR_STR
8979 BGP_STR
8980 BGP_INSTANCE_HELP_STR
8981 "Address family\n"
8982 "Clear all external peers\n"
8983 BGP_SOFT_IN_STR)
8984
718e3744 8985DEFUN (clear_bgp_external_in_prefix_filter,
8986 clear_bgp_external_in_prefix_filter_cmd,
8987 "clear bgp external in prefix-filter",
8988 CLEAR_STR
8989 BGP_STR
8990 "Clear all external peers\n"
e0bce756 8991 BGP_SOFT_IN_STR
718e3744 8992 "Push out prefix-list ORF and do inbound soft reconfig\n")
8993{
8994 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
8995 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
8996}
8997
8998ALIAS (clear_bgp_external_in_prefix_filter,
8999 clear_bgp_ipv6_external_in_prefix_filter_cmd,
9000 "clear bgp ipv6 external in prefix-filter",
9001 CLEAR_STR
9002 BGP_STR
9003 "Address family\n"
9004 "Clear all external peers\n"
e0bce756 9005 BGP_SOFT_IN_STR
718e3744 9006 "Push out prefix-list ORF and do inbound soft reconfig\n")
9007
9008DEFUN (clear_ip_bgp_as_soft_in,
9009 clear_ip_bgp_as_soft_in_cmd,
320da874 9010 "clear ip bgp " CMD_AS_RANGE " soft in",
718e3744 9011 CLEAR_STR
9012 IP_STR
9013 BGP_STR
9014 "Clear peers with the AS number\n"
e0bce756
DS
9015 BGP_SOFT_STR
9016 BGP_SOFT_IN_STR)
718e3744 9017{
01080f7c 9018 if (argc == 3)
9019 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
9020 BGP_CLEAR_SOFT_IN, argv[2]);
9021
718e3744 9022 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
9023 BGP_CLEAR_SOFT_IN, argv[0]);
9024}
9025
9026ALIAS (clear_ip_bgp_as_soft_in,
01080f7c 9027 clear_ip_bgp_instance_as_soft_in_cmd,
9028 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in",
9029 CLEAR_STR
9030 IP_STR
9031 BGP_STR
9032 BGP_INSTANCE_HELP_STR
9033 "Clear peers with the AS number\n"
9034 BGP_SOFT_STR
9035 BGP_SOFT_IN_STR)
9036
9037ALIAS (clear_ip_bgp_as_soft_in,
9038 clear_ip_bgp_as_in_cmd,
9039 "clear ip bgp " CMD_AS_RANGE " in",
9040 CLEAR_STR
9041 IP_STR
9042 BGP_STR
9043 "Clear peers with the AS number\n"
9044 BGP_SOFT_IN_STR)
9045
9046ALIAS (clear_ip_bgp_as_soft_in,
9047 clear_ip_bgp_instance_as_in_cmd,
9048 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in",
718e3744 9049 CLEAR_STR
9050 IP_STR
9051 BGP_STR
01080f7c 9052 BGP_INSTANCE_HELP_STR
718e3744 9053 "Clear peers with the AS number\n"
e0bce756 9054 BGP_SOFT_IN_STR)
718e3744 9055
9056DEFUN (clear_ip_bgp_as_in_prefix_filter,
9057 clear_ip_bgp_as_in_prefix_filter_cmd,
320da874 9058 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
718e3744 9059 CLEAR_STR
9060 IP_STR
9061 BGP_STR
9062 "Clear peers with the AS number\n"
e0bce756 9063 BGP_SOFT_IN_STR
718e3744 9064 "Push out prefix-list ORF and do inbound soft reconfig\n")
9065{
9066 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
9067 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
9068}
9069
9070DEFUN (clear_ip_bgp_as_ipv4_soft_in,
9071 clear_ip_bgp_as_ipv4_soft_in_cmd,
320da874 9072 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
718e3744 9073 CLEAR_STR
9074 IP_STR
9075 BGP_STR
9076 "Clear peers with the AS number\n"
9077 "Address family\n"
9078 "Address Family modifier\n"
9079 "Address Family modifier\n"
e0bce756
DS
9080 BGP_SOFT_STR
9081 BGP_SOFT_IN_STR)
718e3744 9082{
9083 if (strncmp (argv[1], "m", 1) == 0)
9084 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
9085 BGP_CLEAR_SOFT_IN, argv[0]);
9086
9087 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
9088 BGP_CLEAR_SOFT_IN, argv[0]);
9089}
9090
01080f7c 9091DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in,
9092 clear_ip_bgp_instance_as_ipv4_soft_in_cmd,
9093 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
9094 CLEAR_STR
9095 IP_STR
9096 BGP_STR
9097 BGP_INSTANCE_HELP_STR
9098 "Clear peers with the AS number\n"
9099 "Address family\n"
9100 "Address Family modifier\n"
9101 "Address Family modifier\n"
9102 BGP_SOFT_STR
9103 BGP_SOFT_IN_STR)
9104{
9105 if (strncmp (argv[3], "m", 1) == 0)
9106 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as,
9107 BGP_CLEAR_SOFT_IN, argv[2]);
9108
9109 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
9110 BGP_CLEAR_SOFT_IN, argv[2]);
9111}
9112
718e3744 9113ALIAS (clear_ip_bgp_as_ipv4_soft_in,
9114 clear_ip_bgp_as_ipv4_in_cmd,
320da874 9115 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
718e3744 9116 CLEAR_STR
9117 IP_STR
9118 BGP_STR
9119 "Clear peers with the AS number\n"
9120 "Address family\n"
9121 "Address Family modifier\n"
9122 "Address Family modifier\n"
e0bce756 9123 BGP_SOFT_IN_STR)
718e3744 9124
01080f7c 9125ALIAS (clear_ip_bgp_instance_as_ipv4_soft_in,
9126 clear_ip_bgp_instance_as_ipv4_in_cmd,
9127 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
9128 CLEAR_STR
9129 IP_STR
9130 BGP_STR
9131 BGP_INSTANCE_HELP_STR
9132 "Clear peers with the AS number\n"
9133 "Address family\n"
9134 "Address Family modifier\n"
9135 "Address Family modifier\n"
9136 BGP_SOFT_IN_STR)
9137
718e3744 9138DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
9139 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
320da874 9140 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
718e3744 9141 CLEAR_STR
9142 IP_STR
9143 BGP_STR
9144 "Clear peers with the AS number\n"
9145 "Address family\n"
9146 "Address Family modifier\n"
9147 "Address Family modifier\n"
e0bce756 9148 BGP_SOFT_IN_STR
718e3744 9149 "Push out prefix-list ORF and do inbound soft reconfig\n")
9150{
9151 if (strncmp (argv[1], "m", 1) == 0)
9152 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
9153 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
9154
9155 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
9156 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
9157}
9158
9159DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
9160 clear_ip_bgp_as_vpnv4_soft_in_cmd,
320da874 9161 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
718e3744 9162 CLEAR_STR
9163 IP_STR
9164 BGP_STR
9165 "Clear peers with the AS number\n"
9166 "Address family\n"
9167 "Address Family modifier\n"
e0bce756
DS
9168 BGP_SOFT_STR
9169 BGP_SOFT_IN_STR)
718e3744 9170{
9171 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
9172 BGP_CLEAR_SOFT_IN, argv[0]);
9173}
9174
9175ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
9176 clear_ip_bgp_as_vpnv4_in_cmd,
320da874 9177 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
718e3744 9178 CLEAR_STR
9179 IP_STR
9180 BGP_STR
9181 "Clear peers with the AS number\n"
9182 "Address family\n"
9183 "Address Family modifier\n"
e0bce756 9184 BGP_SOFT_IN_STR)
718e3744 9185
587ff0fd
LB
9186DEFUN (clear_ip_bgp_as_encap_soft_in,
9187 clear_ip_bgp_as_encap_soft_in_cmd,
9188 "clear ip bgp " CMD_AS_RANGE " encap unicast soft in",
9189 CLEAR_STR
9190 IP_STR
9191 BGP_STR
9192 "Clear peers with the AS number\n"
9193 "Address family\n"
9194 "Address Family modifier\n"
9195 "Soft reconfig\n"
9196 "Soft reconfig inbound update\n")
9197{
9198 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
9199 BGP_CLEAR_SOFT_IN, argv[0]);
9200}
9201
9202ALIAS (clear_ip_bgp_as_encap_soft_in,
9203 clear_ip_bgp_as_encap_in_cmd,
9204 "clear ip bgp " CMD_AS_RANGE " encap unicast in",
9205 CLEAR_STR
9206 IP_STR
9207 BGP_STR
9208 "Clear peers with the AS number\n"
9209 "Address family\n"
9210 "Address Family modifier\n"
9211 "Soft reconfig inbound update\n")
9212
718e3744 9213DEFUN (clear_bgp_as_soft_in,
9214 clear_bgp_as_soft_in_cmd,
320da874 9215 "clear bgp " CMD_AS_RANGE " soft in",
718e3744 9216 CLEAR_STR
9217 BGP_STR
9218 "Clear peers with the AS number\n"
e0bce756
DS
9219 BGP_SOFT_STR
9220 BGP_SOFT_IN_STR)
718e3744 9221{
01080f7c 9222 if (argc == 3)
9223 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as,
9224 BGP_CLEAR_SOFT_IN, argv[2]);
9225
718e3744 9226 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
9227 BGP_CLEAR_SOFT_IN, argv[0]);
9228}
9229
01080f7c 9230ALIAS (clear_bgp_as_soft_in,
9231 clear_bgp_instance_as_soft_in_cmd,
9232 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in",
9233 CLEAR_STR
9234 BGP_STR
9235 BGP_INSTANCE_HELP_STR
9236 "Clear peers with the AS number\n"
9237 BGP_SOFT_STR
9238 BGP_SOFT_IN_STR)
9239
718e3744 9240ALIAS (clear_bgp_as_soft_in,
9241 clear_bgp_ipv6_as_soft_in_cmd,
320da874 9242 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
718e3744 9243 CLEAR_STR
9244 BGP_STR
9245 "Address family\n"
9246 "Clear peers with the AS number\n"
e0bce756
DS
9247 BGP_SOFT_STR
9248 BGP_SOFT_IN_STR)
718e3744 9249
01080f7c 9250ALIAS (clear_bgp_as_soft_in,
9251 clear_bgp_instance_ipv6_as_soft_in_cmd,
9252 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft in",
9253 CLEAR_STR
9254 BGP_STR
9255 BGP_INSTANCE_HELP_STR
9256 "Address family\n"
9257 "Clear peers with the AS number\n"
9258 BGP_SOFT_STR
9259 BGP_SOFT_IN_STR)
9260
718e3744 9261ALIAS (clear_bgp_as_soft_in,
9262 clear_bgp_as_in_cmd,
320da874 9263 "clear bgp " CMD_AS_RANGE " in",
718e3744 9264 CLEAR_STR
9265 BGP_STR
9266 "Clear peers with the AS number\n"
e0bce756 9267 BGP_SOFT_IN_STR)
718e3744 9268
01080f7c 9269ALIAS (clear_bgp_as_soft_in,
9270 clear_bgp_instance_as_in_cmd,
9271 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in",
9272 CLEAR_STR
9273 BGP_STR
9274 BGP_INSTANCE_HELP_STR
9275 "Clear peers with the AS number\n"
9276 BGP_SOFT_IN_STR)
9277
718e3744 9278ALIAS (clear_bgp_as_soft_in,
9279 clear_bgp_ipv6_as_in_cmd,
320da874 9280 "clear bgp ipv6 " CMD_AS_RANGE " in",
718e3744 9281 CLEAR_STR
9282 BGP_STR
9283 "Address family\n"
9284 "Clear peers with the AS number\n"
e0bce756 9285 BGP_SOFT_IN_STR)
718e3744 9286
01080f7c 9287ALIAS (clear_bgp_as_soft_in,
9288 clear_bgp_instance_ipv6_as_in_cmd,
9289 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " in",
9290 CLEAR_STR
9291 BGP_STR
9292 BGP_INSTANCE_HELP_STR
9293 "Address family\n"
9294 "Clear peers with the AS number\n"
9295 BGP_SOFT_IN_STR)
9296
718e3744 9297DEFUN (clear_bgp_as_in_prefix_filter,
9298 clear_bgp_as_in_prefix_filter_cmd,
320da874 9299 "clear bgp " CMD_AS_RANGE " in prefix-filter",
718e3744 9300 CLEAR_STR
9301 BGP_STR
9302 "Clear peers with the AS number\n"
e0bce756 9303 BGP_SOFT_IN_STR
718e3744 9304 "Push out prefix-list ORF and do inbound soft reconfig\n")
9305{
9306 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
9307 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
9308}
9309
9310ALIAS (clear_bgp_as_in_prefix_filter,
9311 clear_bgp_ipv6_as_in_prefix_filter_cmd,
320da874 9312 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
718e3744 9313 CLEAR_STR
9314 BGP_STR
9315 "Address family\n"
9316 "Clear peers with the AS number\n"
e0bce756 9317 BGP_SOFT_IN_STR
718e3744 9318 "Push out prefix-list ORF and do inbound soft reconfig\n")
6b0655a2 9319
718e3744 9320/* Both soft-reconfiguration */
9321DEFUN (clear_ip_bgp_all_soft,
9322 clear_ip_bgp_all_soft_cmd,
9323 "clear ip bgp * soft",
9324 CLEAR_STR
9325 IP_STR
9326 BGP_STR
9327 "Clear all peers\n"
e0bce756 9328 BGP_SOFT_STR)
718e3744 9329{
6aeb9e78
DS
9330 if (argc == 2)
9331 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all,
718e3744 9332 BGP_CLEAR_SOFT_BOTH, NULL);
9333
9334 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
9335 BGP_CLEAR_SOFT_BOTH, NULL);
9336}
9337
9338ALIAS (clear_ip_bgp_all_soft,
9339 clear_ip_bgp_instance_all_soft_cmd,
8386ac43 9340 "clear ip bgp " BGP_INSTANCE_CMD " * soft",
718e3744 9341 CLEAR_STR
9342 IP_STR
9343 BGP_STR
8386ac43 9344 BGP_INSTANCE_HELP_STR
718e3744 9345 "Clear all peers\n"
e0bce756 9346 BGP_SOFT_STR)
718e3744 9347
9348
9349DEFUN (clear_ip_bgp_all_ipv4_soft,
9350 clear_ip_bgp_all_ipv4_soft_cmd,
9351 "clear ip bgp * ipv4 (unicast|multicast) soft",
9352 CLEAR_STR
9353 IP_STR
9354 BGP_STR
9355 "Clear all peers\n"
9356 "Address family\n"
9357 "Address Family Modifier\n"
9358 "Address Family Modifier\n"
e0bce756 9359 BGP_SOFT_STR)
718e3744 9360{
9361 if (strncmp (argv[0], "m", 1) == 0)
9362 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
9363 BGP_CLEAR_SOFT_BOTH, NULL);
9364
9365 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
9366 BGP_CLEAR_SOFT_BOTH, NULL);
9367}
9368
9369DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
9370 clear_ip_bgp_instance_all_ipv4_soft_cmd,
8386ac43 9371 "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft",
718e3744 9372 CLEAR_STR
9373 IP_STR
9374 BGP_STR
8386ac43 9375 BGP_INSTANCE_HELP_STR
718e3744 9376 "Clear all peers\n"
9377 "Address family\n"
9378 "Address Family Modifier\n"
9379 "Address Family Modifier\n"
e0bce756 9380 BGP_SOFT_STR)
718e3744 9381{
6aeb9e78
DS
9382 if (strncmp (argv[2], "m", 1) == 0)
9383 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all,
718e3744 9384 BGP_CLEAR_SOFT_BOTH, NULL);
9385
9386 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
9387 BGP_CLEAR_SOFT_BOTH, NULL);
9388}
9389
9390DEFUN (clear_ip_bgp_all_vpnv4_soft,
9391 clear_ip_bgp_all_vpnv4_soft_cmd,
9392 "clear ip bgp * vpnv4 unicast soft",
9393 CLEAR_STR
9394 IP_STR
9395 BGP_STR
9396 "Clear all peers\n"
9397 "Address family\n"
9398 "Address Family Modifier\n"
e0bce756 9399 BGP_SOFT_STR)
718e3744 9400{
9401 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
9402 BGP_CLEAR_SOFT_BOTH, argv[0]);
9403}
9404
587ff0fd
LB
9405DEFUN (clear_ip_bgp_all_encap_soft,
9406 clear_ip_bgp_all_encap_soft_cmd,
9407 "clear ip bgp * encap unicast soft",
9408 CLEAR_STR
9409 IP_STR
9410 BGP_STR
9411 "Clear all peers\n"
9412 "Address family\n"
9413 "Address Family Modifier\n"
9414 "Soft reconfig\n")
9415{
9416 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
9417 BGP_CLEAR_SOFT_BOTH, argv[0]);
9418}
9419
718e3744 9420DEFUN (clear_bgp_all_soft,
9421 clear_bgp_all_soft_cmd,
9422 "clear bgp * soft",
9423 CLEAR_STR
9424 BGP_STR
9425 "Clear all peers\n"
e0bce756 9426 BGP_SOFT_STR)
718e3744 9427{
6aeb9e78
DS
9428 if (argc == 2)
9429 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all,
01080f7c 9430 BGP_CLEAR_SOFT_BOTH, NULL);
718e3744 9431
9432 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
01080f7c 9433 BGP_CLEAR_SOFT_BOTH, NULL);
718e3744 9434}
9435
9436ALIAS (clear_bgp_all_soft,
9437 clear_bgp_instance_all_soft_cmd,
8386ac43 9438 "clear bgp " BGP_INSTANCE_CMD " * soft",
718e3744 9439 CLEAR_STR
9440 BGP_STR
8386ac43 9441 BGP_INSTANCE_HELP_STR
718e3744 9442 "Clear all peers\n"
e0bce756 9443 BGP_SOFT_STR)
718e3744 9444
9445ALIAS (clear_bgp_all_soft,
9446 clear_bgp_ipv6_all_soft_cmd,
9447 "clear bgp ipv6 * soft",
9448 CLEAR_STR
9449 BGP_STR
9450 "Address family\n"
9451 "Clear all peers\n"
e0bce756 9452 BGP_SOFT_STR)
718e3744 9453
01080f7c 9454ALIAS (clear_bgp_all_soft,
9455 clear_bgp_instance_ipv6_all_soft_cmd,
9456 "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft",
9457 CLEAR_STR
9458 BGP_STR
9459 BGP_INSTANCE_HELP_STR
9460 "Address family\n"
9461 "Clear all peers\n"
9462 BGP_SOFT_STR)
9463
718e3744 9464DEFUN (clear_ip_bgp_peer_soft,
9465 clear_ip_bgp_peer_soft_cmd,
db64ea86 9466 "clear ip bgp (A.B.C.D|WORD) soft",
718e3744 9467 CLEAR_STR
9468 IP_STR
9469 BGP_STR
9470 "BGP neighbor address to clear\n"
db64ea86 9471 "BGP neighbor on interface to clear\n"
e0bce756 9472 BGP_SOFT_STR)
718e3744 9473{
01080f7c 9474 if (argc == 3)
9475 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
9476 BGP_CLEAR_SOFT_BOTH, argv[2]);
9477
718e3744 9478 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
9479 BGP_CLEAR_SOFT_BOTH, argv[0]);
9480}
9481
01080f7c 9482ALIAS (clear_ip_bgp_peer_soft,
9483 clear_ip_bgp_instance_peer_soft_cmd,
9484 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft",
9485 CLEAR_STR
9486 IP_STR
9487 BGP_STR
9488 BGP_INSTANCE_HELP_STR
9489 "BGP neighbor address to clear\n"
9490 "BGP neighbor on interface to clear\n"
9491 BGP_SOFT_STR)
9492
718e3744 9493DEFUN (clear_ip_bgp_peer_ipv4_soft,
9494 clear_ip_bgp_peer_ipv4_soft_cmd,
db64ea86 9495 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft",
718e3744 9496 CLEAR_STR
9497 IP_STR
9498 BGP_STR
9499 "BGP neighbor address to clear\n"
db64ea86 9500 "BGP neighbor on interface to clear\n"
718e3744 9501 "Address family\n"
9502 "Address Family Modifier\n"
9503 "Address Family Modifier\n"
e0bce756 9504 BGP_SOFT_STR)
718e3744 9505{
9506 if (strncmp (argv[1], "m", 1) == 0)
9507 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
9508 BGP_CLEAR_SOFT_BOTH, argv[0]);
9509
9510 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
9511 BGP_CLEAR_SOFT_BOTH, argv[0]);
9512}
9513
01080f7c 9514DEFUN (clear_ip_bgp_instance_peer_ipv4_soft,
9515 clear_ip_bgp_instance_peer_ipv4_soft_cmd,
9516 "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft",
9517 CLEAR_STR
9518 IP_STR
9519 BGP_STR
9520 BGP_INSTANCE_HELP_STR
9521 "BGP neighbor address to clear\n"
9522 "BGP neighbor on interface to clear\n"
9523 "Address family\n"
9524 "Address Family Modifier\n"
9525 "Address Family Modifier\n"
9526 BGP_SOFT_STR)
9527{
9528 if (strncmp (argv[3], "m", 1) == 0)
9529 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer,
9530 BGP_CLEAR_SOFT_BOTH, argv[2]);
9531
9532 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer,
9533 BGP_CLEAR_SOFT_BOTH, argv[2]);
9534}
9535
718e3744 9536DEFUN (clear_ip_bgp_peer_vpnv4_soft,
9537 clear_ip_bgp_peer_vpnv4_soft_cmd,
db64ea86 9538 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft",
718e3744 9539 CLEAR_STR
9540 IP_STR
9541 BGP_STR
9542 "BGP neighbor address to clear\n"
db64ea86 9543 "BGP neighbor on interface to clear\n"
718e3744 9544 "Address family\n"
9545 "Address Family Modifier\n"
e0bce756 9546 BGP_SOFT_STR)
718e3744 9547{
9548 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
9549 BGP_CLEAR_SOFT_BOTH, argv[0]);
9550}
9551
587ff0fd
LB
9552DEFUN (clear_ip_bgp_peer_encap_soft,
9553 clear_ip_bgp_peer_encap_soft_cmd,
9554 "clear ip bgp A.B.C.D encap unicast soft",
9555 CLEAR_STR
9556 IP_STR
9557 BGP_STR
9558 "BGP neighbor address to clear\n"
9559 "Address family\n"
9560 "Address Family Modifier\n"
9561 "Soft reconfig\n")
9562{
9563 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
9564 BGP_CLEAR_SOFT_BOTH, argv[0]);
9565}
9566
718e3744 9567DEFUN (clear_bgp_peer_soft,
9568 clear_bgp_peer_soft_cmd,
a80beece 9569 "clear bgp (A.B.C.D|X:X::X:X|WORD) soft",
718e3744 9570 CLEAR_STR
9571 BGP_STR
9572 "BGP neighbor address to clear\n"
9573 "BGP IPv6 neighbor to clear\n"
a80beece 9574 "BGP neighbor on interface to clear\n"
e0bce756 9575 BGP_SOFT_STR)
718e3744 9576{
01080f7c 9577 if (argc == 3)
9578 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer,
9579 BGP_CLEAR_SOFT_BOTH, argv[2]);
9580
718e3744 9581 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
9582 BGP_CLEAR_SOFT_BOTH, argv[0]);
9583}
9584
01080f7c 9585ALIAS (clear_bgp_peer_soft,
9586 clear_bgp_instance_peer_soft_cmd,
9587 "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft",
9588 CLEAR_STR
9589 BGP_STR
9590 BGP_INSTANCE_HELP_STR
9591 "BGP neighbor address to clear\n"
9592 "BGP IPv6 neighbor to clear\n"
9593 "BGP neighbor on interface to clear\n"
9594 BGP_SOFT_STR)
9595
718e3744 9596ALIAS (clear_bgp_peer_soft,
9597 clear_bgp_ipv6_peer_soft_cmd,
a80beece 9598 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft",
718e3744 9599 CLEAR_STR
9600 BGP_STR
9601 "Address family\n"
9602 "BGP neighbor address to clear\n"
9603 "BGP IPv6 neighbor to clear\n"
a80beece 9604 "BGP neighbor on interface to clear\n"
e0bce756 9605 BGP_SOFT_STR)
718e3744 9606
01080f7c 9607ALIAS (clear_bgp_peer_soft,
9608 clear_bgp_instance_ipv6_peer_soft_cmd,
9609 "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft",
9610 CLEAR_STR
9611 BGP_STR
9612 BGP_INSTANCE_HELP_STR
9613 "Address family\n"
9614 "BGP neighbor address to clear\n"
9615 "BGP IPv6 neighbor to clear\n"
9616 "BGP neighbor on interface to clear\n"
9617 BGP_SOFT_STR)
9618
718e3744 9619DEFUN (clear_ip_bgp_peer_group_soft,
9620 clear_ip_bgp_peer_group_soft_cmd,
9621 "clear ip bgp peer-group WORD soft",
9622 CLEAR_STR
9623 IP_STR
9624 BGP_STR
9625 "Clear all members of peer-group\n"
9626 "BGP peer-group name\n"
e0bce756 9627 BGP_SOFT_STR)
718e3744 9628{
01080f7c 9629 if (argc == 3)
9630 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
9631 BGP_CLEAR_SOFT_BOTH, argv[2]);
9632
718e3744 9633 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
9634 BGP_CLEAR_SOFT_BOTH, argv[0]);
9635}
9636
01080f7c 9637ALIAS (clear_ip_bgp_peer_group_soft,
9638 clear_ip_bgp_instance_peer_group_soft_cmd,
9639 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft",
9640 CLEAR_STR
9641 IP_STR
9642 BGP_STR
9643 BGP_INSTANCE_HELP_STR
9644 "Clear all members of peer-group\n"
9645 "BGP peer-group name\n"
9646 BGP_SOFT_STR)
9647
718e3744 9648DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
9649 clear_ip_bgp_peer_group_ipv4_soft_cmd,
9650 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
9651 CLEAR_STR
9652 IP_STR
9653 BGP_STR
9654 "Clear all members of peer-group\n"
9655 "BGP peer-group name\n"
9656 "Address family\n"
9657 "Address Family modifier\n"
9658 "Address Family modifier\n"
e0bce756 9659 BGP_SOFT_STR)
718e3744 9660{
9661 if (strncmp (argv[1], "m", 1) == 0)
9662 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
9663 BGP_CLEAR_SOFT_BOTH, argv[0]);
9664
9665 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
9666 BGP_CLEAR_SOFT_BOTH, argv[0]);
9667}
9668
01080f7c 9669DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft,
9670 clear_ip_bgp_instance_peer_group_ipv4_soft_cmd,
9671 "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft",
9672 CLEAR_STR
9673 IP_STR
9674 BGP_STR
9675 BGP_INSTANCE_HELP_STR
9676 "Clear all members of peer-group\n"
9677 "BGP peer-group name\n"
9678 "Address family\n"
9679 "Address Family modifier\n"
9680 "Address Family modifier\n"
9681 BGP_SOFT_STR)
9682{
9683 if (strncmp (argv[3], "m", 1) == 0)
9684 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group,
9685 BGP_CLEAR_SOFT_BOTH, argv[2]);
9686
9687 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group,
9688 BGP_CLEAR_SOFT_BOTH, argv[2]);
9689}
9690
718e3744 9691DEFUN (clear_bgp_peer_group_soft,
9692 clear_bgp_peer_group_soft_cmd,
9693 "clear bgp peer-group WORD soft",
9694 CLEAR_STR
9695 BGP_STR
9696 "Clear all members of peer-group\n"
9697 "BGP peer-group name\n"
e0bce756 9698 BGP_SOFT_STR)
718e3744 9699{
01080f7c 9700 if (argc == 3)
9701 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group,
9702 BGP_CLEAR_SOFT_BOTH, argv[2]);
9703
718e3744 9704 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
9705 BGP_CLEAR_SOFT_BOTH, argv[0]);
9706}
9707
01080f7c 9708ALIAS (clear_bgp_peer_group_soft,
9709 clear_bgp_instance_peer_group_soft_cmd,
9710 "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft",
9711 CLEAR_STR
9712 BGP_STR
9713 BGP_INSTANCE_HELP_STR
9714 "Clear all members of peer-group\n"
9715 "BGP peer-group name\n"
9716 BGP_SOFT_STR)
9717
718e3744 9718ALIAS (clear_bgp_peer_group_soft,
9719 clear_bgp_ipv6_peer_group_soft_cmd,
9720 "clear bgp ipv6 peer-group WORD soft",
9721 CLEAR_STR
9722 BGP_STR
9723 "Address family\n"
9724 "Clear all members of peer-group\n"
9725 "BGP peer-group name\n"
e0bce756 9726 BGP_SOFT_STR)
718e3744 9727
01080f7c 9728ALIAS (clear_bgp_peer_group_soft,
9729 clear_bgp_instance_ipv6_peer_group_soft_cmd,
9730 "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft",
9731 CLEAR_STR
9732 BGP_STR
9733 BGP_INSTANCE_HELP_STR
9734 "Address family\n"
9735 "Clear all members of peer-group\n"
9736 "BGP peer-group name\n"
9737 BGP_SOFT_STR)
9738
718e3744 9739DEFUN (clear_ip_bgp_external_soft,
9740 clear_ip_bgp_external_soft_cmd,
9741 "clear ip bgp external soft",
9742 CLEAR_STR
9743 IP_STR
9744 BGP_STR
9745 "Clear all external peers\n"
e0bce756 9746 BGP_SOFT_STR)
718e3744 9747{
01080f7c 9748 if (argc == 2)
9749 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
9750 BGP_CLEAR_SOFT_BOTH, NULL);
9751
718e3744 9752 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
9753 BGP_CLEAR_SOFT_BOTH, NULL);
9754}
9755
01080f7c 9756ALIAS (clear_ip_bgp_external_soft,
9757 clear_ip_bgp_instance_external_soft_cmd,
9758 "clear ip bgp " BGP_INSTANCE_CMD " external soft",
9759 CLEAR_STR
9760 IP_STR
9761 BGP_STR
9762 BGP_INSTANCE_HELP_STR
9763 "Clear all external peers\n"
9764 BGP_SOFT_STR)
9765
718e3744 9766DEFUN (clear_ip_bgp_external_ipv4_soft,
9767 clear_ip_bgp_external_ipv4_soft_cmd,
9768 "clear ip bgp external ipv4 (unicast|multicast) soft",
9769 CLEAR_STR
9770 IP_STR
9771 BGP_STR
9772 "Clear all external peers\n"
9773 "Address family\n"
9774 "Address Family modifier\n"
9775 "Address Family modifier\n"
e0bce756 9776 BGP_SOFT_STR)
718e3744 9777{
9778 if (strncmp (argv[0], "m", 1) == 0)
9779 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
9780 BGP_CLEAR_SOFT_BOTH, NULL);
9781
9782 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
9783 BGP_CLEAR_SOFT_BOTH, NULL);
9784}
9785
01080f7c 9786DEFUN (clear_ip_bgp_instance_external_ipv4_soft,
9787 clear_ip_bgp_instance_external_ipv4_soft_cmd,
9788 "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft",
9789 CLEAR_STR
9790 IP_STR
9791 BGP_STR
9792 BGP_INSTANCE_HELP_STR
9793 "Clear all external peers\n"
9794 "Address family\n"
9795 "Address Family modifier\n"
9796 "Address Family modifier\n"
9797 BGP_SOFT_STR)
9798{
9799 if (strncmp (argv[2], "m", 1) == 0)
9800 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external,
9801 BGP_CLEAR_SOFT_BOTH, NULL);
9802
9803 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external,
9804 BGP_CLEAR_SOFT_BOTH, NULL);
9805}
9806
718e3744 9807DEFUN (clear_bgp_external_soft,
9808 clear_bgp_external_soft_cmd,
9809 "clear bgp external soft",
9810 CLEAR_STR
9811 BGP_STR
9812 "Clear all external peers\n"
e0bce756 9813 BGP_SOFT_STR)
718e3744 9814{
01080f7c 9815 if (argc == 2)
9816 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external,
9817 BGP_CLEAR_SOFT_BOTH, NULL);
9818
718e3744 9819 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
9820 BGP_CLEAR_SOFT_BOTH, NULL);
9821}
9822
01080f7c 9823ALIAS (clear_bgp_external_soft,
9824 clear_bgp_instance_external_soft_cmd,
9825 "clear bgp " BGP_INSTANCE_CMD " external soft",
9826 CLEAR_STR
9827 BGP_STR
9828 BGP_INSTANCE_HELP_STR
9829 "Clear all external peers\n"
9830 BGP_SOFT_STR)
9831
718e3744 9832ALIAS (clear_bgp_external_soft,
9833 clear_bgp_ipv6_external_soft_cmd,
9834 "clear bgp ipv6 external soft",
9835 CLEAR_STR
9836 BGP_STR
9837 "Address family\n"
9838 "Clear all external peers\n"
e0bce756 9839 BGP_SOFT_STR)
718e3744 9840
01080f7c 9841ALIAS (clear_bgp_external_soft,
9842 clear_bgp_instance_ipv6_external_soft_cmd,
9843 "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft",
9844 CLEAR_STR
9845 BGP_STR
9846 BGP_INSTANCE_HELP_STR
9847 "Address family\n"
9848 "Clear all external peers\n"
9849 BGP_SOFT_STR)
9850
718e3744 9851DEFUN (clear_ip_bgp_as_soft,
9852 clear_ip_bgp_as_soft_cmd,
320da874 9853 "clear ip bgp " CMD_AS_RANGE " soft",
718e3744 9854 CLEAR_STR
9855 IP_STR
9856 BGP_STR
9857 "Clear peers with the AS number\n"
e0bce756 9858 BGP_SOFT_STR)
718e3744 9859{
01080f7c 9860 if (argc == 3)
9861 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as,
9862 BGP_CLEAR_SOFT_BOTH, argv[2]);
9863
718e3744 9864 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
9865 BGP_CLEAR_SOFT_BOTH, argv[0]);
9866}
9867
01080f7c 9868ALIAS (clear_ip_bgp_as_soft,
9869 clear_ip_bgp_instance_as_soft_cmd,
9870 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft",
9871 CLEAR_STR
9872 IP_STR
9873 BGP_STR
9874 BGP_INSTANCE_HELP_STR
9875 "Clear peers with the AS number\n"
9876 BGP_SOFT_STR)
9877
718e3744 9878DEFUN (clear_ip_bgp_as_ipv4_soft,
9879 clear_ip_bgp_as_ipv4_soft_cmd,
320da874 9880 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
718e3744 9881 CLEAR_STR
9882 IP_STR
9883 BGP_STR
9884 "Clear peers with the AS number\n"
9885 "Address family\n"
9886 "Address Family Modifier\n"
9887 "Address Family Modifier\n"
e0bce756 9888 BGP_SOFT_STR)
718e3744 9889{
9890 if (strncmp (argv[1], "m", 1) == 0)
9891 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
9892 BGP_CLEAR_SOFT_BOTH, argv[0]);
9893
9894 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
9895 BGP_CLEAR_SOFT_BOTH, argv[0]);
9896}
9897
01080f7c 9898DEFUN (clear_ip_bgp_instance_as_ipv4_soft,
9899 clear_ip_bgp_instance_as_ipv4_soft_cmd,
9900 "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
9901 CLEAR_STR
9902 IP_STR
9903 BGP_STR
9904 BGP_INSTANCE_HELP_STR
9905 "Clear peers with the AS number\n"
9906 "Address family\n"
9907 "Address Family Modifier\n"
9908 "Address Family Modifier\n"
9909 BGP_SOFT_STR)
9910{
9911 if (strncmp (argv[3], "m", 1) == 0)
9912 return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as,
9913 BGP_CLEAR_SOFT_BOTH, argv[2]);
9914
9915 return bgp_clear_vty (vty, argv[1],AFI_IP, SAFI_UNICAST, clear_as,
9916 BGP_CLEAR_SOFT_BOTH, argv[2]);
9917}
9918
718e3744 9919DEFUN (clear_ip_bgp_as_vpnv4_soft,
9920 clear_ip_bgp_as_vpnv4_soft_cmd,
320da874 9921 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
718e3744 9922 CLEAR_STR
9923 IP_STR
9924 BGP_STR
9925 "Clear peers with the AS number\n"
9926 "Address family\n"
9927 "Address Family Modifier\n"
e0bce756 9928 BGP_SOFT_STR)
718e3744 9929{
9930 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
9931 BGP_CLEAR_SOFT_BOTH, argv[0]);
9932}
9933
587ff0fd
LB
9934DEFUN (clear_ip_bgp_as_encap_soft,
9935 clear_ip_bgp_as_encap_soft_cmd,
9936 "clear ip bgp " CMD_AS_RANGE " encap unicast soft",
9937 CLEAR_STR
9938 IP_STR
9939 BGP_STR
9940 "Clear peers with the AS number\n"
9941 "Address family\n"
9942 "Address Family Modifier\n"
9943 "Soft reconfig\n")
9944{
9945 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
9946 BGP_CLEAR_SOFT_BOTH, argv[0]);
9947}
9948
718e3744 9949DEFUN (clear_bgp_as_soft,
9950 clear_bgp_as_soft_cmd,
320da874 9951 "clear bgp " CMD_AS_RANGE " soft",
718e3744 9952 CLEAR_STR
9953 BGP_STR
9954 "Clear peers with the AS number\n"
e0bce756 9955 BGP_SOFT_STR)
718e3744 9956{
01080f7c 9957 if (argc == 3)
9958 return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as,
9959 BGP_CLEAR_SOFT_BOTH, argv[2]);
9960
718e3744 9961 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
9962 BGP_CLEAR_SOFT_BOTH, argv[0]);
9963}
9964
01080f7c 9965ALIAS (clear_bgp_as_soft,
9966 clear_bgp_instance_as_soft_cmd,
9967 "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft",
9968 CLEAR_STR
9969 BGP_STR
9970 BGP_INSTANCE_HELP_STR
9971 "Clear peers with the AS number\n"
9972 BGP_SOFT_STR)
9973
718e3744 9974ALIAS (clear_bgp_as_soft,
9975 clear_bgp_ipv6_as_soft_cmd,
320da874 9976 "clear bgp ipv6 " CMD_AS_RANGE " soft",
718e3744 9977 CLEAR_STR
9978 BGP_STR
9979 "Address family\n"
9980 "Clear peers with the AS number\n"
e0bce756 9981 BGP_SOFT_STR)
6b0655a2 9982
01080f7c 9983ALIAS (clear_bgp_as_soft,
9984 clear_bgp_instance_ipv6_as_soft_cmd,
9985 "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft",
9986 CLEAR_STR
9987 BGP_STR
9988 BGP_INSTANCE_HELP_STR
9989 "Address family\n"
9990 "Clear peers with the AS number\n"
9991 BGP_SOFT_STR)
9992
e0081f70
ML
9993DEFUN (show_bgp_views,
9994 show_bgp_views_cmd,
9995 "show bgp views",
9996 SHOW_STR
9997 BGP_STR
9998 "Show the defined BGP views\n")
9999{
10000 struct list *inst = bm->bgp;
10001 struct listnode *node;
10002 struct bgp *bgp;
10003
10004 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
10005 {
8386ac43 10006 vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE);
e0081f70
ML
10007 return CMD_WARNING;
10008 }
10009
10010 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
10011 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
8386ac43 10012 {
10013 /* Skip VRFs. */
10014 if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF)
10015 continue;
10016 vty_out (vty, "\t%s (AS%u)%s",
10017 bgp->name ? bgp->name : "(null)",
10018 bgp->as, VTY_NEWLINE);
10019 }
e0081f70
ML
10020
10021 return CMD_SUCCESS;
10022}
10023
8386ac43 10024DEFUN (show_bgp_vrfs,
10025 show_bgp_vrfs_cmd,
10026 "show bgp vrfs {json}",
10027 SHOW_STR
10028 BGP_STR
10029 "Show BGP VRFs\n"
10030 "JavaScript Object Notation\n")
10031{
10032 struct list *inst = bm->bgp;
10033 struct listnode *node;
10034 struct bgp *bgp;
10035 u_char uj = use_json(argc, argv);
10036 json_object *json = NULL;
10037 json_object *json_vrfs = NULL;
10038 int count = 0;
10039 static char header[] = "Type Id RouterId #PeersCfg #PeersEstb Name";
10040
10041 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
10042 {
10043 vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE);
10044 return CMD_WARNING;
10045 }
10046
10047 if (uj)
10048 {
10049 json = json_object_new_object();
10050 json_vrfs = json_object_new_object();
10051 }
10052
10053 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
10054 {
10055 const char *name, *type;
10056 struct peer *peer;
10057 struct listnode *node, *nnode;
10058 int peers_cfg, peers_estb;
10059 json_object *json_vrf = NULL;
5c81a5f3 10060 int vrf_id_ui;
8386ac43 10061
10062 /* Skip Views. */
10063 if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
10064 continue;
10065
10066 count++;
10067 if (!uj && count == 1)
10068 vty_out (vty, "%s%s", header, VTY_NEWLINE);
10069
10070 peers_cfg = peers_estb = 0;
10071 if (uj)
10072 json_vrf = json_object_new_object();
10073
10074
10075 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
10076 {
10077 if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
10078 continue;
10079 peers_cfg++;
10080 if (peer->status == Established)
10081 peers_estb++;
10082 }
10083
10084 if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
10085 {
10086 name = "Default";
10087 type = "DFLT";
10088 }
10089 else
10090 {
10091 name = bgp->name;
10092 type = "VRF";
10093 }
10094
5c81a5f3 10095 vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id;
8386ac43 10096 if (uj)
10097 {
10098 json_object_string_add(json_vrf, "type", type);
5c81a5f3 10099 json_object_int_add(json_vrf, "vrfId", vrf_id_ui);
8386ac43 10100 json_object_string_add(json_vrf, "routerId", inet_ntoa (bgp->router_id));
10101 json_object_int_add(json_vrf, "numConfiguredPeers", peers_cfg);
10102 json_object_int_add(json_vrf, "numEstablishedPeers", peers_estb);
10103
10104 json_object_object_add(json_vrfs, name, json_vrf);
10105 }
10106 else
5c81a5f3 10107 vty_out (vty, "%4s %-5d %-16s %9u %10u %s%s",
10108 type, vrf_id_ui, inet_ntoa (bgp->router_id),
8386ac43 10109 peers_cfg, peers_estb, name,
10110 VTY_NEWLINE);
10111 }
10112
10113 if (uj)
10114 {
10115 json_object_object_add(json, "vrfs", json_vrfs);
10116
10117 json_object_int_add(json, "totalVrfs", count);
10118
10119 vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
10120 json_object_free(json);
10121 }
10122 else
10123 {
10124 if (count)
10125 vty_out (vty, "%sTotal number of VRFs (including default): %d%s",
10126 VTY_NEWLINE, count, VTY_NEWLINE);
10127 }
10128
10129 return CMD_SUCCESS;
10130}
10131
4bf6a362
PJ
10132DEFUN (show_bgp_memory,
10133 show_bgp_memory_cmd,
10134 "show bgp memory",
10135 SHOW_STR
10136 BGP_STR
10137 "Global BGP memory statistics\n")
10138{
10139 char memstrbuf[MTYPE_MEMSTR_LEN];
10140 unsigned long count;
10141
10142 /* RIB related usage stats */
10143 count = mtype_stats_alloc (MTYPE_BGP_NODE);
10144 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
10145 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10146 count * sizeof (struct bgp_node)),
10147 VTY_NEWLINE);
10148
10149 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
10150 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
10151 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10152 count * sizeof (struct bgp_info)),
10153 VTY_NEWLINE);
fb982c25
PJ
10154 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
10155 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
10156 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10157 count * sizeof (struct bgp_info_extra)),
10158 VTY_NEWLINE);
4bf6a362
PJ
10159
10160 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
10161 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
10162 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10163 count * sizeof (struct bgp_static)),
10164 VTY_NEWLINE);
3f9c7369
DS
10165
10166 if ((count = mtype_stats_alloc (MTYPE_BGP_PACKET)))
10167 vty_out (vty, "%ld Packets, using %s of memory%s", count,
10168 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10169 count * sizeof (struct bpacket)),
10170 VTY_NEWLINE);
4bf6a362
PJ
10171
10172 /* Adj-In/Out */
10173 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
10174 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
10175 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10176 count * sizeof (struct bgp_adj_in)),
10177 VTY_NEWLINE);
10178 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
10179 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
10180 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10181 count * sizeof (struct bgp_adj_out)),
10182 VTY_NEWLINE);
10183
10184 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
10185 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
10186 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10187 count * sizeof (struct bgp_nexthop_cache)),
10188 VTY_NEWLINE);
10189
10190 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
10191 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
10192 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10193 count * sizeof (struct bgp_damp_info)),
10194 VTY_NEWLINE);
10195
10196 /* Attributes */
10197 count = attr_count();
10198 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
10199 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10200 count * sizeof(struct attr)),
10201 VTY_NEWLINE);
fb982c25
PJ
10202 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
10203 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
10204 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10205 count * sizeof(struct attr_extra)),
10206 VTY_NEWLINE);
4bf6a362
PJ
10207
10208 if ((count = attr_unknown_count()))
10209 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
10210
10211 /* AS_PATH attributes */
10212 count = aspath_count ();
10213 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
10214 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10215 count * sizeof (struct aspath)),
10216 VTY_NEWLINE);
10217
10218 count = mtype_stats_alloc (MTYPE_AS_SEG);
10219 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
10220 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10221 count * sizeof (struct assegment)),
10222 VTY_NEWLINE);
10223
10224 /* Other attributes */
10225 if ((count = community_count ()))
10226 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
10227 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10228 count * sizeof (struct community)),
10229 VTY_NEWLINE);
10230 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
10231 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
10232 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10233 count * sizeof (struct ecommunity)),
10234 VTY_NEWLINE);
10235
10236 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
10237 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
10238 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10239 count * sizeof (struct cluster_list)),
10240 VTY_NEWLINE);
10241
10242 /* Peer related usage */
10243 count = mtype_stats_alloc (MTYPE_BGP_PEER);
10244 vty_out (vty, "%ld peers, using %s of memory%s", count,
10245 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10246 count * sizeof (struct peer)),
10247 VTY_NEWLINE);
10248
6e919709 10249 if ((count = mtype_stats_alloc (MTYPE_BGP_PEER_GROUP)))
4bf6a362
PJ
10250 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
10251 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10252 count * sizeof (struct peer_group)),
10253 VTY_NEWLINE);
10254
10255 /* Other */
10256 if ((count = mtype_stats_alloc (MTYPE_HASH)))
10257 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
10258 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10259 count * sizeof (struct hash)),
10260 VTY_NEWLINE);
10261 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
10262 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
10263 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10264 count * sizeof (struct hash_backet)),
10265 VTY_NEWLINE);
10266 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
10267 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
10268 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10269 count * sizeof (regex_t)),
10270 VTY_NEWLINE);
10271 return CMD_SUCCESS;
10272}
fee0f4c6 10273
718e3744 10274/* Show BGP peer's summary information. */
94f2b392 10275static int
b05a1c8b 10276bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi,
9f689658 10277 u_char use_json, json_object *json)
718e3744 10278{
10279 struct peer *peer;
1eb8ef25 10280 struct listnode *node, *nnode;
f14e6fdb
DS
10281 unsigned int count = 0, dn_count = 0;
10282 char timebuf[BGP_UPTIME_LEN], dn_flag[2];
718e3744 10283 int len;
ffd0c037
DS
10284 json_object *json_peer = NULL;
10285 json_object *json_peers = NULL;
718e3744 10286
10287 /* Header string for each address family. */
4a7ac06c 10288 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
47fc97cc 10289
b05a1c8b
DS
10290 if (use_json)
10291 {
9f689658
DD
10292 if (json == NULL)
10293 json = json_object_new_object();
10294
f1aa5d8a 10295 json_peers = json_object_new_object();
b05a1c8b
DS
10296 }
10297
1eb8ef25 10298 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
718e3744 10299 {
1ff9a340
DS
10300 if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
10301 continue;
10302
718e3744 10303 if (peer->afc[afi][safi])
10304 {
b05a1c8b 10305 if (!count)
4bf6a362
PJ
10306 {
10307 unsigned long ents;
10308 char memstrbuf[MTYPE_MEMSTR_LEN];
5c81a5f3 10309 int vrf_id_ui;
10310
10311 vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id;
b05a1c8b 10312
4bf6a362 10313 /* Usage summary and header */
b05a1c8b
DS
10314 if (use_json)
10315 {
62d6dca0 10316 json_object_string_add(json, "routerId", inet_ntoa (bgp->router_id));
f1aa5d8a 10317 json_object_int_add(json, "as", bgp->as);
9f689658
DD
10318 json_object_int_add(json, "vrfId", vrf_id_ui);
10319 json_object_string_add(json, "vrfName",
10320 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
10321 ? "Default" : bgp->name);
b05a1c8b
DS
10322 }
10323 else
10324 {
10325 vty_out (vty,
5c81a5f3 10326 "BGP router identifier %s, local AS number %u vrf-id %d",
10327 inet_ntoa (bgp->router_id), bgp->as, vrf_id_ui);
6aeb9e78 10328 vty_out (vty, "%s", VTY_NEWLINE);
b05a1c8b
DS
10329 }
10330
f188f2c4
DS
10331 if (bgp_update_delay_configured(bgp))
10332 {
b05a1c8b 10333 if (use_json)
f188f2c4 10334 {
62d6dca0 10335 json_object_int_add(json, "updateDelayLimit", bgp->v_update_delay);
b05a1c8b
DS
10336
10337 if (bgp->v_update_delay != bgp->v_establish_wait)
62d6dca0 10338 json_object_int_add(json, "updateDelayEstablishWait", bgp->v_establish_wait);
b05a1c8b
DS
10339
10340 if (bgp_update_delay_active(bgp))
10341 {
62d6dca0
DS
10342 json_object_string_add(json, "updateDelayFirstNeighbor", bgp->update_delay_begin_time);
10343 json_object_boolean_true_add(json, "updateDelayInProgress");
b05a1c8b
DS
10344 }
10345 else
10346 {
10347 if (bgp->update_delay_over)
10348 {
62d6dca0 10349 json_object_string_add(json, "updateDelayFirstNeighbor",
f1aa5d8a 10350 bgp->update_delay_begin_time);
62d6dca0 10351 json_object_string_add(json, "updateDelayBestpathResumed",
f1aa5d8a 10352 bgp->update_delay_end_time);
62d6dca0 10353 json_object_string_add(json, "updateDelayZebraUpdateResume",
f1aa5d8a 10354 bgp->update_delay_zebra_resume_time);
62d6dca0 10355 json_object_string_add(json, "updateDelayPeerUpdateResume",
f1aa5d8a 10356 bgp->update_delay_peers_resume_time);
b05a1c8b
DS
10357 }
10358 }
f188f2c4
DS
10359 }
10360 else
10361 {
b05a1c8b
DS
10362 vty_out (vty, "Read-only mode update-delay limit: %d seconds%s",
10363 bgp->v_update_delay, VTY_NEWLINE);
10364 if (bgp->v_update_delay != bgp->v_establish_wait)
10365 vty_out (vty, " Establish wait: %d seconds%s",
10366 bgp->v_establish_wait, VTY_NEWLINE);
10367
10368 if (bgp_update_delay_active(bgp))
f188f2c4
DS
10369 {
10370 vty_out (vty, " First neighbor established: %s%s",
10371 bgp->update_delay_begin_time, VTY_NEWLINE);
b05a1c8b
DS
10372 vty_out (vty, " Delay in progress%s", VTY_NEWLINE);
10373 }
10374 else
10375 {
10376 if (bgp->update_delay_over)
10377 {
10378 vty_out (vty, " First neighbor established: %s%s",
10379 bgp->update_delay_begin_time, VTY_NEWLINE);
10380 vty_out (vty, " Best-paths resumed: %s%s",
10381 bgp->update_delay_end_time, VTY_NEWLINE);
10382 vty_out (vty, " zebra update resumed: %s%s",
10383 bgp->update_delay_zebra_resume_time, VTY_NEWLINE);
10384 vty_out (vty, " peers update resumed: %s%s",
10385 bgp->update_delay_peers_resume_time, VTY_NEWLINE);
10386 }
f188f2c4
DS
10387 }
10388 }
10389 }
4bf6a362 10390
b05a1c8b
DS
10391 if (use_json)
10392 {
10393 if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active)
62d6dca0 10394 json_object_boolean_true_add(json, "maxMedOnStartup");
b05a1c8b 10395 if (bgp->v_maxmed_admin)
62d6dca0 10396 json_object_boolean_true_add(json, "maxMedAdministrative");
b05a1c8b 10397
62d6dca0 10398 json_object_int_add(json, "tableVersion", bgp_table_version(bgp->rib[afi][safi]));
b05a1c8b
DS
10399
10400 ents = bgp_table_count (bgp->rib[afi][safi]);
62d6dca0
DS
10401 json_object_int_add(json, "ribCount", ents);
10402 json_object_int_add(json, "ribMemory", ents * sizeof (struct bgp_node));
b05a1c8b
DS
10403
10404 ents = listcount (bgp->peer);
62d6dca0
DS
10405 json_object_int_add(json, "peerCount", ents);
10406 json_object_int_add(json, "peerMemory", ents * sizeof (struct peer));
b05a1c8b 10407
b05a1c8b
DS
10408 if ((ents = listcount (bgp->group)))
10409 {
62d6dca0
DS
10410 json_object_int_add(json, "peerGroupCount", ents);
10411 json_object_int_add(json, "peerGroupMemory", ents * sizeof (struct peer_group));
b05a1c8b 10412 }
3f9c7369 10413
b05a1c8b 10414 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
62d6dca0 10415 json_object_boolean_true_add(json, "dampeningEnabled");
b05a1c8b
DS
10416 }
10417 else
10418 {
10419 if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active)
10420 vty_out (vty, "Max-med on-startup active%s", VTY_NEWLINE);
10421 if (bgp->v_maxmed_admin)
10422 vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE);
10423
ffd0c037 10424 vty_out(vty, "BGP table version %" PRIu64 "%s",
b05a1c8b
DS
10425 bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE);
10426
10427 ents = bgp_table_count (bgp->rib[afi][safi]);
10428 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
10429 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10430 ents * sizeof (struct bgp_node)),
10431 VTY_NEWLINE);
10432
10433 /* Peer related usage */
10434 ents = listcount (bgp->peer);
10435 vty_out (vty, "Peers %ld, using %s of memory%s",
10436 ents,
10437 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10438 ents * sizeof (struct peer)),
10439 VTY_NEWLINE);
10440
b05a1c8b
DS
10441 if ((ents = listcount (bgp->group)))
10442 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
10443 mtype_memstr (memstrbuf, sizeof (memstrbuf),
10444 ents * sizeof (struct peer_group)),
10445 VTY_NEWLINE);
10446
10447 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
10448 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
10449 vty_out (vty, "%s", VTY_NEWLINE);
10450 vty_out (vty, "%s%s", header, VTY_NEWLINE);
10451 }
4bf6a362
PJ
10452 }
10453
b05a1c8b 10454 count++;
718e3744 10455
b05a1c8b
DS
10456 if (use_json)
10457 {
10458 json_peer = json_object_new_object();
f14e6fdb 10459
b05a1c8b 10460 if (peer_dynamic_neighbor(peer))
62d6dca0 10461 json_object_boolean_true_add(json_peer, "dynamicPeer");
b05a1c8b 10462
04b6bdc0
DW
10463 if (peer->hostname)
10464 json_object_string_add(json_peer, "hostname", peer->hostname);
10465
10466 if (peer->domainname)
10467 json_object_string_add(json_peer, "domainname", peer->domainname);
10468
62d6dca0 10469 json_object_int_add(json_peer, "remoteAs", peer->as);
f1aa5d8a 10470 json_object_int_add(json_peer, "version", 4);
62d6dca0 10471 json_object_int_add(json_peer, "msgRcvd",
f1aa5d8a
DS
10472 peer->open_in + peer->update_in + peer->keepalive_in
10473 + peer->notify_in + peer->refresh_in
10474 + peer->dynamic_cap_in);
62d6dca0 10475 json_object_int_add(json_peer, "msgSent",
f1aa5d8a
DS
10476 peer->open_out + peer->update_out + peer->keepalive_out
10477 + peer->notify_out + peer->refresh_out
10478 + peer->dynamic_cap_out);
10479
62d6dca0 10480 json_object_int_add(json_peer, "tableVersion", peer->version[afi][safi]);
f1aa5d8a
DS
10481 json_object_int_add(json_peer, "outq", peer->obuf->count);
10482 json_object_int_add(json_peer, "inq", 0);
856ca177 10483 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, use_json, json_peer);
62d6dca0 10484 json_object_int_add(json_peer, "prefixReceivedCount", peer->pcount[afi][safi]);
b05a1c8b
DS
10485
10486 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
f1aa5d8a 10487 json_object_string_add(json_peer, "state", "Idle (Admin)");
b05a1c8b 10488 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
f1aa5d8a 10489 json_object_string_add(json_peer, "state", "Idle (PfxCt)");
b05a1c8b 10490 else
f1aa5d8a 10491 json_object_string_add(json_peer, "state", LOOKUP(bgp_status_msg, peer->status));
b05a1c8b 10492
f1aa5d8a 10493 if (peer->conf_if)
62d6dca0 10494 json_object_string_add(json_peer, "idType", "interface");
f1aa5d8a 10495 else if (peer->su.sa.sa_family == AF_INET)
62d6dca0 10496 json_object_string_add(json_peer, "idType", "ipv4");
f1aa5d8a 10497 else if (peer->su.sa.sa_family == AF_INET6)
62d6dca0 10498 json_object_string_add(json_peer, "idType", "ipv6");
b05a1c8b 10499
f1aa5d8a 10500 json_object_object_add(json_peers, peer->host, json_peer);
b05a1c8b
DS
10501 }
10502 else
10503 {
10504 memset(dn_flag, '\0', sizeof(dn_flag));
10505 if (peer_dynamic_neighbor(peer))
10506 {
10507 dn_count++;
10508 dn_flag[0] = '*';
10509 }
10510
04b6bdc0
DW
10511 if (peer->hostname && bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME))
10512 len = vty_out (vty, "%s%s(%s)", dn_flag, peer->hostname,
10513 peer->host);
10514 else
10515 len = vty_out (vty, "%s%s", dn_flag, peer->host);
b05a1c8b
DS
10516 len = 16 - len;
10517
10518 if (len < 1)
10519 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
10520 else
10521 vty_out (vty, "%*s", len, " ");
10522
10523 vty_out (vty, "4 ");
10524
ee046671 10525 vty_out (vty, "%5u %7d %7d %8" PRIu64 " %4d %4zd ",
b05a1c8b
DS
10526 peer->as,
10527 peer->open_in + peer->update_in + peer->keepalive_in
10528 + peer->notify_in + peer->refresh_in
10529 + peer->dynamic_cap_in,
10530 peer->open_out + peer->update_out + peer->keepalive_out
10531 + peer->notify_out + peer->refresh_out
10532 + peer->dynamic_cap_out,
10533 peer->version[afi][safi],
10534 0,
ffd0c037 10535 peer->obuf->count);
b05a1c8b 10536
f1aa5d8a 10537 vty_out (vty, "%-8s",
856ca177 10538 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL));
b05a1c8b
DS
10539
10540 if (peer->status == Established)
10541 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
10542 else
10543 {
10544 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
10545 vty_out (vty, " Idle (Admin)");
10546 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
10547 vty_out (vty, " Idle (PfxCt)");
10548 else
10549 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
10550 }
10551 vty_out (vty, "%s", VTY_NEWLINE);
10552 }
718e3744 10553 }
10554 }
10555
b05a1c8b
DS
10556 if (use_json)
10557 {
10558 json_object_object_add(json, "peers", json_peers);
14151a32 10559
62d6dca0
DS
10560 json_object_int_add(json, "totalPeers", count);
10561 json_object_int_add(json, "dynamicPeers", dn_count);
14151a32 10562
b05a1c8b 10563 vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
f1aa5d8a 10564 json_object_free(json);
b05a1c8b
DS
10565 }
10566 else
f14e6fdb 10567 {
b05a1c8b
DS
10568 if (count)
10569 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
10570 count, VTY_NEWLINE);
10571 else
9f689658
DD
10572 {
10573 if (use_json)
10574 vty_out(vty, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s",
10575 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
10576 else
10577 vty_out (vty, "No %s neighbor is configured%s",
10578 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
10579 }
b05a1c8b 10580
9f689658 10581 if (dn_count && ! use_json)
b05a1c8b
DS
10582 {
10583 vty_out(vty, "* - dynamic neighbor%s", VTY_NEWLINE);
10584 vty_out(vty,
10585 "%d dynamic neighbor(s), limit %d%s",
10586 dn_count, bgp->dynamic_neighbors_limit, VTY_NEWLINE);
10587 }
f14e6fdb
DS
10588 }
10589
718e3744 10590 return CMD_SUCCESS;
10591}
10592
47fc97cc
DS
10593static int
10594bgp_show_summary_vty (struct vty *vty, const char *name,
b05a1c8b 10595 afi_t afi, safi_t safi, u_char use_json)
718e3744 10596{
10597 struct bgp *bgp;
10598
10599 if (name)
10600 {
10601 bgp = bgp_lookup_by_name (name);
47fc97cc 10602
718e3744 10603 if (! bgp)
10604 {
47fc97cc 10605 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
718e3744 10606 return CMD_WARNING;
10607 }
10608
9f689658 10609 bgp_show_summary (vty, bgp, afi, safi, use_json, NULL);
718e3744 10610 return CMD_SUCCESS;
10611 }
47fc97cc 10612
718e3744 10613 bgp = bgp_get_default ();
10614
10615 if (bgp)
9f689658 10616 bgp_show_summary (vty, bgp, afi, safi, use_json, NULL);
47fc97cc 10617
718e3744 10618 return CMD_SUCCESS;
10619}
10620
f186de26 10621static void
10622bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi,
10623 u_char use_json)
10624{
10625 struct listnode *node, *nnode;
10626 struct bgp *bgp;
9f689658
DD
10627 json_object *json = NULL;
10628 int is_first = 1;
10629
10630 if (use_json)
10631 vty_out (vty, "{%s", VTY_NEWLINE);
f186de26 10632
10633 for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
10634 {
9f689658
DD
10635 if (use_json)
10636 {
10637 if (!(json = json_object_new_object()))
10638 {
10639 zlog_err("Unable to allocate memory for JSON object");
10640 vty_out (vty,
10641 "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s",
10642 VTY_NEWLINE);
10643 return;
10644 }
10645
10646 if (! is_first)
10647 vty_out (vty, ",%s", VTY_NEWLINE);
10648 else
10649 is_first = 0;
10650
10651 vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
10652 ? "Default" : bgp->name);
10653 }
10654 else
10655 {
10656 vty_out (vty, "%sInstance %s:%s",
10657 VTY_NEWLINE,
10658 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
10659 ? "Default" : bgp->name, VTY_NEWLINE);
10660 }
10661 bgp_show_summary (vty, bgp, afi, safi, use_json, json);
f186de26 10662 }
9f689658
DD
10663
10664 if (use_json)
10665 vty_out (vty, "}%s", VTY_NEWLINE);
10666
f186de26 10667}
10668
718e3744 10669/* `show ip bgp summary' commands. */
47fc97cc 10670DEFUN (show_ip_bgp_summary,
718e3744 10671 show_ip_bgp_summary_cmd,
b05a1c8b 10672 "show ip bgp summary {json}",
47fc97cc
DS
10673 SHOW_STR
10674 IP_STR
10675 BGP_STR
b05a1c8b
DS
10676 "Summary of BGP neighbor status\n"
10677 "JavaScript Object Notation\n")
47fc97cc 10678{
db7c8528
DS
10679 u_char uj = use_json(argc, argv);
10680 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj);
718e3744 10681}
10682
10683DEFUN (show_ip_bgp_instance_summary,
10684 show_ip_bgp_instance_summary_cmd,
8386ac43 10685 "show ip bgp " BGP_INSTANCE_CMD " summary {json}",
718e3744 10686 SHOW_STR
10687 IP_STR
10688 BGP_STR
8386ac43 10689 BGP_INSTANCE_HELP_STR
b05a1c8b
DS
10690 "Summary of BGP neighbor status\n"
10691 "JavaScript Object Notation\n")
718e3744 10692{
db7c8528 10693 u_char uj = use_json(argc, argv);
6aeb9e78 10694 return bgp_show_summary_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, uj);
718e3744 10695}
10696
f186de26 10697DEFUN (show_ip_bgp_instance_all_summary,
10698 show_ip_bgp_instance_all_summary_cmd,
10699 "show ip bgp " BGP_INSTANCE_ALL_CMD " summary {json}",
10700 SHOW_STR
10701 IP_STR
10702 BGP_STR
10703 BGP_INSTANCE_ALL_HELP_STR
10704 "Summary of BGP neighbor status\n"
10705 "JavaScript Object Notation\n")
10706{
10707 u_char uj = use_json(argc, argv);
10708
10709 bgp_show_all_instances_summary_vty (vty, AFI_IP, SAFI_UNICAST, uj);
10710 return CMD_SUCCESS;
10711}
10712
718e3744 10713DEFUN (show_ip_bgp_ipv4_summary,
10714 show_ip_bgp_ipv4_summary_cmd,
b05a1c8b 10715 "show ip bgp ipv4 (unicast|multicast) summary {json}",
718e3744 10716 SHOW_STR
10717 IP_STR
10718 BGP_STR
10719 "Address family\n"
10720 "Address Family modifier\n"
10721 "Address Family modifier\n"
b05a1c8b
DS
10722 "Summary of BGP neighbor status\n"
10723 "JavaScript Object Notation\n")
718e3744 10724{
db7c8528 10725 u_char uj = use_json(argc, argv);
718e3744 10726 if (strncmp (argv[0], "m", 1) == 0)
db7c8528 10727 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, uj);
718e3744 10728
db7c8528 10729 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj);
718e3744 10730}
10731
95cbbd2a
ML
10732ALIAS (show_ip_bgp_ipv4_summary,
10733 show_bgp_ipv4_safi_summary_cmd,
b05a1c8b 10734 "show bgp ipv4 (unicast|multicast) summary {json}",
95cbbd2a
ML
10735 SHOW_STR
10736 BGP_STR
10737 "Address family\n"
10738 "Address Family modifier\n"
10739 "Address Family modifier\n"
10740 "Summary of BGP neighbor status\n")
10741
718e3744 10742DEFUN (show_ip_bgp_instance_ipv4_summary,
10743 show_ip_bgp_instance_ipv4_summary_cmd,
b05a1c8b 10744 "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}",
718e3744 10745 SHOW_STR
10746 IP_STR
10747 BGP_STR
10748 "BGP view\n"
10749 "View name\n"
10750 "Address family\n"
10751 "Address Family modifier\n"
10752 "Address Family modifier\n"
b05a1c8b
DS
10753 "Summary of BGP neighbor status\n"
10754 "JavaScript Object Notation\n")
718e3744 10755{
db7c8528 10756 u_char uj = use_json(argc, argv);
718e3744 10757 if (strncmp (argv[1], "m", 1) == 0)
db7c8528 10758 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, uj);
718e3744 10759 else
db7c8528 10760 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, uj);
718e3744 10761}
10762
95cbbd2a
ML
10763ALIAS (show_ip_bgp_instance_ipv4_summary,
10764 show_bgp_instance_ipv4_safi_summary_cmd,
b05a1c8b 10765 "show bgp view WORD ipv4 (unicast|multicast) summary {json}",
95cbbd2a
ML
10766 SHOW_STR
10767 BGP_STR
10768 "BGP view\n"
10769 "View name\n"
10770 "Address family\n"
10771 "Address Family modifier\n"
10772 "Address Family modifier\n"
10773 "Summary of BGP neighbor status\n")
10774
718e3744 10775DEFUN (show_ip_bgp_vpnv4_all_summary,
10776 show_ip_bgp_vpnv4_all_summary_cmd,
b05a1c8b 10777 "show ip bgp vpnv4 all summary {json}",
718e3744 10778 SHOW_STR
10779 IP_STR
10780 BGP_STR
10781 "Display VPNv4 NLRI specific information\n"
10782 "Display information about all VPNv4 NLRIs\n"
b05a1c8b
DS
10783 "Summary of BGP neighbor status\n"
10784 "JavaScript Object Notation\n")
718e3744 10785{
db7c8528
DS
10786 u_char uj = use_json(argc, argv);
10787 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj);
718e3744 10788}
10789
10790DEFUN (show_ip_bgp_vpnv4_rd_summary,
10791 show_ip_bgp_vpnv4_rd_summary_cmd,
b05a1c8b 10792 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary {json}",
718e3744 10793 SHOW_STR
10794 IP_STR
10795 BGP_STR
10796 "Display VPNv4 NLRI specific information\n"
10797 "Display information for a route distinguisher\n"
10798 "VPN Route Distinguisher\n"
b05a1c8b
DS
10799 "Summary of BGP neighbor status\n"
10800 "JavaScript Object Notation\n")
718e3744 10801{
10802 int ret;
10803 struct prefix_rd prd;
db7c8528 10804 u_char uj = use_json(argc, argv);
718e3744 10805
10806 ret = str2prefix_rd (argv[0], &prd);
10807 if (! ret)
10808 {
10809 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
10810 return CMD_WARNING;
10811 }
10812
db7c8528 10813 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj);
718e3744 10814}
10815
10816#ifdef HAVE_IPV6
47fc97cc 10817DEFUN (show_bgp_summary,
718e3744 10818 show_bgp_summary_cmd,
b05a1c8b 10819 "show bgp summary {json}",
718e3744 10820 SHOW_STR
10821 BGP_STR
b05a1c8b
DS
10822 "Summary of BGP neighbor status\n"
10823 "JavaScript Object Notation\n")
718e3744 10824{
db7c8528 10825 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json(argc, argv));
718e3744 10826}
10827
10828DEFUN (show_bgp_instance_summary,
10829 show_bgp_instance_summary_cmd,
8386ac43 10830 "show bgp " BGP_INSTANCE_CMD " summary {json}",
718e3744 10831 SHOW_STR
10832 BGP_STR
8386ac43 10833 BGP_INSTANCE_HELP_STR
b05a1c8b
DS
10834 "Summary of BGP neighbor status\n"
10835 "JavaScript Object Notation\n")
718e3744 10836{
6aeb9e78 10837 return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, use_json(argc, argv));
718e3744 10838}
10839
f186de26 10840DEFUN (show_bgp_instance_all_summary,
10841 show_bgp_instance_all_summary_cmd,
10842 "show bgp " BGP_INSTANCE_ALL_CMD " summary {json}",
10843 SHOW_STR
10844 BGP_STR
10845 BGP_INSTANCE_ALL_HELP_STR
10846 "Summary of BGP neighbor status\n"
10847 "JavaScript Object Notation\n")
10848{
10849 u_char uj = use_json(argc, argv);
10850
10851 bgp_show_all_instances_summary_vty (vty, AFI_IP6, SAFI_UNICAST, uj);
10852 return CMD_SUCCESS;
10853}
10854
718e3744 10855ALIAS (show_bgp_summary,
10856 show_bgp_ipv6_summary_cmd,
b05a1c8b 10857 "show bgp ipv6 summary {json}",
718e3744 10858 SHOW_STR
10859 BGP_STR
10860 "Address family\n"
10861 "Summary of BGP neighbor status\n")
10862
10863ALIAS (show_bgp_instance_summary,
10864 show_bgp_instance_ipv6_summary_cmd,
8386ac43 10865 "show bgp " BGP_INSTANCE_CMD " ipv6 summary {json}",
718e3744 10866 SHOW_STR
10867 BGP_STR
8386ac43 10868 BGP_INSTANCE_HELP_STR
718e3744 10869 "Address family\n"
10870 "Summary of BGP neighbor status\n")
10871
95cbbd2a
ML
10872DEFUN (show_bgp_ipv6_safi_summary,
10873 show_bgp_ipv6_safi_summary_cmd,
b05a1c8b 10874 "show bgp ipv6 (unicast|multicast) summary {json}",
95cbbd2a
ML
10875 SHOW_STR
10876 BGP_STR
10877 "Address family\n"
10878 "Address Family modifier\n"
10879 "Address Family modifier\n"
b05a1c8b
DS
10880 "Summary of BGP neighbor status\n"
10881 "JavaScript Object Notation\n")
95cbbd2a 10882{
db7c8528 10883 u_char uj = use_json(argc, argv);
95cbbd2a 10884 if (strncmp (argv[0], "m", 1) == 0)
db7c8528 10885 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj);
95cbbd2a 10886
db7c8528 10887 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj);
95cbbd2a
ML
10888}
10889
10890DEFUN (show_bgp_instance_ipv6_safi_summary,
10891 show_bgp_instance_ipv6_safi_summary_cmd,
8386ac43 10892 "show bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) summary {json}",
95cbbd2a
ML
10893 SHOW_STR
10894 BGP_STR
8386ac43 10895 BGP_INSTANCE_HELP_STR
95cbbd2a
ML
10896 "Address family\n"
10897 "Address Family modifier\n"
10898 "Address Family modifier\n"
b05a1c8b
DS
10899 "Summary of BGP neighbor status\n"
10900 "JavaScript Object Notation\n")
95cbbd2a 10901{
db7c8528 10902 u_char uj = use_json(argc, argv);
6aeb9e78
DS
10903 if (strncmp (argv[2], "m", 1) == 0)
10904 return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_MULTICAST, uj);
95cbbd2a 10905
6aeb9e78 10906 return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, uj);
95cbbd2a
ML
10907}
10908
718e3744 10909/* old command */
10910DEFUN (show_ipv6_bgp_summary,
10911 show_ipv6_bgp_summary_cmd,
b05a1c8b 10912 "show ipv6 bgp summary {json}",
718e3744 10913 SHOW_STR
10914 IPV6_STR
10915 BGP_STR
b05a1c8b
DS
10916 "Summary of BGP neighbor status\n"
10917 "JavaScript Object Notation\n")
718e3744 10918{
db7c8528
DS
10919 u_char uj = use_json(argc, argv);
10920 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj);
718e3744 10921}
10922
10923/* old command */
10924DEFUN (show_ipv6_mbgp_summary,
10925 show_ipv6_mbgp_summary_cmd,
b05a1c8b 10926 "show ipv6 mbgp summary {json}",
718e3744 10927 SHOW_STR
10928 IPV6_STR
10929 MBGP_STR
b05a1c8b
DS
10930 "Summary of BGP neighbor status\n"
10931 "JavaScript Object Notation\n")
718e3744 10932{
db7c8528
DS
10933 u_char uj = use_json(argc, argv);
10934 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj);
718e3744 10935}
10936#endif /* HAVE_IPV6 */
6b0655a2 10937
fd79ac91 10938const char *
538621f2 10939afi_safi_print (afi_t afi, safi_t safi)
10940{
10941 if (afi == AFI_IP && safi == SAFI_UNICAST)
10942 return "IPv4 Unicast";
10943 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
10944 return "IPv4 Multicast";
10945 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
945c8fe9 10946 return "VPN-IPv4 Unicast";
8b1fb8be
LB
10947 else if (afi == AFI_IP && safi == SAFI_ENCAP)
10948 return "ENCAP-IPv4 Unicast";
538621f2 10949 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
10950 return "IPv6 Unicast";
10951 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
10952 return "IPv6 Multicast";
945c8fe9
LB
10953 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
10954 return "VPN-IPv6 Unicast";
8b1fb8be
LB
10955 else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
10956 return "ENCAP-IPv6 Unicast";
538621f2 10957 else
10958 return "Unknown";
10959}
10960
718e3744 10961/* Show BGP peer's information. */
10962enum show_type
10963{
10964 show_all,
10965 show_peer
10966};
10967
94f2b392 10968static void
856ca177
MS
10969bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, afi_t afi, safi_t safi,
10970 u_int16_t adv_smcap, u_int16_t adv_rmcap, u_int16_t rcv_smcap,
10971 u_int16_t rcv_rmcap, u_char use_json, json_object *json_pref)
718e3744 10972{
10973 /* Send-Mode */
10974 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
10975 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
10976 {
856ca177
MS
10977 if (use_json)
10978 {
10979 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
10980 json_object_string_add(json_pref, "sendMode", "advertisedAndReceived");
10981 else if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
10982 json_object_string_add(json_pref, "sendMode", "advertised");
10983 else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
10984 json_object_string_add(json_pref, "sendMode", "received");
10985 }
10986 else
10987 {
10988 vty_out (vty, " Send-mode: ");
10989 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
10990 vty_out (vty, "advertised");
10991 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
10992 vty_out (vty, "%sreceived",
10993 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
10994 ", " : "");
10995 vty_out (vty, "%s", VTY_NEWLINE);
10996 }
718e3744 10997 }
10998
10999 /* Receive-Mode */
11000 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
11001 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
11002 {
856ca177
MS
11003 if (use_json)
11004 {
11005 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
11006 json_object_string_add(json_pref, "recvMode", "advertisedAndReceived");
11007 else if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
11008 json_object_string_add(json_pref, "recvMode", "advertised");
11009 else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
11010 json_object_string_add(json_pref, "recvMode", "received");
11011 }
11012 else
11013 {
11014 vty_out (vty, " Receive-mode: ");
11015 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
11016 vty_out (vty, "advertised");
11017 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
11018 vty_out (vty, "%sreceived",
11019 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
11020 ", " : "");
11021 vty_out (vty, "%s", VTY_NEWLINE);
11022 }
718e3744 11023 }
11024}
11025
94f2b392 11026static void
856ca177
MS
11027bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi,
11028 u_char use_json, json_object *json_neigh)
718e3744 11029{
11030 struct bgp_filter *filter;
3f9c7369 11031 struct peer_af *paf;
718e3744 11032 char orf_pfx_name[BUFSIZ];
11033 int orf_pfx_count;
856ca177
MS
11034 json_object *json_af = NULL;
11035 json_object *json_prefA = NULL;
11036 json_object *json_prefB = NULL;
11037 json_object *json_addr = NULL;
718e3744 11038
856ca177
MS
11039 if (use_json)
11040 {
11041 json_addr = json_object_new_object();
11042 json_af = json_object_new_object();
11043 json_prefA = json_object_new_object();
11044 json_prefB = json_object_new_object();
11045 filter = &p->filter[afi][safi];
718e3744 11046
c8560b44 11047 if (peer_group_active(p))
856ca177 11048 json_object_string_add(json_addr, "peerGroupMember", p->group->name);
538621f2 11049
856ca177
MS
11050 paf = peer_af_find(p, afi, safi);
11051 if (paf && PAF_SUBGRP(paf))
11052 {
11053 json_object_int_add(json_addr, "updateGroupId", PAF_UPDGRP(paf)->id);
11054 json_object_int_add(json_addr, "subGroupId", PAF_SUBGRP(paf)->id);
11055 json_object_int_add(json_addr, "packetQueueLength", bpacket_queue_virtual_length(paf));
11056 }
11057
11058 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
11059 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
11060 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
11061 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
11062 {
11063 json_object_int_add(json_af, "orfType", ORF_TYPE_PREFIX);
11064 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
11065 PEER_CAP_ORF_PREFIX_SM_ADV,
11066 PEER_CAP_ORF_PREFIX_RM_ADV,
11067 PEER_CAP_ORF_PREFIX_SM_RCV,
11068 PEER_CAP_ORF_PREFIX_RM_RCV, use_json, json_prefA);
11069 json_object_object_add(json_af, "orfPrefixList", json_prefA);
11070 }
11071
11072 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
11073 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
11074 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
11075 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
11076 {
11077 json_object_int_add(json_af, "orfOldType", ORF_TYPE_PREFIX_OLD);
11078 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
11079 PEER_CAP_ORF_PREFIX_SM_ADV,
11080 PEER_CAP_ORF_PREFIX_RM_ADV,
11081 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
11082 PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, json_prefB);
11083 json_object_object_add(json_af, "orfOldPrefixList", json_prefB);
11084 }
11085
11086 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
11087 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
11088 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
11089 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
11090 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
11091 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
11092 json_object_object_add(json_addr, "afDependentCap", json_af);
11093
11094 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
11095 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json);
11096
11097 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
11098 || orf_pfx_count)
11099 {
11100 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
11101 json_object_boolean_true_add(json_neigh, "orfSent");
11102 if (orf_pfx_count)
11103 json_object_int_add(json_addr, "orfRecvCounter", orf_pfx_count);
11104 }
11105 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
11106 json_object_string_add(json_addr, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd");
11107
11108 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
11109 json_object_boolean_true_add(json_addr, "routeReflectorClient");
11110 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
11111 json_object_boolean_true_add(json_addr, "routeServerClient");
11112 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
11113 json_object_boolean_true_add(json_addr, "inboundSoftConfigPermit");
11114
88b8ed8d
DW
11115 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE))
11116 json_object_boolean_true_add(json_addr, "privateAsNumsAllReplacedInUpdatesToNbr");
11117 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE))
856ca177 11118 json_object_boolean_true_add(json_addr, "privateAsNumsReplacedInUpdatesToNbr");
88b8ed8d
DW
11119 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL))
11120 json_object_boolean_true_add(json_addr, "privateAsNumsAllRemovedInUpdatesToNbr");
856ca177
MS
11121 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
11122 json_object_boolean_true_add(json_addr, "privateAsNumsRemovedInUpdatesToNbr");
11123
adbac85e
DW
11124 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS))
11125 json_object_boolean_true_add(json_addr, "addpathTxAllPaths");
11126
06370dac
DW
11127 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS))
11128 json_object_boolean_true_add(json_addr, "addpathTxBestpathPerAS");
11129
856ca177
MS
11130 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE))
11131 json_object_string_add(json_addr, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs");
11132
11133 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) ||
11134 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF))
11135 json_object_boolean_true_add(json_addr, "routerAlwaysNextHop");
11136 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
11137 json_object_boolean_true_add(json_addr, "unchangedAsPathPropogatedToNbr");
11138 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
11139 json_object_boolean_true_add(json_addr, "unchangedNextHopPropogatedToNbr");
11140 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
11141 json_object_boolean_true_add(json_addr, "unchangedMedPropogatedToNbr");
718e3744 11142 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
856ca177
MS
11143 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11144 {
11145 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
11146 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11147 json_object_string_add(json_addr, "commAttriSentToNbr", "extendedAndStandard");
11148 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11149 json_object_string_add(json_addr, "commAttriSentToNbr", "extended");
11150 else
11151 json_object_string_add(json_addr, "commAttriSentToNbr", "standard");
11152 }
11153 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
11154 {
11155 if (p->default_rmap[afi][safi].name)
11156 json_object_string_add(json_addr, "defaultRouteMap", p->default_rmap[afi][safi].name);
11157
11158 if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE))
11159 json_object_boolean_true_add(json_addr, "defaultSent");
11160 else
11161 json_object_boolean_true_add(json_addr, "defaultNotSent");
11162 }
11163
11164 if (filter->plist[FILTER_IN].name
11165 || filter->dlist[FILTER_IN].name
11166 || filter->aslist[FILTER_IN].name
11167 || filter->map[RMAP_IN].name)
11168 json_object_boolean_true_add(json_addr, "inboundPathPolicyConfig");
11169 if (filter->plist[FILTER_OUT].name
11170 || filter->dlist[FILTER_OUT].name
11171 || filter->aslist[FILTER_OUT].name
11172 || filter->map[RMAP_OUT].name
11173 || filter->usmap.name)
11174 json_object_boolean_true_add(json_addr, "outboundPathPolicyConfig");
856ca177
MS
11175
11176 /* prefix-list */
11177 if (filter->plist[FILTER_IN].name)
11178 json_object_string_add(json_addr, "incomingUpdatePrefixFilterList", filter->plist[FILTER_IN].name);
11179 if (filter->plist[FILTER_OUT].name)
11180 json_object_string_add(json_addr, "outgoingUpdatePrefixFilterList", filter->plist[FILTER_OUT].name);
11181
11182 /* distribute-list */
11183 if (filter->dlist[FILTER_IN].name)
11184 json_object_string_add(json_addr, "incomingUpdateNetworkFilterList", filter->dlist[FILTER_IN].name);
11185 if (filter->dlist[FILTER_OUT].name)
11186 json_object_string_add(json_addr, "outgoingUpdateNetworkFilterList", filter->dlist[FILTER_OUT].name);
11187
11188 /* filter-list. */
11189 if (filter->aslist[FILTER_IN].name)
11190 json_object_string_add(json_addr, "incomingUpdateAsPathFilterList", filter->aslist[FILTER_IN].name);
11191 if (filter->aslist[FILTER_OUT].name)
11192 json_object_string_add(json_addr, "outgoingUpdateAsPathFilterList", filter->aslist[FILTER_OUT].name);
11193
11194 /* route-map. */
11195 if (filter->map[RMAP_IN].name)
11196 json_object_string_add(json_addr, "routeMapForIncomingAdvertisements", filter->map[RMAP_IN].name);
11197 if (filter->map[RMAP_OUT].name)
11198 json_object_string_add(json_addr, "routeMapForOutgoingAdvertisements", filter->map[RMAP_OUT].name);
856ca177
MS
11199
11200 /* unsuppress-map */
11201 if (filter->usmap.name)
11202 json_object_string_add(json_addr, "selectiveUnsuppressRouteMap", filter->usmap.name);
11203
11204 /* Receive prefix count */
11205 json_object_int_add(json_addr, "acceptedPrefixCounter", p->pcount[afi][safi]);
11206
11207 /* Maximum prefix */
11208 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
11209 {
11210 json_object_int_add(json_addr, "prefixAllowedMax", p->pmax[afi][safi]);
11211 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING))
11212 json_object_boolean_true_add(json_addr, "prefixAllowedMaxWarning");
11213 json_object_int_add(json_addr, "prefixAllowedWarningThresh", p->pmax_threshold[afi][safi]);
11214 if (p->pmax_restart[afi][safi])
11215 json_object_int_add(json_addr, "prefixAllowedRestartIntervalMsecs", p->pmax_restart[afi][safi] * 60000);
11216 }
11217 json_object_object_add(json_neigh, afi_safi_print (afi, safi), json_addr);
11218
11219 }
11220 else
11221 {
11222 filter = &p->filter[afi][safi];
11223
11224 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
11225 VTY_NEWLINE);
11226
c8560b44 11227 if (peer_group_active(p))
856ca177
MS
11228 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
11229
11230 paf = peer_af_find(p, afi, safi);
11231 if (paf && PAF_SUBGRP(paf))
11232 {
11233 vty_out (vty, " Update group %" PRIu64 ", subgroup %" PRIu64 "%s",
11234 PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE);
11235 vty_out (vty, " Packet Queue length %d%s",
11236 bpacket_queue_virtual_length(paf), VTY_NEWLINE);
11237 }
718e3744 11238 else
856ca177
MS
11239 {
11240 vty_out(vty, " Not part of any update group%s", VTY_NEWLINE);
11241 }
11242 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
11243 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
11244 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
11245 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
11246 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
11247 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
11248 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
11249
11250 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
11251 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
11252 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
11253 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
11254 {
11255 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
11256 ORF_TYPE_PREFIX, VTY_NEWLINE);
11257 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
11258 PEER_CAP_ORF_PREFIX_SM_ADV,
11259 PEER_CAP_ORF_PREFIX_RM_ADV,
11260 PEER_CAP_ORF_PREFIX_SM_RCV,
11261 PEER_CAP_ORF_PREFIX_RM_RCV, use_json, NULL);
11262 }
11263 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
11264 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
11265 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
11266 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
11267 {
11268 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
11269 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
11270 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
11271 PEER_CAP_ORF_PREFIX_SM_ADV,
11272 PEER_CAP_ORF_PREFIX_RM_ADV,
11273 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
11274 PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, NULL);
11275 }
718e3744 11276
856ca177
MS
11277 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
11278 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json);
718e3744 11279
856ca177
MS
11280 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
11281 || orf_pfx_count)
11282 {
11283 vty_out (vty, " Outbound Route Filter (ORF):");
11284 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
11285 vty_out (vty, " sent;");
11286 if (orf_pfx_count)
11287 vty_out (vty, " received (%d entries)", orf_pfx_count);
11288 vty_out (vty, "%s", VTY_NEWLINE);
11289 }
11290 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
11291 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
11292
11293 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
11294 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
11295 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
11296 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
11297 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
11298 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
11299
88b8ed8d
DW
11300 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE))
11301 vty_out (vty, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE);
11302 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE))
856ca177 11303 vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE);
88b8ed8d
DW
11304 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL))
11305 vty_out (vty, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE);
856ca177
MS
11306 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
11307 vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE);
11308
adbac85e
DW
11309 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS))
11310 vty_out (vty, " Advertise all paths via addpath%s", VTY_NEWLINE);
11311
06370dac
DW
11312 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS))
11313 vty_out (vty, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE);
11314
856ca177
MS
11315 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE))
11316 vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE);
11317
11318 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) ||
11319 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF))
11320 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
11321 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
11322 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
11323 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
11324 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
11325 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
11326 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
11327 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
11328 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11329 {
11330 vty_out (vty, " Community attribute sent to this neighbor");
11331 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
11332 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11333 vty_out (vty, "(both)%s", VTY_NEWLINE);
11334 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
11335 vty_out (vty, "(extended)%s", VTY_NEWLINE);
11336 else
11337 vty_out (vty, "(standard)%s", VTY_NEWLINE);
11338 }
11339 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
11340 {
11341 vty_out (vty, " Default information originate,");
11342
11343 if (p->default_rmap[afi][safi].name)
11344 vty_out (vty, " default route-map %s%s,",
11345 p->default_rmap[afi][safi].map ? "*" : "",
11346 p->default_rmap[afi][safi].name);
11347 if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE))
11348 vty_out (vty, " default sent%s", VTY_NEWLINE);
11349 else
11350 vty_out (vty, " default not sent%s", VTY_NEWLINE);
11351 }
718e3744 11352
856ca177
MS
11353 if (filter->plist[FILTER_IN].name
11354 || filter->dlist[FILTER_IN].name
11355 || filter->aslist[FILTER_IN].name
11356 || filter->map[RMAP_IN].name)
11357 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
11358 if (filter->plist[FILTER_OUT].name
11359 || filter->dlist[FILTER_OUT].name
11360 || filter->aslist[FILTER_OUT].name
11361 || filter->map[RMAP_OUT].name
11362 || filter->usmap.name)
11363 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
856ca177
MS
11364
11365 /* prefix-list */
11366 if (filter->plist[FILTER_IN].name)
11367 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
11368 filter->plist[FILTER_IN].plist ? "*" : "",
11369 filter->plist[FILTER_IN].name,
11370 VTY_NEWLINE);
11371 if (filter->plist[FILTER_OUT].name)
11372 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
11373 filter->plist[FILTER_OUT].plist ? "*" : "",
11374 filter->plist[FILTER_OUT].name,
11375 VTY_NEWLINE);
11376
11377 /* distribute-list */
11378 if (filter->dlist[FILTER_IN].name)
11379 vty_out (vty, " Incoming update network filter list is %s%s%s",
11380 filter->dlist[FILTER_IN].alist ? "*" : "",
11381 filter->dlist[FILTER_IN].name,
11382 VTY_NEWLINE);
11383 if (filter->dlist[FILTER_OUT].name)
11384 vty_out (vty, " Outgoing update network filter list is %s%s%s",
11385 filter->dlist[FILTER_OUT].alist ? "*" : "",
11386 filter->dlist[FILTER_OUT].name,
11387 VTY_NEWLINE);
11388
11389 /* filter-list. */
11390 if (filter->aslist[FILTER_IN].name)
11391 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
11392 filter->aslist[FILTER_IN].aslist ? "*" : "",
11393 filter->aslist[FILTER_IN].name,
11394 VTY_NEWLINE);
11395 if (filter->aslist[FILTER_OUT].name)
11396 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
11397 filter->aslist[FILTER_OUT].aslist ? "*" : "",
11398 filter->aslist[FILTER_OUT].name,
11399 VTY_NEWLINE);
11400
11401 /* route-map. */
11402 if (filter->map[RMAP_IN].name)
11403 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
11404 filter->map[RMAP_IN].map ? "*" : "",
11405 filter->map[RMAP_IN].name,
11406 VTY_NEWLINE);
11407 if (filter->map[RMAP_OUT].name)
11408 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
11409 filter->map[RMAP_OUT].map ? "*" : "",
11410 filter->map[RMAP_OUT].name,
11411 VTY_NEWLINE);
856ca177
MS
11412
11413 /* unsuppress-map */
11414 if (filter->usmap.name)
11415 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
11416 filter->usmap.map ? "*" : "",
11417 filter->usmap.name, VTY_NEWLINE);
11418
11419 /* Receive prefix count */
11420 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
11421
11422 /* Maximum prefix */
11423 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
11424 {
11425 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
11426 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
11427 ? " (warning-only)" : "", VTY_NEWLINE);
11428 vty_out (vty, " Threshold for warning message %d%%",
11429 p->pmax_threshold[afi][safi]);
11430 if (p->pmax_restart[afi][safi])
11431 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
11432 vty_out (vty, "%s", VTY_NEWLINE);
11433 }
718e3744 11434
0a486e5f 11435 vty_out (vty, "%s", VTY_NEWLINE);
718e3744 11436 }
718e3744 11437}
11438
94f2b392 11439static void
e8f7da3a 11440bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *json)
718e3744 11441{
11442 struct bgp *bgp;
4690c7d7 11443 char buf1[PREFIX2STR_BUFFER], buf[SU_ADDRSTRLEN];
718e3744 11444 char timebuf[BGP_UPTIME_LEN];
f14e6fdb 11445 char dn_flag[2];
3a8c7ba1
DW
11446 const char *subcode_str;
11447 const char *code_str;
538621f2 11448 afi_t afi;
11449 safi_t safi;
d6661008
DS
11450 u_int16_t i;
11451 u_char *msg;
e8f7da3a 11452 json_object *json_neigh = NULL;
718e3744 11453
11454 bgp = p->bgp;
11455
e8f7da3a
DW
11456 if (use_json)
11457 json_neigh = json_object_new_object();
11458
856ca177 11459 if (!use_json)
f14e6fdb 11460 {
856ca177
MS
11461 if (p->conf_if) /* Configured interface name. */
11462 vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if,
11463 BGP_PEER_SU_UNSPEC(p) ? "None" :
11464 sockunion2str (&p->su, buf, SU_ADDRSTRLEN));
11465 else /* Configured IP address. */
11466 {
11467 memset(dn_flag, '\0', sizeof(dn_flag));
11468 if (peer_dynamic_neighbor(p))
11469 dn_flag[0] = '*';
f14e6fdb 11470
856ca177
MS
11471 vty_out (vty, "BGP neighbor is %s%s, ", dn_flag, p->host);
11472 }
f14e6fdb
DS
11473 }
11474
856ca177
MS
11475 if (use_json)
11476 {
11477 if (p->conf_if && BGP_PEER_SU_UNSPEC(p))
11478 json_object_string_add(json_neigh, "bgpNeighborAddr", "none");
11479 else if (p->conf_if && !BGP_PEER_SU_UNSPEC(p))
11480 json_object_string_add(json_neigh, "bgpNeighborAddr", sockunion2str (&p->su, buf, SU_ADDRSTRLEN));
11481
11482 json_object_int_add(json_neigh, "remoteAs", p->as);
11483
11484 if (p->change_local_as)
11485 json_object_int_add(json_neigh, "localAs", p->change_local_as);
11486 else
11487 json_object_int_add(json_neigh, "localAs", p->local_as);
11488
11489 if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND))
11490 json_object_boolean_true_add(json_neigh, "localAsNoPrepend");
66b199b2 11491
856ca177
MS
11492 if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS))
11493 json_object_boolean_true_add(json_neigh, "localAsReplaceAs");
11494 }
11495 else
11496 {
f8cfafda
DS
11497 if ((p->as_type == AS_SPECIFIED) ||
11498 (p->as_type == AS_EXTERNAL) ||
11499 (p->as_type == AS_INTERNAL))
11500 vty_out (vty, "remote AS %u, ", p->as);
11501 else
11502 vty_out (vty, "remote AS Unspecified, ");
856ca177
MS
11503 vty_out (vty, "local AS %u%s%s, ",
11504 p->change_local_as ? p->change_local_as : p->local_as,
11505 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
11506 " no-prepend" : "",
11507 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
11508 " replace-as" : "");
11509 }
66b199b2
DS
11510 /* peer type internal, external, confed-internal or confed-external */
11511 if (p->as == p->local_as)
11512 {
856ca177
MS
11513 if (use_json)
11514 {
11515 if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION))
11516 json_object_boolean_true_add(json_neigh, "nbrConfedInternalLink");
11517 else
11518 json_object_boolean_true_add(json_neigh, "nbrInternalLink");
11519 }
66b199b2 11520 else
856ca177
MS
11521 {
11522 if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION))
11523 vty_out (vty, "confed-internal link%s", VTY_NEWLINE);
11524 else
11525 vty_out (vty, "internal link%s", VTY_NEWLINE);
11526 }
66b199b2
DS
11527 }
11528 else
11529 {
856ca177
MS
11530 if (use_json)
11531 {
11532 if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION))
11533 json_object_boolean_true_add(json_neigh, "nbrConfedExternalLink");
11534 else
11535 json_object_boolean_true_add(json_neigh, "nbrExternalLink");
11536 }
66b199b2 11537 else
856ca177
MS
11538 {
11539 if (bgp_confederation_peers_check(bgp, p->as))
11540 vty_out (vty, "confed-external link%s", VTY_NEWLINE);
11541 else
11542 vty_out (vty, "external link%s", VTY_NEWLINE);
11543 }
66b199b2 11544 }
718e3744 11545
11546 /* Description. */
11547 if (p->desc)
856ca177
MS
11548 {
11549 if (use_json)
11550 json_object_string_add(json_neigh, "nbrDesc", p->desc);
11551 else
11552 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
11553 }
6410e93a 11554
04b6bdc0
DW
11555 if (p->hostname)
11556 {
d1570739
DW
11557 if (use_json)
11558 {
11559 if (p->hostname)
11560 json_object_string_add(json_neigh, "hostname", p->hostname);
11561
11562 if (p->domainname)
11563 json_object_string_add(json_neigh, "domainname", p->domainname);
11564 }
04b6bdc0 11565 else
d1570739
DW
11566 {
11567 if (p->domainname && (p->domainname[0] != '\0'))
11568 vty_out(vty, "Hostname: %s.%s%s", p->hostname, p->domainname,
11569 VTY_NEWLINE);
11570 else
11571 vty_out(vty, "Hostname: %s%s", p->hostname, VTY_NEWLINE);
11572 }
11573
04b6bdc0
DW
11574 }
11575
c744aa9f 11576 /* Peer-group */
718e3744 11577 if (p->group)
f14e6fdb 11578 {
856ca177
MS
11579 if (use_json)
11580 {
11581 json_object_string_add(json_neigh, "peerGroup", p->group->name);
11582
11583 if (dn_flag[0])
11584 {
40ee54a7 11585 struct prefix prefix, *range = NULL;
f14e6fdb 11586
40ee54a7
TT
11587 sockunion2hostprefix(&(p->su), &prefix);
11588 range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix);
856ca177
MS
11589
11590 if (range)
11591 {
11592 prefix2str(range, buf1, sizeof(buf1));
11593 json_object_string_add(json_neigh, "peerSubnetRangeGroup", buf1);
11594 }
11595 }
11596 }
11597 else
f14e6fdb 11598 {
856ca177
MS
11599 vty_out (vty, " Member of peer-group %s for session parameters%s",
11600 p->group->name, VTY_NEWLINE);
f14e6fdb 11601
856ca177 11602 if (dn_flag[0])
f14e6fdb 11603 {
40ee54a7 11604 struct prefix prefix, *range = NULL;
856ca177 11605
40ee54a7
TT
11606 sockunion2hostprefix(&(p->su), &prefix);
11607 range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix);
856ca177
MS
11608
11609 if (range)
11610 {
11611 prefix2str(range, buf1, sizeof(buf1));
11612 vty_out (vty, " Belongs to the subnet range group: %s%s", buf1, VTY_NEWLINE);
11613 }
f14e6fdb
DS
11614 }
11615 }
11616 }
718e3744 11617
856ca177
MS
11618 if (use_json)
11619 {
11620 /* Administrative shutdown. */
11621 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
11622 json_object_boolean_true_add(json_neigh, "adminShutDown");
718e3744 11623
856ca177
MS
11624 /* BGP Version. */
11625 json_object_int_add(json_neigh, "bgpVersion", 4);
11626 json_object_string_add(json_neigh, "remoteRouterId", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ));
718e3744 11627
856ca177
MS
11628 /* Confederation */
11629 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) && bgp_confederation_peers_check (bgp, p->as))
11630 json_object_boolean_true_add(json_neigh, "nbrCommonAdmin");
11631
11632 /* Status. */
11633 json_object_string_add(json_neigh, "bgpState", LOOKUP (bgp_status_msg, p->status));
11634
11635 if (p->status == Established)
11636 {
11637 time_t uptime;
11638 struct tm *tm;
11639
11640 uptime = bgp_clock();
11641 uptime -= p->uptime;
11642 tm = gmtime(&uptime);
11643
11644 json_object_int_add(json_neigh, "bgpTimerUp", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000));
11645 }
11646
11647 else if (p->status == Active)
11648 {
11649 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
11650 json_object_string_add(json_neigh, "bgpStateIs", "passive");
11651 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
11652 json_object_string_add(json_neigh, "bgpStateIs", "passiveNSF");
11653 }
11654
11655 /* read timer */
11656 time_t uptime;
11657 struct tm *tm;
11658
11659 uptime = bgp_clock();
11660 uptime -= p->readtime;
11661 tm = gmtime(&uptime);
11662 json_object_int_add(json_neigh, "bgpTimerLastRead", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000));
11663
11664 uptime = bgp_clock();
11665 uptime -= p->last_write;
11666 tm = gmtime(&uptime);
39e871e6
ST
11667 json_object_int_add(json_neigh, "bgpTimerLastWrite", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000));
11668
11669 uptime = bgp_clock();
11670 uptime -= p->update_time;
11671 tm = gmtime(&uptime);
11672 json_object_int_add(json_neigh, "bgpInUpdateElapsedTimeMsecs",
11673 (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000));
856ca177
MS
11674
11675 /* Configured timer values. */
11676 json_object_int_add(json_neigh, "bgpTimerHoldTimeMsecs", p->v_holdtime * 1000);
11677 json_object_int_add(json_neigh, "bgpTimerKeepAliveIntervalMsecs", p->v_keepalive * 1000);
11678
11679 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
11680 {
11681 json_object_int_add(json_neigh, "bgpTimerConfiguredHoldTimeMsecs", p->holdtime * 1000);
11682 json_object_int_add(json_neigh, "bgpTimerConfiguredKeepAliveIntervalMsecs", p->keepalive * 1000);
11683 }
93406d87 11684 }
856ca177
MS
11685 else
11686 {
11687 /* Administrative shutdown. */
11688 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
11689 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
11690
11691 /* BGP Version. */
11692 vty_out (vty, " BGP version 4");
11693 vty_out (vty, ", remote router ID %s%s", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
11694 VTY_NEWLINE);
11695
11696 /* Confederation */
11697 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
11698 && bgp_confederation_peers_check (bgp, p->as))
11699 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
718e3744 11700
856ca177
MS
11701 /* Status. */
11702 vty_out (vty, " BGP state = %s", LOOKUP (bgp_status_msg, p->status));
718e3744 11703
856ca177
MS
11704 if (p->status == Established)
11705 vty_out (vty, ", up for %8s", peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL));
11706
11707 else if (p->status == Active)
11708 {
11709 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
11710 vty_out (vty, " (passive)");
11711 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
11712 vty_out (vty, " (NSF passive)");
11713 }
11714 vty_out (vty, "%s", VTY_NEWLINE);
93406d87 11715
856ca177
MS
11716 /* read timer */
11717 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN, 0, NULL));
11718 vty_out (vty, ", Last write %s%s",
11719 peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN, 0, NULL), VTY_NEWLINE);
11720
11721 /* Configured timer values. */
11722 vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s",
11723 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
11724 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
11725 {
11726 vty_out (vty, " Configured hold time is %d", p->holdtime);
11727 vty_out (vty, ", keepalive interval is %d seconds%s",
11728 p->keepalive, VTY_NEWLINE);
11729 }
11730 }
718e3744 11731 /* Capability. */
11732 if (p->status == Established)
11733 {
538621f2 11734 if (p->cap
718e3744 11735 || p->afc_adv[AFI_IP][SAFI_UNICAST]
11736 || p->afc_recv[AFI_IP][SAFI_UNICAST]
11737 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
11738 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
11739#ifdef HAVE_IPV6
11740 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
11741 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
11742 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
11743 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
945c8fe9
LB
11744 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
11745 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
8b1fb8be
LB
11746 || p->afc_adv[AFI_IP6][SAFI_ENCAP]
11747 || p->afc_recv[AFI_IP6][SAFI_ENCAP]
718e3744 11748#endif /* HAVE_IPV6 */
8b1fb8be
LB
11749 || p->afc_adv[AFI_IP][SAFI_ENCAP]
11750 || p->afc_recv[AFI_IP][SAFI_ENCAP]
718e3744 11751 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
11752 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
11753 {
856ca177
MS
11754 if (use_json)
11755 {
11756 json_object *json_cap = NULL;
11757
11758 json_cap = json_object_new_object();
11759
11760 /* AS4 */
11761 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
11762 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
11763 {
11764 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) && CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
11765 json_object_string_add(json_cap, "4byteAs", "advertisedAndReceived");
11766 else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
11767 json_object_string_add(json_cap, "4byteAs", "advertised");
11768 else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
11769 json_object_string_add(json_cap, "4byteAs", "received");
11770 }
11771
11772 /* AddPath */
11773 if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV)
11774 || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV))
11775 {
11776 json_object *json_add = NULL;
11777 const char *print_store;
718e3744 11778
856ca177 11779 json_add = json_object_new_object();
a82478b9 11780
856ca177
MS
11781 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
11782 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
11783 {
11784 json_object *json_sub = NULL;
11785 json_sub = json_object_new_object();
11786 print_store = afi_safi_print (afi, safi);
11787
11788 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ||
11789 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV))
11790 {
11791 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))
11792 json_object_boolean_true_add(json_sub, "txAdvertisedAndReceived");
11793 else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV))
11794 json_object_boolean_true_add(json_sub, "txAdvertised");
11795 else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV))
11796 json_object_boolean_true_add(json_sub, "txReceived");
11797 }
11798
11799 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ||
11800 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
11801 {
11802 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))
11803 json_object_boolean_true_add(json_sub, "rxAdvertisedAndReceived");
11804 else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV))
11805 json_object_boolean_true_add(json_sub, "rxAdvertised");
11806 else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
11807 json_object_boolean_true_add(json_sub, "rxReceived");
11808 }
11809
11810 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ||
11811 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV) ||
11812 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ||
11813 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
11814 json_object_object_add(json_add, print_store, json_sub);
11815 }
a82478b9 11816
856ca177
MS
11817 json_object_object_add(json_cap, "addPath", json_add);
11818 }
11819
11820 /* Dynamic */
11821 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
11822 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
11823 {
11824 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) && CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
11825 json_object_string_add(json_cap, "dynamic", "advertisedAndReceived");
11826 else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
11827 json_object_string_add(json_cap, "dynamic", "advertised");
11828 else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
11829 json_object_string_add(json_cap, "dynamic", "received");
11830 }
11831
11832 /* Extended nexthop */
11833 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)
11834 || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV))
11835 {
11836 json_object *json_nxt = NULL;
11837 const char *print_store;
11838
11839 json_nxt = json_object_new_object();
11840
11841 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) && CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
11842 json_object_string_add(json_cap, "extendedNexthop", "advertisedAndReceived");
11843 else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV))
11844 json_object_string_add(json_cap, "extendedNexthop", "advertised");
11845 else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
11846 json_object_string_add(json_cap, "extendedNexthop", "received");
11847
11848 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
11849 {
11850 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
11851 {
11852 if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV))
11853 {
11854 print_store = afi_safi_print (AFI_IP, safi);
11855 json_object_string_add(json_nxt, print_store, "recieved");
11856 }
11857 }
11858 json_object_object_add(json_cap, "extendedNexthopFamililesByPeer", json_nxt);
11859 }
11860 }
11861
11862 /* Route Refresh */
11863 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
11864 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
11865 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
11866 {
11867 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)))
11868 {
11869 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV))
11870 json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOldNew");
11871 else
11872 {
11873 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
11874 json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOld");
11875 else
11876 json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedNew");
11877 }
11878 }
11879 else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
11880 json_object_string_add(json_cap, "routeRefresh", "advertised");
11881 else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
11882 json_object_string_add(json_cap, "routeRefresh", "received");
11883 }
11884
11885 /* Multiprotocol Extensions */
11886 json_object *json_multi = NULL;
11887 json_multi = json_object_new_object();
11888
11889 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
11890 {
11891 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
11892 {
11893 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
11894 {
11895 json_object *json_exten = NULL;
11896 json_exten = json_object_new_object();
11897
11898 if (p->afc_adv[afi][safi] && p->afc_recv[afi][safi])
11899 json_object_boolean_true_add(json_exten, "advertisedAndReceived");
11900 else if (p->afc_adv[afi][safi])
11901 json_object_boolean_true_add(json_exten, "advertised");
11902 else if (p->afc_recv[afi][safi])
11903 json_object_boolean_true_add(json_exten, "received");
11904
11905 json_object_object_add(json_multi, afi_safi_print (afi, safi), json_exten);
11906 }
11907 }
11908 }
11909 json_object_object_add(json_cap, "multiprotocolExtensions", json_multi);
11910
11911 /* Gracefull Restart */
11912 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
11913 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
11914 {
11915 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) && CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
11916 json_object_string_add(json_cap, "gracefulRestart", "advertisedAndReceived");
11917 else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
11918 json_object_string_add(json_cap, "gracefulRestartCapability", "advertised");
11919 else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
11920 json_object_string_add(json_cap, "gracefulRestartCapability", "received");
11921
11922 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
11923 {
11924 int restart_af_count = 0;
11925 json_object *json_restart = NULL;
11926 json_restart = json_object_new_object();
11927
11928 json_object_int_add(json_cap, "gracefulRestartRemoteTimerMsecs", p->v_gr_restart * 1000);
11929
11930 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
11931 {
11932 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
11933 {
11934 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
11935 {
11936 json_object *json_sub = NULL;
11937 json_sub = json_object_new_object();
11938
11939 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV))
11940 json_object_boolean_true_add(json_sub, "preserved");
11941 restart_af_count++;
11942 json_object_object_add(json_restart, afi_safi_print (afi, safi), json_sub);
11943 }
11944 }
11945 }
11946 if (! restart_af_count)
11947 json_object_string_add(json_cap, "addressFamiliesByPeer", "none");
11948 else
11949 json_object_object_add(json_cap, "addressFamiliesByPeer", json_restart);
11950 }
11951 }
11952 json_object_object_add(json_neigh, "neighborCapabilities", json_cap);
11953 }
11954 else
11955 {
11956 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
11957
11958 /* AS4 */
11959 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
11960 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
11961 {
11962 vty_out (vty, " 4 Byte AS:");
11963 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
11964 vty_out (vty, " advertised");
11965 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
11966 vty_out (vty, " %sreceived",
11967 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
11968 vty_out (vty, "%s", VTY_NEWLINE);
11969 }
11970
11971 /* AddPath */
11972 if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV)
11973 || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV))
11974 {
11975 vty_out (vty, " AddPath:%s", VTY_NEWLINE);
a82478b9 11976
856ca177
MS
11977 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
11978 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
a82478b9 11979 {
856ca177
MS
11980 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ||
11981 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV))
11982 {
11983 vty_out (vty, " %s: TX ", afi_safi_print (afi, safi));
a82478b9 11984
856ca177
MS
11985 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV))
11986 vty_out (vty, "advertised %s", afi_safi_print (afi, safi));
a82478b9 11987
856ca177
MS
11988 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV))
11989 vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" );
a82478b9 11990
856ca177
MS
11991 vty_out (vty, "%s", VTY_NEWLINE);
11992 }
a82478b9 11993
856ca177 11994 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ||
a82478b9 11995 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
856ca177
MS
11996 {
11997 vty_out (vty, " %s: RX ", afi_safi_print (afi, safi));
a82478b9 11998
856ca177
MS
11999 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV))
12000 vty_out (vty, "advertised %s", afi_safi_print (afi, safi));
a82478b9 12001
856ca177
MS
12002 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV))
12003 vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" );
a82478b9 12004
856ca177
MS
12005 vty_out (vty, "%s", VTY_NEWLINE);
12006 }
a82478b9 12007 }
856ca177 12008 }
a82478b9 12009
856ca177
MS
12010 /* Dynamic */
12011 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
12012 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
12013 {
12014 vty_out (vty, " Dynamic:");
12015 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
12016 vty_out (vty, " advertised");
12017 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
12018 vty_out (vty, " %sreceived",
12019 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
12020 vty_out (vty, "%s", VTY_NEWLINE);
12021 }
12022
12023 /* Extended nexthop */
12024 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)
12025 || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV))
12026 {
12027 vty_out (vty, " Extended nexthop:");
12028 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV))
12029 vty_out (vty, " advertised");
12030 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
12031 vty_out (vty, " %sreceived",
12032 CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) ? "and " : "");
12033 vty_out (vty, "%s", VTY_NEWLINE);
718e3744 12034
856ca177
MS
12035 if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV))
12036 {
12037 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
12038 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12039 if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV))
12040 vty_out (vty, " %s%s",
12041 afi_safi_print (AFI_IP, safi), VTY_NEWLINE);
12042 }
12043 }
8a92a8a0 12044
856ca177
MS
12045 /* Route Refresh */
12046 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
12047 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
12048 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
12049 {
12050 vty_out (vty, " Route refresh:");
12051 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
12052 vty_out (vty, " advertised");
12053 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
12054 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
12055 vty_out (vty, " %sreceived(%s)",
12056 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
12057 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
12058 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
12059 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
8a92a8a0 12060
856ca177
MS
12061 vty_out (vty, "%s", VTY_NEWLINE);
12062 }
718e3744 12063
856ca177
MS
12064 /* Multiprotocol Extensions */
12065 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12066 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12067 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
12068 {
12069 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
12070 if (p->afc_adv[afi][safi])
12071 vty_out (vty, " advertised");
12072 if (p->afc_recv[afi][safi])
12073 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
12074 vty_out (vty, "%s", VTY_NEWLINE);
12075 }
538621f2 12076
04b6bdc0
DW
12077 /* Hostname capability */
12078 if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV) ||
12079 CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV))
12080 {
12081 vty_out (vty, " Hostname Capability:");
12082 if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV))
12083 vty_out (vty, " advertised");
12084 if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_RCV))
12085 vty_out (vty, " %sreceived",
12086 CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV) ? "and " : "");
12087 vty_out (vty, "%s", VTY_NEWLINE);
12088 }
12089
856ca177
MS
12090 /* Gracefull Restart */
12091 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
12092 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
12093 {
12094 vty_out (vty, " Graceful Restart Capabilty:");
12095 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
538621f2 12096 vty_out (vty, " advertised");
856ca177
MS
12097 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
12098 vty_out (vty, " %sreceived",
12099 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
12100 vty_out (vty, "%s", VTY_NEWLINE);
538621f2 12101
856ca177
MS
12102 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
12103 {
12104 int restart_af_count = 0;
12105
12106 vty_out (vty, " Remote Restart timer is %d seconds%s",
12107 p->v_gr_restart, VTY_NEWLINE);
12108 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
12109
12110 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12111 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12112 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
12113 {
12114 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
12115 afi_safi_print (afi, safi),
12116 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
12117 "preserved" : "not preserved");
12118 restart_af_count++;
12119 }
12120 if (! restart_af_count)
12121 vty_out (vty, "none");
12122 vty_out (vty, "%s", VTY_NEWLINE);
12123 }
12124 }
12125 }
718e3744 12126 }
12127 }
12128
93406d87 12129 /* graceful restart information */
12130 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
12131 || p->t_gr_restart
12132 || p->t_gr_stale)
12133 {
856ca177
MS
12134 json_object *json_grace = NULL;
12135 json_object *json_grace_send = NULL;
12136 json_object *json_grace_recv = NULL;
93406d87 12137 int eor_send_af_count = 0;
12138 int eor_receive_af_count = 0;
12139
856ca177
MS
12140 if (use_json)
12141 {
12142 json_grace = json_object_new_object();
12143 json_grace_send = json_object_new_object();
12144 json_grace_recv = json_object_new_object();
12145
12146 if (p->status == Established)
12147 {
12148 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12149 {
12150 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12151 {
12152 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
12153 {
12154 json_object_boolean_true_add(json_grace_send, afi_safi_print (afi, safi));
12155 eor_send_af_count++;
12156 }
12157 }
12158 }
12159 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12160 {
12161 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12162 {
12163 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
12164 {
12165 json_object_boolean_true_add(json_grace_recv, afi_safi_print (afi, safi));
12166 eor_receive_af_count++;
12167 }
12168 }
12169 }
12170 }
12171
12172 json_object_object_add(json_grace, "endOfRibSend", json_grace_send);
12173 json_object_object_add(json_grace, "endOfRibRecv", json_grace_recv);
12174
12175 if (p->t_gr_restart)
12176 json_object_int_add(json_grace, "gracefulRestartTimerMsecs", thread_timer_remain_second (p->t_gr_restart) * 1000);
12177
12178 if (p->t_gr_stale)
12179 json_object_int_add(json_grace, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p->t_gr_stale) * 1000);
12180
12181 json_object_object_add(json_neigh, "gracefulRestartInfo", json_grace);
12182 }
12183 else
12184 {
12185 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
12186 if (p->status == Established)
12187 {
12188 vty_out (vty, " End-of-RIB send: ");
12189 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12190 {
12191 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12192 {
12193 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
12194 {
12195 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
12196 afi_safi_print (afi, safi));
12197 eor_send_af_count++;
12198 }
12199 }
12200 }
12201 vty_out (vty, "%s", VTY_NEWLINE);
12202 vty_out (vty, " End-of-RIB received: ");
12203 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12204 {
12205 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12206 {
12207 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
12208 {
12209 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
12210 afi_safi_print (afi, safi));
12211 eor_receive_af_count++;
12212 }
12213 }
12214 }
12215 vty_out (vty, "%s", VTY_NEWLINE);
12216 }
93406d87 12217
856ca177
MS
12218 if (p->t_gr_restart)
12219 vty_out (vty, " The remaining time of restart timer is %ld%s",
12220 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
0b2aa3a0 12221
856ca177
MS
12222 if (p->t_gr_stale)
12223 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
12224 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
12225 }
12226 }
12227 if (use_json)
12228 {
12229 json_object *json_stat = NULL;
12230 json_stat = json_object_new_object();
12231 /* Packet counts. */
12232 json_object_int_add(json_stat, "depthInq", 0);
12233 json_object_int_add(json_stat, "depthOutq", (unsigned long) p->obuf->count);
12234 json_object_int_add(json_stat, "opensSent", p->open_out);
12235 json_object_int_add(json_stat, "opensRecv", p->open_in);
12236 json_object_int_add(json_stat, "notificationsSent", p->notify_out);
12237 json_object_int_add(json_stat, "notificationsRecv", p->notify_in);
12238 json_object_int_add(json_stat, "updatesSent", p->update_out);
12239 json_object_int_add(json_stat, "updatesRecv", p->update_in);
12240 json_object_int_add(json_stat, "keepalivesSent", p->keepalive_out);
12241 json_object_int_add(json_stat, "keepalivesRecv", p->keepalive_in);
12242 json_object_int_add(json_stat, "routeRefreshSent", p->refresh_out);
12243 json_object_int_add(json_stat, "routeRefreshRecv", p->refresh_in);
12244 json_object_int_add(json_stat, "capabilitySent", p->dynamic_cap_out);
12245 json_object_int_add(json_stat, "capabilityRecv", p->dynamic_cap_in);
12246 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);
12247 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);
12248 json_object_object_add(json_neigh, "messageStats", json_stat);
12249 }
12250 else
12251 {
12252 /* Packet counts. */
12253 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
12254 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
12255 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
12256 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
12257 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
12258 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
12259 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
12260 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
12261 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
12262 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
12263 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
12264 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
12265 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
12266 p->dynamic_cap_in, VTY_NEWLINE);
718e3744 12267 }
12268
856ca177
MS
12269 if (use_json)
12270 {
12271 /* advertisement-interval */
12272 json_object_int_add(json_neigh, "minBtwnAdvertisementRunsTimerMsecs", p->v_routeadv * 1000);
718e3744 12273
856ca177
MS
12274 /* Update-source. */
12275 if (p->update_if || p->update_source)
12276 {
12277 if (p->update_if)
12278 json_object_string_add(json_neigh, "updateSource", p->update_if);
12279 else if (p->update_source)
12280 json_object_string_add(json_neigh, "updateSource", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
12281 }
12282
12283 /* Default weight */
12284 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
12285 json_object_int_add(json_neigh, "defaultWeight", p->weight);
12286
12287 }
12288 else
12289 {
12290 /* advertisement-interval */
12291 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
12292 p->v_routeadv, VTY_NEWLINE);
12293
12294 /* Update-source. */
12295 if (p->update_if || p->update_source)
12296 {
12297 vty_out (vty, " Update source is ");
12298 if (p->update_if)
12299 vty_out (vty, "%s", p->update_if);
12300 else if (p->update_source)
12301 vty_out (vty, "%s", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
12302 vty_out (vty, "%s", VTY_NEWLINE);
12303 }
12304
12305 /* Default weight */
12306 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
12307 vty_out (vty, " Default weight %d%s", p->weight, VTY_NEWLINE);
12308
12309 vty_out (vty, "%s", VTY_NEWLINE);
12310 }
718e3744 12311
12312 /* Address Family Information */
856ca177
MS
12313 json_object *json_hold = NULL;
12314
12315 if (use_json)
12316 json_hold = json_object_new_object();
12317
538621f2 12318 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
12319 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
12320 if (p->afc[afi][safi])
856ca177 12321 bgp_show_peer_afi (vty, p, afi, safi, use_json, json_hold);
718e3744 12322
856ca177
MS
12323 if (use_json)
12324 {
12325 json_object_int_add(json_hold, "connectionsEstablished", p->established);
12326 json_object_int_add(json_hold, "connectionsDropped", p->dropped);
12327 }
12328 else
12329 vty_out (vty, " Connections established %d; dropped %d%s", p->established, p->dropped,
12330 VTY_NEWLINE);
718e3744 12331
d6661008 12332 if (! p->last_reset)
856ca177
MS
12333 {
12334 if (use_json)
12335 json_object_string_add(json_hold, "lastReset", "never");
12336 else
12337 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
12338 }
e0701b79 12339 else
d6661008 12340 {
856ca177
MS
12341 if (use_json)
12342 {
12343 time_t uptime;
12344 struct tm *tm;
12345
12346 uptime = bgp_clock();
12347 uptime -= p->resettime;
12348 tm = gmtime(&uptime);
12349 json_object_int_add(json_hold, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000));
12350 json_object_string_add(json_hold, "lastResetDueTo", peer_down_str[(int) p->last_reset]);
12351 if (p->last_reset_cause_size)
12352 {
39e871e6
ST
12353 char errorcodesubcode_hexstr[5];
12354 sprintf(errorcodesubcode_hexstr, "%02X%02X", p->notify.code, p->notify.subcode);
12355 json_object_string_add(json_hold, "lastErrorCodeSubcode", errorcodesubcode_hexstr);
856ca177
MS
12356 }
12357 }
12358 else
d6661008 12359 {
3a8c7ba1
DW
12360 vty_out (vty, " Last reset %s, ",
12361 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN, 0, NULL));
12362
12363 if (p->last_reset == PEER_DOWN_NOTIFY_SEND ||
12364 p->last_reset == PEER_DOWN_NOTIFY_RECEIVED)
12365 {
12366 code_str = bgp_notify_code_str(p->notify.code);
12367 subcode_str = bgp_notify_subcode_str(p->notify.code, p->notify.subcode);
12368 vty_out (vty, "due to NOTIFICATION %s (%s%s)%s",
12369 p->last_reset == PEER_DOWN_NOTIFY_SEND ? "sent" : "received",
12370 code_str, subcode_str, VTY_NEWLINE);
12371 }
12372 else
12373 {
12374 vty_out (vty, "due to %s%s",
12375 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
12376 }
856ca177
MS
12377
12378 if (p->last_reset_cause_size)
d6661008 12379 {
856ca177
MS
12380 msg = p->last_reset_cause;
12381 vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE);
12382 for (i = 1; i <= p->last_reset_cause_size; i++)
12383 {
12384 vty_out(vty, "%02X", *msg++);
d6661008 12385
856ca177
MS
12386 if (i != p->last_reset_cause_size)
12387 {
12388 if (i % 16 == 0)
12389 {
12390 vty_out(vty, "%s ", VTY_NEWLINE);
12391 }
12392 else if (i % 4 == 0)
12393 {
12394 vty_out(vty, " ");
12395 }
12396 }
12397 }
12398 vty_out(vty, "%s", VTY_NEWLINE);
d6661008 12399 }
d6661008
DS
12400 }
12401 }
848973c7 12402
718e3744 12403 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
12404 {
856ca177
MS
12405 if (use_json)
12406 json_object_boolean_true_add(json_hold, "prefixesConfigExceedMax");
12407 else
12408 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
0a486e5f 12409
12410 if (p->t_pmax_restart)
856ca177
MS
12411 {
12412 if (use_json)
12413 {
e8f7da3a 12414 json_object_boolean_true_add(json_hold, "reducePrefixNumFrom");
856ca177
MS
12415 json_object_int_add(json_hold, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000);
12416 }
12417 else
12418 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
12419 p->host, thread_timer_remain_second (p->t_pmax_restart),
12420 VTY_NEWLINE);
12421 }
0a486e5f 12422 else
856ca177
MS
12423 {
12424 if (use_json)
e8f7da3a 12425 json_object_boolean_true_add(json_hold, "reducePrefixNumAndClearIpBgp");
856ca177
MS
12426 else
12427 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
12428 p->host, VTY_NEWLINE);
12429 }
718e3744 12430 }
12431
856ca177
MS
12432 if (use_json)
12433 json_object_object_add(json_neigh, "addressFamilyInfo", json_hold);
12434
f5a4827d 12435 /* EBGP Multihop and GTSM */
6d85b15b 12436 if (p->sort != BGP_PEER_IBGP)
f5a4827d 12437 {
856ca177
MS
12438 if (use_json)
12439 {
12440 if (p->gtsm_hops > 0)
12441 json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->gtsm_hops);
12442 else if (p->ttl > 1)
12443 json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->ttl);
12444 }
12445 else
12446 {
12447 if (p->gtsm_hops > 0)
12448 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
12449 p->gtsm_hops, VTY_NEWLINE);
12450 else if (p->ttl > 1)
12451 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
12452 p->ttl, VTY_NEWLINE);
12453 }
f5a4827d 12454 }
5d804b43
PM
12455 else
12456 {
12457 if (p->gtsm_hops > 0)
856ca177
MS
12458 {
12459 if (use_json)
12460 json_object_int_add(json_neigh, "internalBgpNbrMaxHopsAway", p->gtsm_hops);
12461 else
12462 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
12463 p->gtsm_hops, VTY_NEWLINE);
12464 }
5d804b43 12465 }
718e3744 12466
12467 /* Local address. */
12468 if (p->su_local)
12469 {
856ca177
MS
12470 if (use_json)
12471 {
12472 json_object_string_add(json_neigh, "hostLocal", sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN));
12473 json_object_int_add(json_neigh, "portLocal", ntohs (p->su_local->sin.sin_port));
12474 }
12475 else
12476 vty_out (vty, "Local host: %s, Local port: %d%s",
12477 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
12478 ntohs (p->su_local->sin.sin_port),
12479 VTY_NEWLINE);
718e3744 12480 }
12481
12482 /* Remote address. */
12483 if (p->su_remote)
12484 {
856ca177
MS
12485 if (use_json)
12486 {
12487 json_object_string_add(json_neigh, "hostForeign", sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN));
12488 json_object_int_add(json_neigh, "portForeign", ntohs (p->su_remote->sin.sin_port));
12489 }
12490 else
12491 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
718e3744 12492 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
12493 ntohs (p->su_remote->sin.sin_port),
12494 VTY_NEWLINE);
12495 }
12496
12497 /* Nexthop display. */
12498 if (p->su_local)
12499 {
856ca177
MS
12500 if (use_json)
12501 {
12502 json_object_string_add(json_neigh, "nexthop", inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ));
718e3744 12503#ifdef HAVE_IPV6
856ca177
MS
12504 json_object_string_add(json_neigh, "nexthopGlobal", inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ));
12505 json_object_string_add(json_neigh, "nexthopLocal", inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ));
12506 if (p->shared_network)
12507 json_object_string_add(json_neigh, "bgpConnection", "sharedNetwork");
12508 else
12509 json_object_string_add(json_neigh, "bgpConnection", "nonSharedNetwork");
12510#endif /* HAVE_IPV6 */
12511 }
12512 else
12513 {
12514 vty_out (vty, "Nexthop: %s%s",
12515 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
12516 VTY_NEWLINE);
12517#ifdef HAVE_IPV6
12518 vty_out (vty, "Nexthop global: %s%s",
12519 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
12520 VTY_NEWLINE);
12521 vty_out (vty, "Nexthop local: %s%s",
12522 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
12523 VTY_NEWLINE);
12524 vty_out (vty, "BGP connection: %s%s",
12525 p->shared_network ? "shared network" : "non shared network",
12526 VTY_NEWLINE);
718e3744 12527#endif /* HAVE_IPV6 */
856ca177 12528 }
718e3744 12529 }
12530
12531 /* Timer information. */
856ca177
MS
12532 if (use_json)
12533 {
39e871e6 12534 json_object_int_add(json_neigh, "connectRetryTimer", p->v_connect);
dd9275d6
ST
12535 if (p->status == Established && p->rtt)
12536 json_object_int_add(json_neigh, "estimatedRttInMsecs", p->rtt);
856ca177
MS
12537 if (p->t_start)
12538 json_object_int_add(json_neigh, "nextStartTimerDueInMsecs", thread_timer_remain_second (p->t_start) * 1000);
12539 if (p->t_connect)
12540 json_object_int_add(json_neigh, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p->t_connect) * 1000);
12541 if (p->t_routeadv)
12542 {
12543 json_object_int_add(json_neigh, "mraiInterval", p->v_routeadv);
12544 json_object_int_add(json_neigh, "mraiTimerExpireInMsecs", thread_timer_remain_second (p->t_routeadv) * 1000);
12545 }
cb1faec9 12546
856ca177
MS
12547 if (p->t_read)
12548 json_object_string_add(json_neigh, "readThread", "on");
12549 else
12550 json_object_string_add(json_neigh, "readThread", "off");
12551 if (p->t_write)
12552 json_object_string_add(json_neigh, "writeThread", "on");
12553 else
12554 json_object_string_add(json_neigh, "writeThread", "off");
12555 }
12556 else
12557 {
39e871e6
ST
12558 vty_out (vty, "BGP Connect Retry Timer in Seconds: %d%s",
12559 p->v_connect, VTY_NEWLINE);
dd9275d6
ST
12560 if (p->status == Established && p->rtt)
12561 vty_out (vty, "Estimated round trip time: %d ms%s",
12562 p->rtt, VTY_NEWLINE);
856ca177
MS
12563 if (p->t_start)
12564 vty_out (vty, "Next start timer due in %ld seconds%s",
12565 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
12566 if (p->t_connect)
12567 vty_out (vty, "Next connect timer due in %ld seconds%s",
12568 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
12569 if (p->t_routeadv)
12570 vty_out (vty, "MRAI (interval %u) timer expires in %ld seconds%s",
12571 p->v_routeadv, thread_timer_remain_second (p->t_routeadv),
12572 VTY_NEWLINE);
12573
12574 vty_out (vty, "Read thread: %s Write thread: %s%s",
12575 p->t_read ? "on" : "off",
12576 p->t_write ? "on" : "off",
12577 VTY_NEWLINE);
12578 }
718e3744 12579
12580 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
12581 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
856ca177
MS
12582 bgp_capability_vty_out (vty, p, use_json, json_neigh);
12583
12584 if (!use_json)
12585 vty_out (vty, "%s", VTY_NEWLINE);
c43ed2e4
DS
12586
12587 /* BFD information. */
856ca177
MS
12588 bgp_bfd_show_info(vty, p, use_json, json_neigh);
12589
12590 if (use_json)
12591 {
12592 if (p->conf_if) /* Configured interface name. */
12593 json_object_object_add(json, p->conf_if, json_neigh);
12594 else /* Configured IP address. */
12595 json_object_object_add(json, p->host, json_neigh);
12596 }
718e3744 12597}
12598
94f2b392 12599static int
856ca177
MS
12600bgp_show_neighbor (struct vty *vty, struct bgp *bgp, enum show_type type,
12601 union sockunion *su, const char *conf_if, u_char use_json, json_object *json)
718e3744 12602{
1eb8ef25 12603 struct listnode *node, *nnode;
718e3744 12604 struct peer *peer;
12605 int find = 0;
12606
1eb8ef25 12607 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
718e3744 12608 {
1ff9a340
DS
12609 if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
12610 continue;
12611
718e3744 12612 switch (type)
856ca177
MS
12613 {
12614 case show_all:
e8f7da3a 12615 bgp_show_peer (vty, peer, use_json, json);
856ca177
MS
12616 break;
12617 case show_peer:
12618 if (conf_if)
12619 {
4873b3b9
DW
12620 if ((peer->conf_if && !strcmp(peer->conf_if, conf_if)) ||
12621 (peer->hostname && !strcmp(peer->hostname, conf_if)))
856ca177
MS
12622 {
12623 find = 1;
e8f7da3a 12624 bgp_show_peer (vty, peer, use_json, json);
856ca177
MS
12625 }
12626 }
12627 else
12628 {
12629 if (sockunion_same (&peer->su, su))
12630 {
12631 find = 1;
e8f7da3a 12632 bgp_show_peer (vty, peer, use_json, json);
856ca177
MS
12633 }
12634 }
12635 break;
718e3744 12636 }
12637 }
12638
12639 if (type == show_peer && ! find)
856ca177
MS
12640 {
12641 if (use_json)
12642 json_object_boolean_true_add(json, "bgpNoSuchNeighbor");
12643 else
12644 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
12645 }
12646
12647 if (use_json)
12648 {
12649 vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
12650 json_object_free(json);
12651 }
12652 else
12653 {
12654 vty_out (vty, "%s", VTY_NEWLINE);
12655 }
12656
718e3744 12657 return CMD_SUCCESS;
12658}
12659
94f2b392 12660static int
fd79ac91 12661bgp_show_neighbor_vty (struct vty *vty, const char *name,
9f689658
DD
12662 enum show_type type, const char *ip_str, u_char use_json,
12663 json_object *json)
718e3744 12664{
12665 int ret;
12666 struct bgp *bgp;
12667 union sockunion su;
856ca177 12668
9f689658 12669 if (use_json && (json == NULL))
856ca177 12670 json = json_object_new_object();
718e3744 12671
718e3744 12672 if (name)
12673 {
12674 bgp = bgp_lookup_by_name (name);
718e3744 12675 if (! bgp)
12676 {
856ca177
MS
12677 if (use_json)
12678 {
12679 json_object_boolean_true_add(json, "bgpNoSuchInstance");
12680 vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
12681 json_object_free(json);
12682 }
12683 else
12684 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
12685
718e3744 12686 return CMD_WARNING;
12687 }
718e3744 12688 }
a80beece
DS
12689 else
12690 {
12691 bgp = bgp_get_default ();
12692 }
718e3744 12693
12694 if (bgp)
a80beece
DS
12695 {
12696 if (ip_str)
12697 {
12698 ret = str2sockunion (ip_str, &su);
12699 if (ret < 0)
856ca177 12700 bgp_show_neighbor (vty, bgp, type, NULL, ip_str, use_json, json);
a80beece 12701 else
856ca177 12702 bgp_show_neighbor (vty, bgp, type, &su, NULL, use_json, json);
a80beece
DS
12703 }
12704 else
12705 {
856ca177 12706 bgp_show_neighbor (vty, bgp, type, NULL, NULL, use_json, json);
a80beece
DS
12707 }
12708 }
718e3744 12709
12710 return CMD_SUCCESS;
12711}
12712
f186de26 12713static void
12714bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json)
12715{
12716 struct listnode *node, *nnode;
12717 struct bgp *bgp;
12718 json_object *json = NULL;
9f689658
DD
12719 int is_first = 1;
12720
12721 if (use_json)
12722 vty_out (vty, "{%s", VTY_NEWLINE);
f186de26 12723
12724 for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
12725 {
f186de26 12726 if (use_json)
9f689658
DD
12727 {
12728 if (!(json = json_object_new_object()))
12729 {
12730 zlog_err("Unable to allocate memory for JSON object");
12731 vty_out (vty,
12732 "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s",
12733 VTY_NEWLINE);
12734 return;
12735 }
12736
12737 json_object_int_add(json, "vrfId",
12738 (bgp->vrf_id == VRF_UNKNOWN)
12739 ? -1 : bgp->vrf_id);
12740 json_object_string_add(json, "vrfName",
12741 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
12742 ? "Default" : bgp->name);
12743
12744 if (! is_first)
12745 vty_out (vty, ",%s", VTY_NEWLINE);
12746 else
12747 is_first = 0;
12748
12749 vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
12750 ? "Default" : bgp->name);
12751 }
12752 else
12753 {
12754 vty_out (vty, "%sInstance %s:%s",
12755 VTY_NEWLINE,
12756 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)
12757 ? "Default" : bgp->name,
12758 VTY_NEWLINE);
12759 }
f186de26 12760 bgp_show_neighbor (vty, bgp, show_all, NULL, NULL, use_json, json);
12761 }
9f689658
DD
12762
12763 if (use_json)
12764 vty_out (vty, "}%s", VTY_NEWLINE);
f186de26 12765}
12766
718e3744 12767/* "show ip bgp neighbors" commands. */
12768DEFUN (show_ip_bgp_neighbors,
12769 show_ip_bgp_neighbors_cmd,
856ca177 12770 "show ip bgp neighbors {json}",
718e3744 12771 SHOW_STR
12772 IP_STR
12773 BGP_STR
856ca177
MS
12774 "Detailed information on TCP and BGP neighbor connections\n"
12775 "JavaScript Object Notation\n")
718e3744 12776{
db7c8528 12777 u_char uj = use_json(argc, argv);
856ca177 12778
9f689658 12779 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL, uj, NULL);
718e3744 12780}
12781
12782ALIAS (show_ip_bgp_neighbors,
12783 show_ip_bgp_ipv4_neighbors_cmd,
856ca177 12784 "show ip bgp ipv4 (unicast|multicast) neighbors {json}",
718e3744 12785 SHOW_STR
12786 IP_STR
12787 BGP_STR
12788 "Address family\n"
12789 "Address Family modifier\n"
12790 "Address Family modifier\n"
856ca177
MS
12791 "Detailed information on TCP and BGP neighbor connections\n"
12792 "JavaScript Object Notation\n")
718e3744 12793
12794ALIAS (show_ip_bgp_neighbors,
12795 show_ip_bgp_vpnv4_all_neighbors_cmd,
856ca177 12796 "show ip bgp vpnv4 all neighbors {json}",
718e3744 12797 SHOW_STR
12798 IP_STR
12799 BGP_STR
12800 "Display VPNv4 NLRI specific information\n"
12801 "Display information about all VPNv4 NLRIs\n"
856ca177
MS
12802 "Detailed information on TCP and BGP neighbor connections\n"
12803 "JavaScript Object Notation\n")
718e3744 12804
12805ALIAS (show_ip_bgp_neighbors,
12806 show_ip_bgp_vpnv4_rd_neighbors_cmd,
856ca177 12807 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors {json}",
718e3744 12808 SHOW_STR
12809 IP_STR
12810 BGP_STR
12811 "Display VPNv4 NLRI specific information\n"
12812 "Display information for a route distinguisher\n"
12813 "VPN Route Distinguisher\n"
856ca177
MS
12814 "Detailed information on TCP and BGP neighbor connections\n"
12815 "JavaScript Object Notation\n")
718e3744 12816
12817ALIAS (show_ip_bgp_neighbors,
12818 show_bgp_neighbors_cmd,
856ca177 12819 "show bgp neighbors {json}",
718e3744 12820 SHOW_STR
12821 BGP_STR
856ca177
MS
12822 "Detailed information on TCP and BGP neighbor connections\n"
12823 "JavaScript Object Notation\n")
718e3744 12824
12825ALIAS (show_ip_bgp_neighbors,
12826 show_bgp_ipv6_neighbors_cmd,
856ca177 12827 "show bgp ipv6 neighbors {json}",
718e3744 12828 SHOW_STR
12829 BGP_STR
12830 "Address family\n"
856ca177
MS
12831 "Detailed information on TCP and BGP neighbor connections\n"
12832 "JavaScript Object Notation\n")
718e3744 12833
12834DEFUN (show_ip_bgp_neighbors_peer,
12835 show_ip_bgp_neighbors_peer_cmd,
856ca177 12836 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
718e3744 12837 SHOW_STR
12838 IP_STR
12839 BGP_STR
12840 "Detailed information on TCP and BGP neighbor connections\n"
12841 "Neighbor to display information about\n"
a80beece 12842 "Neighbor to display information about\n"
856ca177
MS
12843 "Neighbor on bgp configured interface\n"
12844 "JavaScript Object Notation\n")
718e3744 12845{
db7c8528 12846 u_char uj = use_json(argc, argv);
856ca177 12847
9f689658 12848 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 2], uj, NULL);
718e3744 12849}
12850
12851ALIAS (show_ip_bgp_neighbors_peer,
12852 show_ip_bgp_ipv4_neighbors_peer_cmd,
856ca177 12853 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
718e3744 12854 SHOW_STR
12855 IP_STR
12856 BGP_STR
12857 "Address family\n"
12858 "Address Family modifier\n"
12859 "Address Family modifier\n"
12860 "Detailed information on TCP and BGP neighbor connections\n"
12861 "Neighbor to display information about\n"
a80beece 12862 "Neighbor to display information about\n"
856ca177
MS
12863 "Neighbor on bgp configured interface\n"
12864 "JavaScript Object Notation\n")
718e3744 12865
12866ALIAS (show_ip_bgp_neighbors_peer,
12867 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
856ca177 12868 "show ip bgp vpnv4 all neighbors A.B.C.D {json}",
718e3744 12869 SHOW_STR
12870 IP_STR
12871 BGP_STR
12872 "Display VPNv4 NLRI specific information\n"
12873 "Display information about all VPNv4 NLRIs\n"
12874 "Detailed information on TCP and BGP neighbor connections\n"
856ca177
MS
12875 "Neighbor to display information about\n"
12876 "JavaScript Object Notation\n")
718e3744 12877
12878ALIAS (show_ip_bgp_neighbors_peer,
12879 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
856ca177 12880 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D {json}",
718e3744 12881 SHOW_STR
12882 IP_STR
12883 BGP_STR
12884 "Display VPNv4 NLRI specific information\n"
12885 "Display information about all VPNv4 NLRIs\n"
12886 "Detailed information on TCP and BGP neighbor connections\n"
856ca177
MS
12887 "Neighbor to display information about\n"
12888 "JavaScript Object Notation\n")
718e3744 12889
12890ALIAS (show_ip_bgp_neighbors_peer,
12891 show_bgp_neighbors_peer_cmd,
856ca177 12892 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
718e3744 12893 SHOW_STR
12894 BGP_STR
12895 "Detailed information on TCP and BGP neighbor connections\n"
12896 "Neighbor to display information about\n"
a80beece 12897 "Neighbor to display information about\n"
856ca177
MS
12898 "Neighbor on bgp configured interface\n"
12899 "JavaScript Object Notation\n")
718e3744 12900
12901ALIAS (show_ip_bgp_neighbors_peer,
12902 show_bgp_ipv6_neighbors_peer_cmd,
856ca177 12903 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
718e3744 12904 SHOW_STR
12905 BGP_STR
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")
718e3744 12912
12913DEFUN (show_ip_bgp_instance_neighbors,
12914 show_ip_bgp_instance_neighbors_cmd,
8386ac43 12915 "show ip bgp " BGP_INSTANCE_CMD " neighbors {json}",
718e3744 12916 SHOW_STR
12917 IP_STR
12918 BGP_STR
8386ac43 12919 BGP_INSTANCE_HELP_STR
856ca177
MS
12920 "Detailed information on TCP and BGP neighbor connections\n"
12921 "JavaScript Object Notation\n")
718e3744 12922{
db7c8528 12923 u_char uj = use_json(argc, argv);
856ca177 12924
9f689658 12925 return bgp_show_neighbor_vty (vty, argv[1], show_all, NULL, uj, NULL);
718e3744 12926}
12927
f186de26 12928DEFUN (show_ip_bgp_instance_all_neighbors,
12929 show_ip_bgp_instance_all_neighbors_cmd,
12930 "show ip bgp " BGP_INSTANCE_ALL_CMD " neighbors {json}",
12931 SHOW_STR
12932 IP_STR
12933 BGP_STR
12934 BGP_INSTANCE_ALL_HELP_STR
12935 "Detailed information on TCP and BGP neighbor connections\n"
12936 "JavaScript Object Notation\n")
12937{
12938 u_char uj = use_json(argc, argv);
12939
12940 bgp_show_all_instances_neighbors_vty (vty, uj);
12941 return CMD_SUCCESS;
12942}
12943
bb46e94f 12944ALIAS (show_ip_bgp_instance_neighbors,
12945 show_bgp_instance_neighbors_cmd,
8386ac43 12946 "show bgp " BGP_INSTANCE_CMD " neighbors {json}",
bb46e94f 12947 SHOW_STR
12948 BGP_STR
8386ac43 12949 BGP_INSTANCE_HELP_STR
856ca177
MS
12950 "Detailed information on TCP and BGP neighbor connections\n"
12951 "JavaScript Object Notation\n")
bb46e94f 12952
12953ALIAS (show_ip_bgp_instance_neighbors,
12954 show_bgp_instance_ipv6_neighbors_cmd,
8386ac43 12955 "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors {json}",
bb46e94f 12956 SHOW_STR
12957 BGP_STR
8386ac43 12958 BGP_INSTANCE_HELP_STR
bb46e94f 12959 "Address family\n"
856ca177
MS
12960 "Detailed information on TCP and BGP neighbor connections\n"
12961 "JavaScript Object Notation\n")
bb46e94f 12962
718e3744 12963DEFUN (show_ip_bgp_instance_neighbors_peer,
12964 show_ip_bgp_instance_neighbors_peer_cmd,
8386ac43 12965 "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
718e3744 12966 SHOW_STR
12967 IP_STR
12968 BGP_STR
8386ac43 12969 BGP_INSTANCE_HELP_STR
718e3744 12970 "Detailed information on TCP and BGP neighbor connections\n"
12971 "Neighbor to display information about\n"
a80beece 12972 "Neighbor to display information about\n"
856ca177
MS
12973 "Neighbor on bgp configured interface\n"
12974 "JavaScript Object Notation\n")
718e3744 12975{
db7c8528 12976 u_char uj = use_json(argc, argv);
856ca177 12977
9f689658 12978 return bgp_show_neighbor_vty (vty, argv[1], show_peer, argv[2], uj, NULL);
718e3744 12979}
bb46e94f 12980
12981ALIAS (show_ip_bgp_instance_neighbors_peer,
12982 show_bgp_instance_neighbors_peer_cmd,
8386ac43 12983 "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
bb46e94f 12984 SHOW_STR
12985 BGP_STR
8386ac43 12986 BGP_INSTANCE_HELP_STR
bb46e94f 12987 "Detailed information on TCP and BGP neighbor connections\n"
12988 "Neighbor to display information about\n"
a80beece 12989 "Neighbor to display information about\n"
856ca177
MS
12990 "Neighbor on bgp configured interface\n"
12991 "JavaScript Object Notation\n")
bb46e94f 12992
12993ALIAS (show_ip_bgp_instance_neighbors_peer,
12994 show_bgp_instance_ipv6_neighbors_peer_cmd,
8386ac43 12995 "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
bb46e94f 12996 SHOW_STR
12997 BGP_STR
8386ac43 12998 BGP_INSTANCE_HELP_STR
bb46e94f 12999 "Address family\n"
13000 "Detailed information on TCP and BGP neighbor connections\n"
13001 "Neighbor to display information about\n"
a80beece 13002 "Neighbor to display information about\n"
856ca177
MS
13003 "Neighbor on bgp configured interface\n"
13004 "JavaScript Object Notation\n")
6b0655a2 13005
718e3744 13006/* Show BGP's AS paths internal data. There are both `show ip bgp
13007 paths' and `show ip mbgp paths'. Those functions results are the
13008 same.*/
13009DEFUN (show_ip_bgp_paths,
13010 show_ip_bgp_paths_cmd,
13011 "show ip bgp paths",
13012 SHOW_STR
13013 IP_STR
13014 BGP_STR
13015 "Path information\n")
13016{
13017 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
13018 aspath_print_all_vty (vty);
13019 return CMD_SUCCESS;
13020}
13021
13022DEFUN (show_ip_bgp_ipv4_paths,
13023 show_ip_bgp_ipv4_paths_cmd,
13024 "show ip bgp ipv4 (unicast|multicast) paths",
13025 SHOW_STR
13026 IP_STR
13027 BGP_STR
13028 "Address family\n"
13029 "Address Family modifier\n"
13030 "Address Family modifier\n"
13031 "Path information\n")
13032{
13033 vty_out (vty, "Address Refcnt Path\r\n");
13034 aspath_print_all_vty (vty);
13035
13036 return CMD_SUCCESS;
13037}
6b0655a2 13038
718e3744 13039#include "hash.h"
13040
94f2b392 13041static void
718e3744 13042community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
13043{
13044 struct community *com;
13045
13046 com = (struct community *) backet->data;
6c4f4e6e 13047 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
718e3744 13048 community_str (com), VTY_NEWLINE);
13049}
13050
13051/* Show BGP's community internal data. */
13052DEFUN (show_ip_bgp_community_info,
13053 show_ip_bgp_community_info_cmd,
13054 "show ip bgp community-info",
13055 SHOW_STR
13056 IP_STR
13057 BGP_STR
13058 "List all bgp community information\n")
13059{
13060 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
13061
13062 hash_iterate (community_hash (),
13063 (void (*) (struct hash_backet *, void *))
13064 community_show_all_iterator,
13065 vty);
13066
13067 return CMD_SUCCESS;
13068}
13069
13070DEFUN (show_ip_bgp_attr_info,
13071 show_ip_bgp_attr_info_cmd,
13072 "show ip bgp attribute-info",
13073 SHOW_STR
13074 IP_STR
13075 BGP_STR
13076 "List all bgp attribute information\n")
13077{
13078 attr_show_all (vty);
13079 return CMD_SUCCESS;
13080}
6b0655a2 13081
8386ac43 13082static int bgp_show_update_groups(struct vty *vty, const char *name,
13083 int afi, int safi,
f43e655e 13084 uint64_t subgrp_id)
3f9c7369
DS
13085{
13086 struct bgp *bgp;
13087
8386ac43 13088 if (name)
13089 bgp = bgp_lookup_by_name (name);
13090 else
13091 bgp = bgp_get_default ();
13092
3f9c7369 13093 if (bgp)
8fe8a7f6 13094 update_group_show(bgp, afi, safi, vty, subgrp_id);
3f9c7369
DS
13095 return CMD_SUCCESS;
13096}
13097
f186de26 13098static void
13099bgp_show_all_instances_updgrps_vty (struct vty *vty, afi_t afi, safi_t safi)
13100{
13101 struct listnode *node, *nnode;
13102 struct bgp *bgp;
13103
13104 for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
13105 {
13106 vty_out (vty, "%sInstance %s:%s",
13107 VTY_NEWLINE,
13108 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name,
13109 VTY_NEWLINE);
13110 update_group_show(bgp, afi, safi, vty, 0);
13111 }
13112}
13113
8fe8a7f6
DS
13114DEFUN (show_ip_bgp_updgrps,
13115 show_ip_bgp_updgrps_cmd,
13116 "show ip bgp update-groups",
13117 SHOW_STR
13118 IP_STR
13119 BGP_STR
13120 "Detailed info about dynamic update groups\n")
13121{
8386ac43 13122 return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, 0));
13123}
13124
13125DEFUN (show_ip_bgp_instance_updgrps,
13126 show_ip_bgp_instance_updgrps_cmd,
13127 "show ip bgp " BGP_INSTANCE_CMD " update-groups",
13128 SHOW_STR
13129 IP_STR
13130 BGP_STR
13131 BGP_INSTANCE_HELP_STR
13132 "Detailed info about dynamic update groups\n")
13133{
13134 return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, 0));
8fe8a7f6
DS
13135}
13136
f186de26 13137DEFUN (show_ip_bgp_instance_all_updgrps,
13138 show_ip_bgp_instance_all_updgrps_cmd,
13139 "show ip bgp " BGP_INSTANCE_ALL_CMD " update-groups",
13140 SHOW_STR
13141 IP_STR
13142 BGP_STR
13143 BGP_INSTANCE_ALL_HELP_STR
13144 "Detailed info about dynamic update groups\n")
13145{
13146 bgp_show_all_instances_updgrps_vty (vty, AFI_IP, SAFI_UNICAST);
13147 return CMD_SUCCESS;
13148}
13149
3f9c7369
DS
13150DEFUN (show_bgp_ipv6_updgrps,
13151 show_bgp_ipv6_updgrps_cmd,
8fe8a7f6 13152 "show bgp update-groups",
3f9c7369
DS
13153 SHOW_STR
13154 BGP_STR
8fe8a7f6 13155 "Detailed info about v6 dynamic update groups\n")
3f9c7369 13156{
8386ac43 13157 return (bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, 0));
13158}
13159
13160DEFUN (show_bgp_instance_ipv6_updgrps,
13161 show_bgp_instance_ipv6_updgrps_cmd,
13162 "show bgp " BGP_INSTANCE_CMD " update-groups",
13163 SHOW_STR
13164 BGP_STR
13165 BGP_INSTANCE_HELP_STR
13166 "Detailed info about v6 dynamic update groups\n")
13167{
13168 return (bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, 0));
3f9c7369
DS
13169}
13170
f186de26 13171DEFUN (show_bgp_instance_all_ipv6_updgrps,
13172 show_bgp_instance_all_ipv6_updgrps_cmd,
13173 "show bgp " BGP_INSTANCE_ALL_CMD " update-groups",
13174 SHOW_STR
13175 BGP_STR
13176 BGP_INSTANCE_ALL_HELP_STR
13177 "Detailed info about v6 dynamic update groups\n")
13178{
13179 bgp_show_all_instances_updgrps_vty (vty, AFI_IP6, SAFI_UNICAST);
13180 return CMD_SUCCESS;
13181}
13182
3f9c7369
DS
13183DEFUN (show_bgp_updgrps,
13184 show_bgp_updgrps_cmd,
8fe8a7f6 13185 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups",
3f9c7369
DS
13186 SHOW_STR
13187 BGP_STR
13188 "Address family\n"
13189 "Address family\n"
13190 "Address Family modifier\n"
13191 "Address Family modifier\n"
8fe8a7f6 13192 "Detailed info about dynamic update groups\n")
3f9c7369 13193{
3f9c7369
DS
13194 afi_t afi;
13195 safi_t safi;
13196
13197 afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
13198 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8386ac43 13199 return (bgp_show_update_groups(vty, NULL, afi, safi, 0));
8fe8a7f6
DS
13200}
13201
13202DEFUN (show_ip_bgp_updgrps_s,
13203 show_ip_bgp_updgrps_s_cmd,
13204 "show ip bgp update-groups SUBGROUP-ID",
13205 SHOW_STR
13206 IP_STR
13207 BGP_STR
13208 "Detailed info about dynamic update groups\n"
13209 "Specific subgroup to display detailed info for\n")
13210{
f43e655e 13211 uint64_t subgrp_id;
8fe8a7f6
DS
13212
13213 VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]);
8386ac43 13214 return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, subgrp_id));
13215}
13216
13217DEFUN (show_ip_bgp_instance_updgrps_s,
13218 show_ip_bgp_instance_updgrps_s_cmd,
13219 "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID",
13220 SHOW_STR
13221 IP_STR
13222 BGP_STR
13223 BGP_INSTANCE_HELP_STR
13224 "Detailed info about dynamic update groups\n"
13225 "Specific subgroup to display detailed info for\n")
13226{
f43e655e 13227 uint64_t subgrp_id;
8386ac43 13228
13229 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
13230 return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, subgrp_id));
8fe8a7f6
DS
13231}
13232
13233DEFUN (show_bgp_ipv6_updgrps_s,
13234 show_bgp_ipv6_updgrps_s_cmd,
13235 "show bgp update-groups SUBGROUP-ID",
13236 SHOW_STR
13237 BGP_STR
13238 "Detailed info about v6 dynamic update groups\n"
13239 "Specific subgroup to display detailed info for\n")
13240{
f43e655e 13241 uint64_t subgrp_id;
8fe8a7f6
DS
13242
13243 VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]);
8386ac43 13244 return(bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, subgrp_id));
13245}
13246
13247DEFUN (show_bgp_instance_ipv6_updgrps_s,
13248 show_bgp_instance_ipv6_updgrps_s_cmd,
13249 "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID",
13250 SHOW_STR
13251 BGP_STR
13252 "Detailed info about v6 dynamic update groups\n"
13253 "Specific subgroup to display detailed info for\n")
13254{
f43e655e 13255 uint64_t subgrp_id;
8386ac43 13256
13257 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
13258 return(bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, subgrp_id));
8fe8a7f6
DS
13259}
13260
13261DEFUN (show_bgp_updgrps_s,
13262 show_bgp_updgrps_s_cmd,
13263 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID",
13264 SHOW_STR
13265 BGP_STR
13266 "Address family\n"
13267 "Address family\n"
13268 "Address Family modifier\n"
13269 "Address Family modifier\n"
13270 "Detailed info about v6 dynamic update groups\n"
13271 "Specific subgroup to display detailed info for")
13272{
13273 afi_t afi;
13274 safi_t safi;
f43e655e 13275 uint64_t subgrp_id;
8fe8a7f6
DS
13276
13277 afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
13278 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
13279
13280 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
8386ac43 13281 return(bgp_show_update_groups(vty, NULL, afi, safi, subgrp_id));
3f9c7369
DS
13282}
13283
13284DEFUN (show_bgp_updgrps_stats,
13285 show_bgp_updgrps_stats_cmd,
13286 "show bgp update-groups statistics",
13287 SHOW_STR
13288 BGP_STR
13289 "BGP update groups\n"
13290 "Statistics\n")
13291{
13292 struct bgp *bgp;
13293
13294 bgp = bgp_get_default();
13295 if (bgp)
13296 update_group_show_stats(bgp, vty);
13297
13298 return CMD_SUCCESS;
13299}
13300
8386ac43 13301DEFUN (show_bgp_instance_updgrps_stats,
13302 show_bgp_instance_updgrps_stats_cmd,
13303 "show bgp " BGP_INSTANCE_CMD " update-groups statistics",
13304 SHOW_STR
13305 BGP_STR
13306 BGP_INSTANCE_HELP_STR
13307 "BGP update groups\n"
13308 "Statistics\n")
13309{
13310 struct bgp *bgp;
13311
13312 bgp = bgp_lookup_by_name (argv[1]);
13313 if (bgp)
13314 update_group_show_stats(bgp, vty);
13315
13316 return CMD_SUCCESS;
13317}
13318
3f9c7369 13319static void
8386ac43 13320show_bgp_updgrps_adj_info_aux (struct vty *vty, const char *name,
13321 afi_t afi, safi_t safi,
f43e655e 13322 const char *what, uint64_t subgrp_id)
3f9c7369
DS
13323{
13324 struct bgp *bgp;
8386ac43 13325
13326 if (name)
13327 bgp = bgp_lookup_by_name (name);
13328 else
13329 bgp = bgp_get_default ();
13330
3f9c7369
DS
13331 if (bgp)
13332 {
13333 if (!strcmp(what, "advertise-queue"))
13334 update_group_show_adj_queue(bgp, afi, safi, vty, subgrp_id);
13335 else if (!strcmp(what, "advertised-routes"))
13336 update_group_show_advertised(bgp, afi, safi, vty, subgrp_id);
13337 else if (!strcmp(what, "packet-queue"))
13338 update_group_show_packet_queue(bgp, afi, safi, vty, subgrp_id);
13339 }
13340}
13341
13342DEFUN (show_ip_bgp_updgrps_adj,
13343 show_ip_bgp_updgrps_adj_cmd,
13344 "show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)",
13345 SHOW_STR
13346 IP_STR
13347 BGP_STR
13348 "BGP update groups\n"
13349 "Advertisement queue\n"
13350 "Announced routes\n"
13351 "Packet queue\n")
8fe8a7f6 13352
3f9c7369 13353{
8386ac43 13354 show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[0], 0);
13355 return CMD_SUCCESS;
13356}
13357
13358DEFUN (show_ip_bgp_instance_updgrps_adj,
13359 show_ip_bgp_instance_updgrps_adj_cmd,
13360 "show ip bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)",
13361 SHOW_STR
13362 IP_STR
13363 BGP_STR
13364 BGP_INSTANCE_HELP_STR
13365 "BGP update groups\n"
13366 "Advertisement queue\n"
13367 "Announced routes\n"
13368 "Packet queue\n")
13369
13370{
13371 show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[2], 0);
3f9c7369
DS
13372 return CMD_SUCCESS;
13373}
13374
13375DEFUN (show_bgp_updgrps_afi_adj,
13376 show_bgp_updgrps_afi_adj_cmd,
13377 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)",
13378 SHOW_STR
13379 BGP_STR
13380 "Address family\n"
13381 "Address family\n"
13382 "Address Family modifier\n"
13383 "Address Family modifier\n"
13384 "BGP update groups\n"
13385 "Advertisement queue\n"
13386 "Announced routes\n"
8fe8a7f6
DS
13387 "Packet queue\n"
13388 "Specific subgroup info wanted for\n")
3f9c7369
DS
13389{
13390 afi_t afi;
13391 safi_t safi;
13392
13393 afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
13394 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8386ac43 13395 show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[2], 0);
8fe8a7f6 13396 return CMD_SUCCESS;
3f9c7369
DS
13397}
13398
13399DEFUN (show_bgp_updgrps_adj,
13400 show_bgp_updgrps_adj_cmd,
13401 "show bgp update-groups (advertise-queue|advertised-routes|packet-queue)",
13402 SHOW_STR
13403 BGP_STR
13404 "BGP update groups\n"
13405 "Advertisement queue\n"
13406 "Announced routes\n"
13407 "Packet queue\n")
13408{
8386ac43 13409 show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[0], 0);
13410 return CMD_SUCCESS;
13411}
13412
13413DEFUN (show_bgp_instance_updgrps_adj,
13414 show_bgp_instance_updgrps_adj_cmd,
13415 "show bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)",
13416 SHOW_STR
13417 BGP_STR
13418 BGP_INSTANCE_HELP_STR
13419 "BGP update groups\n"
13420 "Advertisement queue\n"
13421 "Announced routes\n"
13422 "Packet queue\n")
13423{
13424 show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[2], 0);
3f9c7369
DS
13425 return CMD_SUCCESS;
13426}
13427
13428DEFUN (show_ip_bgp_updgrps_adj_s,
8fe8a7f6 13429 show_ip_bgp_updgrps_adj_s_cmd,
3f9c7369
DS
13430 "show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
13431 SHOW_STR
13432 IP_STR
13433 BGP_STR
13434 "BGP update groups\n"
8fe8a7f6 13435 "Specific subgroup to display info for\n"
3f9c7369
DS
13436 "Advertisement queue\n"
13437 "Announced routes\n"
13438 "Packet queue\n")
3f9c7369 13439
3f9c7369 13440{
f43e655e 13441 uint64_t subgrp_id;
8fe8a7f6
DS
13442
13443 VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]);
13444
8386ac43 13445 show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[1], subgrp_id);
13446 return CMD_SUCCESS;
13447}
13448
13449DEFUN (show_ip_bgp_instance_updgrps_adj_s,
13450 show_ip_bgp_instance_updgrps_adj_s_cmd,
13451 "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
13452 SHOW_STR
13453 IP_STR
13454 BGP_STR
13455 BGP_INSTANCE_HELP_STR
13456 "BGP update groups\n"
13457 "Specific subgroup to display info for\n"
13458 "Advertisement queue\n"
13459 "Announced routes\n"
13460 "Packet queue\n")
13461
13462{
f43e655e 13463 uint64_t subgrp_id;
8386ac43 13464
13465 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
13466
13467 show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[3], subgrp_id);
3f9c7369
DS
13468 return CMD_SUCCESS;
13469}
13470
8fe8a7f6
DS
13471DEFUN (show_bgp_updgrps_afi_adj_s,
13472 show_bgp_updgrps_afi_adj_s_cmd,
3f9c7369
DS
13473 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
13474 SHOW_STR
13475 BGP_STR
13476 "Address family\n"
13477 "Address family\n"
13478 "Address Family modifier\n"
13479 "Address Family modifier\n"
13480 "BGP update groups\n"
8fe8a7f6 13481 "Specific subgroup to display info for\n"
3f9c7369
DS
13482 "Advertisement queue\n"
13483 "Announced routes\n"
8fe8a7f6
DS
13484 "Packet queue\n"
13485 "Specific subgroup info wanted for\n")
3f9c7369
DS
13486{
13487 afi_t afi;
13488 safi_t safi;
f43e655e 13489 uint64_t subgrp_id;
3f9c7369
DS
13490
13491 afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6;
13492 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8fe8a7f6
DS
13493 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
13494
8386ac43 13495 show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[3], subgrp_id);
8fe8a7f6 13496 return CMD_SUCCESS;
3f9c7369
DS
13497}
13498
8fe8a7f6
DS
13499DEFUN (show_bgp_updgrps_adj_s,
13500 show_bgp_updgrps_adj_s_cmd,
13501 "show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
13502 SHOW_STR
13503 BGP_STR
13504 "BGP update groups\n"
13505 "Specific subgroup to display info for\n"
13506 "Advertisement queue\n"
13507 "Announced routes\n"
13508 "Packet queue\n")
13509{
f43e655e 13510 uint64_t subgrp_id;
8fe8a7f6
DS
13511
13512 VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]);
13513
8386ac43 13514 show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[1], subgrp_id);
8fe8a7f6
DS
13515 return CMD_SUCCESS;
13516}
13517
8386ac43 13518DEFUN (show_bgp_instance_updgrps_adj_s,
13519 show_bgp_instance_updgrps_adj_s_cmd,
13520 "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
13521 SHOW_STR
13522 BGP_STR
13523 BGP_INSTANCE_HELP_STR
13524 "BGP update groups\n"
13525 "Specific subgroup to display info for\n"
13526 "Advertisement queue\n"
13527 "Announced routes\n"
13528 "Packet queue\n")
13529{
f43e655e 13530 uint64_t subgrp_id;
8386ac43 13531
13532 VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]);
13533
13534 show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[3], subgrp_id);
13535 return CMD_SUCCESS;
13536}
13537
13538
8fe8a7f6 13539
f14e6fdb
DS
13540static int
13541bgp_show_one_peer_group (struct vty *vty, struct peer_group *group)
13542{
13543 struct listnode *node, *nnode;
13544 struct prefix *range;
13545 struct peer *conf;
13546 struct peer *peer;
4690c7d7 13547 char buf[PREFIX2STR_BUFFER];
f14e6fdb
DS
13548 afi_t afi;
13549 safi_t safi;
ffd0c037
DS
13550 const char *peer_status;
13551 const char *af_str;
f14e6fdb
DS
13552 int lr_count;
13553 int dynamic;
13554 int af_cfgd;
13555
13556 conf = group->conf;
13557
0299c004
DS
13558 if (conf->as_type == AS_SPECIFIED ||
13559 conf->as_type == AS_EXTERNAL) {
66b199b2 13560 vty_out (vty, "%sBGP peer-group %s, remote AS %d%s",
f14e6fdb 13561 VTY_NEWLINE, group->name, conf->as, VTY_NEWLINE);
0299c004 13562 } else if (conf->as_type == AS_INTERNAL) {
66b199b2 13563 vty_out (vty, "%sBGP peer-group %s, remote AS %d%s",
0299c004 13564 VTY_NEWLINE, group->name, group->bgp->as, VTY_NEWLINE);
66b199b2
DS
13565 } else {
13566 vty_out (vty, "%sBGP peer-group %s%s",
13567 VTY_NEWLINE, group->name, VTY_NEWLINE);
0299c004 13568 }
f14e6fdb 13569
0299c004 13570 if ((group->bgp->as == conf->as) || (conf->as_type == AS_INTERNAL))
f14e6fdb
DS
13571 vty_out (vty, " Peer-group type is internal%s", VTY_NEWLINE);
13572 else
13573 vty_out (vty, " Peer-group type is external%s", VTY_NEWLINE);
13574
13575 /* Display AFs configured. */
13576 vty_out (vty, " Configured address-families:");
13577 for (afi = AFI_IP; afi < AFI_MAX; afi++)
13578 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
13579 {
13580 if (conf->afc[afi][safi])
13581 {
13582 af_cfgd = 1;
13583 vty_out (vty, " %s;", afi_safi_print(afi, safi));
13584 }
13585 }
13586 if (!af_cfgd)
13587 vty_out (vty, " none%s", VTY_NEWLINE);
13588 else
13589 vty_out (vty, "%s", VTY_NEWLINE);
13590
13591 /* Display listen ranges (for dynamic neighbors), if any */
13592 for (afi = AFI_IP; afi < AFI_MAX; afi++)
13593 {
13594 if (afi == AFI_IP)
13595 af_str = "IPv4";
13596 else if (afi == AFI_IP6)
13597 af_str = "IPv6";
13598 lr_count = listcount(group->listen_range[afi]);
13599 if (lr_count)
13600 {
13601 vty_out(vty,
13602 " %d %s listen range(s)%s",
13603 lr_count, af_str, VTY_NEWLINE);
13604
13605
13606 for (ALL_LIST_ELEMENTS (group->listen_range[afi], node,
13607 nnode, range))
13608 {
13609 prefix2str(range, buf, sizeof(buf));
13610 vty_out(vty, " %s%s", buf, VTY_NEWLINE);
13611 }
13612 }
13613 }
13614
13615 /* Display group members and their status */
13616 if (listcount(group->peer))
13617 {
13618 vty_out (vty, " Peer-group members:%s", VTY_NEWLINE);
13619 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
13620 {
13621 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
13622 peer_status = "Idle (Admin)";
13623 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
13624 peer_status = "Idle (PfxCt)";
13625 else
13626 peer_status = LOOKUP(bgp_status_msg, peer->status);
13627
13628 dynamic = peer_dynamic_neighbor(peer);
13629 vty_out (vty, " %s %s %s %s",
13630 peer->host, dynamic ? "(dynamic)" : "",
13631 peer_status, VTY_NEWLINE);
13632 }
13633 }
13634
13635 return CMD_SUCCESS;
13636}
13637
13638/* Show BGP peer group's information. */
13639enum show_group_type
13640{
13641 show_all_groups,
13642 show_peer_group
13643};
13644
13645static int
13646bgp_show_peer_group (struct vty *vty, struct bgp *bgp,
13647 enum show_group_type type, const char *group_name)
13648{
13649 struct listnode *node, *nnode;
13650 struct peer_group *group;
13651 int find = 0;
13652
13653 for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group))
13654 {
13655 switch (type)
13656 {
13657 case show_all_groups:
13658 bgp_show_one_peer_group (vty, group);
13659 break;
13660 case show_peer_group:
13661 if (group_name && (strcmp(group->name, group_name) == 0))
13662 {
13663 find = 1;
13664 bgp_show_one_peer_group (vty, group);
13665 }
13666 break;
13667 }
13668 }
13669
13670 if (type == show_peer_group && ! find)
6d9e66dc 13671 vty_out (vty, "%% No such peer-group%s", VTY_NEWLINE);
f14e6fdb
DS
13672
13673 return CMD_SUCCESS;
13674}
13675
13676static int
13677bgp_show_peer_group_vty (struct vty *vty, const char *name,
13678 enum show_group_type type, const char *group_name)
13679{
13680 struct bgp *bgp;
13681 int ret = CMD_SUCCESS;
13682
13683 if (name)
8386ac43 13684 bgp = bgp_lookup_by_name (name);
13685 else
13686 bgp = bgp_get_default ();
f14e6fdb 13687
8386ac43 13688 if (! bgp)
13689 {
13690 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
13691 return CMD_WARNING;
f14e6fdb
DS
13692 }
13693
8386ac43 13694 ret = bgp_show_peer_group (vty, bgp, type, group_name);
f14e6fdb
DS
13695
13696 return ret;
13697}
13698
13699DEFUN (show_ip_bgp_peer_groups,
13700 show_ip_bgp_peer_groups_cmd,
13701 "show ip bgp peer-group",
13702 SHOW_STR
13703 IP_STR
13704 BGP_STR
13705 "Detailed information on all BGP peer groups\n")
13706{
13707 return bgp_show_peer_group_vty (vty, NULL, show_all_groups, NULL);
13708}
13709
13710DEFUN (show_ip_bgp_instance_peer_groups,
13711 show_ip_bgp_instance_peer_groups_cmd,
8386ac43 13712 "show ip bgp " BGP_INSTANCE_CMD " peer-group",
f14e6fdb
DS
13713 SHOW_STR
13714 IP_STR
13715 BGP_STR
8386ac43 13716 BGP_INSTANCE_HELP_STR
f14e6fdb
DS
13717 "Detailed information on all BGP peer groups\n")
13718{
8386ac43 13719 return bgp_show_peer_group_vty (vty, argv[1], show_all_groups, NULL);
f14e6fdb
DS
13720}
13721
13722DEFUN (show_ip_bgp_peer_group,
13723 show_ip_bgp_peer_group_cmd,
13724 "show ip bgp peer-group WORD",
13725 SHOW_STR
13726 IP_STR
13727 BGP_STR
13728 "BGP peer-group name\n"
13729 "Detailed information on a BGP peer group\n")
13730{
13731 return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[0]);
13732}
13733
13734DEFUN (show_ip_bgp_instance_peer_group,
13735 show_ip_bgp_instance_peer_group_cmd,
8386ac43 13736 "show ip bgp " BGP_INSTANCE_CMD " peer-group WORD",
f14e6fdb
DS
13737 SHOW_STR
13738 IP_STR
13739 BGP_STR
8386ac43 13740 BGP_INSTANCE_HELP_STR
f14e6fdb
DS
13741 "BGP peer-group name\n"
13742 "Detailed information on a BGP peer group\n")
13743{
8386ac43 13744 return bgp_show_peer_group_vty (vty, argv[1], show_peer_group, argv[2]);
f14e6fdb 13745}
3f9c7369 13746
718e3744 13747/* Redistribute VTY commands. */
13748
718e3744 13749DEFUN (bgp_redistribute_ipv4,
13750 bgp_redistribute_ipv4_cmd,
e0ca5fde 13751 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
718e3744 13752 "Redistribute information from another routing protocol\n"
e0ca5fde 13753 QUAGGA_IP_REDIST_HELP_STR_BGPD)
718e3744 13754{
13755 int type;
13756
e0ca5fde
DL
13757 type = proto_redistnum (AFI_IP, argv[0]);
13758 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13759 {
13760 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13761 return CMD_WARNING;
13762 }
7c8ff89e 13763 bgp_redist_add(vty->index, AFI_IP, type, 0);
6aeb9e78 13764 return bgp_redistribute_set (vty->index, AFI_IP, type, 0);
718e3744 13765}
13766
13767DEFUN (bgp_redistribute_ipv4_rmap,
13768 bgp_redistribute_ipv4_rmap_cmd,
e0ca5fde 13769 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
718e3744 13770 "Redistribute information from another routing protocol\n"
e0ca5fde 13771 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 13772 "Route map reference\n"
13773 "Pointer to route-map entries\n")
13774{
13775 int type;
7c8ff89e 13776 struct bgp_redist *red;
718e3744 13777
e0ca5fde
DL
13778 type = proto_redistnum (AFI_IP, argv[0]);
13779 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13780 {
13781 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13782 return CMD_WARNING;
13783 }
13784
7c8ff89e
DS
13785 red = bgp_redist_add(vty->index, AFI_IP, type, 0);
13786 bgp_redistribute_rmap_set (red, argv[1]);
6aeb9e78 13787 return bgp_redistribute_set (vty->index, AFI_IP, type, 0);
718e3744 13788}
13789
13790DEFUN (bgp_redistribute_ipv4_metric,
13791 bgp_redistribute_ipv4_metric_cmd,
e0ca5fde 13792 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 13793 "Redistribute information from another routing protocol\n"
e0ca5fde 13794 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 13795 "Metric for redistributed routes\n"
13796 "Default metric\n")
13797{
13798 int type;
13799 u_int32_t metric;
7c8ff89e 13800 struct bgp_redist *red;
718e3744 13801
e0ca5fde
DL
13802 type = proto_redistnum (AFI_IP, argv[0]);
13803 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13804 {
13805 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13806 return CMD_WARNING;
13807 }
13808 VTY_GET_INTEGER ("metric", metric, argv[1]);
13809
7c8ff89e 13810 red = bgp_redist_add(vty->index, AFI_IP, type, 0);
caf958b4 13811 bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric);
6aeb9e78 13812 return bgp_redistribute_set (vty->index, AFI_IP, type, 0);
718e3744 13813}
13814
13815DEFUN (bgp_redistribute_ipv4_rmap_metric,
13816 bgp_redistribute_ipv4_rmap_metric_cmd,
e0ca5fde 13817 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 13818 "Redistribute information from another routing protocol\n"
e0ca5fde 13819 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 13820 "Route map reference\n"
13821 "Pointer to route-map entries\n"
13822 "Metric for redistributed routes\n"
13823 "Default metric\n")
13824{
13825 int type;
13826 u_int32_t metric;
7c8ff89e 13827 struct bgp_redist *red;
718e3744 13828
e0ca5fde
DL
13829 type = proto_redistnum (AFI_IP, argv[0]);
13830 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13831 {
13832 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13833 return CMD_WARNING;
13834 }
13835 VTY_GET_INTEGER ("metric", metric, argv[2]);
13836
7c8ff89e
DS
13837 red = bgp_redist_add(vty->index, AFI_IP, type, 0);
13838 bgp_redistribute_rmap_set (red, argv[1]);
caf958b4 13839 bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric);
6aeb9e78 13840 return bgp_redistribute_set (vty->index, AFI_IP, type, 0);
718e3744 13841}
13842
13843DEFUN (bgp_redistribute_ipv4_metric_rmap,
13844 bgp_redistribute_ipv4_metric_rmap_cmd,
e0ca5fde 13845 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 13846 "Redistribute information from another routing protocol\n"
e0ca5fde 13847 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 13848 "Metric for redistributed routes\n"
13849 "Default metric\n"
13850 "Route map reference\n"
13851 "Pointer to route-map entries\n")
13852{
13853 int type;
13854 u_int32_t metric;
7c8ff89e 13855 struct bgp_redist *red;
718e3744 13856
e0ca5fde
DL
13857 type = proto_redistnum (AFI_IP, argv[0]);
13858 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 13859 {
13860 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
13861 return CMD_WARNING;
13862 }
13863 VTY_GET_INTEGER ("metric", metric, argv[1]);
13864
7c8ff89e 13865 red = bgp_redist_add(vty->index, AFI_IP, type, 0);
caf958b4 13866 bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric);
7c8ff89e 13867 bgp_redistribute_rmap_set (red, argv[2]);
6aeb9e78 13868 return bgp_redistribute_set (vty->index, AFI_IP, type, 0);
718e3744 13869}
13870
7c8ff89e
DS
13871DEFUN (bgp_redistribute_ipv4_ospf,
13872 bgp_redistribute_ipv4_ospf_cmd,
7a4bb9c5 13873 "redistribute (ospf|table) <1-65535>",
7c8ff89e
DS
13874 "Redistribute information from another routing protocol\n"
13875 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13876 "Non-main Kernel Routing Table\n"
13877 "Instance ID/Table ID\n")
7c8ff89e
DS
13878{
13879 u_short instance;
7a4bb9c5 13880 u_short protocol;
7c8ff89e 13881
7a4bb9c5
DS
13882 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
13883
13884 if (strncmp(argv[0], "o", 1) == 0)
13885 protocol = ZEBRA_ROUTE_OSPF;
13886 else
13887 protocol = ZEBRA_ROUTE_TABLE;
13888
13889 bgp_redist_add(vty->index, AFI_IP, protocol, instance);
6aeb9e78 13890 return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
13891}
13892
13893DEFUN (bgp_redistribute_ipv4_ospf_rmap,
13894 bgp_redistribute_ipv4_ospf_rmap_cmd,
7a4bb9c5 13895 "redistribute (ospf|table) <1-65535> route-map WORD",
7c8ff89e
DS
13896 "Redistribute information from another routing protocol\n"
13897 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13898 "Non-main Kernel Routing Table\n"
13899 "Instance ID/Table ID\n"
7c8ff89e
DS
13900 "Route map reference\n"
13901 "Pointer to route-map entries\n")
13902{
13903 struct bgp_redist *red;
13904 u_short instance;
7a4bb9c5 13905 int protocol;
7c8ff89e 13906
7a4bb9c5
DS
13907 if (strncmp(argv[0], "o", 1) == 0)
13908 protocol = ZEBRA_ROUTE_OSPF;
13909 else
13910 protocol = ZEBRA_ROUTE_TABLE;
13911
13912 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
13913 red = bgp_redist_add(vty->index, AFI_IP, protocol, instance);
13914 bgp_redistribute_rmap_set (red, argv[2]);
6aeb9e78 13915 return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
13916}
13917
13918DEFUN (bgp_redistribute_ipv4_ospf_metric,
13919 bgp_redistribute_ipv4_ospf_metric_cmd,
7a4bb9c5 13920 "redistribute (ospf|table) <1-65535> metric <0-4294967295>",
7c8ff89e
DS
13921 "Redistribute information from another routing protocol\n"
13922 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13923 "Non-main Kernel Routing Table\n"
13924 "Instance ID/Table ID\n"
7c8ff89e
DS
13925 "Metric for redistributed routes\n"
13926 "Default metric\n")
13927{
13928 u_int32_t metric;
13929 struct bgp_redist *red;
13930 u_short instance;
7a4bb9c5 13931 int protocol;
7c8ff89e 13932
7a4bb9c5
DS
13933 if (strncmp(argv[0], "o", 1) == 0)
13934 protocol = ZEBRA_ROUTE_OSPF;
13935 else
13936 protocol = ZEBRA_ROUTE_TABLE;
7c8ff89e 13937
7a4bb9c5
DS
13938 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
13939 VTY_GET_INTEGER ("metric", metric, argv[2]);
13940
13941 red = bgp_redist_add(vty->index, AFI_IP, protocol, instance);
caf958b4 13942 bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric);
6aeb9e78 13943 return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
13944}
13945
13946DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric,
13947 bgp_redistribute_ipv4_ospf_rmap_metric_cmd,
7a4bb9c5 13948 "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>",
7c8ff89e
DS
13949 "Redistribute information from another routing protocol\n"
13950 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13951 "Non-main Kernel Routing Table\n"
13952 "Instance ID/Table ID\n"
7c8ff89e
DS
13953 "Route map reference\n"
13954 "Pointer to route-map entries\n"
13955 "Metric for redistributed routes\n"
13956 "Default metric\n")
13957{
13958 u_int32_t metric;
13959 struct bgp_redist *red;
13960 u_short instance;
7a4bb9c5 13961 int protocol;
7c8ff89e 13962
7a4bb9c5
DS
13963 if (strncmp(argv[0], "o", 1) == 0)
13964 protocol = ZEBRA_ROUTE_OSPF;
13965 else
13966 protocol = ZEBRA_ROUTE_TABLE;
7c8ff89e 13967
7a4bb9c5
DS
13968 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
13969 VTY_GET_INTEGER ("metric", metric, argv[3]);
13970
13971 red = bgp_redist_add(vty->index, AFI_IP, protocol, instance);
13972 bgp_redistribute_rmap_set (red, argv[2]);
caf958b4 13973 bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric);
6aeb9e78 13974 return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
13975}
13976
13977DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap,
13978 bgp_redistribute_ipv4_ospf_metric_rmap_cmd,
7a4bb9c5 13979 "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD",
7c8ff89e
DS
13980 "Redistribute information from another routing protocol\n"
13981 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
13982 "Non-main Kernel Routing Table\n"
13983 "Instance ID/Table ID\n"
7c8ff89e
DS
13984 "Metric for redistributed routes\n"
13985 "Default metric\n"
13986 "Route map reference\n"
13987 "Pointer to route-map entries\n")
13988{
13989 u_int32_t metric;
13990 struct bgp_redist *red;
13991 u_short instance;
7a4bb9c5 13992 int protocol;
7c8ff89e 13993
7a4bb9c5
DS
13994 if (strncmp(argv[0], "o", 1) == 0)
13995 protocol = ZEBRA_ROUTE_OSPF;
13996 else
13997 protocol = ZEBRA_ROUTE_TABLE;
7c8ff89e 13998
7a4bb9c5
DS
13999 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
14000 VTY_GET_INTEGER ("metric", metric, argv[2]);
14001
14002 red = bgp_redist_add(vty->index, AFI_IP, protocol, instance);
caf958b4 14003 bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric);
7a4bb9c5 14004 bgp_redistribute_rmap_set (red, argv[3]);
6aeb9e78 14005 return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
14006}
14007
14008DEFUN (no_bgp_redistribute_ipv4_ospf,
14009 no_bgp_redistribute_ipv4_ospf_cmd,
7a4bb9c5 14010 "no redistribute (ospf|table) <1-65535>",
7c8ff89e
DS
14011 NO_STR
14012 "Redistribute information from another routing protocol\n"
14013 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
14014 "Non-main Kernel Routing Table\n"
14015 "Instance ID/Table ID\n")
7c8ff89e
DS
14016{
14017 u_short instance;
7a4bb9c5
DS
14018 int protocol;
14019
14020 if (strncmp(argv[0], "o", 1) == 0)
14021 protocol = ZEBRA_ROUTE_OSPF;
14022 else
14023 protocol = ZEBRA_ROUTE_TABLE;
7c8ff89e 14024
7a4bb9c5
DS
14025 VTY_GET_INTEGER ("Instance ID", instance, argv[1]);
14026 return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance);
7c8ff89e
DS
14027}
14028
14029ALIAS (no_bgp_redistribute_ipv4_ospf,
14030 no_bgp_redistribute_ipv4_ospf_rmap_cmd,
7a4bb9c5 14031 "no redistribute (ospf|table) <1-65535> route-map WORD",
7c8ff89e
DS
14032 NO_STR
14033 "Redistribute information from another routing protocol\n"
14034 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
14035 "Non-main Kernel Routing Table\n"
14036 "Instance ID/Table ID\n"
7c8ff89e
DS
14037 "Route map reference\n"
14038 "Pointer to route-map entries\n")
14039
14040ALIAS (no_bgp_redistribute_ipv4_ospf,
14041 no_bgp_redistribute_ipv4_ospf_metric_cmd,
7a4bb9c5 14042 "no redistribute (ospf|table) <1-65535> metric <0-4294967295>",
7c8ff89e
DS
14043 NO_STR
14044 "Redistribute information from another routing protocol\n"
14045 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
14046 "Non-main Kernel Routing Table\n"
14047 "Instance ID/Table ID\n"
7c8ff89e
DS
14048 "Metric for redistributed routes\n"
14049 "Default metric\n")
14050
14051ALIAS (no_bgp_redistribute_ipv4_ospf,
14052 no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd,
7a4bb9c5 14053 "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>",
7c8ff89e
DS
14054 NO_STR
14055 "Redistribute information from another routing protocol\n"
14056 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
14057 "Non-main Kernel Routing Table\n"
14058 "Instance ID/Table ID\n"
7c8ff89e
DS
14059 "Route map reference\n"
14060 "Pointer to route-map entries\n"
14061 "Metric for redistributed routes\n"
14062 "Default metric\n")
14063
14064ALIAS (no_bgp_redistribute_ipv4_ospf,
14065 no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd,
7a4bb9c5 14066 "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD",
7c8ff89e
DS
14067 NO_STR
14068 "Redistribute information from another routing protocol\n"
14069 "Open Shortest Path First (OSPFv2)\n"
2d627ff5
DS
14070 "Non-main Kernel Routing Table\n"
14071 "Instance ID/Table ID\n"
7c8ff89e
DS
14072 "Metric for redistributed routes\n"
14073 "Default metric\n"
14074 "Route map reference\n"
14075 "Pointer to route-map entries\n")
14076
718e3744 14077DEFUN (no_bgp_redistribute_ipv4,
14078 no_bgp_redistribute_ipv4_cmd,
e0ca5fde 14079 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
718e3744 14080 NO_STR
14081 "Redistribute information from another routing protocol\n"
e0ca5fde 14082 QUAGGA_IP_REDIST_HELP_STR_BGPD)
718e3744 14083{
14084 int type;
14085
e0ca5fde
DL
14086 type = proto_redistnum (AFI_IP, argv[0]);
14087 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14088 {
14089 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14090 return CMD_WARNING;
14091 }
7c8ff89e 14092 return bgp_redistribute_unset (vty->index, AFI_IP, type, 0);
718e3744 14093}
14094
503006bc 14095ALIAS (no_bgp_redistribute_ipv4,
718e3744 14096 no_bgp_redistribute_ipv4_rmap_cmd,
e0ca5fde 14097 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
718e3744 14098 NO_STR
14099 "Redistribute information from another routing protocol\n"
e0ca5fde 14100 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 14101 "Route map reference\n"
14102 "Pointer to route-map entries\n")
718e3744 14103
503006bc 14104ALIAS (no_bgp_redistribute_ipv4,
718e3744 14105 no_bgp_redistribute_ipv4_metric_cmd,
e0ca5fde 14106 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 14107 NO_STR
14108 "Redistribute information from another routing protocol\n"
e0ca5fde 14109 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 14110 "Metric for redistributed routes\n"
14111 "Default metric\n")
718e3744 14112
503006bc 14113ALIAS (no_bgp_redistribute_ipv4,
718e3744 14114 no_bgp_redistribute_ipv4_rmap_metric_cmd,
e0ca5fde 14115 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 14116 NO_STR
14117 "Redistribute information from another routing protocol\n"
e0ca5fde 14118 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 14119 "Route map reference\n"
14120 "Pointer to route-map entries\n"
14121 "Metric for redistributed routes\n"
14122 "Default metric\n")
718e3744 14123
503006bc 14124ALIAS (no_bgp_redistribute_ipv4,
718e3744 14125 no_bgp_redistribute_ipv4_metric_rmap_cmd,
e0ca5fde 14126 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 14127 NO_STR
14128 "Redistribute information from another routing protocol\n"
e0ca5fde 14129 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 14130 "Metric for redistributed routes\n"
14131 "Default metric\n"
14132 "Route map reference\n"
14133 "Pointer to route-map entries\n")
6b0655a2 14134
718e3744 14135#ifdef HAVE_IPV6
14136DEFUN (bgp_redistribute_ipv6,
14137 bgp_redistribute_ipv6_cmd,
e0ca5fde 14138 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
718e3744 14139 "Redistribute information from another routing protocol\n"
e0ca5fde 14140 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
718e3744 14141{
14142 int type;
14143
e0ca5fde
DL
14144 type = proto_redistnum (AFI_IP6, argv[0]);
14145 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14146 {
14147 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14148 return CMD_WARNING;
14149 }
14150
7c8ff89e 14151 bgp_redist_add(vty->index, AFI_IP6, type, 0);
6aeb9e78 14152 return bgp_redistribute_set (vty->index, AFI_IP6, type, 0);
718e3744 14153}
14154
14155DEFUN (bgp_redistribute_ipv6_rmap,
14156 bgp_redistribute_ipv6_rmap_cmd,
e0ca5fde 14157 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
718e3744 14158 "Redistribute information from another routing protocol\n"
e0ca5fde 14159 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14160 "Route map reference\n"
14161 "Pointer to route-map entries\n")
14162{
14163 int type;
7c8ff89e 14164 struct bgp_redist *red;
718e3744 14165
e0ca5fde
DL
14166 type = proto_redistnum (AFI_IP6, argv[0]);
14167 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14168 {
14169 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14170 return CMD_WARNING;
14171 }
14172
7c8ff89e
DS
14173 red = bgp_redist_add(vty->index, AFI_IP6, type, 0);
14174 bgp_redistribute_rmap_set (red, argv[1]);
6aeb9e78 14175 return bgp_redistribute_set (vty->index, AFI_IP6, type, 0);
718e3744 14176}
14177
14178DEFUN (bgp_redistribute_ipv6_metric,
14179 bgp_redistribute_ipv6_metric_cmd,
e0ca5fde 14180 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 14181 "Redistribute information from another routing protocol\n"
e0ca5fde 14182 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14183 "Metric for redistributed routes\n"
14184 "Default metric\n")
14185{
14186 int type;
14187 u_int32_t metric;
7c8ff89e 14188 struct bgp_redist *red;
718e3744 14189
e0ca5fde
DL
14190 type = proto_redistnum (AFI_IP6, argv[0]);
14191 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14192 {
14193 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14194 return CMD_WARNING;
14195 }
14196 VTY_GET_INTEGER ("metric", metric, argv[1]);
14197
7c8ff89e 14198 red = bgp_redist_add(vty->index, AFI_IP6, type, 0);
caf958b4 14199 bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric);
6aeb9e78 14200 return bgp_redistribute_set (vty->index, AFI_IP6, type, 0);
718e3744 14201}
14202
14203DEFUN (bgp_redistribute_ipv6_rmap_metric,
14204 bgp_redistribute_ipv6_rmap_metric_cmd,
e0ca5fde 14205 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 14206 "Redistribute information from another routing protocol\n"
e0ca5fde 14207 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14208 "Route map reference\n"
14209 "Pointer to route-map entries\n"
14210 "Metric for redistributed routes\n"
14211 "Default metric\n")
14212{
14213 int type;
14214 u_int32_t metric;
7c8ff89e 14215 struct bgp_redist *red;
718e3744 14216
e0ca5fde
DL
14217 type = proto_redistnum (AFI_IP6, argv[0]);
14218 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14219 {
14220 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14221 return CMD_WARNING;
14222 }
14223 VTY_GET_INTEGER ("metric", metric, argv[2]);
14224
7c8ff89e
DS
14225 red = bgp_redist_add(vty->index, AFI_IP6, type, 0);
14226 bgp_redistribute_rmap_set (red, argv[1]);
caf958b4 14227 bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric);
6aeb9e78 14228 return bgp_redistribute_set (vty->index, AFI_IP6, type, 0);
718e3744 14229}
14230
14231DEFUN (bgp_redistribute_ipv6_metric_rmap,
14232 bgp_redistribute_ipv6_metric_rmap_cmd,
e0ca5fde 14233 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 14234 "Redistribute information from another routing protocol\n"
e0ca5fde 14235 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14236 "Metric for redistributed routes\n"
14237 "Default metric\n"
14238 "Route map reference\n"
14239 "Pointer to route-map entries\n")
14240{
14241 int type;
14242 u_int32_t metric;
7c8ff89e 14243 struct bgp_redist *red;
718e3744 14244
e0ca5fde
DL
14245 type = proto_redistnum (AFI_IP6, argv[0]);
14246 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14247 {
14248 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14249 return CMD_WARNING;
14250 }
14251 VTY_GET_INTEGER ("metric", metric, argv[1]);
14252
7c8ff89e 14253 red = bgp_redist_add(vty->index, AFI_IP6, type, 0);
caf958b4 14254 bgp_redistribute_metric_set(vty->index, red, AFI_IP6, SAFI_UNICAST, metric);
7c8ff89e 14255 bgp_redistribute_rmap_set (red, argv[2]);
6aeb9e78 14256 return bgp_redistribute_set (vty->index, AFI_IP6, type, 0);
718e3744 14257}
14258
14259DEFUN (no_bgp_redistribute_ipv6,
14260 no_bgp_redistribute_ipv6_cmd,
e0ca5fde 14261 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
718e3744 14262 NO_STR
14263 "Redistribute information from another routing protocol\n"
e0ca5fde 14264 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
718e3744 14265{
14266 int type;
14267
e0ca5fde
DL
14268 type = proto_redistnum (AFI_IP6, argv[0]);
14269 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 14270 {
14271 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
14272 return CMD_WARNING;
14273 }
14274
7c8ff89e 14275 return bgp_redistribute_unset (vty->index, AFI_IP6, type, 0);
718e3744 14276}
14277
503006bc 14278ALIAS (no_bgp_redistribute_ipv6,
718e3744 14279 no_bgp_redistribute_ipv6_rmap_cmd,
e0ca5fde 14280 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
718e3744 14281 NO_STR
14282 "Redistribute information from another routing protocol\n"
e0ca5fde 14283 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14284 "Route map reference\n"
14285 "Pointer to route-map entries\n")
718e3744 14286
503006bc 14287ALIAS (no_bgp_redistribute_ipv6,
718e3744 14288 no_bgp_redistribute_ipv6_metric_cmd,
e0ca5fde 14289 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 14290 NO_STR
14291 "Redistribute information from another routing protocol\n"
e0ca5fde 14292 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14293 "Metric for redistributed routes\n"
14294 "Default metric\n")
718e3744 14295
503006bc 14296ALIAS (no_bgp_redistribute_ipv6,
718e3744 14297 no_bgp_redistribute_ipv6_rmap_metric_cmd,
e0ca5fde 14298 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 14299 NO_STR
14300 "Redistribute information from another routing protocol\n"
e0ca5fde 14301 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14302 "Route map reference\n"
14303 "Pointer to route-map entries\n"
14304 "Metric for redistributed routes\n"
14305 "Default metric\n")
718e3744 14306
503006bc 14307ALIAS (no_bgp_redistribute_ipv6,
718e3744 14308 no_bgp_redistribute_ipv6_metric_rmap_cmd,
e0ca5fde 14309 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 14310 NO_STR
14311 "Redistribute information from another routing protocol\n"
e0ca5fde 14312 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 14313 "Metric for redistributed routes\n"
14314 "Default metric\n"
14315 "Route map reference\n"
14316 "Pointer to route-map entries\n")
14317#endif /* HAVE_IPV6 */
6b0655a2 14318
718e3744 14319int
14320bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
14321 safi_t safi, int *write)
14322{
14323 int i;
718e3744 14324
14325 /* Unicast redistribution only. */
14326 if (safi != SAFI_UNICAST)
14327 return 0;
14328
14329 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
14330 {
14331 /* Redistribute BGP does not make sense. */
7c8ff89e 14332 if (i != ZEBRA_ROUTE_BGP)
718e3744 14333 {
7c8ff89e
DS
14334 struct list *red_list;
14335 struct listnode *node;
14336 struct bgp_redist *red;
718e3744 14337
7c8ff89e
DS
14338 red_list = bgp->redist[afi][i];
14339 if (!red_list)
14340 continue;
718e3744 14341
7c8ff89e
DS
14342 for (ALL_LIST_ELEMENTS_RO(red_list, node, red))
14343 {
14344 /* Display "address-family" when it is not yet diplayed. */
14345 bgp_config_write_family_header (vty, afi, safi, write);
14346
14347 /* "redistribute" configuration. */
0b960b4d 14348 vty_out (vty, " redistribute %s", zebra_route_string(i));
7c8ff89e
DS
14349 if (red->instance)
14350 vty_out (vty, " %d", red->instance);
14351 if (red->redist_metric_flag)
14352 vty_out (vty, " metric %u", red->redist_metric);
14353 if (red->rmap.name)
14354 vty_out (vty, " route-map %s", red->rmap.name);
14355 vty_out (vty, "%s", VTY_NEWLINE);
14356 }
718e3744 14357 }
14358 }
14359 return *write;
14360}
6b0655a2 14361
718e3744 14362/* BGP node structure. */
7fc626de 14363static struct cmd_node bgp_node =
718e3744 14364{
14365 BGP_NODE,
14366 "%s(config-router)# ",
14367 1,
14368};
14369
7fc626de 14370static struct cmd_node bgp_ipv4_unicast_node =
718e3744 14371{
14372 BGP_IPV4_NODE,
14373 "%s(config-router-af)# ",
14374 1,
14375};
14376
7fc626de 14377static struct cmd_node bgp_ipv4_multicast_node =
718e3744 14378{
14379 BGP_IPV4M_NODE,
14380 "%s(config-router-af)# ",
14381 1,
14382};
14383
7fc626de 14384static struct cmd_node bgp_ipv6_unicast_node =
718e3744 14385{
14386 BGP_IPV6_NODE,
14387 "%s(config-router-af)# ",
14388 1,
14389};
14390
7fc626de 14391static struct cmd_node bgp_ipv6_multicast_node =
25ffbdc1 14392{
14393 BGP_IPV6M_NODE,
14394 "%s(config-router-af)# ",
14395 1,
14396};
14397
7fc626de 14398static struct cmd_node bgp_vpnv4_node =
718e3744 14399{
14400 BGP_VPNV4_NODE,
14401 "%s(config-router-af)# ",
14402 1
14403};
6b0655a2 14404
8ecd3266 14405static struct cmd_node bgp_vpnv6_node =
14406{
14407 BGP_VPNV6_NODE,
14408 "%s(config-router-af-vpnv6)# ",
14409 1
14410};
14411
8b1fb8be
LB
14412static struct cmd_node bgp_encap_node =
14413{
14414 BGP_ENCAP_NODE,
14415 "%s(config-router-af-encap)# ",
14416 1
14417};
14418
14419static struct cmd_node bgp_encapv6_node =
14420{
14421 BGP_ENCAPV6_NODE,
14422 "%s(config-router-af-encapv6)# ",
14423 1
14424};
14425
1f8ae70b 14426static void community_list_vty (void);
14427
718e3744 14428void
94f2b392 14429bgp_vty_init (void)
718e3744 14430{
718e3744 14431 /* Install bgp top node. */
14432 install_node (&bgp_node, bgp_config_write);
14433 install_node (&bgp_ipv4_unicast_node, NULL);
14434 install_node (&bgp_ipv4_multicast_node, NULL);
14435 install_node (&bgp_ipv6_unicast_node, NULL);
25ffbdc1 14436 install_node (&bgp_ipv6_multicast_node, NULL);
718e3744 14437 install_node (&bgp_vpnv4_node, NULL);
8ecd3266 14438 install_node (&bgp_vpnv6_node, NULL);
8b1fb8be
LB
14439 install_node (&bgp_encap_node, NULL);
14440 install_node (&bgp_encapv6_node, NULL);
718e3744 14441
14442 /* Install default VTY commands to new nodes. */
14443 install_default (BGP_NODE);
14444 install_default (BGP_IPV4_NODE);
14445 install_default (BGP_IPV4M_NODE);
14446 install_default (BGP_IPV6_NODE);
25ffbdc1 14447 install_default (BGP_IPV6M_NODE);
718e3744 14448 install_default (BGP_VPNV4_NODE);
8ecd3266 14449 install_default (BGP_VPNV6_NODE);
8b1fb8be
LB
14450 install_default (BGP_ENCAP_NODE);
14451 install_default (BGP_ENCAPV6_NODE);
718e3744 14452
14453 /* "bgp multiple-instance" commands. */
14454 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
14455 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
14456
14457 /* "bgp config-type" commands. */
14458 install_element (CONFIG_NODE, &bgp_config_type_cmd);
813d4307 14459 install_element (CONFIG_NODE, &no_bgp_config_type_val_cmd);
718e3744 14460
5fe9f963 14461 /* bgp route-map delay-timer commands. */
14462 install_element (CONFIG_NODE, &bgp_set_route_map_delay_timer_cmd);
14463 install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_cmd);
14464 install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_val_cmd);
14465
718e3744 14466 /* Dummy commands (Currently not supported) */
14467 install_element (BGP_NODE, &no_synchronization_cmd);
14468 install_element (BGP_NODE, &no_auto_summary_cmd);
14469
14470 /* "router bgp" commands. */
14471 install_element (CONFIG_NODE, &router_bgp_cmd);
6aeb9e78 14472 install_element (CONFIG_NODE, &router_bgp_instance_cmd);
2385a876 14473 install_element (CONFIG_NODE, &router_bgp_noasn_cmd);
718e3744 14474
14475 /* "no router bgp" commands. */
14476 install_element (CONFIG_NODE, &no_router_bgp_cmd);
6aeb9e78 14477 install_element (CONFIG_NODE, &no_router_bgp_instance_cmd);
7fb21a9f 14478 install_element (CONFIG_NODE, &no_router_bgp_noasn_cmd);
718e3744 14479
14480 /* "bgp router-id" commands. */
14481 install_element (BGP_NODE, &bgp_router_id_cmd);
14482 install_element (BGP_NODE, &no_bgp_router_id_cmd);
14483 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
14484
14485 /* "bgp cluster-id" commands. */
14486 install_element (BGP_NODE, &bgp_cluster_id_cmd);
14487 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
14488 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
813d4307
DW
14489 install_element (BGP_NODE, &no_bgp_cluster_id_ip_cmd);
14490 install_element (BGP_NODE, &no_bgp_cluster_id_decimal_cmd);
718e3744 14491
14492 /* "bgp confederation" commands. */
14493 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
14494 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
14495 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
14496
14497 /* "bgp confederation peers" commands. */
14498 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
14499 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
14500
abc920f8
DS
14501 /* bgp max-med command */
14502 install_element (BGP_NODE, &bgp_maxmed_admin_cmd);
14503 install_element (BGP_NODE, &no_bgp_maxmed_admin_cmd);
14504 install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd);
14505 install_element (BGP_NODE, &no_bgp_maxmed_admin_medv_cmd);
14506 install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd);
14507 install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd);
14508 install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_cmd);
14509 install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd);
14510 install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_medv_cmd);
14511
907f92c8
DS
14512 /* bgp disable-ebgp-connected-nh-check */
14513 install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd);
14514 install_element (BGP_NODE, &no_bgp_disable_connected_route_check_cmd);
14515
f188f2c4
DS
14516 /* bgp update-delay command */
14517 install_element (BGP_NODE, &bgp_update_delay_cmd);
14518 install_element (BGP_NODE, &no_bgp_update_delay_cmd);
14519 install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd);
14520 install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd);
14521
cb1faec9
DS
14522 install_element (BGP_NODE, &bgp_wpkt_quanta_cmd);
14523 install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd);
14524
3f9c7369
DS
14525 install_element (BGP_NODE, &bgp_coalesce_time_cmd);
14526 install_element (BGP_NODE, &no_bgp_coalesce_time_cmd);
14527
165b5fff
JB
14528 /* "maximum-paths" commands. */
14529 install_element (BGP_NODE, &bgp_maxpaths_cmd);
14530 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
14531 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
14532 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
14533 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
14534 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
431aa9f9
DS
14535 install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd);
14536 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd);
14537 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd);
165b5fff 14538 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
5e242b0d 14539 install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd);
165b5fff
JB
14540 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
14541 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
5e242b0d 14542 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 14543 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
5e242b0d 14544 install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 14545 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
5e242b0d 14546 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 14547 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
431aa9f9 14548 install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd);
5e242b0d 14549 install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd);
431aa9f9
DS
14550 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd);
14551 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
5e242b0d 14552 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 14553
718e3744 14554 /* "timers bgp" commands. */
14555 install_element (BGP_NODE, &bgp_timers_cmd);
14556 install_element (BGP_NODE, &no_bgp_timers_cmd);
14557 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
14558
5fe9f963 14559 /* route-map delay-timer commands - per instance for backwards compat. */
518f0eb1
DS
14560 install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd);
14561 install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd);
f414725f 14562 install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_val_cmd);
518f0eb1 14563
718e3744 14564 /* "bgp client-to-client reflection" commands */
14565 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
14566 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
14567
14568 /* "bgp always-compare-med" commands */
14569 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
14570 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
14571
14572 /* "bgp deterministic-med" commands */
14573 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
14574 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
538621f2 14575
538621f2 14576 /* "bgp graceful-restart" commands */
14577 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
14578 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
93406d87 14579 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
14580 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
14581 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
eb6f1b41
PG
14582 install_element (BGP_NODE, &bgp_graceful_restart_restart_time_cmd);
14583 install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_cmd);
14584 install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_val_cmd);
718e3744 14585
14586 /* "bgp fast-external-failover" commands */
14587 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
14588 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
14589
14590 /* "bgp enforce-first-as" commands */
14591 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
14592 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
14593
14594 /* "bgp bestpath compare-routerid" commands */
14595 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
14596 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
14597
14598 /* "bgp bestpath as-path ignore" commands */
14599 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
14600 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
14601
6811845b 14602 /* "bgp bestpath as-path confed" commands */
14603 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
14604 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
14605
2fdd455c
PM
14606 /* "bgp bestpath as-path multipath-relax" commands */
14607 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
14608 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
14609
848973c7 14610 /* "bgp log-neighbor-changes" commands */
14611 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
14612 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
14613
718e3744 14614 /* "bgp bestpath med" commands */
14615 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
14616 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
14617 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
14618 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
14619 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
14620 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
14621
14622 /* "no bgp default ipv4-unicast" commands. */
14623 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
14624 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
14625
14626 /* "bgp network import-check" commands. */
14627 install_element (BGP_NODE, &bgp_network_import_check_cmd);
8233ef81 14628 install_element (BGP_NODE, &bgp_network_import_check_exact_cmd);
718e3744 14629 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
14630
14631 /* "bgp default local-preference" commands. */
14632 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
14633 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
14634 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
14635
04b6bdc0
DW
14636 /* bgp default show-hostname */
14637 install_element (BGP_NODE, &bgp_default_show_hostname_cmd);
14638 install_element (BGP_NODE, &no_bgp_default_show_hostname_cmd);
14639
3f9c7369
DS
14640 /* "bgp default subgroup-pkt-queue-max" commands. */
14641 install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd);
14642 install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd);
813d4307 14643 install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_val_cmd);
3f9c7369 14644
8bd9d948
DS
14645 /* bgp ibgp-allow-policy-mods command */
14646 install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd);
14647 install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd);
14648
f14e6fdb
DS
14649 /* "bgp listen limit" commands. */
14650 install_element (BGP_NODE, &bgp_listen_limit_cmd);
14651 install_element (BGP_NODE, &no_bgp_listen_limit_cmd);
813d4307 14652 install_element (BGP_NODE, &no_bgp_listen_limit_val_cmd);
f14e6fdb
DS
14653
14654 /* "bgp listen range" commands. */
14655 install_element (BGP_NODE, &bgp_listen_range_cmd);
14656 install_element (BGP_NODE, &no_bgp_listen_range_cmd);
14657
718e3744 14658 /* "neighbor remote-as" commands. */
14659 install_element (BGP_NODE, &neighbor_remote_as_cmd);
a80beece 14660 install_element (BGP_NODE, &neighbor_interface_config_cmd);
4c48cf63
DW
14661 install_element (BGP_NODE, &neighbor_interface_config_v6only_cmd);
14662 install_element (BGP_NODE, &neighbor_interface_config_peergroup_cmd);
14663 install_element (BGP_NODE, &neighbor_interface_config_v6only_peergroup_cmd);
b3a39dc5
DD
14664 install_element (BGP_NODE, &neighbor_interface_config_remote_as_cmd);
14665 install_element (BGP_NODE, &neighbor_interface_v6only_config_remote_as_cmd);
718e3744 14666 install_element (BGP_NODE, &no_neighbor_cmd);
14667 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
a80beece 14668 install_element (BGP_NODE, &no_neighbor_interface_config_cmd);
4c48cf63
DW
14669 install_element (BGP_NODE, &no_neighbor_interface_config_v6only_cmd);
14670 install_element (BGP_NODE, &no_neighbor_interface_config_peergroup_cmd);
14671 install_element (BGP_NODE, &no_neighbor_interface_config_v6only_peergroup_cmd);
b3a39dc5
DD
14672 install_element (BGP_NODE, &no_neighbor_interface_config_remote_as_cmd);
14673 install_element (BGP_NODE, &no_neighbor_interface_config_v6only_remote_as_cmd);
718e3744 14674
14675 /* "neighbor peer-group" commands. */
14676 install_element (BGP_NODE, &neighbor_peer_group_cmd);
14677 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
a80beece 14678 install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd);
718e3744 14679
14680 /* "neighbor local-as" commands. */
14681 install_element (BGP_NODE, &neighbor_local_as_cmd);
14682 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
9d3f9705 14683 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
718e3744 14684 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
14685 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
14686 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
9d3f9705 14687 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
718e3744 14688
3f9c7369
DS
14689 /* "neighbor solo" commands. */
14690 install_element (BGP_NODE, &neighbor_solo_cmd);
14691 install_element (BGP_NODE, &no_neighbor_solo_cmd);
14692
0df7c91f
PJ
14693 /* "neighbor password" commands. */
14694 install_element (BGP_NODE, &neighbor_password_cmd);
14695 install_element (BGP_NODE, &no_neighbor_password_cmd);
813d4307 14696 install_element (BGP_NODE, &no_neighbor_password_val_cmd);
0df7c91f 14697
718e3744 14698 /* "neighbor activate" commands. */
14699 install_element (BGP_NODE, &neighbor_activate_cmd);
14700 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
14701 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
14702 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
25ffbdc1 14703 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
718e3744 14704 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
8ecd3266 14705 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
8b1fb8be
LB
14706 install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd);
14707 install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd);
718e3744 14708
14709 /* "no neighbor activate" commands. */
14710 install_element (BGP_NODE, &no_neighbor_activate_cmd);
14711 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
14712 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
14713 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
25ffbdc1 14714 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
718e3744 14715 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
8ecd3266 14716 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
8b1fb8be
LB
14717 install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd);
14718 install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd);
718e3744 14719
c8560b44
DW
14720 /* "neighbor peer-group" set commands.
14721 * Long term we should only accept this command under BGP_NODE and not all of
14722 * the afi/safi sub-contexts. For now though we need to accept it for backwards
14723 * compatibility. This changed when we stopped requiring that peers be assigned
14724 * to their peer-group under each address-family sub-context.
14725 */
718e3744 14726 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
14727 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
14728 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
14729 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
25ffbdc1 14730 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
a58545bb 14731 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
8ecd3266 14732 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
8b1fb8be
LB
14733 install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd);
14734 install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd);
c8560b44 14735
718e3744 14736 /* "no neighbor peer-group unset" commands. */
14737 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
14738 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
14739 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
14740 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
25ffbdc1 14741 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
a58545bb 14742 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
8ecd3266 14743 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
8b1fb8be
LB
14744 install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd);
14745 install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd);
a58545bb 14746
718e3744 14747 /* "neighbor softreconfiguration inbound" commands.*/
14748 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
14749 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
14750 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
14751 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
14752 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
14753 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
14754 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
14755 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
25ffbdc1 14756 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
14757 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
a58545bb 14758 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
14759 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
8ecd3266 14760 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
14761 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
8b1fb8be
LB
14762 install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd);
14763 install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd);
14764 install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd);
14765 install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
718e3744 14766
14767 /* "neighbor attribute-unchanged" commands. */
14768 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
14769 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
14770 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
14771 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
14772 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
14773 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
14774 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
14775 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
14776 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
14777 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
14778 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
14779 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
14780 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
14781 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
14782 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
14783 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
14784 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
14785 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
14786 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
14787 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
14788 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
14789 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
14790 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
14791 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
14792 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
14793 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
14794 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
14795 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
14796 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
14797 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
14798 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
14799 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
14800 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
14801 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
14802 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
14803 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
14804 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
14805 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
14806 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
14807 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
14808 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
14809 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
14810 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
14811 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
14812 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
14813 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
14814 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
14815 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
14816 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
14817 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
14818 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
14819 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
14820 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
14821 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
14822 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
14823 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
14824 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
14825 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
14826 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
14827 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
14828 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
14829 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
14830 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
14831 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
14832 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
14833 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
14834 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
14835 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
14836 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
14837 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
14838 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
14839 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
14840 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
14841 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
14842 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
14843 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
14844 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
14845 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
14846 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
14847 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
14848 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
14849 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
14850 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
14851 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
14852 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
14853 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
14854 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
14855 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
25ffbdc1 14856 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
14857 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
14858 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
14859 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
14860 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
14861 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
14862 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
14863 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
14864 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
14865 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
14866 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
14867 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
14868 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
14869 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
14870 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
14871 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
14872 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
14873 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
14874 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
14875 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
14876 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
14877 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
718e3744 14878 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
14879 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
14880 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
14881 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
14882 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
14883 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
14884 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
14885 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
14886 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
14887 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
14888 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
14889 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
14890 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
14891 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
14892 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
14893 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
14894 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
14895 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
14896 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
14897 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
14898 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
14899 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
8ecd3266 14900 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
14901 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
14902 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
14903 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
14904 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
14905 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
14906 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
14907 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
14908 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
14909 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
14910 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
14911 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
14912 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
14913 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
14914 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
14915 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
14916 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
14917 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
14918 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
14919 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
14920 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
14921 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
14922
8b1fb8be
LB
14923 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd);
14924 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd);
14925 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd);
14926 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd);
14927 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd);
14928 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd);
14929 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd);
14930 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd);
14931 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd);
14932 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd);
14933 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd);
14934 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd);
14935 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd);
14936 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd);
14937 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd);
14938 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd);
14939 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd);
14940 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd);
14941 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd);
14942 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd);
14943 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd);
14944 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd);
14945
14946 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd);
14947 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd);
14948 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd);
14949 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd);
14950 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd);
14951 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd);
14952 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd);
14953 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd);
14954 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd);
14955 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd);
14956 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd);
14957 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd);
14958 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
14959 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
14960 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
14961 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
14962 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
14963 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
14964 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
14965 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
14966 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
14967 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
718e3744 14968
fee0f4c6 14969 /* "nexthop-local unchanged" commands */
14970 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
14971 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
14972
718e3744 14973 /* "neighbor next-hop-self" commands. */
14974 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
14975 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
14976 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
14977 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
14978 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
14979 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
14980 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
14981 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
25ffbdc1 14982 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
14983 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
718e3744 14984 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
14985 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
8ecd3266 14986 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
14987 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
8b1fb8be
LB
14988 install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd);
14989 install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd);
14990 install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd);
14991 install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd);
718e3744 14992
a538debe
DS
14993 /* "neighbor next-hop-self force" commands. */
14994 install_element (BGP_NODE, &neighbor_nexthop_self_force_cmd);
14995 install_element (BGP_NODE, &no_neighbor_nexthop_self_force_cmd);
14996 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_force_cmd);
14997 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_force_cmd);
14998 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_force_cmd);
14999 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_force_cmd);
15000 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_force_cmd);
15001 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_force_cmd);
15002 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_force_cmd);
15003 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_force_cmd);
15004 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_force_cmd);
15005 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_force_cmd);
8ecd3266 15006 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_force_cmd);
15007 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_force_cmd);
a538debe 15008
c7122e14
DS
15009 /* "neighbor as-override" commands. */
15010 install_element (BGP_NODE, &neighbor_as_override_cmd);
15011 install_element (BGP_NODE, &no_neighbor_as_override_cmd);
15012 install_element (BGP_IPV4_NODE, &neighbor_as_override_cmd);
15013 install_element (BGP_IPV4_NODE, &no_neighbor_as_override_cmd);
15014 install_element (BGP_IPV4M_NODE, &neighbor_as_override_cmd);
15015 install_element (BGP_IPV4M_NODE, &no_neighbor_as_override_cmd);
15016 install_element (BGP_IPV6_NODE, &neighbor_as_override_cmd);
15017 install_element (BGP_IPV6_NODE, &no_neighbor_as_override_cmd);
15018 install_element (BGP_IPV6M_NODE, &neighbor_as_override_cmd);
15019 install_element (BGP_IPV6M_NODE, &no_neighbor_as_override_cmd);
15020 install_element (BGP_VPNV4_NODE, &neighbor_as_override_cmd);
15021 install_element (BGP_VPNV4_NODE, &no_neighbor_as_override_cmd);
8ecd3266 15022 install_element (BGP_VPNV6_NODE, &neighbor_as_override_cmd);
15023 install_element (BGP_VPNV6_NODE, &no_neighbor_as_override_cmd);
c7122e14 15024
718e3744 15025 /* "neighbor remove-private-AS" commands. */
15026 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
15027 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
15028 install_element (BGP_NODE, &neighbor_remove_private_as_all_cmd);
15029 install_element (BGP_NODE, &no_neighbor_remove_private_as_all_cmd);
15030 install_element (BGP_NODE, &neighbor_remove_private_as_replace_as_cmd);
15031 install_element (BGP_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
15032 install_element (BGP_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
15033 install_element (BGP_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
718e3744 15034 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
15035 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
15036 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_cmd);
15037 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_cmd);
15038 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_replace_as_cmd);
15039 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
15040 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
15041 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
718e3744 15042 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
15043 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
15044 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_cmd);
15045 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_cmd);
15046 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_replace_as_cmd);
15047 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
15048 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
15049 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
718e3744 15050 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
15051 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
15052 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_cmd);
15053 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_cmd);
15054 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_replace_as_cmd);
15055 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
15056 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
15057 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
25ffbdc1 15058 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
15059 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
15060 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_cmd);
15061 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_cmd);
15062 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_replace_as_cmd);
15063 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
15064 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
15065 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
718e3744 15066 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
15067 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
5000f21c
DS
15068 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_cmd);
15069 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_cmd);
15070 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_replace_as_cmd);
15071 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
15072 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
15073 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
8ecd3266 15074 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
15075 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
15076 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_cmd);
15077 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_cmd);
15078 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_replace_as_cmd);
15079 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd);
15080 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd);
15081 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd);
8b1fb8be
LB
15082 install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd);
15083 install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd);
15084 install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd);
15085 install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd);
718e3744 15086
15087 /* "neighbor send-community" commands.*/
15088 install_element (BGP_NODE, &neighbor_send_community_cmd);
15089 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
15090 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
15091 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
15092 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
15093 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
15094 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
15095 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
15096 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
15097 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
15098 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
15099 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
15100 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
15101 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
15102 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
15103 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
25ffbdc1 15104 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
15105 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
15106 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
15107 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
718e3744 15108 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
15109 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
15110 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
15111 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
8ecd3266 15112 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
15113 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
15114 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
15115 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
8b1fb8be
LB
15116 install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd);
15117 install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd);
15118 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd);
15119 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd);
15120 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd);
15121 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd);
15122 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd);
15123 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd);
718e3744 15124
15125 /* "neighbor route-reflector" commands.*/
15126 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
15127 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
15128 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
15129 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
15130 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
15131 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
15132 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
15133 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
25ffbdc1 15134 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
15135 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
718e3744 15136 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
15137 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
8ecd3266 15138 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
15139 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
8b1fb8be
LB
15140 install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd);
15141 install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd);
15142 install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd);
15143 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd);
718e3744 15144
15145 /* "neighbor route-server" commands.*/
15146 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
15147 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
15148 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
15149 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
15150 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
15151 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
15152 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
15153 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
25ffbdc1 15154 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
15155 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
718e3744 15156 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
15157 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
8ecd3266 15158 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
15159 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
8b1fb8be
LB
15160 install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd);
15161 install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd);
15162 install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd);
15163 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd);
718e3744 15164
adbac85e
DW
15165 /* "neighbor addpath-tx-all-paths" commands.*/
15166 install_element (BGP_NODE, &neighbor_addpath_tx_all_paths_cmd);
15167 install_element (BGP_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
15168 install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_all_paths_cmd);
15169 install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
15170 install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_all_paths_cmd);
15171 install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
15172 install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_all_paths_cmd);
15173 install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
15174 install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_all_paths_cmd);
15175 install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
15176 install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_all_paths_cmd);
15177 install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
8ecd3266 15178 install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_all_paths_cmd);
15179 install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd);
adbac85e 15180
06370dac
DW
15181 /* "neighbor addpath-tx-bestpath-per-AS" commands.*/
15182 install_element (BGP_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15183 install_element (BGP_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
15184 install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15185 install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
15186 install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15187 install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
15188 install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15189 install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
15190 install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15191 install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
15192 install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15193 install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
8ecd3266 15194 install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd);
15195 install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd);
06370dac 15196
718e3744 15197 /* "neighbor passive" commands. */
15198 install_element (BGP_NODE, &neighbor_passive_cmd);
15199 install_element (BGP_NODE, &no_neighbor_passive_cmd);
15200
d5a5c8f0 15201
718e3744 15202 /* "neighbor shutdown" commands. */
15203 install_element (BGP_NODE, &neighbor_shutdown_cmd);
15204 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
15205
8a92a8a0
DS
15206 /* "neighbor capability extended-nexthop" commands.*/
15207 install_element (BGP_NODE, &neighbor_capability_enhe_cmd);
15208 install_element (BGP_NODE, &no_neighbor_capability_enhe_cmd);
15209
718e3744 15210 /* "neighbor capability orf prefix-list" commands.*/
15211 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
15212 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
15213 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
15214 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
15215 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
15216 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
15217 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
15218 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
25ffbdc1 15219 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
15220 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
718e3744 15221
15222 /* "neighbor capability dynamic" commands.*/
15223 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
15224 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
15225
15226 /* "neighbor dont-capability-negotiate" commands. */
15227 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
15228 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
15229
15230 /* "neighbor ebgp-multihop" commands. */
15231 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
15232 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
15233 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
15234 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
15235
6ffd2079 15236 /* "neighbor disable-connected-check" commands. */
15237 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
15238 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
718e3744 15239 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
15240 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
15241
15242 /* "neighbor description" commands. */
15243 install_element (BGP_NODE, &neighbor_description_cmd);
15244 install_element (BGP_NODE, &no_neighbor_description_cmd);
15245 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
15246
15247 /* "neighbor update-source" commands. "*/
15248 install_element (BGP_NODE, &neighbor_update_source_cmd);
15249 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
15250
15251 /* "neighbor default-originate" commands. */
15252 install_element (BGP_NODE, &neighbor_default_originate_cmd);
15253 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
15254 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
15255 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
15256 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
15257 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
15258 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
15259 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
15260 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
15261 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
15262 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
15263 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
15264 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
15265 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
15266 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
15267 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
25ffbdc1 15268 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
15269 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
15270 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
15271 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
718e3744 15272
15273 /* "neighbor port" commands. */
15274 install_element (BGP_NODE, &neighbor_port_cmd);
15275 install_element (BGP_NODE, &no_neighbor_port_cmd);
15276 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
15277
15278 /* "neighbor weight" commands. */
15279 install_element (BGP_NODE, &neighbor_weight_cmd);
15280 install_element (BGP_NODE, &no_neighbor_weight_cmd);
15281 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
15282
15283 /* "neighbor override-capability" commands. */
15284 install_element (BGP_NODE, &neighbor_override_capability_cmd);
15285 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
15286
15287 /* "neighbor strict-capability-match" commands. */
15288 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
15289 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
15290
15291 /* "neighbor timers" commands. */
15292 install_element (BGP_NODE, &neighbor_timers_cmd);
15293 install_element (BGP_NODE, &no_neighbor_timers_cmd);
813d4307 15294 install_element (BGP_NODE, &no_neighbor_timers_val_cmd);
718e3744 15295
15296 /* "neighbor timers connect" commands. */
15297 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
15298 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
15299 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
15300
15301 /* "neighbor advertisement-interval" commands. */
15302 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
15303 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
15304 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
15305
718e3744 15306 /* "neighbor interface" commands. */
15307 install_element (BGP_NODE, &neighbor_interface_cmd);
15308 install_element (BGP_NODE, &no_neighbor_interface_cmd);
15309
15310 /* "neighbor distribute" commands. */
15311 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
15312 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
15313 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
15314 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
15315 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
15316 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
15317 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
15318 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
25ffbdc1 15319 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
15320 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
718e3744 15321 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
15322 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
8ecd3266 15323 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
15324 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
8b1fb8be
LB
15325 install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd);
15326 install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd);
15327 install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd);
15328 install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd);
718e3744 15329
15330 /* "neighbor prefix-list" commands. */
15331 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
15332 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
15333 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
15334 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
15335 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
15336 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
15337 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
15338 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
25ffbdc1 15339 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
15340 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
718e3744 15341 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
15342 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
8ecd3266 15343 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
15344 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
8b1fb8be
LB
15345 install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd);
15346 install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd);
15347 install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd);
15348 install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd);
718e3744 15349
15350 /* "neighbor filter-list" commands. */
15351 install_element (BGP_NODE, &neighbor_filter_list_cmd);
15352 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
15353 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
15354 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
15355 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
15356 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
15357 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
15358 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
25ffbdc1 15359 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
15360 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
718e3744 15361 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
15362 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
8ecd3266 15363 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
15364 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
8b1fb8be
LB
15365 install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd);
15366 install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd);
15367 install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd);
15368 install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd);
718e3744 15369
15370 /* "neighbor route-map" commands. */
15371 install_element (BGP_NODE, &neighbor_route_map_cmd);
15372 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
15373 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
15374 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
15375 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
15376 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
15377 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
15378 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
25ffbdc1 15379 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
15380 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
718e3744 15381 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
15382 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
8ecd3266 15383 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
15384 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
8b1fb8be
LB
15385 install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd);
15386 install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd);
15387 install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd);
15388 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd);
718e3744 15389
15390 /* "neighbor unsuppress-map" commands. */
15391 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
15392 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
15393 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
15394 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
15395 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
15396 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
15397 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
15398 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
25ffbdc1 15399 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
15400 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
a58545bb 15401 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
bb86c601 15402 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
8ecd3266 15403 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
bb86c601 15404 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
8b1fb8be
LB
15405 install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd);
15406 install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd);
15407 install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd);
15408 install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd);
718e3744 15409
15410 /* "neighbor maximum-prefix" commands. */
15411 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 15412 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 15413 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 15414 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 15415 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
15416 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15417 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
15418 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 15419 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15420 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15421 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15422 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15423 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15424 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 15425 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 15426 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 15427 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 15428 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
15429 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15430 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
15431 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 15432 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15433 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15434 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15435 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15436 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15437 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 15438 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 15439 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 15440 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 15441 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
15442 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15443 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
15444 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 15445 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15446 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15447 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15448 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15449 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15450 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 15451 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 15452 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 15453 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 15454 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
15455 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15456 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
15457 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 15458 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15459 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15460 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15461 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15462 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
25ffbdc1 15463 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
15464 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
15465 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
15466 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
15467 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
15468 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
15469 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
15470 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
15471 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15472 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15473 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15474 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15475 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15476 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 15477 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 15478 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 15479 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 15480 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
15481 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15482 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
15483 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 15484 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15485 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15486 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15487 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15488 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
8ecd3266 15489 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
15490 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
15491 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
15492 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
15493 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
15494 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
15495 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
15496 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
15497 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15498 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15499 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15500 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15501 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 15502
8b1fb8be
LB
15503 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd);
15504 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd);
15505 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd);
15506 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
15507 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd);
15508 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
15509 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd);
15510 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd);
15511 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15512 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15513 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15514 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15515 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
15516
15517 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd);
15518 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
15519 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
15520 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
15521 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
15522 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
15523 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd);
15524 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
15525 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
15526 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
15527 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
15528 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
15529 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
15530
718e3744 15531 /* "neighbor allowas-in" */
15532 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
15533 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
15534 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15535 install_element (BGP_NODE, &no_neighbor_allowas_in_val_cmd);
718e3744 15536 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
15537 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
15538 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15539 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_val_cmd);
718e3744 15540 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
15541 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
15542 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15543 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_val_cmd);
718e3744 15544 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
15545 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
15546 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15547 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_val_cmd);
25ffbdc1 15548 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
15549 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
15550 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15551 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_val_cmd);
718e3744 15552 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
15553 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
15554 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
813d4307 15555 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_val_cmd);
8ecd3266 15556 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
15557 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
15558 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
15559 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_val_cmd);
8b1fb8be
LB
15560 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd);
15561 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd);
15562 install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd);
15563 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd);
15564 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd);
15565 install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd);
718e3744 15566
15567 /* address-family commands. */
15568 install_element (BGP_NODE, &address_family_ipv4_cmd);
15569 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
15570#ifdef HAVE_IPV6
15571 install_element (BGP_NODE, &address_family_ipv6_cmd);
25ffbdc1 15572 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
718e3744 15573#endif /* HAVE_IPV6 */
15574 install_element (BGP_NODE, &address_family_vpnv4_cmd);
15575 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
15576
8b1fb8be
LB
15577 install_element (BGP_NODE, &address_family_vpnv6_cmd);
15578 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
15579
15580 install_element (BGP_NODE, &address_family_encap_cmd);
15581 install_element (BGP_NODE, &address_family_encapv4_cmd);
15582#ifdef HAVE_IPV6
15583 install_element (BGP_NODE, &address_family_encapv6_cmd);
15584#endif
15585
718e3744 15586 /* "exit-address-family" command. */
15587 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
15588 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
15589 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
25ffbdc1 15590 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
718e3744 15591 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
8ecd3266 15592 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
8b1fb8be
LB
15593 install_element (BGP_ENCAP_NODE, &exit_address_family_cmd);
15594 install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd);
718e3744 15595
15596 /* "clear ip bgp commands" */
15597 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
15598 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
15599 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
01080f7c 15600 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_cmd);
718e3744 15601 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
01080f7c 15602 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_cmd);
718e3744 15603 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
01080f7c 15604 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_cmd);
718e3744 15605 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
01080f7c 15606 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_cmd);
15607
718e3744 15608 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
15609 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
15610 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
01080f7c 15611 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_cmd);
718e3744 15612 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
01080f7c 15613 install_element (ENABLE_NODE, &clear_bgp_instance_peer_cmd);
718e3744 15614 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
01080f7c 15615 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_cmd);
718e3744 15616 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
01080f7c 15617 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_cmd);
718e3744 15618 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
01080f7c 15619 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_cmd);
718e3744 15620 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
01080f7c 15621 install_element (ENABLE_NODE, &clear_bgp_instance_external_cmd);
718e3744 15622 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
01080f7c 15623 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_cmd);
718e3744 15624 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
01080f7c 15625 install_element (ENABLE_NODE, &clear_bgp_instance_as_cmd);
718e3744 15626 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
01080f7c 15627 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_cmd);
718e3744 15628
15629 /* "clear ip bgp neighbor soft in" */
15630 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
15631 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
15632 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
01080f7c 15633 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_cmd);
718e3744 15634 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
718e3744 15635 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
01080f7c 15636 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_in_cmd);
718e3744 15637 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
01080f7c 15638 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_in_cmd);
718e3744 15639 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
15640 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
01080f7c 15641 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_in_cmd);
718e3744 15642 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
01080f7c 15643 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_in_cmd);
718e3744 15644 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
15645 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
01080f7c 15646 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_in_cmd);
718e3744 15647 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
01080f7c 15648 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_in_cmd);
718e3744 15649 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
15650 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
01080f7c 15651 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_in_cmd);
718e3744 15652 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
01080f7c 15653 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_in_cmd);
718e3744 15654 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
15655 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
15656 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
15657 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
01080f7c 15658 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_cmd);
718e3744 15659 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
718e3744 15660 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
01080f7c 15661 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_in_cmd);
718e3744 15662 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
01080f7c 15663 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_in_cmd);
718e3744 15664 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
15665 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
01080f7c 15666 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd);
718e3744 15667 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
01080f7c 15668 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_in_cmd);
718e3744 15669 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
15670 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
01080f7c 15671 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_in_cmd);
718e3744 15672 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
01080f7c 15673 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_in_cmd);
718e3744 15674 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
15675 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
01080f7c 15676 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_in_cmd);
718e3744 15677 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
01080f7c 15678 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_in_cmd);
718e3744 15679 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
15680 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
15681 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
15682 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
15683 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
15684 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
15685 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
587ff0fd
LB
15686 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
15687 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
15688 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
15689 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
15690 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
15691 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
718e3744 15692 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
15693 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
15694 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
01080f7c 15695 install_element (ENABLE_NODE, &clear_bgp_instance_all_in_cmd);
718e3744 15696 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
15697 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
01080f7c 15698 install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_in_cmd);
718e3744 15699 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
01080f7c 15700 install_element (ENABLE_NODE, &clear_bgp_instance_peer_in_cmd);
718e3744 15701 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
15702 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
01080f7c 15703 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_in_cmd);
718e3744 15704 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
01080f7c 15705 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_in_cmd);
718e3744 15706 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
15707 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
01080f7c 15708 install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_in_cmd);
718e3744 15709 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
01080f7c 15710 install_element (ENABLE_NODE, &clear_bgp_instance_external_in_cmd);
718e3744 15711 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
15712 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
01080f7c 15713 install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_in_cmd);
718e3744 15714 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
01080f7c 15715 install_element (ENABLE_NODE, &clear_bgp_instance_as_in_cmd);
718e3744 15716 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
15717 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
01080f7c 15718 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_in_cmd);
718e3744 15719 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
01080f7c 15720 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_in_cmd);
718e3744 15721 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
15722 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
01080f7c 15723 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_in_cmd);
718e3744 15724 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
01080f7c 15725 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_in_cmd);
718e3744 15726 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
15727 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
01080f7c 15728 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_in_cmd);
718e3744 15729 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
01080f7c 15730 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_in_cmd);
718e3744 15731 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
15732 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
01080f7c 15733 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_in_cmd);
718e3744 15734 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
01080f7c 15735 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_in_cmd);
718e3744 15736 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
15737 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
01080f7c 15738 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_in_cmd);
718e3744 15739 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
01080f7c 15740 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_in_cmd);
718e3744 15741 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
718e3744 15742
8ad7271d
DS
15743 /* clear ip bgp prefix */
15744 install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd);
01080f7c 15745 install_element (ENABLE_NODE, &clear_ip_bgp_instance_prefix_cmd);
8ad7271d 15746 install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd);
01080f7c 15747 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_safi_prefix_cmd);
8ad7271d 15748
718e3744 15749 /* "clear ip bgp neighbor soft out" */
15750 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
15751 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
15752 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
01080f7c 15753 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_out_cmd);
718e3744 15754 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
01080f7c 15755 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_out_cmd);
718e3744 15756 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
01080f7c 15757 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_out_cmd);
718e3744 15758 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
01080f7c 15759 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_out_cmd);
718e3744 15760 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
01080f7c 15761 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_out_cmd);
718e3744 15762 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
01080f7c 15763 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_out_cmd);
718e3744 15764 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
01080f7c 15765 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_out_cmd);
718e3744 15766 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
01080f7c 15767 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_out_cmd);
718e3744 15768 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
01080f7c 15769 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_out_cmd);
718e3744 15770 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
15771 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
15772 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
01080f7c 15773 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_out_cmd);
718e3744 15774 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
01080f7c 15775 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_out_cmd);
718e3744 15776 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
01080f7c 15777 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_out_cmd);
718e3744 15778 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
01080f7c 15779 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd);
718e3744 15780 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
01080f7c 15781 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_out_cmd);
718e3744 15782 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
01080f7c 15783 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_out_cmd);
718e3744 15784 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
01080f7c 15785 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_out_cmd);
718e3744 15786 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
01080f7c 15787 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_out_cmd);
718e3744 15788 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
01080f7c 15789 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_out_cmd);
718e3744 15790 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
15791 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
15792 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
15793 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
15794 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
15795 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
587ff0fd
LB
15796 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
15797 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
15798 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
15799 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
15800 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
15801 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
718e3744 15802 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
15803 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
15804 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
01080f7c 15805 install_element (ENABLE_NODE, &clear_bgp_instance_all_out_cmd);
718e3744 15806 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
01080f7c 15807 install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_out_cmd);
718e3744 15808 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
01080f7c 15809 install_element (ENABLE_NODE, &clear_bgp_instance_peer_out_cmd);
718e3744 15810 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
01080f7c 15811 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_out_cmd);
718e3744 15812 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
01080f7c 15813 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_out_cmd);
718e3744 15814 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
01080f7c 15815 install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_out_cmd);
718e3744 15816 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
01080f7c 15817 install_element (ENABLE_NODE, &clear_bgp_instance_external_out_cmd);
718e3744 15818 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
01080f7c 15819 install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_out_cmd);
718e3744 15820 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
01080f7c 15821 install_element (ENABLE_NODE, &clear_bgp_instance_as_out_cmd);
718e3744 15822 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
01080f7c 15823 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_out_cmd);
718e3744 15824 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
01080f7c 15825 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_out_cmd);
718e3744 15826 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
01080f7c 15827 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_out_cmd);
718e3744 15828 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
01080f7c 15829 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_out_cmd);
718e3744 15830 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
01080f7c 15831 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_out_cmd);
718e3744 15832 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
01080f7c 15833 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_out_cmd);
718e3744 15834 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
01080f7c 15835 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_out_cmd);
718e3744 15836 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
01080f7c 15837 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_out_cmd);
718e3744 15838 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
01080f7c 15839 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_out_cmd);
718e3744 15840 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
01080f7c 15841 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_out_cmd);
718e3744 15842
15843 /* "clear ip bgp neighbor soft" */
15844 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
15845 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
15846 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
01080f7c 15847 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_cmd);
718e3744 15848 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
01080f7c 15849 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_cmd);
718e3744 15850 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
01080f7c 15851 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_cmd);
718e3744 15852 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
01080f7c 15853 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_cmd);
718e3744 15854 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
15855 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
15856 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
01080f7c 15857 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_cmd);
718e3744 15858 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
01080f7c 15859 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_cmd);
718e3744 15860 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
01080f7c 15861 install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_cmd);
718e3744 15862 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
01080f7c 15863 install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_cmd);
718e3744 15864 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
15865 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
15866 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
587ff0fd
LB
15867 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
15868 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
15869 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
718e3744 15870 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
15871 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
15872 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
01080f7c 15873 install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_cmd);
718e3744 15874 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
01080f7c 15875 install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_cmd);
718e3744 15876 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
01080f7c 15877 install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_cmd);
718e3744 15878 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
01080f7c 15879 install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_cmd);
718e3744 15880 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
01080f7c 15881 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_cmd);
718e3744 15882 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
01080f7c 15883 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_cmd);
718e3744 15884 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
01080f7c 15885 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_cmd);
718e3744 15886 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
01080f7c 15887 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_cmd);
718e3744 15888 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
01080f7c 15889 install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_cmd);
718e3744 15890
15891 /* "show ip bgp summary" commands. */
15892 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
3f9c7369 15893 install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd);
8386ac43 15894 install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_cmd);
f186de26 15895 install_element (VIEW_NODE, &show_ip_bgp_instance_all_updgrps_cmd);
3f9c7369
DS
15896 install_element (VIEW_NODE, &show_bgp_updgrps_cmd);
15897 install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_cmd);
8386ac43 15898 install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_cmd);
f186de26 15899 install_element (VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd);
8fe8a7f6 15900 install_element (VIEW_NODE, &show_ip_bgp_updgrps_s_cmd);
8386ac43 15901 install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_s_cmd);
8fe8a7f6
DS
15902 install_element (VIEW_NODE, &show_bgp_updgrps_s_cmd);
15903 install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_s_cmd);
8386ac43 15904 install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd);
3f9c7369 15905 install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd);
8386ac43 15906 install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_cmd);
3f9c7369 15907 install_element (VIEW_NODE, &show_bgp_updgrps_adj_cmd);
8386ac43 15908 install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_cmd);
3f9c7369 15909 install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_cmd);
8fe8a7f6 15910 install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_s_cmd);
8386ac43 15911 install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15912 install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd);
8386ac43 15913 install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15914 install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
718e3744 15915 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
f186de26 15916 install_element (VIEW_NODE, &show_ip_bgp_instance_all_summary_cmd);
718e3744 15917 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
95cbbd2a 15918 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
718e3744 15919 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
95cbbd2a 15920 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
718e3744 15921 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
15922 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
15923#ifdef HAVE_IPV6
15924 install_element (VIEW_NODE, &show_bgp_summary_cmd);
15925 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
f186de26 15926 install_element (VIEW_NODE, &show_bgp_instance_all_summary_cmd);
718e3744 15927 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
95cbbd2a 15928 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
718e3744 15929 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
95cbbd2a 15930 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
62687ff1
PJ
15931#endif /* HAVE_IPV6 */
15932 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
3f9c7369 15933 install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd);
8386ac43 15934 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_cmd);
f186de26 15935 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_updgrps_cmd);
3f9c7369
DS
15936 install_element (RESTRICTED_NODE, &show_bgp_updgrps_cmd);
15937 install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_cmd);
8386ac43 15938 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_cmd);
f186de26 15939 install_element (RESTRICTED_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd);
8fe8a7f6 15940 install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_s_cmd);
8386ac43 15941 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_s_cmd);
8fe8a7f6
DS
15942 install_element (RESTRICTED_NODE, &show_bgp_updgrps_s_cmd);
15943 install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_s_cmd);
8386ac43 15944 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd);
3f9c7369 15945 install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_cmd);
8386ac43 15946 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_cmd);
3f9c7369 15947 install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_cmd);
8386ac43 15948 install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_cmd);
3f9c7369 15949 install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_cmd);
8fe8a7f6 15950 install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_s_cmd);
8386ac43 15951 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15952 install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_s_cmd);
8386ac43 15953 install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15954 install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
62687ff1 15955 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
f186de26 15956 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_summary_cmd);
62687ff1 15957 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
95cbbd2a 15958 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
62687ff1 15959 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
95cbbd2a 15960 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
62687ff1
PJ
15961 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
15962 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
15963#ifdef HAVE_IPV6
15964 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
15965 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
f186de26 15966 install_element (RESTRICTED_NODE, &show_bgp_instance_all_summary_cmd);
62687ff1 15967 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
95cbbd2a 15968 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
62687ff1 15969 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
95cbbd2a 15970 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
718e3744 15971#endif /* HAVE_IPV6 */
15972 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
3f9c7369 15973 install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd);
8386ac43 15974 install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_cmd);
f186de26 15975 install_element (ENABLE_NODE, &show_ip_bgp_instance_all_updgrps_cmd);
3f9c7369
DS
15976 install_element (ENABLE_NODE, &show_bgp_updgrps_cmd);
15977 install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_cmd);
8386ac43 15978 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_cmd);
f186de26 15979 install_element (ENABLE_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd);
8fe8a7f6 15980 install_element (ENABLE_NODE, &show_ip_bgp_updgrps_s_cmd);
8386ac43 15981 install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_s_cmd);
8fe8a7f6
DS
15982 install_element (ENABLE_NODE, &show_bgp_updgrps_s_cmd);
15983 install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_s_cmd);
8386ac43 15984 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd);
3f9c7369 15985 install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_cmd);
8386ac43 15986 install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_cmd);
3f9c7369 15987 install_element (ENABLE_NODE, &show_bgp_updgrps_adj_cmd);
8386ac43 15988 install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_cmd);
3f9c7369 15989 install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_cmd);
8fe8a7f6 15990 install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_s_cmd);
8386ac43 15991 install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15992 install_element (ENABLE_NODE, &show_bgp_updgrps_adj_s_cmd);
8386ac43 15993 install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
8fe8a7f6 15994 install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
718e3744 15995 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
f186de26 15996 install_element (ENABLE_NODE, &show_ip_bgp_instance_all_summary_cmd);
718e3744 15997 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
95cbbd2a 15998 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
718e3744 15999 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
95cbbd2a 16000 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
718e3744 16001 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
16002 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
16003#ifdef HAVE_IPV6
16004 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
16005 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
f186de26 16006 install_element (ENABLE_NODE, &show_bgp_instance_all_summary_cmd);
718e3744 16007 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
95cbbd2a 16008 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
718e3744 16009 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
95cbbd2a 16010 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
718e3744 16011#endif /* HAVE_IPV6 */
16012
16013 /* "show ip bgp neighbors" commands. */
16014 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
16015 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
16016 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
16017 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
16018 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
16019 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
16020 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
16021 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
16022 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
f186de26 16023 install_element (VIEW_NODE, &show_ip_bgp_instance_all_neighbors_cmd);
718e3744 16024 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
62687ff1
PJ
16025 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
16026 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
16027 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
16028 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
16029 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
718e3744 16030 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
16031 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
16032 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
16033 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
16034 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
16035 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
16036 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
16037 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
16038 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
f186de26 16039 install_element (ENABLE_NODE, &show_ip_bgp_instance_all_neighbors_cmd);
718e3744 16040 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
16041
16042#ifdef HAVE_IPV6
16043 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
16044 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
16045 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
16046 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
bb46e94f 16047 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
16048 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
16049 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
16050 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
62687ff1
PJ
16051 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
16052 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
16053 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
16054 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
718e3744 16055 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
16056 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
16057 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
16058 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
bb46e94f 16059 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
16060 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
16061 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
16062 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
718e3744 16063
16064 /* Old commands. */
16065 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
16066 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
16067 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
16068 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
16069#endif /* HAVE_IPV6 */
fee0f4c6 16070
f14e6fdb
DS
16071 /* "show ip bgp peer-group" commands. */
16072 install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd);
16073 install_element (VIEW_NODE, &show_ip_bgp_instance_peer_groups_cmd);
16074 install_element (VIEW_NODE, &show_ip_bgp_peer_group_cmd);
16075 install_element (VIEW_NODE, &show_ip_bgp_instance_peer_group_cmd);
16076 install_element (ENABLE_NODE, &show_ip_bgp_peer_groups_cmd);
16077 install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_groups_cmd);
16078 install_element (ENABLE_NODE, &show_ip_bgp_peer_group_cmd);
16079 install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_group_cmd);
16080
718e3744 16081 /* "show ip bgp paths" commands. */
16082 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
16083 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
16084 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
16085 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
16086
16087 /* "show ip bgp community" commands. */
16088 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
16089 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
16090
16091 /* "show ip bgp attribute-info" commands. */
16092 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
16093 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
16094
16095 /* "redistribute" commands. */
16096 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
16097 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
16098 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
16099 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
16100 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
16101 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
16102 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
16103 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
16104 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
16105 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
7c8ff89e
DS
16106 install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_cmd);
16107 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_cmd);
16108 install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd);
16109 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd);
16110 install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd);
16111 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd);
16112 install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd);
16113 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd);
16114 install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd);
16115 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd);
919e0666
DW
16116 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_cmd);
16117 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_cmd);
16118 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_cmd);
16119 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
16120 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_cmd);
16121 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
16122 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
16123 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
16124 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
16125 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
16126 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_cmd);
16127 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_cmd);
16128 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd);
16129 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd);
16130 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd);
16131 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd);
16132 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd);
16133 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd);
16134 install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd);
16135 install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd);
718e3744 16136#ifdef HAVE_IPV6
16137 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
16138 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
16139 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
16140 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
16141 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
16142 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
16143 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
16144 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
16145 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
16146 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
16147#endif /* HAVE_IPV6 */
16148
fa411a21
NH
16149 /* ttl_security commands */
16150 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
16151 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
16152
4bf6a362
PJ
16153 /* "show bgp memory" commands. */
16154 install_element (VIEW_NODE, &show_bgp_memory_cmd);
62687ff1 16155 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
4bf6a362
PJ
16156 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
16157
e0081f70
ML
16158 /* "show bgp views" commands. */
16159 install_element (VIEW_NODE, &show_bgp_views_cmd);
16160 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
16161 install_element (ENABLE_NODE, &show_bgp_views_cmd);
16162
8386ac43 16163 /* "show bgp vrfs" commands. */
16164 install_element (VIEW_NODE, &show_bgp_vrfs_cmd);
16165 install_element (RESTRICTED_NODE, &show_bgp_vrfs_cmd);
16166 install_element (ENABLE_NODE, &show_bgp_vrfs_cmd);
16167
718e3744 16168 /* Community-list. */
16169 community_list_vty ();
16170}
6b0655a2 16171
718e3744 16172#include "memory.h"
16173#include "bgp_regex.h"
16174#include "bgp_clist.h"
16175#include "bgp_ecommunity.h"
16176
16177/* VTY functions. */
16178
16179/* Direction value to string conversion. */
94f2b392 16180static const char *
718e3744 16181community_direct_str (int direct)
16182{
16183 switch (direct)
16184 {
16185 case COMMUNITY_DENY:
16186 return "deny";
718e3744 16187 case COMMUNITY_PERMIT:
16188 return "permit";
718e3744 16189 default:
16190 return "unknown";
718e3744 16191 }
16192}
16193
16194/* Display error string. */
94f2b392 16195static void
718e3744 16196community_list_perror (struct vty *vty, int ret)
16197{
16198 switch (ret)
16199 {
16200 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
b729294c 16201 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
718e3744 16202 break;
16203 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
16204 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
16205 break;
16206 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
16207 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
16208 break;
16209 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
16210 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
16211 break;
16212 }
16213}
16214
16215/* VTY interface for community_set() function. */
94f2b392 16216static int
fd79ac91 16217community_list_set_vty (struct vty *vty, int argc, const char **argv,
16218 int style, int reject_all_digit_name)
718e3744 16219{
16220 int ret;
16221 int direct;
16222 char *str;
16223
16224 /* Check the list type. */
16225 if (strncmp (argv[1], "p", 1) == 0)
16226 direct = COMMUNITY_PERMIT;
16227 else if (strncmp (argv[1], "d", 1) == 0)
16228 direct = COMMUNITY_DENY;
16229 else
16230 {
16231 vty_out (vty, "%% Matching condition must be permit or deny%s",
16232 VTY_NEWLINE);
16233 return CMD_WARNING;
16234 }
16235
16236 /* All digit name check. */
16237 if (reject_all_digit_name && all_digit (argv[0]))
16238 {
16239 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
16240 return CMD_WARNING;
16241 }
16242
16243 /* Concat community string argument. */
16244 if (argc > 1)
16245 str = argv_concat (argv, argc, 2);
16246 else
16247 str = NULL;
16248
16249 /* When community_list_set() return nevetive value, it means
16250 malformed community string. */
16251 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
16252
16253 /* Free temporary community list string allocated by
16254 argv_concat(). */
16255 if (str)
16256 XFREE (MTYPE_TMP, str);
16257
16258 if (ret < 0)
16259 {
16260 /* Display error string. */
16261 community_list_perror (vty, ret);
16262 return CMD_WARNING;
16263 }
16264
16265 return CMD_SUCCESS;
16266}
16267
718e3744 16268/* Communiyt-list entry delete. */
94f2b392 16269static int
fee6e4e4 16270community_list_unset_vty (struct vty *vty, int argc, const char **argv,
813d4307 16271 int style, int delete_all)
718e3744 16272{
16273 int ret;
fee6e4e4 16274 int direct = 0;
16275 char *str = NULL;
718e3744 16276
fee6e4e4 16277 if (argc > 1)
718e3744 16278 {
fee6e4e4 16279 /* Check the list direct. */
16280 if (strncmp (argv[1], "p", 1) == 0)
16281 direct = COMMUNITY_PERMIT;
16282 else if (strncmp (argv[1], "d", 1) == 0)
16283 direct = COMMUNITY_DENY;
16284 else
16285 {
16286 vty_out (vty, "%% Matching condition must be permit or deny%s",
16287 VTY_NEWLINE);
16288 return CMD_WARNING;
16289 }
718e3744 16290
fee6e4e4 16291 /* Concat community string argument. */
16292 str = argv_concat (argv, argc, 2);
16293 }
718e3744 16294
16295 /* Unset community list. */
813d4307 16296 ret = community_list_unset (bgp_clist, argv[0], str, direct, style, delete_all);
718e3744 16297
16298 /* Free temporary community list string allocated by
16299 argv_concat(). */
fee6e4e4 16300 if (str)
16301 XFREE (MTYPE_TMP, str);
718e3744 16302
16303 if (ret < 0)
16304 {
16305 community_list_perror (vty, ret);
16306 return CMD_WARNING;
16307 }
16308
16309 return CMD_SUCCESS;
16310}
16311
16312/* "community-list" keyword help string. */
16313#define COMMUNITY_LIST_STR "Add a community list entry\n"
718e3744 16314
718e3744 16315DEFUN (ip_community_list_standard,
16316 ip_community_list_standard_cmd,
16317 "ip community-list <1-99> (deny|permit) .AA:NN",
16318 IP_STR
16319 COMMUNITY_LIST_STR
16320 "Community list number (standard)\n"
16321 "Specify community to reject\n"
16322 "Specify community to accept\n"
16323 COMMUNITY_VAL_STR)
16324{
16325 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
16326}
16327
16328ALIAS (ip_community_list_standard,
16329 ip_community_list_standard2_cmd,
16330 "ip community-list <1-99> (deny|permit)",
16331 IP_STR
16332 COMMUNITY_LIST_STR
16333 "Community list number (standard)\n"
16334 "Specify community to reject\n"
16335 "Specify community to accept\n")
16336
16337DEFUN (ip_community_list_expanded,
16338 ip_community_list_expanded_cmd,
fee6e4e4 16339 "ip community-list <100-500> (deny|permit) .LINE",
718e3744 16340 IP_STR
16341 COMMUNITY_LIST_STR
16342 "Community list number (expanded)\n"
16343 "Specify community to reject\n"
16344 "Specify community to accept\n"
16345 "An ordered list as a regular-expression\n")
16346{
16347 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
16348}
16349
16350DEFUN (ip_community_list_name_standard,
16351 ip_community_list_name_standard_cmd,
16352 "ip community-list standard WORD (deny|permit) .AA:NN",
16353 IP_STR
16354 COMMUNITY_LIST_STR
16355 "Add a standard community-list entry\n"
16356 "Community list name\n"
16357 "Specify community to reject\n"
16358 "Specify community to accept\n"
16359 COMMUNITY_VAL_STR)
16360{
16361 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
16362}
16363
16364ALIAS (ip_community_list_name_standard,
16365 ip_community_list_name_standard2_cmd,
16366 "ip community-list standard WORD (deny|permit)",
16367 IP_STR
16368 COMMUNITY_LIST_STR
16369 "Add a standard community-list entry\n"
16370 "Community list name\n"
16371 "Specify community to reject\n"
16372 "Specify community to accept\n")
16373
16374DEFUN (ip_community_list_name_expanded,
16375 ip_community_list_name_expanded_cmd,
16376 "ip community-list expanded WORD (deny|permit) .LINE",
16377 IP_STR
16378 COMMUNITY_LIST_STR
16379 "Add an expanded community-list entry\n"
16380 "Community list name\n"
16381 "Specify community to reject\n"
16382 "Specify community to accept\n"
16383 "An ordered list as a regular-expression\n")
16384{
16385 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
16386}
16387
fee6e4e4 16388DEFUN (no_ip_community_list_standard_all,
16389 no_ip_community_list_standard_all_cmd,
16390 "no ip community-list <1-99>",
16391 NO_STR
16392 IP_STR
16393 COMMUNITY_LIST_STR
16394 "Community list number (standard)\n")
16395{
813d4307
DW
16396 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
16397}
16398
16399DEFUN (no_ip_community_list_standard_direction,
16400 no_ip_community_list_standard_direction_cmd,
16401 "no ip community-list <1-99> (deny|permit)",
16402 NO_STR
16403 IP_STR
16404 COMMUNITY_LIST_STR
16405 "Community list number (standard)\n"
16406 "Specify community to reject\n"
16407 "Specify community to accept\n")
16408{
16409 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
fee6e4e4 16410}
16411
813d4307 16412
fee6e4e4 16413DEFUN (no_ip_community_list_expanded_all,
16414 no_ip_community_list_expanded_all_cmd,
16415 "no ip community-list <100-500>",
718e3744 16416 NO_STR
16417 IP_STR
16418 COMMUNITY_LIST_STR
718e3744 16419 "Community list number (expanded)\n")
16420{
813d4307 16421 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
718e3744 16422}
16423
fee6e4e4 16424DEFUN (no_ip_community_list_name_standard_all,
16425 no_ip_community_list_name_standard_all_cmd,
16426 "no ip community-list standard WORD",
718e3744 16427 NO_STR
16428 IP_STR
16429 COMMUNITY_LIST_STR
16430 "Add a standard community-list entry\n"
718e3744 16431 "Community list name\n")
16432{
813d4307 16433 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
718e3744 16434}
16435
fee6e4e4 16436DEFUN (no_ip_community_list_name_expanded_all,
16437 no_ip_community_list_name_expanded_all_cmd,
16438 "no ip community-list expanded WORD",
718e3744 16439 NO_STR
16440 IP_STR
16441 COMMUNITY_LIST_STR
fee6e4e4 16442 "Add an expanded community-list entry\n"
16443 "Community list name\n")
718e3744 16444{
813d4307 16445 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
718e3744 16446}
16447
16448DEFUN (no_ip_community_list_standard,
16449 no_ip_community_list_standard_cmd,
16450 "no ip community-list <1-99> (deny|permit) .AA:NN",
16451 NO_STR
16452 IP_STR
16453 COMMUNITY_LIST_STR
16454 "Community list number (standard)\n"
16455 "Specify community to reject\n"
16456 "Specify community to accept\n"
16457 COMMUNITY_VAL_STR)
16458{
813d4307 16459 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
718e3744 16460}
16461
16462DEFUN (no_ip_community_list_expanded,
16463 no_ip_community_list_expanded_cmd,
fee6e4e4 16464 "no ip community-list <100-500> (deny|permit) .LINE",
718e3744 16465 NO_STR
16466 IP_STR
16467 COMMUNITY_LIST_STR
16468 "Community list number (expanded)\n"
16469 "Specify community to reject\n"
16470 "Specify community to accept\n"
16471 "An ordered list as a regular-expression\n")
16472{
813d4307 16473 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
718e3744 16474}
16475
16476DEFUN (no_ip_community_list_name_standard,
16477 no_ip_community_list_name_standard_cmd,
16478 "no ip community-list standard WORD (deny|permit) .AA:NN",
16479 NO_STR
16480 IP_STR
16481 COMMUNITY_LIST_STR
16482 "Specify a standard community-list\n"
16483 "Community list name\n"
16484 "Specify community to reject\n"
16485 "Specify community to accept\n"
16486 COMMUNITY_VAL_STR)
16487{
813d4307
DW
16488 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
16489}
16490
16491DEFUN (no_ip_community_list_name_standard_brief,
16492 no_ip_community_list_name_standard_brief_cmd,
16493 "no ip community-list standard WORD (deny|permit)",
16494 NO_STR
16495 IP_STR
16496 COMMUNITY_LIST_STR
16497 "Specify a standard community-list\n"
16498 "Community list name\n"
16499 "Specify community to reject\n"
16500 "Specify community to accept\n")
16501{
16502 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
718e3744 16503}
16504
16505DEFUN (no_ip_community_list_name_expanded,
16506 no_ip_community_list_name_expanded_cmd,
16507 "no ip community-list expanded WORD (deny|permit) .LINE",
16508 NO_STR
16509 IP_STR
16510 COMMUNITY_LIST_STR
16511 "Specify an expanded community-list\n"
16512 "Community list name\n"
16513 "Specify community to reject\n"
16514 "Specify community to accept\n"
16515 "An ordered list as a regular-expression\n")
16516{
813d4307 16517 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
718e3744 16518}
16519
94f2b392 16520static void
718e3744 16521community_list_show (struct vty *vty, struct community_list *list)
16522{
16523 struct community_entry *entry;
16524
16525 for (entry = list->head; entry; entry = entry->next)
16526 {
16527 if (entry == list->head)
16528 {
16529 if (all_digit (list->name))
16530 vty_out (vty, "Community %s list %s%s",
16531 entry->style == COMMUNITY_LIST_STANDARD ?
16532 "standard" : "(expanded) access",
16533 list->name, VTY_NEWLINE);
16534 else
16535 vty_out (vty, "Named Community %s list %s%s",
16536 entry->style == COMMUNITY_LIST_STANDARD ?
16537 "standard" : "expanded",
16538 list->name, VTY_NEWLINE);
16539 }
16540 if (entry->any)
16541 vty_out (vty, " %s%s",
16542 community_direct_str (entry->direct), VTY_NEWLINE);
16543 else
16544 vty_out (vty, " %s %s%s",
16545 community_direct_str (entry->direct),
16546 entry->style == COMMUNITY_LIST_STANDARD
16547 ? community_str (entry->u.com) : entry->config,
16548 VTY_NEWLINE);
16549 }
16550}
16551
16552DEFUN (show_ip_community_list,
16553 show_ip_community_list_cmd,
16554 "show ip community-list",
16555 SHOW_STR
16556 IP_STR
16557 "List community-list\n")
16558{
16559 struct community_list *list;
16560 struct community_list_master *cm;
16561
fee6e4e4 16562 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
718e3744 16563 if (! cm)
16564 return CMD_SUCCESS;
16565
16566 for (list = cm->num.head; list; list = list->next)
16567 community_list_show (vty, list);
16568
16569 for (list = cm->str.head; list; list = list->next)
16570 community_list_show (vty, list);
16571
16572 return CMD_SUCCESS;
16573}
16574
16575DEFUN (show_ip_community_list_arg,
16576 show_ip_community_list_arg_cmd,
fee6e4e4 16577 "show ip community-list (<1-500>|WORD)",
718e3744 16578 SHOW_STR
16579 IP_STR
16580 "List community-list\n"
16581 "Community-list number\n"
16582 "Community-list name\n")
16583{
16584 struct community_list *list;
16585
fee6e4e4 16586 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
718e3744 16587 if (! list)
16588 {
b729294c 16589 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
718e3744 16590 return CMD_WARNING;
16591 }
16592
16593 community_list_show (vty, list);
16594
16595 return CMD_SUCCESS;
16596}
6b0655a2 16597
94f2b392 16598static int
fd79ac91 16599extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
16600 int style, int reject_all_digit_name)
718e3744 16601{
16602 int ret;
16603 int direct;
16604 char *str;
16605
16606 /* Check the list type. */
16607 if (strncmp (argv[1], "p", 1) == 0)
16608 direct = COMMUNITY_PERMIT;
16609 else if (strncmp (argv[1], "d", 1) == 0)
16610 direct = COMMUNITY_DENY;
16611 else
16612 {
16613 vty_out (vty, "%% Matching condition must be permit or deny%s",
16614 VTY_NEWLINE);
16615 return CMD_WARNING;
16616 }
16617
16618 /* All digit name check. */
16619 if (reject_all_digit_name && all_digit (argv[0]))
16620 {
16621 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
16622 return CMD_WARNING;
16623 }
16624
16625 /* Concat community string argument. */
16626 if (argc > 1)
16627 str = argv_concat (argv, argc, 2);
16628 else
16629 str = NULL;
16630
16631 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
16632
16633 /* Free temporary community list string allocated by
16634 argv_concat(). */
16635 if (str)
16636 XFREE (MTYPE_TMP, str);
16637
16638 if (ret < 0)
16639 {
16640 community_list_perror (vty, ret);
16641 return CMD_WARNING;
16642 }
16643 return CMD_SUCCESS;
16644}
16645
94f2b392 16646static int
fee6e4e4 16647extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
813d4307 16648 int style, int delete_all)
718e3744 16649{
16650 int ret;
fee6e4e4 16651 int direct = 0;
16652 char *str = NULL;
718e3744 16653
fee6e4e4 16654 if (argc > 1)
718e3744 16655 {
fee6e4e4 16656 /* Check the list direct. */
16657 if (strncmp (argv[1], "p", 1) == 0)
16658 direct = COMMUNITY_PERMIT;
16659 else if (strncmp (argv[1], "d", 1) == 0)
16660 direct = COMMUNITY_DENY;
16661 else
16662 {
16663 vty_out (vty, "%% Matching condition must be permit or deny%s",
16664 VTY_NEWLINE);
16665 return CMD_WARNING;
16666 }
718e3744 16667
fee6e4e4 16668 /* Concat community string argument. */
16669 str = argv_concat (argv, argc, 2);
718e3744 16670 }
16671
718e3744 16672 /* Unset community list. */
813d4307 16673 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style, delete_all);
718e3744 16674
16675 /* Free temporary community list string allocated by
16676 argv_concat(). */
fee6e4e4 16677 if (str)
16678 XFREE (MTYPE_TMP, str);
718e3744 16679
16680 if (ret < 0)
16681 {
16682 community_list_perror (vty, ret);
16683 return CMD_WARNING;
16684 }
16685
16686 return CMD_SUCCESS;
16687}
16688
16689/* "extcommunity-list" keyword help string. */
16690#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
16691#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
16692
16693DEFUN (ip_extcommunity_list_standard,
16694 ip_extcommunity_list_standard_cmd,
16695 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
16696 IP_STR
16697 EXTCOMMUNITY_LIST_STR
16698 "Extended Community list number (standard)\n"
16699 "Specify community to reject\n"
16700 "Specify community to accept\n"
16701 EXTCOMMUNITY_VAL_STR)
16702{
16703 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
16704}
16705
16706ALIAS (ip_extcommunity_list_standard,
16707 ip_extcommunity_list_standard2_cmd,
16708 "ip extcommunity-list <1-99> (deny|permit)",
16709 IP_STR
16710 EXTCOMMUNITY_LIST_STR
16711 "Extended Community list number (standard)\n"
16712 "Specify community to reject\n"
16713 "Specify community to accept\n")
16714
16715DEFUN (ip_extcommunity_list_expanded,
16716 ip_extcommunity_list_expanded_cmd,
fee6e4e4 16717 "ip extcommunity-list <100-500> (deny|permit) .LINE",
718e3744 16718 IP_STR
16719 EXTCOMMUNITY_LIST_STR
16720 "Extended Community list number (expanded)\n"
16721 "Specify community to reject\n"
16722 "Specify community to accept\n"
16723 "An ordered list as a regular-expression\n")
16724{
16725 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
16726}
16727
16728DEFUN (ip_extcommunity_list_name_standard,
16729 ip_extcommunity_list_name_standard_cmd,
16730 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
16731 IP_STR
16732 EXTCOMMUNITY_LIST_STR
16733 "Specify standard extcommunity-list\n"
16734 "Extended Community list name\n"
16735 "Specify community to reject\n"
16736 "Specify community to accept\n"
16737 EXTCOMMUNITY_VAL_STR)
16738{
16739 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
16740}
16741
16742ALIAS (ip_extcommunity_list_name_standard,
16743 ip_extcommunity_list_name_standard2_cmd,
16744 "ip extcommunity-list standard WORD (deny|permit)",
16745 IP_STR
16746 EXTCOMMUNITY_LIST_STR
16747 "Specify standard extcommunity-list\n"
16748 "Extended Community list name\n"
16749 "Specify community to reject\n"
16750 "Specify community to accept\n")
16751
16752DEFUN (ip_extcommunity_list_name_expanded,
16753 ip_extcommunity_list_name_expanded_cmd,
16754 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
16755 IP_STR
16756 EXTCOMMUNITY_LIST_STR
16757 "Specify expanded extcommunity-list\n"
16758 "Extended Community list name\n"
16759 "Specify community to reject\n"
16760 "Specify community to accept\n"
16761 "An ordered list as a regular-expression\n")
16762{
16763 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
16764}
16765
fee6e4e4 16766DEFUN (no_ip_extcommunity_list_standard_all,
16767 no_ip_extcommunity_list_standard_all_cmd,
16768 "no ip extcommunity-list <1-99>",
16769 NO_STR
16770 IP_STR
16771 EXTCOMMUNITY_LIST_STR
16772 "Extended Community list number (standard)\n")
16773{
813d4307
DW
16774 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
16775}
16776
16777DEFUN (no_ip_extcommunity_list_standard_direction,
16778 no_ip_extcommunity_list_standard_direction_cmd,
16779 "no ip extcommunity-list <1-99> (deny|permit)",
16780 NO_STR
16781 IP_STR
16782 EXTCOMMUNITY_LIST_STR
16783 "Extended Community list number (standard)\n"
16784 "Specify community to reject\n"
16785 "Specify community to accept\n")
16786{
16787 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
fee6e4e4 16788}
16789
16790DEFUN (no_ip_extcommunity_list_expanded_all,
16791 no_ip_extcommunity_list_expanded_all_cmd,
16792 "no ip extcommunity-list <100-500>",
718e3744 16793 NO_STR
16794 IP_STR
16795 EXTCOMMUNITY_LIST_STR
718e3744 16796 "Extended Community list number (expanded)\n")
16797{
813d4307 16798 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
718e3744 16799}
16800
fee6e4e4 16801DEFUN (no_ip_extcommunity_list_name_standard_all,
16802 no_ip_extcommunity_list_name_standard_all_cmd,
16803 "no ip extcommunity-list standard WORD",
718e3744 16804 NO_STR
16805 IP_STR
16806 EXTCOMMUNITY_LIST_STR
16807 "Specify standard extcommunity-list\n"
fee6e4e4 16808 "Extended Community list name\n")
16809{
813d4307 16810 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
fee6e4e4 16811}
16812
16813DEFUN (no_ip_extcommunity_list_name_expanded_all,
16814 no_ip_extcommunity_list_name_expanded_all_cmd,
16815 "no ip extcommunity-list expanded WORD",
16816 NO_STR
16817 IP_STR
16818 EXTCOMMUNITY_LIST_STR
718e3744 16819 "Specify expanded extcommunity-list\n"
16820 "Extended Community list name\n")
16821{
813d4307 16822 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
718e3744 16823}
16824
16825DEFUN (no_ip_extcommunity_list_standard,
16826 no_ip_extcommunity_list_standard_cmd,
16827 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
16828 NO_STR
16829 IP_STR
16830 EXTCOMMUNITY_LIST_STR
16831 "Extended Community list number (standard)\n"
16832 "Specify community to reject\n"
16833 "Specify community to accept\n"
16834 EXTCOMMUNITY_VAL_STR)
16835{
813d4307 16836 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
718e3744 16837}
16838
16839DEFUN (no_ip_extcommunity_list_expanded,
16840 no_ip_extcommunity_list_expanded_cmd,
fee6e4e4 16841 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
718e3744 16842 NO_STR
16843 IP_STR
16844 EXTCOMMUNITY_LIST_STR
16845 "Extended Community list number (expanded)\n"
16846 "Specify community to reject\n"
16847 "Specify community to accept\n"
16848 "An ordered list as a regular-expression\n")
16849{
813d4307 16850 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
718e3744 16851}
16852
16853DEFUN (no_ip_extcommunity_list_name_standard,
16854 no_ip_extcommunity_list_name_standard_cmd,
16855 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
16856 NO_STR
16857 IP_STR
16858 EXTCOMMUNITY_LIST_STR
16859 "Specify standard extcommunity-list\n"
16860 "Extended Community list name\n"
16861 "Specify community to reject\n"
16862 "Specify community to accept\n"
16863 EXTCOMMUNITY_VAL_STR)
16864{
813d4307
DW
16865 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
16866}
16867
16868DEFUN (no_ip_extcommunity_list_name_standard_brief,
16869 no_ip_extcommunity_list_name_standard_brief_cmd,
16870 "no ip extcommunity-list standard WORD (deny|permit)",
16871 NO_STR
16872 IP_STR
16873 EXTCOMMUNITY_LIST_STR
16874 "Specify standard extcommunity-list\n"
16875 "Extended Community list name\n"
16876 "Specify community to reject\n"
16877 "Specify community to accept\n")
16878{
16879 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
718e3744 16880}
16881
16882DEFUN (no_ip_extcommunity_list_name_expanded,
16883 no_ip_extcommunity_list_name_expanded_cmd,
16884 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
16885 NO_STR
16886 IP_STR
16887 EXTCOMMUNITY_LIST_STR
16888 "Specify expanded extcommunity-list\n"
16889 "Community list name\n"
16890 "Specify community to reject\n"
16891 "Specify community to accept\n"
16892 "An ordered list as a regular-expression\n")
16893{
813d4307 16894 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
718e3744 16895}
16896
94f2b392 16897static void
718e3744 16898extcommunity_list_show (struct vty *vty, struct community_list *list)
16899{
16900 struct community_entry *entry;
16901
16902 for (entry = list->head; entry; entry = entry->next)
16903 {
16904 if (entry == list->head)
16905 {
16906 if (all_digit (list->name))
16907 vty_out (vty, "Extended community %s list %s%s",
16908 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
16909 "standard" : "(expanded) access",
16910 list->name, VTY_NEWLINE);
16911 else
16912 vty_out (vty, "Named extended community %s list %s%s",
16913 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
16914 "standard" : "expanded",
16915 list->name, VTY_NEWLINE);
16916 }
16917 if (entry->any)
16918 vty_out (vty, " %s%s",
16919 community_direct_str (entry->direct), VTY_NEWLINE);
16920 else
16921 vty_out (vty, " %s %s%s",
16922 community_direct_str (entry->direct),
16923 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
16924 entry->u.ecom->str : entry->config,
16925 VTY_NEWLINE);
16926 }
16927}
16928
16929DEFUN (show_ip_extcommunity_list,
16930 show_ip_extcommunity_list_cmd,
16931 "show ip extcommunity-list",
16932 SHOW_STR
16933 IP_STR
16934 "List extended-community list\n")
16935{
16936 struct community_list *list;
16937 struct community_list_master *cm;
16938
fee6e4e4 16939 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
718e3744 16940 if (! cm)
16941 return CMD_SUCCESS;
16942
16943 for (list = cm->num.head; list; list = list->next)
16944 extcommunity_list_show (vty, list);
16945
16946 for (list = cm->str.head; list; list = list->next)
16947 extcommunity_list_show (vty, list);
16948
16949 return CMD_SUCCESS;
16950}
16951
16952DEFUN (show_ip_extcommunity_list_arg,
16953 show_ip_extcommunity_list_arg_cmd,
fee6e4e4 16954 "show ip extcommunity-list (<1-500>|WORD)",
718e3744 16955 SHOW_STR
16956 IP_STR
16957 "List extended-community list\n"
16958 "Extcommunity-list number\n"
16959 "Extcommunity-list name\n")
16960{
16961 struct community_list *list;
16962
fee6e4e4 16963 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
718e3744 16964 if (! list)
16965 {
b729294c 16966 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
718e3744 16967 return CMD_WARNING;
16968 }
16969
16970 extcommunity_list_show (vty, list);
16971
16972 return CMD_SUCCESS;
16973}
6b0655a2 16974
718e3744 16975/* Return configuration string of community-list entry. */
fd79ac91 16976static const char *
718e3744 16977community_list_config_str (struct community_entry *entry)
16978{
fd79ac91 16979 const char *str;
718e3744 16980
16981 if (entry->any)
16982 str = "";
16983 else
16984 {
16985 if (entry->style == COMMUNITY_LIST_STANDARD)
16986 str = community_str (entry->u.com);
16987 else
16988 str = entry->config;
16989 }
16990 return str;
16991}
16992
16993/* Display community-list and extcommunity-list configuration. */
94f2b392 16994static int
718e3744 16995community_list_config_write (struct vty *vty)
16996{
16997 struct community_list *list;
16998 struct community_entry *entry;
16999 struct community_list_master *cm;
17000 int write = 0;
17001
17002 /* Community-list. */
fee6e4e4 17003 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
718e3744 17004
17005 for (list = cm->num.head; list; list = list->next)
17006 for (entry = list->head; entry; entry = entry->next)
17007 {
fee6e4e4 17008 vty_out (vty, "ip community-list %s %s %s%s",
17009 list->name, community_direct_str (entry->direct),
17010 community_list_config_str (entry),
17011 VTY_NEWLINE);
718e3744 17012 write++;
17013 }
17014 for (list = cm->str.head; list; list = list->next)
17015 for (entry = list->head; entry; entry = entry->next)
17016 {
17017 vty_out (vty, "ip community-list %s %s %s %s%s",
17018 entry->style == COMMUNITY_LIST_STANDARD
17019 ? "standard" : "expanded",
17020 list->name, community_direct_str (entry->direct),
17021 community_list_config_str (entry),
17022 VTY_NEWLINE);
17023 write++;
17024 }
17025
17026 /* Extcommunity-list. */
fee6e4e4 17027 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
718e3744 17028
17029 for (list = cm->num.head; list; list = list->next)
17030 for (entry = list->head; entry; entry = entry->next)
17031 {
fee6e4e4 17032 vty_out (vty, "ip extcommunity-list %s %s %s%s",
17033 list->name, community_direct_str (entry->direct),
17034 community_list_config_str (entry), VTY_NEWLINE);
718e3744 17035 write++;
17036 }
17037 for (list = cm->str.head; list; list = list->next)
17038 for (entry = list->head; entry; entry = entry->next)
17039 {
17040 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
17041 entry->style == EXTCOMMUNITY_LIST_STANDARD
17042 ? "standard" : "expanded",
17043 list->name, community_direct_str (entry->direct),
17044 community_list_config_str (entry), VTY_NEWLINE);
17045 write++;
17046 }
17047 return write;
17048}
17049
7fc626de 17050static struct cmd_node community_list_node =
718e3744 17051{
17052 COMMUNITY_LIST_NODE,
17053 "",
17054 1 /* Export to vtysh. */
17055};
17056
94f2b392 17057static void
17058community_list_vty (void)
718e3744 17059{
17060 install_node (&community_list_node, community_list_config_write);
17061
17062 /* Community-list. */
718e3744 17063 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
17064 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
17065 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
17066 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
17067 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
17068 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
fee6e4e4 17069 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
813d4307 17070 install_element (CONFIG_NODE, &no_ip_community_list_standard_direction_cmd);
fee6e4e4 17071 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
17072 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
17073 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
718e3744 17074 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
17075 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
17076 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
813d4307 17077 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_brief_cmd);
718e3744 17078 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
17079 install_element (VIEW_NODE, &show_ip_community_list_cmd);
17080 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
17081 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
17082 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
17083
17084 /* Extcommunity-list. */
17085 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
17086 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
17087 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
17088 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
17089 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
17090 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
fee6e4e4 17091 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
813d4307 17092 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_direction_cmd);
fee6e4e4 17093 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
17094 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
17095 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
718e3744 17096 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
17097 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
17098 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
813d4307 17099 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_brief_cmd);
718e3744 17100 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
17101 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
17102 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
17103 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
17104 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
17105}