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