blob: 76c537b49e6ce751efebf5674cedb459dcdb38fc [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
282DEFUN (no_synchronization,
283 no_synchronization_cmd,
284 "no synchronization",
285 NO_STR
286 "Perform IGP synchronization\n")
287{
288 return CMD_SUCCESS;
289}
290
291DEFUN (no_auto_summary,
292 no_auto_summary_cmd,
293 "no auto-summary",
294 NO_STR
295 "Enable automatic network number summarization\n")
296{
297 return CMD_SUCCESS;
298}
hasso3d515fd2005-02-01 21:30:04 +0000299
300DEFUN_DEPRECATED (neighbor_version,
301 neighbor_version_cmd,
302 NEIGHBOR_CMD "version (4|4-)",
303 NEIGHBOR_STR
304 NEIGHBOR_ADDR_STR
305 "Set the BGP version to match a neighbor\n"
306 "Neighbor's BGP version\n")
307{
308 return CMD_SUCCESS;
309}
paul718e3742002-12-13 20:15:29 +0000310
311/* "router bgp" commands. */
312DEFUN (router_bgp,
313 router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000314 "router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000315 ROUTER_STR
316 BGP_STR
317 AS_STR)
318{
319 int ret;
320 as_t as;
321 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000322 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000323
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000324 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000325
326 if (argc == 2)
327 name = argv[1];
328
329 ret = bgp_get (&bgp, &as, name);
330 switch (ret)
331 {
332 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
333 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
334 VTY_NEWLINE);
335 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000336 case BGP_ERR_AS_MISMATCH:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400337 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000338 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000339 case BGP_ERR_INSTANCE_MISMATCH:
340 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400341 vty_out (vty, "BGP instance is already running; AS is %u%s",
paul718e3742002-12-13 20:15:29 +0000342 as, VTY_NEWLINE);
343 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000344 }
345
346 vty->node = BGP_NODE;
347 vty->index = bgp;
348
349 return CMD_SUCCESS;
350}
351
352ALIAS (router_bgp,
353 router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000354 "router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000355 ROUTER_STR
356 BGP_STR
357 AS_STR
358 "BGP view\n"
359 "view name\n")
360
361/* "no router bgp" commands. */
362DEFUN (no_router_bgp,
363 no_router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000364 "no router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000365 NO_STR
366 ROUTER_STR
367 BGP_STR
368 AS_STR)
369{
370 as_t as;
371 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000372 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000373
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000374 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000375
376 if (argc == 2)
377 name = argv[1];
378
379 /* Lookup bgp structure. */
380 bgp = bgp_lookup (as, name);
381 if (! bgp)
382 {
383 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
384 return CMD_WARNING;
385 }
386
387 bgp_delete (bgp);
388
389 return CMD_SUCCESS;
390}
391
392ALIAS (no_router_bgp,
393 no_router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000394 "no router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000395 NO_STR
396 ROUTER_STR
397 BGP_STR
398 AS_STR
399 "BGP view\n"
400 "view name\n")
401
402/* BGP router-id. */
403
404DEFUN (bgp_router_id,
405 bgp_router_id_cmd,
406 "bgp router-id A.B.C.D",
407 BGP_STR
408 "Override configured router identifier\n"
409 "Manually configured router identifier\n")
410{
411 int ret;
412 struct in_addr id;
413 struct bgp *bgp;
414
415 bgp = vty->index;
416
417 ret = inet_aton (argv[0], &id);
418 if (! ret)
419 {
420 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
421 return CMD_WARNING;
422 }
423
hasso18a6dce2004-10-03 18:18:34 +0000424 bgp->router_id_static = id;
paul718e3742002-12-13 20:15:29 +0000425 bgp_router_id_set (bgp, &id);
426
427 return CMD_SUCCESS;
428}
429
430DEFUN (no_bgp_router_id,
431 no_bgp_router_id_cmd,
432 "no bgp router-id",
433 NO_STR
434 BGP_STR
435 "Override configured router identifier\n")
436{
437 int ret;
438 struct in_addr id;
439 struct bgp *bgp;
440
441 bgp = vty->index;
442
443 if (argc == 1)
444 {
445 ret = inet_aton (argv[0], &id);
446 if (! ret)
447 {
448 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
449 return CMD_WARNING;
450 }
451
hasso18a6dce2004-10-03 18:18:34 +0000452 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
paul718e3742002-12-13 20:15:29 +0000453 {
454 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
455 return CMD_WARNING;
456 }
457 }
458
hasso18a6dce2004-10-03 18:18:34 +0000459 bgp->router_id_static.s_addr = 0;
460 bgp_router_id_set (bgp, &router_id_zebra);
paul718e3742002-12-13 20:15:29 +0000461
462 return CMD_SUCCESS;
463}
464
465ALIAS (no_bgp_router_id,
466 no_bgp_router_id_val_cmd,
467 "no bgp router-id A.B.C.D",
468 NO_STR
469 BGP_STR
470 "Override configured router identifier\n"
471 "Manually configured router identifier\n")
472
473/* BGP Cluster ID. */
474
475DEFUN (bgp_cluster_id,
476 bgp_cluster_id_cmd,
477 "bgp cluster-id A.B.C.D",
478 BGP_STR
479 "Configure Route-Reflector Cluster-id\n"
480 "Route-Reflector Cluster-id in IP address format\n")
481{
482 int ret;
483 struct bgp *bgp;
484 struct in_addr cluster;
485
486 bgp = vty->index;
487
488 ret = inet_aton (argv[0], &cluster);
489 if (! ret)
490 {
491 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
492 return CMD_WARNING;
493 }
494
495 bgp_cluster_id_set (bgp, &cluster);
496
497 return CMD_SUCCESS;
498}
499
500ALIAS (bgp_cluster_id,
501 bgp_cluster_id32_cmd,
502 "bgp cluster-id <1-4294967295>",
503 BGP_STR
504 "Configure Route-Reflector Cluster-id\n"
505 "Route-Reflector Cluster-id as 32 bit quantity\n")
506
507DEFUN (no_bgp_cluster_id,
508 no_bgp_cluster_id_cmd,
509 "no bgp cluster-id",
510 NO_STR
511 BGP_STR
512 "Configure Route-Reflector Cluster-id\n")
513{
514 int ret;
515 struct bgp *bgp;
516 struct in_addr cluster;
517
518 bgp = vty->index;
519
520 if (argc == 1)
521 {
522 ret = inet_aton (argv[0], &cluster);
523 if (! ret)
524 {
525 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
526 return CMD_WARNING;
527 }
528 }
529
530 bgp_cluster_id_unset (bgp);
531
532 return CMD_SUCCESS;
533}
534
535ALIAS (no_bgp_cluster_id,
536 no_bgp_cluster_id_arg_cmd,
537 "no bgp cluster-id A.B.C.D",
538 NO_STR
539 BGP_STR
540 "Configure Route-Reflector Cluster-id\n"
541 "Route-Reflector Cluster-id in IP address format\n")
542
543DEFUN (bgp_confederation_identifier,
544 bgp_confederation_identifier_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000545 "bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000546 "BGP specific commands\n"
547 "AS confederation parameters\n"
548 "AS number\n"
549 "Set routing domain confederation AS\n")
550{
551 struct bgp *bgp;
552 as_t as;
553
554 bgp = vty->index;
555
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000556 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000557
558 bgp_confederation_id_set (bgp, as);
559
560 return CMD_SUCCESS;
561}
562
563DEFUN (no_bgp_confederation_identifier,
564 no_bgp_confederation_identifier_cmd,
565 "no bgp confederation identifier",
566 NO_STR
567 "BGP specific commands\n"
568 "AS confederation parameters\n"
569 "AS number\n")
570{
571 struct bgp *bgp;
572 as_t as;
573
574 bgp = vty->index;
575
576 if (argc == 1)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000577 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000578
579 bgp_confederation_id_unset (bgp);
580
581 return CMD_SUCCESS;
582}
583
584ALIAS (no_bgp_confederation_identifier,
585 no_bgp_confederation_identifier_arg_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000586 "no bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000587 NO_STR
588 "BGP specific commands\n"
589 "AS confederation parameters\n"
590 "AS number\n"
591 "Set routing domain confederation AS\n")
592
593DEFUN (bgp_confederation_peers,
594 bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000595 "bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000596 "BGP specific commands\n"
597 "AS confederation parameters\n"
598 "Peer ASs in BGP confederation\n"
599 AS_STR)
600{
601 struct bgp *bgp;
602 as_t as;
603 int i;
604
605 bgp = vty->index;
606
607 for (i = 0; i < argc; i++)
608 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000609 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000610
611 if (bgp->as == as)
612 {
613 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
614 VTY_NEWLINE);
615 continue;
616 }
617
618 bgp_confederation_peers_add (bgp, as);
619 }
620 return CMD_SUCCESS;
621}
622
623DEFUN (no_bgp_confederation_peers,
624 no_bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000625 "no bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000626 NO_STR
627 "BGP specific commands\n"
628 "AS confederation parameters\n"
629 "Peer ASs in BGP confederation\n"
630 AS_STR)
631{
632 struct bgp *bgp;
633 as_t as;
634 int i;
635
636 bgp = vty->index;
637
638 for (i = 0; i < argc; i++)
639 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000640 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
641
paul718e3742002-12-13 20:15:29 +0000642 bgp_confederation_peers_remove (bgp, as);
643 }
644 return CMD_SUCCESS;
645}
646
647/* BGP timers. */
648
649DEFUN (bgp_timers,
650 bgp_timers_cmd,
651 "timers bgp <0-65535> <0-65535>",
652 "Adjust routing timers\n"
653 "BGP timers\n"
654 "Keepalive interval\n"
655 "Holdtime\n")
656{
657 struct bgp *bgp;
658 unsigned long keepalive = 0;
659 unsigned long holdtime = 0;
660
661 bgp = vty->index;
662
663 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
664 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
665
666 /* Holdtime value check. */
667 if (holdtime < 3 && holdtime != 0)
668 {
669 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
670 VTY_NEWLINE);
671 return CMD_WARNING;
672 }
673
674 bgp_timers_set (bgp, keepalive, holdtime);
675
676 return CMD_SUCCESS;
677}
678
679DEFUN (no_bgp_timers,
680 no_bgp_timers_cmd,
681 "no timers bgp",
682 NO_STR
683 "Adjust routing timers\n"
684 "BGP timers\n")
685{
686 struct bgp *bgp;
687
688 bgp = vty->index;
689 bgp_timers_unset (bgp);
690
691 return CMD_SUCCESS;
692}
693
694ALIAS (no_bgp_timers,
695 no_bgp_timers_arg_cmd,
696 "no timers bgp <0-65535> <0-65535>",
697 NO_STR
698 "Adjust routing timers\n"
699 "BGP timers\n"
700 "Keepalive interval\n"
701 "Holdtime\n")
702
703DEFUN (bgp_client_to_client_reflection,
704 bgp_client_to_client_reflection_cmd,
705 "bgp client-to-client reflection",
706 "BGP specific commands\n"
707 "Configure client to client route reflection\n"
708 "reflection of routes allowed\n")
709{
710 struct bgp *bgp;
711
712 bgp = vty->index;
713 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
714 return CMD_SUCCESS;
715}
716
717DEFUN (no_bgp_client_to_client_reflection,
718 no_bgp_client_to_client_reflection_cmd,
719 "no bgp client-to-client reflection",
720 NO_STR
721 "BGP specific commands\n"
722 "Configure client to client route reflection\n"
723 "reflection of routes allowed\n")
724{
725 struct bgp *bgp;
726
727 bgp = vty->index;
728 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
729 return CMD_SUCCESS;
730}
731
732/* "bgp always-compare-med" configuration. */
733DEFUN (bgp_always_compare_med,
734 bgp_always_compare_med_cmd,
735 "bgp always-compare-med",
736 "BGP specific commands\n"
737 "Allow comparing MED from different neighbors\n")
738{
739 struct bgp *bgp;
740
741 bgp = vty->index;
742 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
743 return CMD_SUCCESS;
744}
745
746DEFUN (no_bgp_always_compare_med,
747 no_bgp_always_compare_med_cmd,
748 "no bgp always-compare-med",
749 NO_STR
750 "BGP specific commands\n"
751 "Allow comparing MED from different neighbors\n")
752{
753 struct bgp *bgp;
754
755 bgp = vty->index;
756 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
757 return CMD_SUCCESS;
758}
759
760/* "bgp deterministic-med" configuration. */
761DEFUN (bgp_deterministic_med,
762 bgp_deterministic_med_cmd,
763 "bgp deterministic-med",
764 "BGP specific commands\n"
765 "Pick the best-MED path among paths advertised from the neighboring AS\n")
766{
767 struct bgp *bgp;
768
769 bgp = vty->index;
770 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
771 return CMD_SUCCESS;
772}
773
774DEFUN (no_bgp_deterministic_med,
775 no_bgp_deterministic_med_cmd,
776 "no bgp deterministic-med",
777 NO_STR
778 "BGP specific commands\n"
779 "Pick the best-MED path among paths advertised from the neighboring AS\n")
780{
781 struct bgp *bgp;
782
783 bgp = vty->index;
784 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
785 return CMD_SUCCESS;
786}
hasso538621f2004-05-21 09:31:30 +0000787
788/* "bgp graceful-restart" configuration. */
789DEFUN (bgp_graceful_restart,
790 bgp_graceful_restart_cmd,
791 "bgp graceful-restart",
792 "BGP specific commands\n"
793 "Graceful restart capability parameters\n")
794{
795 struct bgp *bgp;
796
797 bgp = vty->index;
798 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
799 return CMD_SUCCESS;
800}
801
802DEFUN (no_bgp_graceful_restart,
803 no_bgp_graceful_restart_cmd,
804 "no bgp graceful-restart",
805 NO_STR
806 "BGP specific commands\n"
807 "Graceful restart capability parameters\n")
808{
809 struct bgp *bgp;
810
811 bgp = vty->index;
812 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
813 return CMD_SUCCESS;
814}
815
hasso93406d82005-02-02 14:40:33 +0000816DEFUN (bgp_graceful_restart_stalepath_time,
817 bgp_graceful_restart_stalepath_time_cmd,
818 "bgp graceful-restart stalepath-time <1-3600>",
819 "BGP specific commands\n"
820 "Graceful restart capability parameters\n"
821 "Set the max time to hold onto restarting peer's stale paths\n"
822 "Delay value (seconds)\n")
823{
824 struct bgp *bgp;
825 u_int32_t stalepath;
826
827 bgp = vty->index;
828 if (! bgp)
829 return CMD_WARNING;
830
831 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
832 bgp->stalepath_time = stalepath;
833 return CMD_SUCCESS;
834}
835
836DEFUN (no_bgp_graceful_restart_stalepath_time,
837 no_bgp_graceful_restart_stalepath_time_cmd,
838 "no bgp graceful-restart stalepath-time",
839 NO_STR
840 "BGP specific commands\n"
841 "Graceful restart capability parameters\n"
842 "Set the max time to hold onto restarting peer's stale paths\n")
843{
844 struct bgp *bgp;
845
846 bgp = vty->index;
847 if (! bgp)
848 return CMD_WARNING;
849
850 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
851 return CMD_SUCCESS;
852}
853
854ALIAS (no_bgp_graceful_restart_stalepath_time,
855 no_bgp_graceful_restart_stalepath_time_val_cmd,
856 "no bgp graceful-restart stalepath-time <1-3600>",
857 NO_STR
858 "BGP specific commands\n"
859 "Graceful restart capability parameters\n"
860 "Set the max time to hold onto restarting peer's stale paths\n"
861 "Delay value (seconds)\n")
862
paul718e3742002-12-13 20:15:29 +0000863/* "bgp fast-external-failover" configuration. */
864DEFUN (bgp_fast_external_failover,
865 bgp_fast_external_failover_cmd,
866 "bgp fast-external-failover",
867 BGP_STR
868 "Immediately reset session if a link to a directly connected external peer goes down\n")
869{
870 struct bgp *bgp;
871
872 bgp = vty->index;
873 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
874 return CMD_SUCCESS;
875}
876
877DEFUN (no_bgp_fast_external_failover,
878 no_bgp_fast_external_failover_cmd,
879 "no bgp fast-external-failover",
880 NO_STR
881 BGP_STR
882 "Immediately reset session if a link to a directly connected external peer goes down\n")
883{
884 struct bgp *bgp;
885
886 bgp = vty->index;
887 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
888 return CMD_SUCCESS;
889}
890
891/* "bgp enforce-first-as" configuration. */
892DEFUN (bgp_enforce_first_as,
893 bgp_enforce_first_as_cmd,
894 "bgp enforce-first-as",
895 BGP_STR
896 "Enforce the first AS for EBGP routes\n")
897{
898 struct bgp *bgp;
899
900 bgp = vty->index;
901 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
902 return CMD_SUCCESS;
903}
904
905DEFUN (no_bgp_enforce_first_as,
906 no_bgp_enforce_first_as_cmd,
907 "no bgp enforce-first-as",
908 NO_STR
909 BGP_STR
910 "Enforce the first AS for EBGP routes\n")
911{
912 struct bgp *bgp;
913
914 bgp = vty->index;
915 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
916 return CMD_SUCCESS;
917}
918
919/* "bgp bestpath compare-routerid" configuration. */
920DEFUN (bgp_bestpath_compare_router_id,
921 bgp_bestpath_compare_router_id_cmd,
922 "bgp bestpath compare-routerid",
923 "BGP specific commands\n"
924 "Change the default bestpath selection\n"
925 "Compare router-id for identical EBGP paths\n")
926{
927 struct bgp *bgp;
928
929 bgp = vty->index;
930 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
931 return CMD_SUCCESS;
932}
933
934DEFUN (no_bgp_bestpath_compare_router_id,
935 no_bgp_bestpath_compare_router_id_cmd,
936 "no bgp bestpath compare-routerid",
937 NO_STR
938 "BGP specific commands\n"
939 "Change the default bestpath selection\n"
940 "Compare router-id for identical EBGP paths\n")
941{
942 struct bgp *bgp;
943
944 bgp = vty->index;
945 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
946 return CMD_SUCCESS;
947}
948
949/* "bgp bestpath as-path ignore" configuration. */
950DEFUN (bgp_bestpath_aspath_ignore,
951 bgp_bestpath_aspath_ignore_cmd,
952 "bgp bestpath as-path ignore",
953 "BGP specific commands\n"
954 "Change the default bestpath selection\n"
955 "AS-path attribute\n"
956 "Ignore as-path length in selecting a route\n")
957{
958 struct bgp *bgp;
959
960 bgp = vty->index;
961 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
962 return CMD_SUCCESS;
963}
964
965DEFUN (no_bgp_bestpath_aspath_ignore,
966 no_bgp_bestpath_aspath_ignore_cmd,
967 "no bgp bestpath as-path ignore",
968 NO_STR
969 "BGP specific commands\n"
970 "Change the default bestpath selection\n"
971 "AS-path attribute\n"
972 "Ignore as-path length in selecting a route\n")
973{
974 struct bgp *bgp;
975
976 bgp = vty->index;
977 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
978 return CMD_SUCCESS;
979}
980
hasso68118452005-04-08 15:40:36 +0000981/* "bgp bestpath as-path confed" configuration. */
982DEFUN (bgp_bestpath_aspath_confed,
983 bgp_bestpath_aspath_confed_cmd,
984 "bgp bestpath as-path confed",
985 "BGP specific commands\n"
986 "Change the default bestpath selection\n"
987 "AS-path attribute\n"
988 "Compare path lengths including confederation sets & sequences in selecting a route\n")
989{
990 struct bgp *bgp;
991
992 bgp = vty->index;
993 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
994 return CMD_SUCCESS;
995}
996
997DEFUN (no_bgp_bestpath_aspath_confed,
998 no_bgp_bestpath_aspath_confed_cmd,
999 "no bgp bestpath as-path confed",
1000 NO_STR
1001 "BGP specific commands\n"
1002 "Change the default bestpath selection\n"
1003 "AS-path attribute\n"
1004 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1005{
1006 struct bgp *bgp;
1007
1008 bgp = vty->index;
1009 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1010 return CMD_SUCCESS;
1011}
1012
paul848973c2003-08-13 00:32:49 +00001013/* "bgp log-neighbor-changes" configuration. */
1014DEFUN (bgp_log_neighbor_changes,
1015 bgp_log_neighbor_changes_cmd,
1016 "bgp log-neighbor-changes",
1017 "BGP specific commands\n"
1018 "Log neighbor up/down and reset reason\n")
1019{
1020 struct bgp *bgp;
1021
1022 bgp = vty->index;
1023 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1024 return CMD_SUCCESS;
1025}
1026
1027DEFUN (no_bgp_log_neighbor_changes,
1028 no_bgp_log_neighbor_changes_cmd,
1029 "no bgp log-neighbor-changes",
1030 NO_STR
1031 "BGP specific commands\n"
1032 "Log neighbor up/down and reset reason\n")
1033{
1034 struct bgp *bgp;
1035
1036 bgp = vty->index;
1037 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1038 return CMD_SUCCESS;
1039}
1040
paul718e3742002-12-13 20:15:29 +00001041/* "bgp bestpath med" configuration. */
1042DEFUN (bgp_bestpath_med,
1043 bgp_bestpath_med_cmd,
1044 "bgp bestpath med (confed|missing-as-worst)",
1045 "BGP specific commands\n"
1046 "Change the default bestpath selection\n"
1047 "MED attribute\n"
1048 "Compare MED among confederation paths\n"
1049 "Treat missing MED as the least preferred one\n")
1050{
1051 struct bgp *bgp;
1052
1053 bgp = vty->index;
1054
1055 if (strncmp (argv[0], "confed", 1) == 0)
1056 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1057 else
1058 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1059
1060 return CMD_SUCCESS;
1061}
1062
1063DEFUN (bgp_bestpath_med2,
1064 bgp_bestpath_med2_cmd,
1065 "bgp bestpath med confed missing-as-worst",
1066 "BGP specific commands\n"
1067 "Change the default bestpath selection\n"
1068 "MED attribute\n"
1069 "Compare MED among confederation paths\n"
1070 "Treat missing MED as the least preferred one\n")
1071{
1072 struct bgp *bgp;
1073
1074 bgp = vty->index;
1075 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1076 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1077 return CMD_SUCCESS;
1078}
1079
1080ALIAS (bgp_bestpath_med2,
1081 bgp_bestpath_med3_cmd,
1082 "bgp bestpath med missing-as-worst confed",
1083 "BGP specific commands\n"
1084 "Change the default bestpath selection\n"
1085 "MED attribute\n"
1086 "Treat missing MED as the least preferred one\n"
1087 "Compare MED among confederation paths\n")
1088
1089DEFUN (no_bgp_bestpath_med,
1090 no_bgp_bestpath_med_cmd,
1091 "no bgp bestpath med (confed|missing-as-worst)",
1092 NO_STR
1093 "BGP specific commands\n"
1094 "Change the default bestpath selection\n"
1095 "MED attribute\n"
1096 "Compare MED among confederation paths\n"
1097 "Treat missing MED as the least preferred one\n")
1098{
1099 struct bgp *bgp;
1100
1101 bgp = vty->index;
1102
1103 if (strncmp (argv[0], "confed", 1) == 0)
1104 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1105 else
1106 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1107
1108 return CMD_SUCCESS;
1109}
1110
1111DEFUN (no_bgp_bestpath_med2,
1112 no_bgp_bestpath_med2_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 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1125 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1126 return CMD_SUCCESS;
1127}
1128
1129ALIAS (no_bgp_bestpath_med2,
1130 no_bgp_bestpath_med3_cmd,
1131 "no bgp bestpath med missing-as-worst confed",
1132 NO_STR
1133 "BGP specific commands\n"
1134 "Change the default bestpath selection\n"
1135 "MED attribute\n"
1136 "Treat missing MED as the least preferred one\n"
1137 "Compare MED among confederation paths\n")
1138
1139/* "no bgp default ipv4-unicast". */
1140DEFUN (no_bgp_default_ipv4_unicast,
1141 no_bgp_default_ipv4_unicast_cmd,
1142 "no bgp default ipv4-unicast",
1143 NO_STR
1144 "BGP specific commands\n"
1145 "Configure BGP defaults\n"
1146 "Activate ipv4-unicast for a peer by default\n")
1147{
1148 struct bgp *bgp;
1149
1150 bgp = vty->index;
1151 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1152 return CMD_SUCCESS;
1153}
1154
1155DEFUN (bgp_default_ipv4_unicast,
1156 bgp_default_ipv4_unicast_cmd,
1157 "bgp default ipv4-unicast",
1158 "BGP specific commands\n"
1159 "Configure BGP defaults\n"
1160 "Activate ipv4-unicast for a peer by default\n")
1161{
1162 struct bgp *bgp;
1163
1164 bgp = vty->index;
1165 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1166 return CMD_SUCCESS;
1167}
1168
1169/* "bgp import-check" configuration. */
1170DEFUN (bgp_network_import_check,
1171 bgp_network_import_check_cmd,
1172 "bgp network import-check",
1173 "BGP specific commands\n"
1174 "BGP network command\n"
1175 "Check BGP network route exists in IGP\n")
1176{
1177 struct bgp *bgp;
1178
1179 bgp = vty->index;
1180 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1181 return CMD_SUCCESS;
1182}
1183
1184DEFUN (no_bgp_network_import_check,
1185 no_bgp_network_import_check_cmd,
1186 "no bgp network import-check",
1187 NO_STR
1188 "BGP specific commands\n"
1189 "BGP network command\n"
1190 "Check BGP network route exists in IGP\n")
1191{
1192 struct bgp *bgp;
1193
1194 bgp = vty->index;
1195 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1196 return CMD_SUCCESS;
1197}
1198
1199DEFUN (bgp_default_local_preference,
1200 bgp_default_local_preference_cmd,
1201 "bgp default local-preference <0-4294967295>",
1202 "BGP specific commands\n"
1203 "Configure BGP defaults\n"
1204 "local preference (higher=more preferred)\n"
1205 "Configure default local preference value\n")
1206{
1207 struct bgp *bgp;
1208 u_int32_t local_pref;
1209
1210 bgp = vty->index;
1211
1212 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1213
1214 bgp_default_local_preference_set (bgp, local_pref);
1215
1216 return CMD_SUCCESS;
1217}
1218
1219DEFUN (no_bgp_default_local_preference,
1220 no_bgp_default_local_preference_cmd,
1221 "no bgp default local-preference",
1222 NO_STR
1223 "BGP specific commands\n"
1224 "Configure BGP defaults\n"
1225 "local preference (higher=more preferred)\n")
1226{
1227 struct bgp *bgp;
1228
1229 bgp = vty->index;
1230 bgp_default_local_preference_unset (bgp);
1231 return CMD_SUCCESS;
1232}
1233
1234ALIAS (no_bgp_default_local_preference,
1235 no_bgp_default_local_preference_val_cmd,
1236 "no bgp default local-preference <0-4294967295>",
1237 NO_STR
1238 "BGP specific commands\n"
1239 "Configure BGP defaults\n"
1240 "local preference (higher=more preferred)\n"
1241 "Configure default local preference value\n")
1242
1243static int
paulfd79ac92004-10-13 05:06:08 +00001244peer_remote_as_vty (struct vty *vty, const char *peer_str,
1245 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001246{
1247 int ret;
1248 struct bgp *bgp;
1249 as_t as;
1250 union sockunion su;
1251
1252 bgp = vty->index;
1253
1254 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001255 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001256
1257 /* If peer is peer group, call proper function. */
1258 ret = str2sockunion (peer_str, &su);
1259 if (ret < 0)
1260 {
1261 ret = peer_group_remote_as (bgp, peer_str, &as);
1262 if (ret < 0)
1263 {
1264 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1265 return CMD_WARNING;
1266 }
1267 return CMD_SUCCESS;
1268 }
1269
1270 if (peer_address_self_check (&su))
1271 {
1272 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1273 VTY_NEWLINE);
1274 return CMD_WARNING;
1275 }
1276
1277 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1278
1279 /* This peer belongs to peer group. */
1280 switch (ret)
1281 {
1282 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001283 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001284 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001285 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001286 vty_out (vty, "%% The AS# can not be changed from %u to %s, peer-group members must be all internal or all external%s", as, as_str, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001287 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001288 }
1289 return bgp_vty_return (vty, ret);
1290}
1291
1292DEFUN (neighbor_remote_as,
1293 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001294 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001295 NEIGHBOR_STR
1296 NEIGHBOR_ADDR_STR2
1297 "Specify a BGP neighbor\n"
1298 AS_STR)
1299{
1300 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1301}
1302
1303DEFUN (neighbor_peer_group,
1304 neighbor_peer_group_cmd,
1305 "neighbor WORD peer-group",
1306 NEIGHBOR_STR
1307 "Neighbor tag\n"
1308 "Configure peer-group\n")
1309{
1310 struct bgp *bgp;
1311 struct peer_group *group;
1312
1313 bgp = vty->index;
1314
1315 group = peer_group_get (bgp, argv[0]);
1316 if (! group)
1317 return CMD_WARNING;
1318
1319 return CMD_SUCCESS;
1320}
1321
1322DEFUN (no_neighbor,
1323 no_neighbor_cmd,
1324 NO_NEIGHBOR_CMD2,
1325 NO_STR
1326 NEIGHBOR_STR
1327 NEIGHBOR_ADDR_STR2)
1328{
1329 int ret;
1330 union sockunion su;
1331 struct peer_group *group;
1332 struct peer *peer;
1333
1334 ret = str2sockunion (argv[0], &su);
1335 if (ret < 0)
1336 {
1337 group = peer_group_lookup (vty->index, argv[0]);
1338 if (group)
1339 peer_group_delete (group);
1340 else
1341 {
1342 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1343 return CMD_WARNING;
1344 }
1345 }
1346 else
1347 {
1348 peer = peer_lookup (vty->index, &su);
1349 if (peer)
paul200df112005-06-01 11:17:05 +00001350 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001351 }
1352
1353 return CMD_SUCCESS;
1354}
1355
1356ALIAS (no_neighbor,
1357 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001358 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001359 NO_STR
1360 NEIGHBOR_STR
1361 NEIGHBOR_ADDR_STR
1362 "Specify a BGP neighbor\n"
1363 AS_STR)
1364
1365DEFUN (no_neighbor_peer_group,
1366 no_neighbor_peer_group_cmd,
1367 "no neighbor WORD peer-group",
1368 NO_STR
1369 NEIGHBOR_STR
1370 "Neighbor tag\n"
1371 "Configure peer-group\n")
1372{
1373 struct peer_group *group;
1374
1375 group = peer_group_lookup (vty->index, argv[0]);
1376 if (group)
1377 peer_group_delete (group);
1378 else
1379 {
1380 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1381 return CMD_WARNING;
1382 }
1383 return CMD_SUCCESS;
1384}
1385
1386DEFUN (no_neighbor_peer_group_remote_as,
1387 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001388 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001389 NO_STR
1390 NEIGHBOR_STR
1391 "Neighbor tag\n"
1392 "Specify a BGP neighbor\n"
1393 AS_STR)
1394{
1395 struct peer_group *group;
1396
1397 group = peer_group_lookup (vty->index, argv[0]);
1398 if (group)
1399 peer_group_remote_as_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 (neighbor_local_as,
1409 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001410 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001411 NEIGHBOR_STR
1412 NEIGHBOR_ADDR_STR2
1413 "Specify a local-as number\n"
1414 "AS number used as local AS\n")
1415{
1416 struct peer *peer;
1417 int ret;
1418
1419 peer = peer_and_group_lookup_vty (vty, argv[0]);
1420 if (! peer)
1421 return CMD_WARNING;
1422
1423 ret = peer_local_as_set (peer, atoi (argv[1]), 0);
1424 return bgp_vty_return (vty, ret);
1425}
1426
1427DEFUN (neighbor_local_as_no_prepend,
1428 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001429 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001430 NEIGHBOR_STR
1431 NEIGHBOR_ADDR_STR2
1432 "Specify a local-as number\n"
1433 "AS number used as local AS\n"
1434 "Do not prepend local-as to updates from ebgp peers\n")
1435{
1436 struct peer *peer;
1437 int ret;
1438
1439 peer = peer_and_group_lookup_vty (vty, argv[0]);
1440 if (! peer)
1441 return CMD_WARNING;
1442
1443 ret = peer_local_as_set (peer, atoi (argv[1]), 1);
1444 return bgp_vty_return (vty, ret);
1445}
1446
1447DEFUN (no_neighbor_local_as,
1448 no_neighbor_local_as_cmd,
1449 NO_NEIGHBOR_CMD2 "local-as",
1450 NO_STR
1451 NEIGHBOR_STR
1452 NEIGHBOR_ADDR_STR2
1453 "Specify a local-as number\n")
1454{
1455 struct peer *peer;
1456 int ret;
1457
1458 peer = peer_and_group_lookup_vty (vty, argv[0]);
1459 if (! peer)
1460 return CMD_WARNING;
1461
1462 ret = peer_local_as_unset (peer);
1463 return bgp_vty_return (vty, ret);
1464}
1465
1466ALIAS (no_neighbor_local_as,
1467 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001468 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001469 NO_STR
1470 NEIGHBOR_STR
1471 NEIGHBOR_ADDR_STR2
1472 "Specify a local-as number\n"
1473 "AS number used as local AS\n")
1474
1475ALIAS (no_neighbor_local_as,
1476 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001477 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001478 NO_STR
1479 NEIGHBOR_STR
1480 NEIGHBOR_ADDR_STR2
1481 "Specify a local-as number\n"
1482 "AS number used as local AS\n"
1483 "Do not prepend local-as to updates from ebgp peers\n")
1484
Paul Jakma0df7c912008-07-21 21:02:49 +00001485DEFUN (neighbor_password,
1486 neighbor_password_cmd,
1487 NEIGHBOR_CMD2 "password LINE",
1488 NEIGHBOR_STR
1489 NEIGHBOR_ADDR_STR2
1490 "Set a password\n"
1491 "The password\n")
1492{
1493 struct peer *peer;
1494 int ret;
1495
1496 peer = peer_and_group_lookup_vty (vty, argv[0]);
1497 if (! peer)
1498 return CMD_WARNING;
1499
1500 ret = peer_password_set (peer, argv[1]);
1501 return bgp_vty_return (vty, ret);
1502}
1503
1504DEFUN (no_neighbor_password,
1505 no_neighbor_password_cmd,
1506 NO_NEIGHBOR_CMD2 "password",
1507 NO_STR
1508 NEIGHBOR_STR
1509 NEIGHBOR_ADDR_STR2
1510 "Set a password\n")
1511{
1512 struct peer *peer;
1513 int ret;
1514
1515 peer = peer_and_group_lookup_vty (vty, argv[0]);
1516 if (! peer)
1517 return CMD_WARNING;
1518
1519 ret = peer_password_unset (peer);
1520 return bgp_vty_return (vty, ret);
1521}
1522
paul718e3742002-12-13 20:15:29 +00001523DEFUN (neighbor_activate,
1524 neighbor_activate_cmd,
1525 NEIGHBOR_CMD2 "activate",
1526 NEIGHBOR_STR
1527 NEIGHBOR_ADDR_STR2
1528 "Enable the Address Family for this Neighbor\n")
1529{
1530 struct peer *peer;
1531
1532 peer = peer_and_group_lookup_vty (vty, argv[0]);
1533 if (! peer)
1534 return CMD_WARNING;
1535
1536 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1537
1538 return CMD_SUCCESS;
1539}
1540
1541DEFUN (no_neighbor_activate,
1542 no_neighbor_activate_cmd,
1543 NO_NEIGHBOR_CMD2 "activate",
1544 NO_STR
1545 NEIGHBOR_STR
1546 NEIGHBOR_ADDR_STR2
1547 "Enable the Address Family for this Neighbor\n")
1548{
1549 int ret;
1550 struct peer *peer;
1551
1552 /* Lookup peer. */
1553 peer = peer_and_group_lookup_vty (vty, argv[0]);
1554 if (! peer)
1555 return CMD_WARNING;
1556
1557 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1558
1559 return bgp_vty_return (vty, ret);
1560}
1561
1562DEFUN (neighbor_set_peer_group,
1563 neighbor_set_peer_group_cmd,
1564 NEIGHBOR_CMD "peer-group WORD",
1565 NEIGHBOR_STR
1566 NEIGHBOR_ADDR_STR
1567 "Member of the peer-group\n"
1568 "peer-group name\n")
1569{
1570 int ret;
1571 as_t as;
1572 union sockunion su;
1573 struct bgp *bgp;
1574 struct peer_group *group;
1575
1576 bgp = vty->index;
1577
1578 ret = str2sockunion (argv[0], &su);
1579 if (ret < 0)
1580 {
1581 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1582 return CMD_WARNING;
1583 }
1584
1585 group = peer_group_lookup (bgp, argv[1]);
1586 if (! group)
1587 {
1588 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1589 return CMD_WARNING;
1590 }
1591
1592 if (peer_address_self_check (&su))
1593 {
1594 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1595 VTY_NEWLINE);
1596 return CMD_WARNING;
1597 }
1598
1599 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1600 bgp_node_safi (vty), &as);
1601
1602 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1603 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001604 vty_out (vty, "%% Peer with AS %u cannot be in this peer-group, members must be all internal or all external%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001605 return CMD_WARNING;
1606 }
1607
1608 return bgp_vty_return (vty, ret);
1609}
1610
1611DEFUN (no_neighbor_set_peer_group,
1612 no_neighbor_set_peer_group_cmd,
1613 NO_NEIGHBOR_CMD "peer-group WORD",
1614 NO_STR
1615 NEIGHBOR_STR
1616 NEIGHBOR_ADDR_STR
1617 "Member of the peer-group\n"
1618 "peer-group name\n")
1619{
1620 int ret;
1621 struct bgp *bgp;
1622 struct peer *peer;
1623 struct peer_group *group;
1624
1625 bgp = vty->index;
1626
1627 peer = peer_lookup_vty (vty, argv[0]);
1628 if (! peer)
1629 return CMD_WARNING;
1630
1631 group = peer_group_lookup (bgp, argv[1]);
1632 if (! group)
1633 {
1634 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1635 return CMD_WARNING;
1636 }
1637
1638 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1639 bgp_node_safi (vty));
1640
1641 return bgp_vty_return (vty, ret);
1642}
1643
paul94f2b392005-06-28 12:44:16 +00001644static int
paulfd79ac92004-10-13 05:06:08 +00001645peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1646 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001647{
1648 int ret;
1649 struct peer *peer;
1650
1651 peer = peer_and_group_lookup_vty (vty, ip_str);
1652 if (! peer)
1653 return CMD_WARNING;
1654
1655 if (set)
1656 ret = peer_flag_set (peer, flag);
1657 else
1658 ret = peer_flag_unset (peer, flag);
1659
1660 return bgp_vty_return (vty, ret);
1661}
1662
paul94f2b392005-06-28 12:44:16 +00001663static int
paulfd79ac92004-10-13 05:06:08 +00001664peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001665{
1666 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1667}
1668
paul94f2b392005-06-28 12:44:16 +00001669static int
paulfd79ac92004-10-13 05:06:08 +00001670peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001671{
1672 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1673}
1674
1675/* neighbor passive. */
1676DEFUN (neighbor_passive,
1677 neighbor_passive_cmd,
1678 NEIGHBOR_CMD2 "passive",
1679 NEIGHBOR_STR
1680 NEIGHBOR_ADDR_STR2
1681 "Don't send open messages to this neighbor\n")
1682{
1683 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1684}
1685
1686DEFUN (no_neighbor_passive,
1687 no_neighbor_passive_cmd,
1688 NO_NEIGHBOR_CMD2 "passive",
1689 NO_STR
1690 NEIGHBOR_STR
1691 NEIGHBOR_ADDR_STR2
1692 "Don't send open messages to this neighbor\n")
1693{
1694 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1695}
1696
1697/* neighbor shutdown. */
1698DEFUN (neighbor_shutdown,
1699 neighbor_shutdown_cmd,
1700 NEIGHBOR_CMD2 "shutdown",
1701 NEIGHBOR_STR
1702 NEIGHBOR_ADDR_STR2
1703 "Administratively shut down this neighbor\n")
1704{
1705 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1706}
1707
1708DEFUN (no_neighbor_shutdown,
1709 no_neighbor_shutdown_cmd,
1710 NO_NEIGHBOR_CMD2 "shutdown",
1711 NO_STR
1712 NEIGHBOR_STR
1713 NEIGHBOR_ADDR_STR2
1714 "Administratively shut down this neighbor\n")
1715{
1716 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1717}
1718
hassoc9502432005-02-01 22:01:48 +00001719/* Deprecated neighbor capability route-refresh. */
1720DEFUN_DEPRECATED (neighbor_capability_route_refresh,
1721 neighbor_capability_route_refresh_cmd,
1722 NEIGHBOR_CMD2 "capability route-refresh",
1723 NEIGHBOR_STR
1724 NEIGHBOR_ADDR_STR2
1725 "Advertise capability to the peer\n"
1726 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001727{
hassoc9502432005-02-01 22:01:48 +00001728 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001729}
1730
hassoc9502432005-02-01 22:01:48 +00001731DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
1732 no_neighbor_capability_route_refresh_cmd,
1733 NO_NEIGHBOR_CMD2 "capability route-refresh",
1734 NO_STR
1735 NEIGHBOR_STR
1736 NEIGHBOR_ADDR_STR2
1737 "Advertise capability to the peer\n"
1738 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001739{
hassoc9502432005-02-01 22:01:48 +00001740 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001741}
1742
1743/* neighbor capability dynamic. */
1744DEFUN (neighbor_capability_dynamic,
1745 neighbor_capability_dynamic_cmd,
1746 NEIGHBOR_CMD2 "capability dynamic",
1747 NEIGHBOR_STR
1748 NEIGHBOR_ADDR_STR2
1749 "Advertise capability to the peer\n"
1750 "Advertise dynamic capability to this neighbor\n")
1751{
1752 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1753}
1754
1755DEFUN (no_neighbor_capability_dynamic,
1756 no_neighbor_capability_dynamic_cmd,
1757 NO_NEIGHBOR_CMD2 "capability dynamic",
1758 NO_STR
1759 NEIGHBOR_STR
1760 NEIGHBOR_ADDR_STR2
1761 "Advertise capability to the peer\n"
1762 "Advertise dynamic capability to this neighbor\n")
1763{
1764 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1765}
1766
1767/* neighbor dont-capability-negotiate */
1768DEFUN (neighbor_dont_capability_negotiate,
1769 neighbor_dont_capability_negotiate_cmd,
1770 NEIGHBOR_CMD2 "dont-capability-negotiate",
1771 NEIGHBOR_STR
1772 NEIGHBOR_ADDR_STR2
1773 "Do not perform capability negotiation\n")
1774{
1775 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
1776}
1777
1778DEFUN (no_neighbor_dont_capability_negotiate,
1779 no_neighbor_dont_capability_negotiate_cmd,
1780 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
1781 NO_STR
1782 NEIGHBOR_STR
1783 NEIGHBOR_ADDR_STR2
1784 "Do not perform capability negotiation\n")
1785{
1786 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
1787}
1788
paul94f2b392005-06-28 12:44:16 +00001789static int
paulfd79ac92004-10-13 05:06:08 +00001790peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00001791 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001792{
1793 int ret;
1794 struct peer *peer;
1795
1796 peer = peer_and_group_lookup_vty (vty, peer_str);
1797 if (! peer)
1798 return CMD_WARNING;
1799
1800 if (set)
1801 ret = peer_af_flag_set (peer, afi, safi, flag);
1802 else
1803 ret = peer_af_flag_unset (peer, afi, safi, flag);
1804
1805 return bgp_vty_return (vty, ret);
1806}
1807
paul94f2b392005-06-28 12:44:16 +00001808static int
paulfd79ac92004-10-13 05:06:08 +00001809peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00001810 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00001811{
1812 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
1813}
1814
paul94f2b392005-06-28 12:44:16 +00001815static int
paulfd79ac92004-10-13 05:06:08 +00001816peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00001817 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00001818{
1819 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
1820}
1821
1822/* neighbor capability orf prefix-list. */
1823DEFUN (neighbor_capability_orf_prefix,
1824 neighbor_capability_orf_prefix_cmd,
1825 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
1826 NEIGHBOR_STR
1827 NEIGHBOR_ADDR_STR2
1828 "Advertise capability to the peer\n"
1829 "Advertise ORF capability to the peer\n"
1830 "Advertise prefixlist ORF capability to this neighbor\n"
1831 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
1832 "Capability to RECEIVE the ORF from this neighbor\n"
1833 "Capability to SEND the ORF to this neighbor\n")
1834{
1835 u_int16_t flag = 0;
1836
1837 if (strncmp (argv[1], "s", 1) == 0)
1838 flag = PEER_FLAG_ORF_PREFIX_SM;
1839 else if (strncmp (argv[1], "r", 1) == 0)
1840 flag = PEER_FLAG_ORF_PREFIX_RM;
1841 else if (strncmp (argv[1], "b", 1) == 0)
1842 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
1843 else
1844 return CMD_WARNING;
1845
1846 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1847 bgp_node_safi (vty), flag);
1848}
1849
1850DEFUN (no_neighbor_capability_orf_prefix,
1851 no_neighbor_capability_orf_prefix_cmd,
1852 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
1853 NO_STR
1854 NEIGHBOR_STR
1855 NEIGHBOR_ADDR_STR2
1856 "Advertise capability to the peer\n"
1857 "Advertise ORF capability to the peer\n"
1858 "Advertise prefixlist ORF capability to this neighbor\n"
1859 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
1860 "Capability to RECEIVE the ORF from this neighbor\n"
1861 "Capability to SEND the ORF to this neighbor\n")
1862{
1863 u_int16_t flag = 0;
1864
1865 if (strncmp (argv[1], "s", 1) == 0)
1866 flag = PEER_FLAG_ORF_PREFIX_SM;
1867 else if (strncmp (argv[1], "r", 1) == 0)
1868 flag = PEER_FLAG_ORF_PREFIX_RM;
1869 else if (strncmp (argv[1], "b", 1) == 0)
1870 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
1871 else
1872 return CMD_WARNING;
1873
1874 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1875 bgp_node_safi (vty), flag);
1876}
1877
1878/* neighbor next-hop-self. */
1879DEFUN (neighbor_nexthop_self,
1880 neighbor_nexthop_self_cmd,
1881 NEIGHBOR_CMD2 "next-hop-self",
1882 NEIGHBOR_STR
1883 NEIGHBOR_ADDR_STR2
1884 "Disable the next hop calculation for this neighbor\n")
1885{
1886 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1887 bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
1888}
1889
1890DEFUN (no_neighbor_nexthop_self,
1891 no_neighbor_nexthop_self_cmd,
1892 NO_NEIGHBOR_CMD2 "next-hop-self",
1893 NO_STR
1894 NEIGHBOR_STR
1895 NEIGHBOR_ADDR_STR2
1896 "Disable the next hop calculation for this neighbor\n")
1897{
1898 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1899 bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
1900}
1901
1902/* neighbor remove-private-AS. */
1903DEFUN (neighbor_remove_private_as,
1904 neighbor_remove_private_as_cmd,
1905 NEIGHBOR_CMD2 "remove-private-AS",
1906 NEIGHBOR_STR
1907 NEIGHBOR_ADDR_STR2
1908 "Remove private AS number from outbound updates\n")
1909{
1910 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1911 bgp_node_safi (vty),
1912 PEER_FLAG_REMOVE_PRIVATE_AS);
1913}
1914
1915DEFUN (no_neighbor_remove_private_as,
1916 no_neighbor_remove_private_as_cmd,
1917 NO_NEIGHBOR_CMD2 "remove-private-AS",
1918 NO_STR
1919 NEIGHBOR_STR
1920 NEIGHBOR_ADDR_STR2
1921 "Remove private AS number from outbound updates\n")
1922{
1923 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1924 bgp_node_safi (vty),
1925 PEER_FLAG_REMOVE_PRIVATE_AS);
1926}
1927
1928/* neighbor send-community. */
1929DEFUN (neighbor_send_community,
1930 neighbor_send_community_cmd,
1931 NEIGHBOR_CMD2 "send-community",
1932 NEIGHBOR_STR
1933 NEIGHBOR_ADDR_STR2
1934 "Send Community attribute to this neighbor\n")
1935{
1936 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1937 bgp_node_safi (vty),
1938 PEER_FLAG_SEND_COMMUNITY);
1939}
1940
1941DEFUN (no_neighbor_send_community,
1942 no_neighbor_send_community_cmd,
1943 NO_NEIGHBOR_CMD2 "send-community",
1944 NO_STR
1945 NEIGHBOR_STR
1946 NEIGHBOR_ADDR_STR2
1947 "Send Community attribute to this neighbor\n")
1948{
1949 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1950 bgp_node_safi (vty),
1951 PEER_FLAG_SEND_COMMUNITY);
1952}
1953
1954/* neighbor send-community extended. */
1955DEFUN (neighbor_send_community_type,
1956 neighbor_send_community_type_cmd,
1957 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
1958 NEIGHBOR_STR
1959 NEIGHBOR_ADDR_STR2
1960 "Send Community attribute to this neighbor\n"
1961 "Send Standard and Extended Community attributes\n"
1962 "Send Extended Community attributes\n"
1963 "Send Standard Community attributes\n")
1964{
1965 if (strncmp (argv[1], "s", 1) == 0)
1966 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1967 bgp_node_safi (vty),
1968 PEER_FLAG_SEND_COMMUNITY);
1969 if (strncmp (argv[1], "e", 1) == 0)
1970 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1971 bgp_node_safi (vty),
1972 PEER_FLAG_SEND_EXT_COMMUNITY);
1973
1974 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1975 bgp_node_safi (vty),
1976 (PEER_FLAG_SEND_COMMUNITY|
1977 PEER_FLAG_SEND_EXT_COMMUNITY));
1978}
1979
1980DEFUN (no_neighbor_send_community_type,
1981 no_neighbor_send_community_type_cmd,
1982 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
1983 NO_STR
1984 NEIGHBOR_STR
1985 NEIGHBOR_ADDR_STR2
1986 "Send Community attribute to this neighbor\n"
1987 "Send Standard and Extended Community attributes\n"
1988 "Send Extended Community attributes\n"
1989 "Send Standard Community attributes\n")
1990{
1991 if (strncmp (argv[1], "s", 1) == 0)
1992 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1993 bgp_node_safi (vty),
1994 PEER_FLAG_SEND_COMMUNITY);
1995 if (strncmp (argv[1], "e", 1) == 0)
1996 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
1997 bgp_node_safi (vty),
1998 PEER_FLAG_SEND_EXT_COMMUNITY);
1999
2000 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2001 bgp_node_safi (vty),
2002 (PEER_FLAG_SEND_COMMUNITY |
2003 PEER_FLAG_SEND_EXT_COMMUNITY));
2004}
2005
2006/* neighbor soft-reconfig. */
2007DEFUN (neighbor_soft_reconfiguration,
2008 neighbor_soft_reconfiguration_cmd,
2009 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2010 NEIGHBOR_STR
2011 NEIGHBOR_ADDR_STR2
2012 "Per neighbor soft reconfiguration\n"
2013 "Allow inbound soft reconfiguration for this neighbor\n")
2014{
2015 return peer_af_flag_set_vty (vty, argv[0],
2016 bgp_node_afi (vty), bgp_node_safi (vty),
2017 PEER_FLAG_SOFT_RECONFIG);
2018}
2019
2020DEFUN (no_neighbor_soft_reconfiguration,
2021 no_neighbor_soft_reconfiguration_cmd,
2022 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2023 NO_STR
2024 NEIGHBOR_STR
2025 NEIGHBOR_ADDR_STR2
2026 "Per neighbor soft reconfiguration\n"
2027 "Allow inbound soft reconfiguration for this neighbor\n")
2028{
2029 return peer_af_flag_unset_vty (vty, argv[0],
2030 bgp_node_afi (vty), bgp_node_safi (vty),
2031 PEER_FLAG_SOFT_RECONFIG);
2032}
2033
2034DEFUN (neighbor_route_reflector_client,
2035 neighbor_route_reflector_client_cmd,
2036 NEIGHBOR_CMD2 "route-reflector-client",
2037 NEIGHBOR_STR
2038 NEIGHBOR_ADDR_STR2
2039 "Configure a neighbor as Route Reflector client\n")
2040{
2041 struct peer *peer;
2042
2043
2044 peer = peer_and_group_lookup_vty (vty, argv[0]);
2045 if (! peer)
2046 return CMD_WARNING;
2047
2048 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2049 bgp_node_safi (vty),
2050 PEER_FLAG_REFLECTOR_CLIENT);
2051}
2052
2053DEFUN (no_neighbor_route_reflector_client,
2054 no_neighbor_route_reflector_client_cmd,
2055 NO_NEIGHBOR_CMD2 "route-reflector-client",
2056 NO_STR
2057 NEIGHBOR_STR
2058 NEIGHBOR_ADDR_STR2
2059 "Configure a neighbor as Route Reflector client\n")
2060{
2061 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2062 bgp_node_safi (vty),
2063 PEER_FLAG_REFLECTOR_CLIENT);
2064}
2065
paul94f2b392005-06-28 12:44:16 +00002066static int
paulfd79ac92004-10-13 05:06:08 +00002067peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2068 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002069{
2070 int ret;
2071 struct bgp *bgp;
2072 struct peer *peer;
2073 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002074 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002075 struct bgp_filter *pfilter;
2076 struct bgp_filter *gfilter;
2077
2078 bgp = vty->index;
2079
2080 peer = peer_and_group_lookup_vty (vty, peer_str);
2081 if ( ! peer )
2082 return CMD_WARNING;
2083
2084 /* If it is already a RS-Client, don't do anything. */
2085 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2086 return CMD_SUCCESS;
2087
2088 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002089 {
2090 peer = peer_lock (peer); /* rsclient peer list reference */
2091 listnode_add_sort (bgp->rsclient, peer);
2092 }
paulfee0f4c2004-09-13 05:12:46 +00002093
2094 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2095 if (ret < 0)
2096 return bgp_vty_return (vty, ret);
2097
Paul Jakma64e580a2006-02-21 01:09:01 +00002098 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002099 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
2100 peer->rib[afi][safi]->owner = peer;
2101
2102 /* Check for existing 'network' and 'redistribute' routes. */
2103 bgp_check_local_routes_rsclient (peer, afi, safi);
2104
2105 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2106 bgp_soft_reconfig_rsclient (peer, afi, safi);
2107
2108 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2109 {
2110 group = peer->group;
2111 gfilter = &peer->filter[afi][safi];
2112
paul1eb8ef22005-04-07 07:30:20 +00002113 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002114 {
2115 pfilter = &peer->filter[afi][safi];
2116
2117 /* Members of a non-RS-Client group should not be RS-Clients, as that
2118 is checked when the become part of the peer-group */
2119 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2120 if (ret < 0)
2121 return bgp_vty_return (vty, ret);
2122
2123 /* Make peer's RIB point to group's RIB. */
2124 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2125
2126 /* Import policy. */
2127 if (pfilter->map[RMAP_IMPORT].name)
2128 free (pfilter->map[RMAP_IMPORT].name);
2129 if (gfilter->map[RMAP_IMPORT].name)
2130 {
2131 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2132 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2133 }
2134 else
2135 {
2136 pfilter->map[RMAP_IMPORT].name = NULL;
2137 pfilter->map[RMAP_IMPORT].map =NULL;
2138 }
2139
2140 /* Export policy. */
2141 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2142 {
2143 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2144 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2145 }
2146 }
2147 }
2148 return CMD_SUCCESS;
2149}
2150
paul94f2b392005-06-28 12:44:16 +00002151static int
paulfd79ac92004-10-13 05:06:08 +00002152peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2153 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002154{
2155 int ret;
2156 struct bgp *bgp;
2157 struct peer *peer;
2158 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002159 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002160
2161 bgp = vty->index;
2162
2163 peer = peer_and_group_lookup_vty (vty, peer_str);
2164 if ( ! peer )
2165 return CMD_WARNING;
2166
2167 /* If it is not a RS-Client, don't do anything. */
2168 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2169 return CMD_SUCCESS;
2170
2171 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2172 {
2173 group = peer->group;
2174
paul1eb8ef22005-04-07 07:30:20 +00002175 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002176 {
2177 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2178 if (ret < 0)
2179 return bgp_vty_return (vty, ret);
2180
2181 peer->rib[afi][safi] = NULL;
2182 }
2183
2184 peer = group->conf;
2185 }
2186
2187 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2188 if (ret < 0)
2189 return bgp_vty_return (vty, ret);
2190
2191 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002192 {
2193 peer_unlock (peer); /* peer bgp rsclient reference */
2194 listnode_delete (bgp->rsclient, peer);
2195 }
paulfee0f4c2004-09-13 05:12:46 +00002196
Paul Jakmab608d5b2008-07-02 02:12:07 +00002197 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002198
2199 return CMD_SUCCESS;
2200}
2201
paul718e3742002-12-13 20:15:29 +00002202/* neighbor route-server-client. */
2203DEFUN (neighbor_route_server_client,
2204 neighbor_route_server_client_cmd,
2205 NEIGHBOR_CMD2 "route-server-client",
2206 NEIGHBOR_STR
2207 NEIGHBOR_ADDR_STR2
2208 "Configure a neighbor as Route Server client\n")
2209{
paulfee0f4c2004-09-13 05:12:46 +00002210 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2211 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002212}
2213
2214DEFUN (no_neighbor_route_server_client,
2215 no_neighbor_route_server_client_cmd,
2216 NO_NEIGHBOR_CMD2 "route-server-client",
2217 NO_STR
2218 NEIGHBOR_STR
2219 NEIGHBOR_ADDR_STR2
2220 "Configure a neighbor as Route Server client\n")
2221{
paulfee0f4c2004-09-13 05:12:46 +00002222 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2223 bgp_node_safi(vty));
2224}
2225
2226DEFUN (neighbor_nexthop_local_unchanged,
2227 neighbor_nexthop_local_unchanged_cmd,
2228 NEIGHBOR_CMD2 "nexthop-local unchanged",
2229 NEIGHBOR_STR
2230 NEIGHBOR_ADDR_STR2
2231 "Configure treatment of outgoing link-local nexthop attribute\n"
2232 "Leave link-local nexthop unchanged for this peer\n")
2233{
2234 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2235 bgp_node_safi (vty),
2236 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2237}
2238
2239DEFUN (no_neighbor_nexthop_local_unchanged,
2240 no_neighbor_nexthop_local_unchanged_cmd,
2241 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2242 NO_STR
2243 NEIGHBOR_STR
2244 NEIGHBOR_ADDR_STR2
2245 "Configure treatment of outgoing link-local-nexthop attribute\n"
2246 "Leave link-local nexthop unchanged for this peer\n")
2247{
paul718e3742002-12-13 20:15:29 +00002248 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2249 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002250 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002251}
2252
2253DEFUN (neighbor_attr_unchanged,
2254 neighbor_attr_unchanged_cmd,
2255 NEIGHBOR_CMD2 "attribute-unchanged",
2256 NEIGHBOR_STR
2257 NEIGHBOR_ADDR_STR2
2258 "BGP attribute is propagated unchanged to this neighbor\n")
2259{
2260 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2261 bgp_node_safi (vty),
2262 (PEER_FLAG_AS_PATH_UNCHANGED |
2263 PEER_FLAG_NEXTHOP_UNCHANGED |
2264 PEER_FLAG_MED_UNCHANGED));
2265}
2266
2267DEFUN (neighbor_attr_unchanged1,
2268 neighbor_attr_unchanged1_cmd,
2269 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2270 NEIGHBOR_STR
2271 NEIGHBOR_ADDR_STR2
2272 "BGP attribute is propagated unchanged to this neighbor\n"
2273 "As-path attribute\n"
2274 "Nexthop attribute\n"
2275 "Med attribute\n")
2276{
2277 u_int16_t flags = 0;
2278
2279 if (strncmp (argv[1], "as-path", 1) == 0)
2280 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2281 else if (strncmp (argv[1], "next-hop", 1) == 0)
2282 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2283 else if (strncmp (argv[1], "med", 1) == 0)
2284 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2285
2286 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2287 bgp_node_safi (vty), flags);
2288}
2289
2290DEFUN (neighbor_attr_unchanged2,
2291 neighbor_attr_unchanged2_cmd,
2292 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2293 NEIGHBOR_STR
2294 NEIGHBOR_ADDR_STR2
2295 "BGP attribute is propagated unchanged to this neighbor\n"
2296 "As-path attribute\n"
2297 "Nexthop attribute\n"
2298 "Med attribute\n")
2299{
2300 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2301
2302 if (strncmp (argv[1], "next-hop", 1) == 0)
2303 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2304 else if (strncmp (argv[1], "med", 1) == 0)
2305 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2306
2307 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2308 bgp_node_safi (vty), flags);
2309
2310}
2311
2312DEFUN (neighbor_attr_unchanged3,
2313 neighbor_attr_unchanged3_cmd,
2314 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2315 NEIGHBOR_STR
2316 NEIGHBOR_ADDR_STR2
2317 "BGP attribute is propagated unchanged to this neighbor\n"
2318 "Nexthop attribute\n"
2319 "As-path attribute\n"
2320 "Med attribute\n")
2321{
2322 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2323
2324 if (strncmp (argv[1], "as-path", 1) == 0)
2325 SET_FLAG (flags, PEER_FLAG_AS_PATH_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
2333DEFUN (neighbor_attr_unchanged4,
2334 neighbor_attr_unchanged4_cmd,
2335 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2336 NEIGHBOR_STR
2337 NEIGHBOR_ADDR_STR2
2338 "BGP attribute is propagated unchanged to this neighbor\n"
2339 "Med attribute\n"
2340 "As-path attribute\n"
2341 "Nexthop attribute\n")
2342{
2343 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2344
2345 if (strncmp (argv[1], "as-path", 1) == 0)
2346 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2347 else if (strncmp (argv[1], "next-hop", 1) == 0)
2348 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2349
2350 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2351 bgp_node_safi (vty), flags);
2352}
2353
2354ALIAS (neighbor_attr_unchanged,
2355 neighbor_attr_unchanged5_cmd,
2356 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2357 NEIGHBOR_STR
2358 NEIGHBOR_ADDR_STR2
2359 "BGP attribute is propagated unchanged to this neighbor\n"
2360 "As-path attribute\n"
2361 "Nexthop attribute\n"
2362 "Med attribute\n")
2363
2364ALIAS (neighbor_attr_unchanged,
2365 neighbor_attr_unchanged6_cmd,
2366 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2367 NEIGHBOR_STR
2368 NEIGHBOR_ADDR_STR2
2369 "BGP attribute is propagated unchanged to this neighbor\n"
2370 "As-path attribute\n"
2371 "Med attribute\n"
2372 "Nexthop attribute\n")
2373
2374ALIAS (neighbor_attr_unchanged,
2375 neighbor_attr_unchanged7_cmd,
2376 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2377 NEIGHBOR_STR
2378 NEIGHBOR_ADDR_STR2
2379 "BGP attribute is propagated unchanged to this neighbor\n"
2380 "Nexthop attribute\n"
2381 "Med attribute\n"
2382 "As-path attribute\n")
2383
2384ALIAS (neighbor_attr_unchanged,
2385 neighbor_attr_unchanged8_cmd,
2386 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2387 NEIGHBOR_STR
2388 NEIGHBOR_ADDR_STR2
2389 "BGP attribute is propagated unchanged to this neighbor\n"
2390 "Nexthop attribute\n"
2391 "As-path attribute\n"
2392 "Med attribute\n")
2393
2394ALIAS (neighbor_attr_unchanged,
2395 neighbor_attr_unchanged9_cmd,
2396 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2397 NEIGHBOR_STR
2398 NEIGHBOR_ADDR_STR2
2399 "BGP attribute is propagated unchanged to this neighbor\n"
2400 "Med attribute\n"
2401 "Nexthop attribute\n"
2402 "As-path attribute\n")
2403
2404ALIAS (neighbor_attr_unchanged,
2405 neighbor_attr_unchanged10_cmd,
2406 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2407 NEIGHBOR_STR
2408 NEIGHBOR_ADDR_STR2
2409 "BGP attribute is propagated unchanged to this neighbor\n"
2410 "Med attribute\n"
2411 "As-path attribute\n"
2412 "Nexthop attribute\n")
2413
2414DEFUN (no_neighbor_attr_unchanged,
2415 no_neighbor_attr_unchanged_cmd,
2416 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2417 NO_STR
2418 NEIGHBOR_STR
2419 NEIGHBOR_ADDR_STR2
2420 "BGP attribute is propagated unchanged to this neighbor\n")
2421{
2422 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2423 bgp_node_safi (vty),
2424 (PEER_FLAG_AS_PATH_UNCHANGED |
2425 PEER_FLAG_NEXTHOP_UNCHANGED |
2426 PEER_FLAG_MED_UNCHANGED));
2427}
2428
2429DEFUN (no_neighbor_attr_unchanged1,
2430 no_neighbor_attr_unchanged1_cmd,
2431 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2432 NO_STR
2433 NEIGHBOR_STR
2434 NEIGHBOR_ADDR_STR2
2435 "BGP attribute is propagated unchanged to this neighbor\n"
2436 "As-path attribute\n"
2437 "Nexthop attribute\n"
2438 "Med attribute\n")
2439{
2440 u_int16_t flags = 0;
2441
2442 if (strncmp (argv[1], "as-path", 1) == 0)
2443 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2444 else if (strncmp (argv[1], "next-hop", 1) == 0)
2445 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2446 else if (strncmp (argv[1], "med", 1) == 0)
2447 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2448
2449 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2450 bgp_node_safi (vty), flags);
2451}
2452
2453DEFUN (no_neighbor_attr_unchanged2,
2454 no_neighbor_attr_unchanged2_cmd,
2455 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2456 NO_STR
2457 NEIGHBOR_STR
2458 NEIGHBOR_ADDR_STR2
2459 "BGP attribute is propagated unchanged to this neighbor\n"
2460 "As-path attribute\n"
2461 "Nexthop attribute\n"
2462 "Med attribute\n")
2463{
2464 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2465
2466 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_unchanged3,
2476 no_neighbor_attr_unchanged3_cmd,
2477 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2478 NO_STR
2479 NEIGHBOR_STR
2480 NEIGHBOR_ADDR_STR2
2481 "BGP attribute is propagated unchanged to this neighbor\n"
2482 "Nexthop attribute\n"
2483 "As-path attribute\n"
2484 "Med attribute\n")
2485{
2486 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2487
2488 if (strncmp (argv[1], "as-path", 1) == 0)
2489 SET_FLAG (flags, PEER_FLAG_AS_PATH_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_unchanged4,
2498 no_neighbor_attr_unchanged4_cmd,
2499 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2500 NO_STR
2501 NEIGHBOR_STR
2502 NEIGHBOR_ADDR_STR2
2503 "BGP attribute is propagated unchanged to this neighbor\n"
2504 "Med attribute\n"
2505 "As-path attribute\n"
2506 "Nexthop attribute\n")
2507{
2508 u_int16_t flags = PEER_FLAG_MED_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], "next-hop", 1) == 0)
2513 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2514
2515 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2516 bgp_node_safi (vty), flags);
2517}
2518
2519ALIAS (no_neighbor_attr_unchanged,
2520 no_neighbor_attr_unchanged5_cmd,
2521 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2522 NO_STR
2523 NEIGHBOR_STR
2524 NEIGHBOR_ADDR_STR2
2525 "BGP attribute is propagated unchanged to this neighbor\n"
2526 "As-path attribute\n"
2527 "Nexthop attribute\n"
2528 "Med attribute\n")
2529
2530ALIAS (no_neighbor_attr_unchanged,
2531 no_neighbor_attr_unchanged6_cmd,
2532 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2533 NO_STR
2534 NEIGHBOR_STR
2535 NEIGHBOR_ADDR_STR2
2536 "BGP attribute is propagated unchanged to this neighbor\n"
2537 "As-path attribute\n"
2538 "Med attribute\n"
2539 "Nexthop attribute\n")
2540
2541ALIAS (no_neighbor_attr_unchanged,
2542 no_neighbor_attr_unchanged7_cmd,
2543 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2544 NO_STR
2545 NEIGHBOR_STR
2546 NEIGHBOR_ADDR_STR2
2547 "BGP attribute is propagated unchanged to this neighbor\n"
2548 "Nexthop attribute\n"
2549 "Med attribute\n"
2550 "As-path attribute\n")
2551
2552ALIAS (no_neighbor_attr_unchanged,
2553 no_neighbor_attr_unchanged8_cmd,
2554 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2555 NO_STR
2556 NEIGHBOR_STR
2557 NEIGHBOR_ADDR_STR2
2558 "BGP attribute is propagated unchanged to this neighbor\n"
2559 "Nexthop attribute\n"
2560 "As-path attribute\n"
2561 "Med attribute\n")
2562
2563ALIAS (no_neighbor_attr_unchanged,
2564 no_neighbor_attr_unchanged9_cmd,
2565 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2566 NO_STR
2567 NEIGHBOR_STR
2568 NEIGHBOR_ADDR_STR2
2569 "BGP attribute is propagated unchanged to this neighbor\n"
2570 "Med attribute\n"
2571 "Nexthop attribute\n"
2572 "As-path attribute\n")
2573
2574ALIAS (no_neighbor_attr_unchanged,
2575 no_neighbor_attr_unchanged10_cmd,
2576 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2577 NO_STR
2578 NEIGHBOR_STR
2579 NEIGHBOR_ADDR_STR2
2580 "BGP attribute is propagated unchanged to this neighbor\n"
2581 "Med attribute\n"
2582 "As-path attribute\n"
2583 "Nexthop attribute\n")
2584
2585/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002586DEFUN_DEPRECATED (neighbor_transparent_as,
2587 neighbor_transparent_as_cmd,
2588 NEIGHBOR_CMD "transparent-as",
2589 NEIGHBOR_STR
2590 NEIGHBOR_ADDR_STR
2591 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002592{
2593 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2594 bgp_node_safi (vty),
2595 PEER_FLAG_AS_PATH_UNCHANGED);
2596}
2597
hassodd4c5932005-02-02 17:15:34 +00002598DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2599 neighbor_transparent_nexthop_cmd,
2600 NEIGHBOR_CMD "transparent-nexthop",
2601 NEIGHBOR_STR
2602 NEIGHBOR_ADDR_STR
2603 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002604{
2605 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2606 bgp_node_safi (vty),
2607 PEER_FLAG_NEXTHOP_UNCHANGED);
2608}
2609
2610/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00002611static int
paulfd79ac92004-10-13 05:06:08 +00002612peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2613 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002614{
2615 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002616 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002617
2618 peer = peer_and_group_lookup_vty (vty, ip_str);
2619 if (! peer)
2620 return CMD_WARNING;
2621
2622 if (! ttl_str)
2623 ttl = TTL_MAX;
2624 else
2625 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2626
2627 peer_ebgp_multihop_set (peer, ttl);
2628
2629 return CMD_SUCCESS;
2630}
2631
paul94f2b392005-06-28 12:44:16 +00002632static int
paulfd79ac92004-10-13 05:06:08 +00002633peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002634{
2635 struct peer *peer;
2636
2637 peer = peer_and_group_lookup_vty (vty, ip_str);
2638 if (! peer)
2639 return CMD_WARNING;
2640
2641 peer_ebgp_multihop_unset (peer);
2642
2643 return CMD_SUCCESS;
2644}
2645
2646/* neighbor ebgp-multihop. */
2647DEFUN (neighbor_ebgp_multihop,
2648 neighbor_ebgp_multihop_cmd,
2649 NEIGHBOR_CMD2 "ebgp-multihop",
2650 NEIGHBOR_STR
2651 NEIGHBOR_ADDR_STR2
2652 "Allow EBGP neighbors not on directly connected networks\n")
2653{
2654 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2655}
2656
2657DEFUN (neighbor_ebgp_multihop_ttl,
2658 neighbor_ebgp_multihop_ttl_cmd,
2659 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2660 NEIGHBOR_STR
2661 NEIGHBOR_ADDR_STR2
2662 "Allow EBGP neighbors not on directly connected networks\n"
2663 "maximum hop count\n")
2664{
2665 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
2666}
2667
2668DEFUN (no_neighbor_ebgp_multihop,
2669 no_neighbor_ebgp_multihop_cmd,
2670 NO_NEIGHBOR_CMD2 "ebgp-multihop",
2671 NO_STR
2672 NEIGHBOR_STR
2673 NEIGHBOR_ADDR_STR2
2674 "Allow EBGP neighbors not on directly connected networks\n")
2675{
2676 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
2677}
2678
2679ALIAS (no_neighbor_ebgp_multihop,
2680 no_neighbor_ebgp_multihop_ttl_cmd,
2681 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2682 NO_STR
2683 NEIGHBOR_STR
2684 NEIGHBOR_ADDR_STR2
2685 "Allow EBGP neighbors not on directly connected networks\n"
2686 "maximum hop count\n")
2687
hasso6ffd2072005-02-02 14:50:11 +00002688/* disable-connected-check */
2689DEFUN (neighbor_disable_connected_check,
2690 neighbor_disable_connected_check_cmd,
2691 NEIGHBOR_CMD2 "disable-connected-check",
2692 NEIGHBOR_STR
2693 NEIGHBOR_ADDR_STR2
2694 "one-hop away EBGP peer using loopback address\n")
2695{
2696 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2697}
2698
2699DEFUN (no_neighbor_disable_connected_check,
2700 no_neighbor_disable_connected_check_cmd,
2701 NO_NEIGHBOR_CMD2 "disable-connected-check",
2702 NO_STR
2703 NEIGHBOR_STR
2704 NEIGHBOR_ADDR_STR2
2705 "one-hop away EBGP peer using loopback address\n")
2706{
2707 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2708}
2709
paul718e3742002-12-13 20:15:29 +00002710/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00002711ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002712 neighbor_enforce_multihop_cmd,
2713 NEIGHBOR_CMD2 "enforce-multihop",
2714 NEIGHBOR_STR
2715 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002716 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00002717
hasso6ffd2072005-02-02 14:50:11 +00002718/* Enforce multihop. */
2719ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002720 no_neighbor_enforce_multihop_cmd,
2721 NO_NEIGHBOR_CMD2 "enforce-multihop",
2722 NO_STR
2723 NEIGHBOR_STR
2724 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002725 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00002726
2727DEFUN (neighbor_description,
2728 neighbor_description_cmd,
2729 NEIGHBOR_CMD2 "description .LINE",
2730 NEIGHBOR_STR
2731 NEIGHBOR_ADDR_STR2
2732 "Neighbor specific description\n"
2733 "Up to 80 characters describing this neighbor\n")
2734{
2735 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00002736 char *str;
paul718e3742002-12-13 20:15:29 +00002737
2738 peer = peer_and_group_lookup_vty (vty, argv[0]);
2739 if (! peer)
2740 return CMD_WARNING;
2741
2742 if (argc == 1)
2743 return CMD_SUCCESS;
2744
ajs3b8b1852005-01-29 18:19:13 +00002745 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00002746
2747 peer_description_set (peer, str);
2748
ajs3b8b1852005-01-29 18:19:13 +00002749 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00002750
2751 return CMD_SUCCESS;
2752}
2753
2754DEFUN (no_neighbor_description,
2755 no_neighbor_description_cmd,
2756 NO_NEIGHBOR_CMD2 "description",
2757 NO_STR
2758 NEIGHBOR_STR
2759 NEIGHBOR_ADDR_STR2
2760 "Neighbor specific description\n")
2761{
2762 struct peer *peer;
2763
2764 peer = peer_and_group_lookup_vty (vty, argv[0]);
2765 if (! peer)
2766 return CMD_WARNING;
2767
2768 peer_description_unset (peer);
2769
2770 return CMD_SUCCESS;
2771}
2772
2773ALIAS (no_neighbor_description,
2774 no_neighbor_description_val_cmd,
2775 NO_NEIGHBOR_CMD2 "description .LINE",
2776 NO_STR
2777 NEIGHBOR_STR
2778 NEIGHBOR_ADDR_STR2
2779 "Neighbor specific description\n"
2780 "Up to 80 characters describing this neighbor\n")
2781
2782/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00002783static int
paulfd79ac92004-10-13 05:06:08 +00002784peer_update_source_vty (struct vty *vty, const char *peer_str,
2785 const char *source_str)
paul718e3742002-12-13 20:15:29 +00002786{
2787 struct peer *peer;
2788 union sockunion *su;
2789
2790 peer = peer_and_group_lookup_vty (vty, peer_str);
2791 if (! peer)
2792 return CMD_WARNING;
2793
2794 if (source_str)
2795 {
2796 su = sockunion_str2su (source_str);
2797 if (su)
2798 {
2799 peer_update_source_addr_set (peer, su);
2800 sockunion_free (su);
2801 }
2802 else
2803 peer_update_source_if_set (peer, source_str);
2804 }
2805 else
2806 peer_update_source_unset (peer);
2807
2808 return CMD_SUCCESS;
2809}
2810
Paul Jakma369688c2006-05-23 22:27:55 +00002811#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|WORD)"
2812#define BGP_UPDATE_SOURCE_HELP_STR \
2813 "IPv4 address\n" \
2814 "Interface name\n"
2815
paul718e3742002-12-13 20:15:29 +00002816DEFUN (neighbor_update_source,
2817 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00002818 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00002819 NEIGHBOR_STR
2820 NEIGHBOR_ADDR_STR2
2821 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00002822 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00002823{
2824 return peer_update_source_vty (vty, argv[0], argv[1]);
2825}
2826
2827DEFUN (no_neighbor_update_source,
2828 no_neighbor_update_source_cmd,
2829 NO_NEIGHBOR_CMD2 "update-source",
2830 NO_STR
2831 NEIGHBOR_STR
2832 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00002833 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00002834{
2835 return peer_update_source_vty (vty, argv[0], NULL);
2836}
2837
paul94f2b392005-06-28 12:44:16 +00002838static int
paulfd79ac92004-10-13 05:06:08 +00002839peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
2840 afi_t afi, safi_t safi,
2841 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00002842{
2843 int ret;
2844 struct peer *peer;
2845
2846 peer = peer_and_group_lookup_vty (vty, peer_str);
2847 if (! peer)
2848 return CMD_WARNING;
2849
2850 if (set)
2851 ret = peer_default_originate_set (peer, afi, safi, rmap);
2852 else
2853 ret = peer_default_originate_unset (peer, afi, safi);
2854
2855 return bgp_vty_return (vty, ret);
2856}
2857
2858/* neighbor default-originate. */
2859DEFUN (neighbor_default_originate,
2860 neighbor_default_originate_cmd,
2861 NEIGHBOR_CMD2 "default-originate",
2862 NEIGHBOR_STR
2863 NEIGHBOR_ADDR_STR2
2864 "Originate default route to this neighbor\n")
2865{
2866 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2867 bgp_node_safi (vty), NULL, 1);
2868}
2869
2870DEFUN (neighbor_default_originate_rmap,
2871 neighbor_default_originate_rmap_cmd,
2872 NEIGHBOR_CMD2 "default-originate route-map WORD",
2873 NEIGHBOR_STR
2874 NEIGHBOR_ADDR_STR2
2875 "Originate default route to this neighbor\n"
2876 "Route-map to specify criteria to originate default\n"
2877 "route-map name\n")
2878{
2879 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2880 bgp_node_safi (vty), argv[1], 1);
2881}
2882
2883DEFUN (no_neighbor_default_originate,
2884 no_neighbor_default_originate_cmd,
2885 NO_NEIGHBOR_CMD2 "default-originate",
2886 NO_STR
2887 NEIGHBOR_STR
2888 NEIGHBOR_ADDR_STR2
2889 "Originate default route to this neighbor\n")
2890{
2891 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
2892 bgp_node_safi (vty), NULL, 0);
2893}
2894
2895ALIAS (no_neighbor_default_originate,
2896 no_neighbor_default_originate_rmap_cmd,
2897 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
2898 NO_STR
2899 NEIGHBOR_STR
2900 NEIGHBOR_ADDR_STR2
2901 "Originate default route to this neighbor\n"
2902 "Route-map to specify criteria to originate default\n"
2903 "route-map name\n")
2904
2905/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00002906static int
paulfd79ac92004-10-13 05:06:08 +00002907peer_port_vty (struct vty *vty, const char *ip_str, int afi,
2908 const char *port_str)
paul718e3742002-12-13 20:15:29 +00002909{
2910 struct peer *peer;
2911 u_int16_t port;
2912 struct servent *sp;
2913
2914 peer = peer_lookup_vty (vty, ip_str);
2915 if (! peer)
2916 return CMD_WARNING;
2917
2918 if (! port_str)
2919 {
2920 sp = getservbyname ("bgp", "tcp");
2921 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
2922 }
2923 else
2924 {
2925 VTY_GET_INTEGER("port", port, port_str);
2926 }
2927
2928 peer_port_set (peer, port);
2929
2930 return CMD_SUCCESS;
2931}
2932
hassof4184462005-02-01 20:13:16 +00002933/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00002934DEFUN (neighbor_port,
2935 neighbor_port_cmd,
2936 NEIGHBOR_CMD "port <0-65535>",
2937 NEIGHBOR_STR
2938 NEIGHBOR_ADDR_STR
2939 "Neighbor's BGP port\n"
2940 "TCP port number\n")
2941{
2942 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
2943}
2944
2945DEFUN (no_neighbor_port,
2946 no_neighbor_port_cmd,
2947 NO_NEIGHBOR_CMD "port",
2948 NO_STR
2949 NEIGHBOR_STR
2950 NEIGHBOR_ADDR_STR
2951 "Neighbor's BGP port\n")
2952{
2953 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
2954}
2955
2956ALIAS (no_neighbor_port,
2957 no_neighbor_port_val_cmd,
2958 NO_NEIGHBOR_CMD "port <0-65535>",
2959 NO_STR
2960 NEIGHBOR_STR
2961 NEIGHBOR_ADDR_STR
2962 "Neighbor's BGP port\n"
2963 "TCP port number\n")
2964
2965/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00002966static int
paulfd79ac92004-10-13 05:06:08 +00002967peer_weight_set_vty (struct vty *vty, const char *ip_str,
2968 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00002969{
2970 int ret;
2971 struct peer *peer;
2972 unsigned long weight;
2973
2974 peer = peer_and_group_lookup_vty (vty, ip_str);
2975 if (! peer)
2976 return CMD_WARNING;
2977
2978 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
2979
2980 ret = peer_weight_set (peer, weight);
2981
2982 return CMD_SUCCESS;
2983}
2984
paul94f2b392005-06-28 12:44:16 +00002985static int
paulfd79ac92004-10-13 05:06:08 +00002986peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002987{
2988 struct peer *peer;
2989
2990 peer = peer_and_group_lookup_vty (vty, ip_str);
2991 if (! peer)
2992 return CMD_WARNING;
2993
2994 peer_weight_unset (peer);
2995
2996 return CMD_SUCCESS;
2997}
2998
2999DEFUN (neighbor_weight,
3000 neighbor_weight_cmd,
3001 NEIGHBOR_CMD2 "weight <0-65535>",
3002 NEIGHBOR_STR
3003 NEIGHBOR_ADDR_STR2
3004 "Set default weight for routes from this neighbor\n"
3005 "default weight\n")
3006{
3007 return peer_weight_set_vty (vty, argv[0], argv[1]);
3008}
3009
3010DEFUN (no_neighbor_weight,
3011 no_neighbor_weight_cmd,
3012 NO_NEIGHBOR_CMD2 "weight",
3013 NO_STR
3014 NEIGHBOR_STR
3015 NEIGHBOR_ADDR_STR2
3016 "Set default weight for routes from this neighbor\n")
3017{
3018 return peer_weight_unset_vty (vty, argv[0]);
3019}
3020
3021ALIAS (no_neighbor_weight,
3022 no_neighbor_weight_val_cmd,
3023 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3024 NO_STR
3025 NEIGHBOR_STR
3026 NEIGHBOR_ADDR_STR2
3027 "Set default weight for routes from this neighbor\n"
3028 "default weight\n")
3029
3030/* Override capability negotiation. */
3031DEFUN (neighbor_override_capability,
3032 neighbor_override_capability_cmd,
3033 NEIGHBOR_CMD2 "override-capability",
3034 NEIGHBOR_STR
3035 NEIGHBOR_ADDR_STR2
3036 "Override capability negotiation result\n")
3037{
3038 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3039}
3040
3041DEFUN (no_neighbor_override_capability,
3042 no_neighbor_override_capability_cmd,
3043 NO_NEIGHBOR_CMD2 "override-capability",
3044 NO_STR
3045 NEIGHBOR_STR
3046 NEIGHBOR_ADDR_STR2
3047 "Override capability negotiation result\n")
3048{
3049 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3050}
3051
3052DEFUN (neighbor_strict_capability,
3053 neighbor_strict_capability_cmd,
3054 NEIGHBOR_CMD "strict-capability-match",
3055 NEIGHBOR_STR
3056 NEIGHBOR_ADDR_STR
3057 "Strict capability negotiation match\n")
3058{
3059 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3060}
3061
3062DEFUN (no_neighbor_strict_capability,
3063 no_neighbor_strict_capability_cmd,
3064 NO_NEIGHBOR_CMD "strict-capability-match",
3065 NO_STR
3066 NEIGHBOR_STR
3067 NEIGHBOR_ADDR_STR
3068 "Strict capability negotiation match\n")
3069{
3070 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3071}
3072
paul94f2b392005-06-28 12:44:16 +00003073static int
paulfd79ac92004-10-13 05:06:08 +00003074peer_timers_set_vty (struct vty *vty, const char *ip_str,
3075 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003076{
3077 int ret;
3078 struct peer *peer;
3079 u_int32_t keepalive;
3080 u_int32_t holdtime;
3081
3082 peer = peer_and_group_lookup_vty (vty, ip_str);
3083 if (! peer)
3084 return CMD_WARNING;
3085
3086 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3087 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3088
3089 ret = peer_timers_set (peer, keepalive, holdtime);
3090
3091 return bgp_vty_return (vty, ret);
3092}
3093
paul94f2b392005-06-28 12:44:16 +00003094static int
paulfd79ac92004-10-13 05:06:08 +00003095peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003096{
3097 int ret;
3098 struct peer *peer;
3099
3100 peer = peer_lookup_vty (vty, ip_str);
3101 if (! peer)
3102 return CMD_WARNING;
3103
3104 ret = peer_timers_unset (peer);
3105
3106 return bgp_vty_return (vty, ret);
3107}
3108
3109DEFUN (neighbor_timers,
3110 neighbor_timers_cmd,
3111 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3112 NEIGHBOR_STR
3113 NEIGHBOR_ADDR_STR2
3114 "BGP per neighbor timers\n"
3115 "Keepalive interval\n"
3116 "Holdtime\n")
3117{
3118 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3119}
3120
3121DEFUN (no_neighbor_timers,
3122 no_neighbor_timers_cmd,
3123 NO_NEIGHBOR_CMD2 "timers",
3124 NO_STR
3125 NEIGHBOR_STR
3126 NEIGHBOR_ADDR_STR2
3127 "BGP per neighbor timers\n")
3128{
3129 return peer_timers_unset_vty (vty, argv[0]);
3130}
3131
paul94f2b392005-06-28 12:44:16 +00003132static int
paulfd79ac92004-10-13 05:06:08 +00003133peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3134 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003135{
3136 int ret;
3137 struct peer *peer;
3138 u_int32_t connect;
3139
3140 peer = peer_lookup_vty (vty, ip_str);
3141 if (! peer)
3142 return CMD_WARNING;
3143
3144 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3145
3146 ret = peer_timers_connect_set (peer, connect);
3147
3148 return CMD_SUCCESS;
3149}
3150
paul94f2b392005-06-28 12:44:16 +00003151static int
paulfd79ac92004-10-13 05:06:08 +00003152peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003153{
3154 int ret;
3155 struct peer *peer;
3156
3157 peer = peer_and_group_lookup_vty (vty, ip_str);
3158 if (! peer)
3159 return CMD_WARNING;
3160
3161 ret = peer_timers_connect_unset (peer);
3162
3163 return CMD_SUCCESS;
3164}
3165
3166DEFUN (neighbor_timers_connect,
3167 neighbor_timers_connect_cmd,
3168 NEIGHBOR_CMD "timers connect <0-65535>",
3169 NEIGHBOR_STR
3170 NEIGHBOR_ADDR_STR
3171 "BGP per neighbor timers\n"
3172 "BGP connect timer\n"
3173 "Connect timer\n")
3174{
3175 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3176}
3177
3178DEFUN (no_neighbor_timers_connect,
3179 no_neighbor_timers_connect_cmd,
3180 NO_NEIGHBOR_CMD "timers connect",
3181 NO_STR
3182 NEIGHBOR_STR
3183 NEIGHBOR_ADDR_STR
3184 "BGP per neighbor timers\n"
3185 "BGP connect timer\n")
3186{
3187 return peer_timers_connect_unset_vty (vty, argv[0]);
3188}
3189
3190ALIAS (no_neighbor_timers_connect,
3191 no_neighbor_timers_connect_val_cmd,
3192 NO_NEIGHBOR_CMD "timers connect <0-65535>",
3193 NO_STR
3194 NEIGHBOR_STR
3195 NEIGHBOR_ADDR_STR
3196 "BGP per neighbor timers\n"
3197 "BGP connect timer\n"
3198 "Connect timer\n")
3199
paul94f2b392005-06-28 12:44:16 +00003200static int
paulfd79ac92004-10-13 05:06:08 +00003201peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3202 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003203{
3204 int ret;
3205 struct peer *peer;
3206 u_int32_t routeadv = 0;
3207
3208 peer = peer_lookup_vty (vty, ip_str);
3209 if (! peer)
3210 return CMD_WARNING;
3211
3212 if (time_str)
3213 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3214
3215 if (set)
3216 ret = peer_advertise_interval_set (peer, routeadv);
3217 else
3218 ret = peer_advertise_interval_unset (peer);
3219
3220 return CMD_SUCCESS;
3221}
3222
3223DEFUN (neighbor_advertise_interval,
3224 neighbor_advertise_interval_cmd,
3225 NEIGHBOR_CMD "advertisement-interval <0-600>",
3226 NEIGHBOR_STR
3227 NEIGHBOR_ADDR_STR
3228 "Minimum interval between sending BGP routing updates\n"
3229 "time in seconds\n")
3230{
3231 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3232}
3233
3234DEFUN (no_neighbor_advertise_interval,
3235 no_neighbor_advertise_interval_cmd,
3236 NO_NEIGHBOR_CMD "advertisement-interval",
3237 NO_STR
3238 NEIGHBOR_STR
3239 NEIGHBOR_ADDR_STR
3240 "Minimum interval between sending BGP routing updates\n")
3241{
3242 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3243}
3244
3245ALIAS (no_neighbor_advertise_interval,
3246 no_neighbor_advertise_interval_val_cmd,
3247 NO_NEIGHBOR_CMD "advertisement-interval <0-600>",
3248 NO_STR
3249 NEIGHBOR_STR
3250 NEIGHBOR_ADDR_STR
3251 "Minimum interval between sending BGP routing updates\n"
3252 "time in seconds\n")
3253
paul718e3742002-12-13 20:15:29 +00003254/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003255static int
paulfd79ac92004-10-13 05:06:08 +00003256peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003257{
3258 int ret;
3259 struct peer *peer;
3260
3261 peer = peer_lookup_vty (vty, ip_str);
3262 if (! peer)
3263 return CMD_WARNING;
3264
3265 if (str)
3266 ret = peer_interface_set (peer, str);
3267 else
3268 ret = peer_interface_unset (peer);
3269
3270 return CMD_SUCCESS;
3271}
3272
3273DEFUN (neighbor_interface,
3274 neighbor_interface_cmd,
3275 NEIGHBOR_CMD "interface WORD",
3276 NEIGHBOR_STR
3277 NEIGHBOR_ADDR_STR
3278 "Interface\n"
3279 "Interface name\n")
3280{
3281 return peer_interface_vty (vty, argv[0], argv[1]);
3282}
3283
3284DEFUN (no_neighbor_interface,
3285 no_neighbor_interface_cmd,
3286 NO_NEIGHBOR_CMD "interface WORD",
3287 NO_STR
3288 NEIGHBOR_STR
3289 NEIGHBOR_ADDR_STR
3290 "Interface\n"
3291 "Interface name\n")
3292{
3293 return peer_interface_vty (vty, argv[0], NULL);
3294}
3295
3296/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003297static int
paulfd79ac92004-10-13 05:06:08 +00003298peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3299 afi_t afi, safi_t safi,
3300 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003301{
3302 int ret;
3303 struct peer *peer;
3304 int direct = FILTER_IN;
3305
3306 peer = peer_and_group_lookup_vty (vty, ip_str);
3307 if (! peer)
3308 return CMD_WARNING;
3309
3310 /* Check filter direction. */
3311 if (strncmp (direct_str, "i", 1) == 0)
3312 direct = FILTER_IN;
3313 else if (strncmp (direct_str, "o", 1) == 0)
3314 direct = FILTER_OUT;
3315
3316 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3317
3318 return bgp_vty_return (vty, ret);
3319}
3320
paul94f2b392005-06-28 12:44:16 +00003321static int
paulfd79ac92004-10-13 05:06:08 +00003322peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3323 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003324{
3325 int ret;
3326 struct peer *peer;
3327 int direct = FILTER_IN;
3328
3329 peer = peer_and_group_lookup_vty (vty, ip_str);
3330 if (! peer)
3331 return CMD_WARNING;
3332
3333 /* Check filter direction. */
3334 if (strncmp (direct_str, "i", 1) == 0)
3335 direct = FILTER_IN;
3336 else if (strncmp (direct_str, "o", 1) == 0)
3337 direct = FILTER_OUT;
3338
3339 ret = peer_distribute_unset (peer, afi, safi, direct);
3340
3341 return bgp_vty_return (vty, ret);
3342}
3343
3344DEFUN (neighbor_distribute_list,
3345 neighbor_distribute_list_cmd,
3346 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3347 NEIGHBOR_STR
3348 NEIGHBOR_ADDR_STR2
3349 "Filter updates to/from this neighbor\n"
3350 "IP access-list number\n"
3351 "IP access-list number (expanded range)\n"
3352 "IP Access-list name\n"
3353 "Filter incoming updates\n"
3354 "Filter outgoing updates\n")
3355{
3356 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3357 bgp_node_safi (vty), argv[1], argv[2]);
3358}
3359
3360DEFUN (no_neighbor_distribute_list,
3361 no_neighbor_distribute_list_cmd,
3362 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3363 NO_STR
3364 NEIGHBOR_STR
3365 NEIGHBOR_ADDR_STR2
3366 "Filter updates to/from this neighbor\n"
3367 "IP access-list number\n"
3368 "IP access-list number (expanded range)\n"
3369 "IP Access-list name\n"
3370 "Filter incoming updates\n"
3371 "Filter outgoing updates\n")
3372{
3373 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3374 bgp_node_safi (vty), argv[2]);
3375}
3376
3377/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003378static int
paulfd79ac92004-10-13 05:06:08 +00003379peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3380 safi_t safi, const char *name_str,
3381 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003382{
3383 int ret;
3384 struct peer *peer;
3385 int direct = FILTER_IN;
3386
3387 peer = peer_and_group_lookup_vty (vty, ip_str);
3388 if (! peer)
3389 return CMD_WARNING;
3390
3391 /* Check filter direction. */
3392 if (strncmp (direct_str, "i", 1) == 0)
3393 direct = FILTER_IN;
3394 else if (strncmp (direct_str, "o", 1) == 0)
3395 direct = FILTER_OUT;
3396
3397 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3398
3399 return bgp_vty_return (vty, ret);
3400}
3401
paul94f2b392005-06-28 12:44:16 +00003402static int
paulfd79ac92004-10-13 05:06:08 +00003403peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3404 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003405{
3406 int ret;
3407 struct peer *peer;
3408 int direct = FILTER_IN;
3409
3410 peer = peer_and_group_lookup_vty (vty, ip_str);
3411 if (! peer)
3412 return CMD_WARNING;
3413
3414 /* Check filter direction. */
3415 if (strncmp (direct_str, "i", 1) == 0)
3416 direct = FILTER_IN;
3417 else if (strncmp (direct_str, "o", 1) == 0)
3418 direct = FILTER_OUT;
3419
3420 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3421
3422 return bgp_vty_return (vty, ret);
3423}
3424
3425DEFUN (neighbor_prefix_list,
3426 neighbor_prefix_list_cmd,
3427 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3428 NEIGHBOR_STR
3429 NEIGHBOR_ADDR_STR2
3430 "Filter updates to/from this neighbor\n"
3431 "Name of a prefix list\n"
3432 "Filter incoming updates\n"
3433 "Filter outgoing updates\n")
3434{
3435 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3436 bgp_node_safi (vty), argv[1], argv[2]);
3437}
3438
3439DEFUN (no_neighbor_prefix_list,
3440 no_neighbor_prefix_list_cmd,
3441 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3442 NO_STR
3443 NEIGHBOR_STR
3444 NEIGHBOR_ADDR_STR2
3445 "Filter updates to/from this neighbor\n"
3446 "Name of a prefix list\n"
3447 "Filter incoming updates\n"
3448 "Filter outgoing updates\n")
3449{
3450 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3451 bgp_node_safi (vty), argv[2]);
3452}
3453
paul94f2b392005-06-28 12:44:16 +00003454static int
paulfd79ac92004-10-13 05:06:08 +00003455peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3456 afi_t afi, safi_t safi,
3457 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003458{
3459 int ret;
3460 struct peer *peer;
3461 int direct = FILTER_IN;
3462
3463 peer = peer_and_group_lookup_vty (vty, ip_str);
3464 if (! peer)
3465 return CMD_WARNING;
3466
3467 /* Check filter direction. */
3468 if (strncmp (direct_str, "i", 1) == 0)
3469 direct = FILTER_IN;
3470 else if (strncmp (direct_str, "o", 1) == 0)
3471 direct = FILTER_OUT;
3472
3473 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3474
3475 return bgp_vty_return (vty, ret);
3476}
3477
paul94f2b392005-06-28 12:44:16 +00003478static int
paulfd79ac92004-10-13 05:06:08 +00003479peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3480 afi_t afi, safi_t safi,
3481 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003482{
3483 int ret;
3484 struct peer *peer;
3485 int direct = FILTER_IN;
3486
3487 peer = peer_and_group_lookup_vty (vty, ip_str);
3488 if (! peer)
3489 return CMD_WARNING;
3490
3491 /* Check filter direction. */
3492 if (strncmp (direct_str, "i", 1) == 0)
3493 direct = FILTER_IN;
3494 else if (strncmp (direct_str, "o", 1) == 0)
3495 direct = FILTER_OUT;
3496
3497 ret = peer_aslist_unset (peer, afi, safi, direct);
3498
3499 return bgp_vty_return (vty, ret);
3500}
3501
3502DEFUN (neighbor_filter_list,
3503 neighbor_filter_list_cmd,
3504 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3505 NEIGHBOR_STR
3506 NEIGHBOR_ADDR_STR2
3507 "Establish BGP filters\n"
3508 "AS path access-list name\n"
3509 "Filter incoming routes\n"
3510 "Filter outgoing routes\n")
3511{
3512 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3513 bgp_node_safi (vty), argv[1], argv[2]);
3514}
3515
3516DEFUN (no_neighbor_filter_list,
3517 no_neighbor_filter_list_cmd,
3518 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3519 NO_STR
3520 NEIGHBOR_STR
3521 NEIGHBOR_ADDR_STR2
3522 "Establish BGP filters\n"
3523 "AS path access-list name\n"
3524 "Filter incoming routes\n"
3525 "Filter outgoing routes\n")
3526{
3527 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3528 bgp_node_safi (vty), argv[2]);
3529}
3530
3531/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003532static int
paulfd79ac92004-10-13 05:06:08 +00003533peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3534 afi_t afi, safi_t safi,
3535 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003536{
3537 int ret;
3538 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003539 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003540
3541 peer = peer_and_group_lookup_vty (vty, ip_str);
3542 if (! peer)
3543 return CMD_WARNING;
3544
3545 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003546 if (strncmp (direct_str, "in", 2) == 0)
3547 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003548 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003549 direct = RMAP_OUT;
3550 else if (strncmp (direct_str, "im", 2) == 0)
3551 direct = RMAP_IMPORT;
3552 else if (strncmp (direct_str, "e", 1) == 0)
3553 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003554
3555 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3556
3557 return bgp_vty_return (vty, ret);
3558}
3559
paul94f2b392005-06-28 12:44:16 +00003560static int
paulfd79ac92004-10-13 05:06:08 +00003561peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3562 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003563{
3564 int ret;
3565 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003566 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003567
3568 peer = peer_and_group_lookup_vty (vty, ip_str);
3569 if (! peer)
3570 return CMD_WARNING;
3571
3572 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003573 if (strncmp (direct_str, "in", 2) == 0)
3574 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003575 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003576 direct = RMAP_OUT;
3577 else if (strncmp (direct_str, "im", 2) == 0)
3578 direct = RMAP_IMPORT;
3579 else if (strncmp (direct_str, "e", 1) == 0)
3580 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003581
3582 ret = peer_route_map_unset (peer, afi, safi, direct);
3583
3584 return bgp_vty_return (vty, ret);
3585}
3586
3587DEFUN (neighbor_route_map,
3588 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003589 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003590 NEIGHBOR_STR
3591 NEIGHBOR_ADDR_STR2
3592 "Apply route map to neighbor\n"
3593 "Name of route map\n"
3594 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003595 "Apply map to outbound routes\n"
3596 "Apply map to routes going into a Route-Server client's table\n"
3597 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003598{
3599 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3600 bgp_node_safi (vty), argv[1], argv[2]);
3601}
3602
3603DEFUN (no_neighbor_route_map,
3604 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003605 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003606 NO_STR
3607 NEIGHBOR_STR
3608 NEIGHBOR_ADDR_STR2
3609 "Apply route map to neighbor\n"
3610 "Name of route map\n"
3611 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003612 "Apply map to outbound routes\n"
3613 "Apply map to routes going into a Route-Server client's table\n"
3614 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003615{
3616 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3617 bgp_node_safi (vty), argv[2]);
3618}
3619
3620/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003621static int
paulfd79ac92004-10-13 05:06:08 +00003622peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3623 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003624{
3625 int ret;
3626 struct peer *peer;
3627
3628 peer = peer_and_group_lookup_vty (vty, ip_str);
3629 if (! peer)
3630 return CMD_WARNING;
3631
3632 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3633
3634 return bgp_vty_return (vty, ret);
3635}
3636
3637/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003638static int
paulfd79ac92004-10-13 05:06:08 +00003639peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003640 safi_t safi)
3641{
3642 int ret;
3643 struct peer *peer;
3644
3645 peer = peer_and_group_lookup_vty (vty, ip_str);
3646 if (! peer)
3647 return CMD_WARNING;
3648
3649 ret = peer_unsuppress_map_unset (peer, afi, safi);
3650
3651 return bgp_vty_return (vty, ret);
3652}
3653
3654DEFUN (neighbor_unsuppress_map,
3655 neighbor_unsuppress_map_cmd,
3656 NEIGHBOR_CMD2 "unsuppress-map WORD",
3657 NEIGHBOR_STR
3658 NEIGHBOR_ADDR_STR2
3659 "Route-map to selectively unsuppress suppressed routes\n"
3660 "Name of route map\n")
3661{
3662 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3663 bgp_node_safi (vty), argv[1]);
3664}
3665
3666DEFUN (no_neighbor_unsuppress_map,
3667 no_neighbor_unsuppress_map_cmd,
3668 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3669 NO_STR
3670 NEIGHBOR_STR
3671 NEIGHBOR_ADDR_STR2
3672 "Route-map to selectively unsuppress suppressed routes\n"
3673 "Name of route map\n")
3674{
3675 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3676 bgp_node_safi (vty));
3677}
3678
paul94f2b392005-06-28 12:44:16 +00003679static int
paulfd79ac92004-10-13 05:06:08 +00003680peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3681 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003682 const char *threshold_str, int warning,
3683 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003684{
3685 int ret;
3686 struct peer *peer;
3687 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003688 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003689 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003690
3691 peer = peer_and_group_lookup_vty (vty, ip_str);
3692 if (! peer)
3693 return CMD_WARNING;
3694
3695 VTY_GET_INTEGER ("maxmum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003696 if (threshold_str)
3697 threshold = atoi (threshold_str);
3698 else
3699 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00003700
hasso0a486e52005-02-01 20:57:17 +00003701 if (restart_str)
3702 restart = atoi (restart_str);
3703 else
3704 restart = 0;
3705
3706 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00003707
3708 return bgp_vty_return (vty, ret);
3709}
3710
paul94f2b392005-06-28 12:44:16 +00003711static int
paulfd79ac92004-10-13 05:06:08 +00003712peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003713 safi_t safi)
3714{
3715 int ret;
3716 struct peer *peer;
3717
3718 peer = peer_and_group_lookup_vty (vty, ip_str);
3719 if (! peer)
3720 return CMD_WARNING;
3721
3722 ret = peer_maximum_prefix_unset (peer, afi, safi);
3723
3724 return bgp_vty_return (vty, ret);
3725}
3726
3727/* Maximum number of prefix configuration. prefix count is different
3728 for each peer configuration. So this configuration can be set for
3729 each peer configuration. */
3730DEFUN (neighbor_maximum_prefix,
3731 neighbor_maximum_prefix_cmd,
3732 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3733 NEIGHBOR_STR
3734 NEIGHBOR_ADDR_STR2
3735 "Maximum number of prefix accept from this peer\n"
3736 "maximum no. of prefix limit\n")
3737{
3738 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003739 bgp_node_safi (vty), argv[1], NULL, 0,
3740 NULL);
paul718e3742002-12-13 20:15:29 +00003741}
3742
hassoe0701b72004-05-20 09:19:34 +00003743DEFUN (neighbor_maximum_prefix_threshold,
3744 neighbor_maximum_prefix_threshold_cmd,
3745 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
3746 NEIGHBOR_STR
3747 NEIGHBOR_ADDR_STR2
3748 "Maximum number of prefix accept from this peer\n"
3749 "maximum no. of prefix limit\n"
3750 "Threshold value (%) at which to generate a warning msg\n")
3751{
3752 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003753 bgp_node_safi (vty), argv[1], argv[2], 0,
3754 NULL);
3755}
hassoe0701b72004-05-20 09:19:34 +00003756
paul718e3742002-12-13 20:15:29 +00003757DEFUN (neighbor_maximum_prefix_warning,
3758 neighbor_maximum_prefix_warning_cmd,
3759 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3760 NEIGHBOR_STR
3761 NEIGHBOR_ADDR_STR2
3762 "Maximum number of prefix accept from this peer\n"
3763 "maximum no. of prefix limit\n"
3764 "Only give warning message when limit is exceeded\n")
3765{
3766 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003767 bgp_node_safi (vty), argv[1], NULL, 1,
3768 NULL);
paul718e3742002-12-13 20:15:29 +00003769}
3770
hassoe0701b72004-05-20 09:19:34 +00003771DEFUN (neighbor_maximum_prefix_threshold_warning,
3772 neighbor_maximum_prefix_threshold_warning_cmd,
3773 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
3774 NEIGHBOR_STR
3775 NEIGHBOR_ADDR_STR2
3776 "Maximum number of prefix accept from this peer\n"
3777 "maximum no. of prefix limit\n"
3778 "Threshold value (%) at which to generate a warning msg\n"
3779 "Only give warning message when limit is exceeded\n")
3780{
3781 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003782 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
3783}
3784
3785DEFUN (neighbor_maximum_prefix_restart,
3786 neighbor_maximum_prefix_restart_cmd,
3787 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
3788 NEIGHBOR_STR
3789 NEIGHBOR_ADDR_STR2
3790 "Maximum number of prefix accept from this peer\n"
3791 "maximum no. of prefix limit\n"
3792 "Restart bgp connection after limit is exceeded\n"
3793 "Restart interval in minutes")
3794{
3795 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3796 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
3797}
3798
3799DEFUN (neighbor_maximum_prefix_threshold_restart,
3800 neighbor_maximum_prefix_threshold_restart_cmd,
3801 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
3802 NEIGHBOR_STR
3803 NEIGHBOR_ADDR_STR2
3804 "Maximum number of prefix accept from this peer\n"
3805 "maximum no. of prefix limit\n"
3806 "Threshold value (%) at which to generate a warning msg\n"
3807 "Restart bgp connection after limit is exceeded\n"
3808 "Restart interval in minutes")
3809{
3810 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3811 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
3812}
hassoe0701b72004-05-20 09:19:34 +00003813
paul718e3742002-12-13 20:15:29 +00003814DEFUN (no_neighbor_maximum_prefix,
3815 no_neighbor_maximum_prefix_cmd,
3816 NO_NEIGHBOR_CMD2 "maximum-prefix",
3817 NO_STR
3818 NEIGHBOR_STR
3819 NEIGHBOR_ADDR_STR2
3820 "Maximum number of prefix accept from this peer\n")
3821{
3822 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
3823 bgp_node_safi (vty));
3824}
3825
3826ALIAS (no_neighbor_maximum_prefix,
3827 no_neighbor_maximum_prefix_val_cmd,
3828 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3829 NO_STR
3830 NEIGHBOR_STR
3831 NEIGHBOR_ADDR_STR2
3832 "Maximum number of prefix accept from this peer\n"
3833 "maximum no. of prefix limit\n")
3834
3835ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00003836 no_neighbor_maximum_prefix_threshold_cmd,
3837 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3838 NO_STR
3839 NEIGHBOR_STR
3840 NEIGHBOR_ADDR_STR2
3841 "Maximum number of prefix accept from this peer\n"
3842 "maximum no. of prefix limit\n"
3843 "Threshold value (%) at which to generate a warning msg\n")
3844
3845ALIAS (no_neighbor_maximum_prefix,
3846 no_neighbor_maximum_prefix_warning_cmd,
3847 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3848 NO_STR
3849 NEIGHBOR_STR
3850 NEIGHBOR_ADDR_STR2
3851 "Maximum number of prefix accept from this peer\n"
3852 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00003853 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00003854
3855ALIAS (no_neighbor_maximum_prefix,
3856 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00003857 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
3858 NO_STR
3859 NEIGHBOR_STR
3860 NEIGHBOR_ADDR_STR2
3861 "Maximum number of prefix accept from this peer\n"
3862 "maximum no. of prefix limit\n"
3863 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00003864 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00003865
3866ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00003867 no_neighbor_maximum_prefix_restart_cmd,
3868 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00003869 NO_STR
3870 NEIGHBOR_STR
3871 NEIGHBOR_ADDR_STR2
3872 "Maximum number of prefix accept from this peer\n"
3873 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00003874 "Restart bgp connection after limit is exceeded\n"
3875 "Restart interval in minutes")
3876
3877ALIAS (no_neighbor_maximum_prefix,
3878 no_neighbor_maximum_prefix_threshold_restart_cmd,
3879 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
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"
3886 "Restart bgp connection after limit is exceeded\n"
3887 "Restart interval in minutes")
paul718e3742002-12-13 20:15:29 +00003888
3889/* "neighbor allowas-in" */
3890DEFUN (neighbor_allowas_in,
3891 neighbor_allowas_in_cmd,
3892 NEIGHBOR_CMD2 "allowas-in",
3893 NEIGHBOR_STR
3894 NEIGHBOR_ADDR_STR2
3895 "Accept as-path with my AS present in it\n")
3896{
3897 int ret;
3898 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00003899 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00003900
3901 peer = peer_and_group_lookup_vty (vty, argv[0]);
3902 if (! peer)
3903 return CMD_WARNING;
3904
3905 if (argc == 1)
3906 allow_num = 3;
3907 else
3908 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
3909
3910 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
3911 allow_num);
3912
3913 return bgp_vty_return (vty, ret);
3914}
3915
3916ALIAS (neighbor_allowas_in,
3917 neighbor_allowas_in_arg_cmd,
3918 NEIGHBOR_CMD2 "allowas-in <1-10>",
3919 NEIGHBOR_STR
3920 NEIGHBOR_ADDR_STR2
3921 "Accept as-path with my AS present in it\n"
3922 "Number of occurances of AS number\n")
3923
3924DEFUN (no_neighbor_allowas_in,
3925 no_neighbor_allowas_in_cmd,
3926 NO_NEIGHBOR_CMD2 "allowas-in",
3927 NO_STR
3928 NEIGHBOR_STR
3929 NEIGHBOR_ADDR_STR2
3930 "allow local ASN appears in aspath attribute\n")
3931{
3932 int ret;
3933 struct peer *peer;
3934
3935 peer = peer_and_group_lookup_vty (vty, argv[0]);
3936 if (! peer)
3937 return CMD_WARNING;
3938
3939 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
3940
3941 return bgp_vty_return (vty, ret);
3942}
3943
3944/* Address family configuration. */
3945DEFUN (address_family_ipv4,
3946 address_family_ipv4_cmd,
3947 "address-family ipv4",
3948 "Enter Address Family command mode\n"
3949 "Address family\n")
3950{
3951 vty->node = BGP_IPV4_NODE;
3952 return CMD_SUCCESS;
3953}
3954
3955DEFUN (address_family_ipv4_safi,
3956 address_family_ipv4_safi_cmd,
3957 "address-family ipv4 (unicast|multicast)",
3958 "Enter Address Family command mode\n"
3959 "Address family\n"
3960 "Address Family modifier\n"
3961 "Address Family modifier\n")
3962{
3963 if (strncmp (argv[0], "m", 1) == 0)
3964 vty->node = BGP_IPV4M_NODE;
3965 else
3966 vty->node = BGP_IPV4_NODE;
3967
3968 return CMD_SUCCESS;
3969}
3970
paul25ffbdc2005-08-22 22:42:08 +00003971DEFUN (address_family_ipv6,
3972 address_family_ipv6_cmd,
3973 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00003974 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00003975 "Address family\n")
paul718e3742002-12-13 20:15:29 +00003976{
3977 vty->node = BGP_IPV6_NODE;
3978 return CMD_SUCCESS;
3979}
3980
paul25ffbdc2005-08-22 22:42:08 +00003981DEFUN (address_family_ipv6_safi,
3982 address_family_ipv6_safi_cmd,
3983 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00003984 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00003985 "Address family\n"
3986 "Address Family modifier\n"
3987 "Address Family modifier\n")
3988{
3989 if (strncmp (argv[0], "m", 1) == 0)
3990 vty->node = BGP_IPV6M_NODE;
3991 else
3992 vty->node = BGP_IPV6_NODE;
3993
3994 return CMD_SUCCESS;
3995}
paul718e3742002-12-13 20:15:29 +00003996
3997DEFUN (address_family_vpnv4,
3998 address_family_vpnv4_cmd,
3999 "address-family vpnv4",
4000 "Enter Address Family command mode\n"
4001 "Address family\n")
4002{
4003 vty->node = BGP_VPNV4_NODE;
4004 return CMD_SUCCESS;
4005}
4006
4007ALIAS (address_family_vpnv4,
4008 address_family_vpnv4_unicast_cmd,
4009 "address-family vpnv4 unicast",
4010 "Enter Address Family command mode\n"
4011 "Address family\n"
4012 "Address Family Modifier\n")
4013
4014DEFUN (exit_address_family,
4015 exit_address_family_cmd,
4016 "exit-address-family",
4017 "Exit from Address Family configuration mode\n")
4018{
hassoa8a80d52005-04-09 13:07:47 +00004019 if (vty->node == BGP_IPV4_NODE
4020 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004021 || vty->node == BGP_VPNV4_NODE
paul25ffbdc2005-08-22 22:42:08 +00004022 || vty->node == BGP_IPV6_NODE
4023 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004024 vty->node = BGP_NODE;
4025 return CMD_SUCCESS;
4026}
4027
4028/* BGP clear sort. */
4029enum clear_sort
4030{
4031 clear_all,
4032 clear_peer,
4033 clear_group,
4034 clear_external,
4035 clear_as
4036};
4037
paul94f2b392005-06-28 12:44:16 +00004038static void
paul718e3742002-12-13 20:15:29 +00004039bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4040 safi_t safi, int error)
4041{
4042 switch (error)
4043 {
4044 case BGP_ERR_AF_UNCONFIGURED:
4045 vty_out (vty,
4046 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4047 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4048 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4049 peer->host, VTY_NEWLINE);
4050 break;
4051 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4052 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);
4053 break;
4054 default:
4055 break;
4056 }
4057}
4058
4059/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004060static int
paul718e3742002-12-13 20:15:29 +00004061bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004062 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004063{
4064 int ret;
4065 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004066 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004067
4068 /* Clear all neighbors. */
4069 if (sort == clear_all)
4070 {
paul1eb8ef22005-04-07 07:30:20 +00004071 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004072 {
4073 if (stype == BGP_CLEAR_SOFT_NONE)
4074 ret = peer_clear (peer);
4075 else
4076 ret = peer_clear_soft (peer, afi, safi, stype);
4077
4078 if (ret < 0)
4079 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4080 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004081 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004082 }
4083
4084 /* Clear specified neighbors. */
4085 if (sort == clear_peer)
4086 {
4087 union sockunion su;
4088 int ret;
4089
4090 /* Make sockunion for lookup. */
4091 ret = str2sockunion (arg, &su);
4092 if (ret < 0)
4093 {
4094 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004095 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004096 }
4097 peer = peer_lookup (bgp, &su);
4098 if (! peer)
4099 {
4100 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004101 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004102 }
4103
4104 if (stype == BGP_CLEAR_SOFT_NONE)
4105 ret = peer_clear (peer);
4106 else
4107 ret = peer_clear_soft (peer, afi, safi, stype);
4108
4109 if (ret < 0)
4110 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4111
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004112 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004113 }
4114
4115 /* Clear all peer-group members. */
4116 if (sort == clear_group)
4117 {
4118 struct peer_group *group;
4119
4120 group = peer_group_lookup (bgp, arg);
4121 if (! group)
4122 {
4123 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004124 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004125 }
4126
paul1eb8ef22005-04-07 07:30:20 +00004127 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004128 {
4129 if (stype == BGP_CLEAR_SOFT_NONE)
4130 {
4131 ret = peer_clear (peer);
4132 continue;
4133 }
4134
4135 if (! peer->af_group[afi][safi])
4136 continue;
4137
4138 ret = peer_clear_soft (peer, afi, safi, stype);
4139
4140 if (ret < 0)
4141 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4142 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004143 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004144 }
4145
4146 if (sort == clear_external)
4147 {
paul1eb8ef22005-04-07 07:30:20 +00004148 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004149 {
4150 if (peer_sort (peer) == BGP_PEER_IBGP)
4151 continue;
4152
4153 if (stype == BGP_CLEAR_SOFT_NONE)
4154 ret = peer_clear (peer);
4155 else
4156 ret = peer_clear_soft (peer, afi, safi, stype);
4157
4158 if (ret < 0)
4159 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4160 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004161 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004162 }
4163
4164 if (sort == clear_as)
4165 {
4166 as_t as;
4167 unsigned long as_ul;
paul718e3742002-12-13 20:15:29 +00004168 int find = 0;
4169
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004170 VTY_GET_LONG ("AS", as_ul, arg);
4171
4172 if (!as_ul)
paul718e3742002-12-13 20:15:29 +00004173 {
4174 vty_out (vty, "Invalid AS number%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004175 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004176 }
4177 as = (as_t) as_ul;
4178
paul1eb8ef22005-04-07 07:30:20 +00004179 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004180 {
4181 if (peer->as != as)
4182 continue;
4183
4184 find = 1;
4185 if (stype == BGP_CLEAR_SOFT_NONE)
4186 ret = peer_clear (peer);
4187 else
4188 ret = peer_clear_soft (peer, afi, safi, stype);
4189
4190 if (ret < 0)
4191 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4192 }
4193 if (! find)
4194 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4195 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004196 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004197 }
4198
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004199 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004200}
4201
paul94f2b392005-06-28 12:44:16 +00004202static int
paulfd79ac92004-10-13 05:06:08 +00004203bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4204 enum clear_sort sort, enum bgp_clear_type stype,
4205 const char *arg)
paul718e3742002-12-13 20:15:29 +00004206{
paul718e3742002-12-13 20:15:29 +00004207 struct bgp *bgp;
4208
4209 /* BGP structure lookup. */
4210 if (name)
4211 {
4212 bgp = bgp_lookup_by_name (name);
4213 if (bgp == NULL)
4214 {
4215 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4216 return CMD_WARNING;
4217 }
4218 }
4219 else
4220 {
4221 bgp = bgp_get_default ();
4222 if (bgp == NULL)
4223 {
4224 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4225 return CMD_WARNING;
4226 }
4227 }
4228
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004229 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004230}
4231
4232DEFUN (clear_ip_bgp_all,
4233 clear_ip_bgp_all_cmd,
4234 "clear ip bgp *",
4235 CLEAR_STR
4236 IP_STR
4237 BGP_STR
4238 "Clear all peers\n")
4239{
4240 if (argc == 1)
4241 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4242
4243 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4244}
4245
4246ALIAS (clear_ip_bgp_all,
4247 clear_bgp_all_cmd,
4248 "clear bgp *",
4249 CLEAR_STR
4250 BGP_STR
4251 "Clear all peers\n")
4252
4253ALIAS (clear_ip_bgp_all,
4254 clear_bgp_ipv6_all_cmd,
4255 "clear bgp ipv6 *",
4256 CLEAR_STR
4257 BGP_STR
4258 "Address family\n"
4259 "Clear all peers\n")
4260
4261ALIAS (clear_ip_bgp_all,
4262 clear_ip_bgp_instance_all_cmd,
4263 "clear ip bgp view WORD *",
4264 CLEAR_STR
4265 IP_STR
4266 BGP_STR
4267 "BGP view\n"
4268 "view name\n"
4269 "Clear all peers\n")
4270
4271ALIAS (clear_ip_bgp_all,
4272 clear_bgp_instance_all_cmd,
4273 "clear bgp view WORD *",
4274 CLEAR_STR
4275 BGP_STR
4276 "BGP view\n"
4277 "view name\n"
4278 "Clear all peers\n")
4279
4280DEFUN (clear_ip_bgp_peer,
4281 clear_ip_bgp_peer_cmd,
4282 "clear ip bgp (A.B.C.D|X:X::X:X)",
4283 CLEAR_STR
4284 IP_STR
4285 BGP_STR
4286 "BGP neighbor IP address to clear\n"
4287 "BGP IPv6 neighbor to clear\n")
4288{
4289 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4290}
4291
4292ALIAS (clear_ip_bgp_peer,
4293 clear_bgp_peer_cmd,
4294 "clear bgp (A.B.C.D|X:X::X:X)",
4295 CLEAR_STR
4296 BGP_STR
4297 "BGP neighbor address to clear\n"
4298 "BGP IPv6 neighbor to clear\n")
4299
4300ALIAS (clear_ip_bgp_peer,
4301 clear_bgp_ipv6_peer_cmd,
4302 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4303 CLEAR_STR
4304 BGP_STR
4305 "Address family\n"
4306 "BGP neighbor address to clear\n"
4307 "BGP IPv6 neighbor to clear\n")
4308
4309DEFUN (clear_ip_bgp_peer_group,
4310 clear_ip_bgp_peer_group_cmd,
4311 "clear ip bgp peer-group WORD",
4312 CLEAR_STR
4313 IP_STR
4314 BGP_STR
4315 "Clear all members of peer-group\n"
4316 "BGP peer-group name\n")
4317{
4318 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4319}
4320
4321ALIAS (clear_ip_bgp_peer_group,
4322 clear_bgp_peer_group_cmd,
4323 "clear bgp peer-group WORD",
4324 CLEAR_STR
4325 BGP_STR
4326 "Clear all members of peer-group\n"
4327 "BGP peer-group name\n")
4328
4329ALIAS (clear_ip_bgp_peer_group,
4330 clear_bgp_ipv6_peer_group_cmd,
4331 "clear bgp ipv6 peer-group WORD",
4332 CLEAR_STR
4333 BGP_STR
4334 "Address family\n"
4335 "Clear all members of peer-group\n"
4336 "BGP peer-group name\n")
4337
4338DEFUN (clear_ip_bgp_external,
4339 clear_ip_bgp_external_cmd,
4340 "clear ip bgp external",
4341 CLEAR_STR
4342 IP_STR
4343 BGP_STR
4344 "Clear all external peers\n")
4345{
4346 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4347}
4348
4349ALIAS (clear_ip_bgp_external,
4350 clear_bgp_external_cmd,
4351 "clear bgp external",
4352 CLEAR_STR
4353 BGP_STR
4354 "Clear all external peers\n")
4355
4356ALIAS (clear_ip_bgp_external,
4357 clear_bgp_ipv6_external_cmd,
4358 "clear bgp ipv6 external",
4359 CLEAR_STR
4360 BGP_STR
4361 "Address family\n"
4362 "Clear all external peers\n")
4363
4364DEFUN (clear_ip_bgp_as,
4365 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004366 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004367 CLEAR_STR
4368 IP_STR
4369 BGP_STR
4370 "Clear peers with the AS number\n")
4371{
4372 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4373}
4374
4375ALIAS (clear_ip_bgp_as,
4376 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004377 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004378 CLEAR_STR
4379 BGP_STR
4380 "Clear peers with the AS number\n")
4381
4382ALIAS (clear_ip_bgp_as,
4383 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004384 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004385 CLEAR_STR
4386 BGP_STR
4387 "Address family\n"
4388 "Clear peers with the AS number\n")
4389
4390/* Outbound soft-reconfiguration */
4391DEFUN (clear_ip_bgp_all_soft_out,
4392 clear_ip_bgp_all_soft_out_cmd,
4393 "clear ip bgp * soft out",
4394 CLEAR_STR
4395 IP_STR
4396 BGP_STR
4397 "Clear all peers\n"
4398 "Soft reconfig\n"
4399 "Soft reconfig outbound update\n")
4400{
4401 if (argc == 1)
4402 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4403 BGP_CLEAR_SOFT_OUT, NULL);
4404
4405 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4406 BGP_CLEAR_SOFT_OUT, NULL);
4407}
4408
4409ALIAS (clear_ip_bgp_all_soft_out,
4410 clear_ip_bgp_all_out_cmd,
4411 "clear ip bgp * out",
4412 CLEAR_STR
4413 IP_STR
4414 BGP_STR
4415 "Clear all peers\n"
4416 "Soft reconfig outbound update\n")
4417
4418ALIAS (clear_ip_bgp_all_soft_out,
4419 clear_ip_bgp_instance_all_soft_out_cmd,
4420 "clear ip bgp view WORD * soft out",
4421 CLEAR_STR
4422 IP_STR
4423 BGP_STR
4424 "BGP view\n"
4425 "view name\n"
4426 "Clear all peers\n"
4427 "Soft reconfig\n"
4428 "Soft reconfig outbound update\n")
4429
4430DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4431 clear_ip_bgp_all_ipv4_soft_out_cmd,
4432 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4433 CLEAR_STR
4434 IP_STR
4435 BGP_STR
4436 "Clear all peers\n"
4437 "Address family\n"
4438 "Address Family modifier\n"
4439 "Address Family modifier\n"
4440 "Soft reconfig\n"
4441 "Soft reconfig outbound update\n")
4442{
4443 if (strncmp (argv[0], "m", 1) == 0)
4444 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4445 BGP_CLEAR_SOFT_OUT, NULL);
4446
4447 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4448 BGP_CLEAR_SOFT_OUT, NULL);
4449}
4450
4451ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4452 clear_ip_bgp_all_ipv4_out_cmd,
4453 "clear ip bgp * ipv4 (unicast|multicast) out",
4454 CLEAR_STR
4455 IP_STR
4456 BGP_STR
4457 "Clear all peers\n"
4458 "Address family\n"
4459 "Address Family modifier\n"
4460 "Address Family modifier\n"
4461 "Soft reconfig outbound update\n")
4462
4463DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4464 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4465 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4466 CLEAR_STR
4467 IP_STR
4468 BGP_STR
4469 "BGP view\n"
4470 "view name\n"
4471 "Clear all peers\n"
4472 "Address family\n"
4473 "Address Family modifier\n"
4474 "Address Family modifier\n"
4475 "Soft reconfig outbound update\n")
4476{
4477 if (strncmp (argv[1], "m", 1) == 0)
4478 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4479 BGP_CLEAR_SOFT_OUT, NULL);
4480
4481 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4482 BGP_CLEAR_SOFT_OUT, NULL);
4483}
4484
4485DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4486 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4487 "clear ip bgp * vpnv4 unicast soft out",
4488 CLEAR_STR
4489 IP_STR
4490 BGP_STR
4491 "Clear all peers\n"
4492 "Address family\n"
4493 "Address Family Modifier\n"
4494 "Soft reconfig\n"
4495 "Soft reconfig outbound update\n")
4496{
4497 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4498 BGP_CLEAR_SOFT_OUT, NULL);
4499}
4500
4501ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4502 clear_ip_bgp_all_vpnv4_out_cmd,
4503 "clear ip bgp * vpnv4 unicast out",
4504 CLEAR_STR
4505 IP_STR
4506 BGP_STR
4507 "Clear all peers\n"
4508 "Address family\n"
4509 "Address Family Modifier\n"
4510 "Soft reconfig outbound update\n")
4511
4512DEFUN (clear_bgp_all_soft_out,
4513 clear_bgp_all_soft_out_cmd,
4514 "clear bgp * soft out",
4515 CLEAR_STR
4516 BGP_STR
4517 "Clear all peers\n"
4518 "Soft reconfig\n"
4519 "Soft reconfig outbound update\n")
4520{
4521 if (argc == 1)
4522 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4523 BGP_CLEAR_SOFT_OUT, NULL);
4524
4525 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4526 BGP_CLEAR_SOFT_OUT, NULL);
4527}
4528
4529ALIAS (clear_bgp_all_soft_out,
4530 clear_bgp_instance_all_soft_out_cmd,
4531 "clear bgp view WORD * soft out",
4532 CLEAR_STR
4533 BGP_STR
4534 "BGP view\n"
4535 "view name\n"
4536 "Clear all peers\n"
4537 "Soft reconfig\n"
4538 "Soft reconfig outbound update\n")
4539
4540ALIAS (clear_bgp_all_soft_out,
4541 clear_bgp_all_out_cmd,
4542 "clear bgp * out",
4543 CLEAR_STR
4544 BGP_STR
4545 "Clear all peers\n"
4546 "Soft reconfig outbound update\n")
4547
4548ALIAS (clear_bgp_all_soft_out,
4549 clear_bgp_ipv6_all_soft_out_cmd,
4550 "clear bgp ipv6 * soft out",
4551 CLEAR_STR
4552 BGP_STR
4553 "Address family\n"
4554 "Clear all peers\n"
4555 "Soft reconfig\n"
4556 "Soft reconfig outbound update\n")
4557
4558ALIAS (clear_bgp_all_soft_out,
4559 clear_bgp_ipv6_all_out_cmd,
4560 "clear bgp ipv6 * out",
4561 CLEAR_STR
4562 BGP_STR
4563 "Address family\n"
4564 "Clear all peers\n"
4565 "Soft reconfig outbound update\n")
4566
4567DEFUN (clear_ip_bgp_peer_soft_out,
4568 clear_ip_bgp_peer_soft_out_cmd,
4569 "clear ip bgp A.B.C.D soft out",
4570 CLEAR_STR
4571 IP_STR
4572 BGP_STR
4573 "BGP neighbor address to clear\n"
4574 "Soft reconfig\n"
4575 "Soft reconfig outbound update\n")
4576{
4577 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4578 BGP_CLEAR_SOFT_OUT, argv[0]);
4579}
4580
4581ALIAS (clear_ip_bgp_peer_soft_out,
4582 clear_ip_bgp_peer_out_cmd,
4583 "clear ip bgp A.B.C.D out",
4584 CLEAR_STR
4585 IP_STR
4586 BGP_STR
4587 "BGP neighbor address to clear\n"
4588 "Soft reconfig outbound update\n")
4589
4590DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4591 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4592 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4593 CLEAR_STR
4594 IP_STR
4595 BGP_STR
4596 "BGP neighbor address to clear\n"
4597 "Address family\n"
4598 "Address Family modifier\n"
4599 "Address Family modifier\n"
4600 "Soft reconfig\n"
4601 "Soft reconfig outbound update\n")
4602{
4603 if (strncmp (argv[1], "m", 1) == 0)
4604 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4605 BGP_CLEAR_SOFT_OUT, argv[0]);
4606
4607 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4608 BGP_CLEAR_SOFT_OUT, argv[0]);
4609}
4610
4611ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
4612 clear_ip_bgp_peer_ipv4_out_cmd,
4613 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
4614 CLEAR_STR
4615 IP_STR
4616 BGP_STR
4617 "BGP neighbor address to clear\n"
4618 "Address family\n"
4619 "Address Family modifier\n"
4620 "Address Family modifier\n"
4621 "Soft reconfig outbound update\n")
4622
4623DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
4624 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
4625 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
4626 CLEAR_STR
4627 IP_STR
4628 BGP_STR
4629 "BGP neighbor address to clear\n"
4630 "Address family\n"
4631 "Address Family Modifier\n"
4632 "Soft reconfig\n"
4633 "Soft reconfig outbound update\n")
4634{
4635 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
4636 BGP_CLEAR_SOFT_OUT, argv[0]);
4637}
4638
4639ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
4640 clear_ip_bgp_peer_vpnv4_out_cmd,
4641 "clear ip bgp A.B.C.D vpnv4 unicast out",
4642 CLEAR_STR
4643 IP_STR
4644 BGP_STR
4645 "BGP neighbor address to clear\n"
4646 "Address family\n"
4647 "Address Family Modifier\n"
4648 "Soft reconfig outbound update\n")
4649
4650DEFUN (clear_bgp_peer_soft_out,
4651 clear_bgp_peer_soft_out_cmd,
4652 "clear bgp (A.B.C.D|X:X::X:X) soft out",
4653 CLEAR_STR
4654 BGP_STR
4655 "BGP neighbor address to clear\n"
4656 "BGP IPv6 neighbor to clear\n"
4657 "Soft reconfig\n"
4658 "Soft reconfig outbound update\n")
4659{
4660 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
4661 BGP_CLEAR_SOFT_OUT, argv[0]);
4662}
4663
4664ALIAS (clear_bgp_peer_soft_out,
4665 clear_bgp_ipv6_peer_soft_out_cmd,
4666 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
4667 CLEAR_STR
4668 BGP_STR
4669 "Address family\n"
4670 "BGP neighbor address to clear\n"
4671 "BGP IPv6 neighbor to clear\n"
4672 "Soft reconfig\n"
4673 "Soft reconfig outbound update\n")
4674
4675ALIAS (clear_bgp_peer_soft_out,
4676 clear_bgp_peer_out_cmd,
4677 "clear bgp (A.B.C.D|X:X::X:X) out",
4678 CLEAR_STR
4679 BGP_STR
4680 "BGP neighbor address to clear\n"
4681 "BGP IPv6 neighbor to clear\n"
4682 "Soft reconfig outbound update\n")
4683
4684ALIAS (clear_bgp_peer_soft_out,
4685 clear_bgp_ipv6_peer_out_cmd,
4686 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
4687 CLEAR_STR
4688 BGP_STR
4689 "Address family\n"
4690 "BGP neighbor address to clear\n"
4691 "BGP IPv6 neighbor to clear\n"
4692 "Soft reconfig outbound update\n")
4693
4694DEFUN (clear_ip_bgp_peer_group_soft_out,
4695 clear_ip_bgp_peer_group_soft_out_cmd,
4696 "clear ip bgp peer-group WORD soft out",
4697 CLEAR_STR
4698 IP_STR
4699 BGP_STR
4700 "Clear all members of peer-group\n"
4701 "BGP peer-group name\n"
4702 "Soft reconfig\n"
4703 "Soft reconfig outbound update\n")
4704{
4705 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4706 BGP_CLEAR_SOFT_OUT, argv[0]);
4707}
4708
4709ALIAS (clear_ip_bgp_peer_group_soft_out,
4710 clear_ip_bgp_peer_group_out_cmd,
4711 "clear ip bgp peer-group WORD out",
4712 CLEAR_STR
4713 IP_STR
4714 BGP_STR
4715 "Clear all members of peer-group\n"
4716 "BGP peer-group name\n"
4717 "Soft reconfig outbound update\n")
4718
4719DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
4720 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
4721 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
4722 CLEAR_STR
4723 IP_STR
4724 BGP_STR
4725 "Clear all members of peer-group\n"
4726 "BGP peer-group name\n"
4727 "Address family\n"
4728 "Address Family modifier\n"
4729 "Address Family modifier\n"
4730 "Soft reconfig\n"
4731 "Soft reconfig outbound update\n")
4732{
4733 if (strncmp (argv[1], "m", 1) == 0)
4734 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
4735 BGP_CLEAR_SOFT_OUT, argv[0]);
4736
4737 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4738 BGP_CLEAR_SOFT_OUT, argv[0]);
4739}
4740
4741ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
4742 clear_ip_bgp_peer_group_ipv4_out_cmd,
4743 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) 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 outbound update\n")
4753
4754DEFUN (clear_bgp_peer_group_soft_out,
4755 clear_bgp_peer_group_soft_out_cmd,
4756 "clear bgp peer-group WORD soft out",
4757 CLEAR_STR
4758 BGP_STR
4759 "Clear all members of peer-group\n"
4760 "BGP peer-group name\n"
4761 "Soft reconfig\n"
4762 "Soft reconfig outbound update\n")
4763{
4764 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
4765 BGP_CLEAR_SOFT_OUT, argv[0]);
4766}
4767
4768ALIAS (clear_bgp_peer_group_soft_out,
4769 clear_bgp_ipv6_peer_group_soft_out_cmd,
4770 "clear bgp ipv6 peer-group WORD soft out",
4771 CLEAR_STR
4772 BGP_STR
4773 "Address family\n"
4774 "Clear all members of peer-group\n"
4775 "BGP peer-group name\n"
4776 "Soft reconfig\n"
4777 "Soft reconfig outbound update\n")
4778
4779ALIAS (clear_bgp_peer_group_soft_out,
4780 clear_bgp_peer_group_out_cmd,
4781 "clear bgp peer-group WORD out",
4782 CLEAR_STR
4783 BGP_STR
4784 "Clear all members of peer-group\n"
4785 "BGP peer-group name\n"
4786 "Soft reconfig outbound update\n")
4787
4788ALIAS (clear_bgp_peer_group_soft_out,
4789 clear_bgp_ipv6_peer_group_out_cmd,
4790 "clear bgp ipv6 peer-group WORD out",
4791 CLEAR_STR
4792 BGP_STR
4793 "Address family\n"
4794 "Clear all members of peer-group\n"
4795 "BGP peer-group name\n"
4796 "Soft reconfig outbound update\n")
4797
4798DEFUN (clear_ip_bgp_external_soft_out,
4799 clear_ip_bgp_external_soft_out_cmd,
4800 "clear ip bgp external soft out",
4801 CLEAR_STR
4802 IP_STR
4803 BGP_STR
4804 "Clear all external peers\n"
4805 "Soft reconfig\n"
4806 "Soft reconfig outbound update\n")
4807{
4808 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
4809 BGP_CLEAR_SOFT_OUT, NULL);
4810}
4811
4812ALIAS (clear_ip_bgp_external_soft_out,
4813 clear_ip_bgp_external_out_cmd,
4814 "clear ip bgp external out",
4815 CLEAR_STR
4816 IP_STR
4817 BGP_STR
4818 "Clear all external peers\n"
4819 "Soft reconfig outbound update\n")
4820
4821DEFUN (clear_ip_bgp_external_ipv4_soft_out,
4822 clear_ip_bgp_external_ipv4_soft_out_cmd,
4823 "clear ip bgp external ipv4 (unicast|multicast) soft out",
4824 CLEAR_STR
4825 IP_STR
4826 BGP_STR
4827 "Clear all external peers\n"
4828 "Address family\n"
4829 "Address Family modifier\n"
4830 "Address Family modifier\n"
4831 "Soft reconfig\n"
4832 "Soft reconfig outbound update\n")
4833{
4834 if (strncmp (argv[0], "m", 1) == 0)
4835 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
4836 BGP_CLEAR_SOFT_OUT, NULL);
4837
4838 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
4839 BGP_CLEAR_SOFT_OUT, NULL);
4840}
4841
4842ALIAS (clear_ip_bgp_external_ipv4_soft_out,
4843 clear_ip_bgp_external_ipv4_out_cmd,
4844 "clear ip bgp external ipv4 (unicast|multicast) out",
4845 CLEAR_STR
4846 IP_STR
4847 BGP_STR
4848 "Clear all external peers\n"
4849 "Address family\n"
4850 "Address Family modifier\n"
4851 "Address Family modifier\n"
4852 "Soft reconfig outbound update\n")
4853
4854DEFUN (clear_bgp_external_soft_out,
4855 clear_bgp_external_soft_out_cmd,
4856 "clear bgp external soft out",
4857 CLEAR_STR
4858 BGP_STR
4859 "Clear all external peers\n"
4860 "Soft reconfig\n"
4861 "Soft reconfig outbound update\n")
4862{
4863 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
4864 BGP_CLEAR_SOFT_OUT, NULL);
4865}
4866
4867ALIAS (clear_bgp_external_soft_out,
4868 clear_bgp_ipv6_external_soft_out_cmd,
4869 "clear bgp ipv6 external soft out",
4870 CLEAR_STR
4871 BGP_STR
4872 "Address family\n"
4873 "Clear all external peers\n"
4874 "Soft reconfig\n"
4875 "Soft reconfig outbound update\n")
4876
4877ALIAS (clear_bgp_external_soft_out,
4878 clear_bgp_external_out_cmd,
4879 "clear bgp external out",
4880 CLEAR_STR
4881 BGP_STR
4882 "Clear all external peers\n"
4883 "Soft reconfig outbound update\n")
4884
4885ALIAS (clear_bgp_external_soft_out,
4886 clear_bgp_ipv6_external_out_cmd,
4887 "clear bgp ipv6 external WORD out",
4888 CLEAR_STR
4889 BGP_STR
4890 "Address family\n"
4891 "Clear all external peers\n"
4892 "Soft reconfig outbound update\n")
4893
4894DEFUN (clear_ip_bgp_as_soft_out,
4895 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004896 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00004897 CLEAR_STR
4898 IP_STR
4899 BGP_STR
4900 "Clear peers with the AS number\n"
4901 "Soft reconfig\n"
4902 "Soft reconfig outbound update\n")
4903{
4904 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
4905 BGP_CLEAR_SOFT_OUT, argv[0]);
4906}
4907
4908ALIAS (clear_ip_bgp_as_soft_out,
4909 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004910 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00004911 CLEAR_STR
4912 IP_STR
4913 BGP_STR
4914 "Clear peers with the AS number\n"
4915 "Soft reconfig outbound update\n")
4916
4917DEFUN (clear_ip_bgp_as_ipv4_soft_out,
4918 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004919 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00004920 CLEAR_STR
4921 IP_STR
4922 BGP_STR
4923 "Clear peers with the AS number\n"
4924 "Address family\n"
4925 "Address Family modifier\n"
4926 "Address Family modifier\n"
4927 "Soft reconfig\n"
4928 "Soft reconfig outbound update\n")
4929{
4930 if (strncmp (argv[1], "m", 1) == 0)
4931 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
4932 BGP_CLEAR_SOFT_OUT, argv[0]);
4933
4934 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
4935 BGP_CLEAR_SOFT_OUT, argv[0]);
4936}
4937
4938ALIAS (clear_ip_bgp_as_ipv4_soft_out,
4939 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004940 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00004941 CLEAR_STR
4942 IP_STR
4943 BGP_STR
4944 "Clear peers with the AS number\n"
4945 "Address family\n"
4946 "Address Family modifier\n"
4947 "Address Family modifier\n"
4948 "Soft reconfig outbound update\n")
4949
4950DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
4951 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004952 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00004953 CLEAR_STR
4954 IP_STR
4955 BGP_STR
4956 "Clear peers with the AS number\n"
4957 "Address family\n"
4958 "Address Family modifier\n"
4959 "Soft reconfig\n"
4960 "Soft reconfig outbound update\n")
4961{
4962 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
4963 BGP_CLEAR_SOFT_OUT, argv[0]);
4964}
4965
4966ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
4967 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004968 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00004969 CLEAR_STR
4970 IP_STR
4971 BGP_STR
4972 "Clear peers with the AS number\n"
4973 "Address family\n"
4974 "Address Family modifier\n"
4975 "Soft reconfig outbound update\n")
4976
4977DEFUN (clear_bgp_as_soft_out,
4978 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004979 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00004980 CLEAR_STR
4981 BGP_STR
4982 "Clear peers with the AS number\n"
4983 "Soft reconfig\n"
4984 "Soft reconfig outbound update\n")
4985{
4986 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
4987 BGP_CLEAR_SOFT_OUT, argv[0]);
4988}
4989
4990ALIAS (clear_bgp_as_soft_out,
4991 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004992 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00004993 CLEAR_STR
4994 BGP_STR
4995 "Address family\n"
4996 "Clear peers with the AS number\n"
4997 "Soft reconfig\n"
4998 "Soft reconfig outbound update\n")
4999
5000ALIAS (clear_bgp_as_soft_out,
5001 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005002 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005003 CLEAR_STR
5004 BGP_STR
5005 "Clear peers with the AS number\n"
5006 "Soft reconfig outbound update\n")
5007
5008ALIAS (clear_bgp_as_soft_out,
5009 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005010 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005011 CLEAR_STR
5012 BGP_STR
5013 "Address family\n"
5014 "Clear peers with the AS number\n"
5015 "Soft reconfig outbound update\n")
5016
5017/* Inbound soft-reconfiguration */
5018DEFUN (clear_ip_bgp_all_soft_in,
5019 clear_ip_bgp_all_soft_in_cmd,
5020 "clear ip bgp * soft in",
5021 CLEAR_STR
5022 IP_STR
5023 BGP_STR
5024 "Clear all peers\n"
5025 "Soft reconfig\n"
5026 "Soft reconfig inbound update\n")
5027{
5028 if (argc == 1)
5029 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5030 BGP_CLEAR_SOFT_IN, NULL);
5031
5032 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5033 BGP_CLEAR_SOFT_IN, NULL);
5034}
5035
5036ALIAS (clear_ip_bgp_all_soft_in,
5037 clear_ip_bgp_instance_all_soft_in_cmd,
5038 "clear ip bgp view WORD * soft in",
5039 CLEAR_STR
5040 IP_STR
5041 BGP_STR
5042 "BGP view\n"
5043 "view name\n"
5044 "Clear all peers\n"
5045 "Soft reconfig\n"
5046 "Soft reconfig inbound update\n")
5047
5048ALIAS (clear_ip_bgp_all_soft_in,
5049 clear_ip_bgp_all_in_cmd,
5050 "clear ip bgp * in",
5051 CLEAR_STR
5052 IP_STR
5053 BGP_STR
5054 "Clear all peers\n"
5055 "Soft reconfig inbound update\n")
5056
5057DEFUN (clear_ip_bgp_all_in_prefix_filter,
5058 clear_ip_bgp_all_in_prefix_filter_cmd,
5059 "clear ip bgp * in prefix-filter",
5060 CLEAR_STR
5061 IP_STR
5062 BGP_STR
5063 "Clear all peers\n"
5064 "Soft reconfig inbound update\n"
5065 "Push out prefix-list ORF and do inbound soft reconfig\n")
5066{
5067 if (argc== 1)
5068 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5069 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5070
5071 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5072 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5073}
5074
5075ALIAS (clear_ip_bgp_all_in_prefix_filter,
5076 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5077 "clear ip bgp view WORD * in prefix-filter",
5078 CLEAR_STR
5079 IP_STR
5080 BGP_STR
5081 "BGP view\n"
5082 "view name\n"
5083 "Clear all peers\n"
5084 "Soft reconfig inbound update\n"
5085 "Push out prefix-list ORF and do inbound soft reconfig\n")
5086
5087
5088DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5089 clear_ip_bgp_all_ipv4_soft_in_cmd,
5090 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5091 CLEAR_STR
5092 IP_STR
5093 BGP_STR
5094 "Clear all peers\n"
5095 "Address family\n"
5096 "Address Family modifier\n"
5097 "Address Family modifier\n"
5098 "Soft reconfig\n"
5099 "Soft reconfig inbound update\n")
5100{
5101 if (strncmp (argv[0], "m", 1) == 0)
5102 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5103 BGP_CLEAR_SOFT_IN, NULL);
5104
5105 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5106 BGP_CLEAR_SOFT_IN, NULL);
5107}
5108
5109ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5110 clear_ip_bgp_all_ipv4_in_cmd,
5111 "clear ip bgp * ipv4 (unicast|multicast) in",
5112 CLEAR_STR
5113 IP_STR
5114 BGP_STR
5115 "Clear all peers\n"
5116 "Address family\n"
5117 "Address Family modifier\n"
5118 "Address Family modifier\n"
5119 "Soft reconfig inbound update\n")
5120
5121DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5122 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5123 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5124 CLEAR_STR
5125 IP_STR
5126 BGP_STR
5127 "BGP view\n"
5128 "view name\n"
5129 "Clear all peers\n"
5130 "Address family\n"
5131 "Address Family modifier\n"
5132 "Address Family modifier\n"
5133 "Soft reconfig\n"
5134 "Soft reconfig inbound update\n")
5135{
5136 if (strncmp (argv[1], "m", 1) == 0)
5137 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5138 BGP_CLEAR_SOFT_IN, NULL);
5139
5140 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5141 BGP_CLEAR_SOFT_IN, NULL);
5142}
5143
5144DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5145 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5146 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5147 CLEAR_STR
5148 IP_STR
5149 BGP_STR
5150 "Clear all peers\n"
5151 "Address family\n"
5152 "Address Family modifier\n"
5153 "Address Family modifier\n"
5154 "Soft reconfig inbound update\n"
5155 "Push out prefix-list ORF and do inbound soft reconfig\n")
5156{
5157 if (strncmp (argv[0], "m", 1) == 0)
5158 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5159 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5160
5161 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5162 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5163}
5164
5165DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5166 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5167 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5168 CLEAR_STR
5169 IP_STR
5170 BGP_STR
5171 "Clear all peers\n"
5172 "Address family\n"
5173 "Address Family modifier\n"
5174 "Address Family modifier\n"
5175 "Soft reconfig inbound update\n"
5176 "Push out prefix-list ORF and do inbound soft reconfig\n")
5177{
5178 if (strncmp (argv[1], "m", 1) == 0)
5179 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5180 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5181
5182 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5183 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5184}
5185
5186DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5187 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5188 "clear ip bgp * vpnv4 unicast soft in",
5189 CLEAR_STR
5190 IP_STR
5191 BGP_STR
5192 "Clear all peers\n"
5193 "Address family\n"
5194 "Address Family Modifier\n"
5195 "Soft reconfig\n"
5196 "Soft reconfig inbound update\n")
5197{
5198 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5199 BGP_CLEAR_SOFT_IN, NULL);
5200}
5201
5202ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5203 clear_ip_bgp_all_vpnv4_in_cmd,
5204 "clear ip bgp * vpnv4 unicast in",
5205 CLEAR_STR
5206 IP_STR
5207 BGP_STR
5208 "Clear all peers\n"
5209 "Address family\n"
5210 "Address Family Modifier\n"
5211 "Soft reconfig inbound update\n")
5212
5213DEFUN (clear_bgp_all_soft_in,
5214 clear_bgp_all_soft_in_cmd,
5215 "clear bgp * soft in",
5216 CLEAR_STR
5217 BGP_STR
5218 "Clear all peers\n"
5219 "Soft reconfig\n"
5220 "Soft reconfig inbound update\n")
5221{
5222 if (argc == 1)
5223 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5224 BGP_CLEAR_SOFT_IN, NULL);
5225
5226 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5227 BGP_CLEAR_SOFT_IN, NULL);
5228}
5229
5230ALIAS (clear_bgp_all_soft_in,
5231 clear_bgp_instance_all_soft_in_cmd,
5232 "clear bgp view WORD * soft in",
5233 CLEAR_STR
5234 BGP_STR
5235 "BGP view\n"
5236 "view name\n"
5237 "Clear all peers\n"
5238 "Soft reconfig\n"
5239 "Soft reconfig inbound update\n")
5240
5241ALIAS (clear_bgp_all_soft_in,
5242 clear_bgp_ipv6_all_soft_in_cmd,
5243 "clear bgp ipv6 * soft in",
5244 CLEAR_STR
5245 BGP_STR
5246 "Address family\n"
5247 "Clear all peers\n"
5248 "Soft reconfig\n"
5249 "Soft reconfig inbound update\n")
5250
5251ALIAS (clear_bgp_all_soft_in,
5252 clear_bgp_all_in_cmd,
5253 "clear bgp * in",
5254 CLEAR_STR
5255 BGP_STR
5256 "Clear all peers\n"
5257 "Soft reconfig inbound update\n")
5258
5259ALIAS (clear_bgp_all_soft_in,
5260 clear_bgp_ipv6_all_in_cmd,
5261 "clear bgp ipv6 * in",
5262 CLEAR_STR
5263 BGP_STR
5264 "Address family\n"
5265 "Clear all peers\n"
5266 "Soft reconfig inbound update\n")
5267
5268DEFUN (clear_bgp_all_in_prefix_filter,
5269 clear_bgp_all_in_prefix_filter_cmd,
5270 "clear bgp * in prefix-filter",
5271 CLEAR_STR
5272 BGP_STR
5273 "Clear all peers\n"
5274 "Soft reconfig inbound update\n"
5275 "Push out prefix-list ORF and do inbound soft reconfig\n")
5276{
5277 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5278 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5279}
5280
5281ALIAS (clear_bgp_all_in_prefix_filter,
5282 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5283 "clear bgp ipv6 * in prefix-filter",
5284 CLEAR_STR
5285 BGP_STR
5286 "Address family\n"
5287 "Clear all peers\n"
5288 "Soft reconfig inbound update\n"
5289 "Push out prefix-list ORF and do inbound soft reconfig\n")
5290
5291DEFUN (clear_ip_bgp_peer_soft_in,
5292 clear_ip_bgp_peer_soft_in_cmd,
5293 "clear ip bgp A.B.C.D soft in",
5294 CLEAR_STR
5295 IP_STR
5296 BGP_STR
5297 "BGP neighbor address to clear\n"
5298 "Soft reconfig\n"
5299 "Soft reconfig inbound update\n")
5300{
5301 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5302 BGP_CLEAR_SOFT_IN, argv[0]);
5303}
5304
5305ALIAS (clear_ip_bgp_peer_soft_in,
5306 clear_ip_bgp_peer_in_cmd,
5307 "clear ip bgp A.B.C.D in",
5308 CLEAR_STR
5309 IP_STR
5310 BGP_STR
5311 "BGP neighbor address to clear\n"
5312 "Soft reconfig inbound update\n")
5313
5314DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5315 clear_ip_bgp_peer_in_prefix_filter_cmd,
5316 "clear ip bgp A.B.C.D in prefix-filter",
5317 CLEAR_STR
5318 IP_STR
5319 BGP_STR
5320 "BGP neighbor address to clear\n"
5321 "Soft reconfig inbound update\n"
5322 "Push out the existing ORF prefix-list\n")
5323{
5324 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5325 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5326}
5327
5328DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5329 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5330 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5331 CLEAR_STR
5332 IP_STR
5333 BGP_STR
5334 "BGP neighbor address to clear\n"
5335 "Address family\n"
5336 "Address Family modifier\n"
5337 "Address Family modifier\n"
5338 "Soft reconfig\n"
5339 "Soft reconfig inbound update\n")
5340{
5341 if (strncmp (argv[1], "m", 1) == 0)
5342 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5343 BGP_CLEAR_SOFT_IN, argv[0]);
5344
5345 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5346 BGP_CLEAR_SOFT_IN, argv[0]);
5347}
5348
5349ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5350 clear_ip_bgp_peer_ipv4_in_cmd,
5351 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5352 CLEAR_STR
5353 IP_STR
5354 BGP_STR
5355 "BGP neighbor address to clear\n"
5356 "Address family\n"
5357 "Address Family modifier\n"
5358 "Address Family modifier\n"
5359 "Soft reconfig inbound update\n")
5360
5361DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5362 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5363 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5364 CLEAR_STR
5365 IP_STR
5366 BGP_STR
5367 "BGP neighbor address to clear\n"
5368 "Address family\n"
5369 "Address Family modifier\n"
5370 "Address Family modifier\n"
5371 "Soft reconfig inbound update\n"
5372 "Push out the existing ORF prefix-list\n")
5373{
5374 if (strncmp (argv[1], "m", 1) == 0)
5375 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5376 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5377
5378 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5379 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5380}
5381
5382DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5383 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5384 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5385 CLEAR_STR
5386 IP_STR
5387 BGP_STR
5388 "BGP neighbor address to clear\n"
5389 "Address family\n"
5390 "Address Family Modifier\n"
5391 "Soft reconfig\n"
5392 "Soft reconfig inbound update\n")
5393{
5394 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5395 BGP_CLEAR_SOFT_IN, argv[0]);
5396}
5397
5398ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5399 clear_ip_bgp_peer_vpnv4_in_cmd,
5400 "clear ip bgp A.B.C.D vpnv4 unicast in",
5401 CLEAR_STR
5402 IP_STR
5403 BGP_STR
5404 "BGP neighbor address to clear\n"
5405 "Address family\n"
5406 "Address Family Modifier\n"
5407 "Soft reconfig inbound update\n")
5408
5409DEFUN (clear_bgp_peer_soft_in,
5410 clear_bgp_peer_soft_in_cmd,
5411 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5412 CLEAR_STR
5413 BGP_STR
5414 "BGP neighbor address to clear\n"
5415 "BGP IPv6 neighbor to clear\n"
5416 "Soft reconfig\n"
5417 "Soft reconfig inbound update\n")
5418{
5419 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5420 BGP_CLEAR_SOFT_IN, argv[0]);
5421}
5422
5423ALIAS (clear_bgp_peer_soft_in,
5424 clear_bgp_ipv6_peer_soft_in_cmd,
5425 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5426 CLEAR_STR
5427 BGP_STR
5428 "Address family\n"
5429 "BGP neighbor address to clear\n"
5430 "BGP IPv6 neighbor to clear\n"
5431 "Soft reconfig\n"
5432 "Soft reconfig inbound update\n")
5433
5434ALIAS (clear_bgp_peer_soft_in,
5435 clear_bgp_peer_in_cmd,
5436 "clear bgp (A.B.C.D|X:X::X:X) in",
5437 CLEAR_STR
5438 BGP_STR
5439 "BGP neighbor address to clear\n"
5440 "BGP IPv6 neighbor to clear\n"
5441 "Soft reconfig inbound update\n")
5442
5443ALIAS (clear_bgp_peer_soft_in,
5444 clear_bgp_ipv6_peer_in_cmd,
5445 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5446 CLEAR_STR
5447 BGP_STR
5448 "Address family\n"
5449 "BGP neighbor address to clear\n"
5450 "BGP IPv6 neighbor to clear\n"
5451 "Soft reconfig inbound update\n")
5452
5453DEFUN (clear_bgp_peer_in_prefix_filter,
5454 clear_bgp_peer_in_prefix_filter_cmd,
5455 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5456 CLEAR_STR
5457 BGP_STR
5458 "BGP neighbor address to clear\n"
5459 "BGP IPv6 neighbor to clear\n"
5460 "Soft reconfig inbound update\n"
5461 "Push out the existing ORF prefix-list\n")
5462{
5463 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5464 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5465}
5466
5467ALIAS (clear_bgp_peer_in_prefix_filter,
5468 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5469 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5470 CLEAR_STR
5471 BGP_STR
5472 "Address family\n"
5473 "BGP neighbor address to clear\n"
5474 "BGP IPv6 neighbor to clear\n"
5475 "Soft reconfig inbound update\n"
5476 "Push out the existing ORF prefix-list\n")
5477
5478DEFUN (clear_ip_bgp_peer_group_soft_in,
5479 clear_ip_bgp_peer_group_soft_in_cmd,
5480 "clear ip bgp peer-group WORD soft in",
5481 CLEAR_STR
5482 IP_STR
5483 BGP_STR
5484 "Clear all members of peer-group\n"
5485 "BGP peer-group name\n"
5486 "Soft reconfig\n"
5487 "Soft reconfig inbound update\n")
5488{
5489 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5490 BGP_CLEAR_SOFT_IN, argv[0]);
5491}
5492
5493ALIAS (clear_ip_bgp_peer_group_soft_in,
5494 clear_ip_bgp_peer_group_in_cmd,
5495 "clear ip bgp peer-group WORD in",
5496 CLEAR_STR
5497 IP_STR
5498 BGP_STR
5499 "Clear all members of peer-group\n"
5500 "BGP peer-group name\n"
5501 "Soft reconfig inbound update\n")
5502
5503DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
5504 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
5505 "clear ip bgp peer-group WORD in prefix-filter",
5506 CLEAR_STR
5507 IP_STR
5508 BGP_STR
5509 "Clear all members of peer-group\n"
5510 "BGP peer-group name\n"
5511 "Soft reconfig inbound update\n"
5512 "Push out prefix-list ORF and do inbound soft reconfig\n")
5513{
5514 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5515 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5516}
5517
5518DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
5519 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
5520 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
5521 CLEAR_STR
5522 IP_STR
5523 BGP_STR
5524 "Clear all members of peer-group\n"
5525 "BGP peer-group name\n"
5526 "Address family\n"
5527 "Address Family modifier\n"
5528 "Address Family modifier\n"
5529 "Soft reconfig\n"
5530 "Soft reconfig inbound update\n")
5531{
5532 if (strncmp (argv[1], "m", 1) == 0)
5533 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5534 BGP_CLEAR_SOFT_IN, argv[0]);
5535
5536 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5537 BGP_CLEAR_SOFT_IN, argv[0]);
5538}
5539
5540ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
5541 clear_ip_bgp_peer_group_ipv4_in_cmd,
5542 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) 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 inbound update\n")
5552
5553DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
5554 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
5555 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
5556 CLEAR_STR
5557 IP_STR
5558 BGP_STR
5559 "Clear all members of peer-group\n"
5560 "BGP peer-group name\n"
5561 "Address family\n"
5562 "Address Family modifier\n"
5563 "Address Family modifier\n"
5564 "Soft reconfig inbound update\n"
5565 "Push out prefix-list ORF and do inbound soft reconfig\n")
5566{
5567 if (strncmp (argv[1], "m", 1) == 0)
5568 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5569 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5570
5571 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5572 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5573}
5574
5575DEFUN (clear_bgp_peer_group_soft_in,
5576 clear_bgp_peer_group_soft_in_cmd,
5577 "clear bgp peer-group WORD soft in",
5578 CLEAR_STR
5579 BGP_STR
5580 "Clear all members of peer-group\n"
5581 "BGP peer-group name\n"
5582 "Soft reconfig\n"
5583 "Soft reconfig inbound update\n")
5584{
5585 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5586 BGP_CLEAR_SOFT_IN, argv[0]);
5587}
5588
5589ALIAS (clear_bgp_peer_group_soft_in,
5590 clear_bgp_ipv6_peer_group_soft_in_cmd,
5591 "clear bgp ipv6 peer-group WORD soft in",
5592 CLEAR_STR
5593 BGP_STR
5594 "Address family\n"
5595 "Clear all members of peer-group\n"
5596 "BGP peer-group name\n"
5597 "Soft reconfig\n"
5598 "Soft reconfig inbound update\n")
5599
5600ALIAS (clear_bgp_peer_group_soft_in,
5601 clear_bgp_peer_group_in_cmd,
5602 "clear bgp peer-group WORD in",
5603 CLEAR_STR
5604 BGP_STR
5605 "Clear all members of peer-group\n"
5606 "BGP peer-group name\n"
5607 "Soft reconfig inbound update\n")
5608
5609ALIAS (clear_bgp_peer_group_soft_in,
5610 clear_bgp_ipv6_peer_group_in_cmd,
5611 "clear bgp ipv6 peer-group WORD in",
5612 CLEAR_STR
5613 BGP_STR
5614 "Address family\n"
5615 "Clear all members of peer-group\n"
5616 "BGP peer-group name\n"
5617 "Soft reconfig inbound update\n")
5618
5619DEFUN (clear_bgp_peer_group_in_prefix_filter,
5620 clear_bgp_peer_group_in_prefix_filter_cmd,
5621 "clear bgp peer-group WORD in prefix-filter",
5622 CLEAR_STR
5623 BGP_STR
5624 "Clear all members of peer-group\n"
5625 "BGP peer-group name\n"
5626 "Soft reconfig inbound update\n"
5627 "Push out prefix-list ORF and do inbound soft reconfig\n")
5628{
5629 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5630 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5631}
5632
5633ALIAS (clear_bgp_peer_group_in_prefix_filter,
5634 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
5635 "clear bgp ipv6 peer-group WORD in prefix-filter",
5636 CLEAR_STR
5637 BGP_STR
5638 "Address family\n"
5639 "Clear all members of peer-group\n"
5640 "BGP peer-group name\n"
5641 "Soft reconfig inbound update\n"
5642 "Push out prefix-list ORF and do inbound soft reconfig\n")
5643
5644DEFUN (clear_ip_bgp_external_soft_in,
5645 clear_ip_bgp_external_soft_in_cmd,
5646 "clear ip bgp external soft in",
5647 CLEAR_STR
5648 IP_STR
5649 BGP_STR
5650 "Clear all external peers\n"
5651 "Soft reconfig\n"
5652 "Soft reconfig inbound update\n")
5653{
5654 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5655 BGP_CLEAR_SOFT_IN, NULL);
5656}
5657
5658ALIAS (clear_ip_bgp_external_soft_in,
5659 clear_ip_bgp_external_in_cmd,
5660 "clear ip bgp external in",
5661 CLEAR_STR
5662 IP_STR
5663 BGP_STR
5664 "Clear all external peers\n"
5665 "Soft reconfig inbound update\n")
5666
5667DEFUN (clear_ip_bgp_external_in_prefix_filter,
5668 clear_ip_bgp_external_in_prefix_filter_cmd,
5669 "clear ip bgp external in prefix-filter",
5670 CLEAR_STR
5671 IP_STR
5672 BGP_STR
5673 "Clear all external peers\n"
5674 "Soft reconfig inbound update\n"
5675 "Push out prefix-list ORF and do inbound soft reconfig\n")
5676{
5677 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5678 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5679}
5680
5681DEFUN (clear_ip_bgp_external_ipv4_soft_in,
5682 clear_ip_bgp_external_ipv4_soft_in_cmd,
5683 "clear ip bgp external ipv4 (unicast|multicast) soft in",
5684 CLEAR_STR
5685 IP_STR
5686 BGP_STR
5687 "Clear all external peers\n"
5688 "Address family\n"
5689 "Address Family modifier\n"
5690 "Address Family modifier\n"
5691 "Soft reconfig\n"
5692 "Soft reconfig inbound update\n")
5693{
5694 if (strncmp (argv[0], "m", 1) == 0)
5695 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5696 BGP_CLEAR_SOFT_IN, NULL);
5697
5698 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5699 BGP_CLEAR_SOFT_IN, NULL);
5700}
5701
5702ALIAS (clear_ip_bgp_external_ipv4_soft_in,
5703 clear_ip_bgp_external_ipv4_in_cmd,
5704 "clear ip bgp external ipv4 (unicast|multicast) in",
5705 CLEAR_STR
5706 IP_STR
5707 BGP_STR
5708 "Clear all external peers\n"
5709 "Address family\n"
5710 "Address Family modifier\n"
5711 "Address Family modifier\n"
5712 "Soft reconfig inbound update\n")
5713
5714DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
5715 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
5716 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
5717 CLEAR_STR
5718 IP_STR
5719 BGP_STR
5720 "Clear all external peers\n"
5721 "Address family\n"
5722 "Address Family modifier\n"
5723 "Address Family modifier\n"
5724 "Soft reconfig inbound update\n"
5725 "Push out prefix-list ORF and do inbound soft reconfig\n")
5726{
5727 if (strncmp (argv[0], "m", 1) == 0)
5728 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5729 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5730
5731 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5732 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5733}
5734
5735DEFUN (clear_bgp_external_soft_in,
5736 clear_bgp_external_soft_in_cmd,
5737 "clear bgp external soft in",
5738 CLEAR_STR
5739 BGP_STR
5740 "Clear all external peers\n"
5741 "Soft reconfig\n"
5742 "Soft reconfig inbound update\n")
5743{
5744 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5745 BGP_CLEAR_SOFT_IN, NULL);
5746}
5747
5748ALIAS (clear_bgp_external_soft_in,
5749 clear_bgp_ipv6_external_soft_in_cmd,
5750 "clear bgp ipv6 external soft in",
5751 CLEAR_STR
5752 BGP_STR
5753 "Address family\n"
5754 "Clear all external peers\n"
5755 "Soft reconfig\n"
5756 "Soft reconfig inbound update\n")
5757
5758ALIAS (clear_bgp_external_soft_in,
5759 clear_bgp_external_in_cmd,
5760 "clear bgp external in",
5761 CLEAR_STR
5762 BGP_STR
5763 "Clear all external peers\n"
5764 "Soft reconfig inbound update\n")
5765
5766ALIAS (clear_bgp_external_soft_in,
5767 clear_bgp_ipv6_external_in_cmd,
5768 "clear bgp ipv6 external WORD in",
5769 CLEAR_STR
5770 BGP_STR
5771 "Address family\n"
5772 "Clear all external peers\n"
5773 "Soft reconfig inbound update\n")
5774
5775DEFUN (clear_bgp_external_in_prefix_filter,
5776 clear_bgp_external_in_prefix_filter_cmd,
5777 "clear bgp external in prefix-filter",
5778 CLEAR_STR
5779 BGP_STR
5780 "Clear all external peers\n"
5781 "Soft reconfig inbound update\n"
5782 "Push out prefix-list ORF and do inbound soft reconfig\n")
5783{
5784 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5785 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5786}
5787
5788ALIAS (clear_bgp_external_in_prefix_filter,
5789 clear_bgp_ipv6_external_in_prefix_filter_cmd,
5790 "clear bgp ipv6 external in prefix-filter",
5791 CLEAR_STR
5792 BGP_STR
5793 "Address family\n"
5794 "Clear all external peers\n"
5795 "Soft reconfig inbound update\n"
5796 "Push out prefix-list ORF and do inbound soft reconfig\n")
5797
5798DEFUN (clear_ip_bgp_as_soft_in,
5799 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005800 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00005801 CLEAR_STR
5802 IP_STR
5803 BGP_STR
5804 "Clear peers with the AS number\n"
5805 "Soft reconfig\n"
5806 "Soft reconfig inbound update\n")
5807{
5808 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5809 BGP_CLEAR_SOFT_IN, argv[0]);
5810}
5811
5812ALIAS (clear_ip_bgp_as_soft_in,
5813 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005814 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00005815 CLEAR_STR
5816 IP_STR
5817 BGP_STR
5818 "Clear peers with the AS number\n"
5819 "Soft reconfig inbound update\n")
5820
5821DEFUN (clear_ip_bgp_as_in_prefix_filter,
5822 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005823 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00005824 CLEAR_STR
5825 IP_STR
5826 BGP_STR
5827 "Clear peers with the AS number\n"
5828 "Soft reconfig inbound update\n"
5829 "Push out prefix-list ORF and do inbound soft reconfig\n")
5830{
5831 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5832 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5833}
5834
5835DEFUN (clear_ip_bgp_as_ipv4_soft_in,
5836 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005837 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00005838 CLEAR_STR
5839 IP_STR
5840 BGP_STR
5841 "Clear peers with the AS number\n"
5842 "Address family\n"
5843 "Address Family modifier\n"
5844 "Address Family modifier\n"
5845 "Soft reconfig\n"
5846 "Soft reconfig inbound update\n")
5847{
5848 if (strncmp (argv[1], "m", 1) == 0)
5849 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5850 BGP_CLEAR_SOFT_IN, argv[0]);
5851
5852 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5853 BGP_CLEAR_SOFT_IN, argv[0]);
5854}
5855
5856ALIAS (clear_ip_bgp_as_ipv4_soft_in,
5857 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005858 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00005859 CLEAR_STR
5860 IP_STR
5861 BGP_STR
5862 "Clear peers with the AS number\n"
5863 "Address family\n"
5864 "Address Family modifier\n"
5865 "Address Family modifier\n"
5866 "Soft reconfig inbound update\n")
5867
5868DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
5869 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005870 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00005871 CLEAR_STR
5872 IP_STR
5873 BGP_STR
5874 "Clear peers with the AS number\n"
5875 "Address family\n"
5876 "Address Family modifier\n"
5877 "Address Family modifier\n"
5878 "Soft reconfig inbound update\n"
5879 "Push out prefix-list ORF and do inbound soft reconfig\n")
5880{
5881 if (strncmp (argv[1], "m", 1) == 0)
5882 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5883 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5884
5885 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5886 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5887}
5888
5889DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
5890 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005891 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00005892 CLEAR_STR
5893 IP_STR
5894 BGP_STR
5895 "Clear peers with the AS number\n"
5896 "Address family\n"
5897 "Address Family modifier\n"
5898 "Soft reconfig\n"
5899 "Soft reconfig inbound update\n")
5900{
5901 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5902 BGP_CLEAR_SOFT_IN, argv[0]);
5903}
5904
5905ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
5906 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005907 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00005908 CLEAR_STR
5909 IP_STR
5910 BGP_STR
5911 "Clear peers with the AS number\n"
5912 "Address family\n"
5913 "Address Family modifier\n"
5914 "Soft reconfig inbound update\n")
5915
5916DEFUN (clear_bgp_as_soft_in,
5917 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005918 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00005919 CLEAR_STR
5920 BGP_STR
5921 "Clear peers with the AS number\n"
5922 "Soft reconfig\n"
5923 "Soft reconfig inbound update\n")
5924{
5925 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5926 BGP_CLEAR_SOFT_IN, argv[0]);
5927}
5928
5929ALIAS (clear_bgp_as_soft_in,
5930 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005931 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00005932 CLEAR_STR
5933 BGP_STR
5934 "Address family\n"
5935 "Clear peers with the AS number\n"
5936 "Soft reconfig\n"
5937 "Soft reconfig inbound update\n")
5938
5939ALIAS (clear_bgp_as_soft_in,
5940 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005941 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00005942 CLEAR_STR
5943 BGP_STR
5944 "Clear peers with the AS number\n"
5945 "Soft reconfig inbound update\n")
5946
5947ALIAS (clear_bgp_as_soft_in,
5948 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005949 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00005950 CLEAR_STR
5951 BGP_STR
5952 "Address family\n"
5953 "Clear peers with the AS number\n"
5954 "Soft reconfig inbound update\n")
5955
5956DEFUN (clear_bgp_as_in_prefix_filter,
5957 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005958 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00005959 CLEAR_STR
5960 BGP_STR
5961 "Clear peers with the AS number\n"
5962 "Soft reconfig inbound update\n"
5963 "Push out prefix-list ORF and do inbound soft reconfig\n")
5964{
5965 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5966 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5967}
5968
5969ALIAS (clear_bgp_as_in_prefix_filter,
5970 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005971 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
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 "Push out prefix-list ORF and do inbound soft reconfig\n")
5978
5979/* Both soft-reconfiguration */
5980DEFUN (clear_ip_bgp_all_soft,
5981 clear_ip_bgp_all_soft_cmd,
5982 "clear ip bgp * soft",
5983 CLEAR_STR
5984 IP_STR
5985 BGP_STR
5986 "Clear all peers\n"
5987 "Soft reconfig\n")
5988{
5989 if (argc == 1)
5990 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5991 BGP_CLEAR_SOFT_BOTH, NULL);
5992
5993 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5994 BGP_CLEAR_SOFT_BOTH, NULL);
5995}
5996
5997ALIAS (clear_ip_bgp_all_soft,
5998 clear_ip_bgp_instance_all_soft_cmd,
5999 "clear ip bgp view WORD * soft",
6000 CLEAR_STR
6001 IP_STR
6002 BGP_STR
6003 "BGP view\n"
6004 "view name\n"
6005 "Clear all peers\n"
6006 "Soft reconfig\n")
6007
6008
6009DEFUN (clear_ip_bgp_all_ipv4_soft,
6010 clear_ip_bgp_all_ipv4_soft_cmd,
6011 "clear ip bgp * ipv4 (unicast|multicast) soft",
6012 CLEAR_STR
6013 IP_STR
6014 BGP_STR
6015 "Clear all peers\n"
6016 "Address family\n"
6017 "Address Family Modifier\n"
6018 "Address Family Modifier\n"
6019 "Soft reconfig\n")
6020{
6021 if (strncmp (argv[0], "m", 1) == 0)
6022 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6023 BGP_CLEAR_SOFT_BOTH, NULL);
6024
6025 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6026 BGP_CLEAR_SOFT_BOTH, NULL);
6027}
6028
6029DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6030 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6031 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6032 CLEAR_STR
6033 IP_STR
6034 BGP_STR
6035 "BGP view\n"
6036 "view name\n"
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[1], "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_all_vpnv4_soft,
6052 clear_ip_bgp_all_vpnv4_soft_cmd,
6053 "clear ip bgp * vpnv4 unicast soft",
6054 CLEAR_STR
6055 IP_STR
6056 BGP_STR
6057 "Clear all peers\n"
6058 "Address family\n"
6059 "Address Family Modifier\n"
6060 "Soft reconfig\n")
6061{
6062 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6063 BGP_CLEAR_SOFT_BOTH, argv[0]);
6064}
6065
6066DEFUN (clear_bgp_all_soft,
6067 clear_bgp_all_soft_cmd,
6068 "clear bgp * soft",
6069 CLEAR_STR
6070 BGP_STR
6071 "Clear all peers\n"
6072 "Soft reconfig\n")
6073{
6074 if (argc == 1)
6075 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6076 BGP_CLEAR_SOFT_BOTH, argv[0]);
6077
6078 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6079 BGP_CLEAR_SOFT_BOTH, argv[0]);
6080}
6081
6082ALIAS (clear_bgp_all_soft,
6083 clear_bgp_instance_all_soft_cmd,
6084 "clear bgp view WORD * soft",
6085 CLEAR_STR
6086 BGP_STR
6087 "BGP view\n"
6088 "view name\n"
6089 "Clear all peers\n"
6090 "Soft reconfig\n")
6091
6092ALIAS (clear_bgp_all_soft,
6093 clear_bgp_ipv6_all_soft_cmd,
6094 "clear bgp ipv6 * soft",
6095 CLEAR_STR
6096 BGP_STR
6097 "Address family\n"
6098 "Clear all peers\n"
6099 "Soft reconfig\n")
6100
6101DEFUN (clear_ip_bgp_peer_soft,
6102 clear_ip_bgp_peer_soft_cmd,
6103 "clear ip bgp A.B.C.D soft",
6104 CLEAR_STR
6105 IP_STR
6106 BGP_STR
6107 "BGP neighbor address to clear\n"
6108 "Soft reconfig\n")
6109{
6110 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6111 BGP_CLEAR_SOFT_BOTH, argv[0]);
6112}
6113
6114DEFUN (clear_ip_bgp_peer_ipv4_soft,
6115 clear_ip_bgp_peer_ipv4_soft_cmd,
6116 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6117 CLEAR_STR
6118 IP_STR
6119 BGP_STR
6120 "BGP neighbor address to clear\n"
6121 "Address family\n"
6122 "Address Family Modifier\n"
6123 "Address Family Modifier\n"
6124 "Soft reconfig\n")
6125{
6126 if (strncmp (argv[1], "m", 1) == 0)
6127 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6128 BGP_CLEAR_SOFT_BOTH, argv[0]);
6129
6130 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6131 BGP_CLEAR_SOFT_BOTH, argv[0]);
6132}
6133
6134DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6135 clear_ip_bgp_peer_vpnv4_soft_cmd,
6136 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6137 CLEAR_STR
6138 IP_STR
6139 BGP_STR
6140 "BGP neighbor address to clear\n"
6141 "Address family\n"
6142 "Address Family Modifier\n"
6143 "Soft reconfig\n")
6144{
6145 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6146 BGP_CLEAR_SOFT_BOTH, argv[0]);
6147}
6148
6149DEFUN (clear_bgp_peer_soft,
6150 clear_bgp_peer_soft_cmd,
6151 "clear bgp (A.B.C.D|X:X::X:X) soft",
6152 CLEAR_STR
6153 BGP_STR
6154 "BGP neighbor address to clear\n"
6155 "BGP IPv6 neighbor to clear\n"
6156 "Soft reconfig\n")
6157{
6158 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6159 BGP_CLEAR_SOFT_BOTH, argv[0]);
6160}
6161
6162ALIAS (clear_bgp_peer_soft,
6163 clear_bgp_ipv6_peer_soft_cmd,
6164 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6165 CLEAR_STR
6166 BGP_STR
6167 "Address family\n"
6168 "BGP neighbor address to clear\n"
6169 "BGP IPv6 neighbor to clear\n"
6170 "Soft reconfig\n")
6171
6172DEFUN (clear_ip_bgp_peer_group_soft,
6173 clear_ip_bgp_peer_group_soft_cmd,
6174 "clear ip bgp peer-group WORD soft",
6175 CLEAR_STR
6176 IP_STR
6177 BGP_STR
6178 "Clear all members of peer-group\n"
6179 "BGP peer-group name\n"
6180 "Soft reconfig\n")
6181{
6182 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6183 BGP_CLEAR_SOFT_BOTH, argv[0]);
6184}
6185
6186DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6187 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6188 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6189 CLEAR_STR
6190 IP_STR
6191 BGP_STR
6192 "Clear all members of peer-group\n"
6193 "BGP peer-group name\n"
6194 "Address family\n"
6195 "Address Family modifier\n"
6196 "Address Family modifier\n"
6197 "Soft reconfig\n")
6198{
6199 if (strncmp (argv[1], "m", 1) == 0)
6200 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6201 BGP_CLEAR_SOFT_BOTH, argv[0]);
6202
6203 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6204 BGP_CLEAR_SOFT_BOTH, argv[0]);
6205}
6206
6207DEFUN (clear_bgp_peer_group_soft,
6208 clear_bgp_peer_group_soft_cmd,
6209 "clear bgp peer-group WORD soft",
6210 CLEAR_STR
6211 BGP_STR
6212 "Clear all members of peer-group\n"
6213 "BGP peer-group name\n"
6214 "Soft reconfig\n")
6215{
6216 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6217 BGP_CLEAR_SOFT_BOTH, argv[0]);
6218}
6219
6220ALIAS (clear_bgp_peer_group_soft,
6221 clear_bgp_ipv6_peer_group_soft_cmd,
6222 "clear bgp ipv6 peer-group WORD soft",
6223 CLEAR_STR
6224 BGP_STR
6225 "Address family\n"
6226 "Clear all members of peer-group\n"
6227 "BGP peer-group name\n"
6228 "Soft reconfig\n")
6229
6230DEFUN (clear_ip_bgp_external_soft,
6231 clear_ip_bgp_external_soft_cmd,
6232 "clear ip bgp external soft",
6233 CLEAR_STR
6234 IP_STR
6235 BGP_STR
6236 "Clear all external peers\n"
6237 "Soft reconfig\n")
6238{
6239 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6240 BGP_CLEAR_SOFT_BOTH, NULL);
6241}
6242
6243DEFUN (clear_ip_bgp_external_ipv4_soft,
6244 clear_ip_bgp_external_ipv4_soft_cmd,
6245 "clear ip bgp external ipv4 (unicast|multicast) soft",
6246 CLEAR_STR
6247 IP_STR
6248 BGP_STR
6249 "Clear all external peers\n"
6250 "Address family\n"
6251 "Address Family modifier\n"
6252 "Address Family modifier\n"
6253 "Soft reconfig\n")
6254{
6255 if (strncmp (argv[0], "m", 1) == 0)
6256 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6257 BGP_CLEAR_SOFT_BOTH, NULL);
6258
6259 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6260 BGP_CLEAR_SOFT_BOTH, NULL);
6261}
6262
6263DEFUN (clear_bgp_external_soft,
6264 clear_bgp_external_soft_cmd,
6265 "clear bgp external soft",
6266 CLEAR_STR
6267 BGP_STR
6268 "Clear all external peers\n"
6269 "Soft reconfig\n")
6270{
6271 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6272 BGP_CLEAR_SOFT_BOTH, NULL);
6273}
6274
6275ALIAS (clear_bgp_external_soft,
6276 clear_bgp_ipv6_external_soft_cmd,
6277 "clear bgp ipv6 external soft",
6278 CLEAR_STR
6279 BGP_STR
6280 "Address family\n"
6281 "Clear all external peers\n"
6282 "Soft reconfig\n")
6283
6284DEFUN (clear_ip_bgp_as_soft,
6285 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006286 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006287 CLEAR_STR
6288 IP_STR
6289 BGP_STR
6290 "Clear peers with the AS number\n"
6291 "Soft reconfig\n")
6292{
6293 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6294 BGP_CLEAR_SOFT_BOTH, argv[0]);
6295}
6296
6297DEFUN (clear_ip_bgp_as_ipv4_soft,
6298 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006299 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006300 CLEAR_STR
6301 IP_STR
6302 BGP_STR
6303 "Clear peers with the AS number\n"
6304 "Address family\n"
6305 "Address Family Modifier\n"
6306 "Address Family Modifier\n"
6307 "Soft reconfig\n")
6308{
6309 if (strncmp (argv[1], "m", 1) == 0)
6310 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6311 BGP_CLEAR_SOFT_BOTH, argv[0]);
6312
6313 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6314 BGP_CLEAR_SOFT_BOTH, argv[0]);
6315}
6316
6317DEFUN (clear_ip_bgp_as_vpnv4_soft,
6318 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006319 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00006320 CLEAR_STR
6321 IP_STR
6322 BGP_STR
6323 "Clear peers with the AS number\n"
6324 "Address family\n"
6325 "Address Family Modifier\n"
6326 "Soft reconfig\n")
6327{
6328 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6329 BGP_CLEAR_SOFT_BOTH, argv[0]);
6330}
6331
6332DEFUN (clear_bgp_as_soft,
6333 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006334 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006335 CLEAR_STR
6336 BGP_STR
6337 "Clear peers with the AS number\n"
6338 "Soft reconfig\n")
6339{
6340 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6341 BGP_CLEAR_SOFT_BOTH, argv[0]);
6342}
6343
6344ALIAS (clear_bgp_as_soft,
6345 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006346 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006347 CLEAR_STR
6348 BGP_STR
6349 "Address family\n"
6350 "Clear peers with the AS number\n"
6351 "Soft reconfig\n")
6352
paulfee0f4c2004-09-13 05:12:46 +00006353/* RS-client soft reconfiguration. */
6354#ifdef HAVE_IPV6
6355DEFUN (clear_bgp_all_rsclient,
6356 clear_bgp_all_rsclient_cmd,
6357 "clear bgp * rsclient",
6358 CLEAR_STR
6359 BGP_STR
6360 "Clear all peers\n"
6361 "Soft reconfig for rsclient RIB\n")
6362{
6363 if (argc == 1)
6364 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6365 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6366
6367 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6368 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6369}
6370
6371ALIAS (clear_bgp_all_rsclient,
6372 clear_bgp_ipv6_all_rsclient_cmd,
6373 "clear bgp ipv6 * rsclient",
6374 CLEAR_STR
6375 BGP_STR
6376 "Address family\n"
6377 "Clear all peers\n"
6378 "Soft reconfig for rsclient RIB\n")
6379
6380ALIAS (clear_bgp_all_rsclient,
6381 clear_bgp_instance_all_rsclient_cmd,
6382 "clear bgp view WORD * rsclient",
6383 CLEAR_STR
6384 BGP_STR
6385 "BGP view\n"
6386 "view name\n"
6387 "Clear all peers\n"
6388 "Soft reconfig for rsclient RIB\n")
6389
6390ALIAS (clear_bgp_all_rsclient,
6391 clear_bgp_ipv6_instance_all_rsclient_cmd,
6392 "clear bgp ipv6 view WORD * rsclient",
6393 CLEAR_STR
6394 BGP_STR
6395 "Address family\n"
6396 "BGP view\n"
6397 "view name\n"
6398 "Clear all peers\n"
6399 "Soft reconfig for rsclient RIB\n")
6400#endif /* HAVE_IPV6 */
6401
6402DEFUN (clear_ip_bgp_all_rsclient,
6403 clear_ip_bgp_all_rsclient_cmd,
6404 "clear ip bgp * rsclient",
6405 CLEAR_STR
6406 IP_STR
6407 BGP_STR
6408 "Clear all peers\n"
6409 "Soft reconfig for rsclient RIB\n")
6410{
6411 if (argc == 1)
6412 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6413 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6414
6415 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6416 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6417}
6418
6419ALIAS (clear_ip_bgp_all_rsclient,
6420 clear_ip_bgp_instance_all_rsclient_cmd,
6421 "clear ip bgp view WORD * rsclient",
6422 CLEAR_STR
6423 IP_STR
6424 BGP_STR
6425 "BGP view\n"
6426 "view name\n"
6427 "Clear all peers\n"
6428 "Soft reconfig for rsclient RIB\n")
6429
6430#ifdef HAVE_IPV6
6431DEFUN (clear_bgp_peer_rsclient,
6432 clear_bgp_peer_rsclient_cmd,
6433 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
6434 CLEAR_STR
6435 BGP_STR
6436 "BGP neighbor IP address to clear\n"
6437 "BGP IPv6 neighbor to clear\n"
6438 "Soft reconfig for rsclient RIB\n")
6439{
6440 if (argc == 2)
6441 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
6442 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6443
6444 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6445 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6446}
6447
6448ALIAS (clear_bgp_peer_rsclient,
6449 clear_bgp_ipv6_peer_rsclient_cmd,
6450 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
6451 CLEAR_STR
6452 BGP_STR
6453 "Address family\n"
6454 "BGP neighbor IP address to clear\n"
6455 "BGP IPv6 neighbor to clear\n"
6456 "Soft reconfig for rsclient RIB\n")
6457
6458ALIAS (clear_bgp_peer_rsclient,
6459 clear_bgp_instance_peer_rsclient_cmd,
6460 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6461 CLEAR_STR
6462 BGP_STR
6463 "BGP view\n"
6464 "view name\n"
6465 "BGP neighbor IP address to clear\n"
6466 "BGP IPv6 neighbor to clear\n"
6467 "Soft reconfig for rsclient RIB\n")
6468
6469ALIAS (clear_bgp_peer_rsclient,
6470 clear_bgp_ipv6_instance_peer_rsclient_cmd,
6471 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
6472 CLEAR_STR
6473 BGP_STR
6474 "Address family\n"
6475 "BGP view\n"
6476 "view name\n"
6477 "BGP neighbor IP address to clear\n"
6478 "BGP IPv6 neighbor to clear\n"
6479 "Soft reconfig for rsclient RIB\n")
6480#endif /* HAVE_IPV6 */
6481
6482DEFUN (clear_ip_bgp_peer_rsclient,
6483 clear_ip_bgp_peer_rsclient_cmd,
6484 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
6485 CLEAR_STR
6486 IP_STR
6487 BGP_STR
6488 "BGP neighbor IP address to clear\n"
6489 "BGP IPv6 neighbor to clear\n"
6490 "Soft reconfig for rsclient RIB\n")
6491{
6492 if (argc == 2)
6493 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
6494 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6495
6496 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6497 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6498}
6499
6500ALIAS (clear_ip_bgp_peer_rsclient,
6501 clear_ip_bgp_instance_peer_rsclient_cmd,
6502 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6503 CLEAR_STR
6504 IP_STR
6505 BGP_STR
6506 "BGP view\n"
6507 "view name\n"
6508 "BGP neighbor IP address to clear\n"
6509 "BGP IPv6 neighbor to clear\n"
6510 "Soft reconfig for rsclient RIB\n")
6511
Michael Lamberte0081f72008-11-16 20:12:04 +00006512DEFUN (show_bgp_views,
6513 show_bgp_views_cmd,
6514 "show bgp views",
6515 SHOW_STR
6516 BGP_STR
6517 "Show the defined BGP views\n")
6518{
6519 struct list *inst = bm->bgp;
6520 struct listnode *node;
6521 struct bgp *bgp;
6522
6523 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
6524 {
6525 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
6526 return CMD_WARNING;
6527 }
6528
6529 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
6530 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
6531 vty_out (vty, "\t%s (AS%u)%s",
6532 bgp->name ? bgp->name : "(null)",
6533 bgp->as, VTY_NEWLINE);
6534
6535 return CMD_SUCCESS;
6536}
6537
Paul Jakma4bf6a362006-03-30 14:05:23 +00006538DEFUN (show_bgp_memory,
6539 show_bgp_memory_cmd,
6540 "show bgp memory",
6541 SHOW_STR
6542 BGP_STR
6543 "Global BGP memory statistics\n")
6544{
6545 char memstrbuf[MTYPE_MEMSTR_LEN];
6546 unsigned long count;
6547
6548 /* RIB related usage stats */
6549 count = mtype_stats_alloc (MTYPE_BGP_NODE);
6550 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
6551 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6552 count * sizeof (struct bgp_node)),
6553 VTY_NEWLINE);
6554
6555 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
6556 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
6557 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6558 count * sizeof (struct bgp_info)),
6559 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006560 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
6561 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
6562 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6563 count * sizeof (struct bgp_info_extra)),
6564 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006565
6566 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
6567 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
6568 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6569 count * sizeof (struct bgp_static)),
6570 VTY_NEWLINE);
6571
6572 /* Adj-In/Out */
6573 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
6574 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
6575 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6576 count * sizeof (struct bgp_adj_in)),
6577 VTY_NEWLINE);
6578 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
6579 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
6580 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6581 count * sizeof (struct bgp_adj_out)),
6582 VTY_NEWLINE);
6583
6584 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
6585 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
6586 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6587 count * sizeof (struct bgp_nexthop_cache)),
6588 VTY_NEWLINE);
6589
6590 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
6591 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
6592 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6593 count * sizeof (struct bgp_damp_info)),
6594 VTY_NEWLINE);
6595
6596 /* Attributes */
6597 count = attr_count();
6598 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
6599 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6600 count * sizeof(struct attr)),
6601 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006602 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
6603 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
6604 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6605 count * sizeof(struct attr_extra)),
6606 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006607
6608 if ((count = attr_unknown_count()))
6609 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
6610
6611 /* AS_PATH attributes */
6612 count = aspath_count ();
6613 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
6614 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6615 count * sizeof (struct aspath)),
6616 VTY_NEWLINE);
6617
6618 count = mtype_stats_alloc (MTYPE_AS_SEG);
6619 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
6620 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6621 count * sizeof (struct assegment)),
6622 VTY_NEWLINE);
6623
6624 /* Other attributes */
6625 if ((count = community_count ()))
6626 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6627 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6628 count * sizeof (struct community)),
6629 VTY_NEWLINE);
6630 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
6631 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6632 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6633 count * sizeof (struct ecommunity)),
6634 VTY_NEWLINE);
6635
6636 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
6637 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
6638 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6639 count * sizeof (struct cluster_list)),
6640 VTY_NEWLINE);
6641
6642 /* Peer related usage */
6643 count = mtype_stats_alloc (MTYPE_BGP_PEER);
6644 vty_out (vty, "%ld peers, using %s of memory%s", count,
6645 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6646 count * sizeof (struct peer)),
6647 VTY_NEWLINE);
6648
6649 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
6650 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
6651 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6652 count * sizeof (struct peer_group)),
6653 VTY_NEWLINE);
6654
6655 /* Other */
6656 if ((count = mtype_stats_alloc (MTYPE_HASH)))
6657 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
6658 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6659 count * sizeof (struct hash)),
6660 VTY_NEWLINE);
6661 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
6662 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
6663 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6664 count * sizeof (struct hash_backet)),
6665 VTY_NEWLINE);
6666 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
6667 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
6668 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6669 count * sizeof (regex_t)),
6670 VTY_NEWLINE);
6671 return CMD_SUCCESS;
6672}
paulfee0f4c2004-09-13 05:12:46 +00006673
paul718e3742002-12-13 20:15:29 +00006674/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00006675static int
paul718e3742002-12-13 20:15:29 +00006676bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
6677{
6678 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00006679 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00006680 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00006681 char timebuf[BGP_UPTIME_LEN];
6682 int len;
6683
6684 /* Header string for each address family. */
6685 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00006686
paul1eb8ef22005-04-07 07:30:20 +00006687 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00006688 {
6689 if (peer->afc[afi][safi])
6690 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00006691 if (!count)
6692 {
6693 unsigned long ents;
6694 char memstrbuf[MTYPE_MEMSTR_LEN];
6695
6696 /* Usage summary and header */
6697 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04006698 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00006699 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006700
Paul Jakma4bf6a362006-03-30 14:05:23 +00006701 ents = bgp_table_count (bgp->rib[afi][safi]);
6702 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
6703 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6704 ents * sizeof (struct bgp_node)),
6705 VTY_NEWLINE);
6706
6707 /* Peer related usage */
6708 ents = listcount (bgp->peer);
6709 vty_out (vty, "Peers %ld, using %s of memory%s",
6710 ents,
6711 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6712 ents * sizeof (struct peer)),
6713 VTY_NEWLINE);
6714
6715 if ((ents = listcount (bgp->rsclient)))
6716 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
6717 ents,
6718 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6719 ents * sizeof (struct peer)),
6720 VTY_NEWLINE);
6721
6722 if ((ents = listcount (bgp->group)))
6723 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
6724 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6725 ents * sizeof (struct peer_group)),
6726 VTY_NEWLINE);
6727
6728 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
6729 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
6730 vty_out (vty, "%s", VTY_NEWLINE);
6731 vty_out (vty, "%s%s", header, VTY_NEWLINE);
6732 }
6733
paul718e3742002-12-13 20:15:29 +00006734 count++;
6735
6736 len = vty_out (vty, "%s", peer->host);
6737 len = 16 - len;
6738 if (len < 1)
6739 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
6740 else
6741 vty_out (vty, "%*s", len, " ");
6742
hasso3d515fd2005-02-01 21:30:04 +00006743 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00006744
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04006745 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00006746 peer->as,
6747 peer->open_in + peer->update_in + peer->keepalive_in
6748 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
6749 peer->open_out + peer->update_out + peer->keepalive_out
6750 + peer->notify_out + peer->refresh_out
6751 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00006752 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00006753
6754 vty_out (vty, "%8s",
6755 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
6756
6757 if (peer->status == Established)
6758 {
6759 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
6760 }
6761 else
6762 {
6763 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
6764 vty_out (vty, " Idle (Admin)");
6765 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
6766 vty_out (vty, " Idle (PfxCt)");
6767 else
6768 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
6769 }
6770
6771 vty_out (vty, "%s", VTY_NEWLINE);
6772 }
6773 }
6774
6775 if (count)
6776 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
6777 count, VTY_NEWLINE);
6778 else
6779 vty_out (vty, "No %s neighbor is configured%s",
6780 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
6781 return CMD_SUCCESS;
6782}
6783
paul94f2b392005-06-28 12:44:16 +00006784static int
paulfd79ac92004-10-13 05:06:08 +00006785bgp_show_summary_vty (struct vty *vty, const char *name,
6786 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00006787{
6788 struct bgp *bgp;
6789
6790 if (name)
6791 {
6792 bgp = bgp_lookup_by_name (name);
6793
6794 if (! bgp)
6795 {
6796 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
6797 return CMD_WARNING;
6798 }
6799
6800 bgp_show_summary (vty, bgp, afi, safi);
6801 return CMD_SUCCESS;
6802 }
6803
6804 bgp = bgp_get_default ();
6805
6806 if (bgp)
6807 bgp_show_summary (vty, bgp, afi, safi);
6808
6809 return CMD_SUCCESS;
6810}
6811
6812/* `show ip bgp summary' commands. */
6813DEFUN (show_ip_bgp_summary,
6814 show_ip_bgp_summary_cmd,
6815 "show ip bgp summary",
6816 SHOW_STR
6817 IP_STR
6818 BGP_STR
6819 "Summary of BGP neighbor status\n")
6820{
6821 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
6822}
6823
6824DEFUN (show_ip_bgp_instance_summary,
6825 show_ip_bgp_instance_summary_cmd,
6826 "show ip bgp view WORD summary",
6827 SHOW_STR
6828 IP_STR
6829 BGP_STR
6830 "BGP view\n"
6831 "View name\n"
6832 "Summary of BGP neighbor status\n")
6833{
6834 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
6835}
6836
6837DEFUN (show_ip_bgp_ipv4_summary,
6838 show_ip_bgp_ipv4_summary_cmd,
6839 "show ip bgp ipv4 (unicast|multicast) summary",
6840 SHOW_STR
6841 IP_STR
6842 BGP_STR
6843 "Address family\n"
6844 "Address Family modifier\n"
6845 "Address Family modifier\n"
6846 "Summary of BGP neighbor status\n")
6847{
6848 if (strncmp (argv[0], "m", 1) == 0)
6849 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
6850
6851 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
6852}
6853
6854DEFUN (show_ip_bgp_instance_ipv4_summary,
6855 show_ip_bgp_instance_ipv4_summary_cmd,
6856 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
6857 SHOW_STR
6858 IP_STR
6859 BGP_STR
6860 "BGP view\n"
6861 "View name\n"
6862 "Address family\n"
6863 "Address Family modifier\n"
6864 "Address Family modifier\n"
6865 "Summary of BGP neighbor status\n")
6866{
6867 if (strncmp (argv[1], "m", 1) == 0)
6868 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
6869 else
6870 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
6871}
6872
6873DEFUN (show_ip_bgp_vpnv4_all_summary,
6874 show_ip_bgp_vpnv4_all_summary_cmd,
6875 "show ip bgp vpnv4 all summary",
6876 SHOW_STR
6877 IP_STR
6878 BGP_STR
6879 "Display VPNv4 NLRI specific information\n"
6880 "Display information about all VPNv4 NLRIs\n"
6881 "Summary of BGP neighbor status\n")
6882{
6883 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
6884}
6885
6886DEFUN (show_ip_bgp_vpnv4_rd_summary,
6887 show_ip_bgp_vpnv4_rd_summary_cmd,
6888 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
6889 SHOW_STR
6890 IP_STR
6891 BGP_STR
6892 "Display VPNv4 NLRI specific information\n"
6893 "Display information for a route distinguisher\n"
6894 "VPN Route Distinguisher\n"
6895 "Summary of BGP neighbor status\n")
6896{
6897 int ret;
6898 struct prefix_rd prd;
6899
6900 ret = str2prefix_rd (argv[0], &prd);
6901 if (! ret)
6902 {
6903 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
6904 return CMD_WARNING;
6905 }
6906
6907 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
6908}
6909
6910#ifdef HAVE_IPV6
6911DEFUN (show_bgp_summary,
6912 show_bgp_summary_cmd,
6913 "show bgp summary",
6914 SHOW_STR
6915 BGP_STR
6916 "Summary of BGP neighbor status\n")
6917{
6918 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
6919}
6920
6921DEFUN (show_bgp_instance_summary,
6922 show_bgp_instance_summary_cmd,
6923 "show bgp view WORD summary",
6924 SHOW_STR
6925 BGP_STR
6926 "BGP view\n"
6927 "View name\n"
6928 "Summary of BGP neighbor status\n")
6929{
6930 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
6931}
6932
6933ALIAS (show_bgp_summary,
6934 show_bgp_ipv6_summary_cmd,
6935 "show bgp ipv6 summary",
6936 SHOW_STR
6937 BGP_STR
6938 "Address family\n"
6939 "Summary of BGP neighbor status\n")
6940
6941ALIAS (show_bgp_instance_summary,
6942 show_bgp_instance_ipv6_summary_cmd,
6943 "show bgp view WORD ipv6 summary",
6944 SHOW_STR
6945 BGP_STR
6946 "BGP view\n"
6947 "View name\n"
6948 "Address family\n"
6949 "Summary of BGP neighbor status\n")
6950
6951/* old command */
6952DEFUN (show_ipv6_bgp_summary,
6953 show_ipv6_bgp_summary_cmd,
6954 "show ipv6 bgp summary",
6955 SHOW_STR
6956 IPV6_STR
6957 BGP_STR
6958 "Summary of BGP neighbor status\n")
6959{
6960 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
6961}
6962
6963/* old command */
6964DEFUN (show_ipv6_mbgp_summary,
6965 show_ipv6_mbgp_summary_cmd,
6966 "show ipv6 mbgp summary",
6967 SHOW_STR
6968 IPV6_STR
6969 MBGP_STR
6970 "Summary of BGP neighbor status\n")
6971{
6972 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
6973}
6974#endif /* HAVE_IPV6 */
6975
paulfd79ac92004-10-13 05:06:08 +00006976const char *
hasso538621f2004-05-21 09:31:30 +00006977afi_safi_print (afi_t afi, safi_t safi)
6978{
6979 if (afi == AFI_IP && safi == SAFI_UNICAST)
6980 return "IPv4 Unicast";
6981 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
6982 return "IPv4 Multicast";
6983 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
6984 return "VPNv4 Unicast";
6985 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
6986 return "IPv6 Unicast";
6987 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
6988 return "IPv6 Multicast";
6989 else
6990 return "Unknown";
6991}
6992
paul718e3742002-12-13 20:15:29 +00006993/* Show BGP peer's information. */
6994enum show_type
6995{
6996 show_all,
6997 show_peer
6998};
6999
paul94f2b392005-06-28 12:44:16 +00007000static void
paul718e3742002-12-13 20:15:29 +00007001bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7002 afi_t afi, safi_t safi,
7003 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7004 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7005{
7006 /* Send-Mode */
7007 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7008 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7009 {
7010 vty_out (vty, " Send-mode: ");
7011 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7012 vty_out (vty, "advertised");
7013 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7014 vty_out (vty, "%sreceived",
7015 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7016 ", " : "");
7017 vty_out (vty, "%s", VTY_NEWLINE);
7018 }
7019
7020 /* Receive-Mode */
7021 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7022 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7023 {
7024 vty_out (vty, " Receive-mode: ");
7025 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7026 vty_out (vty, "advertised");
7027 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7028 vty_out (vty, "%sreceived",
7029 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7030 ", " : "");
7031 vty_out (vty, "%s", VTY_NEWLINE);
7032 }
7033}
7034
paul94f2b392005-06-28 12:44:16 +00007035static void
paul718e3742002-12-13 20:15:29 +00007036bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7037{
7038 struct bgp_filter *filter;
7039 char orf_pfx_name[BUFSIZ];
7040 int orf_pfx_count;
7041
7042 filter = &p->filter[afi][safi];
7043
hasso538621f2004-05-21 09:31:30 +00007044 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007045 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007046
paul718e3742002-12-13 20:15:29 +00007047 if (p->af_group[afi][safi])
7048 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7049
7050 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7051 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7052 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7053 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7054 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7055 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7056 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7057
7058 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7059 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7060 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7061 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7062 {
7063 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7064 ORF_TYPE_PREFIX, VTY_NEWLINE);
7065 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7066 PEER_CAP_ORF_PREFIX_SM_ADV,
7067 PEER_CAP_ORF_PREFIX_RM_ADV,
7068 PEER_CAP_ORF_PREFIX_SM_RCV,
7069 PEER_CAP_ORF_PREFIX_RM_RCV);
7070 }
7071 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7072 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7073 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7074 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7075 {
7076 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7077 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7078 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7079 PEER_CAP_ORF_PREFIX_SM_ADV,
7080 PEER_CAP_ORF_PREFIX_RM_ADV,
7081 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7082 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7083 }
7084
7085 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7086 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7087
7088 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7089 || orf_pfx_count)
7090 {
7091 vty_out (vty, " Outbound Route Filter (ORF):");
7092 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7093 vty_out (vty, " sent;");
7094 if (orf_pfx_count)
7095 vty_out (vty, " received (%d entries)", orf_pfx_count);
7096 vty_out (vty, "%s", VTY_NEWLINE);
7097 }
7098 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7099 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7100
7101 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7102 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7103 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7104 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7105 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7106 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7107 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7108 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7109 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7110 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
7111 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
7112 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7113 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
7114 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7115 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
7116 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
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))
7119 {
7120 vty_out (vty, " Community attribute sent to this neighbor");
7121 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7122 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007123 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007124 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007125 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007126 else
hasso538621f2004-05-21 09:31:30 +00007127 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007128 }
7129 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
7130 {
7131 vty_out (vty, " Default information originate,");
7132
7133 if (p->default_rmap[afi][safi].name)
7134 vty_out (vty, " default route-map %s%s,",
7135 p->default_rmap[afi][safi].map ? "*" : "",
7136 p->default_rmap[afi][safi].name);
7137 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
7138 vty_out (vty, " default sent%s", VTY_NEWLINE);
7139 else
7140 vty_out (vty, " default not sent%s", VTY_NEWLINE);
7141 }
7142
7143 if (filter->plist[FILTER_IN].name
7144 || filter->dlist[FILTER_IN].name
7145 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00007146 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007147 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
7148 if (filter->plist[FILTER_OUT].name
7149 || filter->dlist[FILTER_OUT].name
7150 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00007151 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00007152 || filter->usmap.name)
7153 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007154 if (filter->map[RMAP_IMPORT].name)
7155 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
7156 if (filter->map[RMAP_EXPORT].name)
7157 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007158
7159 /* prefix-list */
7160 if (filter->plist[FILTER_IN].name)
7161 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
7162 filter->plist[FILTER_IN].plist ? "*" : "",
7163 filter->plist[FILTER_IN].name,
7164 VTY_NEWLINE);
7165 if (filter->plist[FILTER_OUT].name)
7166 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
7167 filter->plist[FILTER_OUT].plist ? "*" : "",
7168 filter->plist[FILTER_OUT].name,
7169 VTY_NEWLINE);
7170
7171 /* distribute-list */
7172 if (filter->dlist[FILTER_IN].name)
7173 vty_out (vty, " Incoming update network filter list is %s%s%s",
7174 filter->dlist[FILTER_IN].alist ? "*" : "",
7175 filter->dlist[FILTER_IN].name,
7176 VTY_NEWLINE);
7177 if (filter->dlist[FILTER_OUT].name)
7178 vty_out (vty, " Outgoing update network filter list is %s%s%s",
7179 filter->dlist[FILTER_OUT].alist ? "*" : "",
7180 filter->dlist[FILTER_OUT].name,
7181 VTY_NEWLINE);
7182
7183 /* filter-list. */
7184 if (filter->aslist[FILTER_IN].name)
7185 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
7186 filter->aslist[FILTER_IN].aslist ? "*" : "",
7187 filter->aslist[FILTER_IN].name,
7188 VTY_NEWLINE);
7189 if (filter->aslist[FILTER_OUT].name)
7190 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
7191 filter->aslist[FILTER_OUT].aslist ? "*" : "",
7192 filter->aslist[FILTER_OUT].name,
7193 VTY_NEWLINE);
7194
7195 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00007196 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007197 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007198 filter->map[RMAP_IN].map ? "*" : "",
7199 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00007200 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007201 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00007202 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007203 filter->map[RMAP_OUT].map ? "*" : "",
7204 filter->map[RMAP_OUT].name,
7205 VTY_NEWLINE);
7206 if (filter->map[RMAP_IMPORT].name)
7207 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
7208 filter->map[RMAP_IMPORT].map ? "*" : "",
7209 filter->map[RMAP_IMPORT].name,
7210 VTY_NEWLINE);
7211 if (filter->map[RMAP_EXPORT].name)
7212 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
7213 filter->map[RMAP_EXPORT].map ? "*" : "",
7214 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00007215 VTY_NEWLINE);
7216
7217 /* unsuppress-map */
7218 if (filter->usmap.name)
7219 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
7220 filter->usmap.map ? "*" : "",
7221 filter->usmap.name, VTY_NEWLINE);
7222
7223 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00007224 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
7225
paul718e3742002-12-13 20:15:29 +00007226 /* Maximum prefix */
7227 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
7228 {
hasso0a486e52005-02-01 20:57:17 +00007229 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00007230 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00007231 ? " (warning-only)" : "", VTY_NEWLINE);
7232 vty_out (vty, " Threshold for warning message %d%%",
7233 p->pmax_threshold[afi][safi]);
7234 if (p->pmax_restart[afi][safi])
7235 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
7236 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007237 }
paul718e3742002-12-13 20:15:29 +00007238
7239 vty_out (vty, "%s", VTY_NEWLINE);
7240}
7241
paul94f2b392005-06-28 12:44:16 +00007242static void
paul718e3742002-12-13 20:15:29 +00007243bgp_show_peer (struct vty *vty, struct peer *p)
7244{
7245 struct bgp *bgp;
7246 char buf1[BUFSIZ];
7247 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00007248 afi_t afi;
7249 safi_t safi;
paul718e3742002-12-13 20:15:29 +00007250
7251 bgp = p->bgp;
7252
7253 /* Configured IP address. */
7254 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007255 vty_out (vty, "remote AS %u, ", p->as);
7256 vty_out (vty, "local AS %u%s, ",
paul718e3742002-12-13 20:15:29 +00007257 p->change_local_as ? p->change_local_as : p->local_as,
7258 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
7259 " no-prepend" : "");
7260 vty_out (vty, "%s link%s",
7261 p->as == p->local_as ? "internal" : "external",
7262 VTY_NEWLINE);
7263
7264 /* Description. */
7265 if (p->desc)
7266 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
7267
7268 /* Peer-group */
7269 if (p->group)
7270 vty_out (vty, " Member of peer-group %s for session parameters%s",
7271 p->group->name, VTY_NEWLINE);
7272
7273 /* Administrative shutdown. */
7274 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
7275 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
7276
7277 /* BGP Version. */
7278 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00007279 vty_out (vty, ", remote router ID %s%s",
7280 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
7281 VTY_NEWLINE);
7282
7283 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00007284 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
7285 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00007286 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
7287
7288 /* Status. */
7289 vty_out (vty, " BGP state = %s",
7290 LOOKUP (bgp_status_msg, p->status));
7291 if (p->status == Established)
7292 vty_out (vty, ", up for %8s",
7293 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00007294 else if (p->status == Active)
7295 {
7296 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7297 vty_out (vty, " (passive)");
7298 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7299 vty_out (vty, " (NSF passive)");
7300 }
paul718e3742002-12-13 20:15:29 +00007301 vty_out (vty, "%s", VTY_NEWLINE);
7302
7303 /* read timer */
7304 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7305
7306 /* Configured timer values. */
7307 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7308 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7309 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7310 {
7311 vty_out (vty, " Configured hold time is %d", p->holdtime);
7312 vty_out (vty, ", keepalive interval is %d seconds%s",
7313 p->keepalive, VTY_NEWLINE);
7314 }
hasso93406d82005-02-02 14:40:33 +00007315
paul718e3742002-12-13 20:15:29 +00007316 /* Capability. */
7317 if (p->status == Established)
7318 {
hasso538621f2004-05-21 09:31:30 +00007319 if (p->cap
paul718e3742002-12-13 20:15:29 +00007320 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7321 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7322 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7323 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7324#ifdef HAVE_IPV6
7325 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7326 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7327 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7328 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
7329#endif /* HAVE_IPV6 */
7330 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7331 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7332 {
7333 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7334
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007335 /* AS4 */
7336 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
7337 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7338 {
7339 vty_out (vty, " 4 Byte AS:");
7340 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7341 vty_out (vty, " advertised");
7342 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
7343 vty_out (vty, " %sreceived",
7344 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
7345 vty_out (vty, "%s", VTY_NEWLINE);
7346 }
paul718e3742002-12-13 20:15:29 +00007347 /* Dynamic */
7348 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
7349 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7350 {
7351 vty_out (vty, " Dynamic:");
7352 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7353 vty_out (vty, " advertised");
7354 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00007355 vty_out (vty, " %sreceived",
7356 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007357 vty_out (vty, "%s", VTY_NEWLINE);
7358 }
7359
7360 /* Route Refresh */
7361 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
7362 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7363 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
7364 {
7365 vty_out (vty, " Route refresh:");
7366 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
7367 vty_out (vty, " advertised");
7368 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7369 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00007370 vty_out (vty, " %sreceived(%s)",
7371 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
7372 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
7373 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
7374 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
7375
paul718e3742002-12-13 20:15:29 +00007376 vty_out (vty, "%s", VTY_NEWLINE);
7377 }
7378
hasso538621f2004-05-21 09:31:30 +00007379 /* Multiprotocol Extensions */
7380 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7381 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7382 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00007383 {
hasso538621f2004-05-21 09:31:30 +00007384 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
7385 if (p->afc_adv[afi][safi])
7386 vty_out (vty, " advertised");
7387 if (p->afc_recv[afi][safi])
7388 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
7389 vty_out (vty, "%s", VTY_NEWLINE);
7390 }
7391
7392 /* Gracefull Restart */
7393 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7394 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007395 {
hasso538621f2004-05-21 09:31:30 +00007396 vty_out (vty, " Graceful Restart Capabilty:");
7397 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007398 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00007399 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
7400 vty_out (vty, " %sreceived",
7401 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007402 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007403
7404 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00007405 {
hasso538621f2004-05-21 09:31:30 +00007406 int restart_af_count = 0;
7407
7408 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00007409 p->v_gr_restart, VTY_NEWLINE);
7410 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007411
7412 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7413 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7414 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
7415 {
hasso93406d82005-02-02 14:40:33 +00007416 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
7417 afi_safi_print (afi, safi),
7418 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
7419 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00007420 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00007421 }
hasso538621f2004-05-21 09:31:30 +00007422 if (! restart_af_count)
7423 vty_out (vty, "none");
7424 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007425 }
paul718e3742002-12-13 20:15:29 +00007426 }
paul718e3742002-12-13 20:15:29 +00007427 }
7428 }
7429
hasso93406d82005-02-02 14:40:33 +00007430 /* graceful restart information */
7431 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7432 || p->t_gr_restart
7433 || p->t_gr_stale)
7434 {
7435 int eor_send_af_count = 0;
7436 int eor_receive_af_count = 0;
7437
7438 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
7439 if (p->status == Established)
7440 {
7441 vty_out (vty, " End-of-RIB send: ");
7442 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7443 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7444 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
7445 {
7446 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
7447 afi_safi_print (afi, safi));
7448 eor_send_af_count++;
7449 }
7450 vty_out (vty, "%s", VTY_NEWLINE);
7451
7452 vty_out (vty, " End-of-RIB received: ");
7453 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7454 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7455 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
7456 {
7457 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
7458 afi_safi_print (afi, safi));
7459 eor_receive_af_count++;
7460 }
7461 vty_out (vty, "%s", VTY_NEWLINE);
7462 }
7463
7464 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007465 vty_out (vty, " The remaining time of restart timer is %ld%s",
7466 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
7467
hasso93406d82005-02-02 14:40:33 +00007468 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007469 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
7470 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007471 }
7472
paul718e3742002-12-13 20:15:29 +00007473 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00007474 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
7475 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007476 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007477 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
7478 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
7479 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
7480 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
7481 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
7482 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
7483 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
7484 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
7485 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
7486 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
7487 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007488
7489 /* advertisement-interval */
7490 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
7491 p->v_routeadv, VTY_NEWLINE);
7492
7493 /* Update-source. */
7494 if (p->update_if || p->update_source)
7495 {
7496 vty_out (vty, " Update source is ");
7497 if (p->update_if)
7498 vty_out (vty, "%s", p->update_if);
7499 else if (p->update_source)
7500 vty_out (vty, "%s",
7501 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
7502 vty_out (vty, "%s", VTY_NEWLINE);
7503 }
7504
7505 /* Default weight */
7506 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
7507 vty_out (vty, " Default weight %d%s", p->weight,
7508 VTY_NEWLINE);
7509
7510 vty_out (vty, "%s", VTY_NEWLINE);
7511
7512 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00007513 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7514 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7515 if (p->afc[afi][safi])
7516 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00007517
7518 vty_out (vty, " Connections established %d; dropped %d%s",
7519 p->established, p->dropped,
7520 VTY_NEWLINE);
7521
hassoe0701b72004-05-20 09:19:34 +00007522 if (! p->dropped)
7523 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
7524 else
7525 vty_out (vty, " Last reset %s, due to %s%s",
7526 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
7527 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00007528
paul718e3742002-12-13 20:15:29 +00007529 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7530 {
7531 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00007532
7533 if (p->t_pmax_restart)
7534 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
7535 p->host, thread_timer_remain_second (p->t_pmax_restart),
7536 VTY_NEWLINE);
7537 else
7538 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
7539 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007540 }
7541
7542 /* EBGP Multihop */
7543 if (peer_sort (p) != BGP_PEER_IBGP && p->ttl > 1)
7544 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7545 p->ttl, VTY_NEWLINE);
7546
7547 /* Local address. */
7548 if (p->su_local)
7549 {
hasso93406d82005-02-02 14:40:33 +00007550 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00007551 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
7552 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00007553 VTY_NEWLINE);
7554 }
7555
7556 /* Remote address. */
7557 if (p->su_remote)
7558 {
7559 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
7560 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
7561 ntohs (p->su_remote->sin.sin_port),
7562 VTY_NEWLINE);
7563 }
7564
7565 /* Nexthop display. */
7566 if (p->su_local)
7567 {
7568 vty_out (vty, "Nexthop: %s%s",
7569 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
7570 VTY_NEWLINE);
7571#ifdef HAVE_IPV6
7572 vty_out (vty, "Nexthop global: %s%s",
7573 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
7574 VTY_NEWLINE);
7575 vty_out (vty, "Nexthop local: %s%s",
7576 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
7577 VTY_NEWLINE);
7578 vty_out (vty, "BGP connection: %s%s",
7579 p->shared_network ? "shared network" : "non shared network",
7580 VTY_NEWLINE);
7581#endif /* HAVE_IPV6 */
7582 }
7583
7584 /* Timer information. */
7585 if (p->t_start)
7586 vty_out (vty, "Next start timer due in %ld seconds%s",
7587 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
7588 if (p->t_connect)
7589 vty_out (vty, "Next connect timer due in %ld seconds%s",
7590 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
7591
7592 vty_out (vty, "Read thread: %s Write thread: %s%s",
7593 p->t_read ? "on" : "off",
7594 p->t_write ? "on" : "off",
7595 VTY_NEWLINE);
7596
7597 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
7598 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
7599 bgp_capability_vty_out (vty, p);
7600
7601 vty_out (vty, "%s", VTY_NEWLINE);
7602}
7603
paul94f2b392005-06-28 12:44:16 +00007604static int
paul718e3742002-12-13 20:15:29 +00007605bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
7606 enum show_type type, union sockunion *su)
7607{
paul1eb8ef22005-04-07 07:30:20 +00007608 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00007609 struct peer *peer;
7610 int find = 0;
7611
paul1eb8ef22005-04-07 07:30:20 +00007612 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007613 {
7614 switch (type)
7615 {
7616 case show_all:
7617 bgp_show_peer (vty, peer);
7618 break;
7619 case show_peer:
7620 if (sockunion_same (&peer->su, su))
7621 {
7622 find = 1;
7623 bgp_show_peer (vty, peer);
7624 }
7625 break;
7626 }
7627 }
7628
7629 if (type == show_peer && ! find)
7630 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
7631
7632 return CMD_SUCCESS;
7633}
7634
paul94f2b392005-06-28 12:44:16 +00007635static int
paulfd79ac92004-10-13 05:06:08 +00007636bgp_show_neighbor_vty (struct vty *vty, const char *name,
7637 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00007638{
7639 int ret;
7640 struct bgp *bgp;
7641 union sockunion su;
7642
7643 if (ip_str)
7644 {
7645 ret = str2sockunion (ip_str, &su);
7646 if (ret < 0)
7647 {
7648 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
7649 return CMD_WARNING;
7650 }
7651 }
7652
7653 if (name)
7654 {
7655 bgp = bgp_lookup_by_name (name);
7656
7657 if (! bgp)
7658 {
7659 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7660 return CMD_WARNING;
7661 }
7662
7663 bgp_show_neighbor (vty, bgp, type, &su);
7664
7665 return CMD_SUCCESS;
7666 }
7667
7668 bgp = bgp_get_default ();
7669
7670 if (bgp)
7671 bgp_show_neighbor (vty, bgp, type, &su);
7672
7673 return CMD_SUCCESS;
7674}
7675
7676/* "show ip bgp neighbors" commands. */
7677DEFUN (show_ip_bgp_neighbors,
7678 show_ip_bgp_neighbors_cmd,
7679 "show ip bgp neighbors",
7680 SHOW_STR
7681 IP_STR
7682 BGP_STR
7683 "Detailed information on TCP and BGP neighbor connections\n")
7684{
7685 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
7686}
7687
7688ALIAS (show_ip_bgp_neighbors,
7689 show_ip_bgp_ipv4_neighbors_cmd,
7690 "show ip bgp ipv4 (unicast|multicast) neighbors",
7691 SHOW_STR
7692 IP_STR
7693 BGP_STR
7694 "Address family\n"
7695 "Address Family modifier\n"
7696 "Address Family modifier\n"
7697 "Detailed information on TCP and BGP neighbor connections\n")
7698
7699ALIAS (show_ip_bgp_neighbors,
7700 show_ip_bgp_vpnv4_all_neighbors_cmd,
7701 "show ip bgp vpnv4 all neighbors",
7702 SHOW_STR
7703 IP_STR
7704 BGP_STR
7705 "Display VPNv4 NLRI specific information\n"
7706 "Display information about all VPNv4 NLRIs\n"
7707 "Detailed information on TCP and BGP neighbor connections\n")
7708
7709ALIAS (show_ip_bgp_neighbors,
7710 show_ip_bgp_vpnv4_rd_neighbors_cmd,
7711 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
7712 SHOW_STR
7713 IP_STR
7714 BGP_STR
7715 "Display VPNv4 NLRI specific information\n"
7716 "Display information for a route distinguisher\n"
7717 "VPN Route Distinguisher\n"
7718 "Detailed information on TCP and BGP neighbor connections\n")
7719
7720ALIAS (show_ip_bgp_neighbors,
7721 show_bgp_neighbors_cmd,
7722 "show bgp neighbors",
7723 SHOW_STR
7724 BGP_STR
7725 "Detailed information on TCP and BGP neighbor connections\n")
7726
7727ALIAS (show_ip_bgp_neighbors,
7728 show_bgp_ipv6_neighbors_cmd,
7729 "show bgp ipv6 neighbors",
7730 SHOW_STR
7731 BGP_STR
7732 "Address family\n"
7733 "Detailed information on TCP and BGP neighbor connections\n")
7734
7735DEFUN (show_ip_bgp_neighbors_peer,
7736 show_ip_bgp_neighbors_peer_cmd,
7737 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
7738 SHOW_STR
7739 IP_STR
7740 BGP_STR
7741 "Detailed information on TCP and BGP neighbor connections\n"
7742 "Neighbor to display information about\n"
7743 "Neighbor to display information about\n")
7744{
7745 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
7746}
7747
7748ALIAS (show_ip_bgp_neighbors_peer,
7749 show_ip_bgp_ipv4_neighbors_peer_cmd,
7750 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
7751 SHOW_STR
7752 IP_STR
7753 BGP_STR
7754 "Address family\n"
7755 "Address Family modifier\n"
7756 "Address Family modifier\n"
7757 "Detailed information on TCP and BGP neighbor connections\n"
7758 "Neighbor to display information about\n"
7759 "Neighbor to display information about\n")
7760
7761ALIAS (show_ip_bgp_neighbors_peer,
7762 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
7763 "show ip bgp vpnv4 all neighbors A.B.C.D",
7764 SHOW_STR
7765 IP_STR
7766 BGP_STR
7767 "Display VPNv4 NLRI specific information\n"
7768 "Display information about all VPNv4 NLRIs\n"
7769 "Detailed information on TCP and BGP neighbor connections\n"
7770 "Neighbor to display information about\n")
7771
7772ALIAS (show_ip_bgp_neighbors_peer,
7773 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
7774 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
7775 SHOW_STR
7776 IP_STR
7777 BGP_STR
7778 "Display VPNv4 NLRI specific information\n"
7779 "Display information about all VPNv4 NLRIs\n"
7780 "Detailed information on TCP and BGP neighbor connections\n"
7781 "Neighbor to display information about\n")
7782
7783ALIAS (show_ip_bgp_neighbors_peer,
7784 show_bgp_neighbors_peer_cmd,
7785 "show bgp neighbors (A.B.C.D|X:X::X:X)",
7786 SHOW_STR
7787 BGP_STR
7788 "Detailed information on TCP and BGP neighbor connections\n"
7789 "Neighbor to display information about\n"
7790 "Neighbor to display information about\n")
7791
7792ALIAS (show_ip_bgp_neighbors_peer,
7793 show_bgp_ipv6_neighbors_peer_cmd,
7794 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
7795 SHOW_STR
7796 BGP_STR
7797 "Address family\n"
7798 "Detailed information on TCP and BGP neighbor connections\n"
7799 "Neighbor to display information about\n"
7800 "Neighbor to display information about\n")
7801
7802DEFUN (show_ip_bgp_instance_neighbors,
7803 show_ip_bgp_instance_neighbors_cmd,
7804 "show ip bgp view WORD neighbors",
7805 SHOW_STR
7806 IP_STR
7807 BGP_STR
7808 "BGP view\n"
7809 "View name\n"
7810 "Detailed information on TCP and BGP neighbor connections\n")
7811{
7812 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
7813}
7814
paulbb46e942003-10-24 19:02:03 +00007815ALIAS (show_ip_bgp_instance_neighbors,
7816 show_bgp_instance_neighbors_cmd,
7817 "show bgp view WORD neighbors",
7818 SHOW_STR
7819 BGP_STR
7820 "BGP view\n"
7821 "View name\n"
7822 "Detailed information on TCP and BGP neighbor connections\n")
7823
7824ALIAS (show_ip_bgp_instance_neighbors,
7825 show_bgp_instance_ipv6_neighbors_cmd,
7826 "show bgp view WORD ipv6 neighbors",
7827 SHOW_STR
7828 BGP_STR
7829 "BGP view\n"
7830 "View name\n"
7831 "Address family\n"
7832 "Detailed information on TCP and BGP neighbor connections\n")
7833
paul718e3742002-12-13 20:15:29 +00007834DEFUN (show_ip_bgp_instance_neighbors_peer,
7835 show_ip_bgp_instance_neighbors_peer_cmd,
7836 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
7837 SHOW_STR
7838 IP_STR
7839 BGP_STR
7840 "BGP view\n"
7841 "View name\n"
7842 "Detailed information on TCP and BGP neighbor connections\n"
7843 "Neighbor to display information about\n"
7844 "Neighbor to display information about\n")
7845{
7846 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
7847}
paulbb46e942003-10-24 19:02:03 +00007848
7849ALIAS (show_ip_bgp_instance_neighbors_peer,
7850 show_bgp_instance_neighbors_peer_cmd,
7851 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
7852 SHOW_STR
7853 BGP_STR
7854 "BGP view\n"
7855 "View name\n"
7856 "Detailed information on TCP and BGP neighbor connections\n"
7857 "Neighbor to display information about\n"
7858 "Neighbor to display information about\n")
7859
7860ALIAS (show_ip_bgp_instance_neighbors_peer,
7861 show_bgp_instance_ipv6_neighbors_peer_cmd,
7862 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
7863 SHOW_STR
7864 BGP_STR
7865 "BGP view\n"
7866 "View name\n"
7867 "Address family\n"
7868 "Detailed information on TCP and BGP neighbor connections\n"
7869 "Neighbor to display information about\n"
7870 "Neighbor to display information about\n")
7871
paul718e3742002-12-13 20:15:29 +00007872/* Show BGP's AS paths internal data. There are both `show ip bgp
7873 paths' and `show ip mbgp paths'. Those functions results are the
7874 same.*/
7875DEFUN (show_ip_bgp_paths,
7876 show_ip_bgp_paths_cmd,
7877 "show ip bgp paths",
7878 SHOW_STR
7879 IP_STR
7880 BGP_STR
7881 "Path information\n")
7882{
7883 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
7884 aspath_print_all_vty (vty);
7885 return CMD_SUCCESS;
7886}
7887
7888DEFUN (show_ip_bgp_ipv4_paths,
7889 show_ip_bgp_ipv4_paths_cmd,
7890 "show ip bgp ipv4 (unicast|multicast) paths",
7891 SHOW_STR
7892 IP_STR
7893 BGP_STR
7894 "Address family\n"
7895 "Address Family modifier\n"
7896 "Address Family modifier\n"
7897 "Path information\n")
7898{
7899 vty_out (vty, "Address Refcnt Path\r\n");
7900 aspath_print_all_vty (vty);
7901
7902 return CMD_SUCCESS;
7903}
7904
7905#include "hash.h"
7906
paul94f2b392005-06-28 12:44:16 +00007907static void
paul718e3742002-12-13 20:15:29 +00007908community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
7909{
7910 struct community *com;
7911
7912 com = (struct community *) backet->data;
7913 vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt,
7914 community_str (com), VTY_NEWLINE);
7915}
7916
7917/* Show BGP's community internal data. */
7918DEFUN (show_ip_bgp_community_info,
7919 show_ip_bgp_community_info_cmd,
7920 "show ip bgp community-info",
7921 SHOW_STR
7922 IP_STR
7923 BGP_STR
7924 "List all bgp community information\n")
7925{
7926 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
7927
7928 hash_iterate (community_hash (),
7929 (void (*) (struct hash_backet *, void *))
7930 community_show_all_iterator,
7931 vty);
7932
7933 return CMD_SUCCESS;
7934}
7935
7936DEFUN (show_ip_bgp_attr_info,
7937 show_ip_bgp_attr_info_cmd,
7938 "show ip bgp attribute-info",
7939 SHOW_STR
7940 IP_STR
7941 BGP_STR
7942 "List all bgp attribute information\n")
7943{
7944 attr_show_all (vty);
7945 return CMD_SUCCESS;
7946}
7947
paul94f2b392005-06-28 12:44:16 +00007948static int
paulfee0f4c2004-09-13 05:12:46 +00007949bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
7950 afi_t afi, safi_t safi)
7951{
7952 char timebuf[BGP_UPTIME_LEN];
7953 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00007954 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00007955 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007956 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00007957 int len;
7958 int count = 0;
7959
7960 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
7961 {
paul1eb8ef22005-04-07 07:30:20 +00007962 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00007963 {
7964 count++;
7965 bgp_write_rsclient_summary (vty, peer, afi, safi);
7966 }
7967 return count;
7968 }
7969
7970 len = vty_out (vty, "%s", rsclient->host);
7971 len = 16 - len;
7972
7973 if (len < 1)
7974 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7975 else
7976 vty_out (vty, "%*s", len, " ");
7977
hasso3d515fd2005-02-01 21:30:04 +00007978 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00007979
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007980 vty_out (vty, "%11d ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00007981
7982 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
7983 if ( rmname && strlen (rmname) > 13 )
7984 {
7985 sprintf (rmbuf, "%13s", "...");
7986 rmname = strncpy (rmbuf, rmname, 10);
7987 }
7988 else if (! rmname)
7989 rmname = "<none>";
7990 vty_out (vty, " %13s ", rmname);
7991
7992 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
7993 if ( rmname && strlen (rmname) > 13 )
7994 {
7995 sprintf (rmbuf, "%13s", "...");
7996 rmname = strncpy (rmbuf, rmname, 10);
7997 }
7998 else if (! rmname)
7999 rmname = "<none>";
8000 vty_out (vty, " %13s ", rmname);
8001
8002 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8003
8004 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8005 vty_out (vty, " Idle (Admin)");
8006 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8007 vty_out (vty, " Idle (PfxCt)");
8008 else
8009 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8010
8011 vty_out (vty, "%s", VTY_NEWLINE);
8012
8013 return 1;
8014}
8015
paul94f2b392005-06-28 12:44:16 +00008016static int
paulfd79ac92004-10-13 05:06:08 +00008017bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8018 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008019{
8020 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008021 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008022 int count = 0;
8023
8024 /* Header string for each address family. */
8025 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
8026
paul1eb8ef22005-04-07 07:30:20 +00008027 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008028 {
8029 if (peer->afc[afi][safi] &&
8030 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8031 {
8032 if (! count)
8033 {
8034 vty_out (vty,
8035 "Route Server's BGP router identifier %s%s",
8036 inet_ntoa (bgp->router_id), VTY_NEWLINE);
8037 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008038 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00008039 VTY_NEWLINE);
8040
8041 vty_out (vty, "%s", VTY_NEWLINE);
8042 vty_out (vty, "%s%s", header, VTY_NEWLINE);
8043 }
8044
8045 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
8046 }
8047 }
8048
8049 if (count)
8050 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
8051 count, VTY_NEWLINE);
8052 else
8053 vty_out (vty, "No %s Route Server Client is configured%s",
8054 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
8055
8056 return CMD_SUCCESS;
8057}
8058
paul94f2b392005-06-28 12:44:16 +00008059static int
paulfd79ac92004-10-13 05:06:08 +00008060bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
8061 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008062{
8063 struct bgp *bgp;
8064
8065 if (name)
8066 {
8067 bgp = bgp_lookup_by_name (name);
8068
8069 if (! bgp)
8070 {
8071 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8072 return CMD_WARNING;
8073 }
8074
8075 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8076 return CMD_SUCCESS;
8077 }
8078
8079 bgp = bgp_get_default ();
8080
8081 if (bgp)
8082 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8083
8084 return CMD_SUCCESS;
8085}
8086
8087/* 'show bgp rsclient' commands. */
8088DEFUN (show_ip_bgp_rsclient_summary,
8089 show_ip_bgp_rsclient_summary_cmd,
8090 "show ip bgp rsclient summary",
8091 SHOW_STR
8092 IP_STR
8093 BGP_STR
8094 "Information about Route Server Clients\n"
8095 "Summary of all Route Server Clients\n")
8096{
8097 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8098}
8099
8100DEFUN (show_ip_bgp_instance_rsclient_summary,
8101 show_ip_bgp_instance_rsclient_summary_cmd,
8102 "show ip bgp view WORD rsclient summary",
8103 SHOW_STR
8104 IP_STR
8105 BGP_STR
8106 "BGP view\n"
8107 "View name\n"
8108 "Information about Route Server Clients\n"
8109 "Summary of all Route Server Clients\n")
8110{
8111 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8112}
8113
8114DEFUN (show_ip_bgp_ipv4_rsclient_summary,
8115 show_ip_bgp_ipv4_rsclient_summary_cmd,
8116 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
8117 SHOW_STR
8118 IP_STR
8119 BGP_STR
8120 "Address family\n"
8121 "Address Family modifier\n"
8122 "Address Family modifier\n"
8123 "Information about Route Server Clients\n"
8124 "Summary of all Route Server Clients\n")
8125{
8126 if (strncmp (argv[0], "m", 1) == 0)
8127 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
8128
8129 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8130}
8131
8132DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
8133 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
8134 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8135 SHOW_STR
8136 IP_STR
8137 BGP_STR
8138 "BGP view\n"
8139 "View name\n"
8140 "Address family\n"
8141 "Address Family modifier\n"
8142 "Address Family modifier\n"
8143 "Information about Route Server Clients\n"
8144 "Summary of all Route Server Clients\n")
8145{
8146 if (strncmp (argv[1], "m", 1) == 0)
8147 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
8148
8149 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8150}
8151
8152#ifdef HAVE_IPV6
8153DEFUN (show_bgp_rsclient_summary,
8154 show_bgp_rsclient_summary_cmd,
8155 "show bgp rsclient summary",
8156 SHOW_STR
8157 BGP_STR
8158 "Information about Route Server Clients\n"
8159 "Summary of all Route Server Clients\n")
8160{
8161 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8162}
8163
8164DEFUN (show_bgp_instance_rsclient_summary,
8165 show_bgp_instance_rsclient_summary_cmd,
8166 "show bgp view WORD rsclient summary",
8167 SHOW_STR
8168 BGP_STR
8169 "BGP view\n"
8170 "View name\n"
8171 "Information about Route Server Clients\n"
8172 "Summary of all Route Server Clients\n")
8173{
8174 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
8175}
8176
8177ALIAS (show_bgp_rsclient_summary,
8178 show_bgp_ipv6_rsclient_summary_cmd,
8179 "show bgp ipv6 rsclient summary",
8180 SHOW_STR
8181 BGP_STR
8182 "Address family\n"
8183 "Information about Route Server Clients\n"
8184 "Summary of all Route Server Clients\n")
8185
8186ALIAS (show_bgp_instance_rsclient_summary,
8187 show_bgp_instance_ipv6_rsclient_summary_cmd,
8188 "show bgp view WORD ipv6 rsclient summary",
8189 SHOW_STR
8190 BGP_STR
8191 "BGP view\n"
8192 "View name\n"
8193 "Address family\n"
8194 "Information about Route Server Clients\n"
8195 "Summary of all Route Server Clients\n")
8196#endif /* HAVE IPV6 */
8197
paul718e3742002-12-13 20:15:29 +00008198/* Redistribute VTY commands. */
8199
8200/* Utility function to convert user input route type string to route
8201 type. */
8202static int
paulfd79ac92004-10-13 05:06:08 +00008203bgp_str2route_type (int afi, const char *str)
paul718e3742002-12-13 20:15:29 +00008204{
8205 if (! str)
8206 return 0;
8207
8208 if (afi == AFI_IP)
8209 {
8210 if (strncmp (str, "k", 1) == 0)
8211 return ZEBRA_ROUTE_KERNEL;
8212 else if (strncmp (str, "c", 1) == 0)
8213 return ZEBRA_ROUTE_CONNECT;
8214 else if (strncmp (str, "s", 1) == 0)
8215 return ZEBRA_ROUTE_STATIC;
8216 else if (strncmp (str, "r", 1) == 0)
8217 return ZEBRA_ROUTE_RIP;
8218 else if (strncmp (str, "o", 1) == 0)
8219 return ZEBRA_ROUTE_OSPF;
8220 }
8221 if (afi == AFI_IP6)
8222 {
8223 if (strncmp (str, "k", 1) == 0)
8224 return ZEBRA_ROUTE_KERNEL;
8225 else if (strncmp (str, "c", 1) == 0)
8226 return ZEBRA_ROUTE_CONNECT;
8227 else if (strncmp (str, "s", 1) == 0)
8228 return ZEBRA_ROUTE_STATIC;
8229 else if (strncmp (str, "r", 1) == 0)
8230 return ZEBRA_ROUTE_RIPNG;
8231 else if (strncmp (str, "o", 1) == 0)
8232 return ZEBRA_ROUTE_OSPF6;
8233 }
8234 return 0;
8235}
8236
8237DEFUN (bgp_redistribute_ipv4,
8238 bgp_redistribute_ipv4_cmd,
8239 "redistribute (connected|kernel|ospf|rip|static)",
8240 "Redistribute information from another routing protocol\n"
8241 "Connected\n"
8242 "Kernel routes\n"
8243 "Open Shurtest Path First (OSPF)\n"
8244 "Routing Information Protocol (RIP)\n"
8245 "Static routes\n")
8246{
8247 int type;
8248
8249 type = bgp_str2route_type (AFI_IP, argv[0]);
8250 if (! type)
8251 {
8252 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8253 return CMD_WARNING;
8254 }
8255 return bgp_redistribute_set (vty->index, AFI_IP, type);
8256}
8257
8258DEFUN (bgp_redistribute_ipv4_rmap,
8259 bgp_redistribute_ipv4_rmap_cmd,
8260 "redistribute (connected|kernel|ospf|rip|static) route-map WORD",
8261 "Redistribute information from another routing protocol\n"
8262 "Connected\n"
8263 "Kernel routes\n"
8264 "Open Shurtest Path First (OSPF)\n"
8265 "Routing Information Protocol (RIP)\n"
8266 "Static routes\n"
8267 "Route map reference\n"
8268 "Pointer to route-map entries\n")
8269{
8270 int type;
8271
8272 type = bgp_str2route_type (AFI_IP, argv[0]);
8273 if (! type)
8274 {
8275 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8276 return CMD_WARNING;
8277 }
8278
8279 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8280 return bgp_redistribute_set (vty->index, AFI_IP, type);
8281}
8282
8283DEFUN (bgp_redistribute_ipv4_metric,
8284 bgp_redistribute_ipv4_metric_cmd,
8285 "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
8286 "Redistribute information from another routing protocol\n"
8287 "Connected\n"
8288 "Kernel routes\n"
8289 "Open Shurtest Path First (OSPF)\n"
8290 "Routing Information Protocol (RIP)\n"
8291 "Static routes\n"
8292 "Metric for redistributed routes\n"
8293 "Default metric\n")
8294{
8295 int type;
8296 u_int32_t metric;
8297
8298 type = bgp_str2route_type (AFI_IP, argv[0]);
8299 if (! type)
8300 {
8301 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8302 return CMD_WARNING;
8303 }
8304 VTY_GET_INTEGER ("metric", metric, argv[1]);
8305
8306 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8307 return bgp_redistribute_set (vty->index, AFI_IP, type);
8308}
8309
8310DEFUN (bgp_redistribute_ipv4_rmap_metric,
8311 bgp_redistribute_ipv4_rmap_metric_cmd,
8312 "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
8313 "Redistribute information from another routing protocol\n"
8314 "Connected\n"
8315 "Kernel routes\n"
8316 "Open Shurtest Path First (OSPF)\n"
8317 "Routing Information Protocol (RIP)\n"
8318 "Static routes\n"
8319 "Route map reference\n"
8320 "Pointer to route-map entries\n"
8321 "Metric for redistributed routes\n"
8322 "Default metric\n")
8323{
8324 int type;
8325 u_int32_t metric;
8326
8327 type = bgp_str2route_type (AFI_IP, argv[0]);
8328 if (! type)
8329 {
8330 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8331 return CMD_WARNING;
8332 }
8333 VTY_GET_INTEGER ("metric", metric, argv[2]);
8334
8335 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8336 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8337 return bgp_redistribute_set (vty->index, AFI_IP, type);
8338}
8339
8340DEFUN (bgp_redistribute_ipv4_metric_rmap,
8341 bgp_redistribute_ipv4_metric_rmap_cmd,
8342 "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
8343 "Redistribute information from another routing protocol\n"
8344 "Connected\n"
8345 "Kernel routes\n"
8346 "Open Shurtest Path First (OSPF)\n"
8347 "Routing Information Protocol (RIP)\n"
8348 "Static routes\n"
8349 "Metric for redistributed routes\n"
8350 "Default metric\n"
8351 "Route map reference\n"
8352 "Pointer to route-map entries\n")
8353{
8354 int type;
8355 u_int32_t metric;
8356
8357 type = bgp_str2route_type (AFI_IP, argv[0]);
8358 if (! type)
8359 {
8360 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8361 return CMD_WARNING;
8362 }
8363 VTY_GET_INTEGER ("metric", metric, argv[1]);
8364
8365 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8366 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
8367 return bgp_redistribute_set (vty->index, AFI_IP, type);
8368}
8369
8370DEFUN (no_bgp_redistribute_ipv4,
8371 no_bgp_redistribute_ipv4_cmd,
8372 "no redistribute (connected|kernel|ospf|rip|static)",
8373 NO_STR
8374 "Redistribute information from another routing protocol\n"
8375 "Connected\n"
8376 "Kernel routes\n"
8377 "Open Shurtest Path First (OSPF)\n"
8378 "Routing Information Protocol (RIP)\n"
8379 "Static routes\n")
8380{
8381 int type;
8382
8383 type = bgp_str2route_type (AFI_IP, argv[0]);
8384 if (! type)
8385 {
8386 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8387 return CMD_WARNING;
8388 }
8389
8390 return bgp_redistribute_unset (vty->index, AFI_IP, type);
8391}
8392
8393DEFUN (no_bgp_redistribute_ipv4_rmap,
8394 no_bgp_redistribute_ipv4_rmap_cmd,
8395 "no redistribute (connected|kernel|ospf|rip|static) route-map WORD",
8396 NO_STR
8397 "Redistribute information from another routing protocol\n"
8398 "Connected\n"
8399 "Kernel routes\n"
8400 "Open Shurtest Path First (OSPF)\n"
8401 "Routing Information Protocol (RIP)\n"
8402 "Static routes\n"
8403 "Route map reference\n"
8404 "Pointer to route-map entries\n")
8405{
8406 int type;
8407
8408 type = bgp_str2route_type (AFI_IP, argv[0]);
8409 if (! type)
8410 {
8411 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8412 return CMD_WARNING;
8413 }
8414
8415 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8416 return CMD_SUCCESS;
8417}
8418
8419DEFUN (no_bgp_redistribute_ipv4_metric,
8420 no_bgp_redistribute_ipv4_metric_cmd,
8421 "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
8422 NO_STR
8423 "Redistribute information from another routing protocol\n"
8424 "Connected\n"
8425 "Kernel routes\n"
8426 "Open Shurtest Path First (OSPF)\n"
8427 "Routing Information Protocol (RIP)\n"
8428 "Static routes\n"
8429 "Metric for redistributed routes\n"
8430 "Default metric\n")
8431{
8432 int type;
8433
8434 type = bgp_str2route_type (AFI_IP, argv[0]);
8435 if (! type)
8436 {
8437 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8438 return CMD_WARNING;
8439 }
8440
8441 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8442 return CMD_SUCCESS;
8443}
8444
8445DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
8446 no_bgp_redistribute_ipv4_rmap_metric_cmd,
8447 "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
8448 NO_STR
8449 "Redistribute information from another routing protocol\n"
8450 "Connected\n"
8451 "Kernel routes\n"
8452 "Open Shurtest Path First (OSPF)\n"
8453 "Routing Information Protocol (RIP)\n"
8454 "Static routes\n"
8455 "Route map reference\n"
8456 "Pointer to route-map entries\n"
8457 "Metric for redistributed routes\n"
8458 "Default metric\n")
8459{
8460 int type;
8461
8462 type = bgp_str2route_type (AFI_IP, argv[0]);
8463 if (! type)
8464 {
8465 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8466 return CMD_WARNING;
8467 }
8468
8469 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8470 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8471 return CMD_SUCCESS;
8472}
8473
8474ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
8475 no_bgp_redistribute_ipv4_metric_rmap_cmd,
8476 "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
8477 NO_STR
8478 "Redistribute information from another routing protocol\n"
8479 "Connected\n"
8480 "Kernel routes\n"
8481 "Open Shurtest Path First (OSPF)\n"
8482 "Routing Information Protocol (RIP)\n"
8483 "Static routes\n"
8484 "Metric for redistributed routes\n"
8485 "Default metric\n"
8486 "Route map reference\n"
8487 "Pointer to route-map entries\n")
8488
8489#ifdef HAVE_IPV6
8490DEFUN (bgp_redistribute_ipv6,
8491 bgp_redistribute_ipv6_cmd,
8492 "redistribute (connected|kernel|ospf6|ripng|static)",
8493 "Redistribute information from another routing protocol\n"
8494 "Connected\n"
8495 "Kernel routes\n"
8496 "Open Shurtest Path First (OSPFv3)\n"
8497 "Routing Information Protocol (RIPng)\n"
8498 "Static routes\n")
8499{
8500 int type;
8501
8502 type = bgp_str2route_type (AFI_IP6, argv[0]);
8503 if (! type)
8504 {
8505 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8506 return CMD_WARNING;
8507 }
8508
8509 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8510}
8511
8512DEFUN (bgp_redistribute_ipv6_rmap,
8513 bgp_redistribute_ipv6_rmap_cmd,
8514 "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
8515 "Redistribute information from another routing protocol\n"
8516 "Connected\n"
8517 "Kernel routes\n"
8518 "Open Shurtest Path First (OSPFv3)\n"
8519 "Routing Information Protocol (RIPng)\n"
8520 "Static routes\n"
8521 "Route map reference\n"
8522 "Pointer to route-map entries\n")
8523{
8524 int type;
8525
8526 type = bgp_str2route_type (AFI_IP6, argv[0]);
8527 if (! type)
8528 {
8529 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8530 return CMD_WARNING;
8531 }
8532
8533 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8534 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8535}
8536
8537DEFUN (bgp_redistribute_ipv6_metric,
8538 bgp_redistribute_ipv6_metric_cmd,
8539 "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
8540 "Redistribute information from another routing protocol\n"
8541 "Connected\n"
8542 "Kernel routes\n"
8543 "Open Shurtest Path First (OSPFv3)\n"
8544 "Routing Information Protocol (RIPng)\n"
8545 "Static routes\n"
8546 "Metric for redistributed routes\n"
8547 "Default metric\n")
8548{
8549 int type;
8550 u_int32_t metric;
8551
8552 type = bgp_str2route_type (AFI_IP6, argv[0]);
8553 if (! type)
8554 {
8555 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8556 return CMD_WARNING;
8557 }
8558 VTY_GET_INTEGER ("metric", metric, argv[1]);
8559
8560 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8561 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8562}
8563
8564DEFUN (bgp_redistribute_ipv6_rmap_metric,
8565 bgp_redistribute_ipv6_rmap_metric_cmd,
8566 "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
8567 "Redistribute information from another routing protocol\n"
8568 "Connected\n"
8569 "Kernel routes\n"
8570 "Open Shurtest Path First (OSPFv3)\n"
8571 "Routing Information Protocol (RIPng)\n"
8572 "Static routes\n"
8573 "Route map reference\n"
8574 "Pointer to route-map entries\n"
8575 "Metric for redistributed routes\n"
8576 "Default metric\n")
8577{
8578 int type;
8579 u_int32_t metric;
8580
8581 type = bgp_str2route_type (AFI_IP6, argv[0]);
8582 if (! type)
8583 {
8584 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8585 return CMD_WARNING;
8586 }
8587 VTY_GET_INTEGER ("metric", metric, argv[2]);
8588
8589 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8590 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8591 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8592}
8593
8594DEFUN (bgp_redistribute_ipv6_metric_rmap,
8595 bgp_redistribute_ipv6_metric_rmap_cmd,
8596 "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
8597 "Redistribute information from another routing protocol\n"
8598 "Connected\n"
8599 "Kernel routes\n"
8600 "Open Shurtest Path First (OSPFv3)\n"
8601 "Routing Information Protocol (RIPng)\n"
8602 "Static routes\n"
8603 "Metric for redistributed routes\n"
8604 "Default metric\n"
8605 "Route map reference\n"
8606 "Pointer to route-map entries\n")
8607{
8608 int type;
8609 u_int32_t metric;
8610
8611 type = bgp_str2route_type (AFI_IP6, argv[0]);
8612 if (! type)
8613 {
8614 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8615 return CMD_WARNING;
8616 }
8617 VTY_GET_INTEGER ("metric", metric, argv[1]);
8618
8619 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8620 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
8621 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8622}
8623
8624DEFUN (no_bgp_redistribute_ipv6,
8625 no_bgp_redistribute_ipv6_cmd,
8626 "no redistribute (connected|kernel|ospf6|ripng|static)",
8627 NO_STR
8628 "Redistribute information from another routing protocol\n"
8629 "Connected\n"
8630 "Kernel routes\n"
8631 "Open Shurtest Path First (OSPFv3)\n"
8632 "Routing Information Protocol (RIPng)\n"
8633 "Static routes\n")
8634{
8635 int type;
8636
8637 type = bgp_str2route_type (AFI_IP6, argv[0]);
8638 if (! type)
8639 {
8640 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8641 return CMD_WARNING;
8642 }
8643
8644 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
8645}
8646
8647DEFUN (no_bgp_redistribute_ipv6_rmap,
8648 no_bgp_redistribute_ipv6_rmap_cmd,
8649 "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
8650 NO_STR
8651 "Redistribute information from another routing protocol\n"
8652 "Connected\n"
8653 "Kernel routes\n"
8654 "Open Shurtest Path First (OSPFv3)\n"
8655 "Routing Information Protocol (RIPng)\n"
8656 "Static routes\n"
8657 "Route map reference\n"
8658 "Pointer to route-map entries\n")
8659{
8660 int type;
8661
8662 type = bgp_str2route_type (AFI_IP6, argv[0]);
8663 if (! type)
8664 {
8665 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8666 return CMD_WARNING;
8667 }
8668
8669 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8670 return CMD_SUCCESS;
8671}
8672
8673DEFUN (no_bgp_redistribute_ipv6_metric,
8674 no_bgp_redistribute_ipv6_metric_cmd,
8675 "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
8676 NO_STR
8677 "Redistribute information from another routing protocol\n"
8678 "Connected\n"
8679 "Kernel routes\n"
8680 "Open Shurtest Path First (OSPFv3)\n"
8681 "Routing Information Protocol (RIPng)\n"
8682 "Static routes\n"
8683 "Metric for redistributed routes\n"
8684 "Default metric\n")
8685{
8686 int type;
8687
8688 type = bgp_str2route_type (AFI_IP6, argv[0]);
8689 if (! type)
8690 {
8691 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8692 return CMD_WARNING;
8693 }
8694
8695 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8696 return CMD_SUCCESS;
8697}
8698
8699DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
8700 no_bgp_redistribute_ipv6_rmap_metric_cmd,
8701 "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
8702 NO_STR
8703 "Redistribute information from another routing protocol\n"
8704 "Connected\n"
8705 "Kernel routes\n"
8706 "Open Shurtest Path First (OSPFv3)\n"
8707 "Routing Information Protocol (RIPng)\n"
8708 "Static routes\n"
8709 "Route map reference\n"
8710 "Pointer to route-map entries\n"
8711 "Metric for redistributed routes\n"
8712 "Default metric\n")
8713{
8714 int type;
8715
8716 type = bgp_str2route_type (AFI_IP6, argv[0]);
8717 if (! type)
8718 {
8719 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8720 return CMD_WARNING;
8721 }
8722
8723 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8724 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8725 return CMD_SUCCESS;
8726}
8727
8728ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
8729 no_bgp_redistribute_ipv6_metric_rmap_cmd,
8730 "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
8731 NO_STR
8732 "Redistribute information from another routing protocol\n"
8733 "Connected\n"
8734 "Kernel routes\n"
8735 "Open Shurtest Path First (OSPFv3)\n"
8736 "Routing Information Protocol (RIPng)\n"
8737 "Static routes\n"
8738 "Metric for redistributed routes\n"
8739 "Default metric\n"
8740 "Route map reference\n"
8741 "Pointer to route-map entries\n")
8742#endif /* HAVE_IPV6 */
8743
8744int
8745bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
8746 safi_t safi, int *write)
8747{
8748 int i;
paul718e3742002-12-13 20:15:29 +00008749
8750 /* Unicast redistribution only. */
8751 if (safi != SAFI_UNICAST)
8752 return 0;
8753
8754 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
8755 {
8756 /* Redistribute BGP does not make sense. */
8757 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
8758 {
8759 /* Display "address-family" when it is not yet diplayed. */
8760 bgp_config_write_family_header (vty, afi, safi, write);
8761
8762 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00008763 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00008764
8765 if (bgp->redist_metric_flag[afi][i])
8766 vty_out (vty, " metric %d", bgp->redist_metric[afi][i]);
8767
8768 if (bgp->rmap[afi][i].name)
8769 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
8770
8771 vty_out (vty, "%s", VTY_NEWLINE);
8772 }
8773 }
8774 return *write;
8775}
8776
8777/* BGP node structure. */
8778struct cmd_node bgp_node =
8779{
8780 BGP_NODE,
8781 "%s(config-router)# ",
8782 1,
8783};
8784
8785struct cmd_node bgp_ipv4_unicast_node =
8786{
8787 BGP_IPV4_NODE,
8788 "%s(config-router-af)# ",
8789 1,
8790};
8791
8792struct cmd_node bgp_ipv4_multicast_node =
8793{
8794 BGP_IPV4M_NODE,
8795 "%s(config-router-af)# ",
8796 1,
8797};
8798
8799struct cmd_node bgp_ipv6_unicast_node =
8800{
8801 BGP_IPV6_NODE,
8802 "%s(config-router-af)# ",
8803 1,
8804};
8805
paul25ffbdc2005-08-22 22:42:08 +00008806struct cmd_node bgp_ipv6_multicast_node =
8807{
8808 BGP_IPV6M_NODE,
8809 "%s(config-router-af)# ",
8810 1,
8811};
8812
paul718e3742002-12-13 20:15:29 +00008813struct cmd_node bgp_vpnv4_node =
8814{
8815 BGP_VPNV4_NODE,
8816 "%s(config-router-af)# ",
8817 1
8818};
8819
paul1f8ae702005-09-09 23:49:49 +00008820static void community_list_vty (void);
8821
paul718e3742002-12-13 20:15:29 +00008822void
paul94f2b392005-06-28 12:44:16 +00008823bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00008824{
paul718e3742002-12-13 20:15:29 +00008825 /* Install bgp top node. */
8826 install_node (&bgp_node, bgp_config_write);
8827 install_node (&bgp_ipv4_unicast_node, NULL);
8828 install_node (&bgp_ipv4_multicast_node, NULL);
8829 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00008830 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00008831 install_node (&bgp_vpnv4_node, NULL);
8832
8833 /* Install default VTY commands to new nodes. */
8834 install_default (BGP_NODE);
8835 install_default (BGP_IPV4_NODE);
8836 install_default (BGP_IPV4M_NODE);
8837 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00008838 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00008839 install_default (BGP_VPNV4_NODE);
8840
8841 /* "bgp multiple-instance" commands. */
8842 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
8843 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
8844
8845 /* "bgp config-type" commands. */
8846 install_element (CONFIG_NODE, &bgp_config_type_cmd);
8847 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
8848
8849 /* 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 */
Paul Jakma62687ff2008-08-23 14:27:06 +01009751 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
9752 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
9753 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
9754 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
9755 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9756 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9757#ifdef HAVE_IPV6
9758 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
9759 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
9760 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
9761 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
9762#endif /* HAVE_IPV6 */
paul718e3742002-12-13 20:15:29 +00009763 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
9764 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
9765 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
9766 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
9767 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9768 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9769#ifdef HAVE_IPV6
9770 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
9771 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
9772 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
9773 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
9774#endif /* HAVE_IPV6 */
9775
9776 /* "show ip bgp neighbors" commands. */
9777 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
9778 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
9779 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
9780 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
9781 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
9782 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
9783 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
9784 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
9785 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
9786 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +01009787 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
9788 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
9789 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
9790 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
9791 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +00009792 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
9793 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
9794 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
9795 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
9796 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
9797 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
9798 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
9799 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
9800 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
9801 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
9802
9803#ifdef HAVE_IPV6
9804 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
9805 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
9806 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
9807 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +00009808 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
9809 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
9810 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
9811 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +01009812 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
9813 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
9814 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
9815 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +00009816 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
9817 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
9818 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
9819 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +00009820 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
9821 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
9822 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
9823 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +00009824
9825 /* Old commands. */
9826 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
9827 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
9828 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
9829 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
9830#endif /* HAVE_IPV6 */
9831
paulfee0f4c2004-09-13 05:12:46 +00009832 /* "show ip bgp rsclient" commands. */
9833 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
9834 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
9835 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
9836 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +01009837 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
9838 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
9839 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
9840 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +00009841 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
9842 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
9843 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
9844 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
9845
9846#ifdef HAVE_IPV6
9847 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
9848 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
9849 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
9850 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +01009851 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
9852 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
9853 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
9854 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +00009855 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
9856 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
9857 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
9858 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
9859#endif /* HAVE_IPV6 */
9860
paul718e3742002-12-13 20:15:29 +00009861 /* "show ip bgp paths" commands. */
9862 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
9863 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
9864 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
9865 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
9866
9867 /* "show ip bgp community" commands. */
9868 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
9869 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
9870
9871 /* "show ip bgp attribute-info" commands. */
9872 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
9873 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
9874
9875 /* "redistribute" commands. */
9876 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
9877 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
9878 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
9879 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
9880 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
9881 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
9882 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
9883 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
9884 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
9885 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
9886#ifdef HAVE_IPV6
9887 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
9888 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
9889 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
9890 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
9891 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
9892 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
9893 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
9894 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
9895 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
9896 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
9897#endif /* HAVE_IPV6 */
9898
Paul Jakma4bf6a362006-03-30 14:05:23 +00009899 /* "show bgp memory" commands. */
9900 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +01009901 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +00009902 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
9903
Michael Lamberte0081f72008-11-16 20:12:04 +00009904 /* "show bgp views" commands. */
9905 install_element (VIEW_NODE, &show_bgp_views_cmd);
9906 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
9907 install_element (ENABLE_NODE, &show_bgp_views_cmd);
9908
paul718e3742002-12-13 20:15:29 +00009909 /* Community-list. */
9910 community_list_vty ();
9911}
9912
9913#include "memory.h"
9914#include "bgp_regex.h"
9915#include "bgp_clist.h"
9916#include "bgp_ecommunity.h"
9917
9918/* VTY functions. */
9919
9920/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +00009921static const char *
paul718e3742002-12-13 20:15:29 +00009922community_direct_str (int direct)
9923{
9924 switch (direct)
9925 {
9926 case COMMUNITY_DENY:
9927 return "deny";
paul718e3742002-12-13 20:15:29 +00009928 case COMMUNITY_PERMIT:
9929 return "permit";
paul718e3742002-12-13 20:15:29 +00009930 default:
9931 return "unknown";
paul718e3742002-12-13 20:15:29 +00009932 }
9933}
9934
9935/* Display error string. */
paul94f2b392005-06-28 12:44:16 +00009936static void
paul718e3742002-12-13 20:15:29 +00009937community_list_perror (struct vty *vty, int ret)
9938{
9939 switch (ret)
9940 {
9941 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
9942 vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE);
9943 break;
9944 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
9945 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
9946 break;
9947 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
9948 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
9949 break;
9950 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
9951 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
9952 break;
9953 }
9954}
9955
9956/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +00009957static int
paulfd79ac92004-10-13 05:06:08 +00009958community_list_set_vty (struct vty *vty, int argc, const char **argv,
9959 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +00009960{
9961 int ret;
9962 int direct;
9963 char *str;
9964
9965 /* Check the list type. */
9966 if (strncmp (argv[1], "p", 1) == 0)
9967 direct = COMMUNITY_PERMIT;
9968 else if (strncmp (argv[1], "d", 1) == 0)
9969 direct = COMMUNITY_DENY;
9970 else
9971 {
9972 vty_out (vty, "%% Matching condition must be permit or deny%s",
9973 VTY_NEWLINE);
9974 return CMD_WARNING;
9975 }
9976
9977 /* All digit name check. */
9978 if (reject_all_digit_name && all_digit (argv[0]))
9979 {
9980 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
9981 return CMD_WARNING;
9982 }
9983
9984 /* Concat community string argument. */
9985 if (argc > 1)
9986 str = argv_concat (argv, argc, 2);
9987 else
9988 str = NULL;
9989
9990 /* When community_list_set() return nevetive value, it means
9991 malformed community string. */
9992 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
9993
9994 /* Free temporary community list string allocated by
9995 argv_concat(). */
9996 if (str)
9997 XFREE (MTYPE_TMP, str);
9998
9999 if (ret < 0)
10000 {
10001 /* Display error string. */
10002 community_list_perror (vty, ret);
10003 return CMD_WARNING;
10004 }
10005
10006 return CMD_SUCCESS;
10007}
10008
paul718e3742002-12-13 20:15:29 +000010009/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000010010static int
hassofee6e4e2005-02-02 16:29:31 +000010011community_list_unset_vty (struct vty *vty, int argc, const char **argv,
10012 int style)
paul718e3742002-12-13 20:15:29 +000010013{
10014 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010015 int direct = 0;
10016 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010017
hassofee6e4e2005-02-02 16:29:31 +000010018 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010019 {
hassofee6e4e2005-02-02 16:29:31 +000010020 /* Check the list direct. */
10021 if (strncmp (argv[1], "p", 1) == 0)
10022 direct = COMMUNITY_PERMIT;
10023 else if (strncmp (argv[1], "d", 1) == 0)
10024 direct = COMMUNITY_DENY;
10025 else
10026 {
10027 vty_out (vty, "%% Matching condition must be permit or deny%s",
10028 VTY_NEWLINE);
10029 return CMD_WARNING;
10030 }
paul718e3742002-12-13 20:15:29 +000010031
hassofee6e4e2005-02-02 16:29:31 +000010032 /* Concat community string argument. */
10033 str = argv_concat (argv, argc, 2);
10034 }
paul718e3742002-12-13 20:15:29 +000010035
10036 /* Unset community list. */
10037 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
10038
10039 /* Free temporary community list string allocated by
10040 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010041 if (str)
10042 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010043
10044 if (ret < 0)
10045 {
10046 community_list_perror (vty, ret);
10047 return CMD_WARNING;
10048 }
10049
10050 return CMD_SUCCESS;
10051}
10052
10053/* "community-list" keyword help string. */
10054#define COMMUNITY_LIST_STR "Add a community list entry\n"
10055#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
10056
paul718e3742002-12-13 20:15:29 +000010057DEFUN (ip_community_list_standard,
10058 ip_community_list_standard_cmd,
10059 "ip community-list <1-99> (deny|permit) .AA:NN",
10060 IP_STR
10061 COMMUNITY_LIST_STR
10062 "Community list number (standard)\n"
10063 "Specify community to reject\n"
10064 "Specify community to accept\n"
10065 COMMUNITY_VAL_STR)
10066{
10067 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
10068}
10069
10070ALIAS (ip_community_list_standard,
10071 ip_community_list_standard2_cmd,
10072 "ip community-list <1-99> (deny|permit)",
10073 IP_STR
10074 COMMUNITY_LIST_STR
10075 "Community list number (standard)\n"
10076 "Specify community to reject\n"
10077 "Specify community to accept\n")
10078
10079DEFUN (ip_community_list_expanded,
10080 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010081 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010082 IP_STR
10083 COMMUNITY_LIST_STR
10084 "Community list number (expanded)\n"
10085 "Specify community to reject\n"
10086 "Specify community to accept\n"
10087 "An ordered list as a regular-expression\n")
10088{
10089 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
10090}
10091
10092DEFUN (ip_community_list_name_standard,
10093 ip_community_list_name_standard_cmd,
10094 "ip community-list standard WORD (deny|permit) .AA:NN",
10095 IP_STR
10096 COMMUNITY_LIST_STR
10097 "Add a standard community-list entry\n"
10098 "Community list name\n"
10099 "Specify community to reject\n"
10100 "Specify community to accept\n"
10101 COMMUNITY_VAL_STR)
10102{
10103 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
10104}
10105
10106ALIAS (ip_community_list_name_standard,
10107 ip_community_list_name_standard2_cmd,
10108 "ip community-list standard WORD (deny|permit)",
10109 IP_STR
10110 COMMUNITY_LIST_STR
10111 "Add a standard community-list entry\n"
10112 "Community list name\n"
10113 "Specify community to reject\n"
10114 "Specify community to accept\n")
10115
10116DEFUN (ip_community_list_name_expanded,
10117 ip_community_list_name_expanded_cmd,
10118 "ip community-list expanded WORD (deny|permit) .LINE",
10119 IP_STR
10120 COMMUNITY_LIST_STR
10121 "Add an expanded community-list entry\n"
10122 "Community list name\n"
10123 "Specify community to reject\n"
10124 "Specify community to accept\n"
10125 "An ordered list as a regular-expression\n")
10126{
10127 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
10128}
10129
hassofee6e4e2005-02-02 16:29:31 +000010130DEFUN (no_ip_community_list_standard_all,
10131 no_ip_community_list_standard_all_cmd,
10132 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010133 NO_STR
10134 IP_STR
10135 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010136 "Community list number (standard)\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_STANDARD);
paul718e3742002-12-13 20:15:29 +000010139}
10140
hassofee6e4e2005-02-02 16:29:31 +000010141DEFUN (no_ip_community_list_expanded_all,
10142 no_ip_community_list_expanded_all_cmd,
10143 "no ip community-list <100-500>",
10144 NO_STR
10145 IP_STR
10146 COMMUNITY_LIST_STR
10147 "Community list number (expanded)\n")
10148{
10149 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10150}
10151
10152DEFUN (no_ip_community_list_name_standard_all,
10153 no_ip_community_list_name_standard_all_cmd,
10154 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010155 NO_STR
10156 IP_STR
10157 COMMUNITY_LIST_STR
10158 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000010159 "Community list name\n")
10160{
hassofee6e4e2005-02-02 16:29:31 +000010161 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010162}
10163
hassofee6e4e2005-02-02 16:29:31 +000010164DEFUN (no_ip_community_list_name_expanded_all,
10165 no_ip_community_list_name_expanded_all_cmd,
10166 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000010167 NO_STR
10168 IP_STR
10169 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010170 "Add an expanded community-list entry\n"
10171 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000010172{
hassofee6e4e2005-02-02 16:29:31 +000010173 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010174}
10175
10176DEFUN (no_ip_community_list_standard,
10177 no_ip_community_list_standard_cmd,
10178 "no ip community-list <1-99> (deny|permit) .AA:NN",
10179 NO_STR
10180 IP_STR
10181 COMMUNITY_LIST_STR
10182 "Community list number (standard)\n"
10183 "Specify community to reject\n"
10184 "Specify community to accept\n"
10185 COMMUNITY_VAL_STR)
10186{
10187 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10188}
10189
10190DEFUN (no_ip_community_list_expanded,
10191 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010192 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010193 NO_STR
10194 IP_STR
10195 COMMUNITY_LIST_STR
10196 "Community list number (expanded)\n"
10197 "Specify community to reject\n"
10198 "Specify community to accept\n"
10199 "An ordered list as a regular-expression\n")
10200{
10201 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10202}
10203
10204DEFUN (no_ip_community_list_name_standard,
10205 no_ip_community_list_name_standard_cmd,
10206 "no ip community-list standard WORD (deny|permit) .AA:NN",
10207 NO_STR
10208 IP_STR
10209 COMMUNITY_LIST_STR
10210 "Specify a standard community-list\n"
10211 "Community list name\n"
10212 "Specify community to reject\n"
10213 "Specify community to accept\n"
10214 COMMUNITY_VAL_STR)
10215{
10216 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10217}
10218
10219DEFUN (no_ip_community_list_name_expanded,
10220 no_ip_community_list_name_expanded_cmd,
10221 "no ip community-list expanded WORD (deny|permit) .LINE",
10222 NO_STR
10223 IP_STR
10224 COMMUNITY_LIST_STR
10225 "Specify an expanded community-list\n"
10226 "Community list name\n"
10227 "Specify community to reject\n"
10228 "Specify community to accept\n"
10229 "An ordered list as a regular-expression\n")
10230{
10231 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10232}
10233
paul94f2b392005-06-28 12:44:16 +000010234static void
paul718e3742002-12-13 20:15:29 +000010235community_list_show (struct vty *vty, struct community_list *list)
10236{
10237 struct community_entry *entry;
10238
10239 for (entry = list->head; entry; entry = entry->next)
10240 {
10241 if (entry == list->head)
10242 {
10243 if (all_digit (list->name))
10244 vty_out (vty, "Community %s list %s%s",
10245 entry->style == COMMUNITY_LIST_STANDARD ?
10246 "standard" : "(expanded) access",
10247 list->name, VTY_NEWLINE);
10248 else
10249 vty_out (vty, "Named Community %s list %s%s",
10250 entry->style == COMMUNITY_LIST_STANDARD ?
10251 "standard" : "expanded",
10252 list->name, VTY_NEWLINE);
10253 }
10254 if (entry->any)
10255 vty_out (vty, " %s%s",
10256 community_direct_str (entry->direct), VTY_NEWLINE);
10257 else
10258 vty_out (vty, " %s %s%s",
10259 community_direct_str (entry->direct),
10260 entry->style == COMMUNITY_LIST_STANDARD
10261 ? community_str (entry->u.com) : entry->config,
10262 VTY_NEWLINE);
10263 }
10264}
10265
10266DEFUN (show_ip_community_list,
10267 show_ip_community_list_cmd,
10268 "show ip community-list",
10269 SHOW_STR
10270 IP_STR
10271 "List community-list\n")
10272{
10273 struct community_list *list;
10274 struct community_list_master *cm;
10275
hassofee6e4e2005-02-02 16:29:31 +000010276 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010277 if (! cm)
10278 return CMD_SUCCESS;
10279
10280 for (list = cm->num.head; list; list = list->next)
10281 community_list_show (vty, list);
10282
10283 for (list = cm->str.head; list; list = list->next)
10284 community_list_show (vty, list);
10285
10286 return CMD_SUCCESS;
10287}
10288
10289DEFUN (show_ip_community_list_arg,
10290 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010291 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010292 SHOW_STR
10293 IP_STR
10294 "List community-list\n"
10295 "Community-list number\n"
10296 "Community-list name\n")
10297{
10298 struct community_list *list;
10299
hassofee6e4e2005-02-02 16:29:31 +000010300 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010301 if (! list)
10302 {
10303 vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE);
10304 return CMD_WARNING;
10305 }
10306
10307 community_list_show (vty, list);
10308
10309 return CMD_SUCCESS;
10310}
10311
paul94f2b392005-06-28 12:44:16 +000010312static int
paulfd79ac92004-10-13 05:06:08 +000010313extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
10314 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010315{
10316 int ret;
10317 int direct;
10318 char *str;
10319
10320 /* Check the list type. */
10321 if (strncmp (argv[1], "p", 1) == 0)
10322 direct = COMMUNITY_PERMIT;
10323 else if (strncmp (argv[1], "d", 1) == 0)
10324 direct = COMMUNITY_DENY;
10325 else
10326 {
10327 vty_out (vty, "%% Matching condition must be permit or deny%s",
10328 VTY_NEWLINE);
10329 return CMD_WARNING;
10330 }
10331
10332 /* All digit name check. */
10333 if (reject_all_digit_name && all_digit (argv[0]))
10334 {
10335 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10336 return CMD_WARNING;
10337 }
10338
10339 /* Concat community string argument. */
10340 if (argc > 1)
10341 str = argv_concat (argv, argc, 2);
10342 else
10343 str = NULL;
10344
10345 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
10346
10347 /* Free temporary community list string allocated by
10348 argv_concat(). */
10349 if (str)
10350 XFREE (MTYPE_TMP, str);
10351
10352 if (ret < 0)
10353 {
10354 community_list_perror (vty, ret);
10355 return CMD_WARNING;
10356 }
10357 return CMD_SUCCESS;
10358}
10359
paul94f2b392005-06-28 12:44:16 +000010360static int
hassofee6e4e2005-02-02 16:29:31 +000010361extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
10362 int style)
paul718e3742002-12-13 20:15:29 +000010363{
10364 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010365 int direct = 0;
10366 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010367
hassofee6e4e2005-02-02 16:29:31 +000010368 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010369 {
hassofee6e4e2005-02-02 16:29:31 +000010370 /* Check the list direct. */
10371 if (strncmp (argv[1], "p", 1) == 0)
10372 direct = COMMUNITY_PERMIT;
10373 else if (strncmp (argv[1], "d", 1) == 0)
10374 direct = COMMUNITY_DENY;
10375 else
10376 {
10377 vty_out (vty, "%% Matching condition must be permit or deny%s",
10378 VTY_NEWLINE);
10379 return CMD_WARNING;
10380 }
10381
10382 /* Concat community string argument. */
10383 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000010384 }
paul718e3742002-12-13 20:15:29 +000010385
10386 /* Unset community list. */
10387 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
10388
10389 /* Free temporary community list string allocated by
10390 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010391 if (str)
10392 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010393
10394 if (ret < 0)
10395 {
10396 community_list_perror (vty, ret);
10397 return CMD_WARNING;
10398 }
10399
10400 return CMD_SUCCESS;
10401}
10402
10403/* "extcommunity-list" keyword help string. */
10404#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
10405#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
10406
10407DEFUN (ip_extcommunity_list_standard,
10408 ip_extcommunity_list_standard_cmd,
10409 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10410 IP_STR
10411 EXTCOMMUNITY_LIST_STR
10412 "Extended Community list number (standard)\n"
10413 "Specify community to reject\n"
10414 "Specify community to accept\n"
10415 EXTCOMMUNITY_VAL_STR)
10416{
10417 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
10418}
10419
10420ALIAS (ip_extcommunity_list_standard,
10421 ip_extcommunity_list_standard2_cmd,
10422 "ip extcommunity-list <1-99> (deny|permit)",
10423 IP_STR
10424 EXTCOMMUNITY_LIST_STR
10425 "Extended Community list number (standard)\n"
10426 "Specify community to reject\n"
10427 "Specify community to accept\n")
10428
10429DEFUN (ip_extcommunity_list_expanded,
10430 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010431 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010432 IP_STR
10433 EXTCOMMUNITY_LIST_STR
10434 "Extended Community list number (expanded)\n"
10435 "Specify community to reject\n"
10436 "Specify community to accept\n"
10437 "An ordered list as a regular-expression\n")
10438{
10439 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
10440}
10441
10442DEFUN (ip_extcommunity_list_name_standard,
10443 ip_extcommunity_list_name_standard_cmd,
10444 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10445 IP_STR
10446 EXTCOMMUNITY_LIST_STR
10447 "Specify standard extcommunity-list\n"
10448 "Extended Community list name\n"
10449 "Specify community to reject\n"
10450 "Specify community to accept\n"
10451 EXTCOMMUNITY_VAL_STR)
10452{
10453 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
10454}
10455
10456ALIAS (ip_extcommunity_list_name_standard,
10457 ip_extcommunity_list_name_standard2_cmd,
10458 "ip extcommunity-list standard WORD (deny|permit)",
10459 IP_STR
10460 EXTCOMMUNITY_LIST_STR
10461 "Specify standard extcommunity-list\n"
10462 "Extended Community list name\n"
10463 "Specify community to reject\n"
10464 "Specify community to accept\n")
10465
10466DEFUN (ip_extcommunity_list_name_expanded,
10467 ip_extcommunity_list_name_expanded_cmd,
10468 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
10469 IP_STR
10470 EXTCOMMUNITY_LIST_STR
10471 "Specify expanded extcommunity-list\n"
10472 "Extended Community list name\n"
10473 "Specify community to reject\n"
10474 "Specify community to accept\n"
10475 "An ordered list as a regular-expression\n")
10476{
10477 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
10478}
10479
hassofee6e4e2005-02-02 16:29:31 +000010480DEFUN (no_ip_extcommunity_list_standard_all,
10481 no_ip_extcommunity_list_standard_all_cmd,
10482 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010483 NO_STR
10484 IP_STR
10485 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010486 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010487{
hassofee6e4e2005-02-02 16:29:31 +000010488 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010489}
10490
hassofee6e4e2005-02-02 16:29:31 +000010491DEFUN (no_ip_extcommunity_list_expanded_all,
10492 no_ip_extcommunity_list_expanded_all_cmd,
10493 "no ip extcommunity-list <100-500>",
10494 NO_STR
10495 IP_STR
10496 EXTCOMMUNITY_LIST_STR
10497 "Extended Community list number (expanded)\n")
10498{
10499 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10500}
10501
10502DEFUN (no_ip_extcommunity_list_name_standard_all,
10503 no_ip_extcommunity_list_name_standard_all_cmd,
10504 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010505 NO_STR
10506 IP_STR
10507 EXTCOMMUNITY_LIST_STR
10508 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000010509 "Extended Community list name\n")
10510{
10511 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10512}
10513
10514DEFUN (no_ip_extcommunity_list_name_expanded_all,
10515 no_ip_extcommunity_list_name_expanded_all_cmd,
10516 "no ip extcommunity-list expanded WORD",
10517 NO_STR
10518 IP_STR
10519 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000010520 "Specify expanded extcommunity-list\n"
10521 "Extended Community list name\n")
10522{
hassofee6e4e2005-02-02 16:29:31 +000010523 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010524}
10525
10526DEFUN (no_ip_extcommunity_list_standard,
10527 no_ip_extcommunity_list_standard_cmd,
10528 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10529 NO_STR
10530 IP_STR
10531 EXTCOMMUNITY_LIST_STR
10532 "Extended Community list number (standard)\n"
10533 "Specify community to reject\n"
10534 "Specify community to accept\n"
10535 EXTCOMMUNITY_VAL_STR)
10536{
10537 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10538}
10539
10540DEFUN (no_ip_extcommunity_list_expanded,
10541 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010542 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010543 NO_STR
10544 IP_STR
10545 EXTCOMMUNITY_LIST_STR
10546 "Extended Community list number (expanded)\n"
10547 "Specify community to reject\n"
10548 "Specify community to accept\n"
10549 "An ordered list as a regular-expression\n")
10550{
10551 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10552}
10553
10554DEFUN (no_ip_extcommunity_list_name_standard,
10555 no_ip_extcommunity_list_name_standard_cmd,
10556 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10557 NO_STR
10558 IP_STR
10559 EXTCOMMUNITY_LIST_STR
10560 "Specify standard extcommunity-list\n"
10561 "Extended Community list name\n"
10562 "Specify community to reject\n"
10563 "Specify community to accept\n"
10564 EXTCOMMUNITY_VAL_STR)
10565{
10566 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10567}
10568
10569DEFUN (no_ip_extcommunity_list_name_expanded,
10570 no_ip_extcommunity_list_name_expanded_cmd,
10571 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
10572 NO_STR
10573 IP_STR
10574 EXTCOMMUNITY_LIST_STR
10575 "Specify expanded extcommunity-list\n"
10576 "Community list name\n"
10577 "Specify community to reject\n"
10578 "Specify community to accept\n"
10579 "An ordered list as a regular-expression\n")
10580{
10581 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10582}
10583
paul94f2b392005-06-28 12:44:16 +000010584static void
paul718e3742002-12-13 20:15:29 +000010585extcommunity_list_show (struct vty *vty, struct community_list *list)
10586{
10587 struct community_entry *entry;
10588
10589 for (entry = list->head; entry; entry = entry->next)
10590 {
10591 if (entry == list->head)
10592 {
10593 if (all_digit (list->name))
10594 vty_out (vty, "Extended community %s list %s%s",
10595 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10596 "standard" : "(expanded) access",
10597 list->name, VTY_NEWLINE);
10598 else
10599 vty_out (vty, "Named extended community %s list %s%s",
10600 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10601 "standard" : "expanded",
10602 list->name, VTY_NEWLINE);
10603 }
10604 if (entry->any)
10605 vty_out (vty, " %s%s",
10606 community_direct_str (entry->direct), VTY_NEWLINE);
10607 else
10608 vty_out (vty, " %s %s%s",
10609 community_direct_str (entry->direct),
10610 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10611 entry->u.ecom->str : entry->config,
10612 VTY_NEWLINE);
10613 }
10614}
10615
10616DEFUN (show_ip_extcommunity_list,
10617 show_ip_extcommunity_list_cmd,
10618 "show ip extcommunity-list",
10619 SHOW_STR
10620 IP_STR
10621 "List extended-community list\n")
10622{
10623 struct community_list *list;
10624 struct community_list_master *cm;
10625
hassofee6e4e2005-02-02 16:29:31 +000010626 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010627 if (! cm)
10628 return CMD_SUCCESS;
10629
10630 for (list = cm->num.head; list; list = list->next)
10631 extcommunity_list_show (vty, list);
10632
10633 for (list = cm->str.head; list; list = list->next)
10634 extcommunity_list_show (vty, list);
10635
10636 return CMD_SUCCESS;
10637}
10638
10639DEFUN (show_ip_extcommunity_list_arg,
10640 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010641 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010642 SHOW_STR
10643 IP_STR
10644 "List extended-community list\n"
10645 "Extcommunity-list number\n"
10646 "Extcommunity-list name\n")
10647{
10648 struct community_list *list;
10649
hassofee6e4e2005-02-02 16:29:31 +000010650 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010651 if (! list)
10652 {
10653 vty_out (vty, "%% Can't find extcommunit-list%s", VTY_NEWLINE);
10654 return CMD_WARNING;
10655 }
10656
10657 extcommunity_list_show (vty, list);
10658
10659 return CMD_SUCCESS;
10660}
10661
10662/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000010663static const char *
paul718e3742002-12-13 20:15:29 +000010664community_list_config_str (struct community_entry *entry)
10665{
paulfd79ac92004-10-13 05:06:08 +000010666 const char *str;
paul718e3742002-12-13 20:15:29 +000010667
10668 if (entry->any)
10669 str = "";
10670 else
10671 {
10672 if (entry->style == COMMUNITY_LIST_STANDARD)
10673 str = community_str (entry->u.com);
10674 else
10675 str = entry->config;
10676 }
10677 return str;
10678}
10679
10680/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000010681static int
paul718e3742002-12-13 20:15:29 +000010682community_list_config_write (struct vty *vty)
10683{
10684 struct community_list *list;
10685 struct community_entry *entry;
10686 struct community_list_master *cm;
10687 int write = 0;
10688
10689 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000010690 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010691
10692 for (list = cm->num.head; list; list = list->next)
10693 for (entry = list->head; entry; entry = entry->next)
10694 {
hassofee6e4e2005-02-02 16:29:31 +000010695 vty_out (vty, "ip community-list %s %s %s%s",
10696 list->name, community_direct_str (entry->direct),
10697 community_list_config_str (entry),
10698 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010699 write++;
10700 }
10701 for (list = cm->str.head; list; list = list->next)
10702 for (entry = list->head; entry; entry = entry->next)
10703 {
10704 vty_out (vty, "ip community-list %s %s %s %s%s",
10705 entry->style == COMMUNITY_LIST_STANDARD
10706 ? "standard" : "expanded",
10707 list->name, community_direct_str (entry->direct),
10708 community_list_config_str (entry),
10709 VTY_NEWLINE);
10710 write++;
10711 }
10712
10713 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000010714 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010715
10716 for (list = cm->num.head; list; list = list->next)
10717 for (entry = list->head; entry; entry = entry->next)
10718 {
hassofee6e4e2005-02-02 16:29:31 +000010719 vty_out (vty, "ip extcommunity-list %s %s %s%s",
10720 list->name, community_direct_str (entry->direct),
10721 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010722 write++;
10723 }
10724 for (list = cm->str.head; list; list = list->next)
10725 for (entry = list->head; entry; entry = entry->next)
10726 {
10727 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
10728 entry->style == EXTCOMMUNITY_LIST_STANDARD
10729 ? "standard" : "expanded",
10730 list->name, community_direct_str (entry->direct),
10731 community_list_config_str (entry), VTY_NEWLINE);
10732 write++;
10733 }
10734 return write;
10735}
10736
10737struct cmd_node community_list_node =
10738{
10739 COMMUNITY_LIST_NODE,
10740 "",
10741 1 /* Export to vtysh. */
10742};
10743
paul94f2b392005-06-28 12:44:16 +000010744static void
10745community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000010746{
10747 install_node (&community_list_node, community_list_config_write);
10748
10749 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000010750 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
10751 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
10752 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
10753 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
10754 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
10755 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000010756 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
10757 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
10758 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
10759 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000010760 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
10761 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
10762 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
10763 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
10764 install_element (VIEW_NODE, &show_ip_community_list_cmd);
10765 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
10766 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
10767 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
10768
10769 /* Extcommunity-list. */
10770 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
10771 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
10772 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
10773 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
10774 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
10775 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000010776 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
10777 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
10778 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
10779 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000010780 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
10781 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
10782 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
10783 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
10784 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
10785 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
10786 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
10787 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
10788}