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