blob: 685ea28e6ced50cf31435bcc66e8228780036be9 [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{
paul25ffbdc2005-08-22 22:42:08 +000052 if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +000053 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;
paul25ffbdc2005-08-22 22:42:08 +000064 if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +000065 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
paul25ffbdc2005-08-22 22:42:08 +00003925DEFUN (address_family_ipv6,
3926 address_family_ipv6_cmd,
3927 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00003928 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00003929 "Address family\n")
paul718e3742002-12-13 20:15:29 +00003930{
3931 vty->node = BGP_IPV6_NODE;
3932 return CMD_SUCCESS;
3933}
3934
paul25ffbdc2005-08-22 22:42:08 +00003935DEFUN (address_family_ipv6_safi,
3936 address_family_ipv6_safi_cmd,
3937 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00003938 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00003939 "Address family\n"
3940 "Address Family modifier\n"
3941 "Address Family modifier\n")
3942{
3943 if (strncmp (argv[0], "m", 1) == 0)
3944 vty->node = BGP_IPV6M_NODE;
3945 else
3946 vty->node = BGP_IPV6_NODE;
3947
3948 return CMD_SUCCESS;
3949}
paul718e3742002-12-13 20:15:29 +00003950
3951DEFUN (address_family_vpnv4,
3952 address_family_vpnv4_cmd,
3953 "address-family vpnv4",
3954 "Enter Address Family command mode\n"
3955 "Address family\n")
3956{
3957 vty->node = BGP_VPNV4_NODE;
3958 return CMD_SUCCESS;
3959}
3960
3961ALIAS (address_family_vpnv4,
3962 address_family_vpnv4_unicast_cmd,
3963 "address-family vpnv4 unicast",
3964 "Enter Address Family command mode\n"
3965 "Address family\n"
3966 "Address Family Modifier\n")
3967
3968DEFUN (exit_address_family,
3969 exit_address_family_cmd,
3970 "exit-address-family",
3971 "Exit from Address Family configuration mode\n")
3972{
hassoa8a80d52005-04-09 13:07:47 +00003973 if (vty->node == BGP_IPV4_NODE
3974 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00003975 || vty->node == BGP_VPNV4_NODE
paul25ffbdc2005-08-22 22:42:08 +00003976 || vty->node == BGP_IPV6_NODE
3977 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00003978 vty->node = BGP_NODE;
3979 return CMD_SUCCESS;
3980}
3981
3982/* BGP clear sort. */
3983enum clear_sort
3984{
3985 clear_all,
3986 clear_peer,
3987 clear_group,
3988 clear_external,
3989 clear_as
3990};
3991
paul94f2b392005-06-28 12:44:16 +00003992static void
paul718e3742002-12-13 20:15:29 +00003993bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
3994 safi_t safi, int error)
3995{
3996 switch (error)
3997 {
3998 case BGP_ERR_AF_UNCONFIGURED:
3999 vty_out (vty,
4000 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4001 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4002 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4003 peer->host, VTY_NEWLINE);
4004 break;
4005 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4006 vty_out (vty, "%%BGP: Inbound soft reconfig for %s not possible as it%s has neither refresh capability, nor inbound soft reconfig%s", peer->host, VTY_NEWLINE, VTY_NEWLINE);
4007 break;
4008 default:
4009 break;
4010 }
4011}
4012
4013/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004014static int
paul718e3742002-12-13 20:15:29 +00004015bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004016 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004017{
4018 int ret;
4019 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004020 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004021
4022 /* Clear all neighbors. */
4023 if (sort == clear_all)
4024 {
paul1eb8ef22005-04-07 07:30:20 +00004025 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004026 {
4027 if (stype == BGP_CLEAR_SOFT_NONE)
4028 ret = peer_clear (peer);
4029 else
4030 ret = peer_clear_soft (peer, afi, safi, stype);
4031
4032 if (ret < 0)
4033 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4034 }
4035 return 0;
4036 }
4037
4038 /* Clear specified neighbors. */
4039 if (sort == clear_peer)
4040 {
4041 union sockunion su;
4042 int ret;
4043
4044 /* Make sockunion for lookup. */
4045 ret = str2sockunion (arg, &su);
4046 if (ret < 0)
4047 {
4048 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
4049 return -1;
4050 }
4051 peer = peer_lookup (bgp, &su);
4052 if (! peer)
4053 {
4054 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
4055 return -1;
4056 }
4057
4058 if (stype == BGP_CLEAR_SOFT_NONE)
4059 ret = peer_clear (peer);
4060 else
4061 ret = peer_clear_soft (peer, afi, safi, stype);
4062
4063 if (ret < 0)
4064 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4065
4066 return 0;
4067 }
4068
4069 /* Clear all peer-group members. */
4070 if (sort == clear_group)
4071 {
4072 struct peer_group *group;
4073
4074 group = peer_group_lookup (bgp, arg);
4075 if (! group)
4076 {
4077 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
4078 return -1;
4079 }
4080
paul1eb8ef22005-04-07 07:30:20 +00004081 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004082 {
4083 if (stype == BGP_CLEAR_SOFT_NONE)
4084 {
4085 ret = peer_clear (peer);
4086 continue;
4087 }
4088
4089 if (! peer->af_group[afi][safi])
4090 continue;
4091
4092 ret = peer_clear_soft (peer, afi, safi, stype);
4093
4094 if (ret < 0)
4095 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4096 }
4097 return 0;
4098 }
4099
4100 if (sort == clear_external)
4101 {
paul1eb8ef22005-04-07 07:30:20 +00004102 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004103 {
4104 if (peer_sort (peer) == BGP_PEER_IBGP)
4105 continue;
4106
4107 if (stype == BGP_CLEAR_SOFT_NONE)
4108 ret = peer_clear (peer);
4109 else
4110 ret = peer_clear_soft (peer, afi, safi, stype);
4111
4112 if (ret < 0)
4113 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4114 }
4115 return 0;
4116 }
4117
4118 if (sort == clear_as)
4119 {
4120 as_t as;
4121 unsigned long as_ul;
4122 char *endptr = NULL;
4123 int find = 0;
4124
4125 as_ul = strtoul(arg, &endptr, 10);
4126
4127 if ((as_ul == ULONG_MAX) || (*endptr != '\0') || (as_ul > USHRT_MAX))
4128 {
4129 vty_out (vty, "Invalid AS number%s", VTY_NEWLINE);
4130 return -1;
4131 }
4132 as = (as_t) as_ul;
4133
paul1eb8ef22005-04-07 07:30:20 +00004134 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004135 {
4136 if (peer->as != as)
4137 continue;
4138
4139 find = 1;
4140 if (stype == BGP_CLEAR_SOFT_NONE)
4141 ret = peer_clear (peer);
4142 else
4143 ret = peer_clear_soft (peer, afi, safi, stype);
4144
4145 if (ret < 0)
4146 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4147 }
4148 if (! find)
4149 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4150 VTY_NEWLINE);
4151 return 0;
4152 }
4153
4154 return 0;
4155}
4156
paul94f2b392005-06-28 12:44:16 +00004157static int
paulfd79ac92004-10-13 05:06:08 +00004158bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4159 enum clear_sort sort, enum bgp_clear_type stype,
4160 const char *arg)
paul718e3742002-12-13 20:15:29 +00004161{
4162 int ret;
4163 struct bgp *bgp;
4164
4165 /* BGP structure lookup. */
4166 if (name)
4167 {
4168 bgp = bgp_lookup_by_name (name);
4169 if (bgp == NULL)
4170 {
4171 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4172 return CMD_WARNING;
4173 }
4174 }
4175 else
4176 {
4177 bgp = bgp_get_default ();
4178 if (bgp == NULL)
4179 {
4180 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4181 return CMD_WARNING;
4182 }
4183 }
4184
4185 ret = bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
4186 if (ret < 0)
4187 return CMD_WARNING;
4188
4189 return CMD_SUCCESS;
4190}
4191
4192DEFUN (clear_ip_bgp_all,
4193 clear_ip_bgp_all_cmd,
4194 "clear ip bgp *",
4195 CLEAR_STR
4196 IP_STR
4197 BGP_STR
4198 "Clear all peers\n")
4199{
4200 if (argc == 1)
4201 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4202
4203 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4204}
4205
4206ALIAS (clear_ip_bgp_all,
4207 clear_bgp_all_cmd,
4208 "clear bgp *",
4209 CLEAR_STR
4210 BGP_STR
4211 "Clear all peers\n")
4212
4213ALIAS (clear_ip_bgp_all,
4214 clear_bgp_ipv6_all_cmd,
4215 "clear bgp ipv6 *",
4216 CLEAR_STR
4217 BGP_STR
4218 "Address family\n"
4219 "Clear all peers\n")
4220
4221ALIAS (clear_ip_bgp_all,
4222 clear_ip_bgp_instance_all_cmd,
4223 "clear ip bgp view WORD *",
4224 CLEAR_STR
4225 IP_STR
4226 BGP_STR
4227 "BGP view\n"
4228 "view name\n"
4229 "Clear all peers\n")
4230
4231ALIAS (clear_ip_bgp_all,
4232 clear_bgp_instance_all_cmd,
4233 "clear bgp view WORD *",
4234 CLEAR_STR
4235 BGP_STR
4236 "BGP view\n"
4237 "view name\n"
4238 "Clear all peers\n")
4239
4240DEFUN (clear_ip_bgp_peer,
4241 clear_ip_bgp_peer_cmd,
4242 "clear ip bgp (A.B.C.D|X:X::X:X)",
4243 CLEAR_STR
4244 IP_STR
4245 BGP_STR
4246 "BGP neighbor IP address to clear\n"
4247 "BGP IPv6 neighbor to clear\n")
4248{
4249 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4250}
4251
4252ALIAS (clear_ip_bgp_peer,
4253 clear_bgp_peer_cmd,
4254 "clear bgp (A.B.C.D|X:X::X:X)",
4255 CLEAR_STR
4256 BGP_STR
4257 "BGP neighbor address to clear\n"
4258 "BGP IPv6 neighbor to clear\n")
4259
4260ALIAS (clear_ip_bgp_peer,
4261 clear_bgp_ipv6_peer_cmd,
4262 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4263 CLEAR_STR
4264 BGP_STR
4265 "Address family\n"
4266 "BGP neighbor address to clear\n"
4267 "BGP IPv6 neighbor to clear\n")
4268
4269DEFUN (clear_ip_bgp_peer_group,
4270 clear_ip_bgp_peer_group_cmd,
4271 "clear ip bgp peer-group WORD",
4272 CLEAR_STR
4273 IP_STR
4274 BGP_STR
4275 "Clear all members of peer-group\n"
4276 "BGP peer-group name\n")
4277{
4278 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4279}
4280
4281ALIAS (clear_ip_bgp_peer_group,
4282 clear_bgp_peer_group_cmd,
4283 "clear bgp peer-group WORD",
4284 CLEAR_STR
4285 BGP_STR
4286 "Clear all members of peer-group\n"
4287 "BGP peer-group name\n")
4288
4289ALIAS (clear_ip_bgp_peer_group,
4290 clear_bgp_ipv6_peer_group_cmd,
4291 "clear bgp ipv6 peer-group WORD",
4292 CLEAR_STR
4293 BGP_STR
4294 "Address family\n"
4295 "Clear all members of peer-group\n"
4296 "BGP peer-group name\n")
4297
4298DEFUN (clear_ip_bgp_external,
4299 clear_ip_bgp_external_cmd,
4300 "clear ip bgp external",
4301 CLEAR_STR
4302 IP_STR
4303 BGP_STR
4304 "Clear all external peers\n")
4305{
4306 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4307}
4308
4309ALIAS (clear_ip_bgp_external,
4310 clear_bgp_external_cmd,
4311 "clear bgp external",
4312 CLEAR_STR
4313 BGP_STR
4314 "Clear all external peers\n")
4315
4316ALIAS (clear_ip_bgp_external,
4317 clear_bgp_ipv6_external_cmd,
4318 "clear bgp ipv6 external",
4319 CLEAR_STR
4320 BGP_STR
4321 "Address family\n"
4322 "Clear all external peers\n")
4323
4324DEFUN (clear_ip_bgp_as,
4325 clear_ip_bgp_as_cmd,
4326 "clear ip bgp <1-65535>",
4327 CLEAR_STR
4328 IP_STR
4329 BGP_STR
4330 "Clear peers with the AS number\n")
4331{
4332 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4333}
4334
4335ALIAS (clear_ip_bgp_as,
4336 clear_bgp_as_cmd,
4337 "clear bgp <1-65535>",
4338 CLEAR_STR
4339 BGP_STR
4340 "Clear peers with the AS number\n")
4341
4342ALIAS (clear_ip_bgp_as,
4343 clear_bgp_ipv6_as_cmd,
4344 "clear bgp ipv6 <1-65535>",
4345 CLEAR_STR
4346 BGP_STR
4347 "Address family\n"
4348 "Clear peers with the AS number\n")
4349
4350/* Outbound soft-reconfiguration */
4351DEFUN (clear_ip_bgp_all_soft_out,
4352 clear_ip_bgp_all_soft_out_cmd,
4353 "clear ip bgp * soft out",
4354 CLEAR_STR
4355 IP_STR
4356 BGP_STR
4357 "Clear all peers\n"
4358 "Soft reconfig\n"
4359 "Soft reconfig outbound update\n")
4360{
4361 if (argc == 1)
4362 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4363 BGP_CLEAR_SOFT_OUT, NULL);
4364
4365 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4366 BGP_CLEAR_SOFT_OUT, NULL);
4367}
4368
4369ALIAS (clear_ip_bgp_all_soft_out,
4370 clear_ip_bgp_all_out_cmd,
4371 "clear ip bgp * out",
4372 CLEAR_STR
4373 IP_STR
4374 BGP_STR
4375 "Clear all peers\n"
4376 "Soft reconfig outbound update\n")
4377
4378ALIAS (clear_ip_bgp_all_soft_out,
4379 clear_ip_bgp_instance_all_soft_out_cmd,
4380 "clear ip bgp view WORD * soft out",
4381 CLEAR_STR
4382 IP_STR
4383 BGP_STR
4384 "BGP view\n"
4385 "view name\n"
4386 "Clear all peers\n"
4387 "Soft reconfig\n"
4388 "Soft reconfig outbound update\n")
4389
4390DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4391 clear_ip_bgp_all_ipv4_soft_out_cmd,
4392 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4393 CLEAR_STR
4394 IP_STR
4395 BGP_STR
4396 "Clear all peers\n"
4397 "Address family\n"
4398 "Address Family modifier\n"
4399 "Address Family modifier\n"
4400 "Soft reconfig\n"
4401 "Soft reconfig outbound update\n")
4402{
4403 if (strncmp (argv[0], "m", 1) == 0)
4404 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4405 BGP_CLEAR_SOFT_OUT, NULL);
4406
4407 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4408 BGP_CLEAR_SOFT_OUT, NULL);
4409}
4410
4411ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4412 clear_ip_bgp_all_ipv4_out_cmd,
4413 "clear ip bgp * ipv4 (unicast|multicast) out",
4414 CLEAR_STR
4415 IP_STR
4416 BGP_STR
4417 "Clear all peers\n"
4418 "Address family\n"
4419 "Address Family modifier\n"
4420 "Address Family modifier\n"
4421 "Soft reconfig outbound update\n")
4422
4423DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4424 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4425 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4426 CLEAR_STR
4427 IP_STR
4428 BGP_STR
4429 "BGP view\n"
4430 "view name\n"
4431 "Clear all peers\n"
4432 "Address family\n"
4433 "Address Family modifier\n"
4434 "Address Family modifier\n"
4435 "Soft reconfig outbound update\n")
4436{
4437 if (strncmp (argv[1], "m", 1) == 0)
4438 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4439 BGP_CLEAR_SOFT_OUT, NULL);
4440
4441 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4442 BGP_CLEAR_SOFT_OUT, NULL);
4443}
4444
4445DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4446 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4447 "clear ip bgp * vpnv4 unicast soft out",
4448 CLEAR_STR
4449 IP_STR
4450 BGP_STR
4451 "Clear all peers\n"
4452 "Address family\n"
4453 "Address Family Modifier\n"
4454 "Soft reconfig\n"
4455 "Soft reconfig outbound update\n")
4456{
4457 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4458 BGP_CLEAR_SOFT_OUT, NULL);
4459}
4460
4461ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4462 clear_ip_bgp_all_vpnv4_out_cmd,
4463 "clear ip bgp * vpnv4 unicast out",
4464 CLEAR_STR
4465 IP_STR
4466 BGP_STR
4467 "Clear all peers\n"
4468 "Address family\n"
4469 "Address Family Modifier\n"
4470 "Soft reconfig outbound update\n")
4471
4472DEFUN (clear_bgp_all_soft_out,
4473 clear_bgp_all_soft_out_cmd,
4474 "clear bgp * soft out",
4475 CLEAR_STR
4476 BGP_STR
4477 "Clear all peers\n"
4478 "Soft reconfig\n"
4479 "Soft reconfig outbound update\n")
4480{
4481 if (argc == 1)
4482 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4483 BGP_CLEAR_SOFT_OUT, NULL);
4484
4485 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4486 BGP_CLEAR_SOFT_OUT, NULL);
4487}
4488
4489ALIAS (clear_bgp_all_soft_out,
4490 clear_bgp_instance_all_soft_out_cmd,
4491 "clear bgp view WORD * soft out",
4492 CLEAR_STR
4493 BGP_STR
4494 "BGP view\n"
4495 "view name\n"
4496 "Clear all peers\n"
4497 "Soft reconfig\n"
4498 "Soft reconfig outbound update\n")
4499
4500ALIAS (clear_bgp_all_soft_out,
4501 clear_bgp_all_out_cmd,
4502 "clear bgp * out",
4503 CLEAR_STR
4504 BGP_STR
4505 "Clear all peers\n"
4506 "Soft reconfig outbound update\n")
4507
4508ALIAS (clear_bgp_all_soft_out,
4509 clear_bgp_ipv6_all_soft_out_cmd,
4510 "clear bgp ipv6 * soft out",
4511 CLEAR_STR
4512 BGP_STR
4513 "Address family\n"
4514 "Clear all peers\n"
4515 "Soft reconfig\n"
4516 "Soft reconfig outbound update\n")
4517
4518ALIAS (clear_bgp_all_soft_out,
4519 clear_bgp_ipv6_all_out_cmd,
4520 "clear bgp ipv6 * out",
4521 CLEAR_STR
4522 BGP_STR
4523 "Address family\n"
4524 "Clear all peers\n"
4525 "Soft reconfig outbound update\n")
4526
4527DEFUN (clear_ip_bgp_peer_soft_out,
4528 clear_ip_bgp_peer_soft_out_cmd,
4529 "clear ip bgp A.B.C.D soft out",
4530 CLEAR_STR
4531 IP_STR
4532 BGP_STR
4533 "BGP neighbor address to clear\n"
4534 "Soft reconfig\n"
4535 "Soft reconfig outbound update\n")
4536{
4537 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4538 BGP_CLEAR_SOFT_OUT, argv[0]);
4539}
4540
4541ALIAS (clear_ip_bgp_peer_soft_out,
4542 clear_ip_bgp_peer_out_cmd,
4543 "clear ip bgp A.B.C.D out",
4544 CLEAR_STR
4545 IP_STR
4546 BGP_STR
4547 "BGP neighbor address to clear\n"
4548 "Soft reconfig outbound update\n")
4549
4550DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4551 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4552 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4553 CLEAR_STR
4554 IP_STR
4555 BGP_STR
4556 "BGP neighbor address to clear\n"
4557 "Address family\n"
4558 "Address Family modifier\n"
4559 "Address Family modifier\n"
4560 "Soft reconfig\n"
4561 "Soft reconfig outbound update\n")
4562{
4563 if (strncmp (argv[1], "m", 1) == 0)
4564 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4565 BGP_CLEAR_SOFT_OUT, argv[0]);
4566
4567 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4568 BGP_CLEAR_SOFT_OUT, argv[0]);
4569}
4570
4571ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
4572 clear_ip_bgp_peer_ipv4_out_cmd,
4573 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
4574 CLEAR_STR
4575 IP_STR
4576 BGP_STR
4577 "BGP neighbor address to clear\n"
4578 "Address family\n"
4579 "Address Family modifier\n"
4580 "Address Family modifier\n"
4581 "Soft reconfig outbound update\n")
4582
4583DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
4584 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
4585 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
4586 CLEAR_STR
4587 IP_STR
4588 BGP_STR
4589 "BGP neighbor address to clear\n"
4590 "Address family\n"
4591 "Address Family Modifier\n"
4592 "Soft reconfig\n"
4593 "Soft reconfig outbound update\n")
4594{
4595 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
4596 BGP_CLEAR_SOFT_OUT, argv[0]);
4597}
4598
4599ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
4600 clear_ip_bgp_peer_vpnv4_out_cmd,
4601 "clear ip bgp A.B.C.D vpnv4 unicast out",
4602 CLEAR_STR
4603 IP_STR
4604 BGP_STR
4605 "BGP neighbor address to clear\n"
4606 "Address family\n"
4607 "Address Family Modifier\n"
4608 "Soft reconfig outbound update\n")
4609
4610DEFUN (clear_bgp_peer_soft_out,
4611 clear_bgp_peer_soft_out_cmd,
4612 "clear bgp (A.B.C.D|X:X::X:X) soft out",
4613 CLEAR_STR
4614 BGP_STR
4615 "BGP neighbor address to clear\n"
4616 "BGP IPv6 neighbor to clear\n"
4617 "Soft reconfig\n"
4618 "Soft reconfig outbound update\n")
4619{
4620 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
4621 BGP_CLEAR_SOFT_OUT, argv[0]);
4622}
4623
4624ALIAS (clear_bgp_peer_soft_out,
4625 clear_bgp_ipv6_peer_soft_out_cmd,
4626 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
4627 CLEAR_STR
4628 BGP_STR
4629 "Address family\n"
4630 "BGP neighbor address to clear\n"
4631 "BGP IPv6 neighbor to clear\n"
4632 "Soft reconfig\n"
4633 "Soft reconfig outbound update\n")
4634
4635ALIAS (clear_bgp_peer_soft_out,
4636 clear_bgp_peer_out_cmd,
4637 "clear bgp (A.B.C.D|X:X::X:X) out",
4638 CLEAR_STR
4639 BGP_STR
4640 "BGP neighbor address to clear\n"
4641 "BGP IPv6 neighbor to clear\n"
4642 "Soft reconfig outbound update\n")
4643
4644ALIAS (clear_bgp_peer_soft_out,
4645 clear_bgp_ipv6_peer_out_cmd,
4646 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
4647 CLEAR_STR
4648 BGP_STR
4649 "Address family\n"
4650 "BGP neighbor address to clear\n"
4651 "BGP IPv6 neighbor to clear\n"
4652 "Soft reconfig outbound update\n")
4653
4654DEFUN (clear_ip_bgp_peer_group_soft_out,
4655 clear_ip_bgp_peer_group_soft_out_cmd,
4656 "clear ip bgp peer-group WORD soft out",
4657 CLEAR_STR
4658 IP_STR
4659 BGP_STR
4660 "Clear all members of peer-group\n"
4661 "BGP peer-group name\n"
4662 "Soft reconfig\n"
4663 "Soft reconfig outbound update\n")
4664{
4665 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4666 BGP_CLEAR_SOFT_OUT, argv[0]);
4667}
4668
4669ALIAS (clear_ip_bgp_peer_group_soft_out,
4670 clear_ip_bgp_peer_group_out_cmd,
4671 "clear ip bgp peer-group WORD out",
4672 CLEAR_STR
4673 IP_STR
4674 BGP_STR
4675 "Clear all members of peer-group\n"
4676 "BGP peer-group name\n"
4677 "Soft reconfig outbound update\n")
4678
4679DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
4680 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
4681 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
4682 CLEAR_STR
4683 IP_STR
4684 BGP_STR
4685 "Clear all members of peer-group\n"
4686 "BGP peer-group name\n"
4687 "Address family\n"
4688 "Address Family modifier\n"
4689 "Address Family modifier\n"
4690 "Soft reconfig\n"
4691 "Soft reconfig outbound update\n")
4692{
4693 if (strncmp (argv[1], "m", 1) == 0)
4694 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
4695 BGP_CLEAR_SOFT_OUT, argv[0]);
4696
4697 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4698 BGP_CLEAR_SOFT_OUT, argv[0]);
4699}
4700
4701ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
4702 clear_ip_bgp_peer_group_ipv4_out_cmd,
4703 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
4704 CLEAR_STR
4705 IP_STR
4706 BGP_STR
4707 "Clear all members of peer-group\n"
4708 "BGP peer-group name\n"
4709 "Address family\n"
4710 "Address Family modifier\n"
4711 "Address Family modifier\n"
4712 "Soft reconfig outbound update\n")
4713
4714DEFUN (clear_bgp_peer_group_soft_out,
4715 clear_bgp_peer_group_soft_out_cmd,
4716 "clear bgp peer-group WORD soft out",
4717 CLEAR_STR
4718 BGP_STR
4719 "Clear all members of peer-group\n"
4720 "BGP peer-group name\n"
4721 "Soft reconfig\n"
4722 "Soft reconfig outbound update\n")
4723{
4724 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
4725 BGP_CLEAR_SOFT_OUT, argv[0]);
4726}
4727
4728ALIAS (clear_bgp_peer_group_soft_out,
4729 clear_bgp_ipv6_peer_group_soft_out_cmd,
4730 "clear bgp ipv6 peer-group WORD soft out",
4731 CLEAR_STR
4732 BGP_STR
4733 "Address family\n"
4734 "Clear all members of peer-group\n"
4735 "BGP peer-group name\n"
4736 "Soft reconfig\n"
4737 "Soft reconfig outbound update\n")
4738
4739ALIAS (clear_bgp_peer_group_soft_out,
4740 clear_bgp_peer_group_out_cmd,
4741 "clear bgp peer-group WORD out",
4742 CLEAR_STR
4743 BGP_STR
4744 "Clear all members of peer-group\n"
4745 "BGP peer-group name\n"
4746 "Soft reconfig outbound update\n")
4747
4748ALIAS (clear_bgp_peer_group_soft_out,
4749 clear_bgp_ipv6_peer_group_out_cmd,
4750 "clear bgp ipv6 peer-group WORD out",
4751 CLEAR_STR
4752 BGP_STR
4753 "Address family\n"
4754 "Clear all members of peer-group\n"
4755 "BGP peer-group name\n"
4756 "Soft reconfig outbound update\n")
4757
4758DEFUN (clear_ip_bgp_external_soft_out,
4759 clear_ip_bgp_external_soft_out_cmd,
4760 "clear ip bgp external soft out",
4761 CLEAR_STR
4762 IP_STR
4763 BGP_STR
4764 "Clear all external peers\n"
4765 "Soft reconfig\n"
4766 "Soft reconfig outbound update\n")
4767{
4768 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
4769 BGP_CLEAR_SOFT_OUT, NULL);
4770}
4771
4772ALIAS (clear_ip_bgp_external_soft_out,
4773 clear_ip_bgp_external_out_cmd,
4774 "clear ip bgp external out",
4775 CLEAR_STR
4776 IP_STR
4777 BGP_STR
4778 "Clear all external peers\n"
4779 "Soft reconfig outbound update\n")
4780
4781DEFUN (clear_ip_bgp_external_ipv4_soft_out,
4782 clear_ip_bgp_external_ipv4_soft_out_cmd,
4783 "clear ip bgp external ipv4 (unicast|multicast) soft out",
4784 CLEAR_STR
4785 IP_STR
4786 BGP_STR
4787 "Clear all external peers\n"
4788 "Address family\n"
4789 "Address Family modifier\n"
4790 "Address Family modifier\n"
4791 "Soft reconfig\n"
4792 "Soft reconfig outbound update\n")
4793{
4794 if (strncmp (argv[0], "m", 1) == 0)
4795 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
4796 BGP_CLEAR_SOFT_OUT, NULL);
4797
4798 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
4799 BGP_CLEAR_SOFT_OUT, NULL);
4800}
4801
4802ALIAS (clear_ip_bgp_external_ipv4_soft_out,
4803 clear_ip_bgp_external_ipv4_out_cmd,
4804 "clear ip bgp external ipv4 (unicast|multicast) out",
4805 CLEAR_STR
4806 IP_STR
4807 BGP_STR
4808 "Clear all external peers\n"
4809 "Address family\n"
4810 "Address Family modifier\n"
4811 "Address Family modifier\n"
4812 "Soft reconfig outbound update\n")
4813
4814DEFUN (clear_bgp_external_soft_out,
4815 clear_bgp_external_soft_out_cmd,
4816 "clear bgp external soft out",
4817 CLEAR_STR
4818 BGP_STR
4819 "Clear all external peers\n"
4820 "Soft reconfig\n"
4821 "Soft reconfig outbound update\n")
4822{
4823 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
4824 BGP_CLEAR_SOFT_OUT, NULL);
4825}
4826
4827ALIAS (clear_bgp_external_soft_out,
4828 clear_bgp_ipv6_external_soft_out_cmd,
4829 "clear bgp ipv6 external soft out",
4830 CLEAR_STR
4831 BGP_STR
4832 "Address family\n"
4833 "Clear all external peers\n"
4834 "Soft reconfig\n"
4835 "Soft reconfig outbound update\n")
4836
4837ALIAS (clear_bgp_external_soft_out,
4838 clear_bgp_external_out_cmd,
4839 "clear bgp external out",
4840 CLEAR_STR
4841 BGP_STR
4842 "Clear all external peers\n"
4843 "Soft reconfig outbound update\n")
4844
4845ALIAS (clear_bgp_external_soft_out,
4846 clear_bgp_ipv6_external_out_cmd,
4847 "clear bgp ipv6 external WORD out",
4848 CLEAR_STR
4849 BGP_STR
4850 "Address family\n"
4851 "Clear all external peers\n"
4852 "Soft reconfig outbound update\n")
4853
4854DEFUN (clear_ip_bgp_as_soft_out,
4855 clear_ip_bgp_as_soft_out_cmd,
4856 "clear ip bgp <1-65535> soft out",
4857 CLEAR_STR
4858 IP_STR
4859 BGP_STR
4860 "Clear peers with the AS number\n"
4861 "Soft reconfig\n"
4862 "Soft reconfig outbound update\n")
4863{
4864 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
4865 BGP_CLEAR_SOFT_OUT, argv[0]);
4866}
4867
4868ALIAS (clear_ip_bgp_as_soft_out,
4869 clear_ip_bgp_as_out_cmd,
4870 "clear ip bgp <1-65535> out",
4871 CLEAR_STR
4872 IP_STR
4873 BGP_STR
4874 "Clear peers with the AS number\n"
4875 "Soft reconfig outbound update\n")
4876
4877DEFUN (clear_ip_bgp_as_ipv4_soft_out,
4878 clear_ip_bgp_as_ipv4_soft_out_cmd,
4879 "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft out",
4880 CLEAR_STR
4881 IP_STR
4882 BGP_STR
4883 "Clear peers with the AS number\n"
4884 "Address family\n"
4885 "Address Family modifier\n"
4886 "Address Family modifier\n"
4887 "Soft reconfig\n"
4888 "Soft reconfig outbound update\n")
4889{
4890 if (strncmp (argv[1], "m", 1) == 0)
4891 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
4892 BGP_CLEAR_SOFT_OUT, argv[0]);
4893
4894 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
4895 BGP_CLEAR_SOFT_OUT, argv[0]);
4896}
4897
4898ALIAS (clear_ip_bgp_as_ipv4_soft_out,
4899 clear_ip_bgp_as_ipv4_out_cmd,
4900 "clear ip bgp <1-65535> ipv4 (unicast|multicast) out",
4901 CLEAR_STR
4902 IP_STR
4903 BGP_STR
4904 "Clear peers with the AS number\n"
4905 "Address family\n"
4906 "Address Family modifier\n"
4907 "Address Family modifier\n"
4908 "Soft reconfig outbound update\n")
4909
4910DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
4911 clear_ip_bgp_as_vpnv4_soft_out_cmd,
4912 "clear ip bgp <1-65535> vpnv4 unicast soft out",
4913 CLEAR_STR
4914 IP_STR
4915 BGP_STR
4916 "Clear peers with the AS number\n"
4917 "Address family\n"
4918 "Address Family modifier\n"
4919 "Soft reconfig\n"
4920 "Soft reconfig outbound update\n")
4921{
4922 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
4923 BGP_CLEAR_SOFT_OUT, argv[0]);
4924}
4925
4926ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
4927 clear_ip_bgp_as_vpnv4_out_cmd,
4928 "clear ip bgp <1-65535> vpnv4 unicast out",
4929 CLEAR_STR
4930 IP_STR
4931 BGP_STR
4932 "Clear peers with the AS number\n"
4933 "Address family\n"
4934 "Address Family modifier\n"
4935 "Soft reconfig outbound update\n")
4936
4937DEFUN (clear_bgp_as_soft_out,
4938 clear_bgp_as_soft_out_cmd,
4939 "clear bgp <1-65535> soft out",
4940 CLEAR_STR
4941 BGP_STR
4942 "Clear peers with the AS number\n"
4943 "Soft reconfig\n"
4944 "Soft reconfig outbound update\n")
4945{
4946 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
4947 BGP_CLEAR_SOFT_OUT, argv[0]);
4948}
4949
4950ALIAS (clear_bgp_as_soft_out,
4951 clear_bgp_ipv6_as_soft_out_cmd,
4952 "clear bgp ipv6 <1-65535> soft out",
4953 CLEAR_STR
4954 BGP_STR
4955 "Address family\n"
4956 "Clear peers with the AS number\n"
4957 "Soft reconfig\n"
4958 "Soft reconfig outbound update\n")
4959
4960ALIAS (clear_bgp_as_soft_out,
4961 clear_bgp_as_out_cmd,
4962 "clear bgp <1-65535> out",
4963 CLEAR_STR
4964 BGP_STR
4965 "Clear peers with the AS number\n"
4966 "Soft reconfig outbound update\n")
4967
4968ALIAS (clear_bgp_as_soft_out,
4969 clear_bgp_ipv6_as_out_cmd,
4970 "clear bgp ipv6 <1-65535> out",
4971 CLEAR_STR
4972 BGP_STR
4973 "Address family\n"
4974 "Clear peers with the AS number\n"
4975 "Soft reconfig outbound update\n")
4976
4977/* Inbound soft-reconfiguration */
4978DEFUN (clear_ip_bgp_all_soft_in,
4979 clear_ip_bgp_all_soft_in_cmd,
4980 "clear ip bgp * soft in",
4981 CLEAR_STR
4982 IP_STR
4983 BGP_STR
4984 "Clear all peers\n"
4985 "Soft reconfig\n"
4986 "Soft reconfig inbound update\n")
4987{
4988 if (argc == 1)
4989 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4990 BGP_CLEAR_SOFT_IN, NULL);
4991
4992 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4993 BGP_CLEAR_SOFT_IN, NULL);
4994}
4995
4996ALIAS (clear_ip_bgp_all_soft_in,
4997 clear_ip_bgp_instance_all_soft_in_cmd,
4998 "clear ip bgp view WORD * soft in",
4999 CLEAR_STR
5000 IP_STR
5001 BGP_STR
5002 "BGP view\n"
5003 "view name\n"
5004 "Clear all peers\n"
5005 "Soft reconfig\n"
5006 "Soft reconfig inbound update\n")
5007
5008ALIAS (clear_ip_bgp_all_soft_in,
5009 clear_ip_bgp_all_in_cmd,
5010 "clear ip bgp * in",
5011 CLEAR_STR
5012 IP_STR
5013 BGP_STR
5014 "Clear all peers\n"
5015 "Soft reconfig inbound update\n")
5016
5017DEFUN (clear_ip_bgp_all_in_prefix_filter,
5018 clear_ip_bgp_all_in_prefix_filter_cmd,
5019 "clear ip bgp * in prefix-filter",
5020 CLEAR_STR
5021 IP_STR
5022 BGP_STR
5023 "Clear all peers\n"
5024 "Soft reconfig inbound update\n"
5025 "Push out prefix-list ORF and do inbound soft reconfig\n")
5026{
5027 if (argc== 1)
5028 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5029 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5030
5031 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5032 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5033}
5034
5035ALIAS (clear_ip_bgp_all_in_prefix_filter,
5036 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5037 "clear ip bgp view WORD * in prefix-filter",
5038 CLEAR_STR
5039 IP_STR
5040 BGP_STR
5041 "BGP view\n"
5042 "view name\n"
5043 "Clear all peers\n"
5044 "Soft reconfig inbound update\n"
5045 "Push out prefix-list ORF and do inbound soft reconfig\n")
5046
5047
5048DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5049 clear_ip_bgp_all_ipv4_soft_in_cmd,
5050 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5051 CLEAR_STR
5052 IP_STR
5053 BGP_STR
5054 "Clear all peers\n"
5055 "Address family\n"
5056 "Address Family modifier\n"
5057 "Address Family modifier\n"
5058 "Soft reconfig\n"
5059 "Soft reconfig inbound update\n")
5060{
5061 if (strncmp (argv[0], "m", 1) == 0)
5062 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5063 BGP_CLEAR_SOFT_IN, NULL);
5064
5065 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5066 BGP_CLEAR_SOFT_IN, NULL);
5067}
5068
5069ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5070 clear_ip_bgp_all_ipv4_in_cmd,
5071 "clear ip bgp * ipv4 (unicast|multicast) in",
5072 CLEAR_STR
5073 IP_STR
5074 BGP_STR
5075 "Clear all peers\n"
5076 "Address family\n"
5077 "Address Family modifier\n"
5078 "Address Family modifier\n"
5079 "Soft reconfig inbound update\n")
5080
5081DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5082 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5083 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5084 CLEAR_STR
5085 IP_STR
5086 BGP_STR
5087 "BGP view\n"
5088 "view name\n"
5089 "Clear all peers\n"
5090 "Address family\n"
5091 "Address Family modifier\n"
5092 "Address Family modifier\n"
5093 "Soft reconfig\n"
5094 "Soft reconfig inbound update\n")
5095{
5096 if (strncmp (argv[1], "m", 1) == 0)
5097 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5098 BGP_CLEAR_SOFT_IN, NULL);
5099
5100 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5101 BGP_CLEAR_SOFT_IN, NULL);
5102}
5103
5104DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5105 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5106 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5107 CLEAR_STR
5108 IP_STR
5109 BGP_STR
5110 "Clear all peers\n"
5111 "Address family\n"
5112 "Address Family modifier\n"
5113 "Address Family modifier\n"
5114 "Soft reconfig inbound update\n"
5115 "Push out prefix-list ORF and do inbound soft reconfig\n")
5116{
5117 if (strncmp (argv[0], "m", 1) == 0)
5118 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5119 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5120
5121 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5122 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5123}
5124
5125DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5126 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5127 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5128 CLEAR_STR
5129 IP_STR
5130 BGP_STR
5131 "Clear all peers\n"
5132 "Address family\n"
5133 "Address Family modifier\n"
5134 "Address Family modifier\n"
5135 "Soft reconfig inbound update\n"
5136 "Push out prefix-list ORF and do inbound soft reconfig\n")
5137{
5138 if (strncmp (argv[1], "m", 1) == 0)
5139 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5140 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5141
5142 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5143 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5144}
5145
5146DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5147 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5148 "clear ip bgp * vpnv4 unicast soft in",
5149 CLEAR_STR
5150 IP_STR
5151 BGP_STR
5152 "Clear all peers\n"
5153 "Address family\n"
5154 "Address Family Modifier\n"
5155 "Soft reconfig\n"
5156 "Soft reconfig inbound update\n")
5157{
5158 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5159 BGP_CLEAR_SOFT_IN, NULL);
5160}
5161
5162ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5163 clear_ip_bgp_all_vpnv4_in_cmd,
5164 "clear ip bgp * vpnv4 unicast in",
5165 CLEAR_STR
5166 IP_STR
5167 BGP_STR
5168 "Clear all peers\n"
5169 "Address family\n"
5170 "Address Family Modifier\n"
5171 "Soft reconfig inbound update\n")
5172
5173DEFUN (clear_bgp_all_soft_in,
5174 clear_bgp_all_soft_in_cmd,
5175 "clear bgp * soft in",
5176 CLEAR_STR
5177 BGP_STR
5178 "Clear all peers\n"
5179 "Soft reconfig\n"
5180 "Soft reconfig inbound update\n")
5181{
5182 if (argc == 1)
5183 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5184 BGP_CLEAR_SOFT_IN, NULL);
5185
5186 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5187 BGP_CLEAR_SOFT_IN, NULL);
5188}
5189
5190ALIAS (clear_bgp_all_soft_in,
5191 clear_bgp_instance_all_soft_in_cmd,
5192 "clear bgp view WORD * soft in",
5193 CLEAR_STR
5194 BGP_STR
5195 "BGP view\n"
5196 "view name\n"
5197 "Clear all peers\n"
5198 "Soft reconfig\n"
5199 "Soft reconfig inbound update\n")
5200
5201ALIAS (clear_bgp_all_soft_in,
5202 clear_bgp_ipv6_all_soft_in_cmd,
5203 "clear bgp ipv6 * soft in",
5204 CLEAR_STR
5205 BGP_STR
5206 "Address family\n"
5207 "Clear all peers\n"
5208 "Soft reconfig\n"
5209 "Soft reconfig inbound update\n")
5210
5211ALIAS (clear_bgp_all_soft_in,
5212 clear_bgp_all_in_cmd,
5213 "clear bgp * in",
5214 CLEAR_STR
5215 BGP_STR
5216 "Clear all peers\n"
5217 "Soft reconfig inbound update\n")
5218
5219ALIAS (clear_bgp_all_soft_in,
5220 clear_bgp_ipv6_all_in_cmd,
5221 "clear bgp ipv6 * in",
5222 CLEAR_STR
5223 BGP_STR
5224 "Address family\n"
5225 "Clear all peers\n"
5226 "Soft reconfig inbound update\n")
5227
5228DEFUN (clear_bgp_all_in_prefix_filter,
5229 clear_bgp_all_in_prefix_filter_cmd,
5230 "clear bgp * in prefix-filter",
5231 CLEAR_STR
5232 BGP_STR
5233 "Clear all peers\n"
5234 "Soft reconfig inbound update\n"
5235 "Push out prefix-list ORF and do inbound soft reconfig\n")
5236{
5237 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5238 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5239}
5240
5241ALIAS (clear_bgp_all_in_prefix_filter,
5242 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5243 "clear bgp ipv6 * in prefix-filter",
5244 CLEAR_STR
5245 BGP_STR
5246 "Address family\n"
5247 "Clear all peers\n"
5248 "Soft reconfig inbound update\n"
5249 "Push out prefix-list ORF and do inbound soft reconfig\n")
5250
5251DEFUN (clear_ip_bgp_peer_soft_in,
5252 clear_ip_bgp_peer_soft_in_cmd,
5253 "clear ip bgp A.B.C.D soft in",
5254 CLEAR_STR
5255 IP_STR
5256 BGP_STR
5257 "BGP neighbor address to clear\n"
5258 "Soft reconfig\n"
5259 "Soft reconfig inbound update\n")
5260{
5261 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5262 BGP_CLEAR_SOFT_IN, argv[0]);
5263}
5264
5265ALIAS (clear_ip_bgp_peer_soft_in,
5266 clear_ip_bgp_peer_in_cmd,
5267 "clear ip bgp A.B.C.D in",
5268 CLEAR_STR
5269 IP_STR
5270 BGP_STR
5271 "BGP neighbor address to clear\n"
5272 "Soft reconfig inbound update\n")
5273
5274DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5275 clear_ip_bgp_peer_in_prefix_filter_cmd,
5276 "clear ip bgp A.B.C.D in prefix-filter",
5277 CLEAR_STR
5278 IP_STR
5279 BGP_STR
5280 "BGP neighbor address to clear\n"
5281 "Soft reconfig inbound update\n"
5282 "Push out the existing ORF prefix-list\n")
5283{
5284 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5285 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5286}
5287
5288DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5289 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5290 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5291 CLEAR_STR
5292 IP_STR
5293 BGP_STR
5294 "BGP neighbor address to clear\n"
5295 "Address family\n"
5296 "Address Family modifier\n"
5297 "Address Family modifier\n"
5298 "Soft reconfig\n"
5299 "Soft reconfig inbound update\n")
5300{
5301 if (strncmp (argv[1], "m", 1) == 0)
5302 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5303 BGP_CLEAR_SOFT_IN, argv[0]);
5304
5305 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5306 BGP_CLEAR_SOFT_IN, argv[0]);
5307}
5308
5309ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5310 clear_ip_bgp_peer_ipv4_in_cmd,
5311 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5312 CLEAR_STR
5313 IP_STR
5314 BGP_STR
5315 "BGP neighbor address to clear\n"
5316 "Address family\n"
5317 "Address Family modifier\n"
5318 "Address Family modifier\n"
5319 "Soft reconfig inbound update\n")
5320
5321DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5322 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5323 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5324 CLEAR_STR
5325 IP_STR
5326 BGP_STR
5327 "BGP neighbor address to clear\n"
5328 "Address family\n"
5329 "Address Family modifier\n"
5330 "Address Family modifier\n"
5331 "Soft reconfig inbound update\n"
5332 "Push out the existing ORF prefix-list\n")
5333{
5334 if (strncmp (argv[1], "m", 1) == 0)
5335 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5336 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5337
5338 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5339 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5340}
5341
5342DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5343 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5344 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5345 CLEAR_STR
5346 IP_STR
5347 BGP_STR
5348 "BGP neighbor address to clear\n"
5349 "Address family\n"
5350 "Address Family Modifier\n"
5351 "Soft reconfig\n"
5352 "Soft reconfig inbound update\n")
5353{
5354 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5355 BGP_CLEAR_SOFT_IN, argv[0]);
5356}
5357
5358ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5359 clear_ip_bgp_peer_vpnv4_in_cmd,
5360 "clear ip bgp A.B.C.D vpnv4 unicast in",
5361 CLEAR_STR
5362 IP_STR
5363 BGP_STR
5364 "BGP neighbor address to clear\n"
5365 "Address family\n"
5366 "Address Family Modifier\n"
5367 "Soft reconfig inbound update\n")
5368
5369DEFUN (clear_bgp_peer_soft_in,
5370 clear_bgp_peer_soft_in_cmd,
5371 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5372 CLEAR_STR
5373 BGP_STR
5374 "BGP neighbor address to clear\n"
5375 "BGP IPv6 neighbor to clear\n"
5376 "Soft reconfig\n"
5377 "Soft reconfig inbound update\n")
5378{
5379 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5380 BGP_CLEAR_SOFT_IN, argv[0]);
5381}
5382
5383ALIAS (clear_bgp_peer_soft_in,
5384 clear_bgp_ipv6_peer_soft_in_cmd,
5385 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5386 CLEAR_STR
5387 BGP_STR
5388 "Address family\n"
5389 "BGP neighbor address to clear\n"
5390 "BGP IPv6 neighbor to clear\n"
5391 "Soft reconfig\n"
5392 "Soft reconfig inbound update\n")
5393
5394ALIAS (clear_bgp_peer_soft_in,
5395 clear_bgp_peer_in_cmd,
5396 "clear bgp (A.B.C.D|X:X::X:X) in",
5397 CLEAR_STR
5398 BGP_STR
5399 "BGP neighbor address to clear\n"
5400 "BGP IPv6 neighbor to clear\n"
5401 "Soft reconfig inbound update\n")
5402
5403ALIAS (clear_bgp_peer_soft_in,
5404 clear_bgp_ipv6_peer_in_cmd,
5405 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5406 CLEAR_STR
5407 BGP_STR
5408 "Address family\n"
5409 "BGP neighbor address to clear\n"
5410 "BGP IPv6 neighbor to clear\n"
5411 "Soft reconfig inbound update\n")
5412
5413DEFUN (clear_bgp_peer_in_prefix_filter,
5414 clear_bgp_peer_in_prefix_filter_cmd,
5415 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5416 CLEAR_STR
5417 BGP_STR
5418 "BGP neighbor address to clear\n"
5419 "BGP IPv6 neighbor to clear\n"
5420 "Soft reconfig inbound update\n"
5421 "Push out the existing ORF prefix-list\n")
5422{
5423 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5424 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5425}
5426
5427ALIAS (clear_bgp_peer_in_prefix_filter,
5428 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5429 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5430 CLEAR_STR
5431 BGP_STR
5432 "Address family\n"
5433 "BGP neighbor address to clear\n"
5434 "BGP IPv6 neighbor to clear\n"
5435 "Soft reconfig inbound update\n"
5436 "Push out the existing ORF prefix-list\n")
5437
5438DEFUN (clear_ip_bgp_peer_group_soft_in,
5439 clear_ip_bgp_peer_group_soft_in_cmd,
5440 "clear ip bgp peer-group WORD soft in",
5441 CLEAR_STR
5442 IP_STR
5443 BGP_STR
5444 "Clear all members of peer-group\n"
5445 "BGP peer-group name\n"
5446 "Soft reconfig\n"
5447 "Soft reconfig inbound update\n")
5448{
5449 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5450 BGP_CLEAR_SOFT_IN, argv[0]);
5451}
5452
5453ALIAS (clear_ip_bgp_peer_group_soft_in,
5454 clear_ip_bgp_peer_group_in_cmd,
5455 "clear ip bgp peer-group WORD in",
5456 CLEAR_STR
5457 IP_STR
5458 BGP_STR
5459 "Clear all members of peer-group\n"
5460 "BGP peer-group name\n"
5461 "Soft reconfig inbound update\n")
5462
5463DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
5464 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
5465 "clear ip bgp peer-group WORD in prefix-filter",
5466 CLEAR_STR
5467 IP_STR
5468 BGP_STR
5469 "Clear all members of peer-group\n"
5470 "BGP peer-group name\n"
5471 "Soft reconfig inbound update\n"
5472 "Push out prefix-list ORF and do inbound soft reconfig\n")
5473{
5474 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5475 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5476}
5477
5478DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
5479 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
5480 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
5481 CLEAR_STR
5482 IP_STR
5483 BGP_STR
5484 "Clear all members of peer-group\n"
5485 "BGP peer-group name\n"
5486 "Address family\n"
5487 "Address Family modifier\n"
5488 "Address Family modifier\n"
5489 "Soft reconfig\n"
5490 "Soft reconfig inbound update\n")
5491{
5492 if (strncmp (argv[1], "m", 1) == 0)
5493 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5494 BGP_CLEAR_SOFT_IN, argv[0]);
5495
5496 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5497 BGP_CLEAR_SOFT_IN, argv[0]);
5498}
5499
5500ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
5501 clear_ip_bgp_peer_group_ipv4_in_cmd,
5502 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
5503 CLEAR_STR
5504 IP_STR
5505 BGP_STR
5506 "Clear all members of peer-group\n"
5507 "BGP peer-group name\n"
5508 "Address family\n"
5509 "Address Family modifier\n"
5510 "Address Family modifier\n"
5511 "Soft reconfig inbound update\n")
5512
5513DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
5514 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
5515 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
5516 CLEAR_STR
5517 IP_STR
5518 BGP_STR
5519 "Clear all members of peer-group\n"
5520 "BGP peer-group name\n"
5521 "Address family\n"
5522 "Address Family modifier\n"
5523 "Address Family modifier\n"
5524 "Soft reconfig inbound update\n"
5525 "Push out prefix-list ORF and do inbound soft reconfig\n")
5526{
5527 if (strncmp (argv[1], "m", 1) == 0)
5528 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5529 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5530
5531 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5532 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5533}
5534
5535DEFUN (clear_bgp_peer_group_soft_in,
5536 clear_bgp_peer_group_soft_in_cmd,
5537 "clear bgp peer-group WORD soft in",
5538 CLEAR_STR
5539 BGP_STR
5540 "Clear all members of peer-group\n"
5541 "BGP peer-group name\n"
5542 "Soft reconfig\n"
5543 "Soft reconfig inbound update\n")
5544{
5545 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5546 BGP_CLEAR_SOFT_IN, argv[0]);
5547}
5548
5549ALIAS (clear_bgp_peer_group_soft_in,
5550 clear_bgp_ipv6_peer_group_soft_in_cmd,
5551 "clear bgp ipv6 peer-group WORD soft in",
5552 CLEAR_STR
5553 BGP_STR
5554 "Address family\n"
5555 "Clear all members of peer-group\n"
5556 "BGP peer-group name\n"
5557 "Soft reconfig\n"
5558 "Soft reconfig inbound update\n")
5559
5560ALIAS (clear_bgp_peer_group_soft_in,
5561 clear_bgp_peer_group_in_cmd,
5562 "clear bgp peer-group WORD in",
5563 CLEAR_STR
5564 BGP_STR
5565 "Clear all members of peer-group\n"
5566 "BGP peer-group name\n"
5567 "Soft reconfig inbound update\n")
5568
5569ALIAS (clear_bgp_peer_group_soft_in,
5570 clear_bgp_ipv6_peer_group_in_cmd,
5571 "clear bgp ipv6 peer-group WORD in",
5572 CLEAR_STR
5573 BGP_STR
5574 "Address family\n"
5575 "Clear all members of peer-group\n"
5576 "BGP peer-group name\n"
5577 "Soft reconfig inbound update\n")
5578
5579DEFUN (clear_bgp_peer_group_in_prefix_filter,
5580 clear_bgp_peer_group_in_prefix_filter_cmd,
5581 "clear bgp peer-group WORD in prefix-filter",
5582 CLEAR_STR
5583 BGP_STR
5584 "Clear all members of peer-group\n"
5585 "BGP peer-group name\n"
5586 "Soft reconfig inbound update\n"
5587 "Push out prefix-list ORF and do inbound soft reconfig\n")
5588{
5589 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5590 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5591}
5592
5593ALIAS (clear_bgp_peer_group_in_prefix_filter,
5594 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
5595 "clear bgp ipv6 peer-group WORD in prefix-filter",
5596 CLEAR_STR
5597 BGP_STR
5598 "Address family\n"
5599 "Clear all members of peer-group\n"
5600 "BGP peer-group name\n"
5601 "Soft reconfig inbound update\n"
5602 "Push out prefix-list ORF and do inbound soft reconfig\n")
5603
5604DEFUN (clear_ip_bgp_external_soft_in,
5605 clear_ip_bgp_external_soft_in_cmd,
5606 "clear ip bgp external soft in",
5607 CLEAR_STR
5608 IP_STR
5609 BGP_STR
5610 "Clear all external peers\n"
5611 "Soft reconfig\n"
5612 "Soft reconfig inbound update\n")
5613{
5614 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5615 BGP_CLEAR_SOFT_IN, NULL);
5616}
5617
5618ALIAS (clear_ip_bgp_external_soft_in,
5619 clear_ip_bgp_external_in_cmd,
5620 "clear ip bgp external in",
5621 CLEAR_STR
5622 IP_STR
5623 BGP_STR
5624 "Clear all external peers\n"
5625 "Soft reconfig inbound update\n")
5626
5627DEFUN (clear_ip_bgp_external_in_prefix_filter,
5628 clear_ip_bgp_external_in_prefix_filter_cmd,
5629 "clear ip bgp external in prefix-filter",
5630 CLEAR_STR
5631 IP_STR
5632 BGP_STR
5633 "Clear all external peers\n"
5634 "Soft reconfig inbound update\n"
5635 "Push out prefix-list ORF and do inbound soft reconfig\n")
5636{
5637 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5638 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5639}
5640
5641DEFUN (clear_ip_bgp_external_ipv4_soft_in,
5642 clear_ip_bgp_external_ipv4_soft_in_cmd,
5643 "clear ip bgp external ipv4 (unicast|multicast) soft in",
5644 CLEAR_STR
5645 IP_STR
5646 BGP_STR
5647 "Clear all external peers\n"
5648 "Address family\n"
5649 "Address Family modifier\n"
5650 "Address Family modifier\n"
5651 "Soft reconfig\n"
5652 "Soft reconfig inbound update\n")
5653{
5654 if (strncmp (argv[0], "m", 1) == 0)
5655 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5656 BGP_CLEAR_SOFT_IN, NULL);
5657
5658 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5659 BGP_CLEAR_SOFT_IN, NULL);
5660}
5661
5662ALIAS (clear_ip_bgp_external_ipv4_soft_in,
5663 clear_ip_bgp_external_ipv4_in_cmd,
5664 "clear ip bgp external ipv4 (unicast|multicast) in",
5665 CLEAR_STR
5666 IP_STR
5667 BGP_STR
5668 "Clear all external peers\n"
5669 "Address family\n"
5670 "Address Family modifier\n"
5671 "Address Family modifier\n"
5672 "Soft reconfig inbound update\n")
5673
5674DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
5675 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
5676 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
5677 CLEAR_STR
5678 IP_STR
5679 BGP_STR
5680 "Clear all external peers\n"
5681 "Address family\n"
5682 "Address Family modifier\n"
5683 "Address Family modifier\n"
5684 "Soft reconfig inbound update\n"
5685 "Push out prefix-list ORF and do inbound soft reconfig\n")
5686{
5687 if (strncmp (argv[0], "m", 1) == 0)
5688 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5689 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5690
5691 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5692 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5693}
5694
5695DEFUN (clear_bgp_external_soft_in,
5696 clear_bgp_external_soft_in_cmd,
5697 "clear bgp external soft in",
5698 CLEAR_STR
5699 BGP_STR
5700 "Clear all external peers\n"
5701 "Soft reconfig\n"
5702 "Soft reconfig inbound update\n")
5703{
5704 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5705 BGP_CLEAR_SOFT_IN, NULL);
5706}
5707
5708ALIAS (clear_bgp_external_soft_in,
5709 clear_bgp_ipv6_external_soft_in_cmd,
5710 "clear bgp ipv6 external soft in",
5711 CLEAR_STR
5712 BGP_STR
5713 "Address family\n"
5714 "Clear all external peers\n"
5715 "Soft reconfig\n"
5716 "Soft reconfig inbound update\n")
5717
5718ALIAS (clear_bgp_external_soft_in,
5719 clear_bgp_external_in_cmd,
5720 "clear bgp external in",
5721 CLEAR_STR
5722 BGP_STR
5723 "Clear all external peers\n"
5724 "Soft reconfig inbound update\n")
5725
5726ALIAS (clear_bgp_external_soft_in,
5727 clear_bgp_ipv6_external_in_cmd,
5728 "clear bgp ipv6 external WORD in",
5729 CLEAR_STR
5730 BGP_STR
5731 "Address family\n"
5732 "Clear all external peers\n"
5733 "Soft reconfig inbound update\n")
5734
5735DEFUN (clear_bgp_external_in_prefix_filter,
5736 clear_bgp_external_in_prefix_filter_cmd,
5737 "clear bgp external in prefix-filter",
5738 CLEAR_STR
5739 BGP_STR
5740 "Clear all external peers\n"
5741 "Soft reconfig inbound update\n"
5742 "Push out prefix-list ORF and do inbound soft reconfig\n")
5743{
5744 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5745 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5746}
5747
5748ALIAS (clear_bgp_external_in_prefix_filter,
5749 clear_bgp_ipv6_external_in_prefix_filter_cmd,
5750 "clear bgp ipv6 external in prefix-filter",
5751 CLEAR_STR
5752 BGP_STR
5753 "Address family\n"
5754 "Clear all external peers\n"
5755 "Soft reconfig inbound update\n"
5756 "Push out prefix-list ORF and do inbound soft reconfig\n")
5757
5758DEFUN (clear_ip_bgp_as_soft_in,
5759 clear_ip_bgp_as_soft_in_cmd,
5760 "clear ip bgp <1-65535> soft in",
5761 CLEAR_STR
5762 IP_STR
5763 BGP_STR
5764 "Clear peers with the AS number\n"
5765 "Soft reconfig\n"
5766 "Soft reconfig inbound update\n")
5767{
5768 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5769 BGP_CLEAR_SOFT_IN, argv[0]);
5770}
5771
5772ALIAS (clear_ip_bgp_as_soft_in,
5773 clear_ip_bgp_as_in_cmd,
5774 "clear ip bgp <1-65535> in",
5775 CLEAR_STR
5776 IP_STR
5777 BGP_STR
5778 "Clear peers with the AS number\n"
5779 "Soft reconfig inbound update\n")
5780
5781DEFUN (clear_ip_bgp_as_in_prefix_filter,
5782 clear_ip_bgp_as_in_prefix_filter_cmd,
5783 "clear ip bgp <1-65535> in prefix-filter",
5784 CLEAR_STR
5785 IP_STR
5786 BGP_STR
5787 "Clear peers with the AS number\n"
5788 "Soft reconfig inbound update\n"
5789 "Push out prefix-list ORF and do inbound soft reconfig\n")
5790{
5791 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5792 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5793}
5794
5795DEFUN (clear_ip_bgp_as_ipv4_soft_in,
5796 clear_ip_bgp_as_ipv4_soft_in_cmd,
5797 "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft in",
5798 CLEAR_STR
5799 IP_STR
5800 BGP_STR
5801 "Clear peers with the AS number\n"
5802 "Address family\n"
5803 "Address Family modifier\n"
5804 "Address Family modifier\n"
5805 "Soft reconfig\n"
5806 "Soft reconfig inbound update\n")
5807{
5808 if (strncmp (argv[1], "m", 1) == 0)
5809 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5810 BGP_CLEAR_SOFT_IN, argv[0]);
5811
5812 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5813 BGP_CLEAR_SOFT_IN, argv[0]);
5814}
5815
5816ALIAS (clear_ip_bgp_as_ipv4_soft_in,
5817 clear_ip_bgp_as_ipv4_in_cmd,
5818 "clear ip bgp <1-65535> ipv4 (unicast|multicast) in",
5819 CLEAR_STR
5820 IP_STR
5821 BGP_STR
5822 "Clear peers with the AS number\n"
5823 "Address family\n"
5824 "Address Family modifier\n"
5825 "Address Family modifier\n"
5826 "Soft reconfig inbound update\n")
5827
5828DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
5829 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
5830 "clear ip bgp <1-65535> ipv4 (unicast|multicast) in prefix-filter",
5831 CLEAR_STR
5832 IP_STR
5833 BGP_STR
5834 "Clear peers with the AS number\n"
5835 "Address family\n"
5836 "Address Family modifier\n"
5837 "Address Family modifier\n"
5838 "Soft reconfig inbound update\n"
5839 "Push out prefix-list ORF and do inbound soft reconfig\n")
5840{
5841 if (strncmp (argv[1], "m", 1) == 0)
5842 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5843 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5844
5845 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5846 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5847}
5848
5849DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
5850 clear_ip_bgp_as_vpnv4_soft_in_cmd,
5851 "clear ip bgp <1-65535> vpnv4 unicast soft in",
5852 CLEAR_STR
5853 IP_STR
5854 BGP_STR
5855 "Clear peers with the AS number\n"
5856 "Address family\n"
5857 "Address Family modifier\n"
5858 "Soft reconfig\n"
5859 "Soft reconfig inbound update\n")
5860{
5861 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5862 BGP_CLEAR_SOFT_IN, argv[0]);
5863}
5864
5865ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
5866 clear_ip_bgp_as_vpnv4_in_cmd,
5867 "clear ip bgp <1-65535> vpnv4 unicast in",
5868 CLEAR_STR
5869 IP_STR
5870 BGP_STR
5871 "Clear peers with the AS number\n"
5872 "Address family\n"
5873 "Address Family modifier\n"
5874 "Soft reconfig inbound update\n")
5875
5876DEFUN (clear_bgp_as_soft_in,
5877 clear_bgp_as_soft_in_cmd,
5878 "clear bgp <1-65535> soft in",
5879 CLEAR_STR
5880 BGP_STR
5881 "Clear peers with the AS number\n"
5882 "Soft reconfig\n"
5883 "Soft reconfig inbound update\n")
5884{
5885 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5886 BGP_CLEAR_SOFT_IN, argv[0]);
5887}
5888
5889ALIAS (clear_bgp_as_soft_in,
5890 clear_bgp_ipv6_as_soft_in_cmd,
5891 "clear bgp ipv6 <1-65535> soft in",
5892 CLEAR_STR
5893 BGP_STR
5894 "Address family\n"
5895 "Clear peers with the AS number\n"
5896 "Soft reconfig\n"
5897 "Soft reconfig inbound update\n")
5898
5899ALIAS (clear_bgp_as_soft_in,
5900 clear_bgp_as_in_cmd,
5901 "clear bgp <1-65535> in",
5902 CLEAR_STR
5903 BGP_STR
5904 "Clear peers with the AS number\n"
5905 "Soft reconfig inbound update\n")
5906
5907ALIAS (clear_bgp_as_soft_in,
5908 clear_bgp_ipv6_as_in_cmd,
5909 "clear bgp ipv6 <1-65535> in",
5910 CLEAR_STR
5911 BGP_STR
5912 "Address family\n"
5913 "Clear peers with the AS number\n"
5914 "Soft reconfig inbound update\n")
5915
5916DEFUN (clear_bgp_as_in_prefix_filter,
5917 clear_bgp_as_in_prefix_filter_cmd,
5918 "clear bgp <1-65535> in prefix-filter",
5919 CLEAR_STR
5920 BGP_STR
5921 "Clear peers with the AS number\n"
5922 "Soft reconfig inbound update\n"
5923 "Push out prefix-list ORF and do inbound soft reconfig\n")
5924{
5925 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5926 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5927}
5928
5929ALIAS (clear_bgp_as_in_prefix_filter,
5930 clear_bgp_ipv6_as_in_prefix_filter_cmd,
5931 "clear bgp ipv6 <1-65535> in prefix-filter",
5932 CLEAR_STR
5933 BGP_STR
5934 "Address family\n"
5935 "Clear peers with the AS number\n"
5936 "Soft reconfig inbound update\n"
5937 "Push out prefix-list ORF and do inbound soft reconfig\n")
5938
5939/* Both soft-reconfiguration */
5940DEFUN (clear_ip_bgp_all_soft,
5941 clear_ip_bgp_all_soft_cmd,
5942 "clear ip bgp * soft",
5943 CLEAR_STR
5944 IP_STR
5945 BGP_STR
5946 "Clear all peers\n"
5947 "Soft reconfig\n")
5948{
5949 if (argc == 1)
5950 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5951 BGP_CLEAR_SOFT_BOTH, NULL);
5952
5953 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5954 BGP_CLEAR_SOFT_BOTH, NULL);
5955}
5956
5957ALIAS (clear_ip_bgp_all_soft,
5958 clear_ip_bgp_instance_all_soft_cmd,
5959 "clear ip bgp view WORD * soft",
5960 CLEAR_STR
5961 IP_STR
5962 BGP_STR
5963 "BGP view\n"
5964 "view name\n"
5965 "Clear all peers\n"
5966 "Soft reconfig\n")
5967
5968
5969DEFUN (clear_ip_bgp_all_ipv4_soft,
5970 clear_ip_bgp_all_ipv4_soft_cmd,
5971 "clear ip bgp * ipv4 (unicast|multicast) soft",
5972 CLEAR_STR
5973 IP_STR
5974 BGP_STR
5975 "Clear all peers\n"
5976 "Address family\n"
5977 "Address Family Modifier\n"
5978 "Address Family Modifier\n"
5979 "Soft reconfig\n")
5980{
5981 if (strncmp (argv[0], "m", 1) == 0)
5982 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5983 BGP_CLEAR_SOFT_BOTH, NULL);
5984
5985 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5986 BGP_CLEAR_SOFT_BOTH, NULL);
5987}
5988
5989DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
5990 clear_ip_bgp_instance_all_ipv4_soft_cmd,
5991 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
5992 CLEAR_STR
5993 IP_STR
5994 BGP_STR
5995 "BGP view\n"
5996 "view name\n"
5997 "Clear all peers\n"
5998 "Address family\n"
5999 "Address Family Modifier\n"
6000 "Address Family Modifier\n"
6001 "Soft reconfig\n")
6002{
6003 if (strncmp (argv[1], "m", 1) == 0)
6004 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6005 BGP_CLEAR_SOFT_BOTH, NULL);
6006
6007 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6008 BGP_CLEAR_SOFT_BOTH, NULL);
6009}
6010
6011DEFUN (clear_ip_bgp_all_vpnv4_soft,
6012 clear_ip_bgp_all_vpnv4_soft_cmd,
6013 "clear ip bgp * vpnv4 unicast soft",
6014 CLEAR_STR
6015 IP_STR
6016 BGP_STR
6017 "Clear all peers\n"
6018 "Address family\n"
6019 "Address Family Modifier\n"
6020 "Soft reconfig\n")
6021{
6022 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6023 BGP_CLEAR_SOFT_BOTH, argv[0]);
6024}
6025
6026DEFUN (clear_bgp_all_soft,
6027 clear_bgp_all_soft_cmd,
6028 "clear bgp * soft",
6029 CLEAR_STR
6030 BGP_STR
6031 "Clear all peers\n"
6032 "Soft reconfig\n")
6033{
6034 if (argc == 1)
6035 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6036 BGP_CLEAR_SOFT_BOTH, argv[0]);
6037
6038 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6039 BGP_CLEAR_SOFT_BOTH, argv[0]);
6040}
6041
6042ALIAS (clear_bgp_all_soft,
6043 clear_bgp_instance_all_soft_cmd,
6044 "clear bgp view WORD * soft",
6045 CLEAR_STR
6046 BGP_STR
6047 "BGP view\n"
6048 "view name\n"
6049 "Clear all peers\n"
6050 "Soft reconfig\n")
6051
6052ALIAS (clear_bgp_all_soft,
6053 clear_bgp_ipv6_all_soft_cmd,
6054 "clear bgp ipv6 * soft",
6055 CLEAR_STR
6056 BGP_STR
6057 "Address family\n"
6058 "Clear all peers\n"
6059 "Soft reconfig\n")
6060
6061DEFUN (clear_ip_bgp_peer_soft,
6062 clear_ip_bgp_peer_soft_cmd,
6063 "clear ip bgp A.B.C.D soft",
6064 CLEAR_STR
6065 IP_STR
6066 BGP_STR
6067 "BGP neighbor address to clear\n"
6068 "Soft reconfig\n")
6069{
6070 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6071 BGP_CLEAR_SOFT_BOTH, argv[0]);
6072}
6073
6074DEFUN (clear_ip_bgp_peer_ipv4_soft,
6075 clear_ip_bgp_peer_ipv4_soft_cmd,
6076 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6077 CLEAR_STR
6078 IP_STR
6079 BGP_STR
6080 "BGP neighbor address to clear\n"
6081 "Address family\n"
6082 "Address Family Modifier\n"
6083 "Address Family Modifier\n"
6084 "Soft reconfig\n")
6085{
6086 if (strncmp (argv[1], "m", 1) == 0)
6087 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6088 BGP_CLEAR_SOFT_BOTH, argv[0]);
6089
6090 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6091 BGP_CLEAR_SOFT_BOTH, argv[0]);
6092}
6093
6094DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6095 clear_ip_bgp_peer_vpnv4_soft_cmd,
6096 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6097 CLEAR_STR
6098 IP_STR
6099 BGP_STR
6100 "BGP neighbor address to clear\n"
6101 "Address family\n"
6102 "Address Family Modifier\n"
6103 "Soft reconfig\n")
6104{
6105 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6106 BGP_CLEAR_SOFT_BOTH, argv[0]);
6107}
6108
6109DEFUN (clear_bgp_peer_soft,
6110 clear_bgp_peer_soft_cmd,
6111 "clear bgp (A.B.C.D|X:X::X:X) soft",
6112 CLEAR_STR
6113 BGP_STR
6114 "BGP neighbor address to clear\n"
6115 "BGP IPv6 neighbor to clear\n"
6116 "Soft reconfig\n")
6117{
6118 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6119 BGP_CLEAR_SOFT_BOTH, argv[0]);
6120}
6121
6122ALIAS (clear_bgp_peer_soft,
6123 clear_bgp_ipv6_peer_soft_cmd,
6124 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6125 CLEAR_STR
6126 BGP_STR
6127 "Address family\n"
6128 "BGP neighbor address to clear\n"
6129 "BGP IPv6 neighbor to clear\n"
6130 "Soft reconfig\n")
6131
6132DEFUN (clear_ip_bgp_peer_group_soft,
6133 clear_ip_bgp_peer_group_soft_cmd,
6134 "clear ip bgp peer-group WORD soft",
6135 CLEAR_STR
6136 IP_STR
6137 BGP_STR
6138 "Clear all members of peer-group\n"
6139 "BGP peer-group name\n"
6140 "Soft reconfig\n")
6141{
6142 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6143 BGP_CLEAR_SOFT_BOTH, argv[0]);
6144}
6145
6146DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6147 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6148 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6149 CLEAR_STR
6150 IP_STR
6151 BGP_STR
6152 "Clear all members of peer-group\n"
6153 "BGP peer-group name\n"
6154 "Address family\n"
6155 "Address Family modifier\n"
6156 "Address Family modifier\n"
6157 "Soft reconfig\n")
6158{
6159 if (strncmp (argv[1], "m", 1) == 0)
6160 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6161 BGP_CLEAR_SOFT_BOTH, argv[0]);
6162
6163 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6164 BGP_CLEAR_SOFT_BOTH, argv[0]);
6165}
6166
6167DEFUN (clear_bgp_peer_group_soft,
6168 clear_bgp_peer_group_soft_cmd,
6169 "clear bgp peer-group WORD soft",
6170 CLEAR_STR
6171 BGP_STR
6172 "Clear all members of peer-group\n"
6173 "BGP peer-group name\n"
6174 "Soft reconfig\n")
6175{
6176 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6177 BGP_CLEAR_SOFT_BOTH, argv[0]);
6178}
6179
6180ALIAS (clear_bgp_peer_group_soft,
6181 clear_bgp_ipv6_peer_group_soft_cmd,
6182 "clear bgp ipv6 peer-group WORD soft",
6183 CLEAR_STR
6184 BGP_STR
6185 "Address family\n"
6186 "Clear all members of peer-group\n"
6187 "BGP peer-group name\n"
6188 "Soft reconfig\n")
6189
6190DEFUN (clear_ip_bgp_external_soft,
6191 clear_ip_bgp_external_soft_cmd,
6192 "clear ip bgp external soft",
6193 CLEAR_STR
6194 IP_STR
6195 BGP_STR
6196 "Clear all external peers\n"
6197 "Soft reconfig\n")
6198{
6199 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6200 BGP_CLEAR_SOFT_BOTH, NULL);
6201}
6202
6203DEFUN (clear_ip_bgp_external_ipv4_soft,
6204 clear_ip_bgp_external_ipv4_soft_cmd,
6205 "clear ip bgp external ipv4 (unicast|multicast) soft",
6206 CLEAR_STR
6207 IP_STR
6208 BGP_STR
6209 "Clear all external peers\n"
6210 "Address family\n"
6211 "Address Family modifier\n"
6212 "Address Family modifier\n"
6213 "Soft reconfig\n")
6214{
6215 if (strncmp (argv[0], "m", 1) == 0)
6216 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6217 BGP_CLEAR_SOFT_BOTH, NULL);
6218
6219 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6220 BGP_CLEAR_SOFT_BOTH, NULL);
6221}
6222
6223DEFUN (clear_bgp_external_soft,
6224 clear_bgp_external_soft_cmd,
6225 "clear bgp external soft",
6226 CLEAR_STR
6227 BGP_STR
6228 "Clear all external peers\n"
6229 "Soft reconfig\n")
6230{
6231 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6232 BGP_CLEAR_SOFT_BOTH, NULL);
6233}
6234
6235ALIAS (clear_bgp_external_soft,
6236 clear_bgp_ipv6_external_soft_cmd,
6237 "clear bgp ipv6 external soft",
6238 CLEAR_STR
6239 BGP_STR
6240 "Address family\n"
6241 "Clear all external peers\n"
6242 "Soft reconfig\n")
6243
6244DEFUN (clear_ip_bgp_as_soft,
6245 clear_ip_bgp_as_soft_cmd,
6246 "clear ip bgp <1-65535> soft",
6247 CLEAR_STR
6248 IP_STR
6249 BGP_STR
6250 "Clear peers with the AS number\n"
6251 "Soft reconfig\n")
6252{
6253 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6254 BGP_CLEAR_SOFT_BOTH, argv[0]);
6255}
6256
6257DEFUN (clear_ip_bgp_as_ipv4_soft,
6258 clear_ip_bgp_as_ipv4_soft_cmd,
6259 "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft",
6260 CLEAR_STR
6261 IP_STR
6262 BGP_STR
6263 "Clear peers with the AS number\n"
6264 "Address family\n"
6265 "Address Family Modifier\n"
6266 "Address Family Modifier\n"
6267 "Soft reconfig\n")
6268{
6269 if (strncmp (argv[1], "m", 1) == 0)
6270 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6271 BGP_CLEAR_SOFT_BOTH, argv[0]);
6272
6273 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6274 BGP_CLEAR_SOFT_BOTH, argv[0]);
6275}
6276
6277DEFUN (clear_ip_bgp_as_vpnv4_soft,
6278 clear_ip_bgp_as_vpnv4_soft_cmd,
6279 "clear ip bgp <1-65535> vpnv4 unicast soft",
6280 CLEAR_STR
6281 IP_STR
6282 BGP_STR
6283 "Clear peers with the AS number\n"
6284 "Address family\n"
6285 "Address Family Modifier\n"
6286 "Soft reconfig\n")
6287{
6288 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6289 BGP_CLEAR_SOFT_BOTH, argv[0]);
6290}
6291
6292DEFUN (clear_bgp_as_soft,
6293 clear_bgp_as_soft_cmd,
6294 "clear bgp <1-65535> soft",
6295 CLEAR_STR
6296 BGP_STR
6297 "Clear peers with the AS number\n"
6298 "Soft reconfig\n")
6299{
6300 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6301 BGP_CLEAR_SOFT_BOTH, argv[0]);
6302}
6303
6304ALIAS (clear_bgp_as_soft,
6305 clear_bgp_ipv6_as_soft_cmd,
6306 "clear bgp ipv6 <1-65535> soft",
6307 CLEAR_STR
6308 BGP_STR
6309 "Address family\n"
6310 "Clear peers with the AS number\n"
6311 "Soft reconfig\n")
6312
paulfee0f4c2004-09-13 05:12:46 +00006313/* RS-client soft reconfiguration. */
6314#ifdef HAVE_IPV6
6315DEFUN (clear_bgp_all_rsclient,
6316 clear_bgp_all_rsclient_cmd,
6317 "clear bgp * rsclient",
6318 CLEAR_STR
6319 BGP_STR
6320 "Clear all peers\n"
6321 "Soft reconfig for rsclient RIB\n")
6322{
6323 if (argc == 1)
6324 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6325 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6326
6327 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6328 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6329}
6330
6331ALIAS (clear_bgp_all_rsclient,
6332 clear_bgp_ipv6_all_rsclient_cmd,
6333 "clear bgp ipv6 * rsclient",
6334 CLEAR_STR
6335 BGP_STR
6336 "Address family\n"
6337 "Clear all peers\n"
6338 "Soft reconfig for rsclient RIB\n")
6339
6340ALIAS (clear_bgp_all_rsclient,
6341 clear_bgp_instance_all_rsclient_cmd,
6342 "clear bgp view WORD * rsclient",
6343 CLEAR_STR
6344 BGP_STR
6345 "BGP view\n"
6346 "view name\n"
6347 "Clear all peers\n"
6348 "Soft reconfig for rsclient RIB\n")
6349
6350ALIAS (clear_bgp_all_rsclient,
6351 clear_bgp_ipv6_instance_all_rsclient_cmd,
6352 "clear bgp ipv6 view WORD * rsclient",
6353 CLEAR_STR
6354 BGP_STR
6355 "Address family\n"
6356 "BGP view\n"
6357 "view name\n"
6358 "Clear all peers\n"
6359 "Soft reconfig for rsclient RIB\n")
6360#endif /* HAVE_IPV6 */
6361
6362DEFUN (clear_ip_bgp_all_rsclient,
6363 clear_ip_bgp_all_rsclient_cmd,
6364 "clear ip bgp * rsclient",
6365 CLEAR_STR
6366 IP_STR
6367 BGP_STR
6368 "Clear all peers\n"
6369 "Soft reconfig for rsclient RIB\n")
6370{
6371 if (argc == 1)
6372 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6373 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6374
6375 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6376 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6377}
6378
6379ALIAS (clear_ip_bgp_all_rsclient,
6380 clear_ip_bgp_instance_all_rsclient_cmd,
6381 "clear ip bgp view WORD * rsclient",
6382 CLEAR_STR
6383 IP_STR
6384 BGP_STR
6385 "BGP view\n"
6386 "view name\n"
6387 "Clear all peers\n"
6388 "Soft reconfig for rsclient RIB\n")
6389
6390#ifdef HAVE_IPV6
6391DEFUN (clear_bgp_peer_rsclient,
6392 clear_bgp_peer_rsclient_cmd,
6393 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
6394 CLEAR_STR
6395 BGP_STR
6396 "BGP neighbor IP address to clear\n"
6397 "BGP IPv6 neighbor to clear\n"
6398 "Soft reconfig for rsclient RIB\n")
6399{
6400 if (argc == 2)
6401 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
6402 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6403
6404 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6405 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6406}
6407
6408ALIAS (clear_bgp_peer_rsclient,
6409 clear_bgp_ipv6_peer_rsclient_cmd,
6410 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
6411 CLEAR_STR
6412 BGP_STR
6413 "Address family\n"
6414 "BGP neighbor IP address to clear\n"
6415 "BGP IPv6 neighbor to clear\n"
6416 "Soft reconfig for rsclient RIB\n")
6417
6418ALIAS (clear_bgp_peer_rsclient,
6419 clear_bgp_instance_peer_rsclient_cmd,
6420 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6421 CLEAR_STR
6422 BGP_STR
6423 "BGP view\n"
6424 "view name\n"
6425 "BGP neighbor IP address to clear\n"
6426 "BGP IPv6 neighbor to clear\n"
6427 "Soft reconfig for rsclient RIB\n")
6428
6429ALIAS (clear_bgp_peer_rsclient,
6430 clear_bgp_ipv6_instance_peer_rsclient_cmd,
6431 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
6432 CLEAR_STR
6433 BGP_STR
6434 "Address family\n"
6435 "BGP view\n"
6436 "view name\n"
6437 "BGP neighbor IP address to clear\n"
6438 "BGP IPv6 neighbor to clear\n"
6439 "Soft reconfig for rsclient RIB\n")
6440#endif /* HAVE_IPV6 */
6441
6442DEFUN (clear_ip_bgp_peer_rsclient,
6443 clear_ip_bgp_peer_rsclient_cmd,
6444 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
6445 CLEAR_STR
6446 IP_STR
6447 BGP_STR
6448 "BGP neighbor IP address to clear\n"
6449 "BGP IPv6 neighbor to clear\n"
6450 "Soft reconfig for rsclient RIB\n")
6451{
6452 if (argc == 2)
6453 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
6454 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6455
6456 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6457 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6458}
6459
6460ALIAS (clear_ip_bgp_peer_rsclient,
6461 clear_ip_bgp_instance_peer_rsclient_cmd,
6462 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6463 CLEAR_STR
6464 IP_STR
6465 BGP_STR
6466 "BGP view\n"
6467 "view name\n"
6468 "BGP neighbor IP address to clear\n"
6469 "BGP IPv6 neighbor to clear\n"
6470 "Soft reconfig for rsclient RIB\n")
6471
6472
paul718e3742002-12-13 20:15:29 +00006473/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00006474static int
paul718e3742002-12-13 20:15:29 +00006475bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
6476{
6477 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00006478 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00006479 int count = 0;
6480 char timebuf[BGP_UPTIME_LEN];
6481 int len;
6482
6483 /* Header string for each address family. */
6484 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
6485
paul1eb8ef22005-04-07 07:30:20 +00006486 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00006487 {
6488 if (peer->afc[afi][safi])
6489 {
6490 if (! count)
6491 {
6492 vty_out (vty,
6493 "BGP router identifier %s, local AS number %d%s",
6494 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
6495 vty_out (vty,
6496 "%ld BGP AS-PATH entries%s", aspath_count (),
6497 VTY_NEWLINE);
6498 vty_out (vty,
6499 "%ld BGP community entries%s", community_count (),
6500 VTY_NEWLINE);
6501
6502 if (CHECK_FLAG(bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
6503 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
6504 vty_out (vty, "%s", VTY_NEWLINE);
6505 vty_out (vty, "%s%s", header, VTY_NEWLINE);
6506 }
6507 count++;
6508
6509 len = vty_out (vty, "%s", peer->host);
6510 len = 16 - len;
6511 if (len < 1)
6512 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
6513 else
6514 vty_out (vty, "%*s", len, " ");
6515
hasso3d515fd2005-02-01 21:30:04 +00006516 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00006517
6518 vty_out (vty, "%5d %7d %7d %8d %4d %4ld ",
6519 peer->as,
6520 peer->open_in + peer->update_in + peer->keepalive_in
6521 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
6522 peer->open_out + peer->update_out + peer->keepalive_out
6523 + peer->notify_out + peer->refresh_out
6524 + peer->dynamic_cap_out,
6525 0, 0, peer->obuf->count);
6526
6527 vty_out (vty, "%8s",
6528 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
6529
6530 if (peer->status == Established)
6531 {
6532 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
6533 }
6534 else
6535 {
6536 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
6537 vty_out (vty, " Idle (Admin)");
6538 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
6539 vty_out (vty, " Idle (PfxCt)");
6540 else
6541 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
6542 }
6543
6544 vty_out (vty, "%s", VTY_NEWLINE);
6545 }
6546 }
6547
6548 if (count)
6549 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
6550 count, VTY_NEWLINE);
6551 else
6552 vty_out (vty, "No %s neighbor is configured%s",
6553 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
6554 return CMD_SUCCESS;
6555}
6556
paul94f2b392005-06-28 12:44:16 +00006557static int
paulfd79ac92004-10-13 05:06:08 +00006558bgp_show_summary_vty (struct vty *vty, const char *name,
6559 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00006560{
6561 struct bgp *bgp;
6562
6563 if (name)
6564 {
6565 bgp = bgp_lookup_by_name (name);
6566
6567 if (! bgp)
6568 {
6569 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
6570 return CMD_WARNING;
6571 }
6572
6573 bgp_show_summary (vty, bgp, afi, safi);
6574 return CMD_SUCCESS;
6575 }
6576
6577 bgp = bgp_get_default ();
6578
6579 if (bgp)
6580 bgp_show_summary (vty, bgp, afi, safi);
6581
6582 return CMD_SUCCESS;
6583}
6584
6585/* `show ip bgp summary' commands. */
6586DEFUN (show_ip_bgp_summary,
6587 show_ip_bgp_summary_cmd,
6588 "show ip bgp summary",
6589 SHOW_STR
6590 IP_STR
6591 BGP_STR
6592 "Summary of BGP neighbor status\n")
6593{
6594 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
6595}
6596
6597DEFUN (show_ip_bgp_instance_summary,
6598 show_ip_bgp_instance_summary_cmd,
6599 "show ip bgp view WORD summary",
6600 SHOW_STR
6601 IP_STR
6602 BGP_STR
6603 "BGP view\n"
6604 "View name\n"
6605 "Summary of BGP neighbor status\n")
6606{
6607 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
6608}
6609
6610DEFUN (show_ip_bgp_ipv4_summary,
6611 show_ip_bgp_ipv4_summary_cmd,
6612 "show ip bgp ipv4 (unicast|multicast) summary",
6613 SHOW_STR
6614 IP_STR
6615 BGP_STR
6616 "Address family\n"
6617 "Address Family modifier\n"
6618 "Address Family modifier\n"
6619 "Summary of BGP neighbor status\n")
6620{
6621 if (strncmp (argv[0], "m", 1) == 0)
6622 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
6623
6624 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
6625}
6626
6627DEFUN (show_ip_bgp_instance_ipv4_summary,
6628 show_ip_bgp_instance_ipv4_summary_cmd,
6629 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
6630 SHOW_STR
6631 IP_STR
6632 BGP_STR
6633 "BGP view\n"
6634 "View name\n"
6635 "Address family\n"
6636 "Address Family modifier\n"
6637 "Address Family modifier\n"
6638 "Summary of BGP neighbor status\n")
6639{
6640 if (strncmp (argv[1], "m", 1) == 0)
6641 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
6642 else
6643 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
6644}
6645
6646DEFUN (show_ip_bgp_vpnv4_all_summary,
6647 show_ip_bgp_vpnv4_all_summary_cmd,
6648 "show ip bgp vpnv4 all summary",
6649 SHOW_STR
6650 IP_STR
6651 BGP_STR
6652 "Display VPNv4 NLRI specific information\n"
6653 "Display information about all VPNv4 NLRIs\n"
6654 "Summary of BGP neighbor status\n")
6655{
6656 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
6657}
6658
6659DEFUN (show_ip_bgp_vpnv4_rd_summary,
6660 show_ip_bgp_vpnv4_rd_summary_cmd,
6661 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
6662 SHOW_STR
6663 IP_STR
6664 BGP_STR
6665 "Display VPNv4 NLRI specific information\n"
6666 "Display information for a route distinguisher\n"
6667 "VPN Route Distinguisher\n"
6668 "Summary of BGP neighbor status\n")
6669{
6670 int ret;
6671 struct prefix_rd prd;
6672
6673 ret = str2prefix_rd (argv[0], &prd);
6674 if (! ret)
6675 {
6676 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
6677 return CMD_WARNING;
6678 }
6679
6680 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
6681}
6682
6683#ifdef HAVE_IPV6
6684DEFUN (show_bgp_summary,
6685 show_bgp_summary_cmd,
6686 "show bgp summary",
6687 SHOW_STR
6688 BGP_STR
6689 "Summary of BGP neighbor status\n")
6690{
6691 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
6692}
6693
6694DEFUN (show_bgp_instance_summary,
6695 show_bgp_instance_summary_cmd,
6696 "show bgp view WORD summary",
6697 SHOW_STR
6698 BGP_STR
6699 "BGP view\n"
6700 "View name\n"
6701 "Summary of BGP neighbor status\n")
6702{
6703 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
6704}
6705
6706ALIAS (show_bgp_summary,
6707 show_bgp_ipv6_summary_cmd,
6708 "show bgp ipv6 summary",
6709 SHOW_STR
6710 BGP_STR
6711 "Address family\n"
6712 "Summary of BGP neighbor status\n")
6713
6714ALIAS (show_bgp_instance_summary,
6715 show_bgp_instance_ipv6_summary_cmd,
6716 "show bgp view WORD ipv6 summary",
6717 SHOW_STR
6718 BGP_STR
6719 "BGP view\n"
6720 "View name\n"
6721 "Address family\n"
6722 "Summary of BGP neighbor status\n")
6723
6724/* old command */
6725DEFUN (show_ipv6_bgp_summary,
6726 show_ipv6_bgp_summary_cmd,
6727 "show ipv6 bgp summary",
6728 SHOW_STR
6729 IPV6_STR
6730 BGP_STR
6731 "Summary of BGP neighbor status\n")
6732{
6733 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
6734}
6735
6736/* old command */
6737DEFUN (show_ipv6_mbgp_summary,
6738 show_ipv6_mbgp_summary_cmd,
6739 "show ipv6 mbgp summary",
6740 SHOW_STR
6741 IPV6_STR
6742 MBGP_STR
6743 "Summary of BGP neighbor status\n")
6744{
6745 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
6746}
6747#endif /* HAVE_IPV6 */
6748
paulfd79ac92004-10-13 05:06:08 +00006749const char *
hasso538621f2004-05-21 09:31:30 +00006750afi_safi_print (afi_t afi, safi_t safi)
6751{
6752 if (afi == AFI_IP && safi == SAFI_UNICAST)
6753 return "IPv4 Unicast";
6754 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
6755 return "IPv4 Multicast";
6756 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
6757 return "VPNv4 Unicast";
6758 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
6759 return "IPv6 Unicast";
6760 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
6761 return "IPv6 Multicast";
6762 else
6763 return "Unknown";
6764}
6765
paul718e3742002-12-13 20:15:29 +00006766/* Show BGP peer's information. */
6767enum show_type
6768{
6769 show_all,
6770 show_peer
6771};
6772
paul94f2b392005-06-28 12:44:16 +00006773static void
paul718e3742002-12-13 20:15:29 +00006774bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
6775 afi_t afi, safi_t safi,
6776 u_int16_t adv_smcap, u_int16_t adv_rmcap,
6777 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
6778{
6779 /* Send-Mode */
6780 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
6781 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
6782 {
6783 vty_out (vty, " Send-mode: ");
6784 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
6785 vty_out (vty, "advertised");
6786 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
6787 vty_out (vty, "%sreceived",
6788 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
6789 ", " : "");
6790 vty_out (vty, "%s", VTY_NEWLINE);
6791 }
6792
6793 /* Receive-Mode */
6794 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
6795 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
6796 {
6797 vty_out (vty, " Receive-mode: ");
6798 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
6799 vty_out (vty, "advertised");
6800 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
6801 vty_out (vty, "%sreceived",
6802 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
6803 ", " : "");
6804 vty_out (vty, "%s", VTY_NEWLINE);
6805 }
6806}
6807
paul94f2b392005-06-28 12:44:16 +00006808static void
paul718e3742002-12-13 20:15:29 +00006809bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
6810{
6811 struct bgp_filter *filter;
6812 char orf_pfx_name[BUFSIZ];
6813 int orf_pfx_count;
6814
6815 filter = &p->filter[afi][safi];
6816
hasso538621f2004-05-21 09:31:30 +00006817 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00006818 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00006819
paul718e3742002-12-13 20:15:29 +00006820 if (p->af_group[afi][safi])
6821 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
6822
6823 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
6824 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
6825 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
6826 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
6827 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
6828 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
6829 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
6830
6831 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
6832 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
6833 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
6834 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
6835 {
6836 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
6837 ORF_TYPE_PREFIX, VTY_NEWLINE);
6838 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
6839 PEER_CAP_ORF_PREFIX_SM_ADV,
6840 PEER_CAP_ORF_PREFIX_RM_ADV,
6841 PEER_CAP_ORF_PREFIX_SM_RCV,
6842 PEER_CAP_ORF_PREFIX_RM_RCV);
6843 }
6844 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
6845 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
6846 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
6847 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
6848 {
6849 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
6850 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
6851 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
6852 PEER_CAP_ORF_PREFIX_SM_ADV,
6853 PEER_CAP_ORF_PREFIX_RM_ADV,
6854 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
6855 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
6856 }
6857
6858 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
6859 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
6860
6861 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
6862 || orf_pfx_count)
6863 {
6864 vty_out (vty, " Outbound Route Filter (ORF):");
6865 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
6866 vty_out (vty, " sent;");
6867 if (orf_pfx_count)
6868 vty_out (vty, " received (%d entries)", orf_pfx_count);
6869 vty_out (vty, "%s", VTY_NEWLINE);
6870 }
6871 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
6872 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
6873
6874 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
6875 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
6876 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
6877 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
6878 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
6879 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
6880 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
6881 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
6882 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
6883 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
6884 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
6885 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
6886 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
6887 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
6888 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
6889 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
6890 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
6891 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
6892 {
6893 vty_out (vty, " Community attribute sent to this neighbor");
6894 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
6895 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00006896 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006897 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00006898 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006899 else
hasso538621f2004-05-21 09:31:30 +00006900 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006901 }
6902 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
6903 {
6904 vty_out (vty, " Default information originate,");
6905
6906 if (p->default_rmap[afi][safi].name)
6907 vty_out (vty, " default route-map %s%s,",
6908 p->default_rmap[afi][safi].map ? "*" : "",
6909 p->default_rmap[afi][safi].name);
6910 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
6911 vty_out (vty, " default sent%s", VTY_NEWLINE);
6912 else
6913 vty_out (vty, " default not sent%s", VTY_NEWLINE);
6914 }
6915
6916 if (filter->plist[FILTER_IN].name
6917 || filter->dlist[FILTER_IN].name
6918 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00006919 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00006920 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
6921 if (filter->plist[FILTER_OUT].name
6922 || filter->dlist[FILTER_OUT].name
6923 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00006924 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00006925 || filter->usmap.name)
6926 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00006927 if (filter->map[RMAP_IMPORT].name)
6928 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
6929 if (filter->map[RMAP_EXPORT].name)
6930 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006931
6932 /* prefix-list */
6933 if (filter->plist[FILTER_IN].name)
6934 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
6935 filter->plist[FILTER_IN].plist ? "*" : "",
6936 filter->plist[FILTER_IN].name,
6937 VTY_NEWLINE);
6938 if (filter->plist[FILTER_OUT].name)
6939 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
6940 filter->plist[FILTER_OUT].plist ? "*" : "",
6941 filter->plist[FILTER_OUT].name,
6942 VTY_NEWLINE);
6943
6944 /* distribute-list */
6945 if (filter->dlist[FILTER_IN].name)
6946 vty_out (vty, " Incoming update network filter list is %s%s%s",
6947 filter->dlist[FILTER_IN].alist ? "*" : "",
6948 filter->dlist[FILTER_IN].name,
6949 VTY_NEWLINE);
6950 if (filter->dlist[FILTER_OUT].name)
6951 vty_out (vty, " Outgoing update network filter list is %s%s%s",
6952 filter->dlist[FILTER_OUT].alist ? "*" : "",
6953 filter->dlist[FILTER_OUT].name,
6954 VTY_NEWLINE);
6955
6956 /* filter-list. */
6957 if (filter->aslist[FILTER_IN].name)
6958 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
6959 filter->aslist[FILTER_IN].aslist ? "*" : "",
6960 filter->aslist[FILTER_IN].name,
6961 VTY_NEWLINE);
6962 if (filter->aslist[FILTER_OUT].name)
6963 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
6964 filter->aslist[FILTER_OUT].aslist ? "*" : "",
6965 filter->aslist[FILTER_OUT].name,
6966 VTY_NEWLINE);
6967
6968 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00006969 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00006970 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00006971 filter->map[RMAP_IN].map ? "*" : "",
6972 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00006973 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00006974 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00006975 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00006976 filter->map[RMAP_OUT].map ? "*" : "",
6977 filter->map[RMAP_OUT].name,
6978 VTY_NEWLINE);
6979 if (filter->map[RMAP_IMPORT].name)
6980 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
6981 filter->map[RMAP_IMPORT].map ? "*" : "",
6982 filter->map[RMAP_IMPORT].name,
6983 VTY_NEWLINE);
6984 if (filter->map[RMAP_EXPORT].name)
6985 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
6986 filter->map[RMAP_EXPORT].map ? "*" : "",
6987 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00006988 VTY_NEWLINE);
6989
6990 /* unsuppress-map */
6991 if (filter->usmap.name)
6992 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
6993 filter->usmap.map ? "*" : "",
6994 filter->usmap.name, VTY_NEWLINE);
6995
6996 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00006997 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
6998
paul718e3742002-12-13 20:15:29 +00006999 /* Maximum prefix */
7000 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
7001 {
hasso0a486e52005-02-01 20:57:17 +00007002 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00007003 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00007004 ? " (warning-only)" : "", VTY_NEWLINE);
7005 vty_out (vty, " Threshold for warning message %d%%",
7006 p->pmax_threshold[afi][safi]);
7007 if (p->pmax_restart[afi][safi])
7008 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
7009 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007010 }
paul718e3742002-12-13 20:15:29 +00007011
7012 vty_out (vty, "%s", VTY_NEWLINE);
7013}
7014
paul94f2b392005-06-28 12:44:16 +00007015static void
paul718e3742002-12-13 20:15:29 +00007016bgp_show_peer (struct vty *vty, struct peer *p)
7017{
7018 struct bgp *bgp;
7019 char buf1[BUFSIZ];
7020 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00007021 afi_t afi;
7022 safi_t safi;
paul718e3742002-12-13 20:15:29 +00007023
7024 bgp = p->bgp;
7025
7026 /* Configured IP address. */
7027 vty_out (vty, "BGP neighbor is %s, ", p->host);
7028 vty_out (vty, "remote AS %d, ", p->as);
7029 vty_out (vty, "local AS %d%s, ",
7030 p->change_local_as ? p->change_local_as : p->local_as,
7031 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
7032 " no-prepend" : "");
7033 vty_out (vty, "%s link%s",
7034 p->as == p->local_as ? "internal" : "external",
7035 VTY_NEWLINE);
7036
7037 /* Description. */
7038 if (p->desc)
7039 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
7040
7041 /* Peer-group */
7042 if (p->group)
7043 vty_out (vty, " Member of peer-group %s for session parameters%s",
7044 p->group->name, VTY_NEWLINE);
7045
7046 /* Administrative shutdown. */
7047 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
7048 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
7049
7050 /* BGP Version. */
7051 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00007052 vty_out (vty, ", remote router ID %s%s",
7053 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
7054 VTY_NEWLINE);
7055
7056 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00007057 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
7058 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00007059 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
7060
7061 /* Status. */
7062 vty_out (vty, " BGP state = %s",
7063 LOOKUP (bgp_status_msg, p->status));
7064 if (p->status == Established)
7065 vty_out (vty, ", up for %8s",
7066 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00007067 else if (p->status == Active)
7068 {
7069 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7070 vty_out (vty, " (passive)");
7071 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7072 vty_out (vty, " (NSF passive)");
7073 }
paul718e3742002-12-13 20:15:29 +00007074 vty_out (vty, "%s", VTY_NEWLINE);
7075
7076 /* read timer */
7077 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7078
7079 /* Configured timer values. */
7080 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7081 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7082 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7083 {
7084 vty_out (vty, " Configured hold time is %d", p->holdtime);
7085 vty_out (vty, ", keepalive interval is %d seconds%s",
7086 p->keepalive, VTY_NEWLINE);
7087 }
hasso93406d82005-02-02 14:40:33 +00007088
paul718e3742002-12-13 20:15:29 +00007089 /* Capability. */
7090 if (p->status == Established)
7091 {
hasso538621f2004-05-21 09:31:30 +00007092 if (p->cap
paul718e3742002-12-13 20:15:29 +00007093 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7094 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7095 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7096 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7097#ifdef HAVE_IPV6
7098 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7099 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7100 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7101 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
7102#endif /* HAVE_IPV6 */
7103 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7104 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7105 {
7106 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7107
7108 /* Dynamic */
7109 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
7110 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7111 {
7112 vty_out (vty, " Dynamic:");
7113 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7114 vty_out (vty, " advertised");
7115 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00007116 vty_out (vty, " %sreceived",
7117 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007118 vty_out (vty, "%s", VTY_NEWLINE);
7119 }
7120
7121 /* Route Refresh */
7122 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
7123 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7124 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
7125 {
7126 vty_out (vty, " Route refresh:");
7127 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
7128 vty_out (vty, " advertised");
7129 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7130 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00007131 vty_out (vty, " %sreceived(%s)",
7132 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
7133 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
7134 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
7135 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
7136
paul718e3742002-12-13 20:15:29 +00007137 vty_out (vty, "%s", VTY_NEWLINE);
7138 }
7139
hasso538621f2004-05-21 09:31:30 +00007140 /* Multiprotocol Extensions */
7141 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7142 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7143 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00007144 {
hasso538621f2004-05-21 09:31:30 +00007145 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
7146 if (p->afc_adv[afi][safi])
7147 vty_out (vty, " advertised");
7148 if (p->afc_recv[afi][safi])
7149 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
7150 vty_out (vty, "%s", VTY_NEWLINE);
7151 }
7152
7153 /* Gracefull Restart */
7154 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7155 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007156 {
hasso538621f2004-05-21 09:31:30 +00007157 vty_out (vty, " Graceful Restart Capabilty:");
7158 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007159 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00007160 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
7161 vty_out (vty, " %sreceived",
7162 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007163 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007164
7165 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00007166 {
hasso538621f2004-05-21 09:31:30 +00007167 int restart_af_count = 0;
7168
7169 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00007170 p->v_gr_restart, VTY_NEWLINE);
7171 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007172
7173 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7174 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7175 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
7176 {
hasso93406d82005-02-02 14:40:33 +00007177 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
7178 afi_safi_print (afi, safi),
7179 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
7180 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00007181 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00007182 }
hasso538621f2004-05-21 09:31:30 +00007183 if (! restart_af_count)
7184 vty_out (vty, "none");
7185 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007186 }
paul718e3742002-12-13 20:15:29 +00007187 }
paul718e3742002-12-13 20:15:29 +00007188 }
7189 }
7190
hasso93406d82005-02-02 14:40:33 +00007191 /* graceful restart information */
7192 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7193 || p->t_gr_restart
7194 || p->t_gr_stale)
7195 {
7196 int eor_send_af_count = 0;
7197 int eor_receive_af_count = 0;
7198
7199 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
7200 if (p->status == Established)
7201 {
7202 vty_out (vty, " End-of-RIB send: ");
7203 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7204 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7205 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
7206 {
7207 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
7208 afi_safi_print (afi, safi));
7209 eor_send_af_count++;
7210 }
7211 vty_out (vty, "%s", VTY_NEWLINE);
7212
7213 vty_out (vty, " End-of-RIB received: ");
7214 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7215 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7216 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
7217 {
7218 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
7219 afi_safi_print (afi, safi));
7220 eor_receive_af_count++;
7221 }
7222 vty_out (vty, "%s", VTY_NEWLINE);
7223 }
7224
7225 if (p->t_gr_restart)
7226 {
7227 vty_out (vty, " The remaining time of restart timer is %ld%s",
7228 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
7229 }
7230 if (p->t_gr_stale)
7231 {
7232 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
7233 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
7234 }
7235 }
7236
paul718e3742002-12-13 20:15:29 +00007237 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00007238 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
7239 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
7240 vty_out (vty, " Outq depth is %ld%s", p->obuf->count, VTY_NEWLINE);
7241 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
7242 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
7243 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
7244 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
7245 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
7246 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
7247 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
7248 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
7249 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
7250 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
7251 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007252
7253 /* advertisement-interval */
7254 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
7255 p->v_routeadv, VTY_NEWLINE);
7256
7257 /* Update-source. */
7258 if (p->update_if || p->update_source)
7259 {
7260 vty_out (vty, " Update source is ");
7261 if (p->update_if)
7262 vty_out (vty, "%s", p->update_if);
7263 else if (p->update_source)
7264 vty_out (vty, "%s",
7265 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
7266 vty_out (vty, "%s", VTY_NEWLINE);
7267 }
7268
7269 /* Default weight */
7270 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
7271 vty_out (vty, " Default weight %d%s", p->weight,
7272 VTY_NEWLINE);
7273
7274 vty_out (vty, "%s", VTY_NEWLINE);
7275
7276 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00007277 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7278 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7279 if (p->afc[afi][safi])
7280 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00007281
7282 vty_out (vty, " Connections established %d; dropped %d%s",
7283 p->established, p->dropped,
7284 VTY_NEWLINE);
7285
hassoe0701b72004-05-20 09:19:34 +00007286 if (! p->dropped)
7287 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
7288 else
7289 vty_out (vty, " Last reset %s, due to %s%s",
7290 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
7291 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00007292
paul718e3742002-12-13 20:15:29 +00007293 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7294 {
7295 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00007296
7297 if (p->t_pmax_restart)
7298 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
7299 p->host, thread_timer_remain_second (p->t_pmax_restart),
7300 VTY_NEWLINE);
7301 else
7302 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
7303 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007304 }
7305
7306 /* EBGP Multihop */
7307 if (peer_sort (p) != BGP_PEER_IBGP && p->ttl > 1)
7308 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7309 p->ttl, VTY_NEWLINE);
7310
7311 /* Local address. */
7312 if (p->su_local)
7313 {
hasso93406d82005-02-02 14:40:33 +00007314 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00007315 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
7316 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00007317 VTY_NEWLINE);
7318 }
7319
7320 /* Remote address. */
7321 if (p->su_remote)
7322 {
7323 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
7324 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
7325 ntohs (p->su_remote->sin.sin_port),
7326 VTY_NEWLINE);
7327 }
7328
7329 /* Nexthop display. */
7330 if (p->su_local)
7331 {
7332 vty_out (vty, "Nexthop: %s%s",
7333 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
7334 VTY_NEWLINE);
7335#ifdef HAVE_IPV6
7336 vty_out (vty, "Nexthop global: %s%s",
7337 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
7338 VTY_NEWLINE);
7339 vty_out (vty, "Nexthop local: %s%s",
7340 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
7341 VTY_NEWLINE);
7342 vty_out (vty, "BGP connection: %s%s",
7343 p->shared_network ? "shared network" : "non shared network",
7344 VTY_NEWLINE);
7345#endif /* HAVE_IPV6 */
7346 }
7347
7348 /* Timer information. */
7349 if (p->t_start)
7350 vty_out (vty, "Next start timer due in %ld seconds%s",
7351 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
7352 if (p->t_connect)
7353 vty_out (vty, "Next connect timer due in %ld seconds%s",
7354 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
7355
7356 vty_out (vty, "Read thread: %s Write thread: %s%s",
7357 p->t_read ? "on" : "off",
7358 p->t_write ? "on" : "off",
7359 VTY_NEWLINE);
7360
7361 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
7362 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
7363 bgp_capability_vty_out (vty, p);
7364
7365 vty_out (vty, "%s", VTY_NEWLINE);
7366}
7367
paul94f2b392005-06-28 12:44:16 +00007368static int
paul718e3742002-12-13 20:15:29 +00007369bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
7370 enum show_type type, union sockunion *su)
7371{
paul1eb8ef22005-04-07 07:30:20 +00007372 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00007373 struct peer *peer;
7374 int find = 0;
7375
paul1eb8ef22005-04-07 07:30:20 +00007376 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007377 {
7378 switch (type)
7379 {
7380 case show_all:
7381 bgp_show_peer (vty, peer);
7382 break;
7383 case show_peer:
7384 if (sockunion_same (&peer->su, su))
7385 {
7386 find = 1;
7387 bgp_show_peer (vty, peer);
7388 }
7389 break;
7390 }
7391 }
7392
7393 if (type == show_peer && ! find)
7394 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
7395
7396 return CMD_SUCCESS;
7397}
7398
paul94f2b392005-06-28 12:44:16 +00007399static int
paulfd79ac92004-10-13 05:06:08 +00007400bgp_show_neighbor_vty (struct vty *vty, const char *name,
7401 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00007402{
7403 int ret;
7404 struct bgp *bgp;
7405 union sockunion su;
7406
7407 if (ip_str)
7408 {
7409 ret = str2sockunion (ip_str, &su);
7410 if (ret < 0)
7411 {
7412 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
7413 return CMD_WARNING;
7414 }
7415 }
7416
7417 if (name)
7418 {
7419 bgp = bgp_lookup_by_name (name);
7420
7421 if (! bgp)
7422 {
7423 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7424 return CMD_WARNING;
7425 }
7426
7427 bgp_show_neighbor (vty, bgp, type, &su);
7428
7429 return CMD_SUCCESS;
7430 }
7431
7432 bgp = bgp_get_default ();
7433
7434 if (bgp)
7435 bgp_show_neighbor (vty, bgp, type, &su);
7436
7437 return CMD_SUCCESS;
7438}
7439
7440/* "show ip bgp neighbors" commands. */
7441DEFUN (show_ip_bgp_neighbors,
7442 show_ip_bgp_neighbors_cmd,
7443 "show ip bgp neighbors",
7444 SHOW_STR
7445 IP_STR
7446 BGP_STR
7447 "Detailed information on TCP and BGP neighbor connections\n")
7448{
7449 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
7450}
7451
7452ALIAS (show_ip_bgp_neighbors,
7453 show_ip_bgp_ipv4_neighbors_cmd,
7454 "show ip bgp ipv4 (unicast|multicast) neighbors",
7455 SHOW_STR
7456 IP_STR
7457 BGP_STR
7458 "Address family\n"
7459 "Address Family modifier\n"
7460 "Address Family modifier\n"
7461 "Detailed information on TCP and BGP neighbor connections\n")
7462
7463ALIAS (show_ip_bgp_neighbors,
7464 show_ip_bgp_vpnv4_all_neighbors_cmd,
7465 "show ip bgp vpnv4 all neighbors",
7466 SHOW_STR
7467 IP_STR
7468 BGP_STR
7469 "Display VPNv4 NLRI specific information\n"
7470 "Display information about all VPNv4 NLRIs\n"
7471 "Detailed information on TCP and BGP neighbor connections\n")
7472
7473ALIAS (show_ip_bgp_neighbors,
7474 show_ip_bgp_vpnv4_rd_neighbors_cmd,
7475 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
7476 SHOW_STR
7477 IP_STR
7478 BGP_STR
7479 "Display VPNv4 NLRI specific information\n"
7480 "Display information for a route distinguisher\n"
7481 "VPN Route Distinguisher\n"
7482 "Detailed information on TCP and BGP neighbor connections\n")
7483
7484ALIAS (show_ip_bgp_neighbors,
7485 show_bgp_neighbors_cmd,
7486 "show bgp neighbors",
7487 SHOW_STR
7488 BGP_STR
7489 "Detailed information on TCP and BGP neighbor connections\n")
7490
7491ALIAS (show_ip_bgp_neighbors,
7492 show_bgp_ipv6_neighbors_cmd,
7493 "show bgp ipv6 neighbors",
7494 SHOW_STR
7495 BGP_STR
7496 "Address family\n"
7497 "Detailed information on TCP and BGP neighbor connections\n")
7498
7499DEFUN (show_ip_bgp_neighbors_peer,
7500 show_ip_bgp_neighbors_peer_cmd,
7501 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
7502 SHOW_STR
7503 IP_STR
7504 BGP_STR
7505 "Detailed information on TCP and BGP neighbor connections\n"
7506 "Neighbor to display information about\n"
7507 "Neighbor to display information about\n")
7508{
7509 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
7510}
7511
7512ALIAS (show_ip_bgp_neighbors_peer,
7513 show_ip_bgp_ipv4_neighbors_peer_cmd,
7514 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
7515 SHOW_STR
7516 IP_STR
7517 BGP_STR
7518 "Address family\n"
7519 "Address Family modifier\n"
7520 "Address Family modifier\n"
7521 "Detailed information on TCP and BGP neighbor connections\n"
7522 "Neighbor to display information about\n"
7523 "Neighbor to display information about\n")
7524
7525ALIAS (show_ip_bgp_neighbors_peer,
7526 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
7527 "show ip bgp vpnv4 all neighbors A.B.C.D",
7528 SHOW_STR
7529 IP_STR
7530 BGP_STR
7531 "Display VPNv4 NLRI specific information\n"
7532 "Display information about all VPNv4 NLRIs\n"
7533 "Detailed information on TCP and BGP neighbor connections\n"
7534 "Neighbor to display information about\n")
7535
7536ALIAS (show_ip_bgp_neighbors_peer,
7537 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
7538 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
7539 SHOW_STR
7540 IP_STR
7541 BGP_STR
7542 "Display VPNv4 NLRI specific information\n"
7543 "Display information about all VPNv4 NLRIs\n"
7544 "Detailed information on TCP and BGP neighbor connections\n"
7545 "Neighbor to display information about\n")
7546
7547ALIAS (show_ip_bgp_neighbors_peer,
7548 show_bgp_neighbors_peer_cmd,
7549 "show bgp neighbors (A.B.C.D|X:X::X:X)",
7550 SHOW_STR
7551 BGP_STR
7552 "Detailed information on TCP and BGP neighbor connections\n"
7553 "Neighbor to display information about\n"
7554 "Neighbor to display information about\n")
7555
7556ALIAS (show_ip_bgp_neighbors_peer,
7557 show_bgp_ipv6_neighbors_peer_cmd,
7558 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
7559 SHOW_STR
7560 BGP_STR
7561 "Address family\n"
7562 "Detailed information on TCP and BGP neighbor connections\n"
7563 "Neighbor to display information about\n"
7564 "Neighbor to display information about\n")
7565
7566DEFUN (show_ip_bgp_instance_neighbors,
7567 show_ip_bgp_instance_neighbors_cmd,
7568 "show ip bgp view WORD neighbors",
7569 SHOW_STR
7570 IP_STR
7571 BGP_STR
7572 "BGP view\n"
7573 "View name\n"
7574 "Detailed information on TCP and BGP neighbor connections\n")
7575{
7576 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
7577}
7578
paulbb46e942003-10-24 19:02:03 +00007579ALIAS (show_ip_bgp_instance_neighbors,
7580 show_bgp_instance_neighbors_cmd,
7581 "show bgp view WORD neighbors",
7582 SHOW_STR
7583 BGP_STR
7584 "BGP view\n"
7585 "View name\n"
7586 "Detailed information on TCP and BGP neighbor connections\n")
7587
7588ALIAS (show_ip_bgp_instance_neighbors,
7589 show_bgp_instance_ipv6_neighbors_cmd,
7590 "show bgp view WORD ipv6 neighbors",
7591 SHOW_STR
7592 BGP_STR
7593 "BGP view\n"
7594 "View name\n"
7595 "Address family\n"
7596 "Detailed information on TCP and BGP neighbor connections\n")
7597
paul718e3742002-12-13 20:15:29 +00007598DEFUN (show_ip_bgp_instance_neighbors_peer,
7599 show_ip_bgp_instance_neighbors_peer_cmd,
7600 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
7601 SHOW_STR
7602 IP_STR
7603 BGP_STR
7604 "BGP view\n"
7605 "View name\n"
7606 "Detailed information on TCP and BGP neighbor connections\n"
7607 "Neighbor to display information about\n"
7608 "Neighbor to display information about\n")
7609{
7610 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
7611}
paulbb46e942003-10-24 19:02:03 +00007612
7613ALIAS (show_ip_bgp_instance_neighbors_peer,
7614 show_bgp_instance_neighbors_peer_cmd,
7615 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
7616 SHOW_STR
7617 BGP_STR
7618 "BGP view\n"
7619 "View name\n"
7620 "Detailed information on TCP and BGP neighbor connections\n"
7621 "Neighbor to display information about\n"
7622 "Neighbor to display information about\n")
7623
7624ALIAS (show_ip_bgp_instance_neighbors_peer,
7625 show_bgp_instance_ipv6_neighbors_peer_cmd,
7626 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
7627 SHOW_STR
7628 BGP_STR
7629 "BGP view\n"
7630 "View name\n"
7631 "Address family\n"
7632 "Detailed information on TCP and BGP neighbor connections\n"
7633 "Neighbor to display information about\n"
7634 "Neighbor to display information about\n")
7635
paul718e3742002-12-13 20:15:29 +00007636/* Show BGP's AS paths internal data. There are both `show ip bgp
7637 paths' and `show ip mbgp paths'. Those functions results are the
7638 same.*/
7639DEFUN (show_ip_bgp_paths,
7640 show_ip_bgp_paths_cmd,
7641 "show ip bgp paths",
7642 SHOW_STR
7643 IP_STR
7644 BGP_STR
7645 "Path information\n")
7646{
7647 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
7648 aspath_print_all_vty (vty);
7649 return CMD_SUCCESS;
7650}
7651
7652DEFUN (show_ip_bgp_ipv4_paths,
7653 show_ip_bgp_ipv4_paths_cmd,
7654 "show ip bgp ipv4 (unicast|multicast) paths",
7655 SHOW_STR
7656 IP_STR
7657 BGP_STR
7658 "Address family\n"
7659 "Address Family modifier\n"
7660 "Address Family modifier\n"
7661 "Path information\n")
7662{
7663 vty_out (vty, "Address Refcnt Path\r\n");
7664 aspath_print_all_vty (vty);
7665
7666 return CMD_SUCCESS;
7667}
7668
7669#include "hash.h"
7670
paul94f2b392005-06-28 12:44:16 +00007671static void
paul718e3742002-12-13 20:15:29 +00007672community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
7673{
7674 struct community *com;
7675
7676 com = (struct community *) backet->data;
7677 vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt,
7678 community_str (com), VTY_NEWLINE);
7679}
7680
7681/* Show BGP's community internal data. */
7682DEFUN (show_ip_bgp_community_info,
7683 show_ip_bgp_community_info_cmd,
7684 "show ip bgp community-info",
7685 SHOW_STR
7686 IP_STR
7687 BGP_STR
7688 "List all bgp community information\n")
7689{
7690 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
7691
7692 hash_iterate (community_hash (),
7693 (void (*) (struct hash_backet *, void *))
7694 community_show_all_iterator,
7695 vty);
7696
7697 return CMD_SUCCESS;
7698}
7699
7700DEFUN (show_ip_bgp_attr_info,
7701 show_ip_bgp_attr_info_cmd,
7702 "show ip bgp attribute-info",
7703 SHOW_STR
7704 IP_STR
7705 BGP_STR
7706 "List all bgp attribute information\n")
7707{
7708 attr_show_all (vty);
7709 return CMD_SUCCESS;
7710}
7711
paul94f2b392005-06-28 12:44:16 +00007712static int
paulfee0f4c2004-09-13 05:12:46 +00007713bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
7714 afi_t afi, safi_t safi)
7715{
7716 char timebuf[BGP_UPTIME_LEN];
7717 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00007718 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00007719 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007720 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00007721 int len;
7722 int count = 0;
7723
7724 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
7725 {
paul1eb8ef22005-04-07 07:30:20 +00007726 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00007727 {
7728 count++;
7729 bgp_write_rsclient_summary (vty, peer, afi, safi);
7730 }
7731 return count;
7732 }
7733
7734 len = vty_out (vty, "%s", rsclient->host);
7735 len = 16 - len;
7736
7737 if (len < 1)
7738 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7739 else
7740 vty_out (vty, "%*s", len, " ");
7741
hasso3d515fd2005-02-01 21:30:04 +00007742 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00007743
7744 vty_out (vty, "%5d ", rsclient->as);
7745
7746 rmname = ROUTE_MAP_EXPORT_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 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
7757 if ( rmname && strlen (rmname) > 13 )
7758 {
7759 sprintf (rmbuf, "%13s", "...");
7760 rmname = strncpy (rmbuf, rmname, 10);
7761 }
7762 else if (! rmname)
7763 rmname = "<none>";
7764 vty_out (vty, " %13s ", rmname);
7765
7766 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
7767
7768 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
7769 vty_out (vty, " Idle (Admin)");
7770 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7771 vty_out (vty, " Idle (PfxCt)");
7772 else
7773 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
7774
7775 vty_out (vty, "%s", VTY_NEWLINE);
7776
7777 return 1;
7778}
7779
paul94f2b392005-06-28 12:44:16 +00007780static int
paulfd79ac92004-10-13 05:06:08 +00007781bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
7782 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00007783{
7784 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007785 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00007786 int count = 0;
7787
7788 /* Header string for each address family. */
7789 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
7790
paul1eb8ef22005-04-07 07:30:20 +00007791 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00007792 {
7793 if (peer->afc[afi][safi] &&
7794 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7795 {
7796 if (! count)
7797 {
7798 vty_out (vty,
7799 "Route Server's BGP router identifier %s%s",
7800 inet_ntoa (bgp->router_id), VTY_NEWLINE);
7801 vty_out (vty,
7802 "Route Server's local AS number %d%s", bgp->as,
7803 VTY_NEWLINE);
7804
7805 vty_out (vty, "%s", VTY_NEWLINE);
7806 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7807 }
7808
7809 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
7810 }
7811 }
7812
7813 if (count)
7814 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
7815 count, VTY_NEWLINE);
7816 else
7817 vty_out (vty, "No %s Route Server Client is configured%s",
7818 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7819
7820 return CMD_SUCCESS;
7821}
7822
paul94f2b392005-06-28 12:44:16 +00007823static int
paulfd79ac92004-10-13 05:06:08 +00007824bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
7825 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00007826{
7827 struct bgp *bgp;
7828
7829 if (name)
7830 {
7831 bgp = bgp_lookup_by_name (name);
7832
7833 if (! bgp)
7834 {
7835 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7836 return CMD_WARNING;
7837 }
7838
7839 bgp_show_rsclient_summary (vty, bgp, afi, safi);
7840 return CMD_SUCCESS;
7841 }
7842
7843 bgp = bgp_get_default ();
7844
7845 if (bgp)
7846 bgp_show_rsclient_summary (vty, bgp, afi, safi);
7847
7848 return CMD_SUCCESS;
7849}
7850
7851/* 'show bgp rsclient' commands. */
7852DEFUN (show_ip_bgp_rsclient_summary,
7853 show_ip_bgp_rsclient_summary_cmd,
7854 "show ip bgp rsclient summary",
7855 SHOW_STR
7856 IP_STR
7857 BGP_STR
7858 "Information about Route Server Clients\n"
7859 "Summary of all Route Server Clients\n")
7860{
7861 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7862}
7863
7864DEFUN (show_ip_bgp_instance_rsclient_summary,
7865 show_ip_bgp_instance_rsclient_summary_cmd,
7866 "show ip bgp view WORD rsclient summary",
7867 SHOW_STR
7868 IP_STR
7869 BGP_STR
7870 "BGP view\n"
7871 "View name\n"
7872 "Information about Route Server Clients\n"
7873 "Summary of all Route Server Clients\n")
7874{
7875 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7876}
7877
7878DEFUN (show_ip_bgp_ipv4_rsclient_summary,
7879 show_ip_bgp_ipv4_rsclient_summary_cmd,
7880 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
7881 SHOW_STR
7882 IP_STR
7883 BGP_STR
7884 "Address family\n"
7885 "Address Family modifier\n"
7886 "Address Family modifier\n"
7887 "Information about Route Server Clients\n"
7888 "Summary of all Route Server Clients\n")
7889{
7890 if (strncmp (argv[0], "m", 1) == 0)
7891 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7892
7893 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7894}
7895
7896DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
7897 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
7898 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
7899 SHOW_STR
7900 IP_STR
7901 BGP_STR
7902 "BGP view\n"
7903 "View name\n"
7904 "Address family\n"
7905 "Address Family modifier\n"
7906 "Address Family modifier\n"
7907 "Information about Route Server Clients\n"
7908 "Summary of all Route Server Clients\n")
7909{
7910 if (strncmp (argv[1], "m", 1) == 0)
7911 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7912
7913 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7914}
7915
7916#ifdef HAVE_IPV6
7917DEFUN (show_bgp_rsclient_summary,
7918 show_bgp_rsclient_summary_cmd,
7919 "show bgp rsclient summary",
7920 SHOW_STR
7921 BGP_STR
7922 "Information about Route Server Clients\n"
7923 "Summary of all Route Server Clients\n")
7924{
7925 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7926}
7927
7928DEFUN (show_bgp_instance_rsclient_summary,
7929 show_bgp_instance_rsclient_summary_cmd,
7930 "show bgp view WORD rsclient summary",
7931 SHOW_STR
7932 BGP_STR
7933 "BGP view\n"
7934 "View name\n"
7935 "Information about Route Server Clients\n"
7936 "Summary of all Route Server Clients\n")
7937{
7938 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7939}
7940
7941ALIAS (show_bgp_rsclient_summary,
7942 show_bgp_ipv6_rsclient_summary_cmd,
7943 "show bgp ipv6 rsclient summary",
7944 SHOW_STR
7945 BGP_STR
7946 "Address family\n"
7947 "Information about Route Server Clients\n"
7948 "Summary of all Route Server Clients\n")
7949
7950ALIAS (show_bgp_instance_rsclient_summary,
7951 show_bgp_instance_ipv6_rsclient_summary_cmd,
7952 "show bgp view WORD ipv6 rsclient summary",
7953 SHOW_STR
7954 BGP_STR
7955 "BGP view\n"
7956 "View name\n"
7957 "Address family\n"
7958 "Information about Route Server Clients\n"
7959 "Summary of all Route Server Clients\n")
7960#endif /* HAVE IPV6 */
7961
paul718e3742002-12-13 20:15:29 +00007962/* Redistribute VTY commands. */
7963
7964/* Utility function to convert user input route type string to route
7965 type. */
7966static int
paulfd79ac92004-10-13 05:06:08 +00007967bgp_str2route_type (int afi, const char *str)
paul718e3742002-12-13 20:15:29 +00007968{
7969 if (! str)
7970 return 0;
7971
7972 if (afi == AFI_IP)
7973 {
7974 if (strncmp (str, "k", 1) == 0)
7975 return ZEBRA_ROUTE_KERNEL;
7976 else if (strncmp (str, "c", 1) == 0)
7977 return ZEBRA_ROUTE_CONNECT;
7978 else if (strncmp (str, "s", 1) == 0)
7979 return ZEBRA_ROUTE_STATIC;
7980 else if (strncmp (str, "r", 1) == 0)
7981 return ZEBRA_ROUTE_RIP;
7982 else if (strncmp (str, "o", 1) == 0)
7983 return ZEBRA_ROUTE_OSPF;
7984 }
7985 if (afi == AFI_IP6)
7986 {
7987 if (strncmp (str, "k", 1) == 0)
7988 return ZEBRA_ROUTE_KERNEL;
7989 else if (strncmp (str, "c", 1) == 0)
7990 return ZEBRA_ROUTE_CONNECT;
7991 else if (strncmp (str, "s", 1) == 0)
7992 return ZEBRA_ROUTE_STATIC;
7993 else if (strncmp (str, "r", 1) == 0)
7994 return ZEBRA_ROUTE_RIPNG;
7995 else if (strncmp (str, "o", 1) == 0)
7996 return ZEBRA_ROUTE_OSPF6;
7997 }
7998 return 0;
7999}
8000
8001DEFUN (bgp_redistribute_ipv4,
8002 bgp_redistribute_ipv4_cmd,
8003 "redistribute (connected|kernel|ospf|rip|static)",
8004 "Redistribute information from another routing protocol\n"
8005 "Connected\n"
8006 "Kernel routes\n"
8007 "Open Shurtest Path First (OSPF)\n"
8008 "Routing Information Protocol (RIP)\n"
8009 "Static routes\n")
8010{
8011 int type;
8012
8013 type = bgp_str2route_type (AFI_IP, argv[0]);
8014 if (! type)
8015 {
8016 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8017 return CMD_WARNING;
8018 }
8019 return bgp_redistribute_set (vty->index, AFI_IP, type);
8020}
8021
8022DEFUN (bgp_redistribute_ipv4_rmap,
8023 bgp_redistribute_ipv4_rmap_cmd,
8024 "redistribute (connected|kernel|ospf|rip|static) route-map WORD",
8025 "Redistribute information from another routing protocol\n"
8026 "Connected\n"
8027 "Kernel routes\n"
8028 "Open Shurtest Path First (OSPF)\n"
8029 "Routing Information Protocol (RIP)\n"
8030 "Static routes\n"
8031 "Route map reference\n"
8032 "Pointer to route-map entries\n")
8033{
8034 int type;
8035
8036 type = bgp_str2route_type (AFI_IP, argv[0]);
8037 if (! type)
8038 {
8039 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8040 return CMD_WARNING;
8041 }
8042
8043 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8044 return bgp_redistribute_set (vty->index, AFI_IP, type);
8045}
8046
8047DEFUN (bgp_redistribute_ipv4_metric,
8048 bgp_redistribute_ipv4_metric_cmd,
8049 "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
8050 "Redistribute information from another routing protocol\n"
8051 "Connected\n"
8052 "Kernel routes\n"
8053 "Open Shurtest Path First (OSPF)\n"
8054 "Routing Information Protocol (RIP)\n"
8055 "Static routes\n"
8056 "Metric for redistributed routes\n"
8057 "Default metric\n")
8058{
8059 int type;
8060 u_int32_t metric;
8061
8062 type = bgp_str2route_type (AFI_IP, argv[0]);
8063 if (! type)
8064 {
8065 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8066 return CMD_WARNING;
8067 }
8068 VTY_GET_INTEGER ("metric", metric, argv[1]);
8069
8070 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8071 return bgp_redistribute_set (vty->index, AFI_IP, type);
8072}
8073
8074DEFUN (bgp_redistribute_ipv4_rmap_metric,
8075 bgp_redistribute_ipv4_rmap_metric_cmd,
8076 "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
8077 "Redistribute information from another routing protocol\n"
8078 "Connected\n"
8079 "Kernel routes\n"
8080 "Open Shurtest Path First (OSPF)\n"
8081 "Routing Information Protocol (RIP)\n"
8082 "Static routes\n"
8083 "Route map reference\n"
8084 "Pointer to route-map entries\n"
8085 "Metric for redistributed routes\n"
8086 "Default metric\n")
8087{
8088 int type;
8089 u_int32_t metric;
8090
8091 type = bgp_str2route_type (AFI_IP, argv[0]);
8092 if (! type)
8093 {
8094 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8095 return CMD_WARNING;
8096 }
8097 VTY_GET_INTEGER ("metric", metric, argv[2]);
8098
8099 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8100 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8101 return bgp_redistribute_set (vty->index, AFI_IP, type);
8102}
8103
8104DEFUN (bgp_redistribute_ipv4_metric_rmap,
8105 bgp_redistribute_ipv4_metric_rmap_cmd,
8106 "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
8107 "Redistribute information from another routing protocol\n"
8108 "Connected\n"
8109 "Kernel routes\n"
8110 "Open Shurtest Path First (OSPF)\n"
8111 "Routing Information Protocol (RIP)\n"
8112 "Static routes\n"
8113 "Metric for redistributed routes\n"
8114 "Default metric\n"
8115 "Route map reference\n"
8116 "Pointer to route-map entries\n")
8117{
8118 int type;
8119 u_int32_t metric;
8120
8121 type = bgp_str2route_type (AFI_IP, argv[0]);
8122 if (! type)
8123 {
8124 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8125 return CMD_WARNING;
8126 }
8127 VTY_GET_INTEGER ("metric", metric, argv[1]);
8128
8129 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8130 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
8131 return bgp_redistribute_set (vty->index, AFI_IP, type);
8132}
8133
8134DEFUN (no_bgp_redistribute_ipv4,
8135 no_bgp_redistribute_ipv4_cmd,
8136 "no redistribute (connected|kernel|ospf|rip|static)",
8137 NO_STR
8138 "Redistribute information from another routing protocol\n"
8139 "Connected\n"
8140 "Kernel routes\n"
8141 "Open Shurtest Path First (OSPF)\n"
8142 "Routing Information Protocol (RIP)\n"
8143 "Static routes\n")
8144{
8145 int type;
8146
8147 type = bgp_str2route_type (AFI_IP, argv[0]);
8148 if (! type)
8149 {
8150 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8151 return CMD_WARNING;
8152 }
8153
8154 return bgp_redistribute_unset (vty->index, AFI_IP, type);
8155}
8156
8157DEFUN (no_bgp_redistribute_ipv4_rmap,
8158 no_bgp_redistribute_ipv4_rmap_cmd,
8159 "no redistribute (connected|kernel|ospf|rip|static) route-map WORD",
8160 NO_STR
8161 "Redistribute information from another routing protocol\n"
8162 "Connected\n"
8163 "Kernel routes\n"
8164 "Open Shurtest Path First (OSPF)\n"
8165 "Routing Information Protocol (RIP)\n"
8166 "Static routes\n"
8167 "Route map reference\n"
8168 "Pointer to route-map entries\n")
8169{
8170 int type;
8171
8172 type = bgp_str2route_type (AFI_IP, argv[0]);
8173 if (! type)
8174 {
8175 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8176 return CMD_WARNING;
8177 }
8178
8179 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8180 return CMD_SUCCESS;
8181}
8182
8183DEFUN (no_bgp_redistribute_ipv4_metric,
8184 no_bgp_redistribute_ipv4_metric_cmd,
8185 "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
8186 NO_STR
8187 "Redistribute information from another routing protocol\n"
8188 "Connected\n"
8189 "Kernel routes\n"
8190 "Open Shurtest Path First (OSPF)\n"
8191 "Routing Information Protocol (RIP)\n"
8192 "Static routes\n"
8193 "Metric for redistributed routes\n"
8194 "Default metric\n")
8195{
8196 int type;
8197
8198 type = bgp_str2route_type (AFI_IP, argv[0]);
8199 if (! type)
8200 {
8201 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8202 return CMD_WARNING;
8203 }
8204
8205 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8206 return CMD_SUCCESS;
8207}
8208
8209DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
8210 no_bgp_redistribute_ipv4_rmap_metric_cmd,
8211 "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
8212 NO_STR
8213 "Redistribute information from another routing protocol\n"
8214 "Connected\n"
8215 "Kernel routes\n"
8216 "Open Shurtest Path First (OSPF)\n"
8217 "Routing Information Protocol (RIP)\n"
8218 "Static routes\n"
8219 "Route map reference\n"
8220 "Pointer to route-map entries\n"
8221 "Metric for redistributed routes\n"
8222 "Default metric\n")
8223{
8224 int type;
8225
8226 type = bgp_str2route_type (AFI_IP, argv[0]);
8227 if (! type)
8228 {
8229 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8230 return CMD_WARNING;
8231 }
8232
8233 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8234 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8235 return CMD_SUCCESS;
8236}
8237
8238ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
8239 no_bgp_redistribute_ipv4_metric_rmap_cmd,
8240 "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
8241 NO_STR
8242 "Redistribute information from another routing protocol\n"
8243 "Connected\n"
8244 "Kernel routes\n"
8245 "Open Shurtest Path First (OSPF)\n"
8246 "Routing Information Protocol (RIP)\n"
8247 "Static routes\n"
8248 "Metric for redistributed routes\n"
8249 "Default metric\n"
8250 "Route map reference\n"
8251 "Pointer to route-map entries\n")
8252
8253#ifdef HAVE_IPV6
8254DEFUN (bgp_redistribute_ipv6,
8255 bgp_redistribute_ipv6_cmd,
8256 "redistribute (connected|kernel|ospf6|ripng|static)",
8257 "Redistribute information from another routing protocol\n"
8258 "Connected\n"
8259 "Kernel routes\n"
8260 "Open Shurtest Path First (OSPFv3)\n"
8261 "Routing Information Protocol (RIPng)\n"
8262 "Static routes\n")
8263{
8264 int type;
8265
8266 type = bgp_str2route_type (AFI_IP6, argv[0]);
8267 if (! type)
8268 {
8269 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8270 return CMD_WARNING;
8271 }
8272
8273 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8274}
8275
8276DEFUN (bgp_redistribute_ipv6_rmap,
8277 bgp_redistribute_ipv6_rmap_cmd,
8278 "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
8279 "Redistribute information from another routing protocol\n"
8280 "Connected\n"
8281 "Kernel routes\n"
8282 "Open Shurtest Path First (OSPFv3)\n"
8283 "Routing Information Protocol (RIPng)\n"
8284 "Static routes\n"
8285 "Route map reference\n"
8286 "Pointer to route-map entries\n")
8287{
8288 int type;
8289
8290 type = bgp_str2route_type (AFI_IP6, argv[0]);
8291 if (! type)
8292 {
8293 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8294 return CMD_WARNING;
8295 }
8296
8297 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8298 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8299}
8300
8301DEFUN (bgp_redistribute_ipv6_metric,
8302 bgp_redistribute_ipv6_metric_cmd,
8303 "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
8304 "Redistribute information from another routing protocol\n"
8305 "Connected\n"
8306 "Kernel routes\n"
8307 "Open Shurtest Path First (OSPFv3)\n"
8308 "Routing Information Protocol (RIPng)\n"
8309 "Static routes\n"
8310 "Metric for redistributed routes\n"
8311 "Default metric\n")
8312{
8313 int type;
8314 u_int32_t metric;
8315
8316 type = bgp_str2route_type (AFI_IP6, argv[0]);
8317 if (! type)
8318 {
8319 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8320 return CMD_WARNING;
8321 }
8322 VTY_GET_INTEGER ("metric", metric, argv[1]);
8323
8324 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8325 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8326}
8327
8328DEFUN (bgp_redistribute_ipv6_rmap_metric,
8329 bgp_redistribute_ipv6_rmap_metric_cmd,
8330 "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
8331 "Redistribute information from another routing protocol\n"
8332 "Connected\n"
8333 "Kernel routes\n"
8334 "Open Shurtest Path First (OSPFv3)\n"
8335 "Routing Information Protocol (RIPng)\n"
8336 "Static routes\n"
8337 "Route map reference\n"
8338 "Pointer to route-map entries\n"
8339 "Metric for redistributed routes\n"
8340 "Default metric\n")
8341{
8342 int type;
8343 u_int32_t metric;
8344
8345 type = bgp_str2route_type (AFI_IP6, argv[0]);
8346 if (! type)
8347 {
8348 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8349 return CMD_WARNING;
8350 }
8351 VTY_GET_INTEGER ("metric", metric, argv[2]);
8352
8353 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8354 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8355 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8356}
8357
8358DEFUN (bgp_redistribute_ipv6_metric_rmap,
8359 bgp_redistribute_ipv6_metric_rmap_cmd,
8360 "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
8361 "Redistribute information from another routing protocol\n"
8362 "Connected\n"
8363 "Kernel routes\n"
8364 "Open Shurtest Path First (OSPFv3)\n"
8365 "Routing Information Protocol (RIPng)\n"
8366 "Static routes\n"
8367 "Metric for redistributed routes\n"
8368 "Default metric\n"
8369 "Route map reference\n"
8370 "Pointer to route-map entries\n")
8371{
8372 int type;
8373 u_int32_t metric;
8374
8375 type = bgp_str2route_type (AFI_IP6, argv[0]);
8376 if (! type)
8377 {
8378 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8379 return CMD_WARNING;
8380 }
8381 VTY_GET_INTEGER ("metric", metric, argv[1]);
8382
8383 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8384 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
8385 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8386}
8387
8388DEFUN (no_bgp_redistribute_ipv6,
8389 no_bgp_redistribute_ipv6_cmd,
8390 "no redistribute (connected|kernel|ospf6|ripng|static)",
8391 NO_STR
8392 "Redistribute information from another routing protocol\n"
8393 "Connected\n"
8394 "Kernel routes\n"
8395 "Open Shurtest Path First (OSPFv3)\n"
8396 "Routing Information Protocol (RIPng)\n"
8397 "Static routes\n")
8398{
8399 int type;
8400
8401 type = bgp_str2route_type (AFI_IP6, argv[0]);
8402 if (! type)
8403 {
8404 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8405 return CMD_WARNING;
8406 }
8407
8408 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
8409}
8410
8411DEFUN (no_bgp_redistribute_ipv6_rmap,
8412 no_bgp_redistribute_ipv6_rmap_cmd,
8413 "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
8414 NO_STR
8415 "Redistribute information from another routing protocol\n"
8416 "Connected\n"
8417 "Kernel routes\n"
8418 "Open Shurtest Path First (OSPFv3)\n"
8419 "Routing Information Protocol (RIPng)\n"
8420 "Static routes\n"
8421 "Route map reference\n"
8422 "Pointer to route-map entries\n")
8423{
8424 int type;
8425
8426 type = bgp_str2route_type (AFI_IP6, argv[0]);
8427 if (! type)
8428 {
8429 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8430 return CMD_WARNING;
8431 }
8432
8433 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8434 return CMD_SUCCESS;
8435}
8436
8437DEFUN (no_bgp_redistribute_ipv6_metric,
8438 no_bgp_redistribute_ipv6_metric_cmd,
8439 "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
8440 NO_STR
8441 "Redistribute information from another routing protocol\n"
8442 "Connected\n"
8443 "Kernel routes\n"
8444 "Open Shurtest Path First (OSPFv3)\n"
8445 "Routing Information Protocol (RIPng)\n"
8446 "Static routes\n"
8447 "Metric for redistributed routes\n"
8448 "Default metric\n")
8449{
8450 int type;
8451
8452 type = bgp_str2route_type (AFI_IP6, argv[0]);
8453 if (! type)
8454 {
8455 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8456 return CMD_WARNING;
8457 }
8458
8459 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8460 return CMD_SUCCESS;
8461}
8462
8463DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
8464 no_bgp_redistribute_ipv6_rmap_metric_cmd,
8465 "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
8466 NO_STR
8467 "Redistribute information from another routing protocol\n"
8468 "Connected\n"
8469 "Kernel routes\n"
8470 "Open Shurtest Path First (OSPFv3)\n"
8471 "Routing Information Protocol (RIPng)\n"
8472 "Static routes\n"
8473 "Route map reference\n"
8474 "Pointer to route-map entries\n"
8475 "Metric for redistributed routes\n"
8476 "Default metric\n")
8477{
8478 int type;
8479
8480 type = bgp_str2route_type (AFI_IP6, argv[0]);
8481 if (! type)
8482 {
8483 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8484 return CMD_WARNING;
8485 }
8486
8487 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8488 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8489 return CMD_SUCCESS;
8490}
8491
8492ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
8493 no_bgp_redistribute_ipv6_metric_rmap_cmd,
8494 "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
8495 NO_STR
8496 "Redistribute information from another routing protocol\n"
8497 "Connected\n"
8498 "Kernel routes\n"
8499 "Open Shurtest Path First (OSPFv3)\n"
8500 "Routing Information Protocol (RIPng)\n"
8501 "Static routes\n"
8502 "Metric for redistributed routes\n"
8503 "Default metric\n"
8504 "Route map reference\n"
8505 "Pointer to route-map entries\n")
8506#endif /* HAVE_IPV6 */
8507
8508int
8509bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
8510 safi_t safi, int *write)
8511{
8512 int i;
paulfd79ac92004-10-13 05:06:08 +00008513 const char *str[] = { "system", "kernel", "connected", "static", "rip",
hasso66e31692004-03-20 19:33:06 +00008514 "ripng", "ospf", "ospf6", "isis", "bgp"};
paul718e3742002-12-13 20:15:29 +00008515
8516 /* Unicast redistribution only. */
8517 if (safi != SAFI_UNICAST)
8518 return 0;
8519
8520 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
8521 {
8522 /* Redistribute BGP does not make sense. */
8523 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
8524 {
8525 /* Display "address-family" when it is not yet diplayed. */
8526 bgp_config_write_family_header (vty, afi, safi, write);
8527
8528 /* "redistribute" configuration. */
8529 vty_out (vty, " redistribute %s", str[i]);
8530
8531 if (bgp->redist_metric_flag[afi][i])
8532 vty_out (vty, " metric %d", bgp->redist_metric[afi][i]);
8533
8534 if (bgp->rmap[afi][i].name)
8535 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
8536
8537 vty_out (vty, "%s", VTY_NEWLINE);
8538 }
8539 }
8540 return *write;
8541}
8542
8543/* BGP node structure. */
8544struct cmd_node bgp_node =
8545{
8546 BGP_NODE,
8547 "%s(config-router)# ",
8548 1,
8549};
8550
8551struct cmd_node bgp_ipv4_unicast_node =
8552{
8553 BGP_IPV4_NODE,
8554 "%s(config-router-af)# ",
8555 1,
8556};
8557
8558struct cmd_node bgp_ipv4_multicast_node =
8559{
8560 BGP_IPV4M_NODE,
8561 "%s(config-router-af)# ",
8562 1,
8563};
8564
8565struct cmd_node bgp_ipv6_unicast_node =
8566{
8567 BGP_IPV6_NODE,
8568 "%s(config-router-af)# ",
8569 1,
8570};
8571
paul25ffbdc2005-08-22 22:42:08 +00008572struct cmd_node bgp_ipv6_multicast_node =
8573{
8574 BGP_IPV6M_NODE,
8575 "%s(config-router-af)# ",
8576 1,
8577};
8578
paul718e3742002-12-13 20:15:29 +00008579struct cmd_node bgp_vpnv4_node =
8580{
8581 BGP_VPNV4_NODE,
8582 "%s(config-router-af)# ",
8583 1
8584};
8585
paul1f8ae702005-09-09 23:49:49 +00008586static void community_list_vty (void);
8587
paul718e3742002-12-13 20:15:29 +00008588void
paul94f2b392005-06-28 12:44:16 +00008589bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00008590{
paul718e3742002-12-13 20:15:29 +00008591 /* Install bgp top node. */
8592 install_node (&bgp_node, bgp_config_write);
8593 install_node (&bgp_ipv4_unicast_node, NULL);
8594 install_node (&bgp_ipv4_multicast_node, NULL);
8595 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00008596 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00008597 install_node (&bgp_vpnv4_node, NULL);
8598
8599 /* Install default VTY commands to new nodes. */
8600 install_default (BGP_NODE);
8601 install_default (BGP_IPV4_NODE);
8602 install_default (BGP_IPV4M_NODE);
8603 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00008604 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00008605 install_default (BGP_VPNV4_NODE);
8606
8607 /* "bgp multiple-instance" commands. */
8608 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
8609 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
8610
8611 /* "bgp config-type" commands. */
8612 install_element (CONFIG_NODE, &bgp_config_type_cmd);
8613 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
8614
8615 /* Dummy commands (Currently not supported) */
8616 install_element (BGP_NODE, &no_synchronization_cmd);
8617 install_element (BGP_NODE, &no_auto_summary_cmd);
8618
8619 /* "router bgp" commands. */
8620 install_element (CONFIG_NODE, &router_bgp_cmd);
8621 install_element (CONFIG_NODE, &router_bgp_view_cmd);
8622
8623 /* "no router bgp" commands. */
8624 install_element (CONFIG_NODE, &no_router_bgp_cmd);
8625 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
8626
8627 /* "bgp router-id" commands. */
8628 install_element (BGP_NODE, &bgp_router_id_cmd);
8629 install_element (BGP_NODE, &no_bgp_router_id_cmd);
8630 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
8631
8632 /* "bgp cluster-id" commands. */
8633 install_element (BGP_NODE, &bgp_cluster_id_cmd);
8634 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
8635 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
8636 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
8637
8638 /* "bgp confederation" commands. */
8639 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
8640 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
8641 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
8642
8643 /* "bgp confederation peers" commands. */
8644 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
8645 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
8646
8647 /* "timers bgp" commands. */
8648 install_element (BGP_NODE, &bgp_timers_cmd);
8649 install_element (BGP_NODE, &no_bgp_timers_cmd);
8650 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
8651
8652 /* "bgp client-to-client reflection" commands */
8653 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
8654 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
8655
8656 /* "bgp always-compare-med" commands */
8657 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
8658 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
8659
8660 /* "bgp deterministic-med" commands */
8661 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
8662 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00008663
hasso538621f2004-05-21 09:31:30 +00008664 /* "bgp graceful-restart" commands */
8665 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
8666 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00008667 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
8668 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
8669 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00008670
8671 /* "bgp fast-external-failover" commands */
8672 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
8673 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
8674
8675 /* "bgp enforce-first-as" commands */
8676 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
8677 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
8678
8679 /* "bgp bestpath compare-routerid" commands */
8680 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
8681 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
8682
8683 /* "bgp bestpath as-path ignore" commands */
8684 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
8685 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
8686
hasso68118452005-04-08 15:40:36 +00008687 /* "bgp bestpath as-path confed" commands */
8688 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
8689 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
8690
paul848973c2003-08-13 00:32:49 +00008691 /* "bgp log-neighbor-changes" commands */
8692 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
8693 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
8694
paul718e3742002-12-13 20:15:29 +00008695 /* "bgp bestpath med" commands */
8696 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
8697 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
8698 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
8699 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
8700 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
8701 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
8702
8703 /* "no bgp default ipv4-unicast" commands. */
8704 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
8705 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
8706
8707 /* "bgp network import-check" commands. */
8708 install_element (BGP_NODE, &bgp_network_import_check_cmd);
8709 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
8710
8711 /* "bgp default local-preference" commands. */
8712 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
8713 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
8714 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
8715
8716 /* "neighbor remote-as" commands. */
8717 install_element (BGP_NODE, &neighbor_remote_as_cmd);
8718 install_element (BGP_NODE, &no_neighbor_cmd);
8719 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
8720
8721 /* "neighbor peer-group" commands. */
8722 install_element (BGP_NODE, &neighbor_peer_group_cmd);
8723 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
8724 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
8725
8726 /* "neighbor local-as" commands. */
8727 install_element (BGP_NODE, &neighbor_local_as_cmd);
8728 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
8729 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
8730 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
8731 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
8732
8733 /* "neighbor activate" commands. */
8734 install_element (BGP_NODE, &neighbor_activate_cmd);
8735 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
8736 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
8737 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008738 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00008739 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
8740
8741 /* "no neighbor activate" commands. */
8742 install_element (BGP_NODE, &no_neighbor_activate_cmd);
8743 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
8744 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
8745 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008746 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00008747 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
8748
8749 /* "neighbor peer-group set" commands. */
8750 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
8751 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
8752 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
8753 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008754 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00008755 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
8756
paul718e3742002-12-13 20:15:29 +00008757 /* "no neighbor peer-group unset" commands. */
8758 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
8759 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
8760 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
8761 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008762 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00008763 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
8764
paul718e3742002-12-13 20:15:29 +00008765 /* "neighbor softreconfiguration inbound" commands.*/
8766 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
8767 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
8768 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
8769 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
8770 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
8771 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
8772 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
8773 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008774 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
8775 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +00008776 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
8777 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +00008778
8779 /* "neighbor attribute-unchanged" commands. */
8780 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
8781 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
8782 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
8783 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
8784 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
8785 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
8786 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
8787 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
8788 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
8789 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
8790 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
8791 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
8792 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
8793 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
8794 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
8795 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
8796 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
8797 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
8798 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
8799 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
8800 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
8801 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
8802 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
8803 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
8804 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
8805 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
8806 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
8807 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
8808 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
8809 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
8810 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
8811 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
8812 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
8813 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
8814 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
8815 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
8816 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
8817 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
8818 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
8819 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
8820 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
8821 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
8822 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
8823 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
8824 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
8825 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
8826 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
8827 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
8828 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
8829 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
8830 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
8831 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
8832 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
8833 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
8834 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
8835 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
8836 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
8837 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
8838 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
8839 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
8840 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
8841 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
8842 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
8843 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
8844 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
8845 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
8846 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
8847 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
8848 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
8849 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
8850 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
8851 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
8852 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
8853 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
8854 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
8855 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
8856 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
8857 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
8858 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
8859 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
8860 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
8861 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
8862 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
8863 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
8864 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
8865 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
8866 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
8867 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008868 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
8869 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
8870 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
8871 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
8872 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
8873 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
8874 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
8875 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
8876 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
8877 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
8878 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
8879 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
8880 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
8881 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
8882 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
8883 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
8884 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
8885 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
8886 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
8887 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
8888 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
8889 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +00008890 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
8891 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
8892 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
8893 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
8894 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
8895 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
8896 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
8897 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
8898 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
8899 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
8900 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
8901 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
8902 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
8903 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
8904 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
8905 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
8906 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
8907 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
8908 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
8909 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
8910 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
8911 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
8912
paulfee0f4c2004-09-13 05:12:46 +00008913 /* "nexthop-local unchanged" commands */
8914 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
8915 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
8916
paul718e3742002-12-13 20:15:29 +00008917 /* "transparent-as" and "transparent-nexthop" for old version
8918 compatibility. */
8919 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
8920 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
8921
8922 /* "neighbor next-hop-self" commands. */
8923 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
8924 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
8925 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
8926 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
8927 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
8928 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
8929 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
8930 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008931 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
8932 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00008933 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
8934 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
8935
8936 /* "neighbor remove-private-AS" commands. */
8937 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
8938 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
8939 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
8940 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
8941 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
8942 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
8943 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
8944 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008945 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
8946 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00008947 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
8948 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
8949
8950 /* "neighbor send-community" commands.*/
8951 install_element (BGP_NODE, &neighbor_send_community_cmd);
8952 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
8953 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
8954 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
8955 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
8956 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
8957 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
8958 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
8959 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
8960 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
8961 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
8962 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
8963 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
8964 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
8965 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
8966 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008967 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
8968 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
8969 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
8970 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00008971 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
8972 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
8973 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
8974 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
8975
8976 /* "neighbor route-reflector" commands.*/
8977 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
8978 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
8979 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
8980 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
8981 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
8982 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
8983 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
8984 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008985 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
8986 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +00008987 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
8988 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
8989
8990 /* "neighbor route-server" commands.*/
8991 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
8992 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
8993 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
8994 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
8995 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
8996 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
8997 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
8998 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008999 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
9000 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +00009001 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
9002 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
9003
9004 /* "neighbor passive" commands. */
9005 install_element (BGP_NODE, &neighbor_passive_cmd);
9006 install_element (BGP_NODE, &no_neighbor_passive_cmd);
9007
9008 /* "neighbor shutdown" commands. */
9009 install_element (BGP_NODE, &neighbor_shutdown_cmd);
9010 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
9011
hassoc9502432005-02-01 22:01:48 +00009012 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +00009013 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
9014 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
9015
9016 /* "neighbor capability orf prefix-list" commands.*/
9017 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
9018 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
9019 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
9020 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
9021 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
9022 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
9023 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
9024 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009025 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
9026 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +00009027
9028 /* "neighbor capability dynamic" commands.*/
9029 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
9030 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
9031
9032 /* "neighbor dont-capability-negotiate" commands. */
9033 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
9034 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
9035
9036 /* "neighbor ebgp-multihop" commands. */
9037 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
9038 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
9039 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
9040 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
9041
hasso6ffd2072005-02-02 14:50:11 +00009042 /* "neighbor disable-connected-check" commands. */
9043 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
9044 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +00009045 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
9046 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
9047
9048 /* "neighbor description" commands. */
9049 install_element (BGP_NODE, &neighbor_description_cmd);
9050 install_element (BGP_NODE, &no_neighbor_description_cmd);
9051 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
9052
9053 /* "neighbor update-source" commands. "*/
9054 install_element (BGP_NODE, &neighbor_update_source_cmd);
9055 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
9056
9057 /* "neighbor default-originate" commands. */
9058 install_element (BGP_NODE, &neighbor_default_originate_cmd);
9059 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
9060 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
9061 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
9062 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
9063 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
9064 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
9065 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
9066 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
9067 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
9068 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
9069 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
9070 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
9071 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
9072 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
9073 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009074 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
9075 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
9076 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
9077 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +00009078
9079 /* "neighbor port" commands. */
9080 install_element (BGP_NODE, &neighbor_port_cmd);
9081 install_element (BGP_NODE, &no_neighbor_port_cmd);
9082 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
9083
9084 /* "neighbor weight" commands. */
9085 install_element (BGP_NODE, &neighbor_weight_cmd);
9086 install_element (BGP_NODE, &no_neighbor_weight_cmd);
9087 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
9088
9089 /* "neighbor override-capability" commands. */
9090 install_element (BGP_NODE, &neighbor_override_capability_cmd);
9091 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
9092
9093 /* "neighbor strict-capability-match" commands. */
9094 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
9095 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
9096
9097 /* "neighbor timers" commands. */
9098 install_element (BGP_NODE, &neighbor_timers_cmd);
9099 install_element (BGP_NODE, &no_neighbor_timers_cmd);
9100
9101 /* "neighbor timers connect" commands. */
9102 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
9103 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
9104 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
9105
9106 /* "neighbor advertisement-interval" commands. */
9107 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
9108 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
9109 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
9110
9111 /* "neighbor version" commands. */
9112 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +00009113
9114 /* "neighbor interface" commands. */
9115 install_element (BGP_NODE, &neighbor_interface_cmd);
9116 install_element (BGP_NODE, &no_neighbor_interface_cmd);
9117
9118 /* "neighbor distribute" commands. */
9119 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
9120 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
9121 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
9122 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
9123 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
9124 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
9125 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
9126 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009127 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
9128 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +00009129 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
9130 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
9131
9132 /* "neighbor prefix-list" commands. */
9133 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
9134 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
9135 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
9136 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
9137 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
9138 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
9139 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
9140 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009141 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
9142 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +00009143 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
9144 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
9145
9146 /* "neighbor filter-list" commands. */
9147 install_element (BGP_NODE, &neighbor_filter_list_cmd);
9148 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
9149 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
9150 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
9151 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
9152 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
9153 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
9154 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009155 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
9156 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +00009157 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
9158 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
9159
9160 /* "neighbor route-map" commands. */
9161 install_element (BGP_NODE, &neighbor_route_map_cmd);
9162 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
9163 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
9164 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
9165 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
9166 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
9167 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
9168 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009169 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
9170 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +00009171 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
9172 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
9173
9174 /* "neighbor unsuppress-map" commands. */
9175 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
9176 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
9177 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
9178 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
9179 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
9180 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
9181 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
9182 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009183 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
9184 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +00009185 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
9186 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +00009187
9188 /* "neighbor maximum-prefix" commands. */
9189 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009190 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009191 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009192 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009193 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
9194 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009195 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
9196 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009197 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9198 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9199 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9200 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9201 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009202 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009203 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009204 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009205 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009206 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9207 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009208 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
9209 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009210 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9211 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9212 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9213 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9214 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009215 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009216 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009217 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009218 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009219 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
9220 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009221 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
9222 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009223 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9224 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9225 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9226 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9227 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009228 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009229 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009230 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009231 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009232 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
9233 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009234 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
9235 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009236 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9237 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9238 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9239 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9240 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009241 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
9242 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
9243 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
9244 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9245 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
9246 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9247 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
9248 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
9249 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9250 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9251 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9252 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9253 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009254 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009255 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009256 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009257 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009258 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9259 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009260 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
9261 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009262 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9263 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9264 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9265 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9266 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009267
9268 /* "neighbor allowas-in" */
9269 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
9270 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
9271 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
9272 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
9273 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
9274 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
9275 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
9276 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
9277 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
9278 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
9279 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
9280 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009281 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
9282 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
9283 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +00009284 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
9285 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
9286 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
9287
9288 /* address-family commands. */
9289 install_element (BGP_NODE, &address_family_ipv4_cmd);
9290 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
9291#ifdef HAVE_IPV6
9292 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009293 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +00009294#endif /* HAVE_IPV6 */
9295 install_element (BGP_NODE, &address_family_vpnv4_cmd);
9296 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
9297
9298 /* "exit-address-family" command. */
9299 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
9300 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
9301 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009302 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +00009303 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
9304
9305 /* "clear ip bgp commands" */
9306 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
9307 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
9308 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
9309 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
9310 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
9311 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
9312#ifdef HAVE_IPV6
9313 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
9314 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
9315 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
9316 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
9317 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
9318 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
9319 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
9320 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
9321 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
9322 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
9323 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
9324#endif /* HAVE_IPV6 */
9325
9326 /* "clear ip bgp neighbor soft in" */
9327 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
9328 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
9329 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
9330 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
9331 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
9332 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
9333 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
9334 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
9335 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
9336 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
9337 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
9338 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
9339 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
9340 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
9341 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
9342 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
9343 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
9344 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
9345 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
9346 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
9347 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
9348 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
9349 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
9350 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
9351 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
9352 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
9353 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
9354 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
9355 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
9356 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
9357 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
9358 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
9359 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
9360 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
9361 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
9362 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
9363 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
9364 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
9365 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
9366 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
9367#ifdef HAVE_IPV6
9368 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
9369 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
9370 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
9371 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
9372 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
9373 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
9374 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
9375 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
9376 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
9377 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
9378 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
9379 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
9380 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
9381 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
9382 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
9383 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
9384 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
9385 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
9386 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
9387 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
9388 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
9389 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
9390 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
9391 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
9392 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
9393 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
9394 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
9395 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
9396 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
9397 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
9398 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
9399#endif /* HAVE_IPV6 */
9400
9401 /* "clear ip bgp neighbor soft out" */
9402 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
9403 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
9404 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
9405 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
9406 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
9407 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
9408 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
9409 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
9410 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
9411 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
9412 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
9413 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
9414 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
9415 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
9416 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
9417 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
9418 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
9419 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
9420 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
9421 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
9422 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
9423 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
9424 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
9425 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
9426 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
9427 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
9428 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
9429 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
9430#ifdef HAVE_IPV6
9431 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
9432 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
9433 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
9434 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
9435 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
9436 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
9437 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
9438 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
9439 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
9440 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
9441 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
9442 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
9443 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
9444 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
9445 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
9446 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
9447 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
9448 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
9449 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
9450 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
9451 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
9452#endif /* HAVE_IPV6 */
9453
9454 /* "clear ip bgp neighbor soft" */
9455 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
9456 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
9457 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
9458 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
9459 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
9460 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
9461 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
9462 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
9463 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
9464 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
9465 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
9466 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
9467 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
9468 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
9469 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
9470#ifdef HAVE_IPV6
9471 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
9472 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
9473 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
9474 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
9475 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
9476 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
9477 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
9478 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
9479 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
9480 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
9481 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
9482#endif /* HAVE_IPV6 */
9483
paulfee0f4c2004-09-13 05:12:46 +00009484 /* "clear ip bgp neighbor rsclient" */
9485 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
9486 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
9487 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
9488 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
9489#ifdef HAVE_IPV6
9490 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
9491 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
9492 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
9493 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
9494 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
9495 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
9496 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
9497 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
9498#endif /* HAVE_IPV6 */
9499
paul718e3742002-12-13 20:15:29 +00009500 /* "show ip bgp summary" commands. */
9501 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
9502 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
9503 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
9504 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
9505 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9506 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9507#ifdef HAVE_IPV6
9508 install_element (VIEW_NODE, &show_bgp_summary_cmd);
9509 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
9510 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
9511 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
9512#endif /* HAVE_IPV6 */
9513 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
9514 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
9515 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
9516 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
9517 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9518 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9519#ifdef HAVE_IPV6
9520 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
9521 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
9522 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
9523 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
9524#endif /* HAVE_IPV6 */
9525
9526 /* "show ip bgp neighbors" commands. */
9527 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
9528 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
9529 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
9530 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
9531 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
9532 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
9533 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
9534 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
9535 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
9536 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
9537 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
9538 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
9539 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
9540 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
9541 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
9542 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
9543 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
9544 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
9545 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
9546 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
9547
9548#ifdef HAVE_IPV6
9549 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
9550 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
9551 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
9552 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +00009553 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
9554 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
9555 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
9556 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +00009557 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
9558 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
9559 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
9560 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +00009561 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
9562 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
9563 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
9564 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +00009565
9566 /* Old commands. */
9567 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
9568 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
9569 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
9570 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
9571#endif /* HAVE_IPV6 */
9572
paulfee0f4c2004-09-13 05:12:46 +00009573 /* "show ip bgp rsclient" commands. */
9574 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
9575 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
9576 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
9577 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
9578 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
9579 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
9580 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
9581 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
9582
9583#ifdef HAVE_IPV6
9584 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
9585 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
9586 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
9587 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
9588 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
9589 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
9590 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
9591 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
9592#endif /* HAVE_IPV6 */
9593
paul718e3742002-12-13 20:15:29 +00009594 /* "show ip bgp paths" commands. */
9595 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
9596 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
9597 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
9598 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
9599
9600 /* "show ip bgp community" commands. */
9601 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
9602 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
9603
9604 /* "show ip bgp attribute-info" commands. */
9605 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
9606 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
9607
9608 /* "redistribute" commands. */
9609 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
9610 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
9611 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
9612 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
9613 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
9614 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
9615 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
9616 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
9617 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
9618 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
9619#ifdef HAVE_IPV6
9620 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
9621 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
9622 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
9623 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
9624 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
9625 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
9626 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
9627 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
9628 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
9629 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
9630#endif /* HAVE_IPV6 */
9631
9632 /* Community-list. */
9633 community_list_vty ();
9634}
9635
9636#include "memory.h"
9637#include "bgp_regex.h"
9638#include "bgp_clist.h"
9639#include "bgp_ecommunity.h"
9640
9641/* VTY functions. */
9642
9643/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +00009644static const char *
paul718e3742002-12-13 20:15:29 +00009645community_direct_str (int direct)
9646{
9647 switch (direct)
9648 {
9649 case COMMUNITY_DENY:
9650 return "deny";
9651 break;
9652 case COMMUNITY_PERMIT:
9653 return "permit";
9654 break;
9655 default:
9656 return "unknown";
9657 break;
9658 }
9659}
9660
9661/* Display error string. */
paul94f2b392005-06-28 12:44:16 +00009662static void
paul718e3742002-12-13 20:15:29 +00009663community_list_perror (struct vty *vty, int ret)
9664{
9665 switch (ret)
9666 {
9667 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
9668 vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE);
9669 break;
9670 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
9671 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
9672 break;
9673 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
9674 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
9675 break;
9676 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
9677 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
9678 break;
9679 }
9680}
9681
9682/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +00009683static int
paulfd79ac92004-10-13 05:06:08 +00009684community_list_set_vty (struct vty *vty, int argc, const char **argv,
9685 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +00009686{
9687 int ret;
9688 int direct;
9689 char *str;
9690
9691 /* Check the list type. */
9692 if (strncmp (argv[1], "p", 1) == 0)
9693 direct = COMMUNITY_PERMIT;
9694 else if (strncmp (argv[1], "d", 1) == 0)
9695 direct = COMMUNITY_DENY;
9696 else
9697 {
9698 vty_out (vty, "%% Matching condition must be permit or deny%s",
9699 VTY_NEWLINE);
9700 return CMD_WARNING;
9701 }
9702
9703 /* All digit name check. */
9704 if (reject_all_digit_name && all_digit (argv[0]))
9705 {
9706 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
9707 return CMD_WARNING;
9708 }
9709
9710 /* Concat community string argument. */
9711 if (argc > 1)
9712 str = argv_concat (argv, argc, 2);
9713 else
9714 str = NULL;
9715
9716 /* When community_list_set() return nevetive value, it means
9717 malformed community string. */
9718 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
9719
9720 /* Free temporary community list string allocated by
9721 argv_concat(). */
9722 if (str)
9723 XFREE (MTYPE_TMP, str);
9724
9725 if (ret < 0)
9726 {
9727 /* Display error string. */
9728 community_list_perror (vty, ret);
9729 return CMD_WARNING;
9730 }
9731
9732 return CMD_SUCCESS;
9733}
9734
paul718e3742002-12-13 20:15:29 +00009735/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +00009736static int
hassofee6e4e2005-02-02 16:29:31 +00009737community_list_unset_vty (struct vty *vty, int argc, const char **argv,
9738 int style)
paul718e3742002-12-13 20:15:29 +00009739{
9740 int ret;
hassofee6e4e2005-02-02 16:29:31 +00009741 int direct = 0;
9742 char *str = NULL;
paul718e3742002-12-13 20:15:29 +00009743
hassofee6e4e2005-02-02 16:29:31 +00009744 if (argc > 1)
paul718e3742002-12-13 20:15:29 +00009745 {
hassofee6e4e2005-02-02 16:29:31 +00009746 /* Check the list direct. */
9747 if (strncmp (argv[1], "p", 1) == 0)
9748 direct = COMMUNITY_PERMIT;
9749 else if (strncmp (argv[1], "d", 1) == 0)
9750 direct = COMMUNITY_DENY;
9751 else
9752 {
9753 vty_out (vty, "%% Matching condition must be permit or deny%s",
9754 VTY_NEWLINE);
9755 return CMD_WARNING;
9756 }
paul718e3742002-12-13 20:15:29 +00009757
hassofee6e4e2005-02-02 16:29:31 +00009758 /* Concat community string argument. */
9759 str = argv_concat (argv, argc, 2);
9760 }
paul718e3742002-12-13 20:15:29 +00009761
9762 /* Unset community list. */
9763 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
9764
9765 /* Free temporary community list string allocated by
9766 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +00009767 if (str)
9768 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00009769
9770 if (ret < 0)
9771 {
9772 community_list_perror (vty, ret);
9773 return CMD_WARNING;
9774 }
9775
9776 return CMD_SUCCESS;
9777}
9778
9779/* "community-list" keyword help string. */
9780#define COMMUNITY_LIST_STR "Add a community list entry\n"
9781#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
9782
paul718e3742002-12-13 20:15:29 +00009783DEFUN (ip_community_list_standard,
9784 ip_community_list_standard_cmd,
9785 "ip community-list <1-99> (deny|permit) .AA:NN",
9786 IP_STR
9787 COMMUNITY_LIST_STR
9788 "Community list number (standard)\n"
9789 "Specify community to reject\n"
9790 "Specify community to accept\n"
9791 COMMUNITY_VAL_STR)
9792{
9793 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
9794}
9795
9796ALIAS (ip_community_list_standard,
9797 ip_community_list_standard2_cmd,
9798 "ip community-list <1-99> (deny|permit)",
9799 IP_STR
9800 COMMUNITY_LIST_STR
9801 "Community list number (standard)\n"
9802 "Specify community to reject\n"
9803 "Specify community to accept\n")
9804
9805DEFUN (ip_community_list_expanded,
9806 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +00009807 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +00009808 IP_STR
9809 COMMUNITY_LIST_STR
9810 "Community list number (expanded)\n"
9811 "Specify community to reject\n"
9812 "Specify community to accept\n"
9813 "An ordered list as a regular-expression\n")
9814{
9815 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
9816}
9817
9818DEFUN (ip_community_list_name_standard,
9819 ip_community_list_name_standard_cmd,
9820 "ip community-list standard WORD (deny|permit) .AA:NN",
9821 IP_STR
9822 COMMUNITY_LIST_STR
9823 "Add a standard community-list entry\n"
9824 "Community list name\n"
9825 "Specify community to reject\n"
9826 "Specify community to accept\n"
9827 COMMUNITY_VAL_STR)
9828{
9829 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
9830}
9831
9832ALIAS (ip_community_list_name_standard,
9833 ip_community_list_name_standard2_cmd,
9834 "ip community-list standard WORD (deny|permit)",
9835 IP_STR
9836 COMMUNITY_LIST_STR
9837 "Add a standard community-list entry\n"
9838 "Community list name\n"
9839 "Specify community to reject\n"
9840 "Specify community to accept\n")
9841
9842DEFUN (ip_community_list_name_expanded,
9843 ip_community_list_name_expanded_cmd,
9844 "ip community-list expanded WORD (deny|permit) .LINE",
9845 IP_STR
9846 COMMUNITY_LIST_STR
9847 "Add an expanded community-list entry\n"
9848 "Community list name\n"
9849 "Specify community to reject\n"
9850 "Specify community to accept\n"
9851 "An ordered list as a regular-expression\n")
9852{
9853 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
9854}
9855
hassofee6e4e2005-02-02 16:29:31 +00009856DEFUN (no_ip_community_list_standard_all,
9857 no_ip_community_list_standard_all_cmd,
9858 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +00009859 NO_STR
9860 IP_STR
9861 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +00009862 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +00009863{
hassofee6e4e2005-02-02 16:29:31 +00009864 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +00009865}
9866
hassofee6e4e2005-02-02 16:29:31 +00009867DEFUN (no_ip_community_list_expanded_all,
9868 no_ip_community_list_expanded_all_cmd,
9869 "no ip community-list <100-500>",
9870 NO_STR
9871 IP_STR
9872 COMMUNITY_LIST_STR
9873 "Community list number (expanded)\n")
9874{
9875 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
9876}
9877
9878DEFUN (no_ip_community_list_name_standard_all,
9879 no_ip_community_list_name_standard_all_cmd,
9880 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +00009881 NO_STR
9882 IP_STR
9883 COMMUNITY_LIST_STR
9884 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +00009885 "Community list name\n")
9886{
hassofee6e4e2005-02-02 16:29:31 +00009887 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +00009888}
9889
hassofee6e4e2005-02-02 16:29:31 +00009890DEFUN (no_ip_community_list_name_expanded_all,
9891 no_ip_community_list_name_expanded_all_cmd,
9892 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +00009893 NO_STR
9894 IP_STR
9895 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +00009896 "Add an expanded community-list entry\n"
9897 "Community list name\n")
paul718e3742002-12-13 20:15:29 +00009898{
hassofee6e4e2005-02-02 16:29:31 +00009899 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +00009900}
9901
9902DEFUN (no_ip_community_list_standard,
9903 no_ip_community_list_standard_cmd,
9904 "no ip community-list <1-99> (deny|permit) .AA:NN",
9905 NO_STR
9906 IP_STR
9907 COMMUNITY_LIST_STR
9908 "Community list number (standard)\n"
9909 "Specify community to reject\n"
9910 "Specify community to accept\n"
9911 COMMUNITY_VAL_STR)
9912{
9913 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
9914}
9915
9916DEFUN (no_ip_community_list_expanded,
9917 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +00009918 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +00009919 NO_STR
9920 IP_STR
9921 COMMUNITY_LIST_STR
9922 "Community list number (expanded)\n"
9923 "Specify community to reject\n"
9924 "Specify community to accept\n"
9925 "An ordered list as a regular-expression\n")
9926{
9927 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
9928}
9929
9930DEFUN (no_ip_community_list_name_standard,
9931 no_ip_community_list_name_standard_cmd,
9932 "no ip community-list standard WORD (deny|permit) .AA:NN",
9933 NO_STR
9934 IP_STR
9935 COMMUNITY_LIST_STR
9936 "Specify a standard community-list\n"
9937 "Community list name\n"
9938 "Specify community to reject\n"
9939 "Specify community to accept\n"
9940 COMMUNITY_VAL_STR)
9941{
9942 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
9943}
9944
9945DEFUN (no_ip_community_list_name_expanded,
9946 no_ip_community_list_name_expanded_cmd,
9947 "no ip community-list expanded WORD (deny|permit) .LINE",
9948 NO_STR
9949 IP_STR
9950 COMMUNITY_LIST_STR
9951 "Specify an expanded community-list\n"
9952 "Community list name\n"
9953 "Specify community to reject\n"
9954 "Specify community to accept\n"
9955 "An ordered list as a regular-expression\n")
9956{
9957 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
9958}
9959
paul94f2b392005-06-28 12:44:16 +00009960static void
paul718e3742002-12-13 20:15:29 +00009961community_list_show (struct vty *vty, struct community_list *list)
9962{
9963 struct community_entry *entry;
9964
9965 for (entry = list->head; entry; entry = entry->next)
9966 {
9967 if (entry == list->head)
9968 {
9969 if (all_digit (list->name))
9970 vty_out (vty, "Community %s list %s%s",
9971 entry->style == COMMUNITY_LIST_STANDARD ?
9972 "standard" : "(expanded) access",
9973 list->name, VTY_NEWLINE);
9974 else
9975 vty_out (vty, "Named Community %s list %s%s",
9976 entry->style == COMMUNITY_LIST_STANDARD ?
9977 "standard" : "expanded",
9978 list->name, VTY_NEWLINE);
9979 }
9980 if (entry->any)
9981 vty_out (vty, " %s%s",
9982 community_direct_str (entry->direct), VTY_NEWLINE);
9983 else
9984 vty_out (vty, " %s %s%s",
9985 community_direct_str (entry->direct),
9986 entry->style == COMMUNITY_LIST_STANDARD
9987 ? community_str (entry->u.com) : entry->config,
9988 VTY_NEWLINE);
9989 }
9990}
9991
9992DEFUN (show_ip_community_list,
9993 show_ip_community_list_cmd,
9994 "show ip community-list",
9995 SHOW_STR
9996 IP_STR
9997 "List community-list\n")
9998{
9999 struct community_list *list;
10000 struct community_list_master *cm;
10001
hassofee6e4e2005-02-02 16:29:31 +000010002 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010003 if (! cm)
10004 return CMD_SUCCESS;
10005
10006 for (list = cm->num.head; list; list = list->next)
10007 community_list_show (vty, list);
10008
10009 for (list = cm->str.head; list; list = list->next)
10010 community_list_show (vty, list);
10011
10012 return CMD_SUCCESS;
10013}
10014
10015DEFUN (show_ip_community_list_arg,
10016 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010017 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010018 SHOW_STR
10019 IP_STR
10020 "List community-list\n"
10021 "Community-list number\n"
10022 "Community-list name\n")
10023{
10024 struct community_list *list;
10025
hassofee6e4e2005-02-02 16:29:31 +000010026 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010027 if (! list)
10028 {
10029 vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE);
10030 return CMD_WARNING;
10031 }
10032
10033 community_list_show (vty, list);
10034
10035 return CMD_SUCCESS;
10036}
10037
paul94f2b392005-06-28 12:44:16 +000010038static int
paulfd79ac92004-10-13 05:06:08 +000010039extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
10040 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010041{
10042 int ret;
10043 int direct;
10044 char *str;
10045
10046 /* Check the list type. */
10047 if (strncmp (argv[1], "p", 1) == 0)
10048 direct = COMMUNITY_PERMIT;
10049 else if (strncmp (argv[1], "d", 1) == 0)
10050 direct = COMMUNITY_DENY;
10051 else
10052 {
10053 vty_out (vty, "%% Matching condition must be permit or deny%s",
10054 VTY_NEWLINE);
10055 return CMD_WARNING;
10056 }
10057
10058 /* All digit name check. */
10059 if (reject_all_digit_name && all_digit (argv[0]))
10060 {
10061 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10062 return CMD_WARNING;
10063 }
10064
10065 /* Concat community string argument. */
10066 if (argc > 1)
10067 str = argv_concat (argv, argc, 2);
10068 else
10069 str = NULL;
10070
10071 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
10072
10073 /* Free temporary community list string allocated by
10074 argv_concat(). */
10075 if (str)
10076 XFREE (MTYPE_TMP, str);
10077
10078 if (ret < 0)
10079 {
10080 community_list_perror (vty, ret);
10081 return CMD_WARNING;
10082 }
10083 return CMD_SUCCESS;
10084}
10085
paul94f2b392005-06-28 12:44:16 +000010086static int
hassofee6e4e2005-02-02 16:29:31 +000010087extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
10088 int style)
paul718e3742002-12-13 20:15:29 +000010089{
10090 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010091 int direct = 0;
10092 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010093
hassofee6e4e2005-02-02 16:29:31 +000010094 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010095 {
hassofee6e4e2005-02-02 16:29:31 +000010096 /* Check the list direct. */
10097 if (strncmp (argv[1], "p", 1) == 0)
10098 direct = COMMUNITY_PERMIT;
10099 else if (strncmp (argv[1], "d", 1) == 0)
10100 direct = COMMUNITY_DENY;
10101 else
10102 {
10103 vty_out (vty, "%% Matching condition must be permit or deny%s",
10104 VTY_NEWLINE);
10105 return CMD_WARNING;
10106 }
10107
10108 /* Concat community string argument. */
10109 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000010110 }
paul718e3742002-12-13 20:15:29 +000010111
10112 /* Unset community list. */
10113 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
10114
10115 /* Free temporary community list string allocated by
10116 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010117 if (str)
10118 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010119
10120 if (ret < 0)
10121 {
10122 community_list_perror (vty, ret);
10123 return CMD_WARNING;
10124 }
10125
10126 return CMD_SUCCESS;
10127}
10128
10129/* "extcommunity-list" keyword help string. */
10130#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
10131#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
10132
10133DEFUN (ip_extcommunity_list_standard,
10134 ip_extcommunity_list_standard_cmd,
10135 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10136 IP_STR
10137 EXTCOMMUNITY_LIST_STR
10138 "Extended Community list number (standard)\n"
10139 "Specify community to reject\n"
10140 "Specify community to accept\n"
10141 EXTCOMMUNITY_VAL_STR)
10142{
10143 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
10144}
10145
10146ALIAS (ip_extcommunity_list_standard,
10147 ip_extcommunity_list_standard2_cmd,
10148 "ip extcommunity-list <1-99> (deny|permit)",
10149 IP_STR
10150 EXTCOMMUNITY_LIST_STR
10151 "Extended Community list number (standard)\n"
10152 "Specify community to reject\n"
10153 "Specify community to accept\n")
10154
10155DEFUN (ip_extcommunity_list_expanded,
10156 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010157 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010158 IP_STR
10159 EXTCOMMUNITY_LIST_STR
10160 "Extended Community list number (expanded)\n"
10161 "Specify community to reject\n"
10162 "Specify community to accept\n"
10163 "An ordered list as a regular-expression\n")
10164{
10165 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
10166}
10167
10168DEFUN (ip_extcommunity_list_name_standard,
10169 ip_extcommunity_list_name_standard_cmd,
10170 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10171 IP_STR
10172 EXTCOMMUNITY_LIST_STR
10173 "Specify standard extcommunity-list\n"
10174 "Extended Community list name\n"
10175 "Specify community to reject\n"
10176 "Specify community to accept\n"
10177 EXTCOMMUNITY_VAL_STR)
10178{
10179 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
10180}
10181
10182ALIAS (ip_extcommunity_list_name_standard,
10183 ip_extcommunity_list_name_standard2_cmd,
10184 "ip extcommunity-list standard WORD (deny|permit)",
10185 IP_STR
10186 EXTCOMMUNITY_LIST_STR
10187 "Specify standard extcommunity-list\n"
10188 "Extended Community list name\n"
10189 "Specify community to reject\n"
10190 "Specify community to accept\n")
10191
10192DEFUN (ip_extcommunity_list_name_expanded,
10193 ip_extcommunity_list_name_expanded_cmd,
10194 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
10195 IP_STR
10196 EXTCOMMUNITY_LIST_STR
10197 "Specify expanded extcommunity-list\n"
10198 "Extended Community list name\n"
10199 "Specify community to reject\n"
10200 "Specify community to accept\n"
10201 "An ordered list as a regular-expression\n")
10202{
10203 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
10204}
10205
hassofee6e4e2005-02-02 16:29:31 +000010206DEFUN (no_ip_extcommunity_list_standard_all,
10207 no_ip_extcommunity_list_standard_all_cmd,
10208 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010209 NO_STR
10210 IP_STR
10211 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010212 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010213{
hassofee6e4e2005-02-02 16:29:31 +000010214 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010215}
10216
hassofee6e4e2005-02-02 16:29:31 +000010217DEFUN (no_ip_extcommunity_list_expanded_all,
10218 no_ip_extcommunity_list_expanded_all_cmd,
10219 "no ip extcommunity-list <100-500>",
10220 NO_STR
10221 IP_STR
10222 EXTCOMMUNITY_LIST_STR
10223 "Extended Community list number (expanded)\n")
10224{
10225 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10226}
10227
10228DEFUN (no_ip_extcommunity_list_name_standard_all,
10229 no_ip_extcommunity_list_name_standard_all_cmd,
10230 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010231 NO_STR
10232 IP_STR
10233 EXTCOMMUNITY_LIST_STR
10234 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000010235 "Extended Community list name\n")
10236{
10237 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10238}
10239
10240DEFUN (no_ip_extcommunity_list_name_expanded_all,
10241 no_ip_extcommunity_list_name_expanded_all_cmd,
10242 "no ip extcommunity-list expanded WORD",
10243 NO_STR
10244 IP_STR
10245 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000010246 "Specify expanded extcommunity-list\n"
10247 "Extended Community list name\n")
10248{
hassofee6e4e2005-02-02 16:29:31 +000010249 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010250}
10251
10252DEFUN (no_ip_extcommunity_list_standard,
10253 no_ip_extcommunity_list_standard_cmd,
10254 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10255 NO_STR
10256 IP_STR
10257 EXTCOMMUNITY_LIST_STR
10258 "Extended Community list number (standard)\n"
10259 "Specify community to reject\n"
10260 "Specify community to accept\n"
10261 EXTCOMMUNITY_VAL_STR)
10262{
10263 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10264}
10265
10266DEFUN (no_ip_extcommunity_list_expanded,
10267 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010268 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010269 NO_STR
10270 IP_STR
10271 EXTCOMMUNITY_LIST_STR
10272 "Extended Community list number (expanded)\n"
10273 "Specify community to reject\n"
10274 "Specify community to accept\n"
10275 "An ordered list as a regular-expression\n")
10276{
10277 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10278}
10279
10280DEFUN (no_ip_extcommunity_list_name_standard,
10281 no_ip_extcommunity_list_name_standard_cmd,
10282 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10283 NO_STR
10284 IP_STR
10285 EXTCOMMUNITY_LIST_STR
10286 "Specify standard extcommunity-list\n"
10287 "Extended Community list name\n"
10288 "Specify community to reject\n"
10289 "Specify community to accept\n"
10290 EXTCOMMUNITY_VAL_STR)
10291{
10292 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10293}
10294
10295DEFUN (no_ip_extcommunity_list_name_expanded,
10296 no_ip_extcommunity_list_name_expanded_cmd,
10297 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
10298 NO_STR
10299 IP_STR
10300 EXTCOMMUNITY_LIST_STR
10301 "Specify expanded extcommunity-list\n"
10302 "Community list name\n"
10303 "Specify community to reject\n"
10304 "Specify community to accept\n"
10305 "An ordered list as a regular-expression\n")
10306{
10307 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10308}
10309
paul94f2b392005-06-28 12:44:16 +000010310static void
paul718e3742002-12-13 20:15:29 +000010311extcommunity_list_show (struct vty *vty, struct community_list *list)
10312{
10313 struct community_entry *entry;
10314
10315 for (entry = list->head; entry; entry = entry->next)
10316 {
10317 if (entry == list->head)
10318 {
10319 if (all_digit (list->name))
10320 vty_out (vty, "Extended community %s list %s%s",
10321 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10322 "standard" : "(expanded) access",
10323 list->name, VTY_NEWLINE);
10324 else
10325 vty_out (vty, "Named extended community %s list %s%s",
10326 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10327 "standard" : "expanded",
10328 list->name, VTY_NEWLINE);
10329 }
10330 if (entry->any)
10331 vty_out (vty, " %s%s",
10332 community_direct_str (entry->direct), VTY_NEWLINE);
10333 else
10334 vty_out (vty, " %s %s%s",
10335 community_direct_str (entry->direct),
10336 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10337 entry->u.ecom->str : entry->config,
10338 VTY_NEWLINE);
10339 }
10340}
10341
10342DEFUN (show_ip_extcommunity_list,
10343 show_ip_extcommunity_list_cmd,
10344 "show ip extcommunity-list",
10345 SHOW_STR
10346 IP_STR
10347 "List extended-community list\n")
10348{
10349 struct community_list *list;
10350 struct community_list_master *cm;
10351
hassofee6e4e2005-02-02 16:29:31 +000010352 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010353 if (! cm)
10354 return CMD_SUCCESS;
10355
10356 for (list = cm->num.head; list; list = list->next)
10357 extcommunity_list_show (vty, list);
10358
10359 for (list = cm->str.head; list; list = list->next)
10360 extcommunity_list_show (vty, list);
10361
10362 return CMD_SUCCESS;
10363}
10364
10365DEFUN (show_ip_extcommunity_list_arg,
10366 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010367 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010368 SHOW_STR
10369 IP_STR
10370 "List extended-community list\n"
10371 "Extcommunity-list number\n"
10372 "Extcommunity-list name\n")
10373{
10374 struct community_list *list;
10375
hassofee6e4e2005-02-02 16:29:31 +000010376 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010377 if (! list)
10378 {
10379 vty_out (vty, "%% Can't find extcommunit-list%s", VTY_NEWLINE);
10380 return CMD_WARNING;
10381 }
10382
10383 extcommunity_list_show (vty, list);
10384
10385 return CMD_SUCCESS;
10386}
10387
10388/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000010389static const char *
paul718e3742002-12-13 20:15:29 +000010390community_list_config_str (struct community_entry *entry)
10391{
paulfd79ac92004-10-13 05:06:08 +000010392 const char *str;
paul718e3742002-12-13 20:15:29 +000010393
10394 if (entry->any)
10395 str = "";
10396 else
10397 {
10398 if (entry->style == COMMUNITY_LIST_STANDARD)
10399 str = community_str (entry->u.com);
10400 else
10401 str = entry->config;
10402 }
10403 return str;
10404}
10405
10406/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000010407static int
paul718e3742002-12-13 20:15:29 +000010408community_list_config_write (struct vty *vty)
10409{
10410 struct community_list *list;
10411 struct community_entry *entry;
10412 struct community_list_master *cm;
10413 int write = 0;
10414
10415 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000010416 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010417
10418 for (list = cm->num.head; list; list = list->next)
10419 for (entry = list->head; entry; entry = entry->next)
10420 {
hassofee6e4e2005-02-02 16:29:31 +000010421 vty_out (vty, "ip community-list %s %s %s%s",
10422 list->name, community_direct_str (entry->direct),
10423 community_list_config_str (entry),
10424 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010425 write++;
10426 }
10427 for (list = cm->str.head; list; list = list->next)
10428 for (entry = list->head; entry; entry = entry->next)
10429 {
10430 vty_out (vty, "ip community-list %s %s %s %s%s",
10431 entry->style == COMMUNITY_LIST_STANDARD
10432 ? "standard" : "expanded",
10433 list->name, community_direct_str (entry->direct),
10434 community_list_config_str (entry),
10435 VTY_NEWLINE);
10436 write++;
10437 }
10438
10439 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000010440 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010441
10442 for (list = cm->num.head; list; list = list->next)
10443 for (entry = list->head; entry; entry = entry->next)
10444 {
hassofee6e4e2005-02-02 16:29:31 +000010445 vty_out (vty, "ip extcommunity-list %s %s %s%s",
10446 list->name, community_direct_str (entry->direct),
10447 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010448 write++;
10449 }
10450 for (list = cm->str.head; list; list = list->next)
10451 for (entry = list->head; entry; entry = entry->next)
10452 {
10453 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
10454 entry->style == EXTCOMMUNITY_LIST_STANDARD
10455 ? "standard" : "expanded",
10456 list->name, community_direct_str (entry->direct),
10457 community_list_config_str (entry), VTY_NEWLINE);
10458 write++;
10459 }
10460 return write;
10461}
10462
10463struct cmd_node community_list_node =
10464{
10465 COMMUNITY_LIST_NODE,
10466 "",
10467 1 /* Export to vtysh. */
10468};
10469
paul94f2b392005-06-28 12:44:16 +000010470static void
10471community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000010472{
10473 install_node (&community_list_node, community_list_config_write);
10474
10475 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000010476 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
10477 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
10478 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
10479 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
10480 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
10481 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000010482 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
10483 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
10484 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
10485 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000010486 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
10487 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
10488 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
10489 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
10490 install_element (VIEW_NODE, &show_ip_community_list_cmd);
10491 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
10492 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
10493 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
10494
10495 /* Extcommunity-list. */
10496 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
10497 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
10498 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
10499 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
10500 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
10501 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000010502 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
10503 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
10504 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
10505 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000010506 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
10507 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
10508 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
10509 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
10510 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
10511 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
10512 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
10513 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
10514}