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