blob: c4b1ef543b61a006a09861a63e0413b5ae99565a [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
paul848973c2003-08-13 00:32:49 +0000974/* "bgp log-neighbor-changes" configuration. */
975DEFUN (bgp_log_neighbor_changes,
976 bgp_log_neighbor_changes_cmd,
977 "bgp log-neighbor-changes",
978 "BGP specific commands\n"
979 "Log neighbor up/down and reset reason\n")
980{
981 struct bgp *bgp;
982
983 bgp = vty->index;
984 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
985 return CMD_SUCCESS;
986}
987
988DEFUN (no_bgp_log_neighbor_changes,
989 no_bgp_log_neighbor_changes_cmd,
990 "no bgp log-neighbor-changes",
991 NO_STR
992 "BGP specific commands\n"
993 "Log neighbor up/down and reset reason\n")
994{
995 struct bgp *bgp;
996
997 bgp = vty->index;
998 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
999 return CMD_SUCCESS;
1000}
1001
paul718e3742002-12-13 20:15:29 +00001002/* "bgp bestpath med" configuration. */
1003DEFUN (bgp_bestpath_med,
1004 bgp_bestpath_med_cmd,
1005 "bgp bestpath med (confed|missing-as-worst)",
1006 "BGP specific commands\n"
1007 "Change the default bestpath selection\n"
1008 "MED attribute\n"
1009 "Compare MED among confederation paths\n"
1010 "Treat missing MED as the least preferred one\n")
1011{
1012 struct bgp *bgp;
1013
1014 bgp = vty->index;
1015
1016 if (strncmp (argv[0], "confed", 1) == 0)
1017 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1018 else
1019 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1020
1021 return CMD_SUCCESS;
1022}
1023
1024DEFUN (bgp_bestpath_med2,
1025 bgp_bestpath_med2_cmd,
1026 "bgp bestpath med confed missing-as-worst",
1027 "BGP specific commands\n"
1028 "Change the default bestpath selection\n"
1029 "MED attribute\n"
1030 "Compare MED among confederation paths\n"
1031 "Treat missing MED as the least preferred one\n")
1032{
1033 struct bgp *bgp;
1034
1035 bgp = vty->index;
1036 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1037 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1038 return CMD_SUCCESS;
1039}
1040
1041ALIAS (bgp_bestpath_med2,
1042 bgp_bestpath_med3_cmd,
1043 "bgp bestpath med missing-as-worst confed",
1044 "BGP specific commands\n"
1045 "Change the default bestpath selection\n"
1046 "MED attribute\n"
1047 "Treat missing MED as the least preferred one\n"
1048 "Compare MED among confederation paths\n")
1049
1050DEFUN (no_bgp_bestpath_med,
1051 no_bgp_bestpath_med_cmd,
1052 "no bgp bestpath med (confed|missing-as-worst)",
1053 NO_STR
1054 "BGP specific commands\n"
1055 "Change the default bestpath selection\n"
1056 "MED attribute\n"
1057 "Compare MED among confederation paths\n"
1058 "Treat missing MED as the least preferred one\n")
1059{
1060 struct bgp *bgp;
1061
1062 bgp = vty->index;
1063
1064 if (strncmp (argv[0], "confed", 1) == 0)
1065 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1066 else
1067 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1068
1069 return CMD_SUCCESS;
1070}
1071
1072DEFUN (no_bgp_bestpath_med2,
1073 no_bgp_bestpath_med2_cmd,
1074 "no bgp bestpath med confed missing-as-worst",
1075 NO_STR
1076 "BGP specific commands\n"
1077 "Change the default bestpath selection\n"
1078 "MED attribute\n"
1079 "Compare MED among confederation paths\n"
1080 "Treat missing MED as the least preferred one\n")
1081{
1082 struct bgp *bgp;
1083
1084 bgp = vty->index;
1085 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1086 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1087 return CMD_SUCCESS;
1088}
1089
1090ALIAS (no_bgp_bestpath_med2,
1091 no_bgp_bestpath_med3_cmd,
1092 "no bgp bestpath med missing-as-worst confed",
1093 NO_STR
1094 "BGP specific commands\n"
1095 "Change the default bestpath selection\n"
1096 "MED attribute\n"
1097 "Treat missing MED as the least preferred one\n"
1098 "Compare MED among confederation paths\n")
1099
1100/* "no bgp default ipv4-unicast". */
1101DEFUN (no_bgp_default_ipv4_unicast,
1102 no_bgp_default_ipv4_unicast_cmd,
1103 "no bgp default ipv4-unicast",
1104 NO_STR
1105 "BGP specific commands\n"
1106 "Configure BGP defaults\n"
1107 "Activate ipv4-unicast for a peer by default\n")
1108{
1109 struct bgp *bgp;
1110
1111 bgp = vty->index;
1112 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1113 return CMD_SUCCESS;
1114}
1115
1116DEFUN (bgp_default_ipv4_unicast,
1117 bgp_default_ipv4_unicast_cmd,
1118 "bgp default ipv4-unicast",
1119 "BGP specific commands\n"
1120 "Configure BGP defaults\n"
1121 "Activate ipv4-unicast for a peer by default\n")
1122{
1123 struct bgp *bgp;
1124
1125 bgp = vty->index;
1126 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1127 return CMD_SUCCESS;
1128}
1129
1130/* "bgp import-check" configuration. */
1131DEFUN (bgp_network_import_check,
1132 bgp_network_import_check_cmd,
1133 "bgp network import-check",
1134 "BGP specific commands\n"
1135 "BGP network command\n"
1136 "Check BGP network route exists in IGP\n")
1137{
1138 struct bgp *bgp;
1139
1140 bgp = vty->index;
1141 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1142 return CMD_SUCCESS;
1143}
1144
1145DEFUN (no_bgp_network_import_check,
1146 no_bgp_network_import_check_cmd,
1147 "no bgp network import-check",
1148 NO_STR
1149 "BGP specific commands\n"
1150 "BGP network command\n"
1151 "Check BGP network route exists in IGP\n")
1152{
1153 struct bgp *bgp;
1154
1155 bgp = vty->index;
1156 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1157 return CMD_SUCCESS;
1158}
1159
1160DEFUN (bgp_default_local_preference,
1161 bgp_default_local_preference_cmd,
1162 "bgp default local-preference <0-4294967295>",
1163 "BGP specific commands\n"
1164 "Configure BGP defaults\n"
1165 "local preference (higher=more preferred)\n"
1166 "Configure default local preference value\n")
1167{
1168 struct bgp *bgp;
1169 u_int32_t local_pref;
1170
1171 bgp = vty->index;
1172
1173 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1174
1175 bgp_default_local_preference_set (bgp, local_pref);
1176
1177 return CMD_SUCCESS;
1178}
1179
1180DEFUN (no_bgp_default_local_preference,
1181 no_bgp_default_local_preference_cmd,
1182 "no bgp default local-preference",
1183 NO_STR
1184 "BGP specific commands\n"
1185 "Configure BGP defaults\n"
1186 "local preference (higher=more preferred)\n")
1187{
1188 struct bgp *bgp;
1189
1190 bgp = vty->index;
1191 bgp_default_local_preference_unset (bgp);
1192 return CMD_SUCCESS;
1193}
1194
1195ALIAS (no_bgp_default_local_preference,
1196 no_bgp_default_local_preference_val_cmd,
1197 "no bgp default local-preference <0-4294967295>",
1198 NO_STR
1199 "BGP specific commands\n"
1200 "Configure BGP defaults\n"
1201 "local preference (higher=more preferred)\n"
1202 "Configure default local preference value\n")
1203
1204static int
paulfd79ac92004-10-13 05:06:08 +00001205peer_remote_as_vty (struct vty *vty, const char *peer_str,
1206 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001207{
1208 int ret;
1209 struct bgp *bgp;
1210 as_t as;
1211 union sockunion su;
1212
1213 bgp = vty->index;
1214
1215 /* Get AS number. */
1216 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, 65535);
1217
1218 /* If peer is peer group, call proper function. */
1219 ret = str2sockunion (peer_str, &su);
1220 if (ret < 0)
1221 {
1222 ret = peer_group_remote_as (bgp, peer_str, &as);
1223 if (ret < 0)
1224 {
1225 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1226 return CMD_WARNING;
1227 }
1228 return CMD_SUCCESS;
1229 }
1230
1231 if (peer_address_self_check (&su))
1232 {
1233 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1234 VTY_NEWLINE);
1235 return CMD_WARNING;
1236 }
1237
1238 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1239
1240 /* This peer belongs to peer group. */
1241 switch (ret)
1242 {
1243 case BGP_ERR_PEER_GROUP_MEMBER:
1244 vty_out (vty, "%% Peer-group AS %d. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
1245 return CMD_WARNING;
1246 break;
1247 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
1248 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);
1249 return CMD_WARNING;
1250 break;
1251 }
1252 return bgp_vty_return (vty, ret);
1253}
1254
1255DEFUN (neighbor_remote_as,
1256 neighbor_remote_as_cmd,
1257 NEIGHBOR_CMD2 "remote-as <1-65535>",
1258 NEIGHBOR_STR
1259 NEIGHBOR_ADDR_STR2
1260 "Specify a BGP neighbor\n"
1261 AS_STR)
1262{
1263 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1264}
1265
1266DEFUN (neighbor_peer_group,
1267 neighbor_peer_group_cmd,
1268 "neighbor WORD peer-group",
1269 NEIGHBOR_STR
1270 "Neighbor tag\n"
1271 "Configure peer-group\n")
1272{
1273 struct bgp *bgp;
1274 struct peer_group *group;
1275
1276 bgp = vty->index;
1277
1278 group = peer_group_get (bgp, argv[0]);
1279 if (! group)
1280 return CMD_WARNING;
1281
1282 return CMD_SUCCESS;
1283}
1284
1285DEFUN (no_neighbor,
1286 no_neighbor_cmd,
1287 NO_NEIGHBOR_CMD2,
1288 NO_STR
1289 NEIGHBOR_STR
1290 NEIGHBOR_ADDR_STR2)
1291{
1292 int ret;
1293 union sockunion su;
1294 struct peer_group *group;
1295 struct peer *peer;
1296
1297 ret = str2sockunion (argv[0], &su);
1298 if (ret < 0)
1299 {
1300 group = peer_group_lookup (vty->index, argv[0]);
1301 if (group)
1302 peer_group_delete (group);
1303 else
1304 {
1305 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1306 return CMD_WARNING;
1307 }
1308 }
1309 else
1310 {
1311 peer = peer_lookup (vty->index, &su);
1312 if (peer)
1313 peer_delete (peer);
1314 }
1315
1316 return CMD_SUCCESS;
1317}
1318
1319ALIAS (no_neighbor,
1320 no_neighbor_remote_as_cmd,
1321 NO_NEIGHBOR_CMD "remote-as <1-65535>",
1322 NO_STR
1323 NEIGHBOR_STR
1324 NEIGHBOR_ADDR_STR
1325 "Specify a BGP neighbor\n"
1326 AS_STR)
1327
1328DEFUN (no_neighbor_peer_group,
1329 no_neighbor_peer_group_cmd,
1330 "no neighbor WORD peer-group",
1331 NO_STR
1332 NEIGHBOR_STR
1333 "Neighbor tag\n"
1334 "Configure peer-group\n")
1335{
1336 struct peer_group *group;
1337
1338 group = peer_group_lookup (vty->index, argv[0]);
1339 if (group)
1340 peer_group_delete (group);
1341 else
1342 {
1343 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1344 return CMD_WARNING;
1345 }
1346 return CMD_SUCCESS;
1347}
1348
1349DEFUN (no_neighbor_peer_group_remote_as,
1350 no_neighbor_peer_group_remote_as_cmd,
1351 "no neighbor WORD remote-as <1-65535>",
1352 NO_STR
1353 NEIGHBOR_STR
1354 "Neighbor tag\n"
1355 "Specify a BGP neighbor\n"
1356 AS_STR)
1357{
1358 struct peer_group *group;
1359
1360 group = peer_group_lookup (vty->index, argv[0]);
1361 if (group)
1362 peer_group_remote_as_delete (group);
1363 else
1364 {
1365 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1366 return CMD_WARNING;
1367 }
1368 return CMD_SUCCESS;
1369}
1370
1371DEFUN (neighbor_local_as,
1372 neighbor_local_as_cmd,
1373 NEIGHBOR_CMD2 "local-as <1-65535>",
1374 NEIGHBOR_STR
1375 NEIGHBOR_ADDR_STR2
1376 "Specify a local-as number\n"
1377 "AS number used as local AS\n")
1378{
1379 struct peer *peer;
1380 int ret;
1381
1382 peer = peer_and_group_lookup_vty (vty, argv[0]);
1383 if (! peer)
1384 return CMD_WARNING;
1385
1386 ret = peer_local_as_set (peer, atoi (argv[1]), 0);
1387 return bgp_vty_return (vty, ret);
1388}
1389
1390DEFUN (neighbor_local_as_no_prepend,
1391 neighbor_local_as_no_prepend_cmd,
1392 NEIGHBOR_CMD2 "local-as <1-65535> no-prepend",
1393 NEIGHBOR_STR
1394 NEIGHBOR_ADDR_STR2
1395 "Specify a local-as number\n"
1396 "AS number used as local AS\n"
1397 "Do not prepend local-as to updates from ebgp peers\n")
1398{
1399 struct peer *peer;
1400 int ret;
1401
1402 peer = peer_and_group_lookup_vty (vty, argv[0]);
1403 if (! peer)
1404 return CMD_WARNING;
1405
1406 ret = peer_local_as_set (peer, atoi (argv[1]), 1);
1407 return bgp_vty_return (vty, ret);
1408}
1409
1410DEFUN (no_neighbor_local_as,
1411 no_neighbor_local_as_cmd,
1412 NO_NEIGHBOR_CMD2 "local-as",
1413 NO_STR
1414 NEIGHBOR_STR
1415 NEIGHBOR_ADDR_STR2
1416 "Specify a local-as number\n")
1417{
1418 struct peer *peer;
1419 int ret;
1420
1421 peer = peer_and_group_lookup_vty (vty, argv[0]);
1422 if (! peer)
1423 return CMD_WARNING;
1424
1425 ret = peer_local_as_unset (peer);
1426 return bgp_vty_return (vty, ret);
1427}
1428
1429ALIAS (no_neighbor_local_as,
1430 no_neighbor_local_as_val_cmd,
1431 NO_NEIGHBOR_CMD2 "local-as <1-65535>",
1432 NO_STR
1433 NEIGHBOR_STR
1434 NEIGHBOR_ADDR_STR2
1435 "Specify a local-as number\n"
1436 "AS number used as local AS\n")
1437
1438ALIAS (no_neighbor_local_as,
1439 no_neighbor_local_as_val2_cmd,
1440 NO_NEIGHBOR_CMD2 "local-as <1-65535> no-prepend",
1441 NO_STR
1442 NEIGHBOR_STR
1443 NEIGHBOR_ADDR_STR2
1444 "Specify a local-as number\n"
1445 "AS number used as local AS\n"
1446 "Do not prepend local-as to updates from ebgp peers\n")
1447
1448DEFUN (neighbor_activate,
1449 neighbor_activate_cmd,
1450 NEIGHBOR_CMD2 "activate",
1451 NEIGHBOR_STR
1452 NEIGHBOR_ADDR_STR2
1453 "Enable the Address Family for this Neighbor\n")
1454{
1455 struct peer *peer;
1456
1457 peer = peer_and_group_lookup_vty (vty, argv[0]);
1458 if (! peer)
1459 return CMD_WARNING;
1460
1461 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1462
1463 return CMD_SUCCESS;
1464}
1465
1466DEFUN (no_neighbor_activate,
1467 no_neighbor_activate_cmd,
1468 NO_NEIGHBOR_CMD2 "activate",
1469 NO_STR
1470 NEIGHBOR_STR
1471 NEIGHBOR_ADDR_STR2
1472 "Enable the Address Family for this Neighbor\n")
1473{
1474 int ret;
1475 struct peer *peer;
1476
1477 /* Lookup peer. */
1478 peer = peer_and_group_lookup_vty (vty, argv[0]);
1479 if (! peer)
1480 return CMD_WARNING;
1481
1482 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1483
1484 return bgp_vty_return (vty, ret);
1485}
1486
1487DEFUN (neighbor_set_peer_group,
1488 neighbor_set_peer_group_cmd,
1489 NEIGHBOR_CMD "peer-group WORD",
1490 NEIGHBOR_STR
1491 NEIGHBOR_ADDR_STR
1492 "Member of the peer-group\n"
1493 "peer-group name\n")
1494{
1495 int ret;
1496 as_t as;
1497 union sockunion su;
1498 struct bgp *bgp;
1499 struct peer_group *group;
1500
1501 bgp = vty->index;
1502
1503 ret = str2sockunion (argv[0], &su);
1504 if (ret < 0)
1505 {
1506 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1507 return CMD_WARNING;
1508 }
1509
1510 group = peer_group_lookup (bgp, argv[1]);
1511 if (! group)
1512 {
1513 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1514 return CMD_WARNING;
1515 }
1516
1517 if (peer_address_self_check (&su))
1518 {
1519 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1520 VTY_NEWLINE);
1521 return CMD_WARNING;
1522 }
1523
1524 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1525 bgp_node_safi (vty), &as);
1526
1527 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1528 {
1529 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);
1530 return CMD_WARNING;
1531 }
1532
1533 return bgp_vty_return (vty, ret);
1534}
1535
1536DEFUN (no_neighbor_set_peer_group,
1537 no_neighbor_set_peer_group_cmd,
1538 NO_NEIGHBOR_CMD "peer-group WORD",
1539 NO_STR
1540 NEIGHBOR_STR
1541 NEIGHBOR_ADDR_STR
1542 "Member of the peer-group\n"
1543 "peer-group name\n")
1544{
1545 int ret;
1546 struct bgp *bgp;
1547 struct peer *peer;
1548 struct peer_group *group;
1549
1550 bgp = vty->index;
1551
1552 peer = peer_lookup_vty (vty, argv[0]);
1553 if (! peer)
1554 return CMD_WARNING;
1555
1556 group = peer_group_lookup (bgp, argv[1]);
1557 if (! group)
1558 {
1559 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1560 return CMD_WARNING;
1561 }
1562
1563 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1564 bgp_node_safi (vty));
1565
1566 return bgp_vty_return (vty, ret);
1567}
1568
1569int
paulfd79ac92004-10-13 05:06:08 +00001570peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1571 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001572{
1573 int ret;
1574 struct peer *peer;
1575
1576 peer = peer_and_group_lookup_vty (vty, ip_str);
1577 if (! peer)
1578 return CMD_WARNING;
1579
1580 if (set)
1581 ret = peer_flag_set (peer, flag);
1582 else
1583 ret = peer_flag_unset (peer, flag);
1584
1585 return bgp_vty_return (vty, ret);
1586}
1587
1588int
paulfd79ac92004-10-13 05:06:08 +00001589peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001590{
1591 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1592}
1593
1594int
paulfd79ac92004-10-13 05:06:08 +00001595peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001596{
1597 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1598}
1599
1600/* neighbor passive. */
1601DEFUN (neighbor_passive,
1602 neighbor_passive_cmd,
1603 NEIGHBOR_CMD2 "passive",
1604 NEIGHBOR_STR
1605 NEIGHBOR_ADDR_STR2
1606 "Don't send open messages to this neighbor\n")
1607{
1608 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1609}
1610
1611DEFUN (no_neighbor_passive,
1612 no_neighbor_passive_cmd,
1613 NO_NEIGHBOR_CMD2 "passive",
1614 NO_STR
1615 NEIGHBOR_STR
1616 NEIGHBOR_ADDR_STR2
1617 "Don't send open messages to this neighbor\n")
1618{
1619 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1620}
1621
1622/* neighbor shutdown. */
1623DEFUN (neighbor_shutdown,
1624 neighbor_shutdown_cmd,
1625 NEIGHBOR_CMD2 "shutdown",
1626 NEIGHBOR_STR
1627 NEIGHBOR_ADDR_STR2
1628 "Administratively shut down this neighbor\n")
1629{
1630 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1631}
1632
1633DEFUN (no_neighbor_shutdown,
1634 no_neighbor_shutdown_cmd,
1635 NO_NEIGHBOR_CMD2 "shutdown",
1636 NO_STR
1637 NEIGHBOR_STR
1638 NEIGHBOR_ADDR_STR2
1639 "Administratively shut down this neighbor\n")
1640{
1641 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1642}
1643
hassoc9502432005-02-01 22:01:48 +00001644/* Deprecated neighbor capability route-refresh. */
1645DEFUN_DEPRECATED (neighbor_capability_route_refresh,
1646 neighbor_capability_route_refresh_cmd,
1647 NEIGHBOR_CMD2 "capability route-refresh",
1648 NEIGHBOR_STR
1649 NEIGHBOR_ADDR_STR2
1650 "Advertise capability to the peer\n"
1651 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001652{
hassoc9502432005-02-01 22:01:48 +00001653 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001654}
1655
hassoc9502432005-02-01 22:01:48 +00001656DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
1657 no_neighbor_capability_route_refresh_cmd,
1658 NO_NEIGHBOR_CMD2 "capability route-refresh",
1659 NO_STR
1660 NEIGHBOR_STR
1661 NEIGHBOR_ADDR_STR2
1662 "Advertise capability to the peer\n"
1663 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001664{
hassoc9502432005-02-01 22:01:48 +00001665 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001666}
1667
1668/* neighbor capability dynamic. */
1669DEFUN (neighbor_capability_dynamic,
1670 neighbor_capability_dynamic_cmd,
1671 NEIGHBOR_CMD2 "capability dynamic",
1672 NEIGHBOR_STR
1673 NEIGHBOR_ADDR_STR2
1674 "Advertise capability to the peer\n"
1675 "Advertise dynamic capability to this neighbor\n")
1676{
1677 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1678}
1679
1680DEFUN (no_neighbor_capability_dynamic,
1681 no_neighbor_capability_dynamic_cmd,
1682 NO_NEIGHBOR_CMD2 "capability dynamic",
1683 NO_STR
1684 NEIGHBOR_STR
1685 NEIGHBOR_ADDR_STR2
1686 "Advertise capability to the peer\n"
1687 "Advertise dynamic capability to this neighbor\n")
1688{
1689 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1690}
1691
1692/* neighbor dont-capability-negotiate */
1693DEFUN (neighbor_dont_capability_negotiate,
1694 neighbor_dont_capability_negotiate_cmd,
1695 NEIGHBOR_CMD2 "dont-capability-negotiate",
1696 NEIGHBOR_STR
1697 NEIGHBOR_ADDR_STR2
1698 "Do not perform capability negotiation\n")
1699{
1700 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
1701}
1702
1703DEFUN (no_neighbor_dont_capability_negotiate,
1704 no_neighbor_dont_capability_negotiate_cmd,
1705 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
1706 NO_STR
1707 NEIGHBOR_STR
1708 NEIGHBOR_ADDR_STR2
1709 "Do not perform capability negotiation\n")
1710{
1711 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
1712}
1713
1714int
paulfd79ac92004-10-13 05:06:08 +00001715peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00001716 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001717{
1718 int ret;
1719 struct peer *peer;
1720
1721 peer = peer_and_group_lookup_vty (vty, peer_str);
1722 if (! peer)
1723 return CMD_WARNING;
1724
1725 if (set)
1726 ret = peer_af_flag_set (peer, afi, safi, flag);
1727 else
1728 ret = peer_af_flag_unset (peer, afi, safi, flag);
1729
1730 return bgp_vty_return (vty, ret);
1731}
1732
1733int
paulfd79ac92004-10-13 05:06:08 +00001734peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00001735 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00001736{
1737 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
1738}
1739
1740int
paulfd79ac92004-10-13 05:06:08 +00001741peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00001742 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00001743{
1744 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
1745}
1746
1747/* neighbor capability orf prefix-list. */
1748DEFUN (neighbor_capability_orf_prefix,
1749 neighbor_capability_orf_prefix_cmd,
1750 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
1751 NEIGHBOR_STR
1752 NEIGHBOR_ADDR_STR2
1753 "Advertise capability to the peer\n"
1754 "Advertise ORF capability to the peer\n"
1755 "Advertise prefixlist ORF capability to this neighbor\n"
1756 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
1757 "Capability to RECEIVE the ORF from this neighbor\n"
1758 "Capability to SEND the ORF to this neighbor\n")
1759{
1760 u_int16_t flag = 0;
1761
1762 if (strncmp (argv[1], "s", 1) == 0)
1763 flag = PEER_FLAG_ORF_PREFIX_SM;
1764 else if (strncmp (argv[1], "r", 1) == 0)
1765 flag = PEER_FLAG_ORF_PREFIX_RM;
1766 else if (strncmp (argv[1], "b", 1) == 0)
1767 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
1768 else
1769 return CMD_WARNING;
1770
1771 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1772 bgp_node_safi (vty), flag);
1773}
1774
1775DEFUN (no_neighbor_capability_orf_prefix,
1776 no_neighbor_capability_orf_prefix_cmd,
1777 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
1778 NO_STR
1779 NEIGHBOR_STR
1780 NEIGHBOR_ADDR_STR2
1781 "Advertise capability to the peer\n"
1782 "Advertise ORF capability to the peer\n"
1783 "Advertise prefixlist ORF capability to this neighbor\n"
1784 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
1785 "Capability to RECEIVE the ORF from this neighbor\n"
1786 "Capability to SEND the ORF to this neighbor\n")
1787{
1788 u_int16_t flag = 0;
1789
1790 if (strncmp (argv[1], "s", 1) == 0)
1791 flag = PEER_FLAG_ORF_PREFIX_SM;
1792 else if (strncmp (argv[1], "r", 1) == 0)
1793 flag = PEER_FLAG_ORF_PREFIX_RM;
1794 else if (strncmp (argv[1], "b", 1) == 0)
1795 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
1796 else
1797 return CMD_WARNING;
1798
1799 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1800 bgp_node_safi (vty), flag);
1801}
1802
1803/* neighbor next-hop-self. */
1804DEFUN (neighbor_nexthop_self,
1805 neighbor_nexthop_self_cmd,
1806 NEIGHBOR_CMD2 "next-hop-self",
1807 NEIGHBOR_STR
1808 NEIGHBOR_ADDR_STR2
1809 "Disable the next hop calculation for this neighbor\n")
1810{
1811 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1812 bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
1813}
1814
1815DEFUN (no_neighbor_nexthop_self,
1816 no_neighbor_nexthop_self_cmd,
1817 NO_NEIGHBOR_CMD2 "next-hop-self",
1818 NO_STR
1819 NEIGHBOR_STR
1820 NEIGHBOR_ADDR_STR2
1821 "Disable the next hop calculation for this neighbor\n")
1822{
1823 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1824 bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
1825}
1826
1827/* neighbor remove-private-AS. */
1828DEFUN (neighbor_remove_private_as,
1829 neighbor_remove_private_as_cmd,
1830 NEIGHBOR_CMD2 "remove-private-AS",
1831 NEIGHBOR_STR
1832 NEIGHBOR_ADDR_STR2
1833 "Remove private AS number from outbound updates\n")
1834{
1835 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1836 bgp_node_safi (vty),
1837 PEER_FLAG_REMOVE_PRIVATE_AS);
1838}
1839
1840DEFUN (no_neighbor_remove_private_as,
1841 no_neighbor_remove_private_as_cmd,
1842 NO_NEIGHBOR_CMD2 "remove-private-AS",
1843 NO_STR
1844 NEIGHBOR_STR
1845 NEIGHBOR_ADDR_STR2
1846 "Remove private AS number from outbound updates\n")
1847{
1848 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1849 bgp_node_safi (vty),
1850 PEER_FLAG_REMOVE_PRIVATE_AS);
1851}
1852
1853/* neighbor send-community. */
1854DEFUN (neighbor_send_community,
1855 neighbor_send_community_cmd,
1856 NEIGHBOR_CMD2 "send-community",
1857 NEIGHBOR_STR
1858 NEIGHBOR_ADDR_STR2
1859 "Send Community attribute to this neighbor\n")
1860{
1861 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1862 bgp_node_safi (vty),
1863 PEER_FLAG_SEND_COMMUNITY);
1864}
1865
1866DEFUN (no_neighbor_send_community,
1867 no_neighbor_send_community_cmd,
1868 NO_NEIGHBOR_CMD2 "send-community",
1869 NO_STR
1870 NEIGHBOR_STR
1871 NEIGHBOR_ADDR_STR2
1872 "Send Community attribute to this neighbor\n")
1873{
1874 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1875 bgp_node_safi (vty),
1876 PEER_FLAG_SEND_COMMUNITY);
1877}
1878
1879/* neighbor send-community extended. */
1880DEFUN (neighbor_send_community_type,
1881 neighbor_send_community_type_cmd,
1882 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
1883 NEIGHBOR_STR
1884 NEIGHBOR_ADDR_STR2
1885 "Send Community attribute to this neighbor\n"
1886 "Send Standard and Extended Community attributes\n"
1887 "Send Extended Community attributes\n"
1888 "Send Standard Community attributes\n")
1889{
1890 if (strncmp (argv[1], "s", 1) == 0)
1891 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1892 bgp_node_safi (vty),
1893 PEER_FLAG_SEND_COMMUNITY);
1894 if (strncmp (argv[1], "e", 1) == 0)
1895 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1896 bgp_node_safi (vty),
1897 PEER_FLAG_SEND_EXT_COMMUNITY);
1898
1899 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1900 bgp_node_safi (vty),
1901 (PEER_FLAG_SEND_COMMUNITY|
1902 PEER_FLAG_SEND_EXT_COMMUNITY));
1903}
1904
1905DEFUN (no_neighbor_send_community_type,
1906 no_neighbor_send_community_type_cmd,
1907 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
1908 NO_STR
1909 NEIGHBOR_STR
1910 NEIGHBOR_ADDR_STR2
1911 "Send Community attribute to this neighbor\n"
1912 "Send Standard and Extended Community attributes\n"
1913 "Send Extended Community attributes\n"
1914 "Send Standard Community attributes\n")
1915{
1916 if (strncmp (argv[1], "s", 1) == 0)
1917 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1918 bgp_node_safi (vty),
1919 PEER_FLAG_SEND_COMMUNITY);
1920 if (strncmp (argv[1], "e", 1) == 0)
1921 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1922 bgp_node_safi (vty),
1923 PEER_FLAG_SEND_EXT_COMMUNITY);
1924
1925 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1926 bgp_node_safi (vty),
1927 (PEER_FLAG_SEND_COMMUNITY |
1928 PEER_FLAG_SEND_EXT_COMMUNITY));
1929}
1930
1931/* neighbor soft-reconfig. */
1932DEFUN (neighbor_soft_reconfiguration,
1933 neighbor_soft_reconfiguration_cmd,
1934 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
1935 NEIGHBOR_STR
1936 NEIGHBOR_ADDR_STR2
1937 "Per neighbor soft reconfiguration\n"
1938 "Allow inbound soft reconfiguration for this neighbor\n")
1939{
1940 return peer_af_flag_set_vty (vty, argv[0],
1941 bgp_node_afi (vty), bgp_node_safi (vty),
1942 PEER_FLAG_SOFT_RECONFIG);
1943}
1944
1945DEFUN (no_neighbor_soft_reconfiguration,
1946 no_neighbor_soft_reconfiguration_cmd,
1947 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
1948 NO_STR
1949 NEIGHBOR_STR
1950 NEIGHBOR_ADDR_STR2
1951 "Per neighbor soft reconfiguration\n"
1952 "Allow inbound soft reconfiguration for this neighbor\n")
1953{
1954 return peer_af_flag_unset_vty (vty, argv[0],
1955 bgp_node_afi (vty), bgp_node_safi (vty),
1956 PEER_FLAG_SOFT_RECONFIG);
1957}
1958
1959DEFUN (neighbor_route_reflector_client,
1960 neighbor_route_reflector_client_cmd,
1961 NEIGHBOR_CMD2 "route-reflector-client",
1962 NEIGHBOR_STR
1963 NEIGHBOR_ADDR_STR2
1964 "Configure a neighbor as Route Reflector client\n")
1965{
1966 struct peer *peer;
1967
1968
1969 peer = peer_and_group_lookup_vty (vty, argv[0]);
1970 if (! peer)
1971 return CMD_WARNING;
1972
1973 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1974 bgp_node_safi (vty),
1975 PEER_FLAG_REFLECTOR_CLIENT);
1976}
1977
1978DEFUN (no_neighbor_route_reflector_client,
1979 no_neighbor_route_reflector_client_cmd,
1980 NO_NEIGHBOR_CMD2 "route-reflector-client",
1981 NO_STR
1982 NEIGHBOR_STR
1983 NEIGHBOR_ADDR_STR2
1984 "Configure a neighbor as Route Reflector client\n")
1985{
1986 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1987 bgp_node_safi (vty),
1988 PEER_FLAG_REFLECTOR_CLIENT);
1989}
1990
paulfee0f4c2004-09-13 05:12:46 +00001991int
paulfd79ac92004-10-13 05:06:08 +00001992peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
1993 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00001994{
1995 int ret;
1996 struct bgp *bgp;
1997 struct peer *peer;
1998 struct peer_group *group;
1999 struct listnode *nn;
2000 struct bgp_filter *pfilter;
2001 struct bgp_filter *gfilter;
2002
2003 bgp = vty->index;
2004
2005 peer = peer_and_group_lookup_vty (vty, peer_str);
2006 if ( ! peer )
2007 return CMD_WARNING;
2008
2009 /* If it is already a RS-Client, don't do anything. */
2010 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2011 return CMD_SUCCESS;
2012
2013 if ( ! peer_rsclient_active (peer) )
2014 listnode_add_sort (bgp->rsclient, peer);
2015
2016 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2017 if (ret < 0)
2018 return bgp_vty_return (vty, ret);
2019
2020 peer->rib[afi][safi] = bgp_table_init ();
2021 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
2022 peer->rib[afi][safi]->owner = peer;
2023
2024 /* Check for existing 'network' and 'redistribute' routes. */
2025 bgp_check_local_routes_rsclient (peer, afi, safi);
2026
2027 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2028 bgp_soft_reconfig_rsclient (peer, afi, safi);
2029
2030 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2031 {
2032 group = peer->group;
2033 gfilter = &peer->filter[afi][safi];
2034
2035 LIST_LOOP(group->peer, peer, nn)
2036 {
2037 pfilter = &peer->filter[afi][safi];
2038
2039 /* Members of a non-RS-Client group should not be RS-Clients, as that
2040 is checked when the become part of the peer-group */
2041 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2042 if (ret < 0)
2043 return bgp_vty_return (vty, ret);
2044
2045 /* Make peer's RIB point to group's RIB. */
2046 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2047
2048 /* Import policy. */
2049 if (pfilter->map[RMAP_IMPORT].name)
2050 free (pfilter->map[RMAP_IMPORT].name);
2051 if (gfilter->map[RMAP_IMPORT].name)
2052 {
2053 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2054 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2055 }
2056 else
2057 {
2058 pfilter->map[RMAP_IMPORT].name = NULL;
2059 pfilter->map[RMAP_IMPORT].map =NULL;
2060 }
2061
2062 /* Export policy. */
2063 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2064 {
2065 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2066 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2067 }
2068 }
2069 }
2070 return CMD_SUCCESS;
2071}
2072
2073int
paulfd79ac92004-10-13 05:06:08 +00002074peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2075 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002076{
2077 int ret;
2078 struct bgp *bgp;
2079 struct peer *peer;
2080 struct peer_group *group;
2081 struct listnode *nn;
2082
2083 bgp = vty->index;
2084
2085 peer = peer_and_group_lookup_vty (vty, peer_str);
2086 if ( ! peer )
2087 return CMD_WARNING;
2088
2089 /* If it is not a RS-Client, don't do anything. */
2090 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2091 return CMD_SUCCESS;
2092
2093 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2094 {
2095 group = peer->group;
2096
2097 LIST_LOOP (group->peer, peer, nn)
2098 {
2099 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2100 if (ret < 0)
2101 return bgp_vty_return (vty, ret);
2102
2103 peer->rib[afi][safi] = NULL;
2104 }
2105
2106 peer = group->conf;
2107 }
2108
2109 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2110 if (ret < 0)
2111 return bgp_vty_return (vty, ret);
2112
2113 if ( ! peer_rsclient_active (peer) )
2114 listnode_delete (bgp->rsclient, peer);
2115
2116 bgp_table_finish (peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
2117
2118 return CMD_SUCCESS;
2119}
2120
paul718e3742002-12-13 20:15:29 +00002121/* neighbor route-server-client. */
2122DEFUN (neighbor_route_server_client,
2123 neighbor_route_server_client_cmd,
2124 NEIGHBOR_CMD2 "route-server-client",
2125 NEIGHBOR_STR
2126 NEIGHBOR_ADDR_STR2
2127 "Configure a neighbor as Route Server client\n")
2128{
paulfee0f4c2004-09-13 05:12:46 +00002129 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2130 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002131}
2132
2133DEFUN (no_neighbor_route_server_client,
2134 no_neighbor_route_server_client_cmd,
2135 NO_NEIGHBOR_CMD2 "route-server-client",
2136 NO_STR
2137 NEIGHBOR_STR
2138 NEIGHBOR_ADDR_STR2
2139 "Configure a neighbor as Route Server client\n")
2140{
paulfee0f4c2004-09-13 05:12:46 +00002141 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2142 bgp_node_safi(vty));
2143}
2144
2145DEFUN (neighbor_nexthop_local_unchanged,
2146 neighbor_nexthop_local_unchanged_cmd,
2147 NEIGHBOR_CMD2 "nexthop-local unchanged",
2148 NEIGHBOR_STR
2149 NEIGHBOR_ADDR_STR2
2150 "Configure treatment of outgoing link-local nexthop attribute\n"
2151 "Leave link-local nexthop unchanged for this peer\n")
2152{
2153 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2154 bgp_node_safi (vty),
2155 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2156}
2157
2158DEFUN (no_neighbor_nexthop_local_unchanged,
2159 no_neighbor_nexthop_local_unchanged_cmd,
2160 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2161 NO_STR
2162 NEIGHBOR_STR
2163 NEIGHBOR_ADDR_STR2
2164 "Configure treatment of outgoing link-local-nexthop attribute\n"
2165 "Leave link-local nexthop unchanged for this peer\n")
2166{
paul718e3742002-12-13 20:15:29 +00002167 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2168 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002169 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002170}
2171
2172DEFUN (neighbor_attr_unchanged,
2173 neighbor_attr_unchanged_cmd,
2174 NEIGHBOR_CMD2 "attribute-unchanged",
2175 NEIGHBOR_STR
2176 NEIGHBOR_ADDR_STR2
2177 "BGP attribute is propagated unchanged to this neighbor\n")
2178{
2179 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2180 bgp_node_safi (vty),
2181 (PEER_FLAG_AS_PATH_UNCHANGED |
2182 PEER_FLAG_NEXTHOP_UNCHANGED |
2183 PEER_FLAG_MED_UNCHANGED));
2184}
2185
2186DEFUN (neighbor_attr_unchanged1,
2187 neighbor_attr_unchanged1_cmd,
2188 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2189 NEIGHBOR_STR
2190 NEIGHBOR_ADDR_STR2
2191 "BGP attribute is propagated unchanged to this neighbor\n"
2192 "As-path attribute\n"
2193 "Nexthop attribute\n"
2194 "Med attribute\n")
2195{
2196 u_int16_t flags = 0;
2197
2198 if (strncmp (argv[1], "as-path", 1) == 0)
2199 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2200 else if (strncmp (argv[1], "next-hop", 1) == 0)
2201 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2202 else if (strncmp (argv[1], "med", 1) == 0)
2203 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2204
2205 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2206 bgp_node_safi (vty), flags);
2207}
2208
2209DEFUN (neighbor_attr_unchanged2,
2210 neighbor_attr_unchanged2_cmd,
2211 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2212 NEIGHBOR_STR
2213 NEIGHBOR_ADDR_STR2
2214 "BGP attribute is propagated unchanged to this neighbor\n"
2215 "As-path attribute\n"
2216 "Nexthop attribute\n"
2217 "Med attribute\n")
2218{
2219 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2220
2221 if (strncmp (argv[1], "next-hop", 1) == 0)
2222 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2223 else if (strncmp (argv[1], "med", 1) == 0)
2224 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2225
2226 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2227 bgp_node_safi (vty), flags);
2228
2229}
2230
2231DEFUN (neighbor_attr_unchanged3,
2232 neighbor_attr_unchanged3_cmd,
2233 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2234 NEIGHBOR_STR
2235 NEIGHBOR_ADDR_STR2
2236 "BGP attribute is propagated unchanged to this neighbor\n"
2237 "Nexthop attribute\n"
2238 "As-path attribute\n"
2239 "Med attribute\n")
2240{
2241 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2242
2243 if (strncmp (argv[1], "as-path", 1) == 0)
2244 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2245 else if (strncmp (argv[1], "med", 1) == 0)
2246 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2247
2248 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2249 bgp_node_safi (vty), flags);
2250}
2251
2252DEFUN (neighbor_attr_unchanged4,
2253 neighbor_attr_unchanged4_cmd,
2254 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2255 NEIGHBOR_STR
2256 NEIGHBOR_ADDR_STR2
2257 "BGP attribute is propagated unchanged to this neighbor\n"
2258 "Med attribute\n"
2259 "As-path attribute\n"
2260 "Nexthop attribute\n")
2261{
2262 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2263
2264 if (strncmp (argv[1], "as-path", 1) == 0)
2265 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2266 else if (strncmp (argv[1], "next-hop", 1) == 0)
2267 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2268
2269 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2270 bgp_node_safi (vty), flags);
2271}
2272
2273ALIAS (neighbor_attr_unchanged,
2274 neighbor_attr_unchanged5_cmd,
2275 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2276 NEIGHBOR_STR
2277 NEIGHBOR_ADDR_STR2
2278 "BGP attribute is propagated unchanged to this neighbor\n"
2279 "As-path attribute\n"
2280 "Nexthop attribute\n"
2281 "Med attribute\n")
2282
2283ALIAS (neighbor_attr_unchanged,
2284 neighbor_attr_unchanged6_cmd,
2285 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2286 NEIGHBOR_STR
2287 NEIGHBOR_ADDR_STR2
2288 "BGP attribute is propagated unchanged to this neighbor\n"
2289 "As-path attribute\n"
2290 "Med attribute\n"
2291 "Nexthop attribute\n")
2292
2293ALIAS (neighbor_attr_unchanged,
2294 neighbor_attr_unchanged7_cmd,
2295 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2296 NEIGHBOR_STR
2297 NEIGHBOR_ADDR_STR2
2298 "BGP attribute is propagated unchanged to this neighbor\n"
2299 "Nexthop attribute\n"
2300 "Med attribute\n"
2301 "As-path attribute\n")
2302
2303ALIAS (neighbor_attr_unchanged,
2304 neighbor_attr_unchanged8_cmd,
2305 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2306 NEIGHBOR_STR
2307 NEIGHBOR_ADDR_STR2
2308 "BGP attribute is propagated unchanged to this neighbor\n"
2309 "Nexthop attribute\n"
2310 "As-path attribute\n"
2311 "Med attribute\n")
2312
2313ALIAS (neighbor_attr_unchanged,
2314 neighbor_attr_unchanged9_cmd,
2315 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2316 NEIGHBOR_STR
2317 NEIGHBOR_ADDR_STR2
2318 "BGP attribute is propagated unchanged to this neighbor\n"
2319 "Med attribute\n"
2320 "Nexthop attribute\n"
2321 "As-path attribute\n")
2322
2323ALIAS (neighbor_attr_unchanged,
2324 neighbor_attr_unchanged10_cmd,
2325 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2326 NEIGHBOR_STR
2327 NEIGHBOR_ADDR_STR2
2328 "BGP attribute is propagated unchanged to this neighbor\n"
2329 "Med attribute\n"
2330 "As-path attribute\n"
2331 "Nexthop attribute\n")
2332
2333DEFUN (no_neighbor_attr_unchanged,
2334 no_neighbor_attr_unchanged_cmd,
2335 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2336 NO_STR
2337 NEIGHBOR_STR
2338 NEIGHBOR_ADDR_STR2
2339 "BGP attribute is propagated unchanged to this neighbor\n")
2340{
2341 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2342 bgp_node_safi (vty),
2343 (PEER_FLAG_AS_PATH_UNCHANGED |
2344 PEER_FLAG_NEXTHOP_UNCHANGED |
2345 PEER_FLAG_MED_UNCHANGED));
2346}
2347
2348DEFUN (no_neighbor_attr_unchanged1,
2349 no_neighbor_attr_unchanged1_cmd,
2350 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2351 NO_STR
2352 NEIGHBOR_STR
2353 NEIGHBOR_ADDR_STR2
2354 "BGP attribute is propagated unchanged to this neighbor\n"
2355 "As-path attribute\n"
2356 "Nexthop attribute\n"
2357 "Med attribute\n")
2358{
2359 u_int16_t flags = 0;
2360
2361 if (strncmp (argv[1], "as-path", 1) == 0)
2362 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2363 else if (strncmp (argv[1], "next-hop", 1) == 0)
2364 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2365 else if (strncmp (argv[1], "med", 1) == 0)
2366 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2367
2368 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2369 bgp_node_safi (vty), flags);
2370}
2371
2372DEFUN (no_neighbor_attr_unchanged2,
2373 no_neighbor_attr_unchanged2_cmd,
2374 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2375 NO_STR
2376 NEIGHBOR_STR
2377 NEIGHBOR_ADDR_STR2
2378 "BGP attribute is propagated unchanged to this neighbor\n"
2379 "As-path attribute\n"
2380 "Nexthop attribute\n"
2381 "Med attribute\n")
2382{
2383 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2384
2385 if (strncmp (argv[1], "next-hop", 1) == 0)
2386 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2387 else if (strncmp (argv[1], "med", 1) == 0)
2388 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2389
2390 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2391 bgp_node_safi (vty), flags);
2392}
2393
2394DEFUN (no_neighbor_attr_unchanged3,
2395 no_neighbor_attr_unchanged3_cmd,
2396 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2397 NO_STR
2398 NEIGHBOR_STR
2399 NEIGHBOR_ADDR_STR2
2400 "BGP attribute is propagated unchanged to this neighbor\n"
2401 "Nexthop attribute\n"
2402 "As-path attribute\n"
2403 "Med attribute\n")
2404{
2405 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2406
2407 if (strncmp (argv[1], "as-path", 1) == 0)
2408 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2409 else if (strncmp (argv[1], "med", 1) == 0)
2410 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2411
2412 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2413 bgp_node_safi (vty), flags);
2414}
2415
2416DEFUN (no_neighbor_attr_unchanged4,
2417 no_neighbor_attr_unchanged4_cmd,
2418 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2419 NO_STR
2420 NEIGHBOR_STR
2421 NEIGHBOR_ADDR_STR2
2422 "BGP attribute is propagated unchanged to this neighbor\n"
2423 "Med attribute\n"
2424 "As-path attribute\n"
2425 "Nexthop attribute\n")
2426{
2427 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2428
2429 if (strncmp (argv[1], "as-path", 1) == 0)
2430 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2431 else if (strncmp (argv[1], "next-hop", 1) == 0)
2432 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2433
2434 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2435 bgp_node_safi (vty), flags);
2436}
2437
2438ALIAS (no_neighbor_attr_unchanged,
2439 no_neighbor_attr_unchanged5_cmd,
2440 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2441 NO_STR
2442 NEIGHBOR_STR
2443 NEIGHBOR_ADDR_STR2
2444 "BGP attribute is propagated unchanged to this neighbor\n"
2445 "As-path attribute\n"
2446 "Nexthop attribute\n"
2447 "Med attribute\n")
2448
2449ALIAS (no_neighbor_attr_unchanged,
2450 no_neighbor_attr_unchanged6_cmd,
2451 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2452 NO_STR
2453 NEIGHBOR_STR
2454 NEIGHBOR_ADDR_STR2
2455 "BGP attribute is propagated unchanged to this neighbor\n"
2456 "As-path attribute\n"
2457 "Med attribute\n"
2458 "Nexthop attribute\n")
2459
2460ALIAS (no_neighbor_attr_unchanged,
2461 no_neighbor_attr_unchanged7_cmd,
2462 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2463 NO_STR
2464 NEIGHBOR_STR
2465 NEIGHBOR_ADDR_STR2
2466 "BGP attribute is propagated unchanged to this neighbor\n"
2467 "Nexthop attribute\n"
2468 "Med attribute\n"
2469 "As-path attribute\n")
2470
2471ALIAS (no_neighbor_attr_unchanged,
2472 no_neighbor_attr_unchanged8_cmd,
2473 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2474 NO_STR
2475 NEIGHBOR_STR
2476 NEIGHBOR_ADDR_STR2
2477 "BGP attribute is propagated unchanged to this neighbor\n"
2478 "Nexthop attribute\n"
2479 "As-path attribute\n"
2480 "Med attribute\n")
2481
2482ALIAS (no_neighbor_attr_unchanged,
2483 no_neighbor_attr_unchanged9_cmd,
2484 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2485 NO_STR
2486 NEIGHBOR_STR
2487 NEIGHBOR_ADDR_STR2
2488 "BGP attribute is propagated unchanged to this neighbor\n"
2489 "Med attribute\n"
2490 "Nexthop attribute\n"
2491 "As-path attribute\n")
2492
2493ALIAS (no_neighbor_attr_unchanged,
2494 no_neighbor_attr_unchanged10_cmd,
2495 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2496 NO_STR
2497 NEIGHBOR_STR
2498 NEIGHBOR_ADDR_STR2
2499 "BGP attribute is propagated unchanged to this neighbor\n"
2500 "Med attribute\n"
2501 "As-path attribute\n"
2502 "Nexthop attribute\n")
2503
2504/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002505DEFUN_DEPRECATED (neighbor_transparent_as,
2506 neighbor_transparent_as_cmd,
2507 NEIGHBOR_CMD "transparent-as",
2508 NEIGHBOR_STR
2509 NEIGHBOR_ADDR_STR
2510 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002511{
2512 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2513 bgp_node_safi (vty),
2514 PEER_FLAG_AS_PATH_UNCHANGED);
2515}
2516
hassodd4c5932005-02-02 17:15:34 +00002517DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2518 neighbor_transparent_nexthop_cmd,
2519 NEIGHBOR_CMD "transparent-nexthop",
2520 NEIGHBOR_STR
2521 NEIGHBOR_ADDR_STR
2522 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002523{
2524 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2525 bgp_node_safi (vty),
2526 PEER_FLAG_NEXTHOP_UNCHANGED);
2527}
2528
2529/* EBGP multihop configuration. */
2530int
paulfd79ac92004-10-13 05:06:08 +00002531peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2532 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002533{
2534 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002535 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002536
2537 peer = peer_and_group_lookup_vty (vty, ip_str);
2538 if (! peer)
2539 return CMD_WARNING;
2540
2541 if (! ttl_str)
2542 ttl = TTL_MAX;
2543 else
2544 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2545
2546 peer_ebgp_multihop_set (peer, ttl);
2547
2548 return CMD_SUCCESS;
2549}
2550
2551int
paulfd79ac92004-10-13 05:06:08 +00002552peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002553{
2554 struct peer *peer;
2555
2556 peer = peer_and_group_lookup_vty (vty, ip_str);
2557 if (! peer)
2558 return CMD_WARNING;
2559
2560 peer_ebgp_multihop_unset (peer);
2561
2562 return CMD_SUCCESS;
2563}
2564
2565/* neighbor ebgp-multihop. */
2566DEFUN (neighbor_ebgp_multihop,
2567 neighbor_ebgp_multihop_cmd,
2568 NEIGHBOR_CMD2 "ebgp-multihop",
2569 NEIGHBOR_STR
2570 NEIGHBOR_ADDR_STR2
2571 "Allow EBGP neighbors not on directly connected networks\n")
2572{
2573 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2574}
2575
2576DEFUN (neighbor_ebgp_multihop_ttl,
2577 neighbor_ebgp_multihop_ttl_cmd,
2578 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2579 NEIGHBOR_STR
2580 NEIGHBOR_ADDR_STR2
2581 "Allow EBGP neighbors not on directly connected networks\n"
2582 "maximum hop count\n")
2583{
2584 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
2585}
2586
2587DEFUN (no_neighbor_ebgp_multihop,
2588 no_neighbor_ebgp_multihop_cmd,
2589 NO_NEIGHBOR_CMD2 "ebgp-multihop",
2590 NO_STR
2591 NEIGHBOR_STR
2592 NEIGHBOR_ADDR_STR2
2593 "Allow EBGP neighbors not on directly connected networks\n")
2594{
2595 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
2596}
2597
2598ALIAS (no_neighbor_ebgp_multihop,
2599 no_neighbor_ebgp_multihop_ttl_cmd,
2600 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2601 NO_STR
2602 NEIGHBOR_STR
2603 NEIGHBOR_ADDR_STR2
2604 "Allow EBGP neighbors not on directly connected networks\n"
2605 "maximum hop count\n")
2606
hasso6ffd2072005-02-02 14:50:11 +00002607/* disable-connected-check */
2608DEFUN (neighbor_disable_connected_check,
2609 neighbor_disable_connected_check_cmd,
2610 NEIGHBOR_CMD2 "disable-connected-check",
2611 NEIGHBOR_STR
2612 NEIGHBOR_ADDR_STR2
2613 "one-hop away EBGP peer using loopback address\n")
2614{
2615 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2616}
2617
2618DEFUN (no_neighbor_disable_connected_check,
2619 no_neighbor_disable_connected_check_cmd,
2620 NO_NEIGHBOR_CMD2 "disable-connected-check",
2621 NO_STR
2622 NEIGHBOR_STR
2623 NEIGHBOR_ADDR_STR2
2624 "one-hop away EBGP peer using loopback address\n")
2625{
2626 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2627}
2628
paul718e3742002-12-13 20:15:29 +00002629/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00002630ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002631 neighbor_enforce_multihop_cmd,
2632 NEIGHBOR_CMD2 "enforce-multihop",
2633 NEIGHBOR_STR
2634 NEIGHBOR_ADDR_STR2
hasso6ffd2072005-02-02 14:50:11 +00002635 "Enforce EBGP neighbors perform multihop\n");
paul718e3742002-12-13 20:15:29 +00002636
hasso6ffd2072005-02-02 14:50:11 +00002637/* Enforce multihop. */
2638ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002639 no_neighbor_enforce_multihop_cmd,
2640 NO_NEIGHBOR_CMD2 "enforce-multihop",
2641 NO_STR
2642 NEIGHBOR_STR
2643 NEIGHBOR_ADDR_STR2
hasso6ffd2072005-02-02 14:50:11 +00002644 "Enforce EBGP neighbors perform multihop\n");
paul718e3742002-12-13 20:15:29 +00002645
2646DEFUN (neighbor_description,
2647 neighbor_description_cmd,
2648 NEIGHBOR_CMD2 "description .LINE",
2649 NEIGHBOR_STR
2650 NEIGHBOR_ADDR_STR2
2651 "Neighbor specific description\n"
2652 "Up to 80 characters describing this neighbor\n")
2653{
2654 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00002655 char *str;
paul718e3742002-12-13 20:15:29 +00002656
2657 peer = peer_and_group_lookup_vty (vty, argv[0]);
2658 if (! peer)
2659 return CMD_WARNING;
2660
2661 if (argc == 1)
2662 return CMD_SUCCESS;
2663
ajs3b8b1852005-01-29 18:19:13 +00002664 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00002665
2666 peer_description_set (peer, str);
2667
ajs3b8b1852005-01-29 18:19:13 +00002668 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00002669
2670 return CMD_SUCCESS;
2671}
2672
2673DEFUN (no_neighbor_description,
2674 no_neighbor_description_cmd,
2675 NO_NEIGHBOR_CMD2 "description",
2676 NO_STR
2677 NEIGHBOR_STR
2678 NEIGHBOR_ADDR_STR2
2679 "Neighbor specific description\n")
2680{
2681 struct peer *peer;
2682
2683 peer = peer_and_group_lookup_vty (vty, argv[0]);
2684 if (! peer)
2685 return CMD_WARNING;
2686
2687 peer_description_unset (peer);
2688
2689 return CMD_SUCCESS;
2690}
2691
2692ALIAS (no_neighbor_description,
2693 no_neighbor_description_val_cmd,
2694 NO_NEIGHBOR_CMD2 "description .LINE",
2695 NO_STR
2696 NEIGHBOR_STR
2697 NEIGHBOR_ADDR_STR2
2698 "Neighbor specific description\n"
2699 "Up to 80 characters describing this neighbor\n")
2700
2701/* Neighbor update-source. */
2702int
paulfd79ac92004-10-13 05:06:08 +00002703peer_update_source_vty (struct vty *vty, const char *peer_str,
2704 const char *source_str)
paul718e3742002-12-13 20:15:29 +00002705{
2706 struct peer *peer;
2707 union sockunion *su;
2708
2709 peer = peer_and_group_lookup_vty (vty, peer_str);
2710 if (! peer)
2711 return CMD_WARNING;
2712
2713 if (source_str)
2714 {
2715 su = sockunion_str2su (source_str);
2716 if (su)
2717 {
2718 peer_update_source_addr_set (peer, su);
2719 sockunion_free (su);
2720 }
2721 else
2722 peer_update_source_if_set (peer, source_str);
2723 }
2724 else
2725 peer_update_source_unset (peer);
2726
2727 return CMD_SUCCESS;
2728}
2729
2730DEFUN (neighbor_update_source,
2731 neighbor_update_source_cmd,
2732 NEIGHBOR_CMD2 "update-source WORD",
2733 NEIGHBOR_STR
2734 NEIGHBOR_ADDR_STR2
2735 "Source of routing updates\n"
2736 "Interface name\n")
2737{
2738 return peer_update_source_vty (vty, argv[0], argv[1]);
2739}
2740
2741DEFUN (no_neighbor_update_source,
2742 no_neighbor_update_source_cmd,
2743 NO_NEIGHBOR_CMD2 "update-source",
2744 NO_STR
2745 NEIGHBOR_STR
2746 NEIGHBOR_ADDR_STR2
2747 "Source of routing updates\n"
2748 "Interface name\n")
2749{
2750 return peer_update_source_vty (vty, argv[0], NULL);
2751}
2752
2753int
paulfd79ac92004-10-13 05:06:08 +00002754peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
2755 afi_t afi, safi_t safi,
2756 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00002757{
2758 int ret;
2759 struct peer *peer;
2760
2761 peer = peer_and_group_lookup_vty (vty, peer_str);
2762 if (! peer)
2763 return CMD_WARNING;
2764
2765 if (set)
2766 ret = peer_default_originate_set (peer, afi, safi, rmap);
2767 else
2768 ret = peer_default_originate_unset (peer, afi, safi);
2769
2770 return bgp_vty_return (vty, ret);
2771}
2772
2773/* neighbor default-originate. */
2774DEFUN (neighbor_default_originate,
2775 neighbor_default_originate_cmd,
2776 NEIGHBOR_CMD2 "default-originate",
2777 NEIGHBOR_STR
2778 NEIGHBOR_ADDR_STR2
2779 "Originate default route to this neighbor\n")
2780{
2781 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2782 bgp_node_safi (vty), NULL, 1);
2783}
2784
2785DEFUN (neighbor_default_originate_rmap,
2786 neighbor_default_originate_rmap_cmd,
2787 NEIGHBOR_CMD2 "default-originate route-map WORD",
2788 NEIGHBOR_STR
2789 NEIGHBOR_ADDR_STR2
2790 "Originate default route to this neighbor\n"
2791 "Route-map to specify criteria to originate default\n"
2792 "route-map name\n")
2793{
2794 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2795 bgp_node_safi (vty), argv[1], 1);
2796}
2797
2798DEFUN (no_neighbor_default_originate,
2799 no_neighbor_default_originate_cmd,
2800 NO_NEIGHBOR_CMD2 "default-originate",
2801 NO_STR
2802 NEIGHBOR_STR
2803 NEIGHBOR_ADDR_STR2
2804 "Originate default route to this neighbor\n")
2805{
2806 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2807 bgp_node_safi (vty), NULL, 0);
2808}
2809
2810ALIAS (no_neighbor_default_originate,
2811 no_neighbor_default_originate_rmap_cmd,
2812 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
2813 NO_STR
2814 NEIGHBOR_STR
2815 NEIGHBOR_ADDR_STR2
2816 "Originate default route to this neighbor\n"
2817 "Route-map to specify criteria to originate default\n"
2818 "route-map name\n")
2819
2820/* Set neighbor's BGP port. */
2821int
paulfd79ac92004-10-13 05:06:08 +00002822peer_port_vty (struct vty *vty, const char *ip_str, int afi,
2823 const char *port_str)
paul718e3742002-12-13 20:15:29 +00002824{
2825 struct peer *peer;
2826 u_int16_t port;
2827 struct servent *sp;
2828
2829 peer = peer_lookup_vty (vty, ip_str);
2830 if (! peer)
2831 return CMD_WARNING;
2832
2833 if (! port_str)
2834 {
2835 sp = getservbyname ("bgp", "tcp");
2836 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
2837 }
2838 else
2839 {
2840 VTY_GET_INTEGER("port", port, port_str);
2841 }
2842
2843 peer_port_set (peer, port);
2844
2845 return CMD_SUCCESS;
2846}
2847
hassof4184462005-02-01 20:13:16 +00002848/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00002849DEFUN (neighbor_port,
2850 neighbor_port_cmd,
2851 NEIGHBOR_CMD "port <0-65535>",
2852 NEIGHBOR_STR
2853 NEIGHBOR_ADDR_STR
2854 "Neighbor's BGP port\n"
2855 "TCP port number\n")
2856{
2857 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
2858}
2859
2860DEFUN (no_neighbor_port,
2861 no_neighbor_port_cmd,
2862 NO_NEIGHBOR_CMD "port",
2863 NO_STR
2864 NEIGHBOR_STR
2865 NEIGHBOR_ADDR_STR
2866 "Neighbor's BGP port\n")
2867{
2868 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
2869}
2870
2871ALIAS (no_neighbor_port,
2872 no_neighbor_port_val_cmd,
2873 NO_NEIGHBOR_CMD "port <0-65535>",
2874 NO_STR
2875 NEIGHBOR_STR
2876 NEIGHBOR_ADDR_STR
2877 "Neighbor's BGP port\n"
2878 "TCP port number\n")
2879
2880/* neighbor weight. */
2881int
paulfd79ac92004-10-13 05:06:08 +00002882peer_weight_set_vty (struct vty *vty, const char *ip_str,
2883 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00002884{
2885 int ret;
2886 struct peer *peer;
2887 unsigned long weight;
2888
2889 peer = peer_and_group_lookup_vty (vty, ip_str);
2890 if (! peer)
2891 return CMD_WARNING;
2892
2893 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
2894
2895 ret = peer_weight_set (peer, weight);
2896
2897 return CMD_SUCCESS;
2898}
2899
2900int
paulfd79ac92004-10-13 05:06:08 +00002901peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002902{
2903 struct peer *peer;
2904
2905 peer = peer_and_group_lookup_vty (vty, ip_str);
2906 if (! peer)
2907 return CMD_WARNING;
2908
2909 peer_weight_unset (peer);
2910
2911 return CMD_SUCCESS;
2912}
2913
2914DEFUN (neighbor_weight,
2915 neighbor_weight_cmd,
2916 NEIGHBOR_CMD2 "weight <0-65535>",
2917 NEIGHBOR_STR
2918 NEIGHBOR_ADDR_STR2
2919 "Set default weight for routes from this neighbor\n"
2920 "default weight\n")
2921{
2922 return peer_weight_set_vty (vty, argv[0], argv[1]);
2923}
2924
2925DEFUN (no_neighbor_weight,
2926 no_neighbor_weight_cmd,
2927 NO_NEIGHBOR_CMD2 "weight",
2928 NO_STR
2929 NEIGHBOR_STR
2930 NEIGHBOR_ADDR_STR2
2931 "Set default weight for routes from this neighbor\n")
2932{
2933 return peer_weight_unset_vty (vty, argv[0]);
2934}
2935
2936ALIAS (no_neighbor_weight,
2937 no_neighbor_weight_val_cmd,
2938 NO_NEIGHBOR_CMD2 "weight <0-65535>",
2939 NO_STR
2940 NEIGHBOR_STR
2941 NEIGHBOR_ADDR_STR2
2942 "Set default weight for routes from this neighbor\n"
2943 "default weight\n")
2944
2945/* Override capability negotiation. */
2946DEFUN (neighbor_override_capability,
2947 neighbor_override_capability_cmd,
2948 NEIGHBOR_CMD2 "override-capability",
2949 NEIGHBOR_STR
2950 NEIGHBOR_ADDR_STR2
2951 "Override capability negotiation result\n")
2952{
2953 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
2954}
2955
2956DEFUN (no_neighbor_override_capability,
2957 no_neighbor_override_capability_cmd,
2958 NO_NEIGHBOR_CMD2 "override-capability",
2959 NO_STR
2960 NEIGHBOR_STR
2961 NEIGHBOR_ADDR_STR2
2962 "Override capability negotiation result\n")
2963{
2964 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
2965}
2966
2967DEFUN (neighbor_strict_capability,
2968 neighbor_strict_capability_cmd,
2969 NEIGHBOR_CMD "strict-capability-match",
2970 NEIGHBOR_STR
2971 NEIGHBOR_ADDR_STR
2972 "Strict capability negotiation match\n")
2973{
2974 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
2975}
2976
2977DEFUN (no_neighbor_strict_capability,
2978 no_neighbor_strict_capability_cmd,
2979 NO_NEIGHBOR_CMD "strict-capability-match",
2980 NO_STR
2981 NEIGHBOR_STR
2982 NEIGHBOR_ADDR_STR
2983 "Strict capability negotiation match\n")
2984{
2985 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
2986}
2987
2988int
paulfd79ac92004-10-13 05:06:08 +00002989peer_timers_set_vty (struct vty *vty, const char *ip_str,
2990 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00002991{
2992 int ret;
2993 struct peer *peer;
2994 u_int32_t keepalive;
2995 u_int32_t holdtime;
2996
2997 peer = peer_and_group_lookup_vty (vty, ip_str);
2998 if (! peer)
2999 return CMD_WARNING;
3000
3001 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3002 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3003
3004 ret = peer_timers_set (peer, keepalive, holdtime);
3005
3006 return bgp_vty_return (vty, ret);
3007}
3008
3009int
paulfd79ac92004-10-13 05:06:08 +00003010peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003011{
3012 int ret;
3013 struct peer *peer;
3014
3015 peer = peer_lookup_vty (vty, ip_str);
3016 if (! peer)
3017 return CMD_WARNING;
3018
3019 ret = peer_timers_unset (peer);
3020
3021 return bgp_vty_return (vty, ret);
3022}
3023
3024DEFUN (neighbor_timers,
3025 neighbor_timers_cmd,
3026 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3027 NEIGHBOR_STR
3028 NEIGHBOR_ADDR_STR2
3029 "BGP per neighbor timers\n"
3030 "Keepalive interval\n"
3031 "Holdtime\n")
3032{
3033 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3034}
3035
3036DEFUN (no_neighbor_timers,
3037 no_neighbor_timers_cmd,
3038 NO_NEIGHBOR_CMD2 "timers",
3039 NO_STR
3040 NEIGHBOR_STR
3041 NEIGHBOR_ADDR_STR2
3042 "BGP per neighbor timers\n")
3043{
3044 return peer_timers_unset_vty (vty, argv[0]);
3045}
3046
3047int
paulfd79ac92004-10-13 05:06:08 +00003048peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3049 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003050{
3051 int ret;
3052 struct peer *peer;
3053 u_int32_t connect;
3054
3055 peer = peer_lookup_vty (vty, ip_str);
3056 if (! peer)
3057 return CMD_WARNING;
3058
3059 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3060
3061 ret = peer_timers_connect_set (peer, connect);
3062
3063 return CMD_SUCCESS;
3064}
3065
3066int
paulfd79ac92004-10-13 05:06:08 +00003067peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003068{
3069 int ret;
3070 struct peer *peer;
3071
3072 peer = peer_and_group_lookup_vty (vty, ip_str);
3073 if (! peer)
3074 return CMD_WARNING;
3075
3076 ret = peer_timers_connect_unset (peer);
3077
3078 return CMD_SUCCESS;
3079}
3080
3081DEFUN (neighbor_timers_connect,
3082 neighbor_timers_connect_cmd,
3083 NEIGHBOR_CMD "timers connect <0-65535>",
3084 NEIGHBOR_STR
3085 NEIGHBOR_ADDR_STR
3086 "BGP per neighbor timers\n"
3087 "BGP connect timer\n"
3088 "Connect timer\n")
3089{
3090 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3091}
3092
3093DEFUN (no_neighbor_timers_connect,
3094 no_neighbor_timers_connect_cmd,
3095 NO_NEIGHBOR_CMD "timers connect",
3096 NO_STR
3097 NEIGHBOR_STR
3098 NEIGHBOR_ADDR_STR
3099 "BGP per neighbor timers\n"
3100 "BGP connect timer\n")
3101{
3102 return peer_timers_connect_unset_vty (vty, argv[0]);
3103}
3104
3105ALIAS (no_neighbor_timers_connect,
3106 no_neighbor_timers_connect_val_cmd,
3107 NO_NEIGHBOR_CMD "timers connect <0-65535>",
3108 NO_STR
3109 NEIGHBOR_STR
3110 NEIGHBOR_ADDR_STR
3111 "BGP per neighbor timers\n"
3112 "BGP connect timer\n"
3113 "Connect timer\n")
3114
3115int
paulfd79ac92004-10-13 05:06:08 +00003116peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3117 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003118{
3119 int ret;
3120 struct peer *peer;
3121 u_int32_t routeadv = 0;
3122
3123 peer = peer_lookup_vty (vty, ip_str);
3124 if (! peer)
3125 return CMD_WARNING;
3126
3127 if (time_str)
3128 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3129
3130 if (set)
3131 ret = peer_advertise_interval_set (peer, routeadv);
3132 else
3133 ret = peer_advertise_interval_unset (peer);
3134
3135 return CMD_SUCCESS;
3136}
3137
3138DEFUN (neighbor_advertise_interval,
3139 neighbor_advertise_interval_cmd,
3140 NEIGHBOR_CMD "advertisement-interval <0-600>",
3141 NEIGHBOR_STR
3142 NEIGHBOR_ADDR_STR
3143 "Minimum interval between sending BGP routing updates\n"
3144 "time in seconds\n")
3145{
3146 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3147}
3148
3149DEFUN (no_neighbor_advertise_interval,
3150 no_neighbor_advertise_interval_cmd,
3151 NO_NEIGHBOR_CMD "advertisement-interval",
3152 NO_STR
3153 NEIGHBOR_STR
3154 NEIGHBOR_ADDR_STR
3155 "Minimum interval between sending BGP routing updates\n")
3156{
3157 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3158}
3159
3160ALIAS (no_neighbor_advertise_interval,
3161 no_neighbor_advertise_interval_val_cmd,
3162 NO_NEIGHBOR_CMD "advertisement-interval <0-600>",
3163 NO_STR
3164 NEIGHBOR_STR
3165 NEIGHBOR_ADDR_STR
3166 "Minimum interval between sending BGP routing updates\n"
3167 "time in seconds\n")
3168
paul718e3742002-12-13 20:15:29 +00003169/* neighbor interface */
3170int
paulfd79ac92004-10-13 05:06:08 +00003171peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003172{
3173 int ret;
3174 struct peer *peer;
3175
3176 peer = peer_lookup_vty (vty, ip_str);
3177 if (! peer)
3178 return CMD_WARNING;
3179
3180 if (str)
3181 ret = peer_interface_set (peer, str);
3182 else
3183 ret = peer_interface_unset (peer);
3184
3185 return CMD_SUCCESS;
3186}
3187
3188DEFUN (neighbor_interface,
3189 neighbor_interface_cmd,
3190 NEIGHBOR_CMD "interface WORD",
3191 NEIGHBOR_STR
3192 NEIGHBOR_ADDR_STR
3193 "Interface\n"
3194 "Interface name\n")
3195{
3196 return peer_interface_vty (vty, argv[0], argv[1]);
3197}
3198
3199DEFUN (no_neighbor_interface,
3200 no_neighbor_interface_cmd,
3201 NO_NEIGHBOR_CMD "interface WORD",
3202 NO_STR
3203 NEIGHBOR_STR
3204 NEIGHBOR_ADDR_STR
3205 "Interface\n"
3206 "Interface name\n")
3207{
3208 return peer_interface_vty (vty, argv[0], NULL);
3209}
3210
3211/* Set distribute list to the peer. */
3212int
paulfd79ac92004-10-13 05:06:08 +00003213peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3214 afi_t afi, safi_t safi,
3215 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003216{
3217 int ret;
3218 struct peer *peer;
3219 int direct = FILTER_IN;
3220
3221 peer = peer_and_group_lookup_vty (vty, ip_str);
3222 if (! peer)
3223 return CMD_WARNING;
3224
3225 /* Check filter direction. */
3226 if (strncmp (direct_str, "i", 1) == 0)
3227 direct = FILTER_IN;
3228 else if (strncmp (direct_str, "o", 1) == 0)
3229 direct = FILTER_OUT;
3230
3231 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3232
3233 return bgp_vty_return (vty, ret);
3234}
3235
3236int
paulfd79ac92004-10-13 05:06:08 +00003237peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3238 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003239{
3240 int ret;
3241 struct peer *peer;
3242 int direct = FILTER_IN;
3243
3244 peer = peer_and_group_lookup_vty (vty, ip_str);
3245 if (! peer)
3246 return CMD_WARNING;
3247
3248 /* Check filter direction. */
3249 if (strncmp (direct_str, "i", 1) == 0)
3250 direct = FILTER_IN;
3251 else if (strncmp (direct_str, "o", 1) == 0)
3252 direct = FILTER_OUT;
3253
3254 ret = peer_distribute_unset (peer, afi, safi, direct);
3255
3256 return bgp_vty_return (vty, ret);
3257}
3258
3259DEFUN (neighbor_distribute_list,
3260 neighbor_distribute_list_cmd,
3261 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3262 NEIGHBOR_STR
3263 NEIGHBOR_ADDR_STR2
3264 "Filter updates to/from this neighbor\n"
3265 "IP access-list number\n"
3266 "IP access-list number (expanded range)\n"
3267 "IP Access-list name\n"
3268 "Filter incoming updates\n"
3269 "Filter outgoing updates\n")
3270{
3271 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3272 bgp_node_safi (vty), argv[1], argv[2]);
3273}
3274
3275DEFUN (no_neighbor_distribute_list,
3276 no_neighbor_distribute_list_cmd,
3277 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3278 NO_STR
3279 NEIGHBOR_STR
3280 NEIGHBOR_ADDR_STR2
3281 "Filter updates to/from this neighbor\n"
3282 "IP access-list number\n"
3283 "IP access-list number (expanded range)\n"
3284 "IP Access-list name\n"
3285 "Filter incoming updates\n"
3286 "Filter outgoing updates\n")
3287{
3288 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3289 bgp_node_safi (vty), argv[2]);
3290}
3291
3292/* Set prefix list to the peer. */
3293int
paulfd79ac92004-10-13 05:06:08 +00003294peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3295 safi_t safi, const char *name_str,
3296 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003297{
3298 int ret;
3299 struct peer *peer;
3300 int direct = FILTER_IN;
3301
3302 peer = peer_and_group_lookup_vty (vty, ip_str);
3303 if (! peer)
3304 return CMD_WARNING;
3305
3306 /* Check filter direction. */
3307 if (strncmp (direct_str, "i", 1) == 0)
3308 direct = FILTER_IN;
3309 else if (strncmp (direct_str, "o", 1) == 0)
3310 direct = FILTER_OUT;
3311
3312 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3313
3314 return bgp_vty_return (vty, ret);
3315}
3316
3317int
paulfd79ac92004-10-13 05:06:08 +00003318peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3319 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003320{
3321 int ret;
3322 struct peer *peer;
3323 int direct = FILTER_IN;
3324
3325 peer = peer_and_group_lookup_vty (vty, ip_str);
3326 if (! peer)
3327 return CMD_WARNING;
3328
3329 /* Check filter direction. */
3330 if (strncmp (direct_str, "i", 1) == 0)
3331 direct = FILTER_IN;
3332 else if (strncmp (direct_str, "o", 1) == 0)
3333 direct = FILTER_OUT;
3334
3335 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3336
3337 return bgp_vty_return (vty, ret);
3338}
3339
3340DEFUN (neighbor_prefix_list,
3341 neighbor_prefix_list_cmd,
3342 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3343 NEIGHBOR_STR
3344 NEIGHBOR_ADDR_STR2
3345 "Filter updates to/from this neighbor\n"
3346 "Name of a prefix list\n"
3347 "Filter incoming updates\n"
3348 "Filter outgoing updates\n")
3349{
3350 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3351 bgp_node_safi (vty), argv[1], argv[2]);
3352}
3353
3354DEFUN (no_neighbor_prefix_list,
3355 no_neighbor_prefix_list_cmd,
3356 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3357 NO_STR
3358 NEIGHBOR_STR
3359 NEIGHBOR_ADDR_STR2
3360 "Filter updates to/from this neighbor\n"
3361 "Name of a prefix list\n"
3362 "Filter incoming updates\n"
3363 "Filter outgoing updates\n")
3364{
3365 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3366 bgp_node_safi (vty), argv[2]);
3367}
3368
3369int
paulfd79ac92004-10-13 05:06:08 +00003370peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3371 afi_t afi, safi_t safi,
3372 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003373{
3374 int ret;
3375 struct peer *peer;
3376 int direct = FILTER_IN;
3377
3378 peer = peer_and_group_lookup_vty (vty, ip_str);
3379 if (! peer)
3380 return CMD_WARNING;
3381
3382 /* Check filter direction. */
3383 if (strncmp (direct_str, "i", 1) == 0)
3384 direct = FILTER_IN;
3385 else if (strncmp (direct_str, "o", 1) == 0)
3386 direct = FILTER_OUT;
3387
3388 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3389
3390 return bgp_vty_return (vty, ret);
3391}
3392
3393int
paulfd79ac92004-10-13 05:06:08 +00003394peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3395 afi_t afi, safi_t safi,
3396 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003397{
3398 int ret;
3399 struct peer *peer;
3400 int direct = FILTER_IN;
3401
3402 peer = peer_and_group_lookup_vty (vty, ip_str);
3403 if (! peer)
3404 return CMD_WARNING;
3405
3406 /* Check filter direction. */
3407 if (strncmp (direct_str, "i", 1) == 0)
3408 direct = FILTER_IN;
3409 else if (strncmp (direct_str, "o", 1) == 0)
3410 direct = FILTER_OUT;
3411
3412 ret = peer_aslist_unset (peer, afi, safi, direct);
3413
3414 return bgp_vty_return (vty, ret);
3415}
3416
3417DEFUN (neighbor_filter_list,
3418 neighbor_filter_list_cmd,
3419 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3420 NEIGHBOR_STR
3421 NEIGHBOR_ADDR_STR2
3422 "Establish BGP filters\n"
3423 "AS path access-list name\n"
3424 "Filter incoming routes\n"
3425 "Filter outgoing routes\n")
3426{
3427 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3428 bgp_node_safi (vty), argv[1], argv[2]);
3429}
3430
3431DEFUN (no_neighbor_filter_list,
3432 no_neighbor_filter_list_cmd,
3433 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3434 NO_STR
3435 NEIGHBOR_STR
3436 NEIGHBOR_ADDR_STR2
3437 "Establish BGP filters\n"
3438 "AS path access-list name\n"
3439 "Filter incoming routes\n"
3440 "Filter outgoing routes\n")
3441{
3442 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3443 bgp_node_safi (vty), argv[2]);
3444}
3445
3446/* Set route-map to the peer. */
3447int
paulfd79ac92004-10-13 05:06:08 +00003448peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3449 afi_t afi, safi_t safi,
3450 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003451{
3452 int ret;
3453 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003454 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003455
3456 peer = peer_and_group_lookup_vty (vty, ip_str);
3457 if (! peer)
3458 return CMD_WARNING;
3459
3460 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003461 if (strncmp (direct_str, "in", 2) == 0)
3462 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003463 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003464 direct = RMAP_OUT;
3465 else if (strncmp (direct_str, "im", 2) == 0)
3466 direct = RMAP_IMPORT;
3467 else if (strncmp (direct_str, "e", 1) == 0)
3468 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003469
3470 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3471
3472 return bgp_vty_return (vty, ret);
3473}
3474
3475int
paulfd79ac92004-10-13 05:06:08 +00003476peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3477 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003478{
3479 int ret;
3480 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003481 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003482
3483 peer = peer_and_group_lookup_vty (vty, ip_str);
3484 if (! peer)
3485 return CMD_WARNING;
3486
3487 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003488 if (strncmp (direct_str, "in", 2) == 0)
3489 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003490 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003491 direct = RMAP_OUT;
3492 else if (strncmp (direct_str, "im", 2) == 0)
3493 direct = RMAP_IMPORT;
3494 else if (strncmp (direct_str, "e", 1) == 0)
3495 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003496
3497 ret = peer_route_map_unset (peer, afi, safi, direct);
3498
3499 return bgp_vty_return (vty, ret);
3500}
3501
3502DEFUN (neighbor_route_map,
3503 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003504 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003505 NEIGHBOR_STR
3506 NEIGHBOR_ADDR_STR2
3507 "Apply route map to neighbor\n"
3508 "Name of route map\n"
3509 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003510 "Apply map to outbound routes\n"
3511 "Apply map to routes going into a Route-Server client's table\n"
3512 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003513{
3514 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3515 bgp_node_safi (vty), argv[1], argv[2]);
3516}
3517
3518DEFUN (no_neighbor_route_map,
3519 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003520 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003521 NO_STR
3522 NEIGHBOR_STR
3523 NEIGHBOR_ADDR_STR2
3524 "Apply route map to neighbor\n"
3525 "Name of route map\n"
3526 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003527 "Apply map to outbound routes\n"
3528 "Apply map to routes going into a Route-Server client's table\n"
3529 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003530{
3531 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3532 bgp_node_safi (vty), argv[2]);
3533}
3534
3535/* Set unsuppress-map to the peer. */
3536int
paulfd79ac92004-10-13 05:06:08 +00003537peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3538 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003539{
3540 int ret;
3541 struct peer *peer;
3542
3543 peer = peer_and_group_lookup_vty (vty, ip_str);
3544 if (! peer)
3545 return CMD_WARNING;
3546
3547 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3548
3549 return bgp_vty_return (vty, ret);
3550}
3551
3552/* Unset route-map from the peer. */
3553int
paulfd79ac92004-10-13 05:06:08 +00003554peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003555 safi_t safi)
3556{
3557 int ret;
3558 struct peer *peer;
3559
3560 peer = peer_and_group_lookup_vty (vty, ip_str);
3561 if (! peer)
3562 return CMD_WARNING;
3563
3564 ret = peer_unsuppress_map_unset (peer, afi, safi);
3565
3566 return bgp_vty_return (vty, ret);
3567}
3568
3569DEFUN (neighbor_unsuppress_map,
3570 neighbor_unsuppress_map_cmd,
3571 NEIGHBOR_CMD2 "unsuppress-map WORD",
3572 NEIGHBOR_STR
3573 NEIGHBOR_ADDR_STR2
3574 "Route-map to selectively unsuppress suppressed routes\n"
3575 "Name of route map\n")
3576{
3577 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3578 bgp_node_safi (vty), argv[1]);
3579}
3580
3581DEFUN (no_neighbor_unsuppress_map,
3582 no_neighbor_unsuppress_map_cmd,
3583 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3584 NO_STR
3585 NEIGHBOR_STR
3586 NEIGHBOR_ADDR_STR2
3587 "Route-map to selectively unsuppress suppressed routes\n"
3588 "Name of route map\n")
3589{
3590 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3591 bgp_node_safi (vty));
3592}
3593
3594int
paulfd79ac92004-10-13 05:06:08 +00003595peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3596 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003597 const char *threshold_str, int warning,
3598 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003599{
3600 int ret;
3601 struct peer *peer;
3602 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003603 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003604 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003605
3606 peer = peer_and_group_lookup_vty (vty, ip_str);
3607 if (! peer)
3608 return CMD_WARNING;
3609
3610 VTY_GET_INTEGER ("maxmum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003611 if (threshold_str)
3612 threshold = atoi (threshold_str);
3613 else
3614 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00003615
hasso0a486e52005-02-01 20:57:17 +00003616 if (restart_str)
3617 restart = atoi (restart_str);
3618 else
3619 restart = 0;
3620
3621 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00003622
3623 return bgp_vty_return (vty, ret);
3624}
3625
3626int
paulfd79ac92004-10-13 05:06:08 +00003627peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003628 safi_t safi)
3629{
3630 int ret;
3631 struct peer *peer;
3632
3633 peer = peer_and_group_lookup_vty (vty, ip_str);
3634 if (! peer)
3635 return CMD_WARNING;
3636
3637 ret = peer_maximum_prefix_unset (peer, afi, safi);
3638
3639 return bgp_vty_return (vty, ret);
3640}
3641
3642/* Maximum number of prefix configuration. prefix count is different
3643 for each peer configuration. So this configuration can be set for
3644 each peer configuration. */
3645DEFUN (neighbor_maximum_prefix,
3646 neighbor_maximum_prefix_cmd,
3647 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3648 NEIGHBOR_STR
3649 NEIGHBOR_ADDR_STR2
3650 "Maximum number of prefix accept from this peer\n"
3651 "maximum no. of prefix limit\n")
3652{
3653 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003654 bgp_node_safi (vty), argv[1], NULL, 0,
3655 NULL);
paul718e3742002-12-13 20:15:29 +00003656}
3657
hassoe0701b72004-05-20 09:19:34 +00003658DEFUN (neighbor_maximum_prefix_threshold,
3659 neighbor_maximum_prefix_threshold_cmd,
3660 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
3661 NEIGHBOR_STR
3662 NEIGHBOR_ADDR_STR2
3663 "Maximum number of prefix accept from this peer\n"
3664 "maximum no. of prefix limit\n"
3665 "Threshold value (%) at which to generate a warning msg\n")
3666{
3667 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003668 bgp_node_safi (vty), argv[1], argv[2], 0,
3669 NULL);
3670}
hassoe0701b72004-05-20 09:19:34 +00003671
paul718e3742002-12-13 20:15:29 +00003672DEFUN (neighbor_maximum_prefix_warning,
3673 neighbor_maximum_prefix_warning_cmd,
3674 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3675 NEIGHBOR_STR
3676 NEIGHBOR_ADDR_STR2
3677 "Maximum number of prefix accept from this peer\n"
3678 "maximum no. of prefix limit\n"
3679 "Only give warning message when limit is exceeded\n")
3680{
3681 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003682 bgp_node_safi (vty), argv[1], NULL, 1,
3683 NULL);
paul718e3742002-12-13 20:15:29 +00003684}
3685
hassoe0701b72004-05-20 09:19:34 +00003686DEFUN (neighbor_maximum_prefix_threshold_warning,
3687 neighbor_maximum_prefix_threshold_warning_cmd,
3688 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
3689 NEIGHBOR_STR
3690 NEIGHBOR_ADDR_STR2
3691 "Maximum number of prefix accept from this peer\n"
3692 "maximum no. of prefix limit\n"
3693 "Threshold value (%) at which to generate a warning msg\n"
3694 "Only give warning message when limit is exceeded\n")
3695{
3696 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003697 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
3698}
3699
3700DEFUN (neighbor_maximum_prefix_restart,
3701 neighbor_maximum_prefix_restart_cmd,
3702 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
3703 NEIGHBOR_STR
3704 NEIGHBOR_ADDR_STR2
3705 "Maximum number of prefix accept from this peer\n"
3706 "maximum no. of prefix limit\n"
3707 "Restart bgp connection after limit is exceeded\n"
3708 "Restart interval in minutes")
3709{
3710 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3711 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
3712}
3713
3714DEFUN (neighbor_maximum_prefix_threshold_restart,
3715 neighbor_maximum_prefix_threshold_restart_cmd,
3716 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
3717 NEIGHBOR_STR
3718 NEIGHBOR_ADDR_STR2
3719 "Maximum number of prefix accept from this peer\n"
3720 "maximum no. of prefix limit\n"
3721 "Threshold value (%) at which to generate a warning msg\n"
3722 "Restart bgp connection after limit is exceeded\n"
3723 "Restart interval in minutes")
3724{
3725 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3726 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
3727}
hassoe0701b72004-05-20 09:19:34 +00003728
paul718e3742002-12-13 20:15:29 +00003729DEFUN (no_neighbor_maximum_prefix,
3730 no_neighbor_maximum_prefix_cmd,
3731 NO_NEIGHBOR_CMD2 "maximum-prefix",
3732 NO_STR
3733 NEIGHBOR_STR
3734 NEIGHBOR_ADDR_STR2
3735 "Maximum number of prefix accept from this peer\n")
3736{
3737 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
3738 bgp_node_safi (vty));
3739}
3740
3741ALIAS (no_neighbor_maximum_prefix,
3742 no_neighbor_maximum_prefix_val_cmd,
3743 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3744 NO_STR
3745 NEIGHBOR_STR
3746 NEIGHBOR_ADDR_STR2
3747 "Maximum number of prefix accept from this peer\n"
3748 "maximum no. of prefix limit\n")
3749
3750ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00003751 no_neighbor_maximum_prefix_threshold_cmd,
3752 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3753 NO_STR
3754 NEIGHBOR_STR
3755 NEIGHBOR_ADDR_STR2
3756 "Maximum number of prefix accept from this peer\n"
3757 "maximum no. of prefix limit\n"
3758 "Threshold value (%) at which to generate a warning msg\n")
3759
3760ALIAS (no_neighbor_maximum_prefix,
3761 no_neighbor_maximum_prefix_warning_cmd,
3762 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3763 NO_STR
3764 NEIGHBOR_STR
3765 NEIGHBOR_ADDR_STR2
3766 "Maximum number of prefix accept from this peer\n"
3767 "maximum no. of prefix limit\n"
3768 "Only give warning message when limit is exceeded\n");
3769
3770ALIAS (no_neighbor_maximum_prefix,
3771 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00003772 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
3773 NO_STR
3774 NEIGHBOR_STR
3775 NEIGHBOR_ADDR_STR2
3776 "Maximum number of prefix accept from this peer\n"
3777 "maximum no. of prefix limit\n"
3778 "Threshold value (%) at which to generate a warning msg\n"
hasso0a486e52005-02-01 20:57:17 +00003779 "Only give warning message when limit is exceeded\n");
hassoe0701b72004-05-20 09:19:34 +00003780
3781ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00003782 no_neighbor_maximum_prefix_restart_cmd,
3783 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00003784 NO_STR
3785 NEIGHBOR_STR
3786 NEIGHBOR_ADDR_STR2
3787 "Maximum number of prefix accept from this peer\n"
3788 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00003789 "Restart bgp connection after limit is exceeded\n"
3790 "Restart interval in minutes")
3791
3792ALIAS (no_neighbor_maximum_prefix,
3793 no_neighbor_maximum_prefix_threshold_restart_cmd,
3794 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
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 "Threshold value (%) at which to generate a warning msg\n"
3801 "Restart bgp connection after limit is exceeded\n"
3802 "Restart interval in minutes")
paul718e3742002-12-13 20:15:29 +00003803
3804/* "neighbor allowas-in" */
3805DEFUN (neighbor_allowas_in,
3806 neighbor_allowas_in_cmd,
3807 NEIGHBOR_CMD2 "allowas-in",
3808 NEIGHBOR_STR
3809 NEIGHBOR_ADDR_STR2
3810 "Accept as-path with my AS present in it\n")
3811{
3812 int ret;
3813 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00003814 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00003815
3816 peer = peer_and_group_lookup_vty (vty, argv[0]);
3817 if (! peer)
3818 return CMD_WARNING;
3819
3820 if (argc == 1)
3821 allow_num = 3;
3822 else
3823 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
3824
3825 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
3826 allow_num);
3827
3828 return bgp_vty_return (vty, ret);
3829}
3830
3831ALIAS (neighbor_allowas_in,
3832 neighbor_allowas_in_arg_cmd,
3833 NEIGHBOR_CMD2 "allowas-in <1-10>",
3834 NEIGHBOR_STR
3835 NEIGHBOR_ADDR_STR2
3836 "Accept as-path with my AS present in it\n"
3837 "Number of occurances of AS number\n")
3838
3839DEFUN (no_neighbor_allowas_in,
3840 no_neighbor_allowas_in_cmd,
3841 NO_NEIGHBOR_CMD2 "allowas-in",
3842 NO_STR
3843 NEIGHBOR_STR
3844 NEIGHBOR_ADDR_STR2
3845 "allow local ASN appears in aspath attribute\n")
3846{
3847 int ret;
3848 struct peer *peer;
3849
3850 peer = peer_and_group_lookup_vty (vty, argv[0]);
3851 if (! peer)
3852 return CMD_WARNING;
3853
3854 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
3855
3856 return bgp_vty_return (vty, ret);
3857}
3858
3859/* Address family configuration. */
3860DEFUN (address_family_ipv4,
3861 address_family_ipv4_cmd,
3862 "address-family ipv4",
3863 "Enter Address Family command mode\n"
3864 "Address family\n")
3865{
3866 vty->node = BGP_IPV4_NODE;
3867 return CMD_SUCCESS;
3868}
3869
3870DEFUN (address_family_ipv4_safi,
3871 address_family_ipv4_safi_cmd,
3872 "address-family ipv4 (unicast|multicast)",
3873 "Enter Address Family command mode\n"
3874 "Address family\n"
3875 "Address Family modifier\n"
3876 "Address Family modifier\n")
3877{
3878 if (strncmp (argv[0], "m", 1) == 0)
3879 vty->node = BGP_IPV4M_NODE;
3880 else
3881 vty->node = BGP_IPV4_NODE;
3882
3883 return CMD_SUCCESS;
3884}
3885
3886DEFUN (address_family_ipv6_unicast,
3887 address_family_ipv6_unicast_cmd,
3888 "address-family ipv6 unicast",
3889 "Enter Address Family command mode\n"
3890 "Address family\n"
3891 "unicast\n")
3892{
3893 vty->node = BGP_IPV6_NODE;
3894 return CMD_SUCCESS;
3895}
3896
3897ALIAS (address_family_ipv6_unicast,
3898 address_family_ipv6_cmd,
3899 "address-family ipv6",
3900 "Enter Address Family command mode\n"
3901 "Address family\n")
3902
3903DEFUN (address_family_vpnv4,
3904 address_family_vpnv4_cmd,
3905 "address-family vpnv4",
3906 "Enter Address Family command mode\n"
3907 "Address family\n")
3908{
3909 vty->node = BGP_VPNV4_NODE;
3910 return CMD_SUCCESS;
3911}
3912
3913ALIAS (address_family_vpnv4,
3914 address_family_vpnv4_unicast_cmd,
3915 "address-family vpnv4 unicast",
3916 "Enter Address Family command mode\n"
3917 "Address family\n"
3918 "Address Family Modifier\n")
3919
3920DEFUN (exit_address_family,
3921 exit_address_family_cmd,
3922 "exit-address-family",
3923 "Exit from Address Family configuration mode\n")
3924{
3925 if (vty->node == BGP_IPV4M_NODE
3926 || vty->node == BGP_VPNV4_NODE
3927 || vty->node == BGP_IPV6_NODE)
3928 vty->node = BGP_NODE;
3929 return CMD_SUCCESS;
3930}
3931
3932/* BGP clear sort. */
3933enum clear_sort
3934{
3935 clear_all,
3936 clear_peer,
3937 clear_group,
3938 clear_external,
3939 clear_as
3940};
3941
3942void
3943bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
3944 safi_t safi, int error)
3945{
3946 switch (error)
3947 {
3948 case BGP_ERR_AF_UNCONFIGURED:
3949 vty_out (vty,
3950 "%%BGP: Enable %s %s address family for the neighbor %s%s",
3951 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
3952 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
3953 peer->host, VTY_NEWLINE);
3954 break;
3955 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
3956 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);
3957 break;
3958 default:
3959 break;
3960 }
3961}
3962
3963/* `clear ip bgp' functions. */
3964int
3965bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00003966 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00003967{
3968 int ret;
3969 struct peer *peer;
3970 struct listnode *nn;
3971
3972 /* Clear all neighbors. */
3973 if (sort == clear_all)
3974 {
3975 LIST_LOOP (bgp->peer, peer, nn)
3976 {
3977 if (stype == BGP_CLEAR_SOFT_NONE)
3978 ret = peer_clear (peer);
3979 else
3980 ret = peer_clear_soft (peer, afi, safi, stype);
3981
3982 if (ret < 0)
3983 bgp_clear_vty_error (vty, peer, afi, safi, ret);
3984 }
3985 return 0;
3986 }
3987
3988 /* Clear specified neighbors. */
3989 if (sort == clear_peer)
3990 {
3991 union sockunion su;
3992 int ret;
3993
3994 /* Make sockunion for lookup. */
3995 ret = str2sockunion (arg, &su);
3996 if (ret < 0)
3997 {
3998 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
3999 return -1;
4000 }
4001 peer = peer_lookup (bgp, &su);
4002 if (! peer)
4003 {
4004 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
4005 return -1;
4006 }
4007
4008 if (stype == BGP_CLEAR_SOFT_NONE)
4009 ret = peer_clear (peer);
4010 else
4011 ret = peer_clear_soft (peer, afi, safi, stype);
4012
4013 if (ret < 0)
4014 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4015
4016 return 0;
4017 }
4018
4019 /* Clear all peer-group members. */
4020 if (sort == clear_group)
4021 {
4022 struct peer_group *group;
4023
4024 group = peer_group_lookup (bgp, arg);
4025 if (! group)
4026 {
4027 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
4028 return -1;
4029 }
4030
4031 LIST_LOOP (group->peer, peer, nn)
4032 {
4033 if (stype == BGP_CLEAR_SOFT_NONE)
4034 {
4035 ret = peer_clear (peer);
4036 continue;
4037 }
4038
4039 if (! peer->af_group[afi][safi])
4040 continue;
4041
4042 ret = peer_clear_soft (peer, afi, safi, stype);
4043
4044 if (ret < 0)
4045 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4046 }
4047 return 0;
4048 }
4049
4050 if (sort == clear_external)
4051 {
4052 LIST_LOOP (bgp->peer, peer, nn)
4053 {
4054 if (peer_sort (peer) == BGP_PEER_IBGP)
4055 continue;
4056
4057 if (stype == BGP_CLEAR_SOFT_NONE)
4058 ret = peer_clear (peer);
4059 else
4060 ret = peer_clear_soft (peer, afi, safi, stype);
4061
4062 if (ret < 0)
4063 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4064 }
4065 return 0;
4066 }
4067
4068 if (sort == clear_as)
4069 {
4070 as_t as;
4071 unsigned long as_ul;
4072 char *endptr = NULL;
4073 int find = 0;
4074
4075 as_ul = strtoul(arg, &endptr, 10);
4076
4077 if ((as_ul == ULONG_MAX) || (*endptr != '\0') || (as_ul > USHRT_MAX))
4078 {
4079 vty_out (vty, "Invalid AS number%s", VTY_NEWLINE);
4080 return -1;
4081 }
4082 as = (as_t) as_ul;
4083
4084 LIST_LOOP (bgp->peer, peer, nn)
4085 {
4086 if (peer->as != as)
4087 continue;
4088
4089 find = 1;
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 if (! find)
4099 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4100 VTY_NEWLINE);
4101 return 0;
4102 }
4103
4104 return 0;
4105}
4106
4107int
paulfd79ac92004-10-13 05:06:08 +00004108bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4109 enum clear_sort sort, enum bgp_clear_type stype,
4110 const char *arg)
paul718e3742002-12-13 20:15:29 +00004111{
4112 int ret;
4113 struct bgp *bgp;
4114
4115 /* BGP structure lookup. */
4116 if (name)
4117 {
4118 bgp = bgp_lookup_by_name (name);
4119 if (bgp == NULL)
4120 {
4121 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4122 return CMD_WARNING;
4123 }
4124 }
4125 else
4126 {
4127 bgp = bgp_get_default ();
4128 if (bgp == NULL)
4129 {
4130 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4131 return CMD_WARNING;
4132 }
4133 }
4134
4135 ret = bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
4136 if (ret < 0)
4137 return CMD_WARNING;
4138
4139 return CMD_SUCCESS;
4140}
4141
4142DEFUN (clear_ip_bgp_all,
4143 clear_ip_bgp_all_cmd,
4144 "clear ip bgp *",
4145 CLEAR_STR
4146 IP_STR
4147 BGP_STR
4148 "Clear all peers\n")
4149{
4150 if (argc == 1)
4151 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4152
4153 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4154}
4155
4156ALIAS (clear_ip_bgp_all,
4157 clear_bgp_all_cmd,
4158 "clear bgp *",
4159 CLEAR_STR
4160 BGP_STR
4161 "Clear all peers\n")
4162
4163ALIAS (clear_ip_bgp_all,
4164 clear_bgp_ipv6_all_cmd,
4165 "clear bgp ipv6 *",
4166 CLEAR_STR
4167 BGP_STR
4168 "Address family\n"
4169 "Clear all peers\n")
4170
4171ALIAS (clear_ip_bgp_all,
4172 clear_ip_bgp_instance_all_cmd,
4173 "clear ip bgp view WORD *",
4174 CLEAR_STR
4175 IP_STR
4176 BGP_STR
4177 "BGP view\n"
4178 "view name\n"
4179 "Clear all peers\n")
4180
4181ALIAS (clear_ip_bgp_all,
4182 clear_bgp_instance_all_cmd,
4183 "clear bgp view WORD *",
4184 CLEAR_STR
4185 BGP_STR
4186 "BGP view\n"
4187 "view name\n"
4188 "Clear all peers\n")
4189
4190DEFUN (clear_ip_bgp_peer,
4191 clear_ip_bgp_peer_cmd,
4192 "clear ip bgp (A.B.C.D|X:X::X:X)",
4193 CLEAR_STR
4194 IP_STR
4195 BGP_STR
4196 "BGP neighbor IP address to clear\n"
4197 "BGP IPv6 neighbor to clear\n")
4198{
4199 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4200}
4201
4202ALIAS (clear_ip_bgp_peer,
4203 clear_bgp_peer_cmd,
4204 "clear bgp (A.B.C.D|X:X::X:X)",
4205 CLEAR_STR
4206 BGP_STR
4207 "BGP neighbor address to clear\n"
4208 "BGP IPv6 neighbor to clear\n")
4209
4210ALIAS (clear_ip_bgp_peer,
4211 clear_bgp_ipv6_peer_cmd,
4212 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4213 CLEAR_STR
4214 BGP_STR
4215 "Address family\n"
4216 "BGP neighbor address to clear\n"
4217 "BGP IPv6 neighbor to clear\n")
4218
4219DEFUN (clear_ip_bgp_peer_group,
4220 clear_ip_bgp_peer_group_cmd,
4221 "clear ip bgp peer-group WORD",
4222 CLEAR_STR
4223 IP_STR
4224 BGP_STR
4225 "Clear all members of peer-group\n"
4226 "BGP peer-group name\n")
4227{
4228 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4229}
4230
4231ALIAS (clear_ip_bgp_peer_group,
4232 clear_bgp_peer_group_cmd,
4233 "clear bgp peer-group WORD",
4234 CLEAR_STR
4235 BGP_STR
4236 "Clear all members of peer-group\n"
4237 "BGP peer-group name\n")
4238
4239ALIAS (clear_ip_bgp_peer_group,
4240 clear_bgp_ipv6_peer_group_cmd,
4241 "clear bgp ipv6 peer-group WORD",
4242 CLEAR_STR
4243 BGP_STR
4244 "Address family\n"
4245 "Clear all members of peer-group\n"
4246 "BGP peer-group name\n")
4247
4248DEFUN (clear_ip_bgp_external,
4249 clear_ip_bgp_external_cmd,
4250 "clear ip bgp external",
4251 CLEAR_STR
4252 IP_STR
4253 BGP_STR
4254 "Clear all external peers\n")
4255{
4256 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4257}
4258
4259ALIAS (clear_ip_bgp_external,
4260 clear_bgp_external_cmd,
4261 "clear bgp external",
4262 CLEAR_STR
4263 BGP_STR
4264 "Clear all external peers\n")
4265
4266ALIAS (clear_ip_bgp_external,
4267 clear_bgp_ipv6_external_cmd,
4268 "clear bgp ipv6 external",
4269 CLEAR_STR
4270 BGP_STR
4271 "Address family\n"
4272 "Clear all external peers\n")
4273
4274DEFUN (clear_ip_bgp_as,
4275 clear_ip_bgp_as_cmd,
4276 "clear ip bgp <1-65535>",
4277 CLEAR_STR
4278 IP_STR
4279 BGP_STR
4280 "Clear peers with the AS number\n")
4281{
4282 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4283}
4284
4285ALIAS (clear_ip_bgp_as,
4286 clear_bgp_as_cmd,
4287 "clear bgp <1-65535>",
4288 CLEAR_STR
4289 BGP_STR
4290 "Clear peers with the AS number\n")
4291
4292ALIAS (clear_ip_bgp_as,
4293 clear_bgp_ipv6_as_cmd,
4294 "clear bgp ipv6 <1-65535>",
4295 CLEAR_STR
4296 BGP_STR
4297 "Address family\n"
4298 "Clear peers with the AS number\n")
4299
4300/* Outbound soft-reconfiguration */
4301DEFUN (clear_ip_bgp_all_soft_out,
4302 clear_ip_bgp_all_soft_out_cmd,
4303 "clear ip bgp * soft out",
4304 CLEAR_STR
4305 IP_STR
4306 BGP_STR
4307 "Clear all peers\n"
4308 "Soft reconfig\n"
4309 "Soft reconfig outbound update\n")
4310{
4311 if (argc == 1)
4312 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4313 BGP_CLEAR_SOFT_OUT, NULL);
4314
4315 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4316 BGP_CLEAR_SOFT_OUT, NULL);
4317}
4318
4319ALIAS (clear_ip_bgp_all_soft_out,
4320 clear_ip_bgp_all_out_cmd,
4321 "clear ip bgp * out",
4322 CLEAR_STR
4323 IP_STR
4324 BGP_STR
4325 "Clear all peers\n"
4326 "Soft reconfig outbound update\n")
4327
4328ALIAS (clear_ip_bgp_all_soft_out,
4329 clear_ip_bgp_instance_all_soft_out_cmd,
4330 "clear ip bgp view WORD * soft out",
4331 CLEAR_STR
4332 IP_STR
4333 BGP_STR
4334 "BGP view\n"
4335 "view name\n"
4336 "Clear all peers\n"
4337 "Soft reconfig\n"
4338 "Soft reconfig outbound update\n")
4339
4340DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4341 clear_ip_bgp_all_ipv4_soft_out_cmd,
4342 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4343 CLEAR_STR
4344 IP_STR
4345 BGP_STR
4346 "Clear all peers\n"
4347 "Address family\n"
4348 "Address Family modifier\n"
4349 "Address Family modifier\n"
4350 "Soft reconfig\n"
4351 "Soft reconfig outbound update\n")
4352{
4353 if (strncmp (argv[0], "m", 1) == 0)
4354 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4355 BGP_CLEAR_SOFT_OUT, NULL);
4356
4357 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4358 BGP_CLEAR_SOFT_OUT, NULL);
4359}
4360
4361ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4362 clear_ip_bgp_all_ipv4_out_cmd,
4363 "clear ip bgp * ipv4 (unicast|multicast) out",
4364 CLEAR_STR
4365 IP_STR
4366 BGP_STR
4367 "Clear all peers\n"
4368 "Address family\n"
4369 "Address Family modifier\n"
4370 "Address Family modifier\n"
4371 "Soft reconfig outbound update\n")
4372
4373DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4374 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4375 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4376 CLEAR_STR
4377 IP_STR
4378 BGP_STR
4379 "BGP view\n"
4380 "view name\n"
4381 "Clear all peers\n"
4382 "Address family\n"
4383 "Address Family modifier\n"
4384 "Address Family modifier\n"
4385 "Soft reconfig outbound update\n")
4386{
4387 if (strncmp (argv[1], "m", 1) == 0)
4388 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4389 BGP_CLEAR_SOFT_OUT, NULL);
4390
4391 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4392 BGP_CLEAR_SOFT_OUT, NULL);
4393}
4394
4395DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4396 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4397 "clear ip bgp * vpnv4 unicast soft out",
4398 CLEAR_STR
4399 IP_STR
4400 BGP_STR
4401 "Clear all peers\n"
4402 "Address family\n"
4403 "Address Family Modifier\n"
4404 "Soft reconfig\n"
4405 "Soft reconfig outbound update\n")
4406{
4407 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4408 BGP_CLEAR_SOFT_OUT, NULL);
4409}
4410
4411ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4412 clear_ip_bgp_all_vpnv4_out_cmd,
4413 "clear ip bgp * vpnv4 unicast out",
4414 CLEAR_STR
4415 IP_STR
4416 BGP_STR
4417 "Clear all peers\n"
4418 "Address family\n"
4419 "Address Family Modifier\n"
4420 "Soft reconfig outbound update\n")
4421
4422DEFUN (clear_bgp_all_soft_out,
4423 clear_bgp_all_soft_out_cmd,
4424 "clear bgp * soft out",
4425 CLEAR_STR
4426 BGP_STR
4427 "Clear all peers\n"
4428 "Soft reconfig\n"
4429 "Soft reconfig outbound update\n")
4430{
4431 if (argc == 1)
4432 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4433 BGP_CLEAR_SOFT_OUT, NULL);
4434
4435 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4436 BGP_CLEAR_SOFT_OUT, NULL);
4437}
4438
4439ALIAS (clear_bgp_all_soft_out,
4440 clear_bgp_instance_all_soft_out_cmd,
4441 "clear bgp view WORD * soft out",
4442 CLEAR_STR
4443 BGP_STR
4444 "BGP view\n"
4445 "view name\n"
4446 "Clear all peers\n"
4447 "Soft reconfig\n"
4448 "Soft reconfig outbound update\n")
4449
4450ALIAS (clear_bgp_all_soft_out,
4451 clear_bgp_all_out_cmd,
4452 "clear bgp * out",
4453 CLEAR_STR
4454 BGP_STR
4455 "Clear all peers\n"
4456 "Soft reconfig outbound update\n")
4457
4458ALIAS (clear_bgp_all_soft_out,
4459 clear_bgp_ipv6_all_soft_out_cmd,
4460 "clear bgp ipv6 * soft out",
4461 CLEAR_STR
4462 BGP_STR
4463 "Address family\n"
4464 "Clear all peers\n"
4465 "Soft reconfig\n"
4466 "Soft reconfig outbound update\n")
4467
4468ALIAS (clear_bgp_all_soft_out,
4469 clear_bgp_ipv6_all_out_cmd,
4470 "clear bgp ipv6 * out",
4471 CLEAR_STR
4472 BGP_STR
4473 "Address family\n"
4474 "Clear all peers\n"
4475 "Soft reconfig outbound update\n")
4476
4477DEFUN (clear_ip_bgp_peer_soft_out,
4478 clear_ip_bgp_peer_soft_out_cmd,
4479 "clear ip bgp A.B.C.D soft out",
4480 CLEAR_STR
4481 IP_STR
4482 BGP_STR
4483 "BGP neighbor address to clear\n"
4484 "Soft reconfig\n"
4485 "Soft reconfig outbound update\n")
4486{
4487 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4488 BGP_CLEAR_SOFT_OUT, argv[0]);
4489}
4490
4491ALIAS (clear_ip_bgp_peer_soft_out,
4492 clear_ip_bgp_peer_out_cmd,
4493 "clear ip bgp A.B.C.D out",
4494 CLEAR_STR
4495 IP_STR
4496 BGP_STR
4497 "BGP neighbor address to clear\n"
4498 "Soft reconfig outbound update\n")
4499
4500DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4501 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4502 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4503 CLEAR_STR
4504 IP_STR
4505 BGP_STR
4506 "BGP neighbor address to clear\n"
4507 "Address family\n"
4508 "Address Family modifier\n"
4509 "Address Family modifier\n"
4510 "Soft reconfig\n"
4511 "Soft reconfig outbound update\n")
4512{
4513 if (strncmp (argv[1], "m", 1) == 0)
4514 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4515 BGP_CLEAR_SOFT_OUT, argv[0]);
4516
4517 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4518 BGP_CLEAR_SOFT_OUT, argv[0]);
4519}
4520
4521ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
4522 clear_ip_bgp_peer_ipv4_out_cmd,
4523 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
4524 CLEAR_STR
4525 IP_STR
4526 BGP_STR
4527 "BGP neighbor address to clear\n"
4528 "Address family\n"
4529 "Address Family modifier\n"
4530 "Address Family modifier\n"
4531 "Soft reconfig outbound update\n")
4532
4533DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
4534 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
4535 "clear ip bgp A.B.C.D vpnv4 unicast 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 "Soft reconfig\n"
4543 "Soft reconfig outbound update\n")
4544{
4545 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
4546 BGP_CLEAR_SOFT_OUT, argv[0]);
4547}
4548
4549ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
4550 clear_ip_bgp_peer_vpnv4_out_cmd,
4551 "clear ip bgp A.B.C.D vpnv4 unicast out",
4552 CLEAR_STR
4553 IP_STR
4554 BGP_STR
4555 "BGP neighbor address to clear\n"
4556 "Address family\n"
4557 "Address Family Modifier\n"
4558 "Soft reconfig outbound update\n")
4559
4560DEFUN (clear_bgp_peer_soft_out,
4561 clear_bgp_peer_soft_out_cmd,
4562 "clear bgp (A.B.C.D|X:X::X:X) soft out",
4563 CLEAR_STR
4564 BGP_STR
4565 "BGP neighbor address to clear\n"
4566 "BGP IPv6 neighbor to clear\n"
4567 "Soft reconfig\n"
4568 "Soft reconfig outbound update\n")
4569{
4570 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
4571 BGP_CLEAR_SOFT_OUT, argv[0]);
4572}
4573
4574ALIAS (clear_bgp_peer_soft_out,
4575 clear_bgp_ipv6_peer_soft_out_cmd,
4576 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
4577 CLEAR_STR
4578 BGP_STR
4579 "Address family\n"
4580 "BGP neighbor address to clear\n"
4581 "BGP IPv6 neighbor to clear\n"
4582 "Soft reconfig\n"
4583 "Soft reconfig outbound update\n")
4584
4585ALIAS (clear_bgp_peer_soft_out,
4586 clear_bgp_peer_out_cmd,
4587 "clear bgp (A.B.C.D|X:X::X:X) out",
4588 CLEAR_STR
4589 BGP_STR
4590 "BGP neighbor address to clear\n"
4591 "BGP IPv6 neighbor to clear\n"
4592 "Soft reconfig outbound update\n")
4593
4594ALIAS (clear_bgp_peer_soft_out,
4595 clear_bgp_ipv6_peer_out_cmd,
4596 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
4597 CLEAR_STR
4598 BGP_STR
4599 "Address family\n"
4600 "BGP neighbor address to clear\n"
4601 "BGP IPv6 neighbor to clear\n"
4602 "Soft reconfig outbound update\n")
4603
4604DEFUN (clear_ip_bgp_peer_group_soft_out,
4605 clear_ip_bgp_peer_group_soft_out_cmd,
4606 "clear ip bgp peer-group WORD soft out",
4607 CLEAR_STR
4608 IP_STR
4609 BGP_STR
4610 "Clear all members of peer-group\n"
4611 "BGP peer-group name\n"
4612 "Soft reconfig\n"
4613 "Soft reconfig outbound update\n")
4614{
4615 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4616 BGP_CLEAR_SOFT_OUT, argv[0]);
4617}
4618
4619ALIAS (clear_ip_bgp_peer_group_soft_out,
4620 clear_ip_bgp_peer_group_out_cmd,
4621 "clear ip bgp peer-group WORD out",
4622 CLEAR_STR
4623 IP_STR
4624 BGP_STR
4625 "Clear all members of peer-group\n"
4626 "BGP peer-group name\n"
4627 "Soft reconfig outbound update\n")
4628
4629DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
4630 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
4631 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
4632 CLEAR_STR
4633 IP_STR
4634 BGP_STR
4635 "Clear all members of peer-group\n"
4636 "BGP peer-group name\n"
4637 "Address family\n"
4638 "Address Family modifier\n"
4639 "Address Family modifier\n"
4640 "Soft reconfig\n"
4641 "Soft reconfig outbound update\n")
4642{
4643 if (strncmp (argv[1], "m", 1) == 0)
4644 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
4645 BGP_CLEAR_SOFT_OUT, argv[0]);
4646
4647 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4648 BGP_CLEAR_SOFT_OUT, argv[0]);
4649}
4650
4651ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
4652 clear_ip_bgp_peer_group_ipv4_out_cmd,
4653 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
4654 CLEAR_STR
4655 IP_STR
4656 BGP_STR
4657 "Clear all members of peer-group\n"
4658 "BGP peer-group name\n"
4659 "Address family\n"
4660 "Address Family modifier\n"
4661 "Address Family modifier\n"
4662 "Soft reconfig outbound update\n")
4663
4664DEFUN (clear_bgp_peer_group_soft_out,
4665 clear_bgp_peer_group_soft_out_cmd,
4666 "clear bgp peer-group WORD soft out",
4667 CLEAR_STR
4668 BGP_STR
4669 "Clear all members of peer-group\n"
4670 "BGP peer-group name\n"
4671 "Soft reconfig\n"
4672 "Soft reconfig outbound update\n")
4673{
4674 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
4675 BGP_CLEAR_SOFT_OUT, argv[0]);
4676}
4677
4678ALIAS (clear_bgp_peer_group_soft_out,
4679 clear_bgp_ipv6_peer_group_soft_out_cmd,
4680 "clear bgp ipv6 peer-group WORD soft out",
4681 CLEAR_STR
4682 BGP_STR
4683 "Address family\n"
4684 "Clear all members of peer-group\n"
4685 "BGP peer-group name\n"
4686 "Soft reconfig\n"
4687 "Soft reconfig outbound update\n")
4688
4689ALIAS (clear_bgp_peer_group_soft_out,
4690 clear_bgp_peer_group_out_cmd,
4691 "clear bgp peer-group WORD out",
4692 CLEAR_STR
4693 BGP_STR
4694 "Clear all members of peer-group\n"
4695 "BGP peer-group name\n"
4696 "Soft reconfig outbound update\n")
4697
4698ALIAS (clear_bgp_peer_group_soft_out,
4699 clear_bgp_ipv6_peer_group_out_cmd,
4700 "clear bgp ipv6 peer-group WORD out",
4701 CLEAR_STR
4702 BGP_STR
4703 "Address family\n"
4704 "Clear all members of peer-group\n"
4705 "BGP peer-group name\n"
4706 "Soft reconfig outbound update\n")
4707
4708DEFUN (clear_ip_bgp_external_soft_out,
4709 clear_ip_bgp_external_soft_out_cmd,
4710 "clear ip bgp external soft out",
4711 CLEAR_STR
4712 IP_STR
4713 BGP_STR
4714 "Clear all external peers\n"
4715 "Soft reconfig\n"
4716 "Soft reconfig outbound update\n")
4717{
4718 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
4719 BGP_CLEAR_SOFT_OUT, NULL);
4720}
4721
4722ALIAS (clear_ip_bgp_external_soft_out,
4723 clear_ip_bgp_external_out_cmd,
4724 "clear ip bgp external out",
4725 CLEAR_STR
4726 IP_STR
4727 BGP_STR
4728 "Clear all external peers\n"
4729 "Soft reconfig outbound update\n")
4730
4731DEFUN (clear_ip_bgp_external_ipv4_soft_out,
4732 clear_ip_bgp_external_ipv4_soft_out_cmd,
4733 "clear ip bgp external ipv4 (unicast|multicast) soft out",
4734 CLEAR_STR
4735 IP_STR
4736 BGP_STR
4737 "Clear all external peers\n"
4738 "Address family\n"
4739 "Address Family modifier\n"
4740 "Address Family modifier\n"
4741 "Soft reconfig\n"
4742 "Soft reconfig outbound update\n")
4743{
4744 if (strncmp (argv[0], "m", 1) == 0)
4745 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
4746 BGP_CLEAR_SOFT_OUT, NULL);
4747
4748 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
4749 BGP_CLEAR_SOFT_OUT, NULL);
4750}
4751
4752ALIAS (clear_ip_bgp_external_ipv4_soft_out,
4753 clear_ip_bgp_external_ipv4_out_cmd,
4754 "clear ip bgp external ipv4 (unicast|multicast) out",
4755 CLEAR_STR
4756 IP_STR
4757 BGP_STR
4758 "Clear all external peers\n"
4759 "Address family\n"
4760 "Address Family modifier\n"
4761 "Address Family modifier\n"
4762 "Soft reconfig outbound update\n")
4763
4764DEFUN (clear_bgp_external_soft_out,
4765 clear_bgp_external_soft_out_cmd,
4766 "clear bgp external soft out",
4767 CLEAR_STR
4768 BGP_STR
4769 "Clear all external peers\n"
4770 "Soft reconfig\n"
4771 "Soft reconfig outbound update\n")
4772{
4773 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
4774 BGP_CLEAR_SOFT_OUT, NULL);
4775}
4776
4777ALIAS (clear_bgp_external_soft_out,
4778 clear_bgp_ipv6_external_soft_out_cmd,
4779 "clear bgp ipv6 external soft out",
4780 CLEAR_STR
4781 BGP_STR
4782 "Address family\n"
4783 "Clear all external peers\n"
4784 "Soft reconfig\n"
4785 "Soft reconfig outbound update\n")
4786
4787ALIAS (clear_bgp_external_soft_out,
4788 clear_bgp_external_out_cmd,
4789 "clear bgp external out",
4790 CLEAR_STR
4791 BGP_STR
4792 "Clear all external peers\n"
4793 "Soft reconfig outbound update\n")
4794
4795ALIAS (clear_bgp_external_soft_out,
4796 clear_bgp_ipv6_external_out_cmd,
4797 "clear bgp ipv6 external WORD out",
4798 CLEAR_STR
4799 BGP_STR
4800 "Address family\n"
4801 "Clear all external peers\n"
4802 "Soft reconfig outbound update\n")
4803
4804DEFUN (clear_ip_bgp_as_soft_out,
4805 clear_ip_bgp_as_soft_out_cmd,
4806 "clear ip bgp <1-65535> soft out",
4807 CLEAR_STR
4808 IP_STR
4809 BGP_STR
4810 "Clear peers with the AS number\n"
4811 "Soft reconfig\n"
4812 "Soft reconfig outbound update\n")
4813{
4814 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
4815 BGP_CLEAR_SOFT_OUT, argv[0]);
4816}
4817
4818ALIAS (clear_ip_bgp_as_soft_out,
4819 clear_ip_bgp_as_out_cmd,
4820 "clear ip bgp <1-65535> out",
4821 CLEAR_STR
4822 IP_STR
4823 BGP_STR
4824 "Clear peers with the AS number\n"
4825 "Soft reconfig outbound update\n")
4826
4827DEFUN (clear_ip_bgp_as_ipv4_soft_out,
4828 clear_ip_bgp_as_ipv4_soft_out_cmd,
4829 "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft out",
4830 CLEAR_STR
4831 IP_STR
4832 BGP_STR
4833 "Clear peers with the AS number\n"
4834 "Address family\n"
4835 "Address Family modifier\n"
4836 "Address Family modifier\n"
4837 "Soft reconfig\n"
4838 "Soft reconfig outbound update\n")
4839{
4840 if (strncmp (argv[1], "m", 1) == 0)
4841 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
4842 BGP_CLEAR_SOFT_OUT, argv[0]);
4843
4844 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
4845 BGP_CLEAR_SOFT_OUT, argv[0]);
4846}
4847
4848ALIAS (clear_ip_bgp_as_ipv4_soft_out,
4849 clear_ip_bgp_as_ipv4_out_cmd,
4850 "clear ip bgp <1-65535> ipv4 (unicast|multicast) out",
4851 CLEAR_STR
4852 IP_STR
4853 BGP_STR
4854 "Clear peers with the AS number\n"
4855 "Address family\n"
4856 "Address Family modifier\n"
4857 "Address Family modifier\n"
4858 "Soft reconfig outbound update\n")
4859
4860DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
4861 clear_ip_bgp_as_vpnv4_soft_out_cmd,
4862 "clear ip bgp <1-65535> vpnv4 unicast 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 "Soft reconfig\n"
4870 "Soft reconfig outbound update\n")
4871{
4872 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
4873 BGP_CLEAR_SOFT_OUT, argv[0]);
4874}
4875
4876ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
4877 clear_ip_bgp_as_vpnv4_out_cmd,
4878 "clear ip bgp <1-65535> vpnv4 unicast out",
4879 CLEAR_STR
4880 IP_STR
4881 BGP_STR
4882 "Clear peers with the AS number\n"
4883 "Address family\n"
4884 "Address Family modifier\n"
4885 "Soft reconfig outbound update\n")
4886
4887DEFUN (clear_bgp_as_soft_out,
4888 clear_bgp_as_soft_out_cmd,
4889 "clear bgp <1-65535> soft out",
4890 CLEAR_STR
4891 BGP_STR
4892 "Clear peers with the AS number\n"
4893 "Soft reconfig\n"
4894 "Soft reconfig outbound update\n")
4895{
4896 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
4897 BGP_CLEAR_SOFT_OUT, argv[0]);
4898}
4899
4900ALIAS (clear_bgp_as_soft_out,
4901 clear_bgp_ipv6_as_soft_out_cmd,
4902 "clear bgp ipv6 <1-65535> soft out",
4903 CLEAR_STR
4904 BGP_STR
4905 "Address family\n"
4906 "Clear peers with the AS number\n"
4907 "Soft reconfig\n"
4908 "Soft reconfig outbound update\n")
4909
4910ALIAS (clear_bgp_as_soft_out,
4911 clear_bgp_as_out_cmd,
4912 "clear bgp <1-65535> out",
4913 CLEAR_STR
4914 BGP_STR
4915 "Clear peers with the AS number\n"
4916 "Soft reconfig outbound update\n")
4917
4918ALIAS (clear_bgp_as_soft_out,
4919 clear_bgp_ipv6_as_out_cmd,
4920 "clear bgp ipv6 <1-65535> out",
4921 CLEAR_STR
4922 BGP_STR
4923 "Address family\n"
4924 "Clear peers with the AS number\n"
4925 "Soft reconfig outbound update\n")
4926
4927/* Inbound soft-reconfiguration */
4928DEFUN (clear_ip_bgp_all_soft_in,
4929 clear_ip_bgp_all_soft_in_cmd,
4930 "clear ip bgp * soft in",
4931 CLEAR_STR
4932 IP_STR
4933 BGP_STR
4934 "Clear all peers\n"
4935 "Soft reconfig\n"
4936 "Soft reconfig inbound update\n")
4937{
4938 if (argc == 1)
4939 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4940 BGP_CLEAR_SOFT_IN, NULL);
4941
4942 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4943 BGP_CLEAR_SOFT_IN, NULL);
4944}
4945
4946ALIAS (clear_ip_bgp_all_soft_in,
4947 clear_ip_bgp_instance_all_soft_in_cmd,
4948 "clear ip bgp view WORD * soft in",
4949 CLEAR_STR
4950 IP_STR
4951 BGP_STR
4952 "BGP view\n"
4953 "view name\n"
4954 "Clear all peers\n"
4955 "Soft reconfig\n"
4956 "Soft reconfig inbound update\n")
4957
4958ALIAS (clear_ip_bgp_all_soft_in,
4959 clear_ip_bgp_all_in_cmd,
4960 "clear ip bgp * in",
4961 CLEAR_STR
4962 IP_STR
4963 BGP_STR
4964 "Clear all peers\n"
4965 "Soft reconfig inbound update\n")
4966
4967DEFUN (clear_ip_bgp_all_in_prefix_filter,
4968 clear_ip_bgp_all_in_prefix_filter_cmd,
4969 "clear ip bgp * in prefix-filter",
4970 CLEAR_STR
4971 IP_STR
4972 BGP_STR
4973 "Clear all peers\n"
4974 "Soft reconfig inbound update\n"
4975 "Push out prefix-list ORF and do inbound soft reconfig\n")
4976{
4977 if (argc== 1)
4978 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4979 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
4980
4981 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4982 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
4983}
4984
4985ALIAS (clear_ip_bgp_all_in_prefix_filter,
4986 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
4987 "clear ip bgp view WORD * in prefix-filter",
4988 CLEAR_STR
4989 IP_STR
4990 BGP_STR
4991 "BGP view\n"
4992 "view name\n"
4993 "Clear all peers\n"
4994 "Soft reconfig inbound update\n"
4995 "Push out prefix-list ORF and do inbound soft reconfig\n")
4996
4997
4998DEFUN (clear_ip_bgp_all_ipv4_soft_in,
4999 clear_ip_bgp_all_ipv4_soft_in_cmd,
5000 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5001 CLEAR_STR
5002 IP_STR
5003 BGP_STR
5004 "Clear all peers\n"
5005 "Address family\n"
5006 "Address Family modifier\n"
5007 "Address Family modifier\n"
5008 "Soft reconfig\n"
5009 "Soft reconfig inbound update\n")
5010{
5011 if (strncmp (argv[0], "m", 1) == 0)
5012 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5013 BGP_CLEAR_SOFT_IN, NULL);
5014
5015 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5016 BGP_CLEAR_SOFT_IN, NULL);
5017}
5018
5019ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5020 clear_ip_bgp_all_ipv4_in_cmd,
5021 "clear ip bgp * ipv4 (unicast|multicast) in",
5022 CLEAR_STR
5023 IP_STR
5024 BGP_STR
5025 "Clear all peers\n"
5026 "Address family\n"
5027 "Address Family modifier\n"
5028 "Address Family modifier\n"
5029 "Soft reconfig inbound update\n")
5030
5031DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5032 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5033 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5034 CLEAR_STR
5035 IP_STR
5036 BGP_STR
5037 "BGP view\n"
5038 "view name\n"
5039 "Clear all peers\n"
5040 "Address family\n"
5041 "Address Family modifier\n"
5042 "Address Family modifier\n"
5043 "Soft reconfig\n"
5044 "Soft reconfig inbound update\n")
5045{
5046 if (strncmp (argv[1], "m", 1) == 0)
5047 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5048 BGP_CLEAR_SOFT_IN, NULL);
5049
5050 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5051 BGP_CLEAR_SOFT_IN, NULL);
5052}
5053
5054DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5055 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5056 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5057 CLEAR_STR
5058 IP_STR
5059 BGP_STR
5060 "Clear all peers\n"
5061 "Address family\n"
5062 "Address Family modifier\n"
5063 "Address Family modifier\n"
5064 "Soft reconfig inbound update\n"
5065 "Push out prefix-list ORF and do inbound soft reconfig\n")
5066{
5067 if (strncmp (argv[0], "m", 1) == 0)
5068 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5069 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5070
5071 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5072 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5073}
5074
5075DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5076 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5077 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5078 CLEAR_STR
5079 IP_STR
5080 BGP_STR
5081 "Clear all peers\n"
5082 "Address family\n"
5083 "Address Family modifier\n"
5084 "Address Family modifier\n"
5085 "Soft reconfig inbound update\n"
5086 "Push out prefix-list ORF and do inbound soft reconfig\n")
5087{
5088 if (strncmp (argv[1], "m", 1) == 0)
5089 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5090 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5091
5092 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5093 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5094}
5095
5096DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5097 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5098 "clear ip bgp * vpnv4 unicast soft in",
5099 CLEAR_STR
5100 IP_STR
5101 BGP_STR
5102 "Clear all peers\n"
5103 "Address family\n"
5104 "Address Family Modifier\n"
5105 "Soft reconfig\n"
5106 "Soft reconfig inbound update\n")
5107{
5108 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5109 BGP_CLEAR_SOFT_IN, NULL);
5110}
5111
5112ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5113 clear_ip_bgp_all_vpnv4_in_cmd,
5114 "clear ip bgp * vpnv4 unicast in",
5115 CLEAR_STR
5116 IP_STR
5117 BGP_STR
5118 "Clear all peers\n"
5119 "Address family\n"
5120 "Address Family Modifier\n"
5121 "Soft reconfig inbound update\n")
5122
5123DEFUN (clear_bgp_all_soft_in,
5124 clear_bgp_all_soft_in_cmd,
5125 "clear bgp * soft in",
5126 CLEAR_STR
5127 BGP_STR
5128 "Clear all peers\n"
5129 "Soft reconfig\n"
5130 "Soft reconfig inbound update\n")
5131{
5132 if (argc == 1)
5133 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5134 BGP_CLEAR_SOFT_IN, NULL);
5135
5136 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5137 BGP_CLEAR_SOFT_IN, NULL);
5138}
5139
5140ALIAS (clear_bgp_all_soft_in,
5141 clear_bgp_instance_all_soft_in_cmd,
5142 "clear bgp view WORD * soft in",
5143 CLEAR_STR
5144 BGP_STR
5145 "BGP view\n"
5146 "view name\n"
5147 "Clear all peers\n"
5148 "Soft reconfig\n"
5149 "Soft reconfig inbound update\n")
5150
5151ALIAS (clear_bgp_all_soft_in,
5152 clear_bgp_ipv6_all_soft_in_cmd,
5153 "clear bgp ipv6 * soft in",
5154 CLEAR_STR
5155 BGP_STR
5156 "Address family\n"
5157 "Clear all peers\n"
5158 "Soft reconfig\n"
5159 "Soft reconfig inbound update\n")
5160
5161ALIAS (clear_bgp_all_soft_in,
5162 clear_bgp_all_in_cmd,
5163 "clear bgp * in",
5164 CLEAR_STR
5165 BGP_STR
5166 "Clear all peers\n"
5167 "Soft reconfig inbound update\n")
5168
5169ALIAS (clear_bgp_all_soft_in,
5170 clear_bgp_ipv6_all_in_cmd,
5171 "clear bgp ipv6 * in",
5172 CLEAR_STR
5173 BGP_STR
5174 "Address family\n"
5175 "Clear all peers\n"
5176 "Soft reconfig inbound update\n")
5177
5178DEFUN (clear_bgp_all_in_prefix_filter,
5179 clear_bgp_all_in_prefix_filter_cmd,
5180 "clear bgp * in prefix-filter",
5181 CLEAR_STR
5182 BGP_STR
5183 "Clear all peers\n"
5184 "Soft reconfig inbound update\n"
5185 "Push out prefix-list ORF and do inbound soft reconfig\n")
5186{
5187 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5188 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5189}
5190
5191ALIAS (clear_bgp_all_in_prefix_filter,
5192 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5193 "clear bgp ipv6 * in prefix-filter",
5194 CLEAR_STR
5195 BGP_STR
5196 "Address family\n"
5197 "Clear all peers\n"
5198 "Soft reconfig inbound update\n"
5199 "Push out prefix-list ORF and do inbound soft reconfig\n")
5200
5201DEFUN (clear_ip_bgp_peer_soft_in,
5202 clear_ip_bgp_peer_soft_in_cmd,
5203 "clear ip bgp A.B.C.D soft in",
5204 CLEAR_STR
5205 IP_STR
5206 BGP_STR
5207 "BGP neighbor address to clear\n"
5208 "Soft reconfig\n"
5209 "Soft reconfig inbound update\n")
5210{
5211 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5212 BGP_CLEAR_SOFT_IN, argv[0]);
5213}
5214
5215ALIAS (clear_ip_bgp_peer_soft_in,
5216 clear_ip_bgp_peer_in_cmd,
5217 "clear ip bgp A.B.C.D in",
5218 CLEAR_STR
5219 IP_STR
5220 BGP_STR
5221 "BGP neighbor address to clear\n"
5222 "Soft reconfig inbound update\n")
5223
5224DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5225 clear_ip_bgp_peer_in_prefix_filter_cmd,
5226 "clear ip bgp A.B.C.D in prefix-filter",
5227 CLEAR_STR
5228 IP_STR
5229 BGP_STR
5230 "BGP neighbor address to clear\n"
5231 "Soft reconfig inbound update\n"
5232 "Push out the existing ORF prefix-list\n")
5233{
5234 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5235 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5236}
5237
5238DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5239 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5240 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5241 CLEAR_STR
5242 IP_STR
5243 BGP_STR
5244 "BGP neighbor address to clear\n"
5245 "Address family\n"
5246 "Address Family modifier\n"
5247 "Address Family modifier\n"
5248 "Soft reconfig\n"
5249 "Soft reconfig inbound update\n")
5250{
5251 if (strncmp (argv[1], "m", 1) == 0)
5252 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5253 BGP_CLEAR_SOFT_IN, argv[0]);
5254
5255 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5256 BGP_CLEAR_SOFT_IN, argv[0]);
5257}
5258
5259ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5260 clear_ip_bgp_peer_ipv4_in_cmd,
5261 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5262 CLEAR_STR
5263 IP_STR
5264 BGP_STR
5265 "BGP neighbor address to clear\n"
5266 "Address family\n"
5267 "Address Family modifier\n"
5268 "Address Family modifier\n"
5269 "Soft reconfig inbound update\n")
5270
5271DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5272 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5273 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
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 inbound update\n"
5282 "Push out the existing ORF prefix-list\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_ORF_PREFIX, argv[0]);
5287
5288 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5289 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5290}
5291
5292DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5293 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5294 "clear ip bgp A.B.C.D vpnv4 unicast soft 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 "Soft reconfig\n"
5302 "Soft reconfig inbound update\n")
5303{
5304 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5305 BGP_CLEAR_SOFT_IN, argv[0]);
5306}
5307
5308ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5309 clear_ip_bgp_peer_vpnv4_in_cmd,
5310 "clear ip bgp A.B.C.D vpnv4 unicast in",
5311 CLEAR_STR
5312 IP_STR
5313 BGP_STR
5314 "BGP neighbor address to clear\n"
5315 "Address family\n"
5316 "Address Family Modifier\n"
5317 "Soft reconfig inbound update\n")
5318
5319DEFUN (clear_bgp_peer_soft_in,
5320 clear_bgp_peer_soft_in_cmd,
5321 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5322 CLEAR_STR
5323 BGP_STR
5324 "BGP neighbor address to clear\n"
5325 "BGP IPv6 neighbor to clear\n"
5326 "Soft reconfig\n"
5327 "Soft reconfig inbound update\n")
5328{
5329 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5330 BGP_CLEAR_SOFT_IN, argv[0]);
5331}
5332
5333ALIAS (clear_bgp_peer_soft_in,
5334 clear_bgp_ipv6_peer_soft_in_cmd,
5335 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5336 CLEAR_STR
5337 BGP_STR
5338 "Address family\n"
5339 "BGP neighbor address to clear\n"
5340 "BGP IPv6 neighbor to clear\n"
5341 "Soft reconfig\n"
5342 "Soft reconfig inbound update\n")
5343
5344ALIAS (clear_bgp_peer_soft_in,
5345 clear_bgp_peer_in_cmd,
5346 "clear bgp (A.B.C.D|X:X::X:X) in",
5347 CLEAR_STR
5348 BGP_STR
5349 "BGP neighbor address to clear\n"
5350 "BGP IPv6 neighbor to clear\n"
5351 "Soft reconfig inbound update\n")
5352
5353ALIAS (clear_bgp_peer_soft_in,
5354 clear_bgp_ipv6_peer_in_cmd,
5355 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5356 CLEAR_STR
5357 BGP_STR
5358 "Address family\n"
5359 "BGP neighbor address to clear\n"
5360 "BGP IPv6 neighbor to clear\n"
5361 "Soft reconfig inbound update\n")
5362
5363DEFUN (clear_bgp_peer_in_prefix_filter,
5364 clear_bgp_peer_in_prefix_filter_cmd,
5365 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5366 CLEAR_STR
5367 BGP_STR
5368 "BGP neighbor address to clear\n"
5369 "BGP IPv6 neighbor to clear\n"
5370 "Soft reconfig inbound update\n"
5371 "Push out the existing ORF prefix-list\n")
5372{
5373 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5374 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5375}
5376
5377ALIAS (clear_bgp_peer_in_prefix_filter,
5378 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5379 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5380 CLEAR_STR
5381 BGP_STR
5382 "Address family\n"
5383 "BGP neighbor address to clear\n"
5384 "BGP IPv6 neighbor to clear\n"
5385 "Soft reconfig inbound update\n"
5386 "Push out the existing ORF prefix-list\n")
5387
5388DEFUN (clear_ip_bgp_peer_group_soft_in,
5389 clear_ip_bgp_peer_group_soft_in_cmd,
5390 "clear ip bgp peer-group WORD soft in",
5391 CLEAR_STR
5392 IP_STR
5393 BGP_STR
5394 "Clear all members of peer-group\n"
5395 "BGP peer-group name\n"
5396 "Soft reconfig\n"
5397 "Soft reconfig inbound update\n")
5398{
5399 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5400 BGP_CLEAR_SOFT_IN, argv[0]);
5401}
5402
5403ALIAS (clear_ip_bgp_peer_group_soft_in,
5404 clear_ip_bgp_peer_group_in_cmd,
5405 "clear ip bgp peer-group WORD in",
5406 CLEAR_STR
5407 IP_STR
5408 BGP_STR
5409 "Clear all members of peer-group\n"
5410 "BGP peer-group name\n"
5411 "Soft reconfig inbound update\n")
5412
5413DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
5414 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
5415 "clear ip bgp peer-group WORD in prefix-filter",
5416 CLEAR_STR
5417 IP_STR
5418 BGP_STR
5419 "Clear all members of peer-group\n"
5420 "BGP peer-group name\n"
5421 "Soft reconfig inbound update\n"
5422 "Push out prefix-list ORF and do inbound soft reconfig\n")
5423{
5424 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5425 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5426}
5427
5428DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
5429 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
5430 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
5431 CLEAR_STR
5432 IP_STR
5433 BGP_STR
5434 "Clear all members of peer-group\n"
5435 "BGP peer-group name\n"
5436 "Address family\n"
5437 "Address Family modifier\n"
5438 "Address Family modifier\n"
5439 "Soft reconfig\n"
5440 "Soft reconfig inbound update\n")
5441{
5442 if (strncmp (argv[1], "m", 1) == 0)
5443 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5444 BGP_CLEAR_SOFT_IN, argv[0]);
5445
5446 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5447 BGP_CLEAR_SOFT_IN, argv[0]);
5448}
5449
5450ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
5451 clear_ip_bgp_peer_group_ipv4_in_cmd,
5452 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
5453 CLEAR_STR
5454 IP_STR
5455 BGP_STR
5456 "Clear all members of peer-group\n"
5457 "BGP peer-group name\n"
5458 "Address family\n"
5459 "Address Family modifier\n"
5460 "Address Family modifier\n"
5461 "Soft reconfig inbound update\n")
5462
5463DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
5464 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
5465 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
5466 CLEAR_STR
5467 IP_STR
5468 BGP_STR
5469 "Clear all members of peer-group\n"
5470 "BGP peer-group name\n"
5471 "Address family\n"
5472 "Address Family modifier\n"
5473 "Address Family modifier\n"
5474 "Soft reconfig inbound update\n"
5475 "Push out prefix-list ORF and do inbound soft reconfig\n")
5476{
5477 if (strncmp (argv[1], "m", 1) == 0)
5478 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5479 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5480
5481 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5482 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5483}
5484
5485DEFUN (clear_bgp_peer_group_soft_in,
5486 clear_bgp_peer_group_soft_in_cmd,
5487 "clear bgp peer-group WORD soft in",
5488 CLEAR_STR
5489 BGP_STR
5490 "Clear all members of peer-group\n"
5491 "BGP peer-group name\n"
5492 "Soft reconfig\n"
5493 "Soft reconfig inbound update\n")
5494{
5495 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5496 BGP_CLEAR_SOFT_IN, argv[0]);
5497}
5498
5499ALIAS (clear_bgp_peer_group_soft_in,
5500 clear_bgp_ipv6_peer_group_soft_in_cmd,
5501 "clear bgp ipv6 peer-group WORD soft in",
5502 CLEAR_STR
5503 BGP_STR
5504 "Address family\n"
5505 "Clear all members of peer-group\n"
5506 "BGP peer-group name\n"
5507 "Soft reconfig\n"
5508 "Soft reconfig inbound update\n")
5509
5510ALIAS (clear_bgp_peer_group_soft_in,
5511 clear_bgp_peer_group_in_cmd,
5512 "clear bgp peer-group WORD in",
5513 CLEAR_STR
5514 BGP_STR
5515 "Clear all members of peer-group\n"
5516 "BGP peer-group name\n"
5517 "Soft reconfig inbound update\n")
5518
5519ALIAS (clear_bgp_peer_group_soft_in,
5520 clear_bgp_ipv6_peer_group_in_cmd,
5521 "clear bgp ipv6 peer-group WORD in",
5522 CLEAR_STR
5523 BGP_STR
5524 "Address family\n"
5525 "Clear all members of peer-group\n"
5526 "BGP peer-group name\n"
5527 "Soft reconfig inbound update\n")
5528
5529DEFUN (clear_bgp_peer_group_in_prefix_filter,
5530 clear_bgp_peer_group_in_prefix_filter_cmd,
5531 "clear bgp peer-group WORD in prefix-filter",
5532 CLEAR_STR
5533 BGP_STR
5534 "Clear all members of peer-group\n"
5535 "BGP peer-group name\n"
5536 "Soft reconfig inbound update\n"
5537 "Push out prefix-list ORF and do inbound soft reconfig\n")
5538{
5539 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5540 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5541}
5542
5543ALIAS (clear_bgp_peer_group_in_prefix_filter,
5544 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
5545 "clear bgp ipv6 peer-group WORD in prefix-filter",
5546 CLEAR_STR
5547 BGP_STR
5548 "Address family\n"
5549 "Clear all members of peer-group\n"
5550 "BGP peer-group name\n"
5551 "Soft reconfig inbound update\n"
5552 "Push out prefix-list ORF and do inbound soft reconfig\n")
5553
5554DEFUN (clear_ip_bgp_external_soft_in,
5555 clear_ip_bgp_external_soft_in_cmd,
5556 "clear ip bgp external soft in",
5557 CLEAR_STR
5558 IP_STR
5559 BGP_STR
5560 "Clear all external peers\n"
5561 "Soft reconfig\n"
5562 "Soft reconfig inbound update\n")
5563{
5564 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5565 BGP_CLEAR_SOFT_IN, NULL);
5566}
5567
5568ALIAS (clear_ip_bgp_external_soft_in,
5569 clear_ip_bgp_external_in_cmd,
5570 "clear ip bgp external in",
5571 CLEAR_STR
5572 IP_STR
5573 BGP_STR
5574 "Clear all external peers\n"
5575 "Soft reconfig inbound update\n")
5576
5577DEFUN (clear_ip_bgp_external_in_prefix_filter,
5578 clear_ip_bgp_external_in_prefix_filter_cmd,
5579 "clear ip bgp external in prefix-filter",
5580 CLEAR_STR
5581 IP_STR
5582 BGP_STR
5583 "Clear all external peers\n"
5584 "Soft reconfig inbound update\n"
5585 "Push out prefix-list ORF and do inbound soft reconfig\n")
5586{
5587 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5588 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5589}
5590
5591DEFUN (clear_ip_bgp_external_ipv4_soft_in,
5592 clear_ip_bgp_external_ipv4_soft_in_cmd,
5593 "clear ip bgp external ipv4 (unicast|multicast) soft in",
5594 CLEAR_STR
5595 IP_STR
5596 BGP_STR
5597 "Clear all external peers\n"
5598 "Address family\n"
5599 "Address Family modifier\n"
5600 "Address Family modifier\n"
5601 "Soft reconfig\n"
5602 "Soft reconfig inbound update\n")
5603{
5604 if (strncmp (argv[0], "m", 1) == 0)
5605 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5606 BGP_CLEAR_SOFT_IN, NULL);
5607
5608 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5609 BGP_CLEAR_SOFT_IN, NULL);
5610}
5611
5612ALIAS (clear_ip_bgp_external_ipv4_soft_in,
5613 clear_ip_bgp_external_ipv4_in_cmd,
5614 "clear ip bgp external ipv4 (unicast|multicast) in",
5615 CLEAR_STR
5616 IP_STR
5617 BGP_STR
5618 "Clear all external peers\n"
5619 "Address family\n"
5620 "Address Family modifier\n"
5621 "Address Family modifier\n"
5622 "Soft reconfig inbound update\n")
5623
5624DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
5625 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
5626 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
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 inbound update\n"
5635 "Push out prefix-list ORF and do inbound soft reconfig\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_ORF_PREFIX, NULL);
5640
5641 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5642 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5643}
5644
5645DEFUN (clear_bgp_external_soft_in,
5646 clear_bgp_external_soft_in_cmd,
5647 "clear bgp external soft in",
5648 CLEAR_STR
5649 BGP_STR
5650 "Clear all external peers\n"
5651 "Soft reconfig\n"
5652 "Soft reconfig inbound update\n")
5653{
5654 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5655 BGP_CLEAR_SOFT_IN, NULL);
5656}
5657
5658ALIAS (clear_bgp_external_soft_in,
5659 clear_bgp_ipv6_external_soft_in_cmd,
5660 "clear bgp ipv6 external soft in",
5661 CLEAR_STR
5662 BGP_STR
5663 "Address family\n"
5664 "Clear all external peers\n"
5665 "Soft reconfig\n"
5666 "Soft reconfig inbound update\n")
5667
5668ALIAS (clear_bgp_external_soft_in,
5669 clear_bgp_external_in_cmd,
5670 "clear bgp external in",
5671 CLEAR_STR
5672 BGP_STR
5673 "Clear all external peers\n"
5674 "Soft reconfig inbound update\n")
5675
5676ALIAS (clear_bgp_external_soft_in,
5677 clear_bgp_ipv6_external_in_cmd,
5678 "clear bgp ipv6 external WORD in",
5679 CLEAR_STR
5680 BGP_STR
5681 "Address family\n"
5682 "Clear all external peers\n"
5683 "Soft reconfig inbound update\n")
5684
5685DEFUN (clear_bgp_external_in_prefix_filter,
5686 clear_bgp_external_in_prefix_filter_cmd,
5687 "clear bgp external in prefix-filter",
5688 CLEAR_STR
5689 BGP_STR
5690 "Clear all external peers\n"
5691 "Soft reconfig inbound update\n"
5692 "Push out prefix-list ORF and do inbound soft reconfig\n")
5693{
5694 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5695 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5696}
5697
5698ALIAS (clear_bgp_external_in_prefix_filter,
5699 clear_bgp_ipv6_external_in_prefix_filter_cmd,
5700 "clear bgp ipv6 external in prefix-filter",
5701 CLEAR_STR
5702 BGP_STR
5703 "Address family\n"
5704 "Clear all external peers\n"
5705 "Soft reconfig inbound update\n"
5706 "Push out prefix-list ORF and do inbound soft reconfig\n")
5707
5708DEFUN (clear_ip_bgp_as_soft_in,
5709 clear_ip_bgp_as_soft_in_cmd,
5710 "clear ip bgp <1-65535> soft in",
5711 CLEAR_STR
5712 IP_STR
5713 BGP_STR
5714 "Clear peers with the AS number\n"
5715 "Soft reconfig\n"
5716 "Soft reconfig inbound update\n")
5717{
5718 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5719 BGP_CLEAR_SOFT_IN, argv[0]);
5720}
5721
5722ALIAS (clear_ip_bgp_as_soft_in,
5723 clear_ip_bgp_as_in_cmd,
5724 "clear ip bgp <1-65535> in",
5725 CLEAR_STR
5726 IP_STR
5727 BGP_STR
5728 "Clear peers with the AS number\n"
5729 "Soft reconfig inbound update\n")
5730
5731DEFUN (clear_ip_bgp_as_in_prefix_filter,
5732 clear_ip_bgp_as_in_prefix_filter_cmd,
5733 "clear ip bgp <1-65535> in prefix-filter",
5734 CLEAR_STR
5735 IP_STR
5736 BGP_STR
5737 "Clear peers with the AS number\n"
5738 "Soft reconfig inbound update\n"
5739 "Push out prefix-list ORF and do inbound soft reconfig\n")
5740{
5741 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5742 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5743}
5744
5745DEFUN (clear_ip_bgp_as_ipv4_soft_in,
5746 clear_ip_bgp_as_ipv4_soft_in_cmd,
5747 "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft in",
5748 CLEAR_STR
5749 IP_STR
5750 BGP_STR
5751 "Clear peers with the AS number\n"
5752 "Address family\n"
5753 "Address Family modifier\n"
5754 "Address Family modifier\n"
5755 "Soft reconfig\n"
5756 "Soft reconfig inbound update\n")
5757{
5758 if (strncmp (argv[1], "m", 1) == 0)
5759 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5760 BGP_CLEAR_SOFT_IN, argv[0]);
5761
5762 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5763 BGP_CLEAR_SOFT_IN, argv[0]);
5764}
5765
5766ALIAS (clear_ip_bgp_as_ipv4_soft_in,
5767 clear_ip_bgp_as_ipv4_in_cmd,
5768 "clear ip bgp <1-65535> ipv4 (unicast|multicast) in",
5769 CLEAR_STR
5770 IP_STR
5771 BGP_STR
5772 "Clear peers with the AS number\n"
5773 "Address family\n"
5774 "Address Family modifier\n"
5775 "Address Family modifier\n"
5776 "Soft reconfig inbound update\n")
5777
5778DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
5779 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
5780 "clear ip bgp <1-65535> ipv4 (unicast|multicast) in prefix-filter",
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 inbound update\n"
5789 "Push out prefix-list ORF and do inbound soft reconfig\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_ORF_PREFIX, argv[0]);
5794
5795 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5796 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5797}
5798
5799DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
5800 clear_ip_bgp_as_vpnv4_soft_in_cmd,
5801 "clear ip bgp <1-65535> vpnv4 unicast soft 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 "Soft reconfig\n"
5809 "Soft reconfig inbound update\n")
5810{
5811 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5812 BGP_CLEAR_SOFT_IN, argv[0]);
5813}
5814
5815ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
5816 clear_ip_bgp_as_vpnv4_in_cmd,
5817 "clear ip bgp <1-65535> vpnv4 unicast in",
5818 CLEAR_STR
5819 IP_STR
5820 BGP_STR
5821 "Clear peers with the AS number\n"
5822 "Address family\n"
5823 "Address Family modifier\n"
5824 "Soft reconfig inbound update\n")
5825
5826DEFUN (clear_bgp_as_soft_in,
5827 clear_bgp_as_soft_in_cmd,
5828 "clear bgp <1-65535> soft in",
5829 CLEAR_STR
5830 BGP_STR
5831 "Clear peers with the AS number\n"
5832 "Soft reconfig\n"
5833 "Soft reconfig inbound update\n")
5834{
5835 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5836 BGP_CLEAR_SOFT_IN, argv[0]);
5837}
5838
5839ALIAS (clear_bgp_as_soft_in,
5840 clear_bgp_ipv6_as_soft_in_cmd,
5841 "clear bgp ipv6 <1-65535> soft in",
5842 CLEAR_STR
5843 BGP_STR
5844 "Address family\n"
5845 "Clear peers with the AS number\n"
5846 "Soft reconfig\n"
5847 "Soft reconfig inbound update\n")
5848
5849ALIAS (clear_bgp_as_soft_in,
5850 clear_bgp_as_in_cmd,
5851 "clear bgp <1-65535> in",
5852 CLEAR_STR
5853 BGP_STR
5854 "Clear peers with the AS number\n"
5855 "Soft reconfig inbound update\n")
5856
5857ALIAS (clear_bgp_as_soft_in,
5858 clear_bgp_ipv6_as_in_cmd,
5859 "clear bgp ipv6 <1-65535> in",
5860 CLEAR_STR
5861 BGP_STR
5862 "Address family\n"
5863 "Clear peers with the AS number\n"
5864 "Soft reconfig inbound update\n")
5865
5866DEFUN (clear_bgp_as_in_prefix_filter,
5867 clear_bgp_as_in_prefix_filter_cmd,
5868 "clear bgp <1-65535> in prefix-filter",
5869 CLEAR_STR
5870 BGP_STR
5871 "Clear peers with the AS number\n"
5872 "Soft reconfig inbound update\n"
5873 "Push out prefix-list ORF and do inbound soft reconfig\n")
5874{
5875 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5876 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5877}
5878
5879ALIAS (clear_bgp_as_in_prefix_filter,
5880 clear_bgp_ipv6_as_in_prefix_filter_cmd,
5881 "clear bgp ipv6 <1-65535> in prefix-filter",
5882 CLEAR_STR
5883 BGP_STR
5884 "Address family\n"
5885 "Clear peers with the AS number\n"
5886 "Soft reconfig inbound update\n"
5887 "Push out prefix-list ORF and do inbound soft reconfig\n")
5888
5889/* Both soft-reconfiguration */
5890DEFUN (clear_ip_bgp_all_soft,
5891 clear_ip_bgp_all_soft_cmd,
5892 "clear ip bgp * soft",
5893 CLEAR_STR
5894 IP_STR
5895 BGP_STR
5896 "Clear all peers\n"
5897 "Soft reconfig\n")
5898{
5899 if (argc == 1)
5900 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5901 BGP_CLEAR_SOFT_BOTH, NULL);
5902
5903 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5904 BGP_CLEAR_SOFT_BOTH, NULL);
5905}
5906
5907ALIAS (clear_ip_bgp_all_soft,
5908 clear_ip_bgp_instance_all_soft_cmd,
5909 "clear ip bgp view WORD * soft",
5910 CLEAR_STR
5911 IP_STR
5912 BGP_STR
5913 "BGP view\n"
5914 "view name\n"
5915 "Clear all peers\n"
5916 "Soft reconfig\n")
5917
5918
5919DEFUN (clear_ip_bgp_all_ipv4_soft,
5920 clear_ip_bgp_all_ipv4_soft_cmd,
5921 "clear ip bgp * ipv4 (unicast|multicast) soft",
5922 CLEAR_STR
5923 IP_STR
5924 BGP_STR
5925 "Clear all peers\n"
5926 "Address family\n"
5927 "Address Family Modifier\n"
5928 "Address Family Modifier\n"
5929 "Soft reconfig\n")
5930{
5931 if (strncmp (argv[0], "m", 1) == 0)
5932 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5933 BGP_CLEAR_SOFT_BOTH, NULL);
5934
5935 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5936 BGP_CLEAR_SOFT_BOTH, NULL);
5937}
5938
5939DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
5940 clear_ip_bgp_instance_all_ipv4_soft_cmd,
5941 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
5942 CLEAR_STR
5943 IP_STR
5944 BGP_STR
5945 "BGP view\n"
5946 "view name\n"
5947 "Clear all peers\n"
5948 "Address family\n"
5949 "Address Family Modifier\n"
5950 "Address Family Modifier\n"
5951 "Soft reconfig\n")
5952{
5953 if (strncmp (argv[1], "m", 1) == 0)
5954 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5955 BGP_CLEAR_SOFT_BOTH, NULL);
5956
5957 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5958 BGP_CLEAR_SOFT_BOTH, NULL);
5959}
5960
5961DEFUN (clear_ip_bgp_all_vpnv4_soft,
5962 clear_ip_bgp_all_vpnv4_soft_cmd,
5963 "clear ip bgp * vpnv4 unicast soft",
5964 CLEAR_STR
5965 IP_STR
5966 BGP_STR
5967 "Clear all peers\n"
5968 "Address family\n"
5969 "Address Family Modifier\n"
5970 "Soft reconfig\n")
5971{
5972 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5973 BGP_CLEAR_SOFT_BOTH, argv[0]);
5974}
5975
5976DEFUN (clear_bgp_all_soft,
5977 clear_bgp_all_soft_cmd,
5978 "clear bgp * soft",
5979 CLEAR_STR
5980 BGP_STR
5981 "Clear all peers\n"
5982 "Soft reconfig\n")
5983{
5984 if (argc == 1)
5985 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5986 BGP_CLEAR_SOFT_BOTH, argv[0]);
5987
5988 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5989 BGP_CLEAR_SOFT_BOTH, argv[0]);
5990}
5991
5992ALIAS (clear_bgp_all_soft,
5993 clear_bgp_instance_all_soft_cmd,
5994 "clear bgp view WORD * soft",
5995 CLEAR_STR
5996 BGP_STR
5997 "BGP view\n"
5998 "view name\n"
5999 "Clear all peers\n"
6000 "Soft reconfig\n")
6001
6002ALIAS (clear_bgp_all_soft,
6003 clear_bgp_ipv6_all_soft_cmd,
6004 "clear bgp ipv6 * soft",
6005 CLEAR_STR
6006 BGP_STR
6007 "Address family\n"
6008 "Clear all peers\n"
6009 "Soft reconfig\n")
6010
6011DEFUN (clear_ip_bgp_peer_soft,
6012 clear_ip_bgp_peer_soft_cmd,
6013 "clear ip bgp A.B.C.D soft",
6014 CLEAR_STR
6015 IP_STR
6016 BGP_STR
6017 "BGP neighbor address to clear\n"
6018 "Soft reconfig\n")
6019{
6020 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6021 BGP_CLEAR_SOFT_BOTH, argv[0]);
6022}
6023
6024DEFUN (clear_ip_bgp_peer_ipv4_soft,
6025 clear_ip_bgp_peer_ipv4_soft_cmd,
6026 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6027 CLEAR_STR
6028 IP_STR
6029 BGP_STR
6030 "BGP neighbor address to clear\n"
6031 "Address family\n"
6032 "Address Family Modifier\n"
6033 "Address Family Modifier\n"
6034 "Soft reconfig\n")
6035{
6036 if (strncmp (argv[1], "m", 1) == 0)
6037 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6038 BGP_CLEAR_SOFT_BOTH, argv[0]);
6039
6040 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6041 BGP_CLEAR_SOFT_BOTH, argv[0]);
6042}
6043
6044DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6045 clear_ip_bgp_peer_vpnv4_soft_cmd,
6046 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6047 CLEAR_STR
6048 IP_STR
6049 BGP_STR
6050 "BGP neighbor address to clear\n"
6051 "Address family\n"
6052 "Address Family Modifier\n"
6053 "Soft reconfig\n")
6054{
6055 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6056 BGP_CLEAR_SOFT_BOTH, argv[0]);
6057}
6058
6059DEFUN (clear_bgp_peer_soft,
6060 clear_bgp_peer_soft_cmd,
6061 "clear bgp (A.B.C.D|X:X::X:X) soft",
6062 CLEAR_STR
6063 BGP_STR
6064 "BGP neighbor address to clear\n"
6065 "BGP IPv6 neighbor to clear\n"
6066 "Soft reconfig\n")
6067{
6068 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6069 BGP_CLEAR_SOFT_BOTH, argv[0]);
6070}
6071
6072ALIAS (clear_bgp_peer_soft,
6073 clear_bgp_ipv6_peer_soft_cmd,
6074 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6075 CLEAR_STR
6076 BGP_STR
6077 "Address family\n"
6078 "BGP neighbor address to clear\n"
6079 "BGP IPv6 neighbor to clear\n"
6080 "Soft reconfig\n")
6081
6082DEFUN (clear_ip_bgp_peer_group_soft,
6083 clear_ip_bgp_peer_group_soft_cmd,
6084 "clear ip bgp peer-group WORD soft",
6085 CLEAR_STR
6086 IP_STR
6087 BGP_STR
6088 "Clear all members of peer-group\n"
6089 "BGP peer-group name\n"
6090 "Soft reconfig\n")
6091{
6092 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6093 BGP_CLEAR_SOFT_BOTH, argv[0]);
6094}
6095
6096DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6097 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6098 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6099 CLEAR_STR
6100 IP_STR
6101 BGP_STR
6102 "Clear all members of peer-group\n"
6103 "BGP peer-group name\n"
6104 "Address family\n"
6105 "Address Family modifier\n"
6106 "Address Family modifier\n"
6107 "Soft reconfig\n")
6108{
6109 if (strncmp (argv[1], "m", 1) == 0)
6110 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6111 BGP_CLEAR_SOFT_BOTH, argv[0]);
6112
6113 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6114 BGP_CLEAR_SOFT_BOTH, argv[0]);
6115}
6116
6117DEFUN (clear_bgp_peer_group_soft,
6118 clear_bgp_peer_group_soft_cmd,
6119 "clear bgp peer-group WORD soft",
6120 CLEAR_STR
6121 BGP_STR
6122 "Clear all members of peer-group\n"
6123 "BGP peer-group name\n"
6124 "Soft reconfig\n")
6125{
6126 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6127 BGP_CLEAR_SOFT_BOTH, argv[0]);
6128}
6129
6130ALIAS (clear_bgp_peer_group_soft,
6131 clear_bgp_ipv6_peer_group_soft_cmd,
6132 "clear bgp ipv6 peer-group WORD soft",
6133 CLEAR_STR
6134 BGP_STR
6135 "Address family\n"
6136 "Clear all members of peer-group\n"
6137 "BGP peer-group name\n"
6138 "Soft reconfig\n")
6139
6140DEFUN (clear_ip_bgp_external_soft,
6141 clear_ip_bgp_external_soft_cmd,
6142 "clear ip bgp external soft",
6143 CLEAR_STR
6144 IP_STR
6145 BGP_STR
6146 "Clear all external peers\n"
6147 "Soft reconfig\n")
6148{
6149 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6150 BGP_CLEAR_SOFT_BOTH, NULL);
6151}
6152
6153DEFUN (clear_ip_bgp_external_ipv4_soft,
6154 clear_ip_bgp_external_ipv4_soft_cmd,
6155 "clear ip bgp external ipv4 (unicast|multicast) soft",
6156 CLEAR_STR
6157 IP_STR
6158 BGP_STR
6159 "Clear all external peers\n"
6160 "Address family\n"
6161 "Address Family modifier\n"
6162 "Address Family modifier\n"
6163 "Soft reconfig\n")
6164{
6165 if (strncmp (argv[0], "m", 1) == 0)
6166 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6167 BGP_CLEAR_SOFT_BOTH, NULL);
6168
6169 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6170 BGP_CLEAR_SOFT_BOTH, NULL);
6171}
6172
6173DEFUN (clear_bgp_external_soft,
6174 clear_bgp_external_soft_cmd,
6175 "clear bgp external soft",
6176 CLEAR_STR
6177 BGP_STR
6178 "Clear all external peers\n"
6179 "Soft reconfig\n")
6180{
6181 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6182 BGP_CLEAR_SOFT_BOTH, NULL);
6183}
6184
6185ALIAS (clear_bgp_external_soft,
6186 clear_bgp_ipv6_external_soft_cmd,
6187 "clear bgp ipv6 external soft",
6188 CLEAR_STR
6189 BGP_STR
6190 "Address family\n"
6191 "Clear all external peers\n"
6192 "Soft reconfig\n")
6193
6194DEFUN (clear_ip_bgp_as_soft,
6195 clear_ip_bgp_as_soft_cmd,
6196 "clear ip bgp <1-65535> soft",
6197 CLEAR_STR
6198 IP_STR
6199 BGP_STR
6200 "Clear peers with the AS number\n"
6201 "Soft reconfig\n")
6202{
6203 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6204 BGP_CLEAR_SOFT_BOTH, argv[0]);
6205}
6206
6207DEFUN (clear_ip_bgp_as_ipv4_soft,
6208 clear_ip_bgp_as_ipv4_soft_cmd,
6209 "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft",
6210 CLEAR_STR
6211 IP_STR
6212 BGP_STR
6213 "Clear peers with the AS number\n"
6214 "Address family\n"
6215 "Address Family Modifier\n"
6216 "Address Family Modifier\n"
6217 "Soft reconfig\n")
6218{
6219 if (strncmp (argv[1], "m", 1) == 0)
6220 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6221 BGP_CLEAR_SOFT_BOTH, argv[0]);
6222
6223 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6224 BGP_CLEAR_SOFT_BOTH, argv[0]);
6225}
6226
6227DEFUN (clear_ip_bgp_as_vpnv4_soft,
6228 clear_ip_bgp_as_vpnv4_soft_cmd,
6229 "clear ip bgp <1-65535> vpnv4 unicast soft",
6230 CLEAR_STR
6231 IP_STR
6232 BGP_STR
6233 "Clear peers with the AS number\n"
6234 "Address family\n"
6235 "Address Family Modifier\n"
6236 "Soft reconfig\n")
6237{
6238 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6239 BGP_CLEAR_SOFT_BOTH, argv[0]);
6240}
6241
6242DEFUN (clear_bgp_as_soft,
6243 clear_bgp_as_soft_cmd,
6244 "clear bgp <1-65535> soft",
6245 CLEAR_STR
6246 BGP_STR
6247 "Clear peers with the AS number\n"
6248 "Soft reconfig\n")
6249{
6250 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6251 BGP_CLEAR_SOFT_BOTH, argv[0]);
6252}
6253
6254ALIAS (clear_bgp_as_soft,
6255 clear_bgp_ipv6_as_soft_cmd,
6256 "clear bgp ipv6 <1-65535> soft",
6257 CLEAR_STR
6258 BGP_STR
6259 "Address family\n"
6260 "Clear peers with the AS number\n"
6261 "Soft reconfig\n")
6262
paulfee0f4c2004-09-13 05:12:46 +00006263/* RS-client soft reconfiguration. */
6264#ifdef HAVE_IPV6
6265DEFUN (clear_bgp_all_rsclient,
6266 clear_bgp_all_rsclient_cmd,
6267 "clear bgp * rsclient",
6268 CLEAR_STR
6269 BGP_STR
6270 "Clear all peers\n"
6271 "Soft reconfig for rsclient RIB\n")
6272{
6273 if (argc == 1)
6274 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6275 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6276
6277 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6278 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6279}
6280
6281ALIAS (clear_bgp_all_rsclient,
6282 clear_bgp_ipv6_all_rsclient_cmd,
6283 "clear bgp ipv6 * rsclient",
6284 CLEAR_STR
6285 BGP_STR
6286 "Address family\n"
6287 "Clear all peers\n"
6288 "Soft reconfig for rsclient RIB\n")
6289
6290ALIAS (clear_bgp_all_rsclient,
6291 clear_bgp_instance_all_rsclient_cmd,
6292 "clear bgp view WORD * rsclient",
6293 CLEAR_STR
6294 BGP_STR
6295 "BGP view\n"
6296 "view name\n"
6297 "Clear all peers\n"
6298 "Soft reconfig for rsclient RIB\n")
6299
6300ALIAS (clear_bgp_all_rsclient,
6301 clear_bgp_ipv6_instance_all_rsclient_cmd,
6302 "clear bgp ipv6 view WORD * rsclient",
6303 CLEAR_STR
6304 BGP_STR
6305 "Address family\n"
6306 "BGP view\n"
6307 "view name\n"
6308 "Clear all peers\n"
6309 "Soft reconfig for rsclient RIB\n")
6310#endif /* HAVE_IPV6 */
6311
6312DEFUN (clear_ip_bgp_all_rsclient,
6313 clear_ip_bgp_all_rsclient_cmd,
6314 "clear ip bgp * rsclient",
6315 CLEAR_STR
6316 IP_STR
6317 BGP_STR
6318 "Clear all peers\n"
6319 "Soft reconfig for rsclient RIB\n")
6320{
6321 if (argc == 1)
6322 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6323 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6324
6325 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6326 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6327}
6328
6329ALIAS (clear_ip_bgp_all_rsclient,
6330 clear_ip_bgp_instance_all_rsclient_cmd,
6331 "clear ip bgp view WORD * rsclient",
6332 CLEAR_STR
6333 IP_STR
6334 BGP_STR
6335 "BGP view\n"
6336 "view name\n"
6337 "Clear all peers\n"
6338 "Soft reconfig for rsclient RIB\n")
6339
6340#ifdef HAVE_IPV6
6341DEFUN (clear_bgp_peer_rsclient,
6342 clear_bgp_peer_rsclient_cmd,
6343 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
6344 CLEAR_STR
6345 BGP_STR
6346 "BGP neighbor IP address to clear\n"
6347 "BGP IPv6 neighbor to clear\n"
6348 "Soft reconfig for rsclient RIB\n")
6349{
6350 if (argc == 2)
6351 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
6352 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6353
6354 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6355 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6356}
6357
6358ALIAS (clear_bgp_peer_rsclient,
6359 clear_bgp_ipv6_peer_rsclient_cmd,
6360 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
6361 CLEAR_STR
6362 BGP_STR
6363 "Address family\n"
6364 "BGP neighbor IP address to clear\n"
6365 "BGP IPv6 neighbor to clear\n"
6366 "Soft reconfig for rsclient RIB\n")
6367
6368ALIAS (clear_bgp_peer_rsclient,
6369 clear_bgp_instance_peer_rsclient_cmd,
6370 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6371 CLEAR_STR
6372 BGP_STR
6373 "BGP view\n"
6374 "view name\n"
6375 "BGP neighbor IP address to clear\n"
6376 "BGP IPv6 neighbor to clear\n"
6377 "Soft reconfig for rsclient RIB\n")
6378
6379ALIAS (clear_bgp_peer_rsclient,
6380 clear_bgp_ipv6_instance_peer_rsclient_cmd,
6381 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
6382 CLEAR_STR
6383 BGP_STR
6384 "Address family\n"
6385 "BGP view\n"
6386 "view name\n"
6387 "BGP neighbor IP address to clear\n"
6388 "BGP IPv6 neighbor to clear\n"
6389 "Soft reconfig for rsclient RIB\n")
6390#endif /* HAVE_IPV6 */
6391
6392DEFUN (clear_ip_bgp_peer_rsclient,
6393 clear_ip_bgp_peer_rsclient_cmd,
6394 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
6395 CLEAR_STR
6396 IP_STR
6397 BGP_STR
6398 "BGP neighbor IP address to clear\n"
6399 "BGP IPv6 neighbor to clear\n"
6400 "Soft reconfig for rsclient RIB\n")
6401{
6402 if (argc == 2)
6403 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
6404 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6405
6406 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6407 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6408}
6409
6410ALIAS (clear_ip_bgp_peer_rsclient,
6411 clear_ip_bgp_instance_peer_rsclient_cmd,
6412 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6413 CLEAR_STR
6414 IP_STR
6415 BGP_STR
6416 "BGP view\n"
6417 "view name\n"
6418 "BGP neighbor IP address to clear\n"
6419 "BGP IPv6 neighbor to clear\n"
6420 "Soft reconfig for rsclient RIB\n")
6421
6422
paul718e3742002-12-13 20:15:29 +00006423/* Show BGP peer's summary information. */
6424int
6425bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
6426{
6427 struct peer *peer;
6428 struct listnode *nn;
6429 int count = 0;
6430 char timebuf[BGP_UPTIME_LEN];
6431 int len;
6432
6433 /* Header string for each address family. */
6434 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
6435
6436 LIST_LOOP (bgp->peer, peer, nn)
6437 {
6438 if (peer->afc[afi][safi])
6439 {
6440 if (! count)
6441 {
6442 vty_out (vty,
6443 "BGP router identifier %s, local AS number %d%s",
6444 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
6445 vty_out (vty,
6446 "%ld BGP AS-PATH entries%s", aspath_count (),
6447 VTY_NEWLINE);
6448 vty_out (vty,
6449 "%ld BGP community entries%s", community_count (),
6450 VTY_NEWLINE);
6451
6452 if (CHECK_FLAG(bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
6453 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
6454 vty_out (vty, "%s", VTY_NEWLINE);
6455 vty_out (vty, "%s%s", header, VTY_NEWLINE);
6456 }
6457 count++;
6458
6459 len = vty_out (vty, "%s", peer->host);
6460 len = 16 - len;
6461 if (len < 1)
6462 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
6463 else
6464 vty_out (vty, "%*s", len, " ");
6465
hasso3d515fd2005-02-01 21:30:04 +00006466 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00006467
6468 vty_out (vty, "%5d %7d %7d %8d %4d %4ld ",
6469 peer->as,
6470 peer->open_in + peer->update_in + peer->keepalive_in
6471 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
6472 peer->open_out + peer->update_out + peer->keepalive_out
6473 + peer->notify_out + peer->refresh_out
6474 + peer->dynamic_cap_out,
6475 0, 0, peer->obuf->count);
6476
6477 vty_out (vty, "%8s",
6478 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
6479
6480 if (peer->status == Established)
6481 {
6482 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
6483 }
6484 else
6485 {
6486 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
6487 vty_out (vty, " Idle (Admin)");
6488 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
6489 vty_out (vty, " Idle (PfxCt)");
6490 else
6491 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
6492 }
6493
6494 vty_out (vty, "%s", VTY_NEWLINE);
6495 }
6496 }
6497
6498 if (count)
6499 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
6500 count, VTY_NEWLINE);
6501 else
6502 vty_out (vty, "No %s neighbor is configured%s",
6503 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
6504 return CMD_SUCCESS;
6505}
6506
6507int
paulfd79ac92004-10-13 05:06:08 +00006508bgp_show_summary_vty (struct vty *vty, const char *name,
6509 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00006510{
6511 struct bgp *bgp;
6512
6513 if (name)
6514 {
6515 bgp = bgp_lookup_by_name (name);
6516
6517 if (! bgp)
6518 {
6519 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
6520 return CMD_WARNING;
6521 }
6522
6523 bgp_show_summary (vty, bgp, afi, safi);
6524 return CMD_SUCCESS;
6525 }
6526
6527 bgp = bgp_get_default ();
6528
6529 if (bgp)
6530 bgp_show_summary (vty, bgp, afi, safi);
6531
6532 return CMD_SUCCESS;
6533}
6534
6535/* `show ip bgp summary' commands. */
6536DEFUN (show_ip_bgp_summary,
6537 show_ip_bgp_summary_cmd,
6538 "show ip bgp summary",
6539 SHOW_STR
6540 IP_STR
6541 BGP_STR
6542 "Summary of BGP neighbor status\n")
6543{
6544 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
6545}
6546
6547DEFUN (show_ip_bgp_instance_summary,
6548 show_ip_bgp_instance_summary_cmd,
6549 "show ip bgp view WORD summary",
6550 SHOW_STR
6551 IP_STR
6552 BGP_STR
6553 "BGP view\n"
6554 "View name\n"
6555 "Summary of BGP neighbor status\n")
6556{
6557 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
6558}
6559
6560DEFUN (show_ip_bgp_ipv4_summary,
6561 show_ip_bgp_ipv4_summary_cmd,
6562 "show ip bgp ipv4 (unicast|multicast) summary",
6563 SHOW_STR
6564 IP_STR
6565 BGP_STR
6566 "Address family\n"
6567 "Address Family modifier\n"
6568 "Address Family modifier\n"
6569 "Summary of BGP neighbor status\n")
6570{
6571 if (strncmp (argv[0], "m", 1) == 0)
6572 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
6573
6574 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
6575}
6576
6577DEFUN (show_ip_bgp_instance_ipv4_summary,
6578 show_ip_bgp_instance_ipv4_summary_cmd,
6579 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
6580 SHOW_STR
6581 IP_STR
6582 BGP_STR
6583 "BGP view\n"
6584 "View name\n"
6585 "Address family\n"
6586 "Address Family modifier\n"
6587 "Address Family modifier\n"
6588 "Summary of BGP neighbor status\n")
6589{
6590 if (strncmp (argv[1], "m", 1) == 0)
6591 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
6592 else
6593 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
6594}
6595
6596DEFUN (show_ip_bgp_vpnv4_all_summary,
6597 show_ip_bgp_vpnv4_all_summary_cmd,
6598 "show ip bgp vpnv4 all summary",
6599 SHOW_STR
6600 IP_STR
6601 BGP_STR
6602 "Display VPNv4 NLRI specific information\n"
6603 "Display information about all VPNv4 NLRIs\n"
6604 "Summary of BGP neighbor status\n")
6605{
6606 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
6607}
6608
6609DEFUN (show_ip_bgp_vpnv4_rd_summary,
6610 show_ip_bgp_vpnv4_rd_summary_cmd,
6611 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
6612 SHOW_STR
6613 IP_STR
6614 BGP_STR
6615 "Display VPNv4 NLRI specific information\n"
6616 "Display information for a route distinguisher\n"
6617 "VPN Route Distinguisher\n"
6618 "Summary of BGP neighbor status\n")
6619{
6620 int ret;
6621 struct prefix_rd prd;
6622
6623 ret = str2prefix_rd (argv[0], &prd);
6624 if (! ret)
6625 {
6626 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
6627 return CMD_WARNING;
6628 }
6629
6630 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
6631}
6632
6633#ifdef HAVE_IPV6
6634DEFUN (show_bgp_summary,
6635 show_bgp_summary_cmd,
6636 "show bgp summary",
6637 SHOW_STR
6638 BGP_STR
6639 "Summary of BGP neighbor status\n")
6640{
6641 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
6642}
6643
6644DEFUN (show_bgp_instance_summary,
6645 show_bgp_instance_summary_cmd,
6646 "show bgp view WORD summary",
6647 SHOW_STR
6648 BGP_STR
6649 "BGP view\n"
6650 "View name\n"
6651 "Summary of BGP neighbor status\n")
6652{
6653 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
6654}
6655
6656ALIAS (show_bgp_summary,
6657 show_bgp_ipv6_summary_cmd,
6658 "show bgp ipv6 summary",
6659 SHOW_STR
6660 BGP_STR
6661 "Address family\n"
6662 "Summary of BGP neighbor status\n")
6663
6664ALIAS (show_bgp_instance_summary,
6665 show_bgp_instance_ipv6_summary_cmd,
6666 "show bgp view WORD ipv6 summary",
6667 SHOW_STR
6668 BGP_STR
6669 "BGP view\n"
6670 "View name\n"
6671 "Address family\n"
6672 "Summary of BGP neighbor status\n")
6673
6674/* old command */
6675DEFUN (show_ipv6_bgp_summary,
6676 show_ipv6_bgp_summary_cmd,
6677 "show ipv6 bgp summary",
6678 SHOW_STR
6679 IPV6_STR
6680 BGP_STR
6681 "Summary of BGP neighbor status\n")
6682{
6683 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
6684}
6685
6686/* old command */
6687DEFUN (show_ipv6_mbgp_summary,
6688 show_ipv6_mbgp_summary_cmd,
6689 "show ipv6 mbgp summary",
6690 SHOW_STR
6691 IPV6_STR
6692 MBGP_STR
6693 "Summary of BGP neighbor status\n")
6694{
6695 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
6696}
6697#endif /* HAVE_IPV6 */
6698
paulfd79ac92004-10-13 05:06:08 +00006699const char *
hasso538621f2004-05-21 09:31:30 +00006700afi_safi_print (afi_t afi, safi_t safi)
6701{
6702 if (afi == AFI_IP && safi == SAFI_UNICAST)
6703 return "IPv4 Unicast";
6704 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
6705 return "IPv4 Multicast";
6706 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
6707 return "VPNv4 Unicast";
6708 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
6709 return "IPv6 Unicast";
6710 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
6711 return "IPv6 Multicast";
6712 else
6713 return "Unknown";
6714}
6715
paul718e3742002-12-13 20:15:29 +00006716/* Show BGP peer's information. */
6717enum show_type
6718{
6719 show_all,
6720 show_peer
6721};
6722
6723void
6724bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
6725 afi_t afi, safi_t safi,
6726 u_int16_t adv_smcap, u_int16_t adv_rmcap,
6727 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
6728{
6729 /* Send-Mode */
6730 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
6731 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
6732 {
6733 vty_out (vty, " Send-mode: ");
6734 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
6735 vty_out (vty, "advertised");
6736 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
6737 vty_out (vty, "%sreceived",
6738 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
6739 ", " : "");
6740 vty_out (vty, "%s", VTY_NEWLINE);
6741 }
6742
6743 /* Receive-Mode */
6744 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
6745 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
6746 {
6747 vty_out (vty, " Receive-mode: ");
6748 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
6749 vty_out (vty, "advertised");
6750 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
6751 vty_out (vty, "%sreceived",
6752 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
6753 ", " : "");
6754 vty_out (vty, "%s", VTY_NEWLINE);
6755 }
6756}
6757
6758void
6759bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
6760{
6761 struct bgp_filter *filter;
6762 char orf_pfx_name[BUFSIZ];
6763 int orf_pfx_count;
6764
6765 filter = &p->filter[afi][safi];
6766
hasso538621f2004-05-21 09:31:30 +00006767 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00006768 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00006769
paul718e3742002-12-13 20:15:29 +00006770 if (p->af_group[afi][safi])
6771 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
6772
6773 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
6774 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
6775 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
6776 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
6777 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
6778 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
6779 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
6780
6781 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
6782 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
6783 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
6784 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
6785 {
6786 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
6787 ORF_TYPE_PREFIX, VTY_NEWLINE);
6788 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
6789 PEER_CAP_ORF_PREFIX_SM_ADV,
6790 PEER_CAP_ORF_PREFIX_RM_ADV,
6791 PEER_CAP_ORF_PREFIX_SM_RCV,
6792 PEER_CAP_ORF_PREFIX_RM_RCV);
6793 }
6794 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
6795 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
6796 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
6797 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
6798 {
6799 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
6800 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
6801 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
6802 PEER_CAP_ORF_PREFIX_SM_ADV,
6803 PEER_CAP_ORF_PREFIX_RM_ADV,
6804 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
6805 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
6806 }
6807
6808 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
6809 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
6810
6811 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
6812 || orf_pfx_count)
6813 {
6814 vty_out (vty, " Outbound Route Filter (ORF):");
6815 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
6816 vty_out (vty, " sent;");
6817 if (orf_pfx_count)
6818 vty_out (vty, " received (%d entries)", orf_pfx_count);
6819 vty_out (vty, "%s", VTY_NEWLINE);
6820 }
6821 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
6822 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
6823
6824 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
6825 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
6826 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
6827 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
6828 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
6829 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
6830 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
6831 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
6832 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
6833 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
6834 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
6835 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
6836 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
6837 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
6838 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
6839 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
6840 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
6841 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
6842 {
6843 vty_out (vty, " Community attribute sent to this neighbor");
6844 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
6845 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00006846 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006847 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00006848 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006849 else
hasso538621f2004-05-21 09:31:30 +00006850 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006851 }
6852 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
6853 {
6854 vty_out (vty, " Default information originate,");
6855
6856 if (p->default_rmap[afi][safi].name)
6857 vty_out (vty, " default route-map %s%s,",
6858 p->default_rmap[afi][safi].map ? "*" : "",
6859 p->default_rmap[afi][safi].name);
6860 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
6861 vty_out (vty, " default sent%s", VTY_NEWLINE);
6862 else
6863 vty_out (vty, " default not sent%s", VTY_NEWLINE);
6864 }
6865
6866 if (filter->plist[FILTER_IN].name
6867 || filter->dlist[FILTER_IN].name
6868 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00006869 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00006870 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
6871 if (filter->plist[FILTER_OUT].name
6872 || filter->dlist[FILTER_OUT].name
6873 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00006874 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00006875 || filter->usmap.name)
6876 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00006877 if (filter->map[RMAP_IMPORT].name)
6878 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
6879 if (filter->map[RMAP_EXPORT].name)
6880 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006881
6882 /* prefix-list */
6883 if (filter->plist[FILTER_IN].name)
6884 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
6885 filter->plist[FILTER_IN].plist ? "*" : "",
6886 filter->plist[FILTER_IN].name,
6887 VTY_NEWLINE);
6888 if (filter->plist[FILTER_OUT].name)
6889 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
6890 filter->plist[FILTER_OUT].plist ? "*" : "",
6891 filter->plist[FILTER_OUT].name,
6892 VTY_NEWLINE);
6893
6894 /* distribute-list */
6895 if (filter->dlist[FILTER_IN].name)
6896 vty_out (vty, " Incoming update network filter list is %s%s%s",
6897 filter->dlist[FILTER_IN].alist ? "*" : "",
6898 filter->dlist[FILTER_IN].name,
6899 VTY_NEWLINE);
6900 if (filter->dlist[FILTER_OUT].name)
6901 vty_out (vty, " Outgoing update network filter list is %s%s%s",
6902 filter->dlist[FILTER_OUT].alist ? "*" : "",
6903 filter->dlist[FILTER_OUT].name,
6904 VTY_NEWLINE);
6905
6906 /* filter-list. */
6907 if (filter->aslist[FILTER_IN].name)
6908 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
6909 filter->aslist[FILTER_IN].aslist ? "*" : "",
6910 filter->aslist[FILTER_IN].name,
6911 VTY_NEWLINE);
6912 if (filter->aslist[FILTER_OUT].name)
6913 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
6914 filter->aslist[FILTER_OUT].aslist ? "*" : "",
6915 filter->aslist[FILTER_OUT].name,
6916 VTY_NEWLINE);
6917
6918 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00006919 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00006920 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00006921 filter->map[RMAP_IN].map ? "*" : "",
6922 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00006923 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00006924 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00006925 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00006926 filter->map[RMAP_OUT].map ? "*" : "",
6927 filter->map[RMAP_OUT].name,
6928 VTY_NEWLINE);
6929 if (filter->map[RMAP_IMPORT].name)
6930 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
6931 filter->map[RMAP_IMPORT].map ? "*" : "",
6932 filter->map[RMAP_IMPORT].name,
6933 VTY_NEWLINE);
6934 if (filter->map[RMAP_EXPORT].name)
6935 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
6936 filter->map[RMAP_EXPORT].map ? "*" : "",
6937 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00006938 VTY_NEWLINE);
6939
6940 /* unsuppress-map */
6941 if (filter->usmap.name)
6942 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
6943 filter->usmap.map ? "*" : "",
6944 filter->usmap.name, VTY_NEWLINE);
6945
6946 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00006947 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
6948
paul718e3742002-12-13 20:15:29 +00006949 /* Maximum prefix */
6950 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
6951 {
hasso0a486e52005-02-01 20:57:17 +00006952 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00006953 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00006954 ? " (warning-only)" : "", VTY_NEWLINE);
6955 vty_out (vty, " Threshold for warning message %d%%",
6956 p->pmax_threshold[afi][safi]);
6957 if (p->pmax_restart[afi][safi])
6958 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
6959 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006960 }
paul718e3742002-12-13 20:15:29 +00006961
6962 vty_out (vty, "%s", VTY_NEWLINE);
6963}
6964
6965void
6966bgp_show_peer (struct vty *vty, struct peer *p)
6967{
6968 struct bgp *bgp;
6969 char buf1[BUFSIZ];
6970 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00006971 afi_t afi;
6972 safi_t safi;
paul718e3742002-12-13 20:15:29 +00006973
6974 bgp = p->bgp;
6975
6976 /* Configured IP address. */
6977 vty_out (vty, "BGP neighbor is %s, ", p->host);
6978 vty_out (vty, "remote AS %d, ", p->as);
6979 vty_out (vty, "local AS %d%s, ",
6980 p->change_local_as ? p->change_local_as : p->local_as,
6981 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
6982 " no-prepend" : "");
6983 vty_out (vty, "%s link%s",
6984 p->as == p->local_as ? "internal" : "external",
6985 VTY_NEWLINE);
6986
6987 /* Description. */
6988 if (p->desc)
6989 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
6990
6991 /* Peer-group */
6992 if (p->group)
6993 vty_out (vty, " Member of peer-group %s for session parameters%s",
6994 p->group->name, VTY_NEWLINE);
6995
6996 /* Administrative shutdown. */
6997 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
6998 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
6999
7000 /* BGP Version. */
7001 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00007002 vty_out (vty, ", remote router ID %s%s",
7003 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
7004 VTY_NEWLINE);
7005
7006 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00007007 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
7008 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00007009 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
7010
7011 /* Status. */
7012 vty_out (vty, " BGP state = %s",
7013 LOOKUP (bgp_status_msg, p->status));
7014 if (p->status == Established)
7015 vty_out (vty, ", up for %8s",
7016 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00007017 else if (p->status == Active)
7018 {
7019 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7020 vty_out (vty, " (passive)");
7021 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7022 vty_out (vty, " (NSF passive)");
7023 }
paul718e3742002-12-13 20:15:29 +00007024 vty_out (vty, "%s", VTY_NEWLINE);
7025
7026 /* read timer */
7027 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7028
7029 /* Configured timer values. */
7030 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7031 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7032 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7033 {
7034 vty_out (vty, " Configured hold time is %d", p->holdtime);
7035 vty_out (vty, ", keepalive interval is %d seconds%s",
7036 p->keepalive, VTY_NEWLINE);
7037 }
hasso93406d82005-02-02 14:40:33 +00007038
paul718e3742002-12-13 20:15:29 +00007039 /* Capability. */
7040 if (p->status == Established)
7041 {
hasso538621f2004-05-21 09:31:30 +00007042 if (p->cap
paul718e3742002-12-13 20:15:29 +00007043 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7044 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7045 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7046 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7047#ifdef HAVE_IPV6
7048 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7049 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7050 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7051 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
7052#endif /* HAVE_IPV6 */
7053 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7054 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7055 {
7056 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7057
7058 /* Dynamic */
7059 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
7060 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7061 {
7062 vty_out (vty, " Dynamic:");
7063 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7064 vty_out (vty, " advertised");
7065 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00007066 vty_out (vty, " %sreceived",
7067 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007068 vty_out (vty, "%s", VTY_NEWLINE);
7069 }
7070
7071 /* Route Refresh */
7072 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
7073 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7074 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
7075 {
7076 vty_out (vty, " Route refresh:");
7077 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
7078 vty_out (vty, " advertised");
7079 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7080 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00007081 vty_out (vty, " %sreceived(%s)",
7082 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
7083 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
7084 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
7085 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
7086
paul718e3742002-12-13 20:15:29 +00007087 vty_out (vty, "%s", VTY_NEWLINE);
7088 }
7089
hasso538621f2004-05-21 09:31:30 +00007090 /* Multiprotocol Extensions */
7091 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7092 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7093 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00007094 {
hasso538621f2004-05-21 09:31:30 +00007095 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
7096 if (p->afc_adv[afi][safi])
7097 vty_out (vty, " advertised");
7098 if (p->afc_recv[afi][safi])
7099 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
7100 vty_out (vty, "%s", VTY_NEWLINE);
7101 }
7102
7103 /* Gracefull Restart */
7104 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7105 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007106 {
hasso538621f2004-05-21 09:31:30 +00007107 vty_out (vty, " Graceful Restart Capabilty:");
7108 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007109 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00007110 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
7111 vty_out (vty, " %sreceived",
7112 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007113 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007114
7115 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00007116 {
hasso538621f2004-05-21 09:31:30 +00007117 int restart_af_count = 0;
7118
7119 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00007120 p->v_gr_restart, VTY_NEWLINE);
7121 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007122
7123 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7124 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7125 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
7126 {
hasso93406d82005-02-02 14:40:33 +00007127 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
7128 afi_safi_print (afi, safi),
7129 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
7130 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00007131 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00007132 }
hasso538621f2004-05-21 09:31:30 +00007133 if (! restart_af_count)
7134 vty_out (vty, "none");
7135 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007136 }
paul718e3742002-12-13 20:15:29 +00007137 }
paul718e3742002-12-13 20:15:29 +00007138 }
7139 }
7140
hasso93406d82005-02-02 14:40:33 +00007141 /* graceful restart information */
7142 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7143 || p->t_gr_restart
7144 || p->t_gr_stale)
7145 {
7146 int eor_send_af_count = 0;
7147 int eor_receive_af_count = 0;
7148
7149 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
7150 if (p->status == Established)
7151 {
7152 vty_out (vty, " End-of-RIB send: ");
7153 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7154 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7155 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
7156 {
7157 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
7158 afi_safi_print (afi, safi));
7159 eor_send_af_count++;
7160 }
7161 vty_out (vty, "%s", VTY_NEWLINE);
7162
7163 vty_out (vty, " End-of-RIB received: ");
7164 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7165 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7166 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
7167 {
7168 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
7169 afi_safi_print (afi, safi));
7170 eor_receive_af_count++;
7171 }
7172 vty_out (vty, "%s", VTY_NEWLINE);
7173 }
7174
7175 if (p->t_gr_restart)
7176 {
7177 vty_out (vty, " The remaining time of restart timer is %ld%s",
7178 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
7179 }
7180 if (p->t_gr_stale)
7181 {
7182 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
7183 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
7184 }
7185 }
7186
paul718e3742002-12-13 20:15:29 +00007187 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00007188 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
7189 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
7190 vty_out (vty, " Outq depth is %ld%s", p->obuf->count, VTY_NEWLINE);
7191 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
7192 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
7193 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
7194 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
7195 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
7196 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
7197 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
7198 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
7199 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
7200 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
7201 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007202
7203 /* advertisement-interval */
7204 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
7205 p->v_routeadv, VTY_NEWLINE);
7206
7207 /* Update-source. */
7208 if (p->update_if || p->update_source)
7209 {
7210 vty_out (vty, " Update source is ");
7211 if (p->update_if)
7212 vty_out (vty, "%s", p->update_if);
7213 else if (p->update_source)
7214 vty_out (vty, "%s",
7215 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
7216 vty_out (vty, "%s", VTY_NEWLINE);
7217 }
7218
7219 /* Default weight */
7220 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
7221 vty_out (vty, " Default weight %d%s", p->weight,
7222 VTY_NEWLINE);
7223
7224 vty_out (vty, "%s", VTY_NEWLINE);
7225
7226 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00007227 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7228 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7229 if (p->afc[afi][safi])
7230 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00007231
7232 vty_out (vty, " Connections established %d; dropped %d%s",
7233 p->established, p->dropped,
7234 VTY_NEWLINE);
7235
hassoe0701b72004-05-20 09:19:34 +00007236 if (! p->dropped)
7237 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
7238 else
7239 vty_out (vty, " Last reset %s, due to %s%s",
7240 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
7241 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00007242
paul718e3742002-12-13 20:15:29 +00007243 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7244 {
7245 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00007246
7247 if (p->t_pmax_restart)
7248 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
7249 p->host, thread_timer_remain_second (p->t_pmax_restart),
7250 VTY_NEWLINE);
7251 else
7252 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
7253 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007254 }
7255
7256 /* EBGP Multihop */
7257 if (peer_sort (p) != BGP_PEER_IBGP && p->ttl > 1)
7258 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7259 p->ttl, VTY_NEWLINE);
7260
7261 /* Local address. */
7262 if (p->su_local)
7263 {
hasso93406d82005-02-02 14:40:33 +00007264 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00007265 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
7266 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00007267 VTY_NEWLINE);
7268 }
7269
7270 /* Remote address. */
7271 if (p->su_remote)
7272 {
7273 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
7274 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
7275 ntohs (p->su_remote->sin.sin_port),
7276 VTY_NEWLINE);
7277 }
7278
7279 /* Nexthop display. */
7280 if (p->su_local)
7281 {
7282 vty_out (vty, "Nexthop: %s%s",
7283 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
7284 VTY_NEWLINE);
7285#ifdef HAVE_IPV6
7286 vty_out (vty, "Nexthop global: %s%s",
7287 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
7288 VTY_NEWLINE);
7289 vty_out (vty, "Nexthop local: %s%s",
7290 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
7291 VTY_NEWLINE);
7292 vty_out (vty, "BGP connection: %s%s",
7293 p->shared_network ? "shared network" : "non shared network",
7294 VTY_NEWLINE);
7295#endif /* HAVE_IPV6 */
7296 }
7297
7298 /* Timer information. */
7299 if (p->t_start)
7300 vty_out (vty, "Next start timer due in %ld seconds%s",
7301 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
7302 if (p->t_connect)
7303 vty_out (vty, "Next connect timer due in %ld seconds%s",
7304 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
7305
7306 vty_out (vty, "Read thread: %s Write thread: %s%s",
7307 p->t_read ? "on" : "off",
7308 p->t_write ? "on" : "off",
7309 VTY_NEWLINE);
7310
7311 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
7312 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
7313 bgp_capability_vty_out (vty, p);
7314
7315 vty_out (vty, "%s", VTY_NEWLINE);
7316}
7317
7318int
7319bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
7320 enum show_type type, union sockunion *su)
7321{
7322 struct listnode *nn;
7323 struct peer *peer;
7324 int find = 0;
7325
7326 LIST_LOOP (bgp->peer, peer, nn)
7327 {
7328 switch (type)
7329 {
7330 case show_all:
7331 bgp_show_peer (vty, peer);
7332 break;
7333 case show_peer:
7334 if (sockunion_same (&peer->su, su))
7335 {
7336 find = 1;
7337 bgp_show_peer (vty, peer);
7338 }
7339 break;
7340 }
7341 }
7342
7343 if (type == show_peer && ! find)
7344 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
7345
7346 return CMD_SUCCESS;
7347}
7348
7349int
paulfd79ac92004-10-13 05:06:08 +00007350bgp_show_neighbor_vty (struct vty *vty, const char *name,
7351 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00007352{
7353 int ret;
7354 struct bgp *bgp;
7355 union sockunion su;
7356
7357 if (ip_str)
7358 {
7359 ret = str2sockunion (ip_str, &su);
7360 if (ret < 0)
7361 {
7362 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
7363 return CMD_WARNING;
7364 }
7365 }
7366
7367 if (name)
7368 {
7369 bgp = bgp_lookup_by_name (name);
7370
7371 if (! bgp)
7372 {
7373 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7374 return CMD_WARNING;
7375 }
7376
7377 bgp_show_neighbor (vty, bgp, type, &su);
7378
7379 return CMD_SUCCESS;
7380 }
7381
7382 bgp = bgp_get_default ();
7383
7384 if (bgp)
7385 bgp_show_neighbor (vty, bgp, type, &su);
7386
7387 return CMD_SUCCESS;
7388}
7389
7390/* "show ip bgp neighbors" commands. */
7391DEFUN (show_ip_bgp_neighbors,
7392 show_ip_bgp_neighbors_cmd,
7393 "show ip bgp neighbors",
7394 SHOW_STR
7395 IP_STR
7396 BGP_STR
7397 "Detailed information on TCP and BGP neighbor connections\n")
7398{
7399 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
7400}
7401
7402ALIAS (show_ip_bgp_neighbors,
7403 show_ip_bgp_ipv4_neighbors_cmd,
7404 "show ip bgp ipv4 (unicast|multicast) neighbors",
7405 SHOW_STR
7406 IP_STR
7407 BGP_STR
7408 "Address family\n"
7409 "Address Family modifier\n"
7410 "Address Family modifier\n"
7411 "Detailed information on TCP and BGP neighbor connections\n")
7412
7413ALIAS (show_ip_bgp_neighbors,
7414 show_ip_bgp_vpnv4_all_neighbors_cmd,
7415 "show ip bgp vpnv4 all neighbors",
7416 SHOW_STR
7417 IP_STR
7418 BGP_STR
7419 "Display VPNv4 NLRI specific information\n"
7420 "Display information about all VPNv4 NLRIs\n"
7421 "Detailed information on TCP and BGP neighbor connections\n")
7422
7423ALIAS (show_ip_bgp_neighbors,
7424 show_ip_bgp_vpnv4_rd_neighbors_cmd,
7425 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
7426 SHOW_STR
7427 IP_STR
7428 BGP_STR
7429 "Display VPNv4 NLRI specific information\n"
7430 "Display information for a route distinguisher\n"
7431 "VPN Route Distinguisher\n"
7432 "Detailed information on TCP and BGP neighbor connections\n")
7433
7434ALIAS (show_ip_bgp_neighbors,
7435 show_bgp_neighbors_cmd,
7436 "show bgp neighbors",
7437 SHOW_STR
7438 BGP_STR
7439 "Detailed information on TCP and BGP neighbor connections\n")
7440
7441ALIAS (show_ip_bgp_neighbors,
7442 show_bgp_ipv6_neighbors_cmd,
7443 "show bgp ipv6 neighbors",
7444 SHOW_STR
7445 BGP_STR
7446 "Address family\n"
7447 "Detailed information on TCP and BGP neighbor connections\n")
7448
7449DEFUN (show_ip_bgp_neighbors_peer,
7450 show_ip_bgp_neighbors_peer_cmd,
7451 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
7452 SHOW_STR
7453 IP_STR
7454 BGP_STR
7455 "Detailed information on TCP and BGP neighbor connections\n"
7456 "Neighbor to display information about\n"
7457 "Neighbor to display information about\n")
7458{
7459 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
7460}
7461
7462ALIAS (show_ip_bgp_neighbors_peer,
7463 show_ip_bgp_ipv4_neighbors_peer_cmd,
7464 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
7465 SHOW_STR
7466 IP_STR
7467 BGP_STR
7468 "Address family\n"
7469 "Address Family modifier\n"
7470 "Address Family modifier\n"
7471 "Detailed information on TCP and BGP neighbor connections\n"
7472 "Neighbor to display information about\n"
7473 "Neighbor to display information about\n")
7474
7475ALIAS (show_ip_bgp_neighbors_peer,
7476 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
7477 "show ip bgp vpnv4 all neighbors A.B.C.D",
7478 SHOW_STR
7479 IP_STR
7480 BGP_STR
7481 "Display VPNv4 NLRI specific information\n"
7482 "Display information about all VPNv4 NLRIs\n"
7483 "Detailed information on TCP and BGP neighbor connections\n"
7484 "Neighbor to display information about\n")
7485
7486ALIAS (show_ip_bgp_neighbors_peer,
7487 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
7488 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
7489 SHOW_STR
7490 IP_STR
7491 BGP_STR
7492 "Display VPNv4 NLRI specific information\n"
7493 "Display information about all VPNv4 NLRIs\n"
7494 "Detailed information on TCP and BGP neighbor connections\n"
7495 "Neighbor to display information about\n")
7496
7497ALIAS (show_ip_bgp_neighbors_peer,
7498 show_bgp_neighbors_peer_cmd,
7499 "show bgp neighbors (A.B.C.D|X:X::X:X)",
7500 SHOW_STR
7501 BGP_STR
7502 "Detailed information on TCP and BGP neighbor connections\n"
7503 "Neighbor to display information about\n"
7504 "Neighbor to display information about\n")
7505
7506ALIAS (show_ip_bgp_neighbors_peer,
7507 show_bgp_ipv6_neighbors_peer_cmd,
7508 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
7509 SHOW_STR
7510 BGP_STR
7511 "Address family\n"
7512 "Detailed information on TCP and BGP neighbor connections\n"
7513 "Neighbor to display information about\n"
7514 "Neighbor to display information about\n")
7515
7516DEFUN (show_ip_bgp_instance_neighbors,
7517 show_ip_bgp_instance_neighbors_cmd,
7518 "show ip bgp view WORD neighbors",
7519 SHOW_STR
7520 IP_STR
7521 BGP_STR
7522 "BGP view\n"
7523 "View name\n"
7524 "Detailed information on TCP and BGP neighbor connections\n")
7525{
7526 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
7527}
7528
paulbb46e942003-10-24 19:02:03 +00007529ALIAS (show_ip_bgp_instance_neighbors,
7530 show_bgp_instance_neighbors_cmd,
7531 "show bgp view WORD neighbors",
7532 SHOW_STR
7533 BGP_STR
7534 "BGP view\n"
7535 "View name\n"
7536 "Detailed information on TCP and BGP neighbor connections\n")
7537
7538ALIAS (show_ip_bgp_instance_neighbors,
7539 show_bgp_instance_ipv6_neighbors_cmd,
7540 "show bgp view WORD ipv6 neighbors",
7541 SHOW_STR
7542 BGP_STR
7543 "BGP view\n"
7544 "View name\n"
7545 "Address family\n"
7546 "Detailed information on TCP and BGP neighbor connections\n")
7547
paul718e3742002-12-13 20:15:29 +00007548DEFUN (show_ip_bgp_instance_neighbors_peer,
7549 show_ip_bgp_instance_neighbors_peer_cmd,
7550 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
7551 SHOW_STR
7552 IP_STR
7553 BGP_STR
7554 "BGP view\n"
7555 "View name\n"
7556 "Detailed information on TCP and BGP neighbor connections\n"
7557 "Neighbor to display information about\n"
7558 "Neighbor to display information about\n")
7559{
7560 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
7561}
paulbb46e942003-10-24 19:02:03 +00007562
7563ALIAS (show_ip_bgp_instance_neighbors_peer,
7564 show_bgp_instance_neighbors_peer_cmd,
7565 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
7566 SHOW_STR
7567 BGP_STR
7568 "BGP view\n"
7569 "View name\n"
7570 "Detailed information on TCP and BGP neighbor connections\n"
7571 "Neighbor to display information about\n"
7572 "Neighbor to display information about\n")
7573
7574ALIAS (show_ip_bgp_instance_neighbors_peer,
7575 show_bgp_instance_ipv6_neighbors_peer_cmd,
7576 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
7577 SHOW_STR
7578 BGP_STR
7579 "BGP view\n"
7580 "View name\n"
7581 "Address family\n"
7582 "Detailed information on TCP and BGP neighbor connections\n"
7583 "Neighbor to display information about\n"
7584 "Neighbor to display information about\n")
7585
paul718e3742002-12-13 20:15:29 +00007586/* Show BGP's AS paths internal data. There are both `show ip bgp
7587 paths' and `show ip mbgp paths'. Those functions results are the
7588 same.*/
7589DEFUN (show_ip_bgp_paths,
7590 show_ip_bgp_paths_cmd,
7591 "show ip bgp paths",
7592 SHOW_STR
7593 IP_STR
7594 BGP_STR
7595 "Path information\n")
7596{
7597 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
7598 aspath_print_all_vty (vty);
7599 return CMD_SUCCESS;
7600}
7601
7602DEFUN (show_ip_bgp_ipv4_paths,
7603 show_ip_bgp_ipv4_paths_cmd,
7604 "show ip bgp ipv4 (unicast|multicast) paths",
7605 SHOW_STR
7606 IP_STR
7607 BGP_STR
7608 "Address family\n"
7609 "Address Family modifier\n"
7610 "Address Family modifier\n"
7611 "Path information\n")
7612{
7613 vty_out (vty, "Address Refcnt Path\r\n");
7614 aspath_print_all_vty (vty);
7615
7616 return CMD_SUCCESS;
7617}
7618
7619#include "hash.h"
7620
7621void
7622community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
7623{
7624 struct community *com;
7625
7626 com = (struct community *) backet->data;
7627 vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt,
7628 community_str (com), VTY_NEWLINE);
7629}
7630
7631/* Show BGP's community internal data. */
7632DEFUN (show_ip_bgp_community_info,
7633 show_ip_bgp_community_info_cmd,
7634 "show ip bgp community-info",
7635 SHOW_STR
7636 IP_STR
7637 BGP_STR
7638 "List all bgp community information\n")
7639{
7640 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
7641
7642 hash_iterate (community_hash (),
7643 (void (*) (struct hash_backet *, void *))
7644 community_show_all_iterator,
7645 vty);
7646
7647 return CMD_SUCCESS;
7648}
7649
7650DEFUN (show_ip_bgp_attr_info,
7651 show_ip_bgp_attr_info_cmd,
7652 "show ip bgp attribute-info",
7653 SHOW_STR
7654 IP_STR
7655 BGP_STR
7656 "List all bgp attribute information\n")
7657{
7658 attr_show_all (vty);
7659 return CMD_SUCCESS;
7660}
7661
paulfee0f4c2004-09-13 05:12:46 +00007662int
7663bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
7664 afi_t afi, safi_t safi)
7665{
7666 char timebuf[BGP_UPTIME_LEN];
7667 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00007668 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00007669 struct peer *peer;
7670 struct listnode *nn;
7671 int len;
7672 int count = 0;
7673
7674 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
7675 {
7676 LIST_LOOP (rsclient->group->peer, peer, nn)
7677 {
7678 count++;
7679 bgp_write_rsclient_summary (vty, peer, afi, safi);
7680 }
7681 return count;
7682 }
7683
7684 len = vty_out (vty, "%s", rsclient->host);
7685 len = 16 - len;
7686
7687 if (len < 1)
7688 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7689 else
7690 vty_out (vty, "%*s", len, " ");
7691
hasso3d515fd2005-02-01 21:30:04 +00007692 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00007693
7694 vty_out (vty, "%5d ", rsclient->as);
7695
7696 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
7697 if ( rmname && strlen (rmname) > 13 )
7698 {
7699 sprintf (rmbuf, "%13s", "...");
7700 rmname = strncpy (rmbuf, rmname, 10);
7701 }
7702 else if (! rmname)
7703 rmname = "<none>";
7704 vty_out (vty, " %13s ", rmname);
7705
7706 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
7707 if ( rmname && strlen (rmname) > 13 )
7708 {
7709 sprintf (rmbuf, "%13s", "...");
7710 rmname = strncpy (rmbuf, rmname, 10);
7711 }
7712 else if (! rmname)
7713 rmname = "<none>";
7714 vty_out (vty, " %13s ", rmname);
7715
7716 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
7717
7718 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
7719 vty_out (vty, " Idle (Admin)");
7720 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7721 vty_out (vty, " Idle (PfxCt)");
7722 else
7723 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
7724
7725 vty_out (vty, "%s", VTY_NEWLINE);
7726
7727 return 1;
7728}
7729
7730int
paulfd79ac92004-10-13 05:06:08 +00007731bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
7732 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00007733{
7734 struct peer *peer;
7735 struct listnode *nn;
7736 int count = 0;
7737
7738 /* Header string for each address family. */
7739 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
7740
7741 LIST_LOOP (bgp->rsclient, peer, nn)
7742 {
7743 if (peer->afc[afi][safi] &&
7744 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7745 {
7746 if (! count)
7747 {
7748 vty_out (vty,
7749 "Route Server's BGP router identifier %s%s",
7750 inet_ntoa (bgp->router_id), VTY_NEWLINE);
7751 vty_out (vty,
7752 "Route Server's local AS number %d%s", bgp->as,
7753 VTY_NEWLINE);
7754
7755 vty_out (vty, "%s", VTY_NEWLINE);
7756 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7757 }
7758
7759 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
7760 }
7761 }
7762
7763 if (count)
7764 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
7765 count, VTY_NEWLINE);
7766 else
7767 vty_out (vty, "No %s Route Server Client is configured%s",
7768 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7769
7770 return CMD_SUCCESS;
7771}
7772
7773int
paulfd79ac92004-10-13 05:06:08 +00007774bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
7775 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00007776{
7777 struct bgp *bgp;
7778
7779 if (name)
7780 {
7781 bgp = bgp_lookup_by_name (name);
7782
7783 if (! bgp)
7784 {
7785 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7786 return CMD_WARNING;
7787 }
7788
7789 bgp_show_rsclient_summary (vty, bgp, afi, safi);
7790 return CMD_SUCCESS;
7791 }
7792
7793 bgp = bgp_get_default ();
7794
7795 if (bgp)
7796 bgp_show_rsclient_summary (vty, bgp, afi, safi);
7797
7798 return CMD_SUCCESS;
7799}
7800
7801/* 'show bgp rsclient' commands. */
7802DEFUN (show_ip_bgp_rsclient_summary,
7803 show_ip_bgp_rsclient_summary_cmd,
7804 "show ip bgp rsclient summary",
7805 SHOW_STR
7806 IP_STR
7807 BGP_STR
7808 "Information about Route Server Clients\n"
7809 "Summary of all Route Server Clients\n")
7810{
7811 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7812}
7813
7814DEFUN (show_ip_bgp_instance_rsclient_summary,
7815 show_ip_bgp_instance_rsclient_summary_cmd,
7816 "show ip bgp view WORD rsclient summary",
7817 SHOW_STR
7818 IP_STR
7819 BGP_STR
7820 "BGP view\n"
7821 "View name\n"
7822 "Information about Route Server Clients\n"
7823 "Summary of all Route Server Clients\n")
7824{
7825 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7826}
7827
7828DEFUN (show_ip_bgp_ipv4_rsclient_summary,
7829 show_ip_bgp_ipv4_rsclient_summary_cmd,
7830 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
7831 SHOW_STR
7832 IP_STR
7833 BGP_STR
7834 "Address family\n"
7835 "Address Family modifier\n"
7836 "Address Family modifier\n"
7837 "Information about Route Server Clients\n"
7838 "Summary of all Route Server Clients\n")
7839{
7840 if (strncmp (argv[0], "m", 1) == 0)
7841 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7842
7843 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7844}
7845
7846DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
7847 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
7848 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
7849 SHOW_STR
7850 IP_STR
7851 BGP_STR
7852 "BGP view\n"
7853 "View name\n"
7854 "Address family\n"
7855 "Address Family modifier\n"
7856 "Address Family modifier\n"
7857 "Information about Route Server Clients\n"
7858 "Summary of all Route Server Clients\n")
7859{
7860 if (strncmp (argv[1], "m", 1) == 0)
7861 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7862
7863 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7864}
7865
7866#ifdef HAVE_IPV6
7867DEFUN (show_bgp_rsclient_summary,
7868 show_bgp_rsclient_summary_cmd,
7869 "show bgp rsclient summary",
7870 SHOW_STR
7871 BGP_STR
7872 "Information about Route Server Clients\n"
7873 "Summary of all Route Server Clients\n")
7874{
7875 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7876}
7877
7878DEFUN (show_bgp_instance_rsclient_summary,
7879 show_bgp_instance_rsclient_summary_cmd,
7880 "show bgp view WORD rsclient summary",
7881 SHOW_STR
7882 BGP_STR
7883 "BGP view\n"
7884 "View name\n"
7885 "Information about Route Server Clients\n"
7886 "Summary of all Route Server Clients\n")
7887{
7888 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7889}
7890
7891ALIAS (show_bgp_rsclient_summary,
7892 show_bgp_ipv6_rsclient_summary_cmd,
7893 "show bgp ipv6 rsclient summary",
7894 SHOW_STR
7895 BGP_STR
7896 "Address family\n"
7897 "Information about Route Server Clients\n"
7898 "Summary of all Route Server Clients\n")
7899
7900ALIAS (show_bgp_instance_rsclient_summary,
7901 show_bgp_instance_ipv6_rsclient_summary_cmd,
7902 "show bgp view WORD ipv6 rsclient summary",
7903 SHOW_STR
7904 BGP_STR
7905 "BGP view\n"
7906 "View name\n"
7907 "Address family\n"
7908 "Information about Route Server Clients\n"
7909 "Summary of all Route Server Clients\n")
7910#endif /* HAVE IPV6 */
7911
paul718e3742002-12-13 20:15:29 +00007912/* Redistribute VTY commands. */
7913
7914/* Utility function to convert user input route type string to route
7915 type. */
7916static int
paulfd79ac92004-10-13 05:06:08 +00007917bgp_str2route_type (int afi, const char *str)
paul718e3742002-12-13 20:15:29 +00007918{
7919 if (! str)
7920 return 0;
7921
7922 if (afi == AFI_IP)
7923 {
7924 if (strncmp (str, "k", 1) == 0)
7925 return ZEBRA_ROUTE_KERNEL;
7926 else if (strncmp (str, "c", 1) == 0)
7927 return ZEBRA_ROUTE_CONNECT;
7928 else if (strncmp (str, "s", 1) == 0)
7929 return ZEBRA_ROUTE_STATIC;
7930 else if (strncmp (str, "r", 1) == 0)
7931 return ZEBRA_ROUTE_RIP;
7932 else if (strncmp (str, "o", 1) == 0)
7933 return ZEBRA_ROUTE_OSPF;
7934 }
7935 if (afi == AFI_IP6)
7936 {
7937 if (strncmp (str, "k", 1) == 0)
7938 return ZEBRA_ROUTE_KERNEL;
7939 else if (strncmp (str, "c", 1) == 0)
7940 return ZEBRA_ROUTE_CONNECT;
7941 else if (strncmp (str, "s", 1) == 0)
7942 return ZEBRA_ROUTE_STATIC;
7943 else if (strncmp (str, "r", 1) == 0)
7944 return ZEBRA_ROUTE_RIPNG;
7945 else if (strncmp (str, "o", 1) == 0)
7946 return ZEBRA_ROUTE_OSPF6;
7947 }
7948 return 0;
7949}
7950
7951DEFUN (bgp_redistribute_ipv4,
7952 bgp_redistribute_ipv4_cmd,
7953 "redistribute (connected|kernel|ospf|rip|static)",
7954 "Redistribute information from another routing protocol\n"
7955 "Connected\n"
7956 "Kernel routes\n"
7957 "Open Shurtest Path First (OSPF)\n"
7958 "Routing Information Protocol (RIP)\n"
7959 "Static routes\n")
7960{
7961 int type;
7962
7963 type = bgp_str2route_type (AFI_IP, argv[0]);
7964 if (! type)
7965 {
7966 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
7967 return CMD_WARNING;
7968 }
7969 return bgp_redistribute_set (vty->index, AFI_IP, type);
7970}
7971
7972DEFUN (bgp_redistribute_ipv4_rmap,
7973 bgp_redistribute_ipv4_rmap_cmd,
7974 "redistribute (connected|kernel|ospf|rip|static) route-map WORD",
7975 "Redistribute information from another routing protocol\n"
7976 "Connected\n"
7977 "Kernel routes\n"
7978 "Open Shurtest Path First (OSPF)\n"
7979 "Routing Information Protocol (RIP)\n"
7980 "Static routes\n"
7981 "Route map reference\n"
7982 "Pointer to route-map entries\n")
7983{
7984 int type;
7985
7986 type = bgp_str2route_type (AFI_IP, argv[0]);
7987 if (! type)
7988 {
7989 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
7990 return CMD_WARNING;
7991 }
7992
7993 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
7994 return bgp_redistribute_set (vty->index, AFI_IP, type);
7995}
7996
7997DEFUN (bgp_redistribute_ipv4_metric,
7998 bgp_redistribute_ipv4_metric_cmd,
7999 "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
8000 "Redistribute information from another routing protocol\n"
8001 "Connected\n"
8002 "Kernel routes\n"
8003 "Open Shurtest Path First (OSPF)\n"
8004 "Routing Information Protocol (RIP)\n"
8005 "Static routes\n"
8006 "Metric for redistributed routes\n"
8007 "Default metric\n")
8008{
8009 int type;
8010 u_int32_t metric;
8011
8012 type = bgp_str2route_type (AFI_IP, argv[0]);
8013 if (! type)
8014 {
8015 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8016 return CMD_WARNING;
8017 }
8018 VTY_GET_INTEGER ("metric", metric, argv[1]);
8019
8020 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8021 return bgp_redistribute_set (vty->index, AFI_IP, type);
8022}
8023
8024DEFUN (bgp_redistribute_ipv4_rmap_metric,
8025 bgp_redistribute_ipv4_rmap_metric_cmd,
8026 "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
8027 "Redistribute information from another routing protocol\n"
8028 "Connected\n"
8029 "Kernel routes\n"
8030 "Open Shurtest Path First (OSPF)\n"
8031 "Routing Information Protocol (RIP)\n"
8032 "Static routes\n"
8033 "Route map reference\n"
8034 "Pointer to route-map entries\n"
8035 "Metric for redistributed routes\n"
8036 "Default metric\n")
8037{
8038 int type;
8039 u_int32_t metric;
8040
8041 type = bgp_str2route_type (AFI_IP, argv[0]);
8042 if (! type)
8043 {
8044 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8045 return CMD_WARNING;
8046 }
8047 VTY_GET_INTEGER ("metric", metric, argv[2]);
8048
8049 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8050 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8051 return bgp_redistribute_set (vty->index, AFI_IP, type);
8052}
8053
8054DEFUN (bgp_redistribute_ipv4_metric_rmap,
8055 bgp_redistribute_ipv4_metric_rmap_cmd,
8056 "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
8057 "Redistribute information from another routing protocol\n"
8058 "Connected\n"
8059 "Kernel routes\n"
8060 "Open Shurtest Path First (OSPF)\n"
8061 "Routing Information Protocol (RIP)\n"
8062 "Static routes\n"
8063 "Metric for redistributed routes\n"
8064 "Default metric\n"
8065 "Route map reference\n"
8066 "Pointer to route-map entries\n")
8067{
8068 int type;
8069 u_int32_t metric;
8070
8071 type = bgp_str2route_type (AFI_IP, argv[0]);
8072 if (! type)
8073 {
8074 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8075 return CMD_WARNING;
8076 }
8077 VTY_GET_INTEGER ("metric", metric, argv[1]);
8078
8079 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8080 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
8081 return bgp_redistribute_set (vty->index, AFI_IP, type);
8082}
8083
8084DEFUN (no_bgp_redistribute_ipv4,
8085 no_bgp_redistribute_ipv4_cmd,
8086 "no redistribute (connected|kernel|ospf|rip|static)",
8087 NO_STR
8088 "Redistribute information from another routing protocol\n"
8089 "Connected\n"
8090 "Kernel routes\n"
8091 "Open Shurtest Path First (OSPF)\n"
8092 "Routing Information Protocol (RIP)\n"
8093 "Static routes\n")
8094{
8095 int type;
8096
8097 type = bgp_str2route_type (AFI_IP, argv[0]);
8098 if (! type)
8099 {
8100 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8101 return CMD_WARNING;
8102 }
8103
8104 return bgp_redistribute_unset (vty->index, AFI_IP, type);
8105}
8106
8107DEFUN (no_bgp_redistribute_ipv4_rmap,
8108 no_bgp_redistribute_ipv4_rmap_cmd,
8109 "no redistribute (connected|kernel|ospf|rip|static) route-map WORD",
8110 NO_STR
8111 "Redistribute information from another routing protocol\n"
8112 "Connected\n"
8113 "Kernel routes\n"
8114 "Open Shurtest Path First (OSPF)\n"
8115 "Routing Information Protocol (RIP)\n"
8116 "Static routes\n"
8117 "Route map reference\n"
8118 "Pointer to route-map entries\n")
8119{
8120 int type;
8121
8122 type = bgp_str2route_type (AFI_IP, argv[0]);
8123 if (! type)
8124 {
8125 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8126 return CMD_WARNING;
8127 }
8128
8129 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8130 return CMD_SUCCESS;
8131}
8132
8133DEFUN (no_bgp_redistribute_ipv4_metric,
8134 no_bgp_redistribute_ipv4_metric_cmd,
8135 "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
8136 NO_STR
8137 "Redistribute information from another routing protocol\n"
8138 "Connected\n"
8139 "Kernel routes\n"
8140 "Open Shurtest Path First (OSPF)\n"
8141 "Routing Information Protocol (RIP)\n"
8142 "Static routes\n"
8143 "Metric for redistributed routes\n"
8144 "Default metric\n")
8145{
8146 int type;
8147
8148 type = bgp_str2route_type (AFI_IP, argv[0]);
8149 if (! type)
8150 {
8151 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8152 return CMD_WARNING;
8153 }
8154
8155 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8156 return CMD_SUCCESS;
8157}
8158
8159DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
8160 no_bgp_redistribute_ipv4_rmap_metric_cmd,
8161 "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
8162 NO_STR
8163 "Redistribute information from another routing protocol\n"
8164 "Connected\n"
8165 "Kernel routes\n"
8166 "Open Shurtest Path First (OSPF)\n"
8167 "Routing Information Protocol (RIP)\n"
8168 "Static routes\n"
8169 "Route map reference\n"
8170 "Pointer to route-map entries\n"
8171 "Metric for redistributed routes\n"
8172 "Default metric\n")
8173{
8174 int type;
8175
8176 type = bgp_str2route_type (AFI_IP, argv[0]);
8177 if (! type)
8178 {
8179 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8180 return CMD_WARNING;
8181 }
8182
8183 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8184 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8185 return CMD_SUCCESS;
8186}
8187
8188ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
8189 no_bgp_redistribute_ipv4_metric_rmap_cmd,
8190 "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
8191 NO_STR
8192 "Redistribute information from another routing protocol\n"
8193 "Connected\n"
8194 "Kernel routes\n"
8195 "Open Shurtest Path First (OSPF)\n"
8196 "Routing Information Protocol (RIP)\n"
8197 "Static routes\n"
8198 "Metric for redistributed routes\n"
8199 "Default metric\n"
8200 "Route map reference\n"
8201 "Pointer to route-map entries\n")
8202
8203#ifdef HAVE_IPV6
8204DEFUN (bgp_redistribute_ipv6,
8205 bgp_redistribute_ipv6_cmd,
8206 "redistribute (connected|kernel|ospf6|ripng|static)",
8207 "Redistribute information from another routing protocol\n"
8208 "Connected\n"
8209 "Kernel routes\n"
8210 "Open Shurtest Path First (OSPFv3)\n"
8211 "Routing Information Protocol (RIPng)\n"
8212 "Static routes\n")
8213{
8214 int type;
8215
8216 type = bgp_str2route_type (AFI_IP6, argv[0]);
8217 if (! type)
8218 {
8219 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8220 return CMD_WARNING;
8221 }
8222
8223 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8224}
8225
8226DEFUN (bgp_redistribute_ipv6_rmap,
8227 bgp_redistribute_ipv6_rmap_cmd,
8228 "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
8229 "Redistribute information from another routing protocol\n"
8230 "Connected\n"
8231 "Kernel routes\n"
8232 "Open Shurtest Path First (OSPFv3)\n"
8233 "Routing Information Protocol (RIPng)\n"
8234 "Static routes\n"
8235 "Route map reference\n"
8236 "Pointer to route-map entries\n")
8237{
8238 int type;
8239
8240 type = bgp_str2route_type (AFI_IP6, argv[0]);
8241 if (! type)
8242 {
8243 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8244 return CMD_WARNING;
8245 }
8246
8247 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8248 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8249}
8250
8251DEFUN (bgp_redistribute_ipv6_metric,
8252 bgp_redistribute_ipv6_metric_cmd,
8253 "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
8254 "Redistribute information from another routing protocol\n"
8255 "Connected\n"
8256 "Kernel routes\n"
8257 "Open Shurtest Path First (OSPFv3)\n"
8258 "Routing Information Protocol (RIPng)\n"
8259 "Static routes\n"
8260 "Metric for redistributed routes\n"
8261 "Default metric\n")
8262{
8263 int type;
8264 u_int32_t metric;
8265
8266 type = bgp_str2route_type (AFI_IP6, argv[0]);
8267 if (! type)
8268 {
8269 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8270 return CMD_WARNING;
8271 }
8272 VTY_GET_INTEGER ("metric", metric, argv[1]);
8273
8274 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8275 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8276}
8277
8278DEFUN (bgp_redistribute_ipv6_rmap_metric,
8279 bgp_redistribute_ipv6_rmap_metric_cmd,
8280 "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
8281 "Redistribute information from another routing protocol\n"
8282 "Connected\n"
8283 "Kernel routes\n"
8284 "Open Shurtest Path First (OSPFv3)\n"
8285 "Routing Information Protocol (RIPng)\n"
8286 "Static routes\n"
8287 "Route map reference\n"
8288 "Pointer to route-map entries\n"
8289 "Metric for redistributed routes\n"
8290 "Default metric\n")
8291{
8292 int type;
8293 u_int32_t metric;
8294
8295 type = bgp_str2route_type (AFI_IP6, argv[0]);
8296 if (! type)
8297 {
8298 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8299 return CMD_WARNING;
8300 }
8301 VTY_GET_INTEGER ("metric", metric, argv[2]);
8302
8303 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8304 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8305 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8306}
8307
8308DEFUN (bgp_redistribute_ipv6_metric_rmap,
8309 bgp_redistribute_ipv6_metric_rmap_cmd,
8310 "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
8311 "Redistribute information from another routing protocol\n"
8312 "Connected\n"
8313 "Kernel routes\n"
8314 "Open Shurtest Path First (OSPFv3)\n"
8315 "Routing Information Protocol (RIPng)\n"
8316 "Static routes\n"
8317 "Metric for redistributed routes\n"
8318 "Default metric\n"
8319 "Route map reference\n"
8320 "Pointer to route-map entries\n")
8321{
8322 int type;
8323 u_int32_t metric;
8324
8325 type = bgp_str2route_type (AFI_IP6, argv[0]);
8326 if (! type)
8327 {
8328 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8329 return CMD_WARNING;
8330 }
8331 VTY_GET_INTEGER ("metric", metric, argv[1]);
8332
8333 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8334 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
8335 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8336}
8337
8338DEFUN (no_bgp_redistribute_ipv6,
8339 no_bgp_redistribute_ipv6_cmd,
8340 "no redistribute (connected|kernel|ospf6|ripng|static)",
8341 NO_STR
8342 "Redistribute information from another routing protocol\n"
8343 "Connected\n"
8344 "Kernel routes\n"
8345 "Open Shurtest Path First (OSPFv3)\n"
8346 "Routing Information Protocol (RIPng)\n"
8347 "Static routes\n")
8348{
8349 int type;
8350
8351 type = bgp_str2route_type (AFI_IP6, argv[0]);
8352 if (! type)
8353 {
8354 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8355 return CMD_WARNING;
8356 }
8357
8358 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
8359}
8360
8361DEFUN (no_bgp_redistribute_ipv6_rmap,
8362 no_bgp_redistribute_ipv6_rmap_cmd,
8363 "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
8364 NO_STR
8365 "Redistribute information from another routing protocol\n"
8366 "Connected\n"
8367 "Kernel routes\n"
8368 "Open Shurtest Path First (OSPFv3)\n"
8369 "Routing Information Protocol (RIPng)\n"
8370 "Static routes\n"
8371 "Route map reference\n"
8372 "Pointer to route-map entries\n")
8373{
8374 int type;
8375
8376 type = bgp_str2route_type (AFI_IP6, argv[0]);
8377 if (! type)
8378 {
8379 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8380 return CMD_WARNING;
8381 }
8382
8383 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8384 return CMD_SUCCESS;
8385}
8386
8387DEFUN (no_bgp_redistribute_ipv6_metric,
8388 no_bgp_redistribute_ipv6_metric_cmd,
8389 "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
8390 NO_STR
8391 "Redistribute information from another routing protocol\n"
8392 "Connected\n"
8393 "Kernel routes\n"
8394 "Open Shurtest Path First (OSPFv3)\n"
8395 "Routing Information Protocol (RIPng)\n"
8396 "Static routes\n"
8397 "Metric for redistributed routes\n"
8398 "Default metric\n")
8399{
8400 int type;
8401
8402 type = bgp_str2route_type (AFI_IP6, argv[0]);
8403 if (! type)
8404 {
8405 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8406 return CMD_WARNING;
8407 }
8408
8409 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8410 return CMD_SUCCESS;
8411}
8412
8413DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
8414 no_bgp_redistribute_ipv6_rmap_metric_cmd,
8415 "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
8416 NO_STR
8417 "Redistribute information from another routing protocol\n"
8418 "Connected\n"
8419 "Kernel routes\n"
8420 "Open Shurtest Path First (OSPFv3)\n"
8421 "Routing Information Protocol (RIPng)\n"
8422 "Static routes\n"
8423 "Route map reference\n"
8424 "Pointer to route-map entries\n"
8425 "Metric for redistributed routes\n"
8426 "Default metric\n")
8427{
8428 int type;
8429
8430 type = bgp_str2route_type (AFI_IP6, argv[0]);
8431 if (! type)
8432 {
8433 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8434 return CMD_WARNING;
8435 }
8436
8437 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8438 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8439 return CMD_SUCCESS;
8440}
8441
8442ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
8443 no_bgp_redistribute_ipv6_metric_rmap_cmd,
8444 "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
8445 NO_STR
8446 "Redistribute information from another routing protocol\n"
8447 "Connected\n"
8448 "Kernel routes\n"
8449 "Open Shurtest Path First (OSPFv3)\n"
8450 "Routing Information Protocol (RIPng)\n"
8451 "Static routes\n"
8452 "Metric for redistributed routes\n"
8453 "Default metric\n"
8454 "Route map reference\n"
8455 "Pointer to route-map entries\n")
8456#endif /* HAVE_IPV6 */
8457
8458int
8459bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
8460 safi_t safi, int *write)
8461{
8462 int i;
paulfd79ac92004-10-13 05:06:08 +00008463 const char *str[] = { "system", "kernel", "connected", "static", "rip",
hasso66e31692004-03-20 19:33:06 +00008464 "ripng", "ospf", "ospf6", "isis", "bgp"};
paul718e3742002-12-13 20:15:29 +00008465
8466 /* Unicast redistribution only. */
8467 if (safi != SAFI_UNICAST)
8468 return 0;
8469
8470 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
8471 {
8472 /* Redistribute BGP does not make sense. */
8473 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
8474 {
8475 /* Display "address-family" when it is not yet diplayed. */
8476 bgp_config_write_family_header (vty, afi, safi, write);
8477
8478 /* "redistribute" configuration. */
8479 vty_out (vty, " redistribute %s", str[i]);
8480
8481 if (bgp->redist_metric_flag[afi][i])
8482 vty_out (vty, " metric %d", bgp->redist_metric[afi][i]);
8483
8484 if (bgp->rmap[afi][i].name)
8485 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
8486
8487 vty_out (vty, "%s", VTY_NEWLINE);
8488 }
8489 }
8490 return *write;
8491}
8492
8493/* BGP node structure. */
8494struct cmd_node bgp_node =
8495{
8496 BGP_NODE,
8497 "%s(config-router)# ",
8498 1,
8499};
8500
8501struct cmd_node bgp_ipv4_unicast_node =
8502{
8503 BGP_IPV4_NODE,
8504 "%s(config-router-af)# ",
8505 1,
8506};
8507
8508struct cmd_node bgp_ipv4_multicast_node =
8509{
8510 BGP_IPV4M_NODE,
8511 "%s(config-router-af)# ",
8512 1,
8513};
8514
8515struct cmd_node bgp_ipv6_unicast_node =
8516{
8517 BGP_IPV6_NODE,
8518 "%s(config-router-af)# ",
8519 1,
8520};
8521
8522struct cmd_node bgp_vpnv4_node =
8523{
8524 BGP_VPNV4_NODE,
8525 "%s(config-router-af)# ",
8526 1
8527};
8528
8529void
8530bgp_vty_init ()
8531{
8532 int bgp_config_write (struct vty *);
8533 void community_list_vty ();
8534
8535 /* Install bgp top node. */
8536 install_node (&bgp_node, bgp_config_write);
8537 install_node (&bgp_ipv4_unicast_node, NULL);
8538 install_node (&bgp_ipv4_multicast_node, NULL);
8539 install_node (&bgp_ipv6_unicast_node, NULL);
8540 install_node (&bgp_vpnv4_node, NULL);
8541
8542 /* Install default VTY commands to new nodes. */
8543 install_default (BGP_NODE);
8544 install_default (BGP_IPV4_NODE);
8545 install_default (BGP_IPV4M_NODE);
8546 install_default (BGP_IPV6_NODE);
8547 install_default (BGP_VPNV4_NODE);
8548
8549 /* "bgp multiple-instance" commands. */
8550 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
8551 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
8552
8553 /* "bgp config-type" commands. */
8554 install_element (CONFIG_NODE, &bgp_config_type_cmd);
8555 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
8556
8557 /* Dummy commands (Currently not supported) */
8558 install_element (BGP_NODE, &no_synchronization_cmd);
8559 install_element (BGP_NODE, &no_auto_summary_cmd);
8560
8561 /* "router bgp" commands. */
8562 install_element (CONFIG_NODE, &router_bgp_cmd);
8563 install_element (CONFIG_NODE, &router_bgp_view_cmd);
8564
8565 /* "no router bgp" commands. */
8566 install_element (CONFIG_NODE, &no_router_bgp_cmd);
8567 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
8568
8569 /* "bgp router-id" commands. */
8570 install_element (BGP_NODE, &bgp_router_id_cmd);
8571 install_element (BGP_NODE, &no_bgp_router_id_cmd);
8572 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
8573
8574 /* "bgp cluster-id" commands. */
8575 install_element (BGP_NODE, &bgp_cluster_id_cmd);
8576 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
8577 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
8578 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
8579
8580 /* "bgp confederation" commands. */
8581 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
8582 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
8583 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
8584
8585 /* "bgp confederation peers" commands. */
8586 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
8587 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
8588
8589 /* "timers bgp" commands. */
8590 install_element (BGP_NODE, &bgp_timers_cmd);
8591 install_element (BGP_NODE, &no_bgp_timers_cmd);
8592 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
8593
8594 /* "bgp client-to-client reflection" commands */
8595 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
8596 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
8597
8598 /* "bgp always-compare-med" commands */
8599 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
8600 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
8601
8602 /* "bgp deterministic-med" commands */
8603 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
8604 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00008605
hasso538621f2004-05-21 09:31:30 +00008606 /* "bgp graceful-restart" commands */
8607 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
8608 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00008609 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
8610 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
8611 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00008612
8613 /* "bgp fast-external-failover" commands */
8614 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
8615 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
8616
8617 /* "bgp enforce-first-as" commands */
8618 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
8619 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
8620
8621 /* "bgp bestpath compare-routerid" commands */
8622 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
8623 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
8624
8625 /* "bgp bestpath as-path ignore" commands */
8626 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
8627 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
8628
paul848973c2003-08-13 00:32:49 +00008629 /* "bgp log-neighbor-changes" commands */
8630 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
8631 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
8632
paul718e3742002-12-13 20:15:29 +00008633 /* "bgp bestpath med" commands */
8634 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
8635 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
8636 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
8637 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
8638 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
8639 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
8640
8641 /* "no bgp default ipv4-unicast" commands. */
8642 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
8643 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
8644
8645 /* "bgp network import-check" commands. */
8646 install_element (BGP_NODE, &bgp_network_import_check_cmd);
8647 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
8648
8649 /* "bgp default local-preference" commands. */
8650 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
8651 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
8652 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
8653
8654 /* "neighbor remote-as" commands. */
8655 install_element (BGP_NODE, &neighbor_remote_as_cmd);
8656 install_element (BGP_NODE, &no_neighbor_cmd);
8657 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
8658
8659 /* "neighbor peer-group" commands. */
8660 install_element (BGP_NODE, &neighbor_peer_group_cmd);
8661 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
8662 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
8663
8664 /* "neighbor local-as" commands. */
8665 install_element (BGP_NODE, &neighbor_local_as_cmd);
8666 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
8667 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
8668 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
8669 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
8670
8671 /* "neighbor activate" commands. */
8672 install_element (BGP_NODE, &neighbor_activate_cmd);
8673 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
8674 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
8675 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
8676 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
8677
8678 /* "no neighbor activate" commands. */
8679 install_element (BGP_NODE, &no_neighbor_activate_cmd);
8680 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
8681 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
8682 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
8683 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
8684
8685 /* "neighbor peer-group set" commands. */
8686 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
8687 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
8688 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
8689 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00008690 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
8691
paul718e3742002-12-13 20:15:29 +00008692 /* "no neighbor peer-group unset" commands. */
8693 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
8694 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
8695 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
8696 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00008697 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
8698
paul718e3742002-12-13 20:15:29 +00008699 /* "neighbor softreconfiguration inbound" commands.*/
8700 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
8701 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
8702 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
8703 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
8704 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
8705 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
8706 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
8707 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +00008708 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
8709 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +00008710
8711 /* "neighbor attribute-unchanged" commands. */
8712 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
8713 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
8714 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
8715 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
8716 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
8717 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
8718 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
8719 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
8720 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
8721 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
8722 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
8723 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
8724 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
8725 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
8726 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
8727 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
8728 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
8729 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
8730 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
8731 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
8732 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
8733 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
8734 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
8735 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
8736 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
8737 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
8738 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
8739 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
8740 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
8741 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
8742 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
8743 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
8744 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
8745 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
8746 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
8747 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
8748 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
8749 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
8750 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
8751 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
8752 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
8753 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
8754 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
8755 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
8756 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
8757 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
8758 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
8759 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
8760 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
8761 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
8762 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
8763 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
8764 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
8765 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
8766 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
8767 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
8768 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
8769 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
8770 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
8771 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
8772 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
8773 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
8774 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
8775 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
8776 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
8777 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
8778 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
8779 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
8780 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
8781 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
8782 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
8783 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
8784 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
8785 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
8786 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
8787 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
8788 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
8789 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
8790 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
8791 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
8792 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
8793 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
8794 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
8795 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
8796 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
8797 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
8798 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
8799 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
8800 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
8801 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
8802 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
8803 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
8804 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
8805 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
8806 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
8807 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
8808 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
8809 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
8810 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
8811 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
8812 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
8813 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
8814 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
8815 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
8816 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
8817 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
8818 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
8819 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
8820 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
8821 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
8822
paulfee0f4c2004-09-13 05:12:46 +00008823 /* "nexthop-local unchanged" commands */
8824 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
8825 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
8826
paul718e3742002-12-13 20:15:29 +00008827 /* "transparent-as" and "transparent-nexthop" for old version
8828 compatibility. */
8829 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
8830 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
8831
8832 /* "neighbor next-hop-self" commands. */
8833 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
8834 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
8835 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
8836 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
8837 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
8838 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
8839 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
8840 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
8841 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
8842 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
8843
8844 /* "neighbor remove-private-AS" commands. */
8845 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
8846 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
8847 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
8848 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
8849 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
8850 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
8851 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
8852 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
8853 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
8854 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
8855
8856 /* "neighbor send-community" commands.*/
8857 install_element (BGP_NODE, &neighbor_send_community_cmd);
8858 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
8859 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
8860 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
8861 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
8862 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
8863 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
8864 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
8865 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
8866 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
8867 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
8868 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
8869 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
8870 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
8871 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
8872 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
8873 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
8874 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
8875 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
8876 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
8877
8878 /* "neighbor route-reflector" commands.*/
8879 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
8880 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
8881 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
8882 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
8883 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
8884 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
8885 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
8886 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
8887 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
8888 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
8889
8890 /* "neighbor route-server" commands.*/
8891 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
8892 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
8893 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
8894 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
8895 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
8896 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
8897 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
8898 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
8899 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
8900 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
8901
8902 /* "neighbor passive" commands. */
8903 install_element (BGP_NODE, &neighbor_passive_cmd);
8904 install_element (BGP_NODE, &no_neighbor_passive_cmd);
8905
8906 /* "neighbor shutdown" commands. */
8907 install_element (BGP_NODE, &neighbor_shutdown_cmd);
8908 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
8909
hassoc9502432005-02-01 22:01:48 +00008910 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +00008911 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
8912 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
8913
8914 /* "neighbor capability orf prefix-list" commands.*/
8915 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
8916 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
8917 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
8918 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
8919 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
8920 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
8921 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
8922 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
8923
8924 /* "neighbor capability dynamic" commands.*/
8925 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
8926 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
8927
8928 /* "neighbor dont-capability-negotiate" commands. */
8929 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
8930 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
8931
8932 /* "neighbor ebgp-multihop" commands. */
8933 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
8934 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
8935 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
8936 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
8937
hasso6ffd2072005-02-02 14:50:11 +00008938 /* "neighbor disable-connected-check" commands. */
8939 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
8940 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +00008941 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
8942 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
8943
8944 /* "neighbor description" commands. */
8945 install_element (BGP_NODE, &neighbor_description_cmd);
8946 install_element (BGP_NODE, &no_neighbor_description_cmd);
8947 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
8948
8949 /* "neighbor update-source" commands. "*/
8950 install_element (BGP_NODE, &neighbor_update_source_cmd);
8951 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
8952
8953 /* "neighbor default-originate" commands. */
8954 install_element (BGP_NODE, &neighbor_default_originate_cmd);
8955 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
8956 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
8957 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
8958 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
8959 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
8960 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
8961 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
8962 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
8963 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
8964 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
8965 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
8966 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
8967 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
8968 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
8969 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
8970
8971 /* "neighbor port" commands. */
8972 install_element (BGP_NODE, &neighbor_port_cmd);
8973 install_element (BGP_NODE, &no_neighbor_port_cmd);
8974 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
8975
8976 /* "neighbor weight" commands. */
8977 install_element (BGP_NODE, &neighbor_weight_cmd);
8978 install_element (BGP_NODE, &no_neighbor_weight_cmd);
8979 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
8980
8981 /* "neighbor override-capability" commands. */
8982 install_element (BGP_NODE, &neighbor_override_capability_cmd);
8983 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
8984
8985 /* "neighbor strict-capability-match" commands. */
8986 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
8987 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
8988
8989 /* "neighbor timers" commands. */
8990 install_element (BGP_NODE, &neighbor_timers_cmd);
8991 install_element (BGP_NODE, &no_neighbor_timers_cmd);
8992
8993 /* "neighbor timers connect" commands. */
8994 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
8995 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
8996 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
8997
8998 /* "neighbor advertisement-interval" commands. */
8999 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
9000 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
9001 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
9002
9003 /* "neighbor version" commands. */
9004 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +00009005
9006 /* "neighbor interface" commands. */
9007 install_element (BGP_NODE, &neighbor_interface_cmd);
9008 install_element (BGP_NODE, &no_neighbor_interface_cmd);
9009
9010 /* "neighbor distribute" commands. */
9011 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
9012 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
9013 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
9014 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
9015 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
9016 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
9017 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
9018 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
9019 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
9020 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
9021
9022 /* "neighbor prefix-list" commands. */
9023 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
9024 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
9025 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
9026 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
9027 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
9028 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
9029 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
9030 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
9031 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
9032 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
9033
9034 /* "neighbor filter-list" commands. */
9035 install_element (BGP_NODE, &neighbor_filter_list_cmd);
9036 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
9037 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
9038 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
9039 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
9040 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
9041 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
9042 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
9043 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
9044 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
9045
9046 /* "neighbor route-map" commands. */
9047 install_element (BGP_NODE, &neighbor_route_map_cmd);
9048 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
9049 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
9050 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
9051 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
9052 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
9053 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
9054 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
9055 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
9056 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
9057
9058 /* "neighbor unsuppress-map" commands. */
9059 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
9060 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
9061 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
9062 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
9063 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
9064 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
9065 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
9066 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +00009067 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
9068 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +00009069
9070 /* "neighbor maximum-prefix" commands. */
9071 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009072 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009073 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009074 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009075 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
9076 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009077 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
9078 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009079 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9080 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9081 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9082 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9083 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009084 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009085 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009086 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009087 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009088 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9089 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009090 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
9091 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009092 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9093 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9094 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9095 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9096 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009097 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009098 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009099 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009100 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009101 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
9102 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009103 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
9104 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009105 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9106 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9107 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9108 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9109 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009110 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009111 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009112 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009113 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009114 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
9115 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009116 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
9117 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009118 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9119 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9120 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9121 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9122 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009123 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009124 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009125 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009126 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009127 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9128 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009129 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
9130 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009131 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9132 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9133 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9134 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9135 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009136
9137 /* "neighbor allowas-in" */
9138 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
9139 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
9140 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
9141 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
9142 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
9143 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
9144 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
9145 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
9146 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
9147 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
9148 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
9149 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
9150 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
9151 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
9152 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
9153
9154 /* address-family commands. */
9155 install_element (BGP_NODE, &address_family_ipv4_cmd);
9156 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
9157#ifdef HAVE_IPV6
9158 install_element (BGP_NODE, &address_family_ipv6_cmd);
9159 install_element (BGP_NODE, &address_family_ipv6_unicast_cmd);
9160#endif /* HAVE_IPV6 */
9161 install_element (BGP_NODE, &address_family_vpnv4_cmd);
9162 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
9163
9164 /* "exit-address-family" command. */
9165 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
9166 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
9167 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
9168 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
9169
9170 /* "clear ip bgp commands" */
9171 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
9172 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
9173 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
9174 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
9175 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
9176 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
9177#ifdef HAVE_IPV6
9178 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
9179 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
9180 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
9181 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
9182 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
9183 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
9184 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
9185 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
9186 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
9187 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
9188 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
9189#endif /* HAVE_IPV6 */
9190
9191 /* "clear ip bgp neighbor soft in" */
9192 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
9193 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
9194 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
9195 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
9196 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
9197 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
9198 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
9199 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
9200 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
9201 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
9202 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
9203 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
9204 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
9205 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
9206 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
9207 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
9208 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
9209 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
9210 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
9211 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
9212 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
9213 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
9214 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
9215 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
9216 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
9217 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
9218 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
9219 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
9220 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
9221 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
9222 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
9223 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
9224 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
9225 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
9226 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
9227 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
9228 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
9229 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
9230 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
9231 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
9232#ifdef HAVE_IPV6
9233 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
9234 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
9235 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
9236 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
9237 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
9238 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
9239 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
9240 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
9241 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
9242 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
9243 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
9244 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
9245 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
9246 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
9247 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
9248 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
9249 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
9250 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
9251 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
9252 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
9253 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
9254 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
9255 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
9256 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
9257 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
9258 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
9259 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
9260 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
9261 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
9262 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
9263 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
9264#endif /* HAVE_IPV6 */
9265
9266 /* "clear ip bgp neighbor soft out" */
9267 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
9268 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
9269 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
9270 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
9271 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
9272 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
9273 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
9274 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
9275 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
9276 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
9277 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
9278 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
9279 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
9280 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
9281 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
9282 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
9283 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
9284 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
9285 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
9286 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
9287 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
9288 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
9289 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
9290 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
9291 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
9292 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
9293 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
9294 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
9295#ifdef HAVE_IPV6
9296 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
9297 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
9298 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
9299 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
9300 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
9301 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
9302 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
9303 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
9304 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
9305 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
9306 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
9307 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
9308 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
9309 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
9310 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
9311 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
9312 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
9313 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
9314 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
9315 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
9316 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
9317#endif /* HAVE_IPV6 */
9318
9319 /* "clear ip bgp neighbor soft" */
9320 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
9321 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
9322 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
9323 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
9324 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
9325 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
9326 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
9327 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
9328 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
9329 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
9330 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
9331 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
9332 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
9333 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
9334 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
9335#ifdef HAVE_IPV6
9336 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
9337 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
9338 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
9339 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
9340 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
9341 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
9342 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
9343 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
9344 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
9345 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
9346 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
9347#endif /* HAVE_IPV6 */
9348
paulfee0f4c2004-09-13 05:12:46 +00009349 /* "clear ip bgp neighbor rsclient" */
9350 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
9351 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
9352 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
9353 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
9354#ifdef HAVE_IPV6
9355 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
9356 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
9357 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
9358 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
9359 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
9360 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
9361 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
9362 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
9363#endif /* HAVE_IPV6 */
9364
paul718e3742002-12-13 20:15:29 +00009365 /* "show ip bgp summary" commands. */
9366 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
9367 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
9368 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
9369 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
9370 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9371 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9372#ifdef HAVE_IPV6
9373 install_element (VIEW_NODE, &show_bgp_summary_cmd);
9374 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
9375 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
9376 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
9377#endif /* HAVE_IPV6 */
9378 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
9379 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
9380 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
9381 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
9382 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9383 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9384#ifdef HAVE_IPV6
9385 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
9386 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
9387 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
9388 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
9389#endif /* HAVE_IPV6 */
9390
9391 /* "show ip bgp neighbors" commands. */
9392 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
9393 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
9394 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
9395 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
9396 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
9397 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
9398 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
9399 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
9400 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
9401 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
9402 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
9403 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
9404 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
9405 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
9406 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
9407 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
9408 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
9409 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
9410 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
9411 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
9412
9413#ifdef HAVE_IPV6
9414 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
9415 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
9416 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
9417 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +00009418 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
9419 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
9420 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
9421 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +00009422 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
9423 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
9424 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
9425 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +00009426 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
9427 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
9428 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
9429 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +00009430
9431 /* Old commands. */
9432 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
9433 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
9434 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
9435 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
9436#endif /* HAVE_IPV6 */
9437
paulfee0f4c2004-09-13 05:12:46 +00009438 /* "show ip bgp rsclient" commands. */
9439 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
9440 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
9441 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
9442 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
9443 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
9444 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
9445 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
9446 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
9447
9448#ifdef HAVE_IPV6
9449 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
9450 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
9451 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
9452 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
9453 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
9454 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
9455 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
9456 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
9457#endif /* HAVE_IPV6 */
9458
paul718e3742002-12-13 20:15:29 +00009459 /* "show ip bgp paths" commands. */
9460 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
9461 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
9462 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
9463 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
9464
9465 /* "show ip bgp community" commands. */
9466 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
9467 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
9468
9469 /* "show ip bgp attribute-info" commands. */
9470 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
9471 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
9472
9473 /* "redistribute" commands. */
9474 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
9475 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
9476 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
9477 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
9478 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
9479 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
9480 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
9481 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
9482 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
9483 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
9484#ifdef HAVE_IPV6
9485 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
9486 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
9487 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
9488 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
9489 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
9490 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
9491 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
9492 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
9493 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
9494 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
9495#endif /* HAVE_IPV6 */
9496
9497 /* Community-list. */
9498 community_list_vty ();
9499}
9500
9501#include "memory.h"
9502#include "bgp_regex.h"
9503#include "bgp_clist.h"
9504#include "bgp_ecommunity.h"
9505
9506/* VTY functions. */
9507
9508/* Direction value to string conversion. */
paulfd79ac92004-10-13 05:06:08 +00009509const char *
paul718e3742002-12-13 20:15:29 +00009510community_direct_str (int direct)
9511{
9512 switch (direct)
9513 {
9514 case COMMUNITY_DENY:
9515 return "deny";
9516 break;
9517 case COMMUNITY_PERMIT:
9518 return "permit";
9519 break;
9520 default:
9521 return "unknown";
9522 break;
9523 }
9524}
9525
9526/* Display error string. */
9527void
9528community_list_perror (struct vty *vty, int ret)
9529{
9530 switch (ret)
9531 {
9532 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
9533 vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE);
9534 break;
9535 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
9536 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
9537 break;
9538 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
9539 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
9540 break;
9541 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
9542 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
9543 break;
9544 }
9545}
9546
9547/* VTY interface for community_set() function. */
9548int
paulfd79ac92004-10-13 05:06:08 +00009549community_list_set_vty (struct vty *vty, int argc, const char **argv,
9550 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +00009551{
9552 int ret;
9553 int direct;
9554 char *str;
9555
9556 /* Check the list type. */
9557 if (strncmp (argv[1], "p", 1) == 0)
9558 direct = COMMUNITY_PERMIT;
9559 else if (strncmp (argv[1], "d", 1) == 0)
9560 direct = COMMUNITY_DENY;
9561 else
9562 {
9563 vty_out (vty, "%% Matching condition must be permit or deny%s",
9564 VTY_NEWLINE);
9565 return CMD_WARNING;
9566 }
9567
9568 /* All digit name check. */
9569 if (reject_all_digit_name && all_digit (argv[0]))
9570 {
9571 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
9572 return CMD_WARNING;
9573 }
9574
9575 /* Concat community string argument. */
9576 if (argc > 1)
9577 str = argv_concat (argv, argc, 2);
9578 else
9579 str = NULL;
9580
9581 /* When community_list_set() return nevetive value, it means
9582 malformed community string. */
9583 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
9584
9585 /* Free temporary community list string allocated by
9586 argv_concat(). */
9587 if (str)
9588 XFREE (MTYPE_TMP, str);
9589
9590 if (ret < 0)
9591 {
9592 /* Display error string. */
9593 community_list_perror (vty, ret);
9594 return CMD_WARNING;
9595 }
9596
9597 return CMD_SUCCESS;
9598}
9599
paul718e3742002-12-13 20:15:29 +00009600/* Communiyt-list entry delete. */
9601int
hassofee6e4e2005-02-02 16:29:31 +00009602community_list_unset_vty (struct vty *vty, int argc, const char **argv,
9603 int style)
paul718e3742002-12-13 20:15:29 +00009604{
9605 int ret;
hassofee6e4e2005-02-02 16:29:31 +00009606 int direct = 0;
9607 char *str = NULL;
paul718e3742002-12-13 20:15:29 +00009608
hassofee6e4e2005-02-02 16:29:31 +00009609 if (argc > 1)
paul718e3742002-12-13 20:15:29 +00009610 {
hassofee6e4e2005-02-02 16:29:31 +00009611 /* Check the list direct. */
9612 if (strncmp (argv[1], "p", 1) == 0)
9613 direct = COMMUNITY_PERMIT;
9614 else if (strncmp (argv[1], "d", 1) == 0)
9615 direct = COMMUNITY_DENY;
9616 else
9617 {
9618 vty_out (vty, "%% Matching condition must be permit or deny%s",
9619 VTY_NEWLINE);
9620 return CMD_WARNING;
9621 }
paul718e3742002-12-13 20:15:29 +00009622
hassofee6e4e2005-02-02 16:29:31 +00009623 /* Concat community string argument. */
9624 str = argv_concat (argv, argc, 2);
9625 }
paul718e3742002-12-13 20:15:29 +00009626
9627 /* Unset community list. */
9628 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
9629
9630 /* Free temporary community list string allocated by
9631 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +00009632 if (str)
9633 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00009634
9635 if (ret < 0)
9636 {
9637 community_list_perror (vty, ret);
9638 return CMD_WARNING;
9639 }
9640
9641 return CMD_SUCCESS;
9642}
9643
9644/* "community-list" keyword help string. */
9645#define COMMUNITY_LIST_STR "Add a community list entry\n"
9646#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
9647
paul718e3742002-12-13 20:15:29 +00009648DEFUN (ip_community_list_standard,
9649 ip_community_list_standard_cmd,
9650 "ip community-list <1-99> (deny|permit) .AA:NN",
9651 IP_STR
9652 COMMUNITY_LIST_STR
9653 "Community list number (standard)\n"
9654 "Specify community to reject\n"
9655 "Specify community to accept\n"
9656 COMMUNITY_VAL_STR)
9657{
9658 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
9659}
9660
9661ALIAS (ip_community_list_standard,
9662 ip_community_list_standard2_cmd,
9663 "ip community-list <1-99> (deny|permit)",
9664 IP_STR
9665 COMMUNITY_LIST_STR
9666 "Community list number (standard)\n"
9667 "Specify community to reject\n"
9668 "Specify community to accept\n")
9669
9670DEFUN (ip_community_list_expanded,
9671 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +00009672 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +00009673 IP_STR
9674 COMMUNITY_LIST_STR
9675 "Community list number (expanded)\n"
9676 "Specify community to reject\n"
9677 "Specify community to accept\n"
9678 "An ordered list as a regular-expression\n")
9679{
9680 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
9681}
9682
9683DEFUN (ip_community_list_name_standard,
9684 ip_community_list_name_standard_cmd,
9685 "ip community-list standard WORD (deny|permit) .AA:NN",
9686 IP_STR
9687 COMMUNITY_LIST_STR
9688 "Add a standard community-list entry\n"
9689 "Community list name\n"
9690 "Specify community to reject\n"
9691 "Specify community to accept\n"
9692 COMMUNITY_VAL_STR)
9693{
9694 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
9695}
9696
9697ALIAS (ip_community_list_name_standard,
9698 ip_community_list_name_standard2_cmd,
9699 "ip community-list standard WORD (deny|permit)",
9700 IP_STR
9701 COMMUNITY_LIST_STR
9702 "Add a standard community-list entry\n"
9703 "Community list name\n"
9704 "Specify community to reject\n"
9705 "Specify community to accept\n")
9706
9707DEFUN (ip_community_list_name_expanded,
9708 ip_community_list_name_expanded_cmd,
9709 "ip community-list expanded WORD (deny|permit) .LINE",
9710 IP_STR
9711 COMMUNITY_LIST_STR
9712 "Add an expanded community-list entry\n"
9713 "Community list name\n"
9714 "Specify community to reject\n"
9715 "Specify community to accept\n"
9716 "An ordered list as a regular-expression\n")
9717{
9718 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
9719}
9720
hassofee6e4e2005-02-02 16:29:31 +00009721DEFUN (no_ip_community_list_standard_all,
9722 no_ip_community_list_standard_all_cmd,
9723 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +00009724 NO_STR
9725 IP_STR
9726 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +00009727 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +00009728{
hassofee6e4e2005-02-02 16:29:31 +00009729 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +00009730}
9731
hassofee6e4e2005-02-02 16:29:31 +00009732DEFUN (no_ip_community_list_expanded_all,
9733 no_ip_community_list_expanded_all_cmd,
9734 "no ip community-list <100-500>",
9735 NO_STR
9736 IP_STR
9737 COMMUNITY_LIST_STR
9738 "Community list number (expanded)\n")
9739{
9740 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
9741}
9742
9743DEFUN (no_ip_community_list_name_standard_all,
9744 no_ip_community_list_name_standard_all_cmd,
9745 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +00009746 NO_STR
9747 IP_STR
9748 COMMUNITY_LIST_STR
9749 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +00009750 "Community list name\n")
9751{
hassofee6e4e2005-02-02 16:29:31 +00009752 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +00009753}
9754
hassofee6e4e2005-02-02 16:29:31 +00009755DEFUN (no_ip_community_list_name_expanded_all,
9756 no_ip_community_list_name_expanded_all_cmd,
9757 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +00009758 NO_STR
9759 IP_STR
9760 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +00009761 "Add an expanded community-list entry\n"
9762 "Community list name\n")
paul718e3742002-12-13 20:15:29 +00009763{
hassofee6e4e2005-02-02 16:29:31 +00009764 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +00009765}
9766
9767DEFUN (no_ip_community_list_standard,
9768 no_ip_community_list_standard_cmd,
9769 "no ip community-list <1-99> (deny|permit) .AA:NN",
9770 NO_STR
9771 IP_STR
9772 COMMUNITY_LIST_STR
9773 "Community list number (standard)\n"
9774 "Specify community to reject\n"
9775 "Specify community to accept\n"
9776 COMMUNITY_VAL_STR)
9777{
9778 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
9779}
9780
9781DEFUN (no_ip_community_list_expanded,
9782 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +00009783 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +00009784 NO_STR
9785 IP_STR
9786 COMMUNITY_LIST_STR
9787 "Community list number (expanded)\n"
9788 "Specify community to reject\n"
9789 "Specify community to accept\n"
9790 "An ordered list as a regular-expression\n")
9791{
9792 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
9793}
9794
9795DEFUN (no_ip_community_list_name_standard,
9796 no_ip_community_list_name_standard_cmd,
9797 "no ip community-list standard WORD (deny|permit) .AA:NN",
9798 NO_STR
9799 IP_STR
9800 COMMUNITY_LIST_STR
9801 "Specify a standard community-list\n"
9802 "Community list name\n"
9803 "Specify community to reject\n"
9804 "Specify community to accept\n"
9805 COMMUNITY_VAL_STR)
9806{
9807 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
9808}
9809
9810DEFUN (no_ip_community_list_name_expanded,
9811 no_ip_community_list_name_expanded_cmd,
9812 "no ip community-list expanded WORD (deny|permit) .LINE",
9813 NO_STR
9814 IP_STR
9815 COMMUNITY_LIST_STR
9816 "Specify an expanded community-list\n"
9817 "Community list name\n"
9818 "Specify community to reject\n"
9819 "Specify community to accept\n"
9820 "An ordered list as a regular-expression\n")
9821{
9822 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
9823}
9824
9825void
9826community_list_show (struct vty *vty, struct community_list *list)
9827{
9828 struct community_entry *entry;
9829
9830 for (entry = list->head; entry; entry = entry->next)
9831 {
9832 if (entry == list->head)
9833 {
9834 if (all_digit (list->name))
9835 vty_out (vty, "Community %s list %s%s",
9836 entry->style == COMMUNITY_LIST_STANDARD ?
9837 "standard" : "(expanded) access",
9838 list->name, VTY_NEWLINE);
9839 else
9840 vty_out (vty, "Named Community %s list %s%s",
9841 entry->style == COMMUNITY_LIST_STANDARD ?
9842 "standard" : "expanded",
9843 list->name, VTY_NEWLINE);
9844 }
9845 if (entry->any)
9846 vty_out (vty, " %s%s",
9847 community_direct_str (entry->direct), VTY_NEWLINE);
9848 else
9849 vty_out (vty, " %s %s%s",
9850 community_direct_str (entry->direct),
9851 entry->style == COMMUNITY_LIST_STANDARD
9852 ? community_str (entry->u.com) : entry->config,
9853 VTY_NEWLINE);
9854 }
9855}
9856
9857DEFUN (show_ip_community_list,
9858 show_ip_community_list_cmd,
9859 "show ip community-list",
9860 SHOW_STR
9861 IP_STR
9862 "List community-list\n")
9863{
9864 struct community_list *list;
9865 struct community_list_master *cm;
9866
hassofee6e4e2005-02-02 16:29:31 +00009867 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +00009868 if (! cm)
9869 return CMD_SUCCESS;
9870
9871 for (list = cm->num.head; list; list = list->next)
9872 community_list_show (vty, list);
9873
9874 for (list = cm->str.head; list; list = list->next)
9875 community_list_show (vty, list);
9876
9877 return CMD_SUCCESS;
9878}
9879
9880DEFUN (show_ip_community_list_arg,
9881 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +00009882 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +00009883 SHOW_STR
9884 IP_STR
9885 "List community-list\n"
9886 "Community-list number\n"
9887 "Community-list name\n")
9888{
9889 struct community_list *list;
9890
hassofee6e4e2005-02-02 16:29:31 +00009891 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +00009892 if (! list)
9893 {
9894 vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE);
9895 return CMD_WARNING;
9896 }
9897
9898 community_list_show (vty, list);
9899
9900 return CMD_SUCCESS;
9901}
9902
9903int
paulfd79ac92004-10-13 05:06:08 +00009904extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
9905 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +00009906{
9907 int ret;
9908 int direct;
9909 char *str;
9910
9911 /* Check the list type. */
9912 if (strncmp (argv[1], "p", 1) == 0)
9913 direct = COMMUNITY_PERMIT;
9914 else if (strncmp (argv[1], "d", 1) == 0)
9915 direct = COMMUNITY_DENY;
9916 else
9917 {
9918 vty_out (vty, "%% Matching condition must be permit or deny%s",
9919 VTY_NEWLINE);
9920 return CMD_WARNING;
9921 }
9922
9923 /* All digit name check. */
9924 if (reject_all_digit_name && all_digit (argv[0]))
9925 {
9926 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
9927 return CMD_WARNING;
9928 }
9929
9930 /* Concat community string argument. */
9931 if (argc > 1)
9932 str = argv_concat (argv, argc, 2);
9933 else
9934 str = NULL;
9935
9936 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
9937
9938 /* Free temporary community list string allocated by
9939 argv_concat(). */
9940 if (str)
9941 XFREE (MTYPE_TMP, str);
9942
9943 if (ret < 0)
9944 {
9945 community_list_perror (vty, ret);
9946 return CMD_WARNING;
9947 }
9948 return CMD_SUCCESS;
9949}
9950
9951int
hassofee6e4e2005-02-02 16:29:31 +00009952extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
9953 int style)
paul718e3742002-12-13 20:15:29 +00009954{
9955 int ret;
hassofee6e4e2005-02-02 16:29:31 +00009956 int direct = 0;
9957 char *str = NULL;
paul718e3742002-12-13 20:15:29 +00009958
hassofee6e4e2005-02-02 16:29:31 +00009959 if (argc > 1)
paul718e3742002-12-13 20:15:29 +00009960 {
hassofee6e4e2005-02-02 16:29:31 +00009961 /* Check the list direct. */
9962 if (strncmp (argv[1], "p", 1) == 0)
9963 direct = COMMUNITY_PERMIT;
9964 else if (strncmp (argv[1], "d", 1) == 0)
9965 direct = COMMUNITY_DENY;
9966 else
9967 {
9968 vty_out (vty, "%% Matching condition must be permit or deny%s",
9969 VTY_NEWLINE);
9970 return CMD_WARNING;
9971 }
9972
9973 /* Concat community string argument. */
9974 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +00009975 }
paul718e3742002-12-13 20:15:29 +00009976
9977 /* Unset community list. */
9978 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
9979
9980 /* Free temporary community list string allocated by
9981 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +00009982 if (str)
9983 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00009984
9985 if (ret < 0)
9986 {
9987 community_list_perror (vty, ret);
9988 return CMD_WARNING;
9989 }
9990
9991 return CMD_SUCCESS;
9992}
9993
9994/* "extcommunity-list" keyword help string. */
9995#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
9996#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
9997
9998DEFUN (ip_extcommunity_list_standard,
9999 ip_extcommunity_list_standard_cmd,
10000 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10001 IP_STR
10002 EXTCOMMUNITY_LIST_STR
10003 "Extended Community list number (standard)\n"
10004 "Specify community to reject\n"
10005 "Specify community to accept\n"
10006 EXTCOMMUNITY_VAL_STR)
10007{
10008 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
10009}
10010
10011ALIAS (ip_extcommunity_list_standard,
10012 ip_extcommunity_list_standard2_cmd,
10013 "ip extcommunity-list <1-99> (deny|permit)",
10014 IP_STR
10015 EXTCOMMUNITY_LIST_STR
10016 "Extended Community list number (standard)\n"
10017 "Specify community to reject\n"
10018 "Specify community to accept\n")
10019
10020DEFUN (ip_extcommunity_list_expanded,
10021 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010022 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010023 IP_STR
10024 EXTCOMMUNITY_LIST_STR
10025 "Extended Community list number (expanded)\n"
10026 "Specify community to reject\n"
10027 "Specify community to accept\n"
10028 "An ordered list as a regular-expression\n")
10029{
10030 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
10031}
10032
10033DEFUN (ip_extcommunity_list_name_standard,
10034 ip_extcommunity_list_name_standard_cmd,
10035 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10036 IP_STR
10037 EXTCOMMUNITY_LIST_STR
10038 "Specify standard extcommunity-list\n"
10039 "Extended Community list name\n"
10040 "Specify community to reject\n"
10041 "Specify community to accept\n"
10042 EXTCOMMUNITY_VAL_STR)
10043{
10044 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
10045}
10046
10047ALIAS (ip_extcommunity_list_name_standard,
10048 ip_extcommunity_list_name_standard2_cmd,
10049 "ip extcommunity-list standard WORD (deny|permit)",
10050 IP_STR
10051 EXTCOMMUNITY_LIST_STR
10052 "Specify standard extcommunity-list\n"
10053 "Extended Community list name\n"
10054 "Specify community to reject\n"
10055 "Specify community to accept\n")
10056
10057DEFUN (ip_extcommunity_list_name_expanded,
10058 ip_extcommunity_list_name_expanded_cmd,
10059 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
10060 IP_STR
10061 EXTCOMMUNITY_LIST_STR
10062 "Specify expanded extcommunity-list\n"
10063 "Extended Community list name\n"
10064 "Specify community to reject\n"
10065 "Specify community to accept\n"
10066 "An ordered list as a regular-expression\n")
10067{
10068 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
10069}
10070
hassofee6e4e2005-02-02 16:29:31 +000010071DEFUN (no_ip_extcommunity_list_standard_all,
10072 no_ip_extcommunity_list_standard_all_cmd,
10073 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010074 NO_STR
10075 IP_STR
10076 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010077 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010078{
hassofee6e4e2005-02-02 16:29:31 +000010079 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010080}
10081
hassofee6e4e2005-02-02 16:29:31 +000010082DEFUN (no_ip_extcommunity_list_expanded_all,
10083 no_ip_extcommunity_list_expanded_all_cmd,
10084 "no ip extcommunity-list <100-500>",
10085 NO_STR
10086 IP_STR
10087 EXTCOMMUNITY_LIST_STR
10088 "Extended Community list number (expanded)\n")
10089{
10090 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10091}
10092
10093DEFUN (no_ip_extcommunity_list_name_standard_all,
10094 no_ip_extcommunity_list_name_standard_all_cmd,
10095 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010096 NO_STR
10097 IP_STR
10098 EXTCOMMUNITY_LIST_STR
10099 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000010100 "Extended Community list name\n")
10101{
10102 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10103}
10104
10105DEFUN (no_ip_extcommunity_list_name_expanded_all,
10106 no_ip_extcommunity_list_name_expanded_all_cmd,
10107 "no ip extcommunity-list expanded WORD",
10108 NO_STR
10109 IP_STR
10110 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000010111 "Specify expanded extcommunity-list\n"
10112 "Extended Community list name\n")
10113{
hassofee6e4e2005-02-02 16:29:31 +000010114 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010115}
10116
10117DEFUN (no_ip_extcommunity_list_standard,
10118 no_ip_extcommunity_list_standard_cmd,
10119 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10120 NO_STR
10121 IP_STR
10122 EXTCOMMUNITY_LIST_STR
10123 "Extended Community list number (standard)\n"
10124 "Specify community to reject\n"
10125 "Specify community to accept\n"
10126 EXTCOMMUNITY_VAL_STR)
10127{
10128 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10129}
10130
10131DEFUN (no_ip_extcommunity_list_expanded,
10132 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010133 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010134 NO_STR
10135 IP_STR
10136 EXTCOMMUNITY_LIST_STR
10137 "Extended Community list number (expanded)\n"
10138 "Specify community to reject\n"
10139 "Specify community to accept\n"
10140 "An ordered list as a regular-expression\n")
10141{
10142 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10143}
10144
10145DEFUN (no_ip_extcommunity_list_name_standard,
10146 no_ip_extcommunity_list_name_standard_cmd,
10147 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10148 NO_STR
10149 IP_STR
10150 EXTCOMMUNITY_LIST_STR
10151 "Specify standard extcommunity-list\n"
10152 "Extended Community list name\n"
10153 "Specify community to reject\n"
10154 "Specify community to accept\n"
10155 EXTCOMMUNITY_VAL_STR)
10156{
10157 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10158}
10159
10160DEFUN (no_ip_extcommunity_list_name_expanded,
10161 no_ip_extcommunity_list_name_expanded_cmd,
10162 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
10163 NO_STR
10164 IP_STR
10165 EXTCOMMUNITY_LIST_STR
10166 "Specify expanded extcommunity-list\n"
10167 "Community list name\n"
10168 "Specify community to reject\n"
10169 "Specify community to accept\n"
10170 "An ordered list as a regular-expression\n")
10171{
10172 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10173}
10174
10175void
10176extcommunity_list_show (struct vty *vty, struct community_list *list)
10177{
10178 struct community_entry *entry;
10179
10180 for (entry = list->head; entry; entry = entry->next)
10181 {
10182 if (entry == list->head)
10183 {
10184 if (all_digit (list->name))
10185 vty_out (vty, "Extended community %s list %s%s",
10186 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10187 "standard" : "(expanded) access",
10188 list->name, VTY_NEWLINE);
10189 else
10190 vty_out (vty, "Named extended community %s list %s%s",
10191 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10192 "standard" : "expanded",
10193 list->name, VTY_NEWLINE);
10194 }
10195 if (entry->any)
10196 vty_out (vty, " %s%s",
10197 community_direct_str (entry->direct), VTY_NEWLINE);
10198 else
10199 vty_out (vty, " %s %s%s",
10200 community_direct_str (entry->direct),
10201 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10202 entry->u.ecom->str : entry->config,
10203 VTY_NEWLINE);
10204 }
10205}
10206
10207DEFUN (show_ip_extcommunity_list,
10208 show_ip_extcommunity_list_cmd,
10209 "show ip extcommunity-list",
10210 SHOW_STR
10211 IP_STR
10212 "List extended-community list\n")
10213{
10214 struct community_list *list;
10215 struct community_list_master *cm;
10216
hassofee6e4e2005-02-02 16:29:31 +000010217 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010218 if (! cm)
10219 return CMD_SUCCESS;
10220
10221 for (list = cm->num.head; list; list = list->next)
10222 extcommunity_list_show (vty, list);
10223
10224 for (list = cm->str.head; list; list = list->next)
10225 extcommunity_list_show (vty, list);
10226
10227 return CMD_SUCCESS;
10228}
10229
10230DEFUN (show_ip_extcommunity_list_arg,
10231 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010232 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010233 SHOW_STR
10234 IP_STR
10235 "List extended-community list\n"
10236 "Extcommunity-list number\n"
10237 "Extcommunity-list name\n")
10238{
10239 struct community_list *list;
10240
hassofee6e4e2005-02-02 16:29:31 +000010241 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010242 if (! list)
10243 {
10244 vty_out (vty, "%% Can't find extcommunit-list%s", VTY_NEWLINE);
10245 return CMD_WARNING;
10246 }
10247
10248 extcommunity_list_show (vty, list);
10249
10250 return CMD_SUCCESS;
10251}
10252
10253/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000010254static const char *
paul718e3742002-12-13 20:15:29 +000010255community_list_config_str (struct community_entry *entry)
10256{
paulfd79ac92004-10-13 05:06:08 +000010257 const char *str;
paul718e3742002-12-13 20:15:29 +000010258
10259 if (entry->any)
10260 str = "";
10261 else
10262 {
10263 if (entry->style == COMMUNITY_LIST_STANDARD)
10264 str = community_str (entry->u.com);
10265 else
10266 str = entry->config;
10267 }
10268 return str;
10269}
10270
10271/* Display community-list and extcommunity-list configuration. */
10272int
10273community_list_config_write (struct vty *vty)
10274{
10275 struct community_list *list;
10276 struct community_entry *entry;
10277 struct community_list_master *cm;
10278 int write = 0;
10279
10280 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000010281 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010282
10283 for (list = cm->num.head; list; list = list->next)
10284 for (entry = list->head; entry; entry = entry->next)
10285 {
hassofee6e4e2005-02-02 16:29:31 +000010286 vty_out (vty, "ip community-list %s %s %s%s",
10287 list->name, community_direct_str (entry->direct),
10288 community_list_config_str (entry),
10289 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010290 write++;
10291 }
10292 for (list = cm->str.head; list; list = list->next)
10293 for (entry = list->head; entry; entry = entry->next)
10294 {
10295 vty_out (vty, "ip community-list %s %s %s %s%s",
10296 entry->style == COMMUNITY_LIST_STANDARD
10297 ? "standard" : "expanded",
10298 list->name, community_direct_str (entry->direct),
10299 community_list_config_str (entry),
10300 VTY_NEWLINE);
10301 write++;
10302 }
10303
10304 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000010305 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010306
10307 for (list = cm->num.head; list; list = list->next)
10308 for (entry = list->head; entry; entry = entry->next)
10309 {
hassofee6e4e2005-02-02 16:29:31 +000010310 vty_out (vty, "ip extcommunity-list %s %s %s%s",
10311 list->name, community_direct_str (entry->direct),
10312 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010313 write++;
10314 }
10315 for (list = cm->str.head; list; list = list->next)
10316 for (entry = list->head; entry; entry = entry->next)
10317 {
10318 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
10319 entry->style == EXTCOMMUNITY_LIST_STANDARD
10320 ? "standard" : "expanded",
10321 list->name, community_direct_str (entry->direct),
10322 community_list_config_str (entry), VTY_NEWLINE);
10323 write++;
10324 }
10325 return write;
10326}
10327
10328struct cmd_node community_list_node =
10329{
10330 COMMUNITY_LIST_NODE,
10331 "",
10332 1 /* Export to vtysh. */
10333};
10334
10335void
10336community_list_vty ()
10337{
10338 install_node (&community_list_node, community_list_config_write);
10339
10340 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000010341 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
10342 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
10343 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
10344 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
10345 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
10346 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000010347 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
10348 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
10349 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
10350 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000010351 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
10352 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
10353 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
10354 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
10355 install_element (VIEW_NODE, &show_ip_community_list_cmd);
10356 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
10357 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
10358 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
10359
10360 /* Extcommunity-list. */
10361 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
10362 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
10363 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
10364 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
10365 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
10366 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000010367 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
10368 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
10369 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
10370 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000010371 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
10372 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
10373 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
10374 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
10375 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
10376 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
10377 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
10378 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
10379}