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