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