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