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