blob: 520ddf952ae43667490399f71b73f06b7330a566 [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
2770DEFUN (neighbor_update_source,
2771 neighbor_update_source_cmd,
2772 NEIGHBOR_CMD2 "update-source WORD",
2773 NEIGHBOR_STR
2774 NEIGHBOR_ADDR_STR2
2775 "Source of routing updates\n"
2776 "Interface name\n")
2777{
2778 return peer_update_source_vty (vty, argv[0], argv[1]);
2779}
2780
2781DEFUN (no_neighbor_update_source,
2782 no_neighbor_update_source_cmd,
2783 NO_NEIGHBOR_CMD2 "update-source",
2784 NO_STR
2785 NEIGHBOR_STR
2786 NEIGHBOR_ADDR_STR2
2787 "Source of routing updates\n"
2788 "Interface name\n")
2789{
2790 return peer_update_source_vty (vty, argv[0], NULL);
2791}
2792
paul94f2b392005-06-28 12:44:16 +00002793static int
paulfd79ac92004-10-13 05:06:08 +00002794peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
2795 afi_t afi, safi_t safi,
2796 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00002797{
2798 int ret;
2799 struct peer *peer;
2800
2801 peer = peer_and_group_lookup_vty (vty, peer_str);
2802 if (! peer)
2803 return CMD_WARNING;
2804
2805 if (set)
2806 ret = peer_default_originate_set (peer, afi, safi, rmap);
2807 else
2808 ret = peer_default_originate_unset (peer, afi, safi);
2809
2810 return bgp_vty_return (vty, ret);
2811}
2812
2813/* neighbor default-originate. */
2814DEFUN (neighbor_default_originate,
2815 neighbor_default_originate_cmd,
2816 NEIGHBOR_CMD2 "default-originate",
2817 NEIGHBOR_STR
2818 NEIGHBOR_ADDR_STR2
2819 "Originate default route to this neighbor\n")
2820{
2821 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2822 bgp_node_safi (vty), NULL, 1);
2823}
2824
2825DEFUN (neighbor_default_originate_rmap,
2826 neighbor_default_originate_rmap_cmd,
2827 NEIGHBOR_CMD2 "default-originate route-map WORD",
2828 NEIGHBOR_STR
2829 NEIGHBOR_ADDR_STR2
2830 "Originate default route to this neighbor\n"
2831 "Route-map to specify criteria to originate default\n"
2832 "route-map name\n")
2833{
2834 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2835 bgp_node_safi (vty), argv[1], 1);
2836}
2837
2838DEFUN (no_neighbor_default_originate,
2839 no_neighbor_default_originate_cmd,
2840 NO_NEIGHBOR_CMD2 "default-originate",
2841 NO_STR
2842 NEIGHBOR_STR
2843 NEIGHBOR_ADDR_STR2
2844 "Originate default route to this neighbor\n")
2845{
2846 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2847 bgp_node_safi (vty), NULL, 0);
2848}
2849
2850ALIAS (no_neighbor_default_originate,
2851 no_neighbor_default_originate_rmap_cmd,
2852 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
2853 NO_STR
2854 NEIGHBOR_STR
2855 NEIGHBOR_ADDR_STR2
2856 "Originate default route to this neighbor\n"
2857 "Route-map to specify criteria to originate default\n"
2858 "route-map name\n")
2859
2860/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00002861static int
paulfd79ac92004-10-13 05:06:08 +00002862peer_port_vty (struct vty *vty, const char *ip_str, int afi,
2863 const char *port_str)
paul718e3742002-12-13 20:15:29 +00002864{
2865 struct peer *peer;
2866 u_int16_t port;
2867 struct servent *sp;
2868
2869 peer = peer_lookup_vty (vty, ip_str);
2870 if (! peer)
2871 return CMD_WARNING;
2872
2873 if (! port_str)
2874 {
2875 sp = getservbyname ("bgp", "tcp");
2876 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
2877 }
2878 else
2879 {
2880 VTY_GET_INTEGER("port", port, port_str);
2881 }
2882
2883 peer_port_set (peer, port);
2884
2885 return CMD_SUCCESS;
2886}
2887
hassof4184462005-02-01 20:13:16 +00002888/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00002889DEFUN (neighbor_port,
2890 neighbor_port_cmd,
2891 NEIGHBOR_CMD "port <0-65535>",
2892 NEIGHBOR_STR
2893 NEIGHBOR_ADDR_STR
2894 "Neighbor's BGP port\n"
2895 "TCP port number\n")
2896{
2897 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
2898}
2899
2900DEFUN (no_neighbor_port,
2901 no_neighbor_port_cmd,
2902 NO_NEIGHBOR_CMD "port",
2903 NO_STR
2904 NEIGHBOR_STR
2905 NEIGHBOR_ADDR_STR
2906 "Neighbor's BGP port\n")
2907{
2908 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
2909}
2910
2911ALIAS (no_neighbor_port,
2912 no_neighbor_port_val_cmd,
2913 NO_NEIGHBOR_CMD "port <0-65535>",
2914 NO_STR
2915 NEIGHBOR_STR
2916 NEIGHBOR_ADDR_STR
2917 "Neighbor's BGP port\n"
2918 "TCP port number\n")
2919
2920/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00002921static int
paulfd79ac92004-10-13 05:06:08 +00002922peer_weight_set_vty (struct vty *vty, const char *ip_str,
2923 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00002924{
2925 int ret;
2926 struct peer *peer;
2927 unsigned long weight;
2928
2929 peer = peer_and_group_lookup_vty (vty, ip_str);
2930 if (! peer)
2931 return CMD_WARNING;
2932
2933 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
2934
2935 ret = peer_weight_set (peer, weight);
2936
2937 return CMD_SUCCESS;
2938}
2939
paul94f2b392005-06-28 12:44:16 +00002940static int
paulfd79ac92004-10-13 05:06:08 +00002941peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002942{
2943 struct peer *peer;
2944
2945 peer = peer_and_group_lookup_vty (vty, ip_str);
2946 if (! peer)
2947 return CMD_WARNING;
2948
2949 peer_weight_unset (peer);
2950
2951 return CMD_SUCCESS;
2952}
2953
2954DEFUN (neighbor_weight,
2955 neighbor_weight_cmd,
2956 NEIGHBOR_CMD2 "weight <0-65535>",
2957 NEIGHBOR_STR
2958 NEIGHBOR_ADDR_STR2
2959 "Set default weight for routes from this neighbor\n"
2960 "default weight\n")
2961{
2962 return peer_weight_set_vty (vty, argv[0], argv[1]);
2963}
2964
2965DEFUN (no_neighbor_weight,
2966 no_neighbor_weight_cmd,
2967 NO_NEIGHBOR_CMD2 "weight",
2968 NO_STR
2969 NEIGHBOR_STR
2970 NEIGHBOR_ADDR_STR2
2971 "Set default weight for routes from this neighbor\n")
2972{
2973 return peer_weight_unset_vty (vty, argv[0]);
2974}
2975
2976ALIAS (no_neighbor_weight,
2977 no_neighbor_weight_val_cmd,
2978 NO_NEIGHBOR_CMD2 "weight <0-65535>",
2979 NO_STR
2980 NEIGHBOR_STR
2981 NEIGHBOR_ADDR_STR2
2982 "Set default weight for routes from this neighbor\n"
2983 "default weight\n")
2984
2985/* Override capability negotiation. */
2986DEFUN (neighbor_override_capability,
2987 neighbor_override_capability_cmd,
2988 NEIGHBOR_CMD2 "override-capability",
2989 NEIGHBOR_STR
2990 NEIGHBOR_ADDR_STR2
2991 "Override capability negotiation result\n")
2992{
2993 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
2994}
2995
2996DEFUN (no_neighbor_override_capability,
2997 no_neighbor_override_capability_cmd,
2998 NO_NEIGHBOR_CMD2 "override-capability",
2999 NO_STR
3000 NEIGHBOR_STR
3001 NEIGHBOR_ADDR_STR2
3002 "Override capability negotiation result\n")
3003{
3004 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3005}
3006
3007DEFUN (neighbor_strict_capability,
3008 neighbor_strict_capability_cmd,
3009 NEIGHBOR_CMD "strict-capability-match",
3010 NEIGHBOR_STR
3011 NEIGHBOR_ADDR_STR
3012 "Strict capability negotiation match\n")
3013{
3014 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3015}
3016
3017DEFUN (no_neighbor_strict_capability,
3018 no_neighbor_strict_capability_cmd,
3019 NO_NEIGHBOR_CMD "strict-capability-match",
3020 NO_STR
3021 NEIGHBOR_STR
3022 NEIGHBOR_ADDR_STR
3023 "Strict capability negotiation match\n")
3024{
3025 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3026}
3027
paul94f2b392005-06-28 12:44:16 +00003028static int
paulfd79ac92004-10-13 05:06:08 +00003029peer_timers_set_vty (struct vty *vty, const char *ip_str,
3030 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003031{
3032 int ret;
3033 struct peer *peer;
3034 u_int32_t keepalive;
3035 u_int32_t holdtime;
3036
3037 peer = peer_and_group_lookup_vty (vty, ip_str);
3038 if (! peer)
3039 return CMD_WARNING;
3040
3041 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3042 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3043
3044 ret = peer_timers_set (peer, keepalive, holdtime);
3045
3046 return bgp_vty_return (vty, ret);
3047}
3048
paul94f2b392005-06-28 12:44:16 +00003049static int
paulfd79ac92004-10-13 05:06:08 +00003050peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003051{
3052 int ret;
3053 struct peer *peer;
3054
3055 peer = peer_lookup_vty (vty, ip_str);
3056 if (! peer)
3057 return CMD_WARNING;
3058
3059 ret = peer_timers_unset (peer);
3060
3061 return bgp_vty_return (vty, ret);
3062}
3063
3064DEFUN (neighbor_timers,
3065 neighbor_timers_cmd,
3066 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3067 NEIGHBOR_STR
3068 NEIGHBOR_ADDR_STR2
3069 "BGP per neighbor timers\n"
3070 "Keepalive interval\n"
3071 "Holdtime\n")
3072{
3073 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3074}
3075
3076DEFUN (no_neighbor_timers,
3077 no_neighbor_timers_cmd,
3078 NO_NEIGHBOR_CMD2 "timers",
3079 NO_STR
3080 NEIGHBOR_STR
3081 NEIGHBOR_ADDR_STR2
3082 "BGP per neighbor timers\n")
3083{
3084 return peer_timers_unset_vty (vty, argv[0]);
3085}
3086
paul94f2b392005-06-28 12:44:16 +00003087static int
paulfd79ac92004-10-13 05:06:08 +00003088peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3089 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003090{
3091 int ret;
3092 struct peer *peer;
3093 u_int32_t connect;
3094
3095 peer = peer_lookup_vty (vty, ip_str);
3096 if (! peer)
3097 return CMD_WARNING;
3098
3099 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3100
3101 ret = peer_timers_connect_set (peer, connect);
3102
3103 return CMD_SUCCESS;
3104}
3105
paul94f2b392005-06-28 12:44:16 +00003106static int
paulfd79ac92004-10-13 05:06:08 +00003107peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003108{
3109 int ret;
3110 struct peer *peer;
3111
3112 peer = peer_and_group_lookup_vty (vty, ip_str);
3113 if (! peer)
3114 return CMD_WARNING;
3115
3116 ret = peer_timers_connect_unset (peer);
3117
3118 return CMD_SUCCESS;
3119}
3120
3121DEFUN (neighbor_timers_connect,
3122 neighbor_timers_connect_cmd,
3123 NEIGHBOR_CMD "timers connect <0-65535>",
3124 NEIGHBOR_STR
3125 NEIGHBOR_ADDR_STR
3126 "BGP per neighbor timers\n"
3127 "BGP connect timer\n"
3128 "Connect timer\n")
3129{
3130 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3131}
3132
3133DEFUN (no_neighbor_timers_connect,
3134 no_neighbor_timers_connect_cmd,
3135 NO_NEIGHBOR_CMD "timers connect",
3136 NO_STR
3137 NEIGHBOR_STR
3138 NEIGHBOR_ADDR_STR
3139 "BGP per neighbor timers\n"
3140 "BGP connect timer\n")
3141{
3142 return peer_timers_connect_unset_vty (vty, argv[0]);
3143}
3144
3145ALIAS (no_neighbor_timers_connect,
3146 no_neighbor_timers_connect_val_cmd,
3147 NO_NEIGHBOR_CMD "timers connect <0-65535>",
3148 NO_STR
3149 NEIGHBOR_STR
3150 NEIGHBOR_ADDR_STR
3151 "BGP per neighbor timers\n"
3152 "BGP connect timer\n"
3153 "Connect timer\n")
3154
paul94f2b392005-06-28 12:44:16 +00003155static int
paulfd79ac92004-10-13 05:06:08 +00003156peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3157 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003158{
3159 int ret;
3160 struct peer *peer;
3161 u_int32_t routeadv = 0;
3162
3163 peer = peer_lookup_vty (vty, ip_str);
3164 if (! peer)
3165 return CMD_WARNING;
3166
3167 if (time_str)
3168 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3169
3170 if (set)
3171 ret = peer_advertise_interval_set (peer, routeadv);
3172 else
3173 ret = peer_advertise_interval_unset (peer);
3174
3175 return CMD_SUCCESS;
3176}
3177
3178DEFUN (neighbor_advertise_interval,
3179 neighbor_advertise_interval_cmd,
3180 NEIGHBOR_CMD "advertisement-interval <0-600>",
3181 NEIGHBOR_STR
3182 NEIGHBOR_ADDR_STR
3183 "Minimum interval between sending BGP routing updates\n"
3184 "time in seconds\n")
3185{
3186 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3187}
3188
3189DEFUN (no_neighbor_advertise_interval,
3190 no_neighbor_advertise_interval_cmd,
3191 NO_NEIGHBOR_CMD "advertisement-interval",
3192 NO_STR
3193 NEIGHBOR_STR
3194 NEIGHBOR_ADDR_STR
3195 "Minimum interval between sending BGP routing updates\n")
3196{
3197 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3198}
3199
3200ALIAS (no_neighbor_advertise_interval,
3201 no_neighbor_advertise_interval_val_cmd,
3202 NO_NEIGHBOR_CMD "advertisement-interval <0-600>",
3203 NO_STR
3204 NEIGHBOR_STR
3205 NEIGHBOR_ADDR_STR
3206 "Minimum interval between sending BGP routing updates\n"
3207 "time in seconds\n")
3208
paul718e3742002-12-13 20:15:29 +00003209/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003210static int
paulfd79ac92004-10-13 05:06:08 +00003211peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003212{
3213 int ret;
3214 struct peer *peer;
3215
3216 peer = peer_lookup_vty (vty, ip_str);
3217 if (! peer)
3218 return CMD_WARNING;
3219
3220 if (str)
3221 ret = peer_interface_set (peer, str);
3222 else
3223 ret = peer_interface_unset (peer);
3224
3225 return CMD_SUCCESS;
3226}
3227
3228DEFUN (neighbor_interface,
3229 neighbor_interface_cmd,
3230 NEIGHBOR_CMD "interface WORD",
3231 NEIGHBOR_STR
3232 NEIGHBOR_ADDR_STR
3233 "Interface\n"
3234 "Interface name\n")
3235{
3236 return peer_interface_vty (vty, argv[0], argv[1]);
3237}
3238
3239DEFUN (no_neighbor_interface,
3240 no_neighbor_interface_cmd,
3241 NO_NEIGHBOR_CMD "interface WORD",
3242 NO_STR
3243 NEIGHBOR_STR
3244 NEIGHBOR_ADDR_STR
3245 "Interface\n"
3246 "Interface name\n")
3247{
3248 return peer_interface_vty (vty, argv[0], NULL);
3249}
3250
3251/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003252static int
paulfd79ac92004-10-13 05:06:08 +00003253peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3254 afi_t afi, safi_t safi,
3255 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003256{
3257 int ret;
3258 struct peer *peer;
3259 int direct = FILTER_IN;
3260
3261 peer = peer_and_group_lookup_vty (vty, ip_str);
3262 if (! peer)
3263 return CMD_WARNING;
3264
3265 /* Check filter direction. */
3266 if (strncmp (direct_str, "i", 1) == 0)
3267 direct = FILTER_IN;
3268 else if (strncmp (direct_str, "o", 1) == 0)
3269 direct = FILTER_OUT;
3270
3271 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3272
3273 return bgp_vty_return (vty, ret);
3274}
3275
paul94f2b392005-06-28 12:44:16 +00003276static int
paulfd79ac92004-10-13 05:06:08 +00003277peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3278 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003279{
3280 int ret;
3281 struct peer *peer;
3282 int direct = FILTER_IN;
3283
3284 peer = peer_and_group_lookup_vty (vty, ip_str);
3285 if (! peer)
3286 return CMD_WARNING;
3287
3288 /* Check filter direction. */
3289 if (strncmp (direct_str, "i", 1) == 0)
3290 direct = FILTER_IN;
3291 else if (strncmp (direct_str, "o", 1) == 0)
3292 direct = FILTER_OUT;
3293
3294 ret = peer_distribute_unset (peer, afi, safi, direct);
3295
3296 return bgp_vty_return (vty, ret);
3297}
3298
3299DEFUN (neighbor_distribute_list,
3300 neighbor_distribute_list_cmd,
3301 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3302 NEIGHBOR_STR
3303 NEIGHBOR_ADDR_STR2
3304 "Filter updates to/from this neighbor\n"
3305 "IP access-list number\n"
3306 "IP access-list number (expanded range)\n"
3307 "IP Access-list name\n"
3308 "Filter incoming updates\n"
3309 "Filter outgoing updates\n")
3310{
3311 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3312 bgp_node_safi (vty), argv[1], argv[2]);
3313}
3314
3315DEFUN (no_neighbor_distribute_list,
3316 no_neighbor_distribute_list_cmd,
3317 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3318 NO_STR
3319 NEIGHBOR_STR
3320 NEIGHBOR_ADDR_STR2
3321 "Filter updates to/from this neighbor\n"
3322 "IP access-list number\n"
3323 "IP access-list number (expanded range)\n"
3324 "IP Access-list name\n"
3325 "Filter incoming updates\n"
3326 "Filter outgoing updates\n")
3327{
3328 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3329 bgp_node_safi (vty), argv[2]);
3330}
3331
3332/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003333static int
paulfd79ac92004-10-13 05:06:08 +00003334peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3335 safi_t safi, const char *name_str,
3336 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003337{
3338 int ret;
3339 struct peer *peer;
3340 int direct = FILTER_IN;
3341
3342 peer = peer_and_group_lookup_vty (vty, ip_str);
3343 if (! peer)
3344 return CMD_WARNING;
3345
3346 /* Check filter direction. */
3347 if (strncmp (direct_str, "i", 1) == 0)
3348 direct = FILTER_IN;
3349 else if (strncmp (direct_str, "o", 1) == 0)
3350 direct = FILTER_OUT;
3351
3352 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3353
3354 return bgp_vty_return (vty, ret);
3355}
3356
paul94f2b392005-06-28 12:44:16 +00003357static int
paulfd79ac92004-10-13 05:06:08 +00003358peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3359 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003360{
3361 int ret;
3362 struct peer *peer;
3363 int direct = FILTER_IN;
3364
3365 peer = peer_and_group_lookup_vty (vty, ip_str);
3366 if (! peer)
3367 return CMD_WARNING;
3368
3369 /* Check filter direction. */
3370 if (strncmp (direct_str, "i", 1) == 0)
3371 direct = FILTER_IN;
3372 else if (strncmp (direct_str, "o", 1) == 0)
3373 direct = FILTER_OUT;
3374
3375 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3376
3377 return bgp_vty_return (vty, ret);
3378}
3379
3380DEFUN (neighbor_prefix_list,
3381 neighbor_prefix_list_cmd,
3382 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3383 NEIGHBOR_STR
3384 NEIGHBOR_ADDR_STR2
3385 "Filter updates to/from this neighbor\n"
3386 "Name of a prefix list\n"
3387 "Filter incoming updates\n"
3388 "Filter outgoing updates\n")
3389{
3390 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3391 bgp_node_safi (vty), argv[1], argv[2]);
3392}
3393
3394DEFUN (no_neighbor_prefix_list,
3395 no_neighbor_prefix_list_cmd,
3396 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3397 NO_STR
3398 NEIGHBOR_STR
3399 NEIGHBOR_ADDR_STR2
3400 "Filter updates to/from this neighbor\n"
3401 "Name of a prefix list\n"
3402 "Filter incoming updates\n"
3403 "Filter outgoing updates\n")
3404{
3405 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3406 bgp_node_safi (vty), argv[2]);
3407}
3408
paul94f2b392005-06-28 12:44:16 +00003409static int
paulfd79ac92004-10-13 05:06:08 +00003410peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3411 afi_t afi, safi_t safi,
3412 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003413{
3414 int ret;
3415 struct peer *peer;
3416 int direct = FILTER_IN;
3417
3418 peer = peer_and_group_lookup_vty (vty, ip_str);
3419 if (! peer)
3420 return CMD_WARNING;
3421
3422 /* Check filter direction. */
3423 if (strncmp (direct_str, "i", 1) == 0)
3424 direct = FILTER_IN;
3425 else if (strncmp (direct_str, "o", 1) == 0)
3426 direct = FILTER_OUT;
3427
3428 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3429
3430 return bgp_vty_return (vty, ret);
3431}
3432
paul94f2b392005-06-28 12:44:16 +00003433static int
paulfd79ac92004-10-13 05:06:08 +00003434peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3435 afi_t afi, safi_t safi,
3436 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003437{
3438 int ret;
3439 struct peer *peer;
3440 int direct = FILTER_IN;
3441
3442 peer = peer_and_group_lookup_vty (vty, ip_str);
3443 if (! peer)
3444 return CMD_WARNING;
3445
3446 /* Check filter direction. */
3447 if (strncmp (direct_str, "i", 1) == 0)
3448 direct = FILTER_IN;
3449 else if (strncmp (direct_str, "o", 1) == 0)
3450 direct = FILTER_OUT;
3451
3452 ret = peer_aslist_unset (peer, afi, safi, direct);
3453
3454 return bgp_vty_return (vty, ret);
3455}
3456
3457DEFUN (neighbor_filter_list,
3458 neighbor_filter_list_cmd,
3459 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3460 NEIGHBOR_STR
3461 NEIGHBOR_ADDR_STR2
3462 "Establish BGP filters\n"
3463 "AS path access-list name\n"
3464 "Filter incoming routes\n"
3465 "Filter outgoing routes\n")
3466{
3467 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3468 bgp_node_safi (vty), argv[1], argv[2]);
3469}
3470
3471DEFUN (no_neighbor_filter_list,
3472 no_neighbor_filter_list_cmd,
3473 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3474 NO_STR
3475 NEIGHBOR_STR
3476 NEIGHBOR_ADDR_STR2
3477 "Establish BGP filters\n"
3478 "AS path access-list name\n"
3479 "Filter incoming routes\n"
3480 "Filter outgoing routes\n")
3481{
3482 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3483 bgp_node_safi (vty), argv[2]);
3484}
3485
3486/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003487static int
paulfd79ac92004-10-13 05:06:08 +00003488peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3489 afi_t afi, safi_t safi,
3490 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003491{
3492 int ret;
3493 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003494 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003495
3496 peer = peer_and_group_lookup_vty (vty, ip_str);
3497 if (! peer)
3498 return CMD_WARNING;
3499
3500 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003501 if (strncmp (direct_str, "in", 2) == 0)
3502 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003503 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003504 direct = RMAP_OUT;
3505 else if (strncmp (direct_str, "im", 2) == 0)
3506 direct = RMAP_IMPORT;
3507 else if (strncmp (direct_str, "e", 1) == 0)
3508 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003509
3510 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3511
3512 return bgp_vty_return (vty, ret);
3513}
3514
paul94f2b392005-06-28 12:44:16 +00003515static int
paulfd79ac92004-10-13 05:06:08 +00003516peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3517 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003518{
3519 int ret;
3520 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003521 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003522
3523 peer = peer_and_group_lookup_vty (vty, ip_str);
3524 if (! peer)
3525 return CMD_WARNING;
3526
3527 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003528 if (strncmp (direct_str, "in", 2) == 0)
3529 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003530 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003531 direct = RMAP_OUT;
3532 else if (strncmp (direct_str, "im", 2) == 0)
3533 direct = RMAP_IMPORT;
3534 else if (strncmp (direct_str, "e", 1) == 0)
3535 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003536
3537 ret = peer_route_map_unset (peer, afi, safi, direct);
3538
3539 return bgp_vty_return (vty, ret);
3540}
3541
3542DEFUN (neighbor_route_map,
3543 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003544 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003545 NEIGHBOR_STR
3546 NEIGHBOR_ADDR_STR2
3547 "Apply route map to neighbor\n"
3548 "Name of route map\n"
3549 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003550 "Apply map to outbound routes\n"
3551 "Apply map to routes going into a Route-Server client's table\n"
3552 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003553{
3554 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3555 bgp_node_safi (vty), argv[1], argv[2]);
3556}
3557
3558DEFUN (no_neighbor_route_map,
3559 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003560 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003561 NO_STR
3562 NEIGHBOR_STR
3563 NEIGHBOR_ADDR_STR2
3564 "Apply route map to neighbor\n"
3565 "Name of route map\n"
3566 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003567 "Apply map to outbound routes\n"
3568 "Apply map to routes going into a Route-Server client's table\n"
3569 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003570{
3571 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3572 bgp_node_safi (vty), argv[2]);
3573}
3574
3575/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003576static int
paulfd79ac92004-10-13 05:06:08 +00003577peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3578 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003579{
3580 int ret;
3581 struct peer *peer;
3582
3583 peer = peer_and_group_lookup_vty (vty, ip_str);
3584 if (! peer)
3585 return CMD_WARNING;
3586
3587 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3588
3589 return bgp_vty_return (vty, ret);
3590}
3591
3592/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003593static int
paulfd79ac92004-10-13 05:06:08 +00003594peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003595 safi_t safi)
3596{
3597 int ret;
3598 struct peer *peer;
3599
3600 peer = peer_and_group_lookup_vty (vty, ip_str);
3601 if (! peer)
3602 return CMD_WARNING;
3603
3604 ret = peer_unsuppress_map_unset (peer, afi, safi);
3605
3606 return bgp_vty_return (vty, ret);
3607}
3608
3609DEFUN (neighbor_unsuppress_map,
3610 neighbor_unsuppress_map_cmd,
3611 NEIGHBOR_CMD2 "unsuppress-map WORD",
3612 NEIGHBOR_STR
3613 NEIGHBOR_ADDR_STR2
3614 "Route-map to selectively unsuppress suppressed routes\n"
3615 "Name of route map\n")
3616{
3617 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3618 bgp_node_safi (vty), argv[1]);
3619}
3620
3621DEFUN (no_neighbor_unsuppress_map,
3622 no_neighbor_unsuppress_map_cmd,
3623 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3624 NO_STR
3625 NEIGHBOR_STR
3626 NEIGHBOR_ADDR_STR2
3627 "Route-map to selectively unsuppress suppressed routes\n"
3628 "Name of route map\n")
3629{
3630 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3631 bgp_node_safi (vty));
3632}
3633
paul94f2b392005-06-28 12:44:16 +00003634static int
paulfd79ac92004-10-13 05:06:08 +00003635peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3636 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003637 const char *threshold_str, int warning,
3638 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003639{
3640 int ret;
3641 struct peer *peer;
3642 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003643 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003644 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003645
3646 peer = peer_and_group_lookup_vty (vty, ip_str);
3647 if (! peer)
3648 return CMD_WARNING;
3649
3650 VTY_GET_INTEGER ("maxmum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003651 if (threshold_str)
3652 threshold = atoi (threshold_str);
3653 else
3654 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00003655
hasso0a486e52005-02-01 20:57:17 +00003656 if (restart_str)
3657 restart = atoi (restart_str);
3658 else
3659 restart = 0;
3660
3661 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00003662
3663 return bgp_vty_return (vty, ret);
3664}
3665
paul94f2b392005-06-28 12:44:16 +00003666static int
paulfd79ac92004-10-13 05:06:08 +00003667peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003668 safi_t safi)
3669{
3670 int ret;
3671 struct peer *peer;
3672
3673 peer = peer_and_group_lookup_vty (vty, ip_str);
3674 if (! peer)
3675 return CMD_WARNING;
3676
3677 ret = peer_maximum_prefix_unset (peer, afi, safi);
3678
3679 return bgp_vty_return (vty, ret);
3680}
3681
3682/* Maximum number of prefix configuration. prefix count is different
3683 for each peer configuration. So this configuration can be set for
3684 each peer configuration. */
3685DEFUN (neighbor_maximum_prefix,
3686 neighbor_maximum_prefix_cmd,
3687 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3688 NEIGHBOR_STR
3689 NEIGHBOR_ADDR_STR2
3690 "Maximum number of prefix accept from this peer\n"
3691 "maximum no. of prefix limit\n")
3692{
3693 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003694 bgp_node_safi (vty), argv[1], NULL, 0,
3695 NULL);
paul718e3742002-12-13 20:15:29 +00003696}
3697
hassoe0701b72004-05-20 09:19:34 +00003698DEFUN (neighbor_maximum_prefix_threshold,
3699 neighbor_maximum_prefix_threshold_cmd,
3700 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
3701 NEIGHBOR_STR
3702 NEIGHBOR_ADDR_STR2
3703 "Maximum number of prefix accept from this peer\n"
3704 "maximum no. of prefix limit\n"
3705 "Threshold value (%) at which to generate a warning msg\n")
3706{
3707 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003708 bgp_node_safi (vty), argv[1], argv[2], 0,
3709 NULL);
3710}
hassoe0701b72004-05-20 09:19:34 +00003711
paul718e3742002-12-13 20:15:29 +00003712DEFUN (neighbor_maximum_prefix_warning,
3713 neighbor_maximum_prefix_warning_cmd,
3714 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3715 NEIGHBOR_STR
3716 NEIGHBOR_ADDR_STR2
3717 "Maximum number of prefix accept from this peer\n"
3718 "maximum no. of prefix limit\n"
3719 "Only give warning message when limit is exceeded\n")
3720{
3721 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003722 bgp_node_safi (vty), argv[1], NULL, 1,
3723 NULL);
paul718e3742002-12-13 20:15:29 +00003724}
3725
hassoe0701b72004-05-20 09:19:34 +00003726DEFUN (neighbor_maximum_prefix_threshold_warning,
3727 neighbor_maximum_prefix_threshold_warning_cmd,
3728 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
3729 NEIGHBOR_STR
3730 NEIGHBOR_ADDR_STR2
3731 "Maximum number of prefix accept from this peer\n"
3732 "maximum no. of prefix limit\n"
3733 "Threshold value (%) at which to generate a warning msg\n"
3734 "Only give warning message when limit is exceeded\n")
3735{
3736 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003737 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
3738}
3739
3740DEFUN (neighbor_maximum_prefix_restart,
3741 neighbor_maximum_prefix_restart_cmd,
3742 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
3743 NEIGHBOR_STR
3744 NEIGHBOR_ADDR_STR2
3745 "Maximum number of prefix accept from this peer\n"
3746 "maximum no. of prefix limit\n"
3747 "Restart bgp connection after limit is exceeded\n"
3748 "Restart interval in minutes")
3749{
3750 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3751 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
3752}
3753
3754DEFUN (neighbor_maximum_prefix_threshold_restart,
3755 neighbor_maximum_prefix_threshold_restart_cmd,
3756 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
3757 NEIGHBOR_STR
3758 NEIGHBOR_ADDR_STR2
3759 "Maximum number of prefix accept from this peer\n"
3760 "maximum no. of prefix limit\n"
3761 "Threshold value (%) at which to generate a warning msg\n"
3762 "Restart bgp connection after limit is exceeded\n"
3763 "Restart interval in minutes")
3764{
3765 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3766 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
3767}
hassoe0701b72004-05-20 09:19:34 +00003768
paul718e3742002-12-13 20:15:29 +00003769DEFUN (no_neighbor_maximum_prefix,
3770 no_neighbor_maximum_prefix_cmd,
3771 NO_NEIGHBOR_CMD2 "maximum-prefix",
3772 NO_STR
3773 NEIGHBOR_STR
3774 NEIGHBOR_ADDR_STR2
3775 "Maximum number of prefix accept from this peer\n")
3776{
3777 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
3778 bgp_node_safi (vty));
3779}
3780
3781ALIAS (no_neighbor_maximum_prefix,
3782 no_neighbor_maximum_prefix_val_cmd,
3783 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3784 NO_STR
3785 NEIGHBOR_STR
3786 NEIGHBOR_ADDR_STR2
3787 "Maximum number of prefix accept from this peer\n"
3788 "maximum no. of prefix limit\n")
3789
3790ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00003791 no_neighbor_maximum_prefix_threshold_cmd,
3792 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3793 NO_STR
3794 NEIGHBOR_STR
3795 NEIGHBOR_ADDR_STR2
3796 "Maximum number of prefix accept from this peer\n"
3797 "maximum no. of prefix limit\n"
3798 "Threshold value (%) at which to generate a warning msg\n")
3799
3800ALIAS (no_neighbor_maximum_prefix,
3801 no_neighbor_maximum_prefix_warning_cmd,
3802 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3803 NO_STR
3804 NEIGHBOR_STR
3805 NEIGHBOR_ADDR_STR2
3806 "Maximum number of prefix accept from this peer\n"
3807 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00003808 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00003809
3810ALIAS (no_neighbor_maximum_prefix,
3811 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00003812 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
3813 NO_STR
3814 NEIGHBOR_STR
3815 NEIGHBOR_ADDR_STR2
3816 "Maximum number of prefix accept from this peer\n"
3817 "maximum no. of prefix limit\n"
3818 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00003819 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00003820
3821ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00003822 no_neighbor_maximum_prefix_restart_cmd,
3823 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00003824 NO_STR
3825 NEIGHBOR_STR
3826 NEIGHBOR_ADDR_STR2
3827 "Maximum number of prefix accept from this peer\n"
3828 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00003829 "Restart bgp connection after limit is exceeded\n"
3830 "Restart interval in minutes")
3831
3832ALIAS (no_neighbor_maximum_prefix,
3833 no_neighbor_maximum_prefix_threshold_restart_cmd,
3834 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
3835 NO_STR
3836 NEIGHBOR_STR
3837 NEIGHBOR_ADDR_STR2
3838 "Maximum number of prefix accept from this peer\n"
3839 "maximum no. of prefix limit\n"
3840 "Threshold value (%) at which to generate a warning msg\n"
3841 "Restart bgp connection after limit is exceeded\n"
3842 "Restart interval in minutes")
paul718e3742002-12-13 20:15:29 +00003843
3844/* "neighbor allowas-in" */
3845DEFUN (neighbor_allowas_in,
3846 neighbor_allowas_in_cmd,
3847 NEIGHBOR_CMD2 "allowas-in",
3848 NEIGHBOR_STR
3849 NEIGHBOR_ADDR_STR2
3850 "Accept as-path with my AS present in it\n")
3851{
3852 int ret;
3853 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00003854 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00003855
3856 peer = peer_and_group_lookup_vty (vty, argv[0]);
3857 if (! peer)
3858 return CMD_WARNING;
3859
3860 if (argc == 1)
3861 allow_num = 3;
3862 else
3863 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
3864
3865 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
3866 allow_num);
3867
3868 return bgp_vty_return (vty, ret);
3869}
3870
3871ALIAS (neighbor_allowas_in,
3872 neighbor_allowas_in_arg_cmd,
3873 NEIGHBOR_CMD2 "allowas-in <1-10>",
3874 NEIGHBOR_STR
3875 NEIGHBOR_ADDR_STR2
3876 "Accept as-path with my AS present in it\n"
3877 "Number of occurances of AS number\n")
3878
3879DEFUN (no_neighbor_allowas_in,
3880 no_neighbor_allowas_in_cmd,
3881 NO_NEIGHBOR_CMD2 "allowas-in",
3882 NO_STR
3883 NEIGHBOR_STR
3884 NEIGHBOR_ADDR_STR2
3885 "allow local ASN appears in aspath attribute\n")
3886{
3887 int ret;
3888 struct peer *peer;
3889
3890 peer = peer_and_group_lookup_vty (vty, argv[0]);
3891 if (! peer)
3892 return CMD_WARNING;
3893
3894 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
3895
3896 return bgp_vty_return (vty, ret);
3897}
3898
3899/* Address family configuration. */
3900DEFUN (address_family_ipv4,
3901 address_family_ipv4_cmd,
3902 "address-family ipv4",
3903 "Enter Address Family command mode\n"
3904 "Address family\n")
3905{
3906 vty->node = BGP_IPV4_NODE;
3907 return CMD_SUCCESS;
3908}
3909
3910DEFUN (address_family_ipv4_safi,
3911 address_family_ipv4_safi_cmd,
3912 "address-family ipv4 (unicast|multicast)",
3913 "Enter Address Family command mode\n"
3914 "Address family\n"
3915 "Address Family modifier\n"
3916 "Address Family modifier\n")
3917{
3918 if (strncmp (argv[0], "m", 1) == 0)
3919 vty->node = BGP_IPV4M_NODE;
3920 else
3921 vty->node = BGP_IPV4_NODE;
3922
3923 return CMD_SUCCESS;
3924}
3925
paul25ffbdc2005-08-22 22:42:08 +00003926DEFUN (address_family_ipv6,
3927 address_family_ipv6_cmd,
3928 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00003929 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00003930 "Address family\n")
paul718e3742002-12-13 20:15:29 +00003931{
3932 vty->node = BGP_IPV6_NODE;
3933 return CMD_SUCCESS;
3934}
3935
paul25ffbdc2005-08-22 22:42:08 +00003936DEFUN (address_family_ipv6_safi,
3937 address_family_ipv6_safi_cmd,
3938 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00003939 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00003940 "Address family\n"
3941 "Address Family modifier\n"
3942 "Address Family modifier\n")
3943{
3944 if (strncmp (argv[0], "m", 1) == 0)
3945 vty->node = BGP_IPV6M_NODE;
3946 else
3947 vty->node = BGP_IPV6_NODE;
3948
3949 return CMD_SUCCESS;
3950}
paul718e3742002-12-13 20:15:29 +00003951
3952DEFUN (address_family_vpnv4,
3953 address_family_vpnv4_cmd,
3954 "address-family vpnv4",
3955 "Enter Address Family command mode\n"
3956 "Address family\n")
3957{
3958 vty->node = BGP_VPNV4_NODE;
3959 return CMD_SUCCESS;
3960}
3961
3962ALIAS (address_family_vpnv4,
3963 address_family_vpnv4_unicast_cmd,
3964 "address-family vpnv4 unicast",
3965 "Enter Address Family command mode\n"
3966 "Address family\n"
3967 "Address Family Modifier\n")
3968
3969DEFUN (exit_address_family,
3970 exit_address_family_cmd,
3971 "exit-address-family",
3972 "Exit from Address Family configuration mode\n")
3973{
hassoa8a80d52005-04-09 13:07:47 +00003974 if (vty->node == BGP_IPV4_NODE
3975 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00003976 || vty->node == BGP_VPNV4_NODE
paul25ffbdc2005-08-22 22:42:08 +00003977 || vty->node == BGP_IPV6_NODE
3978 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00003979 vty->node = BGP_NODE;
3980 return CMD_SUCCESS;
3981}
3982
3983/* BGP clear sort. */
3984enum clear_sort
3985{
3986 clear_all,
3987 clear_peer,
3988 clear_group,
3989 clear_external,
3990 clear_as
3991};
3992
paul94f2b392005-06-28 12:44:16 +00003993static void
paul718e3742002-12-13 20:15:29 +00003994bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
3995 safi_t safi, int error)
3996{
3997 switch (error)
3998 {
3999 case BGP_ERR_AF_UNCONFIGURED:
4000 vty_out (vty,
4001 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4002 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4003 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4004 peer->host, VTY_NEWLINE);
4005 break;
4006 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4007 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);
4008 break;
4009 default:
4010 break;
4011 }
4012}
4013
4014/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004015static int
paul718e3742002-12-13 20:15:29 +00004016bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004017 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004018{
4019 int ret;
4020 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004021 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004022
4023 /* Clear all neighbors. */
4024 if (sort == clear_all)
4025 {
paul1eb8ef22005-04-07 07:30:20 +00004026 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004027 {
4028 if (stype == BGP_CLEAR_SOFT_NONE)
4029 ret = peer_clear (peer);
4030 else
4031 ret = peer_clear_soft (peer, afi, safi, stype);
4032
4033 if (ret < 0)
4034 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4035 }
4036 return 0;
4037 }
4038
4039 /* Clear specified neighbors. */
4040 if (sort == clear_peer)
4041 {
4042 union sockunion su;
4043 int ret;
4044
4045 /* Make sockunion for lookup. */
4046 ret = str2sockunion (arg, &su);
4047 if (ret < 0)
4048 {
4049 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
4050 return -1;
4051 }
4052 peer = peer_lookup (bgp, &su);
4053 if (! peer)
4054 {
4055 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
4056 return -1;
4057 }
4058
4059 if (stype == BGP_CLEAR_SOFT_NONE)
4060 ret = peer_clear (peer);
4061 else
4062 ret = peer_clear_soft (peer, afi, safi, stype);
4063
4064 if (ret < 0)
4065 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4066
4067 return 0;
4068 }
4069
4070 /* Clear all peer-group members. */
4071 if (sort == clear_group)
4072 {
4073 struct peer_group *group;
4074
4075 group = peer_group_lookup (bgp, arg);
4076 if (! group)
4077 {
4078 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
4079 return -1;
4080 }
4081
paul1eb8ef22005-04-07 07:30:20 +00004082 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004083 {
4084 if (stype == BGP_CLEAR_SOFT_NONE)
4085 {
4086 ret = peer_clear (peer);
4087 continue;
4088 }
4089
4090 if (! peer->af_group[afi][safi])
4091 continue;
4092
4093 ret = peer_clear_soft (peer, afi, safi, stype);
4094
4095 if (ret < 0)
4096 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4097 }
4098 return 0;
4099 }
4100
4101 if (sort == clear_external)
4102 {
paul1eb8ef22005-04-07 07:30:20 +00004103 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004104 {
4105 if (peer_sort (peer) == BGP_PEER_IBGP)
4106 continue;
4107
4108 if (stype == BGP_CLEAR_SOFT_NONE)
4109 ret = peer_clear (peer);
4110 else
4111 ret = peer_clear_soft (peer, afi, safi, stype);
4112
4113 if (ret < 0)
4114 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4115 }
4116 return 0;
4117 }
4118
4119 if (sort == clear_as)
4120 {
4121 as_t as;
4122 unsigned long as_ul;
4123 char *endptr = NULL;
4124 int find = 0;
4125
4126 as_ul = strtoul(arg, &endptr, 10);
4127
4128 if ((as_ul == ULONG_MAX) || (*endptr != '\0') || (as_ul > USHRT_MAX))
4129 {
4130 vty_out (vty, "Invalid AS number%s", VTY_NEWLINE);
4131 return -1;
4132 }
4133 as = (as_t) as_ul;
4134
paul1eb8ef22005-04-07 07:30:20 +00004135 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004136 {
4137 if (peer->as != as)
4138 continue;
4139
4140 find = 1;
4141 if (stype == BGP_CLEAR_SOFT_NONE)
4142 ret = peer_clear (peer);
4143 else
4144 ret = peer_clear_soft (peer, afi, safi, stype);
4145
4146 if (ret < 0)
4147 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4148 }
4149 if (! find)
4150 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4151 VTY_NEWLINE);
4152 return 0;
4153 }
4154
4155 return 0;
4156}
4157
paul94f2b392005-06-28 12:44:16 +00004158static int
paulfd79ac92004-10-13 05:06:08 +00004159bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4160 enum clear_sort sort, enum bgp_clear_type stype,
4161 const char *arg)
paul718e3742002-12-13 20:15:29 +00004162{
4163 int ret;
4164 struct bgp *bgp;
4165
4166 /* BGP structure lookup. */
4167 if (name)
4168 {
4169 bgp = bgp_lookup_by_name (name);
4170 if (bgp == NULL)
4171 {
4172 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4173 return CMD_WARNING;
4174 }
4175 }
4176 else
4177 {
4178 bgp = bgp_get_default ();
4179 if (bgp == NULL)
4180 {
4181 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4182 return CMD_WARNING;
4183 }
4184 }
4185
4186 ret = bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
4187 if (ret < 0)
4188 return CMD_WARNING;
4189
4190 return CMD_SUCCESS;
4191}
4192
4193DEFUN (clear_ip_bgp_all,
4194 clear_ip_bgp_all_cmd,
4195 "clear ip bgp *",
4196 CLEAR_STR
4197 IP_STR
4198 BGP_STR
4199 "Clear all peers\n")
4200{
4201 if (argc == 1)
4202 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4203
4204 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4205}
4206
4207ALIAS (clear_ip_bgp_all,
4208 clear_bgp_all_cmd,
4209 "clear bgp *",
4210 CLEAR_STR
4211 BGP_STR
4212 "Clear all peers\n")
4213
4214ALIAS (clear_ip_bgp_all,
4215 clear_bgp_ipv6_all_cmd,
4216 "clear bgp ipv6 *",
4217 CLEAR_STR
4218 BGP_STR
4219 "Address family\n"
4220 "Clear all peers\n")
4221
4222ALIAS (clear_ip_bgp_all,
4223 clear_ip_bgp_instance_all_cmd,
4224 "clear ip bgp view WORD *",
4225 CLEAR_STR
4226 IP_STR
4227 BGP_STR
4228 "BGP view\n"
4229 "view name\n"
4230 "Clear all peers\n")
4231
4232ALIAS (clear_ip_bgp_all,
4233 clear_bgp_instance_all_cmd,
4234 "clear bgp view WORD *",
4235 CLEAR_STR
4236 BGP_STR
4237 "BGP view\n"
4238 "view name\n"
4239 "Clear all peers\n")
4240
4241DEFUN (clear_ip_bgp_peer,
4242 clear_ip_bgp_peer_cmd,
4243 "clear ip bgp (A.B.C.D|X:X::X:X)",
4244 CLEAR_STR
4245 IP_STR
4246 BGP_STR
4247 "BGP neighbor IP address to clear\n"
4248 "BGP IPv6 neighbor to clear\n")
4249{
4250 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4251}
4252
4253ALIAS (clear_ip_bgp_peer,
4254 clear_bgp_peer_cmd,
4255 "clear bgp (A.B.C.D|X:X::X:X)",
4256 CLEAR_STR
4257 BGP_STR
4258 "BGP neighbor address to clear\n"
4259 "BGP IPv6 neighbor to clear\n")
4260
4261ALIAS (clear_ip_bgp_peer,
4262 clear_bgp_ipv6_peer_cmd,
4263 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4264 CLEAR_STR
4265 BGP_STR
4266 "Address family\n"
4267 "BGP neighbor address to clear\n"
4268 "BGP IPv6 neighbor to clear\n")
4269
4270DEFUN (clear_ip_bgp_peer_group,
4271 clear_ip_bgp_peer_group_cmd,
4272 "clear ip bgp peer-group WORD",
4273 CLEAR_STR
4274 IP_STR
4275 BGP_STR
4276 "Clear all members of peer-group\n"
4277 "BGP peer-group name\n")
4278{
4279 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4280}
4281
4282ALIAS (clear_ip_bgp_peer_group,
4283 clear_bgp_peer_group_cmd,
4284 "clear bgp peer-group WORD",
4285 CLEAR_STR
4286 BGP_STR
4287 "Clear all members of peer-group\n"
4288 "BGP peer-group name\n")
4289
4290ALIAS (clear_ip_bgp_peer_group,
4291 clear_bgp_ipv6_peer_group_cmd,
4292 "clear bgp ipv6 peer-group WORD",
4293 CLEAR_STR
4294 BGP_STR
4295 "Address family\n"
4296 "Clear all members of peer-group\n"
4297 "BGP peer-group name\n")
4298
4299DEFUN (clear_ip_bgp_external,
4300 clear_ip_bgp_external_cmd,
4301 "clear ip bgp external",
4302 CLEAR_STR
4303 IP_STR
4304 BGP_STR
4305 "Clear all external peers\n")
4306{
4307 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4308}
4309
4310ALIAS (clear_ip_bgp_external,
4311 clear_bgp_external_cmd,
4312 "clear bgp external",
4313 CLEAR_STR
4314 BGP_STR
4315 "Clear all external peers\n")
4316
4317ALIAS (clear_ip_bgp_external,
4318 clear_bgp_ipv6_external_cmd,
4319 "clear bgp ipv6 external",
4320 CLEAR_STR
4321 BGP_STR
4322 "Address family\n"
4323 "Clear all external peers\n")
4324
4325DEFUN (clear_ip_bgp_as,
4326 clear_ip_bgp_as_cmd,
4327 "clear ip bgp <1-65535>",
4328 CLEAR_STR
4329 IP_STR
4330 BGP_STR
4331 "Clear peers with the AS number\n")
4332{
4333 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4334}
4335
4336ALIAS (clear_ip_bgp_as,
4337 clear_bgp_as_cmd,
4338 "clear bgp <1-65535>",
4339 CLEAR_STR
4340 BGP_STR
4341 "Clear peers with the AS number\n")
4342
4343ALIAS (clear_ip_bgp_as,
4344 clear_bgp_ipv6_as_cmd,
4345 "clear bgp ipv6 <1-65535>",
4346 CLEAR_STR
4347 BGP_STR
4348 "Address family\n"
4349 "Clear peers with the AS number\n")
4350
4351/* Outbound soft-reconfiguration */
4352DEFUN (clear_ip_bgp_all_soft_out,
4353 clear_ip_bgp_all_soft_out_cmd,
4354 "clear ip bgp * soft out",
4355 CLEAR_STR
4356 IP_STR
4357 BGP_STR
4358 "Clear all peers\n"
4359 "Soft reconfig\n"
4360 "Soft reconfig outbound update\n")
4361{
4362 if (argc == 1)
4363 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4364 BGP_CLEAR_SOFT_OUT, NULL);
4365
4366 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4367 BGP_CLEAR_SOFT_OUT, NULL);
4368}
4369
4370ALIAS (clear_ip_bgp_all_soft_out,
4371 clear_ip_bgp_all_out_cmd,
4372 "clear ip bgp * out",
4373 CLEAR_STR
4374 IP_STR
4375 BGP_STR
4376 "Clear all peers\n"
4377 "Soft reconfig outbound update\n")
4378
4379ALIAS (clear_ip_bgp_all_soft_out,
4380 clear_ip_bgp_instance_all_soft_out_cmd,
4381 "clear ip bgp view WORD * soft out",
4382 CLEAR_STR
4383 IP_STR
4384 BGP_STR
4385 "BGP view\n"
4386 "view name\n"
4387 "Clear all peers\n"
4388 "Soft reconfig\n"
4389 "Soft reconfig outbound update\n")
4390
4391DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4392 clear_ip_bgp_all_ipv4_soft_out_cmd,
4393 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4394 CLEAR_STR
4395 IP_STR
4396 BGP_STR
4397 "Clear all peers\n"
4398 "Address family\n"
4399 "Address Family modifier\n"
4400 "Address Family modifier\n"
4401 "Soft reconfig\n"
4402 "Soft reconfig outbound update\n")
4403{
4404 if (strncmp (argv[0], "m", 1) == 0)
4405 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4406 BGP_CLEAR_SOFT_OUT, NULL);
4407
4408 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4409 BGP_CLEAR_SOFT_OUT, NULL);
4410}
4411
4412ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4413 clear_ip_bgp_all_ipv4_out_cmd,
4414 "clear ip bgp * ipv4 (unicast|multicast) out",
4415 CLEAR_STR
4416 IP_STR
4417 BGP_STR
4418 "Clear all peers\n"
4419 "Address family\n"
4420 "Address Family modifier\n"
4421 "Address Family modifier\n"
4422 "Soft reconfig outbound update\n")
4423
4424DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4425 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4426 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4427 CLEAR_STR
4428 IP_STR
4429 BGP_STR
4430 "BGP view\n"
4431 "view name\n"
4432 "Clear all peers\n"
4433 "Address family\n"
4434 "Address Family modifier\n"
4435 "Address Family modifier\n"
4436 "Soft reconfig outbound update\n")
4437{
4438 if (strncmp (argv[1], "m", 1) == 0)
4439 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4440 BGP_CLEAR_SOFT_OUT, NULL);
4441
4442 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4443 BGP_CLEAR_SOFT_OUT, NULL);
4444}
4445
4446DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4447 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4448 "clear ip bgp * vpnv4 unicast soft out",
4449 CLEAR_STR
4450 IP_STR
4451 BGP_STR
4452 "Clear all peers\n"
4453 "Address family\n"
4454 "Address Family Modifier\n"
4455 "Soft reconfig\n"
4456 "Soft reconfig outbound update\n")
4457{
4458 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4459 BGP_CLEAR_SOFT_OUT, NULL);
4460}
4461
4462ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4463 clear_ip_bgp_all_vpnv4_out_cmd,
4464 "clear ip bgp * vpnv4 unicast out",
4465 CLEAR_STR
4466 IP_STR
4467 BGP_STR
4468 "Clear all peers\n"
4469 "Address family\n"
4470 "Address Family Modifier\n"
4471 "Soft reconfig outbound update\n")
4472
4473DEFUN (clear_bgp_all_soft_out,
4474 clear_bgp_all_soft_out_cmd,
4475 "clear bgp * soft out",
4476 CLEAR_STR
4477 BGP_STR
4478 "Clear all peers\n"
4479 "Soft reconfig\n"
4480 "Soft reconfig outbound update\n")
4481{
4482 if (argc == 1)
4483 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4484 BGP_CLEAR_SOFT_OUT, NULL);
4485
4486 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4487 BGP_CLEAR_SOFT_OUT, NULL);
4488}
4489
4490ALIAS (clear_bgp_all_soft_out,
4491 clear_bgp_instance_all_soft_out_cmd,
4492 "clear bgp view WORD * soft out",
4493 CLEAR_STR
4494 BGP_STR
4495 "BGP view\n"
4496 "view name\n"
4497 "Clear all peers\n"
4498 "Soft reconfig\n"
4499 "Soft reconfig outbound update\n")
4500
4501ALIAS (clear_bgp_all_soft_out,
4502 clear_bgp_all_out_cmd,
4503 "clear bgp * out",
4504 CLEAR_STR
4505 BGP_STR
4506 "Clear all peers\n"
4507 "Soft reconfig outbound update\n")
4508
4509ALIAS (clear_bgp_all_soft_out,
4510 clear_bgp_ipv6_all_soft_out_cmd,
4511 "clear bgp ipv6 * soft out",
4512 CLEAR_STR
4513 BGP_STR
4514 "Address family\n"
4515 "Clear all peers\n"
4516 "Soft reconfig\n"
4517 "Soft reconfig outbound update\n")
4518
4519ALIAS (clear_bgp_all_soft_out,
4520 clear_bgp_ipv6_all_out_cmd,
4521 "clear bgp ipv6 * out",
4522 CLEAR_STR
4523 BGP_STR
4524 "Address family\n"
4525 "Clear all peers\n"
4526 "Soft reconfig outbound update\n")
4527
4528DEFUN (clear_ip_bgp_peer_soft_out,
4529 clear_ip_bgp_peer_soft_out_cmd,
4530 "clear ip bgp A.B.C.D soft out",
4531 CLEAR_STR
4532 IP_STR
4533 BGP_STR
4534 "BGP neighbor address to clear\n"
4535 "Soft reconfig\n"
4536 "Soft reconfig outbound update\n")
4537{
4538 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4539 BGP_CLEAR_SOFT_OUT, argv[0]);
4540}
4541
4542ALIAS (clear_ip_bgp_peer_soft_out,
4543 clear_ip_bgp_peer_out_cmd,
4544 "clear ip bgp A.B.C.D out",
4545 CLEAR_STR
4546 IP_STR
4547 BGP_STR
4548 "BGP neighbor address to clear\n"
4549 "Soft reconfig outbound update\n")
4550
4551DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4552 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4553 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4554 CLEAR_STR
4555 IP_STR
4556 BGP_STR
4557 "BGP neighbor address to clear\n"
4558 "Address family\n"
4559 "Address Family modifier\n"
4560 "Address Family modifier\n"
4561 "Soft reconfig\n"
4562 "Soft reconfig outbound update\n")
4563{
4564 if (strncmp (argv[1], "m", 1) == 0)
4565 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4566 BGP_CLEAR_SOFT_OUT, argv[0]);
4567
4568 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4569 BGP_CLEAR_SOFT_OUT, argv[0]);
4570}
4571
4572ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
4573 clear_ip_bgp_peer_ipv4_out_cmd,
4574 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
4575 CLEAR_STR
4576 IP_STR
4577 BGP_STR
4578 "BGP neighbor address to clear\n"
4579 "Address family\n"
4580 "Address Family modifier\n"
4581 "Address Family modifier\n"
4582 "Soft reconfig outbound update\n")
4583
4584DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
4585 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
4586 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
4587 CLEAR_STR
4588 IP_STR
4589 BGP_STR
4590 "BGP neighbor address to clear\n"
4591 "Address family\n"
4592 "Address Family Modifier\n"
4593 "Soft reconfig\n"
4594 "Soft reconfig outbound update\n")
4595{
4596 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
4597 BGP_CLEAR_SOFT_OUT, argv[0]);
4598}
4599
4600ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
4601 clear_ip_bgp_peer_vpnv4_out_cmd,
4602 "clear ip bgp A.B.C.D vpnv4 unicast out",
4603 CLEAR_STR
4604 IP_STR
4605 BGP_STR
4606 "BGP neighbor address to clear\n"
4607 "Address family\n"
4608 "Address Family Modifier\n"
4609 "Soft reconfig outbound update\n")
4610
4611DEFUN (clear_bgp_peer_soft_out,
4612 clear_bgp_peer_soft_out_cmd,
4613 "clear bgp (A.B.C.D|X:X::X:X) soft out",
4614 CLEAR_STR
4615 BGP_STR
4616 "BGP neighbor address to clear\n"
4617 "BGP IPv6 neighbor to clear\n"
4618 "Soft reconfig\n"
4619 "Soft reconfig outbound update\n")
4620{
4621 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
4622 BGP_CLEAR_SOFT_OUT, argv[0]);
4623}
4624
4625ALIAS (clear_bgp_peer_soft_out,
4626 clear_bgp_ipv6_peer_soft_out_cmd,
4627 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
4628 CLEAR_STR
4629 BGP_STR
4630 "Address family\n"
4631 "BGP neighbor address to clear\n"
4632 "BGP IPv6 neighbor to clear\n"
4633 "Soft reconfig\n"
4634 "Soft reconfig outbound update\n")
4635
4636ALIAS (clear_bgp_peer_soft_out,
4637 clear_bgp_peer_out_cmd,
4638 "clear bgp (A.B.C.D|X:X::X:X) out",
4639 CLEAR_STR
4640 BGP_STR
4641 "BGP neighbor address to clear\n"
4642 "BGP IPv6 neighbor to clear\n"
4643 "Soft reconfig outbound update\n")
4644
4645ALIAS (clear_bgp_peer_soft_out,
4646 clear_bgp_ipv6_peer_out_cmd,
4647 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
4648 CLEAR_STR
4649 BGP_STR
4650 "Address family\n"
4651 "BGP neighbor address to clear\n"
4652 "BGP IPv6 neighbor to clear\n"
4653 "Soft reconfig outbound update\n")
4654
4655DEFUN (clear_ip_bgp_peer_group_soft_out,
4656 clear_ip_bgp_peer_group_soft_out_cmd,
4657 "clear ip bgp peer-group WORD soft out",
4658 CLEAR_STR
4659 IP_STR
4660 BGP_STR
4661 "Clear all members of peer-group\n"
4662 "BGP peer-group name\n"
4663 "Soft reconfig\n"
4664 "Soft reconfig outbound update\n")
4665{
4666 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4667 BGP_CLEAR_SOFT_OUT, argv[0]);
4668}
4669
4670ALIAS (clear_ip_bgp_peer_group_soft_out,
4671 clear_ip_bgp_peer_group_out_cmd,
4672 "clear ip bgp peer-group WORD out",
4673 CLEAR_STR
4674 IP_STR
4675 BGP_STR
4676 "Clear all members of peer-group\n"
4677 "BGP peer-group name\n"
4678 "Soft reconfig outbound update\n")
4679
4680DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
4681 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
4682 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
4683 CLEAR_STR
4684 IP_STR
4685 BGP_STR
4686 "Clear all members of peer-group\n"
4687 "BGP peer-group name\n"
4688 "Address family\n"
4689 "Address Family modifier\n"
4690 "Address Family modifier\n"
4691 "Soft reconfig\n"
4692 "Soft reconfig outbound update\n")
4693{
4694 if (strncmp (argv[1], "m", 1) == 0)
4695 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
4696 BGP_CLEAR_SOFT_OUT, argv[0]);
4697
4698 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4699 BGP_CLEAR_SOFT_OUT, argv[0]);
4700}
4701
4702ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
4703 clear_ip_bgp_peer_group_ipv4_out_cmd,
4704 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
4705 CLEAR_STR
4706 IP_STR
4707 BGP_STR
4708 "Clear all members of peer-group\n"
4709 "BGP peer-group name\n"
4710 "Address family\n"
4711 "Address Family modifier\n"
4712 "Address Family modifier\n"
4713 "Soft reconfig outbound update\n")
4714
4715DEFUN (clear_bgp_peer_group_soft_out,
4716 clear_bgp_peer_group_soft_out_cmd,
4717 "clear bgp peer-group WORD soft out",
4718 CLEAR_STR
4719 BGP_STR
4720 "Clear all members of peer-group\n"
4721 "BGP peer-group name\n"
4722 "Soft reconfig\n"
4723 "Soft reconfig outbound update\n")
4724{
4725 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
4726 BGP_CLEAR_SOFT_OUT, argv[0]);
4727}
4728
4729ALIAS (clear_bgp_peer_group_soft_out,
4730 clear_bgp_ipv6_peer_group_soft_out_cmd,
4731 "clear bgp ipv6 peer-group WORD soft out",
4732 CLEAR_STR
4733 BGP_STR
4734 "Address family\n"
4735 "Clear all members of peer-group\n"
4736 "BGP peer-group name\n"
4737 "Soft reconfig\n"
4738 "Soft reconfig outbound update\n")
4739
4740ALIAS (clear_bgp_peer_group_soft_out,
4741 clear_bgp_peer_group_out_cmd,
4742 "clear bgp peer-group WORD out",
4743 CLEAR_STR
4744 BGP_STR
4745 "Clear all members of peer-group\n"
4746 "BGP peer-group name\n"
4747 "Soft reconfig outbound update\n")
4748
4749ALIAS (clear_bgp_peer_group_soft_out,
4750 clear_bgp_ipv6_peer_group_out_cmd,
4751 "clear bgp ipv6 peer-group WORD out",
4752 CLEAR_STR
4753 BGP_STR
4754 "Address family\n"
4755 "Clear all members of peer-group\n"
4756 "BGP peer-group name\n"
4757 "Soft reconfig outbound update\n")
4758
4759DEFUN (clear_ip_bgp_external_soft_out,
4760 clear_ip_bgp_external_soft_out_cmd,
4761 "clear ip bgp external soft out",
4762 CLEAR_STR
4763 IP_STR
4764 BGP_STR
4765 "Clear all external peers\n"
4766 "Soft reconfig\n"
4767 "Soft reconfig outbound update\n")
4768{
4769 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
4770 BGP_CLEAR_SOFT_OUT, NULL);
4771}
4772
4773ALIAS (clear_ip_bgp_external_soft_out,
4774 clear_ip_bgp_external_out_cmd,
4775 "clear ip bgp external out",
4776 CLEAR_STR
4777 IP_STR
4778 BGP_STR
4779 "Clear all external peers\n"
4780 "Soft reconfig outbound update\n")
4781
4782DEFUN (clear_ip_bgp_external_ipv4_soft_out,
4783 clear_ip_bgp_external_ipv4_soft_out_cmd,
4784 "clear ip bgp external ipv4 (unicast|multicast) soft out",
4785 CLEAR_STR
4786 IP_STR
4787 BGP_STR
4788 "Clear all external peers\n"
4789 "Address family\n"
4790 "Address Family modifier\n"
4791 "Address Family modifier\n"
4792 "Soft reconfig\n"
4793 "Soft reconfig outbound update\n")
4794{
4795 if (strncmp (argv[0], "m", 1) == 0)
4796 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
4797 BGP_CLEAR_SOFT_OUT, NULL);
4798
4799 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
4800 BGP_CLEAR_SOFT_OUT, NULL);
4801}
4802
4803ALIAS (clear_ip_bgp_external_ipv4_soft_out,
4804 clear_ip_bgp_external_ipv4_out_cmd,
4805 "clear ip bgp external ipv4 (unicast|multicast) out",
4806 CLEAR_STR
4807 IP_STR
4808 BGP_STR
4809 "Clear all external peers\n"
4810 "Address family\n"
4811 "Address Family modifier\n"
4812 "Address Family modifier\n"
4813 "Soft reconfig outbound update\n")
4814
4815DEFUN (clear_bgp_external_soft_out,
4816 clear_bgp_external_soft_out_cmd,
4817 "clear bgp external soft out",
4818 CLEAR_STR
4819 BGP_STR
4820 "Clear all external peers\n"
4821 "Soft reconfig\n"
4822 "Soft reconfig outbound update\n")
4823{
4824 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
4825 BGP_CLEAR_SOFT_OUT, NULL);
4826}
4827
4828ALIAS (clear_bgp_external_soft_out,
4829 clear_bgp_ipv6_external_soft_out_cmd,
4830 "clear bgp ipv6 external soft out",
4831 CLEAR_STR
4832 BGP_STR
4833 "Address family\n"
4834 "Clear all external peers\n"
4835 "Soft reconfig\n"
4836 "Soft reconfig outbound update\n")
4837
4838ALIAS (clear_bgp_external_soft_out,
4839 clear_bgp_external_out_cmd,
4840 "clear bgp external out",
4841 CLEAR_STR
4842 BGP_STR
4843 "Clear all external peers\n"
4844 "Soft reconfig outbound update\n")
4845
4846ALIAS (clear_bgp_external_soft_out,
4847 clear_bgp_ipv6_external_out_cmd,
4848 "clear bgp ipv6 external WORD out",
4849 CLEAR_STR
4850 BGP_STR
4851 "Address family\n"
4852 "Clear all external peers\n"
4853 "Soft reconfig outbound update\n")
4854
4855DEFUN (clear_ip_bgp_as_soft_out,
4856 clear_ip_bgp_as_soft_out_cmd,
4857 "clear ip bgp <1-65535> soft out",
4858 CLEAR_STR
4859 IP_STR
4860 BGP_STR
4861 "Clear peers with the AS number\n"
4862 "Soft reconfig\n"
4863 "Soft reconfig outbound update\n")
4864{
4865 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
4866 BGP_CLEAR_SOFT_OUT, argv[0]);
4867}
4868
4869ALIAS (clear_ip_bgp_as_soft_out,
4870 clear_ip_bgp_as_out_cmd,
4871 "clear ip bgp <1-65535> out",
4872 CLEAR_STR
4873 IP_STR
4874 BGP_STR
4875 "Clear peers with the AS number\n"
4876 "Soft reconfig outbound update\n")
4877
4878DEFUN (clear_ip_bgp_as_ipv4_soft_out,
4879 clear_ip_bgp_as_ipv4_soft_out_cmd,
4880 "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft out",
4881 CLEAR_STR
4882 IP_STR
4883 BGP_STR
4884 "Clear peers with the AS number\n"
4885 "Address family\n"
4886 "Address Family modifier\n"
4887 "Address Family modifier\n"
4888 "Soft reconfig\n"
4889 "Soft reconfig outbound update\n")
4890{
4891 if (strncmp (argv[1], "m", 1) == 0)
4892 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
4893 BGP_CLEAR_SOFT_OUT, argv[0]);
4894
4895 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
4896 BGP_CLEAR_SOFT_OUT, argv[0]);
4897}
4898
4899ALIAS (clear_ip_bgp_as_ipv4_soft_out,
4900 clear_ip_bgp_as_ipv4_out_cmd,
4901 "clear ip bgp <1-65535> ipv4 (unicast|multicast) out",
4902 CLEAR_STR
4903 IP_STR
4904 BGP_STR
4905 "Clear peers with the AS number\n"
4906 "Address family\n"
4907 "Address Family modifier\n"
4908 "Address Family modifier\n"
4909 "Soft reconfig outbound update\n")
4910
4911DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
4912 clear_ip_bgp_as_vpnv4_soft_out_cmd,
4913 "clear ip bgp <1-65535> vpnv4 unicast soft out",
4914 CLEAR_STR
4915 IP_STR
4916 BGP_STR
4917 "Clear peers with the AS number\n"
4918 "Address family\n"
4919 "Address Family modifier\n"
4920 "Soft reconfig\n"
4921 "Soft reconfig outbound update\n")
4922{
4923 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
4924 BGP_CLEAR_SOFT_OUT, argv[0]);
4925}
4926
4927ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
4928 clear_ip_bgp_as_vpnv4_out_cmd,
4929 "clear ip bgp <1-65535> vpnv4 unicast out",
4930 CLEAR_STR
4931 IP_STR
4932 BGP_STR
4933 "Clear peers with the AS number\n"
4934 "Address family\n"
4935 "Address Family modifier\n"
4936 "Soft reconfig outbound update\n")
4937
4938DEFUN (clear_bgp_as_soft_out,
4939 clear_bgp_as_soft_out_cmd,
4940 "clear bgp <1-65535> soft out",
4941 CLEAR_STR
4942 BGP_STR
4943 "Clear peers with the AS number\n"
4944 "Soft reconfig\n"
4945 "Soft reconfig outbound update\n")
4946{
4947 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
4948 BGP_CLEAR_SOFT_OUT, argv[0]);
4949}
4950
4951ALIAS (clear_bgp_as_soft_out,
4952 clear_bgp_ipv6_as_soft_out_cmd,
4953 "clear bgp ipv6 <1-65535> soft out",
4954 CLEAR_STR
4955 BGP_STR
4956 "Address family\n"
4957 "Clear peers with the AS number\n"
4958 "Soft reconfig\n"
4959 "Soft reconfig outbound update\n")
4960
4961ALIAS (clear_bgp_as_soft_out,
4962 clear_bgp_as_out_cmd,
4963 "clear bgp <1-65535> out",
4964 CLEAR_STR
4965 BGP_STR
4966 "Clear peers with the AS number\n"
4967 "Soft reconfig outbound update\n")
4968
4969ALIAS (clear_bgp_as_soft_out,
4970 clear_bgp_ipv6_as_out_cmd,
4971 "clear bgp ipv6 <1-65535> out",
4972 CLEAR_STR
4973 BGP_STR
4974 "Address family\n"
4975 "Clear peers with the AS number\n"
4976 "Soft reconfig outbound update\n")
4977
4978/* Inbound soft-reconfiguration */
4979DEFUN (clear_ip_bgp_all_soft_in,
4980 clear_ip_bgp_all_soft_in_cmd,
4981 "clear ip bgp * soft in",
4982 CLEAR_STR
4983 IP_STR
4984 BGP_STR
4985 "Clear all peers\n"
4986 "Soft reconfig\n"
4987 "Soft reconfig inbound update\n")
4988{
4989 if (argc == 1)
4990 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4991 BGP_CLEAR_SOFT_IN, NULL);
4992
4993 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4994 BGP_CLEAR_SOFT_IN, NULL);
4995}
4996
4997ALIAS (clear_ip_bgp_all_soft_in,
4998 clear_ip_bgp_instance_all_soft_in_cmd,
4999 "clear ip bgp view WORD * soft in",
5000 CLEAR_STR
5001 IP_STR
5002 BGP_STR
5003 "BGP view\n"
5004 "view name\n"
5005 "Clear all peers\n"
5006 "Soft reconfig\n"
5007 "Soft reconfig inbound update\n")
5008
5009ALIAS (clear_ip_bgp_all_soft_in,
5010 clear_ip_bgp_all_in_cmd,
5011 "clear ip bgp * in",
5012 CLEAR_STR
5013 IP_STR
5014 BGP_STR
5015 "Clear all peers\n"
5016 "Soft reconfig inbound update\n")
5017
5018DEFUN (clear_ip_bgp_all_in_prefix_filter,
5019 clear_ip_bgp_all_in_prefix_filter_cmd,
5020 "clear ip bgp * in prefix-filter",
5021 CLEAR_STR
5022 IP_STR
5023 BGP_STR
5024 "Clear all peers\n"
5025 "Soft reconfig inbound update\n"
5026 "Push out prefix-list ORF and do inbound soft reconfig\n")
5027{
5028 if (argc== 1)
5029 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5030 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5031
5032 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5033 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5034}
5035
5036ALIAS (clear_ip_bgp_all_in_prefix_filter,
5037 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5038 "clear ip bgp view WORD * in prefix-filter",
5039 CLEAR_STR
5040 IP_STR
5041 BGP_STR
5042 "BGP view\n"
5043 "view name\n"
5044 "Clear all peers\n"
5045 "Soft reconfig inbound update\n"
5046 "Push out prefix-list ORF and do inbound soft reconfig\n")
5047
5048
5049DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5050 clear_ip_bgp_all_ipv4_soft_in_cmd,
5051 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5052 CLEAR_STR
5053 IP_STR
5054 BGP_STR
5055 "Clear all peers\n"
5056 "Address family\n"
5057 "Address Family modifier\n"
5058 "Address Family modifier\n"
5059 "Soft reconfig\n"
5060 "Soft reconfig inbound update\n")
5061{
5062 if (strncmp (argv[0], "m", 1) == 0)
5063 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5064 BGP_CLEAR_SOFT_IN, NULL);
5065
5066 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5067 BGP_CLEAR_SOFT_IN, NULL);
5068}
5069
5070ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5071 clear_ip_bgp_all_ipv4_in_cmd,
5072 "clear ip bgp * ipv4 (unicast|multicast) in",
5073 CLEAR_STR
5074 IP_STR
5075 BGP_STR
5076 "Clear all peers\n"
5077 "Address family\n"
5078 "Address Family modifier\n"
5079 "Address Family modifier\n"
5080 "Soft reconfig inbound update\n")
5081
5082DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5083 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5084 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5085 CLEAR_STR
5086 IP_STR
5087 BGP_STR
5088 "BGP view\n"
5089 "view name\n"
5090 "Clear all peers\n"
5091 "Address family\n"
5092 "Address Family modifier\n"
5093 "Address Family modifier\n"
5094 "Soft reconfig\n"
5095 "Soft reconfig inbound update\n")
5096{
5097 if (strncmp (argv[1], "m", 1) == 0)
5098 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5099 BGP_CLEAR_SOFT_IN, NULL);
5100
5101 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5102 BGP_CLEAR_SOFT_IN, NULL);
5103}
5104
5105DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5106 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5107 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5108 CLEAR_STR
5109 IP_STR
5110 BGP_STR
5111 "Clear all peers\n"
5112 "Address family\n"
5113 "Address Family modifier\n"
5114 "Address Family modifier\n"
5115 "Soft reconfig inbound update\n"
5116 "Push out prefix-list ORF and do inbound soft reconfig\n")
5117{
5118 if (strncmp (argv[0], "m", 1) == 0)
5119 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5120 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5121
5122 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5123 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5124}
5125
5126DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5127 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5128 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5129 CLEAR_STR
5130 IP_STR
5131 BGP_STR
5132 "Clear all peers\n"
5133 "Address family\n"
5134 "Address Family modifier\n"
5135 "Address Family modifier\n"
5136 "Soft reconfig inbound update\n"
5137 "Push out prefix-list ORF and do inbound soft reconfig\n")
5138{
5139 if (strncmp (argv[1], "m", 1) == 0)
5140 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5141 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5142
5143 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5144 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5145}
5146
5147DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5148 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5149 "clear ip bgp * vpnv4 unicast soft in",
5150 CLEAR_STR
5151 IP_STR
5152 BGP_STR
5153 "Clear all peers\n"
5154 "Address family\n"
5155 "Address Family Modifier\n"
5156 "Soft reconfig\n"
5157 "Soft reconfig inbound update\n")
5158{
5159 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5160 BGP_CLEAR_SOFT_IN, NULL);
5161}
5162
5163ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5164 clear_ip_bgp_all_vpnv4_in_cmd,
5165 "clear ip bgp * vpnv4 unicast in",
5166 CLEAR_STR
5167 IP_STR
5168 BGP_STR
5169 "Clear all peers\n"
5170 "Address family\n"
5171 "Address Family Modifier\n"
5172 "Soft reconfig inbound update\n")
5173
5174DEFUN (clear_bgp_all_soft_in,
5175 clear_bgp_all_soft_in_cmd,
5176 "clear bgp * soft in",
5177 CLEAR_STR
5178 BGP_STR
5179 "Clear all peers\n"
5180 "Soft reconfig\n"
5181 "Soft reconfig inbound update\n")
5182{
5183 if (argc == 1)
5184 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5185 BGP_CLEAR_SOFT_IN, NULL);
5186
5187 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5188 BGP_CLEAR_SOFT_IN, NULL);
5189}
5190
5191ALIAS (clear_bgp_all_soft_in,
5192 clear_bgp_instance_all_soft_in_cmd,
5193 "clear bgp view WORD * soft in",
5194 CLEAR_STR
5195 BGP_STR
5196 "BGP view\n"
5197 "view name\n"
5198 "Clear all peers\n"
5199 "Soft reconfig\n"
5200 "Soft reconfig inbound update\n")
5201
5202ALIAS (clear_bgp_all_soft_in,
5203 clear_bgp_ipv6_all_soft_in_cmd,
5204 "clear bgp ipv6 * soft in",
5205 CLEAR_STR
5206 BGP_STR
5207 "Address family\n"
5208 "Clear all peers\n"
5209 "Soft reconfig\n"
5210 "Soft reconfig inbound update\n")
5211
5212ALIAS (clear_bgp_all_soft_in,
5213 clear_bgp_all_in_cmd,
5214 "clear bgp * in",
5215 CLEAR_STR
5216 BGP_STR
5217 "Clear all peers\n"
5218 "Soft reconfig inbound update\n")
5219
5220ALIAS (clear_bgp_all_soft_in,
5221 clear_bgp_ipv6_all_in_cmd,
5222 "clear bgp ipv6 * in",
5223 CLEAR_STR
5224 BGP_STR
5225 "Address family\n"
5226 "Clear all peers\n"
5227 "Soft reconfig inbound update\n")
5228
5229DEFUN (clear_bgp_all_in_prefix_filter,
5230 clear_bgp_all_in_prefix_filter_cmd,
5231 "clear bgp * in prefix-filter",
5232 CLEAR_STR
5233 BGP_STR
5234 "Clear all peers\n"
5235 "Soft reconfig inbound update\n"
5236 "Push out prefix-list ORF and do inbound soft reconfig\n")
5237{
5238 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5239 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5240}
5241
5242ALIAS (clear_bgp_all_in_prefix_filter,
5243 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5244 "clear bgp ipv6 * in prefix-filter",
5245 CLEAR_STR
5246 BGP_STR
5247 "Address family\n"
5248 "Clear all peers\n"
5249 "Soft reconfig inbound update\n"
5250 "Push out prefix-list ORF and do inbound soft reconfig\n")
5251
5252DEFUN (clear_ip_bgp_peer_soft_in,
5253 clear_ip_bgp_peer_soft_in_cmd,
5254 "clear ip bgp A.B.C.D soft in",
5255 CLEAR_STR
5256 IP_STR
5257 BGP_STR
5258 "BGP neighbor address to clear\n"
5259 "Soft reconfig\n"
5260 "Soft reconfig inbound update\n")
5261{
5262 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5263 BGP_CLEAR_SOFT_IN, argv[0]);
5264}
5265
5266ALIAS (clear_ip_bgp_peer_soft_in,
5267 clear_ip_bgp_peer_in_cmd,
5268 "clear ip bgp A.B.C.D in",
5269 CLEAR_STR
5270 IP_STR
5271 BGP_STR
5272 "BGP neighbor address to clear\n"
5273 "Soft reconfig inbound update\n")
5274
5275DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5276 clear_ip_bgp_peer_in_prefix_filter_cmd,
5277 "clear ip bgp A.B.C.D in prefix-filter",
5278 CLEAR_STR
5279 IP_STR
5280 BGP_STR
5281 "BGP neighbor address to clear\n"
5282 "Soft reconfig inbound update\n"
5283 "Push out the existing ORF prefix-list\n")
5284{
5285 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5286 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5287}
5288
5289DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5290 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5291 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5292 CLEAR_STR
5293 IP_STR
5294 BGP_STR
5295 "BGP neighbor address to clear\n"
5296 "Address family\n"
5297 "Address Family modifier\n"
5298 "Address Family modifier\n"
5299 "Soft reconfig\n"
5300 "Soft reconfig inbound update\n")
5301{
5302 if (strncmp (argv[1], "m", 1) == 0)
5303 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5304 BGP_CLEAR_SOFT_IN, argv[0]);
5305
5306 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5307 BGP_CLEAR_SOFT_IN, argv[0]);
5308}
5309
5310ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5311 clear_ip_bgp_peer_ipv4_in_cmd,
5312 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5313 CLEAR_STR
5314 IP_STR
5315 BGP_STR
5316 "BGP neighbor address to clear\n"
5317 "Address family\n"
5318 "Address Family modifier\n"
5319 "Address Family modifier\n"
5320 "Soft reconfig inbound update\n")
5321
5322DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5323 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5324 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5325 CLEAR_STR
5326 IP_STR
5327 BGP_STR
5328 "BGP neighbor address to clear\n"
5329 "Address family\n"
5330 "Address Family modifier\n"
5331 "Address Family modifier\n"
5332 "Soft reconfig inbound update\n"
5333 "Push out the existing ORF prefix-list\n")
5334{
5335 if (strncmp (argv[1], "m", 1) == 0)
5336 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5337 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5338
5339 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5340 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5341}
5342
5343DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5344 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5345 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5346 CLEAR_STR
5347 IP_STR
5348 BGP_STR
5349 "BGP neighbor address to clear\n"
5350 "Address family\n"
5351 "Address Family Modifier\n"
5352 "Soft reconfig\n"
5353 "Soft reconfig inbound update\n")
5354{
5355 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5356 BGP_CLEAR_SOFT_IN, argv[0]);
5357}
5358
5359ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5360 clear_ip_bgp_peer_vpnv4_in_cmd,
5361 "clear ip bgp A.B.C.D vpnv4 unicast in",
5362 CLEAR_STR
5363 IP_STR
5364 BGP_STR
5365 "BGP neighbor address to clear\n"
5366 "Address family\n"
5367 "Address Family Modifier\n"
5368 "Soft reconfig inbound update\n")
5369
5370DEFUN (clear_bgp_peer_soft_in,
5371 clear_bgp_peer_soft_in_cmd,
5372 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5373 CLEAR_STR
5374 BGP_STR
5375 "BGP neighbor address to clear\n"
5376 "BGP IPv6 neighbor to clear\n"
5377 "Soft reconfig\n"
5378 "Soft reconfig inbound update\n")
5379{
5380 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5381 BGP_CLEAR_SOFT_IN, argv[0]);
5382}
5383
5384ALIAS (clear_bgp_peer_soft_in,
5385 clear_bgp_ipv6_peer_soft_in_cmd,
5386 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5387 CLEAR_STR
5388 BGP_STR
5389 "Address family\n"
5390 "BGP neighbor address to clear\n"
5391 "BGP IPv6 neighbor to clear\n"
5392 "Soft reconfig\n"
5393 "Soft reconfig inbound update\n")
5394
5395ALIAS (clear_bgp_peer_soft_in,
5396 clear_bgp_peer_in_cmd,
5397 "clear bgp (A.B.C.D|X:X::X:X) in",
5398 CLEAR_STR
5399 BGP_STR
5400 "BGP neighbor address to clear\n"
5401 "BGP IPv6 neighbor to clear\n"
5402 "Soft reconfig inbound update\n")
5403
5404ALIAS (clear_bgp_peer_soft_in,
5405 clear_bgp_ipv6_peer_in_cmd,
5406 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5407 CLEAR_STR
5408 BGP_STR
5409 "Address family\n"
5410 "BGP neighbor address to clear\n"
5411 "BGP IPv6 neighbor to clear\n"
5412 "Soft reconfig inbound update\n")
5413
5414DEFUN (clear_bgp_peer_in_prefix_filter,
5415 clear_bgp_peer_in_prefix_filter_cmd,
5416 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5417 CLEAR_STR
5418 BGP_STR
5419 "BGP neighbor address to clear\n"
5420 "BGP IPv6 neighbor to clear\n"
5421 "Soft reconfig inbound update\n"
5422 "Push out the existing ORF prefix-list\n")
5423{
5424 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5425 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5426}
5427
5428ALIAS (clear_bgp_peer_in_prefix_filter,
5429 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5430 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5431 CLEAR_STR
5432 BGP_STR
5433 "Address family\n"
5434 "BGP neighbor address to clear\n"
5435 "BGP IPv6 neighbor to clear\n"
5436 "Soft reconfig inbound update\n"
5437 "Push out the existing ORF prefix-list\n")
5438
5439DEFUN (clear_ip_bgp_peer_group_soft_in,
5440 clear_ip_bgp_peer_group_soft_in_cmd,
5441 "clear ip bgp peer-group WORD soft in",
5442 CLEAR_STR
5443 IP_STR
5444 BGP_STR
5445 "Clear all members of peer-group\n"
5446 "BGP peer-group name\n"
5447 "Soft reconfig\n"
5448 "Soft reconfig inbound update\n")
5449{
5450 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5451 BGP_CLEAR_SOFT_IN, argv[0]);
5452}
5453
5454ALIAS (clear_ip_bgp_peer_group_soft_in,
5455 clear_ip_bgp_peer_group_in_cmd,
5456 "clear ip bgp peer-group WORD in",
5457 CLEAR_STR
5458 IP_STR
5459 BGP_STR
5460 "Clear all members of peer-group\n"
5461 "BGP peer-group name\n"
5462 "Soft reconfig inbound update\n")
5463
5464DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
5465 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
5466 "clear ip bgp peer-group WORD in prefix-filter",
5467 CLEAR_STR
5468 IP_STR
5469 BGP_STR
5470 "Clear all members of peer-group\n"
5471 "BGP peer-group name\n"
5472 "Soft reconfig inbound update\n"
5473 "Push out prefix-list ORF and do inbound soft reconfig\n")
5474{
5475 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5476 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5477}
5478
5479DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
5480 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
5481 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
5482 CLEAR_STR
5483 IP_STR
5484 BGP_STR
5485 "Clear all members of peer-group\n"
5486 "BGP peer-group name\n"
5487 "Address family\n"
5488 "Address Family modifier\n"
5489 "Address Family modifier\n"
5490 "Soft reconfig\n"
5491 "Soft reconfig inbound update\n")
5492{
5493 if (strncmp (argv[1], "m", 1) == 0)
5494 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5495 BGP_CLEAR_SOFT_IN, argv[0]);
5496
5497 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5498 BGP_CLEAR_SOFT_IN, argv[0]);
5499}
5500
5501ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
5502 clear_ip_bgp_peer_group_ipv4_in_cmd,
5503 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
5504 CLEAR_STR
5505 IP_STR
5506 BGP_STR
5507 "Clear all members of peer-group\n"
5508 "BGP peer-group name\n"
5509 "Address family\n"
5510 "Address Family modifier\n"
5511 "Address Family modifier\n"
5512 "Soft reconfig inbound update\n")
5513
5514DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
5515 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
5516 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
5517 CLEAR_STR
5518 IP_STR
5519 BGP_STR
5520 "Clear all members of peer-group\n"
5521 "BGP peer-group name\n"
5522 "Address family\n"
5523 "Address Family modifier\n"
5524 "Address Family modifier\n"
5525 "Soft reconfig inbound update\n"
5526 "Push out prefix-list ORF and do inbound soft reconfig\n")
5527{
5528 if (strncmp (argv[1], "m", 1) == 0)
5529 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5530 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5531
5532 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5533 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5534}
5535
5536DEFUN (clear_bgp_peer_group_soft_in,
5537 clear_bgp_peer_group_soft_in_cmd,
5538 "clear bgp peer-group WORD soft in",
5539 CLEAR_STR
5540 BGP_STR
5541 "Clear all members of peer-group\n"
5542 "BGP peer-group name\n"
5543 "Soft reconfig\n"
5544 "Soft reconfig inbound update\n")
5545{
5546 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5547 BGP_CLEAR_SOFT_IN, argv[0]);
5548}
5549
5550ALIAS (clear_bgp_peer_group_soft_in,
5551 clear_bgp_ipv6_peer_group_soft_in_cmd,
5552 "clear bgp ipv6 peer-group WORD soft in",
5553 CLEAR_STR
5554 BGP_STR
5555 "Address family\n"
5556 "Clear all members of peer-group\n"
5557 "BGP peer-group name\n"
5558 "Soft reconfig\n"
5559 "Soft reconfig inbound update\n")
5560
5561ALIAS (clear_bgp_peer_group_soft_in,
5562 clear_bgp_peer_group_in_cmd,
5563 "clear bgp peer-group WORD in",
5564 CLEAR_STR
5565 BGP_STR
5566 "Clear all members of peer-group\n"
5567 "BGP peer-group name\n"
5568 "Soft reconfig inbound update\n")
5569
5570ALIAS (clear_bgp_peer_group_soft_in,
5571 clear_bgp_ipv6_peer_group_in_cmd,
5572 "clear bgp ipv6 peer-group WORD in",
5573 CLEAR_STR
5574 BGP_STR
5575 "Address family\n"
5576 "Clear all members of peer-group\n"
5577 "BGP peer-group name\n"
5578 "Soft reconfig inbound update\n")
5579
5580DEFUN (clear_bgp_peer_group_in_prefix_filter,
5581 clear_bgp_peer_group_in_prefix_filter_cmd,
5582 "clear bgp peer-group WORD in prefix-filter",
5583 CLEAR_STR
5584 BGP_STR
5585 "Clear all members of peer-group\n"
5586 "BGP peer-group name\n"
5587 "Soft reconfig inbound update\n"
5588 "Push out prefix-list ORF and do inbound soft reconfig\n")
5589{
5590 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5591 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5592}
5593
5594ALIAS (clear_bgp_peer_group_in_prefix_filter,
5595 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
5596 "clear bgp ipv6 peer-group WORD in prefix-filter",
5597 CLEAR_STR
5598 BGP_STR
5599 "Address family\n"
5600 "Clear all members of peer-group\n"
5601 "BGP peer-group name\n"
5602 "Soft reconfig inbound update\n"
5603 "Push out prefix-list ORF and do inbound soft reconfig\n")
5604
5605DEFUN (clear_ip_bgp_external_soft_in,
5606 clear_ip_bgp_external_soft_in_cmd,
5607 "clear ip bgp external soft in",
5608 CLEAR_STR
5609 IP_STR
5610 BGP_STR
5611 "Clear all external peers\n"
5612 "Soft reconfig\n"
5613 "Soft reconfig inbound update\n")
5614{
5615 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5616 BGP_CLEAR_SOFT_IN, NULL);
5617}
5618
5619ALIAS (clear_ip_bgp_external_soft_in,
5620 clear_ip_bgp_external_in_cmd,
5621 "clear ip bgp external in",
5622 CLEAR_STR
5623 IP_STR
5624 BGP_STR
5625 "Clear all external peers\n"
5626 "Soft reconfig inbound update\n")
5627
5628DEFUN (clear_ip_bgp_external_in_prefix_filter,
5629 clear_ip_bgp_external_in_prefix_filter_cmd,
5630 "clear ip bgp external in prefix-filter",
5631 CLEAR_STR
5632 IP_STR
5633 BGP_STR
5634 "Clear all external peers\n"
5635 "Soft reconfig inbound update\n"
5636 "Push out prefix-list ORF and do inbound soft reconfig\n")
5637{
5638 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5639 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5640}
5641
5642DEFUN (clear_ip_bgp_external_ipv4_soft_in,
5643 clear_ip_bgp_external_ipv4_soft_in_cmd,
5644 "clear ip bgp external ipv4 (unicast|multicast) soft in",
5645 CLEAR_STR
5646 IP_STR
5647 BGP_STR
5648 "Clear all external peers\n"
5649 "Address family\n"
5650 "Address Family modifier\n"
5651 "Address Family modifier\n"
5652 "Soft reconfig\n"
5653 "Soft reconfig inbound update\n")
5654{
5655 if (strncmp (argv[0], "m", 1) == 0)
5656 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5657 BGP_CLEAR_SOFT_IN, NULL);
5658
5659 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5660 BGP_CLEAR_SOFT_IN, NULL);
5661}
5662
5663ALIAS (clear_ip_bgp_external_ipv4_soft_in,
5664 clear_ip_bgp_external_ipv4_in_cmd,
5665 "clear ip bgp external ipv4 (unicast|multicast) in",
5666 CLEAR_STR
5667 IP_STR
5668 BGP_STR
5669 "Clear all external peers\n"
5670 "Address family\n"
5671 "Address Family modifier\n"
5672 "Address Family modifier\n"
5673 "Soft reconfig inbound update\n")
5674
5675DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
5676 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
5677 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
5678 CLEAR_STR
5679 IP_STR
5680 BGP_STR
5681 "Clear all external peers\n"
5682 "Address family\n"
5683 "Address Family modifier\n"
5684 "Address Family modifier\n"
5685 "Soft reconfig inbound update\n"
5686 "Push out prefix-list ORF and do inbound soft reconfig\n")
5687{
5688 if (strncmp (argv[0], "m", 1) == 0)
5689 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5690 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5691
5692 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5693 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5694}
5695
5696DEFUN (clear_bgp_external_soft_in,
5697 clear_bgp_external_soft_in_cmd,
5698 "clear bgp external soft in",
5699 CLEAR_STR
5700 BGP_STR
5701 "Clear all external peers\n"
5702 "Soft reconfig\n"
5703 "Soft reconfig inbound update\n")
5704{
5705 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5706 BGP_CLEAR_SOFT_IN, NULL);
5707}
5708
5709ALIAS (clear_bgp_external_soft_in,
5710 clear_bgp_ipv6_external_soft_in_cmd,
5711 "clear bgp ipv6 external soft in",
5712 CLEAR_STR
5713 BGP_STR
5714 "Address family\n"
5715 "Clear all external peers\n"
5716 "Soft reconfig\n"
5717 "Soft reconfig inbound update\n")
5718
5719ALIAS (clear_bgp_external_soft_in,
5720 clear_bgp_external_in_cmd,
5721 "clear bgp external in",
5722 CLEAR_STR
5723 BGP_STR
5724 "Clear all external peers\n"
5725 "Soft reconfig inbound update\n")
5726
5727ALIAS (clear_bgp_external_soft_in,
5728 clear_bgp_ipv6_external_in_cmd,
5729 "clear bgp ipv6 external WORD in",
5730 CLEAR_STR
5731 BGP_STR
5732 "Address family\n"
5733 "Clear all external peers\n"
5734 "Soft reconfig inbound update\n")
5735
5736DEFUN (clear_bgp_external_in_prefix_filter,
5737 clear_bgp_external_in_prefix_filter_cmd,
5738 "clear bgp external in prefix-filter",
5739 CLEAR_STR
5740 BGP_STR
5741 "Clear all external peers\n"
5742 "Soft reconfig inbound update\n"
5743 "Push out prefix-list ORF and do inbound soft reconfig\n")
5744{
5745 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5746 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5747}
5748
5749ALIAS (clear_bgp_external_in_prefix_filter,
5750 clear_bgp_ipv6_external_in_prefix_filter_cmd,
5751 "clear bgp ipv6 external in prefix-filter",
5752 CLEAR_STR
5753 BGP_STR
5754 "Address family\n"
5755 "Clear all external peers\n"
5756 "Soft reconfig inbound update\n"
5757 "Push out prefix-list ORF and do inbound soft reconfig\n")
5758
5759DEFUN (clear_ip_bgp_as_soft_in,
5760 clear_ip_bgp_as_soft_in_cmd,
5761 "clear ip bgp <1-65535> soft in",
5762 CLEAR_STR
5763 IP_STR
5764 BGP_STR
5765 "Clear peers with the AS number\n"
5766 "Soft reconfig\n"
5767 "Soft reconfig inbound update\n")
5768{
5769 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5770 BGP_CLEAR_SOFT_IN, argv[0]);
5771}
5772
5773ALIAS (clear_ip_bgp_as_soft_in,
5774 clear_ip_bgp_as_in_cmd,
5775 "clear ip bgp <1-65535> in",
5776 CLEAR_STR
5777 IP_STR
5778 BGP_STR
5779 "Clear peers with the AS number\n"
5780 "Soft reconfig inbound update\n")
5781
5782DEFUN (clear_ip_bgp_as_in_prefix_filter,
5783 clear_ip_bgp_as_in_prefix_filter_cmd,
5784 "clear ip bgp <1-65535> in prefix-filter",
5785 CLEAR_STR
5786 IP_STR
5787 BGP_STR
5788 "Clear peers with the AS number\n"
5789 "Soft reconfig inbound update\n"
5790 "Push out prefix-list ORF and do inbound soft reconfig\n")
5791{
5792 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5793 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5794}
5795
5796DEFUN (clear_ip_bgp_as_ipv4_soft_in,
5797 clear_ip_bgp_as_ipv4_soft_in_cmd,
5798 "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft in",
5799 CLEAR_STR
5800 IP_STR
5801 BGP_STR
5802 "Clear peers with the AS number\n"
5803 "Address family\n"
5804 "Address Family modifier\n"
5805 "Address Family modifier\n"
5806 "Soft reconfig\n"
5807 "Soft reconfig inbound update\n")
5808{
5809 if (strncmp (argv[1], "m", 1) == 0)
5810 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5811 BGP_CLEAR_SOFT_IN, argv[0]);
5812
5813 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5814 BGP_CLEAR_SOFT_IN, argv[0]);
5815}
5816
5817ALIAS (clear_ip_bgp_as_ipv4_soft_in,
5818 clear_ip_bgp_as_ipv4_in_cmd,
5819 "clear ip bgp <1-65535> ipv4 (unicast|multicast) in",
5820 CLEAR_STR
5821 IP_STR
5822 BGP_STR
5823 "Clear peers with the AS number\n"
5824 "Address family\n"
5825 "Address Family modifier\n"
5826 "Address Family modifier\n"
5827 "Soft reconfig inbound update\n")
5828
5829DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
5830 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
5831 "clear ip bgp <1-65535> ipv4 (unicast|multicast) in prefix-filter",
5832 CLEAR_STR
5833 IP_STR
5834 BGP_STR
5835 "Clear peers with the AS number\n"
5836 "Address family\n"
5837 "Address Family modifier\n"
5838 "Address Family modifier\n"
5839 "Soft reconfig inbound update\n"
5840 "Push out prefix-list ORF and do inbound soft reconfig\n")
5841{
5842 if (strncmp (argv[1], "m", 1) == 0)
5843 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5844 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5845
5846 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5847 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5848}
5849
5850DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
5851 clear_ip_bgp_as_vpnv4_soft_in_cmd,
5852 "clear ip bgp <1-65535> vpnv4 unicast soft in",
5853 CLEAR_STR
5854 IP_STR
5855 BGP_STR
5856 "Clear peers with the AS number\n"
5857 "Address family\n"
5858 "Address Family modifier\n"
5859 "Soft reconfig\n"
5860 "Soft reconfig inbound update\n")
5861{
5862 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5863 BGP_CLEAR_SOFT_IN, argv[0]);
5864}
5865
5866ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
5867 clear_ip_bgp_as_vpnv4_in_cmd,
5868 "clear ip bgp <1-65535> vpnv4 unicast in",
5869 CLEAR_STR
5870 IP_STR
5871 BGP_STR
5872 "Clear peers with the AS number\n"
5873 "Address family\n"
5874 "Address Family modifier\n"
5875 "Soft reconfig inbound update\n")
5876
5877DEFUN (clear_bgp_as_soft_in,
5878 clear_bgp_as_soft_in_cmd,
5879 "clear bgp <1-65535> soft in",
5880 CLEAR_STR
5881 BGP_STR
5882 "Clear peers with the AS number\n"
5883 "Soft reconfig\n"
5884 "Soft reconfig inbound update\n")
5885{
5886 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5887 BGP_CLEAR_SOFT_IN, argv[0]);
5888}
5889
5890ALIAS (clear_bgp_as_soft_in,
5891 clear_bgp_ipv6_as_soft_in_cmd,
5892 "clear bgp ipv6 <1-65535> soft in",
5893 CLEAR_STR
5894 BGP_STR
5895 "Address family\n"
5896 "Clear peers with the AS number\n"
5897 "Soft reconfig\n"
5898 "Soft reconfig inbound update\n")
5899
5900ALIAS (clear_bgp_as_soft_in,
5901 clear_bgp_as_in_cmd,
5902 "clear bgp <1-65535> in",
5903 CLEAR_STR
5904 BGP_STR
5905 "Clear peers with the AS number\n"
5906 "Soft reconfig inbound update\n")
5907
5908ALIAS (clear_bgp_as_soft_in,
5909 clear_bgp_ipv6_as_in_cmd,
5910 "clear bgp ipv6 <1-65535> in",
5911 CLEAR_STR
5912 BGP_STR
5913 "Address family\n"
5914 "Clear peers with the AS number\n"
5915 "Soft reconfig inbound update\n")
5916
5917DEFUN (clear_bgp_as_in_prefix_filter,
5918 clear_bgp_as_in_prefix_filter_cmd,
5919 "clear bgp <1-65535> in prefix-filter",
5920 CLEAR_STR
5921 BGP_STR
5922 "Clear peers with the AS number\n"
5923 "Soft reconfig inbound update\n"
5924 "Push out prefix-list ORF and do inbound soft reconfig\n")
5925{
5926 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5927 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5928}
5929
5930ALIAS (clear_bgp_as_in_prefix_filter,
5931 clear_bgp_ipv6_as_in_prefix_filter_cmd,
5932 "clear bgp ipv6 <1-65535> in prefix-filter",
5933 CLEAR_STR
5934 BGP_STR
5935 "Address family\n"
5936 "Clear peers with the AS number\n"
5937 "Soft reconfig inbound update\n"
5938 "Push out prefix-list ORF and do inbound soft reconfig\n")
5939
5940/* Both soft-reconfiguration */
5941DEFUN (clear_ip_bgp_all_soft,
5942 clear_ip_bgp_all_soft_cmd,
5943 "clear ip bgp * soft",
5944 CLEAR_STR
5945 IP_STR
5946 BGP_STR
5947 "Clear all peers\n"
5948 "Soft reconfig\n")
5949{
5950 if (argc == 1)
5951 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5952 BGP_CLEAR_SOFT_BOTH, NULL);
5953
5954 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5955 BGP_CLEAR_SOFT_BOTH, NULL);
5956}
5957
5958ALIAS (clear_ip_bgp_all_soft,
5959 clear_ip_bgp_instance_all_soft_cmd,
5960 "clear ip bgp view WORD * soft",
5961 CLEAR_STR
5962 IP_STR
5963 BGP_STR
5964 "BGP view\n"
5965 "view name\n"
5966 "Clear all peers\n"
5967 "Soft reconfig\n")
5968
5969
5970DEFUN (clear_ip_bgp_all_ipv4_soft,
5971 clear_ip_bgp_all_ipv4_soft_cmd,
5972 "clear ip bgp * ipv4 (unicast|multicast) soft",
5973 CLEAR_STR
5974 IP_STR
5975 BGP_STR
5976 "Clear all peers\n"
5977 "Address family\n"
5978 "Address Family Modifier\n"
5979 "Address Family Modifier\n"
5980 "Soft reconfig\n")
5981{
5982 if (strncmp (argv[0], "m", 1) == 0)
5983 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5984 BGP_CLEAR_SOFT_BOTH, NULL);
5985
5986 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5987 BGP_CLEAR_SOFT_BOTH, NULL);
5988}
5989
5990DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
5991 clear_ip_bgp_instance_all_ipv4_soft_cmd,
5992 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
5993 CLEAR_STR
5994 IP_STR
5995 BGP_STR
5996 "BGP view\n"
5997 "view name\n"
5998 "Clear all peers\n"
5999 "Address family\n"
6000 "Address Family Modifier\n"
6001 "Address Family Modifier\n"
6002 "Soft reconfig\n")
6003{
6004 if (strncmp (argv[1], "m", 1) == 0)
6005 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6006 BGP_CLEAR_SOFT_BOTH, NULL);
6007
6008 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6009 BGP_CLEAR_SOFT_BOTH, NULL);
6010}
6011
6012DEFUN (clear_ip_bgp_all_vpnv4_soft,
6013 clear_ip_bgp_all_vpnv4_soft_cmd,
6014 "clear ip bgp * vpnv4 unicast soft",
6015 CLEAR_STR
6016 IP_STR
6017 BGP_STR
6018 "Clear all peers\n"
6019 "Address family\n"
6020 "Address Family Modifier\n"
6021 "Soft reconfig\n")
6022{
6023 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6024 BGP_CLEAR_SOFT_BOTH, argv[0]);
6025}
6026
6027DEFUN (clear_bgp_all_soft,
6028 clear_bgp_all_soft_cmd,
6029 "clear bgp * soft",
6030 CLEAR_STR
6031 BGP_STR
6032 "Clear all peers\n"
6033 "Soft reconfig\n")
6034{
6035 if (argc == 1)
6036 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6037 BGP_CLEAR_SOFT_BOTH, argv[0]);
6038
6039 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6040 BGP_CLEAR_SOFT_BOTH, argv[0]);
6041}
6042
6043ALIAS (clear_bgp_all_soft,
6044 clear_bgp_instance_all_soft_cmd,
6045 "clear bgp view WORD * soft",
6046 CLEAR_STR
6047 BGP_STR
6048 "BGP view\n"
6049 "view name\n"
6050 "Clear all peers\n"
6051 "Soft reconfig\n")
6052
6053ALIAS (clear_bgp_all_soft,
6054 clear_bgp_ipv6_all_soft_cmd,
6055 "clear bgp ipv6 * soft",
6056 CLEAR_STR
6057 BGP_STR
6058 "Address family\n"
6059 "Clear all peers\n"
6060 "Soft reconfig\n")
6061
6062DEFUN (clear_ip_bgp_peer_soft,
6063 clear_ip_bgp_peer_soft_cmd,
6064 "clear ip bgp A.B.C.D soft",
6065 CLEAR_STR
6066 IP_STR
6067 BGP_STR
6068 "BGP neighbor address to clear\n"
6069 "Soft reconfig\n")
6070{
6071 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6072 BGP_CLEAR_SOFT_BOTH, argv[0]);
6073}
6074
6075DEFUN (clear_ip_bgp_peer_ipv4_soft,
6076 clear_ip_bgp_peer_ipv4_soft_cmd,
6077 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6078 CLEAR_STR
6079 IP_STR
6080 BGP_STR
6081 "BGP neighbor address to clear\n"
6082 "Address family\n"
6083 "Address Family Modifier\n"
6084 "Address Family Modifier\n"
6085 "Soft reconfig\n")
6086{
6087 if (strncmp (argv[1], "m", 1) == 0)
6088 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6089 BGP_CLEAR_SOFT_BOTH, argv[0]);
6090
6091 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6092 BGP_CLEAR_SOFT_BOTH, argv[0]);
6093}
6094
6095DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6096 clear_ip_bgp_peer_vpnv4_soft_cmd,
6097 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6098 CLEAR_STR
6099 IP_STR
6100 BGP_STR
6101 "BGP neighbor address to clear\n"
6102 "Address family\n"
6103 "Address Family Modifier\n"
6104 "Soft reconfig\n")
6105{
6106 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6107 BGP_CLEAR_SOFT_BOTH, argv[0]);
6108}
6109
6110DEFUN (clear_bgp_peer_soft,
6111 clear_bgp_peer_soft_cmd,
6112 "clear bgp (A.B.C.D|X:X::X:X) soft",
6113 CLEAR_STR
6114 BGP_STR
6115 "BGP neighbor address to clear\n"
6116 "BGP IPv6 neighbor to clear\n"
6117 "Soft reconfig\n")
6118{
6119 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6120 BGP_CLEAR_SOFT_BOTH, argv[0]);
6121}
6122
6123ALIAS (clear_bgp_peer_soft,
6124 clear_bgp_ipv6_peer_soft_cmd,
6125 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6126 CLEAR_STR
6127 BGP_STR
6128 "Address family\n"
6129 "BGP neighbor address to clear\n"
6130 "BGP IPv6 neighbor to clear\n"
6131 "Soft reconfig\n")
6132
6133DEFUN (clear_ip_bgp_peer_group_soft,
6134 clear_ip_bgp_peer_group_soft_cmd,
6135 "clear ip bgp peer-group WORD soft",
6136 CLEAR_STR
6137 IP_STR
6138 BGP_STR
6139 "Clear all members of peer-group\n"
6140 "BGP peer-group name\n"
6141 "Soft reconfig\n")
6142{
6143 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6144 BGP_CLEAR_SOFT_BOTH, argv[0]);
6145}
6146
6147DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6148 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6149 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6150 CLEAR_STR
6151 IP_STR
6152 BGP_STR
6153 "Clear all members of peer-group\n"
6154 "BGP peer-group name\n"
6155 "Address family\n"
6156 "Address Family modifier\n"
6157 "Address Family modifier\n"
6158 "Soft reconfig\n")
6159{
6160 if (strncmp (argv[1], "m", 1) == 0)
6161 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6162 BGP_CLEAR_SOFT_BOTH, argv[0]);
6163
6164 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6165 BGP_CLEAR_SOFT_BOTH, argv[0]);
6166}
6167
6168DEFUN (clear_bgp_peer_group_soft,
6169 clear_bgp_peer_group_soft_cmd,
6170 "clear bgp peer-group WORD soft",
6171 CLEAR_STR
6172 BGP_STR
6173 "Clear all members of peer-group\n"
6174 "BGP peer-group name\n"
6175 "Soft reconfig\n")
6176{
6177 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6178 BGP_CLEAR_SOFT_BOTH, argv[0]);
6179}
6180
6181ALIAS (clear_bgp_peer_group_soft,
6182 clear_bgp_ipv6_peer_group_soft_cmd,
6183 "clear bgp ipv6 peer-group WORD soft",
6184 CLEAR_STR
6185 BGP_STR
6186 "Address family\n"
6187 "Clear all members of peer-group\n"
6188 "BGP peer-group name\n"
6189 "Soft reconfig\n")
6190
6191DEFUN (clear_ip_bgp_external_soft,
6192 clear_ip_bgp_external_soft_cmd,
6193 "clear ip bgp external soft",
6194 CLEAR_STR
6195 IP_STR
6196 BGP_STR
6197 "Clear all external peers\n"
6198 "Soft reconfig\n")
6199{
6200 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6201 BGP_CLEAR_SOFT_BOTH, NULL);
6202}
6203
6204DEFUN (clear_ip_bgp_external_ipv4_soft,
6205 clear_ip_bgp_external_ipv4_soft_cmd,
6206 "clear ip bgp external ipv4 (unicast|multicast) soft",
6207 CLEAR_STR
6208 IP_STR
6209 BGP_STR
6210 "Clear all external peers\n"
6211 "Address family\n"
6212 "Address Family modifier\n"
6213 "Address Family modifier\n"
6214 "Soft reconfig\n")
6215{
6216 if (strncmp (argv[0], "m", 1) == 0)
6217 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6218 BGP_CLEAR_SOFT_BOTH, NULL);
6219
6220 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6221 BGP_CLEAR_SOFT_BOTH, NULL);
6222}
6223
6224DEFUN (clear_bgp_external_soft,
6225 clear_bgp_external_soft_cmd,
6226 "clear bgp external soft",
6227 CLEAR_STR
6228 BGP_STR
6229 "Clear all external peers\n"
6230 "Soft reconfig\n")
6231{
6232 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6233 BGP_CLEAR_SOFT_BOTH, NULL);
6234}
6235
6236ALIAS (clear_bgp_external_soft,
6237 clear_bgp_ipv6_external_soft_cmd,
6238 "clear bgp ipv6 external soft",
6239 CLEAR_STR
6240 BGP_STR
6241 "Address family\n"
6242 "Clear all external peers\n"
6243 "Soft reconfig\n")
6244
6245DEFUN (clear_ip_bgp_as_soft,
6246 clear_ip_bgp_as_soft_cmd,
6247 "clear ip bgp <1-65535> soft",
6248 CLEAR_STR
6249 IP_STR
6250 BGP_STR
6251 "Clear peers with the AS number\n"
6252 "Soft reconfig\n")
6253{
6254 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6255 BGP_CLEAR_SOFT_BOTH, argv[0]);
6256}
6257
6258DEFUN (clear_ip_bgp_as_ipv4_soft,
6259 clear_ip_bgp_as_ipv4_soft_cmd,
6260 "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft",
6261 CLEAR_STR
6262 IP_STR
6263 BGP_STR
6264 "Clear peers with the AS number\n"
6265 "Address family\n"
6266 "Address Family Modifier\n"
6267 "Address Family Modifier\n"
6268 "Soft reconfig\n")
6269{
6270 if (strncmp (argv[1], "m", 1) == 0)
6271 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6272 BGP_CLEAR_SOFT_BOTH, argv[0]);
6273
6274 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6275 BGP_CLEAR_SOFT_BOTH, argv[0]);
6276}
6277
6278DEFUN (clear_ip_bgp_as_vpnv4_soft,
6279 clear_ip_bgp_as_vpnv4_soft_cmd,
6280 "clear ip bgp <1-65535> vpnv4 unicast soft",
6281 CLEAR_STR
6282 IP_STR
6283 BGP_STR
6284 "Clear peers with the AS number\n"
6285 "Address family\n"
6286 "Address Family Modifier\n"
6287 "Soft reconfig\n")
6288{
6289 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6290 BGP_CLEAR_SOFT_BOTH, argv[0]);
6291}
6292
6293DEFUN (clear_bgp_as_soft,
6294 clear_bgp_as_soft_cmd,
6295 "clear bgp <1-65535> soft",
6296 CLEAR_STR
6297 BGP_STR
6298 "Clear peers with the AS number\n"
6299 "Soft reconfig\n")
6300{
6301 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6302 BGP_CLEAR_SOFT_BOTH, argv[0]);
6303}
6304
6305ALIAS (clear_bgp_as_soft,
6306 clear_bgp_ipv6_as_soft_cmd,
6307 "clear bgp ipv6 <1-65535> soft",
6308 CLEAR_STR
6309 BGP_STR
6310 "Address family\n"
6311 "Clear peers with the AS number\n"
6312 "Soft reconfig\n")
6313
paulfee0f4c2004-09-13 05:12:46 +00006314/* RS-client soft reconfiguration. */
6315#ifdef HAVE_IPV6
6316DEFUN (clear_bgp_all_rsclient,
6317 clear_bgp_all_rsclient_cmd,
6318 "clear bgp * rsclient",
6319 CLEAR_STR
6320 BGP_STR
6321 "Clear all peers\n"
6322 "Soft reconfig for rsclient RIB\n")
6323{
6324 if (argc == 1)
6325 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6326 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6327
6328 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6329 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6330}
6331
6332ALIAS (clear_bgp_all_rsclient,
6333 clear_bgp_ipv6_all_rsclient_cmd,
6334 "clear bgp ipv6 * rsclient",
6335 CLEAR_STR
6336 BGP_STR
6337 "Address family\n"
6338 "Clear all peers\n"
6339 "Soft reconfig for rsclient RIB\n")
6340
6341ALIAS (clear_bgp_all_rsclient,
6342 clear_bgp_instance_all_rsclient_cmd,
6343 "clear bgp view WORD * rsclient",
6344 CLEAR_STR
6345 BGP_STR
6346 "BGP view\n"
6347 "view name\n"
6348 "Clear all peers\n"
6349 "Soft reconfig for rsclient RIB\n")
6350
6351ALIAS (clear_bgp_all_rsclient,
6352 clear_bgp_ipv6_instance_all_rsclient_cmd,
6353 "clear bgp ipv6 view WORD * rsclient",
6354 CLEAR_STR
6355 BGP_STR
6356 "Address family\n"
6357 "BGP view\n"
6358 "view name\n"
6359 "Clear all peers\n"
6360 "Soft reconfig for rsclient RIB\n")
6361#endif /* HAVE_IPV6 */
6362
6363DEFUN (clear_ip_bgp_all_rsclient,
6364 clear_ip_bgp_all_rsclient_cmd,
6365 "clear ip bgp * rsclient",
6366 CLEAR_STR
6367 IP_STR
6368 BGP_STR
6369 "Clear all peers\n"
6370 "Soft reconfig for rsclient RIB\n")
6371{
6372 if (argc == 1)
6373 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6374 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6375
6376 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6377 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6378}
6379
6380ALIAS (clear_ip_bgp_all_rsclient,
6381 clear_ip_bgp_instance_all_rsclient_cmd,
6382 "clear ip bgp view WORD * rsclient",
6383 CLEAR_STR
6384 IP_STR
6385 BGP_STR
6386 "BGP view\n"
6387 "view name\n"
6388 "Clear all peers\n"
6389 "Soft reconfig for rsclient RIB\n")
6390
6391#ifdef HAVE_IPV6
6392DEFUN (clear_bgp_peer_rsclient,
6393 clear_bgp_peer_rsclient_cmd,
6394 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
6395 CLEAR_STR
6396 BGP_STR
6397 "BGP neighbor IP address to clear\n"
6398 "BGP IPv6 neighbor to clear\n"
6399 "Soft reconfig for rsclient RIB\n")
6400{
6401 if (argc == 2)
6402 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
6403 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6404
6405 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6406 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6407}
6408
6409ALIAS (clear_bgp_peer_rsclient,
6410 clear_bgp_ipv6_peer_rsclient_cmd,
6411 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
6412 CLEAR_STR
6413 BGP_STR
6414 "Address family\n"
6415 "BGP neighbor IP address to clear\n"
6416 "BGP IPv6 neighbor to clear\n"
6417 "Soft reconfig for rsclient RIB\n")
6418
6419ALIAS (clear_bgp_peer_rsclient,
6420 clear_bgp_instance_peer_rsclient_cmd,
6421 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6422 CLEAR_STR
6423 BGP_STR
6424 "BGP view\n"
6425 "view name\n"
6426 "BGP neighbor IP address to clear\n"
6427 "BGP IPv6 neighbor to clear\n"
6428 "Soft reconfig for rsclient RIB\n")
6429
6430ALIAS (clear_bgp_peer_rsclient,
6431 clear_bgp_ipv6_instance_peer_rsclient_cmd,
6432 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
6433 CLEAR_STR
6434 BGP_STR
6435 "Address family\n"
6436 "BGP view\n"
6437 "view name\n"
6438 "BGP neighbor IP address to clear\n"
6439 "BGP IPv6 neighbor to clear\n"
6440 "Soft reconfig for rsclient RIB\n")
6441#endif /* HAVE_IPV6 */
6442
6443DEFUN (clear_ip_bgp_peer_rsclient,
6444 clear_ip_bgp_peer_rsclient_cmd,
6445 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
6446 CLEAR_STR
6447 IP_STR
6448 BGP_STR
6449 "BGP neighbor IP address to clear\n"
6450 "BGP IPv6 neighbor to clear\n"
6451 "Soft reconfig for rsclient RIB\n")
6452{
6453 if (argc == 2)
6454 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
6455 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6456
6457 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6458 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6459}
6460
6461ALIAS (clear_ip_bgp_peer_rsclient,
6462 clear_ip_bgp_instance_peer_rsclient_cmd,
6463 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6464 CLEAR_STR
6465 IP_STR
6466 BGP_STR
6467 "BGP view\n"
6468 "view name\n"
6469 "BGP neighbor IP address to clear\n"
6470 "BGP IPv6 neighbor to clear\n"
6471 "Soft reconfig for rsclient RIB\n")
6472
Paul Jakma4bf6a362006-03-30 14:05:23 +00006473DEFUN (show_bgp_memory,
6474 show_bgp_memory_cmd,
6475 "show bgp memory",
6476 SHOW_STR
6477 BGP_STR
6478 "Global BGP memory statistics\n")
6479{
6480 char memstrbuf[MTYPE_MEMSTR_LEN];
6481 unsigned long count;
6482
6483 /* RIB related usage stats */
6484 count = mtype_stats_alloc (MTYPE_BGP_NODE);
6485 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
6486 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6487 count * sizeof (struct bgp_node)),
6488 VTY_NEWLINE);
6489
6490 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
6491 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
6492 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6493 count * sizeof (struct bgp_info)),
6494 VTY_NEWLINE);
6495
6496 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
6497 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
6498 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6499 count * sizeof (struct bgp_static)),
6500 VTY_NEWLINE);
6501
6502 /* Adj-In/Out */
6503 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
6504 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
6505 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6506 count * sizeof (struct bgp_adj_in)),
6507 VTY_NEWLINE);
6508 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
6509 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
6510 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6511 count * sizeof (struct bgp_adj_out)),
6512 VTY_NEWLINE);
6513
6514 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
6515 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
6516 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6517 count * sizeof (struct bgp_nexthop_cache)),
6518 VTY_NEWLINE);
6519
6520 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
6521 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
6522 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6523 count * sizeof (struct bgp_damp_info)),
6524 VTY_NEWLINE);
6525
6526 /* Attributes */
6527 count = attr_count();
6528 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
6529 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6530 count * sizeof(struct attr)),
6531 VTY_NEWLINE);
6532
6533 if ((count = attr_unknown_count()))
6534 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
6535
6536 /* AS_PATH attributes */
6537 count = aspath_count ();
6538 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
6539 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6540 count * sizeof (struct aspath)),
6541 VTY_NEWLINE);
6542
6543 count = mtype_stats_alloc (MTYPE_AS_SEG);
6544 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
6545 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6546 count * sizeof (struct assegment)),
6547 VTY_NEWLINE);
6548
6549 /* Other attributes */
6550 if ((count = community_count ()))
6551 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6552 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6553 count * sizeof (struct community)),
6554 VTY_NEWLINE);
6555 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
6556 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6557 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6558 count * sizeof (struct ecommunity)),
6559 VTY_NEWLINE);
6560
6561 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
6562 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
6563 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6564 count * sizeof (struct cluster_list)),
6565 VTY_NEWLINE);
6566
6567 /* Peer related usage */
6568 count = mtype_stats_alloc (MTYPE_BGP_PEER);
6569 vty_out (vty, "%ld peers, using %s of memory%s", count,
6570 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6571 count * sizeof (struct peer)),
6572 VTY_NEWLINE);
6573
6574 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
6575 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
6576 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6577 count * sizeof (struct peer_group)),
6578 VTY_NEWLINE);
6579
6580 /* Other */
6581 if ((count = mtype_stats_alloc (MTYPE_HASH)))
6582 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
6583 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6584 count * sizeof (struct hash)),
6585 VTY_NEWLINE);
6586 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
6587 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
6588 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6589 count * sizeof (struct hash_backet)),
6590 VTY_NEWLINE);
6591 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
6592 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
6593 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6594 count * sizeof (regex_t)),
6595 VTY_NEWLINE);
6596 return CMD_SUCCESS;
6597}
paulfee0f4c2004-09-13 05:12:46 +00006598
paul718e3742002-12-13 20:15:29 +00006599/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00006600static int
paul718e3742002-12-13 20:15:29 +00006601bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
6602{
6603 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00006604 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00006605 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00006606 char timebuf[BGP_UPTIME_LEN];
6607 int len;
6608
6609 /* Header string for each address family. */
6610 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00006611
paul1eb8ef22005-04-07 07:30:20 +00006612 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00006613 {
6614 if (peer->afc[afi][safi])
6615 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00006616 if (!count)
6617 {
6618 unsigned long ents;
6619 char memstrbuf[MTYPE_MEMSTR_LEN];
6620
6621 /* Usage summary and header */
6622 vty_out (vty,
6623 "BGP router identifier %s, local AS number %d%s",
6624 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006625
Paul Jakma4bf6a362006-03-30 14:05:23 +00006626 ents = bgp_table_count (bgp->rib[afi][safi]);
6627 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
6628 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6629 ents * sizeof (struct bgp_node)),
6630 VTY_NEWLINE);
6631
6632 /* Peer related usage */
6633 ents = listcount (bgp->peer);
6634 vty_out (vty, "Peers %ld, using %s of memory%s",
6635 ents,
6636 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6637 ents * sizeof (struct peer)),
6638 VTY_NEWLINE);
6639
6640 if ((ents = listcount (bgp->rsclient)))
6641 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
6642 ents,
6643 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6644 ents * sizeof (struct peer)),
6645 VTY_NEWLINE);
6646
6647 if ((ents = listcount (bgp->group)))
6648 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
6649 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6650 ents * sizeof (struct peer_group)),
6651 VTY_NEWLINE);
6652
6653 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
6654 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
6655 vty_out (vty, "%s", VTY_NEWLINE);
6656 vty_out (vty, "%s%s", header, VTY_NEWLINE);
6657 }
6658
paul718e3742002-12-13 20:15:29 +00006659 count++;
6660
6661 len = vty_out (vty, "%s", peer->host);
6662 len = 16 - len;
6663 if (len < 1)
6664 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
6665 else
6666 vty_out (vty, "%*s", len, " ");
6667
hasso3d515fd2005-02-01 21:30:04 +00006668 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00006669
6670 vty_out (vty, "%5d %7d %7d %8d %4d %4ld ",
6671 peer->as,
6672 peer->open_in + peer->update_in + peer->keepalive_in
6673 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
6674 peer->open_out + peer->update_out + peer->keepalive_out
6675 + peer->notify_out + peer->refresh_out
6676 + peer->dynamic_cap_out,
6677 0, 0, peer->obuf->count);
6678
6679 vty_out (vty, "%8s",
6680 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
6681
6682 if (peer->status == Established)
6683 {
6684 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
6685 }
6686 else
6687 {
6688 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
6689 vty_out (vty, " Idle (Admin)");
6690 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
6691 vty_out (vty, " Idle (PfxCt)");
Paul Jakma6a419732006-02-21 01:14:13 +00006692 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_CLEARING))
6693 vty_out (vty, " Idle (Clrng)");
paul718e3742002-12-13 20:15:29 +00006694 else
6695 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
6696 }
6697
6698 vty_out (vty, "%s", VTY_NEWLINE);
6699 }
6700 }
6701
6702 if (count)
6703 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
6704 count, VTY_NEWLINE);
6705 else
6706 vty_out (vty, "No %s neighbor is configured%s",
6707 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
6708 return CMD_SUCCESS;
6709}
6710
paul94f2b392005-06-28 12:44:16 +00006711static int
paulfd79ac92004-10-13 05:06:08 +00006712bgp_show_summary_vty (struct vty *vty, const char *name,
6713 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00006714{
6715 struct bgp *bgp;
6716
6717 if (name)
6718 {
6719 bgp = bgp_lookup_by_name (name);
6720
6721 if (! bgp)
6722 {
6723 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
6724 return CMD_WARNING;
6725 }
6726
6727 bgp_show_summary (vty, bgp, afi, safi);
6728 return CMD_SUCCESS;
6729 }
6730
6731 bgp = bgp_get_default ();
6732
6733 if (bgp)
6734 bgp_show_summary (vty, bgp, afi, safi);
6735
6736 return CMD_SUCCESS;
6737}
6738
6739/* `show ip bgp summary' commands. */
6740DEFUN (show_ip_bgp_summary,
6741 show_ip_bgp_summary_cmd,
6742 "show ip bgp summary",
6743 SHOW_STR
6744 IP_STR
6745 BGP_STR
6746 "Summary of BGP neighbor status\n")
6747{
6748 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
6749}
6750
6751DEFUN (show_ip_bgp_instance_summary,
6752 show_ip_bgp_instance_summary_cmd,
6753 "show ip bgp view WORD summary",
6754 SHOW_STR
6755 IP_STR
6756 BGP_STR
6757 "BGP view\n"
6758 "View name\n"
6759 "Summary of BGP neighbor status\n")
6760{
6761 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
6762}
6763
6764DEFUN (show_ip_bgp_ipv4_summary,
6765 show_ip_bgp_ipv4_summary_cmd,
6766 "show ip bgp ipv4 (unicast|multicast) summary",
6767 SHOW_STR
6768 IP_STR
6769 BGP_STR
6770 "Address family\n"
6771 "Address Family modifier\n"
6772 "Address Family modifier\n"
6773 "Summary of BGP neighbor status\n")
6774{
6775 if (strncmp (argv[0], "m", 1) == 0)
6776 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
6777
6778 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
6779}
6780
6781DEFUN (show_ip_bgp_instance_ipv4_summary,
6782 show_ip_bgp_instance_ipv4_summary_cmd,
6783 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
6784 SHOW_STR
6785 IP_STR
6786 BGP_STR
6787 "BGP view\n"
6788 "View name\n"
6789 "Address family\n"
6790 "Address Family modifier\n"
6791 "Address Family modifier\n"
6792 "Summary of BGP neighbor status\n")
6793{
6794 if (strncmp (argv[1], "m", 1) == 0)
6795 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
6796 else
6797 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
6798}
6799
6800DEFUN (show_ip_bgp_vpnv4_all_summary,
6801 show_ip_bgp_vpnv4_all_summary_cmd,
6802 "show ip bgp vpnv4 all summary",
6803 SHOW_STR
6804 IP_STR
6805 BGP_STR
6806 "Display VPNv4 NLRI specific information\n"
6807 "Display information about all VPNv4 NLRIs\n"
6808 "Summary of BGP neighbor status\n")
6809{
6810 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
6811}
6812
6813DEFUN (show_ip_bgp_vpnv4_rd_summary,
6814 show_ip_bgp_vpnv4_rd_summary_cmd,
6815 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
6816 SHOW_STR
6817 IP_STR
6818 BGP_STR
6819 "Display VPNv4 NLRI specific information\n"
6820 "Display information for a route distinguisher\n"
6821 "VPN Route Distinguisher\n"
6822 "Summary of BGP neighbor status\n")
6823{
6824 int ret;
6825 struct prefix_rd prd;
6826
6827 ret = str2prefix_rd (argv[0], &prd);
6828 if (! ret)
6829 {
6830 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
6831 return CMD_WARNING;
6832 }
6833
6834 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
6835}
6836
6837#ifdef HAVE_IPV6
6838DEFUN (show_bgp_summary,
6839 show_bgp_summary_cmd,
6840 "show bgp summary",
6841 SHOW_STR
6842 BGP_STR
6843 "Summary of BGP neighbor status\n")
6844{
6845 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
6846}
6847
6848DEFUN (show_bgp_instance_summary,
6849 show_bgp_instance_summary_cmd,
6850 "show bgp view WORD summary",
6851 SHOW_STR
6852 BGP_STR
6853 "BGP view\n"
6854 "View name\n"
6855 "Summary of BGP neighbor status\n")
6856{
6857 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
6858}
6859
6860ALIAS (show_bgp_summary,
6861 show_bgp_ipv6_summary_cmd,
6862 "show bgp ipv6 summary",
6863 SHOW_STR
6864 BGP_STR
6865 "Address family\n"
6866 "Summary of BGP neighbor status\n")
6867
6868ALIAS (show_bgp_instance_summary,
6869 show_bgp_instance_ipv6_summary_cmd,
6870 "show bgp view WORD ipv6 summary",
6871 SHOW_STR
6872 BGP_STR
6873 "BGP view\n"
6874 "View name\n"
6875 "Address family\n"
6876 "Summary of BGP neighbor status\n")
6877
6878/* old command */
6879DEFUN (show_ipv6_bgp_summary,
6880 show_ipv6_bgp_summary_cmd,
6881 "show ipv6 bgp summary",
6882 SHOW_STR
6883 IPV6_STR
6884 BGP_STR
6885 "Summary of BGP neighbor status\n")
6886{
6887 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
6888}
6889
6890/* old command */
6891DEFUN (show_ipv6_mbgp_summary,
6892 show_ipv6_mbgp_summary_cmd,
6893 "show ipv6 mbgp summary",
6894 SHOW_STR
6895 IPV6_STR
6896 MBGP_STR
6897 "Summary of BGP neighbor status\n")
6898{
6899 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
6900}
6901#endif /* HAVE_IPV6 */
6902
paulfd79ac92004-10-13 05:06:08 +00006903const char *
hasso538621f2004-05-21 09:31:30 +00006904afi_safi_print (afi_t afi, safi_t safi)
6905{
6906 if (afi == AFI_IP && safi == SAFI_UNICAST)
6907 return "IPv4 Unicast";
6908 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
6909 return "IPv4 Multicast";
6910 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
6911 return "VPNv4 Unicast";
6912 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
6913 return "IPv6 Unicast";
6914 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
6915 return "IPv6 Multicast";
6916 else
6917 return "Unknown";
6918}
6919
paul718e3742002-12-13 20:15:29 +00006920/* Show BGP peer's information. */
6921enum show_type
6922{
6923 show_all,
6924 show_peer
6925};
6926
paul94f2b392005-06-28 12:44:16 +00006927static void
paul718e3742002-12-13 20:15:29 +00006928bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
6929 afi_t afi, safi_t safi,
6930 u_int16_t adv_smcap, u_int16_t adv_rmcap,
6931 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
6932{
6933 /* Send-Mode */
6934 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
6935 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
6936 {
6937 vty_out (vty, " Send-mode: ");
6938 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
6939 vty_out (vty, "advertised");
6940 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
6941 vty_out (vty, "%sreceived",
6942 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
6943 ", " : "");
6944 vty_out (vty, "%s", VTY_NEWLINE);
6945 }
6946
6947 /* Receive-Mode */
6948 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
6949 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
6950 {
6951 vty_out (vty, " Receive-mode: ");
6952 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
6953 vty_out (vty, "advertised");
6954 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
6955 vty_out (vty, "%sreceived",
6956 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
6957 ", " : "");
6958 vty_out (vty, "%s", VTY_NEWLINE);
6959 }
6960}
6961
paul94f2b392005-06-28 12:44:16 +00006962static void
paul718e3742002-12-13 20:15:29 +00006963bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
6964{
6965 struct bgp_filter *filter;
6966 char orf_pfx_name[BUFSIZ];
6967 int orf_pfx_count;
6968
6969 filter = &p->filter[afi][safi];
6970
hasso538621f2004-05-21 09:31:30 +00006971 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00006972 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00006973
paul718e3742002-12-13 20:15:29 +00006974 if (p->af_group[afi][safi])
6975 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
6976
6977 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
6978 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
6979 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
6980 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
6981 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
6982 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
6983 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
6984
6985 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
6986 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
6987 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
6988 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
6989 {
6990 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
6991 ORF_TYPE_PREFIX, VTY_NEWLINE);
6992 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
6993 PEER_CAP_ORF_PREFIX_SM_ADV,
6994 PEER_CAP_ORF_PREFIX_RM_ADV,
6995 PEER_CAP_ORF_PREFIX_SM_RCV,
6996 PEER_CAP_ORF_PREFIX_RM_RCV);
6997 }
6998 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
6999 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7000 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7001 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7002 {
7003 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7004 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7005 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7006 PEER_CAP_ORF_PREFIX_SM_ADV,
7007 PEER_CAP_ORF_PREFIX_RM_ADV,
7008 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7009 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7010 }
7011
7012 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7013 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7014
7015 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7016 || orf_pfx_count)
7017 {
7018 vty_out (vty, " Outbound Route Filter (ORF):");
7019 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7020 vty_out (vty, " sent;");
7021 if (orf_pfx_count)
7022 vty_out (vty, " received (%d entries)", orf_pfx_count);
7023 vty_out (vty, "%s", VTY_NEWLINE);
7024 }
7025 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7026 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7027
7028 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7029 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7030 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7031 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7032 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7033 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7034 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7035 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7036 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7037 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
7038 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
7039 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7040 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
7041 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7042 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
7043 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7044 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7045 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
7046 {
7047 vty_out (vty, " Community attribute sent to this neighbor");
7048 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7049 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007050 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007051 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007052 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007053 else
hasso538621f2004-05-21 09:31:30 +00007054 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007055 }
7056 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
7057 {
7058 vty_out (vty, " Default information originate,");
7059
7060 if (p->default_rmap[afi][safi].name)
7061 vty_out (vty, " default route-map %s%s,",
7062 p->default_rmap[afi][safi].map ? "*" : "",
7063 p->default_rmap[afi][safi].name);
7064 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
7065 vty_out (vty, " default sent%s", VTY_NEWLINE);
7066 else
7067 vty_out (vty, " default not sent%s", VTY_NEWLINE);
7068 }
7069
7070 if (filter->plist[FILTER_IN].name
7071 || filter->dlist[FILTER_IN].name
7072 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00007073 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007074 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
7075 if (filter->plist[FILTER_OUT].name
7076 || filter->dlist[FILTER_OUT].name
7077 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00007078 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00007079 || filter->usmap.name)
7080 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007081 if (filter->map[RMAP_IMPORT].name)
7082 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
7083 if (filter->map[RMAP_EXPORT].name)
7084 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007085
7086 /* prefix-list */
7087 if (filter->plist[FILTER_IN].name)
7088 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
7089 filter->plist[FILTER_IN].plist ? "*" : "",
7090 filter->plist[FILTER_IN].name,
7091 VTY_NEWLINE);
7092 if (filter->plist[FILTER_OUT].name)
7093 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
7094 filter->plist[FILTER_OUT].plist ? "*" : "",
7095 filter->plist[FILTER_OUT].name,
7096 VTY_NEWLINE);
7097
7098 /* distribute-list */
7099 if (filter->dlist[FILTER_IN].name)
7100 vty_out (vty, " Incoming update network filter list is %s%s%s",
7101 filter->dlist[FILTER_IN].alist ? "*" : "",
7102 filter->dlist[FILTER_IN].name,
7103 VTY_NEWLINE);
7104 if (filter->dlist[FILTER_OUT].name)
7105 vty_out (vty, " Outgoing update network filter list is %s%s%s",
7106 filter->dlist[FILTER_OUT].alist ? "*" : "",
7107 filter->dlist[FILTER_OUT].name,
7108 VTY_NEWLINE);
7109
7110 /* filter-list. */
7111 if (filter->aslist[FILTER_IN].name)
7112 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
7113 filter->aslist[FILTER_IN].aslist ? "*" : "",
7114 filter->aslist[FILTER_IN].name,
7115 VTY_NEWLINE);
7116 if (filter->aslist[FILTER_OUT].name)
7117 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
7118 filter->aslist[FILTER_OUT].aslist ? "*" : "",
7119 filter->aslist[FILTER_OUT].name,
7120 VTY_NEWLINE);
7121
7122 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00007123 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007124 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007125 filter->map[RMAP_IN].map ? "*" : "",
7126 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00007127 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007128 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00007129 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007130 filter->map[RMAP_OUT].map ? "*" : "",
7131 filter->map[RMAP_OUT].name,
7132 VTY_NEWLINE);
7133 if (filter->map[RMAP_IMPORT].name)
7134 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
7135 filter->map[RMAP_IMPORT].map ? "*" : "",
7136 filter->map[RMAP_IMPORT].name,
7137 VTY_NEWLINE);
7138 if (filter->map[RMAP_EXPORT].name)
7139 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
7140 filter->map[RMAP_EXPORT].map ? "*" : "",
7141 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00007142 VTY_NEWLINE);
7143
7144 /* unsuppress-map */
7145 if (filter->usmap.name)
7146 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
7147 filter->usmap.map ? "*" : "",
7148 filter->usmap.name, VTY_NEWLINE);
7149
7150 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00007151 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
7152
paul718e3742002-12-13 20:15:29 +00007153 /* Maximum prefix */
7154 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
7155 {
hasso0a486e52005-02-01 20:57:17 +00007156 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00007157 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00007158 ? " (warning-only)" : "", VTY_NEWLINE);
7159 vty_out (vty, " Threshold for warning message %d%%",
7160 p->pmax_threshold[afi][safi]);
7161 if (p->pmax_restart[afi][safi])
7162 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
7163 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007164 }
paul718e3742002-12-13 20:15:29 +00007165
7166 vty_out (vty, "%s", VTY_NEWLINE);
7167}
7168
paul94f2b392005-06-28 12:44:16 +00007169static void
paul718e3742002-12-13 20:15:29 +00007170bgp_show_peer (struct vty *vty, struct peer *p)
7171{
7172 struct bgp *bgp;
7173 char buf1[BUFSIZ];
7174 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00007175 afi_t afi;
7176 safi_t safi;
paul718e3742002-12-13 20:15:29 +00007177
7178 bgp = p->bgp;
7179
7180 /* Configured IP address. */
7181 vty_out (vty, "BGP neighbor is %s, ", p->host);
7182 vty_out (vty, "remote AS %d, ", p->as);
7183 vty_out (vty, "local AS %d%s, ",
7184 p->change_local_as ? p->change_local_as : p->local_as,
7185 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
7186 " no-prepend" : "");
7187 vty_out (vty, "%s link%s",
7188 p->as == p->local_as ? "internal" : "external",
7189 VTY_NEWLINE);
7190
7191 /* Description. */
7192 if (p->desc)
7193 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
7194
7195 /* Peer-group */
7196 if (p->group)
7197 vty_out (vty, " Member of peer-group %s for session parameters%s",
7198 p->group->name, VTY_NEWLINE);
7199
7200 /* Administrative shutdown. */
7201 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
7202 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
7203
7204 /* BGP Version. */
7205 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00007206 vty_out (vty, ", remote router ID %s%s",
7207 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
7208 VTY_NEWLINE);
7209
7210 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00007211 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
7212 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00007213 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
7214
7215 /* Status. */
7216 vty_out (vty, " BGP state = %s",
7217 LOOKUP (bgp_status_msg, p->status));
7218 if (p->status == Established)
7219 vty_out (vty, ", up for %8s",
7220 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00007221 else if (p->status == Active)
7222 {
7223 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7224 vty_out (vty, " (passive)");
7225 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7226 vty_out (vty, " (NSF passive)");
7227 }
paul718e3742002-12-13 20:15:29 +00007228 vty_out (vty, "%s", VTY_NEWLINE);
7229
7230 /* read timer */
7231 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7232
7233 /* Configured timer values. */
7234 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7235 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7236 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7237 {
7238 vty_out (vty, " Configured hold time is %d", p->holdtime);
7239 vty_out (vty, ", keepalive interval is %d seconds%s",
7240 p->keepalive, VTY_NEWLINE);
7241 }
hasso93406d82005-02-02 14:40:33 +00007242
paul718e3742002-12-13 20:15:29 +00007243 /* Capability. */
7244 if (p->status == Established)
7245 {
hasso538621f2004-05-21 09:31:30 +00007246 if (p->cap
paul718e3742002-12-13 20:15:29 +00007247 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7248 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7249 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7250 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7251#ifdef HAVE_IPV6
7252 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7253 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7254 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7255 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
7256#endif /* HAVE_IPV6 */
7257 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7258 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7259 {
7260 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7261
7262 /* Dynamic */
7263 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
7264 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7265 {
7266 vty_out (vty, " Dynamic:");
7267 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7268 vty_out (vty, " advertised");
7269 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00007270 vty_out (vty, " %sreceived",
7271 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007272 vty_out (vty, "%s", VTY_NEWLINE);
7273 }
7274
7275 /* Route Refresh */
7276 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
7277 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7278 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
7279 {
7280 vty_out (vty, " Route refresh:");
7281 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
7282 vty_out (vty, " advertised");
7283 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7284 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00007285 vty_out (vty, " %sreceived(%s)",
7286 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
7287 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
7288 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
7289 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
7290
paul718e3742002-12-13 20:15:29 +00007291 vty_out (vty, "%s", VTY_NEWLINE);
7292 }
7293
hasso538621f2004-05-21 09:31:30 +00007294 /* Multiprotocol Extensions */
7295 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7296 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7297 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00007298 {
hasso538621f2004-05-21 09:31:30 +00007299 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
7300 if (p->afc_adv[afi][safi])
7301 vty_out (vty, " advertised");
7302 if (p->afc_recv[afi][safi])
7303 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
7304 vty_out (vty, "%s", VTY_NEWLINE);
7305 }
7306
7307 /* Gracefull Restart */
7308 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7309 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007310 {
hasso538621f2004-05-21 09:31:30 +00007311 vty_out (vty, " Graceful Restart Capabilty:");
7312 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007313 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00007314 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
7315 vty_out (vty, " %sreceived",
7316 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007317 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007318
7319 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00007320 {
hasso538621f2004-05-21 09:31:30 +00007321 int restart_af_count = 0;
7322
7323 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00007324 p->v_gr_restart, VTY_NEWLINE);
7325 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007326
7327 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7328 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7329 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
7330 {
hasso93406d82005-02-02 14:40:33 +00007331 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
7332 afi_safi_print (afi, safi),
7333 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
7334 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00007335 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00007336 }
hasso538621f2004-05-21 09:31:30 +00007337 if (! restart_af_count)
7338 vty_out (vty, "none");
7339 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007340 }
paul718e3742002-12-13 20:15:29 +00007341 }
paul718e3742002-12-13 20:15:29 +00007342 }
7343 }
7344
hasso93406d82005-02-02 14:40:33 +00007345 /* graceful restart information */
7346 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7347 || p->t_gr_restart
7348 || p->t_gr_stale)
7349 {
7350 int eor_send_af_count = 0;
7351 int eor_receive_af_count = 0;
7352
7353 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
7354 if (p->status == Established)
7355 {
7356 vty_out (vty, " End-of-RIB send: ");
7357 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7358 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7359 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
7360 {
7361 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
7362 afi_safi_print (afi, safi));
7363 eor_send_af_count++;
7364 }
7365 vty_out (vty, "%s", VTY_NEWLINE);
7366
7367 vty_out (vty, " End-of-RIB received: ");
7368 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7369 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7370 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
7371 {
7372 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
7373 afi_safi_print (afi, safi));
7374 eor_receive_af_count++;
7375 }
7376 vty_out (vty, "%s", VTY_NEWLINE);
7377 }
7378
7379 if (p->t_gr_restart)
7380 {
7381 vty_out (vty, " The remaining time of restart timer is %ld%s",
7382 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
7383 }
7384 if (p->t_gr_stale)
7385 {
7386 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
7387 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
7388 }
7389 }
7390
paul718e3742002-12-13 20:15:29 +00007391 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00007392 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
7393 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
7394 vty_out (vty, " Outq depth is %ld%s", p->obuf->count, VTY_NEWLINE);
7395 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
7396 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
7397 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
7398 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
7399 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
7400 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
7401 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
7402 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
7403 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
7404 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
7405 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007406
7407 /* advertisement-interval */
7408 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
7409 p->v_routeadv, VTY_NEWLINE);
7410
7411 /* Update-source. */
7412 if (p->update_if || p->update_source)
7413 {
7414 vty_out (vty, " Update source is ");
7415 if (p->update_if)
7416 vty_out (vty, "%s", p->update_if);
7417 else if (p->update_source)
7418 vty_out (vty, "%s",
7419 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
7420 vty_out (vty, "%s", VTY_NEWLINE);
7421 }
7422
7423 /* Default weight */
7424 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
7425 vty_out (vty, " Default weight %d%s", p->weight,
7426 VTY_NEWLINE);
7427
7428 vty_out (vty, "%s", VTY_NEWLINE);
7429
7430 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00007431 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7432 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7433 if (p->afc[afi][safi])
7434 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00007435
7436 vty_out (vty, " Connections established %d; dropped %d%s",
7437 p->established, p->dropped,
7438 VTY_NEWLINE);
7439
hassoe0701b72004-05-20 09:19:34 +00007440 if (! p->dropped)
7441 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
7442 else
7443 vty_out (vty, " Last reset %s, due to %s%s",
7444 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
7445 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00007446
paul718e3742002-12-13 20:15:29 +00007447 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7448 {
7449 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00007450
7451 if (p->t_pmax_restart)
7452 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
7453 p->host, thread_timer_remain_second (p->t_pmax_restart),
7454 VTY_NEWLINE);
7455 else
7456 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
7457 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007458 }
7459
7460 /* EBGP Multihop */
7461 if (peer_sort (p) != BGP_PEER_IBGP && p->ttl > 1)
7462 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7463 p->ttl, VTY_NEWLINE);
7464
7465 /* Local address. */
7466 if (p->su_local)
7467 {
hasso93406d82005-02-02 14:40:33 +00007468 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00007469 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
7470 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00007471 VTY_NEWLINE);
7472 }
7473
7474 /* Remote address. */
7475 if (p->su_remote)
7476 {
7477 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
7478 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
7479 ntohs (p->su_remote->sin.sin_port),
7480 VTY_NEWLINE);
7481 }
7482
7483 /* Nexthop display. */
7484 if (p->su_local)
7485 {
7486 vty_out (vty, "Nexthop: %s%s",
7487 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
7488 VTY_NEWLINE);
7489#ifdef HAVE_IPV6
7490 vty_out (vty, "Nexthop global: %s%s",
7491 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
7492 VTY_NEWLINE);
7493 vty_out (vty, "Nexthop local: %s%s",
7494 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
7495 VTY_NEWLINE);
7496 vty_out (vty, "BGP connection: %s%s",
7497 p->shared_network ? "shared network" : "non shared network",
7498 VTY_NEWLINE);
7499#endif /* HAVE_IPV6 */
7500 }
7501
7502 /* Timer information. */
7503 if (p->t_start)
7504 vty_out (vty, "Next start timer due in %ld seconds%s",
7505 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
7506 if (p->t_connect)
7507 vty_out (vty, "Next connect timer due in %ld seconds%s",
7508 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
7509
7510 vty_out (vty, "Read thread: %s Write thread: %s%s",
7511 p->t_read ? "on" : "off",
7512 p->t_write ? "on" : "off",
7513 VTY_NEWLINE);
7514
7515 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
7516 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
7517 bgp_capability_vty_out (vty, p);
7518
7519 vty_out (vty, "%s", VTY_NEWLINE);
7520}
7521
paul94f2b392005-06-28 12:44:16 +00007522static int
paul718e3742002-12-13 20:15:29 +00007523bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
7524 enum show_type type, union sockunion *su)
7525{
paul1eb8ef22005-04-07 07:30:20 +00007526 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00007527 struct peer *peer;
7528 int find = 0;
7529
paul1eb8ef22005-04-07 07:30:20 +00007530 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007531 {
7532 switch (type)
7533 {
7534 case show_all:
7535 bgp_show_peer (vty, peer);
7536 break;
7537 case show_peer:
7538 if (sockunion_same (&peer->su, su))
7539 {
7540 find = 1;
7541 bgp_show_peer (vty, peer);
7542 }
7543 break;
7544 }
7545 }
7546
7547 if (type == show_peer && ! find)
7548 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
7549
7550 return CMD_SUCCESS;
7551}
7552
paul94f2b392005-06-28 12:44:16 +00007553static int
paulfd79ac92004-10-13 05:06:08 +00007554bgp_show_neighbor_vty (struct vty *vty, const char *name,
7555 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00007556{
7557 int ret;
7558 struct bgp *bgp;
7559 union sockunion su;
7560
7561 if (ip_str)
7562 {
7563 ret = str2sockunion (ip_str, &su);
7564 if (ret < 0)
7565 {
7566 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
7567 return CMD_WARNING;
7568 }
7569 }
7570
7571 if (name)
7572 {
7573 bgp = bgp_lookup_by_name (name);
7574
7575 if (! bgp)
7576 {
7577 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7578 return CMD_WARNING;
7579 }
7580
7581 bgp_show_neighbor (vty, bgp, type, &su);
7582
7583 return CMD_SUCCESS;
7584 }
7585
7586 bgp = bgp_get_default ();
7587
7588 if (bgp)
7589 bgp_show_neighbor (vty, bgp, type, &su);
7590
7591 return CMD_SUCCESS;
7592}
7593
7594/* "show ip bgp neighbors" commands. */
7595DEFUN (show_ip_bgp_neighbors,
7596 show_ip_bgp_neighbors_cmd,
7597 "show ip bgp neighbors",
7598 SHOW_STR
7599 IP_STR
7600 BGP_STR
7601 "Detailed information on TCP and BGP neighbor connections\n")
7602{
7603 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
7604}
7605
7606ALIAS (show_ip_bgp_neighbors,
7607 show_ip_bgp_ipv4_neighbors_cmd,
7608 "show ip bgp ipv4 (unicast|multicast) neighbors",
7609 SHOW_STR
7610 IP_STR
7611 BGP_STR
7612 "Address family\n"
7613 "Address Family modifier\n"
7614 "Address Family modifier\n"
7615 "Detailed information on TCP and BGP neighbor connections\n")
7616
7617ALIAS (show_ip_bgp_neighbors,
7618 show_ip_bgp_vpnv4_all_neighbors_cmd,
7619 "show ip bgp vpnv4 all neighbors",
7620 SHOW_STR
7621 IP_STR
7622 BGP_STR
7623 "Display VPNv4 NLRI specific information\n"
7624 "Display information about all VPNv4 NLRIs\n"
7625 "Detailed information on TCP and BGP neighbor connections\n")
7626
7627ALIAS (show_ip_bgp_neighbors,
7628 show_ip_bgp_vpnv4_rd_neighbors_cmd,
7629 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
7630 SHOW_STR
7631 IP_STR
7632 BGP_STR
7633 "Display VPNv4 NLRI specific information\n"
7634 "Display information for a route distinguisher\n"
7635 "VPN Route Distinguisher\n"
7636 "Detailed information on TCP and BGP neighbor connections\n")
7637
7638ALIAS (show_ip_bgp_neighbors,
7639 show_bgp_neighbors_cmd,
7640 "show bgp neighbors",
7641 SHOW_STR
7642 BGP_STR
7643 "Detailed information on TCP and BGP neighbor connections\n")
7644
7645ALIAS (show_ip_bgp_neighbors,
7646 show_bgp_ipv6_neighbors_cmd,
7647 "show bgp ipv6 neighbors",
7648 SHOW_STR
7649 BGP_STR
7650 "Address family\n"
7651 "Detailed information on TCP and BGP neighbor connections\n")
7652
7653DEFUN (show_ip_bgp_neighbors_peer,
7654 show_ip_bgp_neighbors_peer_cmd,
7655 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
7656 SHOW_STR
7657 IP_STR
7658 BGP_STR
7659 "Detailed information on TCP and BGP neighbor connections\n"
7660 "Neighbor to display information about\n"
7661 "Neighbor to display information about\n")
7662{
7663 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
7664}
7665
7666ALIAS (show_ip_bgp_neighbors_peer,
7667 show_ip_bgp_ipv4_neighbors_peer_cmd,
7668 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
7669 SHOW_STR
7670 IP_STR
7671 BGP_STR
7672 "Address family\n"
7673 "Address Family modifier\n"
7674 "Address Family modifier\n"
7675 "Detailed information on TCP and BGP neighbor connections\n"
7676 "Neighbor to display information about\n"
7677 "Neighbor to display information about\n")
7678
7679ALIAS (show_ip_bgp_neighbors_peer,
7680 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
7681 "show ip bgp vpnv4 all neighbors A.B.C.D",
7682 SHOW_STR
7683 IP_STR
7684 BGP_STR
7685 "Display VPNv4 NLRI specific information\n"
7686 "Display information about all VPNv4 NLRIs\n"
7687 "Detailed information on TCP and BGP neighbor connections\n"
7688 "Neighbor to display information about\n")
7689
7690ALIAS (show_ip_bgp_neighbors_peer,
7691 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
7692 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
7693 SHOW_STR
7694 IP_STR
7695 BGP_STR
7696 "Display VPNv4 NLRI specific information\n"
7697 "Display information about all VPNv4 NLRIs\n"
7698 "Detailed information on TCP and BGP neighbor connections\n"
7699 "Neighbor to display information about\n")
7700
7701ALIAS (show_ip_bgp_neighbors_peer,
7702 show_bgp_neighbors_peer_cmd,
7703 "show bgp neighbors (A.B.C.D|X:X::X:X)",
7704 SHOW_STR
7705 BGP_STR
7706 "Detailed information on TCP and BGP neighbor connections\n"
7707 "Neighbor to display information about\n"
7708 "Neighbor to display information about\n")
7709
7710ALIAS (show_ip_bgp_neighbors_peer,
7711 show_bgp_ipv6_neighbors_peer_cmd,
7712 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
7713 SHOW_STR
7714 BGP_STR
7715 "Address family\n"
7716 "Detailed information on TCP and BGP neighbor connections\n"
7717 "Neighbor to display information about\n"
7718 "Neighbor to display information about\n")
7719
7720DEFUN (show_ip_bgp_instance_neighbors,
7721 show_ip_bgp_instance_neighbors_cmd,
7722 "show ip bgp view WORD neighbors",
7723 SHOW_STR
7724 IP_STR
7725 BGP_STR
7726 "BGP view\n"
7727 "View name\n"
7728 "Detailed information on TCP and BGP neighbor connections\n")
7729{
7730 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
7731}
7732
paulbb46e942003-10-24 19:02:03 +00007733ALIAS (show_ip_bgp_instance_neighbors,
7734 show_bgp_instance_neighbors_cmd,
7735 "show bgp view WORD neighbors",
7736 SHOW_STR
7737 BGP_STR
7738 "BGP view\n"
7739 "View name\n"
7740 "Detailed information on TCP and BGP neighbor connections\n")
7741
7742ALIAS (show_ip_bgp_instance_neighbors,
7743 show_bgp_instance_ipv6_neighbors_cmd,
7744 "show bgp view WORD ipv6 neighbors",
7745 SHOW_STR
7746 BGP_STR
7747 "BGP view\n"
7748 "View name\n"
7749 "Address family\n"
7750 "Detailed information on TCP and BGP neighbor connections\n")
7751
paul718e3742002-12-13 20:15:29 +00007752DEFUN (show_ip_bgp_instance_neighbors_peer,
7753 show_ip_bgp_instance_neighbors_peer_cmd,
7754 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
7755 SHOW_STR
7756 IP_STR
7757 BGP_STR
7758 "BGP view\n"
7759 "View name\n"
7760 "Detailed information on TCP and BGP neighbor connections\n"
7761 "Neighbor to display information about\n"
7762 "Neighbor to display information about\n")
7763{
7764 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
7765}
paulbb46e942003-10-24 19:02:03 +00007766
7767ALIAS (show_ip_bgp_instance_neighbors_peer,
7768 show_bgp_instance_neighbors_peer_cmd,
7769 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
7770 SHOW_STR
7771 BGP_STR
7772 "BGP view\n"
7773 "View name\n"
7774 "Detailed information on TCP and BGP neighbor connections\n"
7775 "Neighbor to display information about\n"
7776 "Neighbor to display information about\n")
7777
7778ALIAS (show_ip_bgp_instance_neighbors_peer,
7779 show_bgp_instance_ipv6_neighbors_peer_cmd,
7780 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
7781 SHOW_STR
7782 BGP_STR
7783 "BGP view\n"
7784 "View name\n"
7785 "Address family\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
paul718e3742002-12-13 20:15:29 +00007790/* Show BGP's AS paths internal data. There are both `show ip bgp
7791 paths' and `show ip mbgp paths'. Those functions results are the
7792 same.*/
7793DEFUN (show_ip_bgp_paths,
7794 show_ip_bgp_paths_cmd,
7795 "show ip bgp paths",
7796 SHOW_STR
7797 IP_STR
7798 BGP_STR
7799 "Path information\n")
7800{
7801 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
7802 aspath_print_all_vty (vty);
7803 return CMD_SUCCESS;
7804}
7805
7806DEFUN (show_ip_bgp_ipv4_paths,
7807 show_ip_bgp_ipv4_paths_cmd,
7808 "show ip bgp ipv4 (unicast|multicast) paths",
7809 SHOW_STR
7810 IP_STR
7811 BGP_STR
7812 "Address family\n"
7813 "Address Family modifier\n"
7814 "Address Family modifier\n"
7815 "Path information\n")
7816{
7817 vty_out (vty, "Address Refcnt Path\r\n");
7818 aspath_print_all_vty (vty);
7819
7820 return CMD_SUCCESS;
7821}
7822
7823#include "hash.h"
7824
paul94f2b392005-06-28 12:44:16 +00007825static void
paul718e3742002-12-13 20:15:29 +00007826community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
7827{
7828 struct community *com;
7829
7830 com = (struct community *) backet->data;
7831 vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt,
7832 community_str (com), VTY_NEWLINE);
7833}
7834
7835/* Show BGP's community internal data. */
7836DEFUN (show_ip_bgp_community_info,
7837 show_ip_bgp_community_info_cmd,
7838 "show ip bgp community-info",
7839 SHOW_STR
7840 IP_STR
7841 BGP_STR
7842 "List all bgp community information\n")
7843{
7844 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
7845
7846 hash_iterate (community_hash (),
7847 (void (*) (struct hash_backet *, void *))
7848 community_show_all_iterator,
7849 vty);
7850
7851 return CMD_SUCCESS;
7852}
7853
7854DEFUN (show_ip_bgp_attr_info,
7855 show_ip_bgp_attr_info_cmd,
7856 "show ip bgp attribute-info",
7857 SHOW_STR
7858 IP_STR
7859 BGP_STR
7860 "List all bgp attribute information\n")
7861{
7862 attr_show_all (vty);
7863 return CMD_SUCCESS;
7864}
7865
paul94f2b392005-06-28 12:44:16 +00007866static int
paulfee0f4c2004-09-13 05:12:46 +00007867bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
7868 afi_t afi, safi_t safi)
7869{
7870 char timebuf[BGP_UPTIME_LEN];
7871 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00007872 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00007873 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007874 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00007875 int len;
7876 int count = 0;
7877
7878 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
7879 {
paul1eb8ef22005-04-07 07:30:20 +00007880 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00007881 {
7882 count++;
7883 bgp_write_rsclient_summary (vty, peer, afi, safi);
7884 }
7885 return count;
7886 }
7887
7888 len = vty_out (vty, "%s", rsclient->host);
7889 len = 16 - len;
7890
7891 if (len < 1)
7892 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7893 else
7894 vty_out (vty, "%*s", len, " ");
7895
hasso3d515fd2005-02-01 21:30:04 +00007896 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00007897
7898 vty_out (vty, "%5d ", rsclient->as);
7899
7900 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
7901 if ( rmname && strlen (rmname) > 13 )
7902 {
7903 sprintf (rmbuf, "%13s", "...");
7904 rmname = strncpy (rmbuf, rmname, 10);
7905 }
7906 else if (! rmname)
7907 rmname = "<none>";
7908 vty_out (vty, " %13s ", rmname);
7909
7910 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
7911 if ( rmname && strlen (rmname) > 13 )
7912 {
7913 sprintf (rmbuf, "%13s", "...");
7914 rmname = strncpy (rmbuf, rmname, 10);
7915 }
7916 else if (! rmname)
7917 rmname = "<none>";
7918 vty_out (vty, " %13s ", rmname);
7919
7920 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
7921
7922 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
7923 vty_out (vty, " Idle (Admin)");
7924 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7925 vty_out (vty, " Idle (PfxCt)");
7926 else
7927 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
7928
7929 vty_out (vty, "%s", VTY_NEWLINE);
7930
7931 return 1;
7932}
7933
paul94f2b392005-06-28 12:44:16 +00007934static int
paulfd79ac92004-10-13 05:06:08 +00007935bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
7936 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00007937{
7938 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007939 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00007940 int count = 0;
7941
7942 /* Header string for each address family. */
7943 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
7944
paul1eb8ef22005-04-07 07:30:20 +00007945 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00007946 {
7947 if (peer->afc[afi][safi] &&
7948 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7949 {
7950 if (! count)
7951 {
7952 vty_out (vty,
7953 "Route Server's BGP router identifier %s%s",
7954 inet_ntoa (bgp->router_id), VTY_NEWLINE);
7955 vty_out (vty,
7956 "Route Server's local AS number %d%s", bgp->as,
7957 VTY_NEWLINE);
7958
7959 vty_out (vty, "%s", VTY_NEWLINE);
7960 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7961 }
7962
7963 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
7964 }
7965 }
7966
7967 if (count)
7968 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
7969 count, VTY_NEWLINE);
7970 else
7971 vty_out (vty, "No %s Route Server Client is configured%s",
7972 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7973
7974 return CMD_SUCCESS;
7975}
7976
paul94f2b392005-06-28 12:44:16 +00007977static int
paulfd79ac92004-10-13 05:06:08 +00007978bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
7979 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00007980{
7981 struct bgp *bgp;
7982
7983 if (name)
7984 {
7985 bgp = bgp_lookup_by_name (name);
7986
7987 if (! bgp)
7988 {
7989 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7990 return CMD_WARNING;
7991 }
7992
7993 bgp_show_rsclient_summary (vty, bgp, afi, safi);
7994 return CMD_SUCCESS;
7995 }
7996
7997 bgp = bgp_get_default ();
7998
7999 if (bgp)
8000 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8001
8002 return CMD_SUCCESS;
8003}
8004
8005/* 'show bgp rsclient' commands. */
8006DEFUN (show_ip_bgp_rsclient_summary,
8007 show_ip_bgp_rsclient_summary_cmd,
8008 "show ip bgp rsclient summary",
8009 SHOW_STR
8010 IP_STR
8011 BGP_STR
8012 "Information about Route Server Clients\n"
8013 "Summary of all Route Server Clients\n")
8014{
8015 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8016}
8017
8018DEFUN (show_ip_bgp_instance_rsclient_summary,
8019 show_ip_bgp_instance_rsclient_summary_cmd,
8020 "show ip bgp view WORD rsclient summary",
8021 SHOW_STR
8022 IP_STR
8023 BGP_STR
8024 "BGP view\n"
8025 "View name\n"
8026 "Information about Route Server Clients\n"
8027 "Summary of all Route Server Clients\n")
8028{
8029 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8030}
8031
8032DEFUN (show_ip_bgp_ipv4_rsclient_summary,
8033 show_ip_bgp_ipv4_rsclient_summary_cmd,
8034 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
8035 SHOW_STR
8036 IP_STR
8037 BGP_STR
8038 "Address family\n"
8039 "Address Family modifier\n"
8040 "Address Family modifier\n"
8041 "Information about Route Server Clients\n"
8042 "Summary of all Route Server Clients\n")
8043{
8044 if (strncmp (argv[0], "m", 1) == 0)
8045 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
8046
8047 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8048}
8049
8050DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
8051 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
8052 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8053 SHOW_STR
8054 IP_STR
8055 BGP_STR
8056 "BGP view\n"
8057 "View name\n"
8058 "Address family\n"
8059 "Address Family modifier\n"
8060 "Address Family modifier\n"
8061 "Information about Route Server Clients\n"
8062 "Summary of all Route Server Clients\n")
8063{
8064 if (strncmp (argv[1], "m", 1) == 0)
8065 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
8066
8067 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8068}
8069
8070#ifdef HAVE_IPV6
8071DEFUN (show_bgp_rsclient_summary,
8072 show_bgp_rsclient_summary_cmd,
8073 "show bgp rsclient summary",
8074 SHOW_STR
8075 BGP_STR
8076 "Information about Route Server Clients\n"
8077 "Summary of all Route Server Clients\n")
8078{
8079 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8080}
8081
8082DEFUN (show_bgp_instance_rsclient_summary,
8083 show_bgp_instance_rsclient_summary_cmd,
8084 "show bgp view WORD rsclient summary",
8085 SHOW_STR
8086 BGP_STR
8087 "BGP view\n"
8088 "View name\n"
8089 "Information about Route Server Clients\n"
8090 "Summary of all Route Server Clients\n")
8091{
8092 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
8093}
8094
8095ALIAS (show_bgp_rsclient_summary,
8096 show_bgp_ipv6_rsclient_summary_cmd,
8097 "show bgp ipv6 rsclient summary",
8098 SHOW_STR
8099 BGP_STR
8100 "Address family\n"
8101 "Information about Route Server Clients\n"
8102 "Summary of all Route Server Clients\n")
8103
8104ALIAS (show_bgp_instance_rsclient_summary,
8105 show_bgp_instance_ipv6_rsclient_summary_cmd,
8106 "show bgp view WORD ipv6 rsclient summary",
8107 SHOW_STR
8108 BGP_STR
8109 "BGP view\n"
8110 "View name\n"
8111 "Address family\n"
8112 "Information about Route Server Clients\n"
8113 "Summary of all Route Server Clients\n")
8114#endif /* HAVE IPV6 */
8115
paul718e3742002-12-13 20:15:29 +00008116/* Redistribute VTY commands. */
8117
8118/* Utility function to convert user input route type string to route
8119 type. */
8120static int
paulfd79ac92004-10-13 05:06:08 +00008121bgp_str2route_type (int afi, const char *str)
paul718e3742002-12-13 20:15:29 +00008122{
8123 if (! str)
8124 return 0;
8125
8126 if (afi == AFI_IP)
8127 {
8128 if (strncmp (str, "k", 1) == 0)
8129 return ZEBRA_ROUTE_KERNEL;
8130 else if (strncmp (str, "c", 1) == 0)
8131 return ZEBRA_ROUTE_CONNECT;
8132 else if (strncmp (str, "s", 1) == 0)
8133 return ZEBRA_ROUTE_STATIC;
8134 else if (strncmp (str, "r", 1) == 0)
8135 return ZEBRA_ROUTE_RIP;
8136 else if (strncmp (str, "o", 1) == 0)
8137 return ZEBRA_ROUTE_OSPF;
8138 }
8139 if (afi == AFI_IP6)
8140 {
8141 if (strncmp (str, "k", 1) == 0)
8142 return ZEBRA_ROUTE_KERNEL;
8143 else if (strncmp (str, "c", 1) == 0)
8144 return ZEBRA_ROUTE_CONNECT;
8145 else if (strncmp (str, "s", 1) == 0)
8146 return ZEBRA_ROUTE_STATIC;
8147 else if (strncmp (str, "r", 1) == 0)
8148 return ZEBRA_ROUTE_RIPNG;
8149 else if (strncmp (str, "o", 1) == 0)
8150 return ZEBRA_ROUTE_OSPF6;
8151 }
8152 return 0;
8153}
8154
8155DEFUN (bgp_redistribute_ipv4,
8156 bgp_redistribute_ipv4_cmd,
8157 "redistribute (connected|kernel|ospf|rip|static)",
8158 "Redistribute information from another routing protocol\n"
8159 "Connected\n"
8160 "Kernel routes\n"
8161 "Open Shurtest Path First (OSPF)\n"
8162 "Routing Information Protocol (RIP)\n"
8163 "Static routes\n")
8164{
8165 int type;
8166
8167 type = bgp_str2route_type (AFI_IP, argv[0]);
8168 if (! type)
8169 {
8170 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8171 return CMD_WARNING;
8172 }
8173 return bgp_redistribute_set (vty->index, AFI_IP, type);
8174}
8175
8176DEFUN (bgp_redistribute_ipv4_rmap,
8177 bgp_redistribute_ipv4_rmap_cmd,
8178 "redistribute (connected|kernel|ospf|rip|static) route-map WORD",
8179 "Redistribute information from another routing protocol\n"
8180 "Connected\n"
8181 "Kernel routes\n"
8182 "Open Shurtest Path First (OSPF)\n"
8183 "Routing Information Protocol (RIP)\n"
8184 "Static routes\n"
8185 "Route map reference\n"
8186 "Pointer to route-map entries\n")
8187{
8188 int type;
8189
8190 type = bgp_str2route_type (AFI_IP, argv[0]);
8191 if (! type)
8192 {
8193 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8194 return CMD_WARNING;
8195 }
8196
8197 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8198 return bgp_redistribute_set (vty->index, AFI_IP, type);
8199}
8200
8201DEFUN (bgp_redistribute_ipv4_metric,
8202 bgp_redistribute_ipv4_metric_cmd,
8203 "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
8204 "Redistribute information from another routing protocol\n"
8205 "Connected\n"
8206 "Kernel routes\n"
8207 "Open Shurtest Path First (OSPF)\n"
8208 "Routing Information Protocol (RIP)\n"
8209 "Static routes\n"
8210 "Metric for redistributed routes\n"
8211 "Default metric\n")
8212{
8213 int type;
8214 u_int32_t metric;
8215
8216 type = bgp_str2route_type (AFI_IP, argv[0]);
8217 if (! type)
8218 {
8219 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8220 return CMD_WARNING;
8221 }
8222 VTY_GET_INTEGER ("metric", metric, argv[1]);
8223
8224 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8225 return bgp_redistribute_set (vty->index, AFI_IP, type);
8226}
8227
8228DEFUN (bgp_redistribute_ipv4_rmap_metric,
8229 bgp_redistribute_ipv4_rmap_metric_cmd,
8230 "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
8231 "Redistribute information from another routing protocol\n"
8232 "Connected\n"
8233 "Kernel routes\n"
8234 "Open Shurtest Path First (OSPF)\n"
8235 "Routing Information Protocol (RIP)\n"
8236 "Static routes\n"
8237 "Route map reference\n"
8238 "Pointer to route-map entries\n"
8239 "Metric for redistributed routes\n"
8240 "Default metric\n")
8241{
8242 int type;
8243 u_int32_t metric;
8244
8245 type = bgp_str2route_type (AFI_IP, argv[0]);
8246 if (! type)
8247 {
8248 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8249 return CMD_WARNING;
8250 }
8251 VTY_GET_INTEGER ("metric", metric, argv[2]);
8252
8253 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8254 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8255 return bgp_redistribute_set (vty->index, AFI_IP, type);
8256}
8257
8258DEFUN (bgp_redistribute_ipv4_metric_rmap,
8259 bgp_redistribute_ipv4_metric_rmap_cmd,
8260 "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
8261 "Redistribute information from another routing protocol\n"
8262 "Connected\n"
8263 "Kernel routes\n"
8264 "Open Shurtest Path First (OSPF)\n"
8265 "Routing Information Protocol (RIP)\n"
8266 "Static routes\n"
8267 "Metric for redistributed routes\n"
8268 "Default metric\n"
8269 "Route map reference\n"
8270 "Pointer to route-map entries\n")
8271{
8272 int type;
8273 u_int32_t metric;
8274
8275 type = bgp_str2route_type (AFI_IP, argv[0]);
8276 if (! type)
8277 {
8278 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8279 return CMD_WARNING;
8280 }
8281 VTY_GET_INTEGER ("metric", metric, argv[1]);
8282
8283 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8284 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
8285 return bgp_redistribute_set (vty->index, AFI_IP, type);
8286}
8287
8288DEFUN (no_bgp_redistribute_ipv4,
8289 no_bgp_redistribute_ipv4_cmd,
8290 "no redistribute (connected|kernel|ospf|rip|static)",
8291 NO_STR
8292 "Redistribute information from another routing protocol\n"
8293 "Connected\n"
8294 "Kernel routes\n"
8295 "Open Shurtest Path First (OSPF)\n"
8296 "Routing Information Protocol (RIP)\n"
8297 "Static routes\n")
8298{
8299 int type;
8300
8301 type = bgp_str2route_type (AFI_IP, argv[0]);
8302 if (! type)
8303 {
8304 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8305 return CMD_WARNING;
8306 }
8307
8308 return bgp_redistribute_unset (vty->index, AFI_IP, type);
8309}
8310
8311DEFUN (no_bgp_redistribute_ipv4_rmap,
8312 no_bgp_redistribute_ipv4_rmap_cmd,
8313 "no redistribute (connected|kernel|ospf|rip|static) route-map WORD",
8314 NO_STR
8315 "Redistribute information from another routing protocol\n"
8316 "Connected\n"
8317 "Kernel routes\n"
8318 "Open Shurtest Path First (OSPF)\n"
8319 "Routing Information Protocol (RIP)\n"
8320 "Static routes\n"
8321 "Route map reference\n"
8322 "Pointer to route-map entries\n")
8323{
8324 int type;
8325
8326 type = bgp_str2route_type (AFI_IP, argv[0]);
8327 if (! type)
8328 {
8329 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8330 return CMD_WARNING;
8331 }
8332
8333 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8334 return CMD_SUCCESS;
8335}
8336
8337DEFUN (no_bgp_redistribute_ipv4_metric,
8338 no_bgp_redistribute_ipv4_metric_cmd,
8339 "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
8340 NO_STR
8341 "Redistribute information from another routing protocol\n"
8342 "Connected\n"
8343 "Kernel routes\n"
8344 "Open Shurtest Path First (OSPF)\n"
8345 "Routing Information Protocol (RIP)\n"
8346 "Static routes\n"
8347 "Metric for redistributed routes\n"
8348 "Default metric\n")
8349{
8350 int type;
8351
8352 type = bgp_str2route_type (AFI_IP, argv[0]);
8353 if (! type)
8354 {
8355 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8356 return CMD_WARNING;
8357 }
8358
8359 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8360 return CMD_SUCCESS;
8361}
8362
8363DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
8364 no_bgp_redistribute_ipv4_rmap_metric_cmd,
8365 "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
8366 NO_STR
8367 "Redistribute information from another routing protocol\n"
8368 "Connected\n"
8369 "Kernel routes\n"
8370 "Open Shurtest Path First (OSPF)\n"
8371 "Routing Information Protocol (RIP)\n"
8372 "Static routes\n"
8373 "Route map reference\n"
8374 "Pointer to route-map entries\n"
8375 "Metric for redistributed routes\n"
8376 "Default metric\n")
8377{
8378 int type;
8379
8380 type = bgp_str2route_type (AFI_IP, argv[0]);
8381 if (! type)
8382 {
8383 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8384 return CMD_WARNING;
8385 }
8386
8387 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8388 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8389 return CMD_SUCCESS;
8390}
8391
8392ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
8393 no_bgp_redistribute_ipv4_metric_rmap_cmd,
8394 "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
8395 NO_STR
8396 "Redistribute information from another routing protocol\n"
8397 "Connected\n"
8398 "Kernel routes\n"
8399 "Open Shurtest Path First (OSPF)\n"
8400 "Routing Information Protocol (RIP)\n"
8401 "Static routes\n"
8402 "Metric for redistributed routes\n"
8403 "Default metric\n"
8404 "Route map reference\n"
8405 "Pointer to route-map entries\n")
8406
8407#ifdef HAVE_IPV6
8408DEFUN (bgp_redistribute_ipv6,
8409 bgp_redistribute_ipv6_cmd,
8410 "redistribute (connected|kernel|ospf6|ripng|static)",
8411 "Redistribute information from another routing protocol\n"
8412 "Connected\n"
8413 "Kernel routes\n"
8414 "Open Shurtest Path First (OSPFv3)\n"
8415 "Routing Information Protocol (RIPng)\n"
8416 "Static routes\n")
8417{
8418 int type;
8419
8420 type = bgp_str2route_type (AFI_IP6, argv[0]);
8421 if (! type)
8422 {
8423 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8424 return CMD_WARNING;
8425 }
8426
8427 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8428}
8429
8430DEFUN (bgp_redistribute_ipv6_rmap,
8431 bgp_redistribute_ipv6_rmap_cmd,
8432 "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
8433 "Redistribute information from another routing protocol\n"
8434 "Connected\n"
8435 "Kernel routes\n"
8436 "Open Shurtest Path First (OSPFv3)\n"
8437 "Routing Information Protocol (RIPng)\n"
8438 "Static routes\n"
8439 "Route map reference\n"
8440 "Pointer to route-map entries\n")
8441{
8442 int type;
8443
8444 type = bgp_str2route_type (AFI_IP6, argv[0]);
8445 if (! type)
8446 {
8447 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8448 return CMD_WARNING;
8449 }
8450
8451 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8452 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8453}
8454
8455DEFUN (bgp_redistribute_ipv6_metric,
8456 bgp_redistribute_ipv6_metric_cmd,
8457 "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
8458 "Redistribute information from another routing protocol\n"
8459 "Connected\n"
8460 "Kernel routes\n"
8461 "Open Shurtest Path First (OSPFv3)\n"
8462 "Routing Information Protocol (RIPng)\n"
8463 "Static routes\n"
8464 "Metric for redistributed routes\n"
8465 "Default metric\n")
8466{
8467 int type;
8468 u_int32_t metric;
8469
8470 type = bgp_str2route_type (AFI_IP6, argv[0]);
8471 if (! type)
8472 {
8473 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8474 return CMD_WARNING;
8475 }
8476 VTY_GET_INTEGER ("metric", metric, argv[1]);
8477
8478 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8479 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8480}
8481
8482DEFUN (bgp_redistribute_ipv6_rmap_metric,
8483 bgp_redistribute_ipv6_rmap_metric_cmd,
8484 "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
8485 "Redistribute information from another routing protocol\n"
8486 "Connected\n"
8487 "Kernel routes\n"
8488 "Open Shurtest Path First (OSPFv3)\n"
8489 "Routing Information Protocol (RIPng)\n"
8490 "Static routes\n"
8491 "Route map reference\n"
8492 "Pointer to route-map entries\n"
8493 "Metric for redistributed routes\n"
8494 "Default metric\n")
8495{
8496 int type;
8497 u_int32_t metric;
8498
8499 type = bgp_str2route_type (AFI_IP6, argv[0]);
8500 if (! type)
8501 {
8502 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8503 return CMD_WARNING;
8504 }
8505 VTY_GET_INTEGER ("metric", metric, argv[2]);
8506
8507 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8508 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8509 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8510}
8511
8512DEFUN (bgp_redistribute_ipv6_metric_rmap,
8513 bgp_redistribute_ipv6_metric_rmap_cmd,
8514 "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
8515 "Redistribute information from another routing protocol\n"
8516 "Connected\n"
8517 "Kernel routes\n"
8518 "Open Shurtest Path First (OSPFv3)\n"
8519 "Routing Information Protocol (RIPng)\n"
8520 "Static routes\n"
8521 "Metric for redistributed routes\n"
8522 "Default metric\n"
8523 "Route map reference\n"
8524 "Pointer to route-map entries\n")
8525{
8526 int type;
8527 u_int32_t metric;
8528
8529 type = bgp_str2route_type (AFI_IP6, argv[0]);
8530 if (! type)
8531 {
8532 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8533 return CMD_WARNING;
8534 }
8535 VTY_GET_INTEGER ("metric", metric, argv[1]);
8536
8537 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8538 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
8539 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8540}
8541
8542DEFUN (no_bgp_redistribute_ipv6,
8543 no_bgp_redistribute_ipv6_cmd,
8544 "no redistribute (connected|kernel|ospf6|ripng|static)",
8545 NO_STR
8546 "Redistribute information from another routing protocol\n"
8547 "Connected\n"
8548 "Kernel routes\n"
8549 "Open Shurtest Path First (OSPFv3)\n"
8550 "Routing Information Protocol (RIPng)\n"
8551 "Static routes\n")
8552{
8553 int type;
8554
8555 type = bgp_str2route_type (AFI_IP6, argv[0]);
8556 if (! type)
8557 {
8558 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8559 return CMD_WARNING;
8560 }
8561
8562 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
8563}
8564
8565DEFUN (no_bgp_redistribute_ipv6_rmap,
8566 no_bgp_redistribute_ipv6_rmap_cmd,
8567 "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
8568 NO_STR
8569 "Redistribute information from another routing protocol\n"
8570 "Connected\n"
8571 "Kernel routes\n"
8572 "Open Shurtest Path First (OSPFv3)\n"
8573 "Routing Information Protocol (RIPng)\n"
8574 "Static routes\n"
8575 "Route map reference\n"
8576 "Pointer to route-map entries\n")
8577{
8578 int type;
8579
8580 type = bgp_str2route_type (AFI_IP6, argv[0]);
8581 if (! type)
8582 {
8583 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8584 return CMD_WARNING;
8585 }
8586
8587 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8588 return CMD_SUCCESS;
8589}
8590
8591DEFUN (no_bgp_redistribute_ipv6_metric,
8592 no_bgp_redistribute_ipv6_metric_cmd,
8593 "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
8594 NO_STR
8595 "Redistribute information from another routing protocol\n"
8596 "Connected\n"
8597 "Kernel routes\n"
8598 "Open Shurtest Path First (OSPFv3)\n"
8599 "Routing Information Protocol (RIPng)\n"
8600 "Static routes\n"
8601 "Metric for redistributed routes\n"
8602 "Default metric\n")
8603{
8604 int type;
8605
8606 type = bgp_str2route_type (AFI_IP6, argv[0]);
8607 if (! type)
8608 {
8609 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8610 return CMD_WARNING;
8611 }
8612
8613 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8614 return CMD_SUCCESS;
8615}
8616
8617DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
8618 no_bgp_redistribute_ipv6_rmap_metric_cmd,
8619 "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
8620 NO_STR
8621 "Redistribute information from another routing protocol\n"
8622 "Connected\n"
8623 "Kernel routes\n"
8624 "Open Shurtest Path First (OSPFv3)\n"
8625 "Routing Information Protocol (RIPng)\n"
8626 "Static routes\n"
8627 "Route map reference\n"
8628 "Pointer to route-map entries\n"
8629 "Metric for redistributed routes\n"
8630 "Default metric\n")
8631{
8632 int type;
8633
8634 type = bgp_str2route_type (AFI_IP6, argv[0]);
8635 if (! type)
8636 {
8637 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8638 return CMD_WARNING;
8639 }
8640
8641 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8642 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8643 return CMD_SUCCESS;
8644}
8645
8646ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
8647 no_bgp_redistribute_ipv6_metric_rmap_cmd,
8648 "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
8649 NO_STR
8650 "Redistribute information from another routing protocol\n"
8651 "Connected\n"
8652 "Kernel routes\n"
8653 "Open Shurtest Path First (OSPFv3)\n"
8654 "Routing Information Protocol (RIPng)\n"
8655 "Static routes\n"
8656 "Metric for redistributed routes\n"
8657 "Default metric\n"
8658 "Route map reference\n"
8659 "Pointer to route-map entries\n")
8660#endif /* HAVE_IPV6 */
8661
8662int
8663bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
8664 safi_t safi, int *write)
8665{
8666 int i;
paul718e3742002-12-13 20:15:29 +00008667
8668 /* Unicast redistribution only. */
8669 if (safi != SAFI_UNICAST)
8670 return 0;
8671
8672 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
8673 {
8674 /* Redistribute BGP does not make sense. */
8675 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
8676 {
8677 /* Display "address-family" when it is not yet diplayed. */
8678 bgp_config_write_family_header (vty, afi, safi, write);
8679
8680 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00008681 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00008682
8683 if (bgp->redist_metric_flag[afi][i])
8684 vty_out (vty, " metric %d", bgp->redist_metric[afi][i]);
8685
8686 if (bgp->rmap[afi][i].name)
8687 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
8688
8689 vty_out (vty, "%s", VTY_NEWLINE);
8690 }
8691 }
8692 return *write;
8693}
8694
8695/* BGP node structure. */
8696struct cmd_node bgp_node =
8697{
8698 BGP_NODE,
8699 "%s(config-router)# ",
8700 1,
8701};
8702
8703struct cmd_node bgp_ipv4_unicast_node =
8704{
8705 BGP_IPV4_NODE,
8706 "%s(config-router-af)# ",
8707 1,
8708};
8709
8710struct cmd_node bgp_ipv4_multicast_node =
8711{
8712 BGP_IPV4M_NODE,
8713 "%s(config-router-af)# ",
8714 1,
8715};
8716
8717struct cmd_node bgp_ipv6_unicast_node =
8718{
8719 BGP_IPV6_NODE,
8720 "%s(config-router-af)# ",
8721 1,
8722};
8723
paul25ffbdc2005-08-22 22:42:08 +00008724struct cmd_node bgp_ipv6_multicast_node =
8725{
8726 BGP_IPV6M_NODE,
8727 "%s(config-router-af)# ",
8728 1,
8729};
8730
paul718e3742002-12-13 20:15:29 +00008731struct cmd_node bgp_vpnv4_node =
8732{
8733 BGP_VPNV4_NODE,
8734 "%s(config-router-af)# ",
8735 1
8736};
8737
paul1f8ae702005-09-09 23:49:49 +00008738static void community_list_vty (void);
8739
paul718e3742002-12-13 20:15:29 +00008740void
paul94f2b392005-06-28 12:44:16 +00008741bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00008742{
paul718e3742002-12-13 20:15:29 +00008743 /* Install bgp top node. */
8744 install_node (&bgp_node, bgp_config_write);
8745 install_node (&bgp_ipv4_unicast_node, NULL);
8746 install_node (&bgp_ipv4_multicast_node, NULL);
8747 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00008748 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00008749 install_node (&bgp_vpnv4_node, NULL);
8750
8751 /* Install default VTY commands to new nodes. */
8752 install_default (BGP_NODE);
8753 install_default (BGP_IPV4_NODE);
8754 install_default (BGP_IPV4M_NODE);
8755 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00008756 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00008757 install_default (BGP_VPNV4_NODE);
8758
8759 /* "bgp multiple-instance" commands. */
8760 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
8761 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
8762
8763 /* "bgp config-type" commands. */
8764 install_element (CONFIG_NODE, &bgp_config_type_cmd);
8765 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
8766
8767 /* Dummy commands (Currently not supported) */
8768 install_element (BGP_NODE, &no_synchronization_cmd);
8769 install_element (BGP_NODE, &no_auto_summary_cmd);
8770
8771 /* "router bgp" commands. */
8772 install_element (CONFIG_NODE, &router_bgp_cmd);
8773 install_element (CONFIG_NODE, &router_bgp_view_cmd);
8774
8775 /* "no router bgp" commands. */
8776 install_element (CONFIG_NODE, &no_router_bgp_cmd);
8777 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
8778
8779 /* "bgp router-id" commands. */
8780 install_element (BGP_NODE, &bgp_router_id_cmd);
8781 install_element (BGP_NODE, &no_bgp_router_id_cmd);
8782 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
8783
8784 /* "bgp cluster-id" commands. */
8785 install_element (BGP_NODE, &bgp_cluster_id_cmd);
8786 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
8787 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
8788 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
8789
8790 /* "bgp confederation" commands. */
8791 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
8792 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
8793 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
8794
8795 /* "bgp confederation peers" commands. */
8796 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
8797 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
8798
8799 /* "timers bgp" commands. */
8800 install_element (BGP_NODE, &bgp_timers_cmd);
8801 install_element (BGP_NODE, &no_bgp_timers_cmd);
8802 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
8803
8804 /* "bgp client-to-client reflection" commands */
8805 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
8806 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
8807
8808 /* "bgp always-compare-med" commands */
8809 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
8810 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
8811
8812 /* "bgp deterministic-med" commands */
8813 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
8814 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00008815
hasso538621f2004-05-21 09:31:30 +00008816 /* "bgp graceful-restart" commands */
8817 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
8818 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00008819 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
8820 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
8821 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00008822
8823 /* "bgp fast-external-failover" commands */
8824 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
8825 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
8826
8827 /* "bgp enforce-first-as" commands */
8828 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
8829 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
8830
8831 /* "bgp bestpath compare-routerid" commands */
8832 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
8833 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
8834
8835 /* "bgp bestpath as-path ignore" commands */
8836 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
8837 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
8838
hasso68118452005-04-08 15:40:36 +00008839 /* "bgp bestpath as-path confed" commands */
8840 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
8841 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
8842
paul848973c2003-08-13 00:32:49 +00008843 /* "bgp log-neighbor-changes" commands */
8844 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
8845 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
8846
paul718e3742002-12-13 20:15:29 +00008847 /* "bgp bestpath med" commands */
8848 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
8849 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
8850 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
8851 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
8852 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
8853 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
8854
8855 /* "no bgp default ipv4-unicast" commands. */
8856 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
8857 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
8858
8859 /* "bgp network import-check" commands. */
8860 install_element (BGP_NODE, &bgp_network_import_check_cmd);
8861 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
8862
8863 /* "bgp default local-preference" commands. */
8864 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
8865 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
8866 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
8867
8868 /* "neighbor remote-as" commands. */
8869 install_element (BGP_NODE, &neighbor_remote_as_cmd);
8870 install_element (BGP_NODE, &no_neighbor_cmd);
8871 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
8872
8873 /* "neighbor peer-group" commands. */
8874 install_element (BGP_NODE, &neighbor_peer_group_cmd);
8875 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
8876 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
8877
8878 /* "neighbor local-as" commands. */
8879 install_element (BGP_NODE, &neighbor_local_as_cmd);
8880 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
8881 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
8882 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
8883 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
8884
8885 /* "neighbor activate" commands. */
8886 install_element (BGP_NODE, &neighbor_activate_cmd);
8887 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
8888 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
8889 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008890 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00008891 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
8892
8893 /* "no neighbor activate" commands. */
8894 install_element (BGP_NODE, &no_neighbor_activate_cmd);
8895 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
8896 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
8897 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008898 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00008899 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
8900
8901 /* "neighbor peer-group set" commands. */
8902 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
8903 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
8904 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
8905 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008906 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00008907 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
8908
paul718e3742002-12-13 20:15:29 +00008909 /* "no neighbor peer-group unset" commands. */
8910 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
8911 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
8912 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
8913 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008914 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00008915 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
8916
paul718e3742002-12-13 20:15:29 +00008917 /* "neighbor softreconfiguration inbound" commands.*/
8918 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
8919 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
8920 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
8921 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
8922 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
8923 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
8924 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
8925 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008926 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
8927 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +00008928 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
8929 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +00008930
8931 /* "neighbor attribute-unchanged" commands. */
8932 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
8933 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
8934 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
8935 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
8936 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
8937 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
8938 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
8939 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
8940 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
8941 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
8942 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
8943 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
8944 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
8945 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
8946 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
8947 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
8948 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
8949 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
8950 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
8951 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
8952 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
8953 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
8954 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
8955 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
8956 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
8957 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
8958 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
8959 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
8960 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
8961 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
8962 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
8963 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
8964 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
8965 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
8966 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
8967 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
8968 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
8969 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
8970 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
8971 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
8972 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
8973 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
8974 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
8975 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
8976 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
8977 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
8978 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
8979 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
8980 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
8981 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
8982 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
8983 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
8984 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
8985 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
8986 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
8987 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
8988 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
8989 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
8990 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
8991 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
8992 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
8993 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
8994 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
8995 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
8996 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
8997 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
8998 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
8999 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
9000 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
9001 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
9002 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
9003 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
9004 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
9005 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
9006 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
9007 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
9008 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
9009 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9010 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9011 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9012 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9013 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9014 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9015 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9016 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9017 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9018 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9019 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009020 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
9021 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
9022 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
9023 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
9024 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
9025 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
9026 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
9027 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
9028 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
9029 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
9030 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
9031 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
9032 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
9033 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
9034 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
9035 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
9036 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
9037 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
9038 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
9039 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
9040 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
9041 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +00009042 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
9043 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
9044 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
9045 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
9046 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
9047 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
9048 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
9049 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
9050 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
9051 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
9052 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
9053 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
9054 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9055 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9056 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9057 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9058 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9059 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9060 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9061 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9062 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9063 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9064
paulfee0f4c2004-09-13 05:12:46 +00009065 /* "nexthop-local unchanged" commands */
9066 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
9067 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
9068
paul718e3742002-12-13 20:15:29 +00009069 /* "transparent-as" and "transparent-nexthop" for old version
9070 compatibility. */
9071 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
9072 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
9073
9074 /* "neighbor next-hop-self" commands. */
9075 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
9076 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
9077 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
9078 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
9079 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
9080 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
9081 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
9082 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009083 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
9084 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009085 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
9086 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
9087
9088 /* "neighbor remove-private-AS" commands. */
9089 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
9090 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
9091 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
9092 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
9093 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
9094 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
9095 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
9096 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009097 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
9098 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009099 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
9100 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
9101
9102 /* "neighbor send-community" commands.*/
9103 install_element (BGP_NODE, &neighbor_send_community_cmd);
9104 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
9105 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
9106 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
9107 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
9108 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
9109 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
9110 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
9111 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
9112 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
9113 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
9114 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
9115 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
9116 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
9117 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
9118 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009119 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
9120 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
9121 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
9122 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00009123 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
9124 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
9125 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
9126 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
9127
9128 /* "neighbor route-reflector" commands.*/
9129 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
9130 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
9131 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
9132 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
9133 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
9134 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
9135 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
9136 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009137 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
9138 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +00009139 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
9140 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
9141
9142 /* "neighbor route-server" commands.*/
9143 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
9144 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
9145 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
9146 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
9147 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
9148 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
9149 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
9150 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009151 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
9152 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +00009153 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
9154 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
9155
9156 /* "neighbor passive" commands. */
9157 install_element (BGP_NODE, &neighbor_passive_cmd);
9158 install_element (BGP_NODE, &no_neighbor_passive_cmd);
9159
9160 /* "neighbor shutdown" commands. */
9161 install_element (BGP_NODE, &neighbor_shutdown_cmd);
9162 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
9163
hassoc9502432005-02-01 22:01:48 +00009164 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +00009165 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
9166 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
9167
9168 /* "neighbor capability orf prefix-list" commands.*/
9169 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
9170 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
9171 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
9172 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
9173 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
9174 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
9175 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
9176 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009177 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
9178 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +00009179
9180 /* "neighbor capability dynamic" commands.*/
9181 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
9182 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
9183
9184 /* "neighbor dont-capability-negotiate" commands. */
9185 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
9186 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
9187
9188 /* "neighbor ebgp-multihop" commands. */
9189 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
9190 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
9191 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
9192 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
9193
hasso6ffd2072005-02-02 14:50:11 +00009194 /* "neighbor disable-connected-check" commands. */
9195 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
9196 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +00009197 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
9198 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
9199
9200 /* "neighbor description" commands. */
9201 install_element (BGP_NODE, &neighbor_description_cmd);
9202 install_element (BGP_NODE, &no_neighbor_description_cmd);
9203 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
9204
9205 /* "neighbor update-source" commands. "*/
9206 install_element (BGP_NODE, &neighbor_update_source_cmd);
9207 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
9208
9209 /* "neighbor default-originate" commands. */
9210 install_element (BGP_NODE, &neighbor_default_originate_cmd);
9211 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
9212 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
9213 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
9214 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
9215 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
9216 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
9217 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
9218 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
9219 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
9220 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
9221 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
9222 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
9223 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
9224 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
9225 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009226 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
9227 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
9228 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
9229 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +00009230
9231 /* "neighbor port" commands. */
9232 install_element (BGP_NODE, &neighbor_port_cmd);
9233 install_element (BGP_NODE, &no_neighbor_port_cmd);
9234 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
9235
9236 /* "neighbor weight" commands. */
9237 install_element (BGP_NODE, &neighbor_weight_cmd);
9238 install_element (BGP_NODE, &no_neighbor_weight_cmd);
9239 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
9240
9241 /* "neighbor override-capability" commands. */
9242 install_element (BGP_NODE, &neighbor_override_capability_cmd);
9243 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
9244
9245 /* "neighbor strict-capability-match" commands. */
9246 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
9247 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
9248
9249 /* "neighbor timers" commands. */
9250 install_element (BGP_NODE, &neighbor_timers_cmd);
9251 install_element (BGP_NODE, &no_neighbor_timers_cmd);
9252
9253 /* "neighbor timers connect" commands. */
9254 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
9255 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
9256 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
9257
9258 /* "neighbor advertisement-interval" commands. */
9259 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
9260 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
9261 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
9262
9263 /* "neighbor version" commands. */
9264 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +00009265
9266 /* "neighbor interface" commands. */
9267 install_element (BGP_NODE, &neighbor_interface_cmd);
9268 install_element (BGP_NODE, &no_neighbor_interface_cmd);
9269
9270 /* "neighbor distribute" commands. */
9271 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
9272 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
9273 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
9274 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
9275 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
9276 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
9277 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
9278 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009279 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
9280 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +00009281 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
9282 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
9283
9284 /* "neighbor prefix-list" commands. */
9285 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
9286 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
9287 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
9288 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
9289 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
9290 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
9291 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
9292 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009293 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
9294 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +00009295 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
9296 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
9297
9298 /* "neighbor filter-list" commands. */
9299 install_element (BGP_NODE, &neighbor_filter_list_cmd);
9300 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
9301 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
9302 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
9303 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
9304 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
9305 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
9306 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009307 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
9308 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +00009309 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
9310 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
9311
9312 /* "neighbor route-map" commands. */
9313 install_element (BGP_NODE, &neighbor_route_map_cmd);
9314 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
9315 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
9316 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
9317 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
9318 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
9319 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
9320 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009321 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
9322 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +00009323 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
9324 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
9325
9326 /* "neighbor unsuppress-map" commands. */
9327 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
9328 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
9329 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
9330 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
9331 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
9332 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
9333 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
9334 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009335 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
9336 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +00009337 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
9338 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +00009339
9340 /* "neighbor maximum-prefix" commands. */
9341 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009342 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009343 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009344 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009345 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
9346 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009347 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
9348 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009349 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9350 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9351 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9352 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9353 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009354 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009355 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009356 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009357 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009358 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9359 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009360 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
9361 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009362 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9363 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9364 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9365 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9366 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009367 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009368 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009369 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009370 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009371 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
9372 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009373 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
9374 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009375 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9376 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9377 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9378 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9379 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009380 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009381 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009382 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009383 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009384 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
9385 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009386 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
9387 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009388 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9389 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9390 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9391 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9392 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009393 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
9394 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
9395 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
9396 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9397 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
9398 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9399 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
9400 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
9401 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9402 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9403 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9404 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9405 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009406 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009407 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009408 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009409 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009410 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9411 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009412 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
9413 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009414 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9415 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9416 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9417 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9418 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009419
9420 /* "neighbor allowas-in" */
9421 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
9422 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
9423 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
9424 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
9425 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
9426 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
9427 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
9428 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
9429 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
9430 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
9431 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
9432 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009433 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
9434 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
9435 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +00009436 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
9437 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
9438 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
9439
9440 /* address-family commands. */
9441 install_element (BGP_NODE, &address_family_ipv4_cmd);
9442 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
9443#ifdef HAVE_IPV6
9444 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009445 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +00009446#endif /* HAVE_IPV6 */
9447 install_element (BGP_NODE, &address_family_vpnv4_cmd);
9448 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
9449
9450 /* "exit-address-family" command. */
9451 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
9452 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
9453 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009454 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +00009455 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
9456
9457 /* "clear ip bgp commands" */
9458 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
9459 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
9460 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
9461 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
9462 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
9463 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
9464#ifdef HAVE_IPV6
9465 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
9466 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
9467 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
9468 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
9469 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
9470 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
9471 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
9472 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
9473 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
9474 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
9475 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
9476#endif /* HAVE_IPV6 */
9477
9478 /* "clear ip bgp neighbor soft in" */
9479 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
9480 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
9481 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
9482 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
9483 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
9484 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
9485 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
9486 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
9487 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
9488 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
9489 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
9490 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
9491 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
9492 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
9493 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
9494 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
9495 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
9496 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
9497 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
9498 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
9499 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
9500 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
9501 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
9502 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
9503 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
9504 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
9505 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
9506 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
9507 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
9508 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
9509 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
9510 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
9511 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
9512 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
9513 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
9514 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
9515 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
9516 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
9517 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
9518 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
9519#ifdef HAVE_IPV6
9520 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
9521 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
9522 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
9523 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
9524 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
9525 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
9526 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
9527 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
9528 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
9529 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
9530 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
9531 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
9532 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
9533 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
9534 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
9535 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
9536 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
9537 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
9538 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
9539 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
9540 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
9541 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
9542 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
9543 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
9544 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
9545 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
9546 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
9547 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
9548 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
9549 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
9550 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
9551#endif /* HAVE_IPV6 */
9552
9553 /* "clear ip bgp neighbor soft out" */
9554 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
9555 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
9556 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
9557 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
9558 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
9559 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
9560 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
9561 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
9562 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
9563 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
9564 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
9565 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
9566 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
9567 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
9568 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
9569 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
9570 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
9571 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
9572 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
9573 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
9574 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
9575 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
9576 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
9577 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
9578 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
9579 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
9580 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
9581 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
9582#ifdef HAVE_IPV6
9583 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
9584 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
9585 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
9586 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
9587 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
9588 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
9589 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
9590 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
9591 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
9592 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
9593 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
9594 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
9595 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
9596 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
9597 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
9598 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
9599 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
9600 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
9601 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
9602 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
9603 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
9604#endif /* HAVE_IPV6 */
9605
9606 /* "clear ip bgp neighbor soft" */
9607 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
9608 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
9609 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
9610 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
9611 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
9612 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
9613 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
9614 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
9615 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
9616 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
9617 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
9618 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
9619 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
9620 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
9621 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
9622#ifdef HAVE_IPV6
9623 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
9624 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
9625 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
9626 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
9627 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
9628 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
9629 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
9630 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
9631 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
9632 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
9633 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
9634#endif /* HAVE_IPV6 */
9635
paulfee0f4c2004-09-13 05:12:46 +00009636 /* "clear ip bgp neighbor rsclient" */
9637 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
9638 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
9639 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
9640 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
9641#ifdef HAVE_IPV6
9642 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
9643 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
9644 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
9645 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
9646 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
9647 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
9648 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
9649 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
9650#endif /* HAVE_IPV6 */
9651
paul718e3742002-12-13 20:15:29 +00009652 /* "show ip bgp summary" commands. */
9653 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
9654 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
9655 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
9656 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
9657 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9658 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9659#ifdef HAVE_IPV6
9660 install_element (VIEW_NODE, &show_bgp_summary_cmd);
9661 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
9662 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
9663 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
9664#endif /* HAVE_IPV6 */
9665 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
9666 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
9667 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
9668 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
9669 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9670 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9671#ifdef HAVE_IPV6
9672 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
9673 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
9674 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
9675 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
9676#endif /* HAVE_IPV6 */
9677
9678 /* "show ip bgp neighbors" commands. */
9679 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
9680 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
9681 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
9682 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
9683 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
9684 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
9685 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
9686 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
9687 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
9688 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
9689 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
9690 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
9691 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
9692 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
9693 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
9694 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
9695 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
9696 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
9697 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
9698 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
9699
9700#ifdef HAVE_IPV6
9701 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
9702 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
9703 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
9704 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +00009705 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
9706 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
9707 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
9708 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +00009709 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
9710 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
9711 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
9712 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +00009713 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
9714 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
9715 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
9716 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +00009717
9718 /* Old commands. */
9719 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
9720 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
9721 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
9722 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
9723#endif /* HAVE_IPV6 */
9724
paulfee0f4c2004-09-13 05:12:46 +00009725 /* "show ip bgp rsclient" commands. */
9726 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
9727 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
9728 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
9729 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
9730 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
9731 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
9732 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
9733 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
9734
9735#ifdef HAVE_IPV6
9736 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
9737 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
9738 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
9739 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
9740 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
9741 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
9742 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
9743 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
9744#endif /* HAVE_IPV6 */
9745
paul718e3742002-12-13 20:15:29 +00009746 /* "show ip bgp paths" commands. */
9747 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
9748 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
9749 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
9750 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
9751
9752 /* "show ip bgp community" commands. */
9753 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
9754 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
9755
9756 /* "show ip bgp attribute-info" commands. */
9757 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
9758 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
9759
9760 /* "redistribute" commands. */
9761 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
9762 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
9763 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
9764 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
9765 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
9766 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
9767 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
9768 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
9769 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
9770 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
9771#ifdef HAVE_IPV6
9772 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
9773 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
9774 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
9775 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
9776 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
9777 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
9778 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
9779 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
9780 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
9781 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
9782#endif /* HAVE_IPV6 */
9783
Paul Jakma4bf6a362006-03-30 14:05:23 +00009784 /* "show bgp memory" commands. */
9785 install_element (VIEW_NODE, &show_bgp_memory_cmd);
9786 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
9787
paul718e3742002-12-13 20:15:29 +00009788 /* Community-list. */
9789 community_list_vty ();
9790}
9791
9792#include "memory.h"
9793#include "bgp_regex.h"
9794#include "bgp_clist.h"
9795#include "bgp_ecommunity.h"
9796
9797/* VTY functions. */
9798
9799/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +00009800static const char *
paul718e3742002-12-13 20:15:29 +00009801community_direct_str (int direct)
9802{
9803 switch (direct)
9804 {
9805 case COMMUNITY_DENY:
9806 return "deny";
paul718e3742002-12-13 20:15:29 +00009807 case COMMUNITY_PERMIT:
9808 return "permit";
paul718e3742002-12-13 20:15:29 +00009809 default:
9810 return "unknown";
paul718e3742002-12-13 20:15:29 +00009811 }
9812}
9813
9814/* Display error string. */
paul94f2b392005-06-28 12:44:16 +00009815static void
paul718e3742002-12-13 20:15:29 +00009816community_list_perror (struct vty *vty, int ret)
9817{
9818 switch (ret)
9819 {
9820 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
9821 vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE);
9822 break;
9823 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
9824 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
9825 break;
9826 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
9827 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
9828 break;
9829 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
9830 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
9831 break;
9832 }
9833}
9834
9835/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +00009836static int
paulfd79ac92004-10-13 05:06:08 +00009837community_list_set_vty (struct vty *vty, int argc, const char **argv,
9838 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +00009839{
9840 int ret;
9841 int direct;
9842 char *str;
9843
9844 /* Check the list type. */
9845 if (strncmp (argv[1], "p", 1) == 0)
9846 direct = COMMUNITY_PERMIT;
9847 else if (strncmp (argv[1], "d", 1) == 0)
9848 direct = COMMUNITY_DENY;
9849 else
9850 {
9851 vty_out (vty, "%% Matching condition must be permit or deny%s",
9852 VTY_NEWLINE);
9853 return CMD_WARNING;
9854 }
9855
9856 /* All digit name check. */
9857 if (reject_all_digit_name && all_digit (argv[0]))
9858 {
9859 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
9860 return CMD_WARNING;
9861 }
9862
9863 /* Concat community string argument. */
9864 if (argc > 1)
9865 str = argv_concat (argv, argc, 2);
9866 else
9867 str = NULL;
9868
9869 /* When community_list_set() return nevetive value, it means
9870 malformed community string. */
9871 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
9872
9873 /* Free temporary community list string allocated by
9874 argv_concat(). */
9875 if (str)
9876 XFREE (MTYPE_TMP, str);
9877
9878 if (ret < 0)
9879 {
9880 /* Display error string. */
9881 community_list_perror (vty, ret);
9882 return CMD_WARNING;
9883 }
9884
9885 return CMD_SUCCESS;
9886}
9887
paul718e3742002-12-13 20:15:29 +00009888/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +00009889static int
hassofee6e4e2005-02-02 16:29:31 +00009890community_list_unset_vty (struct vty *vty, int argc, const char **argv,
9891 int style)
paul718e3742002-12-13 20:15:29 +00009892{
9893 int ret;
hassofee6e4e2005-02-02 16:29:31 +00009894 int direct = 0;
9895 char *str = NULL;
paul718e3742002-12-13 20:15:29 +00009896
hassofee6e4e2005-02-02 16:29:31 +00009897 if (argc > 1)
paul718e3742002-12-13 20:15:29 +00009898 {
hassofee6e4e2005-02-02 16:29:31 +00009899 /* Check the list direct. */
9900 if (strncmp (argv[1], "p", 1) == 0)
9901 direct = COMMUNITY_PERMIT;
9902 else if (strncmp (argv[1], "d", 1) == 0)
9903 direct = COMMUNITY_DENY;
9904 else
9905 {
9906 vty_out (vty, "%% Matching condition must be permit or deny%s",
9907 VTY_NEWLINE);
9908 return CMD_WARNING;
9909 }
paul718e3742002-12-13 20:15:29 +00009910
hassofee6e4e2005-02-02 16:29:31 +00009911 /* Concat community string argument. */
9912 str = argv_concat (argv, argc, 2);
9913 }
paul718e3742002-12-13 20:15:29 +00009914
9915 /* Unset community list. */
9916 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
9917
9918 /* Free temporary community list string allocated by
9919 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +00009920 if (str)
9921 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00009922
9923 if (ret < 0)
9924 {
9925 community_list_perror (vty, ret);
9926 return CMD_WARNING;
9927 }
9928
9929 return CMD_SUCCESS;
9930}
9931
9932/* "community-list" keyword help string. */
9933#define COMMUNITY_LIST_STR "Add a community list entry\n"
9934#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
9935
paul718e3742002-12-13 20:15:29 +00009936DEFUN (ip_community_list_standard,
9937 ip_community_list_standard_cmd,
9938 "ip community-list <1-99> (deny|permit) .AA:NN",
9939 IP_STR
9940 COMMUNITY_LIST_STR
9941 "Community list number (standard)\n"
9942 "Specify community to reject\n"
9943 "Specify community to accept\n"
9944 COMMUNITY_VAL_STR)
9945{
9946 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
9947}
9948
9949ALIAS (ip_community_list_standard,
9950 ip_community_list_standard2_cmd,
9951 "ip community-list <1-99> (deny|permit)",
9952 IP_STR
9953 COMMUNITY_LIST_STR
9954 "Community list number (standard)\n"
9955 "Specify community to reject\n"
9956 "Specify community to accept\n")
9957
9958DEFUN (ip_community_list_expanded,
9959 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +00009960 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +00009961 IP_STR
9962 COMMUNITY_LIST_STR
9963 "Community list number (expanded)\n"
9964 "Specify community to reject\n"
9965 "Specify community to accept\n"
9966 "An ordered list as a regular-expression\n")
9967{
9968 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
9969}
9970
9971DEFUN (ip_community_list_name_standard,
9972 ip_community_list_name_standard_cmd,
9973 "ip community-list standard WORD (deny|permit) .AA:NN",
9974 IP_STR
9975 COMMUNITY_LIST_STR
9976 "Add a standard community-list entry\n"
9977 "Community list name\n"
9978 "Specify community to reject\n"
9979 "Specify community to accept\n"
9980 COMMUNITY_VAL_STR)
9981{
9982 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
9983}
9984
9985ALIAS (ip_community_list_name_standard,
9986 ip_community_list_name_standard2_cmd,
9987 "ip community-list standard WORD (deny|permit)",
9988 IP_STR
9989 COMMUNITY_LIST_STR
9990 "Add a standard community-list entry\n"
9991 "Community list name\n"
9992 "Specify community to reject\n"
9993 "Specify community to accept\n")
9994
9995DEFUN (ip_community_list_name_expanded,
9996 ip_community_list_name_expanded_cmd,
9997 "ip community-list expanded WORD (deny|permit) .LINE",
9998 IP_STR
9999 COMMUNITY_LIST_STR
10000 "Add an expanded community-list entry\n"
10001 "Community list name\n"
10002 "Specify community to reject\n"
10003 "Specify community to accept\n"
10004 "An ordered list as a regular-expression\n")
10005{
10006 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
10007}
10008
hassofee6e4e2005-02-02 16:29:31 +000010009DEFUN (no_ip_community_list_standard_all,
10010 no_ip_community_list_standard_all_cmd,
10011 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010012 NO_STR
10013 IP_STR
10014 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010015 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010016{
hassofee6e4e2005-02-02 16:29:31 +000010017 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010018}
10019
hassofee6e4e2005-02-02 16:29:31 +000010020DEFUN (no_ip_community_list_expanded_all,
10021 no_ip_community_list_expanded_all_cmd,
10022 "no ip community-list <100-500>",
10023 NO_STR
10024 IP_STR
10025 COMMUNITY_LIST_STR
10026 "Community list number (expanded)\n")
10027{
10028 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10029}
10030
10031DEFUN (no_ip_community_list_name_standard_all,
10032 no_ip_community_list_name_standard_all_cmd,
10033 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010034 NO_STR
10035 IP_STR
10036 COMMUNITY_LIST_STR
10037 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000010038 "Community list name\n")
10039{
hassofee6e4e2005-02-02 16:29:31 +000010040 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010041}
10042
hassofee6e4e2005-02-02 16:29:31 +000010043DEFUN (no_ip_community_list_name_expanded_all,
10044 no_ip_community_list_name_expanded_all_cmd,
10045 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000010046 NO_STR
10047 IP_STR
10048 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010049 "Add an expanded community-list entry\n"
10050 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000010051{
hassofee6e4e2005-02-02 16:29:31 +000010052 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010053}
10054
10055DEFUN (no_ip_community_list_standard,
10056 no_ip_community_list_standard_cmd,
10057 "no ip community-list <1-99> (deny|permit) .AA:NN",
10058 NO_STR
10059 IP_STR
10060 COMMUNITY_LIST_STR
10061 "Community list number (standard)\n"
10062 "Specify community to reject\n"
10063 "Specify community to accept\n"
10064 COMMUNITY_VAL_STR)
10065{
10066 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10067}
10068
10069DEFUN (no_ip_community_list_expanded,
10070 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010071 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010072 NO_STR
10073 IP_STR
10074 COMMUNITY_LIST_STR
10075 "Community list number (expanded)\n"
10076 "Specify community to reject\n"
10077 "Specify community to accept\n"
10078 "An ordered list as a regular-expression\n")
10079{
10080 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10081}
10082
10083DEFUN (no_ip_community_list_name_standard,
10084 no_ip_community_list_name_standard_cmd,
10085 "no ip community-list standard WORD (deny|permit) .AA:NN",
10086 NO_STR
10087 IP_STR
10088 COMMUNITY_LIST_STR
10089 "Specify a standard community-list\n"
10090 "Community list name\n"
10091 "Specify community to reject\n"
10092 "Specify community to accept\n"
10093 COMMUNITY_VAL_STR)
10094{
10095 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10096}
10097
10098DEFUN (no_ip_community_list_name_expanded,
10099 no_ip_community_list_name_expanded_cmd,
10100 "no ip community-list expanded WORD (deny|permit) .LINE",
10101 NO_STR
10102 IP_STR
10103 COMMUNITY_LIST_STR
10104 "Specify an expanded community-list\n"
10105 "Community list name\n"
10106 "Specify community to reject\n"
10107 "Specify community to accept\n"
10108 "An ordered list as a regular-expression\n")
10109{
10110 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10111}
10112
paul94f2b392005-06-28 12:44:16 +000010113static void
paul718e3742002-12-13 20:15:29 +000010114community_list_show (struct vty *vty, struct community_list *list)
10115{
10116 struct community_entry *entry;
10117
10118 for (entry = list->head; entry; entry = entry->next)
10119 {
10120 if (entry == list->head)
10121 {
10122 if (all_digit (list->name))
10123 vty_out (vty, "Community %s list %s%s",
10124 entry->style == COMMUNITY_LIST_STANDARD ?
10125 "standard" : "(expanded) access",
10126 list->name, VTY_NEWLINE);
10127 else
10128 vty_out (vty, "Named Community %s list %s%s",
10129 entry->style == COMMUNITY_LIST_STANDARD ?
10130 "standard" : "expanded",
10131 list->name, VTY_NEWLINE);
10132 }
10133 if (entry->any)
10134 vty_out (vty, " %s%s",
10135 community_direct_str (entry->direct), VTY_NEWLINE);
10136 else
10137 vty_out (vty, " %s %s%s",
10138 community_direct_str (entry->direct),
10139 entry->style == COMMUNITY_LIST_STANDARD
10140 ? community_str (entry->u.com) : entry->config,
10141 VTY_NEWLINE);
10142 }
10143}
10144
10145DEFUN (show_ip_community_list,
10146 show_ip_community_list_cmd,
10147 "show ip community-list",
10148 SHOW_STR
10149 IP_STR
10150 "List community-list\n")
10151{
10152 struct community_list *list;
10153 struct community_list_master *cm;
10154
hassofee6e4e2005-02-02 16:29:31 +000010155 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010156 if (! cm)
10157 return CMD_SUCCESS;
10158
10159 for (list = cm->num.head; list; list = list->next)
10160 community_list_show (vty, list);
10161
10162 for (list = cm->str.head; list; list = list->next)
10163 community_list_show (vty, list);
10164
10165 return CMD_SUCCESS;
10166}
10167
10168DEFUN (show_ip_community_list_arg,
10169 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010170 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010171 SHOW_STR
10172 IP_STR
10173 "List community-list\n"
10174 "Community-list number\n"
10175 "Community-list name\n")
10176{
10177 struct community_list *list;
10178
hassofee6e4e2005-02-02 16:29:31 +000010179 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010180 if (! list)
10181 {
10182 vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE);
10183 return CMD_WARNING;
10184 }
10185
10186 community_list_show (vty, list);
10187
10188 return CMD_SUCCESS;
10189}
10190
paul94f2b392005-06-28 12:44:16 +000010191static int
paulfd79ac92004-10-13 05:06:08 +000010192extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
10193 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010194{
10195 int ret;
10196 int direct;
10197 char *str;
10198
10199 /* Check the list type. */
10200 if (strncmp (argv[1], "p", 1) == 0)
10201 direct = COMMUNITY_PERMIT;
10202 else if (strncmp (argv[1], "d", 1) == 0)
10203 direct = COMMUNITY_DENY;
10204 else
10205 {
10206 vty_out (vty, "%% Matching condition must be permit or deny%s",
10207 VTY_NEWLINE);
10208 return CMD_WARNING;
10209 }
10210
10211 /* All digit name check. */
10212 if (reject_all_digit_name && all_digit (argv[0]))
10213 {
10214 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10215 return CMD_WARNING;
10216 }
10217
10218 /* Concat community string argument. */
10219 if (argc > 1)
10220 str = argv_concat (argv, argc, 2);
10221 else
10222 str = NULL;
10223
10224 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
10225
10226 /* Free temporary community list string allocated by
10227 argv_concat(). */
10228 if (str)
10229 XFREE (MTYPE_TMP, str);
10230
10231 if (ret < 0)
10232 {
10233 community_list_perror (vty, ret);
10234 return CMD_WARNING;
10235 }
10236 return CMD_SUCCESS;
10237}
10238
paul94f2b392005-06-28 12:44:16 +000010239static int
hassofee6e4e2005-02-02 16:29:31 +000010240extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
10241 int style)
paul718e3742002-12-13 20:15:29 +000010242{
10243 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010244 int direct = 0;
10245 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010246
hassofee6e4e2005-02-02 16:29:31 +000010247 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010248 {
hassofee6e4e2005-02-02 16:29:31 +000010249 /* Check the list direct. */
10250 if (strncmp (argv[1], "p", 1) == 0)
10251 direct = COMMUNITY_PERMIT;
10252 else if (strncmp (argv[1], "d", 1) == 0)
10253 direct = COMMUNITY_DENY;
10254 else
10255 {
10256 vty_out (vty, "%% Matching condition must be permit or deny%s",
10257 VTY_NEWLINE);
10258 return CMD_WARNING;
10259 }
10260
10261 /* Concat community string argument. */
10262 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000010263 }
paul718e3742002-12-13 20:15:29 +000010264
10265 /* Unset community list. */
10266 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
10267
10268 /* Free temporary community list string allocated by
10269 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010270 if (str)
10271 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010272
10273 if (ret < 0)
10274 {
10275 community_list_perror (vty, ret);
10276 return CMD_WARNING;
10277 }
10278
10279 return CMD_SUCCESS;
10280}
10281
10282/* "extcommunity-list" keyword help string. */
10283#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
10284#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
10285
10286DEFUN (ip_extcommunity_list_standard,
10287 ip_extcommunity_list_standard_cmd,
10288 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10289 IP_STR
10290 EXTCOMMUNITY_LIST_STR
10291 "Extended Community list number (standard)\n"
10292 "Specify community to reject\n"
10293 "Specify community to accept\n"
10294 EXTCOMMUNITY_VAL_STR)
10295{
10296 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
10297}
10298
10299ALIAS (ip_extcommunity_list_standard,
10300 ip_extcommunity_list_standard2_cmd,
10301 "ip extcommunity-list <1-99> (deny|permit)",
10302 IP_STR
10303 EXTCOMMUNITY_LIST_STR
10304 "Extended Community list number (standard)\n"
10305 "Specify community to reject\n"
10306 "Specify community to accept\n")
10307
10308DEFUN (ip_extcommunity_list_expanded,
10309 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010310 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010311 IP_STR
10312 EXTCOMMUNITY_LIST_STR
10313 "Extended Community list number (expanded)\n"
10314 "Specify community to reject\n"
10315 "Specify community to accept\n"
10316 "An ordered list as a regular-expression\n")
10317{
10318 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
10319}
10320
10321DEFUN (ip_extcommunity_list_name_standard,
10322 ip_extcommunity_list_name_standard_cmd,
10323 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10324 IP_STR
10325 EXTCOMMUNITY_LIST_STR
10326 "Specify standard extcommunity-list\n"
10327 "Extended Community list name\n"
10328 "Specify community to reject\n"
10329 "Specify community to accept\n"
10330 EXTCOMMUNITY_VAL_STR)
10331{
10332 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
10333}
10334
10335ALIAS (ip_extcommunity_list_name_standard,
10336 ip_extcommunity_list_name_standard2_cmd,
10337 "ip extcommunity-list standard WORD (deny|permit)",
10338 IP_STR
10339 EXTCOMMUNITY_LIST_STR
10340 "Specify standard extcommunity-list\n"
10341 "Extended Community list name\n"
10342 "Specify community to reject\n"
10343 "Specify community to accept\n")
10344
10345DEFUN (ip_extcommunity_list_name_expanded,
10346 ip_extcommunity_list_name_expanded_cmd,
10347 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
10348 IP_STR
10349 EXTCOMMUNITY_LIST_STR
10350 "Specify expanded extcommunity-list\n"
10351 "Extended Community list name\n"
10352 "Specify community to reject\n"
10353 "Specify community to accept\n"
10354 "An ordered list as a regular-expression\n")
10355{
10356 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
10357}
10358
hassofee6e4e2005-02-02 16:29:31 +000010359DEFUN (no_ip_extcommunity_list_standard_all,
10360 no_ip_extcommunity_list_standard_all_cmd,
10361 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010362 NO_STR
10363 IP_STR
10364 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010365 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010366{
hassofee6e4e2005-02-02 16:29:31 +000010367 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010368}
10369
hassofee6e4e2005-02-02 16:29:31 +000010370DEFUN (no_ip_extcommunity_list_expanded_all,
10371 no_ip_extcommunity_list_expanded_all_cmd,
10372 "no ip extcommunity-list <100-500>",
10373 NO_STR
10374 IP_STR
10375 EXTCOMMUNITY_LIST_STR
10376 "Extended Community list number (expanded)\n")
10377{
10378 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10379}
10380
10381DEFUN (no_ip_extcommunity_list_name_standard_all,
10382 no_ip_extcommunity_list_name_standard_all_cmd,
10383 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010384 NO_STR
10385 IP_STR
10386 EXTCOMMUNITY_LIST_STR
10387 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000010388 "Extended Community list name\n")
10389{
10390 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10391}
10392
10393DEFUN (no_ip_extcommunity_list_name_expanded_all,
10394 no_ip_extcommunity_list_name_expanded_all_cmd,
10395 "no ip extcommunity-list expanded WORD",
10396 NO_STR
10397 IP_STR
10398 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000010399 "Specify expanded extcommunity-list\n"
10400 "Extended Community list name\n")
10401{
hassofee6e4e2005-02-02 16:29:31 +000010402 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010403}
10404
10405DEFUN (no_ip_extcommunity_list_standard,
10406 no_ip_extcommunity_list_standard_cmd,
10407 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10408 NO_STR
10409 IP_STR
10410 EXTCOMMUNITY_LIST_STR
10411 "Extended Community list number (standard)\n"
10412 "Specify community to reject\n"
10413 "Specify community to accept\n"
10414 EXTCOMMUNITY_VAL_STR)
10415{
10416 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10417}
10418
10419DEFUN (no_ip_extcommunity_list_expanded,
10420 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010421 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010422 NO_STR
10423 IP_STR
10424 EXTCOMMUNITY_LIST_STR
10425 "Extended Community list number (expanded)\n"
10426 "Specify community to reject\n"
10427 "Specify community to accept\n"
10428 "An ordered list as a regular-expression\n")
10429{
10430 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10431}
10432
10433DEFUN (no_ip_extcommunity_list_name_standard,
10434 no_ip_extcommunity_list_name_standard_cmd,
10435 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10436 NO_STR
10437 IP_STR
10438 EXTCOMMUNITY_LIST_STR
10439 "Specify standard extcommunity-list\n"
10440 "Extended Community list name\n"
10441 "Specify community to reject\n"
10442 "Specify community to accept\n"
10443 EXTCOMMUNITY_VAL_STR)
10444{
10445 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10446}
10447
10448DEFUN (no_ip_extcommunity_list_name_expanded,
10449 no_ip_extcommunity_list_name_expanded_cmd,
10450 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
10451 NO_STR
10452 IP_STR
10453 EXTCOMMUNITY_LIST_STR
10454 "Specify expanded extcommunity-list\n"
10455 "Community list name\n"
10456 "Specify community to reject\n"
10457 "Specify community to accept\n"
10458 "An ordered list as a regular-expression\n")
10459{
10460 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10461}
10462
paul94f2b392005-06-28 12:44:16 +000010463static void
paul718e3742002-12-13 20:15:29 +000010464extcommunity_list_show (struct vty *vty, struct community_list *list)
10465{
10466 struct community_entry *entry;
10467
10468 for (entry = list->head; entry; entry = entry->next)
10469 {
10470 if (entry == list->head)
10471 {
10472 if (all_digit (list->name))
10473 vty_out (vty, "Extended community %s list %s%s",
10474 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10475 "standard" : "(expanded) access",
10476 list->name, VTY_NEWLINE);
10477 else
10478 vty_out (vty, "Named extended community %s list %s%s",
10479 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10480 "standard" : "expanded",
10481 list->name, VTY_NEWLINE);
10482 }
10483 if (entry->any)
10484 vty_out (vty, " %s%s",
10485 community_direct_str (entry->direct), VTY_NEWLINE);
10486 else
10487 vty_out (vty, " %s %s%s",
10488 community_direct_str (entry->direct),
10489 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10490 entry->u.ecom->str : entry->config,
10491 VTY_NEWLINE);
10492 }
10493}
10494
10495DEFUN (show_ip_extcommunity_list,
10496 show_ip_extcommunity_list_cmd,
10497 "show ip extcommunity-list",
10498 SHOW_STR
10499 IP_STR
10500 "List extended-community list\n")
10501{
10502 struct community_list *list;
10503 struct community_list_master *cm;
10504
hassofee6e4e2005-02-02 16:29:31 +000010505 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010506 if (! cm)
10507 return CMD_SUCCESS;
10508
10509 for (list = cm->num.head; list; list = list->next)
10510 extcommunity_list_show (vty, list);
10511
10512 for (list = cm->str.head; list; list = list->next)
10513 extcommunity_list_show (vty, list);
10514
10515 return CMD_SUCCESS;
10516}
10517
10518DEFUN (show_ip_extcommunity_list_arg,
10519 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010520 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010521 SHOW_STR
10522 IP_STR
10523 "List extended-community list\n"
10524 "Extcommunity-list number\n"
10525 "Extcommunity-list name\n")
10526{
10527 struct community_list *list;
10528
hassofee6e4e2005-02-02 16:29:31 +000010529 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010530 if (! list)
10531 {
10532 vty_out (vty, "%% Can't find extcommunit-list%s", VTY_NEWLINE);
10533 return CMD_WARNING;
10534 }
10535
10536 extcommunity_list_show (vty, list);
10537
10538 return CMD_SUCCESS;
10539}
10540
10541/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000010542static const char *
paul718e3742002-12-13 20:15:29 +000010543community_list_config_str (struct community_entry *entry)
10544{
paulfd79ac92004-10-13 05:06:08 +000010545 const char *str;
paul718e3742002-12-13 20:15:29 +000010546
10547 if (entry->any)
10548 str = "";
10549 else
10550 {
10551 if (entry->style == COMMUNITY_LIST_STANDARD)
10552 str = community_str (entry->u.com);
10553 else
10554 str = entry->config;
10555 }
10556 return str;
10557}
10558
10559/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000010560static int
paul718e3742002-12-13 20:15:29 +000010561community_list_config_write (struct vty *vty)
10562{
10563 struct community_list *list;
10564 struct community_entry *entry;
10565 struct community_list_master *cm;
10566 int write = 0;
10567
10568 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000010569 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010570
10571 for (list = cm->num.head; list; list = list->next)
10572 for (entry = list->head; entry; entry = entry->next)
10573 {
hassofee6e4e2005-02-02 16:29:31 +000010574 vty_out (vty, "ip community-list %s %s %s%s",
10575 list->name, community_direct_str (entry->direct),
10576 community_list_config_str (entry),
10577 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010578 write++;
10579 }
10580 for (list = cm->str.head; list; list = list->next)
10581 for (entry = list->head; entry; entry = entry->next)
10582 {
10583 vty_out (vty, "ip community-list %s %s %s %s%s",
10584 entry->style == COMMUNITY_LIST_STANDARD
10585 ? "standard" : "expanded",
10586 list->name, community_direct_str (entry->direct),
10587 community_list_config_str (entry),
10588 VTY_NEWLINE);
10589 write++;
10590 }
10591
10592 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000010593 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010594
10595 for (list = cm->num.head; list; list = list->next)
10596 for (entry = list->head; entry; entry = entry->next)
10597 {
hassofee6e4e2005-02-02 16:29:31 +000010598 vty_out (vty, "ip extcommunity-list %s %s %s%s",
10599 list->name, community_direct_str (entry->direct),
10600 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010601 write++;
10602 }
10603 for (list = cm->str.head; list; list = list->next)
10604 for (entry = list->head; entry; entry = entry->next)
10605 {
10606 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
10607 entry->style == EXTCOMMUNITY_LIST_STANDARD
10608 ? "standard" : "expanded",
10609 list->name, community_direct_str (entry->direct),
10610 community_list_config_str (entry), VTY_NEWLINE);
10611 write++;
10612 }
10613 return write;
10614}
10615
10616struct cmd_node community_list_node =
10617{
10618 COMMUNITY_LIST_NODE,
10619 "",
10620 1 /* Export to vtysh. */
10621};
10622
paul94f2b392005-06-28 12:44:16 +000010623static void
10624community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000010625{
10626 install_node (&community_list_node, community_list_config_write);
10627
10628 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000010629 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
10630 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
10631 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
10632 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
10633 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
10634 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000010635 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
10636 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
10637 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
10638 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000010639 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
10640 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
10641 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
10642 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
10643 install_element (VIEW_NODE, &show_ip_community_list_cmd);
10644 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
10645 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
10646 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
10647
10648 /* Extcommunity-list. */
10649 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
10650 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
10651 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
10652 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
10653 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
10654 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000010655 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
10656 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
10657 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
10658 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000010659 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
10660 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
10661 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
10662 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
10663 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
10664 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
10665 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
10666 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
10667}