blob: 908673730453cf6014a9e9ea8bc6772a58145df5 [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;
Paul Jakma0df7c912008-07-21 21:02:49 +0000213 case BGP_ERR_TCPSIG_FAILED:
214 str = "Error while applying TCP-Sig to session(s)";
215 break;
paul718e3742002-12-13 20:15:29 +0000216 }
217 if (str)
218 {
219 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
220 return CMD_WARNING;
221 }
222 return CMD_SUCCESS;
223}
224
225/* BGP global configuration. */
226
227DEFUN (bgp_multiple_instance_func,
228 bgp_multiple_instance_cmd,
229 "bgp multiple-instance",
230 BGP_STR
231 "Enable bgp multiple instance\n")
232{
233 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
234 return CMD_SUCCESS;
235}
236
237DEFUN (no_bgp_multiple_instance,
238 no_bgp_multiple_instance_cmd,
239 "no bgp multiple-instance",
240 NO_STR
241 BGP_STR
242 "BGP multiple instance\n")
243{
244 int ret;
245
246 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
247 if (ret < 0)
248 {
249 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
250 return CMD_WARNING;
251 }
252 return CMD_SUCCESS;
253}
254
255DEFUN (bgp_config_type,
256 bgp_config_type_cmd,
257 "bgp config-type (cisco|zebra)",
258 BGP_STR
259 "Configuration type\n"
260 "cisco\n"
261 "zebra\n")
262{
263 if (strncmp (argv[0], "c", 1) == 0)
264 bgp_option_set (BGP_OPT_CONFIG_CISCO);
265 else
266 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
267
268 return CMD_SUCCESS;
269}
270
271DEFUN (no_bgp_config_type,
272 no_bgp_config_type_cmd,
273 "no bgp config-type",
274 NO_STR
275 BGP_STR
276 "Display configuration type\n")
277{
278 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
279 return CMD_SUCCESS;
280}
281
Paul Jakmad664ae12007-08-31 14:27:37 +0100282DEFUN_HIDDEN (bgp_open_accept,
283 bgp_open_accept_cmd,
284 "bgp open-accept",
285 BGP_STR
286 "Send OPEN immediately on accepted connections\n")
287{
288 bgp_option_set (BGP_OPT_ALWAYS_OPEN);
289 return CMD_SUCCESS;
290}
291
292DEFUN_HIDDEN (no_bgp_open_accept,
293 no_bgp_open_accept_cmd,
294 "no bgp open-accept",
295 NO_STR
296 BGP_STR
297 "Send OPEN immediately on accepted connections\n")
298
299{
300 bgp_option_unset (BGP_OPT_ALWAYS_OPEN);
301 return CMD_SUCCESS;
302}
303
paul718e3742002-12-13 20:15:29 +0000304DEFUN (no_synchronization,
305 no_synchronization_cmd,
306 "no synchronization",
307 NO_STR
308 "Perform IGP synchronization\n")
309{
310 return CMD_SUCCESS;
311}
312
313DEFUN (no_auto_summary,
314 no_auto_summary_cmd,
315 "no auto-summary",
316 NO_STR
317 "Enable automatic network number summarization\n")
318{
319 return CMD_SUCCESS;
320}
hasso3d515fd2005-02-01 21:30:04 +0000321
322DEFUN_DEPRECATED (neighbor_version,
323 neighbor_version_cmd,
324 NEIGHBOR_CMD "version (4|4-)",
325 NEIGHBOR_STR
326 NEIGHBOR_ADDR_STR
327 "Set the BGP version to match a neighbor\n"
328 "Neighbor's BGP version\n")
329{
330 return CMD_SUCCESS;
331}
paul718e3742002-12-13 20:15:29 +0000332
333/* "router bgp" commands. */
334DEFUN (router_bgp,
335 router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000336 "router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000337 ROUTER_STR
338 BGP_STR
339 AS_STR)
340{
341 int ret;
342 as_t as;
343 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000344 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000345
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000346 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000347
348 if (argc == 2)
349 name = argv[1];
350
351 ret = bgp_get (&bgp, &as, name);
352 switch (ret)
353 {
354 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
355 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
356 VTY_NEWLINE);
357 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000358 case BGP_ERR_AS_MISMATCH:
359 vty_out (vty, "BGP is already running; AS is %d%s", as, VTY_NEWLINE);
360 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000361 case BGP_ERR_INSTANCE_MISMATCH:
362 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
363 vty_out (vty, "BGP instance is already running; AS is %d%s",
364 as, VTY_NEWLINE);
365 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000366 }
367
368 vty->node = BGP_NODE;
369 vty->index = bgp;
370
371 return CMD_SUCCESS;
372}
373
374ALIAS (router_bgp,
375 router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000376 "router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000377 ROUTER_STR
378 BGP_STR
379 AS_STR
380 "BGP view\n"
381 "view name\n")
382
383/* "no router bgp" commands. */
384DEFUN (no_router_bgp,
385 no_router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000386 "no router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000387 NO_STR
388 ROUTER_STR
389 BGP_STR
390 AS_STR)
391{
392 as_t as;
393 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000394 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000395
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000396 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000397
398 if (argc == 2)
399 name = argv[1];
400
401 /* Lookup bgp structure. */
402 bgp = bgp_lookup (as, name);
403 if (! bgp)
404 {
405 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
406 return CMD_WARNING;
407 }
408
409 bgp_delete (bgp);
410
411 return CMD_SUCCESS;
412}
413
414ALIAS (no_router_bgp,
415 no_router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000416 "no router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000417 NO_STR
418 ROUTER_STR
419 BGP_STR
420 AS_STR
421 "BGP view\n"
422 "view name\n")
423
424/* BGP router-id. */
425
426DEFUN (bgp_router_id,
427 bgp_router_id_cmd,
428 "bgp router-id A.B.C.D",
429 BGP_STR
430 "Override configured router identifier\n"
431 "Manually configured router identifier\n")
432{
433 int ret;
434 struct in_addr id;
435 struct bgp *bgp;
436
437 bgp = vty->index;
438
439 ret = inet_aton (argv[0], &id);
440 if (! ret)
441 {
442 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
443 return CMD_WARNING;
444 }
445
hasso18a6dce2004-10-03 18:18:34 +0000446 bgp->router_id_static = id;
paul718e3742002-12-13 20:15:29 +0000447 bgp_router_id_set (bgp, &id);
448
449 return CMD_SUCCESS;
450}
451
452DEFUN (no_bgp_router_id,
453 no_bgp_router_id_cmd,
454 "no bgp router-id",
455 NO_STR
456 BGP_STR
457 "Override configured router identifier\n")
458{
459 int ret;
460 struct in_addr id;
461 struct bgp *bgp;
462
463 bgp = vty->index;
464
465 if (argc == 1)
466 {
467 ret = inet_aton (argv[0], &id);
468 if (! ret)
469 {
470 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
471 return CMD_WARNING;
472 }
473
hasso18a6dce2004-10-03 18:18:34 +0000474 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
paul718e3742002-12-13 20:15:29 +0000475 {
476 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
477 return CMD_WARNING;
478 }
479 }
480
hasso18a6dce2004-10-03 18:18:34 +0000481 bgp->router_id_static.s_addr = 0;
482 bgp_router_id_set (bgp, &router_id_zebra);
paul718e3742002-12-13 20:15:29 +0000483
484 return CMD_SUCCESS;
485}
486
487ALIAS (no_bgp_router_id,
488 no_bgp_router_id_val_cmd,
489 "no bgp router-id A.B.C.D",
490 NO_STR
491 BGP_STR
492 "Override configured router identifier\n"
493 "Manually configured router identifier\n")
494
495/* BGP Cluster ID. */
496
497DEFUN (bgp_cluster_id,
498 bgp_cluster_id_cmd,
499 "bgp cluster-id A.B.C.D",
500 BGP_STR
501 "Configure Route-Reflector Cluster-id\n"
502 "Route-Reflector Cluster-id in IP address format\n")
503{
504 int ret;
505 struct bgp *bgp;
506 struct in_addr cluster;
507
508 bgp = vty->index;
509
510 ret = inet_aton (argv[0], &cluster);
511 if (! ret)
512 {
513 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
514 return CMD_WARNING;
515 }
516
517 bgp_cluster_id_set (bgp, &cluster);
518
519 return CMD_SUCCESS;
520}
521
522ALIAS (bgp_cluster_id,
523 bgp_cluster_id32_cmd,
524 "bgp cluster-id <1-4294967295>",
525 BGP_STR
526 "Configure Route-Reflector Cluster-id\n"
527 "Route-Reflector Cluster-id as 32 bit quantity\n")
528
529DEFUN (no_bgp_cluster_id,
530 no_bgp_cluster_id_cmd,
531 "no bgp cluster-id",
532 NO_STR
533 BGP_STR
534 "Configure Route-Reflector Cluster-id\n")
535{
536 int ret;
537 struct bgp *bgp;
538 struct in_addr cluster;
539
540 bgp = vty->index;
541
542 if (argc == 1)
543 {
544 ret = inet_aton (argv[0], &cluster);
545 if (! ret)
546 {
547 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
548 return CMD_WARNING;
549 }
550 }
551
552 bgp_cluster_id_unset (bgp);
553
554 return CMD_SUCCESS;
555}
556
557ALIAS (no_bgp_cluster_id,
558 no_bgp_cluster_id_arg_cmd,
559 "no bgp cluster-id A.B.C.D",
560 NO_STR
561 BGP_STR
562 "Configure Route-Reflector Cluster-id\n"
563 "Route-Reflector Cluster-id in IP address format\n")
564
565DEFUN (bgp_confederation_identifier,
566 bgp_confederation_identifier_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000567 "bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000568 "BGP specific commands\n"
569 "AS confederation parameters\n"
570 "AS number\n"
571 "Set routing domain confederation AS\n")
572{
573 struct bgp *bgp;
574 as_t as;
575
576 bgp = vty->index;
577
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000578 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000579
580 bgp_confederation_id_set (bgp, as);
581
582 return CMD_SUCCESS;
583}
584
585DEFUN (no_bgp_confederation_identifier,
586 no_bgp_confederation_identifier_cmd,
587 "no bgp confederation identifier",
588 NO_STR
589 "BGP specific commands\n"
590 "AS confederation parameters\n"
591 "AS number\n")
592{
593 struct bgp *bgp;
594 as_t as;
595
596 bgp = vty->index;
597
598 if (argc == 1)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000599 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000600
601 bgp_confederation_id_unset (bgp);
602
603 return CMD_SUCCESS;
604}
605
606ALIAS (no_bgp_confederation_identifier,
607 no_bgp_confederation_identifier_arg_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000608 "no bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000609 NO_STR
610 "BGP specific commands\n"
611 "AS confederation parameters\n"
612 "AS number\n"
613 "Set routing domain confederation AS\n")
614
615DEFUN (bgp_confederation_peers,
616 bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000617 "bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000618 "BGP specific commands\n"
619 "AS confederation parameters\n"
620 "Peer ASs in BGP confederation\n"
621 AS_STR)
622{
623 struct bgp *bgp;
624 as_t as;
625 int i;
626
627 bgp = vty->index;
628
629 for (i = 0; i < argc; i++)
630 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000631 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000632
633 if (bgp->as == as)
634 {
635 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
636 VTY_NEWLINE);
637 continue;
638 }
639
640 bgp_confederation_peers_add (bgp, as);
641 }
642 return CMD_SUCCESS;
643}
644
645DEFUN (no_bgp_confederation_peers,
646 no_bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000647 "no bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000648 NO_STR
649 "BGP specific commands\n"
650 "AS confederation parameters\n"
651 "Peer ASs in BGP confederation\n"
652 AS_STR)
653{
654 struct bgp *bgp;
655 as_t as;
656 int i;
657
658 bgp = vty->index;
659
660 for (i = 0; i < argc; i++)
661 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000662 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
663
paul718e3742002-12-13 20:15:29 +0000664 bgp_confederation_peers_remove (bgp, as);
665 }
666 return CMD_SUCCESS;
667}
668
669/* BGP timers. */
670
671DEFUN (bgp_timers,
672 bgp_timers_cmd,
673 "timers bgp <0-65535> <0-65535>",
674 "Adjust routing timers\n"
675 "BGP timers\n"
676 "Keepalive interval\n"
677 "Holdtime\n")
678{
679 struct bgp *bgp;
680 unsigned long keepalive = 0;
681 unsigned long holdtime = 0;
682
683 bgp = vty->index;
684
685 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
686 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
687
688 /* Holdtime value check. */
689 if (holdtime < 3 && holdtime != 0)
690 {
691 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
692 VTY_NEWLINE);
693 return CMD_WARNING;
694 }
695
696 bgp_timers_set (bgp, keepalive, holdtime);
697
698 return CMD_SUCCESS;
699}
700
701DEFUN (no_bgp_timers,
702 no_bgp_timers_cmd,
703 "no timers bgp",
704 NO_STR
705 "Adjust routing timers\n"
706 "BGP timers\n")
707{
708 struct bgp *bgp;
709
710 bgp = vty->index;
711 bgp_timers_unset (bgp);
712
713 return CMD_SUCCESS;
714}
715
716ALIAS (no_bgp_timers,
717 no_bgp_timers_arg_cmd,
718 "no timers bgp <0-65535> <0-65535>",
719 NO_STR
720 "Adjust routing timers\n"
721 "BGP timers\n"
722 "Keepalive interval\n"
723 "Holdtime\n")
724
725DEFUN (bgp_client_to_client_reflection,
726 bgp_client_to_client_reflection_cmd,
727 "bgp client-to-client reflection",
728 "BGP specific commands\n"
729 "Configure client to client route reflection\n"
730 "reflection of routes allowed\n")
731{
732 struct bgp *bgp;
733
734 bgp = vty->index;
735 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
736 return CMD_SUCCESS;
737}
738
739DEFUN (no_bgp_client_to_client_reflection,
740 no_bgp_client_to_client_reflection_cmd,
741 "no bgp client-to-client reflection",
742 NO_STR
743 "BGP specific commands\n"
744 "Configure client to client route reflection\n"
745 "reflection of routes allowed\n")
746{
747 struct bgp *bgp;
748
749 bgp = vty->index;
750 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
751 return CMD_SUCCESS;
752}
753
754/* "bgp always-compare-med" configuration. */
755DEFUN (bgp_always_compare_med,
756 bgp_always_compare_med_cmd,
757 "bgp always-compare-med",
758 "BGP specific commands\n"
759 "Allow comparing MED from different neighbors\n")
760{
761 struct bgp *bgp;
762
763 bgp = vty->index;
764 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
765 return CMD_SUCCESS;
766}
767
768DEFUN (no_bgp_always_compare_med,
769 no_bgp_always_compare_med_cmd,
770 "no bgp always-compare-med",
771 NO_STR
772 "BGP specific commands\n"
773 "Allow comparing MED from different neighbors\n")
774{
775 struct bgp *bgp;
776
777 bgp = vty->index;
778 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
779 return CMD_SUCCESS;
780}
781
782/* "bgp deterministic-med" configuration. */
783DEFUN (bgp_deterministic_med,
784 bgp_deterministic_med_cmd,
785 "bgp deterministic-med",
786 "BGP specific commands\n"
787 "Pick the best-MED path among paths advertised from the neighboring AS\n")
788{
789 struct bgp *bgp;
790
791 bgp = vty->index;
792 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
793 return CMD_SUCCESS;
794}
795
796DEFUN (no_bgp_deterministic_med,
797 no_bgp_deterministic_med_cmd,
798 "no bgp deterministic-med",
799 NO_STR
800 "BGP specific commands\n"
801 "Pick the best-MED path among paths advertised from the neighboring AS\n")
802{
803 struct bgp *bgp;
804
805 bgp = vty->index;
806 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
807 return CMD_SUCCESS;
808}
hasso538621f2004-05-21 09:31:30 +0000809
810/* "bgp graceful-restart" configuration. */
811DEFUN (bgp_graceful_restart,
812 bgp_graceful_restart_cmd,
813 "bgp graceful-restart",
814 "BGP specific commands\n"
815 "Graceful restart capability parameters\n")
816{
817 struct bgp *bgp;
818
819 bgp = vty->index;
820 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
821 return CMD_SUCCESS;
822}
823
824DEFUN (no_bgp_graceful_restart,
825 no_bgp_graceful_restart_cmd,
826 "no bgp graceful-restart",
827 NO_STR
828 "BGP specific commands\n"
829 "Graceful restart capability parameters\n")
830{
831 struct bgp *bgp;
832
833 bgp = vty->index;
834 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
835 return CMD_SUCCESS;
836}
837
hasso93406d82005-02-02 14:40:33 +0000838DEFUN (bgp_graceful_restart_stalepath_time,
839 bgp_graceful_restart_stalepath_time_cmd,
840 "bgp graceful-restart stalepath-time <1-3600>",
841 "BGP specific commands\n"
842 "Graceful restart capability parameters\n"
843 "Set the max time to hold onto restarting peer's stale paths\n"
844 "Delay value (seconds)\n")
845{
846 struct bgp *bgp;
847 u_int32_t stalepath;
848
849 bgp = vty->index;
850 if (! bgp)
851 return CMD_WARNING;
852
853 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
854 bgp->stalepath_time = stalepath;
855 return CMD_SUCCESS;
856}
857
858DEFUN (no_bgp_graceful_restart_stalepath_time,
859 no_bgp_graceful_restart_stalepath_time_cmd,
860 "no bgp graceful-restart stalepath-time",
861 NO_STR
862 "BGP specific commands\n"
863 "Graceful restart capability parameters\n"
864 "Set the max time to hold onto restarting peer's stale paths\n")
865{
866 struct bgp *bgp;
867
868 bgp = vty->index;
869 if (! bgp)
870 return CMD_WARNING;
871
872 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
873 return CMD_SUCCESS;
874}
875
876ALIAS (no_bgp_graceful_restart_stalepath_time,
877 no_bgp_graceful_restart_stalepath_time_val_cmd,
878 "no bgp graceful-restart stalepath-time <1-3600>",
879 NO_STR
880 "BGP specific commands\n"
881 "Graceful restart capability parameters\n"
882 "Set the max time to hold onto restarting peer's stale paths\n"
883 "Delay value (seconds)\n")
884
paul718e3742002-12-13 20:15:29 +0000885/* "bgp fast-external-failover" configuration. */
886DEFUN (bgp_fast_external_failover,
887 bgp_fast_external_failover_cmd,
888 "bgp fast-external-failover",
889 BGP_STR
890 "Immediately reset session if a link to a directly connected external peer goes down\n")
891{
892 struct bgp *bgp;
893
894 bgp = vty->index;
895 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
896 return CMD_SUCCESS;
897}
898
899DEFUN (no_bgp_fast_external_failover,
900 no_bgp_fast_external_failover_cmd,
901 "no bgp fast-external-failover",
902 NO_STR
903 BGP_STR
904 "Immediately reset session if a link to a directly connected external peer goes down\n")
905{
906 struct bgp *bgp;
907
908 bgp = vty->index;
909 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
910 return CMD_SUCCESS;
911}
912
913/* "bgp enforce-first-as" configuration. */
914DEFUN (bgp_enforce_first_as,
915 bgp_enforce_first_as_cmd,
916 "bgp enforce-first-as",
917 BGP_STR
918 "Enforce the first AS for EBGP routes\n")
919{
920 struct bgp *bgp;
921
922 bgp = vty->index;
923 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
924 return CMD_SUCCESS;
925}
926
927DEFUN (no_bgp_enforce_first_as,
928 no_bgp_enforce_first_as_cmd,
929 "no bgp enforce-first-as",
930 NO_STR
931 BGP_STR
932 "Enforce the first AS for EBGP routes\n")
933{
934 struct bgp *bgp;
935
936 bgp = vty->index;
937 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
938 return CMD_SUCCESS;
939}
940
941/* "bgp bestpath compare-routerid" configuration. */
942DEFUN (bgp_bestpath_compare_router_id,
943 bgp_bestpath_compare_router_id_cmd,
944 "bgp bestpath compare-routerid",
945 "BGP specific commands\n"
946 "Change the default bestpath selection\n"
947 "Compare router-id for identical EBGP paths\n")
948{
949 struct bgp *bgp;
950
951 bgp = vty->index;
952 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
953 return CMD_SUCCESS;
954}
955
956DEFUN (no_bgp_bestpath_compare_router_id,
957 no_bgp_bestpath_compare_router_id_cmd,
958 "no bgp bestpath compare-routerid",
959 NO_STR
960 "BGP specific commands\n"
961 "Change the default bestpath selection\n"
962 "Compare router-id for identical EBGP paths\n")
963{
964 struct bgp *bgp;
965
966 bgp = vty->index;
967 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
968 return CMD_SUCCESS;
969}
970
971/* "bgp bestpath as-path ignore" configuration. */
972DEFUN (bgp_bestpath_aspath_ignore,
973 bgp_bestpath_aspath_ignore_cmd,
974 "bgp bestpath as-path ignore",
975 "BGP specific commands\n"
976 "Change the default bestpath selection\n"
977 "AS-path attribute\n"
978 "Ignore as-path length in selecting a route\n")
979{
980 struct bgp *bgp;
981
982 bgp = vty->index;
983 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
984 return CMD_SUCCESS;
985}
986
987DEFUN (no_bgp_bestpath_aspath_ignore,
988 no_bgp_bestpath_aspath_ignore_cmd,
989 "no bgp bestpath as-path ignore",
990 NO_STR
991 "BGP specific commands\n"
992 "Change the default bestpath selection\n"
993 "AS-path attribute\n"
994 "Ignore as-path length in selecting a route\n")
995{
996 struct bgp *bgp;
997
998 bgp = vty->index;
999 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1000 return CMD_SUCCESS;
1001}
1002
hasso68118452005-04-08 15:40:36 +00001003/* "bgp bestpath as-path confed" configuration. */
1004DEFUN (bgp_bestpath_aspath_confed,
1005 bgp_bestpath_aspath_confed_cmd,
1006 "bgp bestpath as-path confed",
1007 "BGP specific commands\n"
1008 "Change the default bestpath selection\n"
1009 "AS-path attribute\n"
1010 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1011{
1012 struct bgp *bgp;
1013
1014 bgp = vty->index;
1015 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1016 return CMD_SUCCESS;
1017}
1018
1019DEFUN (no_bgp_bestpath_aspath_confed,
1020 no_bgp_bestpath_aspath_confed_cmd,
1021 "no bgp bestpath as-path confed",
1022 NO_STR
1023 "BGP specific commands\n"
1024 "Change the default bestpath selection\n"
1025 "AS-path attribute\n"
1026 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1027{
1028 struct bgp *bgp;
1029
1030 bgp = vty->index;
1031 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1032 return CMD_SUCCESS;
1033}
1034
paul848973c2003-08-13 00:32:49 +00001035/* "bgp log-neighbor-changes" configuration. */
1036DEFUN (bgp_log_neighbor_changes,
1037 bgp_log_neighbor_changes_cmd,
1038 "bgp log-neighbor-changes",
1039 "BGP specific commands\n"
1040 "Log neighbor up/down and reset reason\n")
1041{
1042 struct bgp *bgp;
1043
1044 bgp = vty->index;
1045 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1046 return CMD_SUCCESS;
1047}
1048
1049DEFUN (no_bgp_log_neighbor_changes,
1050 no_bgp_log_neighbor_changes_cmd,
1051 "no bgp log-neighbor-changes",
1052 NO_STR
1053 "BGP specific commands\n"
1054 "Log neighbor up/down and reset reason\n")
1055{
1056 struct bgp *bgp;
1057
1058 bgp = vty->index;
1059 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1060 return CMD_SUCCESS;
1061}
1062
paul718e3742002-12-13 20:15:29 +00001063/* "bgp bestpath med" configuration. */
1064DEFUN (bgp_bestpath_med,
1065 bgp_bestpath_med_cmd,
1066 "bgp bestpath med (confed|missing-as-worst)",
1067 "BGP specific commands\n"
1068 "Change the default bestpath selection\n"
1069 "MED attribute\n"
1070 "Compare MED among confederation paths\n"
1071 "Treat missing MED as the least preferred one\n")
1072{
1073 struct bgp *bgp;
1074
1075 bgp = vty->index;
1076
1077 if (strncmp (argv[0], "confed", 1) == 0)
1078 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1079 else
1080 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1081
1082 return CMD_SUCCESS;
1083}
1084
1085DEFUN (bgp_bestpath_med2,
1086 bgp_bestpath_med2_cmd,
1087 "bgp bestpath med confed missing-as-worst",
1088 "BGP specific commands\n"
1089 "Change the default bestpath selection\n"
1090 "MED attribute\n"
1091 "Compare MED among confederation paths\n"
1092 "Treat missing MED as the least preferred one\n")
1093{
1094 struct bgp *bgp;
1095
1096 bgp = vty->index;
1097 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1098 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1099 return CMD_SUCCESS;
1100}
1101
1102ALIAS (bgp_bestpath_med2,
1103 bgp_bestpath_med3_cmd,
1104 "bgp bestpath med missing-as-worst confed",
1105 "BGP specific commands\n"
1106 "Change the default bestpath selection\n"
1107 "MED attribute\n"
1108 "Treat missing MED as the least preferred one\n"
1109 "Compare MED among confederation paths\n")
1110
1111DEFUN (no_bgp_bestpath_med,
1112 no_bgp_bestpath_med_cmd,
1113 "no bgp bestpath med (confed|missing-as-worst)",
1114 NO_STR
1115 "BGP specific commands\n"
1116 "Change the default bestpath selection\n"
1117 "MED attribute\n"
1118 "Compare MED among confederation paths\n"
1119 "Treat missing MED as the least preferred one\n")
1120{
1121 struct bgp *bgp;
1122
1123 bgp = vty->index;
1124
1125 if (strncmp (argv[0], "confed", 1) == 0)
1126 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1127 else
1128 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1129
1130 return CMD_SUCCESS;
1131}
1132
1133DEFUN (no_bgp_bestpath_med2,
1134 no_bgp_bestpath_med2_cmd,
1135 "no bgp bestpath med confed missing-as-worst",
1136 NO_STR
1137 "BGP specific commands\n"
1138 "Change the default bestpath selection\n"
1139 "MED attribute\n"
1140 "Compare MED among confederation paths\n"
1141 "Treat missing MED as the least preferred one\n")
1142{
1143 struct bgp *bgp;
1144
1145 bgp = vty->index;
1146 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1147 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1148 return CMD_SUCCESS;
1149}
1150
1151ALIAS (no_bgp_bestpath_med2,
1152 no_bgp_bestpath_med3_cmd,
1153 "no bgp bestpath med missing-as-worst confed",
1154 NO_STR
1155 "BGP specific commands\n"
1156 "Change the default bestpath selection\n"
1157 "MED attribute\n"
1158 "Treat missing MED as the least preferred one\n"
1159 "Compare MED among confederation paths\n")
1160
1161/* "no bgp default ipv4-unicast". */
1162DEFUN (no_bgp_default_ipv4_unicast,
1163 no_bgp_default_ipv4_unicast_cmd,
1164 "no bgp default ipv4-unicast",
1165 NO_STR
1166 "BGP specific commands\n"
1167 "Configure BGP defaults\n"
1168 "Activate ipv4-unicast for a peer by default\n")
1169{
1170 struct bgp *bgp;
1171
1172 bgp = vty->index;
1173 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1174 return CMD_SUCCESS;
1175}
1176
1177DEFUN (bgp_default_ipv4_unicast,
1178 bgp_default_ipv4_unicast_cmd,
1179 "bgp default ipv4-unicast",
1180 "BGP specific commands\n"
1181 "Configure BGP defaults\n"
1182 "Activate ipv4-unicast for a peer by default\n")
1183{
1184 struct bgp *bgp;
1185
1186 bgp = vty->index;
1187 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1188 return CMD_SUCCESS;
1189}
1190
1191/* "bgp import-check" configuration. */
1192DEFUN (bgp_network_import_check,
1193 bgp_network_import_check_cmd,
1194 "bgp network import-check",
1195 "BGP specific commands\n"
1196 "BGP network command\n"
1197 "Check BGP network route exists in IGP\n")
1198{
1199 struct bgp *bgp;
1200
1201 bgp = vty->index;
1202 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1203 return CMD_SUCCESS;
1204}
1205
1206DEFUN (no_bgp_network_import_check,
1207 no_bgp_network_import_check_cmd,
1208 "no bgp network import-check",
1209 NO_STR
1210 "BGP specific commands\n"
1211 "BGP network command\n"
1212 "Check BGP network route exists in IGP\n")
1213{
1214 struct bgp *bgp;
1215
1216 bgp = vty->index;
1217 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1218 return CMD_SUCCESS;
1219}
1220
1221DEFUN (bgp_default_local_preference,
1222 bgp_default_local_preference_cmd,
1223 "bgp default local-preference <0-4294967295>",
1224 "BGP specific commands\n"
1225 "Configure BGP defaults\n"
1226 "local preference (higher=more preferred)\n"
1227 "Configure default local preference value\n")
1228{
1229 struct bgp *bgp;
1230 u_int32_t local_pref;
1231
1232 bgp = vty->index;
1233
1234 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1235
1236 bgp_default_local_preference_set (bgp, local_pref);
1237
1238 return CMD_SUCCESS;
1239}
1240
1241DEFUN (no_bgp_default_local_preference,
1242 no_bgp_default_local_preference_cmd,
1243 "no bgp default local-preference",
1244 NO_STR
1245 "BGP specific commands\n"
1246 "Configure BGP defaults\n"
1247 "local preference (higher=more preferred)\n")
1248{
1249 struct bgp *bgp;
1250
1251 bgp = vty->index;
1252 bgp_default_local_preference_unset (bgp);
1253 return CMD_SUCCESS;
1254}
1255
1256ALIAS (no_bgp_default_local_preference,
1257 no_bgp_default_local_preference_val_cmd,
1258 "no bgp default local-preference <0-4294967295>",
1259 NO_STR
1260 "BGP specific commands\n"
1261 "Configure BGP defaults\n"
1262 "local preference (higher=more preferred)\n"
1263 "Configure default local preference value\n")
1264
1265static int
paulfd79ac92004-10-13 05:06:08 +00001266peer_remote_as_vty (struct vty *vty, const char *peer_str,
1267 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001268{
1269 int ret;
1270 struct bgp *bgp;
1271 as_t as;
1272 union sockunion su;
1273
1274 bgp = vty->index;
1275
1276 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001277 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001278
1279 /* If peer is peer group, call proper function. */
1280 ret = str2sockunion (peer_str, &su);
1281 if (ret < 0)
1282 {
1283 ret = peer_group_remote_as (bgp, peer_str, &as);
1284 if (ret < 0)
1285 {
1286 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1287 return CMD_WARNING;
1288 }
1289 return CMD_SUCCESS;
1290 }
1291
1292 if (peer_address_self_check (&su))
1293 {
1294 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1295 VTY_NEWLINE);
1296 return CMD_WARNING;
1297 }
1298
1299 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1300
1301 /* This peer belongs to peer group. */
1302 switch (ret)
1303 {
1304 case BGP_ERR_PEER_GROUP_MEMBER:
1305 vty_out (vty, "%% Peer-group AS %d. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
1306 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001307 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
1308 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);
1309 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001310 }
1311 return bgp_vty_return (vty, ret);
1312}
1313
1314DEFUN (neighbor_remote_as,
1315 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001316 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001317 NEIGHBOR_STR
1318 NEIGHBOR_ADDR_STR2
1319 "Specify a BGP neighbor\n"
1320 AS_STR)
1321{
1322 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1323}
1324
1325DEFUN (neighbor_peer_group,
1326 neighbor_peer_group_cmd,
1327 "neighbor WORD peer-group",
1328 NEIGHBOR_STR
1329 "Neighbor tag\n"
1330 "Configure peer-group\n")
1331{
1332 struct bgp *bgp;
1333 struct peer_group *group;
1334
1335 bgp = vty->index;
1336
1337 group = peer_group_get (bgp, argv[0]);
1338 if (! group)
1339 return CMD_WARNING;
1340
1341 return CMD_SUCCESS;
1342}
1343
1344DEFUN (no_neighbor,
1345 no_neighbor_cmd,
1346 NO_NEIGHBOR_CMD2,
1347 NO_STR
1348 NEIGHBOR_STR
1349 NEIGHBOR_ADDR_STR2)
1350{
1351 int ret;
1352 union sockunion su;
1353 struct peer_group *group;
1354 struct peer *peer;
1355
1356 ret = str2sockunion (argv[0], &su);
1357 if (ret < 0)
1358 {
1359 group = peer_group_lookup (vty->index, argv[0]);
1360 if (group)
1361 peer_group_delete (group);
1362 else
1363 {
1364 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1365 return CMD_WARNING;
1366 }
1367 }
1368 else
1369 {
1370 peer = peer_lookup (vty->index, &su);
1371 if (peer)
paul200df112005-06-01 11:17:05 +00001372 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001373 }
1374
1375 return CMD_SUCCESS;
1376}
1377
1378ALIAS (no_neighbor,
1379 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001380 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001381 NO_STR
1382 NEIGHBOR_STR
1383 NEIGHBOR_ADDR_STR
1384 "Specify a BGP neighbor\n"
1385 AS_STR)
1386
1387DEFUN (no_neighbor_peer_group,
1388 no_neighbor_peer_group_cmd,
1389 "no neighbor WORD peer-group",
1390 NO_STR
1391 NEIGHBOR_STR
1392 "Neighbor tag\n"
1393 "Configure peer-group\n")
1394{
1395 struct peer_group *group;
1396
1397 group = peer_group_lookup (vty->index, argv[0]);
1398 if (group)
1399 peer_group_delete (group);
1400 else
1401 {
1402 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1403 return CMD_WARNING;
1404 }
1405 return CMD_SUCCESS;
1406}
1407
1408DEFUN (no_neighbor_peer_group_remote_as,
1409 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001410 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001411 NO_STR
1412 NEIGHBOR_STR
1413 "Neighbor tag\n"
1414 "Specify a BGP neighbor\n"
1415 AS_STR)
1416{
1417 struct peer_group *group;
1418
1419 group = peer_group_lookup (vty->index, argv[0]);
1420 if (group)
1421 peer_group_remote_as_delete (group);
1422 else
1423 {
1424 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1425 return CMD_WARNING;
1426 }
1427 return CMD_SUCCESS;
1428}
1429
1430DEFUN (neighbor_local_as,
1431 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001432 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001433 NEIGHBOR_STR
1434 NEIGHBOR_ADDR_STR2
1435 "Specify a local-as number\n"
1436 "AS number used as local AS\n")
1437{
1438 struct peer *peer;
1439 int ret;
1440
1441 peer = peer_and_group_lookup_vty (vty, argv[0]);
1442 if (! peer)
1443 return CMD_WARNING;
1444
1445 ret = peer_local_as_set (peer, atoi (argv[1]), 0);
1446 return bgp_vty_return (vty, ret);
1447}
1448
1449DEFUN (neighbor_local_as_no_prepend,
1450 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001451 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001452 NEIGHBOR_STR
1453 NEIGHBOR_ADDR_STR2
1454 "Specify a local-as number\n"
1455 "AS number used as local AS\n"
1456 "Do not prepend local-as to updates from ebgp peers\n")
1457{
1458 struct peer *peer;
1459 int ret;
1460
1461 peer = peer_and_group_lookup_vty (vty, argv[0]);
1462 if (! peer)
1463 return CMD_WARNING;
1464
1465 ret = peer_local_as_set (peer, atoi (argv[1]), 1);
1466 return bgp_vty_return (vty, ret);
1467}
1468
1469DEFUN (no_neighbor_local_as,
1470 no_neighbor_local_as_cmd,
1471 NO_NEIGHBOR_CMD2 "local-as",
1472 NO_STR
1473 NEIGHBOR_STR
1474 NEIGHBOR_ADDR_STR2
1475 "Specify a local-as number\n")
1476{
1477 struct peer *peer;
1478 int ret;
1479
1480 peer = peer_and_group_lookup_vty (vty, argv[0]);
1481 if (! peer)
1482 return CMD_WARNING;
1483
1484 ret = peer_local_as_unset (peer);
1485 return bgp_vty_return (vty, ret);
1486}
1487
1488ALIAS (no_neighbor_local_as,
1489 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001490 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001491 NO_STR
1492 NEIGHBOR_STR
1493 NEIGHBOR_ADDR_STR2
1494 "Specify a local-as number\n"
1495 "AS number used as local AS\n")
1496
1497ALIAS (no_neighbor_local_as,
1498 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001499 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001500 NO_STR
1501 NEIGHBOR_STR
1502 NEIGHBOR_ADDR_STR2
1503 "Specify a local-as number\n"
1504 "AS number used as local AS\n"
1505 "Do not prepend local-as to updates from ebgp peers\n")
1506
Paul Jakma0df7c912008-07-21 21:02:49 +00001507DEFUN (neighbor_password,
1508 neighbor_password_cmd,
1509 NEIGHBOR_CMD2 "password LINE",
1510 NEIGHBOR_STR
1511 NEIGHBOR_ADDR_STR2
1512 "Set a password\n"
1513 "The password\n")
1514{
1515 struct peer *peer;
1516 int ret;
1517
1518 peer = peer_and_group_lookup_vty (vty, argv[0]);
1519 if (! peer)
1520 return CMD_WARNING;
1521
1522 ret = peer_password_set (peer, argv[1]);
1523 return bgp_vty_return (vty, ret);
1524}
1525
1526DEFUN (no_neighbor_password,
1527 no_neighbor_password_cmd,
1528 NO_NEIGHBOR_CMD2 "password",
1529 NO_STR
1530 NEIGHBOR_STR
1531 NEIGHBOR_ADDR_STR2
1532 "Set a password\n")
1533{
1534 struct peer *peer;
1535 int ret;
1536
1537 peer = peer_and_group_lookup_vty (vty, argv[0]);
1538 if (! peer)
1539 return CMD_WARNING;
1540
1541 ret = peer_password_unset (peer);
1542 return bgp_vty_return (vty, ret);
1543}
1544
paul718e3742002-12-13 20:15:29 +00001545DEFUN (neighbor_activate,
1546 neighbor_activate_cmd,
1547 NEIGHBOR_CMD2 "activate",
1548 NEIGHBOR_STR
1549 NEIGHBOR_ADDR_STR2
1550 "Enable the Address Family for this Neighbor\n")
1551{
1552 struct peer *peer;
1553
1554 peer = peer_and_group_lookup_vty (vty, argv[0]);
1555 if (! peer)
1556 return CMD_WARNING;
1557
1558 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1559
1560 return CMD_SUCCESS;
1561}
1562
1563DEFUN (no_neighbor_activate,
1564 no_neighbor_activate_cmd,
1565 NO_NEIGHBOR_CMD2 "activate",
1566 NO_STR
1567 NEIGHBOR_STR
1568 NEIGHBOR_ADDR_STR2
1569 "Enable the Address Family for this Neighbor\n")
1570{
1571 int ret;
1572 struct peer *peer;
1573
1574 /* Lookup peer. */
1575 peer = peer_and_group_lookup_vty (vty, argv[0]);
1576 if (! peer)
1577 return CMD_WARNING;
1578
1579 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1580
1581 return bgp_vty_return (vty, ret);
1582}
1583
1584DEFUN (neighbor_set_peer_group,
1585 neighbor_set_peer_group_cmd,
1586 NEIGHBOR_CMD "peer-group WORD",
1587 NEIGHBOR_STR
1588 NEIGHBOR_ADDR_STR
1589 "Member of the peer-group\n"
1590 "peer-group name\n")
1591{
1592 int ret;
1593 as_t as;
1594 union sockunion su;
1595 struct bgp *bgp;
1596 struct peer_group *group;
1597
1598 bgp = vty->index;
1599
1600 ret = str2sockunion (argv[0], &su);
1601 if (ret < 0)
1602 {
1603 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1604 return CMD_WARNING;
1605 }
1606
1607 group = peer_group_lookup (bgp, argv[1]);
1608 if (! group)
1609 {
1610 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1611 return CMD_WARNING;
1612 }
1613
1614 if (peer_address_self_check (&su))
1615 {
1616 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1617 VTY_NEWLINE);
1618 return CMD_WARNING;
1619 }
1620
1621 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1622 bgp_node_safi (vty), &as);
1623
1624 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1625 {
1626 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);
1627 return CMD_WARNING;
1628 }
1629
1630 return bgp_vty_return (vty, ret);
1631}
1632
1633DEFUN (no_neighbor_set_peer_group,
1634 no_neighbor_set_peer_group_cmd,
1635 NO_NEIGHBOR_CMD "peer-group WORD",
1636 NO_STR
1637 NEIGHBOR_STR
1638 NEIGHBOR_ADDR_STR
1639 "Member of the peer-group\n"
1640 "peer-group name\n")
1641{
1642 int ret;
1643 struct bgp *bgp;
1644 struct peer *peer;
1645 struct peer_group *group;
1646
1647 bgp = vty->index;
1648
1649 peer = peer_lookup_vty (vty, argv[0]);
1650 if (! peer)
1651 return CMD_WARNING;
1652
1653 group = peer_group_lookup (bgp, argv[1]);
1654 if (! group)
1655 {
1656 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1657 return CMD_WARNING;
1658 }
1659
1660 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1661 bgp_node_safi (vty));
1662
1663 return bgp_vty_return (vty, ret);
1664}
1665
paul94f2b392005-06-28 12:44:16 +00001666static int
paulfd79ac92004-10-13 05:06:08 +00001667peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1668 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001669{
1670 int ret;
1671 struct peer *peer;
1672
1673 peer = peer_and_group_lookup_vty (vty, ip_str);
1674 if (! peer)
1675 return CMD_WARNING;
1676
1677 if (set)
1678 ret = peer_flag_set (peer, flag);
1679 else
1680 ret = peer_flag_unset (peer, flag);
1681
1682 return bgp_vty_return (vty, ret);
1683}
1684
paul94f2b392005-06-28 12:44:16 +00001685static int
paulfd79ac92004-10-13 05:06:08 +00001686peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001687{
1688 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1689}
1690
paul94f2b392005-06-28 12:44:16 +00001691static int
paulfd79ac92004-10-13 05:06:08 +00001692peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001693{
1694 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1695}
1696
1697/* neighbor passive. */
1698DEFUN (neighbor_passive,
1699 neighbor_passive_cmd,
1700 NEIGHBOR_CMD2 "passive",
1701 NEIGHBOR_STR
1702 NEIGHBOR_ADDR_STR2
1703 "Don't send open messages to this neighbor\n")
1704{
1705 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1706}
1707
1708DEFUN (no_neighbor_passive,
1709 no_neighbor_passive_cmd,
1710 NO_NEIGHBOR_CMD2 "passive",
1711 NO_STR
1712 NEIGHBOR_STR
1713 NEIGHBOR_ADDR_STR2
1714 "Don't send open messages to this neighbor\n")
1715{
1716 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1717}
1718
1719/* neighbor shutdown. */
1720DEFUN (neighbor_shutdown,
1721 neighbor_shutdown_cmd,
1722 NEIGHBOR_CMD2 "shutdown",
1723 NEIGHBOR_STR
1724 NEIGHBOR_ADDR_STR2
1725 "Administratively shut down this neighbor\n")
1726{
1727 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1728}
1729
1730DEFUN (no_neighbor_shutdown,
1731 no_neighbor_shutdown_cmd,
1732 NO_NEIGHBOR_CMD2 "shutdown",
1733 NO_STR
1734 NEIGHBOR_STR
1735 NEIGHBOR_ADDR_STR2
1736 "Administratively shut down this neighbor\n")
1737{
1738 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1739}
1740
hassoc9502432005-02-01 22:01:48 +00001741/* Deprecated neighbor capability route-refresh. */
1742DEFUN_DEPRECATED (neighbor_capability_route_refresh,
1743 neighbor_capability_route_refresh_cmd,
1744 NEIGHBOR_CMD2 "capability route-refresh",
1745 NEIGHBOR_STR
1746 NEIGHBOR_ADDR_STR2
1747 "Advertise capability to the peer\n"
1748 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001749{
hassoc9502432005-02-01 22:01:48 +00001750 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001751}
1752
hassoc9502432005-02-01 22:01:48 +00001753DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
1754 no_neighbor_capability_route_refresh_cmd,
1755 NO_NEIGHBOR_CMD2 "capability route-refresh",
1756 NO_STR
1757 NEIGHBOR_STR
1758 NEIGHBOR_ADDR_STR2
1759 "Advertise capability to the peer\n"
1760 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001761{
hassoc9502432005-02-01 22:01:48 +00001762 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001763}
1764
1765/* neighbor capability dynamic. */
1766DEFUN (neighbor_capability_dynamic,
1767 neighbor_capability_dynamic_cmd,
1768 NEIGHBOR_CMD2 "capability dynamic",
1769 NEIGHBOR_STR
1770 NEIGHBOR_ADDR_STR2
1771 "Advertise capability to the peer\n"
1772 "Advertise dynamic capability to this neighbor\n")
1773{
1774 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1775}
1776
1777DEFUN (no_neighbor_capability_dynamic,
1778 no_neighbor_capability_dynamic_cmd,
1779 NO_NEIGHBOR_CMD2 "capability dynamic",
1780 NO_STR
1781 NEIGHBOR_STR
1782 NEIGHBOR_ADDR_STR2
1783 "Advertise capability to the peer\n"
1784 "Advertise dynamic capability to this neighbor\n")
1785{
1786 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1787}
1788
1789/* neighbor dont-capability-negotiate */
1790DEFUN (neighbor_dont_capability_negotiate,
1791 neighbor_dont_capability_negotiate_cmd,
1792 NEIGHBOR_CMD2 "dont-capability-negotiate",
1793 NEIGHBOR_STR
1794 NEIGHBOR_ADDR_STR2
1795 "Do not perform capability negotiation\n")
1796{
1797 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
1798}
1799
1800DEFUN (no_neighbor_dont_capability_negotiate,
1801 no_neighbor_dont_capability_negotiate_cmd,
1802 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
1803 NO_STR
1804 NEIGHBOR_STR
1805 NEIGHBOR_ADDR_STR2
1806 "Do not perform capability negotiation\n")
1807{
1808 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
1809}
1810
paul94f2b392005-06-28 12:44:16 +00001811static int
paulfd79ac92004-10-13 05:06:08 +00001812peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00001813 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001814{
1815 int ret;
1816 struct peer *peer;
1817
1818 peer = peer_and_group_lookup_vty (vty, peer_str);
1819 if (! peer)
1820 return CMD_WARNING;
1821
1822 if (set)
1823 ret = peer_af_flag_set (peer, afi, safi, flag);
1824 else
1825 ret = peer_af_flag_unset (peer, afi, safi, flag);
1826
1827 return bgp_vty_return (vty, ret);
1828}
1829
paul94f2b392005-06-28 12:44:16 +00001830static int
paulfd79ac92004-10-13 05:06:08 +00001831peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00001832 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00001833{
1834 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
1835}
1836
paul94f2b392005-06-28 12:44:16 +00001837static int
paulfd79ac92004-10-13 05:06:08 +00001838peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00001839 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00001840{
1841 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
1842}
1843
1844/* neighbor capability orf prefix-list. */
1845DEFUN (neighbor_capability_orf_prefix,
1846 neighbor_capability_orf_prefix_cmd,
1847 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
1848 NEIGHBOR_STR
1849 NEIGHBOR_ADDR_STR2
1850 "Advertise capability to the peer\n"
1851 "Advertise ORF capability to the peer\n"
1852 "Advertise prefixlist ORF capability to this neighbor\n"
1853 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
1854 "Capability to RECEIVE the ORF from this neighbor\n"
1855 "Capability to SEND the ORF to this neighbor\n")
1856{
1857 u_int16_t flag = 0;
1858
1859 if (strncmp (argv[1], "s", 1) == 0)
1860 flag = PEER_FLAG_ORF_PREFIX_SM;
1861 else if (strncmp (argv[1], "r", 1) == 0)
1862 flag = PEER_FLAG_ORF_PREFIX_RM;
1863 else if (strncmp (argv[1], "b", 1) == 0)
1864 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
1865 else
1866 return CMD_WARNING;
1867
1868 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1869 bgp_node_safi (vty), flag);
1870}
1871
1872DEFUN (no_neighbor_capability_orf_prefix,
1873 no_neighbor_capability_orf_prefix_cmd,
1874 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
1875 NO_STR
1876 NEIGHBOR_STR
1877 NEIGHBOR_ADDR_STR2
1878 "Advertise capability to the peer\n"
1879 "Advertise ORF capability to the peer\n"
1880 "Advertise prefixlist ORF capability to this neighbor\n"
1881 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
1882 "Capability to RECEIVE the ORF from this neighbor\n"
1883 "Capability to SEND the ORF to this neighbor\n")
1884{
1885 u_int16_t flag = 0;
1886
1887 if (strncmp (argv[1], "s", 1) == 0)
1888 flag = PEER_FLAG_ORF_PREFIX_SM;
1889 else if (strncmp (argv[1], "r", 1) == 0)
1890 flag = PEER_FLAG_ORF_PREFIX_RM;
1891 else if (strncmp (argv[1], "b", 1) == 0)
1892 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
1893 else
1894 return CMD_WARNING;
1895
1896 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1897 bgp_node_safi (vty), flag);
1898}
1899
1900/* neighbor next-hop-self. */
1901DEFUN (neighbor_nexthop_self,
1902 neighbor_nexthop_self_cmd,
1903 NEIGHBOR_CMD2 "next-hop-self",
1904 NEIGHBOR_STR
1905 NEIGHBOR_ADDR_STR2
1906 "Disable the next hop calculation for this neighbor\n")
1907{
1908 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1909 bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
1910}
1911
1912DEFUN (no_neighbor_nexthop_self,
1913 no_neighbor_nexthop_self_cmd,
1914 NO_NEIGHBOR_CMD2 "next-hop-self",
1915 NO_STR
1916 NEIGHBOR_STR
1917 NEIGHBOR_ADDR_STR2
1918 "Disable the next hop calculation for this neighbor\n")
1919{
1920 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1921 bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
1922}
1923
1924/* neighbor remove-private-AS. */
1925DEFUN (neighbor_remove_private_as,
1926 neighbor_remove_private_as_cmd,
1927 NEIGHBOR_CMD2 "remove-private-AS",
1928 NEIGHBOR_STR
1929 NEIGHBOR_ADDR_STR2
1930 "Remove private AS number from outbound updates\n")
1931{
1932 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1933 bgp_node_safi (vty),
1934 PEER_FLAG_REMOVE_PRIVATE_AS);
1935}
1936
1937DEFUN (no_neighbor_remove_private_as,
1938 no_neighbor_remove_private_as_cmd,
1939 NO_NEIGHBOR_CMD2 "remove-private-AS",
1940 NO_STR
1941 NEIGHBOR_STR
1942 NEIGHBOR_ADDR_STR2
1943 "Remove private AS number from outbound updates\n")
1944{
1945 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1946 bgp_node_safi (vty),
1947 PEER_FLAG_REMOVE_PRIVATE_AS);
1948}
1949
1950/* neighbor send-community. */
1951DEFUN (neighbor_send_community,
1952 neighbor_send_community_cmd,
1953 NEIGHBOR_CMD2 "send-community",
1954 NEIGHBOR_STR
1955 NEIGHBOR_ADDR_STR2
1956 "Send Community attribute to this neighbor\n")
1957{
1958 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1959 bgp_node_safi (vty),
1960 PEER_FLAG_SEND_COMMUNITY);
1961}
1962
1963DEFUN (no_neighbor_send_community,
1964 no_neighbor_send_community_cmd,
1965 NO_NEIGHBOR_CMD2 "send-community",
1966 NO_STR
1967 NEIGHBOR_STR
1968 NEIGHBOR_ADDR_STR2
1969 "Send Community attribute to this neighbor\n")
1970{
1971 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1972 bgp_node_safi (vty),
1973 PEER_FLAG_SEND_COMMUNITY);
1974}
1975
1976/* neighbor send-community extended. */
1977DEFUN (neighbor_send_community_type,
1978 neighbor_send_community_type_cmd,
1979 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
1980 NEIGHBOR_STR
1981 NEIGHBOR_ADDR_STR2
1982 "Send Community attribute to this neighbor\n"
1983 "Send Standard and Extended Community attributes\n"
1984 "Send Extended Community attributes\n"
1985 "Send Standard Community attributes\n")
1986{
1987 if (strncmp (argv[1], "s", 1) == 0)
1988 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1989 bgp_node_safi (vty),
1990 PEER_FLAG_SEND_COMMUNITY);
1991 if (strncmp (argv[1], "e", 1) == 0)
1992 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1993 bgp_node_safi (vty),
1994 PEER_FLAG_SEND_EXT_COMMUNITY);
1995
1996 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1997 bgp_node_safi (vty),
1998 (PEER_FLAG_SEND_COMMUNITY|
1999 PEER_FLAG_SEND_EXT_COMMUNITY));
2000}
2001
2002DEFUN (no_neighbor_send_community_type,
2003 no_neighbor_send_community_type_cmd,
2004 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2005 NO_STR
2006 NEIGHBOR_STR
2007 NEIGHBOR_ADDR_STR2
2008 "Send Community attribute to this neighbor\n"
2009 "Send Standard and Extended Community attributes\n"
2010 "Send Extended Community attributes\n"
2011 "Send Standard Community attributes\n")
2012{
2013 if (strncmp (argv[1], "s", 1) == 0)
2014 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2015 bgp_node_safi (vty),
2016 PEER_FLAG_SEND_COMMUNITY);
2017 if (strncmp (argv[1], "e", 1) == 0)
2018 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2019 bgp_node_safi (vty),
2020 PEER_FLAG_SEND_EXT_COMMUNITY);
2021
2022 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2023 bgp_node_safi (vty),
2024 (PEER_FLAG_SEND_COMMUNITY |
2025 PEER_FLAG_SEND_EXT_COMMUNITY));
2026}
2027
2028/* neighbor soft-reconfig. */
2029DEFUN (neighbor_soft_reconfiguration,
2030 neighbor_soft_reconfiguration_cmd,
2031 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2032 NEIGHBOR_STR
2033 NEIGHBOR_ADDR_STR2
2034 "Per neighbor soft reconfiguration\n"
2035 "Allow inbound soft reconfiguration for this neighbor\n")
2036{
2037 return peer_af_flag_set_vty (vty, argv[0],
2038 bgp_node_afi (vty), bgp_node_safi (vty),
2039 PEER_FLAG_SOFT_RECONFIG);
2040}
2041
2042DEFUN (no_neighbor_soft_reconfiguration,
2043 no_neighbor_soft_reconfiguration_cmd,
2044 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2045 NO_STR
2046 NEIGHBOR_STR
2047 NEIGHBOR_ADDR_STR2
2048 "Per neighbor soft reconfiguration\n"
2049 "Allow inbound soft reconfiguration for this neighbor\n")
2050{
2051 return peer_af_flag_unset_vty (vty, argv[0],
2052 bgp_node_afi (vty), bgp_node_safi (vty),
2053 PEER_FLAG_SOFT_RECONFIG);
2054}
2055
2056DEFUN (neighbor_route_reflector_client,
2057 neighbor_route_reflector_client_cmd,
2058 NEIGHBOR_CMD2 "route-reflector-client",
2059 NEIGHBOR_STR
2060 NEIGHBOR_ADDR_STR2
2061 "Configure a neighbor as Route Reflector client\n")
2062{
2063 struct peer *peer;
2064
2065
2066 peer = peer_and_group_lookup_vty (vty, argv[0]);
2067 if (! peer)
2068 return CMD_WARNING;
2069
2070 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2071 bgp_node_safi (vty),
2072 PEER_FLAG_REFLECTOR_CLIENT);
2073}
2074
2075DEFUN (no_neighbor_route_reflector_client,
2076 no_neighbor_route_reflector_client_cmd,
2077 NO_NEIGHBOR_CMD2 "route-reflector-client",
2078 NO_STR
2079 NEIGHBOR_STR
2080 NEIGHBOR_ADDR_STR2
2081 "Configure a neighbor as Route Reflector client\n")
2082{
2083 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2084 bgp_node_safi (vty),
2085 PEER_FLAG_REFLECTOR_CLIENT);
2086}
2087
paul94f2b392005-06-28 12:44:16 +00002088static int
paulfd79ac92004-10-13 05:06:08 +00002089peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2090 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002091{
2092 int ret;
2093 struct bgp *bgp;
2094 struct peer *peer;
2095 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002096 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002097 struct bgp_filter *pfilter;
2098 struct bgp_filter *gfilter;
2099
2100 bgp = vty->index;
2101
2102 peer = peer_and_group_lookup_vty (vty, peer_str);
2103 if ( ! peer )
2104 return CMD_WARNING;
2105
2106 /* If it is already a RS-Client, don't do anything. */
2107 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2108 return CMD_SUCCESS;
2109
2110 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002111 {
2112 peer = peer_lock (peer); /* rsclient peer list reference */
2113 listnode_add_sort (bgp->rsclient, peer);
2114 }
paulfee0f4c2004-09-13 05:12:46 +00002115
2116 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2117 if (ret < 0)
2118 return bgp_vty_return (vty, ret);
2119
Paul Jakma64e580a2006-02-21 01:09:01 +00002120 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002121 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
2122 peer->rib[afi][safi]->owner = peer;
2123
2124 /* Check for existing 'network' and 'redistribute' routes. */
2125 bgp_check_local_routes_rsclient (peer, afi, safi);
2126
2127 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2128 bgp_soft_reconfig_rsclient (peer, afi, safi);
2129
2130 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2131 {
2132 group = peer->group;
2133 gfilter = &peer->filter[afi][safi];
2134
paul1eb8ef22005-04-07 07:30:20 +00002135 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002136 {
2137 pfilter = &peer->filter[afi][safi];
2138
2139 /* Members of a non-RS-Client group should not be RS-Clients, as that
2140 is checked when the become part of the peer-group */
2141 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2142 if (ret < 0)
2143 return bgp_vty_return (vty, ret);
2144
2145 /* Make peer's RIB point to group's RIB. */
2146 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2147
2148 /* Import policy. */
2149 if (pfilter->map[RMAP_IMPORT].name)
2150 free (pfilter->map[RMAP_IMPORT].name);
2151 if (gfilter->map[RMAP_IMPORT].name)
2152 {
2153 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2154 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2155 }
2156 else
2157 {
2158 pfilter->map[RMAP_IMPORT].name = NULL;
2159 pfilter->map[RMAP_IMPORT].map =NULL;
2160 }
2161
2162 /* Export policy. */
2163 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2164 {
2165 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2166 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2167 }
2168 }
2169 }
2170 return CMD_SUCCESS;
2171}
2172
paul94f2b392005-06-28 12:44:16 +00002173static int
paulfd79ac92004-10-13 05:06:08 +00002174peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2175 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002176{
2177 int ret;
2178 struct bgp *bgp;
2179 struct peer *peer;
2180 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002181 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002182
2183 bgp = vty->index;
2184
2185 peer = peer_and_group_lookup_vty (vty, peer_str);
2186 if ( ! peer )
2187 return CMD_WARNING;
2188
2189 /* If it is not a RS-Client, don't do anything. */
2190 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2191 return CMD_SUCCESS;
2192
2193 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2194 {
2195 group = peer->group;
2196
paul1eb8ef22005-04-07 07:30:20 +00002197 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002198 {
2199 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2200 if (ret < 0)
2201 return bgp_vty_return (vty, ret);
2202
2203 peer->rib[afi][safi] = NULL;
2204 }
2205
2206 peer = group->conf;
2207 }
2208
2209 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2210 if (ret < 0)
2211 return bgp_vty_return (vty, ret);
2212
2213 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002214 {
2215 peer_unlock (peer); /* peer bgp rsclient reference */
2216 listnode_delete (bgp->rsclient, peer);
2217 }
paulfee0f4c2004-09-13 05:12:46 +00002218
Paul Jakmab608d5b2008-07-02 02:12:07 +00002219 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002220
2221 return CMD_SUCCESS;
2222}
2223
paul718e3742002-12-13 20:15:29 +00002224/* neighbor route-server-client. */
2225DEFUN (neighbor_route_server_client,
2226 neighbor_route_server_client_cmd,
2227 NEIGHBOR_CMD2 "route-server-client",
2228 NEIGHBOR_STR
2229 NEIGHBOR_ADDR_STR2
2230 "Configure a neighbor as Route Server client\n")
2231{
paulfee0f4c2004-09-13 05:12:46 +00002232 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2233 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002234}
2235
2236DEFUN (no_neighbor_route_server_client,
2237 no_neighbor_route_server_client_cmd,
2238 NO_NEIGHBOR_CMD2 "route-server-client",
2239 NO_STR
2240 NEIGHBOR_STR
2241 NEIGHBOR_ADDR_STR2
2242 "Configure a neighbor as Route Server client\n")
2243{
paulfee0f4c2004-09-13 05:12:46 +00002244 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2245 bgp_node_safi(vty));
2246}
2247
2248DEFUN (neighbor_nexthop_local_unchanged,
2249 neighbor_nexthop_local_unchanged_cmd,
2250 NEIGHBOR_CMD2 "nexthop-local unchanged",
2251 NEIGHBOR_STR
2252 NEIGHBOR_ADDR_STR2
2253 "Configure treatment of outgoing link-local nexthop attribute\n"
2254 "Leave link-local nexthop unchanged for this peer\n")
2255{
2256 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2257 bgp_node_safi (vty),
2258 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2259}
2260
2261DEFUN (no_neighbor_nexthop_local_unchanged,
2262 no_neighbor_nexthop_local_unchanged_cmd,
2263 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2264 NO_STR
2265 NEIGHBOR_STR
2266 NEIGHBOR_ADDR_STR2
2267 "Configure treatment of outgoing link-local-nexthop attribute\n"
2268 "Leave link-local nexthop unchanged for this peer\n")
2269{
paul718e3742002-12-13 20:15:29 +00002270 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2271 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002272 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002273}
2274
2275DEFUN (neighbor_attr_unchanged,
2276 neighbor_attr_unchanged_cmd,
2277 NEIGHBOR_CMD2 "attribute-unchanged",
2278 NEIGHBOR_STR
2279 NEIGHBOR_ADDR_STR2
2280 "BGP attribute is propagated unchanged to this neighbor\n")
2281{
2282 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2283 bgp_node_safi (vty),
2284 (PEER_FLAG_AS_PATH_UNCHANGED |
2285 PEER_FLAG_NEXTHOP_UNCHANGED |
2286 PEER_FLAG_MED_UNCHANGED));
2287}
2288
2289DEFUN (neighbor_attr_unchanged1,
2290 neighbor_attr_unchanged1_cmd,
2291 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2292 NEIGHBOR_STR
2293 NEIGHBOR_ADDR_STR2
2294 "BGP attribute is propagated unchanged to this neighbor\n"
2295 "As-path attribute\n"
2296 "Nexthop attribute\n"
2297 "Med attribute\n")
2298{
2299 u_int16_t flags = 0;
2300
2301 if (strncmp (argv[1], "as-path", 1) == 0)
2302 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2303 else if (strncmp (argv[1], "next-hop", 1) == 0)
2304 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2305 else if (strncmp (argv[1], "med", 1) == 0)
2306 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2307
2308 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2309 bgp_node_safi (vty), flags);
2310}
2311
2312DEFUN (neighbor_attr_unchanged2,
2313 neighbor_attr_unchanged2_cmd,
2314 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2315 NEIGHBOR_STR
2316 NEIGHBOR_ADDR_STR2
2317 "BGP attribute is propagated unchanged to this neighbor\n"
2318 "As-path attribute\n"
2319 "Nexthop attribute\n"
2320 "Med attribute\n")
2321{
2322 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2323
2324 if (strncmp (argv[1], "next-hop", 1) == 0)
2325 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2326 else if (strncmp (argv[1], "med", 1) == 0)
2327 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2328
2329 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2330 bgp_node_safi (vty), flags);
2331
2332}
2333
2334DEFUN (neighbor_attr_unchanged3,
2335 neighbor_attr_unchanged3_cmd,
2336 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2337 NEIGHBOR_STR
2338 NEIGHBOR_ADDR_STR2
2339 "BGP attribute is propagated unchanged to this neighbor\n"
2340 "Nexthop attribute\n"
2341 "As-path attribute\n"
2342 "Med attribute\n")
2343{
2344 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2345
2346 if (strncmp (argv[1], "as-path", 1) == 0)
2347 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2348 else if (strncmp (argv[1], "med", 1) == 0)
2349 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2350
2351 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2352 bgp_node_safi (vty), flags);
2353}
2354
2355DEFUN (neighbor_attr_unchanged4,
2356 neighbor_attr_unchanged4_cmd,
2357 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2358 NEIGHBOR_STR
2359 NEIGHBOR_ADDR_STR2
2360 "BGP attribute is propagated unchanged to this neighbor\n"
2361 "Med attribute\n"
2362 "As-path attribute\n"
2363 "Nexthop attribute\n")
2364{
2365 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2366
2367 if (strncmp (argv[1], "as-path", 1) == 0)
2368 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2369 else if (strncmp (argv[1], "next-hop", 1) == 0)
2370 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2371
2372 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2373 bgp_node_safi (vty), flags);
2374}
2375
2376ALIAS (neighbor_attr_unchanged,
2377 neighbor_attr_unchanged5_cmd,
2378 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2379 NEIGHBOR_STR
2380 NEIGHBOR_ADDR_STR2
2381 "BGP attribute is propagated unchanged to this neighbor\n"
2382 "As-path attribute\n"
2383 "Nexthop attribute\n"
2384 "Med attribute\n")
2385
2386ALIAS (neighbor_attr_unchanged,
2387 neighbor_attr_unchanged6_cmd,
2388 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2389 NEIGHBOR_STR
2390 NEIGHBOR_ADDR_STR2
2391 "BGP attribute is propagated unchanged to this neighbor\n"
2392 "As-path attribute\n"
2393 "Med attribute\n"
2394 "Nexthop attribute\n")
2395
2396ALIAS (neighbor_attr_unchanged,
2397 neighbor_attr_unchanged7_cmd,
2398 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2399 NEIGHBOR_STR
2400 NEIGHBOR_ADDR_STR2
2401 "BGP attribute is propagated unchanged to this neighbor\n"
2402 "Nexthop attribute\n"
2403 "Med attribute\n"
2404 "As-path attribute\n")
2405
2406ALIAS (neighbor_attr_unchanged,
2407 neighbor_attr_unchanged8_cmd,
2408 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2409 NEIGHBOR_STR
2410 NEIGHBOR_ADDR_STR2
2411 "BGP attribute is propagated unchanged to this neighbor\n"
2412 "Nexthop attribute\n"
2413 "As-path attribute\n"
2414 "Med attribute\n")
2415
2416ALIAS (neighbor_attr_unchanged,
2417 neighbor_attr_unchanged9_cmd,
2418 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2419 NEIGHBOR_STR
2420 NEIGHBOR_ADDR_STR2
2421 "BGP attribute is propagated unchanged to this neighbor\n"
2422 "Med attribute\n"
2423 "Nexthop attribute\n"
2424 "As-path attribute\n")
2425
2426ALIAS (neighbor_attr_unchanged,
2427 neighbor_attr_unchanged10_cmd,
2428 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2429 NEIGHBOR_STR
2430 NEIGHBOR_ADDR_STR2
2431 "BGP attribute is propagated unchanged to this neighbor\n"
2432 "Med attribute\n"
2433 "As-path attribute\n"
2434 "Nexthop attribute\n")
2435
2436DEFUN (no_neighbor_attr_unchanged,
2437 no_neighbor_attr_unchanged_cmd,
2438 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2439 NO_STR
2440 NEIGHBOR_STR
2441 NEIGHBOR_ADDR_STR2
2442 "BGP attribute is propagated unchanged to this neighbor\n")
2443{
2444 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2445 bgp_node_safi (vty),
2446 (PEER_FLAG_AS_PATH_UNCHANGED |
2447 PEER_FLAG_NEXTHOP_UNCHANGED |
2448 PEER_FLAG_MED_UNCHANGED));
2449}
2450
2451DEFUN (no_neighbor_attr_unchanged1,
2452 no_neighbor_attr_unchanged1_cmd,
2453 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2454 NO_STR
2455 NEIGHBOR_STR
2456 NEIGHBOR_ADDR_STR2
2457 "BGP attribute is propagated unchanged to this neighbor\n"
2458 "As-path attribute\n"
2459 "Nexthop attribute\n"
2460 "Med attribute\n")
2461{
2462 u_int16_t flags = 0;
2463
2464 if (strncmp (argv[1], "as-path", 1) == 0)
2465 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2466 else if (strncmp (argv[1], "next-hop", 1) == 0)
2467 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2468 else if (strncmp (argv[1], "med", 1) == 0)
2469 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2470
2471 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2472 bgp_node_safi (vty), flags);
2473}
2474
2475DEFUN (no_neighbor_attr_unchanged2,
2476 no_neighbor_attr_unchanged2_cmd,
2477 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2478 NO_STR
2479 NEIGHBOR_STR
2480 NEIGHBOR_ADDR_STR2
2481 "BGP attribute is propagated unchanged to this neighbor\n"
2482 "As-path attribute\n"
2483 "Nexthop attribute\n"
2484 "Med attribute\n")
2485{
2486 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2487
2488 if (strncmp (argv[1], "next-hop", 1) == 0)
2489 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2490 else if (strncmp (argv[1], "med", 1) == 0)
2491 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2492
2493 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2494 bgp_node_safi (vty), flags);
2495}
2496
2497DEFUN (no_neighbor_attr_unchanged3,
2498 no_neighbor_attr_unchanged3_cmd,
2499 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2500 NO_STR
2501 NEIGHBOR_STR
2502 NEIGHBOR_ADDR_STR2
2503 "BGP attribute is propagated unchanged to this neighbor\n"
2504 "Nexthop attribute\n"
2505 "As-path attribute\n"
2506 "Med attribute\n")
2507{
2508 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2509
2510 if (strncmp (argv[1], "as-path", 1) == 0)
2511 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2512 else if (strncmp (argv[1], "med", 1) == 0)
2513 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2514
2515 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2516 bgp_node_safi (vty), flags);
2517}
2518
2519DEFUN (no_neighbor_attr_unchanged4,
2520 no_neighbor_attr_unchanged4_cmd,
2521 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2522 NO_STR
2523 NEIGHBOR_STR
2524 NEIGHBOR_ADDR_STR2
2525 "BGP attribute is propagated unchanged to this neighbor\n"
2526 "Med attribute\n"
2527 "As-path attribute\n"
2528 "Nexthop attribute\n")
2529{
2530 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2531
2532 if (strncmp (argv[1], "as-path", 1) == 0)
2533 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2534 else if (strncmp (argv[1], "next-hop", 1) == 0)
2535 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2536
2537 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2538 bgp_node_safi (vty), flags);
2539}
2540
2541ALIAS (no_neighbor_attr_unchanged,
2542 no_neighbor_attr_unchanged5_cmd,
2543 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2544 NO_STR
2545 NEIGHBOR_STR
2546 NEIGHBOR_ADDR_STR2
2547 "BGP attribute is propagated unchanged to this neighbor\n"
2548 "As-path attribute\n"
2549 "Nexthop attribute\n"
2550 "Med attribute\n")
2551
2552ALIAS (no_neighbor_attr_unchanged,
2553 no_neighbor_attr_unchanged6_cmd,
2554 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2555 NO_STR
2556 NEIGHBOR_STR
2557 NEIGHBOR_ADDR_STR2
2558 "BGP attribute is propagated unchanged to this neighbor\n"
2559 "As-path attribute\n"
2560 "Med attribute\n"
2561 "Nexthop attribute\n")
2562
2563ALIAS (no_neighbor_attr_unchanged,
2564 no_neighbor_attr_unchanged7_cmd,
2565 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2566 NO_STR
2567 NEIGHBOR_STR
2568 NEIGHBOR_ADDR_STR2
2569 "BGP attribute is propagated unchanged to this neighbor\n"
2570 "Nexthop attribute\n"
2571 "Med attribute\n"
2572 "As-path attribute\n")
2573
2574ALIAS (no_neighbor_attr_unchanged,
2575 no_neighbor_attr_unchanged8_cmd,
2576 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2577 NO_STR
2578 NEIGHBOR_STR
2579 NEIGHBOR_ADDR_STR2
2580 "BGP attribute is propagated unchanged to this neighbor\n"
2581 "Nexthop attribute\n"
2582 "As-path attribute\n"
2583 "Med attribute\n")
2584
2585ALIAS (no_neighbor_attr_unchanged,
2586 no_neighbor_attr_unchanged9_cmd,
2587 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2588 NO_STR
2589 NEIGHBOR_STR
2590 NEIGHBOR_ADDR_STR2
2591 "BGP attribute is propagated unchanged to this neighbor\n"
2592 "Med attribute\n"
2593 "Nexthop attribute\n"
2594 "As-path attribute\n")
2595
2596ALIAS (no_neighbor_attr_unchanged,
2597 no_neighbor_attr_unchanged10_cmd,
2598 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2599 NO_STR
2600 NEIGHBOR_STR
2601 NEIGHBOR_ADDR_STR2
2602 "BGP attribute is propagated unchanged to this neighbor\n"
2603 "Med attribute\n"
2604 "As-path attribute\n"
2605 "Nexthop attribute\n")
2606
2607/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002608DEFUN_DEPRECATED (neighbor_transparent_as,
2609 neighbor_transparent_as_cmd,
2610 NEIGHBOR_CMD "transparent-as",
2611 NEIGHBOR_STR
2612 NEIGHBOR_ADDR_STR
2613 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002614{
2615 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2616 bgp_node_safi (vty),
2617 PEER_FLAG_AS_PATH_UNCHANGED);
2618}
2619
hassodd4c5932005-02-02 17:15:34 +00002620DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2621 neighbor_transparent_nexthop_cmd,
2622 NEIGHBOR_CMD "transparent-nexthop",
2623 NEIGHBOR_STR
2624 NEIGHBOR_ADDR_STR
2625 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002626{
2627 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2628 bgp_node_safi (vty),
2629 PEER_FLAG_NEXTHOP_UNCHANGED);
2630}
2631
2632/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00002633static int
paulfd79ac92004-10-13 05:06:08 +00002634peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2635 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002636{
2637 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002638 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002639
2640 peer = peer_and_group_lookup_vty (vty, ip_str);
2641 if (! peer)
2642 return CMD_WARNING;
2643
2644 if (! ttl_str)
2645 ttl = TTL_MAX;
2646 else
2647 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2648
2649 peer_ebgp_multihop_set (peer, ttl);
2650
2651 return CMD_SUCCESS;
2652}
2653
paul94f2b392005-06-28 12:44:16 +00002654static int
paulfd79ac92004-10-13 05:06:08 +00002655peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002656{
2657 struct peer *peer;
2658
2659 peer = peer_and_group_lookup_vty (vty, ip_str);
2660 if (! peer)
2661 return CMD_WARNING;
2662
2663 peer_ebgp_multihop_unset (peer);
2664
2665 return CMD_SUCCESS;
2666}
2667
2668/* neighbor ebgp-multihop. */
2669DEFUN (neighbor_ebgp_multihop,
2670 neighbor_ebgp_multihop_cmd,
2671 NEIGHBOR_CMD2 "ebgp-multihop",
2672 NEIGHBOR_STR
2673 NEIGHBOR_ADDR_STR2
2674 "Allow EBGP neighbors not on directly connected networks\n")
2675{
2676 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2677}
2678
2679DEFUN (neighbor_ebgp_multihop_ttl,
2680 neighbor_ebgp_multihop_ttl_cmd,
2681 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2682 NEIGHBOR_STR
2683 NEIGHBOR_ADDR_STR2
2684 "Allow EBGP neighbors not on directly connected networks\n"
2685 "maximum hop count\n")
2686{
2687 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
2688}
2689
2690DEFUN (no_neighbor_ebgp_multihop,
2691 no_neighbor_ebgp_multihop_cmd,
2692 NO_NEIGHBOR_CMD2 "ebgp-multihop",
2693 NO_STR
2694 NEIGHBOR_STR
2695 NEIGHBOR_ADDR_STR2
2696 "Allow EBGP neighbors not on directly connected networks\n")
2697{
2698 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
2699}
2700
2701ALIAS (no_neighbor_ebgp_multihop,
2702 no_neighbor_ebgp_multihop_ttl_cmd,
2703 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2704 NO_STR
2705 NEIGHBOR_STR
2706 NEIGHBOR_ADDR_STR2
2707 "Allow EBGP neighbors not on directly connected networks\n"
2708 "maximum hop count\n")
2709
hasso6ffd2072005-02-02 14:50:11 +00002710/* disable-connected-check */
2711DEFUN (neighbor_disable_connected_check,
2712 neighbor_disable_connected_check_cmd,
2713 NEIGHBOR_CMD2 "disable-connected-check",
2714 NEIGHBOR_STR
2715 NEIGHBOR_ADDR_STR2
2716 "one-hop away EBGP peer using loopback address\n")
2717{
2718 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2719}
2720
2721DEFUN (no_neighbor_disable_connected_check,
2722 no_neighbor_disable_connected_check_cmd,
2723 NO_NEIGHBOR_CMD2 "disable-connected-check",
2724 NO_STR
2725 NEIGHBOR_STR
2726 NEIGHBOR_ADDR_STR2
2727 "one-hop away EBGP peer using loopback address\n")
2728{
2729 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2730}
2731
paul718e3742002-12-13 20:15:29 +00002732/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00002733ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002734 neighbor_enforce_multihop_cmd,
2735 NEIGHBOR_CMD2 "enforce-multihop",
2736 NEIGHBOR_STR
2737 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002738 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00002739
hasso6ffd2072005-02-02 14:50:11 +00002740/* Enforce multihop. */
2741ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002742 no_neighbor_enforce_multihop_cmd,
2743 NO_NEIGHBOR_CMD2 "enforce-multihop",
2744 NO_STR
2745 NEIGHBOR_STR
2746 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002747 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00002748
2749DEFUN (neighbor_description,
2750 neighbor_description_cmd,
2751 NEIGHBOR_CMD2 "description .LINE",
2752 NEIGHBOR_STR
2753 NEIGHBOR_ADDR_STR2
2754 "Neighbor specific description\n"
2755 "Up to 80 characters describing this neighbor\n")
2756{
2757 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00002758 char *str;
paul718e3742002-12-13 20:15:29 +00002759
2760 peer = peer_and_group_lookup_vty (vty, argv[0]);
2761 if (! peer)
2762 return CMD_WARNING;
2763
2764 if (argc == 1)
2765 return CMD_SUCCESS;
2766
ajs3b8b1852005-01-29 18:19:13 +00002767 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00002768
2769 peer_description_set (peer, str);
2770
ajs3b8b1852005-01-29 18:19:13 +00002771 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00002772
2773 return CMD_SUCCESS;
2774}
2775
2776DEFUN (no_neighbor_description,
2777 no_neighbor_description_cmd,
2778 NO_NEIGHBOR_CMD2 "description",
2779 NO_STR
2780 NEIGHBOR_STR
2781 NEIGHBOR_ADDR_STR2
2782 "Neighbor specific description\n")
2783{
2784 struct peer *peer;
2785
2786 peer = peer_and_group_lookup_vty (vty, argv[0]);
2787 if (! peer)
2788 return CMD_WARNING;
2789
2790 peer_description_unset (peer);
2791
2792 return CMD_SUCCESS;
2793}
2794
2795ALIAS (no_neighbor_description,
2796 no_neighbor_description_val_cmd,
2797 NO_NEIGHBOR_CMD2 "description .LINE",
2798 NO_STR
2799 NEIGHBOR_STR
2800 NEIGHBOR_ADDR_STR2
2801 "Neighbor specific description\n"
2802 "Up to 80 characters describing this neighbor\n")
2803
2804/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00002805static int
paulfd79ac92004-10-13 05:06:08 +00002806peer_update_source_vty (struct vty *vty, const char *peer_str,
2807 const char *source_str)
paul718e3742002-12-13 20:15:29 +00002808{
2809 struct peer *peer;
2810 union sockunion *su;
2811
2812 peer = peer_and_group_lookup_vty (vty, peer_str);
2813 if (! peer)
2814 return CMD_WARNING;
2815
2816 if (source_str)
2817 {
2818 su = sockunion_str2su (source_str);
2819 if (su)
2820 {
2821 peer_update_source_addr_set (peer, su);
2822 sockunion_free (su);
2823 }
2824 else
2825 peer_update_source_if_set (peer, source_str);
2826 }
2827 else
2828 peer_update_source_unset (peer);
2829
2830 return CMD_SUCCESS;
2831}
2832
Paul Jakma369688c2006-05-23 22:27:55 +00002833#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|WORD)"
2834#define BGP_UPDATE_SOURCE_HELP_STR \
2835 "IPv4 address\n" \
2836 "Interface name\n"
2837
paul718e3742002-12-13 20:15:29 +00002838DEFUN (neighbor_update_source,
2839 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00002840 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00002841 NEIGHBOR_STR
2842 NEIGHBOR_ADDR_STR2
2843 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00002844 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00002845{
2846 return peer_update_source_vty (vty, argv[0], argv[1]);
2847}
2848
2849DEFUN (no_neighbor_update_source,
2850 no_neighbor_update_source_cmd,
2851 NO_NEIGHBOR_CMD2 "update-source",
2852 NO_STR
2853 NEIGHBOR_STR
2854 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00002855 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00002856{
2857 return peer_update_source_vty (vty, argv[0], NULL);
2858}
2859
paul94f2b392005-06-28 12:44:16 +00002860static int
paulfd79ac92004-10-13 05:06:08 +00002861peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
2862 afi_t afi, safi_t safi,
2863 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00002864{
2865 int ret;
2866 struct peer *peer;
2867
2868 peer = peer_and_group_lookup_vty (vty, peer_str);
2869 if (! peer)
2870 return CMD_WARNING;
2871
2872 if (set)
2873 ret = peer_default_originate_set (peer, afi, safi, rmap);
2874 else
2875 ret = peer_default_originate_unset (peer, afi, safi);
2876
2877 return bgp_vty_return (vty, ret);
2878}
2879
2880/* neighbor default-originate. */
2881DEFUN (neighbor_default_originate,
2882 neighbor_default_originate_cmd,
2883 NEIGHBOR_CMD2 "default-originate",
2884 NEIGHBOR_STR
2885 NEIGHBOR_ADDR_STR2
2886 "Originate default route to this neighbor\n")
2887{
2888 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2889 bgp_node_safi (vty), NULL, 1);
2890}
2891
2892DEFUN (neighbor_default_originate_rmap,
2893 neighbor_default_originate_rmap_cmd,
2894 NEIGHBOR_CMD2 "default-originate route-map WORD",
2895 NEIGHBOR_STR
2896 NEIGHBOR_ADDR_STR2
2897 "Originate default route to this neighbor\n"
2898 "Route-map to specify criteria to originate default\n"
2899 "route-map name\n")
2900{
2901 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2902 bgp_node_safi (vty), argv[1], 1);
2903}
2904
2905DEFUN (no_neighbor_default_originate,
2906 no_neighbor_default_originate_cmd,
2907 NO_NEIGHBOR_CMD2 "default-originate",
2908 NO_STR
2909 NEIGHBOR_STR
2910 NEIGHBOR_ADDR_STR2
2911 "Originate default route to this neighbor\n")
2912{
2913 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2914 bgp_node_safi (vty), NULL, 0);
2915}
2916
2917ALIAS (no_neighbor_default_originate,
2918 no_neighbor_default_originate_rmap_cmd,
2919 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
2920 NO_STR
2921 NEIGHBOR_STR
2922 NEIGHBOR_ADDR_STR2
2923 "Originate default route to this neighbor\n"
2924 "Route-map to specify criteria to originate default\n"
2925 "route-map name\n")
2926
2927/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00002928static int
paulfd79ac92004-10-13 05:06:08 +00002929peer_port_vty (struct vty *vty, const char *ip_str, int afi,
2930 const char *port_str)
paul718e3742002-12-13 20:15:29 +00002931{
2932 struct peer *peer;
2933 u_int16_t port;
2934 struct servent *sp;
2935
2936 peer = peer_lookup_vty (vty, ip_str);
2937 if (! peer)
2938 return CMD_WARNING;
2939
2940 if (! port_str)
2941 {
2942 sp = getservbyname ("bgp", "tcp");
2943 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
2944 }
2945 else
2946 {
2947 VTY_GET_INTEGER("port", port, port_str);
2948 }
2949
2950 peer_port_set (peer, port);
2951
2952 return CMD_SUCCESS;
2953}
2954
hassof4184462005-02-01 20:13:16 +00002955/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00002956DEFUN (neighbor_port,
2957 neighbor_port_cmd,
2958 NEIGHBOR_CMD "port <0-65535>",
2959 NEIGHBOR_STR
2960 NEIGHBOR_ADDR_STR
2961 "Neighbor's BGP port\n"
2962 "TCP port number\n")
2963{
2964 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
2965}
2966
2967DEFUN (no_neighbor_port,
2968 no_neighbor_port_cmd,
2969 NO_NEIGHBOR_CMD "port",
2970 NO_STR
2971 NEIGHBOR_STR
2972 NEIGHBOR_ADDR_STR
2973 "Neighbor's BGP port\n")
2974{
2975 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
2976}
2977
2978ALIAS (no_neighbor_port,
2979 no_neighbor_port_val_cmd,
2980 NO_NEIGHBOR_CMD "port <0-65535>",
2981 NO_STR
2982 NEIGHBOR_STR
2983 NEIGHBOR_ADDR_STR
2984 "Neighbor's BGP port\n"
2985 "TCP port number\n")
2986
2987/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00002988static int
paulfd79ac92004-10-13 05:06:08 +00002989peer_weight_set_vty (struct vty *vty, const char *ip_str,
2990 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00002991{
2992 int ret;
2993 struct peer *peer;
2994 unsigned long weight;
2995
2996 peer = peer_and_group_lookup_vty (vty, ip_str);
2997 if (! peer)
2998 return CMD_WARNING;
2999
3000 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3001
3002 ret = peer_weight_set (peer, weight);
3003
3004 return CMD_SUCCESS;
3005}
3006
paul94f2b392005-06-28 12:44:16 +00003007static int
paulfd79ac92004-10-13 05:06:08 +00003008peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003009{
3010 struct peer *peer;
3011
3012 peer = peer_and_group_lookup_vty (vty, ip_str);
3013 if (! peer)
3014 return CMD_WARNING;
3015
3016 peer_weight_unset (peer);
3017
3018 return CMD_SUCCESS;
3019}
3020
3021DEFUN (neighbor_weight,
3022 neighbor_weight_cmd,
3023 NEIGHBOR_CMD2 "weight <0-65535>",
3024 NEIGHBOR_STR
3025 NEIGHBOR_ADDR_STR2
3026 "Set default weight for routes from this neighbor\n"
3027 "default weight\n")
3028{
3029 return peer_weight_set_vty (vty, argv[0], argv[1]);
3030}
3031
3032DEFUN (no_neighbor_weight,
3033 no_neighbor_weight_cmd,
3034 NO_NEIGHBOR_CMD2 "weight",
3035 NO_STR
3036 NEIGHBOR_STR
3037 NEIGHBOR_ADDR_STR2
3038 "Set default weight for routes from this neighbor\n")
3039{
3040 return peer_weight_unset_vty (vty, argv[0]);
3041}
3042
3043ALIAS (no_neighbor_weight,
3044 no_neighbor_weight_val_cmd,
3045 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3046 NO_STR
3047 NEIGHBOR_STR
3048 NEIGHBOR_ADDR_STR2
3049 "Set default weight for routes from this neighbor\n"
3050 "default weight\n")
3051
3052/* Override capability negotiation. */
3053DEFUN (neighbor_override_capability,
3054 neighbor_override_capability_cmd,
3055 NEIGHBOR_CMD2 "override-capability",
3056 NEIGHBOR_STR
3057 NEIGHBOR_ADDR_STR2
3058 "Override capability negotiation result\n")
3059{
3060 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3061}
3062
3063DEFUN (no_neighbor_override_capability,
3064 no_neighbor_override_capability_cmd,
3065 NO_NEIGHBOR_CMD2 "override-capability",
3066 NO_STR
3067 NEIGHBOR_STR
3068 NEIGHBOR_ADDR_STR2
3069 "Override capability negotiation result\n")
3070{
3071 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3072}
3073
3074DEFUN (neighbor_strict_capability,
3075 neighbor_strict_capability_cmd,
3076 NEIGHBOR_CMD "strict-capability-match",
3077 NEIGHBOR_STR
3078 NEIGHBOR_ADDR_STR
3079 "Strict capability negotiation match\n")
3080{
3081 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3082}
3083
3084DEFUN (no_neighbor_strict_capability,
3085 no_neighbor_strict_capability_cmd,
3086 NO_NEIGHBOR_CMD "strict-capability-match",
3087 NO_STR
3088 NEIGHBOR_STR
3089 NEIGHBOR_ADDR_STR
3090 "Strict capability negotiation match\n")
3091{
3092 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3093}
3094
paul94f2b392005-06-28 12:44:16 +00003095static int
paulfd79ac92004-10-13 05:06:08 +00003096peer_timers_set_vty (struct vty *vty, const char *ip_str,
3097 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003098{
3099 int ret;
3100 struct peer *peer;
3101 u_int32_t keepalive;
3102 u_int32_t holdtime;
3103
3104 peer = peer_and_group_lookup_vty (vty, ip_str);
3105 if (! peer)
3106 return CMD_WARNING;
3107
3108 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3109 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3110
3111 ret = peer_timers_set (peer, keepalive, holdtime);
3112
3113 return bgp_vty_return (vty, ret);
3114}
3115
paul94f2b392005-06-28 12:44:16 +00003116static int
paulfd79ac92004-10-13 05:06:08 +00003117peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003118{
3119 int ret;
3120 struct peer *peer;
3121
3122 peer = peer_lookup_vty (vty, ip_str);
3123 if (! peer)
3124 return CMD_WARNING;
3125
3126 ret = peer_timers_unset (peer);
3127
3128 return bgp_vty_return (vty, ret);
3129}
3130
3131DEFUN (neighbor_timers,
3132 neighbor_timers_cmd,
3133 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3134 NEIGHBOR_STR
3135 NEIGHBOR_ADDR_STR2
3136 "BGP per neighbor timers\n"
3137 "Keepalive interval\n"
3138 "Holdtime\n")
3139{
3140 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3141}
3142
3143DEFUN (no_neighbor_timers,
3144 no_neighbor_timers_cmd,
3145 NO_NEIGHBOR_CMD2 "timers",
3146 NO_STR
3147 NEIGHBOR_STR
3148 NEIGHBOR_ADDR_STR2
3149 "BGP per neighbor timers\n")
3150{
3151 return peer_timers_unset_vty (vty, argv[0]);
3152}
3153
paul94f2b392005-06-28 12:44:16 +00003154static int
paulfd79ac92004-10-13 05:06:08 +00003155peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3156 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003157{
3158 int ret;
3159 struct peer *peer;
3160 u_int32_t connect;
3161
3162 peer = peer_lookup_vty (vty, ip_str);
3163 if (! peer)
3164 return CMD_WARNING;
3165
3166 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3167
3168 ret = peer_timers_connect_set (peer, connect);
3169
3170 return CMD_SUCCESS;
3171}
3172
paul94f2b392005-06-28 12:44:16 +00003173static int
paulfd79ac92004-10-13 05:06:08 +00003174peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003175{
3176 int ret;
3177 struct peer *peer;
3178
3179 peer = peer_and_group_lookup_vty (vty, ip_str);
3180 if (! peer)
3181 return CMD_WARNING;
3182
3183 ret = peer_timers_connect_unset (peer);
3184
3185 return CMD_SUCCESS;
3186}
3187
3188DEFUN (neighbor_timers_connect,
3189 neighbor_timers_connect_cmd,
3190 NEIGHBOR_CMD "timers connect <0-65535>",
3191 NEIGHBOR_STR
3192 NEIGHBOR_ADDR_STR
3193 "BGP per neighbor timers\n"
3194 "BGP connect timer\n"
3195 "Connect timer\n")
3196{
3197 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3198}
3199
3200DEFUN (no_neighbor_timers_connect,
3201 no_neighbor_timers_connect_cmd,
3202 NO_NEIGHBOR_CMD "timers connect",
3203 NO_STR
3204 NEIGHBOR_STR
3205 NEIGHBOR_ADDR_STR
3206 "BGP per neighbor timers\n"
3207 "BGP connect timer\n")
3208{
3209 return peer_timers_connect_unset_vty (vty, argv[0]);
3210}
3211
3212ALIAS (no_neighbor_timers_connect,
3213 no_neighbor_timers_connect_val_cmd,
3214 NO_NEIGHBOR_CMD "timers connect <0-65535>",
3215 NO_STR
3216 NEIGHBOR_STR
3217 NEIGHBOR_ADDR_STR
3218 "BGP per neighbor timers\n"
3219 "BGP connect timer\n"
3220 "Connect timer\n")
3221
paul94f2b392005-06-28 12:44:16 +00003222static int
paulfd79ac92004-10-13 05:06:08 +00003223peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3224 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003225{
3226 int ret;
3227 struct peer *peer;
3228 u_int32_t routeadv = 0;
3229
3230 peer = peer_lookup_vty (vty, ip_str);
3231 if (! peer)
3232 return CMD_WARNING;
3233
3234 if (time_str)
3235 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3236
3237 if (set)
3238 ret = peer_advertise_interval_set (peer, routeadv);
3239 else
3240 ret = peer_advertise_interval_unset (peer);
3241
3242 return CMD_SUCCESS;
3243}
3244
3245DEFUN (neighbor_advertise_interval,
3246 neighbor_advertise_interval_cmd,
3247 NEIGHBOR_CMD "advertisement-interval <0-600>",
3248 NEIGHBOR_STR
3249 NEIGHBOR_ADDR_STR
3250 "Minimum interval between sending BGP routing updates\n"
3251 "time in seconds\n")
3252{
3253 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3254}
3255
3256DEFUN (no_neighbor_advertise_interval,
3257 no_neighbor_advertise_interval_cmd,
3258 NO_NEIGHBOR_CMD "advertisement-interval",
3259 NO_STR
3260 NEIGHBOR_STR
3261 NEIGHBOR_ADDR_STR
3262 "Minimum interval between sending BGP routing updates\n")
3263{
3264 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3265}
3266
3267ALIAS (no_neighbor_advertise_interval,
3268 no_neighbor_advertise_interval_val_cmd,
3269 NO_NEIGHBOR_CMD "advertisement-interval <0-600>",
3270 NO_STR
3271 NEIGHBOR_STR
3272 NEIGHBOR_ADDR_STR
3273 "Minimum interval between sending BGP routing updates\n"
3274 "time in seconds\n")
3275
paul718e3742002-12-13 20:15:29 +00003276/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003277static int
paulfd79ac92004-10-13 05:06:08 +00003278peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003279{
3280 int ret;
3281 struct peer *peer;
3282
3283 peer = peer_lookup_vty (vty, ip_str);
3284 if (! peer)
3285 return CMD_WARNING;
3286
3287 if (str)
3288 ret = peer_interface_set (peer, str);
3289 else
3290 ret = peer_interface_unset (peer);
3291
3292 return CMD_SUCCESS;
3293}
3294
3295DEFUN (neighbor_interface,
3296 neighbor_interface_cmd,
3297 NEIGHBOR_CMD "interface WORD",
3298 NEIGHBOR_STR
3299 NEIGHBOR_ADDR_STR
3300 "Interface\n"
3301 "Interface name\n")
3302{
3303 return peer_interface_vty (vty, argv[0], argv[1]);
3304}
3305
3306DEFUN (no_neighbor_interface,
3307 no_neighbor_interface_cmd,
3308 NO_NEIGHBOR_CMD "interface WORD",
3309 NO_STR
3310 NEIGHBOR_STR
3311 NEIGHBOR_ADDR_STR
3312 "Interface\n"
3313 "Interface name\n")
3314{
3315 return peer_interface_vty (vty, argv[0], NULL);
3316}
3317
3318/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003319static int
paulfd79ac92004-10-13 05:06:08 +00003320peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3321 afi_t afi, safi_t safi,
3322 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003323{
3324 int ret;
3325 struct peer *peer;
3326 int direct = FILTER_IN;
3327
3328 peer = peer_and_group_lookup_vty (vty, ip_str);
3329 if (! peer)
3330 return CMD_WARNING;
3331
3332 /* Check filter direction. */
3333 if (strncmp (direct_str, "i", 1) == 0)
3334 direct = FILTER_IN;
3335 else if (strncmp (direct_str, "o", 1) == 0)
3336 direct = FILTER_OUT;
3337
3338 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3339
3340 return bgp_vty_return (vty, ret);
3341}
3342
paul94f2b392005-06-28 12:44:16 +00003343static int
paulfd79ac92004-10-13 05:06:08 +00003344peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3345 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003346{
3347 int ret;
3348 struct peer *peer;
3349 int direct = FILTER_IN;
3350
3351 peer = peer_and_group_lookup_vty (vty, ip_str);
3352 if (! peer)
3353 return CMD_WARNING;
3354
3355 /* Check filter direction. */
3356 if (strncmp (direct_str, "i", 1) == 0)
3357 direct = FILTER_IN;
3358 else if (strncmp (direct_str, "o", 1) == 0)
3359 direct = FILTER_OUT;
3360
3361 ret = peer_distribute_unset (peer, afi, safi, direct);
3362
3363 return bgp_vty_return (vty, ret);
3364}
3365
3366DEFUN (neighbor_distribute_list,
3367 neighbor_distribute_list_cmd,
3368 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3369 NEIGHBOR_STR
3370 NEIGHBOR_ADDR_STR2
3371 "Filter updates to/from this neighbor\n"
3372 "IP access-list number\n"
3373 "IP access-list number (expanded range)\n"
3374 "IP Access-list name\n"
3375 "Filter incoming updates\n"
3376 "Filter outgoing updates\n")
3377{
3378 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3379 bgp_node_safi (vty), argv[1], argv[2]);
3380}
3381
3382DEFUN (no_neighbor_distribute_list,
3383 no_neighbor_distribute_list_cmd,
3384 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3385 NO_STR
3386 NEIGHBOR_STR
3387 NEIGHBOR_ADDR_STR2
3388 "Filter updates to/from this neighbor\n"
3389 "IP access-list number\n"
3390 "IP access-list number (expanded range)\n"
3391 "IP Access-list name\n"
3392 "Filter incoming updates\n"
3393 "Filter outgoing updates\n")
3394{
3395 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3396 bgp_node_safi (vty), argv[2]);
3397}
3398
3399/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003400static int
paulfd79ac92004-10-13 05:06:08 +00003401peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3402 safi_t safi, const char *name_str,
3403 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003404{
3405 int ret;
3406 struct peer *peer;
3407 int direct = FILTER_IN;
3408
3409 peer = peer_and_group_lookup_vty (vty, ip_str);
3410 if (! peer)
3411 return CMD_WARNING;
3412
3413 /* Check filter direction. */
3414 if (strncmp (direct_str, "i", 1) == 0)
3415 direct = FILTER_IN;
3416 else if (strncmp (direct_str, "o", 1) == 0)
3417 direct = FILTER_OUT;
3418
3419 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3420
3421 return bgp_vty_return (vty, ret);
3422}
3423
paul94f2b392005-06-28 12:44:16 +00003424static int
paulfd79ac92004-10-13 05:06:08 +00003425peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3426 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003427{
3428 int ret;
3429 struct peer *peer;
3430 int direct = FILTER_IN;
3431
3432 peer = peer_and_group_lookup_vty (vty, ip_str);
3433 if (! peer)
3434 return CMD_WARNING;
3435
3436 /* Check filter direction. */
3437 if (strncmp (direct_str, "i", 1) == 0)
3438 direct = FILTER_IN;
3439 else if (strncmp (direct_str, "o", 1) == 0)
3440 direct = FILTER_OUT;
3441
3442 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3443
3444 return bgp_vty_return (vty, ret);
3445}
3446
3447DEFUN (neighbor_prefix_list,
3448 neighbor_prefix_list_cmd,
3449 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3450 NEIGHBOR_STR
3451 NEIGHBOR_ADDR_STR2
3452 "Filter updates to/from this neighbor\n"
3453 "Name of a prefix list\n"
3454 "Filter incoming updates\n"
3455 "Filter outgoing updates\n")
3456{
3457 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3458 bgp_node_safi (vty), argv[1], argv[2]);
3459}
3460
3461DEFUN (no_neighbor_prefix_list,
3462 no_neighbor_prefix_list_cmd,
3463 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3464 NO_STR
3465 NEIGHBOR_STR
3466 NEIGHBOR_ADDR_STR2
3467 "Filter updates to/from this neighbor\n"
3468 "Name of a prefix list\n"
3469 "Filter incoming updates\n"
3470 "Filter outgoing updates\n")
3471{
3472 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3473 bgp_node_safi (vty), argv[2]);
3474}
3475
paul94f2b392005-06-28 12:44:16 +00003476static int
paulfd79ac92004-10-13 05:06:08 +00003477peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3478 afi_t afi, safi_t safi,
3479 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003480{
3481 int ret;
3482 struct peer *peer;
3483 int direct = FILTER_IN;
3484
3485 peer = peer_and_group_lookup_vty (vty, ip_str);
3486 if (! peer)
3487 return CMD_WARNING;
3488
3489 /* Check filter direction. */
3490 if (strncmp (direct_str, "i", 1) == 0)
3491 direct = FILTER_IN;
3492 else if (strncmp (direct_str, "o", 1) == 0)
3493 direct = FILTER_OUT;
3494
3495 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3496
3497 return bgp_vty_return (vty, ret);
3498}
3499
paul94f2b392005-06-28 12:44:16 +00003500static int
paulfd79ac92004-10-13 05:06:08 +00003501peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3502 afi_t afi, safi_t safi,
3503 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003504{
3505 int ret;
3506 struct peer *peer;
3507 int direct = FILTER_IN;
3508
3509 peer = peer_and_group_lookup_vty (vty, ip_str);
3510 if (! peer)
3511 return CMD_WARNING;
3512
3513 /* Check filter direction. */
3514 if (strncmp (direct_str, "i", 1) == 0)
3515 direct = FILTER_IN;
3516 else if (strncmp (direct_str, "o", 1) == 0)
3517 direct = FILTER_OUT;
3518
3519 ret = peer_aslist_unset (peer, afi, safi, direct);
3520
3521 return bgp_vty_return (vty, ret);
3522}
3523
3524DEFUN (neighbor_filter_list,
3525 neighbor_filter_list_cmd,
3526 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3527 NEIGHBOR_STR
3528 NEIGHBOR_ADDR_STR2
3529 "Establish BGP filters\n"
3530 "AS path access-list name\n"
3531 "Filter incoming routes\n"
3532 "Filter outgoing routes\n")
3533{
3534 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3535 bgp_node_safi (vty), argv[1], argv[2]);
3536}
3537
3538DEFUN (no_neighbor_filter_list,
3539 no_neighbor_filter_list_cmd,
3540 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3541 NO_STR
3542 NEIGHBOR_STR
3543 NEIGHBOR_ADDR_STR2
3544 "Establish BGP filters\n"
3545 "AS path access-list name\n"
3546 "Filter incoming routes\n"
3547 "Filter outgoing routes\n")
3548{
3549 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3550 bgp_node_safi (vty), argv[2]);
3551}
3552
3553/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003554static int
paulfd79ac92004-10-13 05:06:08 +00003555peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3556 afi_t afi, safi_t safi,
3557 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003558{
3559 int ret;
3560 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003561 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003562
3563 peer = peer_and_group_lookup_vty (vty, ip_str);
3564 if (! peer)
3565 return CMD_WARNING;
3566
3567 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003568 if (strncmp (direct_str, "in", 2) == 0)
3569 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003570 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003571 direct = RMAP_OUT;
3572 else if (strncmp (direct_str, "im", 2) == 0)
3573 direct = RMAP_IMPORT;
3574 else if (strncmp (direct_str, "e", 1) == 0)
3575 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003576
3577 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3578
3579 return bgp_vty_return (vty, ret);
3580}
3581
paul94f2b392005-06-28 12:44:16 +00003582static int
paulfd79ac92004-10-13 05:06:08 +00003583peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3584 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003585{
3586 int ret;
3587 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003588 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003589
3590 peer = peer_and_group_lookup_vty (vty, ip_str);
3591 if (! peer)
3592 return CMD_WARNING;
3593
3594 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003595 if (strncmp (direct_str, "in", 2) == 0)
3596 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003597 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003598 direct = RMAP_OUT;
3599 else if (strncmp (direct_str, "im", 2) == 0)
3600 direct = RMAP_IMPORT;
3601 else if (strncmp (direct_str, "e", 1) == 0)
3602 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003603
3604 ret = peer_route_map_unset (peer, afi, safi, direct);
3605
3606 return bgp_vty_return (vty, ret);
3607}
3608
3609DEFUN (neighbor_route_map,
3610 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003611 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003612 NEIGHBOR_STR
3613 NEIGHBOR_ADDR_STR2
3614 "Apply route map to neighbor\n"
3615 "Name of route map\n"
3616 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003617 "Apply map to outbound routes\n"
3618 "Apply map to routes going into a Route-Server client's table\n"
3619 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003620{
3621 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3622 bgp_node_safi (vty), argv[1], argv[2]);
3623}
3624
3625DEFUN (no_neighbor_route_map,
3626 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003627 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003628 NO_STR
3629 NEIGHBOR_STR
3630 NEIGHBOR_ADDR_STR2
3631 "Apply route map to neighbor\n"
3632 "Name of route map\n"
3633 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003634 "Apply map to outbound routes\n"
3635 "Apply map to routes going into a Route-Server client's table\n"
3636 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003637{
3638 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3639 bgp_node_safi (vty), argv[2]);
3640}
3641
3642/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003643static int
paulfd79ac92004-10-13 05:06:08 +00003644peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3645 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003646{
3647 int ret;
3648 struct peer *peer;
3649
3650 peer = peer_and_group_lookup_vty (vty, ip_str);
3651 if (! peer)
3652 return CMD_WARNING;
3653
3654 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3655
3656 return bgp_vty_return (vty, ret);
3657}
3658
3659/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003660static int
paulfd79ac92004-10-13 05:06:08 +00003661peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003662 safi_t safi)
3663{
3664 int ret;
3665 struct peer *peer;
3666
3667 peer = peer_and_group_lookup_vty (vty, ip_str);
3668 if (! peer)
3669 return CMD_WARNING;
3670
3671 ret = peer_unsuppress_map_unset (peer, afi, safi);
3672
3673 return bgp_vty_return (vty, ret);
3674}
3675
3676DEFUN (neighbor_unsuppress_map,
3677 neighbor_unsuppress_map_cmd,
3678 NEIGHBOR_CMD2 "unsuppress-map WORD",
3679 NEIGHBOR_STR
3680 NEIGHBOR_ADDR_STR2
3681 "Route-map to selectively unsuppress suppressed routes\n"
3682 "Name of route map\n")
3683{
3684 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3685 bgp_node_safi (vty), argv[1]);
3686}
3687
3688DEFUN (no_neighbor_unsuppress_map,
3689 no_neighbor_unsuppress_map_cmd,
3690 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3691 NO_STR
3692 NEIGHBOR_STR
3693 NEIGHBOR_ADDR_STR2
3694 "Route-map to selectively unsuppress suppressed routes\n"
3695 "Name of route map\n")
3696{
3697 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3698 bgp_node_safi (vty));
3699}
3700
paul94f2b392005-06-28 12:44:16 +00003701static int
paulfd79ac92004-10-13 05:06:08 +00003702peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3703 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003704 const char *threshold_str, int warning,
3705 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003706{
3707 int ret;
3708 struct peer *peer;
3709 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003710 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003711 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003712
3713 peer = peer_and_group_lookup_vty (vty, ip_str);
3714 if (! peer)
3715 return CMD_WARNING;
3716
3717 VTY_GET_INTEGER ("maxmum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003718 if (threshold_str)
3719 threshold = atoi (threshold_str);
3720 else
3721 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00003722
hasso0a486e52005-02-01 20:57:17 +00003723 if (restart_str)
3724 restart = atoi (restart_str);
3725 else
3726 restart = 0;
3727
3728 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00003729
3730 return bgp_vty_return (vty, ret);
3731}
3732
paul94f2b392005-06-28 12:44:16 +00003733static int
paulfd79ac92004-10-13 05:06:08 +00003734peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003735 safi_t safi)
3736{
3737 int ret;
3738 struct peer *peer;
3739
3740 peer = peer_and_group_lookup_vty (vty, ip_str);
3741 if (! peer)
3742 return CMD_WARNING;
3743
3744 ret = peer_maximum_prefix_unset (peer, afi, safi);
3745
3746 return bgp_vty_return (vty, ret);
3747}
3748
3749/* Maximum number of prefix configuration. prefix count is different
3750 for each peer configuration. So this configuration can be set for
3751 each peer configuration. */
3752DEFUN (neighbor_maximum_prefix,
3753 neighbor_maximum_prefix_cmd,
3754 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3755 NEIGHBOR_STR
3756 NEIGHBOR_ADDR_STR2
3757 "Maximum number of prefix accept from this peer\n"
3758 "maximum no. of prefix limit\n")
3759{
3760 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003761 bgp_node_safi (vty), argv[1], NULL, 0,
3762 NULL);
paul718e3742002-12-13 20:15:29 +00003763}
3764
hassoe0701b72004-05-20 09:19:34 +00003765DEFUN (neighbor_maximum_prefix_threshold,
3766 neighbor_maximum_prefix_threshold_cmd,
3767 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
3768 NEIGHBOR_STR
3769 NEIGHBOR_ADDR_STR2
3770 "Maximum number of prefix accept from this peer\n"
3771 "maximum no. of prefix limit\n"
3772 "Threshold value (%) at which to generate a warning msg\n")
3773{
3774 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003775 bgp_node_safi (vty), argv[1], argv[2], 0,
3776 NULL);
3777}
hassoe0701b72004-05-20 09:19:34 +00003778
paul718e3742002-12-13 20:15:29 +00003779DEFUN (neighbor_maximum_prefix_warning,
3780 neighbor_maximum_prefix_warning_cmd,
3781 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3782 NEIGHBOR_STR
3783 NEIGHBOR_ADDR_STR2
3784 "Maximum number of prefix accept from this peer\n"
3785 "maximum no. of prefix limit\n"
3786 "Only give warning message when limit is exceeded\n")
3787{
3788 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003789 bgp_node_safi (vty), argv[1], NULL, 1,
3790 NULL);
paul718e3742002-12-13 20:15:29 +00003791}
3792
hassoe0701b72004-05-20 09:19:34 +00003793DEFUN (neighbor_maximum_prefix_threshold_warning,
3794 neighbor_maximum_prefix_threshold_warning_cmd,
3795 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
3796 NEIGHBOR_STR
3797 NEIGHBOR_ADDR_STR2
3798 "Maximum number of prefix accept from this peer\n"
3799 "maximum no. of prefix limit\n"
3800 "Threshold value (%) at which to generate a warning msg\n"
3801 "Only give warning message when limit is exceeded\n")
3802{
3803 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003804 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
3805}
3806
3807DEFUN (neighbor_maximum_prefix_restart,
3808 neighbor_maximum_prefix_restart_cmd,
3809 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
3810 NEIGHBOR_STR
3811 NEIGHBOR_ADDR_STR2
3812 "Maximum number of prefix accept from this peer\n"
3813 "maximum no. of prefix limit\n"
3814 "Restart bgp connection after limit is exceeded\n"
3815 "Restart interval in minutes")
3816{
3817 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3818 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
3819}
3820
3821DEFUN (neighbor_maximum_prefix_threshold_restart,
3822 neighbor_maximum_prefix_threshold_restart_cmd,
3823 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
3824 NEIGHBOR_STR
3825 NEIGHBOR_ADDR_STR2
3826 "Maximum number of prefix accept from this peer\n"
3827 "maximum no. of prefix limit\n"
3828 "Threshold value (%) at which to generate a warning msg\n"
3829 "Restart bgp connection after limit is exceeded\n"
3830 "Restart interval in minutes")
3831{
3832 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3833 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
3834}
hassoe0701b72004-05-20 09:19:34 +00003835
paul718e3742002-12-13 20:15:29 +00003836DEFUN (no_neighbor_maximum_prefix,
3837 no_neighbor_maximum_prefix_cmd,
3838 NO_NEIGHBOR_CMD2 "maximum-prefix",
3839 NO_STR
3840 NEIGHBOR_STR
3841 NEIGHBOR_ADDR_STR2
3842 "Maximum number of prefix accept from this peer\n")
3843{
3844 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
3845 bgp_node_safi (vty));
3846}
3847
3848ALIAS (no_neighbor_maximum_prefix,
3849 no_neighbor_maximum_prefix_val_cmd,
3850 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3851 NO_STR
3852 NEIGHBOR_STR
3853 NEIGHBOR_ADDR_STR2
3854 "Maximum number of prefix accept from this peer\n"
3855 "maximum no. of prefix limit\n")
3856
3857ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00003858 no_neighbor_maximum_prefix_threshold_cmd,
3859 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3860 NO_STR
3861 NEIGHBOR_STR
3862 NEIGHBOR_ADDR_STR2
3863 "Maximum number of prefix accept from this peer\n"
3864 "maximum no. of prefix limit\n"
3865 "Threshold value (%) at which to generate a warning msg\n")
3866
3867ALIAS (no_neighbor_maximum_prefix,
3868 no_neighbor_maximum_prefix_warning_cmd,
3869 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3870 NO_STR
3871 NEIGHBOR_STR
3872 NEIGHBOR_ADDR_STR2
3873 "Maximum number of prefix accept from this peer\n"
3874 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00003875 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00003876
3877ALIAS (no_neighbor_maximum_prefix,
3878 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00003879 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
3880 NO_STR
3881 NEIGHBOR_STR
3882 NEIGHBOR_ADDR_STR2
3883 "Maximum number of prefix accept from this peer\n"
3884 "maximum no. of prefix limit\n"
3885 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00003886 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00003887
3888ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00003889 no_neighbor_maximum_prefix_restart_cmd,
3890 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00003891 NO_STR
3892 NEIGHBOR_STR
3893 NEIGHBOR_ADDR_STR2
3894 "Maximum number of prefix accept from this peer\n"
3895 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00003896 "Restart bgp connection after limit is exceeded\n"
3897 "Restart interval in minutes")
3898
3899ALIAS (no_neighbor_maximum_prefix,
3900 no_neighbor_maximum_prefix_threshold_restart_cmd,
3901 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
3902 NO_STR
3903 NEIGHBOR_STR
3904 NEIGHBOR_ADDR_STR2
3905 "Maximum number of prefix accept from this peer\n"
3906 "maximum no. of prefix limit\n"
3907 "Threshold value (%) at which to generate a warning msg\n"
3908 "Restart bgp connection after limit is exceeded\n"
3909 "Restart interval in minutes")
paul718e3742002-12-13 20:15:29 +00003910
3911/* "neighbor allowas-in" */
3912DEFUN (neighbor_allowas_in,
3913 neighbor_allowas_in_cmd,
3914 NEIGHBOR_CMD2 "allowas-in",
3915 NEIGHBOR_STR
3916 NEIGHBOR_ADDR_STR2
3917 "Accept as-path with my AS present in it\n")
3918{
3919 int ret;
3920 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00003921 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00003922
3923 peer = peer_and_group_lookup_vty (vty, argv[0]);
3924 if (! peer)
3925 return CMD_WARNING;
3926
3927 if (argc == 1)
3928 allow_num = 3;
3929 else
3930 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
3931
3932 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
3933 allow_num);
3934
3935 return bgp_vty_return (vty, ret);
3936}
3937
3938ALIAS (neighbor_allowas_in,
3939 neighbor_allowas_in_arg_cmd,
3940 NEIGHBOR_CMD2 "allowas-in <1-10>",
3941 NEIGHBOR_STR
3942 NEIGHBOR_ADDR_STR2
3943 "Accept as-path with my AS present in it\n"
3944 "Number of occurances of AS number\n")
3945
3946DEFUN (no_neighbor_allowas_in,
3947 no_neighbor_allowas_in_cmd,
3948 NO_NEIGHBOR_CMD2 "allowas-in",
3949 NO_STR
3950 NEIGHBOR_STR
3951 NEIGHBOR_ADDR_STR2
3952 "allow local ASN appears in aspath attribute\n")
3953{
3954 int ret;
3955 struct peer *peer;
3956
3957 peer = peer_and_group_lookup_vty (vty, argv[0]);
3958 if (! peer)
3959 return CMD_WARNING;
3960
3961 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
3962
3963 return bgp_vty_return (vty, ret);
3964}
3965
3966/* Address family configuration. */
3967DEFUN (address_family_ipv4,
3968 address_family_ipv4_cmd,
3969 "address-family ipv4",
3970 "Enter Address Family command mode\n"
3971 "Address family\n")
3972{
3973 vty->node = BGP_IPV4_NODE;
3974 return CMD_SUCCESS;
3975}
3976
3977DEFUN (address_family_ipv4_safi,
3978 address_family_ipv4_safi_cmd,
3979 "address-family ipv4 (unicast|multicast)",
3980 "Enter Address Family command mode\n"
3981 "Address family\n"
3982 "Address Family modifier\n"
3983 "Address Family modifier\n")
3984{
3985 if (strncmp (argv[0], "m", 1) == 0)
3986 vty->node = BGP_IPV4M_NODE;
3987 else
3988 vty->node = BGP_IPV4_NODE;
3989
3990 return CMD_SUCCESS;
3991}
3992
paul25ffbdc2005-08-22 22:42:08 +00003993DEFUN (address_family_ipv6,
3994 address_family_ipv6_cmd,
3995 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00003996 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00003997 "Address family\n")
paul718e3742002-12-13 20:15:29 +00003998{
3999 vty->node = BGP_IPV6_NODE;
4000 return CMD_SUCCESS;
4001}
4002
paul25ffbdc2005-08-22 22:42:08 +00004003DEFUN (address_family_ipv6_safi,
4004 address_family_ipv6_safi_cmd,
4005 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004006 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004007 "Address family\n"
4008 "Address Family modifier\n"
4009 "Address Family modifier\n")
4010{
4011 if (strncmp (argv[0], "m", 1) == 0)
4012 vty->node = BGP_IPV6M_NODE;
4013 else
4014 vty->node = BGP_IPV6_NODE;
4015
4016 return CMD_SUCCESS;
4017}
paul718e3742002-12-13 20:15:29 +00004018
4019DEFUN (address_family_vpnv4,
4020 address_family_vpnv4_cmd,
4021 "address-family vpnv4",
4022 "Enter Address Family command mode\n"
4023 "Address family\n")
4024{
4025 vty->node = BGP_VPNV4_NODE;
4026 return CMD_SUCCESS;
4027}
4028
4029ALIAS (address_family_vpnv4,
4030 address_family_vpnv4_unicast_cmd,
4031 "address-family vpnv4 unicast",
4032 "Enter Address Family command mode\n"
4033 "Address family\n"
4034 "Address Family Modifier\n")
4035
4036DEFUN (exit_address_family,
4037 exit_address_family_cmd,
4038 "exit-address-family",
4039 "Exit from Address Family configuration mode\n")
4040{
hassoa8a80d52005-04-09 13:07:47 +00004041 if (vty->node == BGP_IPV4_NODE
4042 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004043 || vty->node == BGP_VPNV4_NODE
paul25ffbdc2005-08-22 22:42:08 +00004044 || vty->node == BGP_IPV6_NODE
4045 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004046 vty->node = BGP_NODE;
4047 return CMD_SUCCESS;
4048}
4049
4050/* BGP clear sort. */
4051enum clear_sort
4052{
4053 clear_all,
4054 clear_peer,
4055 clear_group,
4056 clear_external,
4057 clear_as
4058};
4059
paul94f2b392005-06-28 12:44:16 +00004060static void
paul718e3742002-12-13 20:15:29 +00004061bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4062 safi_t safi, int error)
4063{
4064 switch (error)
4065 {
4066 case BGP_ERR_AF_UNCONFIGURED:
4067 vty_out (vty,
4068 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4069 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4070 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4071 peer->host, VTY_NEWLINE);
4072 break;
4073 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4074 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);
4075 break;
4076 default:
4077 break;
4078 }
4079}
4080
4081/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004082static int
paul718e3742002-12-13 20:15:29 +00004083bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004084 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004085{
4086 int ret;
4087 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004088 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004089
4090 /* Clear all neighbors. */
4091 if (sort == clear_all)
4092 {
paul1eb8ef22005-04-07 07:30:20 +00004093 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004094 {
4095 if (stype == BGP_CLEAR_SOFT_NONE)
4096 ret = peer_clear (peer);
4097 else
4098 ret = peer_clear_soft (peer, afi, safi, stype);
4099
4100 if (ret < 0)
4101 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4102 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004103 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004104 }
4105
4106 /* Clear specified neighbors. */
4107 if (sort == clear_peer)
4108 {
4109 union sockunion su;
4110 int ret;
4111
4112 /* Make sockunion for lookup. */
4113 ret = str2sockunion (arg, &su);
4114 if (ret < 0)
4115 {
4116 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004117 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004118 }
4119 peer = peer_lookup (bgp, &su);
4120 if (! peer)
4121 {
4122 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004123 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004124 }
4125
4126 if (stype == BGP_CLEAR_SOFT_NONE)
4127 ret = peer_clear (peer);
4128 else
4129 ret = peer_clear_soft (peer, afi, safi, stype);
4130
4131 if (ret < 0)
4132 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4133
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004134 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004135 }
4136
4137 /* Clear all peer-group members. */
4138 if (sort == clear_group)
4139 {
4140 struct peer_group *group;
4141
4142 group = peer_group_lookup (bgp, arg);
4143 if (! group)
4144 {
4145 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004146 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004147 }
4148
paul1eb8ef22005-04-07 07:30:20 +00004149 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004150 {
4151 if (stype == BGP_CLEAR_SOFT_NONE)
4152 {
4153 ret = peer_clear (peer);
4154 continue;
4155 }
4156
4157 if (! peer->af_group[afi][safi])
4158 continue;
4159
4160 ret = peer_clear_soft (peer, afi, safi, stype);
4161
4162 if (ret < 0)
4163 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4164 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004165 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004166 }
4167
4168 if (sort == clear_external)
4169 {
paul1eb8ef22005-04-07 07:30:20 +00004170 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004171 {
4172 if (peer_sort (peer) == BGP_PEER_IBGP)
4173 continue;
4174
4175 if (stype == BGP_CLEAR_SOFT_NONE)
4176 ret = peer_clear (peer);
4177 else
4178 ret = peer_clear_soft (peer, afi, safi, stype);
4179
4180 if (ret < 0)
4181 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4182 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004183 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004184 }
4185
4186 if (sort == clear_as)
4187 {
4188 as_t as;
4189 unsigned long as_ul;
paul718e3742002-12-13 20:15:29 +00004190 int find = 0;
4191
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004192 VTY_GET_LONG ("AS", as_ul, arg);
4193
4194 if (!as_ul)
paul718e3742002-12-13 20:15:29 +00004195 {
4196 vty_out (vty, "Invalid AS number%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004197 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004198 }
4199 as = (as_t) as_ul;
4200
paul1eb8ef22005-04-07 07:30:20 +00004201 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004202 {
4203 if (peer->as != as)
4204 continue;
4205
4206 find = 1;
4207 if (stype == BGP_CLEAR_SOFT_NONE)
4208 ret = peer_clear (peer);
4209 else
4210 ret = peer_clear_soft (peer, afi, safi, stype);
4211
4212 if (ret < 0)
4213 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4214 }
4215 if (! find)
4216 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4217 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004218 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004219 }
4220
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004221 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004222}
4223
paul94f2b392005-06-28 12:44:16 +00004224static int
paulfd79ac92004-10-13 05:06:08 +00004225bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4226 enum clear_sort sort, enum bgp_clear_type stype,
4227 const char *arg)
paul718e3742002-12-13 20:15:29 +00004228{
paul718e3742002-12-13 20:15:29 +00004229 struct bgp *bgp;
4230
4231 /* BGP structure lookup. */
4232 if (name)
4233 {
4234 bgp = bgp_lookup_by_name (name);
4235 if (bgp == NULL)
4236 {
4237 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4238 return CMD_WARNING;
4239 }
4240 }
4241 else
4242 {
4243 bgp = bgp_get_default ();
4244 if (bgp == NULL)
4245 {
4246 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4247 return CMD_WARNING;
4248 }
4249 }
4250
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004251 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004252}
4253
4254DEFUN (clear_ip_bgp_all,
4255 clear_ip_bgp_all_cmd,
4256 "clear ip bgp *",
4257 CLEAR_STR
4258 IP_STR
4259 BGP_STR
4260 "Clear all peers\n")
4261{
4262 if (argc == 1)
4263 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4264
4265 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4266}
4267
4268ALIAS (clear_ip_bgp_all,
4269 clear_bgp_all_cmd,
4270 "clear bgp *",
4271 CLEAR_STR
4272 BGP_STR
4273 "Clear all peers\n")
4274
4275ALIAS (clear_ip_bgp_all,
4276 clear_bgp_ipv6_all_cmd,
4277 "clear bgp ipv6 *",
4278 CLEAR_STR
4279 BGP_STR
4280 "Address family\n"
4281 "Clear all peers\n")
4282
4283ALIAS (clear_ip_bgp_all,
4284 clear_ip_bgp_instance_all_cmd,
4285 "clear ip bgp view WORD *",
4286 CLEAR_STR
4287 IP_STR
4288 BGP_STR
4289 "BGP view\n"
4290 "view name\n"
4291 "Clear all peers\n")
4292
4293ALIAS (clear_ip_bgp_all,
4294 clear_bgp_instance_all_cmd,
4295 "clear bgp view WORD *",
4296 CLEAR_STR
4297 BGP_STR
4298 "BGP view\n"
4299 "view name\n"
4300 "Clear all peers\n")
4301
4302DEFUN (clear_ip_bgp_peer,
4303 clear_ip_bgp_peer_cmd,
4304 "clear ip bgp (A.B.C.D|X:X::X:X)",
4305 CLEAR_STR
4306 IP_STR
4307 BGP_STR
4308 "BGP neighbor IP address to clear\n"
4309 "BGP IPv6 neighbor to clear\n")
4310{
4311 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4312}
4313
4314ALIAS (clear_ip_bgp_peer,
4315 clear_bgp_peer_cmd,
4316 "clear bgp (A.B.C.D|X:X::X:X)",
4317 CLEAR_STR
4318 BGP_STR
4319 "BGP neighbor address to clear\n"
4320 "BGP IPv6 neighbor to clear\n")
4321
4322ALIAS (clear_ip_bgp_peer,
4323 clear_bgp_ipv6_peer_cmd,
4324 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4325 CLEAR_STR
4326 BGP_STR
4327 "Address family\n"
4328 "BGP neighbor address to clear\n"
4329 "BGP IPv6 neighbor to clear\n")
4330
4331DEFUN (clear_ip_bgp_peer_group,
4332 clear_ip_bgp_peer_group_cmd,
4333 "clear ip bgp peer-group WORD",
4334 CLEAR_STR
4335 IP_STR
4336 BGP_STR
4337 "Clear all members of peer-group\n"
4338 "BGP peer-group name\n")
4339{
4340 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4341}
4342
4343ALIAS (clear_ip_bgp_peer_group,
4344 clear_bgp_peer_group_cmd,
4345 "clear bgp peer-group WORD",
4346 CLEAR_STR
4347 BGP_STR
4348 "Clear all members of peer-group\n"
4349 "BGP peer-group name\n")
4350
4351ALIAS (clear_ip_bgp_peer_group,
4352 clear_bgp_ipv6_peer_group_cmd,
4353 "clear bgp ipv6 peer-group WORD",
4354 CLEAR_STR
4355 BGP_STR
4356 "Address family\n"
4357 "Clear all members of peer-group\n"
4358 "BGP peer-group name\n")
4359
4360DEFUN (clear_ip_bgp_external,
4361 clear_ip_bgp_external_cmd,
4362 "clear ip bgp external",
4363 CLEAR_STR
4364 IP_STR
4365 BGP_STR
4366 "Clear all external peers\n")
4367{
4368 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4369}
4370
4371ALIAS (clear_ip_bgp_external,
4372 clear_bgp_external_cmd,
4373 "clear bgp external",
4374 CLEAR_STR
4375 BGP_STR
4376 "Clear all external peers\n")
4377
4378ALIAS (clear_ip_bgp_external,
4379 clear_bgp_ipv6_external_cmd,
4380 "clear bgp ipv6 external",
4381 CLEAR_STR
4382 BGP_STR
4383 "Address family\n"
4384 "Clear all external peers\n")
4385
4386DEFUN (clear_ip_bgp_as,
4387 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004388 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004389 CLEAR_STR
4390 IP_STR
4391 BGP_STR
4392 "Clear peers with the AS number\n")
4393{
4394 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4395}
4396
4397ALIAS (clear_ip_bgp_as,
4398 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004399 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004400 CLEAR_STR
4401 BGP_STR
4402 "Clear peers with the AS number\n")
4403
4404ALIAS (clear_ip_bgp_as,
4405 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004406 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004407 CLEAR_STR
4408 BGP_STR
4409 "Address family\n"
4410 "Clear peers with the AS number\n")
4411
4412/* Outbound soft-reconfiguration */
4413DEFUN (clear_ip_bgp_all_soft_out,
4414 clear_ip_bgp_all_soft_out_cmd,
4415 "clear ip bgp * soft out",
4416 CLEAR_STR
4417 IP_STR
4418 BGP_STR
4419 "Clear all peers\n"
4420 "Soft reconfig\n"
4421 "Soft reconfig outbound update\n")
4422{
4423 if (argc == 1)
4424 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4425 BGP_CLEAR_SOFT_OUT, NULL);
4426
4427 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4428 BGP_CLEAR_SOFT_OUT, NULL);
4429}
4430
4431ALIAS (clear_ip_bgp_all_soft_out,
4432 clear_ip_bgp_all_out_cmd,
4433 "clear ip bgp * out",
4434 CLEAR_STR
4435 IP_STR
4436 BGP_STR
4437 "Clear all peers\n"
4438 "Soft reconfig outbound update\n")
4439
4440ALIAS (clear_ip_bgp_all_soft_out,
4441 clear_ip_bgp_instance_all_soft_out_cmd,
4442 "clear ip bgp view WORD * soft out",
4443 CLEAR_STR
4444 IP_STR
4445 BGP_STR
4446 "BGP view\n"
4447 "view name\n"
4448 "Clear all peers\n"
4449 "Soft reconfig\n"
4450 "Soft reconfig outbound update\n")
4451
4452DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4453 clear_ip_bgp_all_ipv4_soft_out_cmd,
4454 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4455 CLEAR_STR
4456 IP_STR
4457 BGP_STR
4458 "Clear all peers\n"
4459 "Address family\n"
4460 "Address Family modifier\n"
4461 "Address Family modifier\n"
4462 "Soft reconfig\n"
4463 "Soft reconfig outbound update\n")
4464{
4465 if (strncmp (argv[0], "m", 1) == 0)
4466 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4467 BGP_CLEAR_SOFT_OUT, NULL);
4468
4469 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4470 BGP_CLEAR_SOFT_OUT, NULL);
4471}
4472
4473ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4474 clear_ip_bgp_all_ipv4_out_cmd,
4475 "clear ip bgp * ipv4 (unicast|multicast) out",
4476 CLEAR_STR
4477 IP_STR
4478 BGP_STR
4479 "Clear all peers\n"
4480 "Address family\n"
4481 "Address Family modifier\n"
4482 "Address Family modifier\n"
4483 "Soft reconfig outbound update\n")
4484
4485DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4486 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4487 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4488 CLEAR_STR
4489 IP_STR
4490 BGP_STR
4491 "BGP view\n"
4492 "view name\n"
4493 "Clear all peers\n"
4494 "Address family\n"
4495 "Address Family modifier\n"
4496 "Address Family modifier\n"
4497 "Soft reconfig outbound update\n")
4498{
4499 if (strncmp (argv[1], "m", 1) == 0)
4500 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4501 BGP_CLEAR_SOFT_OUT, NULL);
4502
4503 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4504 BGP_CLEAR_SOFT_OUT, NULL);
4505}
4506
4507DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4508 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4509 "clear ip bgp * vpnv4 unicast soft out",
4510 CLEAR_STR
4511 IP_STR
4512 BGP_STR
4513 "Clear all peers\n"
4514 "Address family\n"
4515 "Address Family Modifier\n"
4516 "Soft reconfig\n"
4517 "Soft reconfig outbound update\n")
4518{
4519 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4520 BGP_CLEAR_SOFT_OUT, NULL);
4521}
4522
4523ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4524 clear_ip_bgp_all_vpnv4_out_cmd,
4525 "clear ip bgp * vpnv4 unicast out",
4526 CLEAR_STR
4527 IP_STR
4528 BGP_STR
4529 "Clear all peers\n"
4530 "Address family\n"
4531 "Address Family Modifier\n"
4532 "Soft reconfig outbound update\n")
4533
4534DEFUN (clear_bgp_all_soft_out,
4535 clear_bgp_all_soft_out_cmd,
4536 "clear bgp * soft out",
4537 CLEAR_STR
4538 BGP_STR
4539 "Clear all peers\n"
4540 "Soft reconfig\n"
4541 "Soft reconfig outbound update\n")
4542{
4543 if (argc == 1)
4544 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4545 BGP_CLEAR_SOFT_OUT, NULL);
4546
4547 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4548 BGP_CLEAR_SOFT_OUT, NULL);
4549}
4550
4551ALIAS (clear_bgp_all_soft_out,
4552 clear_bgp_instance_all_soft_out_cmd,
4553 "clear bgp view WORD * soft out",
4554 CLEAR_STR
4555 BGP_STR
4556 "BGP view\n"
4557 "view name\n"
4558 "Clear all peers\n"
4559 "Soft reconfig\n"
4560 "Soft reconfig outbound update\n")
4561
4562ALIAS (clear_bgp_all_soft_out,
4563 clear_bgp_all_out_cmd,
4564 "clear bgp * out",
4565 CLEAR_STR
4566 BGP_STR
4567 "Clear all peers\n"
4568 "Soft reconfig outbound update\n")
4569
4570ALIAS (clear_bgp_all_soft_out,
4571 clear_bgp_ipv6_all_soft_out_cmd,
4572 "clear bgp ipv6 * soft out",
4573 CLEAR_STR
4574 BGP_STR
4575 "Address family\n"
4576 "Clear all peers\n"
4577 "Soft reconfig\n"
4578 "Soft reconfig outbound update\n")
4579
4580ALIAS (clear_bgp_all_soft_out,
4581 clear_bgp_ipv6_all_out_cmd,
4582 "clear bgp ipv6 * out",
4583 CLEAR_STR
4584 BGP_STR
4585 "Address family\n"
4586 "Clear all peers\n"
4587 "Soft reconfig outbound update\n")
4588
4589DEFUN (clear_ip_bgp_peer_soft_out,
4590 clear_ip_bgp_peer_soft_out_cmd,
4591 "clear ip bgp A.B.C.D soft out",
4592 CLEAR_STR
4593 IP_STR
4594 BGP_STR
4595 "BGP neighbor address to clear\n"
4596 "Soft reconfig\n"
4597 "Soft reconfig outbound update\n")
4598{
4599 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4600 BGP_CLEAR_SOFT_OUT, argv[0]);
4601}
4602
4603ALIAS (clear_ip_bgp_peer_soft_out,
4604 clear_ip_bgp_peer_out_cmd,
4605 "clear ip bgp A.B.C.D out",
4606 CLEAR_STR
4607 IP_STR
4608 BGP_STR
4609 "BGP neighbor address to clear\n"
4610 "Soft reconfig outbound update\n")
4611
4612DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4613 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4614 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4615 CLEAR_STR
4616 IP_STR
4617 BGP_STR
4618 "BGP neighbor address to clear\n"
4619 "Address family\n"
4620 "Address Family modifier\n"
4621 "Address Family modifier\n"
4622 "Soft reconfig\n"
4623 "Soft reconfig outbound update\n")
4624{
4625 if (strncmp (argv[1], "m", 1) == 0)
4626 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4627 BGP_CLEAR_SOFT_OUT, argv[0]);
4628
4629 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4630 BGP_CLEAR_SOFT_OUT, argv[0]);
4631}
4632
4633ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
4634 clear_ip_bgp_peer_ipv4_out_cmd,
4635 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
4636 CLEAR_STR
4637 IP_STR
4638 BGP_STR
4639 "BGP neighbor address to clear\n"
4640 "Address family\n"
4641 "Address Family modifier\n"
4642 "Address Family modifier\n"
4643 "Soft reconfig outbound update\n")
4644
4645DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
4646 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
4647 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
4648 CLEAR_STR
4649 IP_STR
4650 BGP_STR
4651 "BGP neighbor address to clear\n"
4652 "Address family\n"
4653 "Address Family Modifier\n"
4654 "Soft reconfig\n"
4655 "Soft reconfig outbound update\n")
4656{
4657 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
4658 BGP_CLEAR_SOFT_OUT, argv[0]);
4659}
4660
4661ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
4662 clear_ip_bgp_peer_vpnv4_out_cmd,
4663 "clear ip bgp A.B.C.D vpnv4 unicast out",
4664 CLEAR_STR
4665 IP_STR
4666 BGP_STR
4667 "BGP neighbor address to clear\n"
4668 "Address family\n"
4669 "Address Family Modifier\n"
4670 "Soft reconfig outbound update\n")
4671
4672DEFUN (clear_bgp_peer_soft_out,
4673 clear_bgp_peer_soft_out_cmd,
4674 "clear bgp (A.B.C.D|X:X::X:X) soft out",
4675 CLEAR_STR
4676 BGP_STR
4677 "BGP neighbor address to clear\n"
4678 "BGP IPv6 neighbor to clear\n"
4679 "Soft reconfig\n"
4680 "Soft reconfig outbound update\n")
4681{
4682 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
4683 BGP_CLEAR_SOFT_OUT, argv[0]);
4684}
4685
4686ALIAS (clear_bgp_peer_soft_out,
4687 clear_bgp_ipv6_peer_soft_out_cmd,
4688 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
4689 CLEAR_STR
4690 BGP_STR
4691 "Address family\n"
4692 "BGP neighbor address to clear\n"
4693 "BGP IPv6 neighbor to clear\n"
4694 "Soft reconfig\n"
4695 "Soft reconfig outbound update\n")
4696
4697ALIAS (clear_bgp_peer_soft_out,
4698 clear_bgp_peer_out_cmd,
4699 "clear bgp (A.B.C.D|X:X::X:X) out",
4700 CLEAR_STR
4701 BGP_STR
4702 "BGP neighbor address to clear\n"
4703 "BGP IPv6 neighbor to clear\n"
4704 "Soft reconfig outbound update\n")
4705
4706ALIAS (clear_bgp_peer_soft_out,
4707 clear_bgp_ipv6_peer_out_cmd,
4708 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
4709 CLEAR_STR
4710 BGP_STR
4711 "Address family\n"
4712 "BGP neighbor address to clear\n"
4713 "BGP IPv6 neighbor to clear\n"
4714 "Soft reconfig outbound update\n")
4715
4716DEFUN (clear_ip_bgp_peer_group_soft_out,
4717 clear_ip_bgp_peer_group_soft_out_cmd,
4718 "clear ip bgp peer-group WORD soft out",
4719 CLEAR_STR
4720 IP_STR
4721 BGP_STR
4722 "Clear all members of peer-group\n"
4723 "BGP peer-group name\n"
4724 "Soft reconfig\n"
4725 "Soft reconfig outbound update\n")
4726{
4727 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4728 BGP_CLEAR_SOFT_OUT, argv[0]);
4729}
4730
4731ALIAS (clear_ip_bgp_peer_group_soft_out,
4732 clear_ip_bgp_peer_group_out_cmd,
4733 "clear ip bgp peer-group WORD out",
4734 CLEAR_STR
4735 IP_STR
4736 BGP_STR
4737 "Clear all members of peer-group\n"
4738 "BGP peer-group name\n"
4739 "Soft reconfig outbound update\n")
4740
4741DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
4742 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
4743 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
4744 CLEAR_STR
4745 IP_STR
4746 BGP_STR
4747 "Clear all members of peer-group\n"
4748 "BGP peer-group name\n"
4749 "Address family\n"
4750 "Address Family modifier\n"
4751 "Address Family modifier\n"
4752 "Soft reconfig\n"
4753 "Soft reconfig outbound update\n")
4754{
4755 if (strncmp (argv[1], "m", 1) == 0)
4756 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
4757 BGP_CLEAR_SOFT_OUT, argv[0]);
4758
4759 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4760 BGP_CLEAR_SOFT_OUT, argv[0]);
4761}
4762
4763ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
4764 clear_ip_bgp_peer_group_ipv4_out_cmd,
4765 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
4766 CLEAR_STR
4767 IP_STR
4768 BGP_STR
4769 "Clear all members of peer-group\n"
4770 "BGP peer-group name\n"
4771 "Address family\n"
4772 "Address Family modifier\n"
4773 "Address Family modifier\n"
4774 "Soft reconfig outbound update\n")
4775
4776DEFUN (clear_bgp_peer_group_soft_out,
4777 clear_bgp_peer_group_soft_out_cmd,
4778 "clear bgp peer-group WORD soft out",
4779 CLEAR_STR
4780 BGP_STR
4781 "Clear all members of peer-group\n"
4782 "BGP peer-group name\n"
4783 "Soft reconfig\n"
4784 "Soft reconfig outbound update\n")
4785{
4786 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
4787 BGP_CLEAR_SOFT_OUT, argv[0]);
4788}
4789
4790ALIAS (clear_bgp_peer_group_soft_out,
4791 clear_bgp_ipv6_peer_group_soft_out_cmd,
4792 "clear bgp ipv6 peer-group WORD soft out",
4793 CLEAR_STR
4794 BGP_STR
4795 "Address family\n"
4796 "Clear all members of peer-group\n"
4797 "BGP peer-group name\n"
4798 "Soft reconfig\n"
4799 "Soft reconfig outbound update\n")
4800
4801ALIAS (clear_bgp_peer_group_soft_out,
4802 clear_bgp_peer_group_out_cmd,
4803 "clear bgp peer-group WORD out",
4804 CLEAR_STR
4805 BGP_STR
4806 "Clear all members of peer-group\n"
4807 "BGP peer-group name\n"
4808 "Soft reconfig outbound update\n")
4809
4810ALIAS (clear_bgp_peer_group_soft_out,
4811 clear_bgp_ipv6_peer_group_out_cmd,
4812 "clear bgp ipv6 peer-group WORD out",
4813 CLEAR_STR
4814 BGP_STR
4815 "Address family\n"
4816 "Clear all members of peer-group\n"
4817 "BGP peer-group name\n"
4818 "Soft reconfig outbound update\n")
4819
4820DEFUN (clear_ip_bgp_external_soft_out,
4821 clear_ip_bgp_external_soft_out_cmd,
4822 "clear ip bgp external soft out",
4823 CLEAR_STR
4824 IP_STR
4825 BGP_STR
4826 "Clear all external peers\n"
4827 "Soft reconfig\n"
4828 "Soft reconfig outbound update\n")
4829{
4830 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
4831 BGP_CLEAR_SOFT_OUT, NULL);
4832}
4833
4834ALIAS (clear_ip_bgp_external_soft_out,
4835 clear_ip_bgp_external_out_cmd,
4836 "clear ip bgp external out",
4837 CLEAR_STR
4838 IP_STR
4839 BGP_STR
4840 "Clear all external peers\n"
4841 "Soft reconfig outbound update\n")
4842
4843DEFUN (clear_ip_bgp_external_ipv4_soft_out,
4844 clear_ip_bgp_external_ipv4_soft_out_cmd,
4845 "clear ip bgp external ipv4 (unicast|multicast) soft out",
4846 CLEAR_STR
4847 IP_STR
4848 BGP_STR
4849 "Clear all external peers\n"
4850 "Address family\n"
4851 "Address Family modifier\n"
4852 "Address Family modifier\n"
4853 "Soft reconfig\n"
4854 "Soft reconfig outbound update\n")
4855{
4856 if (strncmp (argv[0], "m", 1) == 0)
4857 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
4858 BGP_CLEAR_SOFT_OUT, NULL);
4859
4860 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
4861 BGP_CLEAR_SOFT_OUT, NULL);
4862}
4863
4864ALIAS (clear_ip_bgp_external_ipv4_soft_out,
4865 clear_ip_bgp_external_ipv4_out_cmd,
4866 "clear ip bgp external ipv4 (unicast|multicast) out",
4867 CLEAR_STR
4868 IP_STR
4869 BGP_STR
4870 "Clear all external peers\n"
4871 "Address family\n"
4872 "Address Family modifier\n"
4873 "Address Family modifier\n"
4874 "Soft reconfig outbound update\n")
4875
4876DEFUN (clear_bgp_external_soft_out,
4877 clear_bgp_external_soft_out_cmd,
4878 "clear bgp external soft out",
4879 CLEAR_STR
4880 BGP_STR
4881 "Clear all external peers\n"
4882 "Soft reconfig\n"
4883 "Soft reconfig outbound update\n")
4884{
4885 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
4886 BGP_CLEAR_SOFT_OUT, NULL);
4887}
4888
4889ALIAS (clear_bgp_external_soft_out,
4890 clear_bgp_ipv6_external_soft_out_cmd,
4891 "clear bgp ipv6 external soft out",
4892 CLEAR_STR
4893 BGP_STR
4894 "Address family\n"
4895 "Clear all external peers\n"
4896 "Soft reconfig\n"
4897 "Soft reconfig outbound update\n")
4898
4899ALIAS (clear_bgp_external_soft_out,
4900 clear_bgp_external_out_cmd,
4901 "clear bgp external out",
4902 CLEAR_STR
4903 BGP_STR
4904 "Clear all external peers\n"
4905 "Soft reconfig outbound update\n")
4906
4907ALIAS (clear_bgp_external_soft_out,
4908 clear_bgp_ipv6_external_out_cmd,
4909 "clear bgp ipv6 external WORD out",
4910 CLEAR_STR
4911 BGP_STR
4912 "Address family\n"
4913 "Clear all external peers\n"
4914 "Soft reconfig outbound update\n")
4915
4916DEFUN (clear_ip_bgp_as_soft_out,
4917 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004918 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00004919 CLEAR_STR
4920 IP_STR
4921 BGP_STR
4922 "Clear peers with the AS number\n"
4923 "Soft reconfig\n"
4924 "Soft reconfig outbound update\n")
4925{
4926 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
4927 BGP_CLEAR_SOFT_OUT, argv[0]);
4928}
4929
4930ALIAS (clear_ip_bgp_as_soft_out,
4931 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004932 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00004933 CLEAR_STR
4934 IP_STR
4935 BGP_STR
4936 "Clear peers with the AS number\n"
4937 "Soft reconfig outbound update\n")
4938
4939DEFUN (clear_ip_bgp_as_ipv4_soft_out,
4940 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004941 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00004942 CLEAR_STR
4943 IP_STR
4944 BGP_STR
4945 "Clear peers with the AS number\n"
4946 "Address family\n"
4947 "Address Family modifier\n"
4948 "Address Family modifier\n"
4949 "Soft reconfig\n"
4950 "Soft reconfig outbound update\n")
4951{
4952 if (strncmp (argv[1], "m", 1) == 0)
4953 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
4954 BGP_CLEAR_SOFT_OUT, argv[0]);
4955
4956 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
4957 BGP_CLEAR_SOFT_OUT, argv[0]);
4958}
4959
4960ALIAS (clear_ip_bgp_as_ipv4_soft_out,
4961 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004962 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00004963 CLEAR_STR
4964 IP_STR
4965 BGP_STR
4966 "Clear peers with the AS number\n"
4967 "Address family\n"
4968 "Address Family modifier\n"
4969 "Address Family modifier\n"
4970 "Soft reconfig outbound update\n")
4971
4972DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
4973 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004974 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00004975 CLEAR_STR
4976 IP_STR
4977 BGP_STR
4978 "Clear peers with the AS number\n"
4979 "Address family\n"
4980 "Address Family modifier\n"
4981 "Soft reconfig\n"
4982 "Soft reconfig outbound update\n")
4983{
4984 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
4985 BGP_CLEAR_SOFT_OUT, argv[0]);
4986}
4987
4988ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
4989 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004990 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00004991 CLEAR_STR
4992 IP_STR
4993 BGP_STR
4994 "Clear peers with the AS number\n"
4995 "Address family\n"
4996 "Address Family modifier\n"
4997 "Soft reconfig outbound update\n")
4998
4999DEFUN (clear_bgp_as_soft_out,
5000 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005001 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005002 CLEAR_STR
5003 BGP_STR
5004 "Clear peers with the AS number\n"
5005 "Soft reconfig\n"
5006 "Soft reconfig outbound update\n")
5007{
5008 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5009 BGP_CLEAR_SOFT_OUT, argv[0]);
5010}
5011
5012ALIAS (clear_bgp_as_soft_out,
5013 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005014 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005015 CLEAR_STR
5016 BGP_STR
5017 "Address family\n"
5018 "Clear peers with the AS number\n"
5019 "Soft reconfig\n"
5020 "Soft reconfig outbound update\n")
5021
5022ALIAS (clear_bgp_as_soft_out,
5023 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005024 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005025 CLEAR_STR
5026 BGP_STR
5027 "Clear peers with the AS number\n"
5028 "Soft reconfig outbound update\n")
5029
5030ALIAS (clear_bgp_as_soft_out,
5031 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005032 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005033 CLEAR_STR
5034 BGP_STR
5035 "Address family\n"
5036 "Clear peers with the AS number\n"
5037 "Soft reconfig outbound update\n")
5038
5039/* Inbound soft-reconfiguration */
5040DEFUN (clear_ip_bgp_all_soft_in,
5041 clear_ip_bgp_all_soft_in_cmd,
5042 "clear ip bgp * soft in",
5043 CLEAR_STR
5044 IP_STR
5045 BGP_STR
5046 "Clear all peers\n"
5047 "Soft reconfig\n"
5048 "Soft reconfig inbound update\n")
5049{
5050 if (argc == 1)
5051 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5052 BGP_CLEAR_SOFT_IN, NULL);
5053
5054 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5055 BGP_CLEAR_SOFT_IN, NULL);
5056}
5057
5058ALIAS (clear_ip_bgp_all_soft_in,
5059 clear_ip_bgp_instance_all_soft_in_cmd,
5060 "clear ip bgp view WORD * soft in",
5061 CLEAR_STR
5062 IP_STR
5063 BGP_STR
5064 "BGP view\n"
5065 "view name\n"
5066 "Clear all peers\n"
5067 "Soft reconfig\n"
5068 "Soft reconfig inbound update\n")
5069
5070ALIAS (clear_ip_bgp_all_soft_in,
5071 clear_ip_bgp_all_in_cmd,
5072 "clear ip bgp * in",
5073 CLEAR_STR
5074 IP_STR
5075 BGP_STR
5076 "Clear all peers\n"
5077 "Soft reconfig inbound update\n")
5078
5079DEFUN (clear_ip_bgp_all_in_prefix_filter,
5080 clear_ip_bgp_all_in_prefix_filter_cmd,
5081 "clear ip bgp * in prefix-filter",
5082 CLEAR_STR
5083 IP_STR
5084 BGP_STR
5085 "Clear all peers\n"
5086 "Soft reconfig inbound update\n"
5087 "Push out prefix-list ORF and do inbound soft reconfig\n")
5088{
5089 if (argc== 1)
5090 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5091 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5092
5093 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5094 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5095}
5096
5097ALIAS (clear_ip_bgp_all_in_prefix_filter,
5098 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5099 "clear ip bgp view WORD * in prefix-filter",
5100 CLEAR_STR
5101 IP_STR
5102 BGP_STR
5103 "BGP view\n"
5104 "view name\n"
5105 "Clear all peers\n"
5106 "Soft reconfig inbound update\n"
5107 "Push out prefix-list ORF and do inbound soft reconfig\n")
5108
5109
5110DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5111 clear_ip_bgp_all_ipv4_soft_in_cmd,
5112 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5113 CLEAR_STR
5114 IP_STR
5115 BGP_STR
5116 "Clear all peers\n"
5117 "Address family\n"
5118 "Address Family modifier\n"
5119 "Address Family modifier\n"
5120 "Soft reconfig\n"
5121 "Soft reconfig inbound update\n")
5122{
5123 if (strncmp (argv[0], "m", 1) == 0)
5124 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5125 BGP_CLEAR_SOFT_IN, NULL);
5126
5127 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5128 BGP_CLEAR_SOFT_IN, NULL);
5129}
5130
5131ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5132 clear_ip_bgp_all_ipv4_in_cmd,
5133 "clear ip bgp * ipv4 (unicast|multicast) in",
5134 CLEAR_STR
5135 IP_STR
5136 BGP_STR
5137 "Clear all peers\n"
5138 "Address family\n"
5139 "Address Family modifier\n"
5140 "Address Family modifier\n"
5141 "Soft reconfig inbound update\n")
5142
5143DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5144 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5145 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5146 CLEAR_STR
5147 IP_STR
5148 BGP_STR
5149 "BGP view\n"
5150 "view name\n"
5151 "Clear all peers\n"
5152 "Address family\n"
5153 "Address Family modifier\n"
5154 "Address Family modifier\n"
5155 "Soft reconfig\n"
5156 "Soft reconfig inbound update\n")
5157{
5158 if (strncmp (argv[1], "m", 1) == 0)
5159 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5160 BGP_CLEAR_SOFT_IN, NULL);
5161
5162 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5163 BGP_CLEAR_SOFT_IN, NULL);
5164}
5165
5166DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5167 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5168 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5169 CLEAR_STR
5170 IP_STR
5171 BGP_STR
5172 "Clear all peers\n"
5173 "Address family\n"
5174 "Address Family modifier\n"
5175 "Address Family modifier\n"
5176 "Soft reconfig inbound update\n"
5177 "Push out prefix-list ORF and do inbound soft reconfig\n")
5178{
5179 if (strncmp (argv[0], "m", 1) == 0)
5180 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5181 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5182
5183 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5184 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5185}
5186
5187DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5188 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5189 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5190 CLEAR_STR
5191 IP_STR
5192 BGP_STR
5193 "Clear all peers\n"
5194 "Address family\n"
5195 "Address Family modifier\n"
5196 "Address Family modifier\n"
5197 "Soft reconfig inbound update\n"
5198 "Push out prefix-list ORF and do inbound soft reconfig\n")
5199{
5200 if (strncmp (argv[1], "m", 1) == 0)
5201 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5202 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5203
5204 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5205 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5206}
5207
5208DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5209 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5210 "clear ip bgp * vpnv4 unicast soft in",
5211 CLEAR_STR
5212 IP_STR
5213 BGP_STR
5214 "Clear all peers\n"
5215 "Address family\n"
5216 "Address Family Modifier\n"
5217 "Soft reconfig\n"
5218 "Soft reconfig inbound update\n")
5219{
5220 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5221 BGP_CLEAR_SOFT_IN, NULL);
5222}
5223
5224ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5225 clear_ip_bgp_all_vpnv4_in_cmd,
5226 "clear ip bgp * vpnv4 unicast in",
5227 CLEAR_STR
5228 IP_STR
5229 BGP_STR
5230 "Clear all peers\n"
5231 "Address family\n"
5232 "Address Family Modifier\n"
5233 "Soft reconfig inbound update\n")
5234
5235DEFUN (clear_bgp_all_soft_in,
5236 clear_bgp_all_soft_in_cmd,
5237 "clear bgp * soft in",
5238 CLEAR_STR
5239 BGP_STR
5240 "Clear all peers\n"
5241 "Soft reconfig\n"
5242 "Soft reconfig inbound update\n")
5243{
5244 if (argc == 1)
5245 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5246 BGP_CLEAR_SOFT_IN, NULL);
5247
5248 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5249 BGP_CLEAR_SOFT_IN, NULL);
5250}
5251
5252ALIAS (clear_bgp_all_soft_in,
5253 clear_bgp_instance_all_soft_in_cmd,
5254 "clear bgp view WORD * soft in",
5255 CLEAR_STR
5256 BGP_STR
5257 "BGP view\n"
5258 "view name\n"
5259 "Clear all peers\n"
5260 "Soft reconfig\n"
5261 "Soft reconfig inbound update\n")
5262
5263ALIAS (clear_bgp_all_soft_in,
5264 clear_bgp_ipv6_all_soft_in_cmd,
5265 "clear bgp ipv6 * soft in",
5266 CLEAR_STR
5267 BGP_STR
5268 "Address family\n"
5269 "Clear all peers\n"
5270 "Soft reconfig\n"
5271 "Soft reconfig inbound update\n")
5272
5273ALIAS (clear_bgp_all_soft_in,
5274 clear_bgp_all_in_cmd,
5275 "clear bgp * in",
5276 CLEAR_STR
5277 BGP_STR
5278 "Clear all peers\n"
5279 "Soft reconfig inbound update\n")
5280
5281ALIAS (clear_bgp_all_soft_in,
5282 clear_bgp_ipv6_all_in_cmd,
5283 "clear bgp ipv6 * in",
5284 CLEAR_STR
5285 BGP_STR
5286 "Address family\n"
5287 "Clear all peers\n"
5288 "Soft reconfig inbound update\n")
5289
5290DEFUN (clear_bgp_all_in_prefix_filter,
5291 clear_bgp_all_in_prefix_filter_cmd,
5292 "clear bgp * in prefix-filter",
5293 CLEAR_STR
5294 BGP_STR
5295 "Clear all peers\n"
5296 "Soft reconfig inbound update\n"
5297 "Push out prefix-list ORF and do inbound soft reconfig\n")
5298{
5299 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5300 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5301}
5302
5303ALIAS (clear_bgp_all_in_prefix_filter,
5304 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5305 "clear bgp ipv6 * in prefix-filter",
5306 CLEAR_STR
5307 BGP_STR
5308 "Address family\n"
5309 "Clear all peers\n"
5310 "Soft reconfig inbound update\n"
5311 "Push out prefix-list ORF and do inbound soft reconfig\n")
5312
5313DEFUN (clear_ip_bgp_peer_soft_in,
5314 clear_ip_bgp_peer_soft_in_cmd,
5315 "clear ip bgp A.B.C.D soft in",
5316 CLEAR_STR
5317 IP_STR
5318 BGP_STR
5319 "BGP neighbor address to clear\n"
5320 "Soft reconfig\n"
5321 "Soft reconfig inbound update\n")
5322{
5323 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5324 BGP_CLEAR_SOFT_IN, argv[0]);
5325}
5326
5327ALIAS (clear_ip_bgp_peer_soft_in,
5328 clear_ip_bgp_peer_in_cmd,
5329 "clear ip bgp A.B.C.D in",
5330 CLEAR_STR
5331 IP_STR
5332 BGP_STR
5333 "BGP neighbor address to clear\n"
5334 "Soft reconfig inbound update\n")
5335
5336DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5337 clear_ip_bgp_peer_in_prefix_filter_cmd,
5338 "clear ip bgp A.B.C.D in prefix-filter",
5339 CLEAR_STR
5340 IP_STR
5341 BGP_STR
5342 "BGP neighbor address to clear\n"
5343 "Soft reconfig inbound update\n"
5344 "Push out the existing ORF prefix-list\n")
5345{
5346 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5347 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5348}
5349
5350DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5351 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5352 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5353 CLEAR_STR
5354 IP_STR
5355 BGP_STR
5356 "BGP neighbor address to clear\n"
5357 "Address family\n"
5358 "Address Family modifier\n"
5359 "Address Family modifier\n"
5360 "Soft reconfig\n"
5361 "Soft reconfig inbound update\n")
5362{
5363 if (strncmp (argv[1], "m", 1) == 0)
5364 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5365 BGP_CLEAR_SOFT_IN, argv[0]);
5366
5367 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5368 BGP_CLEAR_SOFT_IN, argv[0]);
5369}
5370
5371ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5372 clear_ip_bgp_peer_ipv4_in_cmd,
5373 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5374 CLEAR_STR
5375 IP_STR
5376 BGP_STR
5377 "BGP neighbor address to clear\n"
5378 "Address family\n"
5379 "Address Family modifier\n"
5380 "Address Family modifier\n"
5381 "Soft reconfig inbound update\n")
5382
5383DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5384 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5385 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5386 CLEAR_STR
5387 IP_STR
5388 BGP_STR
5389 "BGP neighbor address to clear\n"
5390 "Address family\n"
5391 "Address Family modifier\n"
5392 "Address Family modifier\n"
5393 "Soft reconfig inbound update\n"
5394 "Push out the existing ORF prefix-list\n")
5395{
5396 if (strncmp (argv[1], "m", 1) == 0)
5397 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5398 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5399
5400 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5401 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5402}
5403
5404DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5405 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5406 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5407 CLEAR_STR
5408 IP_STR
5409 BGP_STR
5410 "BGP neighbor address to clear\n"
5411 "Address family\n"
5412 "Address Family Modifier\n"
5413 "Soft reconfig\n"
5414 "Soft reconfig inbound update\n")
5415{
5416 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5417 BGP_CLEAR_SOFT_IN, argv[0]);
5418}
5419
5420ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5421 clear_ip_bgp_peer_vpnv4_in_cmd,
5422 "clear ip bgp A.B.C.D vpnv4 unicast in",
5423 CLEAR_STR
5424 IP_STR
5425 BGP_STR
5426 "BGP neighbor address to clear\n"
5427 "Address family\n"
5428 "Address Family Modifier\n"
5429 "Soft reconfig inbound update\n")
5430
5431DEFUN (clear_bgp_peer_soft_in,
5432 clear_bgp_peer_soft_in_cmd,
5433 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5434 CLEAR_STR
5435 BGP_STR
5436 "BGP neighbor address to clear\n"
5437 "BGP IPv6 neighbor to clear\n"
5438 "Soft reconfig\n"
5439 "Soft reconfig inbound update\n")
5440{
5441 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5442 BGP_CLEAR_SOFT_IN, argv[0]);
5443}
5444
5445ALIAS (clear_bgp_peer_soft_in,
5446 clear_bgp_ipv6_peer_soft_in_cmd,
5447 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5448 CLEAR_STR
5449 BGP_STR
5450 "Address family\n"
5451 "BGP neighbor address to clear\n"
5452 "BGP IPv6 neighbor to clear\n"
5453 "Soft reconfig\n"
5454 "Soft reconfig inbound update\n")
5455
5456ALIAS (clear_bgp_peer_soft_in,
5457 clear_bgp_peer_in_cmd,
5458 "clear bgp (A.B.C.D|X:X::X:X) in",
5459 CLEAR_STR
5460 BGP_STR
5461 "BGP neighbor address to clear\n"
5462 "BGP IPv6 neighbor to clear\n"
5463 "Soft reconfig inbound update\n")
5464
5465ALIAS (clear_bgp_peer_soft_in,
5466 clear_bgp_ipv6_peer_in_cmd,
5467 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5468 CLEAR_STR
5469 BGP_STR
5470 "Address family\n"
5471 "BGP neighbor address to clear\n"
5472 "BGP IPv6 neighbor to clear\n"
5473 "Soft reconfig inbound update\n")
5474
5475DEFUN (clear_bgp_peer_in_prefix_filter,
5476 clear_bgp_peer_in_prefix_filter_cmd,
5477 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5478 CLEAR_STR
5479 BGP_STR
5480 "BGP neighbor address to clear\n"
5481 "BGP IPv6 neighbor to clear\n"
5482 "Soft reconfig inbound update\n"
5483 "Push out the existing ORF prefix-list\n")
5484{
5485 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5486 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5487}
5488
5489ALIAS (clear_bgp_peer_in_prefix_filter,
5490 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5491 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5492 CLEAR_STR
5493 BGP_STR
5494 "Address family\n"
5495 "BGP neighbor address to clear\n"
5496 "BGP IPv6 neighbor to clear\n"
5497 "Soft reconfig inbound update\n"
5498 "Push out the existing ORF prefix-list\n")
5499
5500DEFUN (clear_ip_bgp_peer_group_soft_in,
5501 clear_ip_bgp_peer_group_soft_in_cmd,
5502 "clear ip bgp peer-group WORD soft in",
5503 CLEAR_STR
5504 IP_STR
5505 BGP_STR
5506 "Clear all members of peer-group\n"
5507 "BGP peer-group name\n"
5508 "Soft reconfig\n"
5509 "Soft reconfig inbound update\n")
5510{
5511 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5512 BGP_CLEAR_SOFT_IN, argv[0]);
5513}
5514
5515ALIAS (clear_ip_bgp_peer_group_soft_in,
5516 clear_ip_bgp_peer_group_in_cmd,
5517 "clear ip bgp peer-group WORD in",
5518 CLEAR_STR
5519 IP_STR
5520 BGP_STR
5521 "Clear all members of peer-group\n"
5522 "BGP peer-group name\n"
5523 "Soft reconfig inbound update\n")
5524
5525DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
5526 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
5527 "clear ip bgp peer-group WORD in prefix-filter",
5528 CLEAR_STR
5529 IP_STR
5530 BGP_STR
5531 "Clear all members of peer-group\n"
5532 "BGP peer-group name\n"
5533 "Soft reconfig inbound update\n"
5534 "Push out prefix-list ORF and do inbound soft reconfig\n")
5535{
5536 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5537 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5538}
5539
5540DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
5541 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
5542 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
5543 CLEAR_STR
5544 IP_STR
5545 BGP_STR
5546 "Clear all members of peer-group\n"
5547 "BGP peer-group name\n"
5548 "Address family\n"
5549 "Address Family modifier\n"
5550 "Address Family modifier\n"
5551 "Soft reconfig\n"
5552 "Soft reconfig inbound update\n")
5553{
5554 if (strncmp (argv[1], "m", 1) == 0)
5555 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5556 BGP_CLEAR_SOFT_IN, argv[0]);
5557
5558 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5559 BGP_CLEAR_SOFT_IN, argv[0]);
5560}
5561
5562ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
5563 clear_ip_bgp_peer_group_ipv4_in_cmd,
5564 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
5565 CLEAR_STR
5566 IP_STR
5567 BGP_STR
5568 "Clear all members of peer-group\n"
5569 "BGP peer-group name\n"
5570 "Address family\n"
5571 "Address Family modifier\n"
5572 "Address Family modifier\n"
5573 "Soft reconfig inbound update\n")
5574
5575DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
5576 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
5577 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
5578 CLEAR_STR
5579 IP_STR
5580 BGP_STR
5581 "Clear all members of peer-group\n"
5582 "BGP peer-group name\n"
5583 "Address family\n"
5584 "Address Family modifier\n"
5585 "Address Family modifier\n"
5586 "Soft reconfig inbound update\n"
5587 "Push out prefix-list ORF and do inbound soft reconfig\n")
5588{
5589 if (strncmp (argv[1], "m", 1) == 0)
5590 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5591 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5592
5593 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5594 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5595}
5596
5597DEFUN (clear_bgp_peer_group_soft_in,
5598 clear_bgp_peer_group_soft_in_cmd,
5599 "clear bgp peer-group WORD soft in",
5600 CLEAR_STR
5601 BGP_STR
5602 "Clear all members of peer-group\n"
5603 "BGP peer-group name\n"
5604 "Soft reconfig\n"
5605 "Soft reconfig inbound update\n")
5606{
5607 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5608 BGP_CLEAR_SOFT_IN, argv[0]);
5609}
5610
5611ALIAS (clear_bgp_peer_group_soft_in,
5612 clear_bgp_ipv6_peer_group_soft_in_cmd,
5613 "clear bgp ipv6 peer-group WORD soft in",
5614 CLEAR_STR
5615 BGP_STR
5616 "Address family\n"
5617 "Clear all members of peer-group\n"
5618 "BGP peer-group name\n"
5619 "Soft reconfig\n"
5620 "Soft reconfig inbound update\n")
5621
5622ALIAS (clear_bgp_peer_group_soft_in,
5623 clear_bgp_peer_group_in_cmd,
5624 "clear bgp peer-group WORD in",
5625 CLEAR_STR
5626 BGP_STR
5627 "Clear all members of peer-group\n"
5628 "BGP peer-group name\n"
5629 "Soft reconfig inbound update\n")
5630
5631ALIAS (clear_bgp_peer_group_soft_in,
5632 clear_bgp_ipv6_peer_group_in_cmd,
5633 "clear bgp ipv6 peer-group WORD in",
5634 CLEAR_STR
5635 BGP_STR
5636 "Address family\n"
5637 "Clear all members of peer-group\n"
5638 "BGP peer-group name\n"
5639 "Soft reconfig inbound update\n")
5640
5641DEFUN (clear_bgp_peer_group_in_prefix_filter,
5642 clear_bgp_peer_group_in_prefix_filter_cmd,
5643 "clear bgp peer-group WORD in prefix-filter",
5644 CLEAR_STR
5645 BGP_STR
5646 "Clear all members of peer-group\n"
5647 "BGP peer-group name\n"
5648 "Soft reconfig inbound update\n"
5649 "Push out prefix-list ORF and do inbound soft reconfig\n")
5650{
5651 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5652 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5653}
5654
5655ALIAS (clear_bgp_peer_group_in_prefix_filter,
5656 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
5657 "clear bgp ipv6 peer-group WORD in prefix-filter",
5658 CLEAR_STR
5659 BGP_STR
5660 "Address family\n"
5661 "Clear all members of peer-group\n"
5662 "BGP peer-group name\n"
5663 "Soft reconfig inbound update\n"
5664 "Push out prefix-list ORF and do inbound soft reconfig\n")
5665
5666DEFUN (clear_ip_bgp_external_soft_in,
5667 clear_ip_bgp_external_soft_in_cmd,
5668 "clear ip bgp external soft in",
5669 CLEAR_STR
5670 IP_STR
5671 BGP_STR
5672 "Clear all external peers\n"
5673 "Soft reconfig\n"
5674 "Soft reconfig inbound update\n")
5675{
5676 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5677 BGP_CLEAR_SOFT_IN, NULL);
5678}
5679
5680ALIAS (clear_ip_bgp_external_soft_in,
5681 clear_ip_bgp_external_in_cmd,
5682 "clear ip bgp external in",
5683 CLEAR_STR
5684 IP_STR
5685 BGP_STR
5686 "Clear all external peers\n"
5687 "Soft reconfig inbound update\n")
5688
5689DEFUN (clear_ip_bgp_external_in_prefix_filter,
5690 clear_ip_bgp_external_in_prefix_filter_cmd,
5691 "clear ip bgp external in prefix-filter",
5692 CLEAR_STR
5693 IP_STR
5694 BGP_STR
5695 "Clear all external peers\n"
5696 "Soft reconfig inbound update\n"
5697 "Push out prefix-list ORF and do inbound soft reconfig\n")
5698{
5699 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5700 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5701}
5702
5703DEFUN (clear_ip_bgp_external_ipv4_soft_in,
5704 clear_ip_bgp_external_ipv4_soft_in_cmd,
5705 "clear ip bgp external ipv4 (unicast|multicast) soft in",
5706 CLEAR_STR
5707 IP_STR
5708 BGP_STR
5709 "Clear all external peers\n"
5710 "Address family\n"
5711 "Address Family modifier\n"
5712 "Address Family modifier\n"
5713 "Soft reconfig\n"
5714 "Soft reconfig inbound update\n")
5715{
5716 if (strncmp (argv[0], "m", 1) == 0)
5717 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5718 BGP_CLEAR_SOFT_IN, NULL);
5719
5720 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5721 BGP_CLEAR_SOFT_IN, NULL);
5722}
5723
5724ALIAS (clear_ip_bgp_external_ipv4_soft_in,
5725 clear_ip_bgp_external_ipv4_in_cmd,
5726 "clear ip bgp external ipv4 (unicast|multicast) in",
5727 CLEAR_STR
5728 IP_STR
5729 BGP_STR
5730 "Clear all external peers\n"
5731 "Address family\n"
5732 "Address Family modifier\n"
5733 "Address Family modifier\n"
5734 "Soft reconfig inbound update\n")
5735
5736DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
5737 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
5738 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
5739 CLEAR_STR
5740 IP_STR
5741 BGP_STR
5742 "Clear all external peers\n"
5743 "Address family\n"
5744 "Address Family modifier\n"
5745 "Address Family modifier\n"
5746 "Soft reconfig inbound update\n"
5747 "Push out prefix-list ORF and do inbound soft reconfig\n")
5748{
5749 if (strncmp (argv[0], "m", 1) == 0)
5750 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5751 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5752
5753 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5754 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5755}
5756
5757DEFUN (clear_bgp_external_soft_in,
5758 clear_bgp_external_soft_in_cmd,
5759 "clear bgp external soft in",
5760 CLEAR_STR
5761 BGP_STR
5762 "Clear all external peers\n"
5763 "Soft reconfig\n"
5764 "Soft reconfig inbound update\n")
5765{
5766 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5767 BGP_CLEAR_SOFT_IN, NULL);
5768}
5769
5770ALIAS (clear_bgp_external_soft_in,
5771 clear_bgp_ipv6_external_soft_in_cmd,
5772 "clear bgp ipv6 external soft in",
5773 CLEAR_STR
5774 BGP_STR
5775 "Address family\n"
5776 "Clear all external peers\n"
5777 "Soft reconfig\n"
5778 "Soft reconfig inbound update\n")
5779
5780ALIAS (clear_bgp_external_soft_in,
5781 clear_bgp_external_in_cmd,
5782 "clear bgp external in",
5783 CLEAR_STR
5784 BGP_STR
5785 "Clear all external peers\n"
5786 "Soft reconfig inbound update\n")
5787
5788ALIAS (clear_bgp_external_soft_in,
5789 clear_bgp_ipv6_external_in_cmd,
5790 "clear bgp ipv6 external WORD in",
5791 CLEAR_STR
5792 BGP_STR
5793 "Address family\n"
5794 "Clear all external peers\n"
5795 "Soft reconfig inbound update\n")
5796
5797DEFUN (clear_bgp_external_in_prefix_filter,
5798 clear_bgp_external_in_prefix_filter_cmd,
5799 "clear bgp external in prefix-filter",
5800 CLEAR_STR
5801 BGP_STR
5802 "Clear all external peers\n"
5803 "Soft reconfig inbound update\n"
5804 "Push out prefix-list ORF and do inbound soft reconfig\n")
5805{
5806 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5807 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5808}
5809
5810ALIAS (clear_bgp_external_in_prefix_filter,
5811 clear_bgp_ipv6_external_in_prefix_filter_cmd,
5812 "clear bgp ipv6 external in prefix-filter",
5813 CLEAR_STR
5814 BGP_STR
5815 "Address family\n"
5816 "Clear all external peers\n"
5817 "Soft reconfig inbound update\n"
5818 "Push out prefix-list ORF and do inbound soft reconfig\n")
5819
5820DEFUN (clear_ip_bgp_as_soft_in,
5821 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005822 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00005823 CLEAR_STR
5824 IP_STR
5825 BGP_STR
5826 "Clear peers with the AS number\n"
5827 "Soft reconfig\n"
5828 "Soft reconfig inbound update\n")
5829{
5830 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5831 BGP_CLEAR_SOFT_IN, argv[0]);
5832}
5833
5834ALIAS (clear_ip_bgp_as_soft_in,
5835 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005836 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00005837 CLEAR_STR
5838 IP_STR
5839 BGP_STR
5840 "Clear peers with the AS number\n"
5841 "Soft reconfig inbound update\n")
5842
5843DEFUN (clear_ip_bgp_as_in_prefix_filter,
5844 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005845 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00005846 CLEAR_STR
5847 IP_STR
5848 BGP_STR
5849 "Clear peers with the AS number\n"
5850 "Soft reconfig inbound update\n"
5851 "Push out prefix-list ORF and do inbound soft reconfig\n")
5852{
5853 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5854 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5855}
5856
5857DEFUN (clear_ip_bgp_as_ipv4_soft_in,
5858 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005859 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00005860 CLEAR_STR
5861 IP_STR
5862 BGP_STR
5863 "Clear peers with the AS number\n"
5864 "Address family\n"
5865 "Address Family modifier\n"
5866 "Address Family modifier\n"
5867 "Soft reconfig\n"
5868 "Soft reconfig inbound update\n")
5869{
5870 if (strncmp (argv[1], "m", 1) == 0)
5871 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5872 BGP_CLEAR_SOFT_IN, argv[0]);
5873
5874 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5875 BGP_CLEAR_SOFT_IN, argv[0]);
5876}
5877
5878ALIAS (clear_ip_bgp_as_ipv4_soft_in,
5879 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005880 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00005881 CLEAR_STR
5882 IP_STR
5883 BGP_STR
5884 "Clear peers with the AS number\n"
5885 "Address family\n"
5886 "Address Family modifier\n"
5887 "Address Family modifier\n"
5888 "Soft reconfig inbound update\n")
5889
5890DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
5891 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005892 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00005893 CLEAR_STR
5894 IP_STR
5895 BGP_STR
5896 "Clear peers with the AS number\n"
5897 "Address family\n"
5898 "Address Family modifier\n"
5899 "Address Family modifier\n"
5900 "Soft reconfig inbound update\n"
5901 "Push out prefix-list ORF and do inbound soft reconfig\n")
5902{
5903 if (strncmp (argv[1], "m", 1) == 0)
5904 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5905 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5906
5907 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5908 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5909}
5910
5911DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
5912 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005913 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00005914 CLEAR_STR
5915 IP_STR
5916 BGP_STR
5917 "Clear peers with the AS number\n"
5918 "Address family\n"
5919 "Address Family modifier\n"
5920 "Soft reconfig\n"
5921 "Soft reconfig inbound update\n")
5922{
5923 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5924 BGP_CLEAR_SOFT_IN, argv[0]);
5925}
5926
5927ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
5928 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005929 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00005930 CLEAR_STR
5931 IP_STR
5932 BGP_STR
5933 "Clear peers with the AS number\n"
5934 "Address family\n"
5935 "Address Family modifier\n"
5936 "Soft reconfig inbound update\n")
5937
5938DEFUN (clear_bgp_as_soft_in,
5939 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005940 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00005941 CLEAR_STR
5942 BGP_STR
5943 "Clear peers with the AS number\n"
5944 "Soft reconfig\n"
5945 "Soft reconfig inbound update\n")
5946{
5947 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5948 BGP_CLEAR_SOFT_IN, argv[0]);
5949}
5950
5951ALIAS (clear_bgp_as_soft_in,
5952 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005953 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00005954 CLEAR_STR
5955 BGP_STR
5956 "Address family\n"
5957 "Clear peers with the AS number\n"
5958 "Soft reconfig\n"
5959 "Soft reconfig inbound update\n")
5960
5961ALIAS (clear_bgp_as_soft_in,
5962 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005963 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00005964 CLEAR_STR
5965 BGP_STR
5966 "Clear peers with the AS number\n"
5967 "Soft reconfig inbound update\n")
5968
5969ALIAS (clear_bgp_as_soft_in,
5970 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005971 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00005972 CLEAR_STR
5973 BGP_STR
5974 "Address family\n"
5975 "Clear peers with the AS number\n"
5976 "Soft reconfig inbound update\n")
5977
5978DEFUN (clear_bgp_as_in_prefix_filter,
5979 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005980 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00005981 CLEAR_STR
5982 BGP_STR
5983 "Clear peers with the AS number\n"
5984 "Soft reconfig inbound update\n"
5985 "Push out prefix-list ORF and do inbound soft reconfig\n")
5986{
5987 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5988 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5989}
5990
5991ALIAS (clear_bgp_as_in_prefix_filter,
5992 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005993 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00005994 CLEAR_STR
5995 BGP_STR
5996 "Address family\n"
5997 "Clear peers with the AS number\n"
5998 "Soft reconfig inbound update\n"
5999 "Push out prefix-list ORF and do inbound soft reconfig\n")
6000
6001/* Both soft-reconfiguration */
6002DEFUN (clear_ip_bgp_all_soft,
6003 clear_ip_bgp_all_soft_cmd,
6004 "clear ip bgp * soft",
6005 CLEAR_STR
6006 IP_STR
6007 BGP_STR
6008 "Clear all peers\n"
6009 "Soft reconfig\n")
6010{
6011 if (argc == 1)
6012 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6013 BGP_CLEAR_SOFT_BOTH, NULL);
6014
6015 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6016 BGP_CLEAR_SOFT_BOTH, NULL);
6017}
6018
6019ALIAS (clear_ip_bgp_all_soft,
6020 clear_ip_bgp_instance_all_soft_cmd,
6021 "clear ip bgp view WORD * soft",
6022 CLEAR_STR
6023 IP_STR
6024 BGP_STR
6025 "BGP view\n"
6026 "view name\n"
6027 "Clear all peers\n"
6028 "Soft reconfig\n")
6029
6030
6031DEFUN (clear_ip_bgp_all_ipv4_soft,
6032 clear_ip_bgp_all_ipv4_soft_cmd,
6033 "clear ip bgp * ipv4 (unicast|multicast) soft",
6034 CLEAR_STR
6035 IP_STR
6036 BGP_STR
6037 "Clear all peers\n"
6038 "Address family\n"
6039 "Address Family Modifier\n"
6040 "Address Family Modifier\n"
6041 "Soft reconfig\n")
6042{
6043 if (strncmp (argv[0], "m", 1) == 0)
6044 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6045 BGP_CLEAR_SOFT_BOTH, NULL);
6046
6047 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6048 BGP_CLEAR_SOFT_BOTH, NULL);
6049}
6050
6051DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6052 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6053 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6054 CLEAR_STR
6055 IP_STR
6056 BGP_STR
6057 "BGP view\n"
6058 "view name\n"
6059 "Clear all peers\n"
6060 "Address family\n"
6061 "Address Family Modifier\n"
6062 "Address Family Modifier\n"
6063 "Soft reconfig\n")
6064{
6065 if (strncmp (argv[1], "m", 1) == 0)
6066 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6067 BGP_CLEAR_SOFT_BOTH, NULL);
6068
6069 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6070 BGP_CLEAR_SOFT_BOTH, NULL);
6071}
6072
6073DEFUN (clear_ip_bgp_all_vpnv4_soft,
6074 clear_ip_bgp_all_vpnv4_soft_cmd,
6075 "clear ip bgp * vpnv4 unicast soft",
6076 CLEAR_STR
6077 IP_STR
6078 BGP_STR
6079 "Clear all peers\n"
6080 "Address family\n"
6081 "Address Family Modifier\n"
6082 "Soft reconfig\n")
6083{
6084 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6085 BGP_CLEAR_SOFT_BOTH, argv[0]);
6086}
6087
6088DEFUN (clear_bgp_all_soft,
6089 clear_bgp_all_soft_cmd,
6090 "clear bgp * soft",
6091 CLEAR_STR
6092 BGP_STR
6093 "Clear all peers\n"
6094 "Soft reconfig\n")
6095{
6096 if (argc == 1)
6097 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6098 BGP_CLEAR_SOFT_BOTH, argv[0]);
6099
6100 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6101 BGP_CLEAR_SOFT_BOTH, argv[0]);
6102}
6103
6104ALIAS (clear_bgp_all_soft,
6105 clear_bgp_instance_all_soft_cmd,
6106 "clear bgp view WORD * soft",
6107 CLEAR_STR
6108 BGP_STR
6109 "BGP view\n"
6110 "view name\n"
6111 "Clear all peers\n"
6112 "Soft reconfig\n")
6113
6114ALIAS (clear_bgp_all_soft,
6115 clear_bgp_ipv6_all_soft_cmd,
6116 "clear bgp ipv6 * soft",
6117 CLEAR_STR
6118 BGP_STR
6119 "Address family\n"
6120 "Clear all peers\n"
6121 "Soft reconfig\n")
6122
6123DEFUN (clear_ip_bgp_peer_soft,
6124 clear_ip_bgp_peer_soft_cmd,
6125 "clear ip bgp A.B.C.D soft",
6126 CLEAR_STR
6127 IP_STR
6128 BGP_STR
6129 "BGP neighbor address to clear\n"
6130 "Soft reconfig\n")
6131{
6132 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6133 BGP_CLEAR_SOFT_BOTH, argv[0]);
6134}
6135
6136DEFUN (clear_ip_bgp_peer_ipv4_soft,
6137 clear_ip_bgp_peer_ipv4_soft_cmd,
6138 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6139 CLEAR_STR
6140 IP_STR
6141 BGP_STR
6142 "BGP neighbor address to clear\n"
6143 "Address family\n"
6144 "Address Family Modifier\n"
6145 "Address Family Modifier\n"
6146 "Soft reconfig\n")
6147{
6148 if (strncmp (argv[1], "m", 1) == 0)
6149 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6150 BGP_CLEAR_SOFT_BOTH, argv[0]);
6151
6152 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6153 BGP_CLEAR_SOFT_BOTH, argv[0]);
6154}
6155
6156DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6157 clear_ip_bgp_peer_vpnv4_soft_cmd,
6158 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6159 CLEAR_STR
6160 IP_STR
6161 BGP_STR
6162 "BGP neighbor address to clear\n"
6163 "Address family\n"
6164 "Address Family Modifier\n"
6165 "Soft reconfig\n")
6166{
6167 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6168 BGP_CLEAR_SOFT_BOTH, argv[0]);
6169}
6170
6171DEFUN (clear_bgp_peer_soft,
6172 clear_bgp_peer_soft_cmd,
6173 "clear bgp (A.B.C.D|X:X::X:X) soft",
6174 CLEAR_STR
6175 BGP_STR
6176 "BGP neighbor address to clear\n"
6177 "BGP IPv6 neighbor to clear\n"
6178 "Soft reconfig\n")
6179{
6180 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6181 BGP_CLEAR_SOFT_BOTH, argv[0]);
6182}
6183
6184ALIAS (clear_bgp_peer_soft,
6185 clear_bgp_ipv6_peer_soft_cmd,
6186 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6187 CLEAR_STR
6188 BGP_STR
6189 "Address family\n"
6190 "BGP neighbor address to clear\n"
6191 "BGP IPv6 neighbor to clear\n"
6192 "Soft reconfig\n")
6193
6194DEFUN (clear_ip_bgp_peer_group_soft,
6195 clear_ip_bgp_peer_group_soft_cmd,
6196 "clear ip bgp peer-group WORD soft",
6197 CLEAR_STR
6198 IP_STR
6199 BGP_STR
6200 "Clear all members of peer-group\n"
6201 "BGP peer-group name\n"
6202 "Soft reconfig\n")
6203{
6204 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6205 BGP_CLEAR_SOFT_BOTH, argv[0]);
6206}
6207
6208DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6209 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6210 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6211 CLEAR_STR
6212 IP_STR
6213 BGP_STR
6214 "Clear all members of peer-group\n"
6215 "BGP peer-group name\n"
6216 "Address family\n"
6217 "Address Family modifier\n"
6218 "Address Family modifier\n"
6219 "Soft reconfig\n")
6220{
6221 if (strncmp (argv[1], "m", 1) == 0)
6222 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6223 BGP_CLEAR_SOFT_BOTH, argv[0]);
6224
6225 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6226 BGP_CLEAR_SOFT_BOTH, argv[0]);
6227}
6228
6229DEFUN (clear_bgp_peer_group_soft,
6230 clear_bgp_peer_group_soft_cmd,
6231 "clear bgp peer-group WORD soft",
6232 CLEAR_STR
6233 BGP_STR
6234 "Clear all members of peer-group\n"
6235 "BGP peer-group name\n"
6236 "Soft reconfig\n")
6237{
6238 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6239 BGP_CLEAR_SOFT_BOTH, argv[0]);
6240}
6241
6242ALIAS (clear_bgp_peer_group_soft,
6243 clear_bgp_ipv6_peer_group_soft_cmd,
6244 "clear bgp ipv6 peer-group WORD soft",
6245 CLEAR_STR
6246 BGP_STR
6247 "Address family\n"
6248 "Clear all members of peer-group\n"
6249 "BGP peer-group name\n"
6250 "Soft reconfig\n")
6251
6252DEFUN (clear_ip_bgp_external_soft,
6253 clear_ip_bgp_external_soft_cmd,
6254 "clear ip bgp external soft",
6255 CLEAR_STR
6256 IP_STR
6257 BGP_STR
6258 "Clear all external peers\n"
6259 "Soft reconfig\n")
6260{
6261 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6262 BGP_CLEAR_SOFT_BOTH, NULL);
6263}
6264
6265DEFUN (clear_ip_bgp_external_ipv4_soft,
6266 clear_ip_bgp_external_ipv4_soft_cmd,
6267 "clear ip bgp external ipv4 (unicast|multicast) soft",
6268 CLEAR_STR
6269 IP_STR
6270 BGP_STR
6271 "Clear all external peers\n"
6272 "Address family\n"
6273 "Address Family modifier\n"
6274 "Address Family modifier\n"
6275 "Soft reconfig\n")
6276{
6277 if (strncmp (argv[0], "m", 1) == 0)
6278 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6279 BGP_CLEAR_SOFT_BOTH, NULL);
6280
6281 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6282 BGP_CLEAR_SOFT_BOTH, NULL);
6283}
6284
6285DEFUN (clear_bgp_external_soft,
6286 clear_bgp_external_soft_cmd,
6287 "clear bgp external soft",
6288 CLEAR_STR
6289 BGP_STR
6290 "Clear all external peers\n"
6291 "Soft reconfig\n")
6292{
6293 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6294 BGP_CLEAR_SOFT_BOTH, NULL);
6295}
6296
6297ALIAS (clear_bgp_external_soft,
6298 clear_bgp_ipv6_external_soft_cmd,
6299 "clear bgp ipv6 external soft",
6300 CLEAR_STR
6301 BGP_STR
6302 "Address family\n"
6303 "Clear all external peers\n"
6304 "Soft reconfig\n")
6305
6306DEFUN (clear_ip_bgp_as_soft,
6307 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006308 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006309 CLEAR_STR
6310 IP_STR
6311 BGP_STR
6312 "Clear peers with the AS number\n"
6313 "Soft reconfig\n")
6314{
6315 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6316 BGP_CLEAR_SOFT_BOTH, argv[0]);
6317}
6318
6319DEFUN (clear_ip_bgp_as_ipv4_soft,
6320 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006321 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006322 CLEAR_STR
6323 IP_STR
6324 BGP_STR
6325 "Clear peers with the AS number\n"
6326 "Address family\n"
6327 "Address Family Modifier\n"
6328 "Address Family Modifier\n"
6329 "Soft reconfig\n")
6330{
6331 if (strncmp (argv[1], "m", 1) == 0)
6332 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6333 BGP_CLEAR_SOFT_BOTH, argv[0]);
6334
6335 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6336 BGP_CLEAR_SOFT_BOTH, argv[0]);
6337}
6338
6339DEFUN (clear_ip_bgp_as_vpnv4_soft,
6340 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006341 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00006342 CLEAR_STR
6343 IP_STR
6344 BGP_STR
6345 "Clear peers with the AS number\n"
6346 "Address family\n"
6347 "Address Family Modifier\n"
6348 "Soft reconfig\n")
6349{
6350 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6351 BGP_CLEAR_SOFT_BOTH, argv[0]);
6352}
6353
6354DEFUN (clear_bgp_as_soft,
6355 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006356 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006357 CLEAR_STR
6358 BGP_STR
6359 "Clear peers with the AS number\n"
6360 "Soft reconfig\n")
6361{
6362 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6363 BGP_CLEAR_SOFT_BOTH, argv[0]);
6364}
6365
6366ALIAS (clear_bgp_as_soft,
6367 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006368 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006369 CLEAR_STR
6370 BGP_STR
6371 "Address family\n"
6372 "Clear peers with the AS number\n"
6373 "Soft reconfig\n")
6374
paulfee0f4c2004-09-13 05:12:46 +00006375/* RS-client soft reconfiguration. */
6376#ifdef HAVE_IPV6
6377DEFUN (clear_bgp_all_rsclient,
6378 clear_bgp_all_rsclient_cmd,
6379 "clear bgp * rsclient",
6380 CLEAR_STR
6381 BGP_STR
6382 "Clear all peers\n"
6383 "Soft reconfig for rsclient RIB\n")
6384{
6385 if (argc == 1)
6386 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6387 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6388
6389 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6390 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6391}
6392
6393ALIAS (clear_bgp_all_rsclient,
6394 clear_bgp_ipv6_all_rsclient_cmd,
6395 "clear bgp ipv6 * rsclient",
6396 CLEAR_STR
6397 BGP_STR
6398 "Address family\n"
6399 "Clear all peers\n"
6400 "Soft reconfig for rsclient RIB\n")
6401
6402ALIAS (clear_bgp_all_rsclient,
6403 clear_bgp_instance_all_rsclient_cmd,
6404 "clear bgp view WORD * rsclient",
6405 CLEAR_STR
6406 BGP_STR
6407 "BGP view\n"
6408 "view name\n"
6409 "Clear all peers\n"
6410 "Soft reconfig for rsclient RIB\n")
6411
6412ALIAS (clear_bgp_all_rsclient,
6413 clear_bgp_ipv6_instance_all_rsclient_cmd,
6414 "clear bgp ipv6 view WORD * rsclient",
6415 CLEAR_STR
6416 BGP_STR
6417 "Address family\n"
6418 "BGP view\n"
6419 "view name\n"
6420 "Clear all peers\n"
6421 "Soft reconfig for rsclient RIB\n")
6422#endif /* HAVE_IPV6 */
6423
6424DEFUN (clear_ip_bgp_all_rsclient,
6425 clear_ip_bgp_all_rsclient_cmd,
6426 "clear ip bgp * rsclient",
6427 CLEAR_STR
6428 IP_STR
6429 BGP_STR
6430 "Clear all peers\n"
6431 "Soft reconfig for rsclient RIB\n")
6432{
6433 if (argc == 1)
6434 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6435 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6436
6437 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6438 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6439}
6440
6441ALIAS (clear_ip_bgp_all_rsclient,
6442 clear_ip_bgp_instance_all_rsclient_cmd,
6443 "clear ip bgp view WORD * rsclient",
6444 CLEAR_STR
6445 IP_STR
6446 BGP_STR
6447 "BGP view\n"
6448 "view name\n"
6449 "Clear all peers\n"
6450 "Soft reconfig for rsclient RIB\n")
6451
6452#ifdef HAVE_IPV6
6453DEFUN (clear_bgp_peer_rsclient,
6454 clear_bgp_peer_rsclient_cmd,
6455 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
6456 CLEAR_STR
6457 BGP_STR
6458 "BGP neighbor IP address to clear\n"
6459 "BGP IPv6 neighbor to clear\n"
6460 "Soft reconfig for rsclient RIB\n")
6461{
6462 if (argc == 2)
6463 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
6464 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6465
6466 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6467 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6468}
6469
6470ALIAS (clear_bgp_peer_rsclient,
6471 clear_bgp_ipv6_peer_rsclient_cmd,
6472 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
6473 CLEAR_STR
6474 BGP_STR
6475 "Address family\n"
6476 "BGP neighbor IP address to clear\n"
6477 "BGP IPv6 neighbor to clear\n"
6478 "Soft reconfig for rsclient RIB\n")
6479
6480ALIAS (clear_bgp_peer_rsclient,
6481 clear_bgp_instance_peer_rsclient_cmd,
6482 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6483 CLEAR_STR
6484 BGP_STR
6485 "BGP view\n"
6486 "view name\n"
6487 "BGP neighbor IP address to clear\n"
6488 "BGP IPv6 neighbor to clear\n"
6489 "Soft reconfig for rsclient RIB\n")
6490
6491ALIAS (clear_bgp_peer_rsclient,
6492 clear_bgp_ipv6_instance_peer_rsclient_cmd,
6493 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
6494 CLEAR_STR
6495 BGP_STR
6496 "Address family\n"
6497 "BGP view\n"
6498 "view name\n"
6499 "BGP neighbor IP address to clear\n"
6500 "BGP IPv6 neighbor to clear\n"
6501 "Soft reconfig for rsclient RIB\n")
6502#endif /* HAVE_IPV6 */
6503
6504DEFUN (clear_ip_bgp_peer_rsclient,
6505 clear_ip_bgp_peer_rsclient_cmd,
6506 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
6507 CLEAR_STR
6508 IP_STR
6509 BGP_STR
6510 "BGP neighbor IP address to clear\n"
6511 "BGP IPv6 neighbor to clear\n"
6512 "Soft reconfig for rsclient RIB\n")
6513{
6514 if (argc == 2)
6515 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
6516 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6517
6518 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6519 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6520}
6521
6522ALIAS (clear_ip_bgp_peer_rsclient,
6523 clear_ip_bgp_instance_peer_rsclient_cmd,
6524 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6525 CLEAR_STR
6526 IP_STR
6527 BGP_STR
6528 "BGP view\n"
6529 "view name\n"
6530 "BGP neighbor IP address to clear\n"
6531 "BGP IPv6 neighbor to clear\n"
6532 "Soft reconfig for rsclient RIB\n")
6533
Paul Jakma4bf6a362006-03-30 14:05:23 +00006534DEFUN (show_bgp_memory,
6535 show_bgp_memory_cmd,
6536 "show bgp memory",
6537 SHOW_STR
6538 BGP_STR
6539 "Global BGP memory statistics\n")
6540{
6541 char memstrbuf[MTYPE_MEMSTR_LEN];
6542 unsigned long count;
6543
6544 /* RIB related usage stats */
6545 count = mtype_stats_alloc (MTYPE_BGP_NODE);
6546 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
6547 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6548 count * sizeof (struct bgp_node)),
6549 VTY_NEWLINE);
6550
6551 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
6552 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
6553 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6554 count * sizeof (struct bgp_info)),
6555 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006556 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
6557 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
6558 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6559 count * sizeof (struct bgp_info_extra)),
6560 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006561
6562 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
6563 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
6564 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6565 count * sizeof (struct bgp_static)),
6566 VTY_NEWLINE);
6567
6568 /* Adj-In/Out */
6569 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
6570 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
6571 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6572 count * sizeof (struct bgp_adj_in)),
6573 VTY_NEWLINE);
6574 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
6575 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
6576 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6577 count * sizeof (struct bgp_adj_out)),
6578 VTY_NEWLINE);
6579
6580 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
6581 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
6582 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6583 count * sizeof (struct bgp_nexthop_cache)),
6584 VTY_NEWLINE);
6585
6586 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
6587 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
6588 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6589 count * sizeof (struct bgp_damp_info)),
6590 VTY_NEWLINE);
6591
6592 /* Attributes */
6593 count = attr_count();
6594 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
6595 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6596 count * sizeof(struct attr)),
6597 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006598 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
6599 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
6600 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6601 count * sizeof(struct attr_extra)),
6602 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006603
6604 if ((count = attr_unknown_count()))
6605 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
6606
6607 /* AS_PATH attributes */
6608 count = aspath_count ();
6609 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
6610 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6611 count * sizeof (struct aspath)),
6612 VTY_NEWLINE);
6613
6614 count = mtype_stats_alloc (MTYPE_AS_SEG);
6615 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
6616 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6617 count * sizeof (struct assegment)),
6618 VTY_NEWLINE);
6619
6620 /* Other attributes */
6621 if ((count = community_count ()))
6622 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6623 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6624 count * sizeof (struct community)),
6625 VTY_NEWLINE);
6626 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
6627 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6628 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6629 count * sizeof (struct ecommunity)),
6630 VTY_NEWLINE);
6631
6632 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
6633 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
6634 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6635 count * sizeof (struct cluster_list)),
6636 VTY_NEWLINE);
6637
6638 /* Peer related usage */
6639 count = mtype_stats_alloc (MTYPE_BGP_PEER);
6640 vty_out (vty, "%ld peers, using %s of memory%s", count,
6641 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6642 count * sizeof (struct peer)),
6643 VTY_NEWLINE);
6644
6645 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
6646 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
6647 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6648 count * sizeof (struct peer_group)),
6649 VTY_NEWLINE);
6650
6651 /* Other */
6652 if ((count = mtype_stats_alloc (MTYPE_HASH)))
6653 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
6654 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6655 count * sizeof (struct hash)),
6656 VTY_NEWLINE);
6657 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
6658 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
6659 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6660 count * sizeof (struct hash_backet)),
6661 VTY_NEWLINE);
6662 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
6663 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
6664 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6665 count * sizeof (regex_t)),
6666 VTY_NEWLINE);
6667 return CMD_SUCCESS;
6668}
paulfee0f4c2004-09-13 05:12:46 +00006669
paul718e3742002-12-13 20:15:29 +00006670/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00006671static int
paul718e3742002-12-13 20:15:29 +00006672bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
6673{
6674 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00006675 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00006676 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00006677 char timebuf[BGP_UPTIME_LEN];
6678 int len;
6679
6680 /* Header string for each address family. */
6681 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00006682
paul1eb8ef22005-04-07 07:30:20 +00006683 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00006684 {
6685 if (peer->afc[afi][safi])
6686 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00006687 if (!count)
6688 {
6689 unsigned long ents;
6690 char memstrbuf[MTYPE_MEMSTR_LEN];
6691
6692 /* Usage summary and header */
6693 vty_out (vty,
6694 "BGP router identifier %s, local AS number %d%s",
6695 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006696
Paul Jakma4bf6a362006-03-30 14:05:23 +00006697 ents = bgp_table_count (bgp->rib[afi][safi]);
6698 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
6699 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6700 ents * sizeof (struct bgp_node)),
6701 VTY_NEWLINE);
6702
6703 /* Peer related usage */
6704 ents = listcount (bgp->peer);
6705 vty_out (vty, "Peers %ld, using %s of memory%s",
6706 ents,
6707 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6708 ents * sizeof (struct peer)),
6709 VTY_NEWLINE);
6710
6711 if ((ents = listcount (bgp->rsclient)))
6712 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
6713 ents,
6714 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6715 ents * sizeof (struct peer)),
6716 VTY_NEWLINE);
6717
6718 if ((ents = listcount (bgp->group)))
6719 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
6720 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6721 ents * sizeof (struct peer_group)),
6722 VTY_NEWLINE);
6723
6724 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
6725 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
6726 vty_out (vty, "%s", VTY_NEWLINE);
6727 vty_out (vty, "%s%s", header, VTY_NEWLINE);
6728 }
6729
paul718e3742002-12-13 20:15:29 +00006730 count++;
6731
6732 len = vty_out (vty, "%s", peer->host);
6733 len = 16 - len;
6734 if (len < 1)
6735 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
6736 else
6737 vty_out (vty, "%*s", len, " ");
6738
hasso3d515fd2005-02-01 21:30:04 +00006739 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00006740
Paul Jakma6d582722007-08-06 15:21:45 +00006741 vty_out (vty, "%5d %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00006742 peer->as,
6743 peer->open_in + peer->update_in + peer->keepalive_in
6744 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
6745 peer->open_out + peer->update_out + peer->keepalive_out
6746 + peer->notify_out + peer->refresh_out
6747 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00006748 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00006749
6750 vty_out (vty, "%8s",
6751 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
6752
6753 if (peer->status == Established)
6754 {
6755 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
6756 }
6757 else
6758 {
6759 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
6760 vty_out (vty, " Idle (Admin)");
6761 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
6762 vty_out (vty, " Idle (PfxCt)");
6763 else
6764 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
6765 }
6766
6767 vty_out (vty, "%s", VTY_NEWLINE);
6768 }
6769 }
6770
6771 if (count)
6772 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
6773 count, VTY_NEWLINE);
6774 else
6775 vty_out (vty, "No %s neighbor is configured%s",
6776 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
6777 return CMD_SUCCESS;
6778}
6779
paul94f2b392005-06-28 12:44:16 +00006780static int
paulfd79ac92004-10-13 05:06:08 +00006781bgp_show_summary_vty (struct vty *vty, const char *name,
6782 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00006783{
6784 struct bgp *bgp;
6785
6786 if (name)
6787 {
6788 bgp = bgp_lookup_by_name (name);
6789
6790 if (! bgp)
6791 {
6792 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
6793 return CMD_WARNING;
6794 }
6795
6796 bgp_show_summary (vty, bgp, afi, safi);
6797 return CMD_SUCCESS;
6798 }
6799
6800 bgp = bgp_get_default ();
6801
6802 if (bgp)
6803 bgp_show_summary (vty, bgp, afi, safi);
6804
6805 return CMD_SUCCESS;
6806}
6807
6808/* `show ip bgp summary' commands. */
6809DEFUN (show_ip_bgp_summary,
6810 show_ip_bgp_summary_cmd,
6811 "show ip bgp summary",
6812 SHOW_STR
6813 IP_STR
6814 BGP_STR
6815 "Summary of BGP neighbor status\n")
6816{
6817 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
6818}
6819
6820DEFUN (show_ip_bgp_instance_summary,
6821 show_ip_bgp_instance_summary_cmd,
6822 "show ip bgp view WORD summary",
6823 SHOW_STR
6824 IP_STR
6825 BGP_STR
6826 "BGP view\n"
6827 "View name\n"
6828 "Summary of BGP neighbor status\n")
6829{
6830 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
6831}
6832
6833DEFUN (show_ip_bgp_ipv4_summary,
6834 show_ip_bgp_ipv4_summary_cmd,
6835 "show ip bgp ipv4 (unicast|multicast) summary",
6836 SHOW_STR
6837 IP_STR
6838 BGP_STR
6839 "Address family\n"
6840 "Address Family modifier\n"
6841 "Address Family modifier\n"
6842 "Summary of BGP neighbor status\n")
6843{
6844 if (strncmp (argv[0], "m", 1) == 0)
6845 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
6846
6847 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
6848}
6849
6850DEFUN (show_ip_bgp_instance_ipv4_summary,
6851 show_ip_bgp_instance_ipv4_summary_cmd,
6852 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
6853 SHOW_STR
6854 IP_STR
6855 BGP_STR
6856 "BGP view\n"
6857 "View name\n"
6858 "Address family\n"
6859 "Address Family modifier\n"
6860 "Address Family modifier\n"
6861 "Summary of BGP neighbor status\n")
6862{
6863 if (strncmp (argv[1], "m", 1) == 0)
6864 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
6865 else
6866 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
6867}
6868
6869DEFUN (show_ip_bgp_vpnv4_all_summary,
6870 show_ip_bgp_vpnv4_all_summary_cmd,
6871 "show ip bgp vpnv4 all summary",
6872 SHOW_STR
6873 IP_STR
6874 BGP_STR
6875 "Display VPNv4 NLRI specific information\n"
6876 "Display information about all VPNv4 NLRIs\n"
6877 "Summary of BGP neighbor status\n")
6878{
6879 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
6880}
6881
6882DEFUN (show_ip_bgp_vpnv4_rd_summary,
6883 show_ip_bgp_vpnv4_rd_summary_cmd,
6884 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
6885 SHOW_STR
6886 IP_STR
6887 BGP_STR
6888 "Display VPNv4 NLRI specific information\n"
6889 "Display information for a route distinguisher\n"
6890 "VPN Route Distinguisher\n"
6891 "Summary of BGP neighbor status\n")
6892{
6893 int ret;
6894 struct prefix_rd prd;
6895
6896 ret = str2prefix_rd (argv[0], &prd);
6897 if (! ret)
6898 {
6899 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
6900 return CMD_WARNING;
6901 }
6902
6903 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
6904}
6905
6906#ifdef HAVE_IPV6
6907DEFUN (show_bgp_summary,
6908 show_bgp_summary_cmd,
6909 "show bgp summary",
6910 SHOW_STR
6911 BGP_STR
6912 "Summary of BGP neighbor status\n")
6913{
6914 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
6915}
6916
6917DEFUN (show_bgp_instance_summary,
6918 show_bgp_instance_summary_cmd,
6919 "show bgp view WORD summary",
6920 SHOW_STR
6921 BGP_STR
6922 "BGP view\n"
6923 "View name\n"
6924 "Summary of BGP neighbor status\n")
6925{
6926 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
6927}
6928
6929ALIAS (show_bgp_summary,
6930 show_bgp_ipv6_summary_cmd,
6931 "show bgp ipv6 summary",
6932 SHOW_STR
6933 BGP_STR
6934 "Address family\n"
6935 "Summary of BGP neighbor status\n")
6936
6937ALIAS (show_bgp_instance_summary,
6938 show_bgp_instance_ipv6_summary_cmd,
6939 "show bgp view WORD ipv6 summary",
6940 SHOW_STR
6941 BGP_STR
6942 "BGP view\n"
6943 "View name\n"
6944 "Address family\n"
6945 "Summary of BGP neighbor status\n")
6946
6947/* old command */
6948DEFUN (show_ipv6_bgp_summary,
6949 show_ipv6_bgp_summary_cmd,
6950 "show ipv6 bgp summary",
6951 SHOW_STR
6952 IPV6_STR
6953 BGP_STR
6954 "Summary of BGP neighbor status\n")
6955{
6956 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
6957}
6958
6959/* old command */
6960DEFUN (show_ipv6_mbgp_summary,
6961 show_ipv6_mbgp_summary_cmd,
6962 "show ipv6 mbgp summary",
6963 SHOW_STR
6964 IPV6_STR
6965 MBGP_STR
6966 "Summary of BGP neighbor status\n")
6967{
6968 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
6969}
6970#endif /* HAVE_IPV6 */
6971
paulfd79ac92004-10-13 05:06:08 +00006972const char *
hasso538621f2004-05-21 09:31:30 +00006973afi_safi_print (afi_t afi, safi_t safi)
6974{
6975 if (afi == AFI_IP && safi == SAFI_UNICAST)
6976 return "IPv4 Unicast";
6977 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
6978 return "IPv4 Multicast";
6979 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
6980 return "VPNv4 Unicast";
6981 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
6982 return "IPv6 Unicast";
6983 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
6984 return "IPv6 Multicast";
6985 else
6986 return "Unknown";
6987}
6988
paul718e3742002-12-13 20:15:29 +00006989/* Show BGP peer's information. */
6990enum show_type
6991{
6992 show_all,
6993 show_peer
6994};
6995
paul94f2b392005-06-28 12:44:16 +00006996static void
paul718e3742002-12-13 20:15:29 +00006997bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
6998 afi_t afi, safi_t safi,
6999 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7000 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7001{
7002 /* Send-Mode */
7003 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7004 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7005 {
7006 vty_out (vty, " Send-mode: ");
7007 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7008 vty_out (vty, "advertised");
7009 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7010 vty_out (vty, "%sreceived",
7011 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7012 ", " : "");
7013 vty_out (vty, "%s", VTY_NEWLINE);
7014 }
7015
7016 /* Receive-Mode */
7017 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7018 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7019 {
7020 vty_out (vty, " Receive-mode: ");
7021 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7022 vty_out (vty, "advertised");
7023 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7024 vty_out (vty, "%sreceived",
7025 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7026 ", " : "");
7027 vty_out (vty, "%s", VTY_NEWLINE);
7028 }
7029}
7030
paul94f2b392005-06-28 12:44:16 +00007031static void
paul718e3742002-12-13 20:15:29 +00007032bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7033{
7034 struct bgp_filter *filter;
7035 char orf_pfx_name[BUFSIZ];
7036 int orf_pfx_count;
7037
7038 filter = &p->filter[afi][safi];
7039
hasso538621f2004-05-21 09:31:30 +00007040 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007041 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007042
paul718e3742002-12-13 20:15:29 +00007043 if (p->af_group[afi][safi])
7044 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7045
7046 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7047 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7048 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7049 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7050 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7051 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7052 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7053
7054 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7055 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7056 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7057 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7058 {
7059 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7060 ORF_TYPE_PREFIX, VTY_NEWLINE);
7061 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7062 PEER_CAP_ORF_PREFIX_SM_ADV,
7063 PEER_CAP_ORF_PREFIX_RM_ADV,
7064 PEER_CAP_ORF_PREFIX_SM_RCV,
7065 PEER_CAP_ORF_PREFIX_RM_RCV);
7066 }
7067 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7068 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7069 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7070 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7071 {
7072 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7073 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7074 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7075 PEER_CAP_ORF_PREFIX_SM_ADV,
7076 PEER_CAP_ORF_PREFIX_RM_ADV,
7077 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7078 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7079 }
7080
7081 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7082 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7083
7084 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7085 || orf_pfx_count)
7086 {
7087 vty_out (vty, " Outbound Route Filter (ORF):");
7088 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7089 vty_out (vty, " sent;");
7090 if (orf_pfx_count)
7091 vty_out (vty, " received (%d entries)", orf_pfx_count);
7092 vty_out (vty, "%s", VTY_NEWLINE);
7093 }
7094 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7095 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7096
7097 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7098 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7099 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7100 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7101 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7102 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7103 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7104 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7105 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7106 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
7107 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
7108 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7109 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
7110 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7111 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
7112 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7113 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7114 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
7115 {
7116 vty_out (vty, " Community attribute sent to this neighbor");
7117 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7118 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007119 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007120 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007121 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007122 else
hasso538621f2004-05-21 09:31:30 +00007123 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007124 }
7125 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
7126 {
7127 vty_out (vty, " Default information originate,");
7128
7129 if (p->default_rmap[afi][safi].name)
7130 vty_out (vty, " default route-map %s%s,",
7131 p->default_rmap[afi][safi].map ? "*" : "",
7132 p->default_rmap[afi][safi].name);
7133 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
7134 vty_out (vty, " default sent%s", VTY_NEWLINE);
7135 else
7136 vty_out (vty, " default not sent%s", VTY_NEWLINE);
7137 }
7138
7139 if (filter->plist[FILTER_IN].name
7140 || filter->dlist[FILTER_IN].name
7141 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00007142 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007143 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
7144 if (filter->plist[FILTER_OUT].name
7145 || filter->dlist[FILTER_OUT].name
7146 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00007147 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00007148 || filter->usmap.name)
7149 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007150 if (filter->map[RMAP_IMPORT].name)
7151 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
7152 if (filter->map[RMAP_EXPORT].name)
7153 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007154
7155 /* prefix-list */
7156 if (filter->plist[FILTER_IN].name)
7157 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
7158 filter->plist[FILTER_IN].plist ? "*" : "",
7159 filter->plist[FILTER_IN].name,
7160 VTY_NEWLINE);
7161 if (filter->plist[FILTER_OUT].name)
7162 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
7163 filter->plist[FILTER_OUT].plist ? "*" : "",
7164 filter->plist[FILTER_OUT].name,
7165 VTY_NEWLINE);
7166
7167 /* distribute-list */
7168 if (filter->dlist[FILTER_IN].name)
7169 vty_out (vty, " Incoming update network filter list is %s%s%s",
7170 filter->dlist[FILTER_IN].alist ? "*" : "",
7171 filter->dlist[FILTER_IN].name,
7172 VTY_NEWLINE);
7173 if (filter->dlist[FILTER_OUT].name)
7174 vty_out (vty, " Outgoing update network filter list is %s%s%s",
7175 filter->dlist[FILTER_OUT].alist ? "*" : "",
7176 filter->dlist[FILTER_OUT].name,
7177 VTY_NEWLINE);
7178
7179 /* filter-list. */
7180 if (filter->aslist[FILTER_IN].name)
7181 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
7182 filter->aslist[FILTER_IN].aslist ? "*" : "",
7183 filter->aslist[FILTER_IN].name,
7184 VTY_NEWLINE);
7185 if (filter->aslist[FILTER_OUT].name)
7186 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
7187 filter->aslist[FILTER_OUT].aslist ? "*" : "",
7188 filter->aslist[FILTER_OUT].name,
7189 VTY_NEWLINE);
7190
7191 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00007192 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007193 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007194 filter->map[RMAP_IN].map ? "*" : "",
7195 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00007196 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007197 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00007198 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007199 filter->map[RMAP_OUT].map ? "*" : "",
7200 filter->map[RMAP_OUT].name,
7201 VTY_NEWLINE);
7202 if (filter->map[RMAP_IMPORT].name)
7203 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
7204 filter->map[RMAP_IMPORT].map ? "*" : "",
7205 filter->map[RMAP_IMPORT].name,
7206 VTY_NEWLINE);
7207 if (filter->map[RMAP_EXPORT].name)
7208 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
7209 filter->map[RMAP_EXPORT].map ? "*" : "",
7210 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00007211 VTY_NEWLINE);
7212
7213 /* unsuppress-map */
7214 if (filter->usmap.name)
7215 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
7216 filter->usmap.map ? "*" : "",
7217 filter->usmap.name, VTY_NEWLINE);
7218
7219 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00007220 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
7221
paul718e3742002-12-13 20:15:29 +00007222 /* Maximum prefix */
7223 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
7224 {
hasso0a486e52005-02-01 20:57:17 +00007225 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00007226 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00007227 ? " (warning-only)" : "", VTY_NEWLINE);
7228 vty_out (vty, " Threshold for warning message %d%%",
7229 p->pmax_threshold[afi][safi]);
7230 if (p->pmax_restart[afi][safi])
7231 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
7232 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007233 }
paul718e3742002-12-13 20:15:29 +00007234
7235 vty_out (vty, "%s", VTY_NEWLINE);
7236}
7237
paul94f2b392005-06-28 12:44:16 +00007238static void
paul718e3742002-12-13 20:15:29 +00007239bgp_show_peer (struct vty *vty, struct peer *p)
7240{
7241 struct bgp *bgp;
7242 char buf1[BUFSIZ];
7243 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00007244 afi_t afi;
7245 safi_t safi;
paul718e3742002-12-13 20:15:29 +00007246
7247 bgp = p->bgp;
7248
7249 /* Configured IP address. */
7250 vty_out (vty, "BGP neighbor is %s, ", p->host);
7251 vty_out (vty, "remote AS %d, ", p->as);
7252 vty_out (vty, "local AS %d%s, ",
7253 p->change_local_as ? p->change_local_as : p->local_as,
7254 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
7255 " no-prepend" : "");
7256 vty_out (vty, "%s link%s",
7257 p->as == p->local_as ? "internal" : "external",
7258 VTY_NEWLINE);
7259
7260 /* Description. */
7261 if (p->desc)
7262 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
7263
7264 /* Peer-group */
7265 if (p->group)
7266 vty_out (vty, " Member of peer-group %s for session parameters%s",
7267 p->group->name, VTY_NEWLINE);
7268
7269 /* Administrative shutdown. */
7270 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
7271 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
7272
7273 /* BGP Version. */
7274 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00007275 vty_out (vty, ", remote router ID %s%s",
7276 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
7277 VTY_NEWLINE);
7278
7279 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00007280 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
7281 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00007282 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
7283
7284 /* Status. */
7285 vty_out (vty, " BGP state = %s",
7286 LOOKUP (bgp_status_msg, p->status));
7287 if (p->status == Established)
7288 vty_out (vty, ", up for %8s",
7289 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00007290 else if (p->status == Active)
7291 {
7292 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7293 vty_out (vty, " (passive)");
7294 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7295 vty_out (vty, " (NSF passive)");
7296 }
paul718e3742002-12-13 20:15:29 +00007297 vty_out (vty, "%s", VTY_NEWLINE);
7298
7299 /* read timer */
7300 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7301
7302 /* Configured timer values. */
7303 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7304 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7305 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7306 {
7307 vty_out (vty, " Configured hold time is %d", p->holdtime);
7308 vty_out (vty, ", keepalive interval is %d seconds%s",
7309 p->keepalive, VTY_NEWLINE);
7310 }
hasso93406d82005-02-02 14:40:33 +00007311
paul718e3742002-12-13 20:15:29 +00007312 /* Capability. */
7313 if (p->status == Established)
7314 {
hasso538621f2004-05-21 09:31:30 +00007315 if (p->cap
paul718e3742002-12-13 20:15:29 +00007316 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7317 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7318 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7319 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7320#ifdef HAVE_IPV6
7321 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7322 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7323 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7324 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
7325#endif /* HAVE_IPV6 */
7326 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7327 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7328 {
7329 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7330
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007331 /* AS4 */
7332 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
7333 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7334 {
7335 vty_out (vty, " 4 Byte AS:");
7336 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7337 vty_out (vty, " advertised");
7338 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
7339 vty_out (vty, " %sreceived",
7340 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
7341 vty_out (vty, "%s", VTY_NEWLINE);
7342 }
paul718e3742002-12-13 20:15:29 +00007343 /* Dynamic */
7344 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
7345 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7346 {
7347 vty_out (vty, " Dynamic:");
7348 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7349 vty_out (vty, " advertised");
7350 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00007351 vty_out (vty, " %sreceived",
7352 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007353 vty_out (vty, "%s", VTY_NEWLINE);
7354 }
7355
7356 /* Route Refresh */
7357 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
7358 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7359 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
7360 {
7361 vty_out (vty, " Route refresh:");
7362 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
7363 vty_out (vty, " advertised");
7364 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7365 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00007366 vty_out (vty, " %sreceived(%s)",
7367 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
7368 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
7369 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
7370 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
7371
paul718e3742002-12-13 20:15:29 +00007372 vty_out (vty, "%s", VTY_NEWLINE);
7373 }
7374
hasso538621f2004-05-21 09:31:30 +00007375 /* Multiprotocol Extensions */
7376 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7377 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7378 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00007379 {
hasso538621f2004-05-21 09:31:30 +00007380 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
7381 if (p->afc_adv[afi][safi])
7382 vty_out (vty, " advertised");
7383 if (p->afc_recv[afi][safi])
7384 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
7385 vty_out (vty, "%s", VTY_NEWLINE);
7386 }
7387
7388 /* Gracefull Restart */
7389 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7390 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007391 {
hasso538621f2004-05-21 09:31:30 +00007392 vty_out (vty, " Graceful Restart Capabilty:");
7393 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007394 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00007395 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
7396 vty_out (vty, " %sreceived",
7397 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007398 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007399
7400 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00007401 {
hasso538621f2004-05-21 09:31:30 +00007402 int restart_af_count = 0;
7403
7404 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00007405 p->v_gr_restart, VTY_NEWLINE);
7406 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007407
7408 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7409 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7410 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
7411 {
hasso93406d82005-02-02 14:40:33 +00007412 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
7413 afi_safi_print (afi, safi),
7414 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
7415 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00007416 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00007417 }
hasso538621f2004-05-21 09:31:30 +00007418 if (! restart_af_count)
7419 vty_out (vty, "none");
7420 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007421 }
paul718e3742002-12-13 20:15:29 +00007422 }
paul718e3742002-12-13 20:15:29 +00007423 }
7424 }
7425
hasso93406d82005-02-02 14:40:33 +00007426 /* graceful restart information */
7427 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7428 || p->t_gr_restart
7429 || p->t_gr_stale)
7430 {
7431 int eor_send_af_count = 0;
7432 int eor_receive_af_count = 0;
7433
7434 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
7435 if (p->status == Established)
7436 {
7437 vty_out (vty, " End-of-RIB send: ");
7438 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7439 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7440 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
7441 {
7442 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
7443 afi_safi_print (afi, safi));
7444 eor_send_af_count++;
7445 }
7446 vty_out (vty, "%s", VTY_NEWLINE);
7447
7448 vty_out (vty, " End-of-RIB received: ");
7449 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7450 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7451 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
7452 {
7453 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
7454 afi_safi_print (afi, safi));
7455 eor_receive_af_count++;
7456 }
7457 vty_out (vty, "%s", VTY_NEWLINE);
7458 }
7459
7460 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007461 vty_out (vty, " The remaining time of restart timer is %ld%s",
7462 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
7463
hasso93406d82005-02-02 14:40:33 +00007464 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007465 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
7466 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007467 }
7468
paul718e3742002-12-13 20:15:29 +00007469 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00007470 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
7471 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007472 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007473 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
7474 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
7475 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
7476 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
7477 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
7478 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
7479 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
7480 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
7481 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
7482 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
7483 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007484
7485 /* advertisement-interval */
7486 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
7487 p->v_routeadv, VTY_NEWLINE);
7488
7489 /* Update-source. */
7490 if (p->update_if || p->update_source)
7491 {
7492 vty_out (vty, " Update source is ");
7493 if (p->update_if)
7494 vty_out (vty, "%s", p->update_if);
7495 else if (p->update_source)
7496 vty_out (vty, "%s",
7497 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
7498 vty_out (vty, "%s", VTY_NEWLINE);
7499 }
7500
7501 /* Default weight */
7502 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
7503 vty_out (vty, " Default weight %d%s", p->weight,
7504 VTY_NEWLINE);
7505
7506 vty_out (vty, "%s", VTY_NEWLINE);
7507
7508 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00007509 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7510 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7511 if (p->afc[afi][safi])
7512 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00007513
7514 vty_out (vty, " Connections established %d; dropped %d%s",
7515 p->established, p->dropped,
7516 VTY_NEWLINE);
7517
hassoe0701b72004-05-20 09:19:34 +00007518 if (! p->dropped)
7519 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
7520 else
7521 vty_out (vty, " Last reset %s, due to %s%s",
7522 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
7523 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00007524
paul718e3742002-12-13 20:15:29 +00007525 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7526 {
7527 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00007528
7529 if (p->t_pmax_restart)
7530 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
7531 p->host, thread_timer_remain_second (p->t_pmax_restart),
7532 VTY_NEWLINE);
7533 else
7534 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
7535 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007536 }
7537
7538 /* EBGP Multihop */
7539 if (peer_sort (p) != BGP_PEER_IBGP && p->ttl > 1)
7540 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7541 p->ttl, VTY_NEWLINE);
7542
7543 /* Local address. */
7544 if (p->su_local)
7545 {
hasso93406d82005-02-02 14:40:33 +00007546 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00007547 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
7548 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00007549 VTY_NEWLINE);
7550 }
7551
7552 /* Remote address. */
7553 if (p->su_remote)
7554 {
7555 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
7556 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
7557 ntohs (p->su_remote->sin.sin_port),
7558 VTY_NEWLINE);
7559 }
7560
7561 /* Nexthop display. */
7562 if (p->su_local)
7563 {
7564 vty_out (vty, "Nexthop: %s%s",
7565 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
7566 VTY_NEWLINE);
7567#ifdef HAVE_IPV6
7568 vty_out (vty, "Nexthop global: %s%s",
7569 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
7570 VTY_NEWLINE);
7571 vty_out (vty, "Nexthop local: %s%s",
7572 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
7573 VTY_NEWLINE);
7574 vty_out (vty, "BGP connection: %s%s",
7575 p->shared_network ? "shared network" : "non shared network",
7576 VTY_NEWLINE);
7577#endif /* HAVE_IPV6 */
7578 }
7579
7580 /* Timer information. */
7581 if (p->t_start)
7582 vty_out (vty, "Next start timer due in %ld seconds%s",
7583 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
7584 if (p->t_connect)
7585 vty_out (vty, "Next connect timer due in %ld seconds%s",
7586 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
7587
7588 vty_out (vty, "Read thread: %s Write thread: %s%s",
7589 p->t_read ? "on" : "off",
7590 p->t_write ? "on" : "off",
7591 VTY_NEWLINE);
7592
7593 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
7594 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
7595 bgp_capability_vty_out (vty, p);
7596
7597 vty_out (vty, "%s", VTY_NEWLINE);
7598}
7599
paul94f2b392005-06-28 12:44:16 +00007600static int
paul718e3742002-12-13 20:15:29 +00007601bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
7602 enum show_type type, union sockunion *su)
7603{
paul1eb8ef22005-04-07 07:30:20 +00007604 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00007605 struct peer *peer;
7606 int find = 0;
7607
paul1eb8ef22005-04-07 07:30:20 +00007608 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007609 {
7610 switch (type)
7611 {
7612 case show_all:
7613 bgp_show_peer (vty, peer);
7614 break;
7615 case show_peer:
7616 if (sockunion_same (&peer->su, su))
7617 {
7618 find = 1;
7619 bgp_show_peer (vty, peer);
7620 }
7621 break;
7622 }
7623 }
7624
7625 if (type == show_peer && ! find)
7626 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
7627
7628 return CMD_SUCCESS;
7629}
7630
paul94f2b392005-06-28 12:44:16 +00007631static int
paulfd79ac92004-10-13 05:06:08 +00007632bgp_show_neighbor_vty (struct vty *vty, const char *name,
7633 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00007634{
7635 int ret;
7636 struct bgp *bgp;
7637 union sockunion su;
7638
7639 if (ip_str)
7640 {
7641 ret = str2sockunion (ip_str, &su);
7642 if (ret < 0)
7643 {
7644 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
7645 return CMD_WARNING;
7646 }
7647 }
7648
7649 if (name)
7650 {
7651 bgp = bgp_lookup_by_name (name);
7652
7653 if (! bgp)
7654 {
7655 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7656 return CMD_WARNING;
7657 }
7658
7659 bgp_show_neighbor (vty, bgp, type, &su);
7660
7661 return CMD_SUCCESS;
7662 }
7663
7664 bgp = bgp_get_default ();
7665
7666 if (bgp)
7667 bgp_show_neighbor (vty, bgp, type, &su);
7668
7669 return CMD_SUCCESS;
7670}
7671
7672/* "show ip bgp neighbors" commands. */
7673DEFUN (show_ip_bgp_neighbors,
7674 show_ip_bgp_neighbors_cmd,
7675 "show ip bgp neighbors",
7676 SHOW_STR
7677 IP_STR
7678 BGP_STR
7679 "Detailed information on TCP and BGP neighbor connections\n")
7680{
7681 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
7682}
7683
7684ALIAS (show_ip_bgp_neighbors,
7685 show_ip_bgp_ipv4_neighbors_cmd,
7686 "show ip bgp ipv4 (unicast|multicast) neighbors",
7687 SHOW_STR
7688 IP_STR
7689 BGP_STR
7690 "Address family\n"
7691 "Address Family modifier\n"
7692 "Address Family modifier\n"
7693 "Detailed information on TCP and BGP neighbor connections\n")
7694
7695ALIAS (show_ip_bgp_neighbors,
7696 show_ip_bgp_vpnv4_all_neighbors_cmd,
7697 "show ip bgp vpnv4 all neighbors",
7698 SHOW_STR
7699 IP_STR
7700 BGP_STR
7701 "Display VPNv4 NLRI specific information\n"
7702 "Display information about all VPNv4 NLRIs\n"
7703 "Detailed information on TCP and BGP neighbor connections\n")
7704
7705ALIAS (show_ip_bgp_neighbors,
7706 show_ip_bgp_vpnv4_rd_neighbors_cmd,
7707 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
7708 SHOW_STR
7709 IP_STR
7710 BGP_STR
7711 "Display VPNv4 NLRI specific information\n"
7712 "Display information for a route distinguisher\n"
7713 "VPN Route Distinguisher\n"
7714 "Detailed information on TCP and BGP neighbor connections\n")
7715
7716ALIAS (show_ip_bgp_neighbors,
7717 show_bgp_neighbors_cmd,
7718 "show bgp neighbors",
7719 SHOW_STR
7720 BGP_STR
7721 "Detailed information on TCP and BGP neighbor connections\n")
7722
7723ALIAS (show_ip_bgp_neighbors,
7724 show_bgp_ipv6_neighbors_cmd,
7725 "show bgp ipv6 neighbors",
7726 SHOW_STR
7727 BGP_STR
7728 "Address family\n"
7729 "Detailed information on TCP and BGP neighbor connections\n")
7730
7731DEFUN (show_ip_bgp_neighbors_peer,
7732 show_ip_bgp_neighbors_peer_cmd,
7733 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
7734 SHOW_STR
7735 IP_STR
7736 BGP_STR
7737 "Detailed information on TCP and BGP neighbor connections\n"
7738 "Neighbor to display information about\n"
7739 "Neighbor to display information about\n")
7740{
7741 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
7742}
7743
7744ALIAS (show_ip_bgp_neighbors_peer,
7745 show_ip_bgp_ipv4_neighbors_peer_cmd,
7746 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
7747 SHOW_STR
7748 IP_STR
7749 BGP_STR
7750 "Address family\n"
7751 "Address Family modifier\n"
7752 "Address Family modifier\n"
7753 "Detailed information on TCP and BGP neighbor connections\n"
7754 "Neighbor to display information about\n"
7755 "Neighbor to display information about\n")
7756
7757ALIAS (show_ip_bgp_neighbors_peer,
7758 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
7759 "show ip bgp vpnv4 all neighbors A.B.C.D",
7760 SHOW_STR
7761 IP_STR
7762 BGP_STR
7763 "Display VPNv4 NLRI specific information\n"
7764 "Display information about all VPNv4 NLRIs\n"
7765 "Detailed information on TCP and BGP neighbor connections\n"
7766 "Neighbor to display information about\n")
7767
7768ALIAS (show_ip_bgp_neighbors_peer,
7769 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
7770 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
7771 SHOW_STR
7772 IP_STR
7773 BGP_STR
7774 "Display VPNv4 NLRI specific information\n"
7775 "Display information about all VPNv4 NLRIs\n"
7776 "Detailed information on TCP and BGP neighbor connections\n"
7777 "Neighbor to display information about\n")
7778
7779ALIAS (show_ip_bgp_neighbors_peer,
7780 show_bgp_neighbors_peer_cmd,
7781 "show bgp neighbors (A.B.C.D|X:X::X:X)",
7782 SHOW_STR
7783 BGP_STR
7784 "Detailed information on TCP and BGP neighbor connections\n"
7785 "Neighbor to display information about\n"
7786 "Neighbor to display information about\n")
7787
7788ALIAS (show_ip_bgp_neighbors_peer,
7789 show_bgp_ipv6_neighbors_peer_cmd,
7790 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
7791 SHOW_STR
7792 BGP_STR
7793 "Address family\n"
7794 "Detailed information on TCP and BGP neighbor connections\n"
7795 "Neighbor to display information about\n"
7796 "Neighbor to display information about\n")
7797
7798DEFUN (show_ip_bgp_instance_neighbors,
7799 show_ip_bgp_instance_neighbors_cmd,
7800 "show ip bgp view WORD neighbors",
7801 SHOW_STR
7802 IP_STR
7803 BGP_STR
7804 "BGP view\n"
7805 "View name\n"
7806 "Detailed information on TCP and BGP neighbor connections\n")
7807{
7808 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
7809}
7810
paulbb46e942003-10-24 19:02:03 +00007811ALIAS (show_ip_bgp_instance_neighbors,
7812 show_bgp_instance_neighbors_cmd,
7813 "show bgp view WORD neighbors",
7814 SHOW_STR
7815 BGP_STR
7816 "BGP view\n"
7817 "View name\n"
7818 "Detailed information on TCP and BGP neighbor connections\n")
7819
7820ALIAS (show_ip_bgp_instance_neighbors,
7821 show_bgp_instance_ipv6_neighbors_cmd,
7822 "show bgp view WORD ipv6 neighbors",
7823 SHOW_STR
7824 BGP_STR
7825 "BGP view\n"
7826 "View name\n"
7827 "Address family\n"
7828 "Detailed information on TCP and BGP neighbor connections\n")
7829
paul718e3742002-12-13 20:15:29 +00007830DEFUN (show_ip_bgp_instance_neighbors_peer,
7831 show_ip_bgp_instance_neighbors_peer_cmd,
7832 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
7833 SHOW_STR
7834 IP_STR
7835 BGP_STR
7836 "BGP view\n"
7837 "View name\n"
7838 "Detailed information on TCP and BGP neighbor connections\n"
7839 "Neighbor to display information about\n"
7840 "Neighbor to display information about\n")
7841{
7842 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
7843}
paulbb46e942003-10-24 19:02:03 +00007844
7845ALIAS (show_ip_bgp_instance_neighbors_peer,
7846 show_bgp_instance_neighbors_peer_cmd,
7847 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
7848 SHOW_STR
7849 BGP_STR
7850 "BGP view\n"
7851 "View name\n"
7852 "Detailed information on TCP and BGP neighbor connections\n"
7853 "Neighbor to display information about\n"
7854 "Neighbor to display information about\n")
7855
7856ALIAS (show_ip_bgp_instance_neighbors_peer,
7857 show_bgp_instance_ipv6_neighbors_peer_cmd,
7858 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
7859 SHOW_STR
7860 BGP_STR
7861 "BGP view\n"
7862 "View name\n"
7863 "Address family\n"
7864 "Detailed information on TCP and BGP neighbor connections\n"
7865 "Neighbor to display information about\n"
7866 "Neighbor to display information about\n")
7867
paul718e3742002-12-13 20:15:29 +00007868/* Show BGP's AS paths internal data. There are both `show ip bgp
7869 paths' and `show ip mbgp paths'. Those functions results are the
7870 same.*/
7871DEFUN (show_ip_bgp_paths,
7872 show_ip_bgp_paths_cmd,
7873 "show ip bgp paths",
7874 SHOW_STR
7875 IP_STR
7876 BGP_STR
7877 "Path information\n")
7878{
7879 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
7880 aspath_print_all_vty (vty);
7881 return CMD_SUCCESS;
7882}
7883
7884DEFUN (show_ip_bgp_ipv4_paths,
7885 show_ip_bgp_ipv4_paths_cmd,
7886 "show ip bgp ipv4 (unicast|multicast) paths",
7887 SHOW_STR
7888 IP_STR
7889 BGP_STR
7890 "Address family\n"
7891 "Address Family modifier\n"
7892 "Address Family modifier\n"
7893 "Path information\n")
7894{
7895 vty_out (vty, "Address Refcnt Path\r\n");
7896 aspath_print_all_vty (vty);
7897
7898 return CMD_SUCCESS;
7899}
7900
7901#include "hash.h"
7902
paul94f2b392005-06-28 12:44:16 +00007903static void
paul718e3742002-12-13 20:15:29 +00007904community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
7905{
7906 struct community *com;
7907
7908 com = (struct community *) backet->data;
7909 vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt,
7910 community_str (com), VTY_NEWLINE);
7911}
7912
7913/* Show BGP's community internal data. */
7914DEFUN (show_ip_bgp_community_info,
7915 show_ip_bgp_community_info_cmd,
7916 "show ip bgp community-info",
7917 SHOW_STR
7918 IP_STR
7919 BGP_STR
7920 "List all bgp community information\n")
7921{
7922 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
7923
7924 hash_iterate (community_hash (),
7925 (void (*) (struct hash_backet *, void *))
7926 community_show_all_iterator,
7927 vty);
7928
7929 return CMD_SUCCESS;
7930}
7931
7932DEFUN (show_ip_bgp_attr_info,
7933 show_ip_bgp_attr_info_cmd,
7934 "show ip bgp attribute-info",
7935 SHOW_STR
7936 IP_STR
7937 BGP_STR
7938 "List all bgp attribute information\n")
7939{
7940 attr_show_all (vty);
7941 return CMD_SUCCESS;
7942}
7943
paul94f2b392005-06-28 12:44:16 +00007944static int
paulfee0f4c2004-09-13 05:12:46 +00007945bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
7946 afi_t afi, safi_t safi)
7947{
7948 char timebuf[BGP_UPTIME_LEN];
7949 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00007950 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00007951 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007952 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00007953 int len;
7954 int count = 0;
7955
7956 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
7957 {
paul1eb8ef22005-04-07 07:30:20 +00007958 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00007959 {
7960 count++;
7961 bgp_write_rsclient_summary (vty, peer, afi, safi);
7962 }
7963 return count;
7964 }
7965
7966 len = vty_out (vty, "%s", rsclient->host);
7967 len = 16 - len;
7968
7969 if (len < 1)
7970 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7971 else
7972 vty_out (vty, "%*s", len, " ");
7973
hasso3d515fd2005-02-01 21:30:04 +00007974 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00007975
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007976 vty_out (vty, "%11d ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00007977
7978 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
7979 if ( rmname && strlen (rmname) > 13 )
7980 {
7981 sprintf (rmbuf, "%13s", "...");
7982 rmname = strncpy (rmbuf, rmname, 10);
7983 }
7984 else if (! rmname)
7985 rmname = "<none>";
7986 vty_out (vty, " %13s ", rmname);
7987
7988 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
7989 if ( rmname && strlen (rmname) > 13 )
7990 {
7991 sprintf (rmbuf, "%13s", "...");
7992 rmname = strncpy (rmbuf, rmname, 10);
7993 }
7994 else if (! rmname)
7995 rmname = "<none>";
7996 vty_out (vty, " %13s ", rmname);
7997
7998 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
7999
8000 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8001 vty_out (vty, " Idle (Admin)");
8002 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8003 vty_out (vty, " Idle (PfxCt)");
8004 else
8005 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8006
8007 vty_out (vty, "%s", VTY_NEWLINE);
8008
8009 return 1;
8010}
8011
paul94f2b392005-06-28 12:44:16 +00008012static int
paulfd79ac92004-10-13 05:06:08 +00008013bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8014 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008015{
8016 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008017 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008018 int count = 0;
8019
8020 /* Header string for each address family. */
8021 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
8022
paul1eb8ef22005-04-07 07:30:20 +00008023 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008024 {
8025 if (peer->afc[afi][safi] &&
8026 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8027 {
8028 if (! count)
8029 {
8030 vty_out (vty,
8031 "Route Server's BGP router identifier %s%s",
8032 inet_ntoa (bgp->router_id), VTY_NEWLINE);
8033 vty_out (vty,
8034 "Route Server's local AS number %d%s", bgp->as,
8035 VTY_NEWLINE);
8036
8037 vty_out (vty, "%s", VTY_NEWLINE);
8038 vty_out (vty, "%s%s", header, VTY_NEWLINE);
8039 }
8040
8041 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
8042 }
8043 }
8044
8045 if (count)
8046 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
8047 count, VTY_NEWLINE);
8048 else
8049 vty_out (vty, "No %s Route Server Client is configured%s",
8050 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
8051
8052 return CMD_SUCCESS;
8053}
8054
paul94f2b392005-06-28 12:44:16 +00008055static int
paulfd79ac92004-10-13 05:06:08 +00008056bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
8057 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008058{
8059 struct bgp *bgp;
8060
8061 if (name)
8062 {
8063 bgp = bgp_lookup_by_name (name);
8064
8065 if (! bgp)
8066 {
8067 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8068 return CMD_WARNING;
8069 }
8070
8071 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8072 return CMD_SUCCESS;
8073 }
8074
8075 bgp = bgp_get_default ();
8076
8077 if (bgp)
8078 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8079
8080 return CMD_SUCCESS;
8081}
8082
8083/* 'show bgp rsclient' commands. */
8084DEFUN (show_ip_bgp_rsclient_summary,
8085 show_ip_bgp_rsclient_summary_cmd,
8086 "show ip bgp rsclient summary",
8087 SHOW_STR
8088 IP_STR
8089 BGP_STR
8090 "Information about Route Server Clients\n"
8091 "Summary of all Route Server Clients\n")
8092{
8093 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8094}
8095
8096DEFUN (show_ip_bgp_instance_rsclient_summary,
8097 show_ip_bgp_instance_rsclient_summary_cmd,
8098 "show ip bgp view WORD rsclient summary",
8099 SHOW_STR
8100 IP_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_IP, SAFI_UNICAST);
8108}
8109
8110DEFUN (show_ip_bgp_ipv4_rsclient_summary,
8111 show_ip_bgp_ipv4_rsclient_summary_cmd,
8112 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
8113 SHOW_STR
8114 IP_STR
8115 BGP_STR
8116 "Address family\n"
8117 "Address Family modifier\n"
8118 "Address Family modifier\n"
8119 "Information about Route Server Clients\n"
8120 "Summary of all Route Server Clients\n")
8121{
8122 if (strncmp (argv[0], "m", 1) == 0)
8123 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
8124
8125 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8126}
8127
8128DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
8129 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
8130 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8131 SHOW_STR
8132 IP_STR
8133 BGP_STR
8134 "BGP view\n"
8135 "View name\n"
8136 "Address family\n"
8137 "Address Family modifier\n"
8138 "Address Family modifier\n"
8139 "Information about Route Server Clients\n"
8140 "Summary of all Route Server Clients\n")
8141{
8142 if (strncmp (argv[1], "m", 1) == 0)
8143 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
8144
8145 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8146}
8147
8148#ifdef HAVE_IPV6
8149DEFUN (show_bgp_rsclient_summary,
8150 show_bgp_rsclient_summary_cmd,
8151 "show bgp rsclient summary",
8152 SHOW_STR
8153 BGP_STR
8154 "Information about Route Server Clients\n"
8155 "Summary of all Route Server Clients\n")
8156{
8157 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8158}
8159
8160DEFUN (show_bgp_instance_rsclient_summary,
8161 show_bgp_instance_rsclient_summary_cmd,
8162 "show bgp view WORD rsclient summary",
8163 SHOW_STR
8164 BGP_STR
8165 "BGP view\n"
8166 "View name\n"
8167 "Information about Route Server Clients\n"
8168 "Summary of all Route Server Clients\n")
8169{
8170 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
8171}
8172
8173ALIAS (show_bgp_rsclient_summary,
8174 show_bgp_ipv6_rsclient_summary_cmd,
8175 "show bgp ipv6 rsclient summary",
8176 SHOW_STR
8177 BGP_STR
8178 "Address family\n"
8179 "Information about Route Server Clients\n"
8180 "Summary of all Route Server Clients\n")
8181
8182ALIAS (show_bgp_instance_rsclient_summary,
8183 show_bgp_instance_ipv6_rsclient_summary_cmd,
8184 "show bgp view WORD ipv6 rsclient summary",
8185 SHOW_STR
8186 BGP_STR
8187 "BGP view\n"
8188 "View name\n"
8189 "Address family\n"
8190 "Information about Route Server Clients\n"
8191 "Summary of all Route Server Clients\n")
8192#endif /* HAVE IPV6 */
8193
paul718e3742002-12-13 20:15:29 +00008194/* Redistribute VTY commands. */
8195
8196/* Utility function to convert user input route type string to route
8197 type. */
8198static int
paulfd79ac92004-10-13 05:06:08 +00008199bgp_str2route_type (int afi, const char *str)
paul718e3742002-12-13 20:15:29 +00008200{
8201 if (! str)
8202 return 0;
8203
8204 if (afi == AFI_IP)
8205 {
8206 if (strncmp (str, "k", 1) == 0)
8207 return ZEBRA_ROUTE_KERNEL;
8208 else if (strncmp (str, "c", 1) == 0)
8209 return ZEBRA_ROUTE_CONNECT;
8210 else if (strncmp (str, "s", 1) == 0)
8211 return ZEBRA_ROUTE_STATIC;
8212 else if (strncmp (str, "r", 1) == 0)
8213 return ZEBRA_ROUTE_RIP;
8214 else if (strncmp (str, "o", 1) == 0)
8215 return ZEBRA_ROUTE_OSPF;
8216 }
8217 if (afi == AFI_IP6)
8218 {
8219 if (strncmp (str, "k", 1) == 0)
8220 return ZEBRA_ROUTE_KERNEL;
8221 else if (strncmp (str, "c", 1) == 0)
8222 return ZEBRA_ROUTE_CONNECT;
8223 else if (strncmp (str, "s", 1) == 0)
8224 return ZEBRA_ROUTE_STATIC;
8225 else if (strncmp (str, "r", 1) == 0)
8226 return ZEBRA_ROUTE_RIPNG;
8227 else if (strncmp (str, "o", 1) == 0)
8228 return ZEBRA_ROUTE_OSPF6;
8229 }
8230 return 0;
8231}
8232
8233DEFUN (bgp_redistribute_ipv4,
8234 bgp_redistribute_ipv4_cmd,
8235 "redistribute (connected|kernel|ospf|rip|static)",
8236 "Redistribute information from another routing protocol\n"
8237 "Connected\n"
8238 "Kernel routes\n"
8239 "Open Shurtest Path First (OSPF)\n"
8240 "Routing Information Protocol (RIP)\n"
8241 "Static routes\n")
8242{
8243 int type;
8244
8245 type = bgp_str2route_type (AFI_IP, argv[0]);
8246 if (! type)
8247 {
8248 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8249 return CMD_WARNING;
8250 }
8251 return bgp_redistribute_set (vty->index, AFI_IP, type);
8252}
8253
8254DEFUN (bgp_redistribute_ipv4_rmap,
8255 bgp_redistribute_ipv4_rmap_cmd,
8256 "redistribute (connected|kernel|ospf|rip|static) route-map WORD",
8257 "Redistribute information from another routing protocol\n"
8258 "Connected\n"
8259 "Kernel routes\n"
8260 "Open Shurtest Path First (OSPF)\n"
8261 "Routing Information Protocol (RIP)\n"
8262 "Static routes\n"
8263 "Route map reference\n"
8264 "Pointer to route-map entries\n")
8265{
8266 int type;
8267
8268 type = bgp_str2route_type (AFI_IP, argv[0]);
8269 if (! type)
8270 {
8271 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8272 return CMD_WARNING;
8273 }
8274
8275 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8276 return bgp_redistribute_set (vty->index, AFI_IP, type);
8277}
8278
8279DEFUN (bgp_redistribute_ipv4_metric,
8280 bgp_redistribute_ipv4_metric_cmd,
8281 "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
8282 "Redistribute information from another routing protocol\n"
8283 "Connected\n"
8284 "Kernel routes\n"
8285 "Open Shurtest Path First (OSPF)\n"
8286 "Routing Information Protocol (RIP)\n"
8287 "Static routes\n"
8288 "Metric for redistributed routes\n"
8289 "Default metric\n")
8290{
8291 int type;
8292 u_int32_t metric;
8293
8294 type = bgp_str2route_type (AFI_IP, argv[0]);
8295 if (! type)
8296 {
8297 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8298 return CMD_WARNING;
8299 }
8300 VTY_GET_INTEGER ("metric", metric, argv[1]);
8301
8302 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8303 return bgp_redistribute_set (vty->index, AFI_IP, type);
8304}
8305
8306DEFUN (bgp_redistribute_ipv4_rmap_metric,
8307 bgp_redistribute_ipv4_rmap_metric_cmd,
8308 "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
8309 "Redistribute information from another routing protocol\n"
8310 "Connected\n"
8311 "Kernel routes\n"
8312 "Open Shurtest Path First (OSPF)\n"
8313 "Routing Information Protocol (RIP)\n"
8314 "Static routes\n"
8315 "Route map reference\n"
8316 "Pointer to route-map entries\n"
8317 "Metric for redistributed routes\n"
8318 "Default metric\n")
8319{
8320 int type;
8321 u_int32_t metric;
8322
8323 type = bgp_str2route_type (AFI_IP, argv[0]);
8324 if (! type)
8325 {
8326 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8327 return CMD_WARNING;
8328 }
8329 VTY_GET_INTEGER ("metric", metric, argv[2]);
8330
8331 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8332 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8333 return bgp_redistribute_set (vty->index, AFI_IP, type);
8334}
8335
8336DEFUN (bgp_redistribute_ipv4_metric_rmap,
8337 bgp_redistribute_ipv4_metric_rmap_cmd,
8338 "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
8339 "Redistribute information from another routing protocol\n"
8340 "Connected\n"
8341 "Kernel routes\n"
8342 "Open Shurtest Path First (OSPF)\n"
8343 "Routing Information Protocol (RIP)\n"
8344 "Static routes\n"
8345 "Metric for redistributed routes\n"
8346 "Default metric\n"
8347 "Route map reference\n"
8348 "Pointer to route-map entries\n")
8349{
8350 int type;
8351 u_int32_t metric;
8352
8353 type = bgp_str2route_type (AFI_IP, argv[0]);
8354 if (! type)
8355 {
8356 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8357 return CMD_WARNING;
8358 }
8359 VTY_GET_INTEGER ("metric", metric, argv[1]);
8360
8361 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8362 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
8363 return bgp_redistribute_set (vty->index, AFI_IP, type);
8364}
8365
8366DEFUN (no_bgp_redistribute_ipv4,
8367 no_bgp_redistribute_ipv4_cmd,
8368 "no redistribute (connected|kernel|ospf|rip|static)",
8369 NO_STR
8370 "Redistribute information from another routing protocol\n"
8371 "Connected\n"
8372 "Kernel routes\n"
8373 "Open Shurtest Path First (OSPF)\n"
8374 "Routing Information Protocol (RIP)\n"
8375 "Static routes\n")
8376{
8377 int type;
8378
8379 type = bgp_str2route_type (AFI_IP, argv[0]);
8380 if (! type)
8381 {
8382 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8383 return CMD_WARNING;
8384 }
8385
8386 return bgp_redistribute_unset (vty->index, AFI_IP, type);
8387}
8388
8389DEFUN (no_bgp_redistribute_ipv4_rmap,
8390 no_bgp_redistribute_ipv4_rmap_cmd,
8391 "no redistribute (connected|kernel|ospf|rip|static) route-map WORD",
8392 NO_STR
8393 "Redistribute information from another routing protocol\n"
8394 "Connected\n"
8395 "Kernel routes\n"
8396 "Open Shurtest Path First (OSPF)\n"
8397 "Routing Information Protocol (RIP)\n"
8398 "Static routes\n"
8399 "Route map reference\n"
8400 "Pointer to route-map entries\n")
8401{
8402 int type;
8403
8404 type = bgp_str2route_type (AFI_IP, argv[0]);
8405 if (! type)
8406 {
8407 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8408 return CMD_WARNING;
8409 }
8410
8411 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8412 return CMD_SUCCESS;
8413}
8414
8415DEFUN (no_bgp_redistribute_ipv4_metric,
8416 no_bgp_redistribute_ipv4_metric_cmd,
8417 "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
8418 NO_STR
8419 "Redistribute information from another routing protocol\n"
8420 "Connected\n"
8421 "Kernel routes\n"
8422 "Open Shurtest Path First (OSPF)\n"
8423 "Routing Information Protocol (RIP)\n"
8424 "Static routes\n"
8425 "Metric for redistributed routes\n"
8426 "Default metric\n")
8427{
8428 int type;
8429
8430 type = bgp_str2route_type (AFI_IP, argv[0]);
8431 if (! type)
8432 {
8433 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8434 return CMD_WARNING;
8435 }
8436
8437 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8438 return CMD_SUCCESS;
8439}
8440
8441DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
8442 no_bgp_redistribute_ipv4_rmap_metric_cmd,
8443 "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
8444 NO_STR
8445 "Redistribute information from another routing protocol\n"
8446 "Connected\n"
8447 "Kernel routes\n"
8448 "Open Shurtest Path First (OSPF)\n"
8449 "Routing Information Protocol (RIP)\n"
8450 "Static routes\n"
8451 "Route map reference\n"
8452 "Pointer to route-map entries\n"
8453 "Metric for redistributed routes\n"
8454 "Default metric\n")
8455{
8456 int type;
8457
8458 type = bgp_str2route_type (AFI_IP, argv[0]);
8459 if (! type)
8460 {
8461 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8462 return CMD_WARNING;
8463 }
8464
8465 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8466 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8467 return CMD_SUCCESS;
8468}
8469
8470ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
8471 no_bgp_redistribute_ipv4_metric_rmap_cmd,
8472 "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
8473 NO_STR
8474 "Redistribute information from another routing protocol\n"
8475 "Connected\n"
8476 "Kernel routes\n"
8477 "Open Shurtest Path First (OSPF)\n"
8478 "Routing Information Protocol (RIP)\n"
8479 "Static routes\n"
8480 "Metric for redistributed routes\n"
8481 "Default metric\n"
8482 "Route map reference\n"
8483 "Pointer to route-map entries\n")
8484
8485#ifdef HAVE_IPV6
8486DEFUN (bgp_redistribute_ipv6,
8487 bgp_redistribute_ipv6_cmd,
8488 "redistribute (connected|kernel|ospf6|ripng|static)",
8489 "Redistribute information from another routing protocol\n"
8490 "Connected\n"
8491 "Kernel routes\n"
8492 "Open Shurtest Path First (OSPFv3)\n"
8493 "Routing Information Protocol (RIPng)\n"
8494 "Static routes\n")
8495{
8496 int type;
8497
8498 type = bgp_str2route_type (AFI_IP6, argv[0]);
8499 if (! type)
8500 {
8501 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8502 return CMD_WARNING;
8503 }
8504
8505 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8506}
8507
8508DEFUN (bgp_redistribute_ipv6_rmap,
8509 bgp_redistribute_ipv6_rmap_cmd,
8510 "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
8511 "Redistribute information from another routing protocol\n"
8512 "Connected\n"
8513 "Kernel routes\n"
8514 "Open Shurtest Path First (OSPFv3)\n"
8515 "Routing Information Protocol (RIPng)\n"
8516 "Static routes\n"
8517 "Route map reference\n"
8518 "Pointer to route-map entries\n")
8519{
8520 int type;
8521
8522 type = bgp_str2route_type (AFI_IP6, argv[0]);
8523 if (! type)
8524 {
8525 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8526 return CMD_WARNING;
8527 }
8528
8529 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8530 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8531}
8532
8533DEFUN (bgp_redistribute_ipv6_metric,
8534 bgp_redistribute_ipv6_metric_cmd,
8535 "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
8536 "Redistribute information from another routing protocol\n"
8537 "Connected\n"
8538 "Kernel routes\n"
8539 "Open Shurtest Path First (OSPFv3)\n"
8540 "Routing Information Protocol (RIPng)\n"
8541 "Static routes\n"
8542 "Metric for redistributed routes\n"
8543 "Default metric\n")
8544{
8545 int type;
8546 u_int32_t metric;
8547
8548 type = bgp_str2route_type (AFI_IP6, argv[0]);
8549 if (! type)
8550 {
8551 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8552 return CMD_WARNING;
8553 }
8554 VTY_GET_INTEGER ("metric", metric, argv[1]);
8555
8556 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8557 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8558}
8559
8560DEFUN (bgp_redistribute_ipv6_rmap_metric,
8561 bgp_redistribute_ipv6_rmap_metric_cmd,
8562 "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
8563 "Redistribute information from another routing protocol\n"
8564 "Connected\n"
8565 "Kernel routes\n"
8566 "Open Shurtest Path First (OSPFv3)\n"
8567 "Routing Information Protocol (RIPng)\n"
8568 "Static routes\n"
8569 "Route map reference\n"
8570 "Pointer to route-map entries\n"
8571 "Metric for redistributed routes\n"
8572 "Default metric\n")
8573{
8574 int type;
8575 u_int32_t metric;
8576
8577 type = bgp_str2route_type (AFI_IP6, argv[0]);
8578 if (! type)
8579 {
8580 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8581 return CMD_WARNING;
8582 }
8583 VTY_GET_INTEGER ("metric", metric, argv[2]);
8584
8585 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8586 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8587 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8588}
8589
8590DEFUN (bgp_redistribute_ipv6_metric_rmap,
8591 bgp_redistribute_ipv6_metric_rmap_cmd,
8592 "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
8593 "Redistribute information from another routing protocol\n"
8594 "Connected\n"
8595 "Kernel routes\n"
8596 "Open Shurtest Path First (OSPFv3)\n"
8597 "Routing Information Protocol (RIPng)\n"
8598 "Static routes\n"
8599 "Metric for redistributed routes\n"
8600 "Default metric\n"
8601 "Route map reference\n"
8602 "Pointer to route-map entries\n")
8603{
8604 int type;
8605 u_int32_t metric;
8606
8607 type = bgp_str2route_type (AFI_IP6, argv[0]);
8608 if (! type)
8609 {
8610 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8611 return CMD_WARNING;
8612 }
8613 VTY_GET_INTEGER ("metric", metric, argv[1]);
8614
8615 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8616 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
8617 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8618}
8619
8620DEFUN (no_bgp_redistribute_ipv6,
8621 no_bgp_redistribute_ipv6_cmd,
8622 "no redistribute (connected|kernel|ospf6|ripng|static)",
8623 NO_STR
8624 "Redistribute information from another routing protocol\n"
8625 "Connected\n"
8626 "Kernel routes\n"
8627 "Open Shurtest Path First (OSPFv3)\n"
8628 "Routing Information Protocol (RIPng)\n"
8629 "Static routes\n")
8630{
8631 int type;
8632
8633 type = bgp_str2route_type (AFI_IP6, argv[0]);
8634 if (! type)
8635 {
8636 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8637 return CMD_WARNING;
8638 }
8639
8640 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
8641}
8642
8643DEFUN (no_bgp_redistribute_ipv6_rmap,
8644 no_bgp_redistribute_ipv6_rmap_cmd,
8645 "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
8646 NO_STR
8647 "Redistribute information from another routing protocol\n"
8648 "Connected\n"
8649 "Kernel routes\n"
8650 "Open Shurtest Path First (OSPFv3)\n"
8651 "Routing Information Protocol (RIPng)\n"
8652 "Static routes\n"
8653 "Route map reference\n"
8654 "Pointer to route-map entries\n")
8655{
8656 int type;
8657
8658 type = bgp_str2route_type (AFI_IP6, argv[0]);
8659 if (! type)
8660 {
8661 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8662 return CMD_WARNING;
8663 }
8664
8665 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8666 return CMD_SUCCESS;
8667}
8668
8669DEFUN (no_bgp_redistribute_ipv6_metric,
8670 no_bgp_redistribute_ipv6_metric_cmd,
8671 "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
8672 NO_STR
8673 "Redistribute information from another routing protocol\n"
8674 "Connected\n"
8675 "Kernel routes\n"
8676 "Open Shurtest Path First (OSPFv3)\n"
8677 "Routing Information Protocol (RIPng)\n"
8678 "Static routes\n"
8679 "Metric for redistributed routes\n"
8680 "Default metric\n")
8681{
8682 int type;
8683
8684 type = bgp_str2route_type (AFI_IP6, argv[0]);
8685 if (! type)
8686 {
8687 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8688 return CMD_WARNING;
8689 }
8690
8691 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8692 return CMD_SUCCESS;
8693}
8694
8695DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
8696 no_bgp_redistribute_ipv6_rmap_metric_cmd,
8697 "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
8698 NO_STR
8699 "Redistribute information from another routing protocol\n"
8700 "Connected\n"
8701 "Kernel routes\n"
8702 "Open Shurtest Path First (OSPFv3)\n"
8703 "Routing Information Protocol (RIPng)\n"
8704 "Static routes\n"
8705 "Route map reference\n"
8706 "Pointer to route-map entries\n"
8707 "Metric for redistributed routes\n"
8708 "Default metric\n")
8709{
8710 int type;
8711
8712 type = bgp_str2route_type (AFI_IP6, argv[0]);
8713 if (! type)
8714 {
8715 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8716 return CMD_WARNING;
8717 }
8718
8719 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8720 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8721 return CMD_SUCCESS;
8722}
8723
8724ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
8725 no_bgp_redistribute_ipv6_metric_rmap_cmd,
8726 "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
8727 NO_STR
8728 "Redistribute information from another routing protocol\n"
8729 "Connected\n"
8730 "Kernel routes\n"
8731 "Open Shurtest Path First (OSPFv3)\n"
8732 "Routing Information Protocol (RIPng)\n"
8733 "Static routes\n"
8734 "Metric for redistributed routes\n"
8735 "Default metric\n"
8736 "Route map reference\n"
8737 "Pointer to route-map entries\n")
8738#endif /* HAVE_IPV6 */
8739
8740int
8741bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
8742 safi_t safi, int *write)
8743{
8744 int i;
paul718e3742002-12-13 20:15:29 +00008745
8746 /* Unicast redistribution only. */
8747 if (safi != SAFI_UNICAST)
8748 return 0;
8749
8750 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
8751 {
8752 /* Redistribute BGP does not make sense. */
8753 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
8754 {
8755 /* Display "address-family" when it is not yet diplayed. */
8756 bgp_config_write_family_header (vty, afi, safi, write);
8757
8758 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00008759 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00008760
8761 if (bgp->redist_metric_flag[afi][i])
8762 vty_out (vty, " metric %d", bgp->redist_metric[afi][i]);
8763
8764 if (bgp->rmap[afi][i].name)
8765 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
8766
8767 vty_out (vty, "%s", VTY_NEWLINE);
8768 }
8769 }
8770 return *write;
8771}
8772
8773/* BGP node structure. */
8774struct cmd_node bgp_node =
8775{
8776 BGP_NODE,
8777 "%s(config-router)# ",
8778 1,
8779};
8780
8781struct cmd_node bgp_ipv4_unicast_node =
8782{
8783 BGP_IPV4_NODE,
8784 "%s(config-router-af)# ",
8785 1,
8786};
8787
8788struct cmd_node bgp_ipv4_multicast_node =
8789{
8790 BGP_IPV4M_NODE,
8791 "%s(config-router-af)# ",
8792 1,
8793};
8794
8795struct cmd_node bgp_ipv6_unicast_node =
8796{
8797 BGP_IPV6_NODE,
8798 "%s(config-router-af)# ",
8799 1,
8800};
8801
paul25ffbdc2005-08-22 22:42:08 +00008802struct cmd_node bgp_ipv6_multicast_node =
8803{
8804 BGP_IPV6M_NODE,
8805 "%s(config-router-af)# ",
8806 1,
8807};
8808
paul718e3742002-12-13 20:15:29 +00008809struct cmd_node bgp_vpnv4_node =
8810{
8811 BGP_VPNV4_NODE,
8812 "%s(config-router-af)# ",
8813 1
8814};
8815
paul1f8ae702005-09-09 23:49:49 +00008816static void community_list_vty (void);
8817
paul718e3742002-12-13 20:15:29 +00008818void
paul94f2b392005-06-28 12:44:16 +00008819bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00008820{
paul718e3742002-12-13 20:15:29 +00008821 /* Install bgp top node. */
8822 install_node (&bgp_node, bgp_config_write);
8823 install_node (&bgp_ipv4_unicast_node, NULL);
8824 install_node (&bgp_ipv4_multicast_node, NULL);
8825 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00008826 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00008827 install_node (&bgp_vpnv4_node, NULL);
8828
8829 /* Install default VTY commands to new nodes. */
8830 install_default (BGP_NODE);
8831 install_default (BGP_IPV4_NODE);
8832 install_default (BGP_IPV4M_NODE);
8833 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00008834 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00008835 install_default (BGP_VPNV4_NODE);
8836
8837 /* "bgp multiple-instance" commands. */
8838 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
8839 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
8840
8841 /* "bgp config-type" commands. */
8842 install_element (CONFIG_NODE, &bgp_config_type_cmd);
8843 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
8844
Paul Jakmad664ae12007-08-31 14:27:37 +01008845 /* "bgp open-all" commands. */
8846 install_element (CONFIG_NODE, &bgp_open_accept_cmd);
8847 install_element (CONFIG_NODE, &no_bgp_open_accept_cmd);
8848
paul718e3742002-12-13 20:15:29 +00008849 /* Dummy commands (Currently not supported) */
8850 install_element (BGP_NODE, &no_synchronization_cmd);
8851 install_element (BGP_NODE, &no_auto_summary_cmd);
8852
8853 /* "router bgp" commands. */
8854 install_element (CONFIG_NODE, &router_bgp_cmd);
8855 install_element (CONFIG_NODE, &router_bgp_view_cmd);
8856
8857 /* "no router bgp" commands. */
8858 install_element (CONFIG_NODE, &no_router_bgp_cmd);
8859 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
8860
8861 /* "bgp router-id" commands. */
8862 install_element (BGP_NODE, &bgp_router_id_cmd);
8863 install_element (BGP_NODE, &no_bgp_router_id_cmd);
8864 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
8865
8866 /* "bgp cluster-id" commands. */
8867 install_element (BGP_NODE, &bgp_cluster_id_cmd);
8868 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
8869 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
8870 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
8871
8872 /* "bgp confederation" commands. */
8873 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
8874 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
8875 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
8876
8877 /* "bgp confederation peers" commands. */
8878 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
8879 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
8880
8881 /* "timers bgp" commands. */
8882 install_element (BGP_NODE, &bgp_timers_cmd);
8883 install_element (BGP_NODE, &no_bgp_timers_cmd);
8884 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
8885
8886 /* "bgp client-to-client reflection" commands */
8887 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
8888 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
8889
8890 /* "bgp always-compare-med" commands */
8891 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
8892 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
8893
8894 /* "bgp deterministic-med" commands */
8895 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
8896 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00008897
hasso538621f2004-05-21 09:31:30 +00008898 /* "bgp graceful-restart" commands */
8899 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
8900 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00008901 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
8902 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
8903 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00008904
8905 /* "bgp fast-external-failover" commands */
8906 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
8907 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
8908
8909 /* "bgp enforce-first-as" commands */
8910 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
8911 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
8912
8913 /* "bgp bestpath compare-routerid" commands */
8914 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
8915 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
8916
8917 /* "bgp bestpath as-path ignore" commands */
8918 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
8919 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
8920
hasso68118452005-04-08 15:40:36 +00008921 /* "bgp bestpath as-path confed" commands */
8922 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
8923 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
8924
paul848973c2003-08-13 00:32:49 +00008925 /* "bgp log-neighbor-changes" commands */
8926 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
8927 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
8928
paul718e3742002-12-13 20:15:29 +00008929 /* "bgp bestpath med" commands */
8930 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
8931 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
8932 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
8933 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
8934 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
8935 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
8936
8937 /* "no bgp default ipv4-unicast" commands. */
8938 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
8939 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
8940
8941 /* "bgp network import-check" commands. */
8942 install_element (BGP_NODE, &bgp_network_import_check_cmd);
8943 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
8944
8945 /* "bgp default local-preference" commands. */
8946 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
8947 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
8948 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
8949
8950 /* "neighbor remote-as" commands. */
8951 install_element (BGP_NODE, &neighbor_remote_as_cmd);
8952 install_element (BGP_NODE, &no_neighbor_cmd);
8953 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
8954
8955 /* "neighbor peer-group" commands. */
8956 install_element (BGP_NODE, &neighbor_peer_group_cmd);
8957 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
8958 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
8959
8960 /* "neighbor local-as" commands. */
8961 install_element (BGP_NODE, &neighbor_local_as_cmd);
8962 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
8963 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
8964 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
8965 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
8966
Paul Jakma0df7c912008-07-21 21:02:49 +00008967 /* "neighbor password" commands. */
8968 install_element (BGP_NODE, &neighbor_password_cmd);
8969 install_element (BGP_NODE, &no_neighbor_password_cmd);
8970
paul718e3742002-12-13 20:15:29 +00008971 /* "neighbor activate" commands. */
8972 install_element (BGP_NODE, &neighbor_activate_cmd);
8973 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
8974 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
8975 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008976 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00008977 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
8978
8979 /* "no neighbor activate" commands. */
8980 install_element (BGP_NODE, &no_neighbor_activate_cmd);
8981 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
8982 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
8983 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008984 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00008985 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
8986
8987 /* "neighbor peer-group set" commands. */
8988 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
8989 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
8990 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
8991 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00008992 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00008993 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
8994
paul718e3742002-12-13 20:15:29 +00008995 /* "no neighbor peer-group unset" commands. */
8996 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
8997 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
8998 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
8999 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009000 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009001 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
9002
paul718e3742002-12-13 20:15:29 +00009003 /* "neighbor softreconfiguration inbound" commands.*/
9004 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
9005 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
9006 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
9007 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
9008 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
9009 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
9010 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
9011 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009012 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
9013 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +00009014 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
9015 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +00009016
9017 /* "neighbor attribute-unchanged" commands. */
9018 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
9019 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
9020 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
9021 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
9022 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
9023 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
9024 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
9025 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
9026 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
9027 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
9028 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
9029 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
9030 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
9031 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
9032 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
9033 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
9034 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
9035 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
9036 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
9037 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
9038 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
9039 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
9040 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
9041 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
9042 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
9043 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
9044 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
9045 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
9046 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
9047 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
9048 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
9049 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
9050 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
9051 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
9052 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9053 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9054 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9055 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9056 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9057 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9058 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9059 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9060 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9061 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9062 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
9063 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
9064 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
9065 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
9066 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
9067 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
9068 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
9069 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
9070 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
9071 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
9072 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
9073 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
9074 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
9075 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
9076 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
9077 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
9078 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
9079 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
9080 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
9081 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
9082 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
9083 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
9084 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
9085 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
9086 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
9087 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
9088 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
9089 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
9090 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
9091 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
9092 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
9093 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
9094 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
9095 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9096 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9097 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9098 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9099 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9100 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9101 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9102 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9103 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9104 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9105 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009106 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
9107 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
9108 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
9109 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
9110 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
9111 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
9112 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
9113 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
9114 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
9115 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
9116 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
9117 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
9118 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
9119 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
9120 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
9121 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
9122 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
9123 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
9124 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
9125 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
9126 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
9127 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +00009128 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
9129 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
9130 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
9131 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
9132 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
9133 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
9134 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
9135 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
9136 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
9137 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
9138 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
9139 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
9140 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9141 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9142 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9143 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9144 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9145 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9146 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9147 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9148 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9149 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9150
paulfee0f4c2004-09-13 05:12:46 +00009151 /* "nexthop-local unchanged" commands */
9152 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
9153 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
9154
paul718e3742002-12-13 20:15:29 +00009155 /* "transparent-as" and "transparent-nexthop" for old version
9156 compatibility. */
9157 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
9158 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
9159
9160 /* "neighbor next-hop-self" commands. */
9161 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
9162 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
9163 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
9164 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
9165 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
9166 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
9167 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
9168 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009169 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
9170 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009171 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
9172 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
9173
9174 /* "neighbor remove-private-AS" commands. */
9175 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
9176 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
9177 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
9178 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
9179 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
9180 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
9181 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
9182 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009183 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
9184 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009185 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
9186 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
9187
9188 /* "neighbor send-community" commands.*/
9189 install_element (BGP_NODE, &neighbor_send_community_cmd);
9190 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
9191 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
9192 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
9193 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
9194 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
9195 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
9196 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
9197 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
9198 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
9199 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
9200 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
9201 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
9202 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
9203 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
9204 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009205 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
9206 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
9207 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
9208 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00009209 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
9210 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
9211 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
9212 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
9213
9214 /* "neighbor route-reflector" commands.*/
9215 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
9216 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
9217 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
9218 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
9219 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
9220 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
9221 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
9222 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009223 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
9224 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +00009225 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
9226 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
9227
9228 /* "neighbor route-server" commands.*/
9229 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
9230 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
9231 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
9232 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
9233 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
9234 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
9235 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
9236 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009237 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
9238 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +00009239 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
9240 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
9241
9242 /* "neighbor passive" commands. */
9243 install_element (BGP_NODE, &neighbor_passive_cmd);
9244 install_element (BGP_NODE, &no_neighbor_passive_cmd);
9245
9246 /* "neighbor shutdown" commands. */
9247 install_element (BGP_NODE, &neighbor_shutdown_cmd);
9248 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
9249
hassoc9502432005-02-01 22:01:48 +00009250 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +00009251 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
9252 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
9253
9254 /* "neighbor capability orf prefix-list" commands.*/
9255 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
9256 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
9257 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
9258 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
9259 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
9260 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
9261 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
9262 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009263 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
9264 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +00009265
9266 /* "neighbor capability dynamic" commands.*/
9267 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
9268 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
9269
9270 /* "neighbor dont-capability-negotiate" commands. */
9271 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
9272 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
9273
9274 /* "neighbor ebgp-multihop" commands. */
9275 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
9276 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
9277 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
9278 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
9279
hasso6ffd2072005-02-02 14:50:11 +00009280 /* "neighbor disable-connected-check" commands. */
9281 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
9282 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +00009283 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
9284 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
9285
9286 /* "neighbor description" commands. */
9287 install_element (BGP_NODE, &neighbor_description_cmd);
9288 install_element (BGP_NODE, &no_neighbor_description_cmd);
9289 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
9290
9291 /* "neighbor update-source" commands. "*/
9292 install_element (BGP_NODE, &neighbor_update_source_cmd);
9293 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
9294
9295 /* "neighbor default-originate" commands. */
9296 install_element (BGP_NODE, &neighbor_default_originate_cmd);
9297 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
9298 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
9299 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
9300 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
9301 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
9302 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
9303 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
9304 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
9305 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
9306 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
9307 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
9308 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
9309 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
9310 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
9311 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009312 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
9313 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
9314 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
9315 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +00009316
9317 /* "neighbor port" commands. */
9318 install_element (BGP_NODE, &neighbor_port_cmd);
9319 install_element (BGP_NODE, &no_neighbor_port_cmd);
9320 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
9321
9322 /* "neighbor weight" commands. */
9323 install_element (BGP_NODE, &neighbor_weight_cmd);
9324 install_element (BGP_NODE, &no_neighbor_weight_cmd);
9325 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
9326
9327 /* "neighbor override-capability" commands. */
9328 install_element (BGP_NODE, &neighbor_override_capability_cmd);
9329 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
9330
9331 /* "neighbor strict-capability-match" commands. */
9332 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
9333 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
9334
9335 /* "neighbor timers" commands. */
9336 install_element (BGP_NODE, &neighbor_timers_cmd);
9337 install_element (BGP_NODE, &no_neighbor_timers_cmd);
9338
9339 /* "neighbor timers connect" commands. */
9340 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
9341 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
9342 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
9343
9344 /* "neighbor advertisement-interval" commands. */
9345 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
9346 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
9347 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
9348
9349 /* "neighbor version" commands. */
9350 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +00009351
9352 /* "neighbor interface" commands. */
9353 install_element (BGP_NODE, &neighbor_interface_cmd);
9354 install_element (BGP_NODE, &no_neighbor_interface_cmd);
9355
9356 /* "neighbor distribute" commands. */
9357 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
9358 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
9359 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
9360 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
9361 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
9362 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
9363 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
9364 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009365 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
9366 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +00009367 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
9368 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
9369
9370 /* "neighbor prefix-list" commands. */
9371 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
9372 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
9373 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
9374 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
9375 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
9376 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
9377 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
9378 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009379 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
9380 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +00009381 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
9382 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
9383
9384 /* "neighbor filter-list" commands. */
9385 install_element (BGP_NODE, &neighbor_filter_list_cmd);
9386 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
9387 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
9388 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
9389 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
9390 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
9391 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
9392 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009393 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
9394 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +00009395 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
9396 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
9397
9398 /* "neighbor route-map" commands. */
9399 install_element (BGP_NODE, &neighbor_route_map_cmd);
9400 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
9401 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
9402 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
9403 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
9404 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
9405 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
9406 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009407 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
9408 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +00009409 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
9410 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
9411
9412 /* "neighbor unsuppress-map" commands. */
9413 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
9414 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
9415 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
9416 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
9417 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
9418 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
9419 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
9420 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009421 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
9422 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +00009423 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
9424 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +00009425
9426 /* "neighbor maximum-prefix" commands. */
9427 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009428 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009429 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009430 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009431 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
9432 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009433 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
9434 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009435 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9436 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9437 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9438 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9439 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009440 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009441 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009442 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009443 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009444 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9445 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009446 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
9447 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009448 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9449 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9450 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9451 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9452 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009453 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009454 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009455 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009456 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009457 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
9458 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009459 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
9460 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009461 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9462 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9463 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9464 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9465 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009466 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009467 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009468 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009469 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009470 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
9471 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009472 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
9473 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009474 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9475 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9476 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9477 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9478 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009479 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
9480 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
9481 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
9482 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9483 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
9484 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9485 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
9486 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
9487 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9488 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9489 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9490 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9491 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009492 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009493 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009494 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009495 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009496 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9497 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009498 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
9499 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009500 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9501 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9502 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9503 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9504 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009505
9506 /* "neighbor allowas-in" */
9507 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
9508 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
9509 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
9510 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
9511 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
9512 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
9513 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
9514 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
9515 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
9516 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
9517 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
9518 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009519 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
9520 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
9521 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +00009522 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
9523 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
9524 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
9525
9526 /* address-family commands. */
9527 install_element (BGP_NODE, &address_family_ipv4_cmd);
9528 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
9529#ifdef HAVE_IPV6
9530 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009531 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +00009532#endif /* HAVE_IPV6 */
9533 install_element (BGP_NODE, &address_family_vpnv4_cmd);
9534 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
9535
9536 /* "exit-address-family" command. */
9537 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
9538 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
9539 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009540 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +00009541 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
9542
9543 /* "clear ip bgp commands" */
9544 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
9545 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
9546 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
9547 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
9548 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
9549 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
9550#ifdef HAVE_IPV6
9551 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
9552 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
9553 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
9554 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
9555 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
9556 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
9557 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
9558 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
9559 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
9560 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
9561 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
9562#endif /* HAVE_IPV6 */
9563
9564 /* "clear ip bgp neighbor soft in" */
9565 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
9566 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
9567 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
9568 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
9569 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
9570 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
9571 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
9572 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
9573 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
9574 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
9575 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
9576 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
9577 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
9578 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
9579 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
9580 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
9581 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
9582 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
9583 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
9584 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
9585 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
9586 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
9587 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
9588 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
9589 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
9590 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
9591 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
9592 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
9593 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
9594 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
9595 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
9596 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
9597 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
9598 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
9599 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
9600 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
9601 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
9602 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
9603 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
9604 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
9605#ifdef HAVE_IPV6
9606 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
9607 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
9608 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
9609 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
9610 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
9611 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
9612 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
9613 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
9614 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
9615 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
9616 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
9617 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
9618 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
9619 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
9620 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
9621 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
9622 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
9623 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
9624 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
9625 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
9626 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
9627 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
9628 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
9629 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
9630 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
9631 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
9632 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
9633 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
9634 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
9635 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
9636 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
9637#endif /* HAVE_IPV6 */
9638
9639 /* "clear ip bgp neighbor soft out" */
9640 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
9641 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
9642 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
9643 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
9644 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
9645 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
9646 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
9647 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
9648 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
9649 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
9650 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
9651 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
9652 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
9653 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
9654 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
9655 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
9656 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
9657 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
9658 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
9659 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
9660 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
9661 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
9662 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
9663 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
9664 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
9665 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
9666 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
9667 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
9668#ifdef HAVE_IPV6
9669 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
9670 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
9671 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
9672 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
9673 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
9674 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
9675 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
9676 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
9677 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
9678 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
9679 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
9680 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
9681 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
9682 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
9683 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
9684 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
9685 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
9686 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
9687 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
9688 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
9689 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
9690#endif /* HAVE_IPV6 */
9691
9692 /* "clear ip bgp neighbor soft" */
9693 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
9694 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
9695 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
9696 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
9697 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
9698 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
9699 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
9700 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
9701 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
9702 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
9703 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
9704 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
9705 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
9706 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
9707 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
9708#ifdef HAVE_IPV6
9709 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
9710 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
9711 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
9712 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
9713 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
9714 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
9715 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
9716 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
9717 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
9718 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
9719 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
9720#endif /* HAVE_IPV6 */
9721
paulfee0f4c2004-09-13 05:12:46 +00009722 /* "clear ip bgp neighbor rsclient" */
9723 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
9724 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
9725 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
9726 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
9727#ifdef HAVE_IPV6
9728 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
9729 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
9730 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
9731 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
9732 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
9733 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
9734 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
9735 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
9736#endif /* HAVE_IPV6 */
9737
paul718e3742002-12-13 20:15:29 +00009738 /* "show ip bgp summary" commands. */
9739 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
9740 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
9741 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
9742 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
9743 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9744 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9745#ifdef HAVE_IPV6
9746 install_element (VIEW_NODE, &show_bgp_summary_cmd);
9747 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
9748 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
9749 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
9750#endif /* HAVE_IPV6 */
9751 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
9752 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
9753 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
9754 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
9755 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9756 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9757#ifdef HAVE_IPV6
9758 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
9759 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
9760 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
9761 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
9762#endif /* HAVE_IPV6 */
9763
9764 /* "show ip bgp neighbors" commands. */
9765 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
9766 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
9767 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
9768 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
9769 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
9770 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
9771 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
9772 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
9773 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
9774 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
9775 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
9776 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
9777 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
9778 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
9779 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
9780 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
9781 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
9782 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
9783 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
9784 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
9785
9786#ifdef HAVE_IPV6
9787 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
9788 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
9789 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
9790 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +00009791 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
9792 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
9793 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
9794 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +00009795 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
9796 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
9797 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
9798 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +00009799 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
9800 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
9801 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
9802 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +00009803
9804 /* Old commands. */
9805 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
9806 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
9807 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
9808 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
9809#endif /* HAVE_IPV6 */
9810
paulfee0f4c2004-09-13 05:12:46 +00009811 /* "show ip bgp rsclient" commands. */
9812 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
9813 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
9814 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
9815 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
9816 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
9817 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
9818 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
9819 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
9820
9821#ifdef HAVE_IPV6
9822 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
9823 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
9824 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
9825 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
9826 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
9827 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
9828 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
9829 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
9830#endif /* HAVE_IPV6 */
9831
paul718e3742002-12-13 20:15:29 +00009832 /* "show ip bgp paths" commands. */
9833 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
9834 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
9835 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
9836 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
9837
9838 /* "show ip bgp community" commands. */
9839 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
9840 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
9841
9842 /* "show ip bgp attribute-info" commands. */
9843 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
9844 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
9845
9846 /* "redistribute" commands. */
9847 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
9848 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
9849 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
9850 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
9851 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
9852 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
9853 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
9854 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
9855 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
9856 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
9857#ifdef HAVE_IPV6
9858 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
9859 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
9860 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
9861 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
9862 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
9863 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
9864 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
9865 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
9866 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
9867 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
9868#endif /* HAVE_IPV6 */
9869
Paul Jakma4bf6a362006-03-30 14:05:23 +00009870 /* "show bgp memory" commands. */
9871 install_element (VIEW_NODE, &show_bgp_memory_cmd);
9872 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
9873
paul718e3742002-12-13 20:15:29 +00009874 /* Community-list. */
9875 community_list_vty ();
9876}
9877
9878#include "memory.h"
9879#include "bgp_regex.h"
9880#include "bgp_clist.h"
9881#include "bgp_ecommunity.h"
9882
9883/* VTY functions. */
9884
9885/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +00009886static const char *
paul718e3742002-12-13 20:15:29 +00009887community_direct_str (int direct)
9888{
9889 switch (direct)
9890 {
9891 case COMMUNITY_DENY:
9892 return "deny";
paul718e3742002-12-13 20:15:29 +00009893 case COMMUNITY_PERMIT:
9894 return "permit";
paul718e3742002-12-13 20:15:29 +00009895 default:
9896 return "unknown";
paul718e3742002-12-13 20:15:29 +00009897 }
9898}
9899
9900/* Display error string. */
paul94f2b392005-06-28 12:44:16 +00009901static void
paul718e3742002-12-13 20:15:29 +00009902community_list_perror (struct vty *vty, int ret)
9903{
9904 switch (ret)
9905 {
9906 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
9907 vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE);
9908 break;
9909 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
9910 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
9911 break;
9912 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
9913 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
9914 break;
9915 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
9916 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
9917 break;
9918 }
9919}
9920
9921/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +00009922static int
paulfd79ac92004-10-13 05:06:08 +00009923community_list_set_vty (struct vty *vty, int argc, const char **argv,
9924 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +00009925{
9926 int ret;
9927 int direct;
9928 char *str;
9929
9930 /* Check the list type. */
9931 if (strncmp (argv[1], "p", 1) == 0)
9932 direct = COMMUNITY_PERMIT;
9933 else if (strncmp (argv[1], "d", 1) == 0)
9934 direct = COMMUNITY_DENY;
9935 else
9936 {
9937 vty_out (vty, "%% Matching condition must be permit or deny%s",
9938 VTY_NEWLINE);
9939 return CMD_WARNING;
9940 }
9941
9942 /* All digit name check. */
9943 if (reject_all_digit_name && all_digit (argv[0]))
9944 {
9945 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
9946 return CMD_WARNING;
9947 }
9948
9949 /* Concat community string argument. */
9950 if (argc > 1)
9951 str = argv_concat (argv, argc, 2);
9952 else
9953 str = NULL;
9954
9955 /* When community_list_set() return nevetive value, it means
9956 malformed community string. */
9957 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
9958
9959 /* Free temporary community list string allocated by
9960 argv_concat(). */
9961 if (str)
9962 XFREE (MTYPE_TMP, str);
9963
9964 if (ret < 0)
9965 {
9966 /* Display error string. */
9967 community_list_perror (vty, ret);
9968 return CMD_WARNING;
9969 }
9970
9971 return CMD_SUCCESS;
9972}
9973
paul718e3742002-12-13 20:15:29 +00009974/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +00009975static int
hassofee6e4e2005-02-02 16:29:31 +00009976community_list_unset_vty (struct vty *vty, int argc, const char **argv,
9977 int style)
paul718e3742002-12-13 20:15:29 +00009978{
9979 int ret;
hassofee6e4e2005-02-02 16:29:31 +00009980 int direct = 0;
9981 char *str = NULL;
paul718e3742002-12-13 20:15:29 +00009982
hassofee6e4e2005-02-02 16:29:31 +00009983 if (argc > 1)
paul718e3742002-12-13 20:15:29 +00009984 {
hassofee6e4e2005-02-02 16:29:31 +00009985 /* Check the list direct. */
9986 if (strncmp (argv[1], "p", 1) == 0)
9987 direct = COMMUNITY_PERMIT;
9988 else if (strncmp (argv[1], "d", 1) == 0)
9989 direct = COMMUNITY_DENY;
9990 else
9991 {
9992 vty_out (vty, "%% Matching condition must be permit or deny%s",
9993 VTY_NEWLINE);
9994 return CMD_WARNING;
9995 }
paul718e3742002-12-13 20:15:29 +00009996
hassofee6e4e2005-02-02 16:29:31 +00009997 /* Concat community string argument. */
9998 str = argv_concat (argv, argc, 2);
9999 }
paul718e3742002-12-13 20:15:29 +000010000
10001 /* Unset community list. */
10002 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
10003
10004 /* Free temporary community list string allocated by
10005 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010006 if (str)
10007 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010008
10009 if (ret < 0)
10010 {
10011 community_list_perror (vty, ret);
10012 return CMD_WARNING;
10013 }
10014
10015 return CMD_SUCCESS;
10016}
10017
10018/* "community-list" keyword help string. */
10019#define COMMUNITY_LIST_STR "Add a community list entry\n"
10020#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
10021
paul718e3742002-12-13 20:15:29 +000010022DEFUN (ip_community_list_standard,
10023 ip_community_list_standard_cmd,
10024 "ip community-list <1-99> (deny|permit) .AA:NN",
10025 IP_STR
10026 COMMUNITY_LIST_STR
10027 "Community list number (standard)\n"
10028 "Specify community to reject\n"
10029 "Specify community to accept\n"
10030 COMMUNITY_VAL_STR)
10031{
10032 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
10033}
10034
10035ALIAS (ip_community_list_standard,
10036 ip_community_list_standard2_cmd,
10037 "ip community-list <1-99> (deny|permit)",
10038 IP_STR
10039 COMMUNITY_LIST_STR
10040 "Community list number (standard)\n"
10041 "Specify community to reject\n"
10042 "Specify community to accept\n")
10043
10044DEFUN (ip_community_list_expanded,
10045 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010046 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010047 IP_STR
10048 COMMUNITY_LIST_STR
10049 "Community list number (expanded)\n"
10050 "Specify community to reject\n"
10051 "Specify community to accept\n"
10052 "An ordered list as a regular-expression\n")
10053{
10054 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
10055}
10056
10057DEFUN (ip_community_list_name_standard,
10058 ip_community_list_name_standard_cmd,
10059 "ip community-list standard WORD (deny|permit) .AA:NN",
10060 IP_STR
10061 COMMUNITY_LIST_STR
10062 "Add a standard community-list entry\n"
10063 "Community list name\n"
10064 "Specify community to reject\n"
10065 "Specify community to accept\n"
10066 COMMUNITY_VAL_STR)
10067{
10068 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
10069}
10070
10071ALIAS (ip_community_list_name_standard,
10072 ip_community_list_name_standard2_cmd,
10073 "ip community-list standard WORD (deny|permit)",
10074 IP_STR
10075 COMMUNITY_LIST_STR
10076 "Add a standard community-list entry\n"
10077 "Community list name\n"
10078 "Specify community to reject\n"
10079 "Specify community to accept\n")
10080
10081DEFUN (ip_community_list_name_expanded,
10082 ip_community_list_name_expanded_cmd,
10083 "ip community-list expanded WORD (deny|permit) .LINE",
10084 IP_STR
10085 COMMUNITY_LIST_STR
10086 "Add an expanded community-list entry\n"
10087 "Community list name\n"
10088 "Specify community to reject\n"
10089 "Specify community to accept\n"
10090 "An ordered list as a regular-expression\n")
10091{
10092 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
10093}
10094
hassofee6e4e2005-02-02 16:29:31 +000010095DEFUN (no_ip_community_list_standard_all,
10096 no_ip_community_list_standard_all_cmd,
10097 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010098 NO_STR
10099 IP_STR
10100 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010101 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010102{
hassofee6e4e2005-02-02 16:29:31 +000010103 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010104}
10105
hassofee6e4e2005-02-02 16:29:31 +000010106DEFUN (no_ip_community_list_expanded_all,
10107 no_ip_community_list_expanded_all_cmd,
10108 "no ip community-list <100-500>",
10109 NO_STR
10110 IP_STR
10111 COMMUNITY_LIST_STR
10112 "Community list number (expanded)\n")
10113{
10114 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10115}
10116
10117DEFUN (no_ip_community_list_name_standard_all,
10118 no_ip_community_list_name_standard_all_cmd,
10119 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010120 NO_STR
10121 IP_STR
10122 COMMUNITY_LIST_STR
10123 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000010124 "Community list name\n")
10125{
hassofee6e4e2005-02-02 16:29:31 +000010126 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010127}
10128
hassofee6e4e2005-02-02 16:29:31 +000010129DEFUN (no_ip_community_list_name_expanded_all,
10130 no_ip_community_list_name_expanded_all_cmd,
10131 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000010132 NO_STR
10133 IP_STR
10134 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010135 "Add an expanded community-list entry\n"
10136 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000010137{
hassofee6e4e2005-02-02 16:29:31 +000010138 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010139}
10140
10141DEFUN (no_ip_community_list_standard,
10142 no_ip_community_list_standard_cmd,
10143 "no ip community-list <1-99> (deny|permit) .AA:NN",
10144 NO_STR
10145 IP_STR
10146 COMMUNITY_LIST_STR
10147 "Community list number (standard)\n"
10148 "Specify community to reject\n"
10149 "Specify community to accept\n"
10150 COMMUNITY_VAL_STR)
10151{
10152 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10153}
10154
10155DEFUN (no_ip_community_list_expanded,
10156 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010157 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010158 NO_STR
10159 IP_STR
10160 COMMUNITY_LIST_STR
10161 "Community list number (expanded)\n"
10162 "Specify community to reject\n"
10163 "Specify community to accept\n"
10164 "An ordered list as a regular-expression\n")
10165{
10166 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10167}
10168
10169DEFUN (no_ip_community_list_name_standard,
10170 no_ip_community_list_name_standard_cmd,
10171 "no ip community-list standard WORD (deny|permit) .AA:NN",
10172 NO_STR
10173 IP_STR
10174 COMMUNITY_LIST_STR
10175 "Specify a standard community-list\n"
10176 "Community list name\n"
10177 "Specify community to reject\n"
10178 "Specify community to accept\n"
10179 COMMUNITY_VAL_STR)
10180{
10181 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10182}
10183
10184DEFUN (no_ip_community_list_name_expanded,
10185 no_ip_community_list_name_expanded_cmd,
10186 "no ip community-list expanded WORD (deny|permit) .LINE",
10187 NO_STR
10188 IP_STR
10189 COMMUNITY_LIST_STR
10190 "Specify an expanded community-list\n"
10191 "Community list name\n"
10192 "Specify community to reject\n"
10193 "Specify community to accept\n"
10194 "An ordered list as a regular-expression\n")
10195{
10196 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10197}
10198
paul94f2b392005-06-28 12:44:16 +000010199static void
paul718e3742002-12-13 20:15:29 +000010200community_list_show (struct vty *vty, struct community_list *list)
10201{
10202 struct community_entry *entry;
10203
10204 for (entry = list->head; entry; entry = entry->next)
10205 {
10206 if (entry == list->head)
10207 {
10208 if (all_digit (list->name))
10209 vty_out (vty, "Community %s list %s%s",
10210 entry->style == COMMUNITY_LIST_STANDARD ?
10211 "standard" : "(expanded) access",
10212 list->name, VTY_NEWLINE);
10213 else
10214 vty_out (vty, "Named Community %s list %s%s",
10215 entry->style == COMMUNITY_LIST_STANDARD ?
10216 "standard" : "expanded",
10217 list->name, VTY_NEWLINE);
10218 }
10219 if (entry->any)
10220 vty_out (vty, " %s%s",
10221 community_direct_str (entry->direct), VTY_NEWLINE);
10222 else
10223 vty_out (vty, " %s %s%s",
10224 community_direct_str (entry->direct),
10225 entry->style == COMMUNITY_LIST_STANDARD
10226 ? community_str (entry->u.com) : entry->config,
10227 VTY_NEWLINE);
10228 }
10229}
10230
10231DEFUN (show_ip_community_list,
10232 show_ip_community_list_cmd,
10233 "show ip community-list",
10234 SHOW_STR
10235 IP_STR
10236 "List community-list\n")
10237{
10238 struct community_list *list;
10239 struct community_list_master *cm;
10240
hassofee6e4e2005-02-02 16:29:31 +000010241 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010242 if (! cm)
10243 return CMD_SUCCESS;
10244
10245 for (list = cm->num.head; list; list = list->next)
10246 community_list_show (vty, list);
10247
10248 for (list = cm->str.head; list; list = list->next)
10249 community_list_show (vty, list);
10250
10251 return CMD_SUCCESS;
10252}
10253
10254DEFUN (show_ip_community_list_arg,
10255 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010256 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010257 SHOW_STR
10258 IP_STR
10259 "List community-list\n"
10260 "Community-list number\n"
10261 "Community-list name\n")
10262{
10263 struct community_list *list;
10264
hassofee6e4e2005-02-02 16:29:31 +000010265 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010266 if (! list)
10267 {
10268 vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE);
10269 return CMD_WARNING;
10270 }
10271
10272 community_list_show (vty, list);
10273
10274 return CMD_SUCCESS;
10275}
10276
paul94f2b392005-06-28 12:44:16 +000010277static int
paulfd79ac92004-10-13 05:06:08 +000010278extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
10279 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010280{
10281 int ret;
10282 int direct;
10283 char *str;
10284
10285 /* Check the list type. */
10286 if (strncmp (argv[1], "p", 1) == 0)
10287 direct = COMMUNITY_PERMIT;
10288 else if (strncmp (argv[1], "d", 1) == 0)
10289 direct = COMMUNITY_DENY;
10290 else
10291 {
10292 vty_out (vty, "%% Matching condition must be permit or deny%s",
10293 VTY_NEWLINE);
10294 return CMD_WARNING;
10295 }
10296
10297 /* All digit name check. */
10298 if (reject_all_digit_name && all_digit (argv[0]))
10299 {
10300 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10301 return CMD_WARNING;
10302 }
10303
10304 /* Concat community string argument. */
10305 if (argc > 1)
10306 str = argv_concat (argv, argc, 2);
10307 else
10308 str = NULL;
10309
10310 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
10311
10312 /* Free temporary community list string allocated by
10313 argv_concat(). */
10314 if (str)
10315 XFREE (MTYPE_TMP, str);
10316
10317 if (ret < 0)
10318 {
10319 community_list_perror (vty, ret);
10320 return CMD_WARNING;
10321 }
10322 return CMD_SUCCESS;
10323}
10324
paul94f2b392005-06-28 12:44:16 +000010325static int
hassofee6e4e2005-02-02 16:29:31 +000010326extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
10327 int style)
paul718e3742002-12-13 20:15:29 +000010328{
10329 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010330 int direct = 0;
10331 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010332
hassofee6e4e2005-02-02 16:29:31 +000010333 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010334 {
hassofee6e4e2005-02-02 16:29:31 +000010335 /* Check the list direct. */
10336 if (strncmp (argv[1], "p", 1) == 0)
10337 direct = COMMUNITY_PERMIT;
10338 else if (strncmp (argv[1], "d", 1) == 0)
10339 direct = COMMUNITY_DENY;
10340 else
10341 {
10342 vty_out (vty, "%% Matching condition must be permit or deny%s",
10343 VTY_NEWLINE);
10344 return CMD_WARNING;
10345 }
10346
10347 /* Concat community string argument. */
10348 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000010349 }
paul718e3742002-12-13 20:15:29 +000010350
10351 /* Unset community list. */
10352 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
10353
10354 /* Free temporary community list string allocated by
10355 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010356 if (str)
10357 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010358
10359 if (ret < 0)
10360 {
10361 community_list_perror (vty, ret);
10362 return CMD_WARNING;
10363 }
10364
10365 return CMD_SUCCESS;
10366}
10367
10368/* "extcommunity-list" keyword help string. */
10369#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
10370#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
10371
10372DEFUN (ip_extcommunity_list_standard,
10373 ip_extcommunity_list_standard_cmd,
10374 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10375 IP_STR
10376 EXTCOMMUNITY_LIST_STR
10377 "Extended Community list number (standard)\n"
10378 "Specify community to reject\n"
10379 "Specify community to accept\n"
10380 EXTCOMMUNITY_VAL_STR)
10381{
10382 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
10383}
10384
10385ALIAS (ip_extcommunity_list_standard,
10386 ip_extcommunity_list_standard2_cmd,
10387 "ip extcommunity-list <1-99> (deny|permit)",
10388 IP_STR
10389 EXTCOMMUNITY_LIST_STR
10390 "Extended Community list number (standard)\n"
10391 "Specify community to reject\n"
10392 "Specify community to accept\n")
10393
10394DEFUN (ip_extcommunity_list_expanded,
10395 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010396 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010397 IP_STR
10398 EXTCOMMUNITY_LIST_STR
10399 "Extended Community list number (expanded)\n"
10400 "Specify community to reject\n"
10401 "Specify community to accept\n"
10402 "An ordered list as a regular-expression\n")
10403{
10404 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
10405}
10406
10407DEFUN (ip_extcommunity_list_name_standard,
10408 ip_extcommunity_list_name_standard_cmd,
10409 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10410 IP_STR
10411 EXTCOMMUNITY_LIST_STR
10412 "Specify standard extcommunity-list\n"
10413 "Extended Community list name\n"
10414 "Specify community to reject\n"
10415 "Specify community to accept\n"
10416 EXTCOMMUNITY_VAL_STR)
10417{
10418 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
10419}
10420
10421ALIAS (ip_extcommunity_list_name_standard,
10422 ip_extcommunity_list_name_standard2_cmd,
10423 "ip extcommunity-list standard WORD (deny|permit)",
10424 IP_STR
10425 EXTCOMMUNITY_LIST_STR
10426 "Specify standard extcommunity-list\n"
10427 "Extended Community list name\n"
10428 "Specify community to reject\n"
10429 "Specify community to accept\n")
10430
10431DEFUN (ip_extcommunity_list_name_expanded,
10432 ip_extcommunity_list_name_expanded_cmd,
10433 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
10434 IP_STR
10435 EXTCOMMUNITY_LIST_STR
10436 "Specify expanded extcommunity-list\n"
10437 "Extended Community list name\n"
10438 "Specify community to reject\n"
10439 "Specify community to accept\n"
10440 "An ordered list as a regular-expression\n")
10441{
10442 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
10443}
10444
hassofee6e4e2005-02-02 16:29:31 +000010445DEFUN (no_ip_extcommunity_list_standard_all,
10446 no_ip_extcommunity_list_standard_all_cmd,
10447 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010448 NO_STR
10449 IP_STR
10450 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010451 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010452{
hassofee6e4e2005-02-02 16:29:31 +000010453 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010454}
10455
hassofee6e4e2005-02-02 16:29:31 +000010456DEFUN (no_ip_extcommunity_list_expanded_all,
10457 no_ip_extcommunity_list_expanded_all_cmd,
10458 "no ip extcommunity-list <100-500>",
10459 NO_STR
10460 IP_STR
10461 EXTCOMMUNITY_LIST_STR
10462 "Extended Community list number (expanded)\n")
10463{
10464 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10465}
10466
10467DEFUN (no_ip_extcommunity_list_name_standard_all,
10468 no_ip_extcommunity_list_name_standard_all_cmd,
10469 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010470 NO_STR
10471 IP_STR
10472 EXTCOMMUNITY_LIST_STR
10473 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000010474 "Extended Community list name\n")
10475{
10476 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10477}
10478
10479DEFUN (no_ip_extcommunity_list_name_expanded_all,
10480 no_ip_extcommunity_list_name_expanded_all_cmd,
10481 "no ip extcommunity-list expanded WORD",
10482 NO_STR
10483 IP_STR
10484 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000010485 "Specify expanded extcommunity-list\n"
10486 "Extended Community list name\n")
10487{
hassofee6e4e2005-02-02 16:29:31 +000010488 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010489}
10490
10491DEFUN (no_ip_extcommunity_list_standard,
10492 no_ip_extcommunity_list_standard_cmd,
10493 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10494 NO_STR
10495 IP_STR
10496 EXTCOMMUNITY_LIST_STR
10497 "Extended Community list number (standard)\n"
10498 "Specify community to reject\n"
10499 "Specify community to accept\n"
10500 EXTCOMMUNITY_VAL_STR)
10501{
10502 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10503}
10504
10505DEFUN (no_ip_extcommunity_list_expanded,
10506 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010507 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010508 NO_STR
10509 IP_STR
10510 EXTCOMMUNITY_LIST_STR
10511 "Extended Community list number (expanded)\n"
10512 "Specify community to reject\n"
10513 "Specify community to accept\n"
10514 "An ordered list as a regular-expression\n")
10515{
10516 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10517}
10518
10519DEFUN (no_ip_extcommunity_list_name_standard,
10520 no_ip_extcommunity_list_name_standard_cmd,
10521 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10522 NO_STR
10523 IP_STR
10524 EXTCOMMUNITY_LIST_STR
10525 "Specify standard extcommunity-list\n"
10526 "Extended Community list name\n"
10527 "Specify community to reject\n"
10528 "Specify community to accept\n"
10529 EXTCOMMUNITY_VAL_STR)
10530{
10531 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10532}
10533
10534DEFUN (no_ip_extcommunity_list_name_expanded,
10535 no_ip_extcommunity_list_name_expanded_cmd,
10536 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
10537 NO_STR
10538 IP_STR
10539 EXTCOMMUNITY_LIST_STR
10540 "Specify expanded extcommunity-list\n"
10541 "Community list name\n"
10542 "Specify community to reject\n"
10543 "Specify community to accept\n"
10544 "An ordered list as a regular-expression\n")
10545{
10546 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10547}
10548
paul94f2b392005-06-28 12:44:16 +000010549static void
paul718e3742002-12-13 20:15:29 +000010550extcommunity_list_show (struct vty *vty, struct community_list *list)
10551{
10552 struct community_entry *entry;
10553
10554 for (entry = list->head; entry; entry = entry->next)
10555 {
10556 if (entry == list->head)
10557 {
10558 if (all_digit (list->name))
10559 vty_out (vty, "Extended community %s list %s%s",
10560 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10561 "standard" : "(expanded) access",
10562 list->name, VTY_NEWLINE);
10563 else
10564 vty_out (vty, "Named extended community %s list %s%s",
10565 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10566 "standard" : "expanded",
10567 list->name, VTY_NEWLINE);
10568 }
10569 if (entry->any)
10570 vty_out (vty, " %s%s",
10571 community_direct_str (entry->direct), VTY_NEWLINE);
10572 else
10573 vty_out (vty, " %s %s%s",
10574 community_direct_str (entry->direct),
10575 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10576 entry->u.ecom->str : entry->config,
10577 VTY_NEWLINE);
10578 }
10579}
10580
10581DEFUN (show_ip_extcommunity_list,
10582 show_ip_extcommunity_list_cmd,
10583 "show ip extcommunity-list",
10584 SHOW_STR
10585 IP_STR
10586 "List extended-community list\n")
10587{
10588 struct community_list *list;
10589 struct community_list_master *cm;
10590
hassofee6e4e2005-02-02 16:29:31 +000010591 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010592 if (! cm)
10593 return CMD_SUCCESS;
10594
10595 for (list = cm->num.head; list; list = list->next)
10596 extcommunity_list_show (vty, list);
10597
10598 for (list = cm->str.head; list; list = list->next)
10599 extcommunity_list_show (vty, list);
10600
10601 return CMD_SUCCESS;
10602}
10603
10604DEFUN (show_ip_extcommunity_list_arg,
10605 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010606 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010607 SHOW_STR
10608 IP_STR
10609 "List extended-community list\n"
10610 "Extcommunity-list number\n"
10611 "Extcommunity-list name\n")
10612{
10613 struct community_list *list;
10614
hassofee6e4e2005-02-02 16:29:31 +000010615 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010616 if (! list)
10617 {
10618 vty_out (vty, "%% Can't find extcommunit-list%s", VTY_NEWLINE);
10619 return CMD_WARNING;
10620 }
10621
10622 extcommunity_list_show (vty, list);
10623
10624 return CMD_SUCCESS;
10625}
10626
10627/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000010628static const char *
paul718e3742002-12-13 20:15:29 +000010629community_list_config_str (struct community_entry *entry)
10630{
paulfd79ac92004-10-13 05:06:08 +000010631 const char *str;
paul718e3742002-12-13 20:15:29 +000010632
10633 if (entry->any)
10634 str = "";
10635 else
10636 {
10637 if (entry->style == COMMUNITY_LIST_STANDARD)
10638 str = community_str (entry->u.com);
10639 else
10640 str = entry->config;
10641 }
10642 return str;
10643}
10644
10645/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000010646static int
paul718e3742002-12-13 20:15:29 +000010647community_list_config_write (struct vty *vty)
10648{
10649 struct community_list *list;
10650 struct community_entry *entry;
10651 struct community_list_master *cm;
10652 int write = 0;
10653
10654 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000010655 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010656
10657 for (list = cm->num.head; list; list = list->next)
10658 for (entry = list->head; entry; entry = entry->next)
10659 {
hassofee6e4e2005-02-02 16:29:31 +000010660 vty_out (vty, "ip community-list %s %s %s%s",
10661 list->name, community_direct_str (entry->direct),
10662 community_list_config_str (entry),
10663 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010664 write++;
10665 }
10666 for (list = cm->str.head; list; list = list->next)
10667 for (entry = list->head; entry; entry = entry->next)
10668 {
10669 vty_out (vty, "ip community-list %s %s %s %s%s",
10670 entry->style == COMMUNITY_LIST_STANDARD
10671 ? "standard" : "expanded",
10672 list->name, community_direct_str (entry->direct),
10673 community_list_config_str (entry),
10674 VTY_NEWLINE);
10675 write++;
10676 }
10677
10678 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000010679 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010680
10681 for (list = cm->num.head; list; list = list->next)
10682 for (entry = list->head; entry; entry = entry->next)
10683 {
hassofee6e4e2005-02-02 16:29:31 +000010684 vty_out (vty, "ip extcommunity-list %s %s %s%s",
10685 list->name, community_direct_str (entry->direct),
10686 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010687 write++;
10688 }
10689 for (list = cm->str.head; list; list = list->next)
10690 for (entry = list->head; entry; entry = entry->next)
10691 {
10692 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
10693 entry->style == EXTCOMMUNITY_LIST_STANDARD
10694 ? "standard" : "expanded",
10695 list->name, community_direct_str (entry->direct),
10696 community_list_config_str (entry), VTY_NEWLINE);
10697 write++;
10698 }
10699 return write;
10700}
10701
10702struct cmd_node community_list_node =
10703{
10704 COMMUNITY_LIST_NODE,
10705 "",
10706 1 /* Export to vtysh. */
10707};
10708
paul94f2b392005-06-28 12:44:16 +000010709static void
10710community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000010711{
10712 install_node (&community_list_node, community_list_config_write);
10713
10714 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000010715 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
10716 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
10717 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
10718 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
10719 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
10720 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000010721 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
10722 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
10723 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
10724 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000010725 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
10726 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
10727 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
10728 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
10729 install_element (VIEW_NODE, &show_ip_community_list_cmd);
10730 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
10731 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
10732 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
10733
10734 /* Extcommunity-list. */
10735 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
10736 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
10737 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
10738 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
10739 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
10740 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000010741 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
10742 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
10743 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
10744 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000010745 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
10746 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
10747 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
10748 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
10749 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
10750 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
10751 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
10752 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
10753}