blob: 8ee47c7e9c1cbeac64e62a72b7add7767f048f5d [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. */
2505DEFUN (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")
2511{
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
2517DEFUN (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")
2523{
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
2607/* Enforce multihop. */
2608DEFUN (neighbor_enforce_multihop,
2609 neighbor_enforce_multihop_cmd,
2610 NEIGHBOR_CMD2 "enforce-multihop",
2611 NEIGHBOR_STR
2612 NEIGHBOR_ADDR_STR2
2613 "Enforce EBGP neighbors perform multihop\n")
2614{
2615 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_ENFORCE_MULTIHOP);
2616}
2617
2618DEFUN (no_neighbor_enforce_multihop,
2619 no_neighbor_enforce_multihop_cmd,
2620 NO_NEIGHBOR_CMD2 "enforce-multihop",
2621 NO_STR
2622 NEIGHBOR_STR
2623 NEIGHBOR_ADDR_STR2
2624 "Enforce EBGP neighbors perform multihop\n")
2625{
2626 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_ENFORCE_MULTIHOP);
2627}
2628
2629DEFUN (neighbor_description,
2630 neighbor_description_cmd,
2631 NEIGHBOR_CMD2 "description .LINE",
2632 NEIGHBOR_STR
2633 NEIGHBOR_ADDR_STR2
2634 "Neighbor specific description\n"
2635 "Up to 80 characters describing this neighbor\n")
2636{
2637 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00002638 char *str;
paul718e3742002-12-13 20:15:29 +00002639
2640 peer = peer_and_group_lookup_vty (vty, argv[0]);
2641 if (! peer)
2642 return CMD_WARNING;
2643
2644 if (argc == 1)
2645 return CMD_SUCCESS;
2646
ajs3b8b1852005-01-29 18:19:13 +00002647 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00002648
2649 peer_description_set (peer, str);
2650
ajs3b8b1852005-01-29 18:19:13 +00002651 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00002652
2653 return CMD_SUCCESS;
2654}
2655
2656DEFUN (no_neighbor_description,
2657 no_neighbor_description_cmd,
2658 NO_NEIGHBOR_CMD2 "description",
2659 NO_STR
2660 NEIGHBOR_STR
2661 NEIGHBOR_ADDR_STR2
2662 "Neighbor specific description\n")
2663{
2664 struct peer *peer;
2665
2666 peer = peer_and_group_lookup_vty (vty, argv[0]);
2667 if (! peer)
2668 return CMD_WARNING;
2669
2670 peer_description_unset (peer);
2671
2672 return CMD_SUCCESS;
2673}
2674
2675ALIAS (no_neighbor_description,
2676 no_neighbor_description_val_cmd,
2677 NO_NEIGHBOR_CMD2 "description .LINE",
2678 NO_STR
2679 NEIGHBOR_STR
2680 NEIGHBOR_ADDR_STR2
2681 "Neighbor specific description\n"
2682 "Up to 80 characters describing this neighbor\n")
2683
2684/* Neighbor update-source. */
2685int
paulfd79ac92004-10-13 05:06:08 +00002686peer_update_source_vty (struct vty *vty, const char *peer_str,
2687 const char *source_str)
paul718e3742002-12-13 20:15:29 +00002688{
2689 struct peer *peer;
2690 union sockunion *su;
2691
2692 peer = peer_and_group_lookup_vty (vty, peer_str);
2693 if (! peer)
2694 return CMD_WARNING;
2695
2696 if (source_str)
2697 {
2698 su = sockunion_str2su (source_str);
2699 if (su)
2700 {
2701 peer_update_source_addr_set (peer, su);
2702 sockunion_free (su);
2703 }
2704 else
2705 peer_update_source_if_set (peer, source_str);
2706 }
2707 else
2708 peer_update_source_unset (peer);
2709
2710 return CMD_SUCCESS;
2711}
2712
2713DEFUN (neighbor_update_source,
2714 neighbor_update_source_cmd,
2715 NEIGHBOR_CMD2 "update-source WORD",
2716 NEIGHBOR_STR
2717 NEIGHBOR_ADDR_STR2
2718 "Source of routing updates\n"
2719 "Interface name\n")
2720{
2721 return peer_update_source_vty (vty, argv[0], argv[1]);
2722}
2723
2724DEFUN (no_neighbor_update_source,
2725 no_neighbor_update_source_cmd,
2726 NO_NEIGHBOR_CMD2 "update-source",
2727 NO_STR
2728 NEIGHBOR_STR
2729 NEIGHBOR_ADDR_STR2
2730 "Source of routing updates\n"
2731 "Interface name\n")
2732{
2733 return peer_update_source_vty (vty, argv[0], NULL);
2734}
2735
2736int
paulfd79ac92004-10-13 05:06:08 +00002737peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
2738 afi_t afi, safi_t safi,
2739 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00002740{
2741 int ret;
2742 struct peer *peer;
2743
2744 peer = peer_and_group_lookup_vty (vty, peer_str);
2745 if (! peer)
2746 return CMD_WARNING;
2747
2748 if (set)
2749 ret = peer_default_originate_set (peer, afi, safi, rmap);
2750 else
2751 ret = peer_default_originate_unset (peer, afi, safi);
2752
2753 return bgp_vty_return (vty, ret);
2754}
2755
2756/* neighbor default-originate. */
2757DEFUN (neighbor_default_originate,
2758 neighbor_default_originate_cmd,
2759 NEIGHBOR_CMD2 "default-originate",
2760 NEIGHBOR_STR
2761 NEIGHBOR_ADDR_STR2
2762 "Originate default route to this neighbor\n")
2763{
2764 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2765 bgp_node_safi (vty), NULL, 1);
2766}
2767
2768DEFUN (neighbor_default_originate_rmap,
2769 neighbor_default_originate_rmap_cmd,
2770 NEIGHBOR_CMD2 "default-originate route-map WORD",
2771 NEIGHBOR_STR
2772 NEIGHBOR_ADDR_STR2
2773 "Originate default route to this neighbor\n"
2774 "Route-map to specify criteria to originate default\n"
2775 "route-map name\n")
2776{
2777 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2778 bgp_node_safi (vty), argv[1], 1);
2779}
2780
2781DEFUN (no_neighbor_default_originate,
2782 no_neighbor_default_originate_cmd,
2783 NO_NEIGHBOR_CMD2 "default-originate",
2784 NO_STR
2785 NEIGHBOR_STR
2786 NEIGHBOR_ADDR_STR2
2787 "Originate default route to this neighbor\n")
2788{
2789 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2790 bgp_node_safi (vty), NULL, 0);
2791}
2792
2793ALIAS (no_neighbor_default_originate,
2794 no_neighbor_default_originate_rmap_cmd,
2795 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
2796 NO_STR
2797 NEIGHBOR_STR
2798 NEIGHBOR_ADDR_STR2
2799 "Originate default route to this neighbor\n"
2800 "Route-map to specify criteria to originate default\n"
2801 "route-map name\n")
2802
2803/* Set neighbor's BGP port. */
2804int
paulfd79ac92004-10-13 05:06:08 +00002805peer_port_vty (struct vty *vty, const char *ip_str, int afi,
2806 const char *port_str)
paul718e3742002-12-13 20:15:29 +00002807{
2808 struct peer *peer;
2809 u_int16_t port;
2810 struct servent *sp;
2811
2812 peer = peer_lookup_vty (vty, ip_str);
2813 if (! peer)
2814 return CMD_WARNING;
2815
2816 if (! port_str)
2817 {
2818 sp = getservbyname ("bgp", "tcp");
2819 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
2820 }
2821 else
2822 {
2823 VTY_GET_INTEGER("port", port, port_str);
2824 }
2825
2826 peer_port_set (peer, port);
2827
2828 return CMD_SUCCESS;
2829}
2830
hassof4184462005-02-01 20:13:16 +00002831/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00002832DEFUN (neighbor_port,
2833 neighbor_port_cmd,
2834 NEIGHBOR_CMD "port <0-65535>",
2835 NEIGHBOR_STR
2836 NEIGHBOR_ADDR_STR
2837 "Neighbor's BGP port\n"
2838 "TCP port number\n")
2839{
2840 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
2841}
2842
2843DEFUN (no_neighbor_port,
2844 no_neighbor_port_cmd,
2845 NO_NEIGHBOR_CMD "port",
2846 NO_STR
2847 NEIGHBOR_STR
2848 NEIGHBOR_ADDR_STR
2849 "Neighbor's BGP port\n")
2850{
2851 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
2852}
2853
2854ALIAS (no_neighbor_port,
2855 no_neighbor_port_val_cmd,
2856 NO_NEIGHBOR_CMD "port <0-65535>",
2857 NO_STR
2858 NEIGHBOR_STR
2859 NEIGHBOR_ADDR_STR
2860 "Neighbor's BGP port\n"
2861 "TCP port number\n")
2862
2863/* neighbor weight. */
2864int
paulfd79ac92004-10-13 05:06:08 +00002865peer_weight_set_vty (struct vty *vty, const char *ip_str,
2866 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00002867{
2868 int ret;
2869 struct peer *peer;
2870 unsigned long weight;
2871
2872 peer = peer_and_group_lookup_vty (vty, ip_str);
2873 if (! peer)
2874 return CMD_WARNING;
2875
2876 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
2877
2878 ret = peer_weight_set (peer, weight);
2879
2880 return CMD_SUCCESS;
2881}
2882
2883int
paulfd79ac92004-10-13 05:06:08 +00002884peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002885{
2886 struct peer *peer;
2887
2888 peer = peer_and_group_lookup_vty (vty, ip_str);
2889 if (! peer)
2890 return CMD_WARNING;
2891
2892 peer_weight_unset (peer);
2893
2894 return CMD_SUCCESS;
2895}
2896
2897DEFUN (neighbor_weight,
2898 neighbor_weight_cmd,
2899 NEIGHBOR_CMD2 "weight <0-65535>",
2900 NEIGHBOR_STR
2901 NEIGHBOR_ADDR_STR2
2902 "Set default weight for routes from this neighbor\n"
2903 "default weight\n")
2904{
2905 return peer_weight_set_vty (vty, argv[0], argv[1]);
2906}
2907
2908DEFUN (no_neighbor_weight,
2909 no_neighbor_weight_cmd,
2910 NO_NEIGHBOR_CMD2 "weight",
2911 NO_STR
2912 NEIGHBOR_STR
2913 NEIGHBOR_ADDR_STR2
2914 "Set default weight for routes from this neighbor\n")
2915{
2916 return peer_weight_unset_vty (vty, argv[0]);
2917}
2918
2919ALIAS (no_neighbor_weight,
2920 no_neighbor_weight_val_cmd,
2921 NO_NEIGHBOR_CMD2 "weight <0-65535>",
2922 NO_STR
2923 NEIGHBOR_STR
2924 NEIGHBOR_ADDR_STR2
2925 "Set default weight for routes from this neighbor\n"
2926 "default weight\n")
2927
2928/* Override capability negotiation. */
2929DEFUN (neighbor_override_capability,
2930 neighbor_override_capability_cmd,
2931 NEIGHBOR_CMD2 "override-capability",
2932 NEIGHBOR_STR
2933 NEIGHBOR_ADDR_STR2
2934 "Override capability negotiation result\n")
2935{
2936 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
2937}
2938
2939DEFUN (no_neighbor_override_capability,
2940 no_neighbor_override_capability_cmd,
2941 NO_NEIGHBOR_CMD2 "override-capability",
2942 NO_STR
2943 NEIGHBOR_STR
2944 NEIGHBOR_ADDR_STR2
2945 "Override capability negotiation result\n")
2946{
2947 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
2948}
2949
2950DEFUN (neighbor_strict_capability,
2951 neighbor_strict_capability_cmd,
2952 NEIGHBOR_CMD "strict-capability-match",
2953 NEIGHBOR_STR
2954 NEIGHBOR_ADDR_STR
2955 "Strict capability negotiation match\n")
2956{
2957 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
2958}
2959
2960DEFUN (no_neighbor_strict_capability,
2961 no_neighbor_strict_capability_cmd,
2962 NO_NEIGHBOR_CMD "strict-capability-match",
2963 NO_STR
2964 NEIGHBOR_STR
2965 NEIGHBOR_ADDR_STR
2966 "Strict capability negotiation match\n")
2967{
2968 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
2969}
2970
2971int
paulfd79ac92004-10-13 05:06:08 +00002972peer_timers_set_vty (struct vty *vty, const char *ip_str,
2973 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00002974{
2975 int ret;
2976 struct peer *peer;
2977 u_int32_t keepalive;
2978 u_int32_t holdtime;
2979
2980 peer = peer_and_group_lookup_vty (vty, ip_str);
2981 if (! peer)
2982 return CMD_WARNING;
2983
2984 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
2985 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
2986
2987 ret = peer_timers_set (peer, keepalive, holdtime);
2988
2989 return bgp_vty_return (vty, ret);
2990}
2991
2992int
paulfd79ac92004-10-13 05:06:08 +00002993peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002994{
2995 int ret;
2996 struct peer *peer;
2997
2998 peer = peer_lookup_vty (vty, ip_str);
2999 if (! peer)
3000 return CMD_WARNING;
3001
3002 ret = peer_timers_unset (peer);
3003
3004 return bgp_vty_return (vty, ret);
3005}
3006
3007DEFUN (neighbor_timers,
3008 neighbor_timers_cmd,
3009 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3010 NEIGHBOR_STR
3011 NEIGHBOR_ADDR_STR2
3012 "BGP per neighbor timers\n"
3013 "Keepalive interval\n"
3014 "Holdtime\n")
3015{
3016 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3017}
3018
3019DEFUN (no_neighbor_timers,
3020 no_neighbor_timers_cmd,
3021 NO_NEIGHBOR_CMD2 "timers",
3022 NO_STR
3023 NEIGHBOR_STR
3024 NEIGHBOR_ADDR_STR2
3025 "BGP per neighbor timers\n")
3026{
3027 return peer_timers_unset_vty (vty, argv[0]);
3028}
3029
3030int
paulfd79ac92004-10-13 05:06:08 +00003031peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3032 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003033{
3034 int ret;
3035 struct peer *peer;
3036 u_int32_t connect;
3037
3038 peer = peer_lookup_vty (vty, ip_str);
3039 if (! peer)
3040 return CMD_WARNING;
3041
3042 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3043
3044 ret = peer_timers_connect_set (peer, connect);
3045
3046 return CMD_SUCCESS;
3047}
3048
3049int
paulfd79ac92004-10-13 05:06:08 +00003050peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003051{
3052 int ret;
3053 struct peer *peer;
3054
3055 peer = peer_and_group_lookup_vty (vty, ip_str);
3056 if (! peer)
3057 return CMD_WARNING;
3058
3059 ret = peer_timers_connect_unset (peer);
3060
3061 return CMD_SUCCESS;
3062}
3063
3064DEFUN (neighbor_timers_connect,
3065 neighbor_timers_connect_cmd,
3066 NEIGHBOR_CMD "timers connect <0-65535>",
3067 NEIGHBOR_STR
3068 NEIGHBOR_ADDR_STR
3069 "BGP per neighbor timers\n"
3070 "BGP connect timer\n"
3071 "Connect timer\n")
3072{
3073 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3074}
3075
3076DEFUN (no_neighbor_timers_connect,
3077 no_neighbor_timers_connect_cmd,
3078 NO_NEIGHBOR_CMD "timers connect",
3079 NO_STR
3080 NEIGHBOR_STR
3081 NEIGHBOR_ADDR_STR
3082 "BGP per neighbor timers\n"
3083 "BGP connect timer\n")
3084{
3085 return peer_timers_connect_unset_vty (vty, argv[0]);
3086}
3087
3088ALIAS (no_neighbor_timers_connect,
3089 no_neighbor_timers_connect_val_cmd,
3090 NO_NEIGHBOR_CMD "timers connect <0-65535>",
3091 NO_STR
3092 NEIGHBOR_STR
3093 NEIGHBOR_ADDR_STR
3094 "BGP per neighbor timers\n"
3095 "BGP connect timer\n"
3096 "Connect timer\n")
3097
3098int
paulfd79ac92004-10-13 05:06:08 +00003099peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3100 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003101{
3102 int ret;
3103 struct peer *peer;
3104 u_int32_t routeadv = 0;
3105
3106 peer = peer_lookup_vty (vty, ip_str);
3107 if (! peer)
3108 return CMD_WARNING;
3109
3110 if (time_str)
3111 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3112
3113 if (set)
3114 ret = peer_advertise_interval_set (peer, routeadv);
3115 else
3116 ret = peer_advertise_interval_unset (peer);
3117
3118 return CMD_SUCCESS;
3119}
3120
3121DEFUN (neighbor_advertise_interval,
3122 neighbor_advertise_interval_cmd,
3123 NEIGHBOR_CMD "advertisement-interval <0-600>",
3124 NEIGHBOR_STR
3125 NEIGHBOR_ADDR_STR
3126 "Minimum interval between sending BGP routing updates\n"
3127 "time in seconds\n")
3128{
3129 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3130}
3131
3132DEFUN (no_neighbor_advertise_interval,
3133 no_neighbor_advertise_interval_cmd,
3134 NO_NEIGHBOR_CMD "advertisement-interval",
3135 NO_STR
3136 NEIGHBOR_STR
3137 NEIGHBOR_ADDR_STR
3138 "Minimum interval between sending BGP routing updates\n")
3139{
3140 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3141}
3142
3143ALIAS (no_neighbor_advertise_interval,
3144 no_neighbor_advertise_interval_val_cmd,
3145 NO_NEIGHBOR_CMD "advertisement-interval <0-600>",
3146 NO_STR
3147 NEIGHBOR_STR
3148 NEIGHBOR_ADDR_STR
3149 "Minimum interval between sending BGP routing updates\n"
3150 "time in seconds\n")
3151
paul718e3742002-12-13 20:15:29 +00003152/* neighbor interface */
3153int
paulfd79ac92004-10-13 05:06:08 +00003154peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003155{
3156 int ret;
3157 struct peer *peer;
3158
3159 peer = peer_lookup_vty (vty, ip_str);
3160 if (! peer)
3161 return CMD_WARNING;
3162
3163 if (str)
3164 ret = peer_interface_set (peer, str);
3165 else
3166 ret = peer_interface_unset (peer);
3167
3168 return CMD_SUCCESS;
3169}
3170
3171DEFUN (neighbor_interface,
3172 neighbor_interface_cmd,
3173 NEIGHBOR_CMD "interface WORD",
3174 NEIGHBOR_STR
3175 NEIGHBOR_ADDR_STR
3176 "Interface\n"
3177 "Interface name\n")
3178{
3179 return peer_interface_vty (vty, argv[0], argv[1]);
3180}
3181
3182DEFUN (no_neighbor_interface,
3183 no_neighbor_interface_cmd,
3184 NO_NEIGHBOR_CMD "interface WORD",
3185 NO_STR
3186 NEIGHBOR_STR
3187 NEIGHBOR_ADDR_STR
3188 "Interface\n"
3189 "Interface name\n")
3190{
3191 return peer_interface_vty (vty, argv[0], NULL);
3192}
3193
3194/* Set distribute list to the peer. */
3195int
paulfd79ac92004-10-13 05:06:08 +00003196peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3197 afi_t afi, safi_t safi,
3198 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003199{
3200 int ret;
3201 struct peer *peer;
3202 int direct = FILTER_IN;
3203
3204 peer = peer_and_group_lookup_vty (vty, ip_str);
3205 if (! peer)
3206 return CMD_WARNING;
3207
3208 /* Check filter direction. */
3209 if (strncmp (direct_str, "i", 1) == 0)
3210 direct = FILTER_IN;
3211 else if (strncmp (direct_str, "o", 1) == 0)
3212 direct = FILTER_OUT;
3213
3214 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3215
3216 return bgp_vty_return (vty, ret);
3217}
3218
3219int
paulfd79ac92004-10-13 05:06:08 +00003220peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3221 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003222{
3223 int ret;
3224 struct peer *peer;
3225 int direct = FILTER_IN;
3226
3227 peer = peer_and_group_lookup_vty (vty, ip_str);
3228 if (! peer)
3229 return CMD_WARNING;
3230
3231 /* Check filter direction. */
3232 if (strncmp (direct_str, "i", 1) == 0)
3233 direct = FILTER_IN;
3234 else if (strncmp (direct_str, "o", 1) == 0)
3235 direct = FILTER_OUT;
3236
3237 ret = peer_distribute_unset (peer, afi, safi, direct);
3238
3239 return bgp_vty_return (vty, ret);
3240}
3241
3242DEFUN (neighbor_distribute_list,
3243 neighbor_distribute_list_cmd,
3244 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3245 NEIGHBOR_STR
3246 NEIGHBOR_ADDR_STR2
3247 "Filter updates to/from this neighbor\n"
3248 "IP access-list number\n"
3249 "IP access-list number (expanded range)\n"
3250 "IP Access-list name\n"
3251 "Filter incoming updates\n"
3252 "Filter outgoing updates\n")
3253{
3254 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3255 bgp_node_safi (vty), argv[1], argv[2]);
3256}
3257
3258DEFUN (no_neighbor_distribute_list,
3259 no_neighbor_distribute_list_cmd,
3260 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3261 NO_STR
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_unset_vty (vty, argv[0], bgp_node_afi (vty),
3272 bgp_node_safi (vty), argv[2]);
3273}
3274
3275/* Set prefix list to the peer. */
3276int
paulfd79ac92004-10-13 05:06:08 +00003277peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3278 safi_t safi, const char *name_str,
3279 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003280{
3281 int ret;
3282 struct peer *peer;
3283 int direct = FILTER_IN;
3284
3285 peer = peer_and_group_lookup_vty (vty, ip_str);
3286 if (! peer)
3287 return CMD_WARNING;
3288
3289 /* Check filter direction. */
3290 if (strncmp (direct_str, "i", 1) == 0)
3291 direct = FILTER_IN;
3292 else if (strncmp (direct_str, "o", 1) == 0)
3293 direct = FILTER_OUT;
3294
3295 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3296
3297 return bgp_vty_return (vty, ret);
3298}
3299
3300int
paulfd79ac92004-10-13 05:06:08 +00003301peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3302 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003303{
3304 int ret;
3305 struct peer *peer;
3306 int direct = FILTER_IN;
3307
3308 peer = peer_and_group_lookup_vty (vty, ip_str);
3309 if (! peer)
3310 return CMD_WARNING;
3311
3312 /* Check filter direction. */
3313 if (strncmp (direct_str, "i", 1) == 0)
3314 direct = FILTER_IN;
3315 else if (strncmp (direct_str, "o", 1) == 0)
3316 direct = FILTER_OUT;
3317
3318 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3319
3320 return bgp_vty_return (vty, ret);
3321}
3322
3323DEFUN (neighbor_prefix_list,
3324 neighbor_prefix_list_cmd,
3325 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3326 NEIGHBOR_STR
3327 NEIGHBOR_ADDR_STR2
3328 "Filter updates to/from this neighbor\n"
3329 "Name of a prefix list\n"
3330 "Filter incoming updates\n"
3331 "Filter outgoing updates\n")
3332{
3333 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3334 bgp_node_safi (vty), argv[1], argv[2]);
3335}
3336
3337DEFUN (no_neighbor_prefix_list,
3338 no_neighbor_prefix_list_cmd,
3339 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3340 NO_STR
3341 NEIGHBOR_STR
3342 NEIGHBOR_ADDR_STR2
3343 "Filter updates to/from this neighbor\n"
3344 "Name of a prefix list\n"
3345 "Filter incoming updates\n"
3346 "Filter outgoing updates\n")
3347{
3348 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3349 bgp_node_safi (vty), argv[2]);
3350}
3351
3352int
paulfd79ac92004-10-13 05:06:08 +00003353peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3354 afi_t afi, safi_t safi,
3355 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003356{
3357 int ret;
3358 struct peer *peer;
3359 int direct = FILTER_IN;
3360
3361 peer = peer_and_group_lookup_vty (vty, ip_str);
3362 if (! peer)
3363 return CMD_WARNING;
3364
3365 /* Check filter direction. */
3366 if (strncmp (direct_str, "i", 1) == 0)
3367 direct = FILTER_IN;
3368 else if (strncmp (direct_str, "o", 1) == 0)
3369 direct = FILTER_OUT;
3370
3371 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3372
3373 return bgp_vty_return (vty, ret);
3374}
3375
3376int
paulfd79ac92004-10-13 05:06:08 +00003377peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3378 afi_t afi, safi_t safi,
3379 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003380{
3381 int ret;
3382 struct peer *peer;
3383 int direct = FILTER_IN;
3384
3385 peer = peer_and_group_lookup_vty (vty, ip_str);
3386 if (! peer)
3387 return CMD_WARNING;
3388
3389 /* Check filter direction. */
3390 if (strncmp (direct_str, "i", 1) == 0)
3391 direct = FILTER_IN;
3392 else if (strncmp (direct_str, "o", 1) == 0)
3393 direct = FILTER_OUT;
3394
3395 ret = peer_aslist_unset (peer, afi, safi, direct);
3396
3397 return bgp_vty_return (vty, ret);
3398}
3399
3400DEFUN (neighbor_filter_list,
3401 neighbor_filter_list_cmd,
3402 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3403 NEIGHBOR_STR
3404 NEIGHBOR_ADDR_STR2
3405 "Establish BGP filters\n"
3406 "AS path access-list name\n"
3407 "Filter incoming routes\n"
3408 "Filter outgoing routes\n")
3409{
3410 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3411 bgp_node_safi (vty), argv[1], argv[2]);
3412}
3413
3414DEFUN (no_neighbor_filter_list,
3415 no_neighbor_filter_list_cmd,
3416 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3417 NO_STR
3418 NEIGHBOR_STR
3419 NEIGHBOR_ADDR_STR2
3420 "Establish BGP filters\n"
3421 "AS path access-list name\n"
3422 "Filter incoming routes\n"
3423 "Filter outgoing routes\n")
3424{
3425 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3426 bgp_node_safi (vty), argv[2]);
3427}
3428
3429/* Set route-map to the peer. */
3430int
paulfd79ac92004-10-13 05:06:08 +00003431peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3432 afi_t afi, safi_t safi,
3433 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003434{
3435 int ret;
3436 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003437 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003438
3439 peer = peer_and_group_lookup_vty (vty, ip_str);
3440 if (! peer)
3441 return CMD_WARNING;
3442
3443 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003444 if (strncmp (direct_str, "in", 2) == 0)
3445 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003446 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003447 direct = RMAP_OUT;
3448 else if (strncmp (direct_str, "im", 2) == 0)
3449 direct = RMAP_IMPORT;
3450 else if (strncmp (direct_str, "e", 1) == 0)
3451 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003452
3453 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3454
3455 return bgp_vty_return (vty, ret);
3456}
3457
3458int
paulfd79ac92004-10-13 05:06:08 +00003459peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3460 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003461{
3462 int ret;
3463 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003464 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003465
3466 peer = peer_and_group_lookup_vty (vty, ip_str);
3467 if (! peer)
3468 return CMD_WARNING;
3469
3470 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003471 if (strncmp (direct_str, "in", 2) == 0)
3472 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003473 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003474 direct = RMAP_OUT;
3475 else if (strncmp (direct_str, "im", 2) == 0)
3476 direct = RMAP_IMPORT;
3477 else if (strncmp (direct_str, "e", 1) == 0)
3478 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003479
3480 ret = peer_route_map_unset (peer, afi, safi, direct);
3481
3482 return bgp_vty_return (vty, ret);
3483}
3484
3485DEFUN (neighbor_route_map,
3486 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003487 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003488 NEIGHBOR_STR
3489 NEIGHBOR_ADDR_STR2
3490 "Apply route map to neighbor\n"
3491 "Name of route map\n"
3492 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003493 "Apply map to outbound routes\n"
3494 "Apply map to routes going into a Route-Server client's table\n"
3495 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003496{
3497 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3498 bgp_node_safi (vty), argv[1], argv[2]);
3499}
3500
3501DEFUN (no_neighbor_route_map,
3502 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003503 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003504 NO_STR
3505 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_unset_vty (vty, argv[0], bgp_node_afi (vty),
3515 bgp_node_safi (vty), argv[2]);
3516}
3517
3518/* Set unsuppress-map to the peer. */
3519int
paulfd79ac92004-10-13 05:06:08 +00003520peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3521 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003522{
3523 int ret;
3524 struct peer *peer;
3525
3526 peer = peer_and_group_lookup_vty (vty, ip_str);
3527 if (! peer)
3528 return CMD_WARNING;
3529
3530 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3531
3532 return bgp_vty_return (vty, ret);
3533}
3534
3535/* Unset route-map from the peer. */
3536int
paulfd79ac92004-10-13 05:06:08 +00003537peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003538 safi_t safi)
3539{
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_unset (peer, afi, safi);
3548
3549 return bgp_vty_return (vty, ret);
3550}
3551
3552DEFUN (neighbor_unsuppress_map,
3553 neighbor_unsuppress_map_cmd,
3554 NEIGHBOR_CMD2 "unsuppress-map WORD",
3555 NEIGHBOR_STR
3556 NEIGHBOR_ADDR_STR2
3557 "Route-map to selectively unsuppress suppressed routes\n"
3558 "Name of route map\n")
3559{
3560 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3561 bgp_node_safi (vty), argv[1]);
3562}
3563
3564DEFUN (no_neighbor_unsuppress_map,
3565 no_neighbor_unsuppress_map_cmd,
3566 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3567 NO_STR
3568 NEIGHBOR_STR
3569 NEIGHBOR_ADDR_STR2
3570 "Route-map to selectively unsuppress suppressed routes\n"
3571 "Name of route map\n")
3572{
3573 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3574 bgp_node_safi (vty));
3575}
3576
3577int
paulfd79ac92004-10-13 05:06:08 +00003578peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3579 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003580 const char *threshold_str, int warning,
3581 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003582{
3583 int ret;
3584 struct peer *peer;
3585 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003586 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003587 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003588
3589 peer = peer_and_group_lookup_vty (vty, ip_str);
3590 if (! peer)
3591 return CMD_WARNING;
3592
3593 VTY_GET_INTEGER ("maxmum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003594 if (threshold_str)
3595 threshold = atoi (threshold_str);
3596 else
3597 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00003598
hasso0a486e52005-02-01 20:57:17 +00003599 if (restart_str)
3600 restart = atoi (restart_str);
3601 else
3602 restart = 0;
3603
3604 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00003605
3606 return bgp_vty_return (vty, ret);
3607}
3608
3609int
paulfd79ac92004-10-13 05:06:08 +00003610peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003611 safi_t safi)
3612{
3613 int ret;
3614 struct peer *peer;
3615
3616 peer = peer_and_group_lookup_vty (vty, ip_str);
3617 if (! peer)
3618 return CMD_WARNING;
3619
3620 ret = peer_maximum_prefix_unset (peer, afi, safi);
3621
3622 return bgp_vty_return (vty, ret);
3623}
3624
3625/* Maximum number of prefix configuration. prefix count is different
3626 for each peer configuration. So this configuration can be set for
3627 each peer configuration. */
3628DEFUN (neighbor_maximum_prefix,
3629 neighbor_maximum_prefix_cmd,
3630 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3631 NEIGHBOR_STR
3632 NEIGHBOR_ADDR_STR2
3633 "Maximum number of prefix accept from this peer\n"
3634 "maximum no. of prefix limit\n")
3635{
3636 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003637 bgp_node_safi (vty), argv[1], NULL, 0,
3638 NULL);
paul718e3742002-12-13 20:15:29 +00003639}
3640
hassoe0701b72004-05-20 09:19:34 +00003641DEFUN (neighbor_maximum_prefix_threshold,
3642 neighbor_maximum_prefix_threshold_cmd,
3643 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
3644 NEIGHBOR_STR
3645 NEIGHBOR_ADDR_STR2
3646 "Maximum number of prefix accept from this peer\n"
3647 "maximum no. of prefix limit\n"
3648 "Threshold value (%) at which to generate a warning msg\n")
3649{
3650 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003651 bgp_node_safi (vty), argv[1], argv[2], 0,
3652 NULL);
3653}
hassoe0701b72004-05-20 09:19:34 +00003654
paul718e3742002-12-13 20:15:29 +00003655DEFUN (neighbor_maximum_prefix_warning,
3656 neighbor_maximum_prefix_warning_cmd,
3657 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3658 NEIGHBOR_STR
3659 NEIGHBOR_ADDR_STR2
3660 "Maximum number of prefix accept from this peer\n"
3661 "maximum no. of prefix limit\n"
3662 "Only give warning message when limit is exceeded\n")
3663{
3664 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003665 bgp_node_safi (vty), argv[1], NULL, 1,
3666 NULL);
paul718e3742002-12-13 20:15:29 +00003667}
3668
hassoe0701b72004-05-20 09:19:34 +00003669DEFUN (neighbor_maximum_prefix_threshold_warning,
3670 neighbor_maximum_prefix_threshold_warning_cmd,
3671 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
3672 NEIGHBOR_STR
3673 NEIGHBOR_ADDR_STR2
3674 "Maximum number of prefix accept from this peer\n"
3675 "maximum no. of prefix limit\n"
3676 "Threshold value (%) at which to generate a warning msg\n"
3677 "Only give warning message when limit is exceeded\n")
3678{
3679 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003680 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
3681}
3682
3683DEFUN (neighbor_maximum_prefix_restart,
3684 neighbor_maximum_prefix_restart_cmd,
3685 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
3686 NEIGHBOR_STR
3687 NEIGHBOR_ADDR_STR2
3688 "Maximum number of prefix accept from this peer\n"
3689 "maximum no. of prefix limit\n"
3690 "Restart bgp connection after limit is exceeded\n"
3691 "Restart interval in minutes")
3692{
3693 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3694 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
3695}
3696
3697DEFUN (neighbor_maximum_prefix_threshold_restart,
3698 neighbor_maximum_prefix_threshold_restart_cmd,
3699 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
3700 NEIGHBOR_STR
3701 NEIGHBOR_ADDR_STR2
3702 "Maximum number of prefix accept from this peer\n"
3703 "maximum no. of prefix limit\n"
3704 "Threshold value (%) at which to generate a warning msg\n"
3705 "Restart bgp connection after limit is exceeded\n"
3706 "Restart interval in minutes")
3707{
3708 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3709 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
3710}
hassoe0701b72004-05-20 09:19:34 +00003711
paul718e3742002-12-13 20:15:29 +00003712DEFUN (no_neighbor_maximum_prefix,
3713 no_neighbor_maximum_prefix_cmd,
3714 NO_NEIGHBOR_CMD2 "maximum-prefix",
3715 NO_STR
3716 NEIGHBOR_STR
3717 NEIGHBOR_ADDR_STR2
3718 "Maximum number of prefix accept from this peer\n")
3719{
3720 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
3721 bgp_node_safi (vty));
3722}
3723
3724ALIAS (no_neighbor_maximum_prefix,
3725 no_neighbor_maximum_prefix_val_cmd,
3726 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3727 NO_STR
3728 NEIGHBOR_STR
3729 NEIGHBOR_ADDR_STR2
3730 "Maximum number of prefix accept from this peer\n"
3731 "maximum no. of prefix limit\n")
3732
3733ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00003734 no_neighbor_maximum_prefix_threshold_cmd,
3735 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3736 NO_STR
3737 NEIGHBOR_STR
3738 NEIGHBOR_ADDR_STR2
3739 "Maximum number of prefix accept from this peer\n"
3740 "maximum no. of prefix limit\n"
3741 "Threshold value (%) at which to generate a warning msg\n")
3742
3743ALIAS (no_neighbor_maximum_prefix,
3744 no_neighbor_maximum_prefix_warning_cmd,
3745 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3746 NO_STR
3747 NEIGHBOR_STR
3748 NEIGHBOR_ADDR_STR2
3749 "Maximum number of prefix accept from this peer\n"
3750 "maximum no. of prefix limit\n"
3751 "Only give warning message when limit is exceeded\n");
3752
3753ALIAS (no_neighbor_maximum_prefix,
3754 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00003755 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
3756 NO_STR
3757 NEIGHBOR_STR
3758 NEIGHBOR_ADDR_STR2
3759 "Maximum number of prefix accept from this peer\n"
3760 "maximum no. of prefix limit\n"
3761 "Threshold value (%) at which to generate a warning msg\n"
hasso0a486e52005-02-01 20:57:17 +00003762 "Only give warning message when limit is exceeded\n");
hassoe0701b72004-05-20 09:19:34 +00003763
3764ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00003765 no_neighbor_maximum_prefix_restart_cmd,
3766 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00003767 NO_STR
3768 NEIGHBOR_STR
3769 NEIGHBOR_ADDR_STR2
3770 "Maximum number of prefix accept from this peer\n"
3771 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00003772 "Restart bgp connection after limit is exceeded\n"
3773 "Restart interval in minutes")
3774
3775ALIAS (no_neighbor_maximum_prefix,
3776 no_neighbor_maximum_prefix_threshold_restart_cmd,
3777 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
3778 NO_STR
3779 NEIGHBOR_STR
3780 NEIGHBOR_ADDR_STR2
3781 "Maximum number of prefix accept from this peer\n"
3782 "maximum no. of prefix limit\n"
3783 "Threshold value (%) at which to generate a warning msg\n"
3784 "Restart bgp connection after limit is exceeded\n"
3785 "Restart interval in minutes")
paul718e3742002-12-13 20:15:29 +00003786
3787/* "neighbor allowas-in" */
3788DEFUN (neighbor_allowas_in,
3789 neighbor_allowas_in_cmd,
3790 NEIGHBOR_CMD2 "allowas-in",
3791 NEIGHBOR_STR
3792 NEIGHBOR_ADDR_STR2
3793 "Accept as-path with my AS present in it\n")
3794{
3795 int ret;
3796 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00003797 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00003798
3799 peer = peer_and_group_lookup_vty (vty, argv[0]);
3800 if (! peer)
3801 return CMD_WARNING;
3802
3803 if (argc == 1)
3804 allow_num = 3;
3805 else
3806 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
3807
3808 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
3809 allow_num);
3810
3811 return bgp_vty_return (vty, ret);
3812}
3813
3814ALIAS (neighbor_allowas_in,
3815 neighbor_allowas_in_arg_cmd,
3816 NEIGHBOR_CMD2 "allowas-in <1-10>",
3817 NEIGHBOR_STR
3818 NEIGHBOR_ADDR_STR2
3819 "Accept as-path with my AS present in it\n"
3820 "Number of occurances of AS number\n")
3821
3822DEFUN (no_neighbor_allowas_in,
3823 no_neighbor_allowas_in_cmd,
3824 NO_NEIGHBOR_CMD2 "allowas-in",
3825 NO_STR
3826 NEIGHBOR_STR
3827 NEIGHBOR_ADDR_STR2
3828 "allow local ASN appears in aspath attribute\n")
3829{
3830 int ret;
3831 struct peer *peer;
3832
3833 peer = peer_and_group_lookup_vty (vty, argv[0]);
3834 if (! peer)
3835 return CMD_WARNING;
3836
3837 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
3838
3839 return bgp_vty_return (vty, ret);
3840}
3841
3842/* Address family configuration. */
3843DEFUN (address_family_ipv4,
3844 address_family_ipv4_cmd,
3845 "address-family ipv4",
3846 "Enter Address Family command mode\n"
3847 "Address family\n")
3848{
3849 vty->node = BGP_IPV4_NODE;
3850 return CMD_SUCCESS;
3851}
3852
3853DEFUN (address_family_ipv4_safi,
3854 address_family_ipv4_safi_cmd,
3855 "address-family ipv4 (unicast|multicast)",
3856 "Enter Address Family command mode\n"
3857 "Address family\n"
3858 "Address Family modifier\n"
3859 "Address Family modifier\n")
3860{
3861 if (strncmp (argv[0], "m", 1) == 0)
3862 vty->node = BGP_IPV4M_NODE;
3863 else
3864 vty->node = BGP_IPV4_NODE;
3865
3866 return CMD_SUCCESS;
3867}
3868
3869DEFUN (address_family_ipv6_unicast,
3870 address_family_ipv6_unicast_cmd,
3871 "address-family ipv6 unicast",
3872 "Enter Address Family command mode\n"
3873 "Address family\n"
3874 "unicast\n")
3875{
3876 vty->node = BGP_IPV6_NODE;
3877 return CMD_SUCCESS;
3878}
3879
3880ALIAS (address_family_ipv6_unicast,
3881 address_family_ipv6_cmd,
3882 "address-family ipv6",
3883 "Enter Address Family command mode\n"
3884 "Address family\n")
3885
3886DEFUN (address_family_vpnv4,
3887 address_family_vpnv4_cmd,
3888 "address-family vpnv4",
3889 "Enter Address Family command mode\n"
3890 "Address family\n")
3891{
3892 vty->node = BGP_VPNV4_NODE;
3893 return CMD_SUCCESS;
3894}
3895
3896ALIAS (address_family_vpnv4,
3897 address_family_vpnv4_unicast_cmd,
3898 "address-family vpnv4 unicast",
3899 "Enter Address Family command mode\n"
3900 "Address family\n"
3901 "Address Family Modifier\n")
3902
3903DEFUN (exit_address_family,
3904 exit_address_family_cmd,
3905 "exit-address-family",
3906 "Exit from Address Family configuration mode\n")
3907{
3908 if (vty->node == BGP_IPV4M_NODE
3909 || vty->node == BGP_VPNV4_NODE
3910 || vty->node == BGP_IPV6_NODE)
3911 vty->node = BGP_NODE;
3912 return CMD_SUCCESS;
3913}
3914
3915/* BGP clear sort. */
3916enum clear_sort
3917{
3918 clear_all,
3919 clear_peer,
3920 clear_group,
3921 clear_external,
3922 clear_as
3923};
3924
3925void
3926bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
3927 safi_t safi, int error)
3928{
3929 switch (error)
3930 {
3931 case BGP_ERR_AF_UNCONFIGURED:
3932 vty_out (vty,
3933 "%%BGP: Enable %s %s address family for the neighbor %s%s",
3934 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
3935 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
3936 peer->host, VTY_NEWLINE);
3937 break;
3938 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
3939 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);
3940 break;
3941 default:
3942 break;
3943 }
3944}
3945
3946/* `clear ip bgp' functions. */
3947int
3948bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00003949 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00003950{
3951 int ret;
3952 struct peer *peer;
3953 struct listnode *nn;
3954
3955 /* Clear all neighbors. */
3956 if (sort == clear_all)
3957 {
3958 LIST_LOOP (bgp->peer, peer, nn)
3959 {
3960 if (stype == BGP_CLEAR_SOFT_NONE)
3961 ret = peer_clear (peer);
3962 else
3963 ret = peer_clear_soft (peer, afi, safi, stype);
3964
3965 if (ret < 0)
3966 bgp_clear_vty_error (vty, peer, afi, safi, ret);
3967 }
3968 return 0;
3969 }
3970
3971 /* Clear specified neighbors. */
3972 if (sort == clear_peer)
3973 {
3974 union sockunion su;
3975 int ret;
3976
3977 /* Make sockunion for lookup. */
3978 ret = str2sockunion (arg, &su);
3979 if (ret < 0)
3980 {
3981 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
3982 return -1;
3983 }
3984 peer = peer_lookup (bgp, &su);
3985 if (! peer)
3986 {
3987 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
3988 return -1;
3989 }
3990
3991 if (stype == BGP_CLEAR_SOFT_NONE)
3992 ret = peer_clear (peer);
3993 else
3994 ret = peer_clear_soft (peer, afi, safi, stype);
3995
3996 if (ret < 0)
3997 bgp_clear_vty_error (vty, peer, afi, safi, ret);
3998
3999 return 0;
4000 }
4001
4002 /* Clear all peer-group members. */
4003 if (sort == clear_group)
4004 {
4005 struct peer_group *group;
4006
4007 group = peer_group_lookup (bgp, arg);
4008 if (! group)
4009 {
4010 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
4011 return -1;
4012 }
4013
4014 LIST_LOOP (group->peer, peer, nn)
4015 {
4016 if (stype == BGP_CLEAR_SOFT_NONE)
4017 {
4018 ret = peer_clear (peer);
4019 continue;
4020 }
4021
4022 if (! peer->af_group[afi][safi])
4023 continue;
4024
4025 ret = peer_clear_soft (peer, afi, safi, stype);
4026
4027 if (ret < 0)
4028 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4029 }
4030 return 0;
4031 }
4032
4033 if (sort == clear_external)
4034 {
4035 LIST_LOOP (bgp->peer, peer, nn)
4036 {
4037 if (peer_sort (peer) == BGP_PEER_IBGP)
4038 continue;
4039
4040 if (stype == BGP_CLEAR_SOFT_NONE)
4041 ret = peer_clear (peer);
4042 else
4043 ret = peer_clear_soft (peer, afi, safi, stype);
4044
4045 if (ret < 0)
4046 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4047 }
4048 return 0;
4049 }
4050
4051 if (sort == clear_as)
4052 {
4053 as_t as;
4054 unsigned long as_ul;
4055 char *endptr = NULL;
4056 int find = 0;
4057
4058 as_ul = strtoul(arg, &endptr, 10);
4059
4060 if ((as_ul == ULONG_MAX) || (*endptr != '\0') || (as_ul > USHRT_MAX))
4061 {
4062 vty_out (vty, "Invalid AS number%s", VTY_NEWLINE);
4063 return -1;
4064 }
4065 as = (as_t) as_ul;
4066
4067 LIST_LOOP (bgp->peer, peer, nn)
4068 {
4069 if (peer->as != as)
4070 continue;
4071
4072 find = 1;
4073 if (stype == BGP_CLEAR_SOFT_NONE)
4074 ret = peer_clear (peer);
4075 else
4076 ret = peer_clear_soft (peer, afi, safi, stype);
4077
4078 if (ret < 0)
4079 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4080 }
4081 if (! find)
4082 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4083 VTY_NEWLINE);
4084 return 0;
4085 }
4086
4087 return 0;
4088}
4089
4090int
paulfd79ac92004-10-13 05:06:08 +00004091bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4092 enum clear_sort sort, enum bgp_clear_type stype,
4093 const char *arg)
paul718e3742002-12-13 20:15:29 +00004094{
4095 int ret;
4096 struct bgp *bgp;
4097
4098 /* BGP structure lookup. */
4099 if (name)
4100 {
4101 bgp = bgp_lookup_by_name (name);
4102 if (bgp == NULL)
4103 {
4104 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4105 return CMD_WARNING;
4106 }
4107 }
4108 else
4109 {
4110 bgp = bgp_get_default ();
4111 if (bgp == NULL)
4112 {
4113 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4114 return CMD_WARNING;
4115 }
4116 }
4117
4118 ret = bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
4119 if (ret < 0)
4120 return CMD_WARNING;
4121
4122 return CMD_SUCCESS;
4123}
4124
4125DEFUN (clear_ip_bgp_all,
4126 clear_ip_bgp_all_cmd,
4127 "clear ip bgp *",
4128 CLEAR_STR
4129 IP_STR
4130 BGP_STR
4131 "Clear all peers\n")
4132{
4133 if (argc == 1)
4134 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4135
4136 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4137}
4138
4139ALIAS (clear_ip_bgp_all,
4140 clear_bgp_all_cmd,
4141 "clear bgp *",
4142 CLEAR_STR
4143 BGP_STR
4144 "Clear all peers\n")
4145
4146ALIAS (clear_ip_bgp_all,
4147 clear_bgp_ipv6_all_cmd,
4148 "clear bgp ipv6 *",
4149 CLEAR_STR
4150 BGP_STR
4151 "Address family\n"
4152 "Clear all peers\n")
4153
4154ALIAS (clear_ip_bgp_all,
4155 clear_ip_bgp_instance_all_cmd,
4156 "clear ip bgp view WORD *",
4157 CLEAR_STR
4158 IP_STR
4159 BGP_STR
4160 "BGP view\n"
4161 "view name\n"
4162 "Clear all peers\n")
4163
4164ALIAS (clear_ip_bgp_all,
4165 clear_bgp_instance_all_cmd,
4166 "clear bgp view WORD *",
4167 CLEAR_STR
4168 BGP_STR
4169 "BGP view\n"
4170 "view name\n"
4171 "Clear all peers\n")
4172
4173DEFUN (clear_ip_bgp_peer,
4174 clear_ip_bgp_peer_cmd,
4175 "clear ip bgp (A.B.C.D|X:X::X:X)",
4176 CLEAR_STR
4177 IP_STR
4178 BGP_STR
4179 "BGP neighbor IP address to clear\n"
4180 "BGP IPv6 neighbor to clear\n")
4181{
4182 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4183}
4184
4185ALIAS (clear_ip_bgp_peer,
4186 clear_bgp_peer_cmd,
4187 "clear bgp (A.B.C.D|X:X::X:X)",
4188 CLEAR_STR
4189 BGP_STR
4190 "BGP neighbor address to clear\n"
4191 "BGP IPv6 neighbor to clear\n")
4192
4193ALIAS (clear_ip_bgp_peer,
4194 clear_bgp_ipv6_peer_cmd,
4195 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4196 CLEAR_STR
4197 BGP_STR
4198 "Address family\n"
4199 "BGP neighbor address to clear\n"
4200 "BGP IPv6 neighbor to clear\n")
4201
4202DEFUN (clear_ip_bgp_peer_group,
4203 clear_ip_bgp_peer_group_cmd,
4204 "clear ip bgp peer-group WORD",
4205 CLEAR_STR
4206 IP_STR
4207 BGP_STR
4208 "Clear all members of peer-group\n"
4209 "BGP peer-group name\n")
4210{
4211 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4212}
4213
4214ALIAS (clear_ip_bgp_peer_group,
4215 clear_bgp_peer_group_cmd,
4216 "clear bgp peer-group WORD",
4217 CLEAR_STR
4218 BGP_STR
4219 "Clear all members of peer-group\n"
4220 "BGP peer-group name\n")
4221
4222ALIAS (clear_ip_bgp_peer_group,
4223 clear_bgp_ipv6_peer_group_cmd,
4224 "clear bgp ipv6 peer-group WORD",
4225 CLEAR_STR
4226 BGP_STR
4227 "Address family\n"
4228 "Clear all members of peer-group\n"
4229 "BGP peer-group name\n")
4230
4231DEFUN (clear_ip_bgp_external,
4232 clear_ip_bgp_external_cmd,
4233 "clear ip bgp external",
4234 CLEAR_STR
4235 IP_STR
4236 BGP_STR
4237 "Clear all external peers\n")
4238{
4239 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4240}
4241
4242ALIAS (clear_ip_bgp_external,
4243 clear_bgp_external_cmd,
4244 "clear bgp external",
4245 CLEAR_STR
4246 BGP_STR
4247 "Clear all external peers\n")
4248
4249ALIAS (clear_ip_bgp_external,
4250 clear_bgp_ipv6_external_cmd,
4251 "clear bgp ipv6 external",
4252 CLEAR_STR
4253 BGP_STR
4254 "Address family\n"
4255 "Clear all external peers\n")
4256
4257DEFUN (clear_ip_bgp_as,
4258 clear_ip_bgp_as_cmd,
4259 "clear ip bgp <1-65535>",
4260 CLEAR_STR
4261 IP_STR
4262 BGP_STR
4263 "Clear peers with the AS number\n")
4264{
4265 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4266}
4267
4268ALIAS (clear_ip_bgp_as,
4269 clear_bgp_as_cmd,
4270 "clear bgp <1-65535>",
4271 CLEAR_STR
4272 BGP_STR
4273 "Clear peers with the AS number\n")
4274
4275ALIAS (clear_ip_bgp_as,
4276 clear_bgp_ipv6_as_cmd,
4277 "clear bgp ipv6 <1-65535>",
4278 CLEAR_STR
4279 BGP_STR
4280 "Address family\n"
4281 "Clear peers with the AS number\n")
4282
4283/* Outbound soft-reconfiguration */
4284DEFUN (clear_ip_bgp_all_soft_out,
4285 clear_ip_bgp_all_soft_out_cmd,
4286 "clear ip bgp * soft out",
4287 CLEAR_STR
4288 IP_STR
4289 BGP_STR
4290 "Clear all peers\n"
4291 "Soft reconfig\n"
4292 "Soft reconfig outbound update\n")
4293{
4294 if (argc == 1)
4295 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4296 BGP_CLEAR_SOFT_OUT, NULL);
4297
4298 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4299 BGP_CLEAR_SOFT_OUT, NULL);
4300}
4301
4302ALIAS (clear_ip_bgp_all_soft_out,
4303 clear_ip_bgp_all_out_cmd,
4304 "clear ip bgp * out",
4305 CLEAR_STR
4306 IP_STR
4307 BGP_STR
4308 "Clear all peers\n"
4309 "Soft reconfig outbound update\n")
4310
4311ALIAS (clear_ip_bgp_all_soft_out,
4312 clear_ip_bgp_instance_all_soft_out_cmd,
4313 "clear ip bgp view WORD * soft out",
4314 CLEAR_STR
4315 IP_STR
4316 BGP_STR
4317 "BGP view\n"
4318 "view name\n"
4319 "Clear all peers\n"
4320 "Soft reconfig\n"
4321 "Soft reconfig outbound update\n")
4322
4323DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4324 clear_ip_bgp_all_ipv4_soft_out_cmd,
4325 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4326 CLEAR_STR
4327 IP_STR
4328 BGP_STR
4329 "Clear all peers\n"
4330 "Address family\n"
4331 "Address Family modifier\n"
4332 "Address Family modifier\n"
4333 "Soft reconfig\n"
4334 "Soft reconfig outbound update\n")
4335{
4336 if (strncmp (argv[0], "m", 1) == 0)
4337 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4338 BGP_CLEAR_SOFT_OUT, NULL);
4339
4340 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4341 BGP_CLEAR_SOFT_OUT, NULL);
4342}
4343
4344ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4345 clear_ip_bgp_all_ipv4_out_cmd,
4346 "clear ip bgp * ipv4 (unicast|multicast) out",
4347 CLEAR_STR
4348 IP_STR
4349 BGP_STR
4350 "Clear all peers\n"
4351 "Address family\n"
4352 "Address Family modifier\n"
4353 "Address Family modifier\n"
4354 "Soft reconfig outbound update\n")
4355
4356DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4357 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4358 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4359 CLEAR_STR
4360 IP_STR
4361 BGP_STR
4362 "BGP view\n"
4363 "view name\n"
4364 "Clear all peers\n"
4365 "Address family\n"
4366 "Address Family modifier\n"
4367 "Address Family modifier\n"
4368 "Soft reconfig outbound update\n")
4369{
4370 if (strncmp (argv[1], "m", 1) == 0)
4371 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4372 BGP_CLEAR_SOFT_OUT, NULL);
4373
4374 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4375 BGP_CLEAR_SOFT_OUT, NULL);
4376}
4377
4378DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4379 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4380 "clear ip bgp * vpnv4 unicast soft out",
4381 CLEAR_STR
4382 IP_STR
4383 BGP_STR
4384 "Clear all peers\n"
4385 "Address family\n"
4386 "Address Family Modifier\n"
4387 "Soft reconfig\n"
4388 "Soft reconfig outbound update\n")
4389{
4390 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4391 BGP_CLEAR_SOFT_OUT, NULL);
4392}
4393
4394ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4395 clear_ip_bgp_all_vpnv4_out_cmd,
4396 "clear ip bgp * vpnv4 unicast out",
4397 CLEAR_STR
4398 IP_STR
4399 BGP_STR
4400 "Clear all peers\n"
4401 "Address family\n"
4402 "Address Family Modifier\n"
4403 "Soft reconfig outbound update\n")
4404
4405DEFUN (clear_bgp_all_soft_out,
4406 clear_bgp_all_soft_out_cmd,
4407 "clear bgp * soft out",
4408 CLEAR_STR
4409 BGP_STR
4410 "Clear all peers\n"
4411 "Soft reconfig\n"
4412 "Soft reconfig outbound update\n")
4413{
4414 if (argc == 1)
4415 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4416 BGP_CLEAR_SOFT_OUT, NULL);
4417
4418 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4419 BGP_CLEAR_SOFT_OUT, NULL);
4420}
4421
4422ALIAS (clear_bgp_all_soft_out,
4423 clear_bgp_instance_all_soft_out_cmd,
4424 "clear bgp view WORD * soft out",
4425 CLEAR_STR
4426 BGP_STR
4427 "BGP view\n"
4428 "view name\n"
4429 "Clear all peers\n"
4430 "Soft reconfig\n"
4431 "Soft reconfig outbound update\n")
4432
4433ALIAS (clear_bgp_all_soft_out,
4434 clear_bgp_all_out_cmd,
4435 "clear bgp * out",
4436 CLEAR_STR
4437 BGP_STR
4438 "Clear all peers\n"
4439 "Soft reconfig outbound update\n")
4440
4441ALIAS (clear_bgp_all_soft_out,
4442 clear_bgp_ipv6_all_soft_out_cmd,
4443 "clear bgp ipv6 * soft out",
4444 CLEAR_STR
4445 BGP_STR
4446 "Address family\n"
4447 "Clear all peers\n"
4448 "Soft reconfig\n"
4449 "Soft reconfig outbound update\n")
4450
4451ALIAS (clear_bgp_all_soft_out,
4452 clear_bgp_ipv6_all_out_cmd,
4453 "clear bgp ipv6 * out",
4454 CLEAR_STR
4455 BGP_STR
4456 "Address family\n"
4457 "Clear all peers\n"
4458 "Soft reconfig outbound update\n")
4459
4460DEFUN (clear_ip_bgp_peer_soft_out,
4461 clear_ip_bgp_peer_soft_out_cmd,
4462 "clear ip bgp A.B.C.D soft out",
4463 CLEAR_STR
4464 IP_STR
4465 BGP_STR
4466 "BGP neighbor address to clear\n"
4467 "Soft reconfig\n"
4468 "Soft reconfig outbound update\n")
4469{
4470 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4471 BGP_CLEAR_SOFT_OUT, argv[0]);
4472}
4473
4474ALIAS (clear_ip_bgp_peer_soft_out,
4475 clear_ip_bgp_peer_out_cmd,
4476 "clear ip bgp A.B.C.D out",
4477 CLEAR_STR
4478 IP_STR
4479 BGP_STR
4480 "BGP neighbor address to clear\n"
4481 "Soft reconfig outbound update\n")
4482
4483DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4484 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4485 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4486 CLEAR_STR
4487 IP_STR
4488 BGP_STR
4489 "BGP neighbor address to clear\n"
4490 "Address family\n"
4491 "Address Family modifier\n"
4492 "Address Family modifier\n"
4493 "Soft reconfig\n"
4494 "Soft reconfig outbound update\n")
4495{
4496 if (strncmp (argv[1], "m", 1) == 0)
4497 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4498 BGP_CLEAR_SOFT_OUT, argv[0]);
4499
4500 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4501 BGP_CLEAR_SOFT_OUT, argv[0]);
4502}
4503
4504ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
4505 clear_ip_bgp_peer_ipv4_out_cmd,
4506 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
4507 CLEAR_STR
4508 IP_STR
4509 BGP_STR
4510 "BGP neighbor address to clear\n"
4511 "Address family\n"
4512 "Address Family modifier\n"
4513 "Address Family modifier\n"
4514 "Soft reconfig outbound update\n")
4515
4516DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
4517 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
4518 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
4519 CLEAR_STR
4520 IP_STR
4521 BGP_STR
4522 "BGP neighbor address to clear\n"
4523 "Address family\n"
4524 "Address Family Modifier\n"
4525 "Soft reconfig\n"
4526 "Soft reconfig outbound update\n")
4527{
4528 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
4529 BGP_CLEAR_SOFT_OUT, argv[0]);
4530}
4531
4532ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
4533 clear_ip_bgp_peer_vpnv4_out_cmd,
4534 "clear ip bgp A.B.C.D vpnv4 unicast out",
4535 CLEAR_STR
4536 IP_STR
4537 BGP_STR
4538 "BGP neighbor address to clear\n"
4539 "Address family\n"
4540 "Address Family Modifier\n"
4541 "Soft reconfig outbound update\n")
4542
4543DEFUN (clear_bgp_peer_soft_out,
4544 clear_bgp_peer_soft_out_cmd,
4545 "clear bgp (A.B.C.D|X:X::X:X) soft out",
4546 CLEAR_STR
4547 BGP_STR
4548 "BGP neighbor address to clear\n"
4549 "BGP IPv6 neighbor to clear\n"
4550 "Soft reconfig\n"
4551 "Soft reconfig outbound update\n")
4552{
4553 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
4554 BGP_CLEAR_SOFT_OUT, argv[0]);
4555}
4556
4557ALIAS (clear_bgp_peer_soft_out,
4558 clear_bgp_ipv6_peer_soft_out_cmd,
4559 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
4560 CLEAR_STR
4561 BGP_STR
4562 "Address family\n"
4563 "BGP neighbor address to clear\n"
4564 "BGP IPv6 neighbor to clear\n"
4565 "Soft reconfig\n"
4566 "Soft reconfig outbound update\n")
4567
4568ALIAS (clear_bgp_peer_soft_out,
4569 clear_bgp_peer_out_cmd,
4570 "clear bgp (A.B.C.D|X:X::X:X) out",
4571 CLEAR_STR
4572 BGP_STR
4573 "BGP neighbor address to clear\n"
4574 "BGP IPv6 neighbor to clear\n"
4575 "Soft reconfig outbound update\n")
4576
4577ALIAS (clear_bgp_peer_soft_out,
4578 clear_bgp_ipv6_peer_out_cmd,
4579 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
4580 CLEAR_STR
4581 BGP_STR
4582 "Address family\n"
4583 "BGP neighbor address to clear\n"
4584 "BGP IPv6 neighbor to clear\n"
4585 "Soft reconfig outbound update\n")
4586
4587DEFUN (clear_ip_bgp_peer_group_soft_out,
4588 clear_ip_bgp_peer_group_soft_out_cmd,
4589 "clear ip bgp peer-group WORD soft out",
4590 CLEAR_STR
4591 IP_STR
4592 BGP_STR
4593 "Clear all members of peer-group\n"
4594 "BGP peer-group name\n"
4595 "Soft reconfig\n"
4596 "Soft reconfig outbound update\n")
4597{
4598 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4599 BGP_CLEAR_SOFT_OUT, argv[0]);
4600}
4601
4602ALIAS (clear_ip_bgp_peer_group_soft_out,
4603 clear_ip_bgp_peer_group_out_cmd,
4604 "clear ip bgp peer-group WORD out",
4605 CLEAR_STR
4606 IP_STR
4607 BGP_STR
4608 "Clear all members of peer-group\n"
4609 "BGP peer-group name\n"
4610 "Soft reconfig outbound update\n")
4611
4612DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
4613 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
4614 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
4615 CLEAR_STR
4616 IP_STR
4617 BGP_STR
4618 "Clear all members of peer-group\n"
4619 "BGP peer-group name\n"
4620 "Address family\n"
4621 "Address Family modifier\n"
4622 "Address Family modifier\n"
4623 "Soft reconfig\n"
4624 "Soft reconfig outbound update\n")
4625{
4626 if (strncmp (argv[1], "m", 1) == 0)
4627 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
4628 BGP_CLEAR_SOFT_OUT, argv[0]);
4629
4630 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4631 BGP_CLEAR_SOFT_OUT, argv[0]);
4632}
4633
4634ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
4635 clear_ip_bgp_peer_group_ipv4_out_cmd,
4636 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
4637 CLEAR_STR
4638 IP_STR
4639 BGP_STR
4640 "Clear all members of peer-group\n"
4641 "BGP peer-group name\n"
4642 "Address family\n"
4643 "Address Family modifier\n"
4644 "Address Family modifier\n"
4645 "Soft reconfig outbound update\n")
4646
4647DEFUN (clear_bgp_peer_group_soft_out,
4648 clear_bgp_peer_group_soft_out_cmd,
4649 "clear bgp peer-group WORD soft out",
4650 CLEAR_STR
4651 BGP_STR
4652 "Clear all members of peer-group\n"
4653 "BGP peer-group name\n"
4654 "Soft reconfig\n"
4655 "Soft reconfig outbound update\n")
4656{
4657 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
4658 BGP_CLEAR_SOFT_OUT, argv[0]);
4659}
4660
4661ALIAS (clear_bgp_peer_group_soft_out,
4662 clear_bgp_ipv6_peer_group_soft_out_cmd,
4663 "clear bgp ipv6 peer-group WORD soft out",
4664 CLEAR_STR
4665 BGP_STR
4666 "Address family\n"
4667 "Clear all members of peer-group\n"
4668 "BGP peer-group name\n"
4669 "Soft reconfig\n"
4670 "Soft reconfig outbound update\n")
4671
4672ALIAS (clear_bgp_peer_group_soft_out,
4673 clear_bgp_peer_group_out_cmd,
4674 "clear bgp peer-group WORD out",
4675 CLEAR_STR
4676 BGP_STR
4677 "Clear all members of peer-group\n"
4678 "BGP peer-group name\n"
4679 "Soft reconfig outbound update\n")
4680
4681ALIAS (clear_bgp_peer_group_soft_out,
4682 clear_bgp_ipv6_peer_group_out_cmd,
4683 "clear bgp ipv6 peer-group WORD out",
4684 CLEAR_STR
4685 BGP_STR
4686 "Address family\n"
4687 "Clear all members of peer-group\n"
4688 "BGP peer-group name\n"
4689 "Soft reconfig outbound update\n")
4690
4691DEFUN (clear_ip_bgp_external_soft_out,
4692 clear_ip_bgp_external_soft_out_cmd,
4693 "clear ip bgp external soft out",
4694 CLEAR_STR
4695 IP_STR
4696 BGP_STR
4697 "Clear all external peers\n"
4698 "Soft reconfig\n"
4699 "Soft reconfig outbound update\n")
4700{
4701 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
4702 BGP_CLEAR_SOFT_OUT, NULL);
4703}
4704
4705ALIAS (clear_ip_bgp_external_soft_out,
4706 clear_ip_bgp_external_out_cmd,
4707 "clear ip bgp external out",
4708 CLEAR_STR
4709 IP_STR
4710 BGP_STR
4711 "Clear all external peers\n"
4712 "Soft reconfig outbound update\n")
4713
4714DEFUN (clear_ip_bgp_external_ipv4_soft_out,
4715 clear_ip_bgp_external_ipv4_soft_out_cmd,
4716 "clear ip bgp external ipv4 (unicast|multicast) soft out",
4717 CLEAR_STR
4718 IP_STR
4719 BGP_STR
4720 "Clear all external peers\n"
4721 "Address family\n"
4722 "Address Family modifier\n"
4723 "Address Family modifier\n"
4724 "Soft reconfig\n"
4725 "Soft reconfig outbound update\n")
4726{
4727 if (strncmp (argv[0], "m", 1) == 0)
4728 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
4729 BGP_CLEAR_SOFT_OUT, NULL);
4730
4731 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
4732 BGP_CLEAR_SOFT_OUT, NULL);
4733}
4734
4735ALIAS (clear_ip_bgp_external_ipv4_soft_out,
4736 clear_ip_bgp_external_ipv4_out_cmd,
4737 "clear ip bgp external ipv4 (unicast|multicast) out",
4738 CLEAR_STR
4739 IP_STR
4740 BGP_STR
4741 "Clear all external peers\n"
4742 "Address family\n"
4743 "Address Family modifier\n"
4744 "Address Family modifier\n"
4745 "Soft reconfig outbound update\n")
4746
4747DEFUN (clear_bgp_external_soft_out,
4748 clear_bgp_external_soft_out_cmd,
4749 "clear bgp external soft out",
4750 CLEAR_STR
4751 BGP_STR
4752 "Clear all external peers\n"
4753 "Soft reconfig\n"
4754 "Soft reconfig outbound update\n")
4755{
4756 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
4757 BGP_CLEAR_SOFT_OUT, NULL);
4758}
4759
4760ALIAS (clear_bgp_external_soft_out,
4761 clear_bgp_ipv6_external_soft_out_cmd,
4762 "clear bgp ipv6 external soft out",
4763 CLEAR_STR
4764 BGP_STR
4765 "Address family\n"
4766 "Clear all external peers\n"
4767 "Soft reconfig\n"
4768 "Soft reconfig outbound update\n")
4769
4770ALIAS (clear_bgp_external_soft_out,
4771 clear_bgp_external_out_cmd,
4772 "clear bgp external out",
4773 CLEAR_STR
4774 BGP_STR
4775 "Clear all external peers\n"
4776 "Soft reconfig outbound update\n")
4777
4778ALIAS (clear_bgp_external_soft_out,
4779 clear_bgp_ipv6_external_out_cmd,
4780 "clear bgp ipv6 external WORD out",
4781 CLEAR_STR
4782 BGP_STR
4783 "Address family\n"
4784 "Clear all external peers\n"
4785 "Soft reconfig outbound update\n")
4786
4787DEFUN (clear_ip_bgp_as_soft_out,
4788 clear_ip_bgp_as_soft_out_cmd,
4789 "clear ip bgp <1-65535> soft out",
4790 CLEAR_STR
4791 IP_STR
4792 BGP_STR
4793 "Clear peers with the AS number\n"
4794 "Soft reconfig\n"
4795 "Soft reconfig outbound update\n")
4796{
4797 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
4798 BGP_CLEAR_SOFT_OUT, argv[0]);
4799}
4800
4801ALIAS (clear_ip_bgp_as_soft_out,
4802 clear_ip_bgp_as_out_cmd,
4803 "clear ip bgp <1-65535> out",
4804 CLEAR_STR
4805 IP_STR
4806 BGP_STR
4807 "Clear peers with the AS number\n"
4808 "Soft reconfig outbound update\n")
4809
4810DEFUN (clear_ip_bgp_as_ipv4_soft_out,
4811 clear_ip_bgp_as_ipv4_soft_out_cmd,
4812 "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft out",
4813 CLEAR_STR
4814 IP_STR
4815 BGP_STR
4816 "Clear peers with the AS number\n"
4817 "Address family\n"
4818 "Address Family modifier\n"
4819 "Address Family modifier\n"
4820 "Soft reconfig\n"
4821 "Soft reconfig outbound update\n")
4822{
4823 if (strncmp (argv[1], "m", 1) == 0)
4824 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
4825 BGP_CLEAR_SOFT_OUT, argv[0]);
4826
4827 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
4828 BGP_CLEAR_SOFT_OUT, argv[0]);
4829}
4830
4831ALIAS (clear_ip_bgp_as_ipv4_soft_out,
4832 clear_ip_bgp_as_ipv4_out_cmd,
4833 "clear ip bgp <1-65535> ipv4 (unicast|multicast) out",
4834 CLEAR_STR
4835 IP_STR
4836 BGP_STR
4837 "Clear peers with the AS number\n"
4838 "Address family\n"
4839 "Address Family modifier\n"
4840 "Address Family modifier\n"
4841 "Soft reconfig outbound update\n")
4842
4843DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
4844 clear_ip_bgp_as_vpnv4_soft_out_cmd,
4845 "clear ip bgp <1-65535> vpnv4 unicast soft out",
4846 CLEAR_STR
4847 IP_STR
4848 BGP_STR
4849 "Clear peers with the AS number\n"
4850 "Address family\n"
4851 "Address Family modifier\n"
4852 "Soft reconfig\n"
4853 "Soft reconfig outbound update\n")
4854{
4855 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
4856 BGP_CLEAR_SOFT_OUT, argv[0]);
4857}
4858
4859ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
4860 clear_ip_bgp_as_vpnv4_out_cmd,
4861 "clear ip bgp <1-65535> vpnv4 unicast out",
4862 CLEAR_STR
4863 IP_STR
4864 BGP_STR
4865 "Clear peers with the AS number\n"
4866 "Address family\n"
4867 "Address Family modifier\n"
4868 "Soft reconfig outbound update\n")
4869
4870DEFUN (clear_bgp_as_soft_out,
4871 clear_bgp_as_soft_out_cmd,
4872 "clear bgp <1-65535> soft out",
4873 CLEAR_STR
4874 BGP_STR
4875 "Clear peers with the AS number\n"
4876 "Soft reconfig\n"
4877 "Soft reconfig outbound update\n")
4878{
4879 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
4880 BGP_CLEAR_SOFT_OUT, argv[0]);
4881}
4882
4883ALIAS (clear_bgp_as_soft_out,
4884 clear_bgp_ipv6_as_soft_out_cmd,
4885 "clear bgp ipv6 <1-65535> soft out",
4886 CLEAR_STR
4887 BGP_STR
4888 "Address family\n"
4889 "Clear peers with the AS number\n"
4890 "Soft reconfig\n"
4891 "Soft reconfig outbound update\n")
4892
4893ALIAS (clear_bgp_as_soft_out,
4894 clear_bgp_as_out_cmd,
4895 "clear bgp <1-65535> out",
4896 CLEAR_STR
4897 BGP_STR
4898 "Clear peers with the AS number\n"
4899 "Soft reconfig outbound update\n")
4900
4901ALIAS (clear_bgp_as_soft_out,
4902 clear_bgp_ipv6_as_out_cmd,
4903 "clear bgp ipv6 <1-65535> out",
4904 CLEAR_STR
4905 BGP_STR
4906 "Address family\n"
4907 "Clear peers with the AS number\n"
4908 "Soft reconfig outbound update\n")
4909
4910/* Inbound soft-reconfiguration */
4911DEFUN (clear_ip_bgp_all_soft_in,
4912 clear_ip_bgp_all_soft_in_cmd,
4913 "clear ip bgp * soft in",
4914 CLEAR_STR
4915 IP_STR
4916 BGP_STR
4917 "Clear all peers\n"
4918 "Soft reconfig\n"
4919 "Soft reconfig inbound update\n")
4920{
4921 if (argc == 1)
4922 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4923 BGP_CLEAR_SOFT_IN, NULL);
4924
4925 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4926 BGP_CLEAR_SOFT_IN, NULL);
4927}
4928
4929ALIAS (clear_ip_bgp_all_soft_in,
4930 clear_ip_bgp_instance_all_soft_in_cmd,
4931 "clear ip bgp view WORD * soft in",
4932 CLEAR_STR
4933 IP_STR
4934 BGP_STR
4935 "BGP view\n"
4936 "view name\n"
4937 "Clear all peers\n"
4938 "Soft reconfig\n"
4939 "Soft reconfig inbound update\n")
4940
4941ALIAS (clear_ip_bgp_all_soft_in,
4942 clear_ip_bgp_all_in_cmd,
4943 "clear ip bgp * in",
4944 CLEAR_STR
4945 IP_STR
4946 BGP_STR
4947 "Clear all peers\n"
4948 "Soft reconfig inbound update\n")
4949
4950DEFUN (clear_ip_bgp_all_in_prefix_filter,
4951 clear_ip_bgp_all_in_prefix_filter_cmd,
4952 "clear ip bgp * in prefix-filter",
4953 CLEAR_STR
4954 IP_STR
4955 BGP_STR
4956 "Clear all peers\n"
4957 "Soft reconfig inbound update\n"
4958 "Push out prefix-list ORF and do inbound soft reconfig\n")
4959{
4960 if (argc== 1)
4961 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4962 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
4963
4964 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4965 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
4966}
4967
4968ALIAS (clear_ip_bgp_all_in_prefix_filter,
4969 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
4970 "clear ip bgp view WORD * in prefix-filter",
4971 CLEAR_STR
4972 IP_STR
4973 BGP_STR
4974 "BGP view\n"
4975 "view name\n"
4976 "Clear all peers\n"
4977 "Soft reconfig inbound update\n"
4978 "Push out prefix-list ORF and do inbound soft reconfig\n")
4979
4980
4981DEFUN (clear_ip_bgp_all_ipv4_soft_in,
4982 clear_ip_bgp_all_ipv4_soft_in_cmd,
4983 "clear ip bgp * ipv4 (unicast|multicast) soft in",
4984 CLEAR_STR
4985 IP_STR
4986 BGP_STR
4987 "Clear all peers\n"
4988 "Address family\n"
4989 "Address Family modifier\n"
4990 "Address Family modifier\n"
4991 "Soft reconfig\n"
4992 "Soft reconfig inbound update\n")
4993{
4994 if (strncmp (argv[0], "m", 1) == 0)
4995 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4996 BGP_CLEAR_SOFT_IN, NULL);
4997
4998 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4999 BGP_CLEAR_SOFT_IN, NULL);
5000}
5001
5002ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5003 clear_ip_bgp_all_ipv4_in_cmd,
5004 "clear ip bgp * ipv4 (unicast|multicast) in",
5005 CLEAR_STR
5006 IP_STR
5007 BGP_STR
5008 "Clear all peers\n"
5009 "Address family\n"
5010 "Address Family modifier\n"
5011 "Address Family modifier\n"
5012 "Soft reconfig inbound update\n")
5013
5014DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5015 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5016 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5017 CLEAR_STR
5018 IP_STR
5019 BGP_STR
5020 "BGP view\n"
5021 "view name\n"
5022 "Clear all peers\n"
5023 "Address family\n"
5024 "Address Family modifier\n"
5025 "Address Family modifier\n"
5026 "Soft reconfig\n"
5027 "Soft reconfig inbound update\n")
5028{
5029 if (strncmp (argv[1], "m", 1) == 0)
5030 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5031 BGP_CLEAR_SOFT_IN, NULL);
5032
5033 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5034 BGP_CLEAR_SOFT_IN, NULL);
5035}
5036
5037DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5038 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5039 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5040 CLEAR_STR
5041 IP_STR
5042 BGP_STR
5043 "Clear all peers\n"
5044 "Address family\n"
5045 "Address Family modifier\n"
5046 "Address Family modifier\n"
5047 "Soft reconfig inbound update\n"
5048 "Push out prefix-list ORF and do inbound soft reconfig\n")
5049{
5050 if (strncmp (argv[0], "m", 1) == 0)
5051 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5052 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5053
5054 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5055 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5056}
5057
5058DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5059 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5060 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5061 CLEAR_STR
5062 IP_STR
5063 BGP_STR
5064 "Clear all peers\n"
5065 "Address family\n"
5066 "Address Family modifier\n"
5067 "Address Family modifier\n"
5068 "Soft reconfig inbound update\n"
5069 "Push out prefix-list ORF and do inbound soft reconfig\n")
5070{
5071 if (strncmp (argv[1], "m", 1) == 0)
5072 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5073 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5074
5075 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5076 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5077}
5078
5079DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5080 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5081 "clear ip bgp * vpnv4 unicast soft in",
5082 CLEAR_STR
5083 IP_STR
5084 BGP_STR
5085 "Clear all peers\n"
5086 "Address family\n"
5087 "Address Family Modifier\n"
5088 "Soft reconfig\n"
5089 "Soft reconfig inbound update\n")
5090{
5091 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5092 BGP_CLEAR_SOFT_IN, NULL);
5093}
5094
5095ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5096 clear_ip_bgp_all_vpnv4_in_cmd,
5097 "clear ip bgp * vpnv4 unicast in",
5098 CLEAR_STR
5099 IP_STR
5100 BGP_STR
5101 "Clear all peers\n"
5102 "Address family\n"
5103 "Address Family Modifier\n"
5104 "Soft reconfig inbound update\n")
5105
5106DEFUN (clear_bgp_all_soft_in,
5107 clear_bgp_all_soft_in_cmd,
5108 "clear bgp * soft in",
5109 CLEAR_STR
5110 BGP_STR
5111 "Clear all peers\n"
5112 "Soft reconfig\n"
5113 "Soft reconfig inbound update\n")
5114{
5115 if (argc == 1)
5116 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5117 BGP_CLEAR_SOFT_IN, NULL);
5118
5119 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5120 BGP_CLEAR_SOFT_IN, NULL);
5121}
5122
5123ALIAS (clear_bgp_all_soft_in,
5124 clear_bgp_instance_all_soft_in_cmd,
5125 "clear bgp view WORD * soft in",
5126 CLEAR_STR
5127 BGP_STR
5128 "BGP view\n"
5129 "view name\n"
5130 "Clear all peers\n"
5131 "Soft reconfig\n"
5132 "Soft reconfig inbound update\n")
5133
5134ALIAS (clear_bgp_all_soft_in,
5135 clear_bgp_ipv6_all_soft_in_cmd,
5136 "clear bgp ipv6 * soft in",
5137 CLEAR_STR
5138 BGP_STR
5139 "Address family\n"
5140 "Clear all peers\n"
5141 "Soft reconfig\n"
5142 "Soft reconfig inbound update\n")
5143
5144ALIAS (clear_bgp_all_soft_in,
5145 clear_bgp_all_in_cmd,
5146 "clear bgp * in",
5147 CLEAR_STR
5148 BGP_STR
5149 "Clear all peers\n"
5150 "Soft reconfig inbound update\n")
5151
5152ALIAS (clear_bgp_all_soft_in,
5153 clear_bgp_ipv6_all_in_cmd,
5154 "clear bgp ipv6 * in",
5155 CLEAR_STR
5156 BGP_STR
5157 "Address family\n"
5158 "Clear all peers\n"
5159 "Soft reconfig inbound update\n")
5160
5161DEFUN (clear_bgp_all_in_prefix_filter,
5162 clear_bgp_all_in_prefix_filter_cmd,
5163 "clear bgp * in prefix-filter",
5164 CLEAR_STR
5165 BGP_STR
5166 "Clear all peers\n"
5167 "Soft reconfig inbound update\n"
5168 "Push out prefix-list ORF and do inbound soft reconfig\n")
5169{
5170 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5171 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5172}
5173
5174ALIAS (clear_bgp_all_in_prefix_filter,
5175 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5176 "clear bgp ipv6 * in prefix-filter",
5177 CLEAR_STR
5178 BGP_STR
5179 "Address family\n"
5180 "Clear all peers\n"
5181 "Soft reconfig inbound update\n"
5182 "Push out prefix-list ORF and do inbound soft reconfig\n")
5183
5184DEFUN (clear_ip_bgp_peer_soft_in,
5185 clear_ip_bgp_peer_soft_in_cmd,
5186 "clear ip bgp A.B.C.D soft in",
5187 CLEAR_STR
5188 IP_STR
5189 BGP_STR
5190 "BGP neighbor address to clear\n"
5191 "Soft reconfig\n"
5192 "Soft reconfig inbound update\n")
5193{
5194 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5195 BGP_CLEAR_SOFT_IN, argv[0]);
5196}
5197
5198ALIAS (clear_ip_bgp_peer_soft_in,
5199 clear_ip_bgp_peer_in_cmd,
5200 "clear ip bgp A.B.C.D in",
5201 CLEAR_STR
5202 IP_STR
5203 BGP_STR
5204 "BGP neighbor address to clear\n"
5205 "Soft reconfig inbound update\n")
5206
5207DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5208 clear_ip_bgp_peer_in_prefix_filter_cmd,
5209 "clear ip bgp A.B.C.D in prefix-filter",
5210 CLEAR_STR
5211 IP_STR
5212 BGP_STR
5213 "BGP neighbor address to clear\n"
5214 "Soft reconfig inbound update\n"
5215 "Push out the existing ORF prefix-list\n")
5216{
5217 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5218 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5219}
5220
5221DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5222 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5223 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5224 CLEAR_STR
5225 IP_STR
5226 BGP_STR
5227 "BGP neighbor address to clear\n"
5228 "Address family\n"
5229 "Address Family modifier\n"
5230 "Address Family modifier\n"
5231 "Soft reconfig\n"
5232 "Soft reconfig inbound update\n")
5233{
5234 if (strncmp (argv[1], "m", 1) == 0)
5235 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5236 BGP_CLEAR_SOFT_IN, argv[0]);
5237
5238 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5239 BGP_CLEAR_SOFT_IN, argv[0]);
5240}
5241
5242ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5243 clear_ip_bgp_peer_ipv4_in_cmd,
5244 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5245 CLEAR_STR
5246 IP_STR
5247 BGP_STR
5248 "BGP neighbor address to clear\n"
5249 "Address family\n"
5250 "Address Family modifier\n"
5251 "Address Family modifier\n"
5252 "Soft reconfig inbound update\n")
5253
5254DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5255 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5256 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5257 CLEAR_STR
5258 IP_STR
5259 BGP_STR
5260 "BGP neighbor address to clear\n"
5261 "Address family\n"
5262 "Address Family modifier\n"
5263 "Address Family modifier\n"
5264 "Soft reconfig inbound update\n"
5265 "Push out the existing ORF prefix-list\n")
5266{
5267 if (strncmp (argv[1], "m", 1) == 0)
5268 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5269 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5270
5271 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5272 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5273}
5274
5275DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5276 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5277 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5278 CLEAR_STR
5279 IP_STR
5280 BGP_STR
5281 "BGP neighbor address to clear\n"
5282 "Address family\n"
5283 "Address Family Modifier\n"
5284 "Soft reconfig\n"
5285 "Soft reconfig inbound update\n")
5286{
5287 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5288 BGP_CLEAR_SOFT_IN, argv[0]);
5289}
5290
5291ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5292 clear_ip_bgp_peer_vpnv4_in_cmd,
5293 "clear ip bgp A.B.C.D vpnv4 unicast in",
5294 CLEAR_STR
5295 IP_STR
5296 BGP_STR
5297 "BGP neighbor address to clear\n"
5298 "Address family\n"
5299 "Address Family Modifier\n"
5300 "Soft reconfig inbound update\n")
5301
5302DEFUN (clear_bgp_peer_soft_in,
5303 clear_bgp_peer_soft_in_cmd,
5304 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5305 CLEAR_STR
5306 BGP_STR
5307 "BGP neighbor address to clear\n"
5308 "BGP IPv6 neighbor to clear\n"
5309 "Soft reconfig\n"
5310 "Soft reconfig inbound update\n")
5311{
5312 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5313 BGP_CLEAR_SOFT_IN, argv[0]);
5314}
5315
5316ALIAS (clear_bgp_peer_soft_in,
5317 clear_bgp_ipv6_peer_soft_in_cmd,
5318 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5319 CLEAR_STR
5320 BGP_STR
5321 "Address family\n"
5322 "BGP neighbor address to clear\n"
5323 "BGP IPv6 neighbor to clear\n"
5324 "Soft reconfig\n"
5325 "Soft reconfig inbound update\n")
5326
5327ALIAS (clear_bgp_peer_soft_in,
5328 clear_bgp_peer_in_cmd,
5329 "clear bgp (A.B.C.D|X:X::X:X) in",
5330 CLEAR_STR
5331 BGP_STR
5332 "BGP neighbor address to clear\n"
5333 "BGP IPv6 neighbor to clear\n"
5334 "Soft reconfig inbound update\n")
5335
5336ALIAS (clear_bgp_peer_soft_in,
5337 clear_bgp_ipv6_peer_in_cmd,
5338 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5339 CLEAR_STR
5340 BGP_STR
5341 "Address family\n"
5342 "BGP neighbor address to clear\n"
5343 "BGP IPv6 neighbor to clear\n"
5344 "Soft reconfig inbound update\n")
5345
5346DEFUN (clear_bgp_peer_in_prefix_filter,
5347 clear_bgp_peer_in_prefix_filter_cmd,
5348 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5349 CLEAR_STR
5350 BGP_STR
5351 "BGP neighbor address to clear\n"
5352 "BGP IPv6 neighbor to clear\n"
5353 "Soft reconfig inbound update\n"
5354 "Push out the existing ORF prefix-list\n")
5355{
5356 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5357 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5358}
5359
5360ALIAS (clear_bgp_peer_in_prefix_filter,
5361 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5362 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5363 CLEAR_STR
5364 BGP_STR
5365 "Address family\n"
5366 "BGP neighbor address to clear\n"
5367 "BGP IPv6 neighbor to clear\n"
5368 "Soft reconfig inbound update\n"
5369 "Push out the existing ORF prefix-list\n")
5370
5371DEFUN (clear_ip_bgp_peer_group_soft_in,
5372 clear_ip_bgp_peer_group_soft_in_cmd,
5373 "clear ip bgp peer-group WORD soft in",
5374 CLEAR_STR
5375 IP_STR
5376 BGP_STR
5377 "Clear all members of peer-group\n"
5378 "BGP peer-group name\n"
5379 "Soft reconfig\n"
5380 "Soft reconfig inbound update\n")
5381{
5382 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5383 BGP_CLEAR_SOFT_IN, argv[0]);
5384}
5385
5386ALIAS (clear_ip_bgp_peer_group_soft_in,
5387 clear_ip_bgp_peer_group_in_cmd,
5388 "clear ip bgp peer-group WORD in",
5389 CLEAR_STR
5390 IP_STR
5391 BGP_STR
5392 "Clear all members of peer-group\n"
5393 "BGP peer-group name\n"
5394 "Soft reconfig inbound update\n")
5395
5396DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
5397 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
5398 "clear ip bgp peer-group WORD in prefix-filter",
5399 CLEAR_STR
5400 IP_STR
5401 BGP_STR
5402 "Clear all members of peer-group\n"
5403 "BGP peer-group name\n"
5404 "Soft reconfig inbound update\n"
5405 "Push out prefix-list ORF and do inbound soft reconfig\n")
5406{
5407 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5408 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5409}
5410
5411DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
5412 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
5413 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
5414 CLEAR_STR
5415 IP_STR
5416 BGP_STR
5417 "Clear all members of peer-group\n"
5418 "BGP peer-group name\n"
5419 "Address family\n"
5420 "Address Family modifier\n"
5421 "Address Family modifier\n"
5422 "Soft reconfig\n"
5423 "Soft reconfig inbound update\n")
5424{
5425 if (strncmp (argv[1], "m", 1) == 0)
5426 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5427 BGP_CLEAR_SOFT_IN, argv[0]);
5428
5429 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5430 BGP_CLEAR_SOFT_IN, argv[0]);
5431}
5432
5433ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
5434 clear_ip_bgp_peer_group_ipv4_in_cmd,
5435 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
5436 CLEAR_STR
5437 IP_STR
5438 BGP_STR
5439 "Clear all members of peer-group\n"
5440 "BGP peer-group name\n"
5441 "Address family\n"
5442 "Address Family modifier\n"
5443 "Address Family modifier\n"
5444 "Soft reconfig inbound update\n")
5445
5446DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
5447 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
5448 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
5449 CLEAR_STR
5450 IP_STR
5451 BGP_STR
5452 "Clear all members of peer-group\n"
5453 "BGP peer-group name\n"
5454 "Address family\n"
5455 "Address Family modifier\n"
5456 "Address Family modifier\n"
5457 "Soft reconfig inbound update\n"
5458 "Push out prefix-list ORF and do inbound soft reconfig\n")
5459{
5460 if (strncmp (argv[1], "m", 1) == 0)
5461 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5462 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5463
5464 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5465 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5466}
5467
5468DEFUN (clear_bgp_peer_group_soft_in,
5469 clear_bgp_peer_group_soft_in_cmd,
5470 "clear bgp peer-group WORD soft in",
5471 CLEAR_STR
5472 BGP_STR
5473 "Clear all members of peer-group\n"
5474 "BGP peer-group name\n"
5475 "Soft reconfig\n"
5476 "Soft reconfig inbound update\n")
5477{
5478 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5479 BGP_CLEAR_SOFT_IN, argv[0]);
5480}
5481
5482ALIAS (clear_bgp_peer_group_soft_in,
5483 clear_bgp_ipv6_peer_group_soft_in_cmd,
5484 "clear bgp ipv6 peer-group WORD soft in",
5485 CLEAR_STR
5486 BGP_STR
5487 "Address family\n"
5488 "Clear all members of peer-group\n"
5489 "BGP peer-group name\n"
5490 "Soft reconfig\n"
5491 "Soft reconfig inbound update\n")
5492
5493ALIAS (clear_bgp_peer_group_soft_in,
5494 clear_bgp_peer_group_in_cmd,
5495 "clear bgp peer-group WORD in",
5496 CLEAR_STR
5497 BGP_STR
5498 "Clear all members of peer-group\n"
5499 "BGP peer-group name\n"
5500 "Soft reconfig inbound update\n")
5501
5502ALIAS (clear_bgp_peer_group_soft_in,
5503 clear_bgp_ipv6_peer_group_in_cmd,
5504 "clear bgp ipv6 peer-group WORD in",
5505 CLEAR_STR
5506 BGP_STR
5507 "Address family\n"
5508 "Clear all members of peer-group\n"
5509 "BGP peer-group name\n"
5510 "Soft reconfig inbound update\n")
5511
5512DEFUN (clear_bgp_peer_group_in_prefix_filter,
5513 clear_bgp_peer_group_in_prefix_filter_cmd,
5514 "clear bgp peer-group WORD in prefix-filter",
5515 CLEAR_STR
5516 BGP_STR
5517 "Clear all members of peer-group\n"
5518 "BGP peer-group name\n"
5519 "Soft reconfig inbound update\n"
5520 "Push out prefix-list ORF and do inbound soft reconfig\n")
5521{
5522 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5523 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5524}
5525
5526ALIAS (clear_bgp_peer_group_in_prefix_filter,
5527 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
5528 "clear bgp ipv6 peer-group WORD in prefix-filter",
5529 CLEAR_STR
5530 BGP_STR
5531 "Address family\n"
5532 "Clear all members of peer-group\n"
5533 "BGP peer-group name\n"
5534 "Soft reconfig inbound update\n"
5535 "Push out prefix-list ORF and do inbound soft reconfig\n")
5536
5537DEFUN (clear_ip_bgp_external_soft_in,
5538 clear_ip_bgp_external_soft_in_cmd,
5539 "clear ip bgp external soft in",
5540 CLEAR_STR
5541 IP_STR
5542 BGP_STR
5543 "Clear all external peers\n"
5544 "Soft reconfig\n"
5545 "Soft reconfig inbound update\n")
5546{
5547 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5548 BGP_CLEAR_SOFT_IN, NULL);
5549}
5550
5551ALIAS (clear_ip_bgp_external_soft_in,
5552 clear_ip_bgp_external_in_cmd,
5553 "clear ip bgp external in",
5554 CLEAR_STR
5555 IP_STR
5556 BGP_STR
5557 "Clear all external peers\n"
5558 "Soft reconfig inbound update\n")
5559
5560DEFUN (clear_ip_bgp_external_in_prefix_filter,
5561 clear_ip_bgp_external_in_prefix_filter_cmd,
5562 "clear ip bgp external in prefix-filter",
5563 CLEAR_STR
5564 IP_STR
5565 BGP_STR
5566 "Clear all external peers\n"
5567 "Soft reconfig inbound update\n"
5568 "Push out prefix-list ORF and do inbound soft reconfig\n")
5569{
5570 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5571 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5572}
5573
5574DEFUN (clear_ip_bgp_external_ipv4_soft_in,
5575 clear_ip_bgp_external_ipv4_soft_in_cmd,
5576 "clear ip bgp external ipv4 (unicast|multicast) soft in",
5577 CLEAR_STR
5578 IP_STR
5579 BGP_STR
5580 "Clear all external peers\n"
5581 "Address family\n"
5582 "Address Family modifier\n"
5583 "Address Family modifier\n"
5584 "Soft reconfig\n"
5585 "Soft reconfig inbound update\n")
5586{
5587 if (strncmp (argv[0], "m", 1) == 0)
5588 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5589 BGP_CLEAR_SOFT_IN, NULL);
5590
5591 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5592 BGP_CLEAR_SOFT_IN, NULL);
5593}
5594
5595ALIAS (clear_ip_bgp_external_ipv4_soft_in,
5596 clear_ip_bgp_external_ipv4_in_cmd,
5597 "clear ip bgp external ipv4 (unicast|multicast) in",
5598 CLEAR_STR
5599 IP_STR
5600 BGP_STR
5601 "Clear all external peers\n"
5602 "Address family\n"
5603 "Address Family modifier\n"
5604 "Address Family modifier\n"
5605 "Soft reconfig inbound update\n")
5606
5607DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
5608 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
5609 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
5610 CLEAR_STR
5611 IP_STR
5612 BGP_STR
5613 "Clear all external peers\n"
5614 "Address family\n"
5615 "Address Family modifier\n"
5616 "Address Family modifier\n"
5617 "Soft reconfig inbound update\n"
5618 "Push out prefix-list ORF and do inbound soft reconfig\n")
5619{
5620 if (strncmp (argv[0], "m", 1) == 0)
5621 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5622 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5623
5624 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5625 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5626}
5627
5628DEFUN (clear_bgp_external_soft_in,
5629 clear_bgp_external_soft_in_cmd,
5630 "clear bgp external soft in",
5631 CLEAR_STR
5632 BGP_STR
5633 "Clear all external peers\n"
5634 "Soft reconfig\n"
5635 "Soft reconfig inbound update\n")
5636{
5637 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5638 BGP_CLEAR_SOFT_IN, NULL);
5639}
5640
5641ALIAS (clear_bgp_external_soft_in,
5642 clear_bgp_ipv6_external_soft_in_cmd,
5643 "clear bgp ipv6 external soft in",
5644 CLEAR_STR
5645 BGP_STR
5646 "Address family\n"
5647 "Clear all external peers\n"
5648 "Soft reconfig\n"
5649 "Soft reconfig inbound update\n")
5650
5651ALIAS (clear_bgp_external_soft_in,
5652 clear_bgp_external_in_cmd,
5653 "clear bgp external in",
5654 CLEAR_STR
5655 BGP_STR
5656 "Clear all external peers\n"
5657 "Soft reconfig inbound update\n")
5658
5659ALIAS (clear_bgp_external_soft_in,
5660 clear_bgp_ipv6_external_in_cmd,
5661 "clear bgp ipv6 external WORD in",
5662 CLEAR_STR
5663 BGP_STR
5664 "Address family\n"
5665 "Clear all external peers\n"
5666 "Soft reconfig inbound update\n")
5667
5668DEFUN (clear_bgp_external_in_prefix_filter,
5669 clear_bgp_external_in_prefix_filter_cmd,
5670 "clear bgp external in prefix-filter",
5671 CLEAR_STR
5672 BGP_STR
5673 "Clear all external peers\n"
5674 "Soft reconfig inbound update\n"
5675 "Push out prefix-list ORF and do inbound soft reconfig\n")
5676{
5677 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5678 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5679}
5680
5681ALIAS (clear_bgp_external_in_prefix_filter,
5682 clear_bgp_ipv6_external_in_prefix_filter_cmd,
5683 "clear bgp ipv6 external in prefix-filter",
5684 CLEAR_STR
5685 BGP_STR
5686 "Address family\n"
5687 "Clear all external peers\n"
5688 "Soft reconfig inbound update\n"
5689 "Push out prefix-list ORF and do inbound soft reconfig\n")
5690
5691DEFUN (clear_ip_bgp_as_soft_in,
5692 clear_ip_bgp_as_soft_in_cmd,
5693 "clear ip bgp <1-65535> soft in",
5694 CLEAR_STR
5695 IP_STR
5696 BGP_STR
5697 "Clear peers with the AS number\n"
5698 "Soft reconfig\n"
5699 "Soft reconfig inbound update\n")
5700{
5701 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5702 BGP_CLEAR_SOFT_IN, argv[0]);
5703}
5704
5705ALIAS (clear_ip_bgp_as_soft_in,
5706 clear_ip_bgp_as_in_cmd,
5707 "clear ip bgp <1-65535> in",
5708 CLEAR_STR
5709 IP_STR
5710 BGP_STR
5711 "Clear peers with the AS number\n"
5712 "Soft reconfig inbound update\n")
5713
5714DEFUN (clear_ip_bgp_as_in_prefix_filter,
5715 clear_ip_bgp_as_in_prefix_filter_cmd,
5716 "clear ip bgp <1-65535> in prefix-filter",
5717 CLEAR_STR
5718 IP_STR
5719 BGP_STR
5720 "Clear peers with the AS number\n"
5721 "Soft reconfig inbound update\n"
5722 "Push out prefix-list ORF and do inbound soft reconfig\n")
5723{
5724 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5725 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5726}
5727
5728DEFUN (clear_ip_bgp_as_ipv4_soft_in,
5729 clear_ip_bgp_as_ipv4_soft_in_cmd,
5730 "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft in",
5731 CLEAR_STR
5732 IP_STR
5733 BGP_STR
5734 "Clear peers with the AS number\n"
5735 "Address family\n"
5736 "Address Family modifier\n"
5737 "Address Family modifier\n"
5738 "Soft reconfig\n"
5739 "Soft reconfig inbound update\n")
5740{
5741 if (strncmp (argv[1], "m", 1) == 0)
5742 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5743 BGP_CLEAR_SOFT_IN, argv[0]);
5744
5745 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5746 BGP_CLEAR_SOFT_IN, argv[0]);
5747}
5748
5749ALIAS (clear_ip_bgp_as_ipv4_soft_in,
5750 clear_ip_bgp_as_ipv4_in_cmd,
5751 "clear ip bgp <1-65535> ipv4 (unicast|multicast) in",
5752 CLEAR_STR
5753 IP_STR
5754 BGP_STR
5755 "Clear peers with the AS number\n"
5756 "Address family\n"
5757 "Address Family modifier\n"
5758 "Address Family modifier\n"
5759 "Soft reconfig inbound update\n")
5760
5761DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
5762 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
5763 "clear ip bgp <1-65535> ipv4 (unicast|multicast) in prefix-filter",
5764 CLEAR_STR
5765 IP_STR
5766 BGP_STR
5767 "Clear peers with the AS number\n"
5768 "Address family\n"
5769 "Address Family modifier\n"
5770 "Address Family modifier\n"
5771 "Soft reconfig inbound update\n"
5772 "Push out prefix-list ORF and do inbound soft reconfig\n")
5773{
5774 if (strncmp (argv[1], "m", 1) == 0)
5775 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5776 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5777
5778 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5779 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5780}
5781
5782DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
5783 clear_ip_bgp_as_vpnv4_soft_in_cmd,
5784 "clear ip bgp <1-65535> vpnv4 unicast soft in",
5785 CLEAR_STR
5786 IP_STR
5787 BGP_STR
5788 "Clear peers with the AS number\n"
5789 "Address family\n"
5790 "Address Family modifier\n"
5791 "Soft reconfig\n"
5792 "Soft reconfig inbound update\n")
5793{
5794 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5795 BGP_CLEAR_SOFT_IN, argv[0]);
5796}
5797
5798ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
5799 clear_ip_bgp_as_vpnv4_in_cmd,
5800 "clear ip bgp <1-65535> vpnv4 unicast in",
5801 CLEAR_STR
5802 IP_STR
5803 BGP_STR
5804 "Clear peers with the AS number\n"
5805 "Address family\n"
5806 "Address Family modifier\n"
5807 "Soft reconfig inbound update\n")
5808
5809DEFUN (clear_bgp_as_soft_in,
5810 clear_bgp_as_soft_in_cmd,
5811 "clear bgp <1-65535> soft in",
5812 CLEAR_STR
5813 BGP_STR
5814 "Clear peers with the AS number\n"
5815 "Soft reconfig\n"
5816 "Soft reconfig inbound update\n")
5817{
5818 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5819 BGP_CLEAR_SOFT_IN, argv[0]);
5820}
5821
5822ALIAS (clear_bgp_as_soft_in,
5823 clear_bgp_ipv6_as_soft_in_cmd,
5824 "clear bgp ipv6 <1-65535> soft in",
5825 CLEAR_STR
5826 BGP_STR
5827 "Address family\n"
5828 "Clear peers with the AS number\n"
5829 "Soft reconfig\n"
5830 "Soft reconfig inbound update\n")
5831
5832ALIAS (clear_bgp_as_soft_in,
5833 clear_bgp_as_in_cmd,
5834 "clear bgp <1-65535> in",
5835 CLEAR_STR
5836 BGP_STR
5837 "Clear peers with the AS number\n"
5838 "Soft reconfig inbound update\n")
5839
5840ALIAS (clear_bgp_as_soft_in,
5841 clear_bgp_ipv6_as_in_cmd,
5842 "clear bgp ipv6 <1-65535> in",
5843 CLEAR_STR
5844 BGP_STR
5845 "Address family\n"
5846 "Clear peers with the AS number\n"
5847 "Soft reconfig inbound update\n")
5848
5849DEFUN (clear_bgp_as_in_prefix_filter,
5850 clear_bgp_as_in_prefix_filter_cmd,
5851 "clear bgp <1-65535> in prefix-filter",
5852 CLEAR_STR
5853 BGP_STR
5854 "Clear peers with the AS number\n"
5855 "Soft reconfig inbound update\n"
5856 "Push out prefix-list ORF and do inbound soft reconfig\n")
5857{
5858 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5859 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5860}
5861
5862ALIAS (clear_bgp_as_in_prefix_filter,
5863 clear_bgp_ipv6_as_in_prefix_filter_cmd,
5864 "clear bgp ipv6 <1-65535> in prefix-filter",
5865 CLEAR_STR
5866 BGP_STR
5867 "Address family\n"
5868 "Clear peers with the AS number\n"
5869 "Soft reconfig inbound update\n"
5870 "Push out prefix-list ORF and do inbound soft reconfig\n")
5871
5872/* Both soft-reconfiguration */
5873DEFUN (clear_ip_bgp_all_soft,
5874 clear_ip_bgp_all_soft_cmd,
5875 "clear ip bgp * soft",
5876 CLEAR_STR
5877 IP_STR
5878 BGP_STR
5879 "Clear all peers\n"
5880 "Soft reconfig\n")
5881{
5882 if (argc == 1)
5883 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5884 BGP_CLEAR_SOFT_BOTH, NULL);
5885
5886 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5887 BGP_CLEAR_SOFT_BOTH, NULL);
5888}
5889
5890ALIAS (clear_ip_bgp_all_soft,
5891 clear_ip_bgp_instance_all_soft_cmd,
5892 "clear ip bgp view WORD * soft",
5893 CLEAR_STR
5894 IP_STR
5895 BGP_STR
5896 "BGP view\n"
5897 "view name\n"
5898 "Clear all peers\n"
5899 "Soft reconfig\n")
5900
5901
5902DEFUN (clear_ip_bgp_all_ipv4_soft,
5903 clear_ip_bgp_all_ipv4_soft_cmd,
5904 "clear ip bgp * ipv4 (unicast|multicast) soft",
5905 CLEAR_STR
5906 IP_STR
5907 BGP_STR
5908 "Clear all peers\n"
5909 "Address family\n"
5910 "Address Family Modifier\n"
5911 "Address Family Modifier\n"
5912 "Soft reconfig\n")
5913{
5914 if (strncmp (argv[0], "m", 1) == 0)
5915 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5916 BGP_CLEAR_SOFT_BOTH, NULL);
5917
5918 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5919 BGP_CLEAR_SOFT_BOTH, NULL);
5920}
5921
5922DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
5923 clear_ip_bgp_instance_all_ipv4_soft_cmd,
5924 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
5925 CLEAR_STR
5926 IP_STR
5927 BGP_STR
5928 "BGP view\n"
5929 "view name\n"
5930 "Clear all peers\n"
5931 "Address family\n"
5932 "Address Family Modifier\n"
5933 "Address Family Modifier\n"
5934 "Soft reconfig\n")
5935{
5936 if (strncmp (argv[1], "m", 1) == 0)
5937 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5938 BGP_CLEAR_SOFT_BOTH, NULL);
5939
5940 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5941 BGP_CLEAR_SOFT_BOTH, NULL);
5942}
5943
5944DEFUN (clear_ip_bgp_all_vpnv4_soft,
5945 clear_ip_bgp_all_vpnv4_soft_cmd,
5946 "clear ip bgp * vpnv4 unicast soft",
5947 CLEAR_STR
5948 IP_STR
5949 BGP_STR
5950 "Clear all peers\n"
5951 "Address family\n"
5952 "Address Family Modifier\n"
5953 "Soft reconfig\n")
5954{
5955 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5956 BGP_CLEAR_SOFT_BOTH, argv[0]);
5957}
5958
5959DEFUN (clear_bgp_all_soft,
5960 clear_bgp_all_soft_cmd,
5961 "clear bgp * soft",
5962 CLEAR_STR
5963 BGP_STR
5964 "Clear all peers\n"
5965 "Soft reconfig\n")
5966{
5967 if (argc == 1)
5968 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5969 BGP_CLEAR_SOFT_BOTH, argv[0]);
5970
5971 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5972 BGP_CLEAR_SOFT_BOTH, argv[0]);
5973}
5974
5975ALIAS (clear_bgp_all_soft,
5976 clear_bgp_instance_all_soft_cmd,
5977 "clear bgp view WORD * soft",
5978 CLEAR_STR
5979 BGP_STR
5980 "BGP view\n"
5981 "view name\n"
5982 "Clear all peers\n"
5983 "Soft reconfig\n")
5984
5985ALIAS (clear_bgp_all_soft,
5986 clear_bgp_ipv6_all_soft_cmd,
5987 "clear bgp ipv6 * soft",
5988 CLEAR_STR
5989 BGP_STR
5990 "Address family\n"
5991 "Clear all peers\n"
5992 "Soft reconfig\n")
5993
5994DEFUN (clear_ip_bgp_peer_soft,
5995 clear_ip_bgp_peer_soft_cmd,
5996 "clear ip bgp A.B.C.D soft",
5997 CLEAR_STR
5998 IP_STR
5999 BGP_STR
6000 "BGP neighbor address to clear\n"
6001 "Soft reconfig\n")
6002{
6003 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6004 BGP_CLEAR_SOFT_BOTH, argv[0]);
6005}
6006
6007DEFUN (clear_ip_bgp_peer_ipv4_soft,
6008 clear_ip_bgp_peer_ipv4_soft_cmd,
6009 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6010 CLEAR_STR
6011 IP_STR
6012 BGP_STR
6013 "BGP neighbor address to clear\n"
6014 "Address family\n"
6015 "Address Family Modifier\n"
6016 "Address Family Modifier\n"
6017 "Soft reconfig\n")
6018{
6019 if (strncmp (argv[1], "m", 1) == 0)
6020 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6021 BGP_CLEAR_SOFT_BOTH, argv[0]);
6022
6023 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6024 BGP_CLEAR_SOFT_BOTH, argv[0]);
6025}
6026
6027DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6028 clear_ip_bgp_peer_vpnv4_soft_cmd,
6029 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6030 CLEAR_STR
6031 IP_STR
6032 BGP_STR
6033 "BGP neighbor address to clear\n"
6034 "Address family\n"
6035 "Address Family Modifier\n"
6036 "Soft reconfig\n")
6037{
6038 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6039 BGP_CLEAR_SOFT_BOTH, argv[0]);
6040}
6041
6042DEFUN (clear_bgp_peer_soft,
6043 clear_bgp_peer_soft_cmd,
6044 "clear bgp (A.B.C.D|X:X::X:X) soft",
6045 CLEAR_STR
6046 BGP_STR
6047 "BGP neighbor address to clear\n"
6048 "BGP IPv6 neighbor to clear\n"
6049 "Soft reconfig\n")
6050{
6051 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6052 BGP_CLEAR_SOFT_BOTH, argv[0]);
6053}
6054
6055ALIAS (clear_bgp_peer_soft,
6056 clear_bgp_ipv6_peer_soft_cmd,
6057 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6058 CLEAR_STR
6059 BGP_STR
6060 "Address family\n"
6061 "BGP neighbor address to clear\n"
6062 "BGP IPv6 neighbor to clear\n"
6063 "Soft reconfig\n")
6064
6065DEFUN (clear_ip_bgp_peer_group_soft,
6066 clear_ip_bgp_peer_group_soft_cmd,
6067 "clear ip bgp peer-group WORD soft",
6068 CLEAR_STR
6069 IP_STR
6070 BGP_STR
6071 "Clear all members of peer-group\n"
6072 "BGP peer-group name\n"
6073 "Soft reconfig\n")
6074{
6075 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6076 BGP_CLEAR_SOFT_BOTH, argv[0]);
6077}
6078
6079DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6080 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6081 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6082 CLEAR_STR
6083 IP_STR
6084 BGP_STR
6085 "Clear all members of peer-group\n"
6086 "BGP peer-group name\n"
6087 "Address family\n"
6088 "Address Family modifier\n"
6089 "Address Family modifier\n"
6090 "Soft reconfig\n")
6091{
6092 if (strncmp (argv[1], "m", 1) == 0)
6093 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6094 BGP_CLEAR_SOFT_BOTH, argv[0]);
6095
6096 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6097 BGP_CLEAR_SOFT_BOTH, argv[0]);
6098}
6099
6100DEFUN (clear_bgp_peer_group_soft,
6101 clear_bgp_peer_group_soft_cmd,
6102 "clear bgp peer-group WORD soft",
6103 CLEAR_STR
6104 BGP_STR
6105 "Clear all members of peer-group\n"
6106 "BGP peer-group name\n"
6107 "Soft reconfig\n")
6108{
6109 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6110 BGP_CLEAR_SOFT_BOTH, argv[0]);
6111}
6112
6113ALIAS (clear_bgp_peer_group_soft,
6114 clear_bgp_ipv6_peer_group_soft_cmd,
6115 "clear bgp ipv6 peer-group WORD soft",
6116 CLEAR_STR
6117 BGP_STR
6118 "Address family\n"
6119 "Clear all members of peer-group\n"
6120 "BGP peer-group name\n"
6121 "Soft reconfig\n")
6122
6123DEFUN (clear_ip_bgp_external_soft,
6124 clear_ip_bgp_external_soft_cmd,
6125 "clear ip bgp external soft",
6126 CLEAR_STR
6127 IP_STR
6128 BGP_STR
6129 "Clear all external peers\n"
6130 "Soft reconfig\n")
6131{
6132 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6133 BGP_CLEAR_SOFT_BOTH, NULL);
6134}
6135
6136DEFUN (clear_ip_bgp_external_ipv4_soft,
6137 clear_ip_bgp_external_ipv4_soft_cmd,
6138 "clear ip bgp external ipv4 (unicast|multicast) soft",
6139 CLEAR_STR
6140 IP_STR
6141 BGP_STR
6142 "Clear all external peers\n"
6143 "Address family\n"
6144 "Address Family modifier\n"
6145 "Address Family modifier\n"
6146 "Soft reconfig\n")
6147{
6148 if (strncmp (argv[0], "m", 1) == 0)
6149 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6150 BGP_CLEAR_SOFT_BOTH, NULL);
6151
6152 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6153 BGP_CLEAR_SOFT_BOTH, NULL);
6154}
6155
6156DEFUN (clear_bgp_external_soft,
6157 clear_bgp_external_soft_cmd,
6158 "clear bgp external soft",
6159 CLEAR_STR
6160 BGP_STR
6161 "Clear all external peers\n"
6162 "Soft reconfig\n")
6163{
6164 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6165 BGP_CLEAR_SOFT_BOTH, NULL);
6166}
6167
6168ALIAS (clear_bgp_external_soft,
6169 clear_bgp_ipv6_external_soft_cmd,
6170 "clear bgp ipv6 external soft",
6171 CLEAR_STR
6172 BGP_STR
6173 "Address family\n"
6174 "Clear all external peers\n"
6175 "Soft reconfig\n")
6176
6177DEFUN (clear_ip_bgp_as_soft,
6178 clear_ip_bgp_as_soft_cmd,
6179 "clear ip bgp <1-65535> soft",
6180 CLEAR_STR
6181 IP_STR
6182 BGP_STR
6183 "Clear peers with the AS number\n"
6184 "Soft reconfig\n")
6185{
6186 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6187 BGP_CLEAR_SOFT_BOTH, argv[0]);
6188}
6189
6190DEFUN (clear_ip_bgp_as_ipv4_soft,
6191 clear_ip_bgp_as_ipv4_soft_cmd,
6192 "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft",
6193 CLEAR_STR
6194 IP_STR
6195 BGP_STR
6196 "Clear peers with the AS number\n"
6197 "Address family\n"
6198 "Address Family Modifier\n"
6199 "Address Family Modifier\n"
6200 "Soft reconfig\n")
6201{
6202 if (strncmp (argv[1], "m", 1) == 0)
6203 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6204 BGP_CLEAR_SOFT_BOTH, argv[0]);
6205
6206 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6207 BGP_CLEAR_SOFT_BOTH, argv[0]);
6208}
6209
6210DEFUN (clear_ip_bgp_as_vpnv4_soft,
6211 clear_ip_bgp_as_vpnv4_soft_cmd,
6212 "clear ip bgp <1-65535> vpnv4 unicast soft",
6213 CLEAR_STR
6214 IP_STR
6215 BGP_STR
6216 "Clear peers with the AS number\n"
6217 "Address family\n"
6218 "Address Family Modifier\n"
6219 "Soft reconfig\n")
6220{
6221 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6222 BGP_CLEAR_SOFT_BOTH, argv[0]);
6223}
6224
6225DEFUN (clear_bgp_as_soft,
6226 clear_bgp_as_soft_cmd,
6227 "clear bgp <1-65535> soft",
6228 CLEAR_STR
6229 BGP_STR
6230 "Clear peers with the AS number\n"
6231 "Soft reconfig\n")
6232{
6233 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6234 BGP_CLEAR_SOFT_BOTH, argv[0]);
6235}
6236
6237ALIAS (clear_bgp_as_soft,
6238 clear_bgp_ipv6_as_soft_cmd,
6239 "clear bgp ipv6 <1-65535> soft",
6240 CLEAR_STR
6241 BGP_STR
6242 "Address family\n"
6243 "Clear peers with the AS number\n"
6244 "Soft reconfig\n")
6245
paulfee0f4c2004-09-13 05:12:46 +00006246/* RS-client soft reconfiguration. */
6247#ifdef HAVE_IPV6
6248DEFUN (clear_bgp_all_rsclient,
6249 clear_bgp_all_rsclient_cmd,
6250 "clear bgp * rsclient",
6251 CLEAR_STR
6252 BGP_STR
6253 "Clear all peers\n"
6254 "Soft reconfig for rsclient RIB\n")
6255{
6256 if (argc == 1)
6257 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6258 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6259
6260 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6261 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6262}
6263
6264ALIAS (clear_bgp_all_rsclient,
6265 clear_bgp_ipv6_all_rsclient_cmd,
6266 "clear bgp ipv6 * rsclient",
6267 CLEAR_STR
6268 BGP_STR
6269 "Address family\n"
6270 "Clear all peers\n"
6271 "Soft reconfig for rsclient RIB\n")
6272
6273ALIAS (clear_bgp_all_rsclient,
6274 clear_bgp_instance_all_rsclient_cmd,
6275 "clear bgp view WORD * rsclient",
6276 CLEAR_STR
6277 BGP_STR
6278 "BGP view\n"
6279 "view name\n"
6280 "Clear all peers\n"
6281 "Soft reconfig for rsclient RIB\n")
6282
6283ALIAS (clear_bgp_all_rsclient,
6284 clear_bgp_ipv6_instance_all_rsclient_cmd,
6285 "clear bgp ipv6 view WORD * rsclient",
6286 CLEAR_STR
6287 BGP_STR
6288 "Address family\n"
6289 "BGP view\n"
6290 "view name\n"
6291 "Clear all peers\n"
6292 "Soft reconfig for rsclient RIB\n")
6293#endif /* HAVE_IPV6 */
6294
6295DEFUN (clear_ip_bgp_all_rsclient,
6296 clear_ip_bgp_all_rsclient_cmd,
6297 "clear ip bgp * rsclient",
6298 CLEAR_STR
6299 IP_STR
6300 BGP_STR
6301 "Clear all peers\n"
6302 "Soft reconfig for rsclient RIB\n")
6303{
6304 if (argc == 1)
6305 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6306 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6307
6308 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6309 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6310}
6311
6312ALIAS (clear_ip_bgp_all_rsclient,
6313 clear_ip_bgp_instance_all_rsclient_cmd,
6314 "clear ip bgp view WORD * rsclient",
6315 CLEAR_STR
6316 IP_STR
6317 BGP_STR
6318 "BGP view\n"
6319 "view name\n"
6320 "Clear all peers\n"
6321 "Soft reconfig for rsclient RIB\n")
6322
6323#ifdef HAVE_IPV6
6324DEFUN (clear_bgp_peer_rsclient,
6325 clear_bgp_peer_rsclient_cmd,
6326 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
6327 CLEAR_STR
6328 BGP_STR
6329 "BGP neighbor IP address to clear\n"
6330 "BGP IPv6 neighbor to clear\n"
6331 "Soft reconfig for rsclient RIB\n")
6332{
6333 if (argc == 2)
6334 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
6335 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6336
6337 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6338 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6339}
6340
6341ALIAS (clear_bgp_peer_rsclient,
6342 clear_bgp_ipv6_peer_rsclient_cmd,
6343 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
6344 CLEAR_STR
6345 BGP_STR
6346 "Address family\n"
6347 "BGP neighbor IP address to clear\n"
6348 "BGP IPv6 neighbor to clear\n"
6349 "Soft reconfig for rsclient RIB\n")
6350
6351ALIAS (clear_bgp_peer_rsclient,
6352 clear_bgp_instance_peer_rsclient_cmd,
6353 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6354 CLEAR_STR
6355 BGP_STR
6356 "BGP view\n"
6357 "view name\n"
6358 "BGP neighbor IP address to clear\n"
6359 "BGP IPv6 neighbor to clear\n"
6360 "Soft reconfig for rsclient RIB\n")
6361
6362ALIAS (clear_bgp_peer_rsclient,
6363 clear_bgp_ipv6_instance_peer_rsclient_cmd,
6364 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
6365 CLEAR_STR
6366 BGP_STR
6367 "Address family\n"
6368 "BGP view\n"
6369 "view name\n"
6370 "BGP neighbor IP address to clear\n"
6371 "BGP IPv6 neighbor to clear\n"
6372 "Soft reconfig for rsclient RIB\n")
6373#endif /* HAVE_IPV6 */
6374
6375DEFUN (clear_ip_bgp_peer_rsclient,
6376 clear_ip_bgp_peer_rsclient_cmd,
6377 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
6378 CLEAR_STR
6379 IP_STR
6380 BGP_STR
6381 "BGP neighbor IP address to clear\n"
6382 "BGP IPv6 neighbor to clear\n"
6383 "Soft reconfig for rsclient RIB\n")
6384{
6385 if (argc == 2)
6386 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
6387 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6388
6389 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6390 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6391}
6392
6393ALIAS (clear_ip_bgp_peer_rsclient,
6394 clear_ip_bgp_instance_peer_rsclient_cmd,
6395 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6396 CLEAR_STR
6397 IP_STR
6398 BGP_STR
6399 "BGP view\n"
6400 "view name\n"
6401 "BGP neighbor IP address to clear\n"
6402 "BGP IPv6 neighbor to clear\n"
6403 "Soft reconfig for rsclient RIB\n")
6404
6405
paul718e3742002-12-13 20:15:29 +00006406/* Show BGP peer's summary information. */
6407int
6408bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
6409{
6410 struct peer *peer;
6411 struct listnode *nn;
6412 int count = 0;
6413 char timebuf[BGP_UPTIME_LEN];
6414 int len;
6415
6416 /* Header string for each address family. */
6417 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
6418
6419 LIST_LOOP (bgp->peer, peer, nn)
6420 {
6421 if (peer->afc[afi][safi])
6422 {
6423 if (! count)
6424 {
6425 vty_out (vty,
6426 "BGP router identifier %s, local AS number %d%s",
6427 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
6428 vty_out (vty,
6429 "%ld BGP AS-PATH entries%s", aspath_count (),
6430 VTY_NEWLINE);
6431 vty_out (vty,
6432 "%ld BGP community entries%s", community_count (),
6433 VTY_NEWLINE);
6434
6435 if (CHECK_FLAG(bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
6436 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
6437 vty_out (vty, "%s", VTY_NEWLINE);
6438 vty_out (vty, "%s%s", header, VTY_NEWLINE);
6439 }
6440 count++;
6441
6442 len = vty_out (vty, "%s", peer->host);
6443 len = 16 - len;
6444 if (len < 1)
6445 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
6446 else
6447 vty_out (vty, "%*s", len, " ");
6448
hasso3d515fd2005-02-01 21:30:04 +00006449 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00006450
6451 vty_out (vty, "%5d %7d %7d %8d %4d %4ld ",
6452 peer->as,
6453 peer->open_in + peer->update_in + peer->keepalive_in
6454 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
6455 peer->open_out + peer->update_out + peer->keepalive_out
6456 + peer->notify_out + peer->refresh_out
6457 + peer->dynamic_cap_out,
6458 0, 0, peer->obuf->count);
6459
6460 vty_out (vty, "%8s",
6461 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
6462
6463 if (peer->status == Established)
6464 {
6465 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
6466 }
6467 else
6468 {
6469 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
6470 vty_out (vty, " Idle (Admin)");
6471 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
6472 vty_out (vty, " Idle (PfxCt)");
6473 else
6474 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
6475 }
6476
6477 vty_out (vty, "%s", VTY_NEWLINE);
6478 }
6479 }
6480
6481 if (count)
6482 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
6483 count, VTY_NEWLINE);
6484 else
6485 vty_out (vty, "No %s neighbor is configured%s",
6486 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
6487 return CMD_SUCCESS;
6488}
6489
6490int
paulfd79ac92004-10-13 05:06:08 +00006491bgp_show_summary_vty (struct vty *vty, const char *name,
6492 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00006493{
6494 struct bgp *bgp;
6495
6496 if (name)
6497 {
6498 bgp = bgp_lookup_by_name (name);
6499
6500 if (! bgp)
6501 {
6502 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
6503 return CMD_WARNING;
6504 }
6505
6506 bgp_show_summary (vty, bgp, afi, safi);
6507 return CMD_SUCCESS;
6508 }
6509
6510 bgp = bgp_get_default ();
6511
6512 if (bgp)
6513 bgp_show_summary (vty, bgp, afi, safi);
6514
6515 return CMD_SUCCESS;
6516}
6517
6518/* `show ip bgp summary' commands. */
6519DEFUN (show_ip_bgp_summary,
6520 show_ip_bgp_summary_cmd,
6521 "show ip bgp summary",
6522 SHOW_STR
6523 IP_STR
6524 BGP_STR
6525 "Summary of BGP neighbor status\n")
6526{
6527 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
6528}
6529
6530DEFUN (show_ip_bgp_instance_summary,
6531 show_ip_bgp_instance_summary_cmd,
6532 "show ip bgp view WORD summary",
6533 SHOW_STR
6534 IP_STR
6535 BGP_STR
6536 "BGP view\n"
6537 "View name\n"
6538 "Summary of BGP neighbor status\n")
6539{
6540 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
6541}
6542
6543DEFUN (show_ip_bgp_ipv4_summary,
6544 show_ip_bgp_ipv4_summary_cmd,
6545 "show ip bgp ipv4 (unicast|multicast) summary",
6546 SHOW_STR
6547 IP_STR
6548 BGP_STR
6549 "Address family\n"
6550 "Address Family modifier\n"
6551 "Address Family modifier\n"
6552 "Summary of BGP neighbor status\n")
6553{
6554 if (strncmp (argv[0], "m", 1) == 0)
6555 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
6556
6557 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
6558}
6559
6560DEFUN (show_ip_bgp_instance_ipv4_summary,
6561 show_ip_bgp_instance_ipv4_summary_cmd,
6562 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
6563 SHOW_STR
6564 IP_STR
6565 BGP_STR
6566 "BGP view\n"
6567 "View name\n"
6568 "Address family\n"
6569 "Address Family modifier\n"
6570 "Address Family modifier\n"
6571 "Summary of BGP neighbor status\n")
6572{
6573 if (strncmp (argv[1], "m", 1) == 0)
6574 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
6575 else
6576 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
6577}
6578
6579DEFUN (show_ip_bgp_vpnv4_all_summary,
6580 show_ip_bgp_vpnv4_all_summary_cmd,
6581 "show ip bgp vpnv4 all summary",
6582 SHOW_STR
6583 IP_STR
6584 BGP_STR
6585 "Display VPNv4 NLRI specific information\n"
6586 "Display information about all VPNv4 NLRIs\n"
6587 "Summary of BGP neighbor status\n")
6588{
6589 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
6590}
6591
6592DEFUN (show_ip_bgp_vpnv4_rd_summary,
6593 show_ip_bgp_vpnv4_rd_summary_cmd,
6594 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
6595 SHOW_STR
6596 IP_STR
6597 BGP_STR
6598 "Display VPNv4 NLRI specific information\n"
6599 "Display information for a route distinguisher\n"
6600 "VPN Route Distinguisher\n"
6601 "Summary of BGP neighbor status\n")
6602{
6603 int ret;
6604 struct prefix_rd prd;
6605
6606 ret = str2prefix_rd (argv[0], &prd);
6607 if (! ret)
6608 {
6609 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
6610 return CMD_WARNING;
6611 }
6612
6613 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
6614}
6615
6616#ifdef HAVE_IPV6
6617DEFUN (show_bgp_summary,
6618 show_bgp_summary_cmd,
6619 "show bgp summary",
6620 SHOW_STR
6621 BGP_STR
6622 "Summary of BGP neighbor status\n")
6623{
6624 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
6625}
6626
6627DEFUN (show_bgp_instance_summary,
6628 show_bgp_instance_summary_cmd,
6629 "show bgp view WORD summary",
6630 SHOW_STR
6631 BGP_STR
6632 "BGP view\n"
6633 "View name\n"
6634 "Summary of BGP neighbor status\n")
6635{
6636 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
6637}
6638
6639ALIAS (show_bgp_summary,
6640 show_bgp_ipv6_summary_cmd,
6641 "show bgp ipv6 summary",
6642 SHOW_STR
6643 BGP_STR
6644 "Address family\n"
6645 "Summary of BGP neighbor status\n")
6646
6647ALIAS (show_bgp_instance_summary,
6648 show_bgp_instance_ipv6_summary_cmd,
6649 "show bgp view WORD ipv6 summary",
6650 SHOW_STR
6651 BGP_STR
6652 "BGP view\n"
6653 "View name\n"
6654 "Address family\n"
6655 "Summary of BGP neighbor status\n")
6656
6657/* old command */
6658DEFUN (show_ipv6_bgp_summary,
6659 show_ipv6_bgp_summary_cmd,
6660 "show ipv6 bgp summary",
6661 SHOW_STR
6662 IPV6_STR
6663 BGP_STR
6664 "Summary of BGP neighbor status\n")
6665{
6666 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
6667}
6668
6669/* old command */
6670DEFUN (show_ipv6_mbgp_summary,
6671 show_ipv6_mbgp_summary_cmd,
6672 "show ipv6 mbgp summary",
6673 SHOW_STR
6674 IPV6_STR
6675 MBGP_STR
6676 "Summary of BGP neighbor status\n")
6677{
6678 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
6679}
6680#endif /* HAVE_IPV6 */
6681
paulfd79ac92004-10-13 05:06:08 +00006682const char *
hasso538621f2004-05-21 09:31:30 +00006683afi_safi_print (afi_t afi, safi_t safi)
6684{
6685 if (afi == AFI_IP && safi == SAFI_UNICAST)
6686 return "IPv4 Unicast";
6687 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
6688 return "IPv4 Multicast";
6689 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
6690 return "VPNv4 Unicast";
6691 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
6692 return "IPv6 Unicast";
6693 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
6694 return "IPv6 Multicast";
6695 else
6696 return "Unknown";
6697}
6698
paul718e3742002-12-13 20:15:29 +00006699/* Show BGP peer's information. */
6700enum show_type
6701{
6702 show_all,
6703 show_peer
6704};
6705
6706void
6707bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
6708 afi_t afi, safi_t safi,
6709 u_int16_t adv_smcap, u_int16_t adv_rmcap,
6710 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
6711{
6712 /* Send-Mode */
6713 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
6714 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
6715 {
6716 vty_out (vty, " Send-mode: ");
6717 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
6718 vty_out (vty, "advertised");
6719 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
6720 vty_out (vty, "%sreceived",
6721 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
6722 ", " : "");
6723 vty_out (vty, "%s", VTY_NEWLINE);
6724 }
6725
6726 /* Receive-Mode */
6727 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
6728 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
6729 {
6730 vty_out (vty, " Receive-mode: ");
6731 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
6732 vty_out (vty, "advertised");
6733 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
6734 vty_out (vty, "%sreceived",
6735 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
6736 ", " : "");
6737 vty_out (vty, "%s", VTY_NEWLINE);
6738 }
6739}
6740
6741void
6742bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
6743{
6744 struct bgp_filter *filter;
6745 char orf_pfx_name[BUFSIZ];
6746 int orf_pfx_count;
6747
6748 filter = &p->filter[afi][safi];
6749
hasso538621f2004-05-21 09:31:30 +00006750 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00006751 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00006752
paul718e3742002-12-13 20:15:29 +00006753 if (p->af_group[afi][safi])
6754 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
6755
6756 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
6757 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
6758 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
6759 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
6760 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
6761 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
6762 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
6763
6764 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
6765 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
6766 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
6767 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
6768 {
6769 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
6770 ORF_TYPE_PREFIX, VTY_NEWLINE);
6771 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
6772 PEER_CAP_ORF_PREFIX_SM_ADV,
6773 PEER_CAP_ORF_PREFIX_RM_ADV,
6774 PEER_CAP_ORF_PREFIX_SM_RCV,
6775 PEER_CAP_ORF_PREFIX_RM_RCV);
6776 }
6777 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
6778 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
6779 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
6780 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
6781 {
6782 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
6783 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
6784 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
6785 PEER_CAP_ORF_PREFIX_SM_ADV,
6786 PEER_CAP_ORF_PREFIX_RM_ADV,
6787 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
6788 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
6789 }
6790
6791 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
6792 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
6793
6794 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
6795 || orf_pfx_count)
6796 {
6797 vty_out (vty, " Outbound Route Filter (ORF):");
6798 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
6799 vty_out (vty, " sent;");
6800 if (orf_pfx_count)
6801 vty_out (vty, " received (%d entries)", orf_pfx_count);
6802 vty_out (vty, "%s", VTY_NEWLINE);
6803 }
6804 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
6805 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
6806
6807 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
6808 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
6809 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
6810 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
6811 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
6812 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
6813 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
6814 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
6815 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
6816 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
6817 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
6818 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
6819 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
6820 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
6821 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
6822 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
6823 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
6824 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
6825 {
6826 vty_out (vty, " Community attribute sent to this neighbor");
6827 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
6828 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00006829 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006830 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00006831 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006832 else
hasso538621f2004-05-21 09:31:30 +00006833 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006834 }
6835 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
6836 {
6837 vty_out (vty, " Default information originate,");
6838
6839 if (p->default_rmap[afi][safi].name)
6840 vty_out (vty, " default route-map %s%s,",
6841 p->default_rmap[afi][safi].map ? "*" : "",
6842 p->default_rmap[afi][safi].name);
6843 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
6844 vty_out (vty, " default sent%s", VTY_NEWLINE);
6845 else
6846 vty_out (vty, " default not sent%s", VTY_NEWLINE);
6847 }
6848
6849 if (filter->plist[FILTER_IN].name
6850 || filter->dlist[FILTER_IN].name
6851 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00006852 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00006853 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
6854 if (filter->plist[FILTER_OUT].name
6855 || filter->dlist[FILTER_OUT].name
6856 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00006857 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00006858 || filter->usmap.name)
6859 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00006860 if (filter->map[RMAP_IMPORT].name)
6861 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
6862 if (filter->map[RMAP_EXPORT].name)
6863 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006864
6865 /* prefix-list */
6866 if (filter->plist[FILTER_IN].name)
6867 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
6868 filter->plist[FILTER_IN].plist ? "*" : "",
6869 filter->plist[FILTER_IN].name,
6870 VTY_NEWLINE);
6871 if (filter->plist[FILTER_OUT].name)
6872 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
6873 filter->plist[FILTER_OUT].plist ? "*" : "",
6874 filter->plist[FILTER_OUT].name,
6875 VTY_NEWLINE);
6876
6877 /* distribute-list */
6878 if (filter->dlist[FILTER_IN].name)
6879 vty_out (vty, " Incoming update network filter list is %s%s%s",
6880 filter->dlist[FILTER_IN].alist ? "*" : "",
6881 filter->dlist[FILTER_IN].name,
6882 VTY_NEWLINE);
6883 if (filter->dlist[FILTER_OUT].name)
6884 vty_out (vty, " Outgoing update network filter list is %s%s%s",
6885 filter->dlist[FILTER_OUT].alist ? "*" : "",
6886 filter->dlist[FILTER_OUT].name,
6887 VTY_NEWLINE);
6888
6889 /* filter-list. */
6890 if (filter->aslist[FILTER_IN].name)
6891 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
6892 filter->aslist[FILTER_IN].aslist ? "*" : "",
6893 filter->aslist[FILTER_IN].name,
6894 VTY_NEWLINE);
6895 if (filter->aslist[FILTER_OUT].name)
6896 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
6897 filter->aslist[FILTER_OUT].aslist ? "*" : "",
6898 filter->aslist[FILTER_OUT].name,
6899 VTY_NEWLINE);
6900
6901 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00006902 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00006903 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00006904 filter->map[RMAP_IN].map ? "*" : "",
6905 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00006906 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00006907 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00006908 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00006909 filter->map[RMAP_OUT].map ? "*" : "",
6910 filter->map[RMAP_OUT].name,
6911 VTY_NEWLINE);
6912 if (filter->map[RMAP_IMPORT].name)
6913 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
6914 filter->map[RMAP_IMPORT].map ? "*" : "",
6915 filter->map[RMAP_IMPORT].name,
6916 VTY_NEWLINE);
6917 if (filter->map[RMAP_EXPORT].name)
6918 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
6919 filter->map[RMAP_EXPORT].map ? "*" : "",
6920 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00006921 VTY_NEWLINE);
6922
6923 /* unsuppress-map */
6924 if (filter->usmap.name)
6925 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
6926 filter->usmap.map ? "*" : "",
6927 filter->usmap.name, VTY_NEWLINE);
6928
6929 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00006930 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
6931
paul718e3742002-12-13 20:15:29 +00006932 /* Maximum prefix */
6933 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
6934 {
hasso0a486e52005-02-01 20:57:17 +00006935 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00006936 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00006937 ? " (warning-only)" : "", VTY_NEWLINE);
6938 vty_out (vty, " Threshold for warning message %d%%",
6939 p->pmax_threshold[afi][safi]);
6940 if (p->pmax_restart[afi][safi])
6941 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
6942 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006943 }
paul718e3742002-12-13 20:15:29 +00006944
6945 vty_out (vty, "%s", VTY_NEWLINE);
6946}
6947
6948void
6949bgp_show_peer (struct vty *vty, struct peer *p)
6950{
6951 struct bgp *bgp;
6952 char buf1[BUFSIZ];
6953 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00006954 afi_t afi;
6955 safi_t safi;
paul718e3742002-12-13 20:15:29 +00006956
6957 bgp = p->bgp;
6958
6959 /* Configured IP address. */
6960 vty_out (vty, "BGP neighbor is %s, ", p->host);
6961 vty_out (vty, "remote AS %d, ", p->as);
6962 vty_out (vty, "local AS %d%s, ",
6963 p->change_local_as ? p->change_local_as : p->local_as,
6964 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
6965 " no-prepend" : "");
6966 vty_out (vty, "%s link%s",
6967 p->as == p->local_as ? "internal" : "external",
6968 VTY_NEWLINE);
6969
6970 /* Description. */
6971 if (p->desc)
6972 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
6973
6974 /* Peer-group */
6975 if (p->group)
6976 vty_out (vty, " Member of peer-group %s for session parameters%s",
6977 p->group->name, VTY_NEWLINE);
6978
6979 /* Administrative shutdown. */
6980 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
6981 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
6982
6983 /* BGP Version. */
6984 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00006985 vty_out (vty, ", remote router ID %s%s",
6986 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
6987 VTY_NEWLINE);
6988
6989 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00006990 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
6991 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00006992 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
6993
6994 /* Status. */
6995 vty_out (vty, " BGP state = %s",
6996 LOOKUP (bgp_status_msg, p->status));
6997 if (p->status == Established)
6998 vty_out (vty, ", up for %8s",
6999 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00007000 else if (p->status == Active)
7001 {
7002 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7003 vty_out (vty, " (passive)");
7004 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7005 vty_out (vty, " (NSF passive)");
7006 }
paul718e3742002-12-13 20:15:29 +00007007 vty_out (vty, "%s", VTY_NEWLINE);
7008
7009 /* read timer */
7010 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7011
7012 /* Configured timer values. */
7013 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7014 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7015 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7016 {
7017 vty_out (vty, " Configured hold time is %d", p->holdtime);
7018 vty_out (vty, ", keepalive interval is %d seconds%s",
7019 p->keepalive, VTY_NEWLINE);
7020 }
hasso93406d82005-02-02 14:40:33 +00007021
paul718e3742002-12-13 20:15:29 +00007022 /* Capability. */
7023 if (p->status == Established)
7024 {
hasso538621f2004-05-21 09:31:30 +00007025 if (p->cap
paul718e3742002-12-13 20:15:29 +00007026 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7027 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7028 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7029 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7030#ifdef HAVE_IPV6
7031 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7032 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7033 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7034 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
7035#endif /* HAVE_IPV6 */
7036 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7037 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7038 {
7039 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7040
7041 /* Dynamic */
7042 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
7043 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7044 {
7045 vty_out (vty, " Dynamic:");
7046 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7047 vty_out (vty, " advertised");
7048 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00007049 vty_out (vty, " %sreceived",
7050 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007051 vty_out (vty, "%s", VTY_NEWLINE);
7052 }
7053
7054 /* Route Refresh */
7055 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
7056 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7057 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
7058 {
7059 vty_out (vty, " Route refresh:");
7060 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
7061 vty_out (vty, " advertised");
7062 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7063 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00007064 vty_out (vty, " %sreceived(%s)",
7065 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
7066 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
7067 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
7068 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
7069
paul718e3742002-12-13 20:15:29 +00007070 vty_out (vty, "%s", VTY_NEWLINE);
7071 }
7072
hasso538621f2004-05-21 09:31:30 +00007073 /* Multiprotocol Extensions */
7074 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7075 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7076 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00007077 {
hasso538621f2004-05-21 09:31:30 +00007078 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
7079 if (p->afc_adv[afi][safi])
7080 vty_out (vty, " advertised");
7081 if (p->afc_recv[afi][safi])
7082 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
7083 vty_out (vty, "%s", VTY_NEWLINE);
7084 }
7085
7086 /* Gracefull Restart */
7087 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7088 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007089 {
hasso538621f2004-05-21 09:31:30 +00007090 vty_out (vty, " Graceful Restart Capabilty:");
7091 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007092 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00007093 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
7094 vty_out (vty, " %sreceived",
7095 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007096 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007097
7098 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00007099 {
hasso538621f2004-05-21 09:31:30 +00007100 int restart_af_count = 0;
7101
7102 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00007103 p->v_gr_restart, VTY_NEWLINE);
7104 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007105
7106 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7107 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7108 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
7109 {
hasso93406d82005-02-02 14:40:33 +00007110 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
7111 afi_safi_print (afi, safi),
7112 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
7113 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00007114 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00007115 }
hasso538621f2004-05-21 09:31:30 +00007116 if (! restart_af_count)
7117 vty_out (vty, "none");
7118 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007119 }
paul718e3742002-12-13 20:15:29 +00007120 }
paul718e3742002-12-13 20:15:29 +00007121 }
7122 }
7123
hasso93406d82005-02-02 14:40:33 +00007124 /* graceful restart information */
7125 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7126 || p->t_gr_restart
7127 || p->t_gr_stale)
7128 {
7129 int eor_send_af_count = 0;
7130 int eor_receive_af_count = 0;
7131
7132 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
7133 if (p->status == Established)
7134 {
7135 vty_out (vty, " End-of-RIB send: ");
7136 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7137 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7138 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
7139 {
7140 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
7141 afi_safi_print (afi, safi));
7142 eor_send_af_count++;
7143 }
7144 vty_out (vty, "%s", VTY_NEWLINE);
7145
7146 vty_out (vty, " End-of-RIB received: ");
7147 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7148 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7149 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
7150 {
7151 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
7152 afi_safi_print (afi, safi));
7153 eor_receive_af_count++;
7154 }
7155 vty_out (vty, "%s", VTY_NEWLINE);
7156 }
7157
7158 if (p->t_gr_restart)
7159 {
7160 vty_out (vty, " The remaining time of restart timer is %ld%s",
7161 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
7162 }
7163 if (p->t_gr_stale)
7164 {
7165 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
7166 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
7167 }
7168 }
7169
paul718e3742002-12-13 20:15:29 +00007170 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00007171 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
7172 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
7173 vty_out (vty, " Outq depth is %ld%s", p->obuf->count, VTY_NEWLINE);
7174 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
7175 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
7176 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
7177 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
7178 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
7179 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
7180 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
7181 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
7182 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
7183 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
7184 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007185
7186 /* advertisement-interval */
7187 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
7188 p->v_routeadv, VTY_NEWLINE);
7189
7190 /* Update-source. */
7191 if (p->update_if || p->update_source)
7192 {
7193 vty_out (vty, " Update source is ");
7194 if (p->update_if)
7195 vty_out (vty, "%s", p->update_if);
7196 else if (p->update_source)
7197 vty_out (vty, "%s",
7198 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
7199 vty_out (vty, "%s", VTY_NEWLINE);
7200 }
7201
7202 /* Default weight */
7203 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
7204 vty_out (vty, " Default weight %d%s", p->weight,
7205 VTY_NEWLINE);
7206
7207 vty_out (vty, "%s", VTY_NEWLINE);
7208
7209 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00007210 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7211 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7212 if (p->afc[afi][safi])
7213 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00007214
7215 vty_out (vty, " Connections established %d; dropped %d%s",
7216 p->established, p->dropped,
7217 VTY_NEWLINE);
7218
hassoe0701b72004-05-20 09:19:34 +00007219 if (! p->dropped)
7220 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
7221 else
7222 vty_out (vty, " Last reset %s, due to %s%s",
7223 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
7224 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00007225
paul718e3742002-12-13 20:15:29 +00007226 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7227 {
7228 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00007229
7230 if (p->t_pmax_restart)
7231 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
7232 p->host, thread_timer_remain_second (p->t_pmax_restart),
7233 VTY_NEWLINE);
7234 else
7235 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
7236 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007237 }
7238
7239 /* EBGP Multihop */
7240 if (peer_sort (p) != BGP_PEER_IBGP && p->ttl > 1)
7241 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7242 p->ttl, VTY_NEWLINE);
7243
7244 /* Local address. */
7245 if (p->su_local)
7246 {
hasso93406d82005-02-02 14:40:33 +00007247 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00007248 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
7249 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00007250 VTY_NEWLINE);
7251 }
7252
7253 /* Remote address. */
7254 if (p->su_remote)
7255 {
7256 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
7257 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
7258 ntohs (p->su_remote->sin.sin_port),
7259 VTY_NEWLINE);
7260 }
7261
7262 /* Nexthop display. */
7263 if (p->su_local)
7264 {
7265 vty_out (vty, "Nexthop: %s%s",
7266 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
7267 VTY_NEWLINE);
7268#ifdef HAVE_IPV6
7269 vty_out (vty, "Nexthop global: %s%s",
7270 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
7271 VTY_NEWLINE);
7272 vty_out (vty, "Nexthop local: %s%s",
7273 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
7274 VTY_NEWLINE);
7275 vty_out (vty, "BGP connection: %s%s",
7276 p->shared_network ? "shared network" : "non shared network",
7277 VTY_NEWLINE);
7278#endif /* HAVE_IPV6 */
7279 }
7280
7281 /* Timer information. */
7282 if (p->t_start)
7283 vty_out (vty, "Next start timer due in %ld seconds%s",
7284 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
7285 if (p->t_connect)
7286 vty_out (vty, "Next connect timer due in %ld seconds%s",
7287 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
7288
7289 vty_out (vty, "Read thread: %s Write thread: %s%s",
7290 p->t_read ? "on" : "off",
7291 p->t_write ? "on" : "off",
7292 VTY_NEWLINE);
7293
7294 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
7295 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
7296 bgp_capability_vty_out (vty, p);
7297
7298 vty_out (vty, "%s", VTY_NEWLINE);
7299}
7300
7301int
7302bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
7303 enum show_type type, union sockunion *su)
7304{
7305 struct listnode *nn;
7306 struct peer *peer;
7307 int find = 0;
7308
7309 LIST_LOOP (bgp->peer, peer, nn)
7310 {
7311 switch (type)
7312 {
7313 case show_all:
7314 bgp_show_peer (vty, peer);
7315 break;
7316 case show_peer:
7317 if (sockunion_same (&peer->su, su))
7318 {
7319 find = 1;
7320 bgp_show_peer (vty, peer);
7321 }
7322 break;
7323 }
7324 }
7325
7326 if (type == show_peer && ! find)
7327 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
7328
7329 return CMD_SUCCESS;
7330}
7331
7332int
paulfd79ac92004-10-13 05:06:08 +00007333bgp_show_neighbor_vty (struct vty *vty, const char *name,
7334 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00007335{
7336 int ret;
7337 struct bgp *bgp;
7338 union sockunion su;
7339
7340 if (ip_str)
7341 {
7342 ret = str2sockunion (ip_str, &su);
7343 if (ret < 0)
7344 {
7345 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
7346 return CMD_WARNING;
7347 }
7348 }
7349
7350 if (name)
7351 {
7352 bgp = bgp_lookup_by_name (name);
7353
7354 if (! bgp)
7355 {
7356 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7357 return CMD_WARNING;
7358 }
7359
7360 bgp_show_neighbor (vty, bgp, type, &su);
7361
7362 return CMD_SUCCESS;
7363 }
7364
7365 bgp = bgp_get_default ();
7366
7367 if (bgp)
7368 bgp_show_neighbor (vty, bgp, type, &su);
7369
7370 return CMD_SUCCESS;
7371}
7372
7373/* "show ip bgp neighbors" commands. */
7374DEFUN (show_ip_bgp_neighbors,
7375 show_ip_bgp_neighbors_cmd,
7376 "show ip bgp neighbors",
7377 SHOW_STR
7378 IP_STR
7379 BGP_STR
7380 "Detailed information on TCP and BGP neighbor connections\n")
7381{
7382 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
7383}
7384
7385ALIAS (show_ip_bgp_neighbors,
7386 show_ip_bgp_ipv4_neighbors_cmd,
7387 "show ip bgp ipv4 (unicast|multicast) neighbors",
7388 SHOW_STR
7389 IP_STR
7390 BGP_STR
7391 "Address family\n"
7392 "Address Family modifier\n"
7393 "Address Family modifier\n"
7394 "Detailed information on TCP and BGP neighbor connections\n")
7395
7396ALIAS (show_ip_bgp_neighbors,
7397 show_ip_bgp_vpnv4_all_neighbors_cmd,
7398 "show ip bgp vpnv4 all neighbors",
7399 SHOW_STR
7400 IP_STR
7401 BGP_STR
7402 "Display VPNv4 NLRI specific information\n"
7403 "Display information about all VPNv4 NLRIs\n"
7404 "Detailed information on TCP and BGP neighbor connections\n")
7405
7406ALIAS (show_ip_bgp_neighbors,
7407 show_ip_bgp_vpnv4_rd_neighbors_cmd,
7408 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
7409 SHOW_STR
7410 IP_STR
7411 BGP_STR
7412 "Display VPNv4 NLRI specific information\n"
7413 "Display information for a route distinguisher\n"
7414 "VPN Route Distinguisher\n"
7415 "Detailed information on TCP and BGP neighbor connections\n")
7416
7417ALIAS (show_ip_bgp_neighbors,
7418 show_bgp_neighbors_cmd,
7419 "show bgp neighbors",
7420 SHOW_STR
7421 BGP_STR
7422 "Detailed information on TCP and BGP neighbor connections\n")
7423
7424ALIAS (show_ip_bgp_neighbors,
7425 show_bgp_ipv6_neighbors_cmd,
7426 "show bgp ipv6 neighbors",
7427 SHOW_STR
7428 BGP_STR
7429 "Address family\n"
7430 "Detailed information on TCP and BGP neighbor connections\n")
7431
7432DEFUN (show_ip_bgp_neighbors_peer,
7433 show_ip_bgp_neighbors_peer_cmd,
7434 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
7435 SHOW_STR
7436 IP_STR
7437 BGP_STR
7438 "Detailed information on TCP and BGP neighbor connections\n"
7439 "Neighbor to display information about\n"
7440 "Neighbor to display information about\n")
7441{
7442 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
7443}
7444
7445ALIAS (show_ip_bgp_neighbors_peer,
7446 show_ip_bgp_ipv4_neighbors_peer_cmd,
7447 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
7448 SHOW_STR
7449 IP_STR
7450 BGP_STR
7451 "Address family\n"
7452 "Address Family modifier\n"
7453 "Address Family modifier\n"
7454 "Detailed information on TCP and BGP neighbor connections\n"
7455 "Neighbor to display information about\n"
7456 "Neighbor to display information about\n")
7457
7458ALIAS (show_ip_bgp_neighbors_peer,
7459 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
7460 "show ip bgp vpnv4 all neighbors A.B.C.D",
7461 SHOW_STR
7462 IP_STR
7463 BGP_STR
7464 "Display VPNv4 NLRI specific information\n"
7465 "Display information about all VPNv4 NLRIs\n"
7466 "Detailed information on TCP and BGP neighbor connections\n"
7467 "Neighbor to display information about\n")
7468
7469ALIAS (show_ip_bgp_neighbors_peer,
7470 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
7471 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
7472 SHOW_STR
7473 IP_STR
7474 BGP_STR
7475 "Display VPNv4 NLRI specific information\n"
7476 "Display information about all VPNv4 NLRIs\n"
7477 "Detailed information on TCP and BGP neighbor connections\n"
7478 "Neighbor to display information about\n")
7479
7480ALIAS (show_ip_bgp_neighbors_peer,
7481 show_bgp_neighbors_peer_cmd,
7482 "show bgp neighbors (A.B.C.D|X:X::X:X)",
7483 SHOW_STR
7484 BGP_STR
7485 "Detailed information on TCP and BGP neighbor connections\n"
7486 "Neighbor to display information about\n"
7487 "Neighbor to display information about\n")
7488
7489ALIAS (show_ip_bgp_neighbors_peer,
7490 show_bgp_ipv6_neighbors_peer_cmd,
7491 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
7492 SHOW_STR
7493 BGP_STR
7494 "Address family\n"
7495 "Detailed information on TCP and BGP neighbor connections\n"
7496 "Neighbor to display information about\n"
7497 "Neighbor to display information about\n")
7498
7499DEFUN (show_ip_bgp_instance_neighbors,
7500 show_ip_bgp_instance_neighbors_cmd,
7501 "show ip bgp view WORD neighbors",
7502 SHOW_STR
7503 IP_STR
7504 BGP_STR
7505 "BGP view\n"
7506 "View name\n"
7507 "Detailed information on TCP and BGP neighbor connections\n")
7508{
7509 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
7510}
7511
paulbb46e942003-10-24 19:02:03 +00007512ALIAS (show_ip_bgp_instance_neighbors,
7513 show_bgp_instance_neighbors_cmd,
7514 "show bgp view WORD neighbors",
7515 SHOW_STR
7516 BGP_STR
7517 "BGP view\n"
7518 "View name\n"
7519 "Detailed information on TCP and BGP neighbor connections\n")
7520
7521ALIAS (show_ip_bgp_instance_neighbors,
7522 show_bgp_instance_ipv6_neighbors_cmd,
7523 "show bgp view WORD ipv6 neighbors",
7524 SHOW_STR
7525 BGP_STR
7526 "BGP view\n"
7527 "View name\n"
7528 "Address family\n"
7529 "Detailed information on TCP and BGP neighbor connections\n")
7530
paul718e3742002-12-13 20:15:29 +00007531DEFUN (show_ip_bgp_instance_neighbors_peer,
7532 show_ip_bgp_instance_neighbors_peer_cmd,
7533 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
7534 SHOW_STR
7535 IP_STR
7536 BGP_STR
7537 "BGP view\n"
7538 "View name\n"
7539 "Detailed information on TCP and BGP neighbor connections\n"
7540 "Neighbor to display information about\n"
7541 "Neighbor to display information about\n")
7542{
7543 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
7544}
paulbb46e942003-10-24 19:02:03 +00007545
7546ALIAS (show_ip_bgp_instance_neighbors_peer,
7547 show_bgp_instance_neighbors_peer_cmd,
7548 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
7549 SHOW_STR
7550 BGP_STR
7551 "BGP view\n"
7552 "View name\n"
7553 "Detailed information on TCP and BGP neighbor connections\n"
7554 "Neighbor to display information about\n"
7555 "Neighbor to display information about\n")
7556
7557ALIAS (show_ip_bgp_instance_neighbors_peer,
7558 show_bgp_instance_ipv6_neighbors_peer_cmd,
7559 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
7560 SHOW_STR
7561 BGP_STR
7562 "BGP view\n"
7563 "View name\n"
7564 "Address family\n"
7565 "Detailed information on TCP and BGP neighbor connections\n"
7566 "Neighbor to display information about\n"
7567 "Neighbor to display information about\n")
7568
paul718e3742002-12-13 20:15:29 +00007569/* Show BGP's AS paths internal data. There are both `show ip bgp
7570 paths' and `show ip mbgp paths'. Those functions results are the
7571 same.*/
7572DEFUN (show_ip_bgp_paths,
7573 show_ip_bgp_paths_cmd,
7574 "show ip bgp paths",
7575 SHOW_STR
7576 IP_STR
7577 BGP_STR
7578 "Path information\n")
7579{
7580 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
7581 aspath_print_all_vty (vty);
7582 return CMD_SUCCESS;
7583}
7584
7585DEFUN (show_ip_bgp_ipv4_paths,
7586 show_ip_bgp_ipv4_paths_cmd,
7587 "show ip bgp ipv4 (unicast|multicast) paths",
7588 SHOW_STR
7589 IP_STR
7590 BGP_STR
7591 "Address family\n"
7592 "Address Family modifier\n"
7593 "Address Family modifier\n"
7594 "Path information\n")
7595{
7596 vty_out (vty, "Address Refcnt Path\r\n");
7597 aspath_print_all_vty (vty);
7598
7599 return CMD_SUCCESS;
7600}
7601
7602#include "hash.h"
7603
7604void
7605community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
7606{
7607 struct community *com;
7608
7609 com = (struct community *) backet->data;
7610 vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt,
7611 community_str (com), VTY_NEWLINE);
7612}
7613
7614/* Show BGP's community internal data. */
7615DEFUN (show_ip_bgp_community_info,
7616 show_ip_bgp_community_info_cmd,
7617 "show ip bgp community-info",
7618 SHOW_STR
7619 IP_STR
7620 BGP_STR
7621 "List all bgp community information\n")
7622{
7623 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
7624
7625 hash_iterate (community_hash (),
7626 (void (*) (struct hash_backet *, void *))
7627 community_show_all_iterator,
7628 vty);
7629
7630 return CMD_SUCCESS;
7631}
7632
7633DEFUN (show_ip_bgp_attr_info,
7634 show_ip_bgp_attr_info_cmd,
7635 "show ip bgp attribute-info",
7636 SHOW_STR
7637 IP_STR
7638 BGP_STR
7639 "List all bgp attribute information\n")
7640{
7641 attr_show_all (vty);
7642 return CMD_SUCCESS;
7643}
7644
paulfee0f4c2004-09-13 05:12:46 +00007645int
7646bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
7647 afi_t afi, safi_t safi)
7648{
7649 char timebuf[BGP_UPTIME_LEN];
7650 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00007651 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00007652 struct peer *peer;
7653 struct listnode *nn;
7654 int len;
7655 int count = 0;
7656
7657 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
7658 {
7659 LIST_LOOP (rsclient->group->peer, peer, nn)
7660 {
7661 count++;
7662 bgp_write_rsclient_summary (vty, peer, afi, safi);
7663 }
7664 return count;
7665 }
7666
7667 len = vty_out (vty, "%s", rsclient->host);
7668 len = 16 - len;
7669
7670 if (len < 1)
7671 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7672 else
7673 vty_out (vty, "%*s", len, " ");
7674
hasso3d515fd2005-02-01 21:30:04 +00007675 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00007676
7677 vty_out (vty, "%5d ", rsclient->as);
7678
7679 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
7680 if ( rmname && strlen (rmname) > 13 )
7681 {
7682 sprintf (rmbuf, "%13s", "...");
7683 rmname = strncpy (rmbuf, rmname, 10);
7684 }
7685 else if (! rmname)
7686 rmname = "<none>";
7687 vty_out (vty, " %13s ", rmname);
7688
7689 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
7690 if ( rmname && strlen (rmname) > 13 )
7691 {
7692 sprintf (rmbuf, "%13s", "...");
7693 rmname = strncpy (rmbuf, rmname, 10);
7694 }
7695 else if (! rmname)
7696 rmname = "<none>";
7697 vty_out (vty, " %13s ", rmname);
7698
7699 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
7700
7701 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
7702 vty_out (vty, " Idle (Admin)");
7703 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7704 vty_out (vty, " Idle (PfxCt)");
7705 else
7706 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
7707
7708 vty_out (vty, "%s", VTY_NEWLINE);
7709
7710 return 1;
7711}
7712
7713int
paulfd79ac92004-10-13 05:06:08 +00007714bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
7715 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00007716{
7717 struct peer *peer;
7718 struct listnode *nn;
7719 int count = 0;
7720
7721 /* Header string for each address family. */
7722 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
7723
7724 LIST_LOOP (bgp->rsclient, peer, nn)
7725 {
7726 if (peer->afc[afi][safi] &&
7727 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7728 {
7729 if (! count)
7730 {
7731 vty_out (vty,
7732 "Route Server's BGP router identifier %s%s",
7733 inet_ntoa (bgp->router_id), VTY_NEWLINE);
7734 vty_out (vty,
7735 "Route Server's local AS number %d%s", bgp->as,
7736 VTY_NEWLINE);
7737
7738 vty_out (vty, "%s", VTY_NEWLINE);
7739 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7740 }
7741
7742 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
7743 }
7744 }
7745
7746 if (count)
7747 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
7748 count, VTY_NEWLINE);
7749 else
7750 vty_out (vty, "No %s Route Server Client is configured%s",
7751 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7752
7753 return CMD_SUCCESS;
7754}
7755
7756int
paulfd79ac92004-10-13 05:06:08 +00007757bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
7758 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00007759{
7760 struct bgp *bgp;
7761
7762 if (name)
7763 {
7764 bgp = bgp_lookup_by_name (name);
7765
7766 if (! bgp)
7767 {
7768 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7769 return CMD_WARNING;
7770 }
7771
7772 bgp_show_rsclient_summary (vty, bgp, afi, safi);
7773 return CMD_SUCCESS;
7774 }
7775
7776 bgp = bgp_get_default ();
7777
7778 if (bgp)
7779 bgp_show_rsclient_summary (vty, bgp, afi, safi);
7780
7781 return CMD_SUCCESS;
7782}
7783
7784/* 'show bgp rsclient' commands. */
7785DEFUN (show_ip_bgp_rsclient_summary,
7786 show_ip_bgp_rsclient_summary_cmd,
7787 "show ip bgp rsclient summary",
7788 SHOW_STR
7789 IP_STR
7790 BGP_STR
7791 "Information about Route Server Clients\n"
7792 "Summary of all Route Server Clients\n")
7793{
7794 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7795}
7796
7797DEFUN (show_ip_bgp_instance_rsclient_summary,
7798 show_ip_bgp_instance_rsclient_summary_cmd,
7799 "show ip bgp view WORD rsclient summary",
7800 SHOW_STR
7801 IP_STR
7802 BGP_STR
7803 "BGP view\n"
7804 "View name\n"
7805 "Information about Route Server Clients\n"
7806 "Summary of all Route Server Clients\n")
7807{
7808 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7809}
7810
7811DEFUN (show_ip_bgp_ipv4_rsclient_summary,
7812 show_ip_bgp_ipv4_rsclient_summary_cmd,
7813 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
7814 SHOW_STR
7815 IP_STR
7816 BGP_STR
7817 "Address family\n"
7818 "Address Family modifier\n"
7819 "Address Family modifier\n"
7820 "Information about Route Server Clients\n"
7821 "Summary of all Route Server Clients\n")
7822{
7823 if (strncmp (argv[0], "m", 1) == 0)
7824 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7825
7826 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7827}
7828
7829DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
7830 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
7831 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
7832 SHOW_STR
7833 IP_STR
7834 BGP_STR
7835 "BGP view\n"
7836 "View name\n"
7837 "Address family\n"
7838 "Address Family modifier\n"
7839 "Address Family modifier\n"
7840 "Information about Route Server Clients\n"
7841 "Summary of all Route Server Clients\n")
7842{
7843 if (strncmp (argv[1], "m", 1) == 0)
7844 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7845
7846 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7847}
7848
7849#ifdef HAVE_IPV6
7850DEFUN (show_bgp_rsclient_summary,
7851 show_bgp_rsclient_summary_cmd,
7852 "show bgp rsclient summary",
7853 SHOW_STR
7854 BGP_STR
7855 "Information about Route Server Clients\n"
7856 "Summary of all Route Server Clients\n")
7857{
7858 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7859}
7860
7861DEFUN (show_bgp_instance_rsclient_summary,
7862 show_bgp_instance_rsclient_summary_cmd,
7863 "show bgp view WORD rsclient summary",
7864 SHOW_STR
7865 BGP_STR
7866 "BGP view\n"
7867 "View name\n"
7868 "Information about Route Server Clients\n"
7869 "Summary of all Route Server Clients\n")
7870{
7871 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7872}
7873
7874ALIAS (show_bgp_rsclient_summary,
7875 show_bgp_ipv6_rsclient_summary_cmd,
7876 "show bgp ipv6 rsclient summary",
7877 SHOW_STR
7878 BGP_STR
7879 "Address family\n"
7880 "Information about Route Server Clients\n"
7881 "Summary of all Route Server Clients\n")
7882
7883ALIAS (show_bgp_instance_rsclient_summary,
7884 show_bgp_instance_ipv6_rsclient_summary_cmd,
7885 "show bgp view WORD ipv6 rsclient summary",
7886 SHOW_STR
7887 BGP_STR
7888 "BGP view\n"
7889 "View name\n"
7890 "Address family\n"
7891 "Information about Route Server Clients\n"
7892 "Summary of all Route Server Clients\n")
7893#endif /* HAVE IPV6 */
7894
paul718e3742002-12-13 20:15:29 +00007895/* Redistribute VTY commands. */
7896
7897/* Utility function to convert user input route type string to route
7898 type. */
7899static int
paulfd79ac92004-10-13 05:06:08 +00007900bgp_str2route_type (int afi, const char *str)
paul718e3742002-12-13 20:15:29 +00007901{
7902 if (! str)
7903 return 0;
7904
7905 if (afi == AFI_IP)
7906 {
7907 if (strncmp (str, "k", 1) == 0)
7908 return ZEBRA_ROUTE_KERNEL;
7909 else if (strncmp (str, "c", 1) == 0)
7910 return ZEBRA_ROUTE_CONNECT;
7911 else if (strncmp (str, "s", 1) == 0)
7912 return ZEBRA_ROUTE_STATIC;
7913 else if (strncmp (str, "r", 1) == 0)
7914 return ZEBRA_ROUTE_RIP;
7915 else if (strncmp (str, "o", 1) == 0)
7916 return ZEBRA_ROUTE_OSPF;
7917 }
7918 if (afi == AFI_IP6)
7919 {
7920 if (strncmp (str, "k", 1) == 0)
7921 return ZEBRA_ROUTE_KERNEL;
7922 else if (strncmp (str, "c", 1) == 0)
7923 return ZEBRA_ROUTE_CONNECT;
7924 else if (strncmp (str, "s", 1) == 0)
7925 return ZEBRA_ROUTE_STATIC;
7926 else if (strncmp (str, "r", 1) == 0)
7927 return ZEBRA_ROUTE_RIPNG;
7928 else if (strncmp (str, "o", 1) == 0)
7929 return ZEBRA_ROUTE_OSPF6;
7930 }
7931 return 0;
7932}
7933
7934DEFUN (bgp_redistribute_ipv4,
7935 bgp_redistribute_ipv4_cmd,
7936 "redistribute (connected|kernel|ospf|rip|static)",
7937 "Redistribute information from another routing protocol\n"
7938 "Connected\n"
7939 "Kernel routes\n"
7940 "Open Shurtest Path First (OSPF)\n"
7941 "Routing Information Protocol (RIP)\n"
7942 "Static routes\n")
7943{
7944 int type;
7945
7946 type = bgp_str2route_type (AFI_IP, argv[0]);
7947 if (! type)
7948 {
7949 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
7950 return CMD_WARNING;
7951 }
7952 return bgp_redistribute_set (vty->index, AFI_IP, type);
7953}
7954
7955DEFUN (bgp_redistribute_ipv4_rmap,
7956 bgp_redistribute_ipv4_rmap_cmd,
7957 "redistribute (connected|kernel|ospf|rip|static) route-map WORD",
7958 "Redistribute information from another routing protocol\n"
7959 "Connected\n"
7960 "Kernel routes\n"
7961 "Open Shurtest Path First (OSPF)\n"
7962 "Routing Information Protocol (RIP)\n"
7963 "Static routes\n"
7964 "Route map reference\n"
7965 "Pointer to route-map entries\n")
7966{
7967 int type;
7968
7969 type = bgp_str2route_type (AFI_IP, argv[0]);
7970 if (! type)
7971 {
7972 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
7973 return CMD_WARNING;
7974 }
7975
7976 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
7977 return bgp_redistribute_set (vty->index, AFI_IP, type);
7978}
7979
7980DEFUN (bgp_redistribute_ipv4_metric,
7981 bgp_redistribute_ipv4_metric_cmd,
7982 "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
7983 "Redistribute information from another routing protocol\n"
7984 "Connected\n"
7985 "Kernel routes\n"
7986 "Open Shurtest Path First (OSPF)\n"
7987 "Routing Information Protocol (RIP)\n"
7988 "Static routes\n"
7989 "Metric for redistributed routes\n"
7990 "Default metric\n")
7991{
7992 int type;
7993 u_int32_t metric;
7994
7995 type = bgp_str2route_type (AFI_IP, argv[0]);
7996 if (! type)
7997 {
7998 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
7999 return CMD_WARNING;
8000 }
8001 VTY_GET_INTEGER ("metric", metric, argv[1]);
8002
8003 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8004 return bgp_redistribute_set (vty->index, AFI_IP, type);
8005}
8006
8007DEFUN (bgp_redistribute_ipv4_rmap_metric,
8008 bgp_redistribute_ipv4_rmap_metric_cmd,
8009 "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
8010 "Redistribute information from another routing protocol\n"
8011 "Connected\n"
8012 "Kernel routes\n"
8013 "Open Shurtest Path First (OSPF)\n"
8014 "Routing Information Protocol (RIP)\n"
8015 "Static routes\n"
8016 "Route map reference\n"
8017 "Pointer to route-map entries\n"
8018 "Metric for redistributed routes\n"
8019 "Default metric\n")
8020{
8021 int type;
8022 u_int32_t metric;
8023
8024 type = bgp_str2route_type (AFI_IP, argv[0]);
8025 if (! type)
8026 {
8027 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8028 return CMD_WARNING;
8029 }
8030 VTY_GET_INTEGER ("metric", metric, argv[2]);
8031
8032 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8033 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8034 return bgp_redistribute_set (vty->index, AFI_IP, type);
8035}
8036
8037DEFUN (bgp_redistribute_ipv4_metric_rmap,
8038 bgp_redistribute_ipv4_metric_rmap_cmd,
8039 "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
8040 "Redistribute information from another routing protocol\n"
8041 "Connected\n"
8042 "Kernel routes\n"
8043 "Open Shurtest Path First (OSPF)\n"
8044 "Routing Information Protocol (RIP)\n"
8045 "Static routes\n"
8046 "Metric for redistributed routes\n"
8047 "Default metric\n"
8048 "Route map reference\n"
8049 "Pointer to route-map entries\n")
8050{
8051 int type;
8052 u_int32_t metric;
8053
8054 type = bgp_str2route_type (AFI_IP, argv[0]);
8055 if (! type)
8056 {
8057 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8058 return CMD_WARNING;
8059 }
8060 VTY_GET_INTEGER ("metric", metric, argv[1]);
8061
8062 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8063 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
8064 return bgp_redistribute_set (vty->index, AFI_IP, type);
8065}
8066
8067DEFUN (no_bgp_redistribute_ipv4,
8068 no_bgp_redistribute_ipv4_cmd,
8069 "no redistribute (connected|kernel|ospf|rip|static)",
8070 NO_STR
8071 "Redistribute information from another routing protocol\n"
8072 "Connected\n"
8073 "Kernel routes\n"
8074 "Open Shurtest Path First (OSPF)\n"
8075 "Routing Information Protocol (RIP)\n"
8076 "Static routes\n")
8077{
8078 int type;
8079
8080 type = bgp_str2route_type (AFI_IP, argv[0]);
8081 if (! type)
8082 {
8083 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8084 return CMD_WARNING;
8085 }
8086
8087 return bgp_redistribute_unset (vty->index, AFI_IP, type);
8088}
8089
8090DEFUN (no_bgp_redistribute_ipv4_rmap,
8091 no_bgp_redistribute_ipv4_rmap_cmd,
8092 "no redistribute (connected|kernel|ospf|rip|static) route-map WORD",
8093 NO_STR
8094 "Redistribute information from another routing protocol\n"
8095 "Connected\n"
8096 "Kernel routes\n"
8097 "Open Shurtest Path First (OSPF)\n"
8098 "Routing Information Protocol (RIP)\n"
8099 "Static routes\n"
8100 "Route map reference\n"
8101 "Pointer to route-map entries\n")
8102{
8103 int type;
8104
8105 type = bgp_str2route_type (AFI_IP, argv[0]);
8106 if (! type)
8107 {
8108 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8109 return CMD_WARNING;
8110 }
8111
8112 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8113 return CMD_SUCCESS;
8114}
8115
8116DEFUN (no_bgp_redistribute_ipv4_metric,
8117 no_bgp_redistribute_ipv4_metric_cmd,
8118 "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
8119 NO_STR
8120 "Redistribute information from another routing protocol\n"
8121 "Connected\n"
8122 "Kernel routes\n"
8123 "Open Shurtest Path First (OSPF)\n"
8124 "Routing Information Protocol (RIP)\n"
8125 "Static routes\n"
8126 "Metric for redistributed routes\n"
8127 "Default metric\n")
8128{
8129 int type;
8130
8131 type = bgp_str2route_type (AFI_IP, argv[0]);
8132 if (! type)
8133 {
8134 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8135 return CMD_WARNING;
8136 }
8137
8138 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8139 return CMD_SUCCESS;
8140}
8141
8142DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
8143 no_bgp_redistribute_ipv4_rmap_metric_cmd,
8144 "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
8145 NO_STR
8146 "Redistribute information from another routing protocol\n"
8147 "Connected\n"
8148 "Kernel routes\n"
8149 "Open Shurtest Path First (OSPF)\n"
8150 "Routing Information Protocol (RIP)\n"
8151 "Static routes\n"
8152 "Route map reference\n"
8153 "Pointer to route-map entries\n"
8154 "Metric for redistributed routes\n"
8155 "Default metric\n")
8156{
8157 int type;
8158
8159 type = bgp_str2route_type (AFI_IP, argv[0]);
8160 if (! type)
8161 {
8162 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8163 return CMD_WARNING;
8164 }
8165
8166 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8167 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8168 return CMD_SUCCESS;
8169}
8170
8171ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
8172 no_bgp_redistribute_ipv4_metric_rmap_cmd,
8173 "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
8174 NO_STR
8175 "Redistribute information from another routing protocol\n"
8176 "Connected\n"
8177 "Kernel routes\n"
8178 "Open Shurtest Path First (OSPF)\n"
8179 "Routing Information Protocol (RIP)\n"
8180 "Static routes\n"
8181 "Metric for redistributed routes\n"
8182 "Default metric\n"
8183 "Route map reference\n"
8184 "Pointer to route-map entries\n")
8185
8186#ifdef HAVE_IPV6
8187DEFUN (bgp_redistribute_ipv6,
8188 bgp_redistribute_ipv6_cmd,
8189 "redistribute (connected|kernel|ospf6|ripng|static)",
8190 "Redistribute information from another routing protocol\n"
8191 "Connected\n"
8192 "Kernel routes\n"
8193 "Open Shurtest Path First (OSPFv3)\n"
8194 "Routing Information Protocol (RIPng)\n"
8195 "Static routes\n")
8196{
8197 int type;
8198
8199 type = bgp_str2route_type (AFI_IP6, argv[0]);
8200 if (! type)
8201 {
8202 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8203 return CMD_WARNING;
8204 }
8205
8206 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8207}
8208
8209DEFUN (bgp_redistribute_ipv6_rmap,
8210 bgp_redistribute_ipv6_rmap_cmd,
8211 "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
8212 "Redistribute information from another routing protocol\n"
8213 "Connected\n"
8214 "Kernel routes\n"
8215 "Open Shurtest Path First (OSPFv3)\n"
8216 "Routing Information Protocol (RIPng)\n"
8217 "Static routes\n"
8218 "Route map reference\n"
8219 "Pointer to route-map entries\n")
8220{
8221 int type;
8222
8223 type = bgp_str2route_type (AFI_IP6, argv[0]);
8224 if (! type)
8225 {
8226 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8227 return CMD_WARNING;
8228 }
8229
8230 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8231 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8232}
8233
8234DEFUN (bgp_redistribute_ipv6_metric,
8235 bgp_redistribute_ipv6_metric_cmd,
8236 "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
8237 "Redistribute information from another routing protocol\n"
8238 "Connected\n"
8239 "Kernel routes\n"
8240 "Open Shurtest Path First (OSPFv3)\n"
8241 "Routing Information Protocol (RIPng)\n"
8242 "Static routes\n"
8243 "Metric for redistributed routes\n"
8244 "Default metric\n")
8245{
8246 int type;
8247 u_int32_t metric;
8248
8249 type = bgp_str2route_type (AFI_IP6, argv[0]);
8250 if (! type)
8251 {
8252 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8253 return CMD_WARNING;
8254 }
8255 VTY_GET_INTEGER ("metric", metric, argv[1]);
8256
8257 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8258 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8259}
8260
8261DEFUN (bgp_redistribute_ipv6_rmap_metric,
8262 bgp_redistribute_ipv6_rmap_metric_cmd,
8263 "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
8264 "Redistribute information from another routing protocol\n"
8265 "Connected\n"
8266 "Kernel routes\n"
8267 "Open Shurtest Path First (OSPFv3)\n"
8268 "Routing Information Protocol (RIPng)\n"
8269 "Static routes\n"
8270 "Route map reference\n"
8271 "Pointer to route-map entries\n"
8272 "Metric for redistributed routes\n"
8273 "Default metric\n")
8274{
8275 int type;
8276 u_int32_t metric;
8277
8278 type = bgp_str2route_type (AFI_IP6, argv[0]);
8279 if (! type)
8280 {
8281 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8282 return CMD_WARNING;
8283 }
8284 VTY_GET_INTEGER ("metric", metric, argv[2]);
8285
8286 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8287 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8288 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8289}
8290
8291DEFUN (bgp_redistribute_ipv6_metric_rmap,
8292 bgp_redistribute_ipv6_metric_rmap_cmd,
8293 "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
8294 "Redistribute information from another routing protocol\n"
8295 "Connected\n"
8296 "Kernel routes\n"
8297 "Open Shurtest Path First (OSPFv3)\n"
8298 "Routing Information Protocol (RIPng)\n"
8299 "Static routes\n"
8300 "Metric for redistributed routes\n"
8301 "Default metric\n"
8302 "Route map reference\n"
8303 "Pointer to route-map entries\n")
8304{
8305 int type;
8306 u_int32_t metric;
8307
8308 type = bgp_str2route_type (AFI_IP6, argv[0]);
8309 if (! type)
8310 {
8311 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8312 return CMD_WARNING;
8313 }
8314 VTY_GET_INTEGER ("metric", metric, argv[1]);
8315
8316 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8317 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
8318 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8319}
8320
8321DEFUN (no_bgp_redistribute_ipv6,
8322 no_bgp_redistribute_ipv6_cmd,
8323 "no redistribute (connected|kernel|ospf6|ripng|static)",
8324 NO_STR
8325 "Redistribute information from another routing protocol\n"
8326 "Connected\n"
8327 "Kernel routes\n"
8328 "Open Shurtest Path First (OSPFv3)\n"
8329 "Routing Information Protocol (RIPng)\n"
8330 "Static routes\n")
8331{
8332 int type;
8333
8334 type = bgp_str2route_type (AFI_IP6, argv[0]);
8335 if (! type)
8336 {
8337 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8338 return CMD_WARNING;
8339 }
8340
8341 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
8342}
8343
8344DEFUN (no_bgp_redistribute_ipv6_rmap,
8345 no_bgp_redistribute_ipv6_rmap_cmd,
8346 "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
8347 NO_STR
8348 "Redistribute information from another routing protocol\n"
8349 "Connected\n"
8350 "Kernel routes\n"
8351 "Open Shurtest Path First (OSPFv3)\n"
8352 "Routing Information Protocol (RIPng)\n"
8353 "Static routes\n"
8354 "Route map reference\n"
8355 "Pointer to route-map entries\n")
8356{
8357 int type;
8358
8359 type = bgp_str2route_type (AFI_IP6, argv[0]);
8360 if (! type)
8361 {
8362 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8363 return CMD_WARNING;
8364 }
8365
8366 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8367 return CMD_SUCCESS;
8368}
8369
8370DEFUN (no_bgp_redistribute_ipv6_metric,
8371 no_bgp_redistribute_ipv6_metric_cmd,
8372 "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
8373 NO_STR
8374 "Redistribute information from another routing protocol\n"
8375 "Connected\n"
8376 "Kernel routes\n"
8377 "Open Shurtest Path First (OSPFv3)\n"
8378 "Routing Information Protocol (RIPng)\n"
8379 "Static routes\n"
8380 "Metric for redistributed routes\n"
8381 "Default metric\n")
8382{
8383 int type;
8384
8385 type = bgp_str2route_type (AFI_IP6, argv[0]);
8386 if (! type)
8387 {
8388 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8389 return CMD_WARNING;
8390 }
8391
8392 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8393 return CMD_SUCCESS;
8394}
8395
8396DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
8397 no_bgp_redistribute_ipv6_rmap_metric_cmd,
8398 "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
8399 NO_STR
8400 "Redistribute information from another routing protocol\n"
8401 "Connected\n"
8402 "Kernel routes\n"
8403 "Open Shurtest Path First (OSPFv3)\n"
8404 "Routing Information Protocol (RIPng)\n"
8405 "Static routes\n"
8406 "Route map reference\n"
8407 "Pointer to route-map entries\n"
8408 "Metric for redistributed routes\n"
8409 "Default metric\n")
8410{
8411 int type;
8412
8413 type = bgp_str2route_type (AFI_IP6, argv[0]);
8414 if (! type)
8415 {
8416 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8417 return CMD_WARNING;
8418 }
8419
8420 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8421 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8422 return CMD_SUCCESS;
8423}
8424
8425ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
8426 no_bgp_redistribute_ipv6_metric_rmap_cmd,
8427 "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
8428 NO_STR
8429 "Redistribute information from another routing protocol\n"
8430 "Connected\n"
8431 "Kernel routes\n"
8432 "Open Shurtest Path First (OSPFv3)\n"
8433 "Routing Information Protocol (RIPng)\n"
8434 "Static routes\n"
8435 "Metric for redistributed routes\n"
8436 "Default metric\n"
8437 "Route map reference\n"
8438 "Pointer to route-map entries\n")
8439#endif /* HAVE_IPV6 */
8440
8441int
8442bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
8443 safi_t safi, int *write)
8444{
8445 int i;
paulfd79ac92004-10-13 05:06:08 +00008446 const char *str[] = { "system", "kernel", "connected", "static", "rip",
hasso66e31692004-03-20 19:33:06 +00008447 "ripng", "ospf", "ospf6", "isis", "bgp"};
paul718e3742002-12-13 20:15:29 +00008448
8449 /* Unicast redistribution only. */
8450 if (safi != SAFI_UNICAST)
8451 return 0;
8452
8453 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
8454 {
8455 /* Redistribute BGP does not make sense. */
8456 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
8457 {
8458 /* Display "address-family" when it is not yet diplayed. */
8459 bgp_config_write_family_header (vty, afi, safi, write);
8460
8461 /* "redistribute" configuration. */
8462 vty_out (vty, " redistribute %s", str[i]);
8463
8464 if (bgp->redist_metric_flag[afi][i])
8465 vty_out (vty, " metric %d", bgp->redist_metric[afi][i]);
8466
8467 if (bgp->rmap[afi][i].name)
8468 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
8469
8470 vty_out (vty, "%s", VTY_NEWLINE);
8471 }
8472 }
8473 return *write;
8474}
8475
8476/* BGP node structure. */
8477struct cmd_node bgp_node =
8478{
8479 BGP_NODE,
8480 "%s(config-router)# ",
8481 1,
8482};
8483
8484struct cmd_node bgp_ipv4_unicast_node =
8485{
8486 BGP_IPV4_NODE,
8487 "%s(config-router-af)# ",
8488 1,
8489};
8490
8491struct cmd_node bgp_ipv4_multicast_node =
8492{
8493 BGP_IPV4M_NODE,
8494 "%s(config-router-af)# ",
8495 1,
8496};
8497
8498struct cmd_node bgp_ipv6_unicast_node =
8499{
8500 BGP_IPV6_NODE,
8501 "%s(config-router-af)# ",
8502 1,
8503};
8504
8505struct cmd_node bgp_vpnv4_node =
8506{
8507 BGP_VPNV4_NODE,
8508 "%s(config-router-af)# ",
8509 1
8510};
8511
8512void
8513bgp_vty_init ()
8514{
8515 int bgp_config_write (struct vty *);
8516 void community_list_vty ();
8517
8518 /* Install bgp top node. */
8519 install_node (&bgp_node, bgp_config_write);
8520 install_node (&bgp_ipv4_unicast_node, NULL);
8521 install_node (&bgp_ipv4_multicast_node, NULL);
8522 install_node (&bgp_ipv6_unicast_node, NULL);
8523 install_node (&bgp_vpnv4_node, NULL);
8524
8525 /* Install default VTY commands to new nodes. */
8526 install_default (BGP_NODE);
8527 install_default (BGP_IPV4_NODE);
8528 install_default (BGP_IPV4M_NODE);
8529 install_default (BGP_IPV6_NODE);
8530 install_default (BGP_VPNV4_NODE);
8531
8532 /* "bgp multiple-instance" commands. */
8533 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
8534 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
8535
8536 /* "bgp config-type" commands. */
8537 install_element (CONFIG_NODE, &bgp_config_type_cmd);
8538 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
8539
8540 /* Dummy commands (Currently not supported) */
8541 install_element (BGP_NODE, &no_synchronization_cmd);
8542 install_element (BGP_NODE, &no_auto_summary_cmd);
8543
8544 /* "router bgp" commands. */
8545 install_element (CONFIG_NODE, &router_bgp_cmd);
8546 install_element (CONFIG_NODE, &router_bgp_view_cmd);
8547
8548 /* "no router bgp" commands. */
8549 install_element (CONFIG_NODE, &no_router_bgp_cmd);
8550 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
8551
8552 /* "bgp router-id" commands. */
8553 install_element (BGP_NODE, &bgp_router_id_cmd);
8554 install_element (BGP_NODE, &no_bgp_router_id_cmd);
8555 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
8556
8557 /* "bgp cluster-id" commands. */
8558 install_element (BGP_NODE, &bgp_cluster_id_cmd);
8559 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
8560 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
8561 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
8562
8563 /* "bgp confederation" commands. */
8564 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
8565 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
8566 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
8567
8568 /* "bgp confederation peers" commands. */
8569 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
8570 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
8571
8572 /* "timers bgp" commands. */
8573 install_element (BGP_NODE, &bgp_timers_cmd);
8574 install_element (BGP_NODE, &no_bgp_timers_cmd);
8575 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
8576
8577 /* "bgp client-to-client reflection" commands */
8578 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
8579 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
8580
8581 /* "bgp always-compare-med" commands */
8582 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
8583 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
8584
8585 /* "bgp deterministic-med" commands */
8586 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
8587 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00008588
hasso538621f2004-05-21 09:31:30 +00008589 /* "bgp graceful-restart" commands */
8590 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
8591 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00008592 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
8593 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
8594 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00008595
8596 /* "bgp fast-external-failover" commands */
8597 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
8598 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
8599
8600 /* "bgp enforce-first-as" commands */
8601 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
8602 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
8603
8604 /* "bgp bestpath compare-routerid" commands */
8605 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
8606 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
8607
8608 /* "bgp bestpath as-path ignore" commands */
8609 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
8610 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
8611
paul848973c2003-08-13 00:32:49 +00008612 /* "bgp log-neighbor-changes" commands */
8613 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
8614 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
8615
paul718e3742002-12-13 20:15:29 +00008616 /* "bgp bestpath med" commands */
8617 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
8618 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
8619 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
8620 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
8621 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
8622 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
8623
8624 /* "no bgp default ipv4-unicast" commands. */
8625 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
8626 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
8627
8628 /* "bgp network import-check" commands. */
8629 install_element (BGP_NODE, &bgp_network_import_check_cmd);
8630 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
8631
8632 /* "bgp default local-preference" commands. */
8633 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
8634 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
8635 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
8636
8637 /* "neighbor remote-as" commands. */
8638 install_element (BGP_NODE, &neighbor_remote_as_cmd);
8639 install_element (BGP_NODE, &no_neighbor_cmd);
8640 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
8641
8642 /* "neighbor peer-group" commands. */
8643 install_element (BGP_NODE, &neighbor_peer_group_cmd);
8644 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
8645 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
8646
8647 /* "neighbor local-as" commands. */
8648 install_element (BGP_NODE, &neighbor_local_as_cmd);
8649 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
8650 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
8651 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
8652 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
8653
8654 /* "neighbor activate" commands. */
8655 install_element (BGP_NODE, &neighbor_activate_cmd);
8656 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
8657 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
8658 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
8659 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
8660
8661 /* "no neighbor activate" commands. */
8662 install_element (BGP_NODE, &no_neighbor_activate_cmd);
8663 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
8664 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
8665 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
8666 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
8667
8668 /* "neighbor peer-group set" commands. */
8669 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
8670 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
8671 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
8672 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00008673 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
8674
paul718e3742002-12-13 20:15:29 +00008675 /* "no neighbor peer-group unset" commands. */
8676 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
8677 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
8678 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
8679 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00008680 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
8681
paul718e3742002-12-13 20:15:29 +00008682 /* "neighbor softreconfiguration inbound" commands.*/
8683 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
8684 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
8685 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
8686 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
8687 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
8688 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
8689 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
8690 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +00008691 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
8692 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +00008693
8694 /* "neighbor attribute-unchanged" commands. */
8695 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
8696 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
8697 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
8698 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
8699 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
8700 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
8701 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
8702 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
8703 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
8704 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
8705 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
8706 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
8707 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
8708 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
8709 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
8710 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
8711 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
8712 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
8713 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
8714 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
8715 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
8716 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
8717 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
8718 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
8719 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
8720 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
8721 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
8722 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
8723 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
8724 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
8725 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
8726 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
8727 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
8728 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
8729 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
8730 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
8731 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
8732 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
8733 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
8734 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
8735 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
8736 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
8737 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
8738 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
8739 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
8740 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
8741 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
8742 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
8743 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
8744 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
8745 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
8746 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
8747 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
8748 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
8749 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
8750 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
8751 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
8752 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
8753 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
8754 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
8755 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
8756 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
8757 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
8758 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
8759 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
8760 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
8761 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
8762 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
8763 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
8764 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
8765 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
8766 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
8767 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
8768 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
8769 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
8770 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
8771 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
8772 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
8773 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
8774 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
8775 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
8776 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
8777 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
8778 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
8779 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
8780 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
8781 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
8782 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
8783 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
8784 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
8785 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
8786 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
8787 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
8788 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
8789 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
8790 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
8791 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
8792 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
8793 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
8794 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
8795 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
8796 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
8797 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
8798 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
8799 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
8800 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
8801 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
8802 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
8803 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
8804 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
8805
paulfee0f4c2004-09-13 05:12:46 +00008806 /* "nexthop-local unchanged" commands */
8807 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
8808 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
8809
paul718e3742002-12-13 20:15:29 +00008810 /* "transparent-as" and "transparent-nexthop" for old version
8811 compatibility. */
8812 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
8813 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
8814
8815 /* "neighbor next-hop-self" commands. */
8816 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
8817 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
8818 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
8819 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
8820 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
8821 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
8822 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
8823 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
8824 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
8825 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
8826
8827 /* "neighbor remove-private-AS" commands. */
8828 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
8829 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
8830 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
8831 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
8832 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
8833 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
8834 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
8835 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
8836 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
8837 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
8838
8839 /* "neighbor send-community" commands.*/
8840 install_element (BGP_NODE, &neighbor_send_community_cmd);
8841 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
8842 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
8843 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
8844 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
8845 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
8846 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
8847 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
8848 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
8849 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
8850 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
8851 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
8852 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
8853 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
8854 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
8855 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
8856 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
8857 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
8858 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
8859 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
8860
8861 /* "neighbor route-reflector" commands.*/
8862 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
8863 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
8864 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
8865 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
8866 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
8867 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
8868 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
8869 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
8870 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
8871 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
8872
8873 /* "neighbor route-server" commands.*/
8874 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
8875 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
8876 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
8877 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
8878 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
8879 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
8880 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
8881 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
8882 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
8883 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
8884
8885 /* "neighbor passive" commands. */
8886 install_element (BGP_NODE, &neighbor_passive_cmd);
8887 install_element (BGP_NODE, &no_neighbor_passive_cmd);
8888
8889 /* "neighbor shutdown" commands. */
8890 install_element (BGP_NODE, &neighbor_shutdown_cmd);
8891 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
8892
hassoc9502432005-02-01 22:01:48 +00008893 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +00008894 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
8895 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
8896
8897 /* "neighbor capability orf prefix-list" commands.*/
8898 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
8899 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
8900 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
8901 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
8902 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
8903 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
8904 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
8905 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
8906
8907 /* "neighbor capability dynamic" commands.*/
8908 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
8909 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
8910
8911 /* "neighbor dont-capability-negotiate" commands. */
8912 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
8913 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
8914
8915 /* "neighbor ebgp-multihop" commands. */
8916 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
8917 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
8918 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
8919 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
8920
8921 /* "neighbor enforce-multihop" commands. */
8922 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
8923 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
8924
8925 /* "neighbor description" commands. */
8926 install_element (BGP_NODE, &neighbor_description_cmd);
8927 install_element (BGP_NODE, &no_neighbor_description_cmd);
8928 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
8929
8930 /* "neighbor update-source" commands. "*/
8931 install_element (BGP_NODE, &neighbor_update_source_cmd);
8932 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
8933
8934 /* "neighbor default-originate" commands. */
8935 install_element (BGP_NODE, &neighbor_default_originate_cmd);
8936 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
8937 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
8938 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
8939 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
8940 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
8941 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
8942 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
8943 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
8944 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
8945 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
8946 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
8947 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
8948 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
8949 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
8950 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
8951
8952 /* "neighbor port" commands. */
8953 install_element (BGP_NODE, &neighbor_port_cmd);
8954 install_element (BGP_NODE, &no_neighbor_port_cmd);
8955 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
8956
8957 /* "neighbor weight" commands. */
8958 install_element (BGP_NODE, &neighbor_weight_cmd);
8959 install_element (BGP_NODE, &no_neighbor_weight_cmd);
8960 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
8961
8962 /* "neighbor override-capability" commands. */
8963 install_element (BGP_NODE, &neighbor_override_capability_cmd);
8964 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
8965
8966 /* "neighbor strict-capability-match" commands. */
8967 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
8968 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
8969
8970 /* "neighbor timers" commands. */
8971 install_element (BGP_NODE, &neighbor_timers_cmd);
8972 install_element (BGP_NODE, &no_neighbor_timers_cmd);
8973
8974 /* "neighbor timers connect" commands. */
8975 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
8976 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
8977 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
8978
8979 /* "neighbor advertisement-interval" commands. */
8980 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
8981 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
8982 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
8983
8984 /* "neighbor version" commands. */
8985 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +00008986
8987 /* "neighbor interface" commands. */
8988 install_element (BGP_NODE, &neighbor_interface_cmd);
8989 install_element (BGP_NODE, &no_neighbor_interface_cmd);
8990
8991 /* "neighbor distribute" commands. */
8992 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
8993 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
8994 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
8995 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
8996 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
8997 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
8998 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
8999 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
9000 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
9001 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
9002
9003 /* "neighbor prefix-list" commands. */
9004 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
9005 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
9006 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
9007 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
9008 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
9009 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
9010 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
9011 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
9012 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
9013 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
9014
9015 /* "neighbor filter-list" commands. */
9016 install_element (BGP_NODE, &neighbor_filter_list_cmd);
9017 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
9018 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
9019 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
9020 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
9021 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
9022 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
9023 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
9024 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
9025 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
9026
9027 /* "neighbor route-map" commands. */
9028 install_element (BGP_NODE, &neighbor_route_map_cmd);
9029 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
9030 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
9031 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
9032 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
9033 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
9034 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
9035 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
9036 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
9037 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
9038
9039 /* "neighbor unsuppress-map" commands. */
9040 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
9041 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
9042 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
9043 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
9044 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
9045 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
9046 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
9047 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +00009048 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
9049 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +00009050
9051 /* "neighbor maximum-prefix" commands. */
9052 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009053 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009054 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009055 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009056 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
9057 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009058 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
9059 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009060 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9061 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9062 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9063 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9064 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009065 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009066 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009067 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009068 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009069 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9070 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009071 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
9072 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009073 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9074 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9075 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9076 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9077 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009078 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009079 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009080 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009081 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009082 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
9083 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009084 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
9085 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009086 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9087 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9088 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9089 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9090 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009091 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009092 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009093 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009094 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009095 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
9096 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009097 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
9098 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009099 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9100 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9101 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9102 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9103 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009104 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009105 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009106 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009107 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009108 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9109 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009110 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
9111 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009112 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9113 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9114 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9115 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9116 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009117
9118 /* "neighbor allowas-in" */
9119 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
9120 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
9121 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
9122 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
9123 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
9124 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
9125 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
9126 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
9127 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
9128 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
9129 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
9130 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
9131 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
9132 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
9133 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
9134
9135 /* address-family commands. */
9136 install_element (BGP_NODE, &address_family_ipv4_cmd);
9137 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
9138#ifdef HAVE_IPV6
9139 install_element (BGP_NODE, &address_family_ipv6_cmd);
9140 install_element (BGP_NODE, &address_family_ipv6_unicast_cmd);
9141#endif /* HAVE_IPV6 */
9142 install_element (BGP_NODE, &address_family_vpnv4_cmd);
9143 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
9144
9145 /* "exit-address-family" command. */
9146 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
9147 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
9148 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
9149 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
9150
9151 /* "clear ip bgp commands" */
9152 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
9153 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
9154 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
9155 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
9156 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
9157 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
9158#ifdef HAVE_IPV6
9159 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
9160 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
9161 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
9162 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
9163 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
9164 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
9165 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
9166 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
9167 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
9168 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
9169 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
9170#endif /* HAVE_IPV6 */
9171
9172 /* "clear ip bgp neighbor soft in" */
9173 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
9174 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
9175 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
9176 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
9177 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
9178 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
9179 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
9180 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
9181 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
9182 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
9183 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
9184 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
9185 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
9186 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
9187 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
9188 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
9189 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
9190 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
9191 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
9192 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
9193 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
9194 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
9195 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
9196 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
9197 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
9198 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
9199 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
9200 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
9201 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
9202 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
9203 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
9204 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
9205 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
9206 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
9207 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
9208 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
9209 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
9210 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
9211 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
9212 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
9213#ifdef HAVE_IPV6
9214 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
9215 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
9216 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
9217 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
9218 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
9219 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
9220 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
9221 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
9222 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
9223 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
9224 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
9225 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
9226 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
9227 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
9228 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
9229 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
9230 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
9231 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
9232 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
9233 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
9234 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
9235 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
9236 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
9237 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
9238 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
9239 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
9240 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
9241 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
9242 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
9243 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
9244 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
9245#endif /* HAVE_IPV6 */
9246
9247 /* "clear ip bgp neighbor soft out" */
9248 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
9249 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
9250 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
9251 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
9252 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
9253 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
9254 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
9255 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
9256 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
9257 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
9258 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
9259 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
9260 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
9261 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
9262 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
9263 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
9264 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
9265 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
9266 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
9267 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
9268 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
9269 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
9270 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
9271 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
9272 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
9273 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
9274 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
9275 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
9276#ifdef HAVE_IPV6
9277 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
9278 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
9279 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
9280 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
9281 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
9282 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
9283 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
9284 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
9285 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
9286 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
9287 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
9288 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
9289 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
9290 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
9291 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
9292 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
9293 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
9294 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
9295 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
9296 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
9297 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
9298#endif /* HAVE_IPV6 */
9299
9300 /* "clear ip bgp neighbor soft" */
9301 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
9302 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
9303 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
9304 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
9305 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
9306 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
9307 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
9308 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
9309 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
9310 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
9311 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
9312 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
9313 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
9314 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
9315 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
9316#ifdef HAVE_IPV6
9317 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
9318 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
9319 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
9320 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
9321 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
9322 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
9323 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
9324 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
9325 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
9326 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
9327 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
9328#endif /* HAVE_IPV6 */
9329
paulfee0f4c2004-09-13 05:12:46 +00009330 /* "clear ip bgp neighbor rsclient" */
9331 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
9332 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
9333 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
9334 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
9335#ifdef HAVE_IPV6
9336 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
9337 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
9338 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
9339 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
9340 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
9341 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
9342 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
9343 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
9344#endif /* HAVE_IPV6 */
9345
paul718e3742002-12-13 20:15:29 +00009346 /* "show ip bgp summary" commands. */
9347 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
9348 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
9349 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
9350 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
9351 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9352 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9353#ifdef HAVE_IPV6
9354 install_element (VIEW_NODE, &show_bgp_summary_cmd);
9355 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
9356 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
9357 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
9358#endif /* HAVE_IPV6 */
9359 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
9360 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
9361 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
9362 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
9363 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9364 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9365#ifdef HAVE_IPV6
9366 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
9367 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
9368 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
9369 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
9370#endif /* HAVE_IPV6 */
9371
9372 /* "show ip bgp neighbors" commands. */
9373 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
9374 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
9375 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
9376 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
9377 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
9378 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
9379 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
9380 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
9381 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
9382 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
9383 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
9384 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
9385 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
9386 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
9387 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
9388 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
9389 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
9390 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
9391 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
9392 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
9393
9394#ifdef HAVE_IPV6
9395 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
9396 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
9397 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
9398 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +00009399 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
9400 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
9401 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
9402 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +00009403 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
9404 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
9405 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
9406 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +00009407 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
9408 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
9409 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
9410 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +00009411
9412 /* Old commands. */
9413 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
9414 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
9415 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
9416 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
9417#endif /* HAVE_IPV6 */
9418
paulfee0f4c2004-09-13 05:12:46 +00009419 /* "show ip bgp rsclient" commands. */
9420 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
9421 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
9422 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
9423 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
9424 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
9425 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
9426 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
9427 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
9428
9429#ifdef HAVE_IPV6
9430 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
9431 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
9432 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
9433 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
9434 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
9435 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
9436 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
9437 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
9438#endif /* HAVE_IPV6 */
9439
paul718e3742002-12-13 20:15:29 +00009440 /* "show ip bgp paths" commands. */
9441 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
9442 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
9443 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
9444 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
9445
9446 /* "show ip bgp community" commands. */
9447 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
9448 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
9449
9450 /* "show ip bgp attribute-info" commands. */
9451 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
9452 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
9453
9454 /* "redistribute" commands. */
9455 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
9456 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
9457 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
9458 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
9459 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
9460 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
9461 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
9462 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
9463 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
9464 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
9465#ifdef HAVE_IPV6
9466 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
9467 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
9468 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
9469 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
9470 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
9471 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
9472 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
9473 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
9474 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
9475 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
9476#endif /* HAVE_IPV6 */
9477
9478 /* Community-list. */
9479 community_list_vty ();
9480}
9481
9482#include "memory.h"
9483#include "bgp_regex.h"
9484#include "bgp_clist.h"
9485#include "bgp_ecommunity.h"
9486
9487/* VTY functions. */
9488
9489/* Direction value to string conversion. */
paulfd79ac92004-10-13 05:06:08 +00009490const char *
paul718e3742002-12-13 20:15:29 +00009491community_direct_str (int direct)
9492{
9493 switch (direct)
9494 {
9495 case COMMUNITY_DENY:
9496 return "deny";
9497 break;
9498 case COMMUNITY_PERMIT:
9499 return "permit";
9500 break;
9501 default:
9502 return "unknown";
9503 break;
9504 }
9505}
9506
9507/* Display error string. */
9508void
9509community_list_perror (struct vty *vty, int ret)
9510{
9511 switch (ret)
9512 {
9513 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
9514 vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE);
9515 break;
9516 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
9517 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
9518 break;
9519 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
9520 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
9521 break;
9522 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
9523 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
9524 break;
9525 }
9526}
9527
9528/* VTY interface for community_set() function. */
9529int
paulfd79ac92004-10-13 05:06:08 +00009530community_list_set_vty (struct vty *vty, int argc, const char **argv,
9531 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +00009532{
9533 int ret;
9534 int direct;
9535 char *str;
9536
9537 /* Check the list type. */
9538 if (strncmp (argv[1], "p", 1) == 0)
9539 direct = COMMUNITY_PERMIT;
9540 else if (strncmp (argv[1], "d", 1) == 0)
9541 direct = COMMUNITY_DENY;
9542 else
9543 {
9544 vty_out (vty, "%% Matching condition must be permit or deny%s",
9545 VTY_NEWLINE);
9546 return CMD_WARNING;
9547 }
9548
9549 /* All digit name check. */
9550 if (reject_all_digit_name && all_digit (argv[0]))
9551 {
9552 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
9553 return CMD_WARNING;
9554 }
9555
9556 /* Concat community string argument. */
9557 if (argc > 1)
9558 str = argv_concat (argv, argc, 2);
9559 else
9560 str = NULL;
9561
9562 /* When community_list_set() return nevetive value, it means
9563 malformed community string. */
9564 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
9565
9566 /* Free temporary community list string allocated by
9567 argv_concat(). */
9568 if (str)
9569 XFREE (MTYPE_TMP, str);
9570
9571 if (ret < 0)
9572 {
9573 /* Display error string. */
9574 community_list_perror (vty, ret);
9575 return CMD_WARNING;
9576 }
9577
9578 return CMD_SUCCESS;
9579}
9580
9581/* Community-list delete with name. */
9582int
paulfd79ac92004-10-13 05:06:08 +00009583community_list_unset_all_vty (struct vty *vty, const char *name)
paul718e3742002-12-13 20:15:29 +00009584{
9585 int ret;
9586
9587 ret = community_list_unset (bgp_clist, name, NULL, 0, COMMUNITY_LIST_AUTO);
9588
9589 if (ret < 0)
9590 {
9591 community_list_perror (vty, ret);
9592 return CMD_WARNING;
9593 }
9594 return CMD_SUCCESS;
9595}
9596
9597/* Communiyt-list entry delete. */
9598int
paulfd79ac92004-10-13 05:06:08 +00009599community_list_unset_vty (struct vty *vty, int argc, const char **argv,
9600 int style)
paul718e3742002-12-13 20:15:29 +00009601{
9602 int ret;
9603 int direct;
9604 char *str;
9605
9606 /* Check the list direct. */
9607 if (strncmp (argv[1], "p", 1) == 0)
9608 direct = COMMUNITY_PERMIT;
9609 else if (strncmp (argv[1], "d", 1) == 0)
9610 direct = COMMUNITY_DENY;
9611 else
9612 {
9613 vty_out (vty, "%% Matching condition must be permit or deny%s",
9614 VTY_NEWLINE);
9615 return CMD_WARNING;
9616 }
9617
9618 /* Concat community string argument. */
9619 str = argv_concat (argv, argc, 2);
9620
9621 /* Unset community list. */
9622 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
9623
9624 /* Free temporary community list string allocated by
9625 argv_concat(). */
9626 XFREE (MTYPE_TMP, str);
9627
9628 if (ret < 0)
9629 {
9630 community_list_perror (vty, ret);
9631 return CMD_WARNING;
9632 }
9633
9634 return CMD_SUCCESS;
9635}
9636
9637/* "community-list" keyword help string. */
9638#define COMMUNITY_LIST_STR "Add a community list entry\n"
9639#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
9640
9641DEFUN (ip_community_list,
9642 ip_community_list_cmd,
9643 "ip community-list WORD (deny|permit) .AA:NN",
9644 IP_STR
9645 COMMUNITY_LIST_STR
9646 "Community list name\n"
9647 "Specify community to reject\n"
9648 "Specify community to accept\n"
9649 COMMUNITY_VAL_STR)
9650{
9651 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_AUTO, 1);
9652}
9653
9654DEFUN (ip_community_list_standard,
9655 ip_community_list_standard_cmd,
9656 "ip community-list <1-99> (deny|permit) .AA:NN",
9657 IP_STR
9658 COMMUNITY_LIST_STR
9659 "Community list number (standard)\n"
9660 "Specify community to reject\n"
9661 "Specify community to accept\n"
9662 COMMUNITY_VAL_STR)
9663{
9664 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
9665}
9666
9667ALIAS (ip_community_list_standard,
9668 ip_community_list_standard2_cmd,
9669 "ip community-list <1-99> (deny|permit)",
9670 IP_STR
9671 COMMUNITY_LIST_STR
9672 "Community list number (standard)\n"
9673 "Specify community to reject\n"
9674 "Specify community to accept\n")
9675
9676DEFUN (ip_community_list_expanded,
9677 ip_community_list_expanded_cmd,
9678 "ip community-list <100-199> (deny|permit) .LINE",
9679 IP_STR
9680 COMMUNITY_LIST_STR
9681 "Community list number (expanded)\n"
9682 "Specify community to reject\n"
9683 "Specify community to accept\n"
9684 "An ordered list as a regular-expression\n")
9685{
9686 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
9687}
9688
9689DEFUN (ip_community_list_name_standard,
9690 ip_community_list_name_standard_cmd,
9691 "ip community-list standard WORD (deny|permit) .AA:NN",
9692 IP_STR
9693 COMMUNITY_LIST_STR
9694 "Add a standard community-list entry\n"
9695 "Community list name\n"
9696 "Specify community to reject\n"
9697 "Specify community to accept\n"
9698 COMMUNITY_VAL_STR)
9699{
9700 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
9701}
9702
9703ALIAS (ip_community_list_name_standard,
9704 ip_community_list_name_standard2_cmd,
9705 "ip community-list standard WORD (deny|permit)",
9706 IP_STR
9707 COMMUNITY_LIST_STR
9708 "Add a standard community-list entry\n"
9709 "Community list name\n"
9710 "Specify community to reject\n"
9711 "Specify community to accept\n")
9712
9713DEFUN (ip_community_list_name_expanded,
9714 ip_community_list_name_expanded_cmd,
9715 "ip community-list expanded WORD (deny|permit) .LINE",
9716 IP_STR
9717 COMMUNITY_LIST_STR
9718 "Add an expanded community-list entry\n"
9719 "Community list name\n"
9720 "Specify community to reject\n"
9721 "Specify community to accept\n"
9722 "An ordered list as a regular-expression\n")
9723{
9724 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
9725}
9726
9727DEFUN (no_ip_community_list_all,
9728 no_ip_community_list_all_cmd,
9729 "no ip community-list (WORD|<1-99>|<100-199>)",
9730 NO_STR
9731 IP_STR
9732 COMMUNITY_LIST_STR
9733 "Community list name\n"
9734 "Community list number (standard)\n"
9735 "Community list number (expanded)\n")
9736{
9737 return community_list_unset_all_vty (vty, argv[0]);
9738}
9739
9740DEFUN (no_ip_community_list_name_all,
9741 no_ip_community_list_name_all_cmd,
9742 "no ip community-list (standard|expanded) WORD",
9743 NO_STR
9744 IP_STR
9745 COMMUNITY_LIST_STR
9746 "Add a standard community-list entry\n"
9747 "Add an expanded community-list entry\n"
9748 "Community list name\n")
9749{
9750 return community_list_unset_all_vty (vty, argv[1]);
9751}
9752
9753DEFUN (no_ip_community_list,
9754 no_ip_community_list_cmd,
9755 "no ip community-list WORD (deny|permit) .AA:NN",
9756 NO_STR
9757 IP_STR
9758 COMMUNITY_LIST_STR
9759 "Community list name\n"
9760 "Specify community to reject\n"
9761 "Specify community to accept\n"
9762 COMMUNITY_VAL_STR)
9763{
9764 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_AUTO);
9765}
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,
9783 "no ip community-list <100-199> (deny|permit) .LINE",
9784 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
9867 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_AUTO);
9868 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,
9882 "show ip community-list (<1-199>|WORD)",
9883 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
9891 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_AUTO);
9892 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
paulfd79ac92004-10-13 05:06:08 +00009952extcommunity_list_unset_all_vty (struct vty *vty, const char *name)
paul718e3742002-12-13 20:15:29 +00009953{
9954 int ret;
9955
9956 ret = extcommunity_list_unset (bgp_clist, name, NULL, 0, EXTCOMMUNITY_LIST_AUTO);
9957
9958 if (ret < 0)
9959 {
9960 community_list_perror (vty, ret);
9961 return CMD_WARNING;
9962 }
9963 return CMD_SUCCESS;
9964}
9965
9966int
paulfd79ac92004-10-13 05:06:08 +00009967extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
9968 int style)
paul718e3742002-12-13 20:15:29 +00009969{
9970 int ret;
9971 int direct;
9972 char *str;
9973
9974 /* Check the list direct. */
9975 if (strncmp (argv[1], "p", 1) == 0)
9976 direct = COMMUNITY_PERMIT;
9977 else if (strncmp (argv[1], "d", 1) == 0)
9978 direct = COMMUNITY_DENY;
9979 else
9980 {
9981 vty_out (vty, "%% Matching condition must be permit or deny%s",
9982 VTY_NEWLINE);
9983 return CMD_WARNING;
9984 }
9985
9986 /* Concat community string argument. */
9987 str = argv_concat (argv, argc, 2);
9988
9989 /* Unset community list. */
9990 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
9991
9992 /* Free temporary community list string allocated by
9993 argv_concat(). */
9994 XFREE (MTYPE_TMP, str);
9995
9996 if (ret < 0)
9997 {
9998 community_list_perror (vty, ret);
9999 return CMD_WARNING;
10000 }
10001
10002 return CMD_SUCCESS;
10003}
10004
10005/* "extcommunity-list" keyword help string. */
10006#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
10007#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
10008
10009DEFUN (ip_extcommunity_list_standard,
10010 ip_extcommunity_list_standard_cmd,
10011 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10012 IP_STR
10013 EXTCOMMUNITY_LIST_STR
10014 "Extended Community list number (standard)\n"
10015 "Specify community to reject\n"
10016 "Specify community to accept\n"
10017 EXTCOMMUNITY_VAL_STR)
10018{
10019 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
10020}
10021
10022ALIAS (ip_extcommunity_list_standard,
10023 ip_extcommunity_list_standard2_cmd,
10024 "ip extcommunity-list <1-99> (deny|permit)",
10025 IP_STR
10026 EXTCOMMUNITY_LIST_STR
10027 "Extended Community list number (standard)\n"
10028 "Specify community to reject\n"
10029 "Specify community to accept\n")
10030
10031DEFUN (ip_extcommunity_list_expanded,
10032 ip_extcommunity_list_expanded_cmd,
10033 "ip extcommunity-list <100-199> (deny|permit) .LINE",
10034 IP_STR
10035 EXTCOMMUNITY_LIST_STR
10036 "Extended Community list number (expanded)\n"
10037 "Specify community to reject\n"
10038 "Specify community to accept\n"
10039 "An ordered list as a regular-expression\n")
10040{
10041 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
10042}
10043
10044DEFUN (ip_extcommunity_list_name_standard,
10045 ip_extcommunity_list_name_standard_cmd,
10046 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10047 IP_STR
10048 EXTCOMMUNITY_LIST_STR
10049 "Specify standard extcommunity-list\n"
10050 "Extended Community list name\n"
10051 "Specify community to reject\n"
10052 "Specify community to accept\n"
10053 EXTCOMMUNITY_VAL_STR)
10054{
10055 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
10056}
10057
10058ALIAS (ip_extcommunity_list_name_standard,
10059 ip_extcommunity_list_name_standard2_cmd,
10060 "ip extcommunity-list standard WORD (deny|permit)",
10061 IP_STR
10062 EXTCOMMUNITY_LIST_STR
10063 "Specify standard extcommunity-list\n"
10064 "Extended Community list name\n"
10065 "Specify community to reject\n"
10066 "Specify community to accept\n")
10067
10068DEFUN (ip_extcommunity_list_name_expanded,
10069 ip_extcommunity_list_name_expanded_cmd,
10070 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
10071 IP_STR
10072 EXTCOMMUNITY_LIST_STR
10073 "Specify expanded extcommunity-list\n"
10074 "Extended Community list name\n"
10075 "Specify community to reject\n"
10076 "Specify community to accept\n"
10077 "An ordered list as a regular-expression\n")
10078{
10079 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
10080}
10081
10082DEFUN (no_ip_extcommunity_list_all,
10083 no_ip_extcommunity_list_all_cmd,
10084 "no ip extcommunity-list (<1-99>|<100-199>)",
10085 NO_STR
10086 IP_STR
10087 EXTCOMMUNITY_LIST_STR
10088 "Extended Community list number (standard)\n"
10089 "Extended Community list number (expanded)\n")
10090{
10091 return extcommunity_list_unset_all_vty (vty, argv[0]);
10092}
10093
10094DEFUN (no_ip_extcommunity_list_name_all,
10095 no_ip_extcommunity_list_name_all_cmd,
10096 "no ip extcommunity-list (standard|expanded) WORD",
10097 NO_STR
10098 IP_STR
10099 EXTCOMMUNITY_LIST_STR
10100 "Specify standard extcommunity-list\n"
10101 "Specify expanded extcommunity-list\n"
10102 "Extended Community list name\n")
10103{
10104 return extcommunity_list_unset_all_vty (vty, argv[1]);
10105}
10106
10107DEFUN (no_ip_extcommunity_list_standard,
10108 no_ip_extcommunity_list_standard_cmd,
10109 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10110 NO_STR
10111 IP_STR
10112 EXTCOMMUNITY_LIST_STR
10113 "Extended Community list number (standard)\n"
10114 "Specify community to reject\n"
10115 "Specify community to accept\n"
10116 EXTCOMMUNITY_VAL_STR)
10117{
10118 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10119}
10120
10121DEFUN (no_ip_extcommunity_list_expanded,
10122 no_ip_extcommunity_list_expanded_cmd,
10123 "no ip extcommunity-list <100-199> (deny|permit) .LINE",
10124 NO_STR
10125 IP_STR
10126 EXTCOMMUNITY_LIST_STR
10127 "Extended Community list number (expanded)\n"
10128 "Specify community to reject\n"
10129 "Specify community to accept\n"
10130 "An ordered list as a regular-expression\n")
10131{
10132 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10133}
10134
10135DEFUN (no_ip_extcommunity_list_name_standard,
10136 no_ip_extcommunity_list_name_standard_cmd,
10137 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10138 NO_STR
10139 IP_STR
10140 EXTCOMMUNITY_LIST_STR
10141 "Specify standard extcommunity-list\n"
10142 "Extended Community list name\n"
10143 "Specify community to reject\n"
10144 "Specify community to accept\n"
10145 EXTCOMMUNITY_VAL_STR)
10146{
10147 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10148}
10149
10150DEFUN (no_ip_extcommunity_list_name_expanded,
10151 no_ip_extcommunity_list_name_expanded_cmd,
10152 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
10153 NO_STR
10154 IP_STR
10155 EXTCOMMUNITY_LIST_STR
10156 "Specify expanded extcommunity-list\n"
10157 "Community list name\n"
10158 "Specify community to reject\n"
10159 "Specify community to accept\n"
10160 "An ordered list as a regular-expression\n")
10161{
10162 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10163}
10164
10165void
10166extcommunity_list_show (struct vty *vty, struct community_list *list)
10167{
10168 struct community_entry *entry;
10169
10170 for (entry = list->head; entry; entry = entry->next)
10171 {
10172 if (entry == list->head)
10173 {
10174 if (all_digit (list->name))
10175 vty_out (vty, "Extended community %s list %s%s",
10176 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10177 "standard" : "(expanded) access",
10178 list->name, VTY_NEWLINE);
10179 else
10180 vty_out (vty, "Named extended community %s list %s%s",
10181 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10182 "standard" : "expanded",
10183 list->name, VTY_NEWLINE);
10184 }
10185 if (entry->any)
10186 vty_out (vty, " %s%s",
10187 community_direct_str (entry->direct), VTY_NEWLINE);
10188 else
10189 vty_out (vty, " %s %s%s",
10190 community_direct_str (entry->direct),
10191 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10192 entry->u.ecom->str : entry->config,
10193 VTY_NEWLINE);
10194 }
10195}
10196
10197DEFUN (show_ip_extcommunity_list,
10198 show_ip_extcommunity_list_cmd,
10199 "show ip extcommunity-list",
10200 SHOW_STR
10201 IP_STR
10202 "List extended-community list\n")
10203{
10204 struct community_list *list;
10205 struct community_list_master *cm;
10206
10207 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_AUTO);
10208 if (! cm)
10209 return CMD_SUCCESS;
10210
10211 for (list = cm->num.head; list; list = list->next)
10212 extcommunity_list_show (vty, list);
10213
10214 for (list = cm->str.head; list; list = list->next)
10215 extcommunity_list_show (vty, list);
10216
10217 return CMD_SUCCESS;
10218}
10219
10220DEFUN (show_ip_extcommunity_list_arg,
10221 show_ip_extcommunity_list_arg_cmd,
10222 "show ip extcommunity-list (<1-199>|WORD)",
10223 SHOW_STR
10224 IP_STR
10225 "List extended-community list\n"
10226 "Extcommunity-list number\n"
10227 "Extcommunity-list name\n")
10228{
10229 struct community_list *list;
10230
10231 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_AUTO);
10232 if (! list)
10233 {
10234 vty_out (vty, "%% Can't find extcommunit-list%s", VTY_NEWLINE);
10235 return CMD_WARNING;
10236 }
10237
10238 extcommunity_list_show (vty, list);
10239
10240 return CMD_SUCCESS;
10241}
10242
10243/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000010244static const char *
paul718e3742002-12-13 20:15:29 +000010245community_list_config_str (struct community_entry *entry)
10246{
paulfd79ac92004-10-13 05:06:08 +000010247 const char *str;
paul718e3742002-12-13 20:15:29 +000010248
10249 if (entry->any)
10250 str = "";
10251 else
10252 {
10253 if (entry->style == COMMUNITY_LIST_STANDARD)
10254 str = community_str (entry->u.com);
10255 else
10256 str = entry->config;
10257 }
10258 return str;
10259}
10260
10261/* Display community-list and extcommunity-list configuration. */
10262int
10263community_list_config_write (struct vty *vty)
10264{
10265 struct community_list *list;
10266 struct community_entry *entry;
10267 struct community_list_master *cm;
10268 int write = 0;
10269
10270 /* Community-list. */
10271 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_AUTO);
10272
10273 for (list = cm->num.head; list; list = list->next)
10274 for (entry = list->head; entry; entry = entry->next)
10275 {
10276 if (atol (list->name) < 200)
10277 vty_out (vty, "ip community-list %s %s %s%s",
10278 list->name, community_direct_str (entry->direct),
10279 community_list_config_str (entry),
10280 VTY_NEWLINE);
10281 else
10282 vty_out (vty, "ip community-list %s %s %s %s%s",
10283 entry->style == COMMUNITY_LIST_STANDARD
10284 ? "standard" : "expanded",
10285 list->name, community_direct_str (entry->direct),
10286 community_list_config_str (entry),
10287 VTY_NEWLINE);
10288 write++;
10289 }
10290 for (list = cm->str.head; list; list = list->next)
10291 for (entry = list->head; entry; entry = entry->next)
10292 {
10293 vty_out (vty, "ip community-list %s %s %s %s%s",
10294 entry->style == COMMUNITY_LIST_STANDARD
10295 ? "standard" : "expanded",
10296 list->name, community_direct_str (entry->direct),
10297 community_list_config_str (entry),
10298 VTY_NEWLINE);
10299 write++;
10300 }
10301
10302 /* Extcommunity-list. */
10303 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_AUTO);
10304
10305 for (list = cm->num.head; list; list = list->next)
10306 for (entry = list->head; entry; entry = entry->next)
10307 {
10308 if (atol (list->name) < 200)
10309 vty_out (vty, "ip extcommunity-list %s %s %s%s",
10310 list->name, community_direct_str (entry->direct),
10311 community_list_config_str (entry), VTY_NEWLINE);
10312 else
10313 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
10314 entry->style == EXTCOMMUNITY_LIST_STANDARD
10315 ? "standard" : "expanded",
10316 list->name, community_direct_str (entry->direct),
10317 community_list_config_str (entry), VTY_NEWLINE);
10318 write++;
10319 }
10320 for (list = cm->str.head; list; list = list->next)
10321 for (entry = list->head; entry; entry = entry->next)
10322 {
10323 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
10324 entry->style == EXTCOMMUNITY_LIST_STANDARD
10325 ? "standard" : "expanded",
10326 list->name, community_direct_str (entry->direct),
10327 community_list_config_str (entry), VTY_NEWLINE);
10328 write++;
10329 }
10330 return write;
10331}
10332
10333struct cmd_node community_list_node =
10334{
10335 COMMUNITY_LIST_NODE,
10336 "",
10337 1 /* Export to vtysh. */
10338};
10339
10340void
10341community_list_vty ()
10342{
10343 install_node (&community_list_node, community_list_config_write);
10344
10345 /* Community-list. */
10346 install_element (CONFIG_NODE, &ip_community_list_cmd);
10347 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
10348 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
10349 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
10350 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
10351 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
10352 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
10353 install_element (CONFIG_NODE, &no_ip_community_list_all_cmd);
10354 install_element (CONFIG_NODE, &no_ip_community_list_name_all_cmd);
10355 install_element (CONFIG_NODE, &no_ip_community_list_cmd);
10356 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
10357 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
10358 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
10359 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
10360 install_element (VIEW_NODE, &show_ip_community_list_cmd);
10361 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
10362 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
10363 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
10364
10365 /* Extcommunity-list. */
10366 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
10367 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
10368 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
10369 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
10370 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
10371 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
10372 install_element (CONFIG_NODE, &no_ip_extcommunity_list_all_cmd);
10373 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_all_cmd);
10374 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
10375 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
10376 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
10377 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
10378 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
10379 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
10380 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
10381 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
10382}