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