blob: cb7ff1fa36d0b2a1bcf0d627ff0385e75d931031 [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"
Josh Bailey165b5ff2011-07-20 20:43:22 -070051#include "bgpd/bgp_mpath.h"
paul718e3742002-12-13 20:15:29 +000052
hasso18a6dce2004-10-03 18:18:34 +000053extern struct in_addr router_id_zebra;
54
paul718e3742002-12-13 20:15:29 +000055/* Utility function to get address family from current node. */
56afi_t
57bgp_node_afi (struct vty *vty)
58{
paul25ffbdc2005-08-22 22:42:08 +000059 if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +000060 return AFI_IP6;
61 return AFI_IP;
62}
63
64/* Utility function to get subsequent address family from current
65 node. */
66safi_t
67bgp_node_safi (struct vty *vty)
68{
69 if (vty->node == BGP_VPNV4_NODE)
70 return SAFI_MPLS_VPN;
paul25ffbdc2005-08-22 22:42:08 +000071 if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +000072 return SAFI_MULTICAST;
73 return SAFI_UNICAST;
74}
75
paul94f2b392005-06-28 12:44:16 +000076static int
paul718e3742002-12-13 20:15:29 +000077peer_address_self_check (union sockunion *su)
78{
79 struct interface *ifp = NULL;
80
81 if (su->sa.sa_family == AF_INET)
82 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
83#ifdef HAVE_IPV6
84 else if (su->sa.sa_family == AF_INET6)
85 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
86#endif /* HAVE IPV6 */
87
88 if (ifp)
89 return 1;
90
91 return 0;
92}
93
94/* Utility function for looking up peer from VTY. */
paul94f2b392005-06-28 12:44:16 +000095static struct peer *
paulfd79ac92004-10-13 05:06:08 +000096peer_lookup_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +000097{
98 int ret;
99 struct bgp *bgp;
100 union sockunion su;
101 struct peer *peer;
102
103 bgp = vty->index;
104
105 ret = str2sockunion (ip_str, &su);
106 if (ret < 0)
107 {
108 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
109 return NULL;
110 }
111
112 peer = peer_lookup (bgp, &su);
113 if (! peer)
114 {
115 vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
116 return NULL;
117 }
118 return peer;
119}
120
121/* Utility function for looking up peer or peer group. */
paul94f2b392005-06-28 12:44:16 +0000122static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000123peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
paul718e3742002-12-13 20:15:29 +0000124{
125 int ret;
126 struct bgp *bgp;
127 union sockunion su;
128 struct peer *peer;
129 struct peer_group *group;
130
131 bgp = vty->index;
132
133 ret = str2sockunion (peer_str, &su);
134 if (ret == 0)
135 {
136 peer = peer_lookup (bgp, &su);
137 if (peer)
138 return peer;
139 }
140 else
141 {
142 group = peer_group_lookup (bgp, peer_str);
143 if (group)
144 return group->conf;
145 }
146
147 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
148 VTY_NEWLINE);
149
150 return NULL;
151}
152
paul94f2b392005-06-28 12:44:16 +0000153static int
paul718e3742002-12-13 20:15:29 +0000154bgp_vty_return (struct vty *vty, int ret)
155{
paulfd79ac92004-10-13 05:06:08 +0000156 const char *str = NULL;
paul718e3742002-12-13 20:15:29 +0000157
158 switch (ret)
159 {
160 case BGP_ERR_INVALID_VALUE:
161 str = "Invalid value";
162 break;
163 case BGP_ERR_INVALID_FLAG:
164 str = "Invalid flag";
165 break;
166 case BGP_ERR_PEER_INACTIVE:
167 str = "Activate the neighbor for the address family first";
168 break;
169 case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
170 str = "Invalid command for a peer-group member";
171 break;
172 case BGP_ERR_PEER_GROUP_SHUTDOWN:
173 str = "Peer-group has been shutdown. Activate the peer-group first";
174 break;
175 case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
176 str = "This peer is a peer-group member. Please change peer-group configuration";
177 break;
178 case BGP_ERR_PEER_FLAG_CONFLICT:
179 str = "Can't set override-capability and strict-capability-match at the same time";
180 break;
181 case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
182 str = "No activate for peergroup can be given only if peer-group has no members";
183 break;
184 case BGP_ERR_PEER_BELONGS_TO_GROUP:
185 str = "No activate for an individual peer-group member is invalid";
186 break;
187 case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
188 str = "Activate the peer-group for the address family first";
189 break;
190 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
191 str = "Specify remote-as or peer-group remote AS first";
192 break;
193 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
194 str = "Cannot change the peer-group. Deconfigure first";
195 break;
196 case BGP_ERR_PEER_GROUP_MISMATCH:
197 str = "Cannot have different peer-group for the neighbor";
198 break;
199 case BGP_ERR_PEER_FILTER_CONFLICT:
200 str = "Prefix/distribute list can not co-exist";
201 break;
202 case BGP_ERR_NOT_INTERNAL_PEER:
203 str = "Invalid command. Not an internal neighbor";
204 break;
205 case BGP_ERR_REMOVE_PRIVATE_AS:
206 str = "Private AS cannot be removed for IBGP peers";
207 break;
208 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
209 str = "Local-AS allowed only for EBGP peers";
210 break;
211 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
212 str = "Cannot have local-as same as BGP AS number";
213 break;
Paul Jakma0df7c912008-07-21 21:02:49 +0000214 case BGP_ERR_TCPSIG_FAILED:
215 str = "Error while applying TCP-Sig to session(s)";
216 break;
Nick Hilliardfa411a22011-03-23 15:33:17 +0000217 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
218 str = "ebgp-multihop and ttl-security cannot be configured together";
219 break;
Stephen Hemmingerf5a48272011-03-24 17:30:21 +0000220 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
221 str = "ttl-security only allowed for EBGP peers";
222 break;
paul718e3742002-12-13 20:15:29 +0000223 }
224 if (str)
225 {
226 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
227 return CMD_WARNING;
228 }
229 return CMD_SUCCESS;
230}
231
232/* BGP global configuration. */
233
234DEFUN (bgp_multiple_instance_func,
235 bgp_multiple_instance_cmd,
236 "bgp multiple-instance",
237 BGP_STR
238 "Enable bgp multiple instance\n")
239{
240 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
241 return CMD_SUCCESS;
242}
243
244DEFUN (no_bgp_multiple_instance,
245 no_bgp_multiple_instance_cmd,
246 "no bgp multiple-instance",
247 NO_STR
248 BGP_STR
249 "BGP multiple instance\n")
250{
251 int ret;
252
253 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
254 if (ret < 0)
255 {
256 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
257 return CMD_WARNING;
258 }
259 return CMD_SUCCESS;
260}
261
262DEFUN (bgp_config_type,
263 bgp_config_type_cmd,
264 "bgp config-type (cisco|zebra)",
265 BGP_STR
266 "Configuration type\n"
267 "cisco\n"
268 "zebra\n")
269{
270 if (strncmp (argv[0], "c", 1) == 0)
271 bgp_option_set (BGP_OPT_CONFIG_CISCO);
272 else
273 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
274
275 return CMD_SUCCESS;
276}
277
278DEFUN (no_bgp_config_type,
279 no_bgp_config_type_cmd,
280 "no bgp config-type",
281 NO_STR
282 BGP_STR
283 "Display configuration type\n")
284{
285 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
286 return CMD_SUCCESS;
287}
288
289DEFUN (no_synchronization,
290 no_synchronization_cmd,
291 "no synchronization",
292 NO_STR
293 "Perform IGP synchronization\n")
294{
295 return CMD_SUCCESS;
296}
297
298DEFUN (no_auto_summary,
299 no_auto_summary_cmd,
300 "no auto-summary",
301 NO_STR
302 "Enable automatic network number summarization\n")
303{
304 return CMD_SUCCESS;
305}
hasso3d515fd2005-02-01 21:30:04 +0000306
307DEFUN_DEPRECATED (neighbor_version,
308 neighbor_version_cmd,
309 NEIGHBOR_CMD "version (4|4-)",
310 NEIGHBOR_STR
311 NEIGHBOR_ADDR_STR
312 "Set the BGP version to match a neighbor\n"
313 "Neighbor's BGP version\n")
314{
315 return CMD_SUCCESS;
316}
paul718e3742002-12-13 20:15:29 +0000317
318/* "router bgp" commands. */
319DEFUN (router_bgp,
320 router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000321 "router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000322 ROUTER_STR
323 BGP_STR
324 AS_STR)
325{
326 int ret;
327 as_t as;
328 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000329 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000330
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000331 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000332
333 if (argc == 2)
334 name = argv[1];
335
336 ret = bgp_get (&bgp, &as, name);
337 switch (ret)
338 {
339 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
340 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
341 VTY_NEWLINE);
342 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000343 case BGP_ERR_AS_MISMATCH:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400344 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000345 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000346 case BGP_ERR_INSTANCE_MISMATCH:
347 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400348 vty_out (vty, "BGP instance is already running; AS is %u%s",
paul718e3742002-12-13 20:15:29 +0000349 as, VTY_NEWLINE);
350 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000351 }
352
353 vty->node = BGP_NODE;
354 vty->index = bgp;
355
356 return CMD_SUCCESS;
357}
358
359ALIAS (router_bgp,
360 router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000361 "router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000362 ROUTER_STR
363 BGP_STR
364 AS_STR
365 "BGP view\n"
366 "view name\n")
367
368/* "no router bgp" commands. */
369DEFUN (no_router_bgp,
370 no_router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000371 "no router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000372 NO_STR
373 ROUTER_STR
374 BGP_STR
375 AS_STR)
376{
377 as_t as;
378 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000379 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000380
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000381 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000382
383 if (argc == 2)
384 name = argv[1];
385
386 /* Lookup bgp structure. */
387 bgp = bgp_lookup (as, name);
388 if (! bgp)
389 {
390 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
391 return CMD_WARNING;
392 }
393
394 bgp_delete (bgp);
395
396 return CMD_SUCCESS;
397}
398
399ALIAS (no_router_bgp,
400 no_router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000401 "no router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000402 NO_STR
403 ROUTER_STR
404 BGP_STR
405 AS_STR
406 "BGP view\n"
407 "view name\n")
408
409/* BGP router-id. */
410
411DEFUN (bgp_router_id,
412 bgp_router_id_cmd,
413 "bgp router-id A.B.C.D",
414 BGP_STR
415 "Override configured router identifier\n"
416 "Manually configured router identifier\n")
417{
418 int ret;
419 struct in_addr id;
420 struct bgp *bgp;
421
422 bgp = vty->index;
423
424 ret = inet_aton (argv[0], &id);
425 if (! ret)
426 {
427 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
428 return CMD_WARNING;
429 }
430
hasso18a6dce2004-10-03 18:18:34 +0000431 bgp->router_id_static = id;
paul718e3742002-12-13 20:15:29 +0000432 bgp_router_id_set (bgp, &id);
433
434 return CMD_SUCCESS;
435}
436
437DEFUN (no_bgp_router_id,
438 no_bgp_router_id_cmd,
439 "no bgp router-id",
440 NO_STR
441 BGP_STR
442 "Override configured router identifier\n")
443{
444 int ret;
445 struct in_addr id;
446 struct bgp *bgp;
447
448 bgp = vty->index;
449
450 if (argc == 1)
451 {
452 ret = inet_aton (argv[0], &id);
453 if (! ret)
454 {
455 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
456 return CMD_WARNING;
457 }
458
hasso18a6dce2004-10-03 18:18:34 +0000459 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
paul718e3742002-12-13 20:15:29 +0000460 {
461 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
462 return CMD_WARNING;
463 }
464 }
465
hasso18a6dce2004-10-03 18:18:34 +0000466 bgp->router_id_static.s_addr = 0;
467 bgp_router_id_set (bgp, &router_id_zebra);
paul718e3742002-12-13 20:15:29 +0000468
469 return CMD_SUCCESS;
470}
471
472ALIAS (no_bgp_router_id,
473 no_bgp_router_id_val_cmd,
474 "no bgp router-id A.B.C.D",
475 NO_STR
476 BGP_STR
477 "Override configured router identifier\n"
478 "Manually configured router identifier\n")
479
480/* BGP Cluster ID. */
481
482DEFUN (bgp_cluster_id,
483 bgp_cluster_id_cmd,
484 "bgp cluster-id A.B.C.D",
485 BGP_STR
486 "Configure Route-Reflector Cluster-id\n"
487 "Route-Reflector Cluster-id in IP address format\n")
488{
489 int ret;
490 struct bgp *bgp;
491 struct in_addr cluster;
492
493 bgp = vty->index;
494
495 ret = inet_aton (argv[0], &cluster);
496 if (! ret)
497 {
498 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
499 return CMD_WARNING;
500 }
501
502 bgp_cluster_id_set (bgp, &cluster);
503
504 return CMD_SUCCESS;
505}
506
507ALIAS (bgp_cluster_id,
508 bgp_cluster_id32_cmd,
509 "bgp cluster-id <1-4294967295>",
510 BGP_STR
511 "Configure Route-Reflector Cluster-id\n"
512 "Route-Reflector Cluster-id as 32 bit quantity\n")
513
514DEFUN (no_bgp_cluster_id,
515 no_bgp_cluster_id_cmd,
516 "no bgp cluster-id",
517 NO_STR
518 BGP_STR
519 "Configure Route-Reflector Cluster-id\n")
520{
521 int ret;
522 struct bgp *bgp;
523 struct in_addr cluster;
524
525 bgp = vty->index;
526
527 if (argc == 1)
528 {
529 ret = inet_aton (argv[0], &cluster);
530 if (! ret)
531 {
532 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
533 return CMD_WARNING;
534 }
535 }
536
537 bgp_cluster_id_unset (bgp);
538
539 return CMD_SUCCESS;
540}
541
542ALIAS (no_bgp_cluster_id,
543 no_bgp_cluster_id_arg_cmd,
544 "no bgp cluster-id A.B.C.D",
545 NO_STR
546 BGP_STR
547 "Configure Route-Reflector Cluster-id\n"
548 "Route-Reflector Cluster-id in IP address format\n")
549
550DEFUN (bgp_confederation_identifier,
551 bgp_confederation_identifier_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000552 "bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000553 "BGP specific commands\n"
554 "AS confederation parameters\n"
555 "AS number\n"
556 "Set routing domain confederation AS\n")
557{
558 struct bgp *bgp;
559 as_t as;
560
561 bgp = vty->index;
562
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000563 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000564
565 bgp_confederation_id_set (bgp, as);
566
567 return CMD_SUCCESS;
568}
569
570DEFUN (no_bgp_confederation_identifier,
571 no_bgp_confederation_identifier_cmd,
572 "no bgp confederation identifier",
573 NO_STR
574 "BGP specific commands\n"
575 "AS confederation parameters\n"
576 "AS number\n")
577{
578 struct bgp *bgp;
579 as_t as;
580
581 bgp = vty->index;
582
583 if (argc == 1)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000584 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000585
586 bgp_confederation_id_unset (bgp);
587
588 return CMD_SUCCESS;
589}
590
591ALIAS (no_bgp_confederation_identifier,
592 no_bgp_confederation_identifier_arg_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000593 "no bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000594 NO_STR
595 "BGP specific commands\n"
596 "AS confederation parameters\n"
597 "AS number\n"
598 "Set routing domain confederation AS\n")
599
600DEFUN (bgp_confederation_peers,
601 bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000602 "bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000603 "BGP specific commands\n"
604 "AS confederation parameters\n"
605 "Peer ASs in BGP confederation\n"
606 AS_STR)
607{
608 struct bgp *bgp;
609 as_t as;
610 int i;
611
612 bgp = vty->index;
613
614 for (i = 0; i < argc; i++)
615 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000616 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000617
618 if (bgp->as == as)
619 {
620 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
621 VTY_NEWLINE);
622 continue;
623 }
624
625 bgp_confederation_peers_add (bgp, as);
626 }
627 return CMD_SUCCESS;
628}
629
630DEFUN (no_bgp_confederation_peers,
631 no_bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000632 "no bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000633 NO_STR
634 "BGP specific commands\n"
635 "AS confederation parameters\n"
636 "Peer ASs in BGP confederation\n"
637 AS_STR)
638{
639 struct bgp *bgp;
640 as_t as;
641 int i;
642
643 bgp = vty->index;
644
645 for (i = 0; i < argc; i++)
646 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000647 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
648
paul718e3742002-12-13 20:15:29 +0000649 bgp_confederation_peers_remove (bgp, as);
650 }
651 return CMD_SUCCESS;
652}
653
Josh Bailey165b5ff2011-07-20 20:43:22 -0700654/* Maximum-paths configuration */
655DEFUN (bgp_maxpaths,
656 bgp_maxpaths_cmd,
657 "maximum-paths <1-255>",
658 "Forward packets over multiple paths\n"
659 "Number of paths\n")
660{
661 struct bgp *bgp;
662 u_int16_t maxpaths;
663 int ret;
664
665 bgp = vty->index;
666
667 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
668
669 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
670 BGP_PEER_EBGP, maxpaths);
671 if (ret < 0)
672 {
673 vty_out (vty,
674 "%% Failed to set maximum-paths %u for afi %u, safi %u%s",
675 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
676 return CMD_WARNING;
677 }
678
679 return CMD_SUCCESS;
680}
681
682DEFUN (bgp_maxpaths_ibgp,
683 bgp_maxpaths_ibgp_cmd,
684 "maximum-paths ibgp <1-255>",
685 "Forward packets over multiple paths\n"
686 "iBGP-multipath\n"
687 "Number of paths\n")
688{
689 struct bgp *bgp;
690 u_int16_t maxpaths;
691 int ret;
692
693 bgp = vty->index;
694
695 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
696
697 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
698 BGP_PEER_IBGP, maxpaths);
699 if (ret < 0)
700 {
701 vty_out (vty,
702 "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
703 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
704 return CMD_WARNING;
705 }
706
707 return CMD_SUCCESS;
708}
709
710DEFUN (no_bgp_maxpaths,
711 no_bgp_maxpaths_cmd,
712 "no maximum-paths",
713 NO_STR
714 "Forward packets over multiple paths\n"
715 "Number of paths\n")
716{
717 struct bgp *bgp;
718 int ret;
719
720 bgp = vty->index;
721
722 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
723 BGP_PEER_EBGP);
724 if (ret < 0)
725 {
726 vty_out (vty,
727 "%% Failed to unset maximum-paths for afi %u, safi %u%s",
728 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
729 return CMD_WARNING;
730 }
731
732 return CMD_SUCCESS;
733}
734
735ALIAS (no_bgp_maxpaths,
736 no_bgp_maxpaths_arg_cmd,
737 "no maximum-paths <1-255>",
738 NO_STR
739 "Forward packets over multiple paths\n"
740 "Number of paths\n")
741
742DEFUN (no_bgp_maxpaths_ibgp,
743 no_bgp_maxpaths_ibgp_cmd,
744 "no maximum-paths ibgp",
745 NO_STR
746 "Forward packets over multiple paths\n"
747 "iBGP-multipath\n"
748 "Number of paths\n")
749{
750 struct bgp *bgp;
751 int ret;
752
753 bgp = vty->index;
754
755 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
756 BGP_PEER_IBGP);
757 if (ret < 0)
758 {
759 vty_out (vty,
760 "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
761 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
762 return CMD_WARNING;
763 }
764
765 return CMD_SUCCESS;
766}
767
768ALIAS (no_bgp_maxpaths_ibgp,
769 no_bgp_maxpaths_ibgp_arg_cmd,
770 "no maximum-paths ibgp <1-255>",
771 NO_STR
772 "Forward packets over multiple paths\n"
773 "iBGP-multipath\n"
774 "Number of paths\n")
775
776int
777bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
778 safi_t safi, int *write)
779{
780 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
781 {
782 bgp_config_write_family_header (vty, afi, safi, write);
783 vty_out (vty, " maximum-paths %d%s",
784 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
785 }
786
787 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
788 {
789 bgp_config_write_family_header (vty, afi, safi, write);
790 vty_out (vty, " maximum-paths ibgp %d%s",
791 bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
792 }
793
794 return 0;
795}
796
paul718e3742002-12-13 20:15:29 +0000797/* BGP timers. */
798
799DEFUN (bgp_timers,
800 bgp_timers_cmd,
801 "timers bgp <0-65535> <0-65535>",
802 "Adjust routing timers\n"
803 "BGP timers\n"
804 "Keepalive interval\n"
805 "Holdtime\n")
806{
807 struct bgp *bgp;
808 unsigned long keepalive = 0;
809 unsigned long holdtime = 0;
810
811 bgp = vty->index;
812
813 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
814 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
815
816 /* Holdtime value check. */
817 if (holdtime < 3 && holdtime != 0)
818 {
819 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
820 VTY_NEWLINE);
821 return CMD_WARNING;
822 }
823
824 bgp_timers_set (bgp, keepalive, holdtime);
825
826 return CMD_SUCCESS;
827}
828
829DEFUN (no_bgp_timers,
830 no_bgp_timers_cmd,
831 "no timers bgp",
832 NO_STR
833 "Adjust routing timers\n"
834 "BGP timers\n")
835{
836 struct bgp *bgp;
837
838 bgp = vty->index;
839 bgp_timers_unset (bgp);
840
841 return CMD_SUCCESS;
842}
843
844ALIAS (no_bgp_timers,
845 no_bgp_timers_arg_cmd,
846 "no timers bgp <0-65535> <0-65535>",
847 NO_STR
848 "Adjust routing timers\n"
849 "BGP timers\n"
850 "Keepalive interval\n"
851 "Holdtime\n")
852
853DEFUN (bgp_client_to_client_reflection,
854 bgp_client_to_client_reflection_cmd,
855 "bgp client-to-client reflection",
856 "BGP specific commands\n"
857 "Configure client to client route reflection\n"
858 "reflection of routes allowed\n")
859{
860 struct bgp *bgp;
861
862 bgp = vty->index;
863 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
864 return CMD_SUCCESS;
865}
866
867DEFUN (no_bgp_client_to_client_reflection,
868 no_bgp_client_to_client_reflection_cmd,
869 "no bgp client-to-client reflection",
870 NO_STR
871 "BGP specific commands\n"
872 "Configure client to client route reflection\n"
873 "reflection of routes allowed\n")
874{
875 struct bgp *bgp;
876
877 bgp = vty->index;
878 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
879 return CMD_SUCCESS;
880}
881
882/* "bgp always-compare-med" configuration. */
883DEFUN (bgp_always_compare_med,
884 bgp_always_compare_med_cmd,
885 "bgp always-compare-med",
886 "BGP specific commands\n"
887 "Allow comparing MED from different neighbors\n")
888{
889 struct bgp *bgp;
890
891 bgp = vty->index;
892 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
893 return CMD_SUCCESS;
894}
895
896DEFUN (no_bgp_always_compare_med,
897 no_bgp_always_compare_med_cmd,
898 "no bgp always-compare-med",
899 NO_STR
900 "BGP specific commands\n"
901 "Allow comparing MED from different neighbors\n")
902{
903 struct bgp *bgp;
904
905 bgp = vty->index;
906 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
907 return CMD_SUCCESS;
908}
909
910/* "bgp deterministic-med" configuration. */
911DEFUN (bgp_deterministic_med,
912 bgp_deterministic_med_cmd,
913 "bgp deterministic-med",
914 "BGP specific commands\n"
915 "Pick the best-MED path among paths advertised from the neighboring AS\n")
916{
917 struct bgp *bgp;
918
919 bgp = vty->index;
920 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
921 return CMD_SUCCESS;
922}
923
924DEFUN (no_bgp_deterministic_med,
925 no_bgp_deterministic_med_cmd,
926 "no bgp deterministic-med",
927 NO_STR
928 "BGP specific commands\n"
929 "Pick the best-MED path among paths advertised from the neighboring AS\n")
930{
931 struct bgp *bgp;
932
933 bgp = vty->index;
934 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
935 return CMD_SUCCESS;
936}
hasso538621f2004-05-21 09:31:30 +0000937
938/* "bgp graceful-restart" configuration. */
939DEFUN (bgp_graceful_restart,
940 bgp_graceful_restart_cmd,
941 "bgp graceful-restart",
942 "BGP specific commands\n"
943 "Graceful restart capability parameters\n")
944{
945 struct bgp *bgp;
946
947 bgp = vty->index;
948 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
949 return CMD_SUCCESS;
950}
951
952DEFUN (no_bgp_graceful_restart,
953 no_bgp_graceful_restart_cmd,
954 "no bgp graceful-restart",
955 NO_STR
956 "BGP specific commands\n"
957 "Graceful restart capability parameters\n")
958{
959 struct bgp *bgp;
960
961 bgp = vty->index;
962 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
963 return CMD_SUCCESS;
964}
965
hasso93406d82005-02-02 14:40:33 +0000966DEFUN (bgp_graceful_restart_stalepath_time,
967 bgp_graceful_restart_stalepath_time_cmd,
968 "bgp graceful-restart stalepath-time <1-3600>",
969 "BGP specific commands\n"
970 "Graceful restart capability parameters\n"
971 "Set the max time to hold onto restarting peer's stale paths\n"
972 "Delay value (seconds)\n")
973{
974 struct bgp *bgp;
975 u_int32_t stalepath;
976
977 bgp = vty->index;
978 if (! bgp)
979 return CMD_WARNING;
980
981 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
982 bgp->stalepath_time = stalepath;
983 return CMD_SUCCESS;
984}
985
986DEFUN (no_bgp_graceful_restart_stalepath_time,
987 no_bgp_graceful_restart_stalepath_time_cmd,
988 "no bgp graceful-restart stalepath-time",
989 NO_STR
990 "BGP specific commands\n"
991 "Graceful restart capability parameters\n"
992 "Set the max time to hold onto restarting peer's stale paths\n")
993{
994 struct bgp *bgp;
995
996 bgp = vty->index;
997 if (! bgp)
998 return CMD_WARNING;
999
1000 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1001 return CMD_SUCCESS;
1002}
1003
1004ALIAS (no_bgp_graceful_restart_stalepath_time,
1005 no_bgp_graceful_restart_stalepath_time_val_cmd,
1006 "no bgp graceful-restart stalepath-time <1-3600>",
1007 NO_STR
1008 "BGP specific commands\n"
1009 "Graceful restart capability parameters\n"
1010 "Set the max time to hold onto restarting peer's stale paths\n"
1011 "Delay value (seconds)\n")
1012
paul718e3742002-12-13 20:15:29 +00001013/* "bgp fast-external-failover" configuration. */
1014DEFUN (bgp_fast_external_failover,
1015 bgp_fast_external_failover_cmd,
1016 "bgp fast-external-failover",
1017 BGP_STR
1018 "Immediately reset session if a link to a directly connected external peer goes down\n")
1019{
1020 struct bgp *bgp;
1021
1022 bgp = vty->index;
1023 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1024 return CMD_SUCCESS;
1025}
1026
1027DEFUN (no_bgp_fast_external_failover,
1028 no_bgp_fast_external_failover_cmd,
1029 "no bgp fast-external-failover",
1030 NO_STR
1031 BGP_STR
1032 "Immediately reset session if a link to a directly connected external peer goes down\n")
1033{
1034 struct bgp *bgp;
1035
1036 bgp = vty->index;
1037 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1038 return CMD_SUCCESS;
1039}
1040
1041/* "bgp enforce-first-as" configuration. */
1042DEFUN (bgp_enforce_first_as,
1043 bgp_enforce_first_as_cmd,
1044 "bgp enforce-first-as",
1045 BGP_STR
1046 "Enforce the first AS for EBGP routes\n")
1047{
1048 struct bgp *bgp;
1049
1050 bgp = vty->index;
1051 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1052 return CMD_SUCCESS;
1053}
1054
1055DEFUN (no_bgp_enforce_first_as,
1056 no_bgp_enforce_first_as_cmd,
1057 "no bgp enforce-first-as",
1058 NO_STR
1059 BGP_STR
1060 "Enforce the first AS for EBGP routes\n")
1061{
1062 struct bgp *bgp;
1063
1064 bgp = vty->index;
1065 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1066 return CMD_SUCCESS;
1067}
1068
1069/* "bgp bestpath compare-routerid" configuration. */
1070DEFUN (bgp_bestpath_compare_router_id,
1071 bgp_bestpath_compare_router_id_cmd,
1072 "bgp bestpath compare-routerid",
1073 "BGP specific commands\n"
1074 "Change the default bestpath selection\n"
1075 "Compare router-id for identical EBGP paths\n")
1076{
1077 struct bgp *bgp;
1078
1079 bgp = vty->index;
1080 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1081 return CMD_SUCCESS;
1082}
1083
1084DEFUN (no_bgp_bestpath_compare_router_id,
1085 no_bgp_bestpath_compare_router_id_cmd,
1086 "no bgp bestpath compare-routerid",
1087 NO_STR
1088 "BGP specific commands\n"
1089 "Change the default bestpath selection\n"
1090 "Compare router-id for identical EBGP paths\n")
1091{
1092 struct bgp *bgp;
1093
1094 bgp = vty->index;
1095 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1096 return CMD_SUCCESS;
1097}
1098
1099/* "bgp bestpath as-path ignore" configuration. */
1100DEFUN (bgp_bestpath_aspath_ignore,
1101 bgp_bestpath_aspath_ignore_cmd,
1102 "bgp bestpath as-path ignore",
1103 "BGP specific commands\n"
1104 "Change the default bestpath selection\n"
1105 "AS-path attribute\n"
1106 "Ignore as-path length in selecting a route\n")
1107{
1108 struct bgp *bgp;
1109
1110 bgp = vty->index;
1111 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
1112 return CMD_SUCCESS;
1113}
1114
1115DEFUN (no_bgp_bestpath_aspath_ignore,
1116 no_bgp_bestpath_aspath_ignore_cmd,
1117 "no bgp bestpath as-path ignore",
1118 NO_STR
1119 "BGP specific commands\n"
1120 "Change the default bestpath selection\n"
1121 "AS-path attribute\n"
1122 "Ignore as-path length in selecting a route\n")
1123{
1124 struct bgp *bgp;
1125
1126 bgp = vty->index;
1127 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1128 return CMD_SUCCESS;
1129}
1130
hasso68118452005-04-08 15:40:36 +00001131/* "bgp bestpath as-path confed" configuration. */
1132DEFUN (bgp_bestpath_aspath_confed,
1133 bgp_bestpath_aspath_confed_cmd,
1134 "bgp bestpath as-path confed",
1135 "BGP specific commands\n"
1136 "Change the default bestpath selection\n"
1137 "AS-path attribute\n"
1138 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1139{
1140 struct bgp *bgp;
1141
1142 bgp = vty->index;
1143 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1144 return CMD_SUCCESS;
1145}
1146
1147DEFUN (no_bgp_bestpath_aspath_confed,
1148 no_bgp_bestpath_aspath_confed_cmd,
1149 "no bgp bestpath as-path confed",
1150 NO_STR
1151 "BGP specific commands\n"
1152 "Change the default bestpath selection\n"
1153 "AS-path attribute\n"
1154 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1155{
1156 struct bgp *bgp;
1157
1158 bgp = vty->index;
1159 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1160 return CMD_SUCCESS;
1161}
1162
paul848973c2003-08-13 00:32:49 +00001163/* "bgp log-neighbor-changes" configuration. */
1164DEFUN (bgp_log_neighbor_changes,
1165 bgp_log_neighbor_changes_cmd,
1166 "bgp log-neighbor-changes",
1167 "BGP specific commands\n"
1168 "Log neighbor up/down and reset reason\n")
1169{
1170 struct bgp *bgp;
1171
1172 bgp = vty->index;
1173 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1174 return CMD_SUCCESS;
1175}
1176
1177DEFUN (no_bgp_log_neighbor_changes,
1178 no_bgp_log_neighbor_changes_cmd,
1179 "no bgp log-neighbor-changes",
1180 NO_STR
1181 "BGP specific commands\n"
1182 "Log neighbor up/down and reset reason\n")
1183{
1184 struct bgp *bgp;
1185
1186 bgp = vty->index;
1187 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1188 return CMD_SUCCESS;
1189}
1190
paul718e3742002-12-13 20:15:29 +00001191/* "bgp bestpath med" configuration. */
1192DEFUN (bgp_bestpath_med,
1193 bgp_bestpath_med_cmd,
1194 "bgp bestpath med (confed|missing-as-worst)",
1195 "BGP specific commands\n"
1196 "Change the default bestpath selection\n"
1197 "MED attribute\n"
1198 "Compare MED among confederation paths\n"
1199 "Treat missing MED as the least preferred one\n")
1200{
1201 struct bgp *bgp;
1202
1203 bgp = vty->index;
1204
1205 if (strncmp (argv[0], "confed", 1) == 0)
1206 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1207 else
1208 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1209
1210 return CMD_SUCCESS;
1211}
1212
1213DEFUN (bgp_bestpath_med2,
1214 bgp_bestpath_med2_cmd,
1215 "bgp bestpath med confed missing-as-worst",
1216 "BGP specific commands\n"
1217 "Change the default bestpath selection\n"
1218 "MED attribute\n"
1219 "Compare MED among confederation paths\n"
1220 "Treat missing MED as the least preferred one\n")
1221{
1222 struct bgp *bgp;
1223
1224 bgp = vty->index;
1225 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1226 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1227 return CMD_SUCCESS;
1228}
1229
1230ALIAS (bgp_bestpath_med2,
1231 bgp_bestpath_med3_cmd,
1232 "bgp bestpath med missing-as-worst confed",
1233 "BGP specific commands\n"
1234 "Change the default bestpath selection\n"
1235 "MED attribute\n"
1236 "Treat missing MED as the least preferred one\n"
1237 "Compare MED among confederation paths\n")
1238
1239DEFUN (no_bgp_bestpath_med,
1240 no_bgp_bestpath_med_cmd,
1241 "no bgp bestpath med (confed|missing-as-worst)",
1242 NO_STR
1243 "BGP specific commands\n"
1244 "Change the default bestpath selection\n"
1245 "MED attribute\n"
1246 "Compare MED among confederation paths\n"
1247 "Treat missing MED as the least preferred one\n")
1248{
1249 struct bgp *bgp;
1250
1251 bgp = vty->index;
1252
1253 if (strncmp (argv[0], "confed", 1) == 0)
1254 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1255 else
1256 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1257
1258 return CMD_SUCCESS;
1259}
1260
1261DEFUN (no_bgp_bestpath_med2,
1262 no_bgp_bestpath_med2_cmd,
1263 "no bgp bestpath med confed missing-as-worst",
1264 NO_STR
1265 "BGP specific commands\n"
1266 "Change the default bestpath selection\n"
1267 "MED attribute\n"
1268 "Compare MED among confederation paths\n"
1269 "Treat missing MED as the least preferred one\n")
1270{
1271 struct bgp *bgp;
1272
1273 bgp = vty->index;
1274 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1275 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1276 return CMD_SUCCESS;
1277}
1278
1279ALIAS (no_bgp_bestpath_med2,
1280 no_bgp_bestpath_med3_cmd,
1281 "no bgp bestpath med missing-as-worst confed",
1282 NO_STR
1283 "BGP specific commands\n"
1284 "Change the default bestpath selection\n"
1285 "MED attribute\n"
1286 "Treat missing MED as the least preferred one\n"
1287 "Compare MED among confederation paths\n")
1288
1289/* "no bgp default ipv4-unicast". */
1290DEFUN (no_bgp_default_ipv4_unicast,
1291 no_bgp_default_ipv4_unicast_cmd,
1292 "no bgp default ipv4-unicast",
1293 NO_STR
1294 "BGP specific commands\n"
1295 "Configure BGP defaults\n"
1296 "Activate ipv4-unicast for a peer by default\n")
1297{
1298 struct bgp *bgp;
1299
1300 bgp = vty->index;
1301 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1302 return CMD_SUCCESS;
1303}
1304
1305DEFUN (bgp_default_ipv4_unicast,
1306 bgp_default_ipv4_unicast_cmd,
1307 "bgp default ipv4-unicast",
1308 "BGP specific commands\n"
1309 "Configure BGP defaults\n"
1310 "Activate ipv4-unicast for a peer by default\n")
1311{
1312 struct bgp *bgp;
1313
1314 bgp = vty->index;
1315 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1316 return CMD_SUCCESS;
1317}
1318
1319/* "bgp import-check" configuration. */
1320DEFUN (bgp_network_import_check,
1321 bgp_network_import_check_cmd,
1322 "bgp network import-check",
1323 "BGP specific commands\n"
1324 "BGP network command\n"
1325 "Check BGP network route exists in IGP\n")
1326{
1327 struct bgp *bgp;
1328
1329 bgp = vty->index;
1330 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1331 return CMD_SUCCESS;
1332}
1333
1334DEFUN (no_bgp_network_import_check,
1335 no_bgp_network_import_check_cmd,
1336 "no bgp network import-check",
1337 NO_STR
1338 "BGP specific commands\n"
1339 "BGP network command\n"
1340 "Check BGP network route exists in IGP\n")
1341{
1342 struct bgp *bgp;
1343
1344 bgp = vty->index;
1345 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1346 return CMD_SUCCESS;
1347}
1348
1349DEFUN (bgp_default_local_preference,
1350 bgp_default_local_preference_cmd,
1351 "bgp default local-preference <0-4294967295>",
1352 "BGP specific commands\n"
1353 "Configure BGP defaults\n"
1354 "local preference (higher=more preferred)\n"
1355 "Configure default local preference value\n")
1356{
1357 struct bgp *bgp;
1358 u_int32_t local_pref;
1359
1360 bgp = vty->index;
1361
1362 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1363
1364 bgp_default_local_preference_set (bgp, local_pref);
1365
1366 return CMD_SUCCESS;
1367}
1368
1369DEFUN (no_bgp_default_local_preference,
1370 no_bgp_default_local_preference_cmd,
1371 "no bgp default local-preference",
1372 NO_STR
1373 "BGP specific commands\n"
1374 "Configure BGP defaults\n"
1375 "local preference (higher=more preferred)\n")
1376{
1377 struct bgp *bgp;
1378
1379 bgp = vty->index;
1380 bgp_default_local_preference_unset (bgp);
1381 return CMD_SUCCESS;
1382}
1383
1384ALIAS (no_bgp_default_local_preference,
1385 no_bgp_default_local_preference_val_cmd,
1386 "no bgp default local-preference <0-4294967295>",
1387 NO_STR
1388 "BGP specific commands\n"
1389 "Configure BGP defaults\n"
1390 "local preference (higher=more preferred)\n"
1391 "Configure default local preference value\n")
1392
1393static int
paulfd79ac92004-10-13 05:06:08 +00001394peer_remote_as_vty (struct vty *vty, const char *peer_str,
1395 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001396{
1397 int ret;
1398 struct bgp *bgp;
1399 as_t as;
1400 union sockunion su;
1401
1402 bgp = vty->index;
1403
1404 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001405 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001406
1407 /* If peer is peer group, call proper function. */
1408 ret = str2sockunion (peer_str, &su);
1409 if (ret < 0)
1410 {
1411 ret = peer_group_remote_as (bgp, peer_str, &as);
1412 if (ret < 0)
1413 {
1414 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1415 return CMD_WARNING;
1416 }
1417 return CMD_SUCCESS;
1418 }
1419
1420 if (peer_address_self_check (&su))
1421 {
1422 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1423 VTY_NEWLINE);
1424 return CMD_WARNING;
1425 }
1426
1427 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1428
1429 /* This peer belongs to peer group. */
1430 switch (ret)
1431 {
1432 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001433 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001434 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001435 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001436 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 +00001437 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001438 }
1439 return bgp_vty_return (vty, ret);
1440}
1441
1442DEFUN (neighbor_remote_as,
1443 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001444 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001445 NEIGHBOR_STR
1446 NEIGHBOR_ADDR_STR2
1447 "Specify a BGP neighbor\n"
1448 AS_STR)
1449{
1450 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1451}
1452
1453DEFUN (neighbor_peer_group,
1454 neighbor_peer_group_cmd,
1455 "neighbor WORD peer-group",
1456 NEIGHBOR_STR
1457 "Neighbor tag\n"
1458 "Configure peer-group\n")
1459{
1460 struct bgp *bgp;
1461 struct peer_group *group;
1462
1463 bgp = vty->index;
1464
1465 group = peer_group_get (bgp, argv[0]);
1466 if (! group)
1467 return CMD_WARNING;
1468
1469 return CMD_SUCCESS;
1470}
1471
1472DEFUN (no_neighbor,
1473 no_neighbor_cmd,
1474 NO_NEIGHBOR_CMD2,
1475 NO_STR
1476 NEIGHBOR_STR
1477 NEIGHBOR_ADDR_STR2)
1478{
1479 int ret;
1480 union sockunion su;
1481 struct peer_group *group;
1482 struct peer *peer;
1483
1484 ret = str2sockunion (argv[0], &su);
1485 if (ret < 0)
1486 {
1487 group = peer_group_lookup (vty->index, argv[0]);
1488 if (group)
1489 peer_group_delete (group);
1490 else
1491 {
1492 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1493 return CMD_WARNING;
1494 }
1495 }
1496 else
1497 {
1498 peer = peer_lookup (vty->index, &su);
1499 if (peer)
paul200df112005-06-01 11:17:05 +00001500 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001501 }
1502
1503 return CMD_SUCCESS;
1504}
1505
1506ALIAS (no_neighbor,
1507 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001508 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001509 NO_STR
1510 NEIGHBOR_STR
1511 NEIGHBOR_ADDR_STR
1512 "Specify a BGP neighbor\n"
1513 AS_STR)
1514
1515DEFUN (no_neighbor_peer_group,
1516 no_neighbor_peer_group_cmd,
1517 "no neighbor WORD peer-group",
1518 NO_STR
1519 NEIGHBOR_STR
1520 "Neighbor tag\n"
1521 "Configure peer-group\n")
1522{
1523 struct peer_group *group;
1524
1525 group = peer_group_lookup (vty->index, argv[0]);
1526 if (group)
1527 peer_group_delete (group);
1528 else
1529 {
1530 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1531 return CMD_WARNING;
1532 }
1533 return CMD_SUCCESS;
1534}
1535
1536DEFUN (no_neighbor_peer_group_remote_as,
1537 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001538 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001539 NO_STR
1540 NEIGHBOR_STR
1541 "Neighbor tag\n"
1542 "Specify a BGP neighbor\n"
1543 AS_STR)
1544{
1545 struct peer_group *group;
1546
1547 group = peer_group_lookup (vty->index, argv[0]);
1548 if (group)
1549 peer_group_remote_as_delete (group);
1550 else
1551 {
1552 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1553 return CMD_WARNING;
1554 }
1555 return CMD_SUCCESS;
1556}
1557
1558DEFUN (neighbor_local_as,
1559 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001560 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001561 NEIGHBOR_STR
1562 NEIGHBOR_ADDR_STR2
1563 "Specify a local-as number\n"
1564 "AS number used as local AS\n")
1565{
1566 struct peer *peer;
1567 int ret;
1568
1569 peer = peer_and_group_lookup_vty (vty, argv[0]);
1570 if (! peer)
1571 return CMD_WARNING;
1572
1573 ret = peer_local_as_set (peer, atoi (argv[1]), 0);
1574 return bgp_vty_return (vty, ret);
1575}
1576
1577DEFUN (neighbor_local_as_no_prepend,
1578 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001579 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001580 NEIGHBOR_STR
1581 NEIGHBOR_ADDR_STR2
1582 "Specify a local-as number\n"
1583 "AS number used as local AS\n"
1584 "Do not prepend local-as to updates from ebgp peers\n")
1585{
1586 struct peer *peer;
1587 int ret;
1588
1589 peer = peer_and_group_lookup_vty (vty, argv[0]);
1590 if (! peer)
1591 return CMD_WARNING;
1592
1593 ret = peer_local_as_set (peer, atoi (argv[1]), 1);
1594 return bgp_vty_return (vty, ret);
1595}
1596
1597DEFUN (no_neighbor_local_as,
1598 no_neighbor_local_as_cmd,
1599 NO_NEIGHBOR_CMD2 "local-as",
1600 NO_STR
1601 NEIGHBOR_STR
1602 NEIGHBOR_ADDR_STR2
1603 "Specify a local-as number\n")
1604{
1605 struct peer *peer;
1606 int ret;
1607
1608 peer = peer_and_group_lookup_vty (vty, argv[0]);
1609 if (! peer)
1610 return CMD_WARNING;
1611
1612 ret = peer_local_as_unset (peer);
1613 return bgp_vty_return (vty, ret);
1614}
1615
1616ALIAS (no_neighbor_local_as,
1617 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001618 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001619 NO_STR
1620 NEIGHBOR_STR
1621 NEIGHBOR_ADDR_STR2
1622 "Specify a local-as number\n"
1623 "AS number used as local AS\n")
1624
1625ALIAS (no_neighbor_local_as,
1626 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001627 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001628 NO_STR
1629 NEIGHBOR_STR
1630 NEIGHBOR_ADDR_STR2
1631 "Specify a local-as number\n"
1632 "AS number used as local AS\n"
1633 "Do not prepend local-as to updates from ebgp peers\n")
1634
Paul Jakma0df7c912008-07-21 21:02:49 +00001635DEFUN (neighbor_password,
1636 neighbor_password_cmd,
1637 NEIGHBOR_CMD2 "password LINE",
1638 NEIGHBOR_STR
1639 NEIGHBOR_ADDR_STR2
1640 "Set a password\n"
1641 "The password\n")
1642{
1643 struct peer *peer;
1644 int ret;
1645
1646 peer = peer_and_group_lookup_vty (vty, argv[0]);
1647 if (! peer)
1648 return CMD_WARNING;
1649
1650 ret = peer_password_set (peer, argv[1]);
1651 return bgp_vty_return (vty, ret);
1652}
1653
1654DEFUN (no_neighbor_password,
1655 no_neighbor_password_cmd,
1656 NO_NEIGHBOR_CMD2 "password",
1657 NO_STR
1658 NEIGHBOR_STR
1659 NEIGHBOR_ADDR_STR2
1660 "Set a password\n")
1661{
1662 struct peer *peer;
1663 int ret;
1664
1665 peer = peer_and_group_lookup_vty (vty, argv[0]);
1666 if (! peer)
1667 return CMD_WARNING;
1668
1669 ret = peer_password_unset (peer);
1670 return bgp_vty_return (vty, ret);
1671}
1672
paul718e3742002-12-13 20:15:29 +00001673DEFUN (neighbor_activate,
1674 neighbor_activate_cmd,
1675 NEIGHBOR_CMD2 "activate",
1676 NEIGHBOR_STR
1677 NEIGHBOR_ADDR_STR2
1678 "Enable the Address Family for this Neighbor\n")
1679{
1680 struct peer *peer;
1681
1682 peer = peer_and_group_lookup_vty (vty, argv[0]);
1683 if (! peer)
1684 return CMD_WARNING;
1685
1686 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1687
1688 return CMD_SUCCESS;
1689}
1690
1691DEFUN (no_neighbor_activate,
1692 no_neighbor_activate_cmd,
1693 NO_NEIGHBOR_CMD2 "activate",
1694 NO_STR
1695 NEIGHBOR_STR
1696 NEIGHBOR_ADDR_STR2
1697 "Enable the Address Family for this Neighbor\n")
1698{
1699 int ret;
1700 struct peer *peer;
1701
1702 /* Lookup peer. */
1703 peer = peer_and_group_lookup_vty (vty, argv[0]);
1704 if (! peer)
1705 return CMD_WARNING;
1706
1707 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1708
1709 return bgp_vty_return (vty, ret);
1710}
1711
1712DEFUN (neighbor_set_peer_group,
1713 neighbor_set_peer_group_cmd,
1714 NEIGHBOR_CMD "peer-group WORD",
1715 NEIGHBOR_STR
1716 NEIGHBOR_ADDR_STR
1717 "Member of the peer-group\n"
1718 "peer-group name\n")
1719{
1720 int ret;
1721 as_t as;
1722 union sockunion su;
1723 struct bgp *bgp;
1724 struct peer_group *group;
1725
1726 bgp = vty->index;
1727
1728 ret = str2sockunion (argv[0], &su);
1729 if (ret < 0)
1730 {
1731 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1732 return CMD_WARNING;
1733 }
1734
1735 group = peer_group_lookup (bgp, argv[1]);
1736 if (! group)
1737 {
1738 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1739 return CMD_WARNING;
1740 }
1741
1742 if (peer_address_self_check (&su))
1743 {
1744 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1745 VTY_NEWLINE);
1746 return CMD_WARNING;
1747 }
1748
1749 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1750 bgp_node_safi (vty), &as);
1751
1752 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1753 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001754 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 +00001755 return CMD_WARNING;
1756 }
1757
1758 return bgp_vty_return (vty, ret);
1759}
1760
1761DEFUN (no_neighbor_set_peer_group,
1762 no_neighbor_set_peer_group_cmd,
1763 NO_NEIGHBOR_CMD "peer-group WORD",
1764 NO_STR
1765 NEIGHBOR_STR
1766 NEIGHBOR_ADDR_STR
1767 "Member of the peer-group\n"
1768 "peer-group name\n")
1769{
1770 int ret;
1771 struct bgp *bgp;
1772 struct peer *peer;
1773 struct peer_group *group;
1774
1775 bgp = vty->index;
1776
1777 peer = peer_lookup_vty (vty, argv[0]);
1778 if (! peer)
1779 return CMD_WARNING;
1780
1781 group = peer_group_lookup (bgp, argv[1]);
1782 if (! group)
1783 {
1784 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1785 return CMD_WARNING;
1786 }
1787
1788 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1789 bgp_node_safi (vty));
1790
1791 return bgp_vty_return (vty, ret);
1792}
1793
paul94f2b392005-06-28 12:44:16 +00001794static int
paulfd79ac92004-10-13 05:06:08 +00001795peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1796 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001797{
1798 int ret;
1799 struct peer *peer;
1800
1801 peer = peer_and_group_lookup_vty (vty, ip_str);
1802 if (! peer)
1803 return CMD_WARNING;
1804
1805 if (set)
1806 ret = peer_flag_set (peer, flag);
1807 else
1808 ret = peer_flag_unset (peer, flag);
1809
1810 return bgp_vty_return (vty, ret);
1811}
1812
paul94f2b392005-06-28 12:44:16 +00001813static int
paulfd79ac92004-10-13 05:06:08 +00001814peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001815{
1816 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1817}
1818
paul94f2b392005-06-28 12:44:16 +00001819static int
paulfd79ac92004-10-13 05:06:08 +00001820peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001821{
1822 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1823}
1824
1825/* neighbor passive. */
1826DEFUN (neighbor_passive,
1827 neighbor_passive_cmd,
1828 NEIGHBOR_CMD2 "passive",
1829 NEIGHBOR_STR
1830 NEIGHBOR_ADDR_STR2
1831 "Don't send open messages to this neighbor\n")
1832{
1833 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1834}
1835
1836DEFUN (no_neighbor_passive,
1837 no_neighbor_passive_cmd,
1838 NO_NEIGHBOR_CMD2 "passive",
1839 NO_STR
1840 NEIGHBOR_STR
1841 NEIGHBOR_ADDR_STR2
1842 "Don't send open messages to this neighbor\n")
1843{
1844 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1845}
1846
1847/* neighbor shutdown. */
1848DEFUN (neighbor_shutdown,
1849 neighbor_shutdown_cmd,
1850 NEIGHBOR_CMD2 "shutdown",
1851 NEIGHBOR_STR
1852 NEIGHBOR_ADDR_STR2
1853 "Administratively shut down this neighbor\n")
1854{
1855 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1856}
1857
1858DEFUN (no_neighbor_shutdown,
1859 no_neighbor_shutdown_cmd,
1860 NO_NEIGHBOR_CMD2 "shutdown",
1861 NO_STR
1862 NEIGHBOR_STR
1863 NEIGHBOR_ADDR_STR2
1864 "Administratively shut down this neighbor\n")
1865{
1866 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1867}
1868
hassoc9502432005-02-01 22:01:48 +00001869/* Deprecated neighbor capability route-refresh. */
1870DEFUN_DEPRECATED (neighbor_capability_route_refresh,
1871 neighbor_capability_route_refresh_cmd,
1872 NEIGHBOR_CMD2 "capability route-refresh",
1873 NEIGHBOR_STR
1874 NEIGHBOR_ADDR_STR2
1875 "Advertise capability to the peer\n"
1876 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001877{
hassoc9502432005-02-01 22:01:48 +00001878 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001879}
1880
hassoc9502432005-02-01 22:01:48 +00001881DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
1882 no_neighbor_capability_route_refresh_cmd,
1883 NO_NEIGHBOR_CMD2 "capability route-refresh",
1884 NO_STR
1885 NEIGHBOR_STR
1886 NEIGHBOR_ADDR_STR2
1887 "Advertise capability to the peer\n"
1888 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001889{
hassoc9502432005-02-01 22:01:48 +00001890 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001891}
1892
1893/* neighbor capability dynamic. */
1894DEFUN (neighbor_capability_dynamic,
1895 neighbor_capability_dynamic_cmd,
1896 NEIGHBOR_CMD2 "capability dynamic",
1897 NEIGHBOR_STR
1898 NEIGHBOR_ADDR_STR2
1899 "Advertise capability to the peer\n"
1900 "Advertise dynamic capability to this neighbor\n")
1901{
1902 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1903}
1904
1905DEFUN (no_neighbor_capability_dynamic,
1906 no_neighbor_capability_dynamic_cmd,
1907 NO_NEIGHBOR_CMD2 "capability dynamic",
1908 NO_STR
1909 NEIGHBOR_STR
1910 NEIGHBOR_ADDR_STR2
1911 "Advertise capability to the peer\n"
1912 "Advertise dynamic capability to this neighbor\n")
1913{
1914 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1915}
1916
1917/* neighbor dont-capability-negotiate */
1918DEFUN (neighbor_dont_capability_negotiate,
1919 neighbor_dont_capability_negotiate_cmd,
1920 NEIGHBOR_CMD2 "dont-capability-negotiate",
1921 NEIGHBOR_STR
1922 NEIGHBOR_ADDR_STR2
1923 "Do not perform capability negotiation\n")
1924{
1925 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
1926}
1927
1928DEFUN (no_neighbor_dont_capability_negotiate,
1929 no_neighbor_dont_capability_negotiate_cmd,
1930 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
1931 NO_STR
1932 NEIGHBOR_STR
1933 NEIGHBOR_ADDR_STR2
1934 "Do not perform capability negotiation\n")
1935{
1936 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
1937}
1938
paul94f2b392005-06-28 12:44:16 +00001939static int
paulfd79ac92004-10-13 05:06:08 +00001940peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00001941 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001942{
1943 int ret;
1944 struct peer *peer;
1945
1946 peer = peer_and_group_lookup_vty (vty, peer_str);
1947 if (! peer)
1948 return CMD_WARNING;
1949
1950 if (set)
1951 ret = peer_af_flag_set (peer, afi, safi, flag);
1952 else
1953 ret = peer_af_flag_unset (peer, afi, safi, flag);
1954
1955 return bgp_vty_return (vty, ret);
1956}
1957
paul94f2b392005-06-28 12:44:16 +00001958static int
paulfd79ac92004-10-13 05:06:08 +00001959peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00001960 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00001961{
1962 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
1963}
1964
paul94f2b392005-06-28 12:44:16 +00001965static int
paulfd79ac92004-10-13 05:06:08 +00001966peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00001967 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00001968{
1969 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
1970}
1971
1972/* neighbor capability orf prefix-list. */
1973DEFUN (neighbor_capability_orf_prefix,
1974 neighbor_capability_orf_prefix_cmd,
1975 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
1976 NEIGHBOR_STR
1977 NEIGHBOR_ADDR_STR2
1978 "Advertise capability to the peer\n"
1979 "Advertise ORF capability to the peer\n"
1980 "Advertise prefixlist ORF capability to this neighbor\n"
1981 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
1982 "Capability to RECEIVE the ORF from this neighbor\n"
1983 "Capability to SEND the ORF to this neighbor\n")
1984{
1985 u_int16_t flag = 0;
1986
1987 if (strncmp (argv[1], "s", 1) == 0)
1988 flag = PEER_FLAG_ORF_PREFIX_SM;
1989 else if (strncmp (argv[1], "r", 1) == 0)
1990 flag = PEER_FLAG_ORF_PREFIX_RM;
1991 else if (strncmp (argv[1], "b", 1) == 0)
1992 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
1993 else
1994 return CMD_WARNING;
1995
1996 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
1997 bgp_node_safi (vty), flag);
1998}
1999
2000DEFUN (no_neighbor_capability_orf_prefix,
2001 no_neighbor_capability_orf_prefix_cmd,
2002 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2003 NO_STR
2004 NEIGHBOR_STR
2005 NEIGHBOR_ADDR_STR2
2006 "Advertise capability to the peer\n"
2007 "Advertise ORF capability to the peer\n"
2008 "Advertise prefixlist ORF capability to this neighbor\n"
2009 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2010 "Capability to RECEIVE the ORF from this neighbor\n"
2011 "Capability to SEND the ORF to this neighbor\n")
2012{
2013 u_int16_t flag = 0;
2014
2015 if (strncmp (argv[1], "s", 1) == 0)
2016 flag = PEER_FLAG_ORF_PREFIX_SM;
2017 else if (strncmp (argv[1], "r", 1) == 0)
2018 flag = PEER_FLAG_ORF_PREFIX_RM;
2019 else if (strncmp (argv[1], "b", 1) == 0)
2020 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2021 else
2022 return CMD_WARNING;
2023
2024 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2025 bgp_node_safi (vty), flag);
2026}
2027
2028/* neighbor next-hop-self. */
2029DEFUN (neighbor_nexthop_self,
2030 neighbor_nexthop_self_cmd,
2031 NEIGHBOR_CMD2 "next-hop-self",
2032 NEIGHBOR_STR
2033 NEIGHBOR_ADDR_STR2
2034 "Disable the next hop calculation for this neighbor\n")
2035{
2036 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2037 bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
2038}
2039
2040DEFUN (no_neighbor_nexthop_self,
2041 no_neighbor_nexthop_self_cmd,
2042 NO_NEIGHBOR_CMD2 "next-hop-self",
2043 NO_STR
2044 NEIGHBOR_STR
2045 NEIGHBOR_ADDR_STR2
2046 "Disable the next hop calculation for this neighbor\n")
2047{
2048 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2049 bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF);
2050}
2051
2052/* neighbor remove-private-AS. */
2053DEFUN (neighbor_remove_private_as,
2054 neighbor_remove_private_as_cmd,
2055 NEIGHBOR_CMD2 "remove-private-AS",
2056 NEIGHBOR_STR
2057 NEIGHBOR_ADDR_STR2
2058 "Remove private AS number from outbound updates\n")
2059{
2060 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2061 bgp_node_safi (vty),
2062 PEER_FLAG_REMOVE_PRIVATE_AS);
2063}
2064
2065DEFUN (no_neighbor_remove_private_as,
2066 no_neighbor_remove_private_as_cmd,
2067 NO_NEIGHBOR_CMD2 "remove-private-AS",
2068 NO_STR
2069 NEIGHBOR_STR
2070 NEIGHBOR_ADDR_STR2
2071 "Remove private AS number from outbound updates\n")
2072{
2073 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2074 bgp_node_safi (vty),
2075 PEER_FLAG_REMOVE_PRIVATE_AS);
2076}
2077
2078/* neighbor send-community. */
2079DEFUN (neighbor_send_community,
2080 neighbor_send_community_cmd,
2081 NEIGHBOR_CMD2 "send-community",
2082 NEIGHBOR_STR
2083 NEIGHBOR_ADDR_STR2
2084 "Send Community attribute to this neighbor\n")
2085{
2086 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2087 bgp_node_safi (vty),
2088 PEER_FLAG_SEND_COMMUNITY);
2089}
2090
2091DEFUN (no_neighbor_send_community,
2092 no_neighbor_send_community_cmd,
2093 NO_NEIGHBOR_CMD2 "send-community",
2094 NO_STR
2095 NEIGHBOR_STR
2096 NEIGHBOR_ADDR_STR2
2097 "Send Community attribute to this neighbor\n")
2098{
2099 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2100 bgp_node_safi (vty),
2101 PEER_FLAG_SEND_COMMUNITY);
2102}
2103
2104/* neighbor send-community extended. */
2105DEFUN (neighbor_send_community_type,
2106 neighbor_send_community_type_cmd,
2107 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2108 NEIGHBOR_STR
2109 NEIGHBOR_ADDR_STR2
2110 "Send Community attribute to this neighbor\n"
2111 "Send Standard and Extended Community attributes\n"
2112 "Send Extended Community attributes\n"
2113 "Send Standard Community attributes\n")
2114{
2115 if (strncmp (argv[1], "s", 1) == 0)
2116 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2117 bgp_node_safi (vty),
2118 PEER_FLAG_SEND_COMMUNITY);
2119 if (strncmp (argv[1], "e", 1) == 0)
2120 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2121 bgp_node_safi (vty),
2122 PEER_FLAG_SEND_EXT_COMMUNITY);
2123
2124 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2125 bgp_node_safi (vty),
2126 (PEER_FLAG_SEND_COMMUNITY|
2127 PEER_FLAG_SEND_EXT_COMMUNITY));
2128}
2129
2130DEFUN (no_neighbor_send_community_type,
2131 no_neighbor_send_community_type_cmd,
2132 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2133 NO_STR
2134 NEIGHBOR_STR
2135 NEIGHBOR_ADDR_STR2
2136 "Send Community attribute to this neighbor\n"
2137 "Send Standard and Extended Community attributes\n"
2138 "Send Extended Community attributes\n"
2139 "Send Standard Community attributes\n")
2140{
2141 if (strncmp (argv[1], "s", 1) == 0)
2142 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2143 bgp_node_safi (vty),
2144 PEER_FLAG_SEND_COMMUNITY);
2145 if (strncmp (argv[1], "e", 1) == 0)
2146 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2147 bgp_node_safi (vty),
2148 PEER_FLAG_SEND_EXT_COMMUNITY);
2149
2150 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2151 bgp_node_safi (vty),
2152 (PEER_FLAG_SEND_COMMUNITY |
2153 PEER_FLAG_SEND_EXT_COMMUNITY));
2154}
2155
2156/* neighbor soft-reconfig. */
2157DEFUN (neighbor_soft_reconfiguration,
2158 neighbor_soft_reconfiguration_cmd,
2159 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2160 NEIGHBOR_STR
2161 NEIGHBOR_ADDR_STR2
2162 "Per neighbor soft reconfiguration\n"
2163 "Allow inbound soft reconfiguration for this neighbor\n")
2164{
2165 return peer_af_flag_set_vty (vty, argv[0],
2166 bgp_node_afi (vty), bgp_node_safi (vty),
2167 PEER_FLAG_SOFT_RECONFIG);
2168}
2169
2170DEFUN (no_neighbor_soft_reconfiguration,
2171 no_neighbor_soft_reconfiguration_cmd,
2172 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2173 NO_STR
2174 NEIGHBOR_STR
2175 NEIGHBOR_ADDR_STR2
2176 "Per neighbor soft reconfiguration\n"
2177 "Allow inbound soft reconfiguration for this neighbor\n")
2178{
2179 return peer_af_flag_unset_vty (vty, argv[0],
2180 bgp_node_afi (vty), bgp_node_safi (vty),
2181 PEER_FLAG_SOFT_RECONFIG);
2182}
2183
2184DEFUN (neighbor_route_reflector_client,
2185 neighbor_route_reflector_client_cmd,
2186 NEIGHBOR_CMD2 "route-reflector-client",
2187 NEIGHBOR_STR
2188 NEIGHBOR_ADDR_STR2
2189 "Configure a neighbor as Route Reflector client\n")
2190{
2191 struct peer *peer;
2192
2193
2194 peer = peer_and_group_lookup_vty (vty, argv[0]);
2195 if (! peer)
2196 return CMD_WARNING;
2197
2198 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2199 bgp_node_safi (vty),
2200 PEER_FLAG_REFLECTOR_CLIENT);
2201}
2202
2203DEFUN (no_neighbor_route_reflector_client,
2204 no_neighbor_route_reflector_client_cmd,
2205 NO_NEIGHBOR_CMD2 "route-reflector-client",
2206 NO_STR
2207 NEIGHBOR_STR
2208 NEIGHBOR_ADDR_STR2
2209 "Configure a neighbor as Route Reflector client\n")
2210{
2211 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2212 bgp_node_safi (vty),
2213 PEER_FLAG_REFLECTOR_CLIENT);
2214}
2215
paul94f2b392005-06-28 12:44:16 +00002216static int
paulfd79ac92004-10-13 05:06:08 +00002217peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2218 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002219{
2220 int ret;
2221 struct bgp *bgp;
2222 struct peer *peer;
2223 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002224 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002225 struct bgp_filter *pfilter;
2226 struct bgp_filter *gfilter;
Chris Caputo228da422009-07-18 05:44:03 +00002227 int locked_and_added = 0;
paulfee0f4c2004-09-13 05:12:46 +00002228
2229 bgp = vty->index;
2230
2231 peer = peer_and_group_lookup_vty (vty, peer_str);
2232 if ( ! peer )
2233 return CMD_WARNING;
2234
2235 /* If it is already a RS-Client, don't do anything. */
2236 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2237 return CMD_SUCCESS;
2238
2239 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002240 {
2241 peer = peer_lock (peer); /* rsclient peer list reference */
2242 listnode_add_sort (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002243 locked_and_added = 1;
paul200df112005-06-01 11:17:05 +00002244 }
paulfee0f4c2004-09-13 05:12:46 +00002245
2246 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2247 if (ret < 0)
Chris Caputo228da422009-07-18 05:44:03 +00002248 {
2249 if (locked_and_added)
2250 {
2251 listnode_delete (bgp->rsclient, peer);
2252 peer_unlock (peer); /* rsclient peer list reference */
2253 }
2254
2255 return bgp_vty_return (vty, ret);
2256 }
paulfee0f4c2004-09-13 05:12:46 +00002257
Paul Jakma64e580a2006-02-21 01:09:01 +00002258 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002259 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
Chris Caputo228da422009-07-18 05:44:03 +00002260 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2261 peer->rib[afi][safi]->owner = peer_lock (peer);
paulfee0f4c2004-09-13 05:12:46 +00002262
2263 /* Check for existing 'network' and 'redistribute' routes. */
2264 bgp_check_local_routes_rsclient (peer, afi, safi);
2265
2266 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2267 bgp_soft_reconfig_rsclient (peer, afi, safi);
2268
2269 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2270 {
2271 group = peer->group;
2272 gfilter = &peer->filter[afi][safi];
2273
paul1eb8ef22005-04-07 07:30:20 +00002274 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002275 {
2276 pfilter = &peer->filter[afi][safi];
2277
2278 /* Members of a non-RS-Client group should not be RS-Clients, as that
2279 is checked when the become part of the peer-group */
2280 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2281 if (ret < 0)
2282 return bgp_vty_return (vty, ret);
2283
2284 /* Make peer's RIB point to group's RIB. */
2285 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2286
2287 /* Import policy. */
2288 if (pfilter->map[RMAP_IMPORT].name)
2289 free (pfilter->map[RMAP_IMPORT].name);
2290 if (gfilter->map[RMAP_IMPORT].name)
2291 {
2292 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2293 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2294 }
2295 else
2296 {
2297 pfilter->map[RMAP_IMPORT].name = NULL;
2298 pfilter->map[RMAP_IMPORT].map =NULL;
2299 }
2300
2301 /* Export policy. */
2302 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2303 {
2304 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2305 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2306 }
2307 }
2308 }
2309 return CMD_SUCCESS;
2310}
2311
paul94f2b392005-06-28 12:44:16 +00002312static int
paulfd79ac92004-10-13 05:06:08 +00002313peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2314 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002315{
2316 int ret;
2317 struct bgp *bgp;
2318 struct peer *peer;
2319 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002320 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002321
2322 bgp = vty->index;
2323
2324 peer = peer_and_group_lookup_vty (vty, peer_str);
2325 if ( ! peer )
2326 return CMD_WARNING;
2327
2328 /* If it is not a RS-Client, don't do anything. */
2329 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2330 return CMD_SUCCESS;
2331
2332 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2333 {
2334 group = peer->group;
2335
paul1eb8ef22005-04-07 07:30:20 +00002336 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002337 {
2338 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2339 if (ret < 0)
2340 return bgp_vty_return (vty, ret);
2341
2342 peer->rib[afi][safi] = NULL;
2343 }
2344
2345 peer = group->conf;
2346 }
2347
2348 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2349 if (ret < 0)
2350 return bgp_vty_return (vty, ret);
2351
2352 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002353 {
Chris Caputo228da422009-07-18 05:44:03 +00002354 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
paul200df112005-06-01 11:17:05 +00002355 listnode_delete (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002356 peer_unlock (peer); /* peer bgp rsclient reference */
paul200df112005-06-01 11:17:05 +00002357 }
paulfee0f4c2004-09-13 05:12:46 +00002358
Paul Jakmab608d5b2008-07-02 02:12:07 +00002359 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002360
2361 return CMD_SUCCESS;
2362}
2363
paul718e3742002-12-13 20:15:29 +00002364/* neighbor route-server-client. */
2365DEFUN (neighbor_route_server_client,
2366 neighbor_route_server_client_cmd,
2367 NEIGHBOR_CMD2 "route-server-client",
2368 NEIGHBOR_STR
2369 NEIGHBOR_ADDR_STR2
2370 "Configure a neighbor as Route Server client\n")
2371{
paulfee0f4c2004-09-13 05:12:46 +00002372 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2373 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002374}
2375
2376DEFUN (no_neighbor_route_server_client,
2377 no_neighbor_route_server_client_cmd,
2378 NO_NEIGHBOR_CMD2 "route-server-client",
2379 NO_STR
2380 NEIGHBOR_STR
2381 NEIGHBOR_ADDR_STR2
2382 "Configure a neighbor as Route Server client\n")
2383{
paulfee0f4c2004-09-13 05:12:46 +00002384 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2385 bgp_node_safi(vty));
2386}
2387
2388DEFUN (neighbor_nexthop_local_unchanged,
2389 neighbor_nexthop_local_unchanged_cmd,
2390 NEIGHBOR_CMD2 "nexthop-local unchanged",
2391 NEIGHBOR_STR
2392 NEIGHBOR_ADDR_STR2
2393 "Configure treatment of outgoing link-local nexthop attribute\n"
2394 "Leave link-local nexthop unchanged for this peer\n")
2395{
2396 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2397 bgp_node_safi (vty),
2398 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2399}
2400
2401DEFUN (no_neighbor_nexthop_local_unchanged,
2402 no_neighbor_nexthop_local_unchanged_cmd,
2403 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2404 NO_STR
2405 NEIGHBOR_STR
2406 NEIGHBOR_ADDR_STR2
2407 "Configure treatment of outgoing link-local-nexthop attribute\n"
2408 "Leave link-local nexthop unchanged for this peer\n")
2409{
paul718e3742002-12-13 20:15:29 +00002410 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2411 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002412 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002413}
2414
2415DEFUN (neighbor_attr_unchanged,
2416 neighbor_attr_unchanged_cmd,
2417 NEIGHBOR_CMD2 "attribute-unchanged",
2418 NEIGHBOR_STR
2419 NEIGHBOR_ADDR_STR2
2420 "BGP attribute is propagated unchanged to this neighbor\n")
2421{
2422 return peer_af_flag_set_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 (neighbor_attr_unchanged1,
2430 neighbor_attr_unchanged1_cmd,
2431 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2432 NEIGHBOR_STR
2433 NEIGHBOR_ADDR_STR2
2434 "BGP attribute is propagated unchanged to this neighbor\n"
2435 "As-path attribute\n"
2436 "Nexthop attribute\n"
2437 "Med attribute\n")
2438{
2439 u_int16_t flags = 0;
2440
2441 if (strncmp (argv[1], "as-path", 1) == 0)
2442 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2443 else if (strncmp (argv[1], "next-hop", 1) == 0)
2444 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2445 else if (strncmp (argv[1], "med", 1) == 0)
2446 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2447
2448 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2449 bgp_node_safi (vty), flags);
2450}
2451
2452DEFUN (neighbor_attr_unchanged2,
2453 neighbor_attr_unchanged2_cmd,
2454 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2455 NEIGHBOR_STR
2456 NEIGHBOR_ADDR_STR2
2457 "BGP attribute is propagated unchanged to this neighbor\n"
2458 "As-path attribute\n"
2459 "Nexthop attribute\n"
2460 "Med attribute\n")
2461{
2462 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2463
2464 if (strncmp (argv[1], "next-hop", 1) == 0)
2465 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2466 else if (strncmp (argv[1], "med", 1) == 0)
2467 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2468
2469 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2470 bgp_node_safi (vty), flags);
2471
2472}
2473
2474DEFUN (neighbor_attr_unchanged3,
2475 neighbor_attr_unchanged3_cmd,
2476 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2477 NEIGHBOR_STR
2478 NEIGHBOR_ADDR_STR2
2479 "BGP attribute is propagated unchanged to this neighbor\n"
2480 "Nexthop attribute\n"
2481 "As-path attribute\n"
2482 "Med attribute\n")
2483{
2484 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2485
2486 if (strncmp (argv[1], "as-path", 1) == 0)
2487 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2488 else if (strncmp (argv[1], "med", 1) == 0)
2489 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2490
2491 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2492 bgp_node_safi (vty), flags);
2493}
2494
2495DEFUN (neighbor_attr_unchanged4,
2496 neighbor_attr_unchanged4_cmd,
2497 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2498 NEIGHBOR_STR
2499 NEIGHBOR_ADDR_STR2
2500 "BGP attribute is propagated unchanged to this neighbor\n"
2501 "Med attribute\n"
2502 "As-path attribute\n"
2503 "Nexthop attribute\n")
2504{
2505 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2506
2507 if (strncmp (argv[1], "as-path", 1) == 0)
2508 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2509 else if (strncmp (argv[1], "next-hop", 1) == 0)
2510 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2511
2512 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2513 bgp_node_safi (vty), flags);
2514}
2515
2516ALIAS (neighbor_attr_unchanged,
2517 neighbor_attr_unchanged5_cmd,
2518 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2519 NEIGHBOR_STR
2520 NEIGHBOR_ADDR_STR2
2521 "BGP attribute is propagated unchanged to this neighbor\n"
2522 "As-path attribute\n"
2523 "Nexthop attribute\n"
2524 "Med attribute\n")
2525
2526ALIAS (neighbor_attr_unchanged,
2527 neighbor_attr_unchanged6_cmd,
2528 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2529 NEIGHBOR_STR
2530 NEIGHBOR_ADDR_STR2
2531 "BGP attribute is propagated unchanged to this neighbor\n"
2532 "As-path attribute\n"
2533 "Med attribute\n"
2534 "Nexthop attribute\n")
2535
2536ALIAS (neighbor_attr_unchanged,
2537 neighbor_attr_unchanged7_cmd,
2538 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2539 NEIGHBOR_STR
2540 NEIGHBOR_ADDR_STR2
2541 "BGP attribute is propagated unchanged to this neighbor\n"
2542 "Nexthop attribute\n"
2543 "Med attribute\n"
2544 "As-path attribute\n")
2545
2546ALIAS (neighbor_attr_unchanged,
2547 neighbor_attr_unchanged8_cmd,
2548 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2549 NEIGHBOR_STR
2550 NEIGHBOR_ADDR_STR2
2551 "BGP attribute is propagated unchanged to this neighbor\n"
2552 "Nexthop attribute\n"
2553 "As-path attribute\n"
2554 "Med attribute\n")
2555
2556ALIAS (neighbor_attr_unchanged,
2557 neighbor_attr_unchanged9_cmd,
2558 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2559 NEIGHBOR_STR
2560 NEIGHBOR_ADDR_STR2
2561 "BGP attribute is propagated unchanged to this neighbor\n"
2562 "Med attribute\n"
2563 "Nexthop attribute\n"
2564 "As-path attribute\n")
2565
2566ALIAS (neighbor_attr_unchanged,
2567 neighbor_attr_unchanged10_cmd,
2568 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2569 NEIGHBOR_STR
2570 NEIGHBOR_ADDR_STR2
2571 "BGP attribute is propagated unchanged to this neighbor\n"
2572 "Med attribute\n"
2573 "As-path attribute\n"
2574 "Nexthop attribute\n")
2575
2576DEFUN (no_neighbor_attr_unchanged,
2577 no_neighbor_attr_unchanged_cmd,
2578 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2579 NO_STR
2580 NEIGHBOR_STR
2581 NEIGHBOR_ADDR_STR2
2582 "BGP attribute is propagated unchanged to this neighbor\n")
2583{
2584 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2585 bgp_node_safi (vty),
2586 (PEER_FLAG_AS_PATH_UNCHANGED |
2587 PEER_FLAG_NEXTHOP_UNCHANGED |
2588 PEER_FLAG_MED_UNCHANGED));
2589}
2590
2591DEFUN (no_neighbor_attr_unchanged1,
2592 no_neighbor_attr_unchanged1_cmd,
2593 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2594 NO_STR
2595 NEIGHBOR_STR
2596 NEIGHBOR_ADDR_STR2
2597 "BGP attribute is propagated unchanged to this neighbor\n"
2598 "As-path attribute\n"
2599 "Nexthop attribute\n"
2600 "Med attribute\n")
2601{
2602 u_int16_t flags = 0;
2603
2604 if (strncmp (argv[1], "as-path", 1) == 0)
2605 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2606 else if (strncmp (argv[1], "next-hop", 1) == 0)
2607 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2608 else if (strncmp (argv[1], "med", 1) == 0)
2609 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2610
2611 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2612 bgp_node_safi (vty), flags);
2613}
2614
2615DEFUN (no_neighbor_attr_unchanged2,
2616 no_neighbor_attr_unchanged2_cmd,
2617 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2618 NO_STR
2619 NEIGHBOR_STR
2620 NEIGHBOR_ADDR_STR2
2621 "BGP attribute is propagated unchanged to this neighbor\n"
2622 "As-path attribute\n"
2623 "Nexthop attribute\n"
2624 "Med attribute\n")
2625{
2626 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2627
2628 if (strncmp (argv[1], "next-hop", 1) == 0)
2629 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2630 else if (strncmp (argv[1], "med", 1) == 0)
2631 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2632
2633 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2634 bgp_node_safi (vty), flags);
2635}
2636
2637DEFUN (no_neighbor_attr_unchanged3,
2638 no_neighbor_attr_unchanged3_cmd,
2639 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2640 NO_STR
2641 NEIGHBOR_STR
2642 NEIGHBOR_ADDR_STR2
2643 "BGP attribute is propagated unchanged to this neighbor\n"
2644 "Nexthop attribute\n"
2645 "As-path attribute\n"
2646 "Med attribute\n")
2647{
2648 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2649
2650 if (strncmp (argv[1], "as-path", 1) == 0)
2651 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2652 else if (strncmp (argv[1], "med", 1) == 0)
2653 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2654
2655 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2656 bgp_node_safi (vty), flags);
2657}
2658
2659DEFUN (no_neighbor_attr_unchanged4,
2660 no_neighbor_attr_unchanged4_cmd,
2661 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2662 NO_STR
2663 NEIGHBOR_STR
2664 NEIGHBOR_ADDR_STR2
2665 "BGP attribute is propagated unchanged to this neighbor\n"
2666 "Med attribute\n"
2667 "As-path attribute\n"
2668 "Nexthop attribute\n")
2669{
2670 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2671
2672 if (strncmp (argv[1], "as-path", 1) == 0)
2673 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2674 else if (strncmp (argv[1], "next-hop", 1) == 0)
2675 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2676
2677 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2678 bgp_node_safi (vty), flags);
2679}
2680
2681ALIAS (no_neighbor_attr_unchanged,
2682 no_neighbor_attr_unchanged5_cmd,
2683 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2684 NO_STR
2685 NEIGHBOR_STR
2686 NEIGHBOR_ADDR_STR2
2687 "BGP attribute is propagated unchanged to this neighbor\n"
2688 "As-path attribute\n"
2689 "Nexthop attribute\n"
2690 "Med attribute\n")
2691
2692ALIAS (no_neighbor_attr_unchanged,
2693 no_neighbor_attr_unchanged6_cmd,
2694 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2695 NO_STR
2696 NEIGHBOR_STR
2697 NEIGHBOR_ADDR_STR2
2698 "BGP attribute is propagated unchanged to this neighbor\n"
2699 "As-path attribute\n"
2700 "Med attribute\n"
2701 "Nexthop attribute\n")
2702
2703ALIAS (no_neighbor_attr_unchanged,
2704 no_neighbor_attr_unchanged7_cmd,
2705 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2706 NO_STR
2707 NEIGHBOR_STR
2708 NEIGHBOR_ADDR_STR2
2709 "BGP attribute is propagated unchanged to this neighbor\n"
2710 "Nexthop attribute\n"
2711 "Med attribute\n"
2712 "As-path attribute\n")
2713
2714ALIAS (no_neighbor_attr_unchanged,
2715 no_neighbor_attr_unchanged8_cmd,
2716 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2717 NO_STR
2718 NEIGHBOR_STR
2719 NEIGHBOR_ADDR_STR2
2720 "BGP attribute is propagated unchanged to this neighbor\n"
2721 "Nexthop attribute\n"
2722 "As-path attribute\n"
2723 "Med attribute\n")
2724
2725ALIAS (no_neighbor_attr_unchanged,
2726 no_neighbor_attr_unchanged9_cmd,
2727 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2728 NO_STR
2729 NEIGHBOR_STR
2730 NEIGHBOR_ADDR_STR2
2731 "BGP attribute is propagated unchanged to this neighbor\n"
2732 "Med attribute\n"
2733 "Nexthop attribute\n"
2734 "As-path attribute\n")
2735
2736ALIAS (no_neighbor_attr_unchanged,
2737 no_neighbor_attr_unchanged10_cmd,
2738 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2739 NO_STR
2740 NEIGHBOR_STR
2741 NEIGHBOR_ADDR_STR2
2742 "BGP attribute is propagated unchanged to this neighbor\n"
2743 "Med attribute\n"
2744 "As-path attribute\n"
2745 "Nexthop attribute\n")
2746
2747/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002748DEFUN_DEPRECATED (neighbor_transparent_as,
2749 neighbor_transparent_as_cmd,
2750 NEIGHBOR_CMD "transparent-as",
2751 NEIGHBOR_STR
2752 NEIGHBOR_ADDR_STR
2753 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002754{
2755 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2756 bgp_node_safi (vty),
2757 PEER_FLAG_AS_PATH_UNCHANGED);
2758}
2759
hassodd4c5932005-02-02 17:15:34 +00002760DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2761 neighbor_transparent_nexthop_cmd,
2762 NEIGHBOR_CMD "transparent-nexthop",
2763 NEIGHBOR_STR
2764 NEIGHBOR_ADDR_STR
2765 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002766{
2767 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2768 bgp_node_safi (vty),
2769 PEER_FLAG_NEXTHOP_UNCHANGED);
2770}
2771
2772/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00002773static int
paulfd79ac92004-10-13 05:06:08 +00002774peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2775 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002776{
2777 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002778 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002779
2780 peer = peer_and_group_lookup_vty (vty, ip_str);
2781 if (! peer)
2782 return CMD_WARNING;
2783
2784 if (! ttl_str)
2785 ttl = TTL_MAX;
2786 else
2787 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2788
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002789 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
paul718e3742002-12-13 20:15:29 +00002790}
2791
paul94f2b392005-06-28 12:44:16 +00002792static int
paulfd79ac92004-10-13 05:06:08 +00002793peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002794{
2795 struct peer *peer;
2796
2797 peer = peer_and_group_lookup_vty (vty, ip_str);
2798 if (! peer)
2799 return CMD_WARNING;
2800
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002801 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
paul718e3742002-12-13 20:15:29 +00002802}
2803
2804/* neighbor ebgp-multihop. */
2805DEFUN (neighbor_ebgp_multihop,
2806 neighbor_ebgp_multihop_cmd,
2807 NEIGHBOR_CMD2 "ebgp-multihop",
2808 NEIGHBOR_STR
2809 NEIGHBOR_ADDR_STR2
2810 "Allow EBGP neighbors not on directly connected networks\n")
2811{
2812 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2813}
2814
2815DEFUN (neighbor_ebgp_multihop_ttl,
2816 neighbor_ebgp_multihop_ttl_cmd,
2817 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2818 NEIGHBOR_STR
2819 NEIGHBOR_ADDR_STR2
2820 "Allow EBGP neighbors not on directly connected networks\n"
2821 "maximum hop count\n")
2822{
2823 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
2824}
2825
2826DEFUN (no_neighbor_ebgp_multihop,
2827 no_neighbor_ebgp_multihop_cmd,
2828 NO_NEIGHBOR_CMD2 "ebgp-multihop",
2829 NO_STR
2830 NEIGHBOR_STR
2831 NEIGHBOR_ADDR_STR2
2832 "Allow EBGP neighbors not on directly connected networks\n")
2833{
2834 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
2835}
2836
2837ALIAS (no_neighbor_ebgp_multihop,
2838 no_neighbor_ebgp_multihop_ttl_cmd,
2839 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2840 NO_STR
2841 NEIGHBOR_STR
2842 NEIGHBOR_ADDR_STR2
2843 "Allow EBGP neighbors not on directly connected networks\n"
2844 "maximum hop count\n")
2845
hasso6ffd2072005-02-02 14:50:11 +00002846/* disable-connected-check */
2847DEFUN (neighbor_disable_connected_check,
2848 neighbor_disable_connected_check_cmd,
2849 NEIGHBOR_CMD2 "disable-connected-check",
2850 NEIGHBOR_STR
2851 NEIGHBOR_ADDR_STR2
2852 "one-hop away EBGP peer using loopback address\n")
2853{
2854 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2855}
2856
2857DEFUN (no_neighbor_disable_connected_check,
2858 no_neighbor_disable_connected_check_cmd,
2859 NO_NEIGHBOR_CMD2 "disable-connected-check",
2860 NO_STR
2861 NEIGHBOR_STR
2862 NEIGHBOR_ADDR_STR2
2863 "one-hop away EBGP peer using loopback address\n")
2864{
2865 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2866}
2867
paul718e3742002-12-13 20:15:29 +00002868/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00002869ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002870 neighbor_enforce_multihop_cmd,
2871 NEIGHBOR_CMD2 "enforce-multihop",
2872 NEIGHBOR_STR
2873 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002874 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00002875
hasso6ffd2072005-02-02 14:50:11 +00002876/* Enforce multihop. */
2877ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002878 no_neighbor_enforce_multihop_cmd,
2879 NO_NEIGHBOR_CMD2 "enforce-multihop",
2880 NO_STR
2881 NEIGHBOR_STR
2882 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002883 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00002884
2885DEFUN (neighbor_description,
2886 neighbor_description_cmd,
2887 NEIGHBOR_CMD2 "description .LINE",
2888 NEIGHBOR_STR
2889 NEIGHBOR_ADDR_STR2
2890 "Neighbor specific description\n"
2891 "Up to 80 characters describing this neighbor\n")
2892{
2893 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00002894 char *str;
paul718e3742002-12-13 20:15:29 +00002895
2896 peer = peer_and_group_lookup_vty (vty, argv[0]);
2897 if (! peer)
2898 return CMD_WARNING;
2899
2900 if (argc == 1)
2901 return CMD_SUCCESS;
2902
ajs3b8b1852005-01-29 18:19:13 +00002903 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00002904
2905 peer_description_set (peer, str);
2906
ajs3b8b1852005-01-29 18:19:13 +00002907 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00002908
2909 return CMD_SUCCESS;
2910}
2911
2912DEFUN (no_neighbor_description,
2913 no_neighbor_description_cmd,
2914 NO_NEIGHBOR_CMD2 "description",
2915 NO_STR
2916 NEIGHBOR_STR
2917 NEIGHBOR_ADDR_STR2
2918 "Neighbor specific description\n")
2919{
2920 struct peer *peer;
2921
2922 peer = peer_and_group_lookup_vty (vty, argv[0]);
2923 if (! peer)
2924 return CMD_WARNING;
2925
2926 peer_description_unset (peer);
2927
2928 return CMD_SUCCESS;
2929}
2930
2931ALIAS (no_neighbor_description,
2932 no_neighbor_description_val_cmd,
2933 NO_NEIGHBOR_CMD2 "description .LINE",
2934 NO_STR
2935 NEIGHBOR_STR
2936 NEIGHBOR_ADDR_STR2
2937 "Neighbor specific description\n"
2938 "Up to 80 characters describing this neighbor\n")
2939
2940/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00002941static int
paulfd79ac92004-10-13 05:06:08 +00002942peer_update_source_vty (struct vty *vty, const char *peer_str,
2943 const char *source_str)
paul718e3742002-12-13 20:15:29 +00002944{
2945 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00002946
2947 peer = peer_and_group_lookup_vty (vty, peer_str);
2948 if (! peer)
2949 return CMD_WARNING;
2950
2951 if (source_str)
2952 {
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +02002953 union sockunion su;
2954 int ret = str2sockunion (source_str, &su);
2955
2956 if (ret == 0)
2957 peer_update_source_addr_set (peer, &su);
paul718e3742002-12-13 20:15:29 +00002958 else
2959 peer_update_source_if_set (peer, source_str);
2960 }
2961 else
2962 peer_update_source_unset (peer);
2963
2964 return CMD_SUCCESS;
2965}
2966
Paul Jakma9a1a3312009-07-27 12:27:55 +01002967#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
Paul Jakma369688c2006-05-23 22:27:55 +00002968#define BGP_UPDATE_SOURCE_HELP_STR \
2969 "IPv4 address\n" \
Paul Jakma9a1a3312009-07-27 12:27:55 +01002970 "IPv6 address\n" \
2971 "Interface name (requires zebra to be running)\n"
Paul Jakma369688c2006-05-23 22:27:55 +00002972
paul718e3742002-12-13 20:15:29 +00002973DEFUN (neighbor_update_source,
2974 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00002975 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00002976 NEIGHBOR_STR
2977 NEIGHBOR_ADDR_STR2
2978 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00002979 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00002980{
2981 return peer_update_source_vty (vty, argv[0], argv[1]);
2982}
2983
2984DEFUN (no_neighbor_update_source,
2985 no_neighbor_update_source_cmd,
2986 NO_NEIGHBOR_CMD2 "update-source",
2987 NO_STR
2988 NEIGHBOR_STR
2989 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00002990 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00002991{
2992 return peer_update_source_vty (vty, argv[0], NULL);
2993}
2994
paul94f2b392005-06-28 12:44:16 +00002995static int
paulfd79ac92004-10-13 05:06:08 +00002996peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
2997 afi_t afi, safi_t safi,
2998 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00002999{
3000 int ret;
3001 struct peer *peer;
3002
3003 peer = peer_and_group_lookup_vty (vty, peer_str);
3004 if (! peer)
3005 return CMD_WARNING;
3006
3007 if (set)
3008 ret = peer_default_originate_set (peer, afi, safi, rmap);
3009 else
3010 ret = peer_default_originate_unset (peer, afi, safi);
3011
3012 return bgp_vty_return (vty, ret);
3013}
3014
3015/* neighbor default-originate. */
3016DEFUN (neighbor_default_originate,
3017 neighbor_default_originate_cmd,
3018 NEIGHBOR_CMD2 "default-originate",
3019 NEIGHBOR_STR
3020 NEIGHBOR_ADDR_STR2
3021 "Originate default route to this neighbor\n")
3022{
3023 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3024 bgp_node_safi (vty), NULL, 1);
3025}
3026
3027DEFUN (neighbor_default_originate_rmap,
3028 neighbor_default_originate_rmap_cmd,
3029 NEIGHBOR_CMD2 "default-originate route-map WORD",
3030 NEIGHBOR_STR
3031 NEIGHBOR_ADDR_STR2
3032 "Originate default route to this neighbor\n"
3033 "Route-map to specify criteria to originate default\n"
3034 "route-map name\n")
3035{
3036 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3037 bgp_node_safi (vty), argv[1], 1);
3038}
3039
3040DEFUN (no_neighbor_default_originate,
3041 no_neighbor_default_originate_cmd,
3042 NO_NEIGHBOR_CMD2 "default-originate",
3043 NO_STR
3044 NEIGHBOR_STR
3045 NEIGHBOR_ADDR_STR2
3046 "Originate default route to this neighbor\n")
3047{
3048 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3049 bgp_node_safi (vty), NULL, 0);
3050}
3051
3052ALIAS (no_neighbor_default_originate,
3053 no_neighbor_default_originate_rmap_cmd,
3054 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3055 NO_STR
3056 NEIGHBOR_STR
3057 NEIGHBOR_ADDR_STR2
3058 "Originate default route to this neighbor\n"
3059 "Route-map to specify criteria to originate default\n"
3060 "route-map name\n")
3061
3062/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00003063static int
paulfd79ac92004-10-13 05:06:08 +00003064peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3065 const char *port_str)
paul718e3742002-12-13 20:15:29 +00003066{
3067 struct peer *peer;
3068 u_int16_t port;
3069 struct servent *sp;
3070
3071 peer = peer_lookup_vty (vty, ip_str);
3072 if (! peer)
3073 return CMD_WARNING;
3074
3075 if (! port_str)
3076 {
3077 sp = getservbyname ("bgp", "tcp");
3078 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3079 }
3080 else
3081 {
3082 VTY_GET_INTEGER("port", port, port_str);
3083 }
3084
3085 peer_port_set (peer, port);
3086
3087 return CMD_SUCCESS;
3088}
3089
hassof4184462005-02-01 20:13:16 +00003090/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00003091DEFUN (neighbor_port,
3092 neighbor_port_cmd,
3093 NEIGHBOR_CMD "port <0-65535>",
3094 NEIGHBOR_STR
3095 NEIGHBOR_ADDR_STR
3096 "Neighbor's BGP port\n"
3097 "TCP port number\n")
3098{
3099 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3100}
3101
3102DEFUN (no_neighbor_port,
3103 no_neighbor_port_cmd,
3104 NO_NEIGHBOR_CMD "port",
3105 NO_STR
3106 NEIGHBOR_STR
3107 NEIGHBOR_ADDR_STR
3108 "Neighbor's BGP port\n")
3109{
3110 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3111}
3112
3113ALIAS (no_neighbor_port,
3114 no_neighbor_port_val_cmd,
3115 NO_NEIGHBOR_CMD "port <0-65535>",
3116 NO_STR
3117 NEIGHBOR_STR
3118 NEIGHBOR_ADDR_STR
3119 "Neighbor's BGP port\n"
3120 "TCP port number\n")
3121
3122/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00003123static int
paulfd79ac92004-10-13 05:06:08 +00003124peer_weight_set_vty (struct vty *vty, const char *ip_str,
3125 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00003126{
3127 int ret;
3128 struct peer *peer;
3129 unsigned long weight;
3130
3131 peer = peer_and_group_lookup_vty (vty, ip_str);
3132 if (! peer)
3133 return CMD_WARNING;
3134
3135 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3136
3137 ret = peer_weight_set (peer, weight);
3138
3139 return CMD_SUCCESS;
3140}
3141
paul94f2b392005-06-28 12:44:16 +00003142static int
paulfd79ac92004-10-13 05:06:08 +00003143peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003144{
3145 struct peer *peer;
3146
3147 peer = peer_and_group_lookup_vty (vty, ip_str);
3148 if (! peer)
3149 return CMD_WARNING;
3150
3151 peer_weight_unset (peer);
3152
3153 return CMD_SUCCESS;
3154}
3155
3156DEFUN (neighbor_weight,
3157 neighbor_weight_cmd,
3158 NEIGHBOR_CMD2 "weight <0-65535>",
3159 NEIGHBOR_STR
3160 NEIGHBOR_ADDR_STR2
3161 "Set default weight for routes from this neighbor\n"
3162 "default weight\n")
3163{
3164 return peer_weight_set_vty (vty, argv[0], argv[1]);
3165}
3166
3167DEFUN (no_neighbor_weight,
3168 no_neighbor_weight_cmd,
3169 NO_NEIGHBOR_CMD2 "weight",
3170 NO_STR
3171 NEIGHBOR_STR
3172 NEIGHBOR_ADDR_STR2
3173 "Set default weight for routes from this neighbor\n")
3174{
3175 return peer_weight_unset_vty (vty, argv[0]);
3176}
3177
3178ALIAS (no_neighbor_weight,
3179 no_neighbor_weight_val_cmd,
3180 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3181 NO_STR
3182 NEIGHBOR_STR
3183 NEIGHBOR_ADDR_STR2
3184 "Set default weight for routes from this neighbor\n"
3185 "default weight\n")
3186
3187/* Override capability negotiation. */
3188DEFUN (neighbor_override_capability,
3189 neighbor_override_capability_cmd,
3190 NEIGHBOR_CMD2 "override-capability",
3191 NEIGHBOR_STR
3192 NEIGHBOR_ADDR_STR2
3193 "Override capability negotiation result\n")
3194{
3195 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3196}
3197
3198DEFUN (no_neighbor_override_capability,
3199 no_neighbor_override_capability_cmd,
3200 NO_NEIGHBOR_CMD2 "override-capability",
3201 NO_STR
3202 NEIGHBOR_STR
3203 NEIGHBOR_ADDR_STR2
3204 "Override capability negotiation result\n")
3205{
3206 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3207}
3208
3209DEFUN (neighbor_strict_capability,
3210 neighbor_strict_capability_cmd,
3211 NEIGHBOR_CMD "strict-capability-match",
3212 NEIGHBOR_STR
3213 NEIGHBOR_ADDR_STR
3214 "Strict capability negotiation match\n")
3215{
3216 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3217}
3218
3219DEFUN (no_neighbor_strict_capability,
3220 no_neighbor_strict_capability_cmd,
3221 NO_NEIGHBOR_CMD "strict-capability-match",
3222 NO_STR
3223 NEIGHBOR_STR
3224 NEIGHBOR_ADDR_STR
3225 "Strict capability negotiation match\n")
3226{
3227 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3228}
3229
paul94f2b392005-06-28 12:44:16 +00003230static int
paulfd79ac92004-10-13 05:06:08 +00003231peer_timers_set_vty (struct vty *vty, const char *ip_str,
3232 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003233{
3234 int ret;
3235 struct peer *peer;
3236 u_int32_t keepalive;
3237 u_int32_t holdtime;
3238
3239 peer = peer_and_group_lookup_vty (vty, ip_str);
3240 if (! peer)
3241 return CMD_WARNING;
3242
3243 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3244 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3245
3246 ret = peer_timers_set (peer, keepalive, holdtime);
3247
3248 return bgp_vty_return (vty, ret);
3249}
3250
paul94f2b392005-06-28 12:44:16 +00003251static int
paulfd79ac92004-10-13 05:06:08 +00003252peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003253{
3254 int ret;
3255 struct peer *peer;
3256
3257 peer = peer_lookup_vty (vty, ip_str);
3258 if (! peer)
3259 return CMD_WARNING;
3260
3261 ret = peer_timers_unset (peer);
3262
3263 return bgp_vty_return (vty, ret);
3264}
3265
3266DEFUN (neighbor_timers,
3267 neighbor_timers_cmd,
3268 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3269 NEIGHBOR_STR
3270 NEIGHBOR_ADDR_STR2
3271 "BGP per neighbor timers\n"
3272 "Keepalive interval\n"
3273 "Holdtime\n")
3274{
3275 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3276}
3277
3278DEFUN (no_neighbor_timers,
3279 no_neighbor_timers_cmd,
3280 NO_NEIGHBOR_CMD2 "timers",
3281 NO_STR
3282 NEIGHBOR_STR
3283 NEIGHBOR_ADDR_STR2
3284 "BGP per neighbor timers\n")
3285{
3286 return peer_timers_unset_vty (vty, argv[0]);
3287}
3288
paul94f2b392005-06-28 12:44:16 +00003289static int
paulfd79ac92004-10-13 05:06:08 +00003290peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3291 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003292{
3293 int ret;
3294 struct peer *peer;
3295 u_int32_t connect;
3296
3297 peer = peer_lookup_vty (vty, ip_str);
3298 if (! peer)
3299 return CMD_WARNING;
3300
3301 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3302
3303 ret = peer_timers_connect_set (peer, connect);
3304
3305 return CMD_SUCCESS;
3306}
3307
paul94f2b392005-06-28 12:44:16 +00003308static int
paulfd79ac92004-10-13 05:06:08 +00003309peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003310{
3311 int ret;
3312 struct peer *peer;
3313
3314 peer = peer_and_group_lookup_vty (vty, ip_str);
3315 if (! peer)
3316 return CMD_WARNING;
3317
3318 ret = peer_timers_connect_unset (peer);
3319
3320 return CMD_SUCCESS;
3321}
3322
3323DEFUN (neighbor_timers_connect,
3324 neighbor_timers_connect_cmd,
3325 NEIGHBOR_CMD "timers connect <0-65535>",
3326 NEIGHBOR_STR
3327 NEIGHBOR_ADDR_STR
3328 "BGP per neighbor timers\n"
3329 "BGP connect timer\n"
3330 "Connect timer\n")
3331{
3332 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3333}
3334
3335DEFUN (no_neighbor_timers_connect,
3336 no_neighbor_timers_connect_cmd,
3337 NO_NEIGHBOR_CMD "timers connect",
3338 NO_STR
3339 NEIGHBOR_STR
3340 NEIGHBOR_ADDR_STR
3341 "BGP per neighbor timers\n"
3342 "BGP connect timer\n")
3343{
3344 return peer_timers_connect_unset_vty (vty, argv[0]);
3345}
3346
3347ALIAS (no_neighbor_timers_connect,
3348 no_neighbor_timers_connect_val_cmd,
3349 NO_NEIGHBOR_CMD "timers connect <0-65535>",
3350 NO_STR
3351 NEIGHBOR_STR
3352 NEIGHBOR_ADDR_STR
3353 "BGP per neighbor timers\n"
3354 "BGP connect timer\n"
3355 "Connect timer\n")
3356
paul94f2b392005-06-28 12:44:16 +00003357static int
paulfd79ac92004-10-13 05:06:08 +00003358peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3359 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003360{
3361 int ret;
3362 struct peer *peer;
3363 u_int32_t routeadv = 0;
3364
3365 peer = peer_lookup_vty (vty, ip_str);
3366 if (! peer)
3367 return CMD_WARNING;
3368
3369 if (time_str)
3370 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3371
3372 if (set)
3373 ret = peer_advertise_interval_set (peer, routeadv);
3374 else
3375 ret = peer_advertise_interval_unset (peer);
3376
3377 return CMD_SUCCESS;
3378}
3379
3380DEFUN (neighbor_advertise_interval,
3381 neighbor_advertise_interval_cmd,
3382 NEIGHBOR_CMD "advertisement-interval <0-600>",
3383 NEIGHBOR_STR
3384 NEIGHBOR_ADDR_STR
3385 "Minimum interval between sending BGP routing updates\n"
3386 "time in seconds\n")
3387{
3388 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3389}
3390
3391DEFUN (no_neighbor_advertise_interval,
3392 no_neighbor_advertise_interval_cmd,
3393 NO_NEIGHBOR_CMD "advertisement-interval",
3394 NO_STR
3395 NEIGHBOR_STR
3396 NEIGHBOR_ADDR_STR
3397 "Minimum interval between sending BGP routing updates\n")
3398{
3399 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3400}
3401
3402ALIAS (no_neighbor_advertise_interval,
3403 no_neighbor_advertise_interval_val_cmd,
3404 NO_NEIGHBOR_CMD "advertisement-interval <0-600>",
3405 NO_STR
3406 NEIGHBOR_STR
3407 NEIGHBOR_ADDR_STR
3408 "Minimum interval between sending BGP routing updates\n"
3409 "time in seconds\n")
3410
paul718e3742002-12-13 20:15:29 +00003411/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003412static int
paulfd79ac92004-10-13 05:06:08 +00003413peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003414{
3415 int ret;
3416 struct peer *peer;
3417
3418 peer = peer_lookup_vty (vty, ip_str);
3419 if (! peer)
3420 return CMD_WARNING;
3421
3422 if (str)
3423 ret = peer_interface_set (peer, str);
3424 else
3425 ret = peer_interface_unset (peer);
3426
3427 return CMD_SUCCESS;
3428}
3429
3430DEFUN (neighbor_interface,
3431 neighbor_interface_cmd,
3432 NEIGHBOR_CMD "interface WORD",
3433 NEIGHBOR_STR
3434 NEIGHBOR_ADDR_STR
3435 "Interface\n"
3436 "Interface name\n")
3437{
3438 return peer_interface_vty (vty, argv[0], argv[1]);
3439}
3440
3441DEFUN (no_neighbor_interface,
3442 no_neighbor_interface_cmd,
3443 NO_NEIGHBOR_CMD "interface WORD",
3444 NO_STR
3445 NEIGHBOR_STR
3446 NEIGHBOR_ADDR_STR
3447 "Interface\n"
3448 "Interface name\n")
3449{
3450 return peer_interface_vty (vty, argv[0], NULL);
3451}
3452
3453/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003454static int
paulfd79ac92004-10-13 05:06:08 +00003455peer_distribute_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_distribute_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_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3480 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003481{
3482 int ret;
3483 struct peer *peer;
3484 int direct = FILTER_IN;
3485
3486 peer = peer_and_group_lookup_vty (vty, ip_str);
3487 if (! peer)
3488 return CMD_WARNING;
3489
3490 /* Check filter direction. */
3491 if (strncmp (direct_str, "i", 1) == 0)
3492 direct = FILTER_IN;
3493 else if (strncmp (direct_str, "o", 1) == 0)
3494 direct = FILTER_OUT;
3495
3496 ret = peer_distribute_unset (peer, afi, safi, direct);
3497
3498 return bgp_vty_return (vty, ret);
3499}
3500
3501DEFUN (neighbor_distribute_list,
3502 neighbor_distribute_list_cmd,
3503 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3504 NEIGHBOR_STR
3505 NEIGHBOR_ADDR_STR2
3506 "Filter updates to/from this neighbor\n"
3507 "IP access-list number\n"
3508 "IP access-list number (expanded range)\n"
3509 "IP Access-list name\n"
3510 "Filter incoming updates\n"
3511 "Filter outgoing updates\n")
3512{
3513 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3514 bgp_node_safi (vty), argv[1], argv[2]);
3515}
3516
3517DEFUN (no_neighbor_distribute_list,
3518 no_neighbor_distribute_list_cmd,
3519 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3520 NO_STR
3521 NEIGHBOR_STR
3522 NEIGHBOR_ADDR_STR2
3523 "Filter updates to/from this neighbor\n"
3524 "IP access-list number\n"
3525 "IP access-list number (expanded range)\n"
3526 "IP Access-list name\n"
3527 "Filter incoming updates\n"
3528 "Filter outgoing updates\n")
3529{
3530 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3531 bgp_node_safi (vty), argv[2]);
3532}
3533
3534/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003535static int
paulfd79ac92004-10-13 05:06:08 +00003536peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3537 safi_t safi, const char *name_str,
3538 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003539{
3540 int ret;
3541 struct peer *peer;
3542 int direct = FILTER_IN;
3543
3544 peer = peer_and_group_lookup_vty (vty, ip_str);
3545 if (! peer)
3546 return CMD_WARNING;
3547
3548 /* Check filter direction. */
3549 if (strncmp (direct_str, "i", 1) == 0)
3550 direct = FILTER_IN;
3551 else if (strncmp (direct_str, "o", 1) == 0)
3552 direct = FILTER_OUT;
3553
3554 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3555
3556 return bgp_vty_return (vty, ret);
3557}
3558
paul94f2b392005-06-28 12:44:16 +00003559static int
paulfd79ac92004-10-13 05:06:08 +00003560peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3561 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003562{
3563 int ret;
3564 struct peer *peer;
3565 int direct = FILTER_IN;
3566
3567 peer = peer_and_group_lookup_vty (vty, ip_str);
3568 if (! peer)
3569 return CMD_WARNING;
3570
3571 /* Check filter direction. */
3572 if (strncmp (direct_str, "i", 1) == 0)
3573 direct = FILTER_IN;
3574 else if (strncmp (direct_str, "o", 1) == 0)
3575 direct = FILTER_OUT;
3576
3577 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3578
3579 return bgp_vty_return (vty, ret);
3580}
3581
3582DEFUN (neighbor_prefix_list,
3583 neighbor_prefix_list_cmd,
3584 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3585 NEIGHBOR_STR
3586 NEIGHBOR_ADDR_STR2
3587 "Filter updates to/from this neighbor\n"
3588 "Name of a prefix list\n"
3589 "Filter incoming updates\n"
3590 "Filter outgoing updates\n")
3591{
3592 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3593 bgp_node_safi (vty), argv[1], argv[2]);
3594}
3595
3596DEFUN (no_neighbor_prefix_list,
3597 no_neighbor_prefix_list_cmd,
3598 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3599 NO_STR
3600 NEIGHBOR_STR
3601 NEIGHBOR_ADDR_STR2
3602 "Filter updates to/from this neighbor\n"
3603 "Name of a prefix list\n"
3604 "Filter incoming updates\n"
3605 "Filter outgoing updates\n")
3606{
3607 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3608 bgp_node_safi (vty), argv[2]);
3609}
3610
paul94f2b392005-06-28 12:44:16 +00003611static int
paulfd79ac92004-10-13 05:06:08 +00003612peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3613 afi_t afi, safi_t safi,
3614 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003615{
3616 int ret;
3617 struct peer *peer;
3618 int direct = FILTER_IN;
3619
3620 peer = peer_and_group_lookup_vty (vty, ip_str);
3621 if (! peer)
3622 return CMD_WARNING;
3623
3624 /* Check filter direction. */
3625 if (strncmp (direct_str, "i", 1) == 0)
3626 direct = FILTER_IN;
3627 else if (strncmp (direct_str, "o", 1) == 0)
3628 direct = FILTER_OUT;
3629
3630 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3631
3632 return bgp_vty_return (vty, ret);
3633}
3634
paul94f2b392005-06-28 12:44:16 +00003635static int
paulfd79ac92004-10-13 05:06:08 +00003636peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3637 afi_t afi, safi_t safi,
3638 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003639{
3640 int ret;
3641 struct peer *peer;
3642 int direct = FILTER_IN;
3643
3644 peer = peer_and_group_lookup_vty (vty, ip_str);
3645 if (! peer)
3646 return CMD_WARNING;
3647
3648 /* Check filter direction. */
3649 if (strncmp (direct_str, "i", 1) == 0)
3650 direct = FILTER_IN;
3651 else if (strncmp (direct_str, "o", 1) == 0)
3652 direct = FILTER_OUT;
3653
3654 ret = peer_aslist_unset (peer, afi, safi, direct);
3655
3656 return bgp_vty_return (vty, ret);
3657}
3658
3659DEFUN (neighbor_filter_list,
3660 neighbor_filter_list_cmd,
3661 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3662 NEIGHBOR_STR
3663 NEIGHBOR_ADDR_STR2
3664 "Establish BGP filters\n"
3665 "AS path access-list name\n"
3666 "Filter incoming routes\n"
3667 "Filter outgoing routes\n")
3668{
3669 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3670 bgp_node_safi (vty), argv[1], argv[2]);
3671}
3672
3673DEFUN (no_neighbor_filter_list,
3674 no_neighbor_filter_list_cmd,
3675 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3676 NO_STR
3677 NEIGHBOR_STR
3678 NEIGHBOR_ADDR_STR2
3679 "Establish BGP filters\n"
3680 "AS path access-list name\n"
3681 "Filter incoming routes\n"
3682 "Filter outgoing routes\n")
3683{
3684 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3685 bgp_node_safi (vty), argv[2]);
3686}
3687
3688/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003689static int
paulfd79ac92004-10-13 05:06:08 +00003690peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3691 afi_t afi, safi_t safi,
3692 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003693{
3694 int ret;
3695 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003696 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003697
3698 peer = peer_and_group_lookup_vty (vty, ip_str);
3699 if (! peer)
3700 return CMD_WARNING;
3701
3702 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003703 if (strncmp (direct_str, "in", 2) == 0)
3704 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003705 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003706 direct = RMAP_OUT;
3707 else if (strncmp (direct_str, "im", 2) == 0)
3708 direct = RMAP_IMPORT;
3709 else if (strncmp (direct_str, "e", 1) == 0)
3710 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003711
3712 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3713
3714 return bgp_vty_return (vty, ret);
3715}
3716
paul94f2b392005-06-28 12:44:16 +00003717static int
paulfd79ac92004-10-13 05:06:08 +00003718peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3719 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003720{
3721 int ret;
3722 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003723 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003724
3725 peer = peer_and_group_lookup_vty (vty, ip_str);
3726 if (! peer)
3727 return CMD_WARNING;
3728
3729 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003730 if (strncmp (direct_str, "in", 2) == 0)
3731 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003732 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003733 direct = RMAP_OUT;
3734 else if (strncmp (direct_str, "im", 2) == 0)
3735 direct = RMAP_IMPORT;
3736 else if (strncmp (direct_str, "e", 1) == 0)
3737 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003738
3739 ret = peer_route_map_unset (peer, afi, safi, direct);
3740
3741 return bgp_vty_return (vty, ret);
3742}
3743
3744DEFUN (neighbor_route_map,
3745 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003746 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003747 NEIGHBOR_STR
3748 NEIGHBOR_ADDR_STR2
3749 "Apply route map to neighbor\n"
3750 "Name of route map\n"
3751 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003752 "Apply map to outbound routes\n"
3753 "Apply map to routes going into a Route-Server client's table\n"
3754 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003755{
3756 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3757 bgp_node_safi (vty), argv[1], argv[2]);
3758}
3759
3760DEFUN (no_neighbor_route_map,
3761 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003762 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003763 NO_STR
3764 NEIGHBOR_STR
3765 NEIGHBOR_ADDR_STR2
3766 "Apply route map to neighbor\n"
3767 "Name of route map\n"
3768 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003769 "Apply map to outbound routes\n"
3770 "Apply map to routes going into a Route-Server client's table\n"
3771 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003772{
3773 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3774 bgp_node_safi (vty), argv[2]);
3775}
3776
3777/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003778static int
paulfd79ac92004-10-13 05:06:08 +00003779peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3780 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003781{
3782 int ret;
3783 struct peer *peer;
3784
3785 peer = peer_and_group_lookup_vty (vty, ip_str);
3786 if (! peer)
3787 return CMD_WARNING;
3788
3789 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3790
3791 return bgp_vty_return (vty, ret);
3792}
3793
3794/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003795static int
paulfd79ac92004-10-13 05:06:08 +00003796peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003797 safi_t safi)
3798{
3799 int ret;
3800 struct peer *peer;
3801
3802 peer = peer_and_group_lookup_vty (vty, ip_str);
3803 if (! peer)
3804 return CMD_WARNING;
3805
3806 ret = peer_unsuppress_map_unset (peer, afi, safi);
3807
3808 return bgp_vty_return (vty, ret);
3809}
3810
3811DEFUN (neighbor_unsuppress_map,
3812 neighbor_unsuppress_map_cmd,
3813 NEIGHBOR_CMD2 "unsuppress-map WORD",
3814 NEIGHBOR_STR
3815 NEIGHBOR_ADDR_STR2
3816 "Route-map to selectively unsuppress suppressed routes\n"
3817 "Name of route map\n")
3818{
3819 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3820 bgp_node_safi (vty), argv[1]);
3821}
3822
3823DEFUN (no_neighbor_unsuppress_map,
3824 no_neighbor_unsuppress_map_cmd,
3825 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3826 NO_STR
3827 NEIGHBOR_STR
3828 NEIGHBOR_ADDR_STR2
3829 "Route-map to selectively unsuppress suppressed routes\n"
3830 "Name of route map\n")
3831{
3832 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3833 bgp_node_safi (vty));
3834}
3835
paul94f2b392005-06-28 12:44:16 +00003836static int
paulfd79ac92004-10-13 05:06:08 +00003837peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3838 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003839 const char *threshold_str, int warning,
3840 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003841{
3842 int ret;
3843 struct peer *peer;
3844 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003845 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003846 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003847
3848 peer = peer_and_group_lookup_vty (vty, ip_str);
3849 if (! peer)
3850 return CMD_WARNING;
3851
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04003852 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003853 if (threshold_str)
3854 threshold = atoi (threshold_str);
3855 else
3856 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00003857
hasso0a486e52005-02-01 20:57:17 +00003858 if (restart_str)
3859 restart = atoi (restart_str);
3860 else
3861 restart = 0;
3862
3863 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00003864
3865 return bgp_vty_return (vty, ret);
3866}
3867
paul94f2b392005-06-28 12:44:16 +00003868static int
paulfd79ac92004-10-13 05:06:08 +00003869peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003870 safi_t safi)
3871{
3872 int ret;
3873 struct peer *peer;
3874
3875 peer = peer_and_group_lookup_vty (vty, ip_str);
3876 if (! peer)
3877 return CMD_WARNING;
3878
3879 ret = peer_maximum_prefix_unset (peer, afi, safi);
3880
3881 return bgp_vty_return (vty, ret);
3882}
3883
3884/* Maximum number of prefix configuration. prefix count is different
3885 for each peer configuration. So this configuration can be set for
3886 each peer configuration. */
3887DEFUN (neighbor_maximum_prefix,
3888 neighbor_maximum_prefix_cmd,
3889 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3890 NEIGHBOR_STR
3891 NEIGHBOR_ADDR_STR2
3892 "Maximum number of prefix accept from this peer\n"
3893 "maximum no. of prefix limit\n")
3894{
3895 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003896 bgp_node_safi (vty), argv[1], NULL, 0,
3897 NULL);
paul718e3742002-12-13 20:15:29 +00003898}
3899
hassoe0701b72004-05-20 09:19:34 +00003900DEFUN (neighbor_maximum_prefix_threshold,
3901 neighbor_maximum_prefix_threshold_cmd,
3902 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
3903 NEIGHBOR_STR
3904 NEIGHBOR_ADDR_STR2
3905 "Maximum number of prefix accept from this peer\n"
3906 "maximum no. of prefix limit\n"
3907 "Threshold value (%) at which to generate a warning msg\n")
3908{
3909 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003910 bgp_node_safi (vty), argv[1], argv[2], 0,
3911 NULL);
3912}
hassoe0701b72004-05-20 09:19:34 +00003913
paul718e3742002-12-13 20:15:29 +00003914DEFUN (neighbor_maximum_prefix_warning,
3915 neighbor_maximum_prefix_warning_cmd,
3916 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3917 NEIGHBOR_STR
3918 NEIGHBOR_ADDR_STR2
3919 "Maximum number of prefix accept from this peer\n"
3920 "maximum no. of prefix limit\n"
3921 "Only give warning message when limit is exceeded\n")
3922{
3923 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003924 bgp_node_safi (vty), argv[1], NULL, 1,
3925 NULL);
paul718e3742002-12-13 20:15:29 +00003926}
3927
hassoe0701b72004-05-20 09:19:34 +00003928DEFUN (neighbor_maximum_prefix_threshold_warning,
3929 neighbor_maximum_prefix_threshold_warning_cmd,
3930 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
3931 NEIGHBOR_STR
3932 NEIGHBOR_ADDR_STR2
3933 "Maximum number of prefix accept from this peer\n"
3934 "maximum no. of prefix limit\n"
3935 "Threshold value (%) at which to generate a warning msg\n"
3936 "Only give warning message when limit is exceeded\n")
3937{
3938 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003939 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
3940}
3941
3942DEFUN (neighbor_maximum_prefix_restart,
3943 neighbor_maximum_prefix_restart_cmd,
3944 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
3945 NEIGHBOR_STR
3946 NEIGHBOR_ADDR_STR2
3947 "Maximum number of prefix accept from this peer\n"
3948 "maximum no. of prefix limit\n"
3949 "Restart bgp connection after limit is exceeded\n"
3950 "Restart interval in minutes")
3951{
3952 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3953 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
3954}
3955
3956DEFUN (neighbor_maximum_prefix_threshold_restart,
3957 neighbor_maximum_prefix_threshold_restart_cmd,
3958 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
3959 NEIGHBOR_STR
3960 NEIGHBOR_ADDR_STR2
3961 "Maximum number of prefix accept from this peer\n"
3962 "maximum no. of prefix limit\n"
3963 "Threshold value (%) at which to generate a warning msg\n"
3964 "Restart bgp connection after limit is exceeded\n"
3965 "Restart interval in minutes")
3966{
3967 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
3968 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
3969}
hassoe0701b72004-05-20 09:19:34 +00003970
paul718e3742002-12-13 20:15:29 +00003971DEFUN (no_neighbor_maximum_prefix,
3972 no_neighbor_maximum_prefix_cmd,
3973 NO_NEIGHBOR_CMD2 "maximum-prefix",
3974 NO_STR
3975 NEIGHBOR_STR
3976 NEIGHBOR_ADDR_STR2
3977 "Maximum number of prefix accept from this peer\n")
3978{
3979 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
3980 bgp_node_safi (vty));
3981}
3982
3983ALIAS (no_neighbor_maximum_prefix,
3984 no_neighbor_maximum_prefix_val_cmd,
3985 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3986 NO_STR
3987 NEIGHBOR_STR
3988 NEIGHBOR_ADDR_STR2
3989 "Maximum number of prefix accept from this peer\n"
3990 "maximum no. of prefix limit\n")
3991
3992ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00003993 no_neighbor_maximum_prefix_threshold_cmd,
3994 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3995 NO_STR
3996 NEIGHBOR_STR
3997 NEIGHBOR_ADDR_STR2
3998 "Maximum number of prefix accept from this peer\n"
3999 "maximum no. of prefix limit\n"
4000 "Threshold value (%) at which to generate a warning msg\n")
4001
4002ALIAS (no_neighbor_maximum_prefix,
4003 no_neighbor_maximum_prefix_warning_cmd,
4004 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4005 NO_STR
4006 NEIGHBOR_STR
4007 NEIGHBOR_ADDR_STR2
4008 "Maximum number of prefix accept from this peer\n"
4009 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00004010 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004011
4012ALIAS (no_neighbor_maximum_prefix,
4013 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004014 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4015 NO_STR
4016 NEIGHBOR_STR
4017 NEIGHBOR_ADDR_STR2
4018 "Maximum number of prefix accept from this peer\n"
4019 "maximum no. of prefix limit\n"
4020 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004021 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004022
4023ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004024 no_neighbor_maximum_prefix_restart_cmd,
4025 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004026 NO_STR
4027 NEIGHBOR_STR
4028 NEIGHBOR_ADDR_STR2
4029 "Maximum number of prefix accept from this peer\n"
4030 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00004031 "Restart bgp connection after limit is exceeded\n"
4032 "Restart interval in minutes")
4033
4034ALIAS (no_neighbor_maximum_prefix,
4035 no_neighbor_maximum_prefix_threshold_restart_cmd,
4036 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4037 NO_STR
4038 NEIGHBOR_STR
4039 NEIGHBOR_ADDR_STR2
4040 "Maximum number of prefix accept from this peer\n"
4041 "maximum no. of prefix limit\n"
4042 "Threshold value (%) at which to generate a warning msg\n"
4043 "Restart bgp connection after limit is exceeded\n"
4044 "Restart interval in minutes")
paul718e3742002-12-13 20:15:29 +00004045
4046/* "neighbor allowas-in" */
4047DEFUN (neighbor_allowas_in,
4048 neighbor_allowas_in_cmd,
4049 NEIGHBOR_CMD2 "allowas-in",
4050 NEIGHBOR_STR
4051 NEIGHBOR_ADDR_STR2
4052 "Accept as-path with my AS present in it\n")
4053{
4054 int ret;
4055 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004056 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004057
4058 peer = peer_and_group_lookup_vty (vty, argv[0]);
4059 if (! peer)
4060 return CMD_WARNING;
4061
4062 if (argc == 1)
4063 allow_num = 3;
4064 else
4065 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4066
4067 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4068 allow_num);
4069
4070 return bgp_vty_return (vty, ret);
4071}
4072
4073ALIAS (neighbor_allowas_in,
4074 neighbor_allowas_in_arg_cmd,
4075 NEIGHBOR_CMD2 "allowas-in <1-10>",
4076 NEIGHBOR_STR
4077 NEIGHBOR_ADDR_STR2
4078 "Accept as-path with my AS present in it\n"
4079 "Number of occurances of AS number\n")
4080
4081DEFUN (no_neighbor_allowas_in,
4082 no_neighbor_allowas_in_cmd,
4083 NO_NEIGHBOR_CMD2 "allowas-in",
4084 NO_STR
4085 NEIGHBOR_STR
4086 NEIGHBOR_ADDR_STR2
4087 "allow local ASN appears in aspath attribute\n")
4088{
4089 int ret;
4090 struct peer *peer;
4091
4092 peer = peer_and_group_lookup_vty (vty, argv[0]);
4093 if (! peer)
4094 return CMD_WARNING;
4095
4096 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4097
4098 return bgp_vty_return (vty, ret);
4099}
4100
Nick Hilliardfa411a22011-03-23 15:33:17 +00004101DEFUN (neighbor_ttl_security,
4102 neighbor_ttl_security_cmd,
4103 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4104 NEIGHBOR_STR
4105 NEIGHBOR_ADDR_STR2
4106 "Specify the maximum number of hops to the BGP peer\n")
4107{
4108 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004109 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004110
4111 peer = peer_and_group_lookup_vty (vty, argv[0]);
4112 if (! peer)
4113 return CMD_WARNING;
4114
4115 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4116
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004117 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004118}
4119
4120DEFUN (no_neighbor_ttl_security,
4121 no_neighbor_ttl_security_cmd,
4122 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4123 NO_STR
4124 NEIGHBOR_STR
4125 NEIGHBOR_ADDR_STR2
4126 "Specify the maximum number of hops to the BGP peer\n")
4127{
4128 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004129
4130 peer = peer_and_group_lookup_vty (vty, argv[0]);
4131 if (! peer)
4132 return CMD_WARNING;
4133
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004134 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004135}
4136
paul718e3742002-12-13 20:15:29 +00004137/* Address family configuration. */
4138DEFUN (address_family_ipv4,
4139 address_family_ipv4_cmd,
4140 "address-family ipv4",
4141 "Enter Address Family command mode\n"
4142 "Address family\n")
4143{
4144 vty->node = BGP_IPV4_NODE;
4145 return CMD_SUCCESS;
4146}
4147
4148DEFUN (address_family_ipv4_safi,
4149 address_family_ipv4_safi_cmd,
4150 "address-family ipv4 (unicast|multicast)",
4151 "Enter Address Family command mode\n"
4152 "Address family\n"
4153 "Address Family modifier\n"
4154 "Address Family modifier\n")
4155{
4156 if (strncmp (argv[0], "m", 1) == 0)
4157 vty->node = BGP_IPV4M_NODE;
4158 else
4159 vty->node = BGP_IPV4_NODE;
4160
4161 return CMD_SUCCESS;
4162}
4163
paul25ffbdc2005-08-22 22:42:08 +00004164DEFUN (address_family_ipv6,
4165 address_family_ipv6_cmd,
4166 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004167 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004168 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004169{
4170 vty->node = BGP_IPV6_NODE;
4171 return CMD_SUCCESS;
4172}
4173
paul25ffbdc2005-08-22 22:42:08 +00004174DEFUN (address_family_ipv6_safi,
4175 address_family_ipv6_safi_cmd,
4176 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004177 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004178 "Address family\n"
4179 "Address Family modifier\n"
4180 "Address Family modifier\n")
4181{
4182 if (strncmp (argv[0], "m", 1) == 0)
4183 vty->node = BGP_IPV6M_NODE;
4184 else
4185 vty->node = BGP_IPV6_NODE;
4186
4187 return CMD_SUCCESS;
4188}
paul718e3742002-12-13 20:15:29 +00004189
4190DEFUN (address_family_vpnv4,
4191 address_family_vpnv4_cmd,
4192 "address-family vpnv4",
4193 "Enter Address Family command mode\n"
4194 "Address family\n")
4195{
4196 vty->node = BGP_VPNV4_NODE;
4197 return CMD_SUCCESS;
4198}
4199
4200ALIAS (address_family_vpnv4,
4201 address_family_vpnv4_unicast_cmd,
4202 "address-family vpnv4 unicast",
4203 "Enter Address Family command mode\n"
4204 "Address family\n"
4205 "Address Family Modifier\n")
4206
4207DEFUN (exit_address_family,
4208 exit_address_family_cmd,
4209 "exit-address-family",
4210 "Exit from Address Family configuration mode\n")
4211{
hassoa8a80d52005-04-09 13:07:47 +00004212 if (vty->node == BGP_IPV4_NODE
4213 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004214 || vty->node == BGP_VPNV4_NODE
paul25ffbdc2005-08-22 22:42:08 +00004215 || vty->node == BGP_IPV6_NODE
4216 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004217 vty->node = BGP_NODE;
4218 return CMD_SUCCESS;
4219}
4220
4221/* BGP clear sort. */
4222enum clear_sort
4223{
4224 clear_all,
4225 clear_peer,
4226 clear_group,
4227 clear_external,
4228 clear_as
4229};
4230
paul94f2b392005-06-28 12:44:16 +00004231static void
paul718e3742002-12-13 20:15:29 +00004232bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4233 safi_t safi, int error)
4234{
4235 switch (error)
4236 {
4237 case BGP_ERR_AF_UNCONFIGURED:
4238 vty_out (vty,
4239 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4240 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4241 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4242 peer->host, VTY_NEWLINE);
4243 break;
4244 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4245 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);
4246 break;
4247 default:
4248 break;
4249 }
4250}
4251
4252/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004253static int
paul718e3742002-12-13 20:15:29 +00004254bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004255 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004256{
4257 int ret;
4258 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004259 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004260
4261 /* Clear all neighbors. */
4262 if (sort == clear_all)
4263 {
paul1eb8ef22005-04-07 07:30:20 +00004264 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004265 {
4266 if (stype == BGP_CLEAR_SOFT_NONE)
4267 ret = peer_clear (peer);
4268 else
4269 ret = peer_clear_soft (peer, afi, safi, stype);
4270
4271 if (ret < 0)
4272 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4273 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004274 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004275 }
4276
4277 /* Clear specified neighbors. */
4278 if (sort == clear_peer)
4279 {
4280 union sockunion su;
4281 int ret;
4282
4283 /* Make sockunion for lookup. */
4284 ret = str2sockunion (arg, &su);
4285 if (ret < 0)
4286 {
4287 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004288 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004289 }
4290 peer = peer_lookup (bgp, &su);
4291 if (! peer)
4292 {
4293 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004294 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004295 }
4296
4297 if (stype == BGP_CLEAR_SOFT_NONE)
4298 ret = peer_clear (peer);
4299 else
4300 ret = peer_clear_soft (peer, afi, safi, stype);
4301
4302 if (ret < 0)
4303 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4304
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004305 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004306 }
4307
4308 /* Clear all peer-group members. */
4309 if (sort == clear_group)
4310 {
4311 struct peer_group *group;
4312
4313 group = peer_group_lookup (bgp, arg);
4314 if (! group)
4315 {
4316 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004317 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004318 }
4319
paul1eb8ef22005-04-07 07:30:20 +00004320 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004321 {
4322 if (stype == BGP_CLEAR_SOFT_NONE)
4323 {
4324 ret = peer_clear (peer);
4325 continue;
4326 }
4327
4328 if (! peer->af_group[afi][safi])
4329 continue;
4330
4331 ret = peer_clear_soft (peer, afi, safi, stype);
4332
4333 if (ret < 0)
4334 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4335 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004336 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004337 }
4338
4339 if (sort == clear_external)
4340 {
paul1eb8ef22005-04-07 07:30:20 +00004341 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004342 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004343 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004344 continue;
4345
4346 if (stype == BGP_CLEAR_SOFT_NONE)
4347 ret = peer_clear (peer);
4348 else
4349 ret = peer_clear_soft (peer, afi, safi, stype);
4350
4351 if (ret < 0)
4352 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4353 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004354 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004355 }
4356
4357 if (sort == clear_as)
4358 {
4359 as_t as;
paul718e3742002-12-13 20:15:29 +00004360 int find = 0;
4361
Ulrich Weberbde12e32011-11-16 19:32:12 +04004362 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004363
paul1eb8ef22005-04-07 07:30:20 +00004364 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004365 {
4366 if (peer->as != as)
4367 continue;
4368
4369 find = 1;
4370 if (stype == BGP_CLEAR_SOFT_NONE)
4371 ret = peer_clear (peer);
4372 else
4373 ret = peer_clear_soft (peer, afi, safi, stype);
4374
4375 if (ret < 0)
4376 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4377 }
4378 if (! find)
4379 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4380 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004381 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004382 }
4383
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004384 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004385}
4386
paul94f2b392005-06-28 12:44:16 +00004387static int
paulfd79ac92004-10-13 05:06:08 +00004388bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4389 enum clear_sort sort, enum bgp_clear_type stype,
4390 const char *arg)
paul718e3742002-12-13 20:15:29 +00004391{
paul718e3742002-12-13 20:15:29 +00004392 struct bgp *bgp;
4393
4394 /* BGP structure lookup. */
4395 if (name)
4396 {
4397 bgp = bgp_lookup_by_name (name);
4398 if (bgp == NULL)
4399 {
4400 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4401 return CMD_WARNING;
4402 }
4403 }
4404 else
4405 {
4406 bgp = bgp_get_default ();
4407 if (bgp == NULL)
4408 {
4409 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4410 return CMD_WARNING;
4411 }
4412 }
4413
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004414 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004415}
4416
4417DEFUN (clear_ip_bgp_all,
4418 clear_ip_bgp_all_cmd,
4419 "clear ip bgp *",
4420 CLEAR_STR
4421 IP_STR
4422 BGP_STR
4423 "Clear all peers\n")
4424{
4425 if (argc == 1)
4426 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4427
4428 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4429}
4430
4431ALIAS (clear_ip_bgp_all,
4432 clear_bgp_all_cmd,
4433 "clear bgp *",
4434 CLEAR_STR
4435 BGP_STR
4436 "Clear all peers\n")
4437
4438ALIAS (clear_ip_bgp_all,
4439 clear_bgp_ipv6_all_cmd,
4440 "clear bgp ipv6 *",
4441 CLEAR_STR
4442 BGP_STR
4443 "Address family\n"
4444 "Clear all peers\n")
4445
4446ALIAS (clear_ip_bgp_all,
4447 clear_ip_bgp_instance_all_cmd,
4448 "clear ip bgp view WORD *",
4449 CLEAR_STR
4450 IP_STR
4451 BGP_STR
4452 "BGP view\n"
4453 "view name\n"
4454 "Clear all peers\n")
4455
4456ALIAS (clear_ip_bgp_all,
4457 clear_bgp_instance_all_cmd,
4458 "clear bgp view WORD *",
4459 CLEAR_STR
4460 BGP_STR
4461 "BGP view\n"
4462 "view name\n"
4463 "Clear all peers\n")
4464
4465DEFUN (clear_ip_bgp_peer,
4466 clear_ip_bgp_peer_cmd,
4467 "clear ip bgp (A.B.C.D|X:X::X:X)",
4468 CLEAR_STR
4469 IP_STR
4470 BGP_STR
4471 "BGP neighbor IP address to clear\n"
4472 "BGP IPv6 neighbor to clear\n")
4473{
4474 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4475}
4476
4477ALIAS (clear_ip_bgp_peer,
4478 clear_bgp_peer_cmd,
4479 "clear bgp (A.B.C.D|X:X::X:X)",
4480 CLEAR_STR
4481 BGP_STR
4482 "BGP neighbor address to clear\n"
4483 "BGP IPv6 neighbor to clear\n")
4484
4485ALIAS (clear_ip_bgp_peer,
4486 clear_bgp_ipv6_peer_cmd,
4487 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4488 CLEAR_STR
4489 BGP_STR
4490 "Address family\n"
4491 "BGP neighbor address to clear\n"
4492 "BGP IPv6 neighbor to clear\n")
4493
4494DEFUN (clear_ip_bgp_peer_group,
4495 clear_ip_bgp_peer_group_cmd,
4496 "clear ip bgp peer-group WORD",
4497 CLEAR_STR
4498 IP_STR
4499 BGP_STR
4500 "Clear all members of peer-group\n"
4501 "BGP peer-group name\n")
4502{
4503 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4504}
4505
4506ALIAS (clear_ip_bgp_peer_group,
4507 clear_bgp_peer_group_cmd,
4508 "clear bgp peer-group WORD",
4509 CLEAR_STR
4510 BGP_STR
4511 "Clear all members of peer-group\n"
4512 "BGP peer-group name\n")
4513
4514ALIAS (clear_ip_bgp_peer_group,
4515 clear_bgp_ipv6_peer_group_cmd,
4516 "clear bgp ipv6 peer-group WORD",
4517 CLEAR_STR
4518 BGP_STR
4519 "Address family\n"
4520 "Clear all members of peer-group\n"
4521 "BGP peer-group name\n")
4522
4523DEFUN (clear_ip_bgp_external,
4524 clear_ip_bgp_external_cmd,
4525 "clear ip bgp external",
4526 CLEAR_STR
4527 IP_STR
4528 BGP_STR
4529 "Clear all external peers\n")
4530{
4531 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4532}
4533
4534ALIAS (clear_ip_bgp_external,
4535 clear_bgp_external_cmd,
4536 "clear bgp external",
4537 CLEAR_STR
4538 BGP_STR
4539 "Clear all external peers\n")
4540
4541ALIAS (clear_ip_bgp_external,
4542 clear_bgp_ipv6_external_cmd,
4543 "clear bgp ipv6 external",
4544 CLEAR_STR
4545 BGP_STR
4546 "Address family\n"
4547 "Clear all external peers\n")
4548
4549DEFUN (clear_ip_bgp_as,
4550 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004551 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004552 CLEAR_STR
4553 IP_STR
4554 BGP_STR
4555 "Clear peers with the AS number\n")
4556{
4557 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4558}
4559
4560ALIAS (clear_ip_bgp_as,
4561 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004562 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004563 CLEAR_STR
4564 BGP_STR
4565 "Clear peers with the AS number\n")
4566
4567ALIAS (clear_ip_bgp_as,
4568 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004569 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004570 CLEAR_STR
4571 BGP_STR
4572 "Address family\n"
4573 "Clear peers with the AS number\n")
4574
4575/* Outbound soft-reconfiguration */
4576DEFUN (clear_ip_bgp_all_soft_out,
4577 clear_ip_bgp_all_soft_out_cmd,
4578 "clear ip bgp * soft out",
4579 CLEAR_STR
4580 IP_STR
4581 BGP_STR
4582 "Clear all peers\n"
4583 "Soft reconfig\n"
4584 "Soft reconfig outbound update\n")
4585{
4586 if (argc == 1)
4587 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4588 BGP_CLEAR_SOFT_OUT, NULL);
4589
4590 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4591 BGP_CLEAR_SOFT_OUT, NULL);
4592}
4593
4594ALIAS (clear_ip_bgp_all_soft_out,
4595 clear_ip_bgp_all_out_cmd,
4596 "clear ip bgp * out",
4597 CLEAR_STR
4598 IP_STR
4599 BGP_STR
4600 "Clear all peers\n"
4601 "Soft reconfig outbound update\n")
4602
4603ALIAS (clear_ip_bgp_all_soft_out,
4604 clear_ip_bgp_instance_all_soft_out_cmd,
4605 "clear ip bgp view WORD * soft out",
4606 CLEAR_STR
4607 IP_STR
4608 BGP_STR
4609 "BGP view\n"
4610 "view name\n"
4611 "Clear all peers\n"
4612 "Soft reconfig\n"
4613 "Soft reconfig outbound update\n")
4614
4615DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4616 clear_ip_bgp_all_ipv4_soft_out_cmd,
4617 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4618 CLEAR_STR
4619 IP_STR
4620 BGP_STR
4621 "Clear all peers\n"
4622 "Address family\n"
4623 "Address Family modifier\n"
4624 "Address Family modifier\n"
4625 "Soft reconfig\n"
4626 "Soft reconfig outbound update\n")
4627{
4628 if (strncmp (argv[0], "m", 1) == 0)
4629 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4630 BGP_CLEAR_SOFT_OUT, NULL);
4631
4632 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4633 BGP_CLEAR_SOFT_OUT, NULL);
4634}
4635
4636ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4637 clear_ip_bgp_all_ipv4_out_cmd,
4638 "clear ip bgp * ipv4 (unicast|multicast) out",
4639 CLEAR_STR
4640 IP_STR
4641 BGP_STR
4642 "Clear all peers\n"
4643 "Address family\n"
4644 "Address Family modifier\n"
4645 "Address Family modifier\n"
4646 "Soft reconfig outbound update\n")
4647
4648DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4649 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4650 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4651 CLEAR_STR
4652 IP_STR
4653 BGP_STR
4654 "BGP view\n"
4655 "view name\n"
4656 "Clear all peers\n"
4657 "Address family\n"
4658 "Address Family modifier\n"
4659 "Address Family modifier\n"
4660 "Soft reconfig outbound update\n")
4661{
4662 if (strncmp (argv[1], "m", 1) == 0)
4663 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4664 BGP_CLEAR_SOFT_OUT, NULL);
4665
4666 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4667 BGP_CLEAR_SOFT_OUT, NULL);
4668}
4669
4670DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4671 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4672 "clear ip bgp * vpnv4 unicast soft out",
4673 CLEAR_STR
4674 IP_STR
4675 BGP_STR
4676 "Clear all peers\n"
4677 "Address family\n"
4678 "Address Family Modifier\n"
4679 "Soft reconfig\n"
4680 "Soft reconfig outbound update\n")
4681{
4682 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4683 BGP_CLEAR_SOFT_OUT, NULL);
4684}
4685
4686ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4687 clear_ip_bgp_all_vpnv4_out_cmd,
4688 "clear ip bgp * vpnv4 unicast out",
4689 CLEAR_STR
4690 IP_STR
4691 BGP_STR
4692 "Clear all peers\n"
4693 "Address family\n"
4694 "Address Family Modifier\n"
4695 "Soft reconfig outbound update\n")
4696
4697DEFUN (clear_bgp_all_soft_out,
4698 clear_bgp_all_soft_out_cmd,
4699 "clear bgp * soft out",
4700 CLEAR_STR
4701 BGP_STR
4702 "Clear all peers\n"
4703 "Soft reconfig\n"
4704 "Soft reconfig outbound update\n")
4705{
4706 if (argc == 1)
4707 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4708 BGP_CLEAR_SOFT_OUT, NULL);
4709
4710 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4711 BGP_CLEAR_SOFT_OUT, NULL);
4712}
4713
4714ALIAS (clear_bgp_all_soft_out,
4715 clear_bgp_instance_all_soft_out_cmd,
4716 "clear bgp view WORD * soft out",
4717 CLEAR_STR
4718 BGP_STR
4719 "BGP view\n"
4720 "view name\n"
4721 "Clear all peers\n"
4722 "Soft reconfig\n"
4723 "Soft reconfig outbound update\n")
4724
4725ALIAS (clear_bgp_all_soft_out,
4726 clear_bgp_all_out_cmd,
4727 "clear bgp * out",
4728 CLEAR_STR
4729 BGP_STR
4730 "Clear all peers\n"
4731 "Soft reconfig outbound update\n")
4732
4733ALIAS (clear_bgp_all_soft_out,
4734 clear_bgp_ipv6_all_soft_out_cmd,
4735 "clear bgp ipv6 * soft out",
4736 CLEAR_STR
4737 BGP_STR
4738 "Address family\n"
4739 "Clear all peers\n"
4740 "Soft reconfig\n"
4741 "Soft reconfig outbound update\n")
4742
4743ALIAS (clear_bgp_all_soft_out,
4744 clear_bgp_ipv6_all_out_cmd,
4745 "clear bgp ipv6 * out",
4746 CLEAR_STR
4747 BGP_STR
4748 "Address family\n"
4749 "Clear all peers\n"
4750 "Soft reconfig outbound update\n")
4751
4752DEFUN (clear_ip_bgp_peer_soft_out,
4753 clear_ip_bgp_peer_soft_out_cmd,
4754 "clear ip bgp A.B.C.D soft out",
4755 CLEAR_STR
4756 IP_STR
4757 BGP_STR
4758 "BGP neighbor address to clear\n"
4759 "Soft reconfig\n"
4760 "Soft reconfig outbound update\n")
4761{
4762 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4763 BGP_CLEAR_SOFT_OUT, argv[0]);
4764}
4765
4766ALIAS (clear_ip_bgp_peer_soft_out,
4767 clear_ip_bgp_peer_out_cmd,
4768 "clear ip bgp A.B.C.D out",
4769 CLEAR_STR
4770 IP_STR
4771 BGP_STR
4772 "BGP neighbor address to clear\n"
4773 "Soft reconfig outbound update\n")
4774
4775DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4776 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4777 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4778 CLEAR_STR
4779 IP_STR
4780 BGP_STR
4781 "BGP neighbor address to clear\n"
4782 "Address family\n"
4783 "Address Family modifier\n"
4784 "Address Family modifier\n"
4785 "Soft reconfig\n"
4786 "Soft reconfig outbound update\n")
4787{
4788 if (strncmp (argv[1], "m", 1) == 0)
4789 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4790 BGP_CLEAR_SOFT_OUT, argv[0]);
4791
4792 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4793 BGP_CLEAR_SOFT_OUT, argv[0]);
4794}
4795
4796ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
4797 clear_ip_bgp_peer_ipv4_out_cmd,
4798 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
4799 CLEAR_STR
4800 IP_STR
4801 BGP_STR
4802 "BGP neighbor address to clear\n"
4803 "Address family\n"
4804 "Address Family modifier\n"
4805 "Address Family modifier\n"
4806 "Soft reconfig outbound update\n")
4807
4808DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
4809 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
4810 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
4811 CLEAR_STR
4812 IP_STR
4813 BGP_STR
4814 "BGP neighbor address to clear\n"
4815 "Address family\n"
4816 "Address Family Modifier\n"
4817 "Soft reconfig\n"
4818 "Soft reconfig outbound update\n")
4819{
4820 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
4821 BGP_CLEAR_SOFT_OUT, argv[0]);
4822}
4823
4824ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
4825 clear_ip_bgp_peer_vpnv4_out_cmd,
4826 "clear ip bgp A.B.C.D vpnv4 unicast out",
4827 CLEAR_STR
4828 IP_STR
4829 BGP_STR
4830 "BGP neighbor address to clear\n"
4831 "Address family\n"
4832 "Address Family Modifier\n"
4833 "Soft reconfig outbound update\n")
4834
4835DEFUN (clear_bgp_peer_soft_out,
4836 clear_bgp_peer_soft_out_cmd,
4837 "clear bgp (A.B.C.D|X:X::X:X) soft out",
4838 CLEAR_STR
4839 BGP_STR
4840 "BGP neighbor address to clear\n"
4841 "BGP IPv6 neighbor to clear\n"
4842 "Soft reconfig\n"
4843 "Soft reconfig outbound update\n")
4844{
4845 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
4846 BGP_CLEAR_SOFT_OUT, argv[0]);
4847}
4848
4849ALIAS (clear_bgp_peer_soft_out,
4850 clear_bgp_ipv6_peer_soft_out_cmd,
4851 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
4852 CLEAR_STR
4853 BGP_STR
4854 "Address family\n"
4855 "BGP neighbor address to clear\n"
4856 "BGP IPv6 neighbor to clear\n"
4857 "Soft reconfig\n"
4858 "Soft reconfig outbound update\n")
4859
4860ALIAS (clear_bgp_peer_soft_out,
4861 clear_bgp_peer_out_cmd,
4862 "clear bgp (A.B.C.D|X:X::X:X) out",
4863 CLEAR_STR
4864 BGP_STR
4865 "BGP neighbor address to clear\n"
4866 "BGP IPv6 neighbor to clear\n"
4867 "Soft reconfig outbound update\n")
4868
4869ALIAS (clear_bgp_peer_soft_out,
4870 clear_bgp_ipv6_peer_out_cmd,
4871 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
4872 CLEAR_STR
4873 BGP_STR
4874 "Address family\n"
4875 "BGP neighbor address to clear\n"
4876 "BGP IPv6 neighbor to clear\n"
4877 "Soft reconfig outbound update\n")
4878
4879DEFUN (clear_ip_bgp_peer_group_soft_out,
4880 clear_ip_bgp_peer_group_soft_out_cmd,
4881 "clear ip bgp peer-group WORD soft out",
4882 CLEAR_STR
4883 IP_STR
4884 BGP_STR
4885 "Clear all members of peer-group\n"
4886 "BGP peer-group name\n"
4887 "Soft reconfig\n"
4888 "Soft reconfig outbound update\n")
4889{
4890 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4891 BGP_CLEAR_SOFT_OUT, argv[0]);
4892}
4893
4894ALIAS (clear_ip_bgp_peer_group_soft_out,
4895 clear_ip_bgp_peer_group_out_cmd,
4896 "clear ip bgp peer-group WORD out",
4897 CLEAR_STR
4898 IP_STR
4899 BGP_STR
4900 "Clear all members of peer-group\n"
4901 "BGP peer-group name\n"
4902 "Soft reconfig outbound update\n")
4903
4904DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
4905 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
4906 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
4907 CLEAR_STR
4908 IP_STR
4909 BGP_STR
4910 "Clear all members of peer-group\n"
4911 "BGP peer-group name\n"
4912 "Address family\n"
4913 "Address Family modifier\n"
4914 "Address Family modifier\n"
4915 "Soft reconfig\n"
4916 "Soft reconfig outbound update\n")
4917{
4918 if (strncmp (argv[1], "m", 1) == 0)
4919 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
4920 BGP_CLEAR_SOFT_OUT, argv[0]);
4921
4922 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4923 BGP_CLEAR_SOFT_OUT, argv[0]);
4924}
4925
4926ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
4927 clear_ip_bgp_peer_group_ipv4_out_cmd,
4928 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
4929 CLEAR_STR
4930 IP_STR
4931 BGP_STR
4932 "Clear all members of peer-group\n"
4933 "BGP peer-group name\n"
4934 "Address family\n"
4935 "Address Family modifier\n"
4936 "Address Family modifier\n"
4937 "Soft reconfig outbound update\n")
4938
4939DEFUN (clear_bgp_peer_group_soft_out,
4940 clear_bgp_peer_group_soft_out_cmd,
4941 "clear bgp peer-group WORD soft out",
4942 CLEAR_STR
4943 BGP_STR
4944 "Clear all members of peer-group\n"
4945 "BGP peer-group name\n"
4946 "Soft reconfig\n"
4947 "Soft reconfig outbound update\n")
4948{
4949 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
4950 BGP_CLEAR_SOFT_OUT, argv[0]);
4951}
4952
4953ALIAS (clear_bgp_peer_group_soft_out,
4954 clear_bgp_ipv6_peer_group_soft_out_cmd,
4955 "clear bgp ipv6 peer-group WORD soft out",
4956 CLEAR_STR
4957 BGP_STR
4958 "Address family\n"
4959 "Clear all members of peer-group\n"
4960 "BGP peer-group name\n"
4961 "Soft reconfig\n"
4962 "Soft reconfig outbound update\n")
4963
4964ALIAS (clear_bgp_peer_group_soft_out,
4965 clear_bgp_peer_group_out_cmd,
4966 "clear bgp peer-group WORD out",
4967 CLEAR_STR
4968 BGP_STR
4969 "Clear all members of peer-group\n"
4970 "BGP peer-group name\n"
4971 "Soft reconfig outbound update\n")
4972
4973ALIAS (clear_bgp_peer_group_soft_out,
4974 clear_bgp_ipv6_peer_group_out_cmd,
4975 "clear bgp ipv6 peer-group WORD out",
4976 CLEAR_STR
4977 BGP_STR
4978 "Address family\n"
4979 "Clear all members of peer-group\n"
4980 "BGP peer-group name\n"
4981 "Soft reconfig outbound update\n")
4982
4983DEFUN (clear_ip_bgp_external_soft_out,
4984 clear_ip_bgp_external_soft_out_cmd,
4985 "clear ip bgp external soft out",
4986 CLEAR_STR
4987 IP_STR
4988 BGP_STR
4989 "Clear all external peers\n"
4990 "Soft reconfig\n"
4991 "Soft reconfig outbound update\n")
4992{
4993 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
4994 BGP_CLEAR_SOFT_OUT, NULL);
4995}
4996
4997ALIAS (clear_ip_bgp_external_soft_out,
4998 clear_ip_bgp_external_out_cmd,
4999 "clear ip bgp external out",
5000 CLEAR_STR
5001 IP_STR
5002 BGP_STR
5003 "Clear all external peers\n"
5004 "Soft reconfig outbound update\n")
5005
5006DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5007 clear_ip_bgp_external_ipv4_soft_out_cmd,
5008 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5009 CLEAR_STR
5010 IP_STR
5011 BGP_STR
5012 "Clear all external peers\n"
5013 "Address family\n"
5014 "Address Family modifier\n"
5015 "Address Family modifier\n"
5016 "Soft reconfig\n"
5017 "Soft reconfig outbound update\n")
5018{
5019 if (strncmp (argv[0], "m", 1) == 0)
5020 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5021 BGP_CLEAR_SOFT_OUT, NULL);
5022
5023 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5024 BGP_CLEAR_SOFT_OUT, NULL);
5025}
5026
5027ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5028 clear_ip_bgp_external_ipv4_out_cmd,
5029 "clear ip bgp external ipv4 (unicast|multicast) out",
5030 CLEAR_STR
5031 IP_STR
5032 BGP_STR
5033 "Clear all external peers\n"
5034 "Address family\n"
5035 "Address Family modifier\n"
5036 "Address Family modifier\n"
5037 "Soft reconfig outbound update\n")
5038
5039DEFUN (clear_bgp_external_soft_out,
5040 clear_bgp_external_soft_out_cmd,
5041 "clear bgp external soft out",
5042 CLEAR_STR
5043 BGP_STR
5044 "Clear all external peers\n"
5045 "Soft reconfig\n"
5046 "Soft reconfig outbound update\n")
5047{
5048 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5049 BGP_CLEAR_SOFT_OUT, NULL);
5050}
5051
5052ALIAS (clear_bgp_external_soft_out,
5053 clear_bgp_ipv6_external_soft_out_cmd,
5054 "clear bgp ipv6 external soft out",
5055 CLEAR_STR
5056 BGP_STR
5057 "Address family\n"
5058 "Clear all external peers\n"
5059 "Soft reconfig\n"
5060 "Soft reconfig outbound update\n")
5061
5062ALIAS (clear_bgp_external_soft_out,
5063 clear_bgp_external_out_cmd,
5064 "clear bgp external out",
5065 CLEAR_STR
5066 BGP_STR
5067 "Clear all external peers\n"
5068 "Soft reconfig outbound update\n")
5069
5070ALIAS (clear_bgp_external_soft_out,
5071 clear_bgp_ipv6_external_out_cmd,
5072 "clear bgp ipv6 external WORD out",
5073 CLEAR_STR
5074 BGP_STR
5075 "Address family\n"
5076 "Clear all external peers\n"
5077 "Soft reconfig outbound update\n")
5078
5079DEFUN (clear_ip_bgp_as_soft_out,
5080 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005081 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005082 CLEAR_STR
5083 IP_STR
5084 BGP_STR
5085 "Clear peers with the AS number\n"
5086 "Soft reconfig\n"
5087 "Soft reconfig outbound update\n")
5088{
5089 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5090 BGP_CLEAR_SOFT_OUT, argv[0]);
5091}
5092
5093ALIAS (clear_ip_bgp_as_soft_out,
5094 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005095 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005096 CLEAR_STR
5097 IP_STR
5098 BGP_STR
5099 "Clear peers with the AS number\n"
5100 "Soft reconfig outbound update\n")
5101
5102DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5103 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005104 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005105 CLEAR_STR
5106 IP_STR
5107 BGP_STR
5108 "Clear peers with the AS number\n"
5109 "Address family\n"
5110 "Address Family modifier\n"
5111 "Address Family modifier\n"
5112 "Soft reconfig\n"
5113 "Soft reconfig outbound update\n")
5114{
5115 if (strncmp (argv[1], "m", 1) == 0)
5116 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5117 BGP_CLEAR_SOFT_OUT, argv[0]);
5118
5119 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5120 BGP_CLEAR_SOFT_OUT, argv[0]);
5121}
5122
5123ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5124 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005125 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00005126 CLEAR_STR
5127 IP_STR
5128 BGP_STR
5129 "Clear peers with the AS number\n"
5130 "Address family\n"
5131 "Address Family modifier\n"
5132 "Address Family modifier\n"
5133 "Soft reconfig outbound update\n")
5134
5135DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5136 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005137 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00005138 CLEAR_STR
5139 IP_STR
5140 BGP_STR
5141 "Clear peers with the AS number\n"
5142 "Address family\n"
5143 "Address Family modifier\n"
5144 "Soft reconfig\n"
5145 "Soft reconfig outbound update\n")
5146{
5147 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5148 BGP_CLEAR_SOFT_OUT, argv[0]);
5149}
5150
5151ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5152 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005153 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005154 CLEAR_STR
5155 IP_STR
5156 BGP_STR
5157 "Clear peers with the AS number\n"
5158 "Address family\n"
5159 "Address Family modifier\n"
5160 "Soft reconfig outbound update\n")
5161
5162DEFUN (clear_bgp_as_soft_out,
5163 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005164 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005165 CLEAR_STR
5166 BGP_STR
5167 "Clear peers with the AS number\n"
5168 "Soft reconfig\n"
5169 "Soft reconfig outbound update\n")
5170{
5171 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5172 BGP_CLEAR_SOFT_OUT, argv[0]);
5173}
5174
5175ALIAS (clear_bgp_as_soft_out,
5176 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005177 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005178 CLEAR_STR
5179 BGP_STR
5180 "Address family\n"
5181 "Clear peers with the AS number\n"
5182 "Soft reconfig\n"
5183 "Soft reconfig outbound update\n")
5184
5185ALIAS (clear_bgp_as_soft_out,
5186 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005187 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005188 CLEAR_STR
5189 BGP_STR
5190 "Clear peers with the AS number\n"
5191 "Soft reconfig outbound update\n")
5192
5193ALIAS (clear_bgp_as_soft_out,
5194 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005195 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005196 CLEAR_STR
5197 BGP_STR
5198 "Address family\n"
5199 "Clear peers with the AS number\n"
5200 "Soft reconfig outbound update\n")
5201
5202/* Inbound soft-reconfiguration */
5203DEFUN (clear_ip_bgp_all_soft_in,
5204 clear_ip_bgp_all_soft_in_cmd,
5205 "clear ip bgp * soft in",
5206 CLEAR_STR
5207 IP_STR
5208 BGP_STR
5209 "Clear all peers\n"
5210 "Soft reconfig\n"
5211 "Soft reconfig inbound update\n")
5212{
5213 if (argc == 1)
5214 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5215 BGP_CLEAR_SOFT_IN, NULL);
5216
5217 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5218 BGP_CLEAR_SOFT_IN, NULL);
5219}
5220
5221ALIAS (clear_ip_bgp_all_soft_in,
5222 clear_ip_bgp_instance_all_soft_in_cmd,
5223 "clear ip bgp view WORD * soft in",
5224 CLEAR_STR
5225 IP_STR
5226 BGP_STR
5227 "BGP view\n"
5228 "view name\n"
5229 "Clear all peers\n"
5230 "Soft reconfig\n"
5231 "Soft reconfig inbound update\n")
5232
5233ALIAS (clear_ip_bgp_all_soft_in,
5234 clear_ip_bgp_all_in_cmd,
5235 "clear ip bgp * in",
5236 CLEAR_STR
5237 IP_STR
5238 BGP_STR
5239 "Clear all peers\n"
5240 "Soft reconfig inbound update\n")
5241
5242DEFUN (clear_ip_bgp_all_in_prefix_filter,
5243 clear_ip_bgp_all_in_prefix_filter_cmd,
5244 "clear ip bgp * in prefix-filter",
5245 CLEAR_STR
5246 IP_STR
5247 BGP_STR
5248 "Clear all peers\n"
5249 "Soft reconfig inbound update\n"
5250 "Push out prefix-list ORF and do inbound soft reconfig\n")
5251{
5252 if (argc== 1)
5253 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5254 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5255
5256 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5257 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5258}
5259
5260ALIAS (clear_ip_bgp_all_in_prefix_filter,
5261 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5262 "clear ip bgp view WORD * in prefix-filter",
5263 CLEAR_STR
5264 IP_STR
5265 BGP_STR
5266 "BGP view\n"
5267 "view name\n"
5268 "Clear all peers\n"
5269 "Soft reconfig inbound update\n"
5270 "Push out prefix-list ORF and do inbound soft reconfig\n")
5271
5272
5273DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5274 clear_ip_bgp_all_ipv4_soft_in_cmd,
5275 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5276 CLEAR_STR
5277 IP_STR
5278 BGP_STR
5279 "Clear all peers\n"
5280 "Address family\n"
5281 "Address Family modifier\n"
5282 "Address Family modifier\n"
5283 "Soft reconfig\n"
5284 "Soft reconfig inbound update\n")
5285{
5286 if (strncmp (argv[0], "m", 1) == 0)
5287 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5288 BGP_CLEAR_SOFT_IN, NULL);
5289
5290 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5291 BGP_CLEAR_SOFT_IN, NULL);
5292}
5293
5294ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5295 clear_ip_bgp_all_ipv4_in_cmd,
5296 "clear ip bgp * ipv4 (unicast|multicast) in",
5297 CLEAR_STR
5298 IP_STR
5299 BGP_STR
5300 "Clear all peers\n"
5301 "Address family\n"
5302 "Address Family modifier\n"
5303 "Address Family modifier\n"
5304 "Soft reconfig inbound update\n")
5305
5306DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5307 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5308 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5309 CLEAR_STR
5310 IP_STR
5311 BGP_STR
5312 "BGP view\n"
5313 "view name\n"
5314 "Clear all peers\n"
5315 "Address family\n"
5316 "Address Family modifier\n"
5317 "Address Family modifier\n"
5318 "Soft reconfig\n"
5319 "Soft reconfig inbound update\n")
5320{
5321 if (strncmp (argv[1], "m", 1) == 0)
5322 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5323 BGP_CLEAR_SOFT_IN, NULL);
5324
5325 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5326 BGP_CLEAR_SOFT_IN, NULL);
5327}
5328
5329DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5330 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5331 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5332 CLEAR_STR
5333 IP_STR
5334 BGP_STR
5335 "Clear all peers\n"
5336 "Address family\n"
5337 "Address Family modifier\n"
5338 "Address Family modifier\n"
5339 "Soft reconfig inbound update\n"
5340 "Push out prefix-list ORF and do inbound soft reconfig\n")
5341{
5342 if (strncmp (argv[0], "m", 1) == 0)
5343 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5344 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5345
5346 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5347 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5348}
5349
5350DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5351 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5352 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5353 CLEAR_STR
5354 IP_STR
5355 BGP_STR
5356 "Clear all peers\n"
5357 "Address family\n"
5358 "Address Family modifier\n"
5359 "Address Family modifier\n"
5360 "Soft reconfig inbound update\n"
5361 "Push out prefix-list ORF and do inbound soft reconfig\n")
5362{
5363 if (strncmp (argv[1], "m", 1) == 0)
5364 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5365 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5366
5367 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5368 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5369}
5370
5371DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5372 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5373 "clear ip bgp * vpnv4 unicast soft in",
5374 CLEAR_STR
5375 IP_STR
5376 BGP_STR
5377 "Clear all peers\n"
5378 "Address family\n"
5379 "Address Family Modifier\n"
5380 "Soft reconfig\n"
5381 "Soft reconfig inbound update\n")
5382{
5383 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5384 BGP_CLEAR_SOFT_IN, NULL);
5385}
5386
5387ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5388 clear_ip_bgp_all_vpnv4_in_cmd,
5389 "clear ip bgp * vpnv4 unicast in",
5390 CLEAR_STR
5391 IP_STR
5392 BGP_STR
5393 "Clear all peers\n"
5394 "Address family\n"
5395 "Address Family Modifier\n"
5396 "Soft reconfig inbound update\n")
5397
5398DEFUN (clear_bgp_all_soft_in,
5399 clear_bgp_all_soft_in_cmd,
5400 "clear bgp * soft in",
5401 CLEAR_STR
5402 BGP_STR
5403 "Clear all peers\n"
5404 "Soft reconfig\n"
5405 "Soft reconfig inbound update\n")
5406{
5407 if (argc == 1)
5408 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5409 BGP_CLEAR_SOFT_IN, NULL);
5410
5411 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5412 BGP_CLEAR_SOFT_IN, NULL);
5413}
5414
5415ALIAS (clear_bgp_all_soft_in,
5416 clear_bgp_instance_all_soft_in_cmd,
5417 "clear bgp view WORD * soft in",
5418 CLEAR_STR
5419 BGP_STR
5420 "BGP view\n"
5421 "view name\n"
5422 "Clear all peers\n"
5423 "Soft reconfig\n"
5424 "Soft reconfig inbound update\n")
5425
5426ALIAS (clear_bgp_all_soft_in,
5427 clear_bgp_ipv6_all_soft_in_cmd,
5428 "clear bgp ipv6 * soft in",
5429 CLEAR_STR
5430 BGP_STR
5431 "Address family\n"
5432 "Clear all peers\n"
5433 "Soft reconfig\n"
5434 "Soft reconfig inbound update\n")
5435
5436ALIAS (clear_bgp_all_soft_in,
5437 clear_bgp_all_in_cmd,
5438 "clear bgp * in",
5439 CLEAR_STR
5440 BGP_STR
5441 "Clear all peers\n"
5442 "Soft reconfig inbound update\n")
5443
5444ALIAS (clear_bgp_all_soft_in,
5445 clear_bgp_ipv6_all_in_cmd,
5446 "clear bgp ipv6 * in",
5447 CLEAR_STR
5448 BGP_STR
5449 "Address family\n"
5450 "Clear all peers\n"
5451 "Soft reconfig inbound update\n")
5452
5453DEFUN (clear_bgp_all_in_prefix_filter,
5454 clear_bgp_all_in_prefix_filter_cmd,
5455 "clear bgp * in prefix-filter",
5456 CLEAR_STR
5457 BGP_STR
5458 "Clear all peers\n"
5459 "Soft reconfig inbound update\n"
5460 "Push out prefix-list ORF and do inbound soft reconfig\n")
5461{
5462 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5463 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5464}
5465
5466ALIAS (clear_bgp_all_in_prefix_filter,
5467 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5468 "clear bgp ipv6 * in prefix-filter",
5469 CLEAR_STR
5470 BGP_STR
5471 "Address family\n"
5472 "Clear all peers\n"
5473 "Soft reconfig inbound update\n"
5474 "Push out prefix-list ORF and do inbound soft reconfig\n")
5475
5476DEFUN (clear_ip_bgp_peer_soft_in,
5477 clear_ip_bgp_peer_soft_in_cmd,
5478 "clear ip bgp A.B.C.D soft in",
5479 CLEAR_STR
5480 IP_STR
5481 BGP_STR
5482 "BGP neighbor address to clear\n"
5483 "Soft reconfig\n"
5484 "Soft reconfig inbound update\n")
5485{
5486 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5487 BGP_CLEAR_SOFT_IN, argv[0]);
5488}
5489
5490ALIAS (clear_ip_bgp_peer_soft_in,
5491 clear_ip_bgp_peer_in_cmd,
5492 "clear ip bgp A.B.C.D in",
5493 CLEAR_STR
5494 IP_STR
5495 BGP_STR
5496 "BGP neighbor address to clear\n"
5497 "Soft reconfig inbound update\n")
5498
5499DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5500 clear_ip_bgp_peer_in_prefix_filter_cmd,
5501 "clear ip bgp A.B.C.D in prefix-filter",
5502 CLEAR_STR
5503 IP_STR
5504 BGP_STR
5505 "BGP neighbor address to clear\n"
5506 "Soft reconfig inbound update\n"
5507 "Push out the existing ORF prefix-list\n")
5508{
5509 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5510 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5511}
5512
5513DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5514 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5515 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5516 CLEAR_STR
5517 IP_STR
5518 BGP_STR
5519 "BGP neighbor address to clear\n"
5520 "Address family\n"
5521 "Address Family modifier\n"
5522 "Address Family modifier\n"
5523 "Soft reconfig\n"
5524 "Soft reconfig inbound update\n")
5525{
5526 if (strncmp (argv[1], "m", 1) == 0)
5527 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5528 BGP_CLEAR_SOFT_IN, argv[0]);
5529
5530 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5531 BGP_CLEAR_SOFT_IN, argv[0]);
5532}
5533
5534ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5535 clear_ip_bgp_peer_ipv4_in_cmd,
5536 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5537 CLEAR_STR
5538 IP_STR
5539 BGP_STR
5540 "BGP neighbor address to clear\n"
5541 "Address family\n"
5542 "Address Family modifier\n"
5543 "Address Family modifier\n"
5544 "Soft reconfig inbound update\n")
5545
5546DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5547 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5548 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5549 CLEAR_STR
5550 IP_STR
5551 BGP_STR
5552 "BGP neighbor address to clear\n"
5553 "Address family\n"
5554 "Address Family modifier\n"
5555 "Address Family modifier\n"
5556 "Soft reconfig inbound update\n"
5557 "Push out the existing ORF prefix-list\n")
5558{
5559 if (strncmp (argv[1], "m", 1) == 0)
5560 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5561 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5562
5563 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5564 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5565}
5566
5567DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5568 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5569 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5570 CLEAR_STR
5571 IP_STR
5572 BGP_STR
5573 "BGP neighbor address to clear\n"
5574 "Address family\n"
5575 "Address Family Modifier\n"
5576 "Soft reconfig\n"
5577 "Soft reconfig inbound update\n")
5578{
5579 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5580 BGP_CLEAR_SOFT_IN, argv[0]);
5581}
5582
5583ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5584 clear_ip_bgp_peer_vpnv4_in_cmd,
5585 "clear ip bgp A.B.C.D vpnv4 unicast in",
5586 CLEAR_STR
5587 IP_STR
5588 BGP_STR
5589 "BGP neighbor address to clear\n"
5590 "Address family\n"
5591 "Address Family Modifier\n"
5592 "Soft reconfig inbound update\n")
5593
5594DEFUN (clear_bgp_peer_soft_in,
5595 clear_bgp_peer_soft_in_cmd,
5596 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5597 CLEAR_STR
5598 BGP_STR
5599 "BGP neighbor address to clear\n"
5600 "BGP IPv6 neighbor to clear\n"
5601 "Soft reconfig\n"
5602 "Soft reconfig inbound update\n")
5603{
5604 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5605 BGP_CLEAR_SOFT_IN, argv[0]);
5606}
5607
5608ALIAS (clear_bgp_peer_soft_in,
5609 clear_bgp_ipv6_peer_soft_in_cmd,
5610 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5611 CLEAR_STR
5612 BGP_STR
5613 "Address family\n"
5614 "BGP neighbor address to clear\n"
5615 "BGP IPv6 neighbor to clear\n"
5616 "Soft reconfig\n"
5617 "Soft reconfig inbound update\n")
5618
5619ALIAS (clear_bgp_peer_soft_in,
5620 clear_bgp_peer_in_cmd,
5621 "clear bgp (A.B.C.D|X:X::X:X) in",
5622 CLEAR_STR
5623 BGP_STR
5624 "BGP neighbor address to clear\n"
5625 "BGP IPv6 neighbor to clear\n"
5626 "Soft reconfig inbound update\n")
5627
5628ALIAS (clear_bgp_peer_soft_in,
5629 clear_bgp_ipv6_peer_in_cmd,
5630 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5631 CLEAR_STR
5632 BGP_STR
5633 "Address family\n"
5634 "BGP neighbor address to clear\n"
5635 "BGP IPv6 neighbor to clear\n"
5636 "Soft reconfig inbound update\n")
5637
5638DEFUN (clear_bgp_peer_in_prefix_filter,
5639 clear_bgp_peer_in_prefix_filter_cmd,
5640 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5641 CLEAR_STR
5642 BGP_STR
5643 "BGP neighbor address to clear\n"
5644 "BGP IPv6 neighbor to clear\n"
5645 "Soft reconfig inbound update\n"
5646 "Push out the existing ORF prefix-list\n")
5647{
5648 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5649 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5650}
5651
5652ALIAS (clear_bgp_peer_in_prefix_filter,
5653 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5654 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5655 CLEAR_STR
5656 BGP_STR
5657 "Address family\n"
5658 "BGP neighbor address to clear\n"
5659 "BGP IPv6 neighbor to clear\n"
5660 "Soft reconfig inbound update\n"
5661 "Push out the existing ORF prefix-list\n")
5662
5663DEFUN (clear_ip_bgp_peer_group_soft_in,
5664 clear_ip_bgp_peer_group_soft_in_cmd,
5665 "clear ip bgp peer-group WORD soft in",
5666 CLEAR_STR
5667 IP_STR
5668 BGP_STR
5669 "Clear all members of peer-group\n"
5670 "BGP peer-group name\n"
5671 "Soft reconfig\n"
5672 "Soft reconfig inbound update\n")
5673{
5674 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5675 BGP_CLEAR_SOFT_IN, argv[0]);
5676}
5677
5678ALIAS (clear_ip_bgp_peer_group_soft_in,
5679 clear_ip_bgp_peer_group_in_cmd,
5680 "clear ip bgp peer-group WORD in",
5681 CLEAR_STR
5682 IP_STR
5683 BGP_STR
5684 "Clear all members of peer-group\n"
5685 "BGP peer-group name\n"
5686 "Soft reconfig inbound update\n")
5687
5688DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
5689 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
5690 "clear ip bgp peer-group WORD in prefix-filter",
5691 CLEAR_STR
5692 IP_STR
5693 BGP_STR
5694 "Clear all members of peer-group\n"
5695 "BGP peer-group name\n"
5696 "Soft reconfig inbound update\n"
5697 "Push out prefix-list ORF and do inbound soft reconfig\n")
5698{
5699 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5700 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5701}
5702
5703DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
5704 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
5705 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
5706 CLEAR_STR
5707 IP_STR
5708 BGP_STR
5709 "Clear all members of peer-group\n"
5710 "BGP peer-group name\n"
5711 "Address family\n"
5712 "Address Family modifier\n"
5713 "Address Family modifier\n"
5714 "Soft reconfig\n"
5715 "Soft reconfig inbound update\n")
5716{
5717 if (strncmp (argv[1], "m", 1) == 0)
5718 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5719 BGP_CLEAR_SOFT_IN, argv[0]);
5720
5721 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5722 BGP_CLEAR_SOFT_IN, argv[0]);
5723}
5724
5725ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
5726 clear_ip_bgp_peer_group_ipv4_in_cmd,
5727 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
5728 CLEAR_STR
5729 IP_STR
5730 BGP_STR
5731 "Clear all members of peer-group\n"
5732 "BGP peer-group name\n"
5733 "Address family\n"
5734 "Address Family modifier\n"
5735 "Address Family modifier\n"
5736 "Soft reconfig inbound update\n")
5737
5738DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
5739 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
5740 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
5741 CLEAR_STR
5742 IP_STR
5743 BGP_STR
5744 "Clear all members of peer-group\n"
5745 "BGP peer-group name\n"
5746 "Address family\n"
5747 "Address Family modifier\n"
5748 "Address Family modifier\n"
5749 "Soft reconfig inbound update\n"
5750 "Push out prefix-list ORF and do inbound soft reconfig\n")
5751{
5752 if (strncmp (argv[1], "m", 1) == 0)
5753 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5754 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5755
5756 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5757 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5758}
5759
5760DEFUN (clear_bgp_peer_group_soft_in,
5761 clear_bgp_peer_group_soft_in_cmd,
5762 "clear bgp peer-group WORD soft in",
5763 CLEAR_STR
5764 BGP_STR
5765 "Clear all members of peer-group\n"
5766 "BGP peer-group name\n"
5767 "Soft reconfig\n"
5768 "Soft reconfig inbound update\n")
5769{
5770 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5771 BGP_CLEAR_SOFT_IN, argv[0]);
5772}
5773
5774ALIAS (clear_bgp_peer_group_soft_in,
5775 clear_bgp_ipv6_peer_group_soft_in_cmd,
5776 "clear bgp ipv6 peer-group WORD soft in",
5777 CLEAR_STR
5778 BGP_STR
5779 "Address family\n"
5780 "Clear all members of peer-group\n"
5781 "BGP peer-group name\n"
5782 "Soft reconfig\n"
5783 "Soft reconfig inbound update\n")
5784
5785ALIAS (clear_bgp_peer_group_soft_in,
5786 clear_bgp_peer_group_in_cmd,
5787 "clear bgp peer-group WORD in",
5788 CLEAR_STR
5789 BGP_STR
5790 "Clear all members of peer-group\n"
5791 "BGP peer-group name\n"
5792 "Soft reconfig inbound update\n")
5793
5794ALIAS (clear_bgp_peer_group_soft_in,
5795 clear_bgp_ipv6_peer_group_in_cmd,
5796 "clear bgp ipv6 peer-group WORD in",
5797 CLEAR_STR
5798 BGP_STR
5799 "Address family\n"
5800 "Clear all members of peer-group\n"
5801 "BGP peer-group name\n"
5802 "Soft reconfig inbound update\n")
5803
5804DEFUN (clear_bgp_peer_group_in_prefix_filter,
5805 clear_bgp_peer_group_in_prefix_filter_cmd,
5806 "clear bgp peer-group WORD in prefix-filter",
5807 CLEAR_STR
5808 BGP_STR
5809 "Clear all members of peer-group\n"
5810 "BGP peer-group name\n"
5811 "Soft reconfig inbound update\n"
5812 "Push out prefix-list ORF and do inbound soft reconfig\n")
5813{
5814 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5815 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5816}
5817
5818ALIAS (clear_bgp_peer_group_in_prefix_filter,
5819 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
5820 "clear bgp ipv6 peer-group WORD in prefix-filter",
5821 CLEAR_STR
5822 BGP_STR
5823 "Address family\n"
5824 "Clear all members of peer-group\n"
5825 "BGP peer-group name\n"
5826 "Soft reconfig inbound update\n"
5827 "Push out prefix-list ORF and do inbound soft reconfig\n")
5828
5829DEFUN (clear_ip_bgp_external_soft_in,
5830 clear_ip_bgp_external_soft_in_cmd,
5831 "clear ip bgp external soft in",
5832 CLEAR_STR
5833 IP_STR
5834 BGP_STR
5835 "Clear all external peers\n"
5836 "Soft reconfig\n"
5837 "Soft reconfig inbound update\n")
5838{
5839 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5840 BGP_CLEAR_SOFT_IN, NULL);
5841}
5842
5843ALIAS (clear_ip_bgp_external_soft_in,
5844 clear_ip_bgp_external_in_cmd,
5845 "clear ip bgp external in",
5846 CLEAR_STR
5847 IP_STR
5848 BGP_STR
5849 "Clear all external peers\n"
5850 "Soft reconfig inbound update\n")
5851
5852DEFUN (clear_ip_bgp_external_in_prefix_filter,
5853 clear_ip_bgp_external_in_prefix_filter_cmd,
5854 "clear ip bgp external in prefix-filter",
5855 CLEAR_STR
5856 IP_STR
5857 BGP_STR
5858 "Clear all external peers\n"
5859 "Soft reconfig inbound update\n"
5860 "Push out prefix-list ORF and do inbound soft reconfig\n")
5861{
5862 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5863 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5864}
5865
5866DEFUN (clear_ip_bgp_external_ipv4_soft_in,
5867 clear_ip_bgp_external_ipv4_soft_in_cmd,
5868 "clear ip bgp external ipv4 (unicast|multicast) soft in",
5869 CLEAR_STR
5870 IP_STR
5871 BGP_STR
5872 "Clear all external peers\n"
5873 "Address family\n"
5874 "Address Family modifier\n"
5875 "Address Family modifier\n"
5876 "Soft reconfig\n"
5877 "Soft reconfig inbound update\n")
5878{
5879 if (strncmp (argv[0], "m", 1) == 0)
5880 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5881 BGP_CLEAR_SOFT_IN, NULL);
5882
5883 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5884 BGP_CLEAR_SOFT_IN, NULL);
5885}
5886
5887ALIAS (clear_ip_bgp_external_ipv4_soft_in,
5888 clear_ip_bgp_external_ipv4_in_cmd,
5889 "clear ip bgp external ipv4 (unicast|multicast) in",
5890 CLEAR_STR
5891 IP_STR
5892 BGP_STR
5893 "Clear all external peers\n"
5894 "Address family\n"
5895 "Address Family modifier\n"
5896 "Address Family modifier\n"
5897 "Soft reconfig inbound update\n")
5898
5899DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
5900 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
5901 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
5902 CLEAR_STR
5903 IP_STR
5904 BGP_STR
5905 "Clear all external peers\n"
5906 "Address family\n"
5907 "Address Family modifier\n"
5908 "Address Family modifier\n"
5909 "Soft reconfig inbound update\n"
5910 "Push out prefix-list ORF and do inbound soft reconfig\n")
5911{
5912 if (strncmp (argv[0], "m", 1) == 0)
5913 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5914 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5915
5916 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5917 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5918}
5919
5920DEFUN (clear_bgp_external_soft_in,
5921 clear_bgp_external_soft_in_cmd,
5922 "clear bgp external soft in",
5923 CLEAR_STR
5924 BGP_STR
5925 "Clear all external peers\n"
5926 "Soft reconfig\n"
5927 "Soft reconfig inbound update\n")
5928{
5929 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5930 BGP_CLEAR_SOFT_IN, NULL);
5931}
5932
5933ALIAS (clear_bgp_external_soft_in,
5934 clear_bgp_ipv6_external_soft_in_cmd,
5935 "clear bgp ipv6 external soft in",
5936 CLEAR_STR
5937 BGP_STR
5938 "Address family\n"
5939 "Clear all external peers\n"
5940 "Soft reconfig\n"
5941 "Soft reconfig inbound update\n")
5942
5943ALIAS (clear_bgp_external_soft_in,
5944 clear_bgp_external_in_cmd,
5945 "clear bgp external in",
5946 CLEAR_STR
5947 BGP_STR
5948 "Clear all external peers\n"
5949 "Soft reconfig inbound update\n")
5950
5951ALIAS (clear_bgp_external_soft_in,
5952 clear_bgp_ipv6_external_in_cmd,
5953 "clear bgp ipv6 external WORD in",
5954 CLEAR_STR
5955 BGP_STR
5956 "Address family\n"
5957 "Clear all external peers\n"
5958 "Soft reconfig inbound update\n")
5959
5960DEFUN (clear_bgp_external_in_prefix_filter,
5961 clear_bgp_external_in_prefix_filter_cmd,
5962 "clear bgp external in prefix-filter",
5963 CLEAR_STR
5964 BGP_STR
5965 "Clear all external peers\n"
5966 "Soft reconfig inbound update\n"
5967 "Push out prefix-list ORF and do inbound soft reconfig\n")
5968{
5969 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5970 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5971}
5972
5973ALIAS (clear_bgp_external_in_prefix_filter,
5974 clear_bgp_ipv6_external_in_prefix_filter_cmd,
5975 "clear bgp ipv6 external in prefix-filter",
5976 CLEAR_STR
5977 BGP_STR
5978 "Address family\n"
5979 "Clear all external peers\n"
5980 "Soft reconfig inbound update\n"
5981 "Push out prefix-list ORF and do inbound soft reconfig\n")
5982
5983DEFUN (clear_ip_bgp_as_soft_in,
5984 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005985 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00005986 CLEAR_STR
5987 IP_STR
5988 BGP_STR
5989 "Clear peers with the AS number\n"
5990 "Soft reconfig\n"
5991 "Soft reconfig inbound update\n")
5992{
5993 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5994 BGP_CLEAR_SOFT_IN, argv[0]);
5995}
5996
5997ALIAS (clear_ip_bgp_as_soft_in,
5998 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005999 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006000 CLEAR_STR
6001 IP_STR
6002 BGP_STR
6003 "Clear peers with the AS number\n"
6004 "Soft reconfig inbound update\n")
6005
6006DEFUN (clear_ip_bgp_as_in_prefix_filter,
6007 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006008 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006009 CLEAR_STR
6010 IP_STR
6011 BGP_STR
6012 "Clear peers with the AS number\n"
6013 "Soft reconfig inbound update\n"
6014 "Push out prefix-list ORF and do inbound soft reconfig\n")
6015{
6016 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6017 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6018}
6019
6020DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6021 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006022 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006023 CLEAR_STR
6024 IP_STR
6025 BGP_STR
6026 "Clear peers with the AS number\n"
6027 "Address family\n"
6028 "Address Family modifier\n"
6029 "Address Family modifier\n"
6030 "Soft reconfig\n"
6031 "Soft reconfig inbound update\n")
6032{
6033 if (strncmp (argv[1], "m", 1) == 0)
6034 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6035 BGP_CLEAR_SOFT_IN, argv[0]);
6036
6037 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6038 BGP_CLEAR_SOFT_IN, argv[0]);
6039}
6040
6041ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6042 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006043 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00006044 CLEAR_STR
6045 IP_STR
6046 BGP_STR
6047 "Clear peers with the AS number\n"
6048 "Address family\n"
6049 "Address Family modifier\n"
6050 "Address Family modifier\n"
6051 "Soft reconfig inbound update\n")
6052
6053DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6054 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006055 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006056 CLEAR_STR
6057 IP_STR
6058 BGP_STR
6059 "Clear peers with the AS number\n"
6060 "Address family\n"
6061 "Address Family modifier\n"
6062 "Address Family modifier\n"
6063 "Soft reconfig inbound update\n"
6064 "Push out prefix-list ORF and do inbound soft reconfig\n")
6065{
6066 if (strncmp (argv[1], "m", 1) == 0)
6067 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6068 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6069
6070 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6071 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6072}
6073
6074DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6075 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006076 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00006077 CLEAR_STR
6078 IP_STR
6079 BGP_STR
6080 "Clear peers with the AS number\n"
6081 "Address family\n"
6082 "Address Family modifier\n"
6083 "Soft reconfig\n"
6084 "Soft reconfig inbound update\n")
6085{
6086 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6087 BGP_CLEAR_SOFT_IN, argv[0]);
6088}
6089
6090ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6091 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006092 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006093 CLEAR_STR
6094 IP_STR
6095 BGP_STR
6096 "Clear peers with the AS number\n"
6097 "Address family\n"
6098 "Address Family modifier\n"
6099 "Soft reconfig inbound update\n")
6100
6101DEFUN (clear_bgp_as_soft_in,
6102 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006103 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006104 CLEAR_STR
6105 BGP_STR
6106 "Clear peers with the AS number\n"
6107 "Soft reconfig\n"
6108 "Soft reconfig inbound update\n")
6109{
6110 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6111 BGP_CLEAR_SOFT_IN, argv[0]);
6112}
6113
6114ALIAS (clear_bgp_as_soft_in,
6115 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006116 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006117 CLEAR_STR
6118 BGP_STR
6119 "Address family\n"
6120 "Clear peers with the AS number\n"
6121 "Soft reconfig\n"
6122 "Soft reconfig inbound update\n")
6123
6124ALIAS (clear_bgp_as_soft_in,
6125 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006126 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006127 CLEAR_STR
6128 BGP_STR
6129 "Clear peers with the AS number\n"
6130 "Soft reconfig inbound update\n")
6131
6132ALIAS (clear_bgp_as_soft_in,
6133 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006134 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006135 CLEAR_STR
6136 BGP_STR
6137 "Address family\n"
6138 "Clear peers with the AS number\n"
6139 "Soft reconfig inbound update\n")
6140
6141DEFUN (clear_bgp_as_in_prefix_filter,
6142 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006143 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006144 CLEAR_STR
6145 BGP_STR
6146 "Clear peers with the AS number\n"
6147 "Soft reconfig inbound update\n"
6148 "Push out prefix-list ORF and do inbound soft reconfig\n")
6149{
6150 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6151 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6152}
6153
6154ALIAS (clear_bgp_as_in_prefix_filter,
6155 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006156 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006157 CLEAR_STR
6158 BGP_STR
6159 "Address family\n"
6160 "Clear peers with the AS number\n"
6161 "Soft reconfig inbound update\n"
6162 "Push out prefix-list ORF and do inbound soft reconfig\n")
6163
6164/* Both soft-reconfiguration */
6165DEFUN (clear_ip_bgp_all_soft,
6166 clear_ip_bgp_all_soft_cmd,
6167 "clear ip bgp * soft",
6168 CLEAR_STR
6169 IP_STR
6170 BGP_STR
6171 "Clear all peers\n"
6172 "Soft reconfig\n")
6173{
6174 if (argc == 1)
6175 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6176 BGP_CLEAR_SOFT_BOTH, NULL);
6177
6178 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6179 BGP_CLEAR_SOFT_BOTH, NULL);
6180}
6181
6182ALIAS (clear_ip_bgp_all_soft,
6183 clear_ip_bgp_instance_all_soft_cmd,
6184 "clear ip bgp view WORD * soft",
6185 CLEAR_STR
6186 IP_STR
6187 BGP_STR
6188 "BGP view\n"
6189 "view name\n"
6190 "Clear all peers\n"
6191 "Soft reconfig\n")
6192
6193
6194DEFUN (clear_ip_bgp_all_ipv4_soft,
6195 clear_ip_bgp_all_ipv4_soft_cmd,
6196 "clear ip bgp * ipv4 (unicast|multicast) soft",
6197 CLEAR_STR
6198 IP_STR
6199 BGP_STR
6200 "Clear all peers\n"
6201 "Address family\n"
6202 "Address Family Modifier\n"
6203 "Address Family Modifier\n"
6204 "Soft reconfig\n")
6205{
6206 if (strncmp (argv[0], "m", 1) == 0)
6207 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6208 BGP_CLEAR_SOFT_BOTH, NULL);
6209
6210 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6211 BGP_CLEAR_SOFT_BOTH, NULL);
6212}
6213
6214DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6215 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6216 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6217 CLEAR_STR
6218 IP_STR
6219 BGP_STR
6220 "BGP view\n"
6221 "view name\n"
6222 "Clear all peers\n"
6223 "Address family\n"
6224 "Address Family Modifier\n"
6225 "Address Family Modifier\n"
6226 "Soft reconfig\n")
6227{
6228 if (strncmp (argv[1], "m", 1) == 0)
6229 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6230 BGP_CLEAR_SOFT_BOTH, NULL);
6231
6232 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6233 BGP_CLEAR_SOFT_BOTH, NULL);
6234}
6235
6236DEFUN (clear_ip_bgp_all_vpnv4_soft,
6237 clear_ip_bgp_all_vpnv4_soft_cmd,
6238 "clear ip bgp * vpnv4 unicast soft",
6239 CLEAR_STR
6240 IP_STR
6241 BGP_STR
6242 "Clear all peers\n"
6243 "Address family\n"
6244 "Address Family Modifier\n"
6245 "Soft reconfig\n")
6246{
6247 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6248 BGP_CLEAR_SOFT_BOTH, argv[0]);
6249}
6250
6251DEFUN (clear_bgp_all_soft,
6252 clear_bgp_all_soft_cmd,
6253 "clear bgp * soft",
6254 CLEAR_STR
6255 BGP_STR
6256 "Clear all peers\n"
6257 "Soft reconfig\n")
6258{
6259 if (argc == 1)
6260 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6261 BGP_CLEAR_SOFT_BOTH, argv[0]);
6262
6263 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6264 BGP_CLEAR_SOFT_BOTH, argv[0]);
6265}
6266
6267ALIAS (clear_bgp_all_soft,
6268 clear_bgp_instance_all_soft_cmd,
6269 "clear bgp view WORD * soft",
6270 CLEAR_STR
6271 BGP_STR
6272 "BGP view\n"
6273 "view name\n"
6274 "Clear all peers\n"
6275 "Soft reconfig\n")
6276
6277ALIAS (clear_bgp_all_soft,
6278 clear_bgp_ipv6_all_soft_cmd,
6279 "clear bgp ipv6 * soft",
6280 CLEAR_STR
6281 BGP_STR
6282 "Address family\n"
6283 "Clear all peers\n"
6284 "Soft reconfig\n")
6285
6286DEFUN (clear_ip_bgp_peer_soft,
6287 clear_ip_bgp_peer_soft_cmd,
6288 "clear ip bgp A.B.C.D soft",
6289 CLEAR_STR
6290 IP_STR
6291 BGP_STR
6292 "BGP neighbor address to clear\n"
6293 "Soft reconfig\n")
6294{
6295 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6296 BGP_CLEAR_SOFT_BOTH, argv[0]);
6297}
6298
6299DEFUN (clear_ip_bgp_peer_ipv4_soft,
6300 clear_ip_bgp_peer_ipv4_soft_cmd,
6301 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6302 CLEAR_STR
6303 IP_STR
6304 BGP_STR
6305 "BGP neighbor address to clear\n"
6306 "Address family\n"
6307 "Address Family Modifier\n"
6308 "Address Family Modifier\n"
6309 "Soft reconfig\n")
6310{
6311 if (strncmp (argv[1], "m", 1) == 0)
6312 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6313 BGP_CLEAR_SOFT_BOTH, argv[0]);
6314
6315 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6316 BGP_CLEAR_SOFT_BOTH, argv[0]);
6317}
6318
6319DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6320 clear_ip_bgp_peer_vpnv4_soft_cmd,
6321 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6322 CLEAR_STR
6323 IP_STR
6324 BGP_STR
6325 "BGP neighbor address to clear\n"
6326 "Address family\n"
6327 "Address Family Modifier\n"
6328 "Soft reconfig\n")
6329{
6330 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6331 BGP_CLEAR_SOFT_BOTH, argv[0]);
6332}
6333
6334DEFUN (clear_bgp_peer_soft,
6335 clear_bgp_peer_soft_cmd,
6336 "clear bgp (A.B.C.D|X:X::X:X) soft",
6337 CLEAR_STR
6338 BGP_STR
6339 "BGP neighbor address to clear\n"
6340 "BGP IPv6 neighbor to clear\n"
6341 "Soft reconfig\n")
6342{
6343 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6344 BGP_CLEAR_SOFT_BOTH, argv[0]);
6345}
6346
6347ALIAS (clear_bgp_peer_soft,
6348 clear_bgp_ipv6_peer_soft_cmd,
6349 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6350 CLEAR_STR
6351 BGP_STR
6352 "Address family\n"
6353 "BGP neighbor address to clear\n"
6354 "BGP IPv6 neighbor to clear\n"
6355 "Soft reconfig\n")
6356
6357DEFUN (clear_ip_bgp_peer_group_soft,
6358 clear_ip_bgp_peer_group_soft_cmd,
6359 "clear ip bgp peer-group WORD soft",
6360 CLEAR_STR
6361 IP_STR
6362 BGP_STR
6363 "Clear all members of peer-group\n"
6364 "BGP peer-group name\n"
6365 "Soft reconfig\n")
6366{
6367 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6368 BGP_CLEAR_SOFT_BOTH, argv[0]);
6369}
6370
6371DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6372 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6373 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6374 CLEAR_STR
6375 IP_STR
6376 BGP_STR
6377 "Clear all members of peer-group\n"
6378 "BGP peer-group name\n"
6379 "Address family\n"
6380 "Address Family modifier\n"
6381 "Address Family modifier\n"
6382 "Soft reconfig\n")
6383{
6384 if (strncmp (argv[1], "m", 1) == 0)
6385 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6386 BGP_CLEAR_SOFT_BOTH, argv[0]);
6387
6388 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6389 BGP_CLEAR_SOFT_BOTH, argv[0]);
6390}
6391
6392DEFUN (clear_bgp_peer_group_soft,
6393 clear_bgp_peer_group_soft_cmd,
6394 "clear bgp peer-group WORD soft",
6395 CLEAR_STR
6396 BGP_STR
6397 "Clear all members of peer-group\n"
6398 "BGP peer-group name\n"
6399 "Soft reconfig\n")
6400{
6401 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6402 BGP_CLEAR_SOFT_BOTH, argv[0]);
6403}
6404
6405ALIAS (clear_bgp_peer_group_soft,
6406 clear_bgp_ipv6_peer_group_soft_cmd,
6407 "clear bgp ipv6 peer-group WORD soft",
6408 CLEAR_STR
6409 BGP_STR
6410 "Address family\n"
6411 "Clear all members of peer-group\n"
6412 "BGP peer-group name\n"
6413 "Soft reconfig\n")
6414
6415DEFUN (clear_ip_bgp_external_soft,
6416 clear_ip_bgp_external_soft_cmd,
6417 "clear ip bgp external soft",
6418 CLEAR_STR
6419 IP_STR
6420 BGP_STR
6421 "Clear all external peers\n"
6422 "Soft reconfig\n")
6423{
6424 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6425 BGP_CLEAR_SOFT_BOTH, NULL);
6426}
6427
6428DEFUN (clear_ip_bgp_external_ipv4_soft,
6429 clear_ip_bgp_external_ipv4_soft_cmd,
6430 "clear ip bgp external ipv4 (unicast|multicast) soft",
6431 CLEAR_STR
6432 IP_STR
6433 BGP_STR
6434 "Clear all external peers\n"
6435 "Address family\n"
6436 "Address Family modifier\n"
6437 "Address Family modifier\n"
6438 "Soft reconfig\n")
6439{
6440 if (strncmp (argv[0], "m", 1) == 0)
6441 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6442 BGP_CLEAR_SOFT_BOTH, NULL);
6443
6444 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6445 BGP_CLEAR_SOFT_BOTH, NULL);
6446}
6447
6448DEFUN (clear_bgp_external_soft,
6449 clear_bgp_external_soft_cmd,
6450 "clear bgp external soft",
6451 CLEAR_STR
6452 BGP_STR
6453 "Clear all external peers\n"
6454 "Soft reconfig\n")
6455{
6456 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6457 BGP_CLEAR_SOFT_BOTH, NULL);
6458}
6459
6460ALIAS (clear_bgp_external_soft,
6461 clear_bgp_ipv6_external_soft_cmd,
6462 "clear bgp ipv6 external soft",
6463 CLEAR_STR
6464 BGP_STR
6465 "Address family\n"
6466 "Clear all external peers\n"
6467 "Soft reconfig\n")
6468
6469DEFUN (clear_ip_bgp_as_soft,
6470 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006471 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006472 CLEAR_STR
6473 IP_STR
6474 BGP_STR
6475 "Clear peers with the AS number\n"
6476 "Soft reconfig\n")
6477{
6478 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6479 BGP_CLEAR_SOFT_BOTH, argv[0]);
6480}
6481
6482DEFUN (clear_ip_bgp_as_ipv4_soft,
6483 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006484 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006485 CLEAR_STR
6486 IP_STR
6487 BGP_STR
6488 "Clear peers with the AS number\n"
6489 "Address family\n"
6490 "Address Family Modifier\n"
6491 "Address Family Modifier\n"
6492 "Soft reconfig\n")
6493{
6494 if (strncmp (argv[1], "m", 1) == 0)
6495 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6496 BGP_CLEAR_SOFT_BOTH, argv[0]);
6497
6498 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6499 BGP_CLEAR_SOFT_BOTH, argv[0]);
6500}
6501
6502DEFUN (clear_ip_bgp_as_vpnv4_soft,
6503 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006504 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00006505 CLEAR_STR
6506 IP_STR
6507 BGP_STR
6508 "Clear peers with the AS number\n"
6509 "Address family\n"
6510 "Address Family Modifier\n"
6511 "Soft reconfig\n")
6512{
6513 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6514 BGP_CLEAR_SOFT_BOTH, argv[0]);
6515}
6516
6517DEFUN (clear_bgp_as_soft,
6518 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006519 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006520 CLEAR_STR
6521 BGP_STR
6522 "Clear peers with the AS number\n"
6523 "Soft reconfig\n")
6524{
6525 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6526 BGP_CLEAR_SOFT_BOTH, argv[0]);
6527}
6528
6529ALIAS (clear_bgp_as_soft,
6530 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006531 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006532 CLEAR_STR
6533 BGP_STR
6534 "Address family\n"
6535 "Clear peers with the AS number\n"
6536 "Soft reconfig\n")
6537
paulfee0f4c2004-09-13 05:12:46 +00006538/* RS-client soft reconfiguration. */
6539#ifdef HAVE_IPV6
6540DEFUN (clear_bgp_all_rsclient,
6541 clear_bgp_all_rsclient_cmd,
6542 "clear bgp * rsclient",
6543 CLEAR_STR
6544 BGP_STR
6545 "Clear all peers\n"
6546 "Soft reconfig for rsclient RIB\n")
6547{
6548 if (argc == 1)
6549 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6550 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6551
6552 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6553 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6554}
6555
6556ALIAS (clear_bgp_all_rsclient,
6557 clear_bgp_ipv6_all_rsclient_cmd,
6558 "clear bgp ipv6 * rsclient",
6559 CLEAR_STR
6560 BGP_STR
6561 "Address family\n"
6562 "Clear all peers\n"
6563 "Soft reconfig for rsclient RIB\n")
6564
6565ALIAS (clear_bgp_all_rsclient,
6566 clear_bgp_instance_all_rsclient_cmd,
6567 "clear bgp view WORD * rsclient",
6568 CLEAR_STR
6569 BGP_STR
6570 "BGP view\n"
6571 "view name\n"
6572 "Clear all peers\n"
6573 "Soft reconfig for rsclient RIB\n")
6574
6575ALIAS (clear_bgp_all_rsclient,
6576 clear_bgp_ipv6_instance_all_rsclient_cmd,
6577 "clear bgp ipv6 view WORD * rsclient",
6578 CLEAR_STR
6579 BGP_STR
6580 "Address family\n"
6581 "BGP view\n"
6582 "view name\n"
6583 "Clear all peers\n"
6584 "Soft reconfig for rsclient RIB\n")
6585#endif /* HAVE_IPV6 */
6586
6587DEFUN (clear_ip_bgp_all_rsclient,
6588 clear_ip_bgp_all_rsclient_cmd,
6589 "clear ip bgp * rsclient",
6590 CLEAR_STR
6591 IP_STR
6592 BGP_STR
6593 "Clear all peers\n"
6594 "Soft reconfig for rsclient RIB\n")
6595{
6596 if (argc == 1)
6597 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6598 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6599
6600 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6601 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6602}
6603
6604ALIAS (clear_ip_bgp_all_rsclient,
6605 clear_ip_bgp_instance_all_rsclient_cmd,
6606 "clear ip bgp view WORD * rsclient",
6607 CLEAR_STR
6608 IP_STR
6609 BGP_STR
6610 "BGP view\n"
6611 "view name\n"
6612 "Clear all peers\n"
6613 "Soft reconfig for rsclient RIB\n")
6614
6615#ifdef HAVE_IPV6
6616DEFUN (clear_bgp_peer_rsclient,
6617 clear_bgp_peer_rsclient_cmd,
6618 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
6619 CLEAR_STR
6620 BGP_STR
6621 "BGP neighbor IP address to clear\n"
6622 "BGP IPv6 neighbor to clear\n"
6623 "Soft reconfig for rsclient RIB\n")
6624{
6625 if (argc == 2)
6626 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
6627 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6628
6629 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6630 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6631}
6632
6633ALIAS (clear_bgp_peer_rsclient,
6634 clear_bgp_ipv6_peer_rsclient_cmd,
6635 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
6636 CLEAR_STR
6637 BGP_STR
6638 "Address family\n"
6639 "BGP neighbor IP address to clear\n"
6640 "BGP IPv6 neighbor to clear\n"
6641 "Soft reconfig for rsclient RIB\n")
6642
6643ALIAS (clear_bgp_peer_rsclient,
6644 clear_bgp_instance_peer_rsclient_cmd,
6645 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6646 CLEAR_STR
6647 BGP_STR
6648 "BGP view\n"
6649 "view name\n"
6650 "BGP neighbor IP address to clear\n"
6651 "BGP IPv6 neighbor to clear\n"
6652 "Soft reconfig for rsclient RIB\n")
6653
6654ALIAS (clear_bgp_peer_rsclient,
6655 clear_bgp_ipv6_instance_peer_rsclient_cmd,
6656 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
6657 CLEAR_STR
6658 BGP_STR
6659 "Address family\n"
6660 "BGP view\n"
6661 "view name\n"
6662 "BGP neighbor IP address to clear\n"
6663 "BGP IPv6 neighbor to clear\n"
6664 "Soft reconfig for rsclient RIB\n")
6665#endif /* HAVE_IPV6 */
6666
6667DEFUN (clear_ip_bgp_peer_rsclient,
6668 clear_ip_bgp_peer_rsclient_cmd,
6669 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
6670 CLEAR_STR
6671 IP_STR
6672 BGP_STR
6673 "BGP neighbor IP address to clear\n"
6674 "BGP IPv6 neighbor to clear\n"
6675 "Soft reconfig for rsclient RIB\n")
6676{
6677 if (argc == 2)
6678 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
6679 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6680
6681 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6682 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6683}
6684
6685ALIAS (clear_ip_bgp_peer_rsclient,
6686 clear_ip_bgp_instance_peer_rsclient_cmd,
6687 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6688 CLEAR_STR
6689 IP_STR
6690 BGP_STR
6691 "BGP view\n"
6692 "view name\n"
6693 "BGP neighbor IP address to clear\n"
6694 "BGP IPv6 neighbor to clear\n"
6695 "Soft reconfig for rsclient RIB\n")
6696
Michael Lamberte0081f72008-11-16 20:12:04 +00006697DEFUN (show_bgp_views,
6698 show_bgp_views_cmd,
6699 "show bgp views",
6700 SHOW_STR
6701 BGP_STR
6702 "Show the defined BGP views\n")
6703{
6704 struct list *inst = bm->bgp;
6705 struct listnode *node;
6706 struct bgp *bgp;
6707
6708 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
6709 {
6710 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
6711 return CMD_WARNING;
6712 }
6713
6714 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
6715 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
6716 vty_out (vty, "\t%s (AS%u)%s",
6717 bgp->name ? bgp->name : "(null)",
6718 bgp->as, VTY_NEWLINE);
6719
6720 return CMD_SUCCESS;
6721}
6722
Paul Jakma4bf6a362006-03-30 14:05:23 +00006723DEFUN (show_bgp_memory,
6724 show_bgp_memory_cmd,
6725 "show bgp memory",
6726 SHOW_STR
6727 BGP_STR
6728 "Global BGP memory statistics\n")
6729{
6730 char memstrbuf[MTYPE_MEMSTR_LEN];
6731 unsigned long count;
6732
6733 /* RIB related usage stats */
6734 count = mtype_stats_alloc (MTYPE_BGP_NODE);
6735 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
6736 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6737 count * sizeof (struct bgp_node)),
6738 VTY_NEWLINE);
6739
6740 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
6741 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
6742 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6743 count * sizeof (struct bgp_info)),
6744 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006745 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
6746 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
6747 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6748 count * sizeof (struct bgp_info_extra)),
6749 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006750
6751 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
6752 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
6753 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6754 count * sizeof (struct bgp_static)),
6755 VTY_NEWLINE);
6756
6757 /* Adj-In/Out */
6758 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
6759 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
6760 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6761 count * sizeof (struct bgp_adj_in)),
6762 VTY_NEWLINE);
6763 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
6764 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
6765 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6766 count * sizeof (struct bgp_adj_out)),
6767 VTY_NEWLINE);
6768
6769 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
6770 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
6771 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6772 count * sizeof (struct bgp_nexthop_cache)),
6773 VTY_NEWLINE);
6774
6775 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
6776 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
6777 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6778 count * sizeof (struct bgp_damp_info)),
6779 VTY_NEWLINE);
6780
6781 /* Attributes */
6782 count = attr_count();
6783 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
6784 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6785 count * sizeof(struct attr)),
6786 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006787 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
6788 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
6789 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6790 count * sizeof(struct attr_extra)),
6791 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006792
6793 if ((count = attr_unknown_count()))
6794 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
6795
6796 /* AS_PATH attributes */
6797 count = aspath_count ();
6798 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
6799 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6800 count * sizeof (struct aspath)),
6801 VTY_NEWLINE);
6802
6803 count = mtype_stats_alloc (MTYPE_AS_SEG);
6804 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
6805 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6806 count * sizeof (struct assegment)),
6807 VTY_NEWLINE);
6808
6809 /* Other attributes */
6810 if ((count = community_count ()))
6811 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6812 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6813 count * sizeof (struct community)),
6814 VTY_NEWLINE);
6815 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
6816 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6817 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6818 count * sizeof (struct ecommunity)),
6819 VTY_NEWLINE);
6820
6821 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
6822 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
6823 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6824 count * sizeof (struct cluster_list)),
6825 VTY_NEWLINE);
6826
6827 /* Peer related usage */
6828 count = mtype_stats_alloc (MTYPE_BGP_PEER);
6829 vty_out (vty, "%ld peers, using %s of memory%s", count,
6830 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6831 count * sizeof (struct peer)),
6832 VTY_NEWLINE);
6833
6834 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
6835 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
6836 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6837 count * sizeof (struct peer_group)),
6838 VTY_NEWLINE);
6839
6840 /* Other */
6841 if ((count = mtype_stats_alloc (MTYPE_HASH)))
6842 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
6843 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6844 count * sizeof (struct hash)),
6845 VTY_NEWLINE);
6846 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
6847 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
6848 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6849 count * sizeof (struct hash_backet)),
6850 VTY_NEWLINE);
6851 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
6852 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
6853 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6854 count * sizeof (regex_t)),
6855 VTY_NEWLINE);
6856 return CMD_SUCCESS;
6857}
paulfee0f4c2004-09-13 05:12:46 +00006858
paul718e3742002-12-13 20:15:29 +00006859/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00006860static int
paul718e3742002-12-13 20:15:29 +00006861bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
6862{
6863 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00006864 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00006865 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00006866 char timebuf[BGP_UPTIME_LEN];
6867 int len;
6868
6869 /* Header string for each address family. */
6870 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00006871
paul1eb8ef22005-04-07 07:30:20 +00006872 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00006873 {
6874 if (peer->afc[afi][safi])
6875 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00006876 if (!count)
6877 {
6878 unsigned long ents;
6879 char memstrbuf[MTYPE_MEMSTR_LEN];
6880
6881 /* Usage summary and header */
6882 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04006883 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00006884 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006885
Paul Jakma4bf6a362006-03-30 14:05:23 +00006886 ents = bgp_table_count (bgp->rib[afi][safi]);
6887 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
6888 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6889 ents * sizeof (struct bgp_node)),
6890 VTY_NEWLINE);
6891
6892 /* Peer related usage */
6893 ents = listcount (bgp->peer);
6894 vty_out (vty, "Peers %ld, using %s of memory%s",
6895 ents,
6896 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6897 ents * sizeof (struct peer)),
6898 VTY_NEWLINE);
6899
6900 if ((ents = listcount (bgp->rsclient)))
6901 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
6902 ents,
6903 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6904 ents * sizeof (struct peer)),
6905 VTY_NEWLINE);
6906
6907 if ((ents = listcount (bgp->group)))
6908 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
6909 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6910 ents * sizeof (struct peer_group)),
6911 VTY_NEWLINE);
6912
6913 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
6914 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
6915 vty_out (vty, "%s", VTY_NEWLINE);
6916 vty_out (vty, "%s%s", header, VTY_NEWLINE);
6917 }
6918
paul718e3742002-12-13 20:15:29 +00006919 count++;
6920
6921 len = vty_out (vty, "%s", peer->host);
6922 len = 16 - len;
6923 if (len < 1)
6924 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
6925 else
6926 vty_out (vty, "%*s", len, " ");
6927
hasso3d515fd2005-02-01 21:30:04 +00006928 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00006929
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04006930 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00006931 peer->as,
6932 peer->open_in + peer->update_in + peer->keepalive_in
6933 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
6934 peer->open_out + peer->update_out + peer->keepalive_out
6935 + peer->notify_out + peer->refresh_out
6936 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00006937 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00006938
6939 vty_out (vty, "%8s",
6940 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
6941
6942 if (peer->status == Established)
6943 {
6944 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
6945 }
6946 else
6947 {
6948 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
6949 vty_out (vty, " Idle (Admin)");
6950 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
6951 vty_out (vty, " Idle (PfxCt)");
6952 else
6953 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
6954 }
6955
6956 vty_out (vty, "%s", VTY_NEWLINE);
6957 }
6958 }
6959
6960 if (count)
6961 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
6962 count, VTY_NEWLINE);
6963 else
6964 vty_out (vty, "No %s neighbor is configured%s",
6965 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
6966 return CMD_SUCCESS;
6967}
6968
paul94f2b392005-06-28 12:44:16 +00006969static int
paulfd79ac92004-10-13 05:06:08 +00006970bgp_show_summary_vty (struct vty *vty, const char *name,
6971 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00006972{
6973 struct bgp *bgp;
6974
6975 if (name)
6976 {
6977 bgp = bgp_lookup_by_name (name);
6978
6979 if (! bgp)
6980 {
6981 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
6982 return CMD_WARNING;
6983 }
6984
6985 bgp_show_summary (vty, bgp, afi, safi);
6986 return CMD_SUCCESS;
6987 }
6988
6989 bgp = bgp_get_default ();
6990
6991 if (bgp)
6992 bgp_show_summary (vty, bgp, afi, safi);
6993
6994 return CMD_SUCCESS;
6995}
6996
6997/* `show ip bgp summary' commands. */
6998DEFUN (show_ip_bgp_summary,
6999 show_ip_bgp_summary_cmd,
7000 "show ip bgp summary",
7001 SHOW_STR
7002 IP_STR
7003 BGP_STR
7004 "Summary of BGP neighbor status\n")
7005{
7006 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7007}
7008
7009DEFUN (show_ip_bgp_instance_summary,
7010 show_ip_bgp_instance_summary_cmd,
7011 "show ip bgp view WORD summary",
7012 SHOW_STR
7013 IP_STR
7014 BGP_STR
7015 "BGP view\n"
7016 "View name\n"
7017 "Summary of BGP neighbor status\n")
7018{
7019 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7020}
7021
7022DEFUN (show_ip_bgp_ipv4_summary,
7023 show_ip_bgp_ipv4_summary_cmd,
7024 "show ip bgp ipv4 (unicast|multicast) summary",
7025 SHOW_STR
7026 IP_STR
7027 BGP_STR
7028 "Address family\n"
7029 "Address Family modifier\n"
7030 "Address Family modifier\n"
7031 "Summary of BGP neighbor status\n")
7032{
7033 if (strncmp (argv[0], "m", 1) == 0)
7034 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7035
7036 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7037}
7038
Michael Lambert95cbbd22010-07-23 14:43:04 -04007039ALIAS (show_ip_bgp_ipv4_summary,
7040 show_bgp_ipv4_safi_summary_cmd,
7041 "show bgp ipv4 (unicast|multicast) summary",
7042 SHOW_STR
7043 BGP_STR
7044 "Address family\n"
7045 "Address Family modifier\n"
7046 "Address Family modifier\n"
7047 "Summary of BGP neighbor status\n")
7048
paul718e3742002-12-13 20:15:29 +00007049DEFUN (show_ip_bgp_instance_ipv4_summary,
7050 show_ip_bgp_instance_ipv4_summary_cmd,
7051 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7052 SHOW_STR
7053 IP_STR
7054 BGP_STR
7055 "BGP view\n"
7056 "View name\n"
7057 "Address family\n"
7058 "Address Family modifier\n"
7059 "Address Family modifier\n"
7060 "Summary of BGP neighbor status\n")
7061{
7062 if (strncmp (argv[1], "m", 1) == 0)
7063 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7064 else
7065 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7066}
7067
Michael Lambert95cbbd22010-07-23 14:43:04 -04007068ALIAS (show_ip_bgp_instance_ipv4_summary,
7069 show_bgp_instance_ipv4_safi_summary_cmd,
7070 "show bgp view WORD ipv4 (unicast|multicast) summary",
7071 SHOW_STR
7072 BGP_STR
7073 "BGP view\n"
7074 "View name\n"
7075 "Address family\n"
7076 "Address Family modifier\n"
7077 "Address Family modifier\n"
7078 "Summary of BGP neighbor status\n")
7079
paul718e3742002-12-13 20:15:29 +00007080DEFUN (show_ip_bgp_vpnv4_all_summary,
7081 show_ip_bgp_vpnv4_all_summary_cmd,
7082 "show ip bgp vpnv4 all summary",
7083 SHOW_STR
7084 IP_STR
7085 BGP_STR
7086 "Display VPNv4 NLRI specific information\n"
7087 "Display information about all VPNv4 NLRIs\n"
7088 "Summary of BGP neighbor status\n")
7089{
7090 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7091}
7092
7093DEFUN (show_ip_bgp_vpnv4_rd_summary,
7094 show_ip_bgp_vpnv4_rd_summary_cmd,
7095 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7096 SHOW_STR
7097 IP_STR
7098 BGP_STR
7099 "Display VPNv4 NLRI specific information\n"
7100 "Display information for a route distinguisher\n"
7101 "VPN Route Distinguisher\n"
7102 "Summary of BGP neighbor status\n")
7103{
7104 int ret;
7105 struct prefix_rd prd;
7106
7107 ret = str2prefix_rd (argv[0], &prd);
7108 if (! ret)
7109 {
7110 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7111 return CMD_WARNING;
7112 }
7113
7114 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7115}
7116
7117#ifdef HAVE_IPV6
7118DEFUN (show_bgp_summary,
7119 show_bgp_summary_cmd,
7120 "show bgp summary",
7121 SHOW_STR
7122 BGP_STR
7123 "Summary of BGP neighbor status\n")
7124{
7125 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7126}
7127
7128DEFUN (show_bgp_instance_summary,
7129 show_bgp_instance_summary_cmd,
7130 "show bgp view WORD summary",
7131 SHOW_STR
7132 BGP_STR
7133 "BGP view\n"
7134 "View name\n"
7135 "Summary of BGP neighbor status\n")
7136{
7137 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7138}
7139
7140ALIAS (show_bgp_summary,
7141 show_bgp_ipv6_summary_cmd,
7142 "show bgp ipv6 summary",
7143 SHOW_STR
7144 BGP_STR
7145 "Address family\n"
7146 "Summary of BGP neighbor status\n")
7147
7148ALIAS (show_bgp_instance_summary,
7149 show_bgp_instance_ipv6_summary_cmd,
7150 "show bgp view WORD ipv6 summary",
7151 SHOW_STR
7152 BGP_STR
7153 "BGP view\n"
7154 "View name\n"
7155 "Address family\n"
7156 "Summary of BGP neighbor status\n")
7157
Michael Lambert95cbbd22010-07-23 14:43:04 -04007158DEFUN (show_bgp_ipv6_safi_summary,
7159 show_bgp_ipv6_safi_summary_cmd,
7160 "show bgp ipv6 (unicast|multicast) summary",
7161 SHOW_STR
7162 BGP_STR
7163 "Address family\n"
7164 "Address Family modifier\n"
7165 "Address Family modifier\n"
7166 "Summary of BGP neighbor status\n")
7167{
7168 if (strncmp (argv[0], "m", 1) == 0)
7169 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7170
7171 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7172}
7173
7174DEFUN (show_bgp_instance_ipv6_safi_summary,
7175 show_bgp_instance_ipv6_safi_summary_cmd,
7176 "show bgp view WORD ipv6 (unicast|multicast) summary",
7177 SHOW_STR
7178 BGP_STR
7179 "BGP view\n"
7180 "View name\n"
7181 "Address family\n"
7182 "Address Family modifier\n"
7183 "Address Family modifier\n"
7184 "Summary of BGP neighbor status\n")
7185{
7186 if (strncmp (argv[1], "m", 1) == 0)
7187 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7188
7189 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7190}
7191
paul718e3742002-12-13 20:15:29 +00007192/* old command */
7193DEFUN (show_ipv6_bgp_summary,
7194 show_ipv6_bgp_summary_cmd,
7195 "show ipv6 bgp summary",
7196 SHOW_STR
7197 IPV6_STR
7198 BGP_STR
7199 "Summary of BGP neighbor status\n")
7200{
7201 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7202}
7203
7204/* old command */
7205DEFUN (show_ipv6_mbgp_summary,
7206 show_ipv6_mbgp_summary_cmd,
7207 "show ipv6 mbgp summary",
7208 SHOW_STR
7209 IPV6_STR
7210 MBGP_STR
7211 "Summary of BGP neighbor status\n")
7212{
7213 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7214}
7215#endif /* HAVE_IPV6 */
7216
paulfd79ac92004-10-13 05:06:08 +00007217const char *
hasso538621f2004-05-21 09:31:30 +00007218afi_safi_print (afi_t afi, safi_t safi)
7219{
7220 if (afi == AFI_IP && safi == SAFI_UNICAST)
7221 return "IPv4 Unicast";
7222 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7223 return "IPv4 Multicast";
7224 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
7225 return "VPNv4 Unicast";
7226 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7227 return "IPv6 Unicast";
7228 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7229 return "IPv6 Multicast";
7230 else
7231 return "Unknown";
7232}
7233
paul718e3742002-12-13 20:15:29 +00007234/* Show BGP peer's information. */
7235enum show_type
7236{
7237 show_all,
7238 show_peer
7239};
7240
paul94f2b392005-06-28 12:44:16 +00007241static void
paul718e3742002-12-13 20:15:29 +00007242bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7243 afi_t afi, safi_t safi,
7244 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7245 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7246{
7247 /* Send-Mode */
7248 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7249 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7250 {
7251 vty_out (vty, " Send-mode: ");
7252 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7253 vty_out (vty, "advertised");
7254 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7255 vty_out (vty, "%sreceived",
7256 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7257 ", " : "");
7258 vty_out (vty, "%s", VTY_NEWLINE);
7259 }
7260
7261 /* Receive-Mode */
7262 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7263 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7264 {
7265 vty_out (vty, " Receive-mode: ");
7266 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7267 vty_out (vty, "advertised");
7268 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7269 vty_out (vty, "%sreceived",
7270 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7271 ", " : "");
7272 vty_out (vty, "%s", VTY_NEWLINE);
7273 }
7274}
7275
paul94f2b392005-06-28 12:44:16 +00007276static void
paul718e3742002-12-13 20:15:29 +00007277bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7278{
7279 struct bgp_filter *filter;
7280 char orf_pfx_name[BUFSIZ];
7281 int orf_pfx_count;
7282
7283 filter = &p->filter[afi][safi];
7284
hasso538621f2004-05-21 09:31:30 +00007285 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007286 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007287
paul718e3742002-12-13 20:15:29 +00007288 if (p->af_group[afi][safi])
7289 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7290
7291 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7292 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7293 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7294 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7295 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7296 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7297 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7298
7299 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7300 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7301 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7302 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7303 {
7304 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7305 ORF_TYPE_PREFIX, VTY_NEWLINE);
7306 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7307 PEER_CAP_ORF_PREFIX_SM_ADV,
7308 PEER_CAP_ORF_PREFIX_RM_ADV,
7309 PEER_CAP_ORF_PREFIX_SM_RCV,
7310 PEER_CAP_ORF_PREFIX_RM_RCV);
7311 }
7312 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7313 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7314 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7315 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7316 {
7317 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7318 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7319 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7320 PEER_CAP_ORF_PREFIX_SM_ADV,
7321 PEER_CAP_ORF_PREFIX_RM_ADV,
7322 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7323 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7324 }
7325
7326 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7327 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7328
7329 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7330 || orf_pfx_count)
7331 {
7332 vty_out (vty, " Outbound Route Filter (ORF):");
7333 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7334 vty_out (vty, " sent;");
7335 if (orf_pfx_count)
7336 vty_out (vty, " received (%d entries)", orf_pfx_count);
7337 vty_out (vty, "%s", VTY_NEWLINE);
7338 }
7339 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7340 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7341
7342 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7343 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7344 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7345 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7346 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7347 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7348 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7349 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7350 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7351 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
7352 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
7353 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7354 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
7355 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7356 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
7357 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7358 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7359 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
7360 {
7361 vty_out (vty, " Community attribute sent to this neighbor");
7362 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7363 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007364 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007365 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007366 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007367 else
hasso538621f2004-05-21 09:31:30 +00007368 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007369 }
7370 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
7371 {
7372 vty_out (vty, " Default information originate,");
7373
7374 if (p->default_rmap[afi][safi].name)
7375 vty_out (vty, " default route-map %s%s,",
7376 p->default_rmap[afi][safi].map ? "*" : "",
7377 p->default_rmap[afi][safi].name);
7378 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
7379 vty_out (vty, " default sent%s", VTY_NEWLINE);
7380 else
7381 vty_out (vty, " default not sent%s", VTY_NEWLINE);
7382 }
7383
7384 if (filter->plist[FILTER_IN].name
7385 || filter->dlist[FILTER_IN].name
7386 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00007387 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007388 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
7389 if (filter->plist[FILTER_OUT].name
7390 || filter->dlist[FILTER_OUT].name
7391 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00007392 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00007393 || filter->usmap.name)
7394 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007395 if (filter->map[RMAP_IMPORT].name)
7396 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
7397 if (filter->map[RMAP_EXPORT].name)
7398 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007399
7400 /* prefix-list */
7401 if (filter->plist[FILTER_IN].name)
7402 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
7403 filter->plist[FILTER_IN].plist ? "*" : "",
7404 filter->plist[FILTER_IN].name,
7405 VTY_NEWLINE);
7406 if (filter->plist[FILTER_OUT].name)
7407 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
7408 filter->plist[FILTER_OUT].plist ? "*" : "",
7409 filter->plist[FILTER_OUT].name,
7410 VTY_NEWLINE);
7411
7412 /* distribute-list */
7413 if (filter->dlist[FILTER_IN].name)
7414 vty_out (vty, " Incoming update network filter list is %s%s%s",
7415 filter->dlist[FILTER_IN].alist ? "*" : "",
7416 filter->dlist[FILTER_IN].name,
7417 VTY_NEWLINE);
7418 if (filter->dlist[FILTER_OUT].name)
7419 vty_out (vty, " Outgoing update network filter list is %s%s%s",
7420 filter->dlist[FILTER_OUT].alist ? "*" : "",
7421 filter->dlist[FILTER_OUT].name,
7422 VTY_NEWLINE);
7423
7424 /* filter-list. */
7425 if (filter->aslist[FILTER_IN].name)
7426 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
7427 filter->aslist[FILTER_IN].aslist ? "*" : "",
7428 filter->aslist[FILTER_IN].name,
7429 VTY_NEWLINE);
7430 if (filter->aslist[FILTER_OUT].name)
7431 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
7432 filter->aslist[FILTER_OUT].aslist ? "*" : "",
7433 filter->aslist[FILTER_OUT].name,
7434 VTY_NEWLINE);
7435
7436 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00007437 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007438 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007439 filter->map[RMAP_IN].map ? "*" : "",
7440 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00007441 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007442 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00007443 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007444 filter->map[RMAP_OUT].map ? "*" : "",
7445 filter->map[RMAP_OUT].name,
7446 VTY_NEWLINE);
7447 if (filter->map[RMAP_IMPORT].name)
7448 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
7449 filter->map[RMAP_IMPORT].map ? "*" : "",
7450 filter->map[RMAP_IMPORT].name,
7451 VTY_NEWLINE);
7452 if (filter->map[RMAP_EXPORT].name)
7453 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
7454 filter->map[RMAP_EXPORT].map ? "*" : "",
7455 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00007456 VTY_NEWLINE);
7457
7458 /* unsuppress-map */
7459 if (filter->usmap.name)
7460 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
7461 filter->usmap.map ? "*" : "",
7462 filter->usmap.name, VTY_NEWLINE);
7463
7464 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00007465 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
7466
paul718e3742002-12-13 20:15:29 +00007467 /* Maximum prefix */
7468 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
7469 {
hasso0a486e52005-02-01 20:57:17 +00007470 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00007471 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00007472 ? " (warning-only)" : "", VTY_NEWLINE);
7473 vty_out (vty, " Threshold for warning message %d%%",
7474 p->pmax_threshold[afi][safi]);
7475 if (p->pmax_restart[afi][safi])
7476 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
7477 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007478 }
paul718e3742002-12-13 20:15:29 +00007479
7480 vty_out (vty, "%s", VTY_NEWLINE);
7481}
7482
paul94f2b392005-06-28 12:44:16 +00007483static void
paul718e3742002-12-13 20:15:29 +00007484bgp_show_peer (struct vty *vty, struct peer *p)
7485{
7486 struct bgp *bgp;
7487 char buf1[BUFSIZ];
7488 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00007489 afi_t afi;
7490 safi_t safi;
paul718e3742002-12-13 20:15:29 +00007491
7492 bgp = p->bgp;
7493
7494 /* Configured IP address. */
7495 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007496 vty_out (vty, "remote AS %u, ", p->as);
7497 vty_out (vty, "local AS %u%s, ",
paul718e3742002-12-13 20:15:29 +00007498 p->change_local_as ? p->change_local_as : p->local_as,
7499 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
7500 " no-prepend" : "");
7501 vty_out (vty, "%s link%s",
7502 p->as == p->local_as ? "internal" : "external",
7503 VTY_NEWLINE);
7504
7505 /* Description. */
7506 if (p->desc)
7507 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
7508
7509 /* Peer-group */
7510 if (p->group)
7511 vty_out (vty, " Member of peer-group %s for session parameters%s",
7512 p->group->name, VTY_NEWLINE);
7513
7514 /* Administrative shutdown. */
7515 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
7516 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
7517
7518 /* BGP Version. */
7519 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00007520 vty_out (vty, ", remote router ID %s%s",
7521 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
7522 VTY_NEWLINE);
7523
7524 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00007525 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
7526 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00007527 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
7528
7529 /* Status. */
7530 vty_out (vty, " BGP state = %s",
7531 LOOKUP (bgp_status_msg, p->status));
7532 if (p->status == Established)
7533 vty_out (vty, ", up for %8s",
7534 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00007535 else if (p->status == Active)
7536 {
7537 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7538 vty_out (vty, " (passive)");
7539 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7540 vty_out (vty, " (NSF passive)");
7541 }
paul718e3742002-12-13 20:15:29 +00007542 vty_out (vty, "%s", VTY_NEWLINE);
7543
7544 /* read timer */
7545 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7546
7547 /* Configured timer values. */
7548 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7549 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7550 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7551 {
7552 vty_out (vty, " Configured hold time is %d", p->holdtime);
7553 vty_out (vty, ", keepalive interval is %d seconds%s",
7554 p->keepalive, VTY_NEWLINE);
7555 }
hasso93406d82005-02-02 14:40:33 +00007556
paul718e3742002-12-13 20:15:29 +00007557 /* Capability. */
7558 if (p->status == Established)
7559 {
hasso538621f2004-05-21 09:31:30 +00007560 if (p->cap
paul718e3742002-12-13 20:15:29 +00007561 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7562 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7563 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7564 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7565#ifdef HAVE_IPV6
7566 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7567 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7568 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7569 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
7570#endif /* HAVE_IPV6 */
7571 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7572 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7573 {
7574 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7575
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007576 /* AS4 */
7577 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
7578 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7579 {
7580 vty_out (vty, " 4 Byte AS:");
7581 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7582 vty_out (vty, " advertised");
7583 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
7584 vty_out (vty, " %sreceived",
7585 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
7586 vty_out (vty, "%s", VTY_NEWLINE);
7587 }
paul718e3742002-12-13 20:15:29 +00007588 /* Dynamic */
7589 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
7590 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7591 {
7592 vty_out (vty, " Dynamic:");
7593 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7594 vty_out (vty, " advertised");
7595 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00007596 vty_out (vty, " %sreceived",
7597 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007598 vty_out (vty, "%s", VTY_NEWLINE);
7599 }
7600
7601 /* Route Refresh */
7602 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
7603 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7604 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
7605 {
7606 vty_out (vty, " Route refresh:");
7607 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
7608 vty_out (vty, " advertised");
7609 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7610 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00007611 vty_out (vty, " %sreceived(%s)",
7612 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
7613 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
7614 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
7615 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
7616
paul718e3742002-12-13 20:15:29 +00007617 vty_out (vty, "%s", VTY_NEWLINE);
7618 }
7619
hasso538621f2004-05-21 09:31:30 +00007620 /* Multiprotocol Extensions */
7621 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7622 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7623 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00007624 {
hasso538621f2004-05-21 09:31:30 +00007625 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
7626 if (p->afc_adv[afi][safi])
7627 vty_out (vty, " advertised");
7628 if (p->afc_recv[afi][safi])
7629 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
7630 vty_out (vty, "%s", VTY_NEWLINE);
7631 }
7632
7633 /* Gracefull Restart */
7634 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7635 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007636 {
hasso538621f2004-05-21 09:31:30 +00007637 vty_out (vty, " Graceful Restart Capabilty:");
7638 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007639 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00007640 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
7641 vty_out (vty, " %sreceived",
7642 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007643 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007644
7645 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00007646 {
hasso538621f2004-05-21 09:31:30 +00007647 int restart_af_count = 0;
7648
7649 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00007650 p->v_gr_restart, VTY_NEWLINE);
7651 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007652
7653 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7654 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7655 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
7656 {
hasso93406d82005-02-02 14:40:33 +00007657 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
7658 afi_safi_print (afi, safi),
7659 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
7660 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00007661 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00007662 }
hasso538621f2004-05-21 09:31:30 +00007663 if (! restart_af_count)
7664 vty_out (vty, "none");
7665 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007666 }
paul718e3742002-12-13 20:15:29 +00007667 }
paul718e3742002-12-13 20:15:29 +00007668 }
7669 }
7670
hasso93406d82005-02-02 14:40:33 +00007671 /* graceful restart information */
7672 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7673 || p->t_gr_restart
7674 || p->t_gr_stale)
7675 {
7676 int eor_send_af_count = 0;
7677 int eor_receive_af_count = 0;
7678
7679 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
7680 if (p->status == Established)
7681 {
7682 vty_out (vty, " End-of-RIB send: ");
7683 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7684 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7685 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
7686 {
7687 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
7688 afi_safi_print (afi, safi));
7689 eor_send_af_count++;
7690 }
7691 vty_out (vty, "%s", VTY_NEWLINE);
7692
7693 vty_out (vty, " End-of-RIB received: ");
7694 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7695 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7696 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
7697 {
7698 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
7699 afi_safi_print (afi, safi));
7700 eor_receive_af_count++;
7701 }
7702 vty_out (vty, "%s", VTY_NEWLINE);
7703 }
7704
7705 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007706 vty_out (vty, " The remaining time of restart timer is %ld%s",
7707 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
7708
hasso93406d82005-02-02 14:40:33 +00007709 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007710 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
7711 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007712 }
7713
paul718e3742002-12-13 20:15:29 +00007714 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00007715 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
7716 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007717 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007718 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
7719 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
7720 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
7721 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
7722 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
7723 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
7724 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
7725 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
7726 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
7727 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
7728 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007729
7730 /* advertisement-interval */
7731 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
7732 p->v_routeadv, VTY_NEWLINE);
7733
7734 /* Update-source. */
7735 if (p->update_if || p->update_source)
7736 {
7737 vty_out (vty, " Update source is ");
7738 if (p->update_if)
7739 vty_out (vty, "%s", p->update_if);
7740 else if (p->update_source)
7741 vty_out (vty, "%s",
7742 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
7743 vty_out (vty, "%s", VTY_NEWLINE);
7744 }
7745
7746 /* Default weight */
7747 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
7748 vty_out (vty, " Default weight %d%s", p->weight,
7749 VTY_NEWLINE);
7750
7751 vty_out (vty, "%s", VTY_NEWLINE);
7752
7753 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00007754 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7755 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7756 if (p->afc[afi][safi])
7757 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00007758
7759 vty_out (vty, " Connections established %d; dropped %d%s",
7760 p->established, p->dropped,
7761 VTY_NEWLINE);
7762
hassoe0701b72004-05-20 09:19:34 +00007763 if (! p->dropped)
7764 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
7765 else
7766 vty_out (vty, " Last reset %s, due to %s%s",
7767 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
7768 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00007769
paul718e3742002-12-13 20:15:29 +00007770 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7771 {
7772 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00007773
7774 if (p->t_pmax_restart)
7775 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
7776 p->host, thread_timer_remain_second (p->t_pmax_restart),
7777 VTY_NEWLINE);
7778 else
7779 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
7780 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007781 }
7782
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00007783 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00007784 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00007785 {
7786 if (p->gtsm_hops > 0)
7787 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7788 p->gtsm_hops, VTY_NEWLINE);
7789 else if (p->ttl > 1)
7790 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7791 p->ttl, VTY_NEWLINE);
7792 }
paul718e3742002-12-13 20:15:29 +00007793
7794 /* Local address. */
7795 if (p->su_local)
7796 {
hasso93406d82005-02-02 14:40:33 +00007797 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00007798 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
7799 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00007800 VTY_NEWLINE);
7801 }
7802
7803 /* Remote address. */
7804 if (p->su_remote)
7805 {
7806 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
7807 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
7808 ntohs (p->su_remote->sin.sin_port),
7809 VTY_NEWLINE);
7810 }
7811
7812 /* Nexthop display. */
7813 if (p->su_local)
7814 {
7815 vty_out (vty, "Nexthop: %s%s",
7816 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
7817 VTY_NEWLINE);
7818#ifdef HAVE_IPV6
7819 vty_out (vty, "Nexthop global: %s%s",
7820 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
7821 VTY_NEWLINE);
7822 vty_out (vty, "Nexthop local: %s%s",
7823 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
7824 VTY_NEWLINE);
7825 vty_out (vty, "BGP connection: %s%s",
7826 p->shared_network ? "shared network" : "non shared network",
7827 VTY_NEWLINE);
7828#endif /* HAVE_IPV6 */
7829 }
7830
7831 /* Timer information. */
7832 if (p->t_start)
7833 vty_out (vty, "Next start timer due in %ld seconds%s",
7834 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
7835 if (p->t_connect)
7836 vty_out (vty, "Next connect timer due in %ld seconds%s",
7837 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
7838
7839 vty_out (vty, "Read thread: %s Write thread: %s%s",
7840 p->t_read ? "on" : "off",
7841 p->t_write ? "on" : "off",
7842 VTY_NEWLINE);
7843
7844 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
7845 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
7846 bgp_capability_vty_out (vty, p);
7847
7848 vty_out (vty, "%s", VTY_NEWLINE);
7849}
7850
paul94f2b392005-06-28 12:44:16 +00007851static int
paul718e3742002-12-13 20:15:29 +00007852bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
7853 enum show_type type, union sockunion *su)
7854{
paul1eb8ef22005-04-07 07:30:20 +00007855 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00007856 struct peer *peer;
7857 int find = 0;
7858
paul1eb8ef22005-04-07 07:30:20 +00007859 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007860 {
7861 switch (type)
7862 {
7863 case show_all:
7864 bgp_show_peer (vty, peer);
7865 break;
7866 case show_peer:
7867 if (sockunion_same (&peer->su, su))
7868 {
7869 find = 1;
7870 bgp_show_peer (vty, peer);
7871 }
7872 break;
7873 }
7874 }
7875
7876 if (type == show_peer && ! find)
7877 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
7878
7879 return CMD_SUCCESS;
7880}
7881
paul94f2b392005-06-28 12:44:16 +00007882static int
paulfd79ac92004-10-13 05:06:08 +00007883bgp_show_neighbor_vty (struct vty *vty, const char *name,
7884 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00007885{
7886 int ret;
7887 struct bgp *bgp;
7888 union sockunion su;
7889
7890 if (ip_str)
7891 {
7892 ret = str2sockunion (ip_str, &su);
7893 if (ret < 0)
7894 {
7895 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
7896 return CMD_WARNING;
7897 }
7898 }
7899
7900 if (name)
7901 {
7902 bgp = bgp_lookup_by_name (name);
7903
7904 if (! bgp)
7905 {
7906 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7907 return CMD_WARNING;
7908 }
7909
7910 bgp_show_neighbor (vty, bgp, type, &su);
7911
7912 return CMD_SUCCESS;
7913 }
7914
7915 bgp = bgp_get_default ();
7916
7917 if (bgp)
7918 bgp_show_neighbor (vty, bgp, type, &su);
7919
7920 return CMD_SUCCESS;
7921}
7922
7923/* "show ip bgp neighbors" commands. */
7924DEFUN (show_ip_bgp_neighbors,
7925 show_ip_bgp_neighbors_cmd,
7926 "show ip bgp neighbors",
7927 SHOW_STR
7928 IP_STR
7929 BGP_STR
7930 "Detailed information on TCP and BGP neighbor connections\n")
7931{
7932 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
7933}
7934
7935ALIAS (show_ip_bgp_neighbors,
7936 show_ip_bgp_ipv4_neighbors_cmd,
7937 "show ip bgp ipv4 (unicast|multicast) neighbors",
7938 SHOW_STR
7939 IP_STR
7940 BGP_STR
7941 "Address family\n"
7942 "Address Family modifier\n"
7943 "Address Family modifier\n"
7944 "Detailed information on TCP and BGP neighbor connections\n")
7945
7946ALIAS (show_ip_bgp_neighbors,
7947 show_ip_bgp_vpnv4_all_neighbors_cmd,
7948 "show ip bgp vpnv4 all neighbors",
7949 SHOW_STR
7950 IP_STR
7951 BGP_STR
7952 "Display VPNv4 NLRI specific information\n"
7953 "Display information about all VPNv4 NLRIs\n"
7954 "Detailed information on TCP and BGP neighbor connections\n")
7955
7956ALIAS (show_ip_bgp_neighbors,
7957 show_ip_bgp_vpnv4_rd_neighbors_cmd,
7958 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
7959 SHOW_STR
7960 IP_STR
7961 BGP_STR
7962 "Display VPNv4 NLRI specific information\n"
7963 "Display information for a route distinguisher\n"
7964 "VPN Route Distinguisher\n"
7965 "Detailed information on TCP and BGP neighbor connections\n")
7966
7967ALIAS (show_ip_bgp_neighbors,
7968 show_bgp_neighbors_cmd,
7969 "show bgp neighbors",
7970 SHOW_STR
7971 BGP_STR
7972 "Detailed information on TCP and BGP neighbor connections\n")
7973
7974ALIAS (show_ip_bgp_neighbors,
7975 show_bgp_ipv6_neighbors_cmd,
7976 "show bgp ipv6 neighbors",
7977 SHOW_STR
7978 BGP_STR
7979 "Address family\n"
7980 "Detailed information on TCP and BGP neighbor connections\n")
7981
7982DEFUN (show_ip_bgp_neighbors_peer,
7983 show_ip_bgp_neighbors_peer_cmd,
7984 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
7985 SHOW_STR
7986 IP_STR
7987 BGP_STR
7988 "Detailed information on TCP and BGP neighbor connections\n"
7989 "Neighbor to display information about\n"
7990 "Neighbor to display information about\n")
7991{
7992 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
7993}
7994
7995ALIAS (show_ip_bgp_neighbors_peer,
7996 show_ip_bgp_ipv4_neighbors_peer_cmd,
7997 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
7998 SHOW_STR
7999 IP_STR
8000 BGP_STR
8001 "Address family\n"
8002 "Address Family modifier\n"
8003 "Address Family modifier\n"
8004 "Detailed information on TCP and BGP neighbor connections\n"
8005 "Neighbor to display information about\n"
8006 "Neighbor to display information about\n")
8007
8008ALIAS (show_ip_bgp_neighbors_peer,
8009 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8010 "show ip bgp vpnv4 all neighbors A.B.C.D",
8011 SHOW_STR
8012 IP_STR
8013 BGP_STR
8014 "Display VPNv4 NLRI specific information\n"
8015 "Display information about all VPNv4 NLRIs\n"
8016 "Detailed information on TCP and BGP neighbor connections\n"
8017 "Neighbor to display information about\n")
8018
8019ALIAS (show_ip_bgp_neighbors_peer,
8020 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8021 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8022 SHOW_STR
8023 IP_STR
8024 BGP_STR
8025 "Display VPNv4 NLRI specific information\n"
8026 "Display information about all VPNv4 NLRIs\n"
8027 "Detailed information on TCP and BGP neighbor connections\n"
8028 "Neighbor to display information about\n")
8029
8030ALIAS (show_ip_bgp_neighbors_peer,
8031 show_bgp_neighbors_peer_cmd,
8032 "show bgp neighbors (A.B.C.D|X:X::X:X)",
8033 SHOW_STR
8034 BGP_STR
8035 "Detailed information on TCP and BGP neighbor connections\n"
8036 "Neighbor to display information about\n"
8037 "Neighbor to display information about\n")
8038
8039ALIAS (show_ip_bgp_neighbors_peer,
8040 show_bgp_ipv6_neighbors_peer_cmd,
8041 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8042 SHOW_STR
8043 BGP_STR
8044 "Address family\n"
8045 "Detailed information on TCP and BGP neighbor connections\n"
8046 "Neighbor to display information about\n"
8047 "Neighbor to display information about\n")
8048
8049DEFUN (show_ip_bgp_instance_neighbors,
8050 show_ip_bgp_instance_neighbors_cmd,
8051 "show ip bgp view WORD neighbors",
8052 SHOW_STR
8053 IP_STR
8054 BGP_STR
8055 "BGP view\n"
8056 "View name\n"
8057 "Detailed information on TCP and BGP neighbor connections\n")
8058{
8059 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8060}
8061
paulbb46e942003-10-24 19:02:03 +00008062ALIAS (show_ip_bgp_instance_neighbors,
8063 show_bgp_instance_neighbors_cmd,
8064 "show bgp view WORD neighbors",
8065 SHOW_STR
8066 BGP_STR
8067 "BGP view\n"
8068 "View name\n"
8069 "Detailed information on TCP and BGP neighbor connections\n")
8070
8071ALIAS (show_ip_bgp_instance_neighbors,
8072 show_bgp_instance_ipv6_neighbors_cmd,
8073 "show bgp view WORD ipv6 neighbors",
8074 SHOW_STR
8075 BGP_STR
8076 "BGP view\n"
8077 "View name\n"
8078 "Address family\n"
8079 "Detailed information on TCP and BGP neighbor connections\n")
8080
paul718e3742002-12-13 20:15:29 +00008081DEFUN (show_ip_bgp_instance_neighbors_peer,
8082 show_ip_bgp_instance_neighbors_peer_cmd,
8083 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8084 SHOW_STR
8085 IP_STR
8086 BGP_STR
8087 "BGP view\n"
8088 "View name\n"
8089 "Detailed information on TCP and BGP neighbor connections\n"
8090 "Neighbor to display information about\n"
8091 "Neighbor to display information about\n")
8092{
8093 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8094}
paulbb46e942003-10-24 19:02:03 +00008095
8096ALIAS (show_ip_bgp_instance_neighbors_peer,
8097 show_bgp_instance_neighbors_peer_cmd,
8098 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8099 SHOW_STR
8100 BGP_STR
8101 "BGP view\n"
8102 "View name\n"
8103 "Detailed information on TCP and BGP neighbor connections\n"
8104 "Neighbor to display information about\n"
8105 "Neighbor to display information about\n")
8106
8107ALIAS (show_ip_bgp_instance_neighbors_peer,
8108 show_bgp_instance_ipv6_neighbors_peer_cmd,
8109 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8110 SHOW_STR
8111 BGP_STR
8112 "BGP view\n"
8113 "View name\n"
8114 "Address family\n"
8115 "Detailed information on TCP and BGP neighbor connections\n"
8116 "Neighbor to display information about\n"
8117 "Neighbor to display information about\n")
8118
paul718e3742002-12-13 20:15:29 +00008119/* Show BGP's AS paths internal data. There are both `show ip bgp
8120 paths' and `show ip mbgp paths'. Those functions results are the
8121 same.*/
8122DEFUN (show_ip_bgp_paths,
8123 show_ip_bgp_paths_cmd,
8124 "show ip bgp paths",
8125 SHOW_STR
8126 IP_STR
8127 BGP_STR
8128 "Path information\n")
8129{
8130 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8131 aspath_print_all_vty (vty);
8132 return CMD_SUCCESS;
8133}
8134
8135DEFUN (show_ip_bgp_ipv4_paths,
8136 show_ip_bgp_ipv4_paths_cmd,
8137 "show ip bgp ipv4 (unicast|multicast) paths",
8138 SHOW_STR
8139 IP_STR
8140 BGP_STR
8141 "Address family\n"
8142 "Address Family modifier\n"
8143 "Address Family modifier\n"
8144 "Path information\n")
8145{
8146 vty_out (vty, "Address Refcnt Path\r\n");
8147 aspath_print_all_vty (vty);
8148
8149 return CMD_SUCCESS;
8150}
8151
8152#include "hash.h"
8153
paul94f2b392005-06-28 12:44:16 +00008154static void
paul718e3742002-12-13 20:15:29 +00008155community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8156{
8157 struct community *com;
8158
8159 com = (struct community *) backet->data;
8160 vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt,
8161 community_str (com), VTY_NEWLINE);
8162}
8163
8164/* Show BGP's community internal data. */
8165DEFUN (show_ip_bgp_community_info,
8166 show_ip_bgp_community_info_cmd,
8167 "show ip bgp community-info",
8168 SHOW_STR
8169 IP_STR
8170 BGP_STR
8171 "List all bgp community information\n")
8172{
8173 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8174
8175 hash_iterate (community_hash (),
8176 (void (*) (struct hash_backet *, void *))
8177 community_show_all_iterator,
8178 vty);
8179
8180 return CMD_SUCCESS;
8181}
8182
8183DEFUN (show_ip_bgp_attr_info,
8184 show_ip_bgp_attr_info_cmd,
8185 "show ip bgp attribute-info",
8186 SHOW_STR
8187 IP_STR
8188 BGP_STR
8189 "List all bgp attribute information\n")
8190{
8191 attr_show_all (vty);
8192 return CMD_SUCCESS;
8193}
8194
paul94f2b392005-06-28 12:44:16 +00008195static int
paulfee0f4c2004-09-13 05:12:46 +00008196bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8197 afi_t afi, safi_t safi)
8198{
8199 char timebuf[BGP_UPTIME_LEN];
8200 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008201 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008202 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008203 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008204 int len;
8205 int count = 0;
8206
8207 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8208 {
paul1eb8ef22005-04-07 07:30:20 +00008209 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008210 {
8211 count++;
8212 bgp_write_rsclient_summary (vty, peer, afi, safi);
8213 }
8214 return count;
8215 }
8216
8217 len = vty_out (vty, "%s", rsclient->host);
8218 len = 16 - len;
8219
8220 if (len < 1)
8221 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8222 else
8223 vty_out (vty, "%*s", len, " ");
8224
hasso3d515fd2005-02-01 21:30:04 +00008225 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008226
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008227 vty_out (vty, "%11d ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008228
8229 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8230 if ( rmname && strlen (rmname) > 13 )
8231 {
8232 sprintf (rmbuf, "%13s", "...");
8233 rmname = strncpy (rmbuf, rmname, 10);
8234 }
8235 else if (! rmname)
8236 rmname = "<none>";
8237 vty_out (vty, " %13s ", rmname);
8238
8239 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8240 if ( rmname && strlen (rmname) > 13 )
8241 {
8242 sprintf (rmbuf, "%13s", "...");
8243 rmname = strncpy (rmbuf, rmname, 10);
8244 }
8245 else if (! rmname)
8246 rmname = "<none>";
8247 vty_out (vty, " %13s ", rmname);
8248
8249 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8250
8251 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8252 vty_out (vty, " Idle (Admin)");
8253 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8254 vty_out (vty, " Idle (PfxCt)");
8255 else
8256 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8257
8258 vty_out (vty, "%s", VTY_NEWLINE);
8259
8260 return 1;
8261}
8262
paul94f2b392005-06-28 12:44:16 +00008263static int
paulfd79ac92004-10-13 05:06:08 +00008264bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8265 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008266{
8267 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008268 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008269 int count = 0;
8270
8271 /* Header string for each address family. */
8272 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
8273
paul1eb8ef22005-04-07 07:30:20 +00008274 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008275 {
8276 if (peer->afc[afi][safi] &&
8277 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8278 {
8279 if (! count)
8280 {
8281 vty_out (vty,
8282 "Route Server's BGP router identifier %s%s",
8283 inet_ntoa (bgp->router_id), VTY_NEWLINE);
8284 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008285 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00008286 VTY_NEWLINE);
8287
8288 vty_out (vty, "%s", VTY_NEWLINE);
8289 vty_out (vty, "%s%s", header, VTY_NEWLINE);
8290 }
8291
8292 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
8293 }
8294 }
8295
8296 if (count)
8297 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
8298 count, VTY_NEWLINE);
8299 else
8300 vty_out (vty, "No %s Route Server Client is configured%s",
8301 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
8302
8303 return CMD_SUCCESS;
8304}
8305
paul94f2b392005-06-28 12:44:16 +00008306static int
paulfd79ac92004-10-13 05:06:08 +00008307bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
8308 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008309{
8310 struct bgp *bgp;
8311
8312 if (name)
8313 {
8314 bgp = bgp_lookup_by_name (name);
8315
8316 if (! bgp)
8317 {
8318 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8319 return CMD_WARNING;
8320 }
8321
8322 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8323 return CMD_SUCCESS;
8324 }
8325
8326 bgp = bgp_get_default ();
8327
8328 if (bgp)
8329 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8330
8331 return CMD_SUCCESS;
8332}
8333
8334/* 'show bgp rsclient' commands. */
8335DEFUN (show_ip_bgp_rsclient_summary,
8336 show_ip_bgp_rsclient_summary_cmd,
8337 "show ip bgp rsclient summary",
8338 SHOW_STR
8339 IP_STR
8340 BGP_STR
8341 "Information about Route Server Clients\n"
8342 "Summary of all Route Server Clients\n")
8343{
8344 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8345}
8346
8347DEFUN (show_ip_bgp_instance_rsclient_summary,
8348 show_ip_bgp_instance_rsclient_summary_cmd,
8349 "show ip bgp view WORD rsclient summary",
8350 SHOW_STR
8351 IP_STR
8352 BGP_STR
8353 "BGP view\n"
8354 "View name\n"
8355 "Information about Route Server Clients\n"
8356 "Summary of all Route Server Clients\n")
8357{
8358 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8359}
8360
8361DEFUN (show_ip_bgp_ipv4_rsclient_summary,
8362 show_ip_bgp_ipv4_rsclient_summary_cmd,
8363 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
8364 SHOW_STR
8365 IP_STR
8366 BGP_STR
8367 "Address family\n"
8368 "Address Family modifier\n"
8369 "Address Family modifier\n"
8370 "Information about Route Server Clients\n"
8371 "Summary of all Route Server Clients\n")
8372{
8373 if (strncmp (argv[0], "m", 1) == 0)
8374 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
8375
8376 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8377}
8378
8379DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
8380 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
8381 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8382 SHOW_STR
8383 IP_STR
8384 BGP_STR
8385 "BGP view\n"
8386 "View name\n"
8387 "Address family\n"
8388 "Address Family modifier\n"
8389 "Address Family modifier\n"
8390 "Information about Route Server Clients\n"
8391 "Summary of all Route Server Clients\n")
8392{
8393 if (strncmp (argv[1], "m", 1) == 0)
8394 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
8395
8396 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8397}
8398
Michael Lambert95cbbd22010-07-23 14:43:04 -04008399DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
8400 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
8401 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8402 SHOW_STR
8403 BGP_STR
8404 "BGP view\n"
8405 "View name\n"
8406 "Address family\n"
8407 "Address Family modifier\n"
8408 "Address Family modifier\n"
8409 "Information about Route Server Clients\n"
8410 "Summary of all Route Server Clients\n")
8411{
8412 safi_t safi;
8413
8414 if (argc == 2) {
8415 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8416 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
8417 } else {
8418 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8419 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
8420 }
8421}
8422
8423ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
8424 show_bgp_ipv4_safi_rsclient_summary_cmd,
8425 "show bgp ipv4 (unicast|multicast) rsclient summary",
8426 SHOW_STR
8427 BGP_STR
8428 "Address family\n"
8429 "Address Family modifier\n"
8430 "Address Family modifier\n"
8431 "Information about Route Server Clients\n"
8432 "Summary of all Route Server Clients\n")
8433
paulfee0f4c2004-09-13 05:12:46 +00008434#ifdef HAVE_IPV6
8435DEFUN (show_bgp_rsclient_summary,
8436 show_bgp_rsclient_summary_cmd,
8437 "show bgp rsclient summary",
8438 SHOW_STR
8439 BGP_STR
8440 "Information about Route Server Clients\n"
8441 "Summary of all Route Server Clients\n")
8442{
8443 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8444}
8445
8446DEFUN (show_bgp_instance_rsclient_summary,
8447 show_bgp_instance_rsclient_summary_cmd,
8448 "show bgp view WORD rsclient summary",
8449 SHOW_STR
8450 BGP_STR
8451 "BGP view\n"
8452 "View name\n"
8453 "Information about Route Server Clients\n"
8454 "Summary of all Route Server Clients\n")
8455{
8456 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
8457}
8458
8459ALIAS (show_bgp_rsclient_summary,
8460 show_bgp_ipv6_rsclient_summary_cmd,
8461 "show bgp ipv6 rsclient summary",
8462 SHOW_STR
8463 BGP_STR
8464 "Address family\n"
8465 "Information about Route Server Clients\n"
8466 "Summary of all Route Server Clients\n")
8467
8468ALIAS (show_bgp_instance_rsclient_summary,
8469 show_bgp_instance_ipv6_rsclient_summary_cmd,
8470 "show bgp view WORD ipv6 rsclient summary",
8471 SHOW_STR
8472 BGP_STR
8473 "BGP view\n"
8474 "View name\n"
8475 "Address family\n"
8476 "Information about Route Server Clients\n"
8477 "Summary of all Route Server Clients\n")
Michael Lambert95cbbd22010-07-23 14:43:04 -04008478
8479DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
8480 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
8481 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
8482 SHOW_STR
8483 BGP_STR
8484 "BGP view\n"
8485 "View name\n"
8486 "Address family\n"
8487 "Address Family modifier\n"
8488 "Address Family modifier\n"
8489 "Information about Route Server Clients\n"
8490 "Summary of all Route Server Clients\n")
8491{
8492 safi_t safi;
8493
8494 if (argc == 2) {
8495 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8496 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
8497 } else {
8498 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8499 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
8500 }
8501}
8502
8503ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
8504 show_bgp_ipv6_safi_rsclient_summary_cmd,
8505 "show bgp ipv6 (unicast|multicast) rsclient summary",
8506 SHOW_STR
8507 BGP_STR
8508 "Address family\n"
8509 "Address Family modifier\n"
8510 "Address Family modifier\n"
8511 "Information about Route Server Clients\n"
8512 "Summary of all Route Server Clients\n")
8513
paulfee0f4c2004-09-13 05:12:46 +00008514#endif /* HAVE IPV6 */
8515
paul718e3742002-12-13 20:15:29 +00008516/* Redistribute VTY commands. */
8517
paul718e3742002-12-13 20:15:29 +00008518DEFUN (bgp_redistribute_ipv4,
8519 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008520 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008521 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008522 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008523{
8524 int type;
8525
David Lampartere0ca5fd2009-09-16 01:52:42 +02008526 type = proto_redistnum (AFI_IP, argv[0]);
8527 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008528 {
8529 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8530 return CMD_WARNING;
8531 }
8532 return bgp_redistribute_set (vty->index, AFI_IP, type);
8533}
8534
8535DEFUN (bgp_redistribute_ipv4_rmap,
8536 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008537 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008538 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008539 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008540 "Route map reference\n"
8541 "Pointer to route-map entries\n")
8542{
8543 int type;
8544
David Lampartere0ca5fd2009-09-16 01:52:42 +02008545 type = proto_redistnum (AFI_IP, argv[0]);
8546 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008547 {
8548 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8549 return CMD_WARNING;
8550 }
8551
8552 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8553 return bgp_redistribute_set (vty->index, AFI_IP, type);
8554}
8555
8556DEFUN (bgp_redistribute_ipv4_metric,
8557 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008558 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008559 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008560 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008561 "Metric for redistributed routes\n"
8562 "Default metric\n")
8563{
8564 int type;
8565 u_int32_t metric;
8566
David Lampartere0ca5fd2009-09-16 01:52:42 +02008567 type = proto_redistnum (AFI_IP, argv[0]);
8568 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008569 {
8570 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8571 return CMD_WARNING;
8572 }
8573 VTY_GET_INTEGER ("metric", metric, argv[1]);
8574
8575 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8576 return bgp_redistribute_set (vty->index, AFI_IP, type);
8577}
8578
8579DEFUN (bgp_redistribute_ipv4_rmap_metric,
8580 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008581 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008582 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008583 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008584 "Route map reference\n"
8585 "Pointer to route-map entries\n"
8586 "Metric for redistributed routes\n"
8587 "Default metric\n")
8588{
8589 int type;
8590 u_int32_t metric;
8591
David Lampartere0ca5fd2009-09-16 01:52:42 +02008592 type = proto_redistnum (AFI_IP, argv[0]);
8593 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008594 {
8595 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8596 return CMD_WARNING;
8597 }
8598 VTY_GET_INTEGER ("metric", metric, argv[2]);
8599
8600 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8601 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8602 return bgp_redistribute_set (vty->index, AFI_IP, type);
8603}
8604
8605DEFUN (bgp_redistribute_ipv4_metric_rmap,
8606 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008607 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008608 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008609 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008610 "Metric for redistributed routes\n"
8611 "Default metric\n"
8612 "Route map reference\n"
8613 "Pointer to route-map entries\n")
8614{
8615 int type;
8616 u_int32_t metric;
8617
David Lampartere0ca5fd2009-09-16 01:52:42 +02008618 type = proto_redistnum (AFI_IP, argv[0]);
8619 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008620 {
8621 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8622 return CMD_WARNING;
8623 }
8624 VTY_GET_INTEGER ("metric", metric, argv[1]);
8625
8626 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8627 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
8628 return bgp_redistribute_set (vty->index, AFI_IP, type);
8629}
8630
8631DEFUN (no_bgp_redistribute_ipv4,
8632 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008633 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008634 NO_STR
8635 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008636 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008637{
8638 int type;
8639
David Lampartere0ca5fd2009-09-16 01:52:42 +02008640 type = proto_redistnum (AFI_IP, argv[0]);
8641 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008642 {
8643 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8644 return CMD_WARNING;
8645 }
8646
8647 return bgp_redistribute_unset (vty->index, AFI_IP, type);
8648}
8649
8650DEFUN (no_bgp_redistribute_ipv4_rmap,
8651 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008652 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008653 NO_STR
8654 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008655 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008656 "Route map reference\n"
8657 "Pointer to route-map entries\n")
8658{
8659 int type;
8660
David Lampartere0ca5fd2009-09-16 01:52:42 +02008661 type = proto_redistnum (AFI_IP, argv[0]);
8662 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008663 {
8664 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8665 return CMD_WARNING;
8666 }
8667
8668 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8669 return CMD_SUCCESS;
8670}
8671
8672DEFUN (no_bgp_redistribute_ipv4_metric,
8673 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008674 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008675 NO_STR
8676 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008677 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008678 "Metric for redistributed routes\n"
8679 "Default metric\n")
8680{
8681 int type;
8682
David Lampartere0ca5fd2009-09-16 01:52:42 +02008683 type = proto_redistnum (AFI_IP, argv[0]);
8684 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008685 {
8686 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8687 return CMD_WARNING;
8688 }
8689
8690 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8691 return CMD_SUCCESS;
8692}
8693
8694DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
8695 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008696 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008697 NO_STR
8698 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008699 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008700 "Route map reference\n"
8701 "Pointer to route-map entries\n"
8702 "Metric for redistributed routes\n"
8703 "Default metric\n")
8704{
8705 int type;
8706
David Lampartere0ca5fd2009-09-16 01:52:42 +02008707 type = proto_redistnum (AFI_IP, argv[0]);
8708 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008709 {
8710 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8711 return CMD_WARNING;
8712 }
8713
8714 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8715 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8716 return CMD_SUCCESS;
8717}
8718
8719ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
8720 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008721 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008722 NO_STR
8723 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008724 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008725 "Metric for redistributed routes\n"
8726 "Default metric\n"
8727 "Route map reference\n"
8728 "Pointer to route-map entries\n")
8729
8730#ifdef HAVE_IPV6
8731DEFUN (bgp_redistribute_ipv6,
8732 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008733 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008734 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008735 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008736{
8737 int type;
8738
David Lampartere0ca5fd2009-09-16 01:52:42 +02008739 type = proto_redistnum (AFI_IP6, argv[0]);
8740 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008741 {
8742 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8743 return CMD_WARNING;
8744 }
8745
8746 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8747}
8748
8749DEFUN (bgp_redistribute_ipv6_rmap,
8750 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008751 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008752 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008753 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008754 "Route map reference\n"
8755 "Pointer to route-map entries\n")
8756{
8757 int type;
8758
David Lampartere0ca5fd2009-09-16 01:52:42 +02008759 type = proto_redistnum (AFI_IP6, argv[0]);
8760 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008761 {
8762 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8763 return CMD_WARNING;
8764 }
8765
8766 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8767 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8768}
8769
8770DEFUN (bgp_redistribute_ipv6_metric,
8771 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008772 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008773 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008774 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008775 "Metric for redistributed routes\n"
8776 "Default metric\n")
8777{
8778 int type;
8779 u_int32_t metric;
8780
David Lampartere0ca5fd2009-09-16 01:52:42 +02008781 type = proto_redistnum (AFI_IP6, argv[0]);
8782 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008783 {
8784 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8785 return CMD_WARNING;
8786 }
8787 VTY_GET_INTEGER ("metric", metric, argv[1]);
8788
8789 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8790 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8791}
8792
8793DEFUN (bgp_redistribute_ipv6_rmap_metric,
8794 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008795 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008796 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008797 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008798 "Route map reference\n"
8799 "Pointer to route-map entries\n"
8800 "Metric for redistributed routes\n"
8801 "Default metric\n")
8802{
8803 int type;
8804 u_int32_t metric;
8805
David Lampartere0ca5fd2009-09-16 01:52:42 +02008806 type = proto_redistnum (AFI_IP6, argv[0]);
8807 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008808 {
8809 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8810 return CMD_WARNING;
8811 }
8812 VTY_GET_INTEGER ("metric", metric, argv[2]);
8813
8814 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8815 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8816 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8817}
8818
8819DEFUN (bgp_redistribute_ipv6_metric_rmap,
8820 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008821 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008822 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008823 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008824 "Metric for redistributed routes\n"
8825 "Default metric\n"
8826 "Route map reference\n"
8827 "Pointer to route-map entries\n")
8828{
8829 int type;
8830 u_int32_t metric;
8831
David Lampartere0ca5fd2009-09-16 01:52:42 +02008832 type = proto_redistnum (AFI_IP6, argv[0]);
8833 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008834 {
8835 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8836 return CMD_WARNING;
8837 }
8838 VTY_GET_INTEGER ("metric", metric, argv[1]);
8839
8840 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8841 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
8842 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8843}
8844
8845DEFUN (no_bgp_redistribute_ipv6,
8846 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008847 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008848 NO_STR
8849 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008850 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008851{
8852 int type;
8853
David Lampartere0ca5fd2009-09-16 01:52:42 +02008854 type = proto_redistnum (AFI_IP6, argv[0]);
8855 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008856 {
8857 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8858 return CMD_WARNING;
8859 }
8860
8861 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
8862}
8863
8864DEFUN (no_bgp_redistribute_ipv6_rmap,
8865 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008866 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008867 NO_STR
8868 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008869 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008870 "Route map reference\n"
8871 "Pointer to route-map entries\n")
8872{
8873 int type;
8874
David Lampartere0ca5fd2009-09-16 01:52:42 +02008875 type = proto_redistnum (AFI_IP6, argv[0]);
8876 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008877 {
8878 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8879 return CMD_WARNING;
8880 }
8881
8882 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8883 return CMD_SUCCESS;
8884}
8885
8886DEFUN (no_bgp_redistribute_ipv6_metric,
8887 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008888 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008889 NO_STR
8890 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008891 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008892 "Metric for redistributed routes\n"
8893 "Default metric\n")
8894{
8895 int type;
8896
David Lampartere0ca5fd2009-09-16 01:52:42 +02008897 type = proto_redistnum (AFI_IP6, argv[0]);
8898 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008899 {
8900 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8901 return CMD_WARNING;
8902 }
8903
8904 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8905 return CMD_SUCCESS;
8906}
8907
8908DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
8909 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008910 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008911 NO_STR
8912 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008913 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008914 "Route map reference\n"
8915 "Pointer to route-map entries\n"
8916 "Metric for redistributed routes\n"
8917 "Default metric\n")
8918{
8919 int type;
8920
David Lampartere0ca5fd2009-09-16 01:52:42 +02008921 type = proto_redistnum (AFI_IP6, argv[0]);
8922 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008923 {
8924 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8925 return CMD_WARNING;
8926 }
8927
8928 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8929 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8930 return CMD_SUCCESS;
8931}
8932
8933ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
8934 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008935 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008936 NO_STR
8937 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008938 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008939 "Metric for redistributed routes\n"
8940 "Default metric\n"
8941 "Route map reference\n"
8942 "Pointer to route-map entries\n")
8943#endif /* HAVE_IPV6 */
8944
8945int
8946bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
8947 safi_t safi, int *write)
8948{
8949 int i;
paul718e3742002-12-13 20:15:29 +00008950
8951 /* Unicast redistribution only. */
8952 if (safi != SAFI_UNICAST)
8953 return 0;
8954
8955 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
8956 {
8957 /* Redistribute BGP does not make sense. */
8958 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
8959 {
8960 /* Display "address-family" when it is not yet diplayed. */
8961 bgp_config_write_family_header (vty, afi, safi, write);
8962
8963 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00008964 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00008965
8966 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02008967 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00008968
8969 if (bgp->rmap[afi][i].name)
8970 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
8971
8972 vty_out (vty, "%s", VTY_NEWLINE);
8973 }
8974 }
8975 return *write;
8976}
8977
8978/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08008979static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00008980{
8981 BGP_NODE,
8982 "%s(config-router)# ",
8983 1,
8984};
8985
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08008986static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00008987{
8988 BGP_IPV4_NODE,
8989 "%s(config-router-af)# ",
8990 1,
8991};
8992
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08008993static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00008994{
8995 BGP_IPV4M_NODE,
8996 "%s(config-router-af)# ",
8997 1,
8998};
8999
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009000static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009001{
9002 BGP_IPV6_NODE,
9003 "%s(config-router-af)# ",
9004 1,
9005};
9006
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009007static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009008{
9009 BGP_IPV6M_NODE,
9010 "%s(config-router-af)# ",
9011 1,
9012};
9013
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009014static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009015{
9016 BGP_VPNV4_NODE,
9017 "%s(config-router-af)# ",
9018 1
9019};
9020
paul1f8ae702005-09-09 23:49:49 +00009021static void community_list_vty (void);
9022
paul718e3742002-12-13 20:15:29 +00009023void
paul94f2b392005-06-28 12:44:16 +00009024bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009025{
paul718e3742002-12-13 20:15:29 +00009026 /* Install bgp top node. */
9027 install_node (&bgp_node, bgp_config_write);
9028 install_node (&bgp_ipv4_unicast_node, NULL);
9029 install_node (&bgp_ipv4_multicast_node, NULL);
9030 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009031 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009032 install_node (&bgp_vpnv4_node, NULL);
9033
9034 /* Install default VTY commands to new nodes. */
9035 install_default (BGP_NODE);
9036 install_default (BGP_IPV4_NODE);
9037 install_default (BGP_IPV4M_NODE);
9038 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009039 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009040 install_default (BGP_VPNV4_NODE);
9041
9042 /* "bgp multiple-instance" commands. */
9043 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9044 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9045
9046 /* "bgp config-type" commands. */
9047 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9048 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9049
9050 /* Dummy commands (Currently not supported) */
9051 install_element (BGP_NODE, &no_synchronization_cmd);
9052 install_element (BGP_NODE, &no_auto_summary_cmd);
9053
9054 /* "router bgp" commands. */
9055 install_element (CONFIG_NODE, &router_bgp_cmd);
9056 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9057
9058 /* "no router bgp" commands. */
9059 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9060 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9061
9062 /* "bgp router-id" commands. */
9063 install_element (BGP_NODE, &bgp_router_id_cmd);
9064 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9065 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9066
9067 /* "bgp cluster-id" commands. */
9068 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9069 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9070 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9071 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9072
9073 /* "bgp confederation" commands. */
9074 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9075 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9076 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9077
9078 /* "bgp confederation peers" commands. */
9079 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9080 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9081
Josh Bailey165b5ff2011-07-20 20:43:22 -07009082 /* "maximum-paths" commands. */
9083 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9084 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9085 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9086 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9087 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9088 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
9089 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9090 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9091 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9092 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9093 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9094 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9095
paul718e3742002-12-13 20:15:29 +00009096 /* "timers bgp" commands. */
9097 install_element (BGP_NODE, &bgp_timers_cmd);
9098 install_element (BGP_NODE, &no_bgp_timers_cmd);
9099 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9100
9101 /* "bgp client-to-client reflection" commands */
9102 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9103 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9104
9105 /* "bgp always-compare-med" commands */
9106 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9107 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9108
9109 /* "bgp deterministic-med" commands */
9110 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9111 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009112
hasso538621f2004-05-21 09:31:30 +00009113 /* "bgp graceful-restart" commands */
9114 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9115 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009116 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9117 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9118 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009119
9120 /* "bgp fast-external-failover" commands */
9121 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9122 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9123
9124 /* "bgp enforce-first-as" commands */
9125 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9126 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9127
9128 /* "bgp bestpath compare-routerid" commands */
9129 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9130 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9131
9132 /* "bgp bestpath as-path ignore" commands */
9133 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9134 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9135
hasso68118452005-04-08 15:40:36 +00009136 /* "bgp bestpath as-path confed" commands */
9137 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9138 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9139
paul848973c2003-08-13 00:32:49 +00009140 /* "bgp log-neighbor-changes" commands */
9141 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9142 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9143
paul718e3742002-12-13 20:15:29 +00009144 /* "bgp bestpath med" commands */
9145 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9146 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9147 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9148 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9149 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9150 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9151
9152 /* "no bgp default ipv4-unicast" commands. */
9153 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9154 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9155
9156 /* "bgp network import-check" commands. */
9157 install_element (BGP_NODE, &bgp_network_import_check_cmd);
9158 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
9159
9160 /* "bgp default local-preference" commands. */
9161 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
9162 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
9163 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
9164
9165 /* "neighbor remote-as" commands. */
9166 install_element (BGP_NODE, &neighbor_remote_as_cmd);
9167 install_element (BGP_NODE, &no_neighbor_cmd);
9168 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
9169
9170 /* "neighbor peer-group" commands. */
9171 install_element (BGP_NODE, &neighbor_peer_group_cmd);
9172 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
9173 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
9174
9175 /* "neighbor local-as" commands. */
9176 install_element (BGP_NODE, &neighbor_local_as_cmd);
9177 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
9178 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
9179 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
9180 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
9181
Paul Jakma0df7c912008-07-21 21:02:49 +00009182 /* "neighbor password" commands. */
9183 install_element (BGP_NODE, &neighbor_password_cmd);
9184 install_element (BGP_NODE, &no_neighbor_password_cmd);
9185
paul718e3742002-12-13 20:15:29 +00009186 /* "neighbor activate" commands. */
9187 install_element (BGP_NODE, &neighbor_activate_cmd);
9188 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
9189 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
9190 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009191 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009192 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
9193
9194 /* "no neighbor activate" commands. */
9195 install_element (BGP_NODE, &no_neighbor_activate_cmd);
9196 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
9197 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
9198 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009199 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009200 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
9201
9202 /* "neighbor peer-group set" commands. */
9203 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
9204 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
9205 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
9206 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009207 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009208 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
9209
paul718e3742002-12-13 20:15:29 +00009210 /* "no neighbor peer-group unset" commands. */
9211 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
9212 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
9213 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
9214 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009215 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009216 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
9217
paul718e3742002-12-13 20:15:29 +00009218 /* "neighbor softreconfiguration inbound" commands.*/
9219 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
9220 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
9221 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
9222 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
9223 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
9224 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
9225 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
9226 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009227 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
9228 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +00009229 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
9230 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +00009231
9232 /* "neighbor attribute-unchanged" commands. */
9233 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
9234 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
9235 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
9236 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
9237 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
9238 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
9239 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
9240 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
9241 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
9242 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
9243 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
9244 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
9245 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
9246 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
9247 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
9248 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
9249 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
9250 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
9251 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
9252 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
9253 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
9254 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
9255 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
9256 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
9257 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
9258 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
9259 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
9260 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
9261 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
9262 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
9263 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
9264 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
9265 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
9266 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
9267 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9268 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9269 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9270 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9271 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9272 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9273 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9274 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9275 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9276 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9277 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
9278 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
9279 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
9280 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
9281 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
9282 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
9283 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
9284 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
9285 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
9286 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
9287 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
9288 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
9289 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
9290 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
9291 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
9292 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
9293 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
9294 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
9295 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
9296 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
9297 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
9298 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
9299 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
9300 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
9301 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
9302 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
9303 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
9304 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
9305 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
9306 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
9307 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
9308 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
9309 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
9310 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9311 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9312 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9313 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9314 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9315 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9316 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9317 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9318 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9319 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9320 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009321 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
9322 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
9323 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
9324 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
9325 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
9326 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
9327 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
9328 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
9329 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
9330 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
9331 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
9332 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
9333 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
9334 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
9335 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
9336 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
9337 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
9338 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
9339 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
9340 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
9341 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
9342 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +00009343 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
9344 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
9345 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
9346 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
9347 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
9348 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
9349 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
9350 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
9351 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
9352 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
9353 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
9354 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
9355 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9356 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9357 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9358 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9359 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9360 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9361 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9362 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9363 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9364 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9365
paulfee0f4c2004-09-13 05:12:46 +00009366 /* "nexthop-local unchanged" commands */
9367 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
9368 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
9369
paul718e3742002-12-13 20:15:29 +00009370 /* "transparent-as" and "transparent-nexthop" for old version
9371 compatibility. */
9372 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
9373 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
9374
9375 /* "neighbor next-hop-self" commands. */
9376 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
9377 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
9378 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
9379 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
9380 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
9381 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
9382 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
9383 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009384 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
9385 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009386 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
9387 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
9388
9389 /* "neighbor remove-private-AS" commands. */
9390 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
9391 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
9392 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
9393 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
9394 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
9395 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
9396 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
9397 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009398 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
9399 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009400 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
9401 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
9402
9403 /* "neighbor send-community" commands.*/
9404 install_element (BGP_NODE, &neighbor_send_community_cmd);
9405 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
9406 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
9407 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
9408 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
9409 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
9410 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
9411 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
9412 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
9413 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
9414 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
9415 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
9416 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
9417 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
9418 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
9419 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009420 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
9421 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
9422 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
9423 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00009424 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
9425 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
9426 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
9427 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
9428
9429 /* "neighbor route-reflector" commands.*/
9430 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
9431 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
9432 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
9433 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
9434 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
9435 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
9436 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
9437 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009438 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
9439 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +00009440 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
9441 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
9442
9443 /* "neighbor route-server" commands.*/
9444 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
9445 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
9446 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
9447 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
9448 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
9449 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
9450 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
9451 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009452 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
9453 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +00009454 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
9455 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
9456
9457 /* "neighbor passive" commands. */
9458 install_element (BGP_NODE, &neighbor_passive_cmd);
9459 install_element (BGP_NODE, &no_neighbor_passive_cmd);
9460
9461 /* "neighbor shutdown" commands. */
9462 install_element (BGP_NODE, &neighbor_shutdown_cmd);
9463 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
9464
hassoc9502432005-02-01 22:01:48 +00009465 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +00009466 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
9467 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
9468
9469 /* "neighbor capability orf prefix-list" commands.*/
9470 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
9471 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
9472 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
9473 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
9474 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
9475 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
9476 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
9477 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009478 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
9479 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +00009480
9481 /* "neighbor capability dynamic" commands.*/
9482 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
9483 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
9484
9485 /* "neighbor dont-capability-negotiate" commands. */
9486 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
9487 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
9488
9489 /* "neighbor ebgp-multihop" commands. */
9490 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
9491 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
9492 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
9493 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
9494
hasso6ffd2072005-02-02 14:50:11 +00009495 /* "neighbor disable-connected-check" commands. */
9496 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
9497 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +00009498 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
9499 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
9500
9501 /* "neighbor description" commands. */
9502 install_element (BGP_NODE, &neighbor_description_cmd);
9503 install_element (BGP_NODE, &no_neighbor_description_cmd);
9504 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
9505
9506 /* "neighbor update-source" commands. "*/
9507 install_element (BGP_NODE, &neighbor_update_source_cmd);
9508 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
9509
9510 /* "neighbor default-originate" commands. */
9511 install_element (BGP_NODE, &neighbor_default_originate_cmd);
9512 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
9513 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
9514 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
9515 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
9516 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
9517 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
9518 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
9519 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
9520 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
9521 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
9522 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
9523 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
9524 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
9525 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
9526 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009527 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
9528 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
9529 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
9530 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +00009531
9532 /* "neighbor port" commands. */
9533 install_element (BGP_NODE, &neighbor_port_cmd);
9534 install_element (BGP_NODE, &no_neighbor_port_cmd);
9535 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
9536
9537 /* "neighbor weight" commands. */
9538 install_element (BGP_NODE, &neighbor_weight_cmd);
9539 install_element (BGP_NODE, &no_neighbor_weight_cmd);
9540 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
9541
9542 /* "neighbor override-capability" commands. */
9543 install_element (BGP_NODE, &neighbor_override_capability_cmd);
9544 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
9545
9546 /* "neighbor strict-capability-match" commands. */
9547 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
9548 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
9549
9550 /* "neighbor timers" commands. */
9551 install_element (BGP_NODE, &neighbor_timers_cmd);
9552 install_element (BGP_NODE, &no_neighbor_timers_cmd);
9553
9554 /* "neighbor timers connect" commands. */
9555 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
9556 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
9557 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
9558
9559 /* "neighbor advertisement-interval" commands. */
9560 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
9561 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
9562 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
9563
9564 /* "neighbor version" commands. */
9565 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +00009566
9567 /* "neighbor interface" commands. */
9568 install_element (BGP_NODE, &neighbor_interface_cmd);
9569 install_element (BGP_NODE, &no_neighbor_interface_cmd);
9570
9571 /* "neighbor distribute" commands. */
9572 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
9573 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
9574 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
9575 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
9576 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
9577 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
9578 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
9579 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009580 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
9581 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +00009582 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
9583 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
9584
9585 /* "neighbor prefix-list" commands. */
9586 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
9587 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
9588 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
9589 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
9590 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
9591 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
9592 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
9593 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009594 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
9595 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +00009596 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
9597 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
9598
9599 /* "neighbor filter-list" commands. */
9600 install_element (BGP_NODE, &neighbor_filter_list_cmd);
9601 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
9602 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
9603 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
9604 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
9605 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
9606 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
9607 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009608 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
9609 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +00009610 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
9611 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
9612
9613 /* "neighbor route-map" commands. */
9614 install_element (BGP_NODE, &neighbor_route_map_cmd);
9615 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
9616 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
9617 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
9618 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
9619 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
9620 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
9621 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009622 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
9623 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +00009624 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
9625 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
9626
9627 /* "neighbor unsuppress-map" commands. */
9628 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
9629 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
9630 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
9631 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
9632 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
9633 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
9634 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
9635 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009636 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
9637 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +00009638 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
9639 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +00009640
9641 /* "neighbor maximum-prefix" commands. */
9642 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009643 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009644 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009645 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009646 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
9647 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009648 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
9649 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009650 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9651 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9652 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9653 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9654 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009655 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009656 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009657 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009658 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009659 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9660 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009661 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
9662 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009663 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9664 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9665 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9666 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9667 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009668 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009669 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009670 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009671 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009672 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
9673 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009674 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
9675 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009676 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9677 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9678 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9679 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9680 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009681 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009682 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009683 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009684 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009685 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
9686 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009687 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
9688 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009689 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9690 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9691 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9692 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9693 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009694 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
9695 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
9696 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
9697 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9698 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
9699 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9700 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
9701 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
9702 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9703 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9704 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9705 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9706 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009707 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009708 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009709 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009710 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009711 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9712 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009713 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
9714 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009715 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9716 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9717 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9718 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9719 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009720
9721 /* "neighbor allowas-in" */
9722 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
9723 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
9724 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
9725 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
9726 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
9727 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
9728 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
9729 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
9730 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
9731 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
9732 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
9733 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009734 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
9735 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
9736 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +00009737 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
9738 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
9739 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
9740
9741 /* address-family commands. */
9742 install_element (BGP_NODE, &address_family_ipv4_cmd);
9743 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
9744#ifdef HAVE_IPV6
9745 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009746 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +00009747#endif /* HAVE_IPV6 */
9748 install_element (BGP_NODE, &address_family_vpnv4_cmd);
9749 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
9750
9751 /* "exit-address-family" command. */
9752 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
9753 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
9754 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009755 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +00009756 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
9757
9758 /* "clear ip bgp commands" */
9759 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
9760 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
9761 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
9762 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
9763 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
9764 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
9765#ifdef HAVE_IPV6
9766 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
9767 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
9768 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
9769 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
9770 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
9771 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
9772 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
9773 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
9774 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
9775 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
9776 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
9777#endif /* HAVE_IPV6 */
9778
9779 /* "clear ip bgp neighbor soft in" */
9780 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
9781 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
9782 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
9783 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
9784 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
9785 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
9786 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
9787 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
9788 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
9789 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
9790 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
9791 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
9792 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
9793 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
9794 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
9795 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
9796 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
9797 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
9798 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
9799 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
9800 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
9801 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
9802 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
9803 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
9804 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
9805 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
9806 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
9807 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
9808 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
9809 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
9810 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
9811 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
9812 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
9813 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
9814 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
9815 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
9816 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
9817 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
9818 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
9819 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
9820#ifdef HAVE_IPV6
9821 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
9822 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
9823 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
9824 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
9825 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
9826 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
9827 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
9828 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
9829 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
9830 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
9831 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
9832 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
9833 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
9834 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
9835 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
9836 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
9837 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
9838 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
9839 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
9840 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
9841 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
9842 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
9843 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
9844 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
9845 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
9846 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
9847 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
9848 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
9849 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
9850 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
9851 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
9852#endif /* HAVE_IPV6 */
9853
9854 /* "clear ip bgp neighbor soft out" */
9855 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
9856 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
9857 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
9858 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
9859 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
9860 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
9861 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
9862 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
9863 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
9864 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
9865 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
9866 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
9867 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
9868 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
9869 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
9870 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
9871 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
9872 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
9873 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
9874 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
9875 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
9876 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
9877 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
9878 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
9879 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
9880 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
9881 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
9882 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
9883#ifdef HAVE_IPV6
9884 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
9885 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
9886 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
9887 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
9888 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
9889 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
9890 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
9891 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
9892 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
9893 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
9894 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
9895 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
9896 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
9897 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
9898 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
9899 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
9900 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
9901 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
9902 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
9903 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
9904 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
9905#endif /* HAVE_IPV6 */
9906
9907 /* "clear ip bgp neighbor soft" */
9908 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
9909 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
9910 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
9911 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
9912 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
9913 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
9914 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
9915 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
9916 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
9917 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
9918 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
9919 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
9920 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
9921 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
9922 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
9923#ifdef HAVE_IPV6
9924 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
9925 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
9926 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
9927 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
9928 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
9929 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
9930 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
9931 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
9932 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
9933 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
9934 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
9935#endif /* HAVE_IPV6 */
9936
paulfee0f4c2004-09-13 05:12:46 +00009937 /* "clear ip bgp neighbor rsclient" */
9938 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
9939 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
9940 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
9941 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
9942#ifdef HAVE_IPV6
9943 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
9944 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
9945 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
9946 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
9947 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
9948 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
9949 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
9950 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
9951#endif /* HAVE_IPV6 */
9952
paul718e3742002-12-13 20:15:29 +00009953 /* "show ip bgp summary" commands. */
9954 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
9955 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
9956 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -04009957 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +00009958 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -04009959 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +00009960 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9961 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9962#ifdef HAVE_IPV6
9963 install_element (VIEW_NODE, &show_bgp_summary_cmd);
9964 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
9965 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -04009966 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +00009967 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -04009968 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +00009969#endif /* HAVE_IPV6 */
Paul Jakma62687ff2008-08-23 14:27:06 +01009970 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
9971 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
9972 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -04009973 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +01009974 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -04009975 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +01009976 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9977 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9978#ifdef HAVE_IPV6
9979 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
9980 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
9981 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -04009982 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +01009983 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -04009984 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +01009985#endif /* HAVE_IPV6 */
paul718e3742002-12-13 20:15:29 +00009986 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
9987 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
9988 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -04009989 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +00009990 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -04009991 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +00009992 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
9993 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
9994#ifdef HAVE_IPV6
9995 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
9996 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
9997 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -04009998 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +00009999 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010000 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010001#endif /* HAVE_IPV6 */
10002
10003 /* "show ip bgp neighbors" commands. */
10004 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
10005 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10006 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
10007 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10008 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10009 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10010 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10011 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10012 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
10013 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010014 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
10015 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10016 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10017 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10018 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010019 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
10020 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10021 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
10022 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10023 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10024 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10025 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10026 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10027 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
10028 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
10029
10030#ifdef HAVE_IPV6
10031 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
10032 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
10033 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
10034 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010035 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
10036 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10037 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
10038 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010039 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
10040 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
10041 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
10042 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010043 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
10044 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
10045 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
10046 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010047 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
10048 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10049 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
10050 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010051
10052 /* Old commands. */
10053 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
10054 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
10055 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
10056 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
10057#endif /* HAVE_IPV6 */
10058
paulfee0f4c2004-09-13 05:12:46 +000010059 /* "show ip bgp rsclient" commands. */
10060 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
10061 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10062 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10063 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010064 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10065 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010066 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
10067 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10068 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10069 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010070 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10071 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010072 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
10073 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10074 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10075 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010076 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10077 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010078
10079#ifdef HAVE_IPV6
10080 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
10081 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10082 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
10083 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010084 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10085 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010086 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
10087 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10088 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
10089 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010090 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10091 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010092 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
10093 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10094 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
10095 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010096 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10097 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010098#endif /* HAVE_IPV6 */
10099
paul718e3742002-12-13 20:15:29 +000010100 /* "show ip bgp paths" commands. */
10101 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
10102 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
10103 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
10104 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
10105
10106 /* "show ip bgp community" commands. */
10107 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
10108 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
10109
10110 /* "show ip bgp attribute-info" commands. */
10111 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
10112 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
10113
10114 /* "redistribute" commands. */
10115 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
10116 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
10117 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
10118 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
10119 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
10120 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
10121 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
10122 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
10123 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
10124 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
10125#ifdef HAVE_IPV6
10126 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
10127 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
10128 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
10129 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
10130 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
10131 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
10132 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
10133 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
10134 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
10135 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
10136#endif /* HAVE_IPV6 */
10137
Nick Hilliardfa411a22011-03-23 15:33:17 +000010138 /* ttl_security commands */
10139 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
10140 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
10141
Paul Jakma4bf6a362006-03-30 14:05:23 +000010142 /* "show bgp memory" commands. */
10143 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010144 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000010145 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
10146
Michael Lamberte0081f72008-11-16 20:12:04 +000010147 /* "show bgp views" commands. */
10148 install_element (VIEW_NODE, &show_bgp_views_cmd);
10149 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
10150 install_element (ENABLE_NODE, &show_bgp_views_cmd);
10151
paul718e3742002-12-13 20:15:29 +000010152 /* Community-list. */
10153 community_list_vty ();
10154}
10155
10156#include "memory.h"
10157#include "bgp_regex.h"
10158#include "bgp_clist.h"
10159#include "bgp_ecommunity.h"
10160
10161/* VTY functions. */
10162
10163/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000010164static const char *
paul718e3742002-12-13 20:15:29 +000010165community_direct_str (int direct)
10166{
10167 switch (direct)
10168 {
10169 case COMMUNITY_DENY:
10170 return "deny";
paul718e3742002-12-13 20:15:29 +000010171 case COMMUNITY_PERMIT:
10172 return "permit";
paul718e3742002-12-13 20:15:29 +000010173 default:
10174 return "unknown";
paul718e3742002-12-13 20:15:29 +000010175 }
10176}
10177
10178/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000010179static void
paul718e3742002-12-13 20:15:29 +000010180community_list_perror (struct vty *vty, int ret)
10181{
10182 switch (ret)
10183 {
10184 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030010185 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010186 break;
10187 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
10188 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
10189 break;
10190 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
10191 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
10192 break;
10193 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
10194 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
10195 break;
10196 }
10197}
10198
10199/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000010200static int
paulfd79ac92004-10-13 05:06:08 +000010201community_list_set_vty (struct vty *vty, int argc, const char **argv,
10202 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010203{
10204 int ret;
10205 int direct;
10206 char *str;
10207
10208 /* Check the list type. */
10209 if (strncmp (argv[1], "p", 1) == 0)
10210 direct = COMMUNITY_PERMIT;
10211 else if (strncmp (argv[1], "d", 1) == 0)
10212 direct = COMMUNITY_DENY;
10213 else
10214 {
10215 vty_out (vty, "%% Matching condition must be permit or deny%s",
10216 VTY_NEWLINE);
10217 return CMD_WARNING;
10218 }
10219
10220 /* All digit name check. */
10221 if (reject_all_digit_name && all_digit (argv[0]))
10222 {
10223 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10224 return CMD_WARNING;
10225 }
10226
10227 /* Concat community string argument. */
10228 if (argc > 1)
10229 str = argv_concat (argv, argc, 2);
10230 else
10231 str = NULL;
10232
10233 /* When community_list_set() return nevetive value, it means
10234 malformed community string. */
10235 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
10236
10237 /* Free temporary community list string allocated by
10238 argv_concat(). */
10239 if (str)
10240 XFREE (MTYPE_TMP, str);
10241
10242 if (ret < 0)
10243 {
10244 /* Display error string. */
10245 community_list_perror (vty, ret);
10246 return CMD_WARNING;
10247 }
10248
10249 return CMD_SUCCESS;
10250}
10251
paul718e3742002-12-13 20:15:29 +000010252/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000010253static int
hassofee6e4e2005-02-02 16:29:31 +000010254community_list_unset_vty (struct vty *vty, int argc, const char **argv,
10255 int style)
paul718e3742002-12-13 20:15:29 +000010256{
10257 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010258 int direct = 0;
10259 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010260
hassofee6e4e2005-02-02 16:29:31 +000010261 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010262 {
hassofee6e4e2005-02-02 16:29:31 +000010263 /* Check the list direct. */
10264 if (strncmp (argv[1], "p", 1) == 0)
10265 direct = COMMUNITY_PERMIT;
10266 else if (strncmp (argv[1], "d", 1) == 0)
10267 direct = COMMUNITY_DENY;
10268 else
10269 {
10270 vty_out (vty, "%% Matching condition must be permit or deny%s",
10271 VTY_NEWLINE);
10272 return CMD_WARNING;
10273 }
paul718e3742002-12-13 20:15:29 +000010274
hassofee6e4e2005-02-02 16:29:31 +000010275 /* Concat community string argument. */
10276 str = argv_concat (argv, argc, 2);
10277 }
paul718e3742002-12-13 20:15:29 +000010278
10279 /* Unset community list. */
10280 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
10281
10282 /* Free temporary community list string allocated by
10283 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010284 if (str)
10285 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010286
10287 if (ret < 0)
10288 {
10289 community_list_perror (vty, ret);
10290 return CMD_WARNING;
10291 }
10292
10293 return CMD_SUCCESS;
10294}
10295
10296/* "community-list" keyword help string. */
10297#define COMMUNITY_LIST_STR "Add a community list entry\n"
10298#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
10299
paul718e3742002-12-13 20:15:29 +000010300DEFUN (ip_community_list_standard,
10301 ip_community_list_standard_cmd,
10302 "ip community-list <1-99> (deny|permit) .AA:NN",
10303 IP_STR
10304 COMMUNITY_LIST_STR
10305 "Community list number (standard)\n"
10306 "Specify community to reject\n"
10307 "Specify community to accept\n"
10308 COMMUNITY_VAL_STR)
10309{
10310 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
10311}
10312
10313ALIAS (ip_community_list_standard,
10314 ip_community_list_standard2_cmd,
10315 "ip community-list <1-99> (deny|permit)",
10316 IP_STR
10317 COMMUNITY_LIST_STR
10318 "Community list number (standard)\n"
10319 "Specify community to reject\n"
10320 "Specify community to accept\n")
10321
10322DEFUN (ip_community_list_expanded,
10323 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010324 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010325 IP_STR
10326 COMMUNITY_LIST_STR
10327 "Community list number (expanded)\n"
10328 "Specify community to reject\n"
10329 "Specify community to accept\n"
10330 "An ordered list as a regular-expression\n")
10331{
10332 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
10333}
10334
10335DEFUN (ip_community_list_name_standard,
10336 ip_community_list_name_standard_cmd,
10337 "ip community-list standard WORD (deny|permit) .AA:NN",
10338 IP_STR
10339 COMMUNITY_LIST_STR
10340 "Add a standard community-list entry\n"
10341 "Community list name\n"
10342 "Specify community to reject\n"
10343 "Specify community to accept\n"
10344 COMMUNITY_VAL_STR)
10345{
10346 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
10347}
10348
10349ALIAS (ip_community_list_name_standard,
10350 ip_community_list_name_standard2_cmd,
10351 "ip community-list standard WORD (deny|permit)",
10352 IP_STR
10353 COMMUNITY_LIST_STR
10354 "Add a standard community-list entry\n"
10355 "Community list name\n"
10356 "Specify community to reject\n"
10357 "Specify community to accept\n")
10358
10359DEFUN (ip_community_list_name_expanded,
10360 ip_community_list_name_expanded_cmd,
10361 "ip community-list expanded WORD (deny|permit) .LINE",
10362 IP_STR
10363 COMMUNITY_LIST_STR
10364 "Add an expanded community-list entry\n"
10365 "Community list name\n"
10366 "Specify community to reject\n"
10367 "Specify community to accept\n"
10368 "An ordered list as a regular-expression\n")
10369{
10370 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
10371}
10372
hassofee6e4e2005-02-02 16:29:31 +000010373DEFUN (no_ip_community_list_standard_all,
10374 no_ip_community_list_standard_all_cmd,
10375 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010376 NO_STR
10377 IP_STR
10378 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010379 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010380{
hassofee6e4e2005-02-02 16:29:31 +000010381 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010382}
10383
hassofee6e4e2005-02-02 16:29:31 +000010384DEFUN (no_ip_community_list_expanded_all,
10385 no_ip_community_list_expanded_all_cmd,
10386 "no ip community-list <100-500>",
10387 NO_STR
10388 IP_STR
10389 COMMUNITY_LIST_STR
10390 "Community list number (expanded)\n")
10391{
10392 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10393}
10394
10395DEFUN (no_ip_community_list_name_standard_all,
10396 no_ip_community_list_name_standard_all_cmd,
10397 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010398 NO_STR
10399 IP_STR
10400 COMMUNITY_LIST_STR
10401 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000010402 "Community list name\n")
10403{
hassofee6e4e2005-02-02 16:29:31 +000010404 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010405}
10406
hassofee6e4e2005-02-02 16:29:31 +000010407DEFUN (no_ip_community_list_name_expanded_all,
10408 no_ip_community_list_name_expanded_all_cmd,
10409 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000010410 NO_STR
10411 IP_STR
10412 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010413 "Add an expanded community-list entry\n"
10414 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000010415{
hassofee6e4e2005-02-02 16:29:31 +000010416 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010417}
10418
10419DEFUN (no_ip_community_list_standard,
10420 no_ip_community_list_standard_cmd,
10421 "no ip community-list <1-99> (deny|permit) .AA:NN",
10422 NO_STR
10423 IP_STR
10424 COMMUNITY_LIST_STR
10425 "Community list number (standard)\n"
10426 "Specify community to reject\n"
10427 "Specify community to accept\n"
10428 COMMUNITY_VAL_STR)
10429{
10430 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10431}
10432
10433DEFUN (no_ip_community_list_expanded,
10434 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010435 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010436 NO_STR
10437 IP_STR
10438 COMMUNITY_LIST_STR
10439 "Community list number (expanded)\n"
10440 "Specify community to reject\n"
10441 "Specify community to accept\n"
10442 "An ordered list as a regular-expression\n")
10443{
10444 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10445}
10446
10447DEFUN (no_ip_community_list_name_standard,
10448 no_ip_community_list_name_standard_cmd,
10449 "no ip community-list standard WORD (deny|permit) .AA:NN",
10450 NO_STR
10451 IP_STR
10452 COMMUNITY_LIST_STR
10453 "Specify a standard community-list\n"
10454 "Community list name\n"
10455 "Specify community to reject\n"
10456 "Specify community to accept\n"
10457 COMMUNITY_VAL_STR)
10458{
10459 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10460}
10461
10462DEFUN (no_ip_community_list_name_expanded,
10463 no_ip_community_list_name_expanded_cmd,
10464 "no ip community-list expanded WORD (deny|permit) .LINE",
10465 NO_STR
10466 IP_STR
10467 COMMUNITY_LIST_STR
10468 "Specify an expanded community-list\n"
10469 "Community list name\n"
10470 "Specify community to reject\n"
10471 "Specify community to accept\n"
10472 "An ordered list as a regular-expression\n")
10473{
10474 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10475}
10476
paul94f2b392005-06-28 12:44:16 +000010477static void
paul718e3742002-12-13 20:15:29 +000010478community_list_show (struct vty *vty, struct community_list *list)
10479{
10480 struct community_entry *entry;
10481
10482 for (entry = list->head; entry; entry = entry->next)
10483 {
10484 if (entry == list->head)
10485 {
10486 if (all_digit (list->name))
10487 vty_out (vty, "Community %s list %s%s",
10488 entry->style == COMMUNITY_LIST_STANDARD ?
10489 "standard" : "(expanded) access",
10490 list->name, VTY_NEWLINE);
10491 else
10492 vty_out (vty, "Named Community %s list %s%s",
10493 entry->style == COMMUNITY_LIST_STANDARD ?
10494 "standard" : "expanded",
10495 list->name, VTY_NEWLINE);
10496 }
10497 if (entry->any)
10498 vty_out (vty, " %s%s",
10499 community_direct_str (entry->direct), VTY_NEWLINE);
10500 else
10501 vty_out (vty, " %s %s%s",
10502 community_direct_str (entry->direct),
10503 entry->style == COMMUNITY_LIST_STANDARD
10504 ? community_str (entry->u.com) : entry->config,
10505 VTY_NEWLINE);
10506 }
10507}
10508
10509DEFUN (show_ip_community_list,
10510 show_ip_community_list_cmd,
10511 "show ip community-list",
10512 SHOW_STR
10513 IP_STR
10514 "List community-list\n")
10515{
10516 struct community_list *list;
10517 struct community_list_master *cm;
10518
hassofee6e4e2005-02-02 16:29:31 +000010519 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010520 if (! cm)
10521 return CMD_SUCCESS;
10522
10523 for (list = cm->num.head; list; list = list->next)
10524 community_list_show (vty, list);
10525
10526 for (list = cm->str.head; list; list = list->next)
10527 community_list_show (vty, list);
10528
10529 return CMD_SUCCESS;
10530}
10531
10532DEFUN (show_ip_community_list_arg,
10533 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010534 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010535 SHOW_STR
10536 IP_STR
10537 "List community-list\n"
10538 "Community-list number\n"
10539 "Community-list name\n")
10540{
10541 struct community_list *list;
10542
hassofee6e4e2005-02-02 16:29:31 +000010543 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010544 if (! list)
10545 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030010546 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010547 return CMD_WARNING;
10548 }
10549
10550 community_list_show (vty, list);
10551
10552 return CMD_SUCCESS;
10553}
10554
paul94f2b392005-06-28 12:44:16 +000010555static int
paulfd79ac92004-10-13 05:06:08 +000010556extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
10557 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010558{
10559 int ret;
10560 int direct;
10561 char *str;
10562
10563 /* Check the list type. */
10564 if (strncmp (argv[1], "p", 1) == 0)
10565 direct = COMMUNITY_PERMIT;
10566 else if (strncmp (argv[1], "d", 1) == 0)
10567 direct = COMMUNITY_DENY;
10568 else
10569 {
10570 vty_out (vty, "%% Matching condition must be permit or deny%s",
10571 VTY_NEWLINE);
10572 return CMD_WARNING;
10573 }
10574
10575 /* All digit name check. */
10576 if (reject_all_digit_name && all_digit (argv[0]))
10577 {
10578 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10579 return CMD_WARNING;
10580 }
10581
10582 /* Concat community string argument. */
10583 if (argc > 1)
10584 str = argv_concat (argv, argc, 2);
10585 else
10586 str = NULL;
10587
10588 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
10589
10590 /* Free temporary community list string allocated by
10591 argv_concat(). */
10592 if (str)
10593 XFREE (MTYPE_TMP, str);
10594
10595 if (ret < 0)
10596 {
10597 community_list_perror (vty, ret);
10598 return CMD_WARNING;
10599 }
10600 return CMD_SUCCESS;
10601}
10602
paul94f2b392005-06-28 12:44:16 +000010603static int
hassofee6e4e2005-02-02 16:29:31 +000010604extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
10605 int style)
paul718e3742002-12-13 20:15:29 +000010606{
10607 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010608 int direct = 0;
10609 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010610
hassofee6e4e2005-02-02 16:29:31 +000010611 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010612 {
hassofee6e4e2005-02-02 16:29:31 +000010613 /* Check the list direct. */
10614 if (strncmp (argv[1], "p", 1) == 0)
10615 direct = COMMUNITY_PERMIT;
10616 else if (strncmp (argv[1], "d", 1) == 0)
10617 direct = COMMUNITY_DENY;
10618 else
10619 {
10620 vty_out (vty, "%% Matching condition must be permit or deny%s",
10621 VTY_NEWLINE);
10622 return CMD_WARNING;
10623 }
10624
10625 /* Concat community string argument. */
10626 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000010627 }
paul718e3742002-12-13 20:15:29 +000010628
10629 /* Unset community list. */
10630 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
10631
10632 /* Free temporary community list string allocated by
10633 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010634 if (str)
10635 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010636
10637 if (ret < 0)
10638 {
10639 community_list_perror (vty, ret);
10640 return CMD_WARNING;
10641 }
10642
10643 return CMD_SUCCESS;
10644}
10645
10646/* "extcommunity-list" keyword help string. */
10647#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
10648#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
10649
10650DEFUN (ip_extcommunity_list_standard,
10651 ip_extcommunity_list_standard_cmd,
10652 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10653 IP_STR
10654 EXTCOMMUNITY_LIST_STR
10655 "Extended Community list number (standard)\n"
10656 "Specify community to reject\n"
10657 "Specify community to accept\n"
10658 EXTCOMMUNITY_VAL_STR)
10659{
10660 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
10661}
10662
10663ALIAS (ip_extcommunity_list_standard,
10664 ip_extcommunity_list_standard2_cmd,
10665 "ip extcommunity-list <1-99> (deny|permit)",
10666 IP_STR
10667 EXTCOMMUNITY_LIST_STR
10668 "Extended Community list number (standard)\n"
10669 "Specify community to reject\n"
10670 "Specify community to accept\n")
10671
10672DEFUN (ip_extcommunity_list_expanded,
10673 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010674 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010675 IP_STR
10676 EXTCOMMUNITY_LIST_STR
10677 "Extended Community list number (expanded)\n"
10678 "Specify community to reject\n"
10679 "Specify community to accept\n"
10680 "An ordered list as a regular-expression\n")
10681{
10682 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
10683}
10684
10685DEFUN (ip_extcommunity_list_name_standard,
10686 ip_extcommunity_list_name_standard_cmd,
10687 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10688 IP_STR
10689 EXTCOMMUNITY_LIST_STR
10690 "Specify standard extcommunity-list\n"
10691 "Extended Community list name\n"
10692 "Specify community to reject\n"
10693 "Specify community to accept\n"
10694 EXTCOMMUNITY_VAL_STR)
10695{
10696 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
10697}
10698
10699ALIAS (ip_extcommunity_list_name_standard,
10700 ip_extcommunity_list_name_standard2_cmd,
10701 "ip extcommunity-list standard WORD (deny|permit)",
10702 IP_STR
10703 EXTCOMMUNITY_LIST_STR
10704 "Specify standard extcommunity-list\n"
10705 "Extended Community list name\n"
10706 "Specify community to reject\n"
10707 "Specify community to accept\n")
10708
10709DEFUN (ip_extcommunity_list_name_expanded,
10710 ip_extcommunity_list_name_expanded_cmd,
10711 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
10712 IP_STR
10713 EXTCOMMUNITY_LIST_STR
10714 "Specify expanded extcommunity-list\n"
10715 "Extended Community list name\n"
10716 "Specify community to reject\n"
10717 "Specify community to accept\n"
10718 "An ordered list as a regular-expression\n")
10719{
10720 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
10721}
10722
hassofee6e4e2005-02-02 16:29:31 +000010723DEFUN (no_ip_extcommunity_list_standard_all,
10724 no_ip_extcommunity_list_standard_all_cmd,
10725 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010726 NO_STR
10727 IP_STR
10728 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010729 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010730{
hassofee6e4e2005-02-02 16:29:31 +000010731 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010732}
10733
hassofee6e4e2005-02-02 16:29:31 +000010734DEFUN (no_ip_extcommunity_list_expanded_all,
10735 no_ip_extcommunity_list_expanded_all_cmd,
10736 "no ip extcommunity-list <100-500>",
10737 NO_STR
10738 IP_STR
10739 EXTCOMMUNITY_LIST_STR
10740 "Extended Community list number (expanded)\n")
10741{
10742 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10743}
10744
10745DEFUN (no_ip_extcommunity_list_name_standard_all,
10746 no_ip_extcommunity_list_name_standard_all_cmd,
10747 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010748 NO_STR
10749 IP_STR
10750 EXTCOMMUNITY_LIST_STR
10751 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000010752 "Extended Community list name\n")
10753{
10754 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10755}
10756
10757DEFUN (no_ip_extcommunity_list_name_expanded_all,
10758 no_ip_extcommunity_list_name_expanded_all_cmd,
10759 "no ip extcommunity-list expanded WORD",
10760 NO_STR
10761 IP_STR
10762 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000010763 "Specify expanded extcommunity-list\n"
10764 "Extended Community list name\n")
10765{
hassofee6e4e2005-02-02 16:29:31 +000010766 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010767}
10768
10769DEFUN (no_ip_extcommunity_list_standard,
10770 no_ip_extcommunity_list_standard_cmd,
10771 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10772 NO_STR
10773 IP_STR
10774 EXTCOMMUNITY_LIST_STR
10775 "Extended Community list number (standard)\n"
10776 "Specify community to reject\n"
10777 "Specify community to accept\n"
10778 EXTCOMMUNITY_VAL_STR)
10779{
10780 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10781}
10782
10783DEFUN (no_ip_extcommunity_list_expanded,
10784 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010785 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010786 NO_STR
10787 IP_STR
10788 EXTCOMMUNITY_LIST_STR
10789 "Extended Community list number (expanded)\n"
10790 "Specify community to reject\n"
10791 "Specify community to accept\n"
10792 "An ordered list as a regular-expression\n")
10793{
10794 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10795}
10796
10797DEFUN (no_ip_extcommunity_list_name_standard,
10798 no_ip_extcommunity_list_name_standard_cmd,
10799 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10800 NO_STR
10801 IP_STR
10802 EXTCOMMUNITY_LIST_STR
10803 "Specify standard extcommunity-list\n"
10804 "Extended Community list name\n"
10805 "Specify community to reject\n"
10806 "Specify community to accept\n"
10807 EXTCOMMUNITY_VAL_STR)
10808{
10809 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10810}
10811
10812DEFUN (no_ip_extcommunity_list_name_expanded,
10813 no_ip_extcommunity_list_name_expanded_cmd,
10814 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
10815 NO_STR
10816 IP_STR
10817 EXTCOMMUNITY_LIST_STR
10818 "Specify expanded extcommunity-list\n"
10819 "Community list name\n"
10820 "Specify community to reject\n"
10821 "Specify community to accept\n"
10822 "An ordered list as a regular-expression\n")
10823{
10824 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10825}
10826
paul94f2b392005-06-28 12:44:16 +000010827static void
paul718e3742002-12-13 20:15:29 +000010828extcommunity_list_show (struct vty *vty, struct community_list *list)
10829{
10830 struct community_entry *entry;
10831
10832 for (entry = list->head; entry; entry = entry->next)
10833 {
10834 if (entry == list->head)
10835 {
10836 if (all_digit (list->name))
10837 vty_out (vty, "Extended community %s list %s%s",
10838 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10839 "standard" : "(expanded) access",
10840 list->name, VTY_NEWLINE);
10841 else
10842 vty_out (vty, "Named extended community %s list %s%s",
10843 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10844 "standard" : "expanded",
10845 list->name, VTY_NEWLINE);
10846 }
10847 if (entry->any)
10848 vty_out (vty, " %s%s",
10849 community_direct_str (entry->direct), VTY_NEWLINE);
10850 else
10851 vty_out (vty, " %s %s%s",
10852 community_direct_str (entry->direct),
10853 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10854 entry->u.ecom->str : entry->config,
10855 VTY_NEWLINE);
10856 }
10857}
10858
10859DEFUN (show_ip_extcommunity_list,
10860 show_ip_extcommunity_list_cmd,
10861 "show ip extcommunity-list",
10862 SHOW_STR
10863 IP_STR
10864 "List extended-community list\n")
10865{
10866 struct community_list *list;
10867 struct community_list_master *cm;
10868
hassofee6e4e2005-02-02 16:29:31 +000010869 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010870 if (! cm)
10871 return CMD_SUCCESS;
10872
10873 for (list = cm->num.head; list; list = list->next)
10874 extcommunity_list_show (vty, list);
10875
10876 for (list = cm->str.head; list; list = list->next)
10877 extcommunity_list_show (vty, list);
10878
10879 return CMD_SUCCESS;
10880}
10881
10882DEFUN (show_ip_extcommunity_list_arg,
10883 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010884 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010885 SHOW_STR
10886 IP_STR
10887 "List extended-community list\n"
10888 "Extcommunity-list number\n"
10889 "Extcommunity-list name\n")
10890{
10891 struct community_list *list;
10892
hassofee6e4e2005-02-02 16:29:31 +000010893 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010894 if (! list)
10895 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030010896 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010897 return CMD_WARNING;
10898 }
10899
10900 extcommunity_list_show (vty, list);
10901
10902 return CMD_SUCCESS;
10903}
10904
10905/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000010906static const char *
paul718e3742002-12-13 20:15:29 +000010907community_list_config_str (struct community_entry *entry)
10908{
paulfd79ac92004-10-13 05:06:08 +000010909 const char *str;
paul718e3742002-12-13 20:15:29 +000010910
10911 if (entry->any)
10912 str = "";
10913 else
10914 {
10915 if (entry->style == COMMUNITY_LIST_STANDARD)
10916 str = community_str (entry->u.com);
10917 else
10918 str = entry->config;
10919 }
10920 return str;
10921}
10922
10923/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000010924static int
paul718e3742002-12-13 20:15:29 +000010925community_list_config_write (struct vty *vty)
10926{
10927 struct community_list *list;
10928 struct community_entry *entry;
10929 struct community_list_master *cm;
10930 int write = 0;
10931
10932 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000010933 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010934
10935 for (list = cm->num.head; list; list = list->next)
10936 for (entry = list->head; entry; entry = entry->next)
10937 {
hassofee6e4e2005-02-02 16:29:31 +000010938 vty_out (vty, "ip community-list %s %s %s%s",
10939 list->name, community_direct_str (entry->direct),
10940 community_list_config_str (entry),
10941 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010942 write++;
10943 }
10944 for (list = cm->str.head; list; list = list->next)
10945 for (entry = list->head; entry; entry = entry->next)
10946 {
10947 vty_out (vty, "ip community-list %s %s %s %s%s",
10948 entry->style == COMMUNITY_LIST_STANDARD
10949 ? "standard" : "expanded",
10950 list->name, community_direct_str (entry->direct),
10951 community_list_config_str (entry),
10952 VTY_NEWLINE);
10953 write++;
10954 }
10955
10956 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000010957 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010958
10959 for (list = cm->num.head; list; list = list->next)
10960 for (entry = list->head; entry; entry = entry->next)
10961 {
hassofee6e4e2005-02-02 16:29:31 +000010962 vty_out (vty, "ip extcommunity-list %s %s %s%s",
10963 list->name, community_direct_str (entry->direct),
10964 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010965 write++;
10966 }
10967 for (list = cm->str.head; list; list = list->next)
10968 for (entry = list->head; entry; entry = entry->next)
10969 {
10970 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
10971 entry->style == EXTCOMMUNITY_LIST_STANDARD
10972 ? "standard" : "expanded",
10973 list->name, community_direct_str (entry->direct),
10974 community_list_config_str (entry), VTY_NEWLINE);
10975 write++;
10976 }
10977 return write;
10978}
10979
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080010980static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000010981{
10982 COMMUNITY_LIST_NODE,
10983 "",
10984 1 /* Export to vtysh. */
10985};
10986
paul94f2b392005-06-28 12:44:16 +000010987static void
10988community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000010989{
10990 install_node (&community_list_node, community_list_config_write);
10991
10992 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000010993 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
10994 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
10995 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
10996 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
10997 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
10998 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000010999 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
11000 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
11001 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
11002 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011003 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
11004 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
11005 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
11006 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
11007 install_element (VIEW_NODE, &show_ip_community_list_cmd);
11008 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
11009 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
11010 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
11011
11012 /* Extcommunity-list. */
11013 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
11014 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
11015 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
11016 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
11017 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
11018 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011019 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
11020 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
11021 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
11022 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011023 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
11024 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
11025 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
11026 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
11027 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
11028 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
11029 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
11030 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
11031}