[git administrivia] remove auto-built quagga.info, add to gitignore.
[jleu-quagga.git] / bgpd / bgp_vty.c
blobc8d5b2ac8b1f5fd8ff2082080aab50b39e24f8e9
1 /* BGP VTY interface.
2 Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro
4 This file is part of GNU Zebra.
6 GNU Zebra is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
9 later version.
11 GNU Zebra is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Zebra; see the file COPYING. If not, write to the Free
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA. */
21 #include <zebra.h>
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"
31 #include "memory.h"
33 #include "bgpd/bgpd.h"
34 #include "bgpd/bgp_attr.h"
35 #include "bgpd/bgp_aspath.h"
36 #include "bgpd/bgp_community.h"
37 #include "bgpd/bgp_debug.h"
38 #include "bgpd/bgp_fsm.h"
39 #include "bgpd/bgp_mplsvpn.h"
40 #include "bgpd/bgp_open.h"
41 #include "bgpd/bgp_route.h"
42 #include "bgpd/bgp_zebra.h"
43 #include "bgpd/bgp_table.h"
44 #include "bgpd/bgp_vty.h"
46 extern struct in_addr router_id_zebra;
48 /* Utility function to get address family from current node. */
49 afi_t
50 bgp_node_afi (struct vty *vty)
52 if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE)
53 return AFI_IP6;
54 return AFI_IP;
57 /* Utility function to get subsequent address family from current
58 node. */
59 safi_t
60 bgp_node_safi (struct vty *vty)
62 if (vty->node == BGP_VPNV4_NODE)
63 return SAFI_MPLS_VPN;
64 if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE)
65 return SAFI_MULTICAST;
66 return SAFI_UNICAST;
69 static int
70 peer_address_self_check (union sockunion *su)
72 struct interface *ifp = NULL;
74 if (su->sa.sa_family == AF_INET)
75 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
76 #ifdef HAVE_IPV6
77 else if (su->sa.sa_family == AF_INET6)
78 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
79 #endif /* HAVE IPV6 */
81 if (ifp)
82 return 1;
84 return 0;
87 /* Utility function for looking up peer from VTY. */
88 static struct peer *
89 peer_lookup_vty (struct vty *vty, const char *ip_str)
91 int ret;
92 struct bgp *bgp;
93 union sockunion su;
94 struct peer *peer;
96 bgp = vty->index;
98 ret = str2sockunion (ip_str, &su);
99 if (ret < 0)
101 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
102 return NULL;
105 peer = peer_lookup (bgp, &su);
106 if (! peer)
108 vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
109 return NULL;
111 return peer;
114 /* Utility function for looking up peer or peer group. */
115 static struct peer *
116 peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
118 int ret;
119 struct bgp *bgp;
120 union sockunion su;
121 struct peer *peer;
122 struct peer_group *group;
124 bgp = vty->index;
126 ret = str2sockunion (peer_str, &su);
127 if (ret == 0)
129 peer = peer_lookup (bgp, &su);
130 if (peer)
131 return peer;
133 else
135 group = peer_group_lookup (bgp, peer_str);
136 if (group)
137 return group->conf;
140 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
141 VTY_NEWLINE);
143 return NULL;
146 static int
147 bgp_vty_return (struct vty *vty, int ret)
149 const char *str = NULL;
151 switch (ret)
153 case BGP_ERR_INVALID_VALUE:
154 str = "Invalid value";
155 break;
156 case BGP_ERR_INVALID_FLAG:
157 str = "Invalid flag";
158 break;
159 case BGP_ERR_PEER_INACTIVE:
160 str = "Activate the neighbor for the address family first";
161 break;
162 case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
163 str = "Invalid command for a peer-group member";
164 break;
165 case BGP_ERR_PEER_GROUP_SHUTDOWN:
166 str = "Peer-group has been shutdown. Activate the peer-group first";
167 break;
168 case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
169 str = "This peer is a peer-group member. Please change peer-group configuration";
170 break;
171 case BGP_ERR_PEER_FLAG_CONFLICT:
172 str = "Can't set override-capability and strict-capability-match at the same time";
173 break;
174 case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
175 str = "No activate for peergroup can be given only if peer-group has no members";
176 break;
177 case BGP_ERR_PEER_BELONGS_TO_GROUP:
178 str = "No activate for an individual peer-group member is invalid";
179 break;
180 case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
181 str = "Activate the peer-group for the address family first";
182 break;
183 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
184 str = "Specify remote-as or peer-group remote AS first";
185 break;
186 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
187 str = "Cannot change the peer-group. Deconfigure first";
188 break;
189 case BGP_ERR_PEER_GROUP_MISMATCH:
190 str = "Cannot have different peer-group for the neighbor";
191 break;
192 case BGP_ERR_PEER_FILTER_CONFLICT:
193 str = "Prefix/distribute list can not co-exist";
194 break;
195 case BGP_ERR_NOT_INTERNAL_PEER:
196 str = "Invalid command. Not an internal neighbor";
197 break;
198 case BGP_ERR_REMOVE_PRIVATE_AS:
199 str = "Private AS cannot be removed for IBGP peers";
200 break;
201 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
202 str = "Local-AS allowed only for EBGP peers";
203 break;
204 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
205 str = "Cannot have local-as same as BGP AS number";
206 break;
208 if (str)
210 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
211 return CMD_WARNING;
213 return CMD_SUCCESS;
216 /* BGP global configuration. */
218 DEFUN (bgp_multiple_instance_func,
219 bgp_multiple_instance_cmd,
220 "bgp multiple-instance",
221 BGP_STR
222 "Enable bgp multiple instance\n")
224 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
225 return CMD_SUCCESS;
228 DEFUN (no_bgp_multiple_instance,
229 no_bgp_multiple_instance_cmd,
230 "no bgp multiple-instance",
231 NO_STR
232 BGP_STR
233 "BGP multiple instance\n")
235 int ret;
237 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
238 if (ret < 0)
240 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
241 return CMD_WARNING;
243 return CMD_SUCCESS;
246 DEFUN (bgp_config_type,
247 bgp_config_type_cmd,
248 "bgp config-type (cisco|zebra)",
249 BGP_STR
250 "Configuration type\n"
251 "cisco\n"
252 "zebra\n")
254 if (strncmp (argv[0], "c", 1) == 0)
255 bgp_option_set (BGP_OPT_CONFIG_CISCO);
256 else
257 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
259 return CMD_SUCCESS;
262 DEFUN (no_bgp_config_type,
263 no_bgp_config_type_cmd,
264 "no bgp config-type",
265 NO_STR
266 BGP_STR
267 "Display configuration type\n")
269 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
270 return CMD_SUCCESS;
273 DEFUN (no_synchronization,
274 no_synchronization_cmd,
275 "no synchronization",
276 NO_STR
277 "Perform IGP synchronization\n")
279 return CMD_SUCCESS;
282 DEFUN (no_auto_summary,
283 no_auto_summary_cmd,
284 "no auto-summary",
285 NO_STR
286 "Enable automatic network number summarization\n")
288 return CMD_SUCCESS;
291 DEFUN_DEPRECATED (neighbor_version,
292 neighbor_version_cmd,
293 NEIGHBOR_CMD "version (4|4-)",
294 NEIGHBOR_STR
295 NEIGHBOR_ADDR_STR
296 "Set the BGP version to match a neighbor\n"
297 "Neighbor's BGP version\n")
299 return CMD_SUCCESS;
302 /* "router bgp" commands. */
303 DEFUN (router_bgp,
304 router_bgp_cmd,
305 "router bgp <1-65535>",
306 ROUTER_STR
307 BGP_STR
308 AS_STR)
310 int ret;
311 as_t as;
312 struct bgp *bgp;
313 const char *name = NULL;
315 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535);
317 if (argc == 2)
318 name = argv[1];
320 ret = bgp_get (&bgp, &as, name);
321 switch (ret)
323 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
324 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
325 VTY_NEWLINE);
326 return CMD_WARNING;
327 break;
328 case BGP_ERR_AS_MISMATCH:
329 vty_out (vty, "BGP is already running; AS is %d%s", as, VTY_NEWLINE);
330 return CMD_WARNING;
331 break;
332 case BGP_ERR_INSTANCE_MISMATCH:
333 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
334 vty_out (vty, "BGP instance is already running; AS is %d%s",
335 as, VTY_NEWLINE);
336 return CMD_WARNING;
337 break;
340 vty->node = BGP_NODE;
341 vty->index = bgp;
343 return CMD_SUCCESS;
346 ALIAS (router_bgp,
347 router_bgp_view_cmd,
348 "router bgp <1-65535> view WORD",
349 ROUTER_STR
350 BGP_STR
351 AS_STR
352 "BGP view\n"
353 "view name\n")
355 /* "no router bgp" commands. */
356 DEFUN (no_router_bgp,
357 no_router_bgp_cmd,
358 "no router bgp <1-65535>",
359 NO_STR
360 ROUTER_STR
361 BGP_STR
362 AS_STR)
364 as_t as;
365 struct bgp *bgp;
366 const char *name = NULL;
368 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535);
370 if (argc == 2)
371 name = argv[1];
373 /* Lookup bgp structure. */
374 bgp = bgp_lookup (as, name);
375 if (! bgp)
377 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
378 return CMD_WARNING;
381 bgp_delete (bgp);
383 return CMD_SUCCESS;
386 ALIAS (no_router_bgp,
387 no_router_bgp_view_cmd,
388 "no router bgp <1-65535> view WORD",
389 NO_STR
390 ROUTER_STR
391 BGP_STR
392 AS_STR
393 "BGP view\n"
394 "view name\n")
396 /* BGP router-id. */
398 DEFUN (bgp_router_id,
399 bgp_router_id_cmd,
400 "bgp router-id A.B.C.D",
401 BGP_STR
402 "Override configured router identifier\n"
403 "Manually configured router identifier\n")
405 int ret;
406 struct in_addr id;
407 struct bgp *bgp;
409 bgp = vty->index;
411 ret = inet_aton (argv[0], &id);
412 if (! ret)
414 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
415 return CMD_WARNING;
418 bgp->router_id_static = id;
419 bgp_router_id_set (bgp, &id);
421 return CMD_SUCCESS;
424 DEFUN (no_bgp_router_id,
425 no_bgp_router_id_cmd,
426 "no bgp router-id",
427 NO_STR
428 BGP_STR
429 "Override configured router identifier\n")
431 int ret;
432 struct in_addr id;
433 struct bgp *bgp;
435 bgp = vty->index;
437 if (argc == 1)
439 ret = inet_aton (argv[0], &id);
440 if (! ret)
442 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
443 return CMD_WARNING;
446 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
448 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
449 return CMD_WARNING;
453 bgp->router_id_static.s_addr = 0;
454 bgp_router_id_set (bgp, &router_id_zebra);
456 return CMD_SUCCESS;
459 ALIAS (no_bgp_router_id,
460 no_bgp_router_id_val_cmd,
461 "no bgp router-id A.B.C.D",
462 NO_STR
463 BGP_STR
464 "Override configured router identifier\n"
465 "Manually configured router identifier\n")
467 /* BGP Cluster ID. */
469 DEFUN (bgp_cluster_id,
470 bgp_cluster_id_cmd,
471 "bgp cluster-id A.B.C.D",
472 BGP_STR
473 "Configure Route-Reflector Cluster-id\n"
474 "Route-Reflector Cluster-id in IP address format\n")
476 int ret;
477 struct bgp *bgp;
478 struct in_addr cluster;
480 bgp = vty->index;
482 ret = inet_aton (argv[0], &cluster);
483 if (! ret)
485 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
486 return CMD_WARNING;
489 bgp_cluster_id_set (bgp, &cluster);
491 return CMD_SUCCESS;
494 ALIAS (bgp_cluster_id,
495 bgp_cluster_id32_cmd,
496 "bgp cluster-id <1-4294967295>",
497 BGP_STR
498 "Configure Route-Reflector Cluster-id\n"
499 "Route-Reflector Cluster-id as 32 bit quantity\n")
501 DEFUN (no_bgp_cluster_id,
502 no_bgp_cluster_id_cmd,
503 "no bgp cluster-id",
504 NO_STR
505 BGP_STR
506 "Configure Route-Reflector Cluster-id\n")
508 int ret;
509 struct bgp *bgp;
510 struct in_addr cluster;
512 bgp = vty->index;
514 if (argc == 1)
516 ret = inet_aton (argv[0], &cluster);
517 if (! ret)
519 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
520 return CMD_WARNING;
524 bgp_cluster_id_unset (bgp);
526 return CMD_SUCCESS;
529 ALIAS (no_bgp_cluster_id,
530 no_bgp_cluster_id_arg_cmd,
531 "no bgp cluster-id A.B.C.D",
532 NO_STR
533 BGP_STR
534 "Configure Route-Reflector Cluster-id\n"
535 "Route-Reflector Cluster-id in IP address format\n")
537 DEFUN (bgp_confederation_identifier,
538 bgp_confederation_identifier_cmd,
539 "bgp confederation identifier <1-65535>",
540 "BGP specific commands\n"
541 "AS confederation parameters\n"
542 "AS number\n"
543 "Set routing domain confederation AS\n")
545 struct bgp *bgp;
546 as_t as;
548 bgp = vty->index;
550 VTY_GET_INTEGER ("AS", as, argv[0]);
552 bgp_confederation_id_set (bgp, as);
554 return CMD_SUCCESS;
557 DEFUN (no_bgp_confederation_identifier,
558 no_bgp_confederation_identifier_cmd,
559 "no bgp confederation identifier",
560 NO_STR
561 "BGP specific commands\n"
562 "AS confederation parameters\n"
563 "AS number\n")
565 struct bgp *bgp;
566 as_t as;
568 bgp = vty->index;
570 if (argc == 1)
571 VTY_GET_INTEGER ("AS", as, argv[0]);
573 bgp_confederation_id_unset (bgp);
575 return CMD_SUCCESS;
578 ALIAS (no_bgp_confederation_identifier,
579 no_bgp_confederation_identifier_arg_cmd,
580 "no bgp confederation identifier <1-65535>",
581 NO_STR
582 "BGP specific commands\n"
583 "AS confederation parameters\n"
584 "AS number\n"
585 "Set routing domain confederation AS\n")
587 DEFUN (bgp_confederation_peers,
588 bgp_confederation_peers_cmd,
589 "bgp confederation peers .<1-65535>",
590 "BGP specific commands\n"
591 "AS confederation parameters\n"
592 "Peer ASs in BGP confederation\n"
593 AS_STR)
595 struct bgp *bgp;
596 as_t as;
597 int i;
599 bgp = vty->index;
601 for (i = 0; i < argc; i++)
603 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, 65535);
605 if (bgp->as == as)
607 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
608 VTY_NEWLINE);
609 continue;
612 bgp_confederation_peers_add (bgp, as);
614 return CMD_SUCCESS;
617 DEFUN (no_bgp_confederation_peers,
618 no_bgp_confederation_peers_cmd,
619 "no bgp confederation peers .<1-65535>",
620 NO_STR
621 "BGP specific commands\n"
622 "AS confederation parameters\n"
623 "Peer ASs in BGP confederation\n"
624 AS_STR)
626 struct bgp *bgp;
627 as_t as;
628 int i;
630 bgp = vty->index;
632 for (i = 0; i < argc; i++)
634 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, 65535);
636 bgp_confederation_peers_remove (bgp, as);
638 return CMD_SUCCESS;
641 /* BGP timers. */
643 DEFUN (bgp_timers,
644 bgp_timers_cmd,
645 "timers bgp <0-65535> <0-65535>",
646 "Adjust routing timers\n"
647 "BGP timers\n"
648 "Keepalive interval\n"
649 "Holdtime\n")
651 struct bgp *bgp;
652 unsigned long keepalive = 0;
653 unsigned long holdtime = 0;
655 bgp = vty->index;
657 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
658 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
660 /* Holdtime value check. */
661 if (holdtime < 3 && holdtime != 0)
663 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
664 VTY_NEWLINE);
665 return CMD_WARNING;
668 bgp_timers_set (bgp, keepalive, holdtime);
670 return CMD_SUCCESS;
673 DEFUN (no_bgp_timers,
674 no_bgp_timers_cmd,
675 "no timers bgp",
676 NO_STR
677 "Adjust routing timers\n"
678 "BGP timers\n")
680 struct bgp *bgp;
682 bgp = vty->index;
683 bgp_timers_unset (bgp);
685 return CMD_SUCCESS;
688 ALIAS (no_bgp_timers,
689 no_bgp_timers_arg_cmd,
690 "no timers bgp <0-65535> <0-65535>",
691 NO_STR
692 "Adjust routing timers\n"
693 "BGP timers\n"
694 "Keepalive interval\n"
695 "Holdtime\n")
697 DEFUN (bgp_client_to_client_reflection,
698 bgp_client_to_client_reflection_cmd,
699 "bgp client-to-client reflection",
700 "BGP specific commands\n"
701 "Configure client to client route reflection\n"
702 "reflection of routes allowed\n")
704 struct bgp *bgp;
706 bgp = vty->index;
707 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
708 return CMD_SUCCESS;
711 DEFUN (no_bgp_client_to_client_reflection,
712 no_bgp_client_to_client_reflection_cmd,
713 "no bgp client-to-client reflection",
714 NO_STR
715 "BGP specific commands\n"
716 "Configure client to client route reflection\n"
717 "reflection of routes allowed\n")
719 struct bgp *bgp;
721 bgp = vty->index;
722 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
723 return CMD_SUCCESS;
726 /* "bgp always-compare-med" configuration. */
727 DEFUN (bgp_always_compare_med,
728 bgp_always_compare_med_cmd,
729 "bgp always-compare-med",
730 "BGP specific commands\n"
731 "Allow comparing MED from different neighbors\n")
733 struct bgp *bgp;
735 bgp = vty->index;
736 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
737 return CMD_SUCCESS;
740 DEFUN (no_bgp_always_compare_med,
741 no_bgp_always_compare_med_cmd,
742 "no bgp always-compare-med",
743 NO_STR
744 "BGP specific commands\n"
745 "Allow comparing MED from different neighbors\n")
747 struct bgp *bgp;
749 bgp = vty->index;
750 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
751 return CMD_SUCCESS;
754 /* "bgp deterministic-med" configuration. */
755 DEFUN (bgp_deterministic_med,
756 bgp_deterministic_med_cmd,
757 "bgp deterministic-med",
758 "BGP specific commands\n"
759 "Pick the best-MED path among paths advertised from the neighboring AS\n")
761 struct bgp *bgp;
763 bgp = vty->index;
764 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
765 return CMD_SUCCESS;
768 DEFUN (no_bgp_deterministic_med,
769 no_bgp_deterministic_med_cmd,
770 "no bgp deterministic-med",
771 NO_STR
772 "BGP specific commands\n"
773 "Pick the best-MED path among paths advertised from the neighboring AS\n")
775 struct bgp *bgp;
777 bgp = vty->index;
778 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
779 return CMD_SUCCESS;
782 /* "bgp graceful-restart" configuration. */
783 DEFUN (bgp_graceful_restart,
784 bgp_graceful_restart_cmd,
785 "bgp graceful-restart",
786 "BGP specific commands\n"
787 "Graceful restart capability parameters\n")
789 struct bgp *bgp;
791 bgp = vty->index;
792 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
793 return CMD_SUCCESS;
796 DEFUN (no_bgp_graceful_restart,
797 no_bgp_graceful_restart_cmd,
798 "no bgp graceful-restart",
799 NO_STR
800 "BGP specific commands\n"
801 "Graceful restart capability parameters\n")
803 struct bgp *bgp;
805 bgp = vty->index;
806 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
807 return CMD_SUCCESS;
810 DEFUN (bgp_graceful_restart_stalepath_time,
811 bgp_graceful_restart_stalepath_time_cmd,
812 "bgp graceful-restart stalepath-time <1-3600>",
813 "BGP specific commands\n"
814 "Graceful restart capability parameters\n"
815 "Set the max time to hold onto restarting peer's stale paths\n"
816 "Delay value (seconds)\n")
818 struct bgp *bgp;
819 u_int32_t stalepath;
821 bgp = vty->index;
822 if (! bgp)
823 return CMD_WARNING;
825 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
826 bgp->stalepath_time = stalepath;
827 return CMD_SUCCESS;
830 DEFUN (no_bgp_graceful_restart_stalepath_time,
831 no_bgp_graceful_restart_stalepath_time_cmd,
832 "no bgp graceful-restart stalepath-time",
833 NO_STR
834 "BGP specific commands\n"
835 "Graceful restart capability parameters\n"
836 "Set the max time to hold onto restarting peer's stale paths\n")
838 struct bgp *bgp;
840 bgp = vty->index;
841 if (! bgp)
842 return CMD_WARNING;
844 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
845 return CMD_SUCCESS;
848 ALIAS (no_bgp_graceful_restart_stalepath_time,
849 no_bgp_graceful_restart_stalepath_time_val_cmd,
850 "no bgp graceful-restart stalepath-time <1-3600>",
851 NO_STR
852 "BGP specific commands\n"
853 "Graceful restart capability parameters\n"
854 "Set the max time to hold onto restarting peer's stale paths\n"
855 "Delay value (seconds)\n")
857 /* "bgp fast-external-failover" configuration. */
858 DEFUN (bgp_fast_external_failover,
859 bgp_fast_external_failover_cmd,
860 "bgp fast-external-failover",
861 BGP_STR
862 "Immediately reset session if a link to a directly connected external peer goes down\n")
864 struct bgp *bgp;
866 bgp = vty->index;
867 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
868 return CMD_SUCCESS;
871 DEFUN (no_bgp_fast_external_failover,
872 no_bgp_fast_external_failover_cmd,
873 "no bgp fast-external-failover",
874 NO_STR
875 BGP_STR
876 "Immediately reset session if a link to a directly connected external peer goes down\n")
878 struct bgp *bgp;
880 bgp = vty->index;
881 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
882 return CMD_SUCCESS;
885 /* "bgp enforce-first-as" configuration. */
886 DEFUN (bgp_enforce_first_as,
887 bgp_enforce_first_as_cmd,
888 "bgp enforce-first-as",
889 BGP_STR
890 "Enforce the first AS for EBGP routes\n")
892 struct bgp *bgp;
894 bgp = vty->index;
895 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
896 return CMD_SUCCESS;
899 DEFUN (no_bgp_enforce_first_as,
900 no_bgp_enforce_first_as_cmd,
901 "no bgp enforce-first-as",
902 NO_STR
903 BGP_STR
904 "Enforce the first AS for EBGP routes\n")
906 struct bgp *bgp;
908 bgp = vty->index;
909 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
910 return CMD_SUCCESS;
913 /* "bgp bestpath compare-routerid" configuration. */
914 DEFUN (bgp_bestpath_compare_router_id,
915 bgp_bestpath_compare_router_id_cmd,
916 "bgp bestpath compare-routerid",
917 "BGP specific commands\n"
918 "Change the default bestpath selection\n"
919 "Compare router-id for identical EBGP paths\n")
921 struct bgp *bgp;
923 bgp = vty->index;
924 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
925 return CMD_SUCCESS;
928 DEFUN (no_bgp_bestpath_compare_router_id,
929 no_bgp_bestpath_compare_router_id_cmd,
930 "no bgp bestpath compare-routerid",
931 NO_STR
932 "BGP specific commands\n"
933 "Change the default bestpath selection\n"
934 "Compare router-id for identical EBGP paths\n")
936 struct bgp *bgp;
938 bgp = vty->index;
939 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
940 return CMD_SUCCESS;
943 /* "bgp bestpath as-path ignore" configuration. */
944 DEFUN (bgp_bestpath_aspath_ignore,
945 bgp_bestpath_aspath_ignore_cmd,
946 "bgp bestpath as-path ignore",
947 "BGP specific commands\n"
948 "Change the default bestpath selection\n"
949 "AS-path attribute\n"
950 "Ignore as-path length in selecting a route\n")
952 struct bgp *bgp;
954 bgp = vty->index;
955 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
956 return CMD_SUCCESS;
959 DEFUN (no_bgp_bestpath_aspath_ignore,
960 no_bgp_bestpath_aspath_ignore_cmd,
961 "no bgp bestpath as-path ignore",
962 NO_STR
963 "BGP specific commands\n"
964 "Change the default bestpath selection\n"
965 "AS-path attribute\n"
966 "Ignore as-path length in selecting a route\n")
968 struct bgp *bgp;
970 bgp = vty->index;
971 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
972 return CMD_SUCCESS;
975 /* "bgp bestpath as-path confed" configuration. */
976 DEFUN (bgp_bestpath_aspath_confed,
977 bgp_bestpath_aspath_confed_cmd,
978 "bgp bestpath as-path confed",
979 "BGP specific commands\n"
980 "Change the default bestpath selection\n"
981 "AS-path attribute\n"
982 "Compare path lengths including confederation sets & sequences in selecting a route\n")
984 struct bgp *bgp;
986 bgp = vty->index;
987 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
988 return CMD_SUCCESS;
991 DEFUN (no_bgp_bestpath_aspath_confed,
992 no_bgp_bestpath_aspath_confed_cmd,
993 "no bgp bestpath as-path confed",
994 NO_STR
995 "BGP specific commands\n"
996 "Change the default bestpath selection\n"
997 "AS-path attribute\n"
998 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1000 struct bgp *bgp;
1002 bgp = vty->index;
1003 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1004 return CMD_SUCCESS;
1007 /* "bgp log-neighbor-changes" configuration. */
1008 DEFUN (bgp_log_neighbor_changes,
1009 bgp_log_neighbor_changes_cmd,
1010 "bgp log-neighbor-changes",
1011 "BGP specific commands\n"
1012 "Log neighbor up/down and reset reason\n")
1014 struct bgp *bgp;
1016 bgp = vty->index;
1017 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1018 return CMD_SUCCESS;
1021 DEFUN (no_bgp_log_neighbor_changes,
1022 no_bgp_log_neighbor_changes_cmd,
1023 "no bgp log-neighbor-changes",
1024 NO_STR
1025 "BGP specific commands\n"
1026 "Log neighbor up/down and reset reason\n")
1028 struct bgp *bgp;
1030 bgp = vty->index;
1031 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1032 return CMD_SUCCESS;
1035 /* "bgp bestpath med" configuration. */
1036 DEFUN (bgp_bestpath_med,
1037 bgp_bestpath_med_cmd,
1038 "bgp bestpath med (confed|missing-as-worst)",
1039 "BGP specific commands\n"
1040 "Change the default bestpath selection\n"
1041 "MED attribute\n"
1042 "Compare MED among confederation paths\n"
1043 "Treat missing MED as the least preferred one\n")
1045 struct bgp *bgp;
1047 bgp = vty->index;
1049 if (strncmp (argv[0], "confed", 1) == 0)
1050 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1051 else
1052 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1054 return CMD_SUCCESS;
1057 DEFUN (bgp_bestpath_med2,
1058 bgp_bestpath_med2_cmd,
1059 "bgp bestpath med confed missing-as-worst",
1060 "BGP specific commands\n"
1061 "Change the default bestpath selection\n"
1062 "MED attribute\n"
1063 "Compare MED among confederation paths\n"
1064 "Treat missing MED as the least preferred one\n")
1066 struct bgp *bgp;
1068 bgp = vty->index;
1069 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1070 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1071 return CMD_SUCCESS;
1074 ALIAS (bgp_bestpath_med2,
1075 bgp_bestpath_med3_cmd,
1076 "bgp bestpath med missing-as-worst confed",
1077 "BGP specific commands\n"
1078 "Change the default bestpath selection\n"
1079 "MED attribute\n"
1080 "Treat missing MED as the least preferred one\n"
1081 "Compare MED among confederation paths\n")
1083 DEFUN (no_bgp_bestpath_med,
1084 no_bgp_bestpath_med_cmd,
1085 "no bgp bestpath med (confed|missing-as-worst)",
1086 NO_STR
1087 "BGP specific commands\n"
1088 "Change the default bestpath selection\n"
1089 "MED attribute\n"
1090 "Compare MED among confederation paths\n"
1091 "Treat missing MED as the least preferred one\n")
1093 struct bgp *bgp;
1095 bgp = vty->index;
1097 if (strncmp (argv[0], "confed", 1) == 0)
1098 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1099 else
1100 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1102 return CMD_SUCCESS;
1105 DEFUN (no_bgp_bestpath_med2,
1106 no_bgp_bestpath_med2_cmd,
1107 "no bgp bestpath med confed missing-as-worst",
1108 NO_STR
1109 "BGP specific commands\n"
1110 "Change the default bestpath selection\n"
1111 "MED attribute\n"
1112 "Compare MED among confederation paths\n"
1113 "Treat missing MED as the least preferred one\n")
1115 struct bgp *bgp;
1117 bgp = vty->index;
1118 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1119 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1120 return CMD_SUCCESS;
1123 ALIAS (no_bgp_bestpath_med2,
1124 no_bgp_bestpath_med3_cmd,
1125 "no bgp bestpath med missing-as-worst confed",
1126 NO_STR
1127 "BGP specific commands\n"
1128 "Change the default bestpath selection\n"
1129 "MED attribute\n"
1130 "Treat missing MED as the least preferred one\n"
1131 "Compare MED among confederation paths\n")
1133 /* "no bgp default ipv4-unicast". */
1134 DEFUN (no_bgp_default_ipv4_unicast,
1135 no_bgp_default_ipv4_unicast_cmd,
1136 "no bgp default ipv4-unicast",
1137 NO_STR
1138 "BGP specific commands\n"
1139 "Configure BGP defaults\n"
1140 "Activate ipv4-unicast for a peer by default\n")
1142 struct bgp *bgp;
1144 bgp = vty->index;
1145 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1146 return CMD_SUCCESS;
1149 DEFUN (bgp_default_ipv4_unicast,
1150 bgp_default_ipv4_unicast_cmd,
1151 "bgp default ipv4-unicast",
1152 "BGP specific commands\n"
1153 "Configure BGP defaults\n"
1154 "Activate ipv4-unicast for a peer by default\n")
1156 struct bgp *bgp;
1158 bgp = vty->index;
1159 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1160 return CMD_SUCCESS;
1163 /* "bgp import-check" configuration. */
1164 DEFUN (bgp_network_import_check,
1165 bgp_network_import_check_cmd,
1166 "bgp network import-check",
1167 "BGP specific commands\n"
1168 "BGP network command\n"
1169 "Check BGP network route exists in IGP\n")
1171 struct bgp *bgp;
1173 bgp = vty->index;
1174 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1175 return CMD_SUCCESS;
1178 DEFUN (no_bgp_network_import_check,
1179 no_bgp_network_import_check_cmd,
1180 "no bgp network import-check",
1181 NO_STR
1182 "BGP specific commands\n"
1183 "BGP network command\n"
1184 "Check BGP network route exists in IGP\n")
1186 struct bgp *bgp;
1188 bgp = vty->index;
1189 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1190 return CMD_SUCCESS;
1193 DEFUN (bgp_default_local_preference,
1194 bgp_default_local_preference_cmd,
1195 "bgp default local-preference <0-4294967295>",
1196 "BGP specific commands\n"
1197 "Configure BGP defaults\n"
1198 "local preference (higher=more preferred)\n"
1199 "Configure default local preference value\n")
1201 struct bgp *bgp;
1202 u_int32_t local_pref;
1204 bgp = vty->index;
1206 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1208 bgp_default_local_preference_set (bgp, local_pref);
1210 return CMD_SUCCESS;
1213 DEFUN (no_bgp_default_local_preference,
1214 no_bgp_default_local_preference_cmd,
1215 "no bgp default local-preference",
1216 NO_STR
1217 "BGP specific commands\n"
1218 "Configure BGP defaults\n"
1219 "local preference (higher=more preferred)\n")
1221 struct bgp *bgp;
1223 bgp = vty->index;
1224 bgp_default_local_preference_unset (bgp);
1225 return CMD_SUCCESS;
1228 ALIAS (no_bgp_default_local_preference,
1229 no_bgp_default_local_preference_val_cmd,
1230 "no bgp default local-preference <0-4294967295>",
1231 NO_STR
1232 "BGP specific commands\n"
1233 "Configure BGP defaults\n"
1234 "local preference (higher=more preferred)\n"
1235 "Configure default local preference value\n")
1237 static int
1238 peer_remote_as_vty (struct vty *vty, const char *peer_str,
1239 const char *as_str, afi_t afi, safi_t safi)
1241 int ret;
1242 struct bgp *bgp;
1243 as_t as;
1244 union sockunion su;
1246 bgp = vty->index;
1248 /* Get AS number. */
1249 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, 65535);
1251 /* If peer is peer group, call proper function. */
1252 ret = str2sockunion (peer_str, &su);
1253 if (ret < 0)
1255 ret = peer_group_remote_as (bgp, peer_str, &as);
1256 if (ret < 0)
1258 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1259 return CMD_WARNING;
1261 return CMD_SUCCESS;
1264 if (peer_address_self_check (&su))
1266 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1267 VTY_NEWLINE);
1268 return CMD_WARNING;
1271 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1273 /* This peer belongs to peer group. */
1274 switch (ret)
1276 case BGP_ERR_PEER_GROUP_MEMBER:
1277 vty_out (vty, "%% Peer-group AS %d. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
1278 return CMD_WARNING;
1279 break;
1280 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
1281 vty_out (vty, "%% The AS# can not be changed from %d to %s, peer-group members must be all internal or all external%s", as, as_str, VTY_NEWLINE);
1282 return CMD_WARNING;
1283 break;
1285 return bgp_vty_return (vty, ret);
1288 DEFUN (neighbor_remote_as,
1289 neighbor_remote_as_cmd,
1290 NEIGHBOR_CMD2 "remote-as <1-65535>",
1291 NEIGHBOR_STR
1292 NEIGHBOR_ADDR_STR2
1293 "Specify a BGP neighbor\n"
1294 AS_STR)
1296 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1299 DEFUN (neighbor_peer_group,
1300 neighbor_peer_group_cmd,
1301 "neighbor WORD peer-group",
1302 NEIGHBOR_STR
1303 "Neighbor tag\n"
1304 "Configure peer-group\n")
1306 struct bgp *bgp;
1307 struct peer_group *group;
1309 bgp = vty->index;
1311 group = peer_group_get (bgp, argv[0]);
1312 if (! group)
1313 return CMD_WARNING;
1315 return CMD_SUCCESS;
1318 DEFUN (no_neighbor,
1319 no_neighbor_cmd,
1320 NO_NEIGHBOR_CMD2,
1321 NO_STR
1322 NEIGHBOR_STR
1323 NEIGHBOR_ADDR_STR2)
1325 int ret;
1326 union sockunion su;
1327 struct peer_group *group;
1328 struct peer *peer;
1330 ret = str2sockunion (argv[0], &su);
1331 if (ret < 0)
1333 group = peer_group_lookup (vty->index, argv[0]);
1334 if (group)
1335 peer_group_delete (group);
1336 else
1338 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1339 return CMD_WARNING;
1342 else
1344 peer = peer_lookup (vty->index, &su);
1345 if (peer)
1346 peer_delete (peer);
1349 return CMD_SUCCESS;
1352 ALIAS (no_neighbor,
1353 no_neighbor_remote_as_cmd,
1354 NO_NEIGHBOR_CMD "remote-as <1-65535>",
1355 NO_STR
1356 NEIGHBOR_STR
1357 NEIGHBOR_ADDR_STR
1358 "Specify a BGP neighbor\n"
1359 AS_STR)
1361 DEFUN (no_neighbor_peer_group,
1362 no_neighbor_peer_group_cmd,
1363 "no neighbor WORD peer-group",
1364 NO_STR
1365 NEIGHBOR_STR
1366 "Neighbor tag\n"
1367 "Configure peer-group\n")
1369 struct peer_group *group;
1371 group = peer_group_lookup (vty->index, argv[0]);
1372 if (group)
1373 peer_group_delete (group);
1374 else
1376 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1377 return CMD_WARNING;
1379 return CMD_SUCCESS;
1382 DEFUN (no_neighbor_peer_group_remote_as,
1383 no_neighbor_peer_group_remote_as_cmd,
1384 "no neighbor WORD remote-as <1-65535>",
1385 NO_STR
1386 NEIGHBOR_STR
1387 "Neighbor tag\n"
1388 "Specify a BGP neighbor\n"
1389 AS_STR)
1391 struct peer_group *group;
1393 group = peer_group_lookup (vty->index, argv[0]);
1394 if (group)
1395 peer_group_remote_as_delete (group);
1396 else
1398 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1399 return CMD_WARNING;
1401 return CMD_SUCCESS;
1404 DEFUN (neighbor_local_as,
1405 neighbor_local_as_cmd,
1406 NEIGHBOR_CMD2 "local-as <1-65535>",
1407 NEIGHBOR_STR
1408 NEIGHBOR_ADDR_STR2
1409 "Specify a local-as number\n"
1410 "AS number used as local AS\n")
1412 struct peer *peer;
1413 int ret;
1415 peer = peer_and_group_lookup_vty (vty, argv[0]);
1416 if (! peer)
1417 return CMD_WARNING;
1419 ret = peer_local_as_set (peer, atoi (argv[1]), 0);
1420 return bgp_vty_return (vty, ret);
1423 DEFUN (neighbor_local_as_no_prepend,
1424 neighbor_local_as_no_prepend_cmd,
1425 NEIGHBOR_CMD2 "local-as <1-65535> no-prepend",
1426 NEIGHBOR_STR
1427 NEIGHBOR_ADDR_STR2
1428 "Specify a local-as number\n"
1429 "AS number used as local AS\n"
1430 "Do not prepend local-as to updates from ebgp peers\n")
1432 struct peer *peer;
1433 int ret;
1435 peer = peer_and_group_lookup_vty (vty, argv[0]);
1436 if (! peer)
1437 return CMD_WARNING;
1439 ret = peer_local_as_set (peer, atoi (argv[1]), 1);
1440 return bgp_vty_return (vty, ret);
1443 DEFUN (no_neighbor_local_as,
1444 no_neighbor_local_as_cmd,
1445 NO_NEIGHBOR_CMD2 "local-as",
1446 NO_STR
1447 NEIGHBOR_STR
1448 NEIGHBOR_ADDR_STR2
1449 "Specify a local-as number\n")
1451 struct peer *peer;
1452 int ret;
1454 peer = peer_and_group_lookup_vty (vty, argv[0]);
1455 if (! peer)
1456 return CMD_WARNING;
1458 ret = peer_local_as_unset (peer);
1459 return bgp_vty_return (vty, ret);
1462 ALIAS (no_neighbor_local_as,
1463 no_neighbor_local_as_val_cmd,
1464 NO_NEIGHBOR_CMD2 "local-as <1-65535>",
1465 NO_STR
1466 NEIGHBOR_STR
1467 NEIGHBOR_ADDR_STR2
1468 "Specify a local-as number\n"
1469 "AS number used as local AS\n")
1471 ALIAS (no_neighbor_local_as,
1472 no_neighbor_local_as_val2_cmd,
1473 NO_NEIGHBOR_CMD2 "local-as <1-65535> no-prepend",
1474 NO_STR
1475 NEIGHBOR_STR
1476 NEIGHBOR_ADDR_STR2
1477 "Specify a local-as number\n"
1478 "AS number used as local AS\n"
1479 "Do not prepend local-as to updates from ebgp peers\n")
1481 DEFUN (neighbor_activate,
1482 neighbor_activate_cmd,
1483 NEIGHBOR_CMD2 "activate",
1484 NEIGHBOR_STR
1485 NEIGHBOR_ADDR_STR2
1486 "Enable the Address Family for this Neighbor\n")
1488 struct peer *peer;
1490 peer = peer_and_group_lookup_vty (vty, argv[0]);
1491 if (! peer)
1492 return CMD_WARNING;
1494 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1496 return CMD_SUCCESS;
1499 DEFUN (no_neighbor_activate,
1500 no_neighbor_activate_cmd,
1501 NO_NEIGHBOR_CMD2 "activate",
1502 NO_STR
1503 NEIGHBOR_STR
1504 NEIGHBOR_ADDR_STR2
1505 "Enable the Address Family for this Neighbor\n")
1507 int ret;
1508 struct peer *peer;
1510 /* Lookup peer. */
1511 peer = peer_and_group_lookup_vty (vty, argv[0]);
1512 if (! peer)
1513 return CMD_WARNING;
1515 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1517 return bgp_vty_return (vty, ret);
1520 DEFUN (neighbor_set_peer_group,
1521 neighbor_set_peer_group_cmd,
1522 NEIGHBOR_CMD "peer-group WORD",
1523 NEIGHBOR_STR
1524 NEIGHBOR_ADDR_STR
1525 "Member of the peer-group\n"
1526 "peer-group name\n")
1528 int ret;
1529 as_t as;
1530 union sockunion su;
1531 struct bgp *bgp;
1532 struct peer_group *group;
1534 bgp = vty->index;
1536 ret = str2sockunion (argv[0], &su);
1537 if (ret < 0)
1539 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1540 return CMD_WARNING;
1543 group = peer_group_lookup (bgp, argv[1]);
1544 if (! group)
1546 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1547 return CMD_WARNING;
1550 if (peer_address_self_check (&su))
1552 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1553 VTY_NEWLINE);
1554 return CMD_WARNING;
1557 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1558 bgp_node_safi (vty), &as);
1560 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1562 vty_out (vty, "%% Peer with AS %d cannot be in this peer-group, members must be all internal or all external%s", as, VTY_NEWLINE);
1563 return CMD_WARNING;
1566 return bgp_vty_return (vty, ret);
1569 DEFUN (no_neighbor_set_peer_group,
1570 no_neighbor_set_peer_group_cmd,
1571 NO_NEIGHBOR_CMD "peer-group WORD",
1572 NO_STR
1573 NEIGHBOR_STR
1574 NEIGHBOR_ADDR_STR
1575 "Member of the peer-group\n"
1576 "peer-group name\n")
1578 int ret;
1579 struct bgp *bgp;
1580 struct peer *peer;
1581 struct peer_group *group;
1583 bgp = vty->index;
1585 peer = peer_lookup_vty (vty, argv[0]);
1586 if (! peer)
1587 return CMD_WARNING;
1589 group = peer_group_lookup (bgp, argv[1]);
1590 if (! group)
1592 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1593 return CMD_WARNING;
1596 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1597 bgp_node_safi (vty));
1599 return bgp_vty_return (vty, ret);
1602 static int
1603 peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1604 u_int16_t flag, int set)
1606 int ret;
1607 struct peer *peer;
1609 peer = peer_and_group_lookup_vty (vty, ip_str);
1610 if (! peer)
1611 return CMD_WARNING;
1613 if (set)
1614 ret = peer_flag_set (peer, flag);
1615 else
1616 ret = peer_flag_unset (peer, flag);
1618 return bgp_vty_return (vty, ret);
1621 static int
1622 peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
1624 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1627 static int
1628 peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
1630 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1633 /* neighbor passive. */
1634 DEFUN (neighbor_passive,
1635 neighbor_passive_cmd,
1636 NEIGHBOR_CMD2 "passive",
1637 NEIGHBOR_STR
1638 NEIGHBOR_ADDR_STR2
1639 "Don't send open messages to this neighbor\n")
1641 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1644 DEFUN (no_neighbor_passive,
1645 no_neighbor_passive_cmd,
1646 NO_NEIGHBOR_CMD2 "passive",
1647 NO_STR
1648 NEIGHBOR_STR
1649 NEIGHBOR_ADDR_STR2
1650 "Don't send open messages to this neighbor\n")
1652 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1655 /* neighbor shutdown. */
1656 DEFUN (neighbor_shutdown,
1657 neighbor_shutdown_cmd,
1658 NEIGHBOR_CMD2 "shutdown",
1659 NEIGHBOR_STR
1660 NEIGHBOR_ADDR_STR2
1661 "Administratively shut down this neighbor\n")
1663 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1666 DEFUN (no_neighbor_shutdown,
1667 no_neighbor_shutdown_cmd,
1668 NO_NEIGHBOR_CMD2 "shutdown",
1669 NO_STR
1670 NEIGHBOR_STR
1671 NEIGHBOR_ADDR_STR2
1672 "Administratively shut down this neighbor\n")
1674 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1677 /* Deprecated neighbor capability route-refresh. */
1678 DEFUN_DEPRECATED (neighbor_capability_route_refresh,
1679 neighbor_capability_route_refresh_cmd,
1680 NEIGHBOR_CMD2 "capability route-refresh",
1681 NEIGHBOR_STR
1682 NEIGHBOR_ADDR_STR2
1683 "Advertise capability to the peer\n"
1684 "Advertise route-refresh capability to this neighbor\n")
1686 return CMD_SUCCESS;
1689 DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
1690 no_neighbor_capability_route_refresh_cmd,
1691 NO_NEIGHBOR_CMD2 "capability route-refresh",
1692 NO_STR
1693 NEIGHBOR_STR
1694 NEIGHBOR_ADDR_STR2
1695 "Advertise capability to the peer\n"
1696 "Advertise route-refresh capability to this neighbor\n")
1698 return CMD_SUCCESS;
1701 /* neighbor capability dynamic. */
1702 DEFUN (neighbor_capability_dynamic,
1703 neighbor_capability_dynamic_cmd,
1704 NEIGHBOR_CMD2 "capability dynamic",
1705 NEIGHBOR_STR
1706 NEIGHBOR_ADDR_STR2
1707 "Advertise capability to the peer\n"
1708 "Advertise dynamic capability to this neighbor\n")
1710 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1713 DEFUN (no_neighbor_capability_dynamic,
1714 no_neighbor_capability_dynamic_cmd,
1715 NO_NEIGHBOR_CMD2 "capability dynamic",
1716 NO_STR
1717 NEIGHBOR_STR
1718 NEIGHBOR_ADDR_STR2
1719 "Advertise capability to the peer\n"
1720 "Advertise dynamic capability to this neighbor\n")
1722 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1725 /* neighbor dont-capability-negotiate */
1726 DEFUN (neighbor_dont_capability_negotiate,
1727 neighbor_dont_capability_negotiate_cmd,
1728 NEIGHBOR_CMD2 "dont-capability-negotiate",
1729 NEIGHBOR_STR
1730 NEIGHBOR_ADDR_STR2
1731 "Do not perform capability negotiation\n")
1733 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
1736 DEFUN (no_neighbor_dont_capability_negotiate,
1737 no_neighbor_dont_capability_negotiate_cmd,
1738 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
1739 NO_STR
1740 NEIGHBOR_STR
1741 NEIGHBOR_ADDR_STR2
1742 "Do not perform capability negotiation\n")
1744 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
1747 static int
1748 peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
1749 safi_t safi, u_int32_t flag, int set)
1751 int ret;
1752 struct peer *peer;
1754 peer = peer_and_group_lookup_vty (vty, peer_str);
1755 if (! peer)
1756 return CMD_WARNING;
1758 if (set)
1759 ret = peer_af_flag_set (peer, afi, safi, flag);
1760 else
1761 ret = peer_af_flag_unset (peer, afi, safi, flag);
1763 return bgp_vty_return (vty, ret);
1766 static int
1767 peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
1768 safi_t safi, u_int32_t flag)
1770 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
1773 static int
1774 peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
1775 safi_t safi, u_int32_t flag)
1777 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
1780 /* neighbor capability orf prefix-list. */
1781 DEFUN (neighbor_capability_orf_prefix,
1782 neighbor_capability_orf_prefix_cmd,
1783 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
1784 NEIGHBOR_STR
1785 NEIGHBOR_ADDR_STR2
1786 "Advertise capability to the peer\n"
1787 "Advertise ORF capability to the peer\n"
1788 "Advertise prefixlist ORF capability to this neighbor\n"
1789 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
1790 "Capability to RECEIVE the ORF from this neighbor\n"
1791 "Capability to SEND the ORF to this neighbor\n")
1793 u_int16_t flag = 0;
1795 if (strncmp (argv[1], "s", 1) == 0)
1796 flag = PEER_FLAG_ORF_PREFIX_SM;
1797 else if (strncmp (argv[1], "r", 1) == 0)
1798 flag = PEER_FLAG_ORF_PREFIX_RM;
1799 else if (strncmp (argv[1], "b", 1) == 0)
1800 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
1801 else
1802 return CMD_WARNING;
1804 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1805 bgp_node_safi (vty), flag);
1808 DEFUN (no_neighbor_capability_orf_prefix,
1809 no_neighbor_capability_orf_prefix_cmd,
1810 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
1811 NO_STR
1812 NEIGHBOR_STR
1813 NEIGHBOR_ADDR_STR2
1814 "Advertise capability to the peer\n"
1815 "Advertise ORF capability to the peer\n"
1816 "Advertise prefixlist ORF capability to this neighbor\n"
1817 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
1818 "Capability to RECEIVE the ORF from this neighbor\n"
1819 "Capability to SEND the ORF to this neighbor\n")
1821 u_int16_t flag = 0;
1823 if (strncmp (argv[1], "s", 1) == 0)
1824 flag = PEER_FLAG_ORF_PREFIX_SM;
1825 else if (strncmp (argv[1], "r", 1) == 0)
1826 flag = PEER_FLAG_ORF_PREFIX_RM;
1827 else if (strncmp (argv[1], "b", 1) == 0)
1828 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
1829 else
1830 return CMD_WARNING;
1832 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1833 bgp_node_safi (vty), flag);
1836 /* neighbor next-hop-self. */
1837 DEFUN (neighbor_nexthop_self,
1838 neighbor_nexthop_self_cmd,
1839 NEIGHBOR_CMD2 "next-hop-self",
1840 NEIGHBOR_STR
1841 NEIGHBOR_ADDR_STR2
1842 "Disable the next hop calculation for this neighbor\n")
1844 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1845 bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
1848 DEFUN (no_neighbor_nexthop_self,
1849 no_neighbor_nexthop_self_cmd,
1850 NO_NEIGHBOR_CMD2 "next-hop-self",
1851 NO_STR
1852 NEIGHBOR_STR
1853 NEIGHBOR_ADDR_STR2
1854 "Disable the next hop calculation for this neighbor\n")
1856 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1857 bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
1860 /* neighbor remove-private-AS. */
1861 DEFUN (neighbor_remove_private_as,
1862 neighbor_remove_private_as_cmd,
1863 NEIGHBOR_CMD2 "remove-private-AS",
1864 NEIGHBOR_STR
1865 NEIGHBOR_ADDR_STR2
1866 "Remove private AS number from outbound updates\n")
1868 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1869 bgp_node_safi (vty),
1870 PEER_FLAG_REMOVE_PRIVATE_AS);
1873 DEFUN (no_neighbor_remove_private_as,
1874 no_neighbor_remove_private_as_cmd,
1875 NO_NEIGHBOR_CMD2 "remove-private-AS",
1876 NO_STR
1877 NEIGHBOR_STR
1878 NEIGHBOR_ADDR_STR2
1879 "Remove private AS number from outbound updates\n")
1881 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1882 bgp_node_safi (vty),
1883 PEER_FLAG_REMOVE_PRIVATE_AS);
1886 /* neighbor send-community. */
1887 DEFUN (neighbor_send_community,
1888 neighbor_send_community_cmd,
1889 NEIGHBOR_CMD2 "send-community",
1890 NEIGHBOR_STR
1891 NEIGHBOR_ADDR_STR2
1892 "Send Community attribute to this neighbor\n")
1894 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1895 bgp_node_safi (vty),
1896 PEER_FLAG_SEND_COMMUNITY);
1899 DEFUN (no_neighbor_send_community,
1900 no_neighbor_send_community_cmd,
1901 NO_NEIGHBOR_CMD2 "send-community",
1902 NO_STR
1903 NEIGHBOR_STR
1904 NEIGHBOR_ADDR_STR2
1905 "Send Community attribute to this neighbor\n")
1907 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1908 bgp_node_safi (vty),
1909 PEER_FLAG_SEND_COMMUNITY);
1912 /* neighbor send-community extended. */
1913 DEFUN (neighbor_send_community_type,
1914 neighbor_send_community_type_cmd,
1915 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
1916 NEIGHBOR_STR
1917 NEIGHBOR_ADDR_STR2
1918 "Send Community attribute to this neighbor\n"
1919 "Send Standard and Extended Community attributes\n"
1920 "Send Extended Community attributes\n"
1921 "Send Standard Community attributes\n")
1923 if (strncmp (argv[1], "s", 1) == 0)
1924 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1925 bgp_node_safi (vty),
1926 PEER_FLAG_SEND_COMMUNITY);
1927 if (strncmp (argv[1], "e", 1) == 0)
1928 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1929 bgp_node_safi (vty),
1930 PEER_FLAG_SEND_EXT_COMMUNITY);
1932 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1933 bgp_node_safi (vty),
1934 (PEER_FLAG_SEND_COMMUNITY|
1935 PEER_FLAG_SEND_EXT_COMMUNITY));
1938 DEFUN (no_neighbor_send_community_type,
1939 no_neighbor_send_community_type_cmd,
1940 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
1941 NO_STR
1942 NEIGHBOR_STR
1943 NEIGHBOR_ADDR_STR2
1944 "Send Community attribute to this neighbor\n"
1945 "Send Standard and Extended Community attributes\n"
1946 "Send Extended Community attributes\n"
1947 "Send Standard Community attributes\n")
1949 if (strncmp (argv[1], "s", 1) == 0)
1950 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1951 bgp_node_safi (vty),
1952 PEER_FLAG_SEND_COMMUNITY);
1953 if (strncmp (argv[1], "e", 1) == 0)
1954 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1955 bgp_node_safi (vty),
1956 PEER_FLAG_SEND_EXT_COMMUNITY);
1958 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1959 bgp_node_safi (vty),
1960 (PEER_FLAG_SEND_COMMUNITY |
1961 PEER_FLAG_SEND_EXT_COMMUNITY));
1964 /* neighbor soft-reconfig. */
1965 DEFUN (neighbor_soft_reconfiguration,
1966 neighbor_soft_reconfiguration_cmd,
1967 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
1968 NEIGHBOR_STR
1969 NEIGHBOR_ADDR_STR2
1970 "Per neighbor soft reconfiguration\n"
1971 "Allow inbound soft reconfiguration for this neighbor\n")
1973 return peer_af_flag_set_vty (vty, argv[0],
1974 bgp_node_afi (vty), bgp_node_safi (vty),
1975 PEER_FLAG_SOFT_RECONFIG);
1978 DEFUN (no_neighbor_soft_reconfiguration,
1979 no_neighbor_soft_reconfiguration_cmd,
1980 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
1981 NO_STR
1982 NEIGHBOR_STR
1983 NEIGHBOR_ADDR_STR2
1984 "Per neighbor soft reconfiguration\n"
1985 "Allow inbound soft reconfiguration for this neighbor\n")
1987 return peer_af_flag_unset_vty (vty, argv[0],
1988 bgp_node_afi (vty), bgp_node_safi (vty),
1989 PEER_FLAG_SOFT_RECONFIG);
1992 DEFUN (neighbor_route_reflector_client,
1993 neighbor_route_reflector_client_cmd,
1994 NEIGHBOR_CMD2 "route-reflector-client",
1995 NEIGHBOR_STR
1996 NEIGHBOR_ADDR_STR2
1997 "Configure a neighbor as Route Reflector client\n")
1999 struct peer *peer;
2002 peer = peer_and_group_lookup_vty (vty, argv[0]);
2003 if (! peer)
2004 return CMD_WARNING;
2006 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2007 bgp_node_safi (vty),
2008 PEER_FLAG_REFLECTOR_CLIENT);
2011 DEFUN (no_neighbor_route_reflector_client,
2012 no_neighbor_route_reflector_client_cmd,
2013 NO_NEIGHBOR_CMD2 "route-reflector-client",
2014 NO_STR
2015 NEIGHBOR_STR
2016 NEIGHBOR_ADDR_STR2
2017 "Configure a neighbor as Route Reflector client\n")
2019 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2020 bgp_node_safi (vty),
2021 PEER_FLAG_REFLECTOR_CLIENT);
2024 static int
2025 peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2026 int afi, int safi)
2028 int ret;
2029 struct bgp *bgp;
2030 struct peer *peer;
2031 struct peer_group *group;
2032 struct listnode *node, *nnode;
2033 struct bgp_filter *pfilter;
2034 struct bgp_filter *gfilter;
2036 bgp = vty->index;
2038 peer = peer_and_group_lookup_vty (vty, peer_str);
2039 if ( ! peer )
2040 return CMD_WARNING;
2042 /* If it is already a RS-Client, don't do anything. */
2043 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2044 return CMD_SUCCESS;
2046 if ( ! peer_rsclient_active (peer) )
2048 peer = peer_lock (peer); /* rsclient peer list reference */
2049 listnode_add_sort (bgp->rsclient, peer);
2052 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2053 if (ret < 0)
2054 return bgp_vty_return (vty, ret);
2056 peer->rib[afi][safi] = bgp_table_init ();
2057 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
2058 peer->rib[afi][safi]->owner = peer;
2060 /* Check for existing 'network' and 'redistribute' routes. */
2061 bgp_check_local_routes_rsclient (peer, afi, safi);
2063 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2064 bgp_soft_reconfig_rsclient (peer, afi, safi);
2066 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2068 group = peer->group;
2069 gfilter = &peer->filter[afi][safi];
2071 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
2073 pfilter = &peer->filter[afi][safi];
2075 /* Members of a non-RS-Client group should not be RS-Clients, as that
2076 is checked when the become part of the peer-group */
2077 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2078 if (ret < 0)
2079 return bgp_vty_return (vty, ret);
2081 /* Make peer's RIB point to group's RIB. */
2082 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2084 /* Import policy. */
2085 if (pfilter->map[RMAP_IMPORT].name)
2086 free (pfilter->map[RMAP_IMPORT].name);
2087 if (gfilter->map[RMAP_IMPORT].name)
2089 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2090 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2092 else
2094 pfilter->map[RMAP_IMPORT].name = NULL;
2095 pfilter->map[RMAP_IMPORT].map =NULL;
2098 /* Export policy. */
2099 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2101 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2102 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2106 return CMD_SUCCESS;
2109 static int
2110 peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2111 int afi, int safi)
2113 int ret;
2114 struct bgp *bgp;
2115 struct peer *peer;
2116 struct peer_group *group;
2117 struct listnode *node, *nnode;
2119 bgp = vty->index;
2121 peer = peer_and_group_lookup_vty (vty, peer_str);
2122 if ( ! peer )
2123 return CMD_WARNING;
2125 /* If it is not a RS-Client, don't do anything. */
2126 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2127 return CMD_SUCCESS;
2129 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2131 group = peer->group;
2133 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
2135 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2136 if (ret < 0)
2137 return bgp_vty_return (vty, ret);
2139 peer->rib[afi][safi] = NULL;
2142 peer = group->conf;
2145 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2146 if (ret < 0)
2147 return bgp_vty_return (vty, ret);
2149 if ( ! peer_rsclient_active (peer) )
2151 peer_unlock (peer); /* peer bgp rsclient reference */
2152 listnode_delete (bgp->rsclient, peer);
2155 bgp_table_finish (peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
2157 return CMD_SUCCESS;
2160 /* neighbor route-server-client. */
2161 DEFUN (neighbor_route_server_client,
2162 neighbor_route_server_client_cmd,
2163 NEIGHBOR_CMD2 "route-server-client",
2164 NEIGHBOR_STR
2165 NEIGHBOR_ADDR_STR2
2166 "Configure a neighbor as Route Server client\n")
2168 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2169 bgp_node_safi(vty));
2172 DEFUN (no_neighbor_route_server_client,
2173 no_neighbor_route_server_client_cmd,
2174 NO_NEIGHBOR_CMD2 "route-server-client",
2175 NO_STR
2176 NEIGHBOR_STR
2177 NEIGHBOR_ADDR_STR2
2178 "Configure a neighbor as Route Server client\n")
2180 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2181 bgp_node_safi(vty));
2184 DEFUN (neighbor_nexthop_local_unchanged,
2185 neighbor_nexthop_local_unchanged_cmd,
2186 NEIGHBOR_CMD2 "nexthop-local unchanged",
2187 NEIGHBOR_STR
2188 NEIGHBOR_ADDR_STR2
2189 "Configure treatment of outgoing link-local nexthop attribute\n"
2190 "Leave link-local nexthop unchanged for this peer\n")
2192 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2193 bgp_node_safi (vty),
2194 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2197 DEFUN (no_neighbor_nexthop_local_unchanged,
2198 no_neighbor_nexthop_local_unchanged_cmd,
2199 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2200 NO_STR
2201 NEIGHBOR_STR
2202 NEIGHBOR_ADDR_STR2
2203 "Configure treatment of outgoing link-local-nexthop attribute\n"
2204 "Leave link-local nexthop unchanged for this peer\n")
2206 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2207 bgp_node_safi (vty),
2208 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2211 DEFUN (neighbor_attr_unchanged,
2212 neighbor_attr_unchanged_cmd,
2213 NEIGHBOR_CMD2 "attribute-unchanged",
2214 NEIGHBOR_STR
2215 NEIGHBOR_ADDR_STR2
2216 "BGP attribute is propagated unchanged to this neighbor\n")
2218 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2219 bgp_node_safi (vty),
2220 (PEER_FLAG_AS_PATH_UNCHANGED |
2221 PEER_FLAG_NEXTHOP_UNCHANGED |
2222 PEER_FLAG_MED_UNCHANGED));
2225 DEFUN (neighbor_attr_unchanged1,
2226 neighbor_attr_unchanged1_cmd,
2227 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2228 NEIGHBOR_STR
2229 NEIGHBOR_ADDR_STR2
2230 "BGP attribute is propagated unchanged to this neighbor\n"
2231 "As-path attribute\n"
2232 "Nexthop attribute\n"
2233 "Med attribute\n")
2235 u_int16_t flags = 0;
2237 if (strncmp (argv[1], "as-path", 1) == 0)
2238 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2239 else if (strncmp (argv[1], "next-hop", 1) == 0)
2240 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2241 else if (strncmp (argv[1], "med", 1) == 0)
2242 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2244 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2245 bgp_node_safi (vty), flags);
2248 DEFUN (neighbor_attr_unchanged2,
2249 neighbor_attr_unchanged2_cmd,
2250 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2251 NEIGHBOR_STR
2252 NEIGHBOR_ADDR_STR2
2253 "BGP attribute is propagated unchanged to this neighbor\n"
2254 "As-path attribute\n"
2255 "Nexthop attribute\n"
2256 "Med attribute\n")
2258 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2260 if (strncmp (argv[1], "next-hop", 1) == 0)
2261 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2262 else if (strncmp (argv[1], "med", 1) == 0)
2263 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2265 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2266 bgp_node_safi (vty), flags);
2270 DEFUN (neighbor_attr_unchanged3,
2271 neighbor_attr_unchanged3_cmd,
2272 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2273 NEIGHBOR_STR
2274 NEIGHBOR_ADDR_STR2
2275 "BGP attribute is propagated unchanged to this neighbor\n"
2276 "Nexthop attribute\n"
2277 "As-path attribute\n"
2278 "Med attribute\n")
2280 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2282 if (strncmp (argv[1], "as-path", 1) == 0)
2283 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2284 else if (strncmp (argv[1], "med", 1) == 0)
2285 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2287 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2288 bgp_node_safi (vty), flags);
2291 DEFUN (neighbor_attr_unchanged4,
2292 neighbor_attr_unchanged4_cmd,
2293 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2294 NEIGHBOR_STR
2295 NEIGHBOR_ADDR_STR2
2296 "BGP attribute is propagated unchanged to this neighbor\n"
2297 "Med attribute\n"
2298 "As-path attribute\n"
2299 "Nexthop attribute\n")
2301 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2303 if (strncmp (argv[1], "as-path", 1) == 0)
2304 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2305 else if (strncmp (argv[1], "next-hop", 1) == 0)
2306 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2308 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2309 bgp_node_safi (vty), flags);
2312 ALIAS (neighbor_attr_unchanged,
2313 neighbor_attr_unchanged5_cmd,
2314 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2315 NEIGHBOR_STR
2316 NEIGHBOR_ADDR_STR2
2317 "BGP attribute is propagated unchanged to this neighbor\n"
2318 "As-path attribute\n"
2319 "Nexthop attribute\n"
2320 "Med attribute\n")
2322 ALIAS (neighbor_attr_unchanged,
2323 neighbor_attr_unchanged6_cmd,
2324 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2325 NEIGHBOR_STR
2326 NEIGHBOR_ADDR_STR2
2327 "BGP attribute is propagated unchanged to this neighbor\n"
2328 "As-path attribute\n"
2329 "Med attribute\n"
2330 "Nexthop attribute\n")
2332 ALIAS (neighbor_attr_unchanged,
2333 neighbor_attr_unchanged7_cmd,
2334 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2335 NEIGHBOR_STR
2336 NEIGHBOR_ADDR_STR2
2337 "BGP attribute is propagated unchanged to this neighbor\n"
2338 "Nexthop attribute\n"
2339 "Med attribute\n"
2340 "As-path attribute\n")
2342 ALIAS (neighbor_attr_unchanged,
2343 neighbor_attr_unchanged8_cmd,
2344 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2345 NEIGHBOR_STR
2346 NEIGHBOR_ADDR_STR2
2347 "BGP attribute is propagated unchanged to this neighbor\n"
2348 "Nexthop attribute\n"
2349 "As-path attribute\n"
2350 "Med attribute\n")
2352 ALIAS (neighbor_attr_unchanged,
2353 neighbor_attr_unchanged9_cmd,
2354 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2355 NEIGHBOR_STR
2356 NEIGHBOR_ADDR_STR2
2357 "BGP attribute is propagated unchanged to this neighbor\n"
2358 "Med attribute\n"
2359 "Nexthop attribute\n"
2360 "As-path attribute\n")
2362 ALIAS (neighbor_attr_unchanged,
2363 neighbor_attr_unchanged10_cmd,
2364 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2365 NEIGHBOR_STR
2366 NEIGHBOR_ADDR_STR2
2367 "BGP attribute is propagated unchanged to this neighbor\n"
2368 "Med attribute\n"
2369 "As-path attribute\n"
2370 "Nexthop attribute\n")
2372 DEFUN (no_neighbor_attr_unchanged,
2373 no_neighbor_attr_unchanged_cmd,
2374 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2375 NO_STR
2376 NEIGHBOR_STR
2377 NEIGHBOR_ADDR_STR2
2378 "BGP attribute is propagated unchanged to this neighbor\n")
2380 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2381 bgp_node_safi (vty),
2382 (PEER_FLAG_AS_PATH_UNCHANGED |
2383 PEER_FLAG_NEXTHOP_UNCHANGED |
2384 PEER_FLAG_MED_UNCHANGED));
2387 DEFUN (no_neighbor_attr_unchanged1,
2388 no_neighbor_attr_unchanged1_cmd,
2389 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2390 NO_STR
2391 NEIGHBOR_STR
2392 NEIGHBOR_ADDR_STR2
2393 "BGP attribute is propagated unchanged to this neighbor\n"
2394 "As-path attribute\n"
2395 "Nexthop attribute\n"
2396 "Med attribute\n")
2398 u_int16_t flags = 0;
2400 if (strncmp (argv[1], "as-path", 1) == 0)
2401 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2402 else if (strncmp (argv[1], "next-hop", 1) == 0)
2403 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2404 else if (strncmp (argv[1], "med", 1) == 0)
2405 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2407 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2408 bgp_node_safi (vty), flags);
2411 DEFUN (no_neighbor_attr_unchanged2,
2412 no_neighbor_attr_unchanged2_cmd,
2413 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2414 NO_STR
2415 NEIGHBOR_STR
2416 NEIGHBOR_ADDR_STR2
2417 "BGP attribute is propagated unchanged to this neighbor\n"
2418 "As-path attribute\n"
2419 "Nexthop attribute\n"
2420 "Med attribute\n")
2422 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2424 if (strncmp (argv[1], "next-hop", 1) == 0)
2425 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2426 else if (strncmp (argv[1], "med", 1) == 0)
2427 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2429 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2430 bgp_node_safi (vty), flags);
2433 DEFUN (no_neighbor_attr_unchanged3,
2434 no_neighbor_attr_unchanged3_cmd,
2435 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2436 NO_STR
2437 NEIGHBOR_STR
2438 NEIGHBOR_ADDR_STR2
2439 "BGP attribute is propagated unchanged to this neighbor\n"
2440 "Nexthop attribute\n"
2441 "As-path attribute\n"
2442 "Med attribute\n")
2444 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2446 if (strncmp (argv[1], "as-path", 1) == 0)
2447 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2448 else if (strncmp (argv[1], "med", 1) == 0)
2449 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2451 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2452 bgp_node_safi (vty), flags);
2455 DEFUN (no_neighbor_attr_unchanged4,
2456 no_neighbor_attr_unchanged4_cmd,
2457 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2458 NO_STR
2459 NEIGHBOR_STR
2460 NEIGHBOR_ADDR_STR2
2461 "BGP attribute is propagated unchanged to this neighbor\n"
2462 "Med attribute\n"
2463 "As-path attribute\n"
2464 "Nexthop attribute\n")
2466 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2468 if (strncmp (argv[1], "as-path", 1) == 0)
2469 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2470 else if (strncmp (argv[1], "next-hop", 1) == 0)
2471 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2473 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2474 bgp_node_safi (vty), flags);
2477 ALIAS (no_neighbor_attr_unchanged,
2478 no_neighbor_attr_unchanged5_cmd,
2479 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2480 NO_STR
2481 NEIGHBOR_STR
2482 NEIGHBOR_ADDR_STR2
2483 "BGP attribute is propagated unchanged to this neighbor\n"
2484 "As-path attribute\n"
2485 "Nexthop attribute\n"
2486 "Med attribute\n")
2488 ALIAS (no_neighbor_attr_unchanged,
2489 no_neighbor_attr_unchanged6_cmd,
2490 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2491 NO_STR
2492 NEIGHBOR_STR
2493 NEIGHBOR_ADDR_STR2
2494 "BGP attribute is propagated unchanged to this neighbor\n"
2495 "As-path attribute\n"
2496 "Med attribute\n"
2497 "Nexthop attribute\n")
2499 ALIAS (no_neighbor_attr_unchanged,
2500 no_neighbor_attr_unchanged7_cmd,
2501 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2502 NO_STR
2503 NEIGHBOR_STR
2504 NEIGHBOR_ADDR_STR2
2505 "BGP attribute is propagated unchanged to this neighbor\n"
2506 "Nexthop attribute\n"
2507 "Med attribute\n"
2508 "As-path attribute\n")
2510 ALIAS (no_neighbor_attr_unchanged,
2511 no_neighbor_attr_unchanged8_cmd,
2512 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2513 NO_STR
2514 NEIGHBOR_STR
2515 NEIGHBOR_ADDR_STR2
2516 "BGP attribute is propagated unchanged to this neighbor\n"
2517 "Nexthop attribute\n"
2518 "As-path attribute\n"
2519 "Med attribute\n")
2521 ALIAS (no_neighbor_attr_unchanged,
2522 no_neighbor_attr_unchanged9_cmd,
2523 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2524 NO_STR
2525 NEIGHBOR_STR
2526 NEIGHBOR_ADDR_STR2
2527 "BGP attribute is propagated unchanged to this neighbor\n"
2528 "Med attribute\n"
2529 "Nexthop attribute\n"
2530 "As-path attribute\n")
2532 ALIAS (no_neighbor_attr_unchanged,
2533 no_neighbor_attr_unchanged10_cmd,
2534 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2535 NO_STR
2536 NEIGHBOR_STR
2537 NEIGHBOR_ADDR_STR2
2538 "BGP attribute is propagated unchanged to this neighbor\n"
2539 "Med attribute\n"
2540 "As-path attribute\n"
2541 "Nexthop attribute\n")
2543 /* For old version Zebra compatibility. */
2544 DEFUN_DEPRECATED (neighbor_transparent_as,
2545 neighbor_transparent_as_cmd,
2546 NEIGHBOR_CMD "transparent-as",
2547 NEIGHBOR_STR
2548 NEIGHBOR_ADDR_STR
2549 "Do not append my AS number even peer is EBGP peer\n")
2551 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2552 bgp_node_safi (vty),
2553 PEER_FLAG_AS_PATH_UNCHANGED);
2556 DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2557 neighbor_transparent_nexthop_cmd,
2558 NEIGHBOR_CMD "transparent-nexthop",
2559 NEIGHBOR_STR
2560 NEIGHBOR_ADDR_STR
2561 "Do not change nexthop even peer is EBGP peer\n")
2563 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2564 bgp_node_safi (vty),
2565 PEER_FLAG_NEXTHOP_UNCHANGED);
2568 /* EBGP multihop configuration. */
2569 static int
2570 peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2571 const char *ttl_str)
2573 struct peer *peer;
2574 unsigned int ttl;
2576 peer = peer_and_group_lookup_vty (vty, ip_str);
2577 if (! peer)
2578 return CMD_WARNING;
2580 if (! ttl_str)
2581 ttl = TTL_MAX;
2582 else
2583 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2585 peer_ebgp_multihop_set (peer, ttl);
2587 return CMD_SUCCESS;
2590 static int
2591 peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
2593 struct peer *peer;
2595 peer = peer_and_group_lookup_vty (vty, ip_str);
2596 if (! peer)
2597 return CMD_WARNING;
2599 peer_ebgp_multihop_unset (peer);
2601 return CMD_SUCCESS;
2604 /* neighbor ebgp-multihop. */
2605 DEFUN (neighbor_ebgp_multihop,
2606 neighbor_ebgp_multihop_cmd,
2607 NEIGHBOR_CMD2 "ebgp-multihop",
2608 NEIGHBOR_STR
2609 NEIGHBOR_ADDR_STR2
2610 "Allow EBGP neighbors not on directly connected networks\n")
2612 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2615 DEFUN (neighbor_ebgp_multihop_ttl,
2616 neighbor_ebgp_multihop_ttl_cmd,
2617 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2618 NEIGHBOR_STR
2619 NEIGHBOR_ADDR_STR2
2620 "Allow EBGP neighbors not on directly connected networks\n"
2621 "maximum hop count\n")
2623 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
2626 DEFUN (no_neighbor_ebgp_multihop,
2627 no_neighbor_ebgp_multihop_cmd,
2628 NO_NEIGHBOR_CMD2 "ebgp-multihop",
2629 NO_STR
2630 NEIGHBOR_STR
2631 NEIGHBOR_ADDR_STR2
2632 "Allow EBGP neighbors not on directly connected networks\n")
2634 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
2637 ALIAS (no_neighbor_ebgp_multihop,
2638 no_neighbor_ebgp_multihop_ttl_cmd,
2639 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2640 NO_STR
2641 NEIGHBOR_STR
2642 NEIGHBOR_ADDR_STR2
2643 "Allow EBGP neighbors not on directly connected networks\n"
2644 "maximum hop count\n")
2646 /* disable-connected-check */
2647 DEFUN (neighbor_disable_connected_check,
2648 neighbor_disable_connected_check_cmd,
2649 NEIGHBOR_CMD2 "disable-connected-check",
2650 NEIGHBOR_STR
2651 NEIGHBOR_ADDR_STR2
2652 "one-hop away EBGP peer using loopback address\n")
2654 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2657 DEFUN (no_neighbor_disable_connected_check,
2658 no_neighbor_disable_connected_check_cmd,
2659 NO_NEIGHBOR_CMD2 "disable-connected-check",
2660 NO_STR
2661 NEIGHBOR_STR
2662 NEIGHBOR_ADDR_STR2
2663 "one-hop away EBGP peer using loopback address\n")
2665 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2668 /* Enforce multihop. */
2669 ALIAS (neighbor_disable_connected_check,
2670 neighbor_enforce_multihop_cmd,
2671 NEIGHBOR_CMD2 "enforce-multihop",
2672 NEIGHBOR_STR
2673 NEIGHBOR_ADDR_STR2
2674 "Enforce EBGP neighbors perform multihop\n");
2676 /* Enforce multihop. */
2677 ALIAS (no_neighbor_disable_connected_check,
2678 no_neighbor_enforce_multihop_cmd,
2679 NO_NEIGHBOR_CMD2 "enforce-multihop",
2680 NO_STR
2681 NEIGHBOR_STR
2682 NEIGHBOR_ADDR_STR2
2683 "Enforce EBGP neighbors perform multihop\n");
2685 DEFUN (neighbor_description,
2686 neighbor_description_cmd,
2687 NEIGHBOR_CMD2 "description .LINE",
2688 NEIGHBOR_STR
2689 NEIGHBOR_ADDR_STR2
2690 "Neighbor specific description\n"
2691 "Up to 80 characters describing this neighbor\n")
2693 struct peer *peer;
2694 char *str;
2696 peer = peer_and_group_lookup_vty (vty, argv[0]);
2697 if (! peer)
2698 return CMD_WARNING;
2700 if (argc == 1)
2701 return CMD_SUCCESS;
2703 str = argv_concat(argv, argc, 1);
2705 peer_description_set (peer, str);
2707 XFREE (MTYPE_TMP, str);
2709 return CMD_SUCCESS;
2712 DEFUN (no_neighbor_description,
2713 no_neighbor_description_cmd,
2714 NO_NEIGHBOR_CMD2 "description",
2715 NO_STR
2716 NEIGHBOR_STR
2717 NEIGHBOR_ADDR_STR2
2718 "Neighbor specific description\n")
2720 struct peer *peer;
2722 peer = peer_and_group_lookup_vty (vty, argv[0]);
2723 if (! peer)
2724 return CMD_WARNING;
2726 peer_description_unset (peer);
2728 return CMD_SUCCESS;
2731 ALIAS (no_neighbor_description,
2732 no_neighbor_description_val_cmd,
2733 NO_NEIGHBOR_CMD2 "description .LINE",
2734 NO_STR
2735 NEIGHBOR_STR
2736 NEIGHBOR_ADDR_STR2
2737 "Neighbor specific description\n"
2738 "Up to 80 characters describing this neighbor\n")
2740 /* Neighbor update-source. */
2741 static int
2742 peer_update_source_vty (struct vty *vty, const char *peer_str,
2743 const char *source_str)
2745 struct peer *peer;
2746 union sockunion *su;
2748 peer = peer_and_group_lookup_vty (vty, peer_str);
2749 if (! peer)
2750 return CMD_WARNING;
2752 if (source_str)
2754 su = sockunion_str2su (source_str);
2755 if (su)
2757 peer_update_source_addr_set (peer, su);
2758 sockunion_free (su);
2760 else
2761 peer_update_source_if_set (peer, source_str);
2763 else
2764 peer_update_source_unset (peer);
2766 return CMD_SUCCESS;
2769 DEFUN (neighbor_update_source,
2770 neighbor_update_source_cmd,
2771 NEIGHBOR_CMD2 "update-source WORD",
2772 NEIGHBOR_STR
2773 NEIGHBOR_ADDR_STR2
2774 "Source of routing updates\n"
2775 "Interface name\n")
2777 return peer_update_source_vty (vty, argv[0], argv[1]);
2780 DEFUN (no_neighbor_update_source,
2781 no_neighbor_update_source_cmd,
2782 NO_NEIGHBOR_CMD2 "update-source",
2783 NO_STR
2784 NEIGHBOR_STR
2785 NEIGHBOR_ADDR_STR2
2786 "Source of routing updates\n"
2787 "Interface name\n")
2789 return peer_update_source_vty (vty, argv[0], NULL);
2792 static int
2793 peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
2794 afi_t afi, safi_t safi,
2795 const char *rmap, int set)
2797 int ret;
2798 struct peer *peer;
2800 peer = peer_and_group_lookup_vty (vty, peer_str);
2801 if (! peer)
2802 return CMD_WARNING;
2804 if (set)
2805 ret = peer_default_originate_set (peer, afi, safi, rmap);
2806 else
2807 ret = peer_default_originate_unset (peer, afi, safi);
2809 return bgp_vty_return (vty, ret);
2812 /* neighbor default-originate. */
2813 DEFUN (neighbor_default_originate,
2814 neighbor_default_originate_cmd,
2815 NEIGHBOR_CMD2 "default-originate",
2816 NEIGHBOR_STR
2817 NEIGHBOR_ADDR_STR2
2818 "Originate default route to this neighbor\n")
2820 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2821 bgp_node_safi (vty), NULL, 1);
2824 DEFUN (neighbor_default_originate_rmap,
2825 neighbor_default_originate_rmap_cmd,
2826 NEIGHBOR_CMD2 "default-originate route-map WORD",
2827 NEIGHBOR_STR
2828 NEIGHBOR_ADDR_STR2
2829 "Originate default route to this neighbor\n"
2830 "Route-map to specify criteria to originate default\n"
2831 "route-map name\n")
2833 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2834 bgp_node_safi (vty), argv[1], 1);
2837 DEFUN (no_neighbor_default_originate,
2838 no_neighbor_default_originate_cmd,
2839 NO_NEIGHBOR_CMD2 "default-originate",
2840 NO_STR
2841 NEIGHBOR_STR
2842 NEIGHBOR_ADDR_STR2
2843 "Originate default route to this neighbor\n")
2845 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2846 bgp_node_safi (vty), NULL, 0);
2849 ALIAS (no_neighbor_default_originate,
2850 no_neighbor_default_originate_rmap_cmd,
2851 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
2852 NO_STR
2853 NEIGHBOR_STR
2854 NEIGHBOR_ADDR_STR2
2855 "Originate default route to this neighbor\n"
2856 "Route-map to specify criteria to originate default\n"
2857 "route-map name\n")
2859 /* Set neighbor's BGP port. */
2860 static int
2861 peer_port_vty (struct vty *vty, const char *ip_str, int afi,
2862 const char *port_str)
2864 struct peer *peer;
2865 u_int16_t port;
2866 struct servent *sp;
2868 peer = peer_lookup_vty (vty, ip_str);
2869 if (! peer)
2870 return CMD_WARNING;
2872 if (! port_str)
2874 sp = getservbyname ("bgp", "tcp");
2875 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
2877 else
2879 VTY_GET_INTEGER("port", port, port_str);
2882 peer_port_set (peer, port);
2884 return CMD_SUCCESS;
2887 /* Set specified peer's BGP port. */
2888 DEFUN (neighbor_port,
2889 neighbor_port_cmd,
2890 NEIGHBOR_CMD "port <0-65535>",
2891 NEIGHBOR_STR
2892 NEIGHBOR_ADDR_STR
2893 "Neighbor's BGP port\n"
2894 "TCP port number\n")
2896 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
2899 DEFUN (no_neighbor_port,
2900 no_neighbor_port_cmd,
2901 NO_NEIGHBOR_CMD "port",
2902 NO_STR
2903 NEIGHBOR_STR
2904 NEIGHBOR_ADDR_STR
2905 "Neighbor's BGP port\n")
2907 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
2910 ALIAS (no_neighbor_port,
2911 no_neighbor_port_val_cmd,
2912 NO_NEIGHBOR_CMD "port <0-65535>",
2913 NO_STR
2914 NEIGHBOR_STR
2915 NEIGHBOR_ADDR_STR
2916 "Neighbor's BGP port\n"
2917 "TCP port number\n")
2919 /* neighbor weight. */
2920 static int
2921 peer_weight_set_vty (struct vty *vty, const char *ip_str,
2922 const char *weight_str)
2924 int ret;
2925 struct peer *peer;
2926 unsigned long weight;
2928 peer = peer_and_group_lookup_vty (vty, ip_str);
2929 if (! peer)
2930 return CMD_WARNING;
2932 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
2934 ret = peer_weight_set (peer, weight);
2936 return CMD_SUCCESS;
2939 static int
2940 peer_weight_unset_vty (struct vty *vty, const char *ip_str)
2942 struct peer *peer;
2944 peer = peer_and_group_lookup_vty (vty, ip_str);
2945 if (! peer)
2946 return CMD_WARNING;
2948 peer_weight_unset (peer);
2950 return CMD_SUCCESS;
2953 DEFUN (neighbor_weight,
2954 neighbor_weight_cmd,
2955 NEIGHBOR_CMD2 "weight <0-65535>",
2956 NEIGHBOR_STR
2957 NEIGHBOR_ADDR_STR2
2958 "Set default weight for routes from this neighbor\n"
2959 "default weight\n")
2961 return peer_weight_set_vty (vty, argv[0], argv[1]);
2964 DEFUN (no_neighbor_weight,
2965 no_neighbor_weight_cmd,
2966 NO_NEIGHBOR_CMD2 "weight",
2967 NO_STR
2968 NEIGHBOR_STR
2969 NEIGHBOR_ADDR_STR2
2970 "Set default weight for routes from this neighbor\n")
2972 return peer_weight_unset_vty (vty, argv[0]);
2975 ALIAS (no_neighbor_weight,
2976 no_neighbor_weight_val_cmd,
2977 NO_NEIGHBOR_CMD2 "weight <0-65535>",
2978 NO_STR
2979 NEIGHBOR_STR
2980 NEIGHBOR_ADDR_STR2
2981 "Set default weight for routes from this neighbor\n"
2982 "default weight\n")
2984 /* Override capability negotiation. */
2985 DEFUN (neighbor_override_capability,
2986 neighbor_override_capability_cmd,
2987 NEIGHBOR_CMD2 "override-capability",
2988 NEIGHBOR_STR
2989 NEIGHBOR_ADDR_STR2
2990 "Override capability negotiation result\n")
2992 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
2995 DEFUN (no_neighbor_override_capability,
2996 no_neighbor_override_capability_cmd,
2997 NO_NEIGHBOR_CMD2 "override-capability",
2998 NO_STR
2999 NEIGHBOR_STR
3000 NEIGHBOR_ADDR_STR2
3001 "Override capability negotiation result\n")
3003 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3006 DEFUN (neighbor_strict_capability,
3007 neighbor_strict_capability_cmd,
3008 NEIGHBOR_CMD "strict-capability-match",
3009 NEIGHBOR_STR
3010 NEIGHBOR_ADDR_STR
3011 "Strict capability negotiation match\n")
3013 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3016 DEFUN (no_neighbor_strict_capability,
3017 no_neighbor_strict_capability_cmd,
3018 NO_NEIGHBOR_CMD "strict-capability-match",
3019 NO_STR
3020 NEIGHBOR_STR
3021 NEIGHBOR_ADDR_STR
3022 "Strict capability negotiation match\n")
3024 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3027 static int
3028 peer_timers_set_vty (struct vty *vty, const char *ip_str,
3029 const char *keep_str, const char *hold_str)
3031 int ret;
3032 struct peer *peer;
3033 u_int32_t keepalive;
3034 u_int32_t holdtime;
3036 peer = peer_and_group_lookup_vty (vty, ip_str);
3037 if (! peer)
3038 return CMD_WARNING;
3040 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3041 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3043 ret = peer_timers_set (peer, keepalive, holdtime);
3045 return bgp_vty_return (vty, ret);
3048 static int
3049 peer_timers_unset_vty (struct vty *vty, const char *ip_str)
3051 int ret;
3052 struct peer *peer;
3054 peer = peer_lookup_vty (vty, ip_str);
3055 if (! peer)
3056 return CMD_WARNING;
3058 ret = peer_timers_unset (peer);
3060 return bgp_vty_return (vty, ret);
3063 DEFUN (neighbor_timers,
3064 neighbor_timers_cmd,
3065 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3066 NEIGHBOR_STR
3067 NEIGHBOR_ADDR_STR2
3068 "BGP per neighbor timers\n"
3069 "Keepalive interval\n"
3070 "Holdtime\n")
3072 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3075 DEFUN (no_neighbor_timers,
3076 no_neighbor_timers_cmd,
3077 NO_NEIGHBOR_CMD2 "timers",
3078 NO_STR
3079 NEIGHBOR_STR
3080 NEIGHBOR_ADDR_STR2
3081 "BGP per neighbor timers\n")
3083 return peer_timers_unset_vty (vty, argv[0]);
3086 static int
3087 peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3088 const char *time_str)
3090 int ret;
3091 struct peer *peer;
3092 u_int32_t connect;
3094 peer = peer_lookup_vty (vty, ip_str);
3095 if (! peer)
3096 return CMD_WARNING;
3098 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3100 ret = peer_timers_connect_set (peer, connect);
3102 return CMD_SUCCESS;
3105 static int
3106 peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
3108 int ret;
3109 struct peer *peer;
3111 peer = peer_and_group_lookup_vty (vty, ip_str);
3112 if (! peer)
3113 return CMD_WARNING;
3115 ret = peer_timers_connect_unset (peer);
3117 return CMD_SUCCESS;
3120 DEFUN (neighbor_timers_connect,
3121 neighbor_timers_connect_cmd,
3122 NEIGHBOR_CMD "timers connect <0-65535>",
3123 NEIGHBOR_STR
3124 NEIGHBOR_ADDR_STR
3125 "BGP per neighbor timers\n"
3126 "BGP connect timer\n"
3127 "Connect timer\n")
3129 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3132 DEFUN (no_neighbor_timers_connect,
3133 no_neighbor_timers_connect_cmd,
3134 NO_NEIGHBOR_CMD "timers connect",
3135 NO_STR
3136 NEIGHBOR_STR
3137 NEIGHBOR_ADDR_STR
3138 "BGP per neighbor timers\n"
3139 "BGP connect timer\n")
3141 return peer_timers_connect_unset_vty (vty, argv[0]);
3144 ALIAS (no_neighbor_timers_connect,
3145 no_neighbor_timers_connect_val_cmd,
3146 NO_NEIGHBOR_CMD "timers connect <0-65535>",
3147 NO_STR
3148 NEIGHBOR_STR
3149 NEIGHBOR_ADDR_STR
3150 "BGP per neighbor timers\n"
3151 "BGP connect timer\n"
3152 "Connect timer\n")
3154 static int
3155 peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3156 const char *time_str, int set)
3158 int ret;
3159 struct peer *peer;
3160 u_int32_t routeadv = 0;
3162 peer = peer_lookup_vty (vty, ip_str);
3163 if (! peer)
3164 return CMD_WARNING;
3166 if (time_str)
3167 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3169 if (set)
3170 ret = peer_advertise_interval_set (peer, routeadv);
3171 else
3172 ret = peer_advertise_interval_unset (peer);
3174 return CMD_SUCCESS;
3177 DEFUN (neighbor_advertise_interval,
3178 neighbor_advertise_interval_cmd,
3179 NEIGHBOR_CMD "advertisement-interval <0-600>",
3180 NEIGHBOR_STR
3181 NEIGHBOR_ADDR_STR
3182 "Minimum interval between sending BGP routing updates\n"
3183 "time in seconds\n")
3185 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3188 DEFUN (no_neighbor_advertise_interval,
3189 no_neighbor_advertise_interval_cmd,
3190 NO_NEIGHBOR_CMD "advertisement-interval",
3191 NO_STR
3192 NEIGHBOR_STR
3193 NEIGHBOR_ADDR_STR
3194 "Minimum interval between sending BGP routing updates\n")
3196 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3199 ALIAS (no_neighbor_advertise_interval,
3200 no_neighbor_advertise_interval_val_cmd,
3201 NO_NEIGHBOR_CMD "advertisement-interval <0-600>",
3202 NO_STR
3203 NEIGHBOR_STR
3204 NEIGHBOR_ADDR_STR
3205 "Minimum interval between sending BGP routing updates\n"
3206 "time in seconds\n")
3208 /* neighbor interface */
3209 static int
3210 peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
3212 int ret;
3213 struct peer *peer;
3215 peer = peer_lookup_vty (vty, ip_str);
3216 if (! peer)
3217 return CMD_WARNING;
3219 if (str)
3220 ret = peer_interface_set (peer, str);
3221 else
3222 ret = peer_interface_unset (peer);
3224 return CMD_SUCCESS;
3227 DEFUN (neighbor_interface,
3228 neighbor_interface_cmd,
3229 NEIGHBOR_CMD "interface WORD",
3230 NEIGHBOR_STR
3231 NEIGHBOR_ADDR_STR
3232 "Interface\n"
3233 "Interface name\n")
3235 return peer_interface_vty (vty, argv[0], argv[1]);
3238 DEFUN (no_neighbor_interface,
3239 no_neighbor_interface_cmd,
3240 NO_NEIGHBOR_CMD "interface WORD",
3241 NO_STR
3242 NEIGHBOR_STR
3243 NEIGHBOR_ADDR_STR
3244 "Interface\n"
3245 "Interface name\n")
3247 return peer_interface_vty (vty, argv[0], NULL);
3250 /* Set distribute list to the peer. */
3251 static int
3252 peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3253 afi_t afi, safi_t safi,
3254 const char *name_str, const char *direct_str)
3256 int ret;
3257 struct peer *peer;
3258 int direct = FILTER_IN;
3260 peer = peer_and_group_lookup_vty (vty, ip_str);
3261 if (! peer)
3262 return CMD_WARNING;
3264 /* Check filter direction. */
3265 if (strncmp (direct_str, "i", 1) == 0)
3266 direct = FILTER_IN;
3267 else if (strncmp (direct_str, "o", 1) == 0)
3268 direct = FILTER_OUT;
3270 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3272 return bgp_vty_return (vty, ret);
3275 static int
3276 peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3277 safi_t safi, const char *direct_str)
3279 int ret;
3280 struct peer *peer;
3281 int direct = FILTER_IN;
3283 peer = peer_and_group_lookup_vty (vty, ip_str);
3284 if (! peer)
3285 return CMD_WARNING;
3287 /* Check filter direction. */
3288 if (strncmp (direct_str, "i", 1) == 0)
3289 direct = FILTER_IN;
3290 else if (strncmp (direct_str, "o", 1) == 0)
3291 direct = FILTER_OUT;
3293 ret = peer_distribute_unset (peer, afi, safi, direct);
3295 return bgp_vty_return (vty, ret);
3298 DEFUN (neighbor_distribute_list,
3299 neighbor_distribute_list_cmd,
3300 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3301 NEIGHBOR_STR
3302 NEIGHBOR_ADDR_STR2
3303 "Filter updates to/from this neighbor\n"
3304 "IP access-list number\n"
3305 "IP access-list number (expanded range)\n"
3306 "IP Access-list name\n"
3307 "Filter incoming updates\n"
3308 "Filter outgoing updates\n")
3310 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3311 bgp_node_safi (vty), argv[1], argv[2]);
3314 DEFUN (no_neighbor_distribute_list,
3315 no_neighbor_distribute_list_cmd,
3316 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3317 NO_STR
3318 NEIGHBOR_STR
3319 NEIGHBOR_ADDR_STR2
3320 "Filter updates to/from this neighbor\n"
3321 "IP access-list number\n"
3322 "IP access-list number (expanded range)\n"
3323 "IP Access-list name\n"
3324 "Filter incoming updates\n"
3325 "Filter outgoing updates\n")
3327 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3328 bgp_node_safi (vty), argv[2]);
3331 /* Set prefix list to the peer. */
3332 static int
3333 peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3334 safi_t safi, const char *name_str,
3335 const char *direct_str)
3337 int ret;
3338 struct peer *peer;
3339 int direct = FILTER_IN;
3341 peer = peer_and_group_lookup_vty (vty, ip_str);
3342 if (! peer)
3343 return CMD_WARNING;
3345 /* Check filter direction. */
3346 if (strncmp (direct_str, "i", 1) == 0)
3347 direct = FILTER_IN;
3348 else if (strncmp (direct_str, "o", 1) == 0)
3349 direct = FILTER_OUT;
3351 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3353 return bgp_vty_return (vty, ret);
3356 static int
3357 peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3358 safi_t safi, const char *direct_str)
3360 int ret;
3361 struct peer *peer;
3362 int direct = FILTER_IN;
3364 peer = peer_and_group_lookup_vty (vty, ip_str);
3365 if (! peer)
3366 return CMD_WARNING;
3368 /* Check filter direction. */
3369 if (strncmp (direct_str, "i", 1) == 0)
3370 direct = FILTER_IN;
3371 else if (strncmp (direct_str, "o", 1) == 0)
3372 direct = FILTER_OUT;
3374 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3376 return bgp_vty_return (vty, ret);
3379 DEFUN (neighbor_prefix_list,
3380 neighbor_prefix_list_cmd,
3381 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3382 NEIGHBOR_STR
3383 NEIGHBOR_ADDR_STR2
3384 "Filter updates to/from this neighbor\n"
3385 "Name of a prefix list\n"
3386 "Filter incoming updates\n"
3387 "Filter outgoing updates\n")
3389 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3390 bgp_node_safi (vty), argv[1], argv[2]);
3393 DEFUN (no_neighbor_prefix_list,
3394 no_neighbor_prefix_list_cmd,
3395 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3396 NO_STR
3397 NEIGHBOR_STR
3398 NEIGHBOR_ADDR_STR2
3399 "Filter updates to/from this neighbor\n"
3400 "Name of a prefix list\n"
3401 "Filter incoming updates\n"
3402 "Filter outgoing updates\n")
3404 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3405 bgp_node_safi (vty), argv[2]);
3408 static int
3409 peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3410 afi_t afi, safi_t safi,
3411 const char *name_str, const char *direct_str)
3413 int ret;
3414 struct peer *peer;
3415 int direct = FILTER_IN;
3417 peer = peer_and_group_lookup_vty (vty, ip_str);
3418 if (! peer)
3419 return CMD_WARNING;
3421 /* Check filter direction. */
3422 if (strncmp (direct_str, "i", 1) == 0)
3423 direct = FILTER_IN;
3424 else if (strncmp (direct_str, "o", 1) == 0)
3425 direct = FILTER_OUT;
3427 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3429 return bgp_vty_return (vty, ret);
3432 static int
3433 peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3434 afi_t afi, safi_t safi,
3435 const char *direct_str)
3437 int ret;
3438 struct peer *peer;
3439 int direct = FILTER_IN;
3441 peer = peer_and_group_lookup_vty (vty, ip_str);
3442 if (! peer)
3443 return CMD_WARNING;
3445 /* Check filter direction. */
3446 if (strncmp (direct_str, "i", 1) == 0)
3447 direct = FILTER_IN;
3448 else if (strncmp (direct_str, "o", 1) == 0)
3449 direct = FILTER_OUT;
3451 ret = peer_aslist_unset (peer, afi, safi, direct);
3453 return bgp_vty_return (vty, ret);
3456 DEFUN (neighbor_filter_list,
3457 neighbor_filter_list_cmd,
3458 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3459 NEIGHBOR_STR
3460 NEIGHBOR_ADDR_STR2
3461 "Establish BGP filters\n"
3462 "AS path access-list name\n"
3463 "Filter incoming routes\n"
3464 "Filter outgoing routes\n")
3466 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3467 bgp_node_safi (vty), argv[1], argv[2]);
3470 DEFUN (no_neighbor_filter_list,
3471 no_neighbor_filter_list_cmd,
3472 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3473 NO_STR
3474 NEIGHBOR_STR
3475 NEIGHBOR_ADDR_STR2
3476 "Establish BGP filters\n"
3477 "AS path access-list name\n"
3478 "Filter incoming routes\n"
3479 "Filter outgoing routes\n")
3481 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3482 bgp_node_safi (vty), argv[2]);
3485 /* Set route-map to the peer. */
3486 static int
3487 peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3488 afi_t afi, safi_t safi,
3489 const char *name_str, const char *direct_str)
3491 int ret;
3492 struct peer *peer;
3493 int direct = RMAP_IN;
3495 peer = peer_and_group_lookup_vty (vty, ip_str);
3496 if (! peer)
3497 return CMD_WARNING;
3499 /* Check filter direction. */
3500 if (strncmp (direct_str, "in", 2) == 0)
3501 direct = RMAP_IN;
3502 else if (strncmp (direct_str, "o", 1) == 0)
3503 direct = RMAP_OUT;
3504 else if (strncmp (direct_str, "im", 2) == 0)
3505 direct = RMAP_IMPORT;
3506 else if (strncmp (direct_str, "e", 1) == 0)
3507 direct = RMAP_EXPORT;
3509 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3511 return bgp_vty_return (vty, ret);
3514 static int
3515 peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3516 safi_t safi, const char *direct_str)
3518 int ret;
3519 struct peer *peer;
3520 int direct = RMAP_IN;
3522 peer = peer_and_group_lookup_vty (vty, ip_str);
3523 if (! peer)
3524 return CMD_WARNING;
3526 /* Check filter direction. */
3527 if (strncmp (direct_str, "in", 2) == 0)
3528 direct = RMAP_IN;
3529 else if (strncmp (direct_str, "o", 1) == 0)
3530 direct = RMAP_OUT;
3531 else if (strncmp (direct_str, "im", 2) == 0)
3532 direct = RMAP_IMPORT;
3533 else if (strncmp (direct_str, "e", 1) == 0)
3534 direct = RMAP_EXPORT;
3536 ret = peer_route_map_unset (peer, afi, safi, direct);
3538 return bgp_vty_return (vty, ret);
3541 DEFUN (neighbor_route_map,
3542 neighbor_route_map_cmd,
3543 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
3544 NEIGHBOR_STR
3545 NEIGHBOR_ADDR_STR2
3546 "Apply route map to neighbor\n"
3547 "Name of route map\n"
3548 "Apply map to incoming routes\n"
3549 "Apply map to outbound routes\n"
3550 "Apply map to routes going into a Route-Server client's table\n"
3551 "Apply map to routes coming from a Route-Server client")
3553 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3554 bgp_node_safi (vty), argv[1], argv[2]);
3557 DEFUN (no_neighbor_route_map,
3558 no_neighbor_route_map_cmd,
3559 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
3560 NO_STR
3561 NEIGHBOR_STR
3562 NEIGHBOR_ADDR_STR2
3563 "Apply route map to neighbor\n"
3564 "Name of route map\n"
3565 "Apply map to incoming routes\n"
3566 "Apply map to outbound routes\n"
3567 "Apply map to routes going into a Route-Server client's table\n"
3568 "Apply map to routes coming from a Route-Server client")
3570 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3571 bgp_node_safi (vty), argv[2]);
3574 /* Set unsuppress-map to the peer. */
3575 static int
3576 peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3577 safi_t safi, const char *name_str)
3579 int ret;
3580 struct peer *peer;
3582 peer = peer_and_group_lookup_vty (vty, ip_str);
3583 if (! peer)
3584 return CMD_WARNING;
3586 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3588 return bgp_vty_return (vty, ret);
3591 /* Unset route-map from the peer. */
3592 static int
3593 peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3594 safi_t safi)
3596 int ret;
3597 struct peer *peer;
3599 peer = peer_and_group_lookup_vty (vty, ip_str);
3600 if (! peer)
3601 return CMD_WARNING;
3603 ret = peer_unsuppress_map_unset (peer, afi, safi);
3605 return bgp_vty_return (vty, ret);
3608 DEFUN (neighbor_unsuppress_map,
3609 neighbor_unsuppress_map_cmd,
3610 NEIGHBOR_CMD2 "unsuppress-map WORD",
3611 NEIGHBOR_STR
3612 NEIGHBOR_ADDR_STR2
3613 "Route-map to selectively unsuppress suppressed routes\n"
3614 "Name of route map\n")
3616 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3617 bgp_node_safi (vty), argv[1]);
3620 DEFUN (no_neighbor_unsuppress_map,
3621 no_neighbor_unsuppress_map_cmd,
3622 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3623 NO_STR
3624 NEIGHBOR_STR
3625 NEIGHBOR_ADDR_STR2
3626 "Route-map to selectively unsuppress suppressed routes\n"
3627 "Name of route map\n")
3629 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3630 bgp_node_safi (vty));
3633 static int
3634 peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3635 safi_t safi, const char *num_str,
3636 const char *threshold_str, int warning,
3637 const char *restart_str)
3639 int ret;
3640 struct peer *peer;
3641 u_int32_t max;
3642 u_char threshold;
3643 u_int16_t restart;
3645 peer = peer_and_group_lookup_vty (vty, ip_str);
3646 if (! peer)
3647 return CMD_WARNING;
3649 VTY_GET_INTEGER ("maxmum number", max, num_str);
3650 if (threshold_str)
3651 threshold = atoi (threshold_str);
3652 else
3653 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
3655 if (restart_str)
3656 restart = atoi (restart_str);
3657 else
3658 restart = 0;
3660 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
3662 return bgp_vty_return (vty, ret);
3665 static int
3666 peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3667 safi_t safi)
3669 int ret;
3670 struct peer *peer;
3672 peer = peer_and_group_lookup_vty (vty, ip_str);
3673 if (! peer)
3674 return CMD_WARNING;
3676 ret = peer_maximum_prefix_unset (peer, afi, safi);
3678 return bgp_vty_return (vty, ret);
3681 /* Maximum number of prefix configuration. prefix count is different
3682 for each peer configuration. So this configuration can be set for
3683 each peer configuration. */
3684 DEFUN (neighbor_maximum_prefix,
3685 neighbor_maximum_prefix_cmd,
3686 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3687 NEIGHBOR_STR
3688 NEIGHBOR_ADDR_STR2
3689 "Maximum number of prefix accept from this peer\n"
3690 "maximum no. of prefix limit\n")
3692 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3693 bgp_node_safi (vty), argv[1], NULL, 0,
3694 NULL);
3697 DEFUN (neighbor_maximum_prefix_threshold,
3698 neighbor_maximum_prefix_threshold_cmd,
3699 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
3700 NEIGHBOR_STR
3701 NEIGHBOR_ADDR_STR2
3702 "Maximum number of prefix accept from this peer\n"
3703 "maximum no. of prefix limit\n"
3704 "Threshold value (%) at which to generate a warning msg\n")
3706 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3707 bgp_node_safi (vty), argv[1], argv[2], 0,
3708 NULL);
3711 DEFUN (neighbor_maximum_prefix_warning,
3712 neighbor_maximum_prefix_warning_cmd,
3713 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3714 NEIGHBOR_STR
3715 NEIGHBOR_ADDR_STR2
3716 "Maximum number of prefix accept from this peer\n"
3717 "maximum no. of prefix limit\n"
3718 "Only give warning message when limit is exceeded\n")
3720 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3721 bgp_node_safi (vty), argv[1], NULL, 1,
3722 NULL);
3725 DEFUN (neighbor_maximum_prefix_threshold_warning,
3726 neighbor_maximum_prefix_threshold_warning_cmd,
3727 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
3728 NEIGHBOR_STR
3729 NEIGHBOR_ADDR_STR2
3730 "Maximum number of prefix accept from this peer\n"
3731 "maximum no. of prefix limit\n"
3732 "Threshold value (%) at which to generate a warning msg\n"
3733 "Only give warning message when limit is exceeded\n")
3735 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3736 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
3739 DEFUN (neighbor_maximum_prefix_restart,
3740 neighbor_maximum_prefix_restart_cmd,
3741 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
3742 NEIGHBOR_STR
3743 NEIGHBOR_ADDR_STR2
3744 "Maximum number of prefix accept from this peer\n"
3745 "maximum no. of prefix limit\n"
3746 "Restart bgp connection after limit is exceeded\n"
3747 "Restart interval in minutes")
3749 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3750 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
3753 DEFUN (neighbor_maximum_prefix_threshold_restart,
3754 neighbor_maximum_prefix_threshold_restart_cmd,
3755 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
3756 NEIGHBOR_STR
3757 NEIGHBOR_ADDR_STR2
3758 "Maximum number of prefix accept from this peer\n"
3759 "maximum no. of prefix limit\n"
3760 "Threshold value (%) at which to generate a warning msg\n"
3761 "Restart bgp connection after limit is exceeded\n"
3762 "Restart interval in minutes")
3764 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3765 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
3768 DEFUN (no_neighbor_maximum_prefix,
3769 no_neighbor_maximum_prefix_cmd,
3770 NO_NEIGHBOR_CMD2 "maximum-prefix",
3771 NO_STR
3772 NEIGHBOR_STR
3773 NEIGHBOR_ADDR_STR2
3774 "Maximum number of prefix accept from this peer\n")
3776 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
3777 bgp_node_safi (vty));
3780 ALIAS (no_neighbor_maximum_prefix,
3781 no_neighbor_maximum_prefix_val_cmd,
3782 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3783 NO_STR
3784 NEIGHBOR_STR
3785 NEIGHBOR_ADDR_STR2
3786 "Maximum number of prefix accept from this peer\n"
3787 "maximum no. of prefix limit\n")
3789 ALIAS (no_neighbor_maximum_prefix,
3790 no_neighbor_maximum_prefix_threshold_cmd,
3791 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3792 NO_STR
3793 NEIGHBOR_STR
3794 NEIGHBOR_ADDR_STR2
3795 "Maximum number of prefix accept from this peer\n"
3796 "maximum no. of prefix limit\n"
3797 "Threshold value (%) at which to generate a warning msg\n")
3799 ALIAS (no_neighbor_maximum_prefix,
3800 no_neighbor_maximum_prefix_warning_cmd,
3801 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3802 NO_STR
3803 NEIGHBOR_STR
3804 NEIGHBOR_ADDR_STR2
3805 "Maximum number of prefix accept from this peer\n"
3806 "maximum no. of prefix limit\n"
3807 "Only give warning message when limit is exceeded\n");
3809 ALIAS (no_neighbor_maximum_prefix,
3810 no_neighbor_maximum_prefix_threshold_warning_cmd,
3811 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
3812 NO_STR
3813 NEIGHBOR_STR
3814 NEIGHBOR_ADDR_STR2
3815 "Maximum number of prefix accept from this peer\n"
3816 "maximum no. of prefix limit\n"
3817 "Threshold value (%) at which to generate a warning msg\n"
3818 "Only give warning message when limit is exceeded\n");
3820 ALIAS (no_neighbor_maximum_prefix,
3821 no_neighbor_maximum_prefix_restart_cmd,
3822 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
3823 NO_STR
3824 NEIGHBOR_STR
3825 NEIGHBOR_ADDR_STR2
3826 "Maximum number of prefix accept from this peer\n"
3827 "maximum no. of prefix limit\n"
3828 "Restart bgp connection after limit is exceeded\n"
3829 "Restart interval in minutes")
3831 ALIAS (no_neighbor_maximum_prefix,
3832 no_neighbor_maximum_prefix_threshold_restart_cmd,
3833 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
3834 NO_STR
3835 NEIGHBOR_STR
3836 NEIGHBOR_ADDR_STR2
3837 "Maximum number of prefix accept from this peer\n"
3838 "maximum no. of prefix limit\n"
3839 "Threshold value (%) at which to generate a warning msg\n"
3840 "Restart bgp connection after limit is exceeded\n"
3841 "Restart interval in minutes")
3843 /* "neighbor allowas-in" */
3844 DEFUN (neighbor_allowas_in,
3845 neighbor_allowas_in_cmd,
3846 NEIGHBOR_CMD2 "allowas-in",
3847 NEIGHBOR_STR
3848 NEIGHBOR_ADDR_STR2
3849 "Accept as-path with my AS present in it\n")
3851 int ret;
3852 struct peer *peer;
3853 unsigned int allow_num;
3855 peer = peer_and_group_lookup_vty (vty, argv[0]);
3856 if (! peer)
3857 return CMD_WARNING;
3859 if (argc == 1)
3860 allow_num = 3;
3861 else
3862 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
3864 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
3865 allow_num);
3867 return bgp_vty_return (vty, ret);
3870 ALIAS (neighbor_allowas_in,
3871 neighbor_allowas_in_arg_cmd,
3872 NEIGHBOR_CMD2 "allowas-in <1-10>",
3873 NEIGHBOR_STR
3874 NEIGHBOR_ADDR_STR2
3875 "Accept as-path with my AS present in it\n"
3876 "Number of occurances of AS number\n")
3878 DEFUN (no_neighbor_allowas_in,
3879 no_neighbor_allowas_in_cmd,
3880 NO_NEIGHBOR_CMD2 "allowas-in",
3881 NO_STR
3882 NEIGHBOR_STR
3883 NEIGHBOR_ADDR_STR2
3884 "allow local ASN appears in aspath attribute\n")
3886 int ret;
3887 struct peer *peer;
3889 peer = peer_and_group_lookup_vty (vty, argv[0]);
3890 if (! peer)
3891 return CMD_WARNING;
3893 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
3895 return bgp_vty_return (vty, ret);
3898 /* Address family configuration. */
3899 DEFUN (address_family_ipv4,
3900 address_family_ipv4_cmd,
3901 "address-family ipv4",
3902 "Enter Address Family command mode\n"
3903 "Address family\n")
3905 vty->node = BGP_IPV4_NODE;
3906 return CMD_SUCCESS;
3909 DEFUN (address_family_ipv4_safi,
3910 address_family_ipv4_safi_cmd,
3911 "address-family ipv4 (unicast|multicast)",
3912 "Enter Address Family command mode\n"
3913 "Address family\n"
3914 "Address Family modifier\n"
3915 "Address Family modifier\n")
3917 if (strncmp (argv[0], "m", 1) == 0)
3918 vty->node = BGP_IPV4M_NODE;
3919 else
3920 vty->node = BGP_IPV4_NODE;
3922 return CMD_SUCCESS;
3925 DEFUN (address_family_ipv6,
3926 address_family_ipv6_cmd,
3927 "address-family ipv6",
3928 "Enter Address Family command mode\n"
3929 "Address family\n")
3931 vty->node = BGP_IPV6_NODE;
3932 return CMD_SUCCESS;
3935 DEFUN (address_family_ipv6_safi,
3936 address_family_ipv6_safi_cmd,
3937 "address-family ipv6 (unicast|multicast)",
3938 "Enter Address Family command mode\n"
3939 "Address family\n"
3940 "Address Family modifier\n"
3941 "Address Family modifier\n")
3943 if (strncmp (argv[0], "m", 1) == 0)
3944 vty->node = BGP_IPV6M_NODE;
3945 else
3946 vty->node = BGP_IPV6_NODE;
3948 return CMD_SUCCESS;
3951 DEFUN (address_family_vpnv4,
3952 address_family_vpnv4_cmd,
3953 "address-family vpnv4",
3954 "Enter Address Family command mode\n"
3955 "Address family\n")
3957 vty->node = BGP_VPNV4_NODE;
3958 return CMD_SUCCESS;
3961 ALIAS (address_family_vpnv4,
3962 address_family_vpnv4_unicast_cmd,
3963 "address-family vpnv4 unicast",
3964 "Enter Address Family command mode\n"
3965 "Address family\n"
3966 "Address Family Modifier\n")
3968 DEFUN (exit_address_family,
3969 exit_address_family_cmd,
3970 "exit-address-family",
3971 "Exit from Address Family configuration mode\n")
3973 if (vty->node == BGP_IPV4_NODE
3974 || vty->node == BGP_IPV4M_NODE
3975 || vty->node == BGP_VPNV4_NODE
3976 || vty->node == BGP_IPV6_NODE
3977 || vty->node == BGP_IPV6M_NODE)
3978 vty->node = BGP_NODE;
3979 return CMD_SUCCESS;
3982 /* BGP clear sort. */
3983 enum clear_sort
3985 clear_all,
3986 clear_peer,
3987 clear_group,
3988 clear_external,
3989 clear_as
3992 static void
3993 bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
3994 safi_t safi, int error)
3996 switch (error)
3998 case BGP_ERR_AF_UNCONFIGURED:
3999 vty_out (vty,
4000 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4001 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4002 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4003 peer->host, VTY_NEWLINE);
4004 break;
4005 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4006 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);
4007 break;
4008 default:
4009 break;
4013 /* `clear ip bgp' functions. */
4014 static int
4015 bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
4016 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
4018 int ret;
4019 struct peer *peer;
4020 struct listnode *node, *nnode;
4022 /* Clear all neighbors. */
4023 if (sort == clear_all)
4025 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
4027 if (stype == BGP_CLEAR_SOFT_NONE)
4028 ret = peer_clear (peer);
4029 else
4030 ret = peer_clear_soft (peer, afi, safi, stype);
4032 if (ret < 0)
4033 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4035 return 0;
4038 /* Clear specified neighbors. */
4039 if (sort == clear_peer)
4041 union sockunion su;
4042 int ret;
4044 /* Make sockunion for lookup. */
4045 ret = str2sockunion (arg, &su);
4046 if (ret < 0)
4048 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
4049 return -1;
4051 peer = peer_lookup (bgp, &su);
4052 if (! peer)
4054 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
4055 return -1;
4058 if (stype == BGP_CLEAR_SOFT_NONE)
4059 ret = peer_clear (peer);
4060 else
4061 ret = peer_clear_soft (peer, afi, safi, stype);
4063 if (ret < 0)
4064 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4066 return 0;
4069 /* Clear all peer-group members. */
4070 if (sort == clear_group)
4072 struct peer_group *group;
4074 group = peer_group_lookup (bgp, arg);
4075 if (! group)
4077 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
4078 return -1;
4081 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
4083 if (stype == BGP_CLEAR_SOFT_NONE)
4085 ret = peer_clear (peer);
4086 continue;
4089 if (! peer->af_group[afi][safi])
4090 continue;
4092 ret = peer_clear_soft (peer, afi, safi, stype);
4094 if (ret < 0)
4095 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4097 return 0;
4100 if (sort == clear_external)
4102 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
4104 if (peer_sort (peer) == BGP_PEER_IBGP)
4105 continue;
4107 if (stype == BGP_CLEAR_SOFT_NONE)
4108 ret = peer_clear (peer);
4109 else
4110 ret = peer_clear_soft (peer, afi, safi, stype);
4112 if (ret < 0)
4113 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4115 return 0;
4118 if (sort == clear_as)
4120 as_t as;
4121 unsigned long as_ul;
4122 char *endptr = NULL;
4123 int find = 0;
4125 as_ul = strtoul(arg, &endptr, 10);
4127 if ((as_ul == ULONG_MAX) || (*endptr != '\0') || (as_ul > USHRT_MAX))
4129 vty_out (vty, "Invalid AS number%s", VTY_NEWLINE);
4130 return -1;
4132 as = (as_t) as_ul;
4134 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
4136 if (peer->as != as)
4137 continue;
4139 find = 1;
4140 if (stype == BGP_CLEAR_SOFT_NONE)
4141 ret = peer_clear (peer);
4142 else
4143 ret = peer_clear_soft (peer, afi, safi, stype);
4145 if (ret < 0)
4146 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4148 if (! find)
4149 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4150 VTY_NEWLINE);
4151 return 0;
4154 return 0;
4157 static int
4158 bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4159 enum clear_sort sort, enum bgp_clear_type stype,
4160 const char *arg)
4162 int ret;
4163 struct bgp *bgp;
4165 /* BGP structure lookup. */
4166 if (name)
4168 bgp = bgp_lookup_by_name (name);
4169 if (bgp == NULL)
4171 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4172 return CMD_WARNING;
4175 else
4177 bgp = bgp_get_default ();
4178 if (bgp == NULL)
4180 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4181 return CMD_WARNING;
4185 ret = bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
4186 if (ret < 0)
4187 return CMD_WARNING;
4189 return CMD_SUCCESS;
4192 DEFUN (clear_ip_bgp_all,
4193 clear_ip_bgp_all_cmd,
4194 "clear ip bgp *",
4195 CLEAR_STR
4196 IP_STR
4197 BGP_STR
4198 "Clear all peers\n")
4200 if (argc == 1)
4201 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4203 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4206 ALIAS (clear_ip_bgp_all,
4207 clear_bgp_all_cmd,
4208 "clear bgp *",
4209 CLEAR_STR
4210 BGP_STR
4211 "Clear all peers\n")
4213 ALIAS (clear_ip_bgp_all,
4214 clear_bgp_ipv6_all_cmd,
4215 "clear bgp ipv6 *",
4216 CLEAR_STR
4217 BGP_STR
4218 "Address family\n"
4219 "Clear all peers\n")
4221 ALIAS (clear_ip_bgp_all,
4222 clear_ip_bgp_instance_all_cmd,
4223 "clear ip bgp view WORD *",
4224 CLEAR_STR
4225 IP_STR
4226 BGP_STR
4227 "BGP view\n"
4228 "view name\n"
4229 "Clear all peers\n")
4231 ALIAS (clear_ip_bgp_all,
4232 clear_bgp_instance_all_cmd,
4233 "clear bgp view WORD *",
4234 CLEAR_STR
4235 BGP_STR
4236 "BGP view\n"
4237 "view name\n"
4238 "Clear all peers\n")
4240 DEFUN (clear_ip_bgp_peer,
4241 clear_ip_bgp_peer_cmd,
4242 "clear ip bgp (A.B.C.D|X:X::X:X)",
4243 CLEAR_STR
4244 IP_STR
4245 BGP_STR
4246 "BGP neighbor IP address to clear\n"
4247 "BGP IPv6 neighbor to clear\n")
4249 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4252 ALIAS (clear_ip_bgp_peer,
4253 clear_bgp_peer_cmd,
4254 "clear bgp (A.B.C.D|X:X::X:X)",
4255 CLEAR_STR
4256 BGP_STR
4257 "BGP neighbor address to clear\n"
4258 "BGP IPv6 neighbor to clear\n")
4260 ALIAS (clear_ip_bgp_peer,
4261 clear_bgp_ipv6_peer_cmd,
4262 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4263 CLEAR_STR
4264 BGP_STR
4265 "Address family\n"
4266 "BGP neighbor address to clear\n"
4267 "BGP IPv6 neighbor to clear\n")
4269 DEFUN (clear_ip_bgp_peer_group,
4270 clear_ip_bgp_peer_group_cmd,
4271 "clear ip bgp peer-group WORD",
4272 CLEAR_STR
4273 IP_STR
4274 BGP_STR
4275 "Clear all members of peer-group\n"
4276 "BGP peer-group name\n")
4278 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4281 ALIAS (clear_ip_bgp_peer_group,
4282 clear_bgp_peer_group_cmd,
4283 "clear bgp peer-group WORD",
4284 CLEAR_STR
4285 BGP_STR
4286 "Clear all members of peer-group\n"
4287 "BGP peer-group name\n")
4289 ALIAS (clear_ip_bgp_peer_group,
4290 clear_bgp_ipv6_peer_group_cmd,
4291 "clear bgp ipv6 peer-group WORD",
4292 CLEAR_STR
4293 BGP_STR
4294 "Address family\n"
4295 "Clear all members of peer-group\n"
4296 "BGP peer-group name\n")
4298 DEFUN (clear_ip_bgp_external,
4299 clear_ip_bgp_external_cmd,
4300 "clear ip bgp external",
4301 CLEAR_STR
4302 IP_STR
4303 BGP_STR
4304 "Clear all external peers\n")
4306 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4309 ALIAS (clear_ip_bgp_external,
4310 clear_bgp_external_cmd,
4311 "clear bgp external",
4312 CLEAR_STR
4313 BGP_STR
4314 "Clear all external peers\n")
4316 ALIAS (clear_ip_bgp_external,
4317 clear_bgp_ipv6_external_cmd,
4318 "clear bgp ipv6 external",
4319 CLEAR_STR
4320 BGP_STR
4321 "Address family\n"
4322 "Clear all external peers\n")
4324 DEFUN (clear_ip_bgp_as,
4325 clear_ip_bgp_as_cmd,
4326 "clear ip bgp <1-65535>",
4327 CLEAR_STR
4328 IP_STR
4329 BGP_STR
4330 "Clear peers with the AS number\n")
4332 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4335 ALIAS (clear_ip_bgp_as,
4336 clear_bgp_as_cmd,
4337 "clear bgp <1-65535>",
4338 CLEAR_STR
4339 BGP_STR
4340 "Clear peers with the AS number\n")
4342 ALIAS (clear_ip_bgp_as,
4343 clear_bgp_ipv6_as_cmd,
4344 "clear bgp ipv6 <1-65535>",
4345 CLEAR_STR
4346 BGP_STR
4347 "Address family\n"
4348 "Clear peers with the AS number\n")
4350 /* Outbound soft-reconfiguration */
4351 DEFUN (clear_ip_bgp_all_soft_out,
4352 clear_ip_bgp_all_soft_out_cmd,
4353 "clear ip bgp * soft out",
4354 CLEAR_STR
4355 IP_STR
4356 BGP_STR
4357 "Clear all peers\n"
4358 "Soft reconfig\n"
4359 "Soft reconfig outbound update\n")
4361 if (argc == 1)
4362 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4363 BGP_CLEAR_SOFT_OUT, NULL);
4365 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4366 BGP_CLEAR_SOFT_OUT, NULL);
4369 ALIAS (clear_ip_bgp_all_soft_out,
4370 clear_ip_bgp_all_out_cmd,
4371 "clear ip bgp * out",
4372 CLEAR_STR
4373 IP_STR
4374 BGP_STR
4375 "Clear all peers\n"
4376 "Soft reconfig outbound update\n")
4378 ALIAS (clear_ip_bgp_all_soft_out,
4379 clear_ip_bgp_instance_all_soft_out_cmd,
4380 "clear ip bgp view WORD * soft out",
4381 CLEAR_STR
4382 IP_STR
4383 BGP_STR
4384 "BGP view\n"
4385 "view name\n"
4386 "Clear all peers\n"
4387 "Soft reconfig\n"
4388 "Soft reconfig outbound update\n")
4390 DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4391 clear_ip_bgp_all_ipv4_soft_out_cmd,
4392 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4393 CLEAR_STR
4394 IP_STR
4395 BGP_STR
4396 "Clear all peers\n"
4397 "Address family\n"
4398 "Address Family modifier\n"
4399 "Address Family modifier\n"
4400 "Soft reconfig\n"
4401 "Soft reconfig outbound update\n")
4403 if (strncmp (argv[0], "m", 1) == 0)
4404 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4405 BGP_CLEAR_SOFT_OUT, NULL);
4407 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4408 BGP_CLEAR_SOFT_OUT, NULL);
4411 ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4412 clear_ip_bgp_all_ipv4_out_cmd,
4413 "clear ip bgp * ipv4 (unicast|multicast) out",
4414 CLEAR_STR
4415 IP_STR
4416 BGP_STR
4417 "Clear all peers\n"
4418 "Address family\n"
4419 "Address Family modifier\n"
4420 "Address Family modifier\n"
4421 "Soft reconfig outbound update\n")
4423 DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4424 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4425 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4426 CLEAR_STR
4427 IP_STR
4428 BGP_STR
4429 "BGP view\n"
4430 "view name\n"
4431 "Clear all peers\n"
4432 "Address family\n"
4433 "Address Family modifier\n"
4434 "Address Family modifier\n"
4435 "Soft reconfig outbound update\n")
4437 if (strncmp (argv[1], "m", 1) == 0)
4438 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4439 BGP_CLEAR_SOFT_OUT, NULL);
4441 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4442 BGP_CLEAR_SOFT_OUT, NULL);
4445 DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4446 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4447 "clear ip bgp * vpnv4 unicast soft out",
4448 CLEAR_STR
4449 IP_STR
4450 BGP_STR
4451 "Clear all peers\n"
4452 "Address family\n"
4453 "Address Family Modifier\n"
4454 "Soft reconfig\n"
4455 "Soft reconfig outbound update\n")
4457 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4458 BGP_CLEAR_SOFT_OUT, NULL);
4461 ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4462 clear_ip_bgp_all_vpnv4_out_cmd,
4463 "clear ip bgp * vpnv4 unicast out",
4464 CLEAR_STR
4465 IP_STR
4466 BGP_STR
4467 "Clear all peers\n"
4468 "Address family\n"
4469 "Address Family Modifier\n"
4470 "Soft reconfig outbound update\n")
4472 DEFUN (clear_bgp_all_soft_out,
4473 clear_bgp_all_soft_out_cmd,
4474 "clear bgp * soft out",
4475 CLEAR_STR
4476 BGP_STR
4477 "Clear all peers\n"
4478 "Soft reconfig\n"
4479 "Soft reconfig outbound update\n")
4481 if (argc == 1)
4482 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4483 BGP_CLEAR_SOFT_OUT, NULL);
4485 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4486 BGP_CLEAR_SOFT_OUT, NULL);
4489 ALIAS (clear_bgp_all_soft_out,
4490 clear_bgp_instance_all_soft_out_cmd,
4491 "clear bgp view WORD * soft out",
4492 CLEAR_STR
4493 BGP_STR
4494 "BGP view\n"
4495 "view name\n"
4496 "Clear all peers\n"
4497 "Soft reconfig\n"
4498 "Soft reconfig outbound update\n")
4500 ALIAS (clear_bgp_all_soft_out,
4501 clear_bgp_all_out_cmd,
4502 "clear bgp * out",
4503 CLEAR_STR
4504 BGP_STR
4505 "Clear all peers\n"
4506 "Soft reconfig outbound update\n")
4508 ALIAS (clear_bgp_all_soft_out,
4509 clear_bgp_ipv6_all_soft_out_cmd,
4510 "clear bgp ipv6 * soft out",
4511 CLEAR_STR
4512 BGP_STR
4513 "Address family\n"
4514 "Clear all peers\n"
4515 "Soft reconfig\n"
4516 "Soft reconfig outbound update\n")
4518 ALIAS (clear_bgp_all_soft_out,
4519 clear_bgp_ipv6_all_out_cmd,
4520 "clear bgp ipv6 * out",
4521 CLEAR_STR
4522 BGP_STR
4523 "Address family\n"
4524 "Clear all peers\n"
4525 "Soft reconfig outbound update\n")
4527 DEFUN (clear_ip_bgp_peer_soft_out,
4528 clear_ip_bgp_peer_soft_out_cmd,
4529 "clear ip bgp A.B.C.D soft out",
4530 CLEAR_STR
4531 IP_STR
4532 BGP_STR
4533 "BGP neighbor address to clear\n"
4534 "Soft reconfig\n"
4535 "Soft reconfig outbound update\n")
4537 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4538 BGP_CLEAR_SOFT_OUT, argv[0]);
4541 ALIAS (clear_ip_bgp_peer_soft_out,
4542 clear_ip_bgp_peer_out_cmd,
4543 "clear ip bgp A.B.C.D out",
4544 CLEAR_STR
4545 IP_STR
4546 BGP_STR
4547 "BGP neighbor address to clear\n"
4548 "Soft reconfig outbound update\n")
4550 DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4551 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4552 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4553 CLEAR_STR
4554 IP_STR
4555 BGP_STR
4556 "BGP neighbor address to clear\n"
4557 "Address family\n"
4558 "Address Family modifier\n"
4559 "Address Family modifier\n"
4560 "Soft reconfig\n"
4561 "Soft reconfig outbound update\n")
4563 if (strncmp (argv[1], "m", 1) == 0)
4564 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4565 BGP_CLEAR_SOFT_OUT, argv[0]);
4567 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4568 BGP_CLEAR_SOFT_OUT, argv[0]);
4571 ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
4572 clear_ip_bgp_peer_ipv4_out_cmd,
4573 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
4574 CLEAR_STR
4575 IP_STR
4576 BGP_STR
4577 "BGP neighbor address to clear\n"
4578 "Address family\n"
4579 "Address Family modifier\n"
4580 "Address Family modifier\n"
4581 "Soft reconfig outbound update\n")
4583 DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
4584 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
4585 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
4586 CLEAR_STR
4587 IP_STR
4588 BGP_STR
4589 "BGP neighbor address to clear\n"
4590 "Address family\n"
4591 "Address Family Modifier\n"
4592 "Soft reconfig\n"
4593 "Soft reconfig outbound update\n")
4595 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
4596 BGP_CLEAR_SOFT_OUT, argv[0]);
4599 ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
4600 clear_ip_bgp_peer_vpnv4_out_cmd,
4601 "clear ip bgp A.B.C.D vpnv4 unicast out",
4602 CLEAR_STR
4603 IP_STR
4604 BGP_STR
4605 "BGP neighbor address to clear\n"
4606 "Address family\n"
4607 "Address Family Modifier\n"
4608 "Soft reconfig outbound update\n")
4610 DEFUN (clear_bgp_peer_soft_out,
4611 clear_bgp_peer_soft_out_cmd,
4612 "clear bgp (A.B.C.D|X:X::X:X) soft out",
4613 CLEAR_STR
4614 BGP_STR
4615 "BGP neighbor address to clear\n"
4616 "BGP IPv6 neighbor to clear\n"
4617 "Soft reconfig\n"
4618 "Soft reconfig outbound update\n")
4620 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
4621 BGP_CLEAR_SOFT_OUT, argv[0]);
4624 ALIAS (clear_bgp_peer_soft_out,
4625 clear_bgp_ipv6_peer_soft_out_cmd,
4626 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
4627 CLEAR_STR
4628 BGP_STR
4629 "Address family\n"
4630 "BGP neighbor address to clear\n"
4631 "BGP IPv6 neighbor to clear\n"
4632 "Soft reconfig\n"
4633 "Soft reconfig outbound update\n")
4635 ALIAS (clear_bgp_peer_soft_out,
4636 clear_bgp_peer_out_cmd,
4637 "clear bgp (A.B.C.D|X:X::X:X) out",
4638 CLEAR_STR
4639 BGP_STR
4640 "BGP neighbor address to clear\n"
4641 "BGP IPv6 neighbor to clear\n"
4642 "Soft reconfig outbound update\n")
4644 ALIAS (clear_bgp_peer_soft_out,
4645 clear_bgp_ipv6_peer_out_cmd,
4646 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
4647 CLEAR_STR
4648 BGP_STR
4649 "Address family\n"
4650 "BGP neighbor address to clear\n"
4651 "BGP IPv6 neighbor to clear\n"
4652 "Soft reconfig outbound update\n")
4654 DEFUN (clear_ip_bgp_peer_group_soft_out,
4655 clear_ip_bgp_peer_group_soft_out_cmd,
4656 "clear ip bgp peer-group WORD soft out",
4657 CLEAR_STR
4658 IP_STR
4659 BGP_STR
4660 "Clear all members of peer-group\n"
4661 "BGP peer-group name\n"
4662 "Soft reconfig\n"
4663 "Soft reconfig outbound update\n")
4665 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4666 BGP_CLEAR_SOFT_OUT, argv[0]);
4669 ALIAS (clear_ip_bgp_peer_group_soft_out,
4670 clear_ip_bgp_peer_group_out_cmd,
4671 "clear ip bgp peer-group WORD out",
4672 CLEAR_STR
4673 IP_STR
4674 BGP_STR
4675 "Clear all members of peer-group\n"
4676 "BGP peer-group name\n"
4677 "Soft reconfig outbound update\n")
4679 DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
4680 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
4681 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
4682 CLEAR_STR
4683 IP_STR
4684 BGP_STR
4685 "Clear all members of peer-group\n"
4686 "BGP peer-group name\n"
4687 "Address family\n"
4688 "Address Family modifier\n"
4689 "Address Family modifier\n"
4690 "Soft reconfig\n"
4691 "Soft reconfig outbound update\n")
4693 if (strncmp (argv[1], "m", 1) == 0)
4694 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
4695 BGP_CLEAR_SOFT_OUT, argv[0]);
4697 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4698 BGP_CLEAR_SOFT_OUT, argv[0]);
4701 ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
4702 clear_ip_bgp_peer_group_ipv4_out_cmd,
4703 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
4704 CLEAR_STR
4705 IP_STR
4706 BGP_STR
4707 "Clear all members of peer-group\n"
4708 "BGP peer-group name\n"
4709 "Address family\n"
4710 "Address Family modifier\n"
4711 "Address Family modifier\n"
4712 "Soft reconfig outbound update\n")
4714 DEFUN (clear_bgp_peer_group_soft_out,
4715 clear_bgp_peer_group_soft_out_cmd,
4716 "clear bgp peer-group WORD soft out",
4717 CLEAR_STR
4718 BGP_STR
4719 "Clear all members of peer-group\n"
4720 "BGP peer-group name\n"
4721 "Soft reconfig\n"
4722 "Soft reconfig outbound update\n")
4724 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
4725 BGP_CLEAR_SOFT_OUT, argv[0]);
4728 ALIAS (clear_bgp_peer_group_soft_out,
4729 clear_bgp_ipv6_peer_group_soft_out_cmd,
4730 "clear bgp ipv6 peer-group WORD soft out",
4731 CLEAR_STR
4732 BGP_STR
4733 "Address family\n"
4734 "Clear all members of peer-group\n"
4735 "BGP peer-group name\n"
4736 "Soft reconfig\n"
4737 "Soft reconfig outbound update\n")
4739 ALIAS (clear_bgp_peer_group_soft_out,
4740 clear_bgp_peer_group_out_cmd,
4741 "clear bgp peer-group WORD out",
4742 CLEAR_STR
4743 BGP_STR
4744 "Clear all members of peer-group\n"
4745 "BGP peer-group name\n"
4746 "Soft reconfig outbound update\n")
4748 ALIAS (clear_bgp_peer_group_soft_out,
4749 clear_bgp_ipv6_peer_group_out_cmd,
4750 "clear bgp ipv6 peer-group WORD out",
4751 CLEAR_STR
4752 BGP_STR
4753 "Address family\n"
4754 "Clear all members of peer-group\n"
4755 "BGP peer-group name\n"
4756 "Soft reconfig outbound update\n")
4758 DEFUN (clear_ip_bgp_external_soft_out,
4759 clear_ip_bgp_external_soft_out_cmd,
4760 "clear ip bgp external soft out",
4761 CLEAR_STR
4762 IP_STR
4763 BGP_STR
4764 "Clear all external peers\n"
4765 "Soft reconfig\n"
4766 "Soft reconfig outbound update\n")
4768 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
4769 BGP_CLEAR_SOFT_OUT, NULL);
4772 ALIAS (clear_ip_bgp_external_soft_out,
4773 clear_ip_bgp_external_out_cmd,
4774 "clear ip bgp external out",
4775 CLEAR_STR
4776 IP_STR
4777 BGP_STR
4778 "Clear all external peers\n"
4779 "Soft reconfig outbound update\n")
4781 DEFUN (clear_ip_bgp_external_ipv4_soft_out,
4782 clear_ip_bgp_external_ipv4_soft_out_cmd,
4783 "clear ip bgp external ipv4 (unicast|multicast) soft out",
4784 CLEAR_STR
4785 IP_STR
4786 BGP_STR
4787 "Clear all external peers\n"
4788 "Address family\n"
4789 "Address Family modifier\n"
4790 "Address Family modifier\n"
4791 "Soft reconfig\n"
4792 "Soft reconfig outbound update\n")
4794 if (strncmp (argv[0], "m", 1) == 0)
4795 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
4796 BGP_CLEAR_SOFT_OUT, NULL);
4798 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
4799 BGP_CLEAR_SOFT_OUT, NULL);
4802 ALIAS (clear_ip_bgp_external_ipv4_soft_out,
4803 clear_ip_bgp_external_ipv4_out_cmd,
4804 "clear ip bgp external ipv4 (unicast|multicast) out",
4805 CLEAR_STR
4806 IP_STR
4807 BGP_STR
4808 "Clear all external peers\n"
4809 "Address family\n"
4810 "Address Family modifier\n"
4811 "Address Family modifier\n"
4812 "Soft reconfig outbound update\n")
4814 DEFUN (clear_bgp_external_soft_out,
4815 clear_bgp_external_soft_out_cmd,
4816 "clear bgp external soft out",
4817 CLEAR_STR
4818 BGP_STR
4819 "Clear all external peers\n"
4820 "Soft reconfig\n"
4821 "Soft reconfig outbound update\n")
4823 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
4824 BGP_CLEAR_SOFT_OUT, NULL);
4827 ALIAS (clear_bgp_external_soft_out,
4828 clear_bgp_ipv6_external_soft_out_cmd,
4829 "clear bgp ipv6 external soft out",
4830 CLEAR_STR
4831 BGP_STR
4832 "Address family\n"
4833 "Clear all external peers\n"
4834 "Soft reconfig\n"
4835 "Soft reconfig outbound update\n")
4837 ALIAS (clear_bgp_external_soft_out,
4838 clear_bgp_external_out_cmd,
4839 "clear bgp external out",
4840 CLEAR_STR
4841 BGP_STR
4842 "Clear all external peers\n"
4843 "Soft reconfig outbound update\n")
4845 ALIAS (clear_bgp_external_soft_out,
4846 clear_bgp_ipv6_external_out_cmd,
4847 "clear bgp ipv6 external WORD out",
4848 CLEAR_STR
4849 BGP_STR
4850 "Address family\n"
4851 "Clear all external peers\n"
4852 "Soft reconfig outbound update\n")
4854 DEFUN (clear_ip_bgp_as_soft_out,
4855 clear_ip_bgp_as_soft_out_cmd,
4856 "clear ip bgp <1-65535> soft out",
4857 CLEAR_STR
4858 IP_STR
4859 BGP_STR
4860 "Clear peers with the AS number\n"
4861 "Soft reconfig\n"
4862 "Soft reconfig outbound update\n")
4864 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
4865 BGP_CLEAR_SOFT_OUT, argv[0]);
4868 ALIAS (clear_ip_bgp_as_soft_out,
4869 clear_ip_bgp_as_out_cmd,
4870 "clear ip bgp <1-65535> out",
4871 CLEAR_STR
4872 IP_STR
4873 BGP_STR
4874 "Clear peers with the AS number\n"
4875 "Soft reconfig outbound update\n")
4877 DEFUN (clear_ip_bgp_as_ipv4_soft_out,
4878 clear_ip_bgp_as_ipv4_soft_out_cmd,
4879 "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft out",
4880 CLEAR_STR
4881 IP_STR
4882 BGP_STR
4883 "Clear peers with the AS number\n"
4884 "Address family\n"
4885 "Address Family modifier\n"
4886 "Address Family modifier\n"
4887 "Soft reconfig\n"
4888 "Soft reconfig outbound update\n")
4890 if (strncmp (argv[1], "m", 1) == 0)
4891 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
4892 BGP_CLEAR_SOFT_OUT, argv[0]);
4894 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
4895 BGP_CLEAR_SOFT_OUT, argv[0]);
4898 ALIAS (clear_ip_bgp_as_ipv4_soft_out,
4899 clear_ip_bgp_as_ipv4_out_cmd,
4900 "clear ip bgp <1-65535> ipv4 (unicast|multicast) out",
4901 CLEAR_STR
4902 IP_STR
4903 BGP_STR
4904 "Clear peers with the AS number\n"
4905 "Address family\n"
4906 "Address Family modifier\n"
4907 "Address Family modifier\n"
4908 "Soft reconfig outbound update\n")
4910 DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
4911 clear_ip_bgp_as_vpnv4_soft_out_cmd,
4912 "clear ip bgp <1-65535> vpnv4 unicast soft out",
4913 CLEAR_STR
4914 IP_STR
4915 BGP_STR
4916 "Clear peers with the AS number\n"
4917 "Address family\n"
4918 "Address Family modifier\n"
4919 "Soft reconfig\n"
4920 "Soft reconfig outbound update\n")
4922 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
4923 BGP_CLEAR_SOFT_OUT, argv[0]);
4926 ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
4927 clear_ip_bgp_as_vpnv4_out_cmd,
4928 "clear ip bgp <1-65535> vpnv4 unicast out",
4929 CLEAR_STR
4930 IP_STR
4931 BGP_STR
4932 "Clear peers with the AS number\n"
4933 "Address family\n"
4934 "Address Family modifier\n"
4935 "Soft reconfig outbound update\n")
4937 DEFUN (clear_bgp_as_soft_out,
4938 clear_bgp_as_soft_out_cmd,
4939 "clear bgp <1-65535> soft out",
4940 CLEAR_STR
4941 BGP_STR
4942 "Clear peers with the AS number\n"
4943 "Soft reconfig\n"
4944 "Soft reconfig outbound update\n")
4946 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
4947 BGP_CLEAR_SOFT_OUT, argv[0]);
4950 ALIAS (clear_bgp_as_soft_out,
4951 clear_bgp_ipv6_as_soft_out_cmd,
4952 "clear bgp ipv6 <1-65535> soft out",
4953 CLEAR_STR
4954 BGP_STR
4955 "Address family\n"
4956 "Clear peers with the AS number\n"
4957 "Soft reconfig\n"
4958 "Soft reconfig outbound update\n")
4960 ALIAS (clear_bgp_as_soft_out,
4961 clear_bgp_as_out_cmd,
4962 "clear bgp <1-65535> out",
4963 CLEAR_STR
4964 BGP_STR
4965 "Clear peers with the AS number\n"
4966 "Soft reconfig outbound update\n")
4968 ALIAS (clear_bgp_as_soft_out,
4969 clear_bgp_ipv6_as_out_cmd,
4970 "clear bgp ipv6 <1-65535> out",
4971 CLEAR_STR
4972 BGP_STR
4973 "Address family\n"
4974 "Clear peers with the AS number\n"
4975 "Soft reconfig outbound update\n")
4977 /* Inbound soft-reconfiguration */
4978 DEFUN (clear_ip_bgp_all_soft_in,
4979 clear_ip_bgp_all_soft_in_cmd,
4980 "clear ip bgp * soft in",
4981 CLEAR_STR
4982 IP_STR
4983 BGP_STR
4984 "Clear all peers\n"
4985 "Soft reconfig\n"
4986 "Soft reconfig inbound update\n")
4988 if (argc == 1)
4989 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4990 BGP_CLEAR_SOFT_IN, NULL);
4992 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4993 BGP_CLEAR_SOFT_IN, NULL);
4996 ALIAS (clear_ip_bgp_all_soft_in,
4997 clear_ip_bgp_instance_all_soft_in_cmd,
4998 "clear ip bgp view WORD * soft in",
4999 CLEAR_STR
5000 IP_STR
5001 BGP_STR
5002 "BGP view\n"
5003 "view name\n"
5004 "Clear all peers\n"
5005 "Soft reconfig\n"
5006 "Soft reconfig inbound update\n")
5008 ALIAS (clear_ip_bgp_all_soft_in,
5009 clear_ip_bgp_all_in_cmd,
5010 "clear ip bgp * in",
5011 CLEAR_STR
5012 IP_STR
5013 BGP_STR
5014 "Clear all peers\n"
5015 "Soft reconfig inbound update\n")
5017 DEFUN (clear_ip_bgp_all_in_prefix_filter,
5018 clear_ip_bgp_all_in_prefix_filter_cmd,
5019 "clear ip bgp * in prefix-filter",
5020 CLEAR_STR
5021 IP_STR
5022 BGP_STR
5023 "Clear all peers\n"
5024 "Soft reconfig inbound update\n"
5025 "Push out prefix-list ORF and do inbound soft reconfig\n")
5027 if (argc== 1)
5028 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5029 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5031 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5032 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5035 ALIAS (clear_ip_bgp_all_in_prefix_filter,
5036 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5037 "clear ip bgp view WORD * in prefix-filter",
5038 CLEAR_STR
5039 IP_STR
5040 BGP_STR
5041 "BGP view\n"
5042 "view name\n"
5043 "Clear all peers\n"
5044 "Soft reconfig inbound update\n"
5045 "Push out prefix-list ORF and do inbound soft reconfig\n")
5048 DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5049 clear_ip_bgp_all_ipv4_soft_in_cmd,
5050 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5051 CLEAR_STR
5052 IP_STR
5053 BGP_STR
5054 "Clear all peers\n"
5055 "Address family\n"
5056 "Address Family modifier\n"
5057 "Address Family modifier\n"
5058 "Soft reconfig\n"
5059 "Soft reconfig inbound update\n")
5061 if (strncmp (argv[0], "m", 1) == 0)
5062 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5063 BGP_CLEAR_SOFT_IN, NULL);
5065 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5066 BGP_CLEAR_SOFT_IN, NULL);
5069 ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5070 clear_ip_bgp_all_ipv4_in_cmd,
5071 "clear ip bgp * ipv4 (unicast|multicast) in",
5072 CLEAR_STR
5073 IP_STR
5074 BGP_STR
5075 "Clear all peers\n"
5076 "Address family\n"
5077 "Address Family modifier\n"
5078 "Address Family modifier\n"
5079 "Soft reconfig inbound update\n")
5081 DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5082 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5083 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5084 CLEAR_STR
5085 IP_STR
5086 BGP_STR
5087 "BGP view\n"
5088 "view name\n"
5089 "Clear all peers\n"
5090 "Address family\n"
5091 "Address Family modifier\n"
5092 "Address Family modifier\n"
5093 "Soft reconfig\n"
5094 "Soft reconfig inbound update\n")
5096 if (strncmp (argv[1], "m", 1) == 0)
5097 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5098 BGP_CLEAR_SOFT_IN, NULL);
5100 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5101 BGP_CLEAR_SOFT_IN, NULL);
5104 DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5105 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5106 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5107 CLEAR_STR
5108 IP_STR
5109 BGP_STR
5110 "Clear all peers\n"
5111 "Address family\n"
5112 "Address Family modifier\n"
5113 "Address Family modifier\n"
5114 "Soft reconfig inbound update\n"
5115 "Push out prefix-list ORF and do inbound soft reconfig\n")
5117 if (strncmp (argv[0], "m", 1) == 0)
5118 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5119 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5121 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5122 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5125 DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5126 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5127 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5128 CLEAR_STR
5129 IP_STR
5130 BGP_STR
5131 "Clear all peers\n"
5132 "Address family\n"
5133 "Address Family modifier\n"
5134 "Address Family modifier\n"
5135 "Soft reconfig inbound update\n"
5136 "Push out prefix-list ORF and do inbound soft reconfig\n")
5138 if (strncmp (argv[1], "m", 1) == 0)
5139 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5140 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5142 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5143 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5146 DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5147 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5148 "clear ip bgp * vpnv4 unicast soft in",
5149 CLEAR_STR
5150 IP_STR
5151 BGP_STR
5152 "Clear all peers\n"
5153 "Address family\n"
5154 "Address Family Modifier\n"
5155 "Soft reconfig\n"
5156 "Soft reconfig inbound update\n")
5158 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5159 BGP_CLEAR_SOFT_IN, NULL);
5162 ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5163 clear_ip_bgp_all_vpnv4_in_cmd,
5164 "clear ip bgp * vpnv4 unicast in",
5165 CLEAR_STR
5166 IP_STR
5167 BGP_STR
5168 "Clear all peers\n"
5169 "Address family\n"
5170 "Address Family Modifier\n"
5171 "Soft reconfig inbound update\n")
5173 DEFUN (clear_bgp_all_soft_in,
5174 clear_bgp_all_soft_in_cmd,
5175 "clear bgp * soft in",
5176 CLEAR_STR
5177 BGP_STR
5178 "Clear all peers\n"
5179 "Soft reconfig\n"
5180 "Soft reconfig inbound update\n")
5182 if (argc == 1)
5183 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5184 BGP_CLEAR_SOFT_IN, NULL);
5186 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5187 BGP_CLEAR_SOFT_IN, NULL);
5190 ALIAS (clear_bgp_all_soft_in,
5191 clear_bgp_instance_all_soft_in_cmd,
5192 "clear bgp view WORD * soft in",
5193 CLEAR_STR
5194 BGP_STR
5195 "BGP view\n"
5196 "view name\n"
5197 "Clear all peers\n"
5198 "Soft reconfig\n"
5199 "Soft reconfig inbound update\n")
5201 ALIAS (clear_bgp_all_soft_in,
5202 clear_bgp_ipv6_all_soft_in_cmd,
5203 "clear bgp ipv6 * soft in",
5204 CLEAR_STR
5205 BGP_STR
5206 "Address family\n"
5207 "Clear all peers\n"
5208 "Soft reconfig\n"
5209 "Soft reconfig inbound update\n")
5211 ALIAS (clear_bgp_all_soft_in,
5212 clear_bgp_all_in_cmd,
5213 "clear bgp * in",
5214 CLEAR_STR
5215 BGP_STR
5216 "Clear all peers\n"
5217 "Soft reconfig inbound update\n")
5219 ALIAS (clear_bgp_all_soft_in,
5220 clear_bgp_ipv6_all_in_cmd,
5221 "clear bgp ipv6 * in",
5222 CLEAR_STR
5223 BGP_STR
5224 "Address family\n"
5225 "Clear all peers\n"
5226 "Soft reconfig inbound update\n")
5228 DEFUN (clear_bgp_all_in_prefix_filter,
5229 clear_bgp_all_in_prefix_filter_cmd,
5230 "clear bgp * in prefix-filter",
5231 CLEAR_STR
5232 BGP_STR
5233 "Clear all peers\n"
5234 "Soft reconfig inbound update\n"
5235 "Push out prefix-list ORF and do inbound soft reconfig\n")
5237 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5238 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5241 ALIAS (clear_bgp_all_in_prefix_filter,
5242 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5243 "clear bgp ipv6 * in prefix-filter",
5244 CLEAR_STR
5245 BGP_STR
5246 "Address family\n"
5247 "Clear all peers\n"
5248 "Soft reconfig inbound update\n"
5249 "Push out prefix-list ORF and do inbound soft reconfig\n")
5251 DEFUN (clear_ip_bgp_peer_soft_in,
5252 clear_ip_bgp_peer_soft_in_cmd,
5253 "clear ip bgp A.B.C.D soft in",
5254 CLEAR_STR
5255 IP_STR
5256 BGP_STR
5257 "BGP neighbor address to clear\n"
5258 "Soft reconfig\n"
5259 "Soft reconfig inbound update\n")
5261 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5262 BGP_CLEAR_SOFT_IN, argv[0]);
5265 ALIAS (clear_ip_bgp_peer_soft_in,
5266 clear_ip_bgp_peer_in_cmd,
5267 "clear ip bgp A.B.C.D in",
5268 CLEAR_STR
5269 IP_STR
5270 BGP_STR
5271 "BGP neighbor address to clear\n"
5272 "Soft reconfig inbound update\n")
5274 DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5275 clear_ip_bgp_peer_in_prefix_filter_cmd,
5276 "clear ip bgp A.B.C.D in prefix-filter",
5277 CLEAR_STR
5278 IP_STR
5279 BGP_STR
5280 "BGP neighbor address to clear\n"
5281 "Soft reconfig inbound update\n"
5282 "Push out the existing ORF prefix-list\n")
5284 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5285 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5288 DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5289 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5290 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5291 CLEAR_STR
5292 IP_STR
5293 BGP_STR
5294 "BGP neighbor address to clear\n"
5295 "Address family\n"
5296 "Address Family modifier\n"
5297 "Address Family modifier\n"
5298 "Soft reconfig\n"
5299 "Soft reconfig inbound update\n")
5301 if (strncmp (argv[1], "m", 1) == 0)
5302 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5303 BGP_CLEAR_SOFT_IN, argv[0]);
5305 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5306 BGP_CLEAR_SOFT_IN, argv[0]);
5309 ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5310 clear_ip_bgp_peer_ipv4_in_cmd,
5311 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5312 CLEAR_STR
5313 IP_STR
5314 BGP_STR
5315 "BGP neighbor address to clear\n"
5316 "Address family\n"
5317 "Address Family modifier\n"
5318 "Address Family modifier\n"
5319 "Soft reconfig inbound update\n")
5321 DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5322 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5323 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5324 CLEAR_STR
5325 IP_STR
5326 BGP_STR
5327 "BGP neighbor address to clear\n"
5328 "Address family\n"
5329 "Address Family modifier\n"
5330 "Address Family modifier\n"
5331 "Soft reconfig inbound update\n"
5332 "Push out the existing ORF prefix-list\n")
5334 if (strncmp (argv[1], "m", 1) == 0)
5335 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5336 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5338 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5339 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5342 DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5343 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5344 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5345 CLEAR_STR
5346 IP_STR
5347 BGP_STR
5348 "BGP neighbor address to clear\n"
5349 "Address family\n"
5350 "Address Family Modifier\n"
5351 "Soft reconfig\n"
5352 "Soft reconfig inbound update\n")
5354 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5355 BGP_CLEAR_SOFT_IN, argv[0]);
5358 ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5359 clear_ip_bgp_peer_vpnv4_in_cmd,
5360 "clear ip bgp A.B.C.D vpnv4 unicast in",
5361 CLEAR_STR
5362 IP_STR
5363 BGP_STR
5364 "BGP neighbor address to clear\n"
5365 "Address family\n"
5366 "Address Family Modifier\n"
5367 "Soft reconfig inbound update\n")
5369 DEFUN (clear_bgp_peer_soft_in,
5370 clear_bgp_peer_soft_in_cmd,
5371 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5372 CLEAR_STR
5373 BGP_STR
5374 "BGP neighbor address to clear\n"
5375 "BGP IPv6 neighbor to clear\n"
5376 "Soft reconfig\n"
5377 "Soft reconfig inbound update\n")
5379 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5380 BGP_CLEAR_SOFT_IN, argv[0]);
5383 ALIAS (clear_bgp_peer_soft_in,
5384 clear_bgp_ipv6_peer_soft_in_cmd,
5385 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5386 CLEAR_STR
5387 BGP_STR
5388 "Address family\n"
5389 "BGP neighbor address to clear\n"
5390 "BGP IPv6 neighbor to clear\n"
5391 "Soft reconfig\n"
5392 "Soft reconfig inbound update\n")
5394 ALIAS (clear_bgp_peer_soft_in,
5395 clear_bgp_peer_in_cmd,
5396 "clear bgp (A.B.C.D|X:X::X:X) in",
5397 CLEAR_STR
5398 BGP_STR
5399 "BGP neighbor address to clear\n"
5400 "BGP IPv6 neighbor to clear\n"
5401 "Soft reconfig inbound update\n")
5403 ALIAS (clear_bgp_peer_soft_in,
5404 clear_bgp_ipv6_peer_in_cmd,
5405 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5406 CLEAR_STR
5407 BGP_STR
5408 "Address family\n"
5409 "BGP neighbor address to clear\n"
5410 "BGP IPv6 neighbor to clear\n"
5411 "Soft reconfig inbound update\n")
5413 DEFUN (clear_bgp_peer_in_prefix_filter,
5414 clear_bgp_peer_in_prefix_filter_cmd,
5415 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5416 CLEAR_STR
5417 BGP_STR
5418 "BGP neighbor address to clear\n"
5419 "BGP IPv6 neighbor to clear\n"
5420 "Soft reconfig inbound update\n"
5421 "Push out the existing ORF prefix-list\n")
5423 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5424 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5427 ALIAS (clear_bgp_peer_in_prefix_filter,
5428 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5429 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5430 CLEAR_STR
5431 BGP_STR
5432 "Address family\n"
5433 "BGP neighbor address to clear\n"
5434 "BGP IPv6 neighbor to clear\n"
5435 "Soft reconfig inbound update\n"
5436 "Push out the existing ORF prefix-list\n")
5438 DEFUN (clear_ip_bgp_peer_group_soft_in,
5439 clear_ip_bgp_peer_group_soft_in_cmd,
5440 "clear ip bgp peer-group WORD soft in",
5441 CLEAR_STR
5442 IP_STR
5443 BGP_STR
5444 "Clear all members of peer-group\n"
5445 "BGP peer-group name\n"
5446 "Soft reconfig\n"
5447 "Soft reconfig inbound update\n")
5449 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5450 BGP_CLEAR_SOFT_IN, argv[0]);
5453 ALIAS (clear_ip_bgp_peer_group_soft_in,
5454 clear_ip_bgp_peer_group_in_cmd,
5455 "clear ip bgp peer-group WORD in",
5456 CLEAR_STR
5457 IP_STR
5458 BGP_STR
5459 "Clear all members of peer-group\n"
5460 "BGP peer-group name\n"
5461 "Soft reconfig inbound update\n")
5463 DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
5464 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
5465 "clear ip bgp peer-group WORD in prefix-filter",
5466 CLEAR_STR
5467 IP_STR
5468 BGP_STR
5469 "Clear all members of peer-group\n"
5470 "BGP peer-group name\n"
5471 "Soft reconfig inbound update\n"
5472 "Push out prefix-list ORF and do inbound soft reconfig\n")
5474 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5475 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5478 DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
5479 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
5480 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
5481 CLEAR_STR
5482 IP_STR
5483 BGP_STR
5484 "Clear all members of peer-group\n"
5485 "BGP peer-group name\n"
5486 "Address family\n"
5487 "Address Family modifier\n"
5488 "Address Family modifier\n"
5489 "Soft reconfig\n"
5490 "Soft reconfig inbound update\n")
5492 if (strncmp (argv[1], "m", 1) == 0)
5493 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5494 BGP_CLEAR_SOFT_IN, argv[0]);
5496 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5497 BGP_CLEAR_SOFT_IN, argv[0]);
5500 ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
5501 clear_ip_bgp_peer_group_ipv4_in_cmd,
5502 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
5503 CLEAR_STR
5504 IP_STR
5505 BGP_STR
5506 "Clear all members of peer-group\n"
5507 "BGP peer-group name\n"
5508 "Address family\n"
5509 "Address Family modifier\n"
5510 "Address Family modifier\n"
5511 "Soft reconfig inbound update\n")
5513 DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
5514 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
5515 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
5516 CLEAR_STR
5517 IP_STR
5518 BGP_STR
5519 "Clear all members of peer-group\n"
5520 "BGP peer-group name\n"
5521 "Address family\n"
5522 "Address Family modifier\n"
5523 "Address Family modifier\n"
5524 "Soft reconfig inbound update\n"
5525 "Push out prefix-list ORF and do inbound soft reconfig\n")
5527 if (strncmp (argv[1], "m", 1) == 0)
5528 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5529 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5531 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5532 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5535 DEFUN (clear_bgp_peer_group_soft_in,
5536 clear_bgp_peer_group_soft_in_cmd,
5537 "clear bgp peer-group WORD soft in",
5538 CLEAR_STR
5539 BGP_STR
5540 "Clear all members of peer-group\n"
5541 "BGP peer-group name\n"
5542 "Soft reconfig\n"
5543 "Soft reconfig inbound update\n")
5545 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5546 BGP_CLEAR_SOFT_IN, argv[0]);
5549 ALIAS (clear_bgp_peer_group_soft_in,
5550 clear_bgp_ipv6_peer_group_soft_in_cmd,
5551 "clear bgp ipv6 peer-group WORD soft in",
5552 CLEAR_STR
5553 BGP_STR
5554 "Address family\n"
5555 "Clear all members of peer-group\n"
5556 "BGP peer-group name\n"
5557 "Soft reconfig\n"
5558 "Soft reconfig inbound update\n")
5560 ALIAS (clear_bgp_peer_group_soft_in,
5561 clear_bgp_peer_group_in_cmd,
5562 "clear bgp peer-group WORD in",
5563 CLEAR_STR
5564 BGP_STR
5565 "Clear all members of peer-group\n"
5566 "BGP peer-group name\n"
5567 "Soft reconfig inbound update\n")
5569 ALIAS (clear_bgp_peer_group_soft_in,
5570 clear_bgp_ipv6_peer_group_in_cmd,
5571 "clear bgp ipv6 peer-group WORD in",
5572 CLEAR_STR
5573 BGP_STR
5574 "Address family\n"
5575 "Clear all members of peer-group\n"
5576 "BGP peer-group name\n"
5577 "Soft reconfig inbound update\n")
5579 DEFUN (clear_bgp_peer_group_in_prefix_filter,
5580 clear_bgp_peer_group_in_prefix_filter_cmd,
5581 "clear bgp peer-group WORD in prefix-filter",
5582 CLEAR_STR
5583 BGP_STR
5584 "Clear all members of peer-group\n"
5585 "BGP peer-group name\n"
5586 "Soft reconfig inbound update\n"
5587 "Push out prefix-list ORF and do inbound soft reconfig\n")
5589 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5590 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5593 ALIAS (clear_bgp_peer_group_in_prefix_filter,
5594 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
5595 "clear bgp ipv6 peer-group WORD in prefix-filter",
5596 CLEAR_STR
5597 BGP_STR
5598 "Address family\n"
5599 "Clear all members of peer-group\n"
5600 "BGP peer-group name\n"
5601 "Soft reconfig inbound update\n"
5602 "Push out prefix-list ORF and do inbound soft reconfig\n")
5604 DEFUN (clear_ip_bgp_external_soft_in,
5605 clear_ip_bgp_external_soft_in_cmd,
5606 "clear ip bgp external soft in",
5607 CLEAR_STR
5608 IP_STR
5609 BGP_STR
5610 "Clear all external peers\n"
5611 "Soft reconfig\n"
5612 "Soft reconfig inbound update\n")
5614 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5615 BGP_CLEAR_SOFT_IN, NULL);
5618 ALIAS (clear_ip_bgp_external_soft_in,
5619 clear_ip_bgp_external_in_cmd,
5620 "clear ip bgp external in",
5621 CLEAR_STR
5622 IP_STR
5623 BGP_STR
5624 "Clear all external peers\n"
5625 "Soft reconfig inbound update\n")
5627 DEFUN (clear_ip_bgp_external_in_prefix_filter,
5628 clear_ip_bgp_external_in_prefix_filter_cmd,
5629 "clear ip bgp external in prefix-filter",
5630 CLEAR_STR
5631 IP_STR
5632 BGP_STR
5633 "Clear all external peers\n"
5634 "Soft reconfig inbound update\n"
5635 "Push out prefix-list ORF and do inbound soft reconfig\n")
5637 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5638 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5641 DEFUN (clear_ip_bgp_external_ipv4_soft_in,
5642 clear_ip_bgp_external_ipv4_soft_in_cmd,
5643 "clear ip bgp external ipv4 (unicast|multicast) soft in",
5644 CLEAR_STR
5645 IP_STR
5646 BGP_STR
5647 "Clear all external peers\n"
5648 "Address family\n"
5649 "Address Family modifier\n"
5650 "Address Family modifier\n"
5651 "Soft reconfig\n"
5652 "Soft reconfig inbound update\n")
5654 if (strncmp (argv[0], "m", 1) == 0)
5655 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5656 BGP_CLEAR_SOFT_IN, NULL);
5658 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5659 BGP_CLEAR_SOFT_IN, NULL);
5662 ALIAS (clear_ip_bgp_external_ipv4_soft_in,
5663 clear_ip_bgp_external_ipv4_in_cmd,
5664 "clear ip bgp external ipv4 (unicast|multicast) in",
5665 CLEAR_STR
5666 IP_STR
5667 BGP_STR
5668 "Clear all external peers\n"
5669 "Address family\n"
5670 "Address Family modifier\n"
5671 "Address Family modifier\n"
5672 "Soft reconfig inbound update\n")
5674 DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
5675 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
5676 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
5677 CLEAR_STR
5678 IP_STR
5679 BGP_STR
5680 "Clear all external peers\n"
5681 "Address family\n"
5682 "Address Family modifier\n"
5683 "Address Family modifier\n"
5684 "Soft reconfig inbound update\n"
5685 "Push out prefix-list ORF and do inbound soft reconfig\n")
5687 if (strncmp (argv[0], "m", 1) == 0)
5688 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5689 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5691 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5692 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5695 DEFUN (clear_bgp_external_soft_in,
5696 clear_bgp_external_soft_in_cmd,
5697 "clear bgp external soft in",
5698 CLEAR_STR
5699 BGP_STR
5700 "Clear all external peers\n"
5701 "Soft reconfig\n"
5702 "Soft reconfig inbound update\n")
5704 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5705 BGP_CLEAR_SOFT_IN, NULL);
5708 ALIAS (clear_bgp_external_soft_in,
5709 clear_bgp_ipv6_external_soft_in_cmd,
5710 "clear bgp ipv6 external soft in",
5711 CLEAR_STR
5712 BGP_STR
5713 "Address family\n"
5714 "Clear all external peers\n"
5715 "Soft reconfig\n"
5716 "Soft reconfig inbound update\n")
5718 ALIAS (clear_bgp_external_soft_in,
5719 clear_bgp_external_in_cmd,
5720 "clear bgp external in",
5721 CLEAR_STR
5722 BGP_STR
5723 "Clear all external peers\n"
5724 "Soft reconfig inbound update\n")
5726 ALIAS (clear_bgp_external_soft_in,
5727 clear_bgp_ipv6_external_in_cmd,
5728 "clear bgp ipv6 external WORD in",
5729 CLEAR_STR
5730 BGP_STR
5731 "Address family\n"
5732 "Clear all external peers\n"
5733 "Soft reconfig inbound update\n")
5735 DEFUN (clear_bgp_external_in_prefix_filter,
5736 clear_bgp_external_in_prefix_filter_cmd,
5737 "clear bgp external in prefix-filter",
5738 CLEAR_STR
5739 BGP_STR
5740 "Clear all external peers\n"
5741 "Soft reconfig inbound update\n"
5742 "Push out prefix-list ORF and do inbound soft reconfig\n")
5744 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5745 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5748 ALIAS (clear_bgp_external_in_prefix_filter,
5749 clear_bgp_ipv6_external_in_prefix_filter_cmd,
5750 "clear bgp ipv6 external in prefix-filter",
5751 CLEAR_STR
5752 BGP_STR
5753 "Address family\n"
5754 "Clear all external peers\n"
5755 "Soft reconfig inbound update\n"
5756 "Push out prefix-list ORF and do inbound soft reconfig\n")
5758 DEFUN (clear_ip_bgp_as_soft_in,
5759 clear_ip_bgp_as_soft_in_cmd,
5760 "clear ip bgp <1-65535> soft in",
5761 CLEAR_STR
5762 IP_STR
5763 BGP_STR
5764 "Clear peers with the AS number\n"
5765 "Soft reconfig\n"
5766 "Soft reconfig inbound update\n")
5768 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5769 BGP_CLEAR_SOFT_IN, argv[0]);
5772 ALIAS (clear_ip_bgp_as_soft_in,
5773 clear_ip_bgp_as_in_cmd,
5774 "clear ip bgp <1-65535> in",
5775 CLEAR_STR
5776 IP_STR
5777 BGP_STR
5778 "Clear peers with the AS number\n"
5779 "Soft reconfig inbound update\n")
5781 DEFUN (clear_ip_bgp_as_in_prefix_filter,
5782 clear_ip_bgp_as_in_prefix_filter_cmd,
5783 "clear ip bgp <1-65535> in prefix-filter",
5784 CLEAR_STR
5785 IP_STR
5786 BGP_STR
5787 "Clear peers with the AS number\n"
5788 "Soft reconfig inbound update\n"
5789 "Push out prefix-list ORF and do inbound soft reconfig\n")
5791 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5792 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5795 DEFUN (clear_ip_bgp_as_ipv4_soft_in,
5796 clear_ip_bgp_as_ipv4_soft_in_cmd,
5797 "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft in",
5798 CLEAR_STR
5799 IP_STR
5800 BGP_STR
5801 "Clear peers with the AS number\n"
5802 "Address family\n"
5803 "Address Family modifier\n"
5804 "Address Family modifier\n"
5805 "Soft reconfig\n"
5806 "Soft reconfig inbound update\n")
5808 if (strncmp (argv[1], "m", 1) == 0)
5809 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5810 BGP_CLEAR_SOFT_IN, argv[0]);
5812 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5813 BGP_CLEAR_SOFT_IN, argv[0]);
5816 ALIAS (clear_ip_bgp_as_ipv4_soft_in,
5817 clear_ip_bgp_as_ipv4_in_cmd,
5818 "clear ip bgp <1-65535> ipv4 (unicast|multicast) in",
5819 CLEAR_STR
5820 IP_STR
5821 BGP_STR
5822 "Clear peers with the AS number\n"
5823 "Address family\n"
5824 "Address Family modifier\n"
5825 "Address Family modifier\n"
5826 "Soft reconfig inbound update\n")
5828 DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
5829 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
5830 "clear ip bgp <1-65535> ipv4 (unicast|multicast) in prefix-filter",
5831 CLEAR_STR
5832 IP_STR
5833 BGP_STR
5834 "Clear peers with the AS number\n"
5835 "Address family\n"
5836 "Address Family modifier\n"
5837 "Address Family modifier\n"
5838 "Soft reconfig inbound update\n"
5839 "Push out prefix-list ORF and do inbound soft reconfig\n")
5841 if (strncmp (argv[1], "m", 1) == 0)
5842 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5843 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5845 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5846 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5849 DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
5850 clear_ip_bgp_as_vpnv4_soft_in_cmd,
5851 "clear ip bgp <1-65535> vpnv4 unicast soft in",
5852 CLEAR_STR
5853 IP_STR
5854 BGP_STR
5855 "Clear peers with the AS number\n"
5856 "Address family\n"
5857 "Address Family modifier\n"
5858 "Soft reconfig\n"
5859 "Soft reconfig inbound update\n")
5861 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5862 BGP_CLEAR_SOFT_IN, argv[0]);
5865 ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
5866 clear_ip_bgp_as_vpnv4_in_cmd,
5867 "clear ip bgp <1-65535> vpnv4 unicast in",
5868 CLEAR_STR
5869 IP_STR
5870 BGP_STR
5871 "Clear peers with the AS number\n"
5872 "Address family\n"
5873 "Address Family modifier\n"
5874 "Soft reconfig inbound update\n")
5876 DEFUN (clear_bgp_as_soft_in,
5877 clear_bgp_as_soft_in_cmd,
5878 "clear bgp <1-65535> soft in",
5879 CLEAR_STR
5880 BGP_STR
5881 "Clear peers with the AS number\n"
5882 "Soft reconfig\n"
5883 "Soft reconfig inbound update\n")
5885 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5886 BGP_CLEAR_SOFT_IN, argv[0]);
5889 ALIAS (clear_bgp_as_soft_in,
5890 clear_bgp_ipv6_as_soft_in_cmd,
5891 "clear bgp ipv6 <1-65535> soft in",
5892 CLEAR_STR
5893 BGP_STR
5894 "Address family\n"
5895 "Clear peers with the AS number\n"
5896 "Soft reconfig\n"
5897 "Soft reconfig inbound update\n")
5899 ALIAS (clear_bgp_as_soft_in,
5900 clear_bgp_as_in_cmd,
5901 "clear bgp <1-65535> in",
5902 CLEAR_STR
5903 BGP_STR
5904 "Clear peers with the AS number\n"
5905 "Soft reconfig inbound update\n")
5907 ALIAS (clear_bgp_as_soft_in,
5908 clear_bgp_ipv6_as_in_cmd,
5909 "clear bgp ipv6 <1-65535> in",
5910 CLEAR_STR
5911 BGP_STR
5912 "Address family\n"
5913 "Clear peers with the AS number\n"
5914 "Soft reconfig inbound update\n")
5916 DEFUN (clear_bgp_as_in_prefix_filter,
5917 clear_bgp_as_in_prefix_filter_cmd,
5918 "clear bgp <1-65535> in prefix-filter",
5919 CLEAR_STR
5920 BGP_STR
5921 "Clear peers with the AS number\n"
5922 "Soft reconfig inbound update\n"
5923 "Push out prefix-list ORF and do inbound soft reconfig\n")
5925 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5926 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5929 ALIAS (clear_bgp_as_in_prefix_filter,
5930 clear_bgp_ipv6_as_in_prefix_filter_cmd,
5931 "clear bgp ipv6 <1-65535> in prefix-filter",
5932 CLEAR_STR
5933 BGP_STR
5934 "Address family\n"
5935 "Clear peers with the AS number\n"
5936 "Soft reconfig inbound update\n"
5937 "Push out prefix-list ORF and do inbound soft reconfig\n")
5939 /* Both soft-reconfiguration */
5940 DEFUN (clear_ip_bgp_all_soft,
5941 clear_ip_bgp_all_soft_cmd,
5942 "clear ip bgp * soft",
5943 CLEAR_STR
5944 IP_STR
5945 BGP_STR
5946 "Clear all peers\n"
5947 "Soft reconfig\n")
5949 if (argc == 1)
5950 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5951 BGP_CLEAR_SOFT_BOTH, NULL);
5953 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5954 BGP_CLEAR_SOFT_BOTH, NULL);
5957 ALIAS (clear_ip_bgp_all_soft,
5958 clear_ip_bgp_instance_all_soft_cmd,
5959 "clear ip bgp view WORD * soft",
5960 CLEAR_STR
5961 IP_STR
5962 BGP_STR
5963 "BGP view\n"
5964 "view name\n"
5965 "Clear all peers\n"
5966 "Soft reconfig\n")
5969 DEFUN (clear_ip_bgp_all_ipv4_soft,
5970 clear_ip_bgp_all_ipv4_soft_cmd,
5971 "clear ip bgp * ipv4 (unicast|multicast) soft",
5972 CLEAR_STR
5973 IP_STR
5974 BGP_STR
5975 "Clear all peers\n"
5976 "Address family\n"
5977 "Address Family Modifier\n"
5978 "Address Family Modifier\n"
5979 "Soft reconfig\n")
5981 if (strncmp (argv[0], "m", 1) == 0)
5982 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5983 BGP_CLEAR_SOFT_BOTH, NULL);
5985 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5986 BGP_CLEAR_SOFT_BOTH, NULL);
5989 DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
5990 clear_ip_bgp_instance_all_ipv4_soft_cmd,
5991 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
5992 CLEAR_STR
5993 IP_STR
5994 BGP_STR
5995 "BGP view\n"
5996 "view name\n"
5997 "Clear all peers\n"
5998 "Address family\n"
5999 "Address Family Modifier\n"
6000 "Address Family Modifier\n"
6001 "Soft reconfig\n")
6003 if (strncmp (argv[1], "m", 1) == 0)
6004 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6005 BGP_CLEAR_SOFT_BOTH, NULL);
6007 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6008 BGP_CLEAR_SOFT_BOTH, NULL);
6011 DEFUN (clear_ip_bgp_all_vpnv4_soft,
6012 clear_ip_bgp_all_vpnv4_soft_cmd,
6013 "clear ip bgp * vpnv4 unicast soft",
6014 CLEAR_STR
6015 IP_STR
6016 BGP_STR
6017 "Clear all peers\n"
6018 "Address family\n"
6019 "Address Family Modifier\n"
6020 "Soft reconfig\n")
6022 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6023 BGP_CLEAR_SOFT_BOTH, argv[0]);
6026 DEFUN (clear_bgp_all_soft,
6027 clear_bgp_all_soft_cmd,
6028 "clear bgp * soft",
6029 CLEAR_STR
6030 BGP_STR
6031 "Clear all peers\n"
6032 "Soft reconfig\n")
6034 if (argc == 1)
6035 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6036 BGP_CLEAR_SOFT_BOTH, argv[0]);
6038 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6039 BGP_CLEAR_SOFT_BOTH, argv[0]);
6042 ALIAS (clear_bgp_all_soft,
6043 clear_bgp_instance_all_soft_cmd,
6044 "clear bgp view WORD * soft",
6045 CLEAR_STR
6046 BGP_STR
6047 "BGP view\n"
6048 "view name\n"
6049 "Clear all peers\n"
6050 "Soft reconfig\n")
6052 ALIAS (clear_bgp_all_soft,
6053 clear_bgp_ipv6_all_soft_cmd,
6054 "clear bgp ipv6 * soft",
6055 CLEAR_STR
6056 BGP_STR
6057 "Address family\n"
6058 "Clear all peers\n"
6059 "Soft reconfig\n")
6061 DEFUN (clear_ip_bgp_peer_soft,
6062 clear_ip_bgp_peer_soft_cmd,
6063 "clear ip bgp A.B.C.D soft",
6064 CLEAR_STR
6065 IP_STR
6066 BGP_STR
6067 "BGP neighbor address to clear\n"
6068 "Soft reconfig\n")
6070 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6071 BGP_CLEAR_SOFT_BOTH, argv[0]);
6074 DEFUN (clear_ip_bgp_peer_ipv4_soft,
6075 clear_ip_bgp_peer_ipv4_soft_cmd,
6076 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6077 CLEAR_STR
6078 IP_STR
6079 BGP_STR
6080 "BGP neighbor address to clear\n"
6081 "Address family\n"
6082 "Address Family Modifier\n"
6083 "Address Family Modifier\n"
6084 "Soft reconfig\n")
6086 if (strncmp (argv[1], "m", 1) == 0)
6087 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6088 BGP_CLEAR_SOFT_BOTH, argv[0]);
6090 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6091 BGP_CLEAR_SOFT_BOTH, argv[0]);
6094 DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6095 clear_ip_bgp_peer_vpnv4_soft_cmd,
6096 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6097 CLEAR_STR
6098 IP_STR
6099 BGP_STR
6100 "BGP neighbor address to clear\n"
6101 "Address family\n"
6102 "Address Family Modifier\n"
6103 "Soft reconfig\n")
6105 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6106 BGP_CLEAR_SOFT_BOTH, argv[0]);
6109 DEFUN (clear_bgp_peer_soft,
6110 clear_bgp_peer_soft_cmd,
6111 "clear bgp (A.B.C.D|X:X::X:X) soft",
6112 CLEAR_STR
6113 BGP_STR
6114 "BGP neighbor address to clear\n"
6115 "BGP IPv6 neighbor to clear\n"
6116 "Soft reconfig\n")
6118 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6119 BGP_CLEAR_SOFT_BOTH, argv[0]);
6122 ALIAS (clear_bgp_peer_soft,
6123 clear_bgp_ipv6_peer_soft_cmd,
6124 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6125 CLEAR_STR
6126 BGP_STR
6127 "Address family\n"
6128 "BGP neighbor address to clear\n"
6129 "BGP IPv6 neighbor to clear\n"
6130 "Soft reconfig\n")
6132 DEFUN (clear_ip_bgp_peer_group_soft,
6133 clear_ip_bgp_peer_group_soft_cmd,
6134 "clear ip bgp peer-group WORD soft",
6135 CLEAR_STR
6136 IP_STR
6137 BGP_STR
6138 "Clear all members of peer-group\n"
6139 "BGP peer-group name\n"
6140 "Soft reconfig\n")
6142 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6143 BGP_CLEAR_SOFT_BOTH, argv[0]);
6146 DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6147 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6148 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6149 CLEAR_STR
6150 IP_STR
6151 BGP_STR
6152 "Clear all members of peer-group\n"
6153 "BGP peer-group name\n"
6154 "Address family\n"
6155 "Address Family modifier\n"
6156 "Address Family modifier\n"
6157 "Soft reconfig\n")
6159 if (strncmp (argv[1], "m", 1) == 0)
6160 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6161 BGP_CLEAR_SOFT_BOTH, argv[0]);
6163 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6164 BGP_CLEAR_SOFT_BOTH, argv[0]);
6167 DEFUN (clear_bgp_peer_group_soft,
6168 clear_bgp_peer_group_soft_cmd,
6169 "clear bgp peer-group WORD soft",
6170 CLEAR_STR
6171 BGP_STR
6172 "Clear all members of peer-group\n"
6173 "BGP peer-group name\n"
6174 "Soft reconfig\n")
6176 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6177 BGP_CLEAR_SOFT_BOTH, argv[0]);
6180 ALIAS (clear_bgp_peer_group_soft,
6181 clear_bgp_ipv6_peer_group_soft_cmd,
6182 "clear bgp ipv6 peer-group WORD soft",
6183 CLEAR_STR
6184 BGP_STR
6185 "Address family\n"
6186 "Clear all members of peer-group\n"
6187 "BGP peer-group name\n"
6188 "Soft reconfig\n")
6190 DEFUN (clear_ip_bgp_external_soft,
6191 clear_ip_bgp_external_soft_cmd,
6192 "clear ip bgp external soft",
6193 CLEAR_STR
6194 IP_STR
6195 BGP_STR
6196 "Clear all external peers\n"
6197 "Soft reconfig\n")
6199 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6200 BGP_CLEAR_SOFT_BOTH, NULL);
6203 DEFUN (clear_ip_bgp_external_ipv4_soft,
6204 clear_ip_bgp_external_ipv4_soft_cmd,
6205 "clear ip bgp external ipv4 (unicast|multicast) soft",
6206 CLEAR_STR
6207 IP_STR
6208 BGP_STR
6209 "Clear all external peers\n"
6210 "Address family\n"
6211 "Address Family modifier\n"
6212 "Address Family modifier\n"
6213 "Soft reconfig\n")
6215 if (strncmp (argv[0], "m", 1) == 0)
6216 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6217 BGP_CLEAR_SOFT_BOTH, NULL);
6219 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6220 BGP_CLEAR_SOFT_BOTH, NULL);
6223 DEFUN (clear_bgp_external_soft,
6224 clear_bgp_external_soft_cmd,
6225 "clear bgp external soft",
6226 CLEAR_STR
6227 BGP_STR
6228 "Clear all external peers\n"
6229 "Soft reconfig\n")
6231 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6232 BGP_CLEAR_SOFT_BOTH, NULL);
6235 ALIAS (clear_bgp_external_soft,
6236 clear_bgp_ipv6_external_soft_cmd,
6237 "clear bgp ipv6 external soft",
6238 CLEAR_STR
6239 BGP_STR
6240 "Address family\n"
6241 "Clear all external peers\n"
6242 "Soft reconfig\n")
6244 DEFUN (clear_ip_bgp_as_soft,
6245 clear_ip_bgp_as_soft_cmd,
6246 "clear ip bgp <1-65535> soft",
6247 CLEAR_STR
6248 IP_STR
6249 BGP_STR
6250 "Clear peers with the AS number\n"
6251 "Soft reconfig\n")
6253 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6254 BGP_CLEAR_SOFT_BOTH, argv[0]);
6257 DEFUN (clear_ip_bgp_as_ipv4_soft,
6258 clear_ip_bgp_as_ipv4_soft_cmd,
6259 "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft",
6260 CLEAR_STR
6261 IP_STR
6262 BGP_STR
6263 "Clear peers with the AS number\n"
6264 "Address family\n"
6265 "Address Family Modifier\n"
6266 "Address Family Modifier\n"
6267 "Soft reconfig\n")
6269 if (strncmp (argv[1], "m", 1) == 0)
6270 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6271 BGP_CLEAR_SOFT_BOTH, argv[0]);
6273 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6274 BGP_CLEAR_SOFT_BOTH, argv[0]);
6277 DEFUN (clear_ip_bgp_as_vpnv4_soft,
6278 clear_ip_bgp_as_vpnv4_soft_cmd,
6279 "clear ip bgp <1-65535> vpnv4 unicast soft",
6280 CLEAR_STR
6281 IP_STR
6282 BGP_STR
6283 "Clear peers with the AS number\n"
6284 "Address family\n"
6285 "Address Family Modifier\n"
6286 "Soft reconfig\n")
6288 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6289 BGP_CLEAR_SOFT_BOTH, argv[0]);
6292 DEFUN (clear_bgp_as_soft,
6293 clear_bgp_as_soft_cmd,
6294 "clear bgp <1-65535> soft",
6295 CLEAR_STR
6296 BGP_STR
6297 "Clear peers with the AS number\n"
6298 "Soft reconfig\n")
6300 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6301 BGP_CLEAR_SOFT_BOTH, argv[0]);
6304 ALIAS (clear_bgp_as_soft,
6305 clear_bgp_ipv6_as_soft_cmd,
6306 "clear bgp ipv6 <1-65535> soft",
6307 CLEAR_STR
6308 BGP_STR
6309 "Address family\n"
6310 "Clear peers with the AS number\n"
6311 "Soft reconfig\n")
6313 /* RS-client soft reconfiguration. */
6314 #ifdef HAVE_IPV6
6315 DEFUN (clear_bgp_all_rsclient,
6316 clear_bgp_all_rsclient_cmd,
6317 "clear bgp * rsclient",
6318 CLEAR_STR
6319 BGP_STR
6320 "Clear all peers\n"
6321 "Soft reconfig for rsclient RIB\n")
6323 if (argc == 1)
6324 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6325 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6327 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6328 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6331 ALIAS (clear_bgp_all_rsclient,
6332 clear_bgp_ipv6_all_rsclient_cmd,
6333 "clear bgp ipv6 * rsclient",
6334 CLEAR_STR
6335 BGP_STR
6336 "Address family\n"
6337 "Clear all peers\n"
6338 "Soft reconfig for rsclient RIB\n")
6340 ALIAS (clear_bgp_all_rsclient,
6341 clear_bgp_instance_all_rsclient_cmd,
6342 "clear bgp view WORD * rsclient",
6343 CLEAR_STR
6344 BGP_STR
6345 "BGP view\n"
6346 "view name\n"
6347 "Clear all peers\n"
6348 "Soft reconfig for rsclient RIB\n")
6350 ALIAS (clear_bgp_all_rsclient,
6351 clear_bgp_ipv6_instance_all_rsclient_cmd,
6352 "clear bgp ipv6 view WORD * rsclient",
6353 CLEAR_STR
6354 BGP_STR
6355 "Address family\n"
6356 "BGP view\n"
6357 "view name\n"
6358 "Clear all peers\n"
6359 "Soft reconfig for rsclient RIB\n")
6360 #endif /* HAVE_IPV6 */
6362 DEFUN (clear_ip_bgp_all_rsclient,
6363 clear_ip_bgp_all_rsclient_cmd,
6364 "clear ip bgp * rsclient",
6365 CLEAR_STR
6366 IP_STR
6367 BGP_STR
6368 "Clear all peers\n"
6369 "Soft reconfig for rsclient RIB\n")
6371 if (argc == 1)
6372 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6373 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6375 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6376 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6379 ALIAS (clear_ip_bgp_all_rsclient,
6380 clear_ip_bgp_instance_all_rsclient_cmd,
6381 "clear ip bgp view WORD * rsclient",
6382 CLEAR_STR
6383 IP_STR
6384 BGP_STR
6385 "BGP view\n"
6386 "view name\n"
6387 "Clear all peers\n"
6388 "Soft reconfig for rsclient RIB\n")
6390 #ifdef HAVE_IPV6
6391 DEFUN (clear_bgp_peer_rsclient,
6392 clear_bgp_peer_rsclient_cmd,
6393 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
6394 CLEAR_STR
6395 BGP_STR
6396 "BGP neighbor IP address to clear\n"
6397 "BGP IPv6 neighbor to clear\n"
6398 "Soft reconfig for rsclient RIB\n")
6400 if (argc == 2)
6401 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
6402 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6404 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6405 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6408 ALIAS (clear_bgp_peer_rsclient,
6409 clear_bgp_ipv6_peer_rsclient_cmd,
6410 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
6411 CLEAR_STR
6412 BGP_STR
6413 "Address family\n"
6414 "BGP neighbor IP address to clear\n"
6415 "BGP IPv6 neighbor to clear\n"
6416 "Soft reconfig for rsclient RIB\n")
6418 ALIAS (clear_bgp_peer_rsclient,
6419 clear_bgp_instance_peer_rsclient_cmd,
6420 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6421 CLEAR_STR
6422 BGP_STR
6423 "BGP view\n"
6424 "view name\n"
6425 "BGP neighbor IP address to clear\n"
6426 "BGP IPv6 neighbor to clear\n"
6427 "Soft reconfig for rsclient RIB\n")
6429 ALIAS (clear_bgp_peer_rsclient,
6430 clear_bgp_ipv6_instance_peer_rsclient_cmd,
6431 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
6432 CLEAR_STR
6433 BGP_STR
6434 "Address family\n"
6435 "BGP view\n"
6436 "view name\n"
6437 "BGP neighbor IP address to clear\n"
6438 "BGP IPv6 neighbor to clear\n"
6439 "Soft reconfig for rsclient RIB\n")
6440 #endif /* HAVE_IPV6 */
6442 DEFUN (clear_ip_bgp_peer_rsclient,
6443 clear_ip_bgp_peer_rsclient_cmd,
6444 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
6445 CLEAR_STR
6446 IP_STR
6447 BGP_STR
6448 "BGP neighbor IP address to clear\n"
6449 "BGP IPv6 neighbor to clear\n"
6450 "Soft reconfig for rsclient RIB\n")
6452 if (argc == 2)
6453 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
6454 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6456 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6457 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6460 ALIAS (clear_ip_bgp_peer_rsclient,
6461 clear_ip_bgp_instance_peer_rsclient_cmd,
6462 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6463 CLEAR_STR
6464 IP_STR
6465 BGP_STR
6466 "BGP view\n"
6467 "view name\n"
6468 "BGP neighbor IP address to clear\n"
6469 "BGP IPv6 neighbor to clear\n"
6470 "Soft reconfig for rsclient RIB\n")
6473 /* Show BGP peer's summary information. */
6474 static int
6475 bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
6477 struct peer *peer;
6478 struct listnode *node, *nnode;
6479 int count = 0;
6480 char timebuf[BGP_UPTIME_LEN];
6481 int len;
6483 /* Header string for each address family. */
6484 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
6486 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
6488 if (peer->afc[afi][safi])
6490 if (! count)
6492 vty_out (vty,
6493 "BGP router identifier %s, local AS number %d%s",
6494 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
6495 vty_out (vty,
6496 "%ld BGP AS-PATH entries%s", aspath_count (),
6497 VTY_NEWLINE);
6498 vty_out (vty,
6499 "%ld BGP community entries%s", community_count (),
6500 VTY_NEWLINE);
6502 if (CHECK_FLAG(bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
6503 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
6504 vty_out (vty, "%s", VTY_NEWLINE);
6505 vty_out (vty, "%s%s", header, VTY_NEWLINE);
6507 count++;
6509 len = vty_out (vty, "%s", peer->host);
6510 len = 16 - len;
6511 if (len < 1)
6512 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
6513 else
6514 vty_out (vty, "%*s", len, " ");
6516 vty_out (vty, "4 ");
6518 vty_out (vty, "%5d %7d %7d %8d %4d %4ld ",
6519 peer->as,
6520 peer->open_in + peer->update_in + peer->keepalive_in
6521 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
6522 peer->open_out + peer->update_out + peer->keepalive_out
6523 + peer->notify_out + peer->refresh_out
6524 + peer->dynamic_cap_out,
6525 0, 0, peer->obuf->count);
6527 vty_out (vty, "%8s",
6528 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
6530 if (peer->status == Established)
6532 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
6534 else
6536 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
6537 vty_out (vty, " Idle (Admin)");
6538 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
6539 vty_out (vty, " Idle (PfxCt)");
6540 else
6541 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
6544 vty_out (vty, "%s", VTY_NEWLINE);
6548 if (count)
6549 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
6550 count, VTY_NEWLINE);
6551 else
6552 vty_out (vty, "No %s neighbor is configured%s",
6553 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
6554 return CMD_SUCCESS;
6557 static int
6558 bgp_show_summary_vty (struct vty *vty, const char *name,
6559 afi_t afi, safi_t safi)
6561 struct bgp *bgp;
6563 if (name)
6565 bgp = bgp_lookup_by_name (name);
6567 if (! bgp)
6569 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
6570 return CMD_WARNING;
6573 bgp_show_summary (vty, bgp, afi, safi);
6574 return CMD_SUCCESS;
6577 bgp = bgp_get_default ();
6579 if (bgp)
6580 bgp_show_summary (vty, bgp, afi, safi);
6582 return CMD_SUCCESS;
6585 /* `show ip bgp summary' commands. */
6586 DEFUN (show_ip_bgp_summary,
6587 show_ip_bgp_summary_cmd,
6588 "show ip bgp summary",
6589 SHOW_STR
6590 IP_STR
6591 BGP_STR
6592 "Summary of BGP neighbor status\n")
6594 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
6597 DEFUN (show_ip_bgp_instance_summary,
6598 show_ip_bgp_instance_summary_cmd,
6599 "show ip bgp view WORD summary",
6600 SHOW_STR
6601 IP_STR
6602 BGP_STR
6603 "BGP view\n"
6604 "View name\n"
6605 "Summary of BGP neighbor status\n")
6607 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
6610 DEFUN (show_ip_bgp_ipv4_summary,
6611 show_ip_bgp_ipv4_summary_cmd,
6612 "show ip bgp ipv4 (unicast|multicast) summary",
6613 SHOW_STR
6614 IP_STR
6615 BGP_STR
6616 "Address family\n"
6617 "Address Family modifier\n"
6618 "Address Family modifier\n"
6619 "Summary of BGP neighbor status\n")
6621 if (strncmp (argv[0], "m", 1) == 0)
6622 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
6624 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
6627 DEFUN (show_ip_bgp_instance_ipv4_summary,
6628 show_ip_bgp_instance_ipv4_summary_cmd,
6629 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
6630 SHOW_STR
6631 IP_STR
6632 BGP_STR
6633 "BGP view\n"
6634 "View name\n"
6635 "Address family\n"
6636 "Address Family modifier\n"
6637 "Address Family modifier\n"
6638 "Summary of BGP neighbor status\n")
6640 if (strncmp (argv[1], "m", 1) == 0)
6641 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
6642 else
6643 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
6646 DEFUN (show_ip_bgp_vpnv4_all_summary,
6647 show_ip_bgp_vpnv4_all_summary_cmd,
6648 "show ip bgp vpnv4 all summary",
6649 SHOW_STR
6650 IP_STR
6651 BGP_STR
6652 "Display VPNv4 NLRI specific information\n"
6653 "Display information about all VPNv4 NLRIs\n"
6654 "Summary of BGP neighbor status\n")
6656 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
6659 DEFUN (show_ip_bgp_vpnv4_rd_summary,
6660 show_ip_bgp_vpnv4_rd_summary_cmd,
6661 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
6662 SHOW_STR
6663 IP_STR
6664 BGP_STR
6665 "Display VPNv4 NLRI specific information\n"
6666 "Display information for a route distinguisher\n"
6667 "VPN Route Distinguisher\n"
6668 "Summary of BGP neighbor status\n")
6670 int ret;
6671 struct prefix_rd prd;
6673 ret = str2prefix_rd (argv[0], &prd);
6674 if (! ret)
6676 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
6677 return CMD_WARNING;
6680 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
6683 #ifdef HAVE_IPV6
6684 DEFUN (show_bgp_summary,
6685 show_bgp_summary_cmd,
6686 "show bgp summary",
6687 SHOW_STR
6688 BGP_STR
6689 "Summary of BGP neighbor status\n")
6691 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
6694 DEFUN (show_bgp_instance_summary,
6695 show_bgp_instance_summary_cmd,
6696 "show bgp view WORD summary",
6697 SHOW_STR
6698 BGP_STR
6699 "BGP view\n"
6700 "View name\n"
6701 "Summary of BGP neighbor status\n")
6703 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
6706 ALIAS (show_bgp_summary,
6707 show_bgp_ipv6_summary_cmd,
6708 "show bgp ipv6 summary",
6709 SHOW_STR
6710 BGP_STR
6711 "Address family\n"
6712 "Summary of BGP neighbor status\n")
6714 ALIAS (show_bgp_instance_summary,
6715 show_bgp_instance_ipv6_summary_cmd,
6716 "show bgp view WORD ipv6 summary",
6717 SHOW_STR
6718 BGP_STR
6719 "BGP view\n"
6720 "View name\n"
6721 "Address family\n"
6722 "Summary of BGP neighbor status\n")
6724 /* old command */
6725 DEFUN (show_ipv6_bgp_summary,
6726 show_ipv6_bgp_summary_cmd,
6727 "show ipv6 bgp summary",
6728 SHOW_STR
6729 IPV6_STR
6730 BGP_STR
6731 "Summary of BGP neighbor status\n")
6733 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
6736 /* old command */
6737 DEFUN (show_ipv6_mbgp_summary,
6738 show_ipv6_mbgp_summary_cmd,
6739 "show ipv6 mbgp summary",
6740 SHOW_STR
6741 IPV6_STR
6742 MBGP_STR
6743 "Summary of BGP neighbor status\n")
6745 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
6747 #endif /* HAVE_IPV6 */
6749 const char *
6750 afi_safi_print (afi_t afi, safi_t safi)
6752 if (afi == AFI_IP && safi == SAFI_UNICAST)
6753 return "IPv4 Unicast";
6754 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
6755 return "IPv4 Multicast";
6756 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
6757 return "VPNv4 Unicast";
6758 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
6759 return "IPv6 Unicast";
6760 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
6761 return "IPv6 Multicast";
6762 else
6763 return "Unknown";
6766 /* Show BGP peer's information. */
6767 enum show_type
6769 show_all,
6770 show_peer
6773 static void
6774 bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
6775 afi_t afi, safi_t safi,
6776 u_int16_t adv_smcap, u_int16_t adv_rmcap,
6777 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
6779 /* Send-Mode */
6780 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
6781 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
6783 vty_out (vty, " Send-mode: ");
6784 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
6785 vty_out (vty, "advertised");
6786 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
6787 vty_out (vty, "%sreceived",
6788 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
6789 ", " : "");
6790 vty_out (vty, "%s", VTY_NEWLINE);
6793 /* Receive-Mode */
6794 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
6795 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
6797 vty_out (vty, " Receive-mode: ");
6798 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
6799 vty_out (vty, "advertised");
6800 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
6801 vty_out (vty, "%sreceived",
6802 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
6803 ", " : "");
6804 vty_out (vty, "%s", VTY_NEWLINE);
6808 static void
6809 bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
6811 struct bgp_filter *filter;
6812 char orf_pfx_name[BUFSIZ];
6813 int orf_pfx_count;
6815 filter = &p->filter[afi][safi];
6817 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
6818 VTY_NEWLINE);
6820 if (p->af_group[afi][safi])
6821 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
6823 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
6824 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
6825 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
6826 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
6827 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
6828 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
6829 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
6831 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
6832 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
6833 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
6834 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
6836 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
6837 ORF_TYPE_PREFIX, VTY_NEWLINE);
6838 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
6839 PEER_CAP_ORF_PREFIX_SM_ADV,
6840 PEER_CAP_ORF_PREFIX_RM_ADV,
6841 PEER_CAP_ORF_PREFIX_SM_RCV,
6842 PEER_CAP_ORF_PREFIX_RM_RCV);
6844 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
6845 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
6846 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
6847 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
6849 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
6850 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
6851 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
6852 PEER_CAP_ORF_PREFIX_SM_ADV,
6853 PEER_CAP_ORF_PREFIX_RM_ADV,
6854 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
6855 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
6858 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
6859 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
6861 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
6862 || orf_pfx_count)
6864 vty_out (vty, " Outbound Route Filter (ORF):");
6865 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
6866 vty_out (vty, " sent;");
6867 if (orf_pfx_count)
6868 vty_out (vty, " received (%d entries)", orf_pfx_count);
6869 vty_out (vty, "%s", VTY_NEWLINE);
6871 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
6872 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
6874 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
6875 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
6876 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
6877 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
6878 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
6879 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
6880 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
6881 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
6882 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
6883 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
6884 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
6885 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
6886 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
6887 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
6888 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
6889 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
6890 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
6891 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
6893 vty_out (vty, " Community attribute sent to this neighbor");
6894 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
6895 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
6896 vty_out (vty, "(both)%s", VTY_NEWLINE);
6897 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
6898 vty_out (vty, "(extended)%s", VTY_NEWLINE);
6899 else
6900 vty_out (vty, "(standard)%s", VTY_NEWLINE);
6902 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
6904 vty_out (vty, " Default information originate,");
6906 if (p->default_rmap[afi][safi].name)
6907 vty_out (vty, " default route-map %s%s,",
6908 p->default_rmap[afi][safi].map ? "*" : "",
6909 p->default_rmap[afi][safi].name);
6910 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
6911 vty_out (vty, " default sent%s", VTY_NEWLINE);
6912 else
6913 vty_out (vty, " default not sent%s", VTY_NEWLINE);
6916 if (filter->plist[FILTER_IN].name
6917 || filter->dlist[FILTER_IN].name
6918 || filter->aslist[FILTER_IN].name
6919 || filter->map[RMAP_IN].name)
6920 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
6921 if (filter->plist[FILTER_OUT].name
6922 || filter->dlist[FILTER_OUT].name
6923 || filter->aslist[FILTER_OUT].name
6924 || filter->map[RMAP_OUT].name
6925 || filter->usmap.name)
6926 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
6927 if (filter->map[RMAP_IMPORT].name)
6928 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
6929 if (filter->map[RMAP_EXPORT].name)
6930 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
6932 /* prefix-list */
6933 if (filter->plist[FILTER_IN].name)
6934 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
6935 filter->plist[FILTER_IN].plist ? "*" : "",
6936 filter->plist[FILTER_IN].name,
6937 VTY_NEWLINE);
6938 if (filter->plist[FILTER_OUT].name)
6939 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
6940 filter->plist[FILTER_OUT].plist ? "*" : "",
6941 filter->plist[FILTER_OUT].name,
6942 VTY_NEWLINE);
6944 /* distribute-list */
6945 if (filter->dlist[FILTER_IN].name)
6946 vty_out (vty, " Incoming update network filter list is %s%s%s",
6947 filter->dlist[FILTER_IN].alist ? "*" : "",
6948 filter->dlist[FILTER_IN].name,
6949 VTY_NEWLINE);
6950 if (filter->dlist[FILTER_OUT].name)
6951 vty_out (vty, " Outgoing update network filter list is %s%s%s",
6952 filter->dlist[FILTER_OUT].alist ? "*" : "",
6953 filter->dlist[FILTER_OUT].name,
6954 VTY_NEWLINE);
6956 /* filter-list. */
6957 if (filter->aslist[FILTER_IN].name)
6958 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
6959 filter->aslist[FILTER_IN].aslist ? "*" : "",
6960 filter->aslist[FILTER_IN].name,
6961 VTY_NEWLINE);
6962 if (filter->aslist[FILTER_OUT].name)
6963 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
6964 filter->aslist[FILTER_OUT].aslist ? "*" : "",
6965 filter->aslist[FILTER_OUT].name,
6966 VTY_NEWLINE);
6968 /* route-map. */
6969 if (filter->map[RMAP_IN].name)
6970 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
6971 filter->map[RMAP_IN].map ? "*" : "",
6972 filter->map[RMAP_IN].name,
6973 VTY_NEWLINE);
6974 if (filter->map[RMAP_OUT].name)
6975 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
6976 filter->map[RMAP_OUT].map ? "*" : "",
6977 filter->map[RMAP_OUT].name,
6978 VTY_NEWLINE);
6979 if (filter->map[RMAP_IMPORT].name)
6980 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
6981 filter->map[RMAP_IMPORT].map ? "*" : "",
6982 filter->map[RMAP_IMPORT].name,
6983 VTY_NEWLINE);
6984 if (filter->map[RMAP_EXPORT].name)
6985 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
6986 filter->map[RMAP_EXPORT].map ? "*" : "",
6987 filter->map[RMAP_EXPORT].name,
6988 VTY_NEWLINE);
6990 /* unsuppress-map */
6991 if (filter->usmap.name)
6992 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
6993 filter->usmap.map ? "*" : "",
6994 filter->usmap.name, VTY_NEWLINE);
6996 /* Receive prefix count */
6997 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
6999 /* Maximum prefix */
7000 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
7002 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
7003 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
7004 ? " (warning-only)" : "", VTY_NEWLINE);
7005 vty_out (vty, " Threshold for warning message %d%%",
7006 p->pmax_threshold[afi][safi]);
7007 if (p->pmax_restart[afi][safi])
7008 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
7009 vty_out (vty, "%s", VTY_NEWLINE);
7012 vty_out (vty, "%s", VTY_NEWLINE);
7015 static void
7016 bgp_show_peer (struct vty *vty, struct peer *p)
7018 struct bgp *bgp;
7019 char buf1[BUFSIZ];
7020 char timebuf[BGP_UPTIME_LEN];
7021 afi_t afi;
7022 safi_t safi;
7024 bgp = p->bgp;
7026 /* Configured IP address. */
7027 vty_out (vty, "BGP neighbor is %s, ", p->host);
7028 vty_out (vty, "remote AS %d, ", p->as);
7029 vty_out (vty, "local AS %d%s, ",
7030 p->change_local_as ? p->change_local_as : p->local_as,
7031 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
7032 " no-prepend" : "");
7033 vty_out (vty, "%s link%s",
7034 p->as == p->local_as ? "internal" : "external",
7035 VTY_NEWLINE);
7037 /* Description. */
7038 if (p->desc)
7039 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
7041 /* Peer-group */
7042 if (p->group)
7043 vty_out (vty, " Member of peer-group %s for session parameters%s",
7044 p->group->name, VTY_NEWLINE);
7046 /* Administrative shutdown. */
7047 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
7048 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
7050 /* BGP Version. */
7051 vty_out (vty, " BGP version 4");
7052 vty_out (vty, ", remote router ID %s%s",
7053 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
7054 VTY_NEWLINE);
7056 /* Confederation */
7057 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
7058 && bgp_confederation_peers_check (bgp, p->as))
7059 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
7061 /* Status. */
7062 vty_out (vty, " BGP state = %s",
7063 LOOKUP (bgp_status_msg, p->status));
7064 if (p->status == Established)
7065 vty_out (vty, ", up for %8s",
7066 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
7067 else if (p->status == Active)
7069 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7070 vty_out (vty, " (passive)");
7071 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7072 vty_out (vty, " (NSF passive)");
7074 vty_out (vty, "%s", VTY_NEWLINE);
7076 /* read timer */
7077 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7079 /* Configured timer values. */
7080 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7081 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7082 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7084 vty_out (vty, " Configured hold time is %d", p->holdtime);
7085 vty_out (vty, ", keepalive interval is %d seconds%s",
7086 p->keepalive, VTY_NEWLINE);
7089 /* Capability. */
7090 if (p->status == Established)
7092 if (p->cap
7093 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7094 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7095 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7096 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7097 #ifdef HAVE_IPV6
7098 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7099 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7100 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7101 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
7102 #endif /* HAVE_IPV6 */
7103 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7104 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7106 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7108 /* Dynamic */
7109 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
7110 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7112 vty_out (vty, " Dynamic:");
7113 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7114 vty_out (vty, " advertised");
7115 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
7116 vty_out (vty, " %sreceived",
7117 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
7118 vty_out (vty, "%s", VTY_NEWLINE);
7121 /* Route Refresh */
7122 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
7123 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7124 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
7126 vty_out (vty, " Route refresh:");
7127 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
7128 vty_out (vty, " advertised");
7129 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7130 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
7131 vty_out (vty, " %sreceived(%s)",
7132 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
7133 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
7134 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
7135 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
7137 vty_out (vty, "%s", VTY_NEWLINE);
7140 /* Multiprotocol Extensions */
7141 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7142 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7143 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
7145 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
7146 if (p->afc_adv[afi][safi])
7147 vty_out (vty, " advertised");
7148 if (p->afc_recv[afi][safi])
7149 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
7150 vty_out (vty, "%s", VTY_NEWLINE);
7153 /* Gracefull Restart */
7154 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7155 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
7157 vty_out (vty, " Graceful Restart Capabilty:");
7158 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
7159 vty_out (vty, " advertised");
7160 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
7161 vty_out (vty, " %sreceived",
7162 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
7163 vty_out (vty, "%s", VTY_NEWLINE);
7165 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
7167 int restart_af_count = 0;
7169 vty_out (vty, " Remote Restart timer is %d seconds%s",
7170 p->v_gr_restart, VTY_NEWLINE);
7171 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
7173 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7174 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7175 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
7177 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
7178 afi_safi_print (afi, safi),
7179 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
7180 "preserved" : "not preserved");
7181 restart_af_count++;
7183 if (! restart_af_count)
7184 vty_out (vty, "none");
7185 vty_out (vty, "%s", VTY_NEWLINE);
7191 /* graceful restart information */
7192 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7193 || p->t_gr_restart
7194 || p->t_gr_stale)
7196 int eor_send_af_count = 0;
7197 int eor_receive_af_count = 0;
7199 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
7200 if (p->status == Established)
7202 vty_out (vty, " End-of-RIB send: ");
7203 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7204 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7205 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
7207 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
7208 afi_safi_print (afi, safi));
7209 eor_send_af_count++;
7211 vty_out (vty, "%s", VTY_NEWLINE);
7213 vty_out (vty, " End-of-RIB received: ");
7214 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7215 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7216 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
7218 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
7219 afi_safi_print (afi, safi));
7220 eor_receive_af_count++;
7222 vty_out (vty, "%s", VTY_NEWLINE);
7225 if (p->t_gr_restart)
7227 vty_out (vty, " The remaining time of restart timer is %ld%s",
7228 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
7230 if (p->t_gr_stale)
7232 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
7233 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
7237 /* Packet counts. */
7238 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
7239 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
7240 vty_out (vty, " Outq depth is %ld%s", p->obuf->count, VTY_NEWLINE);
7241 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
7242 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
7243 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
7244 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
7245 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
7246 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
7247 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
7248 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
7249 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
7250 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
7251 p->dynamic_cap_in, VTY_NEWLINE);
7253 /* advertisement-interval */
7254 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
7255 p->v_routeadv, VTY_NEWLINE);
7257 /* Update-source. */
7258 if (p->update_if || p->update_source)
7260 vty_out (vty, " Update source is ");
7261 if (p->update_if)
7262 vty_out (vty, "%s", p->update_if);
7263 else if (p->update_source)
7264 vty_out (vty, "%s",
7265 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
7266 vty_out (vty, "%s", VTY_NEWLINE);
7269 /* Default weight */
7270 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
7271 vty_out (vty, " Default weight %d%s", p->weight,
7272 VTY_NEWLINE);
7274 vty_out (vty, "%s", VTY_NEWLINE);
7276 /* Address Family Information */
7277 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7278 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7279 if (p->afc[afi][safi])
7280 bgp_show_peer_afi (vty, p, afi, safi);
7282 vty_out (vty, " Connections established %d; dropped %d%s",
7283 p->established, p->dropped,
7284 VTY_NEWLINE);
7286 if (! p->dropped)
7287 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
7288 else
7289 vty_out (vty, " Last reset %s, due to %s%s",
7290 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
7291 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
7293 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7295 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
7297 if (p->t_pmax_restart)
7298 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
7299 p->host, thread_timer_remain_second (p->t_pmax_restart),
7300 VTY_NEWLINE);
7301 else
7302 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
7303 p->host, VTY_NEWLINE);
7306 /* EBGP Multihop */
7307 if (peer_sort (p) != BGP_PEER_IBGP && p->ttl > 1)
7308 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7309 p->ttl, VTY_NEWLINE);
7311 /* Local address. */
7312 if (p->su_local)
7314 vty_out (vty, "Local host: %s, Local port: %d%s",
7315 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
7316 ntohs (p->su_local->sin.sin_port),
7317 VTY_NEWLINE);
7320 /* Remote address. */
7321 if (p->su_remote)
7323 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
7324 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
7325 ntohs (p->su_remote->sin.sin_port),
7326 VTY_NEWLINE);
7329 /* Nexthop display. */
7330 if (p->su_local)
7332 vty_out (vty, "Nexthop: %s%s",
7333 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
7334 VTY_NEWLINE);
7335 #ifdef HAVE_IPV6
7336 vty_out (vty, "Nexthop global: %s%s",
7337 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
7338 VTY_NEWLINE);
7339 vty_out (vty, "Nexthop local: %s%s",
7340 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
7341 VTY_NEWLINE);
7342 vty_out (vty, "BGP connection: %s%s",
7343 p->shared_network ? "shared network" : "non shared network",
7344 VTY_NEWLINE);
7345 #endif /* HAVE_IPV6 */
7348 /* Timer information. */
7349 if (p->t_start)
7350 vty_out (vty, "Next start timer due in %ld seconds%s",
7351 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
7352 if (p->t_connect)
7353 vty_out (vty, "Next connect timer due in %ld seconds%s",
7354 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
7356 vty_out (vty, "Read thread: %s Write thread: %s%s",
7357 p->t_read ? "on" : "off",
7358 p->t_write ? "on" : "off",
7359 VTY_NEWLINE);
7361 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
7362 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
7363 bgp_capability_vty_out (vty, p);
7365 vty_out (vty, "%s", VTY_NEWLINE);
7368 static int
7369 bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
7370 enum show_type type, union sockunion *su)
7372 struct listnode *node, *nnode;
7373 struct peer *peer;
7374 int find = 0;
7376 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
7378 switch (type)
7380 case show_all:
7381 bgp_show_peer (vty, peer);
7382 break;
7383 case show_peer:
7384 if (sockunion_same (&peer->su, su))
7386 find = 1;
7387 bgp_show_peer (vty, peer);
7389 break;
7393 if (type == show_peer && ! find)
7394 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
7396 return CMD_SUCCESS;
7399 static int
7400 bgp_show_neighbor_vty (struct vty *vty, const char *name,
7401 enum show_type type, const char *ip_str)
7403 int ret;
7404 struct bgp *bgp;
7405 union sockunion su;
7407 if (ip_str)
7409 ret = str2sockunion (ip_str, &su);
7410 if (ret < 0)
7412 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
7413 return CMD_WARNING;
7417 if (name)
7419 bgp = bgp_lookup_by_name (name);
7421 if (! bgp)
7423 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7424 return CMD_WARNING;
7427 bgp_show_neighbor (vty, bgp, type, &su);
7429 return CMD_SUCCESS;
7432 bgp = bgp_get_default ();
7434 if (bgp)
7435 bgp_show_neighbor (vty, bgp, type, &su);
7437 return CMD_SUCCESS;
7440 /* "show ip bgp neighbors" commands. */
7441 DEFUN (show_ip_bgp_neighbors,
7442 show_ip_bgp_neighbors_cmd,
7443 "show ip bgp neighbors",
7444 SHOW_STR
7445 IP_STR
7446 BGP_STR
7447 "Detailed information on TCP and BGP neighbor connections\n")
7449 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
7452 ALIAS (show_ip_bgp_neighbors,
7453 show_ip_bgp_ipv4_neighbors_cmd,
7454 "show ip bgp ipv4 (unicast|multicast) neighbors",
7455 SHOW_STR
7456 IP_STR
7457 BGP_STR
7458 "Address family\n"
7459 "Address Family modifier\n"
7460 "Address Family modifier\n"
7461 "Detailed information on TCP and BGP neighbor connections\n")
7463 ALIAS (show_ip_bgp_neighbors,
7464 show_ip_bgp_vpnv4_all_neighbors_cmd,
7465 "show ip bgp vpnv4 all neighbors",
7466 SHOW_STR
7467 IP_STR
7468 BGP_STR
7469 "Display VPNv4 NLRI specific information\n"
7470 "Display information about all VPNv4 NLRIs\n"
7471 "Detailed information on TCP and BGP neighbor connections\n")
7473 ALIAS (show_ip_bgp_neighbors,
7474 show_ip_bgp_vpnv4_rd_neighbors_cmd,
7475 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
7476 SHOW_STR
7477 IP_STR
7478 BGP_STR
7479 "Display VPNv4 NLRI specific information\n"
7480 "Display information for a route distinguisher\n"
7481 "VPN Route Distinguisher\n"
7482 "Detailed information on TCP and BGP neighbor connections\n")
7484 ALIAS (show_ip_bgp_neighbors,
7485 show_bgp_neighbors_cmd,
7486 "show bgp neighbors",
7487 SHOW_STR
7488 BGP_STR
7489 "Detailed information on TCP and BGP neighbor connections\n")
7491 ALIAS (show_ip_bgp_neighbors,
7492 show_bgp_ipv6_neighbors_cmd,
7493 "show bgp ipv6 neighbors",
7494 SHOW_STR
7495 BGP_STR
7496 "Address family\n"
7497 "Detailed information on TCP and BGP neighbor connections\n")
7499 DEFUN (show_ip_bgp_neighbors_peer,
7500 show_ip_bgp_neighbors_peer_cmd,
7501 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
7502 SHOW_STR
7503 IP_STR
7504 BGP_STR
7505 "Detailed information on TCP and BGP neighbor connections\n"
7506 "Neighbor to display information about\n"
7507 "Neighbor to display information about\n")
7509 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
7512 ALIAS (show_ip_bgp_neighbors_peer,
7513 show_ip_bgp_ipv4_neighbors_peer_cmd,
7514 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
7515 SHOW_STR
7516 IP_STR
7517 BGP_STR
7518 "Address family\n"
7519 "Address Family modifier\n"
7520 "Address Family modifier\n"
7521 "Detailed information on TCP and BGP neighbor connections\n"
7522 "Neighbor to display information about\n"
7523 "Neighbor to display information about\n")
7525 ALIAS (show_ip_bgp_neighbors_peer,
7526 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
7527 "show ip bgp vpnv4 all neighbors A.B.C.D",
7528 SHOW_STR
7529 IP_STR
7530 BGP_STR
7531 "Display VPNv4 NLRI specific information\n"
7532 "Display information about all VPNv4 NLRIs\n"
7533 "Detailed information on TCP and BGP neighbor connections\n"
7534 "Neighbor to display information about\n")
7536 ALIAS (show_ip_bgp_neighbors_peer,
7537 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
7538 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
7539 SHOW_STR
7540 IP_STR
7541 BGP_STR
7542 "Display VPNv4 NLRI specific information\n"
7543 "Display information about all VPNv4 NLRIs\n"
7544 "Detailed information on TCP and BGP neighbor connections\n"
7545 "Neighbor to display information about\n")
7547 ALIAS (show_ip_bgp_neighbors_peer,
7548 show_bgp_neighbors_peer_cmd,
7549 "show bgp neighbors (A.B.C.D|X:X::X:X)",
7550 SHOW_STR
7551 BGP_STR
7552 "Detailed information on TCP and BGP neighbor connections\n"
7553 "Neighbor to display information about\n"
7554 "Neighbor to display information about\n")
7556 ALIAS (show_ip_bgp_neighbors_peer,
7557 show_bgp_ipv6_neighbors_peer_cmd,
7558 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
7559 SHOW_STR
7560 BGP_STR
7561 "Address family\n"
7562 "Detailed information on TCP and BGP neighbor connections\n"
7563 "Neighbor to display information about\n"
7564 "Neighbor to display information about\n")
7566 DEFUN (show_ip_bgp_instance_neighbors,
7567 show_ip_bgp_instance_neighbors_cmd,
7568 "show ip bgp view WORD neighbors",
7569 SHOW_STR
7570 IP_STR
7571 BGP_STR
7572 "BGP view\n"
7573 "View name\n"
7574 "Detailed information on TCP and BGP neighbor connections\n")
7576 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
7579 ALIAS (show_ip_bgp_instance_neighbors,
7580 show_bgp_instance_neighbors_cmd,
7581 "show bgp view WORD neighbors",
7582 SHOW_STR
7583 BGP_STR
7584 "BGP view\n"
7585 "View name\n"
7586 "Detailed information on TCP and BGP neighbor connections\n")
7588 ALIAS (show_ip_bgp_instance_neighbors,
7589 show_bgp_instance_ipv6_neighbors_cmd,
7590 "show bgp view WORD ipv6 neighbors",
7591 SHOW_STR
7592 BGP_STR
7593 "BGP view\n"
7594 "View name\n"
7595 "Address family\n"
7596 "Detailed information on TCP and BGP neighbor connections\n")
7598 DEFUN (show_ip_bgp_instance_neighbors_peer,
7599 show_ip_bgp_instance_neighbors_peer_cmd,
7600 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
7601 SHOW_STR
7602 IP_STR
7603 BGP_STR
7604 "BGP view\n"
7605 "View name\n"
7606 "Detailed information on TCP and BGP neighbor connections\n"
7607 "Neighbor to display information about\n"
7608 "Neighbor to display information about\n")
7610 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
7613 ALIAS (show_ip_bgp_instance_neighbors_peer,
7614 show_bgp_instance_neighbors_peer_cmd,
7615 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
7616 SHOW_STR
7617 BGP_STR
7618 "BGP view\n"
7619 "View name\n"
7620 "Detailed information on TCP and BGP neighbor connections\n"
7621 "Neighbor to display information about\n"
7622 "Neighbor to display information about\n")
7624 ALIAS (show_ip_bgp_instance_neighbors_peer,
7625 show_bgp_instance_ipv6_neighbors_peer_cmd,
7626 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
7627 SHOW_STR
7628 BGP_STR
7629 "BGP view\n"
7630 "View name\n"
7631 "Address family\n"
7632 "Detailed information on TCP and BGP neighbor connections\n"
7633 "Neighbor to display information about\n"
7634 "Neighbor to display information about\n")
7636 /* Show BGP's AS paths internal data. There are both `show ip bgp
7637 paths' and `show ip mbgp paths'. Those functions results are the
7638 same.*/
7639 DEFUN (show_ip_bgp_paths,
7640 show_ip_bgp_paths_cmd,
7641 "show ip bgp paths",
7642 SHOW_STR
7643 IP_STR
7644 BGP_STR
7645 "Path information\n")
7647 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
7648 aspath_print_all_vty (vty);
7649 return CMD_SUCCESS;
7652 DEFUN (show_ip_bgp_ipv4_paths,
7653 show_ip_bgp_ipv4_paths_cmd,
7654 "show ip bgp ipv4 (unicast|multicast) paths",
7655 SHOW_STR
7656 IP_STR
7657 BGP_STR
7658 "Address family\n"
7659 "Address Family modifier\n"
7660 "Address Family modifier\n"
7661 "Path information\n")
7663 vty_out (vty, "Address Refcnt Path\r\n");
7664 aspath_print_all_vty (vty);
7666 return CMD_SUCCESS;
7669 #include "hash.h"
7671 static void
7672 community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
7674 struct community *com;
7676 com = (struct community *) backet->data;
7677 vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt,
7678 community_str (com), VTY_NEWLINE);
7681 /* Show BGP's community internal data. */
7682 DEFUN (show_ip_bgp_community_info,
7683 show_ip_bgp_community_info_cmd,
7684 "show ip bgp community-info",
7685 SHOW_STR
7686 IP_STR
7687 BGP_STR
7688 "List all bgp community information\n")
7690 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
7692 hash_iterate (community_hash (),
7693 (void (*) (struct hash_backet *, void *))
7694 community_show_all_iterator,
7695 vty);
7697 return CMD_SUCCESS;
7700 DEFUN (show_ip_bgp_attr_info,
7701 show_ip_bgp_attr_info_cmd,
7702 "show ip bgp attribute-info",
7703 SHOW_STR
7704 IP_STR
7705 BGP_STR
7706 "List all bgp attribute information\n")
7708 attr_show_all (vty);
7709 return CMD_SUCCESS;
7712 static int
7713 bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
7714 afi_t afi, safi_t safi)
7716 char timebuf[BGP_UPTIME_LEN];
7717 char rmbuf[14];
7718 const char *rmname;
7719 struct peer *peer;
7720 struct listnode *node, *nnode;
7721 int len;
7722 int count = 0;
7724 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
7726 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
7728 count++;
7729 bgp_write_rsclient_summary (vty, peer, afi, safi);
7731 return count;
7734 len = vty_out (vty, "%s", rsclient->host);
7735 len = 16 - len;
7737 if (len < 1)
7738 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7739 else
7740 vty_out (vty, "%*s", len, " ");
7742 vty_out (vty, "4 ");
7744 vty_out (vty, "%5d ", rsclient->as);
7746 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
7747 if ( rmname && strlen (rmname) > 13 )
7749 sprintf (rmbuf, "%13s", "...");
7750 rmname = strncpy (rmbuf, rmname, 10);
7752 else if (! rmname)
7753 rmname = "<none>";
7754 vty_out (vty, " %13s ", rmname);
7756 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
7757 if ( rmname && strlen (rmname) > 13 )
7759 sprintf (rmbuf, "%13s", "...");
7760 rmname = strncpy (rmbuf, rmname, 10);
7762 else if (! rmname)
7763 rmname = "<none>";
7764 vty_out (vty, " %13s ", rmname);
7766 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
7768 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
7769 vty_out (vty, " Idle (Admin)");
7770 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7771 vty_out (vty, " Idle (PfxCt)");
7772 else
7773 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
7775 vty_out (vty, "%s", VTY_NEWLINE);
7777 return 1;
7780 static int
7781 bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
7782 afi_t afi, safi_t safi)
7784 struct peer *peer;
7785 struct listnode *node, *nnode;
7786 int count = 0;
7788 /* Header string for each address family. */
7789 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
7791 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
7793 if (peer->afc[afi][safi] &&
7794 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7796 if (! count)
7798 vty_out (vty,
7799 "Route Server's BGP router identifier %s%s",
7800 inet_ntoa (bgp->router_id), VTY_NEWLINE);
7801 vty_out (vty,
7802 "Route Server's local AS number %d%s", bgp->as,
7803 VTY_NEWLINE);
7805 vty_out (vty, "%s", VTY_NEWLINE);
7806 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7809 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
7813 if (count)
7814 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
7815 count, VTY_NEWLINE);
7816 else
7817 vty_out (vty, "No %s Route Server Client is configured%s",
7818 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7820 return CMD_SUCCESS;
7823 static int
7824 bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
7825 afi_t afi, safi_t safi)
7827 struct bgp *bgp;
7829 if (name)
7831 bgp = bgp_lookup_by_name (name);
7833 if (! bgp)
7835 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7836 return CMD_WARNING;
7839 bgp_show_rsclient_summary (vty, bgp, afi, safi);
7840 return CMD_SUCCESS;
7843 bgp = bgp_get_default ();
7845 if (bgp)
7846 bgp_show_rsclient_summary (vty, bgp, afi, safi);
7848 return CMD_SUCCESS;
7851 /* 'show bgp rsclient' commands. */
7852 DEFUN (show_ip_bgp_rsclient_summary,
7853 show_ip_bgp_rsclient_summary_cmd,
7854 "show ip bgp rsclient summary",
7855 SHOW_STR
7856 IP_STR
7857 BGP_STR
7858 "Information about Route Server Clients\n"
7859 "Summary of all Route Server Clients\n")
7861 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7864 DEFUN (show_ip_bgp_instance_rsclient_summary,
7865 show_ip_bgp_instance_rsclient_summary_cmd,
7866 "show ip bgp view WORD rsclient summary",
7867 SHOW_STR
7868 IP_STR
7869 BGP_STR
7870 "BGP view\n"
7871 "View name\n"
7872 "Information about Route Server Clients\n"
7873 "Summary of all Route Server Clients\n")
7875 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7878 DEFUN (show_ip_bgp_ipv4_rsclient_summary,
7879 show_ip_bgp_ipv4_rsclient_summary_cmd,
7880 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
7881 SHOW_STR
7882 IP_STR
7883 BGP_STR
7884 "Address family\n"
7885 "Address Family modifier\n"
7886 "Address Family modifier\n"
7887 "Information about Route Server Clients\n"
7888 "Summary of all Route Server Clients\n")
7890 if (strncmp (argv[0], "m", 1) == 0)
7891 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7893 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7896 DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
7897 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
7898 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
7899 SHOW_STR
7900 IP_STR
7901 BGP_STR
7902 "BGP view\n"
7903 "View name\n"
7904 "Address family\n"
7905 "Address Family modifier\n"
7906 "Address Family modifier\n"
7907 "Information about Route Server Clients\n"
7908 "Summary of all Route Server Clients\n")
7910 if (strncmp (argv[1], "m", 1) == 0)
7911 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7913 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7916 #ifdef HAVE_IPV6
7917 DEFUN (show_bgp_rsclient_summary,
7918 show_bgp_rsclient_summary_cmd,
7919 "show bgp rsclient summary",
7920 SHOW_STR
7921 BGP_STR
7922 "Information about Route Server Clients\n"
7923 "Summary of all Route Server Clients\n")
7925 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7928 DEFUN (show_bgp_instance_rsclient_summary,
7929 show_bgp_instance_rsclient_summary_cmd,
7930 "show bgp view WORD rsclient summary",
7931 SHOW_STR
7932 BGP_STR
7933 "BGP view\n"
7934 "View name\n"
7935 "Information about Route Server Clients\n"
7936 "Summary of all Route Server Clients\n")
7938 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7941 ALIAS (show_bgp_rsclient_summary,
7942 show_bgp_ipv6_rsclient_summary_cmd,
7943 "show bgp ipv6 rsclient summary",
7944 SHOW_STR
7945 BGP_STR
7946 "Address family\n"
7947 "Information about Route Server Clients\n"
7948 "Summary of all Route Server Clients\n")
7950 ALIAS (show_bgp_instance_rsclient_summary,
7951 show_bgp_instance_ipv6_rsclient_summary_cmd,
7952 "show bgp view WORD ipv6 rsclient summary",
7953 SHOW_STR
7954 BGP_STR
7955 "BGP view\n"
7956 "View name\n"
7957 "Address family\n"
7958 "Information about Route Server Clients\n"
7959 "Summary of all Route Server Clients\n")
7960 #endif /* HAVE IPV6 */
7962 /* Redistribute VTY commands. */
7964 /* Utility function to convert user input route type string to route
7965 type. */
7966 static int
7967 bgp_str2route_type (int afi, const char *str)
7969 if (! str)
7970 return 0;
7972 if (afi == AFI_IP)
7974 if (strncmp (str, "k", 1) == 0)
7975 return ZEBRA_ROUTE_KERNEL;
7976 else if (strncmp (str, "c", 1) == 0)
7977 return ZEBRA_ROUTE_CONNECT;
7978 else if (strncmp (str, "s", 1) == 0)
7979 return ZEBRA_ROUTE_STATIC;
7980 else if (strncmp (str, "r", 1) == 0)
7981 return ZEBRA_ROUTE_RIP;
7982 else if (strncmp (str, "o", 1) == 0)
7983 return ZEBRA_ROUTE_OSPF;
7985 if (afi == AFI_IP6)
7987 if (strncmp (str, "k", 1) == 0)
7988 return ZEBRA_ROUTE_KERNEL;
7989 else if (strncmp (str, "c", 1) == 0)
7990 return ZEBRA_ROUTE_CONNECT;
7991 else if (strncmp (str, "s", 1) == 0)
7992 return ZEBRA_ROUTE_STATIC;
7993 else if (strncmp (str, "r", 1) == 0)
7994 return ZEBRA_ROUTE_RIPNG;
7995 else if (strncmp (str, "o", 1) == 0)
7996 return ZEBRA_ROUTE_OSPF6;
7998 return 0;
8001 DEFUN (bgp_redistribute_ipv4,
8002 bgp_redistribute_ipv4_cmd,
8003 "redistribute (connected|kernel|ospf|rip|static)",
8004 "Redistribute information from another routing protocol\n"
8005 "Connected\n"
8006 "Kernel routes\n"
8007 "Open Shurtest Path First (OSPF)\n"
8008 "Routing Information Protocol (RIP)\n"
8009 "Static routes\n")
8011 int type;
8013 type = bgp_str2route_type (AFI_IP, argv[0]);
8014 if (! type)
8016 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8017 return CMD_WARNING;
8019 return bgp_redistribute_set (vty->index, AFI_IP, type);
8022 DEFUN (bgp_redistribute_ipv4_rmap,
8023 bgp_redistribute_ipv4_rmap_cmd,
8024 "redistribute (connected|kernel|ospf|rip|static) route-map WORD",
8025 "Redistribute information from another routing protocol\n"
8026 "Connected\n"
8027 "Kernel routes\n"
8028 "Open Shurtest Path First (OSPF)\n"
8029 "Routing Information Protocol (RIP)\n"
8030 "Static routes\n"
8031 "Route map reference\n"
8032 "Pointer to route-map entries\n")
8034 int type;
8036 type = bgp_str2route_type (AFI_IP, argv[0]);
8037 if (! type)
8039 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8040 return CMD_WARNING;
8043 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8044 return bgp_redistribute_set (vty->index, AFI_IP, type);
8047 DEFUN (bgp_redistribute_ipv4_metric,
8048 bgp_redistribute_ipv4_metric_cmd,
8049 "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
8050 "Redistribute information from another routing protocol\n"
8051 "Connected\n"
8052 "Kernel routes\n"
8053 "Open Shurtest Path First (OSPF)\n"
8054 "Routing Information Protocol (RIP)\n"
8055 "Static routes\n"
8056 "Metric for redistributed routes\n"
8057 "Default metric\n")
8059 int type;
8060 u_int32_t metric;
8062 type = bgp_str2route_type (AFI_IP, argv[0]);
8063 if (! type)
8065 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8066 return CMD_WARNING;
8068 VTY_GET_INTEGER ("metric", metric, argv[1]);
8070 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8071 return bgp_redistribute_set (vty->index, AFI_IP, type);
8074 DEFUN (bgp_redistribute_ipv4_rmap_metric,
8075 bgp_redistribute_ipv4_rmap_metric_cmd,
8076 "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
8077 "Redistribute information from another routing protocol\n"
8078 "Connected\n"
8079 "Kernel routes\n"
8080 "Open Shurtest Path First (OSPF)\n"
8081 "Routing Information Protocol (RIP)\n"
8082 "Static routes\n"
8083 "Route map reference\n"
8084 "Pointer to route-map entries\n"
8085 "Metric for redistributed routes\n"
8086 "Default metric\n")
8088 int type;
8089 u_int32_t metric;
8091 type = bgp_str2route_type (AFI_IP, argv[0]);
8092 if (! type)
8094 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8095 return CMD_WARNING;
8097 VTY_GET_INTEGER ("metric", metric, argv[2]);
8099 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8100 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8101 return bgp_redistribute_set (vty->index, AFI_IP, type);
8104 DEFUN (bgp_redistribute_ipv4_metric_rmap,
8105 bgp_redistribute_ipv4_metric_rmap_cmd,
8106 "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
8107 "Redistribute information from another routing protocol\n"
8108 "Connected\n"
8109 "Kernel routes\n"
8110 "Open Shurtest Path First (OSPF)\n"
8111 "Routing Information Protocol (RIP)\n"
8112 "Static routes\n"
8113 "Metric for redistributed routes\n"
8114 "Default metric\n"
8115 "Route map reference\n"
8116 "Pointer to route-map entries\n")
8118 int type;
8119 u_int32_t metric;
8121 type = bgp_str2route_type (AFI_IP, argv[0]);
8122 if (! type)
8124 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8125 return CMD_WARNING;
8127 VTY_GET_INTEGER ("metric", metric, argv[1]);
8129 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8130 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
8131 return bgp_redistribute_set (vty->index, AFI_IP, type);
8134 DEFUN (no_bgp_redistribute_ipv4,
8135 no_bgp_redistribute_ipv4_cmd,
8136 "no redistribute (connected|kernel|ospf|rip|static)",
8137 NO_STR
8138 "Redistribute information from another routing protocol\n"
8139 "Connected\n"
8140 "Kernel routes\n"
8141 "Open Shurtest Path First (OSPF)\n"
8142 "Routing Information Protocol (RIP)\n"
8143 "Static routes\n")
8145 int type;
8147 type = bgp_str2route_type (AFI_IP, argv[0]);
8148 if (! type)
8150 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8151 return CMD_WARNING;
8154 return bgp_redistribute_unset (vty->index, AFI_IP, type);
8157 DEFUN (no_bgp_redistribute_ipv4_rmap,
8158 no_bgp_redistribute_ipv4_rmap_cmd,
8159 "no redistribute (connected|kernel|ospf|rip|static) route-map WORD",
8160 NO_STR
8161 "Redistribute information from another routing protocol\n"
8162 "Connected\n"
8163 "Kernel routes\n"
8164 "Open Shurtest Path First (OSPF)\n"
8165 "Routing Information Protocol (RIP)\n"
8166 "Static routes\n"
8167 "Route map reference\n"
8168 "Pointer to route-map entries\n")
8170 int type;
8172 type = bgp_str2route_type (AFI_IP, argv[0]);
8173 if (! type)
8175 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8176 return CMD_WARNING;
8179 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8180 return CMD_SUCCESS;
8183 DEFUN (no_bgp_redistribute_ipv4_metric,
8184 no_bgp_redistribute_ipv4_metric_cmd,
8185 "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
8186 NO_STR
8187 "Redistribute information from another routing protocol\n"
8188 "Connected\n"
8189 "Kernel routes\n"
8190 "Open Shurtest Path First (OSPF)\n"
8191 "Routing Information Protocol (RIP)\n"
8192 "Static routes\n"
8193 "Metric for redistributed routes\n"
8194 "Default metric\n")
8196 int type;
8198 type = bgp_str2route_type (AFI_IP, argv[0]);
8199 if (! type)
8201 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8202 return CMD_WARNING;
8205 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8206 return CMD_SUCCESS;
8209 DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
8210 no_bgp_redistribute_ipv4_rmap_metric_cmd,
8211 "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
8212 NO_STR
8213 "Redistribute information from another routing protocol\n"
8214 "Connected\n"
8215 "Kernel routes\n"
8216 "Open Shurtest Path First (OSPF)\n"
8217 "Routing Information Protocol (RIP)\n"
8218 "Static routes\n"
8219 "Route map reference\n"
8220 "Pointer to route-map entries\n"
8221 "Metric for redistributed routes\n"
8222 "Default metric\n")
8224 int type;
8226 type = bgp_str2route_type (AFI_IP, argv[0]);
8227 if (! type)
8229 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8230 return CMD_WARNING;
8233 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8234 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8235 return CMD_SUCCESS;
8238 ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
8239 no_bgp_redistribute_ipv4_metric_rmap_cmd,
8240 "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
8241 NO_STR
8242 "Redistribute information from another routing protocol\n"
8243 "Connected\n"
8244 "Kernel routes\n"
8245 "Open Shurtest Path First (OSPF)\n"
8246 "Routing Information Protocol (RIP)\n"
8247 "Static routes\n"
8248 "Metric for redistributed routes\n"
8249 "Default metric\n"
8250 "Route map reference\n"
8251 "Pointer to route-map entries\n")
8253 #ifdef HAVE_IPV6
8254 DEFUN (bgp_redistribute_ipv6,
8255 bgp_redistribute_ipv6_cmd,
8256 "redistribute (connected|kernel|ospf6|ripng|static)",
8257 "Redistribute information from another routing protocol\n"
8258 "Connected\n"
8259 "Kernel routes\n"
8260 "Open Shurtest Path First (OSPFv3)\n"
8261 "Routing Information Protocol (RIPng)\n"
8262 "Static routes\n")
8264 int type;
8266 type = bgp_str2route_type (AFI_IP6, argv[0]);
8267 if (! type)
8269 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8270 return CMD_WARNING;
8273 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8276 DEFUN (bgp_redistribute_ipv6_rmap,
8277 bgp_redistribute_ipv6_rmap_cmd,
8278 "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
8279 "Redistribute information from another routing protocol\n"
8280 "Connected\n"
8281 "Kernel routes\n"
8282 "Open Shurtest Path First (OSPFv3)\n"
8283 "Routing Information Protocol (RIPng)\n"
8284 "Static routes\n"
8285 "Route map reference\n"
8286 "Pointer to route-map entries\n")
8288 int type;
8290 type = bgp_str2route_type (AFI_IP6, argv[0]);
8291 if (! type)
8293 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8294 return CMD_WARNING;
8297 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8298 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8301 DEFUN (bgp_redistribute_ipv6_metric,
8302 bgp_redistribute_ipv6_metric_cmd,
8303 "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
8304 "Redistribute information from another routing protocol\n"
8305 "Connected\n"
8306 "Kernel routes\n"
8307 "Open Shurtest Path First (OSPFv3)\n"
8308 "Routing Information Protocol (RIPng)\n"
8309 "Static routes\n"
8310 "Metric for redistributed routes\n"
8311 "Default metric\n")
8313 int type;
8314 u_int32_t metric;
8316 type = bgp_str2route_type (AFI_IP6, argv[0]);
8317 if (! type)
8319 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8320 return CMD_WARNING;
8322 VTY_GET_INTEGER ("metric", metric, argv[1]);
8324 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8325 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8328 DEFUN (bgp_redistribute_ipv6_rmap_metric,
8329 bgp_redistribute_ipv6_rmap_metric_cmd,
8330 "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
8331 "Redistribute information from another routing protocol\n"
8332 "Connected\n"
8333 "Kernel routes\n"
8334 "Open Shurtest Path First (OSPFv3)\n"
8335 "Routing Information Protocol (RIPng)\n"
8336 "Static routes\n"
8337 "Route map reference\n"
8338 "Pointer to route-map entries\n"
8339 "Metric for redistributed routes\n"
8340 "Default metric\n")
8342 int type;
8343 u_int32_t metric;
8345 type = bgp_str2route_type (AFI_IP6, argv[0]);
8346 if (! type)
8348 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8349 return CMD_WARNING;
8351 VTY_GET_INTEGER ("metric", metric, argv[2]);
8353 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8354 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8355 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8358 DEFUN (bgp_redistribute_ipv6_metric_rmap,
8359 bgp_redistribute_ipv6_metric_rmap_cmd,
8360 "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
8361 "Redistribute information from another routing protocol\n"
8362 "Connected\n"
8363 "Kernel routes\n"
8364 "Open Shurtest Path First (OSPFv3)\n"
8365 "Routing Information Protocol (RIPng)\n"
8366 "Static routes\n"
8367 "Metric for redistributed routes\n"
8368 "Default metric\n"
8369 "Route map reference\n"
8370 "Pointer to route-map entries\n")
8372 int type;
8373 u_int32_t metric;
8375 type = bgp_str2route_type (AFI_IP6, argv[0]);
8376 if (! type)
8378 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8379 return CMD_WARNING;
8381 VTY_GET_INTEGER ("metric", metric, argv[1]);
8383 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8384 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
8385 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8388 DEFUN (no_bgp_redistribute_ipv6,
8389 no_bgp_redistribute_ipv6_cmd,
8390 "no redistribute (connected|kernel|ospf6|ripng|static)",
8391 NO_STR
8392 "Redistribute information from another routing protocol\n"
8393 "Connected\n"
8394 "Kernel routes\n"
8395 "Open Shurtest Path First (OSPFv3)\n"
8396 "Routing Information Protocol (RIPng)\n"
8397 "Static routes\n")
8399 int type;
8401 type = bgp_str2route_type (AFI_IP6, argv[0]);
8402 if (! type)
8404 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8405 return CMD_WARNING;
8408 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
8411 DEFUN (no_bgp_redistribute_ipv6_rmap,
8412 no_bgp_redistribute_ipv6_rmap_cmd,
8413 "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
8414 NO_STR
8415 "Redistribute information from another routing protocol\n"
8416 "Connected\n"
8417 "Kernel routes\n"
8418 "Open Shurtest Path First (OSPFv3)\n"
8419 "Routing Information Protocol (RIPng)\n"
8420 "Static routes\n"
8421 "Route map reference\n"
8422 "Pointer to route-map entries\n")
8424 int type;
8426 type = bgp_str2route_type (AFI_IP6, argv[0]);
8427 if (! type)
8429 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8430 return CMD_WARNING;
8433 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8434 return CMD_SUCCESS;
8437 DEFUN (no_bgp_redistribute_ipv6_metric,
8438 no_bgp_redistribute_ipv6_metric_cmd,
8439 "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
8440 NO_STR
8441 "Redistribute information from another routing protocol\n"
8442 "Connected\n"
8443 "Kernel routes\n"
8444 "Open Shurtest Path First (OSPFv3)\n"
8445 "Routing Information Protocol (RIPng)\n"
8446 "Static routes\n"
8447 "Metric for redistributed routes\n"
8448 "Default metric\n")
8450 int type;
8452 type = bgp_str2route_type (AFI_IP6, argv[0]);
8453 if (! type)
8455 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8456 return CMD_WARNING;
8459 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8460 return CMD_SUCCESS;
8463 DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
8464 no_bgp_redistribute_ipv6_rmap_metric_cmd,
8465 "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
8466 NO_STR
8467 "Redistribute information from another routing protocol\n"
8468 "Connected\n"
8469 "Kernel routes\n"
8470 "Open Shurtest Path First (OSPFv3)\n"
8471 "Routing Information Protocol (RIPng)\n"
8472 "Static routes\n"
8473 "Route map reference\n"
8474 "Pointer to route-map entries\n"
8475 "Metric for redistributed routes\n"
8476 "Default metric\n")
8478 int type;
8480 type = bgp_str2route_type (AFI_IP6, argv[0]);
8481 if (! type)
8483 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8484 return CMD_WARNING;
8487 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8488 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8489 return CMD_SUCCESS;
8492 ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
8493 no_bgp_redistribute_ipv6_metric_rmap_cmd,
8494 "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
8495 NO_STR
8496 "Redistribute information from another routing protocol\n"
8497 "Connected\n"
8498 "Kernel routes\n"
8499 "Open Shurtest Path First (OSPFv3)\n"
8500 "Routing Information Protocol (RIPng)\n"
8501 "Static routes\n"
8502 "Metric for redistributed routes\n"
8503 "Default metric\n"
8504 "Route map reference\n"
8505 "Pointer to route-map entries\n")
8506 #endif /* HAVE_IPV6 */
8509 bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
8510 safi_t safi, int *write)
8512 int i;
8514 /* Unicast redistribution only. */
8515 if (safi != SAFI_UNICAST)
8516 return 0;
8518 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
8520 /* Redistribute BGP does not make sense. */
8521 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
8523 /* Display "address-family" when it is not yet diplayed. */
8524 bgp_config_write_family_header (vty, afi, safi, write);
8526 /* "redistribute" configuration. */
8527 vty_out (vty, " redistribute %s", zebra_route_string(i));
8529 if (bgp->redist_metric_flag[afi][i])
8530 vty_out (vty, " metric %d", bgp->redist_metric[afi][i]);
8532 if (bgp->rmap[afi][i].name)
8533 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
8535 vty_out (vty, "%s", VTY_NEWLINE);
8538 return *write;
8541 /* BGP node structure. */
8542 struct cmd_node bgp_node =
8544 BGP_NODE,
8545 "%s(config-router)# ",
8549 struct cmd_node bgp_ipv4_unicast_node =
8551 BGP_IPV4_NODE,
8552 "%s(config-router-af)# ",
8556 struct cmd_node bgp_ipv4_multicast_node =
8558 BGP_IPV4M_NODE,
8559 "%s(config-router-af)# ",
8563 struct cmd_node bgp_ipv6_unicast_node =
8565 BGP_IPV6_NODE,
8566 "%s(config-router-af)# ",
8570 struct cmd_node bgp_ipv6_multicast_node =
8572 BGP_IPV6M_NODE,
8573 "%s(config-router-af)# ",
8577 struct cmd_node bgp_vpnv4_node =
8579 BGP_VPNV4_NODE,
8580 "%s(config-router-af)# ",
8584 static void community_list_vty (void);
8586 void
8587 bgp_vty_init (void)
8589 /* Install bgp top node. */
8590 install_node (&bgp_node, bgp_config_write);
8591 install_node (&bgp_ipv4_unicast_node, NULL);
8592 install_node (&bgp_ipv4_multicast_node, NULL);
8593 install_node (&bgp_ipv6_unicast_node, NULL);
8594 install_node (&bgp_ipv6_multicast_node, NULL);
8595 install_node (&bgp_vpnv4_node, NULL);
8597 /* Install default VTY commands to new nodes. */
8598 install_default (BGP_NODE);
8599 install_default (BGP_IPV4_NODE);
8600 install_default (BGP_IPV4M_NODE);
8601 install_default (BGP_IPV6_NODE);
8602 install_default (BGP_IPV6M_NODE);
8603 install_default (BGP_VPNV4_NODE);
8605 /* "bgp multiple-instance" commands. */
8606 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
8607 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
8609 /* "bgp config-type" commands. */
8610 install_element (CONFIG_NODE, &bgp_config_type_cmd);
8611 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
8613 /* Dummy commands (Currently not supported) */
8614 install_element (BGP_NODE, &no_synchronization_cmd);
8615 install_element (BGP_NODE, &no_auto_summary_cmd);
8617 /* "router bgp" commands. */
8618 install_element (CONFIG_NODE, &router_bgp_cmd);
8619 install_element (CONFIG_NODE, &router_bgp_view_cmd);
8621 /* "no router bgp" commands. */
8622 install_element (CONFIG_NODE, &no_router_bgp_cmd);
8623 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
8625 /* "bgp router-id" commands. */
8626 install_element (BGP_NODE, &bgp_router_id_cmd);
8627 install_element (BGP_NODE, &no_bgp_router_id_cmd);
8628 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
8630 /* "bgp cluster-id" commands. */
8631 install_element (BGP_NODE, &bgp_cluster_id_cmd);
8632 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
8633 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
8634 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
8636 /* "bgp confederation" commands. */
8637 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
8638 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
8639 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
8641 /* "bgp confederation peers" commands. */
8642 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
8643 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
8645 /* "timers bgp" commands. */
8646 install_element (BGP_NODE, &bgp_timers_cmd);
8647 install_element (BGP_NODE, &no_bgp_timers_cmd);
8648 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
8650 /* "bgp client-to-client reflection" commands */
8651 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
8652 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
8654 /* "bgp always-compare-med" commands */
8655 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
8656 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
8658 /* "bgp deterministic-med" commands */
8659 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
8660 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
8662 /* "bgp graceful-restart" commands */
8663 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
8664 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
8665 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
8666 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
8667 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
8669 /* "bgp fast-external-failover" commands */
8670 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
8671 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
8673 /* "bgp enforce-first-as" commands */
8674 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
8675 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
8677 /* "bgp bestpath compare-routerid" commands */
8678 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
8679 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
8681 /* "bgp bestpath as-path ignore" commands */
8682 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
8683 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
8685 /* "bgp bestpath as-path confed" commands */
8686 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
8687 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
8689 /* "bgp log-neighbor-changes" commands */
8690 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
8691 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
8693 /* "bgp bestpath med" commands */
8694 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
8695 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
8696 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
8697 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
8698 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
8699 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
8701 /* "no bgp default ipv4-unicast" commands. */
8702 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
8703 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
8705 /* "bgp network import-check" commands. */
8706 install_element (BGP_NODE, &bgp_network_import_check_cmd);
8707 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
8709 /* "bgp default local-preference" commands. */
8710 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
8711 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
8712 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
8714 /* "neighbor remote-as" commands. */
8715 install_element (BGP_NODE, &neighbor_remote_as_cmd);
8716 install_element (BGP_NODE, &no_neighbor_cmd);
8717 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
8719 /* "neighbor peer-group" commands. */
8720 install_element (BGP_NODE, &neighbor_peer_group_cmd);
8721 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
8722 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
8724 /* "neighbor local-as" commands. */
8725 install_element (BGP_NODE, &neighbor_local_as_cmd);
8726 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
8727 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
8728 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
8729 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
8731 /* "neighbor activate" commands. */
8732 install_element (BGP_NODE, &neighbor_activate_cmd);
8733 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
8734 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
8735 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
8736 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
8737 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
8739 /* "no neighbor activate" commands. */
8740 install_element (BGP_NODE, &no_neighbor_activate_cmd);
8741 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
8742 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
8743 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
8744 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
8745 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
8747 /* "neighbor peer-group set" commands. */
8748 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
8749 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
8750 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
8751 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
8752 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
8753 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
8755 /* "no neighbor peer-group unset" commands. */
8756 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
8757 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
8758 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
8759 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
8760 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
8761 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
8763 /* "neighbor softreconfiguration inbound" commands.*/
8764 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
8765 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
8766 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
8767 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
8768 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
8769 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
8770 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
8771 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
8772 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
8773 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
8774 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
8775 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
8777 /* "neighbor attribute-unchanged" commands. */
8778 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
8779 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
8780 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
8781 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
8782 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
8783 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
8784 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
8785 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
8786 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
8787 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
8788 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
8789 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
8790 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
8791 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
8792 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
8793 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
8794 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
8795 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
8796 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
8797 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
8798 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
8799 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
8800 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
8801 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
8802 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
8803 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
8804 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
8805 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
8806 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
8807 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
8808 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
8809 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
8810 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
8811 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
8812 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
8813 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
8814 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
8815 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
8816 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
8817 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
8818 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
8819 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
8820 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
8821 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
8822 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
8823 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
8824 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
8825 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
8826 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
8827 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
8828 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
8829 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
8830 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
8831 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
8832 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
8833 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
8834 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
8835 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
8836 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
8837 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
8838 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
8839 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
8840 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
8841 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
8842 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
8843 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
8844 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
8845 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
8846 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
8847 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
8848 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
8849 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
8850 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
8851 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
8852 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
8853 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
8854 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
8855 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
8856 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
8857 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
8858 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
8859 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
8860 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
8861 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
8862 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
8863 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
8864 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
8865 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
8866 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
8867 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
8868 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
8869 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
8870 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
8871 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
8872 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
8873 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
8874 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
8875 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
8876 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
8877 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
8878 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
8879 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
8880 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
8881 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
8882 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
8883 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
8884 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
8885 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
8886 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
8887 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
8888 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
8889 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
8890 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
8891 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
8892 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
8893 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
8894 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
8895 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
8896 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
8897 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
8898 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
8899 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
8900 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
8901 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
8902 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
8903 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
8904 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
8905 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
8906 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
8907 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
8908 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
8909 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
8911 /* "nexthop-local unchanged" commands */
8912 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
8913 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
8915 /* "transparent-as" and "transparent-nexthop" for old version
8916 compatibility. */
8917 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
8918 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
8920 /* "neighbor next-hop-self" commands. */
8921 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
8922 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
8923 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
8924 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
8925 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
8926 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
8927 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
8928 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
8929 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
8930 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
8931 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
8932 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
8934 /* "neighbor remove-private-AS" commands. */
8935 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
8936 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
8937 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
8938 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
8939 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
8940 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
8941 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
8942 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
8943 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
8944 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
8945 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
8946 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
8948 /* "neighbor send-community" commands.*/
8949 install_element (BGP_NODE, &neighbor_send_community_cmd);
8950 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
8951 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
8952 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
8953 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
8954 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
8955 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
8956 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
8957 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
8958 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
8959 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
8960 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
8961 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
8962 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
8963 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
8964 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
8965 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
8966 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
8967 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
8968 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
8969 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
8970 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
8971 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
8972 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
8974 /* "neighbor route-reflector" commands.*/
8975 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
8976 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
8977 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
8978 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
8979 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
8980 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
8981 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
8982 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
8983 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
8984 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
8985 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
8986 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
8988 /* "neighbor route-server" commands.*/
8989 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
8990 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
8991 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
8992 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
8993 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
8994 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
8995 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
8996 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
8997 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
8998 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
8999 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
9000 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
9002 /* "neighbor passive" commands. */
9003 install_element (BGP_NODE, &neighbor_passive_cmd);
9004 install_element (BGP_NODE, &no_neighbor_passive_cmd);
9006 /* "neighbor shutdown" commands. */
9007 install_element (BGP_NODE, &neighbor_shutdown_cmd);
9008 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
9010 /* Deprecated "neighbor capability route-refresh" commands.*/
9011 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
9012 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
9014 /* "neighbor capability orf prefix-list" commands.*/
9015 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
9016 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
9017 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
9018 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
9019 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
9020 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
9021 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
9022 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
9023 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
9024 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
9026 /* "neighbor capability dynamic" commands.*/
9027 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
9028 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
9030 /* "neighbor dont-capability-negotiate" commands. */
9031 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
9032 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
9034 /* "neighbor ebgp-multihop" commands. */
9035 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
9036 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
9037 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
9038 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
9040 /* "neighbor disable-connected-check" commands. */
9041 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
9042 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
9043 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
9044 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
9046 /* "neighbor description" commands. */
9047 install_element (BGP_NODE, &neighbor_description_cmd);
9048 install_element (BGP_NODE, &no_neighbor_description_cmd);
9049 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
9051 /* "neighbor update-source" commands. "*/
9052 install_element (BGP_NODE, &neighbor_update_source_cmd);
9053 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
9055 /* "neighbor default-originate" commands. */
9056 install_element (BGP_NODE, &neighbor_default_originate_cmd);
9057 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
9058 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
9059 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
9060 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
9061 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
9062 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
9063 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
9064 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
9065 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
9066 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
9067 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
9068 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
9069 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
9070 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
9071 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
9072 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
9073 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
9074 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
9075 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
9077 /* "neighbor port" commands. */
9078 install_element (BGP_NODE, &neighbor_port_cmd);
9079 install_element (BGP_NODE, &no_neighbor_port_cmd);
9080 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
9082 /* "neighbor weight" commands. */
9083 install_element (BGP_NODE, &neighbor_weight_cmd);
9084 install_element (BGP_NODE, &no_neighbor_weight_cmd);
9085 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
9087 /* "neighbor override-capability" commands. */
9088 install_element (BGP_NODE, &neighbor_override_capability_cmd);
9089 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
9091 /* "neighbor strict-capability-match" commands. */
9092 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
9093 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
9095 /* "neighbor timers" commands. */
9096 install_element (BGP_NODE, &neighbor_timers_cmd);
9097 install_element (BGP_NODE, &no_neighbor_timers_cmd);
9099 /* "neighbor timers connect" commands. */
9100 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
9101 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
9102 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
9104 /* "neighbor advertisement-interval" commands. */
9105 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
9106 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
9107 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
9109 /* "neighbor version" commands. */
9110 install_element (BGP_NODE, &neighbor_version_cmd);
9112 /* "neighbor interface" commands. */
9113 install_element (BGP_NODE, &neighbor_interface_cmd);
9114 install_element (BGP_NODE, &no_neighbor_interface_cmd);
9116 /* "neighbor distribute" commands. */
9117 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
9118 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
9119 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
9120 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
9121 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
9122 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
9123 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
9124 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
9125 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
9126 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
9127 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
9128 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
9130 /* "neighbor prefix-list" commands. */
9131 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
9132 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
9133 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
9134 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
9135 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
9136 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
9137 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
9138 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
9139 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
9140 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
9141 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
9142 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
9144 /* "neighbor filter-list" commands. */
9145 install_element (BGP_NODE, &neighbor_filter_list_cmd);
9146 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
9147 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
9148 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
9149 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
9150 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
9151 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
9152 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
9153 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
9154 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
9155 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
9156 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
9158 /* "neighbor route-map" commands. */
9159 install_element (BGP_NODE, &neighbor_route_map_cmd);
9160 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
9161 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
9162 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
9163 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
9164 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
9165 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
9166 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
9167 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
9168 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
9169 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
9170 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
9172 /* "neighbor unsuppress-map" commands. */
9173 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
9174 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
9175 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
9176 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
9177 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
9178 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
9179 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
9180 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
9181 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
9182 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
9183 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
9184 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
9186 /* "neighbor maximum-prefix" commands. */
9187 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
9188 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
9189 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
9190 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9191 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
9192 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9193 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
9194 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
9195 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9196 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9197 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9198 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9199 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
9200 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
9201 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
9202 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
9203 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9204 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9205 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9206 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
9207 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
9208 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9209 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9210 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9211 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9212 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
9213 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
9214 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
9215 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
9216 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9217 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
9218 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9219 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
9220 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
9221 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9222 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9223 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9224 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9225 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
9226 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
9227 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
9228 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
9229 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9230 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
9231 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9232 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
9233 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
9234 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9235 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9236 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9237 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9238 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
9239 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
9240 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
9241 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
9242 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9243 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
9244 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9245 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
9246 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
9247 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9248 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9249 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9250 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9251 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
9252 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
9253 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
9254 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
9255 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9256 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9257 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9258 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
9259 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
9260 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9261 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9262 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9263 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9264 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
9266 /* "neighbor allowas-in" */
9267 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
9268 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
9269 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
9270 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
9271 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
9272 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
9273 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
9274 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
9275 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
9276 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
9277 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
9278 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
9279 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
9280 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
9281 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
9282 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
9283 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
9284 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
9286 /* address-family commands. */
9287 install_element (BGP_NODE, &address_family_ipv4_cmd);
9288 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
9289 #ifdef HAVE_IPV6
9290 install_element (BGP_NODE, &address_family_ipv6_cmd);
9291 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
9292 #endif /* HAVE_IPV6 */
9293 install_element (BGP_NODE, &address_family_vpnv4_cmd);
9294 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
9296 /* "exit-address-family" command. */
9297 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
9298 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
9299 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
9300 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
9301 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
9303 /* "clear ip bgp commands" */
9304 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
9305 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
9306 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
9307 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
9308 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
9309 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
9310 #ifdef HAVE_IPV6
9311 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
9312 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
9313 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
9314 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
9315 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
9316 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
9317 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
9318 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
9319 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
9320 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
9321 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
9322 #endif /* HAVE_IPV6 */
9324 /* "clear ip bgp neighbor soft in" */
9325 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
9326 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
9327 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
9328 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
9329 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
9330 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
9331 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
9332 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
9333 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
9334 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
9335 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
9336 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
9337 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
9338 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
9339 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
9340 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
9341 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
9342 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
9343 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
9344 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
9345 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
9346 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
9347 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
9348 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
9349 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
9350 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
9351 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
9352 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
9353 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
9354 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
9355 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
9356 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
9357 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
9358 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
9359 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
9360 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
9361 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
9362 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
9363 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
9364 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
9365 #ifdef HAVE_IPV6
9366 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
9367 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
9368 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
9369 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
9370 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
9371 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
9372 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
9373 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
9374 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
9375 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
9376 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
9377 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
9378 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
9379 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
9380 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
9381 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
9382 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
9383 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
9384 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
9385 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
9386 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
9387 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
9388 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
9389 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
9390 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
9391 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
9392 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
9393 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
9394 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
9395 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
9396 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
9397 #endif /* HAVE_IPV6 */
9399 /* "clear ip bgp neighbor soft out" */
9400 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
9401 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
9402 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
9403 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
9404 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
9405 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
9406 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
9407 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
9408 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
9409 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
9410 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
9411 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
9412 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
9413 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
9414 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
9415 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
9416 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
9417 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
9418 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
9419 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
9420 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
9421 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
9422 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
9423 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
9424 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
9425 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
9426 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
9427 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
9428 #ifdef HAVE_IPV6
9429 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
9430 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
9431 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
9432 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
9433 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
9434 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
9435 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
9436 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
9437 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
9438 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
9439 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
9440 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
9441 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
9442 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
9443 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
9444 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
9445 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
9446 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
9447 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
9448 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
9449 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
9450 #endif /* HAVE_IPV6 */
9452 /* "clear ip bgp neighbor soft" */
9453 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
9454 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
9455 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
9456 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
9457 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
9458 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
9459 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
9460 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
9461 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
9462 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
9463 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
9464 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
9465 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
9466 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
9467 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
9468 #ifdef HAVE_IPV6
9469 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
9470 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
9471 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
9472 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
9473 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
9474 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
9475 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
9476 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
9477 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
9478 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
9479 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
9480 #endif /* HAVE_IPV6 */
9482 /* "clear ip bgp neighbor rsclient" */
9483 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
9484 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
9485 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
9486 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
9487 #ifdef HAVE_IPV6
9488 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
9489 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
9490 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
9491 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
9492 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
9493 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
9494 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
9495 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
9496 #endif /* HAVE_IPV6 */
9498 /* "show ip bgp summary" commands. */
9499 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
9500 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
9501 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
9502 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
9503 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9504 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9505 #ifdef HAVE_IPV6
9506 install_element (VIEW_NODE, &show_bgp_summary_cmd);
9507 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
9508 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
9509 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
9510 #endif /* HAVE_IPV6 */
9511 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
9512 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
9513 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
9514 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
9515 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9516 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9517 #ifdef HAVE_IPV6
9518 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
9519 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
9520 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
9521 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
9522 #endif /* HAVE_IPV6 */
9524 /* "show ip bgp neighbors" commands. */
9525 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
9526 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
9527 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
9528 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
9529 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
9530 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
9531 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
9532 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
9533 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
9534 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
9535 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
9536 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
9537 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
9538 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
9539 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
9540 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
9541 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
9542 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
9543 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
9544 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
9546 #ifdef HAVE_IPV6
9547 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
9548 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
9549 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
9550 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
9551 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
9552 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
9553 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
9554 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
9555 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
9556 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
9557 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
9558 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
9559 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
9560 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
9561 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
9562 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
9564 /* Old commands. */
9565 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
9566 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
9567 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
9568 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
9569 #endif /* HAVE_IPV6 */
9571 /* "show ip bgp rsclient" commands. */
9572 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
9573 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
9574 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
9575 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
9576 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
9577 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
9578 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
9579 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
9581 #ifdef HAVE_IPV6
9582 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
9583 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
9584 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
9585 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
9586 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
9587 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
9588 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
9589 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
9590 #endif /* HAVE_IPV6 */
9592 /* "show ip bgp paths" commands. */
9593 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
9594 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
9595 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
9596 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
9598 /* "show ip bgp community" commands. */
9599 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
9600 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
9602 /* "show ip bgp attribute-info" commands. */
9603 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
9604 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
9606 /* "redistribute" commands. */
9607 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
9608 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
9609 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
9610 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
9611 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
9612 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
9613 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
9614 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
9615 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
9616 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
9617 #ifdef HAVE_IPV6
9618 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
9619 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
9620 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
9621 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
9622 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
9623 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
9624 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
9625 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
9626 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
9627 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
9628 #endif /* HAVE_IPV6 */
9630 /* Community-list. */
9631 community_list_vty ();
9634 #include "memory.h"
9635 #include "bgp_regex.h"
9636 #include "bgp_clist.h"
9637 #include "bgp_ecommunity.h"
9639 /* VTY functions. */
9641 /* Direction value to string conversion. */
9642 static const char *
9643 community_direct_str (int direct)
9645 switch (direct)
9647 case COMMUNITY_DENY:
9648 return "deny";
9649 break;
9650 case COMMUNITY_PERMIT:
9651 return "permit";
9652 break;
9653 default:
9654 return "unknown";
9655 break;
9659 /* Display error string. */
9660 static void
9661 community_list_perror (struct vty *vty, int ret)
9663 switch (ret)
9665 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
9666 vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE);
9667 break;
9668 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
9669 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
9670 break;
9671 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
9672 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
9673 break;
9674 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
9675 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
9676 break;
9680 /* VTY interface for community_set() function. */
9681 static int
9682 community_list_set_vty (struct vty *vty, int argc, const char **argv,
9683 int style, int reject_all_digit_name)
9685 int ret;
9686 int direct;
9687 char *str;
9689 /* Check the list type. */
9690 if (strncmp (argv[1], "p", 1) == 0)
9691 direct = COMMUNITY_PERMIT;
9692 else if (strncmp (argv[1], "d", 1) == 0)
9693 direct = COMMUNITY_DENY;
9694 else
9696 vty_out (vty, "%% Matching condition must be permit or deny%s",
9697 VTY_NEWLINE);
9698 return CMD_WARNING;
9701 /* All digit name check. */
9702 if (reject_all_digit_name && all_digit (argv[0]))
9704 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
9705 return CMD_WARNING;
9708 /* Concat community string argument. */
9709 if (argc > 1)
9710 str = argv_concat (argv, argc, 2);
9711 else
9712 str = NULL;
9714 /* When community_list_set() return nevetive value, it means
9715 malformed community string. */
9716 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
9718 /* Free temporary community list string allocated by
9719 argv_concat(). */
9720 if (str)
9721 XFREE (MTYPE_TMP, str);
9723 if (ret < 0)
9725 /* Display error string. */
9726 community_list_perror (vty, ret);
9727 return CMD_WARNING;
9730 return CMD_SUCCESS;
9733 /* Communiyt-list entry delete. */
9734 static int
9735 community_list_unset_vty (struct vty *vty, int argc, const char **argv,
9736 int style)
9738 int ret;
9739 int direct = 0;
9740 char *str = NULL;
9742 if (argc > 1)
9744 /* Check the list direct. */
9745 if (strncmp (argv[1], "p", 1) == 0)
9746 direct = COMMUNITY_PERMIT;
9747 else if (strncmp (argv[1], "d", 1) == 0)
9748 direct = COMMUNITY_DENY;
9749 else
9751 vty_out (vty, "%% Matching condition must be permit or deny%s",
9752 VTY_NEWLINE);
9753 return CMD_WARNING;
9756 /* Concat community string argument. */
9757 str = argv_concat (argv, argc, 2);
9760 /* Unset community list. */
9761 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
9763 /* Free temporary community list string allocated by
9764 argv_concat(). */
9765 if (str)
9766 XFREE (MTYPE_TMP, str);
9768 if (ret < 0)
9770 community_list_perror (vty, ret);
9771 return CMD_WARNING;
9774 return CMD_SUCCESS;
9777 /* "community-list" keyword help string. */
9778 #define COMMUNITY_LIST_STR "Add a community list entry\n"
9779 #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
9781 DEFUN (ip_community_list_standard,
9782 ip_community_list_standard_cmd,
9783 "ip community-list <1-99> (deny|permit) .AA:NN",
9784 IP_STR
9785 COMMUNITY_LIST_STR
9786 "Community list number (standard)\n"
9787 "Specify community to reject\n"
9788 "Specify community to accept\n"
9789 COMMUNITY_VAL_STR)
9791 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
9794 ALIAS (ip_community_list_standard,
9795 ip_community_list_standard2_cmd,
9796 "ip community-list <1-99> (deny|permit)",
9797 IP_STR
9798 COMMUNITY_LIST_STR
9799 "Community list number (standard)\n"
9800 "Specify community to reject\n"
9801 "Specify community to accept\n")
9803 DEFUN (ip_community_list_expanded,
9804 ip_community_list_expanded_cmd,
9805 "ip community-list <100-500> (deny|permit) .LINE",
9806 IP_STR
9807 COMMUNITY_LIST_STR
9808 "Community list number (expanded)\n"
9809 "Specify community to reject\n"
9810 "Specify community to accept\n"
9811 "An ordered list as a regular-expression\n")
9813 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
9816 DEFUN (ip_community_list_name_standard,
9817 ip_community_list_name_standard_cmd,
9818 "ip community-list standard WORD (deny|permit) .AA:NN",
9819 IP_STR
9820 COMMUNITY_LIST_STR
9821 "Add a standard community-list entry\n"
9822 "Community list name\n"
9823 "Specify community to reject\n"
9824 "Specify community to accept\n"
9825 COMMUNITY_VAL_STR)
9827 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
9830 ALIAS (ip_community_list_name_standard,
9831 ip_community_list_name_standard2_cmd,
9832 "ip community-list standard WORD (deny|permit)",
9833 IP_STR
9834 COMMUNITY_LIST_STR
9835 "Add a standard community-list entry\n"
9836 "Community list name\n"
9837 "Specify community to reject\n"
9838 "Specify community to accept\n")
9840 DEFUN (ip_community_list_name_expanded,
9841 ip_community_list_name_expanded_cmd,
9842 "ip community-list expanded WORD (deny|permit) .LINE",
9843 IP_STR
9844 COMMUNITY_LIST_STR
9845 "Add an expanded community-list entry\n"
9846 "Community list name\n"
9847 "Specify community to reject\n"
9848 "Specify community to accept\n"
9849 "An ordered list as a regular-expression\n")
9851 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
9854 DEFUN (no_ip_community_list_standard_all,
9855 no_ip_community_list_standard_all_cmd,
9856 "no ip community-list <1-99>",
9857 NO_STR
9858 IP_STR
9859 COMMUNITY_LIST_STR
9860 "Community list number (standard)\n")
9862 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
9865 DEFUN (no_ip_community_list_expanded_all,
9866 no_ip_community_list_expanded_all_cmd,
9867 "no ip community-list <100-500>",
9868 NO_STR
9869 IP_STR
9870 COMMUNITY_LIST_STR
9871 "Community list number (expanded)\n")
9873 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
9876 DEFUN (no_ip_community_list_name_standard_all,
9877 no_ip_community_list_name_standard_all_cmd,
9878 "no ip community-list standard WORD",
9879 NO_STR
9880 IP_STR
9881 COMMUNITY_LIST_STR
9882 "Add a standard community-list entry\n"
9883 "Community list name\n")
9885 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
9888 DEFUN (no_ip_community_list_name_expanded_all,
9889 no_ip_community_list_name_expanded_all_cmd,
9890 "no ip community-list expanded WORD",
9891 NO_STR
9892 IP_STR
9893 COMMUNITY_LIST_STR
9894 "Add an expanded community-list entry\n"
9895 "Community list name\n")
9897 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
9900 DEFUN (no_ip_community_list_standard,
9901 no_ip_community_list_standard_cmd,
9902 "no ip community-list <1-99> (deny|permit) .AA:NN",
9903 NO_STR
9904 IP_STR
9905 COMMUNITY_LIST_STR
9906 "Community list number (standard)\n"
9907 "Specify community to reject\n"
9908 "Specify community to accept\n"
9909 COMMUNITY_VAL_STR)
9911 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
9914 DEFUN (no_ip_community_list_expanded,
9915 no_ip_community_list_expanded_cmd,
9916 "no ip community-list <100-500> (deny|permit) .LINE",
9917 NO_STR
9918 IP_STR
9919 COMMUNITY_LIST_STR
9920 "Community list number (expanded)\n"
9921 "Specify community to reject\n"
9922 "Specify community to accept\n"
9923 "An ordered list as a regular-expression\n")
9925 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
9928 DEFUN (no_ip_community_list_name_standard,
9929 no_ip_community_list_name_standard_cmd,
9930 "no ip community-list standard WORD (deny|permit) .AA:NN",
9931 NO_STR
9932 IP_STR
9933 COMMUNITY_LIST_STR
9934 "Specify a standard community-list\n"
9935 "Community list name\n"
9936 "Specify community to reject\n"
9937 "Specify community to accept\n"
9938 COMMUNITY_VAL_STR)
9940 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
9943 DEFUN (no_ip_community_list_name_expanded,
9944 no_ip_community_list_name_expanded_cmd,
9945 "no ip community-list expanded WORD (deny|permit) .LINE",
9946 NO_STR
9947 IP_STR
9948 COMMUNITY_LIST_STR
9949 "Specify an expanded community-list\n"
9950 "Community list name\n"
9951 "Specify community to reject\n"
9952 "Specify community to accept\n"
9953 "An ordered list as a regular-expression\n")
9955 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
9958 static void
9959 community_list_show (struct vty *vty, struct community_list *list)
9961 struct community_entry *entry;
9963 for (entry = list->head; entry; entry = entry->next)
9965 if (entry == list->head)
9967 if (all_digit (list->name))
9968 vty_out (vty, "Community %s list %s%s",
9969 entry->style == COMMUNITY_LIST_STANDARD ?
9970 "standard" : "(expanded) access",
9971 list->name, VTY_NEWLINE);
9972 else
9973 vty_out (vty, "Named Community %s list %s%s",
9974 entry->style == COMMUNITY_LIST_STANDARD ?
9975 "standard" : "expanded",
9976 list->name, VTY_NEWLINE);
9978 if (entry->any)
9979 vty_out (vty, " %s%s",
9980 community_direct_str (entry->direct), VTY_NEWLINE);
9981 else
9982 vty_out (vty, " %s %s%s",
9983 community_direct_str (entry->direct),
9984 entry->style == COMMUNITY_LIST_STANDARD
9985 ? community_str (entry->u.com) : entry->config,
9986 VTY_NEWLINE);
9990 DEFUN (show_ip_community_list,
9991 show_ip_community_list_cmd,
9992 "show ip community-list",
9993 SHOW_STR
9994 IP_STR
9995 "List community-list\n")
9997 struct community_list *list;
9998 struct community_list_master *cm;
10000 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
10001 if (! cm)
10002 return CMD_SUCCESS;
10004 for (list = cm->num.head; list; list = list->next)
10005 community_list_show (vty, list);
10007 for (list = cm->str.head; list; list = list->next)
10008 community_list_show (vty, list);
10010 return CMD_SUCCESS;
10013 DEFUN (show_ip_community_list_arg,
10014 show_ip_community_list_arg_cmd,
10015 "show ip community-list (<1-500>|WORD)",
10016 SHOW_STR
10017 IP_STR
10018 "List community-list\n"
10019 "Community-list number\n"
10020 "Community-list name\n")
10022 struct community_list *list;
10024 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
10025 if (! list)
10027 vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE);
10028 return CMD_WARNING;
10031 community_list_show (vty, list);
10033 return CMD_SUCCESS;
10036 static int
10037 extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
10038 int style, int reject_all_digit_name)
10040 int ret;
10041 int direct;
10042 char *str;
10044 /* Check the list type. */
10045 if (strncmp (argv[1], "p", 1) == 0)
10046 direct = COMMUNITY_PERMIT;
10047 else if (strncmp (argv[1], "d", 1) == 0)
10048 direct = COMMUNITY_DENY;
10049 else
10051 vty_out (vty, "%% Matching condition must be permit or deny%s",
10052 VTY_NEWLINE);
10053 return CMD_WARNING;
10056 /* All digit name check. */
10057 if (reject_all_digit_name && all_digit (argv[0]))
10059 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10060 return CMD_WARNING;
10063 /* Concat community string argument. */
10064 if (argc > 1)
10065 str = argv_concat (argv, argc, 2);
10066 else
10067 str = NULL;
10069 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
10071 /* Free temporary community list string allocated by
10072 argv_concat(). */
10073 if (str)
10074 XFREE (MTYPE_TMP, str);
10076 if (ret < 0)
10078 community_list_perror (vty, ret);
10079 return CMD_WARNING;
10081 return CMD_SUCCESS;
10084 static int
10085 extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
10086 int style)
10088 int ret;
10089 int direct = 0;
10090 char *str = NULL;
10092 if (argc > 1)
10094 /* Check the list direct. */
10095 if (strncmp (argv[1], "p", 1) == 0)
10096 direct = COMMUNITY_PERMIT;
10097 else if (strncmp (argv[1], "d", 1) == 0)
10098 direct = COMMUNITY_DENY;
10099 else
10101 vty_out (vty, "%% Matching condition must be permit or deny%s",
10102 VTY_NEWLINE);
10103 return CMD_WARNING;
10106 /* Concat community string argument. */
10107 str = argv_concat (argv, argc, 2);
10110 /* Unset community list. */
10111 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
10113 /* Free temporary community list string allocated by
10114 argv_concat(). */
10115 if (str)
10116 XFREE (MTYPE_TMP, str);
10118 if (ret < 0)
10120 community_list_perror (vty, ret);
10121 return CMD_WARNING;
10124 return CMD_SUCCESS;
10127 /* "extcommunity-list" keyword help string. */
10128 #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
10129 #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
10131 DEFUN (ip_extcommunity_list_standard,
10132 ip_extcommunity_list_standard_cmd,
10133 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10134 IP_STR
10135 EXTCOMMUNITY_LIST_STR
10136 "Extended Community list number (standard)\n"
10137 "Specify community to reject\n"
10138 "Specify community to accept\n"
10139 EXTCOMMUNITY_VAL_STR)
10141 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
10144 ALIAS (ip_extcommunity_list_standard,
10145 ip_extcommunity_list_standard2_cmd,
10146 "ip extcommunity-list <1-99> (deny|permit)",
10147 IP_STR
10148 EXTCOMMUNITY_LIST_STR
10149 "Extended Community list number (standard)\n"
10150 "Specify community to reject\n"
10151 "Specify community to accept\n")
10153 DEFUN (ip_extcommunity_list_expanded,
10154 ip_extcommunity_list_expanded_cmd,
10155 "ip extcommunity-list <100-500> (deny|permit) .LINE",
10156 IP_STR
10157 EXTCOMMUNITY_LIST_STR
10158 "Extended Community list number (expanded)\n"
10159 "Specify community to reject\n"
10160 "Specify community to accept\n"
10161 "An ordered list as a regular-expression\n")
10163 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
10166 DEFUN (ip_extcommunity_list_name_standard,
10167 ip_extcommunity_list_name_standard_cmd,
10168 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10169 IP_STR
10170 EXTCOMMUNITY_LIST_STR
10171 "Specify standard extcommunity-list\n"
10172 "Extended Community list name\n"
10173 "Specify community to reject\n"
10174 "Specify community to accept\n"
10175 EXTCOMMUNITY_VAL_STR)
10177 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
10180 ALIAS (ip_extcommunity_list_name_standard,
10181 ip_extcommunity_list_name_standard2_cmd,
10182 "ip extcommunity-list standard WORD (deny|permit)",
10183 IP_STR
10184 EXTCOMMUNITY_LIST_STR
10185 "Specify standard extcommunity-list\n"
10186 "Extended Community list name\n"
10187 "Specify community to reject\n"
10188 "Specify community to accept\n")
10190 DEFUN (ip_extcommunity_list_name_expanded,
10191 ip_extcommunity_list_name_expanded_cmd,
10192 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
10193 IP_STR
10194 EXTCOMMUNITY_LIST_STR
10195 "Specify expanded extcommunity-list\n"
10196 "Extended Community list name\n"
10197 "Specify community to reject\n"
10198 "Specify community to accept\n"
10199 "An ordered list as a regular-expression\n")
10201 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
10204 DEFUN (no_ip_extcommunity_list_standard_all,
10205 no_ip_extcommunity_list_standard_all_cmd,
10206 "no ip extcommunity-list <1-99>",
10207 NO_STR
10208 IP_STR
10209 EXTCOMMUNITY_LIST_STR
10210 "Extended Community list number (standard)\n")
10212 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10215 DEFUN (no_ip_extcommunity_list_expanded_all,
10216 no_ip_extcommunity_list_expanded_all_cmd,
10217 "no ip extcommunity-list <100-500>",
10218 NO_STR
10219 IP_STR
10220 EXTCOMMUNITY_LIST_STR
10221 "Extended Community list number (expanded)\n")
10223 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10226 DEFUN (no_ip_extcommunity_list_name_standard_all,
10227 no_ip_extcommunity_list_name_standard_all_cmd,
10228 "no ip extcommunity-list standard WORD",
10229 NO_STR
10230 IP_STR
10231 EXTCOMMUNITY_LIST_STR
10232 "Specify standard extcommunity-list\n"
10233 "Extended Community list name\n")
10235 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10238 DEFUN (no_ip_extcommunity_list_name_expanded_all,
10239 no_ip_extcommunity_list_name_expanded_all_cmd,
10240 "no ip extcommunity-list expanded WORD",
10241 NO_STR
10242 IP_STR
10243 EXTCOMMUNITY_LIST_STR
10244 "Specify expanded extcommunity-list\n"
10245 "Extended Community list name\n")
10247 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10250 DEFUN (no_ip_extcommunity_list_standard,
10251 no_ip_extcommunity_list_standard_cmd,
10252 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10253 NO_STR
10254 IP_STR
10255 EXTCOMMUNITY_LIST_STR
10256 "Extended Community list number (standard)\n"
10257 "Specify community to reject\n"
10258 "Specify community to accept\n"
10259 EXTCOMMUNITY_VAL_STR)
10261 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10264 DEFUN (no_ip_extcommunity_list_expanded,
10265 no_ip_extcommunity_list_expanded_cmd,
10266 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
10267 NO_STR
10268 IP_STR
10269 EXTCOMMUNITY_LIST_STR
10270 "Extended Community list number (expanded)\n"
10271 "Specify community to reject\n"
10272 "Specify community to accept\n"
10273 "An ordered list as a regular-expression\n")
10275 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10278 DEFUN (no_ip_extcommunity_list_name_standard,
10279 no_ip_extcommunity_list_name_standard_cmd,
10280 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10281 NO_STR
10282 IP_STR
10283 EXTCOMMUNITY_LIST_STR
10284 "Specify standard extcommunity-list\n"
10285 "Extended Community list name\n"
10286 "Specify community to reject\n"
10287 "Specify community to accept\n"
10288 EXTCOMMUNITY_VAL_STR)
10290 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10293 DEFUN (no_ip_extcommunity_list_name_expanded,
10294 no_ip_extcommunity_list_name_expanded_cmd,
10295 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
10296 NO_STR
10297 IP_STR
10298 EXTCOMMUNITY_LIST_STR
10299 "Specify expanded extcommunity-list\n"
10300 "Community list name\n"
10301 "Specify community to reject\n"
10302 "Specify community to accept\n"
10303 "An ordered list as a regular-expression\n")
10305 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10308 static void
10309 extcommunity_list_show (struct vty *vty, struct community_list *list)
10311 struct community_entry *entry;
10313 for (entry = list->head; entry; entry = entry->next)
10315 if (entry == list->head)
10317 if (all_digit (list->name))
10318 vty_out (vty, "Extended community %s list %s%s",
10319 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10320 "standard" : "(expanded) access",
10321 list->name, VTY_NEWLINE);
10322 else
10323 vty_out (vty, "Named extended community %s list %s%s",
10324 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10325 "standard" : "expanded",
10326 list->name, VTY_NEWLINE);
10328 if (entry->any)
10329 vty_out (vty, " %s%s",
10330 community_direct_str (entry->direct), VTY_NEWLINE);
10331 else
10332 vty_out (vty, " %s %s%s",
10333 community_direct_str (entry->direct),
10334 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10335 entry->u.ecom->str : entry->config,
10336 VTY_NEWLINE);
10340 DEFUN (show_ip_extcommunity_list,
10341 show_ip_extcommunity_list_cmd,
10342 "show ip extcommunity-list",
10343 SHOW_STR
10344 IP_STR
10345 "List extended-community list\n")
10347 struct community_list *list;
10348 struct community_list_master *cm;
10350 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
10351 if (! cm)
10352 return CMD_SUCCESS;
10354 for (list = cm->num.head; list; list = list->next)
10355 extcommunity_list_show (vty, list);
10357 for (list = cm->str.head; list; list = list->next)
10358 extcommunity_list_show (vty, list);
10360 return CMD_SUCCESS;
10363 DEFUN (show_ip_extcommunity_list_arg,
10364 show_ip_extcommunity_list_arg_cmd,
10365 "show ip extcommunity-list (<1-500>|WORD)",
10366 SHOW_STR
10367 IP_STR
10368 "List extended-community list\n"
10369 "Extcommunity-list number\n"
10370 "Extcommunity-list name\n")
10372 struct community_list *list;
10374 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
10375 if (! list)
10377 vty_out (vty, "%% Can't find extcommunit-list%s", VTY_NEWLINE);
10378 return CMD_WARNING;
10381 extcommunity_list_show (vty, list);
10383 return CMD_SUCCESS;
10386 /* Return configuration string of community-list entry. */
10387 static const char *
10388 community_list_config_str (struct community_entry *entry)
10390 const char *str;
10392 if (entry->any)
10393 str = "";
10394 else
10396 if (entry->style == COMMUNITY_LIST_STANDARD)
10397 str = community_str (entry->u.com);
10398 else
10399 str = entry->config;
10401 return str;
10404 /* Display community-list and extcommunity-list configuration. */
10405 static int
10406 community_list_config_write (struct vty *vty)
10408 struct community_list *list;
10409 struct community_entry *entry;
10410 struct community_list_master *cm;
10411 int write = 0;
10413 /* Community-list. */
10414 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
10416 for (list = cm->num.head; list; list = list->next)
10417 for (entry = list->head; entry; entry = entry->next)
10419 vty_out (vty, "ip community-list %s %s %s%s",
10420 list->name, community_direct_str (entry->direct),
10421 community_list_config_str (entry),
10422 VTY_NEWLINE);
10423 write++;
10425 for (list = cm->str.head; list; list = list->next)
10426 for (entry = list->head; entry; entry = entry->next)
10428 vty_out (vty, "ip community-list %s %s %s %s%s",
10429 entry->style == COMMUNITY_LIST_STANDARD
10430 ? "standard" : "expanded",
10431 list->name, community_direct_str (entry->direct),
10432 community_list_config_str (entry),
10433 VTY_NEWLINE);
10434 write++;
10437 /* Extcommunity-list. */
10438 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
10440 for (list = cm->num.head; list; list = list->next)
10441 for (entry = list->head; entry; entry = entry->next)
10443 vty_out (vty, "ip extcommunity-list %s %s %s%s",
10444 list->name, community_direct_str (entry->direct),
10445 community_list_config_str (entry), VTY_NEWLINE);
10446 write++;
10448 for (list = cm->str.head; list; list = list->next)
10449 for (entry = list->head; entry; entry = entry->next)
10451 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
10452 entry->style == EXTCOMMUNITY_LIST_STANDARD
10453 ? "standard" : "expanded",
10454 list->name, community_direct_str (entry->direct),
10455 community_list_config_str (entry), VTY_NEWLINE);
10456 write++;
10458 return write;
10461 struct cmd_node community_list_node =
10463 COMMUNITY_LIST_NODE,
10465 1 /* Export to vtysh. */
10468 static void
10469 community_list_vty (void)
10471 install_node (&community_list_node, community_list_config_write);
10473 /* Community-list. */
10474 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
10475 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
10476 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
10477 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
10478 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
10479 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
10480 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
10481 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
10482 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
10483 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
10484 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
10485 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
10486 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
10487 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
10488 install_element (VIEW_NODE, &show_ip_community_list_cmd);
10489 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
10490 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
10491 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
10493 /* Extcommunity-list. */
10494 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
10495 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
10496 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
10497 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
10498 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
10499 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
10500 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
10501 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
10502 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
10503 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
10504 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
10505 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
10506 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
10507 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
10508 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
10509 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
10510 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
10511 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);