blob: a818fe7a86530f8dedcbc69fe5bcf1a993dfe38e [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}
David Lamparter6b0655a2014-06-04 06:53:35 +0200317
paul718e3742002-12-13 20:15:29 +0000318/* "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")
David Lamparter6b0655a2014-06-04 06:53:35 +0200367
paul718e3742002-12-13 20:15:29 +0000368/* "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")
David Lamparter6b0655a2014-06-04 06:53:35 +0200408
paul718e3742002-12-13 20:15:29 +0000409/* 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")
David Lamparter6b0655a2014-06-04 06:53:35 +0200479
paul718e3742002-12-13 20:15:29 +0000480/* 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")
David Lamparter6b0655a2014-06-04 06:53:35 +0200549
paul718e3742002-12-13 20:15:29 +0000550DEFUN (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")
David Lamparter6b0655a2014-06-04 06:53:35 +0200599
paul718e3742002-12-13 20:15:29 +0000600DEFUN (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}
David Lamparter6b0655a2014-06-04 06:53:35 +0200653
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}
David Lamparter6b0655a2014-06-04 06:53:35 +0200796
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")
David Lamparter6b0655a2014-06-04 06:53:35 +0200852
paul718e3742002-12-13 20:15:29 +0000853DEFUN (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}
David Lamparter6b0655a2014-06-04 06:53:35 +0200909
paul718e3742002-12-13 20:15:29 +0000910/* "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}
David Lamparter6b0655a2014-06-04 06:53:35 +02001040
paul718e3742002-12-13 20:15:29 +00001041/* "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}
David Lamparter6b0655a2014-06-04 06:53:35 +02001068
paul718e3742002-12-13 20:15:29 +00001069/* "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}
David Lamparter6b0655a2014-06-04 06:53:35 +02001098
paul718e3742002-12-13 20:15:29 +00001099/* "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}
David Lamparter6b0655a2014-06-04 06:53:35 +02001130
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}
David Lamparter6b0655a2014-06-04 06:53:35 +02001162
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00001163/* "bgp bestpath as-path multipath-relax" configuration. */
1164DEFUN (bgp_bestpath_aspath_multipath_relax,
1165 bgp_bestpath_aspath_multipath_relax_cmd,
1166 "bgp bestpath as-path multipath-relax",
1167 "BGP specific commands\n"
1168 "Change the default bestpath selection\n"
1169 "AS-path attribute\n"
1170 "Allow load sharing across routes that have different AS paths (but same length)\n")
1171{
1172 struct bgp *bgp;
1173
1174 bgp = vty->index;
1175 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1176 return CMD_SUCCESS;
1177}
1178
1179DEFUN (no_bgp_bestpath_aspath_multipath_relax,
1180 no_bgp_bestpath_aspath_multipath_relax_cmd,
1181 "no bgp bestpath as-path multipath-relax",
1182 NO_STR
1183 "BGP specific commands\n"
1184 "Change the default bestpath selection\n"
1185 "AS-path attribute\n"
1186 "Allow load sharing across routes that have different AS paths (but same length)\n")
1187{
1188 struct bgp *bgp;
1189
1190 bgp = vty->index;
1191 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1192 return CMD_SUCCESS;
1193}
David Lamparter6b0655a2014-06-04 06:53:35 +02001194
paul848973c2003-08-13 00:32:49 +00001195/* "bgp log-neighbor-changes" configuration. */
1196DEFUN (bgp_log_neighbor_changes,
1197 bgp_log_neighbor_changes_cmd,
1198 "bgp log-neighbor-changes",
1199 "BGP specific commands\n"
1200 "Log neighbor up/down and reset reason\n")
1201{
1202 struct bgp *bgp;
1203
1204 bgp = vty->index;
1205 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1206 return CMD_SUCCESS;
1207}
1208
1209DEFUN (no_bgp_log_neighbor_changes,
1210 no_bgp_log_neighbor_changes_cmd,
1211 "no bgp log-neighbor-changes",
1212 NO_STR
1213 "BGP specific commands\n"
1214 "Log neighbor up/down and reset reason\n")
1215{
1216 struct bgp *bgp;
1217
1218 bgp = vty->index;
1219 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1220 return CMD_SUCCESS;
1221}
David Lamparter6b0655a2014-06-04 06:53:35 +02001222
paul718e3742002-12-13 20:15:29 +00001223/* "bgp bestpath med" configuration. */
1224DEFUN (bgp_bestpath_med,
1225 bgp_bestpath_med_cmd,
1226 "bgp bestpath med (confed|missing-as-worst)",
1227 "BGP specific commands\n"
1228 "Change the default bestpath selection\n"
1229 "MED attribute\n"
1230 "Compare MED among confederation paths\n"
1231 "Treat missing MED as the least preferred one\n")
1232{
1233 struct bgp *bgp;
1234
1235 bgp = vty->index;
1236
1237 if (strncmp (argv[0], "confed", 1) == 0)
1238 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1239 else
1240 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1241
1242 return CMD_SUCCESS;
1243}
1244
1245DEFUN (bgp_bestpath_med2,
1246 bgp_bestpath_med2_cmd,
1247 "bgp bestpath med confed missing-as-worst",
1248 "BGP specific commands\n"
1249 "Change the default bestpath selection\n"
1250 "MED attribute\n"
1251 "Compare MED among confederation paths\n"
1252 "Treat missing MED as the least preferred one\n")
1253{
1254 struct bgp *bgp;
1255
1256 bgp = vty->index;
1257 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1258 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1259 return CMD_SUCCESS;
1260}
1261
1262ALIAS (bgp_bestpath_med2,
1263 bgp_bestpath_med3_cmd,
1264 "bgp bestpath med missing-as-worst confed",
1265 "BGP specific commands\n"
1266 "Change the default bestpath selection\n"
1267 "MED attribute\n"
1268 "Treat missing MED as the least preferred one\n"
1269 "Compare MED among confederation paths\n")
1270
1271DEFUN (no_bgp_bestpath_med,
1272 no_bgp_bestpath_med_cmd,
1273 "no bgp bestpath med (confed|missing-as-worst)",
1274 NO_STR
1275 "BGP specific commands\n"
1276 "Change the default bestpath selection\n"
1277 "MED attribute\n"
1278 "Compare MED among confederation paths\n"
1279 "Treat missing MED as the least preferred one\n")
1280{
1281 struct bgp *bgp;
1282
1283 bgp = vty->index;
1284
1285 if (strncmp (argv[0], "confed", 1) == 0)
1286 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1287 else
1288 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1289
1290 return CMD_SUCCESS;
1291}
1292
1293DEFUN (no_bgp_bestpath_med2,
1294 no_bgp_bestpath_med2_cmd,
1295 "no bgp bestpath med confed missing-as-worst",
1296 NO_STR
1297 "BGP specific commands\n"
1298 "Change the default bestpath selection\n"
1299 "MED attribute\n"
1300 "Compare MED among confederation paths\n"
1301 "Treat missing MED as the least preferred one\n")
1302{
1303 struct bgp *bgp;
1304
1305 bgp = vty->index;
1306 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1307 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1308 return CMD_SUCCESS;
1309}
1310
1311ALIAS (no_bgp_bestpath_med2,
1312 no_bgp_bestpath_med3_cmd,
1313 "no bgp bestpath med missing-as-worst confed",
1314 NO_STR
1315 "BGP specific commands\n"
1316 "Change the default bestpath selection\n"
1317 "MED attribute\n"
1318 "Treat missing MED as the least preferred one\n"
1319 "Compare MED among confederation paths\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001320
paul718e3742002-12-13 20:15:29 +00001321/* "no bgp default ipv4-unicast". */
1322DEFUN (no_bgp_default_ipv4_unicast,
1323 no_bgp_default_ipv4_unicast_cmd,
1324 "no bgp default ipv4-unicast",
1325 NO_STR
1326 "BGP specific commands\n"
1327 "Configure BGP defaults\n"
1328 "Activate ipv4-unicast for a peer by default\n")
1329{
1330 struct bgp *bgp;
1331
1332 bgp = vty->index;
1333 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1334 return CMD_SUCCESS;
1335}
1336
1337DEFUN (bgp_default_ipv4_unicast,
1338 bgp_default_ipv4_unicast_cmd,
1339 "bgp default ipv4-unicast",
1340 "BGP specific commands\n"
1341 "Configure BGP defaults\n"
1342 "Activate ipv4-unicast for a peer by default\n")
1343{
1344 struct bgp *bgp;
1345
1346 bgp = vty->index;
1347 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1348 return CMD_SUCCESS;
1349}
David Lamparter6b0655a2014-06-04 06:53:35 +02001350
paul718e3742002-12-13 20:15:29 +00001351/* "bgp import-check" configuration. */
1352DEFUN (bgp_network_import_check,
1353 bgp_network_import_check_cmd,
1354 "bgp network import-check",
1355 "BGP specific commands\n"
1356 "BGP network command\n"
1357 "Check BGP network route exists in IGP\n")
1358{
1359 struct bgp *bgp;
1360
1361 bgp = vty->index;
1362 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1363 return CMD_SUCCESS;
1364}
1365
1366DEFUN (no_bgp_network_import_check,
1367 no_bgp_network_import_check_cmd,
1368 "no bgp network import-check",
1369 NO_STR
1370 "BGP specific commands\n"
1371 "BGP network command\n"
1372 "Check BGP network route exists in IGP\n")
1373{
1374 struct bgp *bgp;
1375
1376 bgp = vty->index;
1377 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1378 return CMD_SUCCESS;
1379}
David Lamparter6b0655a2014-06-04 06:53:35 +02001380
paul718e3742002-12-13 20:15:29 +00001381DEFUN (bgp_default_local_preference,
1382 bgp_default_local_preference_cmd,
1383 "bgp default local-preference <0-4294967295>",
1384 "BGP specific commands\n"
1385 "Configure BGP defaults\n"
1386 "local preference (higher=more preferred)\n"
1387 "Configure default local preference value\n")
1388{
1389 struct bgp *bgp;
1390 u_int32_t local_pref;
1391
1392 bgp = vty->index;
1393
1394 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1395
1396 bgp_default_local_preference_set (bgp, local_pref);
1397
1398 return CMD_SUCCESS;
1399}
1400
1401DEFUN (no_bgp_default_local_preference,
1402 no_bgp_default_local_preference_cmd,
1403 "no bgp default local-preference",
1404 NO_STR
1405 "BGP specific commands\n"
1406 "Configure BGP defaults\n"
1407 "local preference (higher=more preferred)\n")
1408{
1409 struct bgp *bgp;
1410
1411 bgp = vty->index;
1412 bgp_default_local_preference_unset (bgp);
1413 return CMD_SUCCESS;
1414}
1415
1416ALIAS (no_bgp_default_local_preference,
1417 no_bgp_default_local_preference_val_cmd,
1418 "no bgp default local-preference <0-4294967295>",
1419 NO_STR
1420 "BGP specific commands\n"
1421 "Configure BGP defaults\n"
1422 "local preference (higher=more preferred)\n"
1423 "Configure default local preference value\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001424
paul718e3742002-12-13 20:15:29 +00001425static int
paulfd79ac92004-10-13 05:06:08 +00001426peer_remote_as_vty (struct vty *vty, const char *peer_str,
1427 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001428{
1429 int ret;
1430 struct bgp *bgp;
1431 as_t as;
1432 union sockunion su;
1433
1434 bgp = vty->index;
1435
1436 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001437 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001438
1439 /* If peer is peer group, call proper function. */
1440 ret = str2sockunion (peer_str, &su);
1441 if (ret < 0)
1442 {
1443 ret = peer_group_remote_as (bgp, peer_str, &as);
1444 if (ret < 0)
1445 {
1446 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1447 return CMD_WARNING;
1448 }
1449 return CMD_SUCCESS;
1450 }
1451
1452 if (peer_address_self_check (&su))
1453 {
1454 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1455 VTY_NEWLINE);
1456 return CMD_WARNING;
1457 }
1458
1459 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1460
1461 /* This peer belongs to peer group. */
1462 switch (ret)
1463 {
1464 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001465 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001466 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001467 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001468 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 +00001469 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001470 }
1471 return bgp_vty_return (vty, ret);
1472}
1473
1474DEFUN (neighbor_remote_as,
1475 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001476 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001477 NEIGHBOR_STR
1478 NEIGHBOR_ADDR_STR2
1479 "Specify a BGP neighbor\n"
1480 AS_STR)
1481{
1482 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1483}
David Lamparter6b0655a2014-06-04 06:53:35 +02001484
paul718e3742002-12-13 20:15:29 +00001485DEFUN (neighbor_peer_group,
1486 neighbor_peer_group_cmd,
1487 "neighbor WORD peer-group",
1488 NEIGHBOR_STR
1489 "Neighbor tag\n"
1490 "Configure peer-group\n")
1491{
1492 struct bgp *bgp;
1493 struct peer_group *group;
1494
1495 bgp = vty->index;
1496
1497 group = peer_group_get (bgp, argv[0]);
1498 if (! group)
1499 return CMD_WARNING;
1500
1501 return CMD_SUCCESS;
1502}
1503
1504DEFUN (no_neighbor,
1505 no_neighbor_cmd,
1506 NO_NEIGHBOR_CMD2,
1507 NO_STR
1508 NEIGHBOR_STR
1509 NEIGHBOR_ADDR_STR2)
1510{
1511 int ret;
1512 union sockunion su;
1513 struct peer_group *group;
1514 struct peer *peer;
1515
1516 ret = str2sockunion (argv[0], &su);
1517 if (ret < 0)
1518 {
1519 group = peer_group_lookup (vty->index, argv[0]);
1520 if (group)
1521 peer_group_delete (group);
1522 else
1523 {
1524 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1525 return CMD_WARNING;
1526 }
1527 }
1528 else
1529 {
1530 peer = peer_lookup (vty->index, &su);
1531 if (peer)
paul200df112005-06-01 11:17:05 +00001532 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001533 }
1534
1535 return CMD_SUCCESS;
1536}
1537
1538ALIAS (no_neighbor,
1539 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001540 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001541 NO_STR
1542 NEIGHBOR_STR
1543 NEIGHBOR_ADDR_STR
1544 "Specify a BGP neighbor\n"
1545 AS_STR)
1546
1547DEFUN (no_neighbor_peer_group,
1548 no_neighbor_peer_group_cmd,
1549 "no neighbor WORD peer-group",
1550 NO_STR
1551 NEIGHBOR_STR
1552 "Neighbor tag\n"
1553 "Configure peer-group\n")
1554{
1555 struct peer_group *group;
1556
1557 group = peer_group_lookup (vty->index, argv[0]);
1558 if (group)
1559 peer_group_delete (group);
1560 else
1561 {
1562 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1563 return CMD_WARNING;
1564 }
1565 return CMD_SUCCESS;
1566}
1567
1568DEFUN (no_neighbor_peer_group_remote_as,
1569 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001570 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001571 NO_STR
1572 NEIGHBOR_STR
1573 "Neighbor tag\n"
1574 "Specify a BGP neighbor\n"
1575 AS_STR)
1576{
1577 struct peer_group *group;
1578
1579 group = peer_group_lookup (vty->index, argv[0]);
1580 if (group)
1581 peer_group_remote_as_delete (group);
1582 else
1583 {
1584 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1585 return CMD_WARNING;
1586 }
1587 return CMD_SUCCESS;
1588}
David Lamparter6b0655a2014-06-04 06:53:35 +02001589
paul718e3742002-12-13 20:15:29 +00001590DEFUN (neighbor_local_as,
1591 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001592 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001593 NEIGHBOR_STR
1594 NEIGHBOR_ADDR_STR2
1595 "Specify a local-as number\n"
1596 "AS number used as local AS\n")
1597{
1598 struct peer *peer;
1599 int ret;
1600
1601 peer = peer_and_group_lookup_vty (vty, argv[0]);
1602 if (! peer)
1603 return CMD_WARNING;
1604
Andrew Certain9d3f9702012-11-07 23:50:07 +00001605 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
paul718e3742002-12-13 20:15:29 +00001606 return bgp_vty_return (vty, ret);
1607}
1608
1609DEFUN (neighbor_local_as_no_prepend,
1610 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001611 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001612 NEIGHBOR_STR
1613 NEIGHBOR_ADDR_STR2
1614 "Specify a local-as number\n"
1615 "AS number used as local AS\n"
1616 "Do not prepend local-as to updates from ebgp peers\n")
1617{
1618 struct peer *peer;
1619 int ret;
1620
1621 peer = peer_and_group_lookup_vty (vty, argv[0]);
1622 if (! peer)
1623 return CMD_WARNING;
1624
Andrew Certain9d3f9702012-11-07 23:50:07 +00001625 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
paul718e3742002-12-13 20:15:29 +00001626 return bgp_vty_return (vty, ret);
1627}
1628
Andrew Certain9d3f9702012-11-07 23:50:07 +00001629DEFUN (neighbor_local_as_no_prepend_replace_as,
1630 neighbor_local_as_no_prepend_replace_as_cmd,
1631 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1632 NEIGHBOR_STR
1633 NEIGHBOR_ADDR_STR2
1634 "Specify a local-as number\n"
1635 "AS number used as local AS\n"
1636 "Do not prepend local-as to updates from ebgp peers\n"
1637 "Do not prepend local-as to updates from ibgp peers\n")
1638{
1639 struct peer *peer;
1640 int ret;
1641
1642 peer = peer_and_group_lookup_vty (vty, argv[0]);
1643 if (! peer)
1644 return CMD_WARNING;
1645
1646 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
1647 return bgp_vty_return (vty, ret);
1648}
1649
1650
paul718e3742002-12-13 20:15:29 +00001651DEFUN (no_neighbor_local_as,
1652 no_neighbor_local_as_cmd,
1653 NO_NEIGHBOR_CMD2 "local-as",
1654 NO_STR
1655 NEIGHBOR_STR
1656 NEIGHBOR_ADDR_STR2
1657 "Specify a local-as number\n")
1658{
1659 struct peer *peer;
1660 int ret;
1661
1662 peer = peer_and_group_lookup_vty (vty, argv[0]);
1663 if (! peer)
1664 return CMD_WARNING;
1665
1666 ret = peer_local_as_unset (peer);
1667 return bgp_vty_return (vty, ret);
1668}
1669
1670ALIAS (no_neighbor_local_as,
1671 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001672 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001673 NO_STR
1674 NEIGHBOR_STR
1675 NEIGHBOR_ADDR_STR2
1676 "Specify a local-as number\n"
1677 "AS number used as local AS\n")
1678
1679ALIAS (no_neighbor_local_as,
1680 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001681 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001682 NO_STR
1683 NEIGHBOR_STR
1684 NEIGHBOR_ADDR_STR2
1685 "Specify a local-as number\n"
1686 "AS number used as local AS\n"
1687 "Do not prepend local-as to updates from ebgp peers\n")
Andrew Certain9d3f9702012-11-07 23:50:07 +00001688
1689ALIAS (no_neighbor_local_as,
1690 no_neighbor_local_as_val3_cmd,
1691 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1692 NO_STR
1693 NEIGHBOR_STR
1694 NEIGHBOR_ADDR_STR2
1695 "Specify a local-as number\n"
1696 "AS number used as local AS\n"
1697 "Do not prepend local-as to updates from ebgp peers\n"
1698 "Do not prepend local-as to updates from ibgp peers\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001699
Paul Jakma0df7c912008-07-21 21:02:49 +00001700DEFUN (neighbor_password,
1701 neighbor_password_cmd,
1702 NEIGHBOR_CMD2 "password LINE",
1703 NEIGHBOR_STR
1704 NEIGHBOR_ADDR_STR2
1705 "Set a password\n"
1706 "The password\n")
1707{
1708 struct peer *peer;
1709 int ret;
1710
1711 peer = peer_and_group_lookup_vty (vty, argv[0]);
1712 if (! peer)
1713 return CMD_WARNING;
1714
1715 ret = peer_password_set (peer, argv[1]);
1716 return bgp_vty_return (vty, ret);
1717}
1718
1719DEFUN (no_neighbor_password,
1720 no_neighbor_password_cmd,
1721 NO_NEIGHBOR_CMD2 "password",
1722 NO_STR
1723 NEIGHBOR_STR
1724 NEIGHBOR_ADDR_STR2
1725 "Set a password\n")
1726{
1727 struct peer *peer;
1728 int ret;
1729
1730 peer = peer_and_group_lookup_vty (vty, argv[0]);
1731 if (! peer)
1732 return CMD_WARNING;
1733
1734 ret = peer_password_unset (peer);
1735 return bgp_vty_return (vty, ret);
1736}
David Lamparter6b0655a2014-06-04 06:53:35 +02001737
paul718e3742002-12-13 20:15:29 +00001738DEFUN (neighbor_activate,
1739 neighbor_activate_cmd,
1740 NEIGHBOR_CMD2 "activate",
1741 NEIGHBOR_STR
1742 NEIGHBOR_ADDR_STR2
1743 "Enable the Address Family for this Neighbor\n")
1744{
1745 struct peer *peer;
1746
1747 peer = peer_and_group_lookup_vty (vty, argv[0]);
1748 if (! peer)
1749 return CMD_WARNING;
1750
1751 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1752
1753 return CMD_SUCCESS;
1754}
1755
1756DEFUN (no_neighbor_activate,
1757 no_neighbor_activate_cmd,
1758 NO_NEIGHBOR_CMD2 "activate",
1759 NO_STR
1760 NEIGHBOR_STR
1761 NEIGHBOR_ADDR_STR2
1762 "Enable the Address Family for this Neighbor\n")
1763{
1764 int ret;
1765 struct peer *peer;
1766
1767 /* Lookup peer. */
1768 peer = peer_and_group_lookup_vty (vty, argv[0]);
1769 if (! peer)
1770 return CMD_WARNING;
1771
1772 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1773
1774 return bgp_vty_return (vty, ret);
1775}
David Lamparter6b0655a2014-06-04 06:53:35 +02001776
paul718e3742002-12-13 20:15:29 +00001777DEFUN (neighbor_set_peer_group,
1778 neighbor_set_peer_group_cmd,
1779 NEIGHBOR_CMD "peer-group WORD",
1780 NEIGHBOR_STR
1781 NEIGHBOR_ADDR_STR
1782 "Member of the peer-group\n"
1783 "peer-group name\n")
1784{
1785 int ret;
1786 as_t as;
1787 union sockunion su;
1788 struct bgp *bgp;
1789 struct peer_group *group;
1790
1791 bgp = vty->index;
1792
1793 ret = str2sockunion (argv[0], &su);
1794 if (ret < 0)
1795 {
1796 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1797 return CMD_WARNING;
1798 }
1799
1800 group = peer_group_lookup (bgp, argv[1]);
1801 if (! group)
1802 {
1803 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1804 return CMD_WARNING;
1805 }
1806
1807 if (peer_address_self_check (&su))
1808 {
1809 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1810 VTY_NEWLINE);
1811 return CMD_WARNING;
1812 }
1813
1814 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1815 bgp_node_safi (vty), &as);
1816
1817 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1818 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001819 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 +00001820 return CMD_WARNING;
1821 }
1822
1823 return bgp_vty_return (vty, ret);
1824}
1825
1826DEFUN (no_neighbor_set_peer_group,
1827 no_neighbor_set_peer_group_cmd,
1828 NO_NEIGHBOR_CMD "peer-group WORD",
1829 NO_STR
1830 NEIGHBOR_STR
1831 NEIGHBOR_ADDR_STR
1832 "Member of the peer-group\n"
1833 "peer-group name\n")
1834{
1835 int ret;
1836 struct bgp *bgp;
1837 struct peer *peer;
1838 struct peer_group *group;
1839
1840 bgp = vty->index;
1841
1842 peer = peer_lookup_vty (vty, argv[0]);
1843 if (! peer)
1844 return CMD_WARNING;
1845
1846 group = peer_group_lookup (bgp, argv[1]);
1847 if (! group)
1848 {
1849 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1850 return CMD_WARNING;
1851 }
1852
1853 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1854 bgp_node_safi (vty));
1855
1856 return bgp_vty_return (vty, ret);
1857}
David Lamparter6b0655a2014-06-04 06:53:35 +02001858
paul94f2b392005-06-28 12:44:16 +00001859static int
paulfd79ac92004-10-13 05:06:08 +00001860peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1861 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001862{
1863 int ret;
1864 struct peer *peer;
1865
1866 peer = peer_and_group_lookup_vty (vty, ip_str);
1867 if (! peer)
1868 return CMD_WARNING;
1869
1870 if (set)
1871 ret = peer_flag_set (peer, flag);
1872 else
1873 ret = peer_flag_unset (peer, flag);
1874
1875 return bgp_vty_return (vty, ret);
1876}
1877
paul94f2b392005-06-28 12:44:16 +00001878static int
paulfd79ac92004-10-13 05:06:08 +00001879peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001880{
1881 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1882}
1883
paul94f2b392005-06-28 12:44:16 +00001884static int
paulfd79ac92004-10-13 05:06:08 +00001885peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001886{
1887 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1888}
1889
1890/* neighbor passive. */
1891DEFUN (neighbor_passive,
1892 neighbor_passive_cmd,
1893 NEIGHBOR_CMD2 "passive",
1894 NEIGHBOR_STR
1895 NEIGHBOR_ADDR_STR2
1896 "Don't send open messages to this neighbor\n")
1897{
1898 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1899}
1900
1901DEFUN (no_neighbor_passive,
1902 no_neighbor_passive_cmd,
1903 NO_NEIGHBOR_CMD2 "passive",
1904 NO_STR
1905 NEIGHBOR_STR
1906 NEIGHBOR_ADDR_STR2
1907 "Don't send open messages to this neighbor\n")
1908{
1909 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1910}
David Lamparter6b0655a2014-06-04 06:53:35 +02001911
paul718e3742002-12-13 20:15:29 +00001912/* neighbor shutdown. */
1913DEFUN (neighbor_shutdown,
1914 neighbor_shutdown_cmd,
1915 NEIGHBOR_CMD2 "shutdown",
1916 NEIGHBOR_STR
1917 NEIGHBOR_ADDR_STR2
1918 "Administratively shut down this neighbor\n")
1919{
1920 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1921}
1922
1923DEFUN (no_neighbor_shutdown,
1924 no_neighbor_shutdown_cmd,
1925 NO_NEIGHBOR_CMD2 "shutdown",
1926 NO_STR
1927 NEIGHBOR_STR
1928 NEIGHBOR_ADDR_STR2
1929 "Administratively shut down this neighbor\n")
1930{
1931 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1932}
David Lamparter6b0655a2014-06-04 06:53:35 +02001933
hassoc9502432005-02-01 22:01:48 +00001934/* Deprecated neighbor capability route-refresh. */
1935DEFUN_DEPRECATED (neighbor_capability_route_refresh,
1936 neighbor_capability_route_refresh_cmd,
1937 NEIGHBOR_CMD2 "capability route-refresh",
1938 NEIGHBOR_STR
1939 NEIGHBOR_ADDR_STR2
1940 "Advertise capability to the peer\n"
1941 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001942{
hassoc9502432005-02-01 22:01:48 +00001943 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001944}
1945
hassoc9502432005-02-01 22:01:48 +00001946DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
1947 no_neighbor_capability_route_refresh_cmd,
1948 NO_NEIGHBOR_CMD2 "capability route-refresh",
1949 NO_STR
1950 NEIGHBOR_STR
1951 NEIGHBOR_ADDR_STR2
1952 "Advertise capability to the peer\n"
1953 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001954{
hassoc9502432005-02-01 22:01:48 +00001955 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001956}
David Lamparter6b0655a2014-06-04 06:53:35 +02001957
paul718e3742002-12-13 20:15:29 +00001958/* neighbor capability dynamic. */
1959DEFUN (neighbor_capability_dynamic,
1960 neighbor_capability_dynamic_cmd,
1961 NEIGHBOR_CMD2 "capability dynamic",
1962 NEIGHBOR_STR
1963 NEIGHBOR_ADDR_STR2
1964 "Advertise capability to the peer\n"
1965 "Advertise dynamic capability to this neighbor\n")
1966{
1967 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1968}
1969
1970DEFUN (no_neighbor_capability_dynamic,
1971 no_neighbor_capability_dynamic_cmd,
1972 NO_NEIGHBOR_CMD2 "capability dynamic",
1973 NO_STR
1974 NEIGHBOR_STR
1975 NEIGHBOR_ADDR_STR2
1976 "Advertise capability to the peer\n"
1977 "Advertise dynamic capability to this neighbor\n")
1978{
1979 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1980}
David Lamparter6b0655a2014-06-04 06:53:35 +02001981
paul718e3742002-12-13 20:15:29 +00001982/* neighbor dont-capability-negotiate */
1983DEFUN (neighbor_dont_capability_negotiate,
1984 neighbor_dont_capability_negotiate_cmd,
1985 NEIGHBOR_CMD2 "dont-capability-negotiate",
1986 NEIGHBOR_STR
1987 NEIGHBOR_ADDR_STR2
1988 "Do not perform capability negotiation\n")
1989{
1990 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
1991}
1992
1993DEFUN (no_neighbor_dont_capability_negotiate,
1994 no_neighbor_dont_capability_negotiate_cmd,
1995 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
1996 NO_STR
1997 NEIGHBOR_STR
1998 NEIGHBOR_ADDR_STR2
1999 "Do not perform capability negotiation\n")
2000{
2001 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2002}
David Lamparter6b0655a2014-06-04 06:53:35 +02002003
paul94f2b392005-06-28 12:44:16 +00002004static int
paulfd79ac92004-10-13 05:06:08 +00002005peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002006 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002007{
2008 int ret;
2009 struct peer *peer;
2010
2011 peer = peer_and_group_lookup_vty (vty, peer_str);
2012 if (! peer)
2013 return CMD_WARNING;
2014
2015 if (set)
2016 ret = peer_af_flag_set (peer, afi, safi, flag);
2017 else
2018 ret = peer_af_flag_unset (peer, afi, safi, flag);
2019
2020 return bgp_vty_return (vty, ret);
2021}
2022
paul94f2b392005-06-28 12:44:16 +00002023static int
paulfd79ac92004-10-13 05:06:08 +00002024peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002025 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002026{
2027 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
2028}
2029
paul94f2b392005-06-28 12:44:16 +00002030static int
paulfd79ac92004-10-13 05:06:08 +00002031peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002032 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002033{
2034 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
2035}
David Lamparter6b0655a2014-06-04 06:53:35 +02002036
paul718e3742002-12-13 20:15:29 +00002037/* neighbor capability orf prefix-list. */
2038DEFUN (neighbor_capability_orf_prefix,
2039 neighbor_capability_orf_prefix_cmd,
2040 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2041 NEIGHBOR_STR
2042 NEIGHBOR_ADDR_STR2
2043 "Advertise capability to the peer\n"
2044 "Advertise ORF capability to the peer\n"
2045 "Advertise prefixlist ORF capability to this neighbor\n"
2046 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2047 "Capability to RECEIVE the ORF from this neighbor\n"
2048 "Capability to SEND the ORF to this neighbor\n")
2049{
2050 u_int16_t flag = 0;
2051
2052 if (strncmp (argv[1], "s", 1) == 0)
2053 flag = PEER_FLAG_ORF_PREFIX_SM;
2054 else if (strncmp (argv[1], "r", 1) == 0)
2055 flag = PEER_FLAG_ORF_PREFIX_RM;
2056 else if (strncmp (argv[1], "b", 1) == 0)
2057 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2058 else
2059 return CMD_WARNING;
2060
2061 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2062 bgp_node_safi (vty), flag);
2063}
2064
2065DEFUN (no_neighbor_capability_orf_prefix,
2066 no_neighbor_capability_orf_prefix_cmd,
2067 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2068 NO_STR
2069 NEIGHBOR_STR
2070 NEIGHBOR_ADDR_STR2
2071 "Advertise capability to the peer\n"
2072 "Advertise ORF capability to the peer\n"
2073 "Advertise prefixlist ORF capability to this neighbor\n"
2074 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2075 "Capability to RECEIVE the ORF from this neighbor\n"
2076 "Capability to SEND the ORF to this neighbor\n")
2077{
2078 u_int16_t flag = 0;
2079
2080 if (strncmp (argv[1], "s", 1) == 0)
2081 flag = PEER_FLAG_ORF_PREFIX_SM;
2082 else if (strncmp (argv[1], "r", 1) == 0)
2083 flag = PEER_FLAG_ORF_PREFIX_RM;
2084 else if (strncmp (argv[1], "b", 1) == 0)
2085 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2086 else
2087 return CMD_WARNING;
2088
2089 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2090 bgp_node_safi (vty), flag);
2091}
David Lamparter6b0655a2014-06-04 06:53:35 +02002092
paul718e3742002-12-13 20:15:29 +00002093/* neighbor next-hop-self. */
2094DEFUN (neighbor_nexthop_self,
2095 neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002096 NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002097 NEIGHBOR_STR
2098 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002099 "Disable the next hop calculation for this neighbor\n"
2100 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002101{
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002102 u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
2103 int rc;
2104
2105 /* Check if "all" is specified */
2106 if (argv[1] != NULL)
2107 flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
2108 else
2109 unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
2110
2111 rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2112 bgp_node_safi (vty), flags);
2113 if ( rc == CMD_SUCCESS && unset )
2114 rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2115 bgp_node_safi (vty), unset);
2116 return rc;
paul718e3742002-12-13 20:15:29 +00002117}
2118
2119DEFUN (no_neighbor_nexthop_self,
2120 no_neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002121 NO_NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002122 NO_STR
2123 NEIGHBOR_STR
2124 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002125 "Disable the next hop calculation for this neighbor\n"
2126 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002127{
2128 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002129 bgp_node_safi (vty),
2130 PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
paul718e3742002-12-13 20:15:29 +00002131}
David Lamparter6b0655a2014-06-04 06:53:35 +02002132
paul718e3742002-12-13 20:15:29 +00002133/* neighbor remove-private-AS. */
2134DEFUN (neighbor_remove_private_as,
2135 neighbor_remove_private_as_cmd,
2136 NEIGHBOR_CMD2 "remove-private-AS",
2137 NEIGHBOR_STR
2138 NEIGHBOR_ADDR_STR2
2139 "Remove private AS number from outbound updates\n")
2140{
2141 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2142 bgp_node_safi (vty),
2143 PEER_FLAG_REMOVE_PRIVATE_AS);
2144}
2145
2146DEFUN (no_neighbor_remove_private_as,
2147 no_neighbor_remove_private_as_cmd,
2148 NO_NEIGHBOR_CMD2 "remove-private-AS",
2149 NO_STR
2150 NEIGHBOR_STR
2151 NEIGHBOR_ADDR_STR2
2152 "Remove private AS number from outbound updates\n")
2153{
2154 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2155 bgp_node_safi (vty),
2156 PEER_FLAG_REMOVE_PRIVATE_AS);
2157}
David Lamparter6b0655a2014-06-04 06:53:35 +02002158
paul718e3742002-12-13 20:15:29 +00002159/* neighbor send-community. */
2160DEFUN (neighbor_send_community,
2161 neighbor_send_community_cmd,
2162 NEIGHBOR_CMD2 "send-community",
2163 NEIGHBOR_STR
2164 NEIGHBOR_ADDR_STR2
2165 "Send Community attribute to this neighbor\n")
2166{
2167 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2168 bgp_node_safi (vty),
2169 PEER_FLAG_SEND_COMMUNITY);
2170}
2171
2172DEFUN (no_neighbor_send_community,
2173 no_neighbor_send_community_cmd,
2174 NO_NEIGHBOR_CMD2 "send-community",
2175 NO_STR
2176 NEIGHBOR_STR
2177 NEIGHBOR_ADDR_STR2
2178 "Send Community attribute to this neighbor\n")
2179{
2180 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2181 bgp_node_safi (vty),
2182 PEER_FLAG_SEND_COMMUNITY);
2183}
David Lamparter6b0655a2014-06-04 06:53:35 +02002184
paul718e3742002-12-13 20:15:29 +00002185/* neighbor send-community extended. */
2186DEFUN (neighbor_send_community_type,
2187 neighbor_send_community_type_cmd,
2188 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2189 NEIGHBOR_STR
2190 NEIGHBOR_ADDR_STR2
2191 "Send Community attribute to this neighbor\n"
2192 "Send Standard and Extended Community attributes\n"
2193 "Send Extended Community attributes\n"
2194 "Send Standard Community attributes\n")
2195{
2196 if (strncmp (argv[1], "s", 1) == 0)
2197 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2198 bgp_node_safi (vty),
2199 PEER_FLAG_SEND_COMMUNITY);
2200 if (strncmp (argv[1], "e", 1) == 0)
2201 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2202 bgp_node_safi (vty),
2203 PEER_FLAG_SEND_EXT_COMMUNITY);
2204
2205 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2206 bgp_node_safi (vty),
2207 (PEER_FLAG_SEND_COMMUNITY|
2208 PEER_FLAG_SEND_EXT_COMMUNITY));
2209}
2210
2211DEFUN (no_neighbor_send_community_type,
2212 no_neighbor_send_community_type_cmd,
2213 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2214 NO_STR
2215 NEIGHBOR_STR
2216 NEIGHBOR_ADDR_STR2
2217 "Send Community attribute to this neighbor\n"
2218 "Send Standard and Extended Community attributes\n"
2219 "Send Extended Community attributes\n"
2220 "Send Standard Community attributes\n")
2221{
2222 if (strncmp (argv[1], "s", 1) == 0)
2223 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2224 bgp_node_safi (vty),
2225 PEER_FLAG_SEND_COMMUNITY);
2226 if (strncmp (argv[1], "e", 1) == 0)
2227 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2228 bgp_node_safi (vty),
2229 PEER_FLAG_SEND_EXT_COMMUNITY);
2230
2231 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2232 bgp_node_safi (vty),
2233 (PEER_FLAG_SEND_COMMUNITY |
2234 PEER_FLAG_SEND_EXT_COMMUNITY));
2235}
David Lamparter6b0655a2014-06-04 06:53:35 +02002236
paul718e3742002-12-13 20:15:29 +00002237/* neighbor soft-reconfig. */
2238DEFUN (neighbor_soft_reconfiguration,
2239 neighbor_soft_reconfiguration_cmd,
2240 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2241 NEIGHBOR_STR
2242 NEIGHBOR_ADDR_STR2
2243 "Per neighbor soft reconfiguration\n"
2244 "Allow inbound soft reconfiguration for this neighbor\n")
2245{
2246 return peer_af_flag_set_vty (vty, argv[0],
2247 bgp_node_afi (vty), bgp_node_safi (vty),
2248 PEER_FLAG_SOFT_RECONFIG);
2249}
2250
2251DEFUN (no_neighbor_soft_reconfiguration,
2252 no_neighbor_soft_reconfiguration_cmd,
2253 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2254 NO_STR
2255 NEIGHBOR_STR
2256 NEIGHBOR_ADDR_STR2
2257 "Per neighbor soft reconfiguration\n"
2258 "Allow inbound soft reconfiguration for this neighbor\n")
2259{
2260 return peer_af_flag_unset_vty (vty, argv[0],
2261 bgp_node_afi (vty), bgp_node_safi (vty),
2262 PEER_FLAG_SOFT_RECONFIG);
2263}
David Lamparter6b0655a2014-06-04 06:53:35 +02002264
paul718e3742002-12-13 20:15:29 +00002265DEFUN (neighbor_route_reflector_client,
2266 neighbor_route_reflector_client_cmd,
2267 NEIGHBOR_CMD2 "route-reflector-client",
2268 NEIGHBOR_STR
2269 NEIGHBOR_ADDR_STR2
2270 "Configure a neighbor as Route Reflector client\n")
2271{
2272 struct peer *peer;
2273
2274
2275 peer = peer_and_group_lookup_vty (vty, argv[0]);
2276 if (! peer)
2277 return CMD_WARNING;
2278
2279 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2280 bgp_node_safi (vty),
2281 PEER_FLAG_REFLECTOR_CLIENT);
2282}
2283
2284DEFUN (no_neighbor_route_reflector_client,
2285 no_neighbor_route_reflector_client_cmd,
2286 NO_NEIGHBOR_CMD2 "route-reflector-client",
2287 NO_STR
2288 NEIGHBOR_STR
2289 NEIGHBOR_ADDR_STR2
2290 "Configure a neighbor as Route Reflector client\n")
2291{
2292 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2293 bgp_node_safi (vty),
2294 PEER_FLAG_REFLECTOR_CLIENT);
2295}
David Lamparter6b0655a2014-06-04 06:53:35 +02002296
paul94f2b392005-06-28 12:44:16 +00002297static int
paulfd79ac92004-10-13 05:06:08 +00002298peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2299 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002300{
2301 int ret;
2302 struct bgp *bgp;
2303 struct peer *peer;
2304 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002305 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002306 struct bgp_filter *pfilter;
2307 struct bgp_filter *gfilter;
Chris Caputo228da422009-07-18 05:44:03 +00002308 int locked_and_added = 0;
paulfee0f4c2004-09-13 05:12:46 +00002309
2310 bgp = vty->index;
2311
2312 peer = peer_and_group_lookup_vty (vty, peer_str);
2313 if ( ! peer )
2314 return CMD_WARNING;
2315
2316 /* If it is already a RS-Client, don't do anything. */
2317 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2318 return CMD_SUCCESS;
2319
2320 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002321 {
2322 peer = peer_lock (peer); /* rsclient peer list reference */
2323 listnode_add_sort (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002324 locked_and_added = 1;
paul200df112005-06-01 11:17:05 +00002325 }
paulfee0f4c2004-09-13 05:12:46 +00002326
2327 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2328 if (ret < 0)
Chris Caputo228da422009-07-18 05:44:03 +00002329 {
2330 if (locked_and_added)
2331 {
2332 listnode_delete (bgp->rsclient, peer);
2333 peer_unlock (peer); /* rsclient peer list reference */
2334 }
2335
2336 return bgp_vty_return (vty, ret);
2337 }
paulfee0f4c2004-09-13 05:12:46 +00002338
Paul Jakma64e580a2006-02-21 01:09:01 +00002339 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002340 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
Chris Caputo228da422009-07-18 05:44:03 +00002341 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2342 peer->rib[afi][safi]->owner = peer_lock (peer);
paulfee0f4c2004-09-13 05:12:46 +00002343
2344 /* Check for existing 'network' and 'redistribute' routes. */
2345 bgp_check_local_routes_rsclient (peer, afi, safi);
2346
2347 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2348 bgp_soft_reconfig_rsclient (peer, afi, safi);
2349
2350 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2351 {
2352 group = peer->group;
2353 gfilter = &peer->filter[afi][safi];
2354
paul1eb8ef22005-04-07 07:30:20 +00002355 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002356 {
2357 pfilter = &peer->filter[afi][safi];
2358
2359 /* Members of a non-RS-Client group should not be RS-Clients, as that
2360 is checked when the become part of the peer-group */
2361 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2362 if (ret < 0)
2363 return bgp_vty_return (vty, ret);
2364
2365 /* Make peer's RIB point to group's RIB. */
2366 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2367
2368 /* Import policy. */
2369 if (pfilter->map[RMAP_IMPORT].name)
2370 free (pfilter->map[RMAP_IMPORT].name);
2371 if (gfilter->map[RMAP_IMPORT].name)
2372 {
2373 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2374 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2375 }
2376 else
2377 {
2378 pfilter->map[RMAP_IMPORT].name = NULL;
2379 pfilter->map[RMAP_IMPORT].map =NULL;
2380 }
2381
2382 /* Export policy. */
2383 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2384 {
2385 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2386 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2387 }
2388 }
2389 }
2390 return CMD_SUCCESS;
2391}
2392
paul94f2b392005-06-28 12:44:16 +00002393static int
paulfd79ac92004-10-13 05:06:08 +00002394peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2395 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002396{
2397 int ret;
2398 struct bgp *bgp;
2399 struct peer *peer;
2400 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002401 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002402
2403 bgp = vty->index;
2404
2405 peer = peer_and_group_lookup_vty (vty, peer_str);
2406 if ( ! peer )
2407 return CMD_WARNING;
2408
2409 /* If it is not a RS-Client, don't do anything. */
2410 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2411 return CMD_SUCCESS;
2412
2413 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2414 {
2415 group = peer->group;
2416
paul1eb8ef22005-04-07 07:30:20 +00002417 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002418 {
2419 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2420 if (ret < 0)
2421 return bgp_vty_return (vty, ret);
2422
2423 peer->rib[afi][safi] = NULL;
2424 }
2425
2426 peer = group->conf;
2427 }
2428
2429 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2430 if (ret < 0)
2431 return bgp_vty_return (vty, ret);
2432
2433 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002434 {
Chris Caputo228da422009-07-18 05:44:03 +00002435 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
paul200df112005-06-01 11:17:05 +00002436 listnode_delete (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002437 peer_unlock (peer); /* peer bgp rsclient reference */
paul200df112005-06-01 11:17:05 +00002438 }
paulfee0f4c2004-09-13 05:12:46 +00002439
Paul Jakmab608d5b2008-07-02 02:12:07 +00002440 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002441
2442 return CMD_SUCCESS;
2443}
David Lamparter6b0655a2014-06-04 06:53:35 +02002444
paul718e3742002-12-13 20:15:29 +00002445/* neighbor route-server-client. */
2446DEFUN (neighbor_route_server_client,
2447 neighbor_route_server_client_cmd,
2448 NEIGHBOR_CMD2 "route-server-client",
2449 NEIGHBOR_STR
2450 NEIGHBOR_ADDR_STR2
2451 "Configure a neighbor as Route Server client\n")
2452{
paulfee0f4c2004-09-13 05:12:46 +00002453 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2454 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002455}
2456
2457DEFUN (no_neighbor_route_server_client,
2458 no_neighbor_route_server_client_cmd,
2459 NO_NEIGHBOR_CMD2 "route-server-client",
2460 NO_STR
2461 NEIGHBOR_STR
2462 NEIGHBOR_ADDR_STR2
2463 "Configure a neighbor as Route Server client\n")
2464{
paulfee0f4c2004-09-13 05:12:46 +00002465 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2466 bgp_node_safi(vty));
2467}
David Lamparter6b0655a2014-06-04 06:53:35 +02002468
paulfee0f4c2004-09-13 05:12:46 +00002469DEFUN (neighbor_nexthop_local_unchanged,
2470 neighbor_nexthop_local_unchanged_cmd,
2471 NEIGHBOR_CMD2 "nexthop-local unchanged",
2472 NEIGHBOR_STR
2473 NEIGHBOR_ADDR_STR2
2474 "Configure treatment of outgoing link-local nexthop attribute\n"
2475 "Leave link-local nexthop unchanged for this peer\n")
2476{
2477 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2478 bgp_node_safi (vty),
2479 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2480}
David Lamparter6b0655a2014-06-04 06:53:35 +02002481
paulfee0f4c2004-09-13 05:12:46 +00002482DEFUN (no_neighbor_nexthop_local_unchanged,
2483 no_neighbor_nexthop_local_unchanged_cmd,
2484 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2485 NO_STR
2486 NEIGHBOR_STR
2487 NEIGHBOR_ADDR_STR2
2488 "Configure treatment of outgoing link-local-nexthop attribute\n"
2489 "Leave link-local nexthop unchanged for this peer\n")
2490{
paul718e3742002-12-13 20:15:29 +00002491 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2492 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002493 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002494}
David Lamparter6b0655a2014-06-04 06:53:35 +02002495
paul718e3742002-12-13 20:15:29 +00002496DEFUN (neighbor_attr_unchanged,
2497 neighbor_attr_unchanged_cmd,
2498 NEIGHBOR_CMD2 "attribute-unchanged",
2499 NEIGHBOR_STR
2500 NEIGHBOR_ADDR_STR2
2501 "BGP attribute is propagated unchanged to this neighbor\n")
2502{
2503 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2504 bgp_node_safi (vty),
2505 (PEER_FLAG_AS_PATH_UNCHANGED |
2506 PEER_FLAG_NEXTHOP_UNCHANGED |
2507 PEER_FLAG_MED_UNCHANGED));
2508}
2509
2510DEFUN (neighbor_attr_unchanged1,
2511 neighbor_attr_unchanged1_cmd,
2512 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2513 NEIGHBOR_STR
2514 NEIGHBOR_ADDR_STR2
2515 "BGP attribute is propagated unchanged to this neighbor\n"
2516 "As-path attribute\n"
2517 "Nexthop attribute\n"
2518 "Med attribute\n")
2519{
2520 u_int16_t flags = 0;
2521
2522 if (strncmp (argv[1], "as-path", 1) == 0)
2523 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2524 else if (strncmp (argv[1], "next-hop", 1) == 0)
2525 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2526 else if (strncmp (argv[1], "med", 1) == 0)
2527 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2528
2529 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2530 bgp_node_safi (vty), flags);
2531}
2532
2533DEFUN (neighbor_attr_unchanged2,
2534 neighbor_attr_unchanged2_cmd,
2535 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2536 NEIGHBOR_STR
2537 NEIGHBOR_ADDR_STR2
2538 "BGP attribute is propagated unchanged to this neighbor\n"
2539 "As-path attribute\n"
2540 "Nexthop attribute\n"
2541 "Med attribute\n")
2542{
2543 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2544
2545 if (strncmp (argv[1], "next-hop", 1) == 0)
2546 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2547 else if (strncmp (argv[1], "med", 1) == 0)
2548 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2549
2550 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2551 bgp_node_safi (vty), flags);
2552
2553}
2554
2555DEFUN (neighbor_attr_unchanged3,
2556 neighbor_attr_unchanged3_cmd,
2557 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2558 NEIGHBOR_STR
2559 NEIGHBOR_ADDR_STR2
2560 "BGP attribute is propagated unchanged to this neighbor\n"
2561 "Nexthop attribute\n"
2562 "As-path attribute\n"
2563 "Med attribute\n")
2564{
2565 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2566
2567 if (strncmp (argv[1], "as-path", 1) == 0)
2568 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2569 else if (strncmp (argv[1], "med", 1) == 0)
2570 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2571
2572 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2573 bgp_node_safi (vty), flags);
2574}
2575
2576DEFUN (neighbor_attr_unchanged4,
2577 neighbor_attr_unchanged4_cmd,
2578 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2579 NEIGHBOR_STR
2580 NEIGHBOR_ADDR_STR2
2581 "BGP attribute is propagated unchanged to this neighbor\n"
2582 "Med attribute\n"
2583 "As-path attribute\n"
2584 "Nexthop attribute\n")
2585{
2586 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2587
2588 if (strncmp (argv[1], "as-path", 1) == 0)
2589 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2590 else if (strncmp (argv[1], "next-hop", 1) == 0)
2591 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2592
2593 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2594 bgp_node_safi (vty), flags);
2595}
2596
2597ALIAS (neighbor_attr_unchanged,
2598 neighbor_attr_unchanged5_cmd,
2599 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2600 NEIGHBOR_STR
2601 NEIGHBOR_ADDR_STR2
2602 "BGP attribute is propagated unchanged to this neighbor\n"
2603 "As-path attribute\n"
2604 "Nexthop attribute\n"
2605 "Med attribute\n")
2606
2607ALIAS (neighbor_attr_unchanged,
2608 neighbor_attr_unchanged6_cmd,
2609 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2610 NEIGHBOR_STR
2611 NEIGHBOR_ADDR_STR2
2612 "BGP attribute is propagated unchanged to this neighbor\n"
2613 "As-path attribute\n"
2614 "Med attribute\n"
2615 "Nexthop attribute\n")
2616
2617ALIAS (neighbor_attr_unchanged,
2618 neighbor_attr_unchanged7_cmd,
2619 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2620 NEIGHBOR_STR
2621 NEIGHBOR_ADDR_STR2
2622 "BGP attribute is propagated unchanged to this neighbor\n"
2623 "Nexthop attribute\n"
2624 "Med attribute\n"
2625 "As-path attribute\n")
2626
2627ALIAS (neighbor_attr_unchanged,
2628 neighbor_attr_unchanged8_cmd,
2629 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2630 NEIGHBOR_STR
2631 NEIGHBOR_ADDR_STR2
2632 "BGP attribute is propagated unchanged to this neighbor\n"
2633 "Nexthop attribute\n"
2634 "As-path attribute\n"
2635 "Med attribute\n")
2636
2637ALIAS (neighbor_attr_unchanged,
2638 neighbor_attr_unchanged9_cmd,
2639 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2640 NEIGHBOR_STR
2641 NEIGHBOR_ADDR_STR2
2642 "BGP attribute is propagated unchanged to this neighbor\n"
2643 "Med attribute\n"
2644 "Nexthop attribute\n"
2645 "As-path attribute\n")
2646
2647ALIAS (neighbor_attr_unchanged,
2648 neighbor_attr_unchanged10_cmd,
2649 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2650 NEIGHBOR_STR
2651 NEIGHBOR_ADDR_STR2
2652 "BGP attribute is propagated unchanged to this neighbor\n"
2653 "Med attribute\n"
2654 "As-path attribute\n"
2655 "Nexthop attribute\n")
2656
2657DEFUN (no_neighbor_attr_unchanged,
2658 no_neighbor_attr_unchanged_cmd,
2659 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2660 NO_STR
2661 NEIGHBOR_STR
2662 NEIGHBOR_ADDR_STR2
2663 "BGP attribute is propagated unchanged to this neighbor\n")
2664{
2665 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2666 bgp_node_safi (vty),
2667 (PEER_FLAG_AS_PATH_UNCHANGED |
2668 PEER_FLAG_NEXTHOP_UNCHANGED |
2669 PEER_FLAG_MED_UNCHANGED));
2670}
2671
2672DEFUN (no_neighbor_attr_unchanged1,
2673 no_neighbor_attr_unchanged1_cmd,
2674 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2675 NO_STR
2676 NEIGHBOR_STR
2677 NEIGHBOR_ADDR_STR2
2678 "BGP attribute is propagated unchanged to this neighbor\n"
2679 "As-path attribute\n"
2680 "Nexthop attribute\n"
2681 "Med attribute\n")
2682{
2683 u_int16_t flags = 0;
2684
2685 if (strncmp (argv[1], "as-path", 1) == 0)
2686 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2687 else if (strncmp (argv[1], "next-hop", 1) == 0)
2688 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2689 else if (strncmp (argv[1], "med", 1) == 0)
2690 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2691
2692 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2693 bgp_node_safi (vty), flags);
2694}
2695
2696DEFUN (no_neighbor_attr_unchanged2,
2697 no_neighbor_attr_unchanged2_cmd,
2698 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2699 NO_STR
2700 NEIGHBOR_STR
2701 NEIGHBOR_ADDR_STR2
2702 "BGP attribute is propagated unchanged to this neighbor\n"
2703 "As-path attribute\n"
2704 "Nexthop attribute\n"
2705 "Med attribute\n")
2706{
2707 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2708
2709 if (strncmp (argv[1], "next-hop", 1) == 0)
2710 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2711 else if (strncmp (argv[1], "med", 1) == 0)
2712 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2713
2714 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2715 bgp_node_safi (vty), flags);
2716}
2717
2718DEFUN (no_neighbor_attr_unchanged3,
2719 no_neighbor_attr_unchanged3_cmd,
2720 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2721 NO_STR
2722 NEIGHBOR_STR
2723 NEIGHBOR_ADDR_STR2
2724 "BGP attribute is propagated unchanged to this neighbor\n"
2725 "Nexthop attribute\n"
2726 "As-path attribute\n"
2727 "Med attribute\n")
2728{
2729 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2730
2731 if (strncmp (argv[1], "as-path", 1) == 0)
2732 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2733 else if (strncmp (argv[1], "med", 1) == 0)
2734 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2735
2736 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2737 bgp_node_safi (vty), flags);
2738}
2739
2740DEFUN (no_neighbor_attr_unchanged4,
2741 no_neighbor_attr_unchanged4_cmd,
2742 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2743 NO_STR
2744 NEIGHBOR_STR
2745 NEIGHBOR_ADDR_STR2
2746 "BGP attribute is propagated unchanged to this neighbor\n"
2747 "Med attribute\n"
2748 "As-path attribute\n"
2749 "Nexthop attribute\n")
2750{
2751 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2752
2753 if (strncmp (argv[1], "as-path", 1) == 0)
2754 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2755 else if (strncmp (argv[1], "next-hop", 1) == 0)
2756 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2757
2758 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2759 bgp_node_safi (vty), flags);
2760}
2761
2762ALIAS (no_neighbor_attr_unchanged,
2763 no_neighbor_attr_unchanged5_cmd,
2764 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2765 NO_STR
2766 NEIGHBOR_STR
2767 NEIGHBOR_ADDR_STR2
2768 "BGP attribute is propagated unchanged to this neighbor\n"
2769 "As-path attribute\n"
2770 "Nexthop attribute\n"
2771 "Med attribute\n")
2772
2773ALIAS (no_neighbor_attr_unchanged,
2774 no_neighbor_attr_unchanged6_cmd,
2775 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2776 NO_STR
2777 NEIGHBOR_STR
2778 NEIGHBOR_ADDR_STR2
2779 "BGP attribute is propagated unchanged to this neighbor\n"
2780 "As-path attribute\n"
2781 "Med attribute\n"
2782 "Nexthop attribute\n")
2783
2784ALIAS (no_neighbor_attr_unchanged,
2785 no_neighbor_attr_unchanged7_cmd,
2786 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2787 NO_STR
2788 NEIGHBOR_STR
2789 NEIGHBOR_ADDR_STR2
2790 "BGP attribute is propagated unchanged to this neighbor\n"
2791 "Nexthop attribute\n"
2792 "Med attribute\n"
2793 "As-path attribute\n")
2794
2795ALIAS (no_neighbor_attr_unchanged,
2796 no_neighbor_attr_unchanged8_cmd,
2797 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2798 NO_STR
2799 NEIGHBOR_STR
2800 NEIGHBOR_ADDR_STR2
2801 "BGP attribute is propagated unchanged to this neighbor\n"
2802 "Nexthop attribute\n"
2803 "As-path attribute\n"
2804 "Med attribute\n")
2805
2806ALIAS (no_neighbor_attr_unchanged,
2807 no_neighbor_attr_unchanged9_cmd,
2808 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2809 NO_STR
2810 NEIGHBOR_STR
2811 NEIGHBOR_ADDR_STR2
2812 "BGP attribute is propagated unchanged to this neighbor\n"
2813 "Med attribute\n"
2814 "Nexthop attribute\n"
2815 "As-path attribute\n")
2816
2817ALIAS (no_neighbor_attr_unchanged,
2818 no_neighbor_attr_unchanged10_cmd,
2819 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2820 NO_STR
2821 NEIGHBOR_STR
2822 NEIGHBOR_ADDR_STR2
2823 "BGP attribute is propagated unchanged to this neighbor\n"
2824 "Med attribute\n"
2825 "As-path attribute\n"
2826 "Nexthop attribute\n")
2827
2828/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002829DEFUN_DEPRECATED (neighbor_transparent_as,
2830 neighbor_transparent_as_cmd,
2831 NEIGHBOR_CMD "transparent-as",
2832 NEIGHBOR_STR
2833 NEIGHBOR_ADDR_STR
2834 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002835{
2836 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2837 bgp_node_safi (vty),
2838 PEER_FLAG_AS_PATH_UNCHANGED);
2839}
2840
hassodd4c5932005-02-02 17:15:34 +00002841DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2842 neighbor_transparent_nexthop_cmd,
2843 NEIGHBOR_CMD "transparent-nexthop",
2844 NEIGHBOR_STR
2845 NEIGHBOR_ADDR_STR
2846 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002847{
2848 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2849 bgp_node_safi (vty),
2850 PEER_FLAG_NEXTHOP_UNCHANGED);
2851}
David Lamparter6b0655a2014-06-04 06:53:35 +02002852
paul718e3742002-12-13 20:15:29 +00002853/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00002854static int
paulfd79ac92004-10-13 05:06:08 +00002855peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2856 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002857{
2858 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002859 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002860
2861 peer = peer_and_group_lookup_vty (vty, ip_str);
2862 if (! peer)
2863 return CMD_WARNING;
2864
2865 if (! ttl_str)
2866 ttl = TTL_MAX;
2867 else
2868 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2869
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002870 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
paul718e3742002-12-13 20:15:29 +00002871}
2872
paul94f2b392005-06-28 12:44:16 +00002873static int
paulfd79ac92004-10-13 05:06:08 +00002874peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002875{
2876 struct peer *peer;
2877
2878 peer = peer_and_group_lookup_vty (vty, ip_str);
2879 if (! peer)
2880 return CMD_WARNING;
2881
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002882 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
paul718e3742002-12-13 20:15:29 +00002883}
2884
2885/* neighbor ebgp-multihop. */
2886DEFUN (neighbor_ebgp_multihop,
2887 neighbor_ebgp_multihop_cmd,
2888 NEIGHBOR_CMD2 "ebgp-multihop",
2889 NEIGHBOR_STR
2890 NEIGHBOR_ADDR_STR2
2891 "Allow EBGP neighbors not on directly connected networks\n")
2892{
2893 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2894}
2895
2896DEFUN (neighbor_ebgp_multihop_ttl,
2897 neighbor_ebgp_multihop_ttl_cmd,
2898 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2899 NEIGHBOR_STR
2900 NEIGHBOR_ADDR_STR2
2901 "Allow EBGP neighbors not on directly connected networks\n"
2902 "maximum hop count\n")
2903{
2904 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
2905}
2906
2907DEFUN (no_neighbor_ebgp_multihop,
2908 no_neighbor_ebgp_multihop_cmd,
2909 NO_NEIGHBOR_CMD2 "ebgp-multihop",
2910 NO_STR
2911 NEIGHBOR_STR
2912 NEIGHBOR_ADDR_STR2
2913 "Allow EBGP neighbors not on directly connected networks\n")
2914{
2915 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
2916}
2917
2918ALIAS (no_neighbor_ebgp_multihop,
2919 no_neighbor_ebgp_multihop_ttl_cmd,
2920 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2921 NO_STR
2922 NEIGHBOR_STR
2923 NEIGHBOR_ADDR_STR2
2924 "Allow EBGP neighbors not on directly connected networks\n"
2925 "maximum hop count\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02002926
hasso6ffd2072005-02-02 14:50:11 +00002927/* disable-connected-check */
2928DEFUN (neighbor_disable_connected_check,
2929 neighbor_disable_connected_check_cmd,
2930 NEIGHBOR_CMD2 "disable-connected-check",
2931 NEIGHBOR_STR
2932 NEIGHBOR_ADDR_STR2
2933 "one-hop away EBGP peer using loopback address\n")
2934{
2935 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2936}
2937
2938DEFUN (no_neighbor_disable_connected_check,
2939 no_neighbor_disable_connected_check_cmd,
2940 NO_NEIGHBOR_CMD2 "disable-connected-check",
2941 NO_STR
2942 NEIGHBOR_STR
2943 NEIGHBOR_ADDR_STR2
2944 "one-hop away EBGP peer using loopback address\n")
2945{
2946 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2947}
2948
paul718e3742002-12-13 20:15:29 +00002949/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00002950ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002951 neighbor_enforce_multihop_cmd,
2952 NEIGHBOR_CMD2 "enforce-multihop",
2953 NEIGHBOR_STR
2954 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002955 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00002956
hasso6ffd2072005-02-02 14:50:11 +00002957/* Enforce multihop. */
2958ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002959 no_neighbor_enforce_multihop_cmd,
2960 NO_NEIGHBOR_CMD2 "enforce-multihop",
2961 NO_STR
2962 NEIGHBOR_STR
2963 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002964 "Enforce EBGP neighbors perform multihop\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02002965
paul718e3742002-12-13 20:15:29 +00002966DEFUN (neighbor_description,
2967 neighbor_description_cmd,
2968 NEIGHBOR_CMD2 "description .LINE",
2969 NEIGHBOR_STR
2970 NEIGHBOR_ADDR_STR2
2971 "Neighbor specific description\n"
2972 "Up to 80 characters describing this neighbor\n")
2973{
2974 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00002975 char *str;
paul718e3742002-12-13 20:15:29 +00002976
2977 peer = peer_and_group_lookup_vty (vty, argv[0]);
2978 if (! peer)
2979 return CMD_WARNING;
2980
2981 if (argc == 1)
2982 return CMD_SUCCESS;
2983
ajs3b8b1852005-01-29 18:19:13 +00002984 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00002985
2986 peer_description_set (peer, str);
2987
ajs3b8b1852005-01-29 18:19:13 +00002988 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00002989
2990 return CMD_SUCCESS;
2991}
2992
2993DEFUN (no_neighbor_description,
2994 no_neighbor_description_cmd,
2995 NO_NEIGHBOR_CMD2 "description",
2996 NO_STR
2997 NEIGHBOR_STR
2998 NEIGHBOR_ADDR_STR2
2999 "Neighbor specific description\n")
3000{
3001 struct peer *peer;
3002
3003 peer = peer_and_group_lookup_vty (vty, argv[0]);
3004 if (! peer)
3005 return CMD_WARNING;
3006
3007 peer_description_unset (peer);
3008
3009 return CMD_SUCCESS;
3010}
3011
3012ALIAS (no_neighbor_description,
3013 no_neighbor_description_val_cmd,
3014 NO_NEIGHBOR_CMD2 "description .LINE",
3015 NO_STR
3016 NEIGHBOR_STR
3017 NEIGHBOR_ADDR_STR2
3018 "Neighbor specific description\n"
3019 "Up to 80 characters describing this neighbor\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003020
paul718e3742002-12-13 20:15:29 +00003021/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00003022static int
paulfd79ac92004-10-13 05:06:08 +00003023peer_update_source_vty (struct vty *vty, const char *peer_str,
3024 const char *source_str)
paul718e3742002-12-13 20:15:29 +00003025{
3026 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003027
3028 peer = peer_and_group_lookup_vty (vty, peer_str);
3029 if (! peer)
3030 return CMD_WARNING;
3031
3032 if (source_str)
3033 {
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +02003034 union sockunion su;
3035 int ret = str2sockunion (source_str, &su);
3036
3037 if (ret == 0)
3038 peer_update_source_addr_set (peer, &su);
paul718e3742002-12-13 20:15:29 +00003039 else
3040 peer_update_source_if_set (peer, source_str);
3041 }
3042 else
3043 peer_update_source_unset (peer);
3044
3045 return CMD_SUCCESS;
3046}
3047
Paul Jakma9a1a3312009-07-27 12:27:55 +01003048#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
Paul Jakma369688c2006-05-23 22:27:55 +00003049#define BGP_UPDATE_SOURCE_HELP_STR \
3050 "IPv4 address\n" \
Paul Jakma9a1a3312009-07-27 12:27:55 +01003051 "IPv6 address\n" \
3052 "Interface name (requires zebra to be running)\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003053
paul718e3742002-12-13 20:15:29 +00003054DEFUN (neighbor_update_source,
3055 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00003056 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00003057 NEIGHBOR_STR
3058 NEIGHBOR_ADDR_STR2
3059 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003060 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00003061{
3062 return peer_update_source_vty (vty, argv[0], argv[1]);
3063}
3064
3065DEFUN (no_neighbor_update_source,
3066 no_neighbor_update_source_cmd,
3067 NO_NEIGHBOR_CMD2 "update-source",
3068 NO_STR
3069 NEIGHBOR_STR
3070 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00003071 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00003072{
3073 return peer_update_source_vty (vty, argv[0], NULL);
3074}
David Lamparter6b0655a2014-06-04 06:53:35 +02003075
paul94f2b392005-06-28 12:44:16 +00003076static int
paulfd79ac92004-10-13 05:06:08 +00003077peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
3078 afi_t afi, safi_t safi,
3079 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00003080{
3081 int ret;
3082 struct peer *peer;
3083
3084 peer = peer_and_group_lookup_vty (vty, peer_str);
3085 if (! peer)
3086 return CMD_WARNING;
3087
3088 if (set)
3089 ret = peer_default_originate_set (peer, afi, safi, rmap);
3090 else
3091 ret = peer_default_originate_unset (peer, afi, safi);
3092
3093 return bgp_vty_return (vty, ret);
3094}
3095
3096/* neighbor default-originate. */
3097DEFUN (neighbor_default_originate,
3098 neighbor_default_originate_cmd,
3099 NEIGHBOR_CMD2 "default-originate",
3100 NEIGHBOR_STR
3101 NEIGHBOR_ADDR_STR2
3102 "Originate default route to this neighbor\n")
3103{
3104 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3105 bgp_node_safi (vty), NULL, 1);
3106}
3107
3108DEFUN (neighbor_default_originate_rmap,
3109 neighbor_default_originate_rmap_cmd,
3110 NEIGHBOR_CMD2 "default-originate route-map WORD",
3111 NEIGHBOR_STR
3112 NEIGHBOR_ADDR_STR2
3113 "Originate default route to this neighbor\n"
3114 "Route-map to specify criteria to originate default\n"
3115 "route-map name\n")
3116{
3117 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3118 bgp_node_safi (vty), argv[1], 1);
3119}
3120
3121DEFUN (no_neighbor_default_originate,
3122 no_neighbor_default_originate_cmd,
3123 NO_NEIGHBOR_CMD2 "default-originate",
3124 NO_STR
3125 NEIGHBOR_STR
3126 NEIGHBOR_ADDR_STR2
3127 "Originate default route to this neighbor\n")
3128{
3129 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3130 bgp_node_safi (vty), NULL, 0);
3131}
3132
3133ALIAS (no_neighbor_default_originate,
3134 no_neighbor_default_originate_rmap_cmd,
3135 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3136 NO_STR
3137 NEIGHBOR_STR
3138 NEIGHBOR_ADDR_STR2
3139 "Originate default route to this neighbor\n"
3140 "Route-map to specify criteria to originate default\n"
3141 "route-map name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003142
paul718e3742002-12-13 20:15:29 +00003143/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00003144static int
paulfd79ac92004-10-13 05:06:08 +00003145peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3146 const char *port_str)
paul718e3742002-12-13 20:15:29 +00003147{
3148 struct peer *peer;
3149 u_int16_t port;
3150 struct servent *sp;
3151
3152 peer = peer_lookup_vty (vty, ip_str);
3153 if (! peer)
3154 return CMD_WARNING;
3155
3156 if (! port_str)
3157 {
3158 sp = getservbyname ("bgp", "tcp");
3159 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3160 }
3161 else
3162 {
3163 VTY_GET_INTEGER("port", port, port_str);
3164 }
3165
3166 peer_port_set (peer, port);
3167
3168 return CMD_SUCCESS;
3169}
3170
hassof4184462005-02-01 20:13:16 +00003171/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00003172DEFUN (neighbor_port,
3173 neighbor_port_cmd,
3174 NEIGHBOR_CMD "port <0-65535>",
3175 NEIGHBOR_STR
3176 NEIGHBOR_ADDR_STR
3177 "Neighbor's BGP port\n"
3178 "TCP port number\n")
3179{
3180 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3181}
3182
3183DEFUN (no_neighbor_port,
3184 no_neighbor_port_cmd,
3185 NO_NEIGHBOR_CMD "port",
3186 NO_STR
3187 NEIGHBOR_STR
3188 NEIGHBOR_ADDR_STR
3189 "Neighbor's BGP port\n")
3190{
3191 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3192}
3193
3194ALIAS (no_neighbor_port,
3195 no_neighbor_port_val_cmd,
3196 NO_NEIGHBOR_CMD "port <0-65535>",
3197 NO_STR
3198 NEIGHBOR_STR
3199 NEIGHBOR_ADDR_STR
3200 "Neighbor's BGP port\n"
3201 "TCP port number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003202
paul718e3742002-12-13 20:15:29 +00003203/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00003204static int
paulfd79ac92004-10-13 05:06:08 +00003205peer_weight_set_vty (struct vty *vty, const char *ip_str,
3206 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00003207{
3208 int ret;
3209 struct peer *peer;
3210 unsigned long weight;
3211
3212 peer = peer_and_group_lookup_vty (vty, ip_str);
3213 if (! peer)
3214 return CMD_WARNING;
3215
3216 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3217
3218 ret = peer_weight_set (peer, weight);
3219
3220 return CMD_SUCCESS;
3221}
3222
paul94f2b392005-06-28 12:44:16 +00003223static int
paulfd79ac92004-10-13 05:06:08 +00003224peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003225{
3226 struct peer *peer;
3227
3228 peer = peer_and_group_lookup_vty (vty, ip_str);
3229 if (! peer)
3230 return CMD_WARNING;
3231
3232 peer_weight_unset (peer);
3233
3234 return CMD_SUCCESS;
3235}
3236
3237DEFUN (neighbor_weight,
3238 neighbor_weight_cmd,
3239 NEIGHBOR_CMD2 "weight <0-65535>",
3240 NEIGHBOR_STR
3241 NEIGHBOR_ADDR_STR2
3242 "Set default weight for routes from this neighbor\n"
3243 "default weight\n")
3244{
3245 return peer_weight_set_vty (vty, argv[0], argv[1]);
3246}
3247
3248DEFUN (no_neighbor_weight,
3249 no_neighbor_weight_cmd,
3250 NO_NEIGHBOR_CMD2 "weight",
3251 NO_STR
3252 NEIGHBOR_STR
3253 NEIGHBOR_ADDR_STR2
3254 "Set default weight for routes from this neighbor\n")
3255{
3256 return peer_weight_unset_vty (vty, argv[0]);
3257}
3258
3259ALIAS (no_neighbor_weight,
3260 no_neighbor_weight_val_cmd,
3261 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3262 NO_STR
3263 NEIGHBOR_STR
3264 NEIGHBOR_ADDR_STR2
3265 "Set default weight for routes from this neighbor\n"
3266 "default weight\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003267
paul718e3742002-12-13 20:15:29 +00003268/* Override capability negotiation. */
3269DEFUN (neighbor_override_capability,
3270 neighbor_override_capability_cmd,
3271 NEIGHBOR_CMD2 "override-capability",
3272 NEIGHBOR_STR
3273 NEIGHBOR_ADDR_STR2
3274 "Override capability negotiation result\n")
3275{
3276 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3277}
3278
3279DEFUN (no_neighbor_override_capability,
3280 no_neighbor_override_capability_cmd,
3281 NO_NEIGHBOR_CMD2 "override-capability",
3282 NO_STR
3283 NEIGHBOR_STR
3284 NEIGHBOR_ADDR_STR2
3285 "Override capability negotiation result\n")
3286{
3287 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3288}
David Lamparter6b0655a2014-06-04 06:53:35 +02003289
paul718e3742002-12-13 20:15:29 +00003290DEFUN (neighbor_strict_capability,
3291 neighbor_strict_capability_cmd,
3292 NEIGHBOR_CMD "strict-capability-match",
3293 NEIGHBOR_STR
3294 NEIGHBOR_ADDR_STR
3295 "Strict capability negotiation match\n")
3296{
3297 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3298}
3299
3300DEFUN (no_neighbor_strict_capability,
3301 no_neighbor_strict_capability_cmd,
3302 NO_NEIGHBOR_CMD "strict-capability-match",
3303 NO_STR
3304 NEIGHBOR_STR
3305 NEIGHBOR_ADDR_STR
3306 "Strict capability negotiation match\n")
3307{
3308 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3309}
David Lamparter6b0655a2014-06-04 06:53:35 +02003310
paul94f2b392005-06-28 12:44:16 +00003311static int
paulfd79ac92004-10-13 05:06:08 +00003312peer_timers_set_vty (struct vty *vty, const char *ip_str,
3313 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003314{
3315 int ret;
3316 struct peer *peer;
3317 u_int32_t keepalive;
3318 u_int32_t holdtime;
3319
3320 peer = peer_and_group_lookup_vty (vty, ip_str);
3321 if (! peer)
3322 return CMD_WARNING;
3323
3324 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3325 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3326
3327 ret = peer_timers_set (peer, keepalive, holdtime);
3328
3329 return bgp_vty_return (vty, ret);
3330}
David Lamparter6b0655a2014-06-04 06:53:35 +02003331
paul94f2b392005-06-28 12:44:16 +00003332static int
paulfd79ac92004-10-13 05:06:08 +00003333peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003334{
3335 int ret;
3336 struct peer *peer;
3337
3338 peer = peer_lookup_vty (vty, ip_str);
3339 if (! peer)
3340 return CMD_WARNING;
3341
3342 ret = peer_timers_unset (peer);
3343
3344 return bgp_vty_return (vty, ret);
3345}
3346
3347DEFUN (neighbor_timers,
3348 neighbor_timers_cmd,
3349 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3350 NEIGHBOR_STR
3351 NEIGHBOR_ADDR_STR2
3352 "BGP per neighbor timers\n"
3353 "Keepalive interval\n"
3354 "Holdtime\n")
3355{
3356 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3357}
3358
3359DEFUN (no_neighbor_timers,
3360 no_neighbor_timers_cmd,
3361 NO_NEIGHBOR_CMD2 "timers",
3362 NO_STR
3363 NEIGHBOR_STR
3364 NEIGHBOR_ADDR_STR2
3365 "BGP per neighbor timers\n")
3366{
3367 return peer_timers_unset_vty (vty, argv[0]);
3368}
David Lamparter6b0655a2014-06-04 06:53:35 +02003369
paul94f2b392005-06-28 12:44:16 +00003370static int
paulfd79ac92004-10-13 05:06:08 +00003371peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3372 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003373{
3374 int ret;
3375 struct peer *peer;
3376 u_int32_t connect;
3377
3378 peer = peer_lookup_vty (vty, ip_str);
3379 if (! peer)
3380 return CMD_WARNING;
3381
3382 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3383
3384 ret = peer_timers_connect_set (peer, connect);
3385
3386 return CMD_SUCCESS;
3387}
3388
paul94f2b392005-06-28 12:44:16 +00003389static int
paulfd79ac92004-10-13 05:06:08 +00003390peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003391{
3392 int ret;
3393 struct peer *peer;
3394
3395 peer = peer_and_group_lookup_vty (vty, ip_str);
3396 if (! peer)
3397 return CMD_WARNING;
3398
3399 ret = peer_timers_connect_unset (peer);
3400
3401 return CMD_SUCCESS;
3402}
3403
3404DEFUN (neighbor_timers_connect,
3405 neighbor_timers_connect_cmd,
3406 NEIGHBOR_CMD "timers connect <0-65535>",
3407 NEIGHBOR_STR
3408 NEIGHBOR_ADDR_STR
3409 "BGP per neighbor timers\n"
3410 "BGP connect timer\n"
3411 "Connect timer\n")
3412{
3413 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3414}
3415
3416DEFUN (no_neighbor_timers_connect,
3417 no_neighbor_timers_connect_cmd,
3418 NO_NEIGHBOR_CMD "timers connect",
3419 NO_STR
3420 NEIGHBOR_STR
3421 NEIGHBOR_ADDR_STR
3422 "BGP per neighbor timers\n"
3423 "BGP connect timer\n")
3424{
3425 return peer_timers_connect_unset_vty (vty, argv[0]);
3426}
3427
3428ALIAS (no_neighbor_timers_connect,
3429 no_neighbor_timers_connect_val_cmd,
3430 NO_NEIGHBOR_CMD "timers connect <0-65535>",
3431 NO_STR
3432 NEIGHBOR_STR
3433 NEIGHBOR_ADDR_STR
3434 "BGP per neighbor timers\n"
3435 "BGP connect timer\n"
3436 "Connect timer\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003437
paul94f2b392005-06-28 12:44:16 +00003438static int
paulfd79ac92004-10-13 05:06:08 +00003439peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3440 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003441{
3442 int ret;
3443 struct peer *peer;
3444 u_int32_t routeadv = 0;
3445
3446 peer = peer_lookup_vty (vty, ip_str);
3447 if (! peer)
3448 return CMD_WARNING;
3449
3450 if (time_str)
3451 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3452
3453 if (set)
3454 ret = peer_advertise_interval_set (peer, routeadv);
3455 else
3456 ret = peer_advertise_interval_unset (peer);
3457
3458 return CMD_SUCCESS;
3459}
3460
3461DEFUN (neighbor_advertise_interval,
3462 neighbor_advertise_interval_cmd,
3463 NEIGHBOR_CMD "advertisement-interval <0-600>",
3464 NEIGHBOR_STR
3465 NEIGHBOR_ADDR_STR
3466 "Minimum interval between sending BGP routing updates\n"
3467 "time in seconds\n")
3468{
3469 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3470}
3471
3472DEFUN (no_neighbor_advertise_interval,
3473 no_neighbor_advertise_interval_cmd,
3474 NO_NEIGHBOR_CMD "advertisement-interval",
3475 NO_STR
3476 NEIGHBOR_STR
3477 NEIGHBOR_ADDR_STR
3478 "Minimum interval between sending BGP routing updates\n")
3479{
3480 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3481}
3482
3483ALIAS (no_neighbor_advertise_interval,
3484 no_neighbor_advertise_interval_val_cmd,
3485 NO_NEIGHBOR_CMD "advertisement-interval <0-600>",
3486 NO_STR
3487 NEIGHBOR_STR
3488 NEIGHBOR_ADDR_STR
3489 "Minimum interval between sending BGP routing updates\n"
3490 "time in seconds\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003491
paul718e3742002-12-13 20:15:29 +00003492/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003493static int
paulfd79ac92004-10-13 05:06:08 +00003494peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003495{
3496 int ret;
3497 struct peer *peer;
3498
3499 peer = peer_lookup_vty (vty, ip_str);
3500 if (! peer)
3501 return CMD_WARNING;
3502
3503 if (str)
3504 ret = peer_interface_set (peer, str);
3505 else
3506 ret = peer_interface_unset (peer);
3507
3508 return CMD_SUCCESS;
3509}
3510
3511DEFUN (neighbor_interface,
3512 neighbor_interface_cmd,
3513 NEIGHBOR_CMD "interface WORD",
3514 NEIGHBOR_STR
3515 NEIGHBOR_ADDR_STR
3516 "Interface\n"
3517 "Interface name\n")
3518{
3519 return peer_interface_vty (vty, argv[0], argv[1]);
3520}
3521
3522DEFUN (no_neighbor_interface,
3523 no_neighbor_interface_cmd,
3524 NO_NEIGHBOR_CMD "interface WORD",
3525 NO_STR
3526 NEIGHBOR_STR
3527 NEIGHBOR_ADDR_STR
3528 "Interface\n"
3529 "Interface name\n")
3530{
3531 return peer_interface_vty (vty, argv[0], NULL);
3532}
David Lamparter6b0655a2014-06-04 06:53:35 +02003533
paul718e3742002-12-13 20:15:29 +00003534/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003535static int
paulfd79ac92004-10-13 05:06:08 +00003536peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3537 afi_t afi, safi_t safi,
3538 const char *name_str, 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_distribute_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_distribute_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_distribute_unset (peer, afi, safi, direct);
3578
3579 return bgp_vty_return (vty, ret);
3580}
3581
3582DEFUN (neighbor_distribute_list,
3583 neighbor_distribute_list_cmd,
3584 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3585 NEIGHBOR_STR
3586 NEIGHBOR_ADDR_STR2
3587 "Filter updates to/from this neighbor\n"
3588 "IP access-list number\n"
3589 "IP access-list number (expanded range)\n"
3590 "IP Access-list name\n"
3591 "Filter incoming updates\n"
3592 "Filter outgoing updates\n")
3593{
3594 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3595 bgp_node_safi (vty), argv[1], argv[2]);
3596}
3597
3598DEFUN (no_neighbor_distribute_list,
3599 no_neighbor_distribute_list_cmd,
3600 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3601 NO_STR
3602 NEIGHBOR_STR
3603 NEIGHBOR_ADDR_STR2
3604 "Filter updates to/from this neighbor\n"
3605 "IP access-list number\n"
3606 "IP access-list number (expanded range)\n"
3607 "IP Access-list name\n"
3608 "Filter incoming updates\n"
3609 "Filter outgoing updates\n")
3610{
3611 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3612 bgp_node_safi (vty), argv[2]);
3613}
David Lamparter6b0655a2014-06-04 06:53:35 +02003614
paul718e3742002-12-13 20:15:29 +00003615/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003616static int
paulfd79ac92004-10-13 05:06:08 +00003617peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3618 safi_t safi, const char *name_str,
3619 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003620{
3621 int ret;
3622 struct peer *peer;
3623 int direct = FILTER_IN;
3624
3625 peer = peer_and_group_lookup_vty (vty, ip_str);
3626 if (! peer)
3627 return CMD_WARNING;
3628
3629 /* Check filter direction. */
3630 if (strncmp (direct_str, "i", 1) == 0)
3631 direct = FILTER_IN;
3632 else if (strncmp (direct_str, "o", 1) == 0)
3633 direct = FILTER_OUT;
3634
3635 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3636
3637 return bgp_vty_return (vty, ret);
3638}
3639
paul94f2b392005-06-28 12:44:16 +00003640static int
paulfd79ac92004-10-13 05:06:08 +00003641peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3642 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003643{
3644 int ret;
3645 struct peer *peer;
3646 int direct = FILTER_IN;
3647
3648 peer = peer_and_group_lookup_vty (vty, ip_str);
3649 if (! peer)
3650 return CMD_WARNING;
3651
3652 /* Check filter direction. */
3653 if (strncmp (direct_str, "i", 1) == 0)
3654 direct = FILTER_IN;
3655 else if (strncmp (direct_str, "o", 1) == 0)
3656 direct = FILTER_OUT;
3657
3658 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3659
3660 return bgp_vty_return (vty, ret);
3661}
3662
3663DEFUN (neighbor_prefix_list,
3664 neighbor_prefix_list_cmd,
3665 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3666 NEIGHBOR_STR
3667 NEIGHBOR_ADDR_STR2
3668 "Filter updates to/from this neighbor\n"
3669 "Name of a prefix list\n"
3670 "Filter incoming updates\n"
3671 "Filter outgoing updates\n")
3672{
3673 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3674 bgp_node_safi (vty), argv[1], argv[2]);
3675}
3676
3677DEFUN (no_neighbor_prefix_list,
3678 no_neighbor_prefix_list_cmd,
3679 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3680 NO_STR
3681 NEIGHBOR_STR
3682 NEIGHBOR_ADDR_STR2
3683 "Filter updates to/from this neighbor\n"
3684 "Name of a prefix list\n"
3685 "Filter incoming updates\n"
3686 "Filter outgoing updates\n")
3687{
3688 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3689 bgp_node_safi (vty), argv[2]);
3690}
David Lamparter6b0655a2014-06-04 06:53:35 +02003691
paul94f2b392005-06-28 12:44:16 +00003692static int
paulfd79ac92004-10-13 05:06:08 +00003693peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3694 afi_t afi, safi_t safi,
3695 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003696{
3697 int ret;
3698 struct peer *peer;
3699 int direct = FILTER_IN;
3700
3701 peer = peer_and_group_lookup_vty (vty, ip_str);
3702 if (! peer)
3703 return CMD_WARNING;
3704
3705 /* Check filter direction. */
3706 if (strncmp (direct_str, "i", 1) == 0)
3707 direct = FILTER_IN;
3708 else if (strncmp (direct_str, "o", 1) == 0)
3709 direct = FILTER_OUT;
3710
3711 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3712
3713 return bgp_vty_return (vty, ret);
3714}
3715
paul94f2b392005-06-28 12:44:16 +00003716static int
paulfd79ac92004-10-13 05:06:08 +00003717peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3718 afi_t afi, safi_t safi,
3719 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003720{
3721 int ret;
3722 struct peer *peer;
3723 int direct = FILTER_IN;
3724
3725 peer = peer_and_group_lookup_vty (vty, ip_str);
3726 if (! peer)
3727 return CMD_WARNING;
3728
3729 /* Check filter direction. */
3730 if (strncmp (direct_str, "i", 1) == 0)
3731 direct = FILTER_IN;
3732 else if (strncmp (direct_str, "o", 1) == 0)
3733 direct = FILTER_OUT;
3734
3735 ret = peer_aslist_unset (peer, afi, safi, direct);
3736
3737 return bgp_vty_return (vty, ret);
3738}
3739
3740DEFUN (neighbor_filter_list,
3741 neighbor_filter_list_cmd,
3742 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3743 NEIGHBOR_STR
3744 NEIGHBOR_ADDR_STR2
3745 "Establish BGP filters\n"
3746 "AS path access-list name\n"
3747 "Filter incoming routes\n"
3748 "Filter outgoing routes\n")
3749{
3750 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3751 bgp_node_safi (vty), argv[1], argv[2]);
3752}
3753
3754DEFUN (no_neighbor_filter_list,
3755 no_neighbor_filter_list_cmd,
3756 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3757 NO_STR
3758 NEIGHBOR_STR
3759 NEIGHBOR_ADDR_STR2
3760 "Establish BGP filters\n"
3761 "AS path access-list name\n"
3762 "Filter incoming routes\n"
3763 "Filter outgoing routes\n")
3764{
3765 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3766 bgp_node_safi (vty), argv[2]);
3767}
David Lamparter6b0655a2014-06-04 06:53:35 +02003768
paul718e3742002-12-13 20:15:29 +00003769/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003770static int
paulfd79ac92004-10-13 05:06:08 +00003771peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3772 afi_t afi, safi_t safi,
3773 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003774{
3775 int ret;
3776 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003777 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003778
3779 peer = peer_and_group_lookup_vty (vty, ip_str);
3780 if (! peer)
3781 return CMD_WARNING;
3782
3783 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003784 if (strncmp (direct_str, "in", 2) == 0)
3785 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003786 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003787 direct = RMAP_OUT;
3788 else if (strncmp (direct_str, "im", 2) == 0)
3789 direct = RMAP_IMPORT;
3790 else if (strncmp (direct_str, "e", 1) == 0)
3791 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003792
3793 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3794
3795 return bgp_vty_return (vty, ret);
3796}
3797
paul94f2b392005-06-28 12:44:16 +00003798static int
paulfd79ac92004-10-13 05:06:08 +00003799peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3800 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003801{
3802 int ret;
3803 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003804 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003805
3806 peer = peer_and_group_lookup_vty (vty, ip_str);
3807 if (! peer)
3808 return CMD_WARNING;
3809
3810 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003811 if (strncmp (direct_str, "in", 2) == 0)
3812 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003813 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003814 direct = RMAP_OUT;
3815 else if (strncmp (direct_str, "im", 2) == 0)
3816 direct = RMAP_IMPORT;
3817 else if (strncmp (direct_str, "e", 1) == 0)
3818 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003819
3820 ret = peer_route_map_unset (peer, afi, safi, direct);
3821
3822 return bgp_vty_return (vty, ret);
3823}
3824
3825DEFUN (neighbor_route_map,
3826 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003827 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003828 NEIGHBOR_STR
3829 NEIGHBOR_ADDR_STR2
3830 "Apply route map to neighbor\n"
3831 "Name of route map\n"
3832 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003833 "Apply map to outbound routes\n"
3834 "Apply map to routes going into a Route-Server client's table\n"
3835 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003836{
3837 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3838 bgp_node_safi (vty), argv[1], argv[2]);
3839}
3840
3841DEFUN (no_neighbor_route_map,
3842 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003843 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003844 NO_STR
3845 NEIGHBOR_STR
3846 NEIGHBOR_ADDR_STR2
3847 "Apply route map to neighbor\n"
3848 "Name of route map\n"
3849 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003850 "Apply map to outbound routes\n"
3851 "Apply map to routes going into a Route-Server client's table\n"
3852 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003853{
3854 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3855 bgp_node_safi (vty), argv[2]);
3856}
David Lamparter6b0655a2014-06-04 06:53:35 +02003857
paul718e3742002-12-13 20:15:29 +00003858/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003859static int
paulfd79ac92004-10-13 05:06:08 +00003860peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3861 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003862{
3863 int ret;
3864 struct peer *peer;
3865
3866 peer = peer_and_group_lookup_vty (vty, ip_str);
3867 if (! peer)
3868 return CMD_WARNING;
3869
3870 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3871
3872 return bgp_vty_return (vty, ret);
3873}
3874
3875/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003876static int
paulfd79ac92004-10-13 05:06:08 +00003877peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003878 safi_t safi)
3879{
3880 int ret;
3881 struct peer *peer;
3882
3883 peer = peer_and_group_lookup_vty (vty, ip_str);
3884 if (! peer)
3885 return CMD_WARNING;
3886
3887 ret = peer_unsuppress_map_unset (peer, afi, safi);
3888
3889 return bgp_vty_return (vty, ret);
3890}
3891
3892DEFUN (neighbor_unsuppress_map,
3893 neighbor_unsuppress_map_cmd,
3894 NEIGHBOR_CMD2 "unsuppress-map WORD",
3895 NEIGHBOR_STR
3896 NEIGHBOR_ADDR_STR2
3897 "Route-map to selectively unsuppress suppressed routes\n"
3898 "Name of route map\n")
3899{
3900 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3901 bgp_node_safi (vty), argv[1]);
3902}
3903
3904DEFUN (no_neighbor_unsuppress_map,
3905 no_neighbor_unsuppress_map_cmd,
3906 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3907 NO_STR
3908 NEIGHBOR_STR
3909 NEIGHBOR_ADDR_STR2
3910 "Route-map to selectively unsuppress suppressed routes\n"
3911 "Name of route map\n")
3912{
3913 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3914 bgp_node_safi (vty));
3915}
David Lamparter6b0655a2014-06-04 06:53:35 +02003916
paul94f2b392005-06-28 12:44:16 +00003917static int
paulfd79ac92004-10-13 05:06:08 +00003918peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3919 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003920 const char *threshold_str, int warning,
3921 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003922{
3923 int ret;
3924 struct peer *peer;
3925 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003926 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003927 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003928
3929 peer = peer_and_group_lookup_vty (vty, ip_str);
3930 if (! peer)
3931 return CMD_WARNING;
3932
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04003933 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003934 if (threshold_str)
3935 threshold = atoi (threshold_str);
3936 else
3937 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00003938
hasso0a486e52005-02-01 20:57:17 +00003939 if (restart_str)
3940 restart = atoi (restart_str);
3941 else
3942 restart = 0;
3943
3944 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00003945
3946 return bgp_vty_return (vty, ret);
3947}
3948
paul94f2b392005-06-28 12:44:16 +00003949static int
paulfd79ac92004-10-13 05:06:08 +00003950peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003951 safi_t safi)
3952{
3953 int ret;
3954 struct peer *peer;
3955
3956 peer = peer_and_group_lookup_vty (vty, ip_str);
3957 if (! peer)
3958 return CMD_WARNING;
3959
3960 ret = peer_maximum_prefix_unset (peer, afi, safi);
3961
3962 return bgp_vty_return (vty, ret);
3963}
3964
3965/* Maximum number of prefix configuration. prefix count is different
3966 for each peer configuration. So this configuration can be set for
3967 each peer configuration. */
3968DEFUN (neighbor_maximum_prefix,
3969 neighbor_maximum_prefix_cmd,
3970 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3971 NEIGHBOR_STR
3972 NEIGHBOR_ADDR_STR2
3973 "Maximum number of prefix accept from this peer\n"
3974 "maximum no. of prefix limit\n")
3975{
3976 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003977 bgp_node_safi (vty), argv[1], NULL, 0,
3978 NULL);
paul718e3742002-12-13 20:15:29 +00003979}
3980
hassoe0701b72004-05-20 09:19:34 +00003981DEFUN (neighbor_maximum_prefix_threshold,
3982 neighbor_maximum_prefix_threshold_cmd,
3983 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
3984 NEIGHBOR_STR
3985 NEIGHBOR_ADDR_STR2
3986 "Maximum number of prefix accept from this peer\n"
3987 "maximum no. of prefix limit\n"
3988 "Threshold value (%) at which to generate a warning msg\n")
3989{
3990 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003991 bgp_node_safi (vty), argv[1], argv[2], 0,
3992 NULL);
3993}
hassoe0701b72004-05-20 09:19:34 +00003994
paul718e3742002-12-13 20:15:29 +00003995DEFUN (neighbor_maximum_prefix_warning,
3996 neighbor_maximum_prefix_warning_cmd,
3997 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3998 NEIGHBOR_STR
3999 NEIGHBOR_ADDR_STR2
4000 "Maximum number of prefix accept from this peer\n"
4001 "maximum no. of prefix limit\n"
4002 "Only give warning message when limit is exceeded\n")
4003{
4004 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004005 bgp_node_safi (vty), argv[1], NULL, 1,
4006 NULL);
paul718e3742002-12-13 20:15:29 +00004007}
4008
hassoe0701b72004-05-20 09:19:34 +00004009DEFUN (neighbor_maximum_prefix_threshold_warning,
4010 neighbor_maximum_prefix_threshold_warning_cmd,
4011 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4012 NEIGHBOR_STR
4013 NEIGHBOR_ADDR_STR2
4014 "Maximum number of prefix accept from this peer\n"
4015 "maximum no. of prefix limit\n"
4016 "Threshold value (%) at which to generate a warning msg\n"
4017 "Only give warning message when limit is exceeded\n")
4018{
4019 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004020 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4021}
4022
4023DEFUN (neighbor_maximum_prefix_restart,
4024 neighbor_maximum_prefix_restart_cmd,
4025 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
4026 NEIGHBOR_STR
4027 NEIGHBOR_ADDR_STR2
4028 "Maximum number of prefix accept from this peer\n"
4029 "maximum no. of prefix limit\n"
4030 "Restart bgp connection after limit is exceeded\n"
4031 "Restart interval in minutes")
4032{
4033 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4034 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
4035}
4036
4037DEFUN (neighbor_maximum_prefix_threshold_restart,
4038 neighbor_maximum_prefix_threshold_restart_cmd,
4039 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4040 NEIGHBOR_STR
4041 NEIGHBOR_ADDR_STR2
4042 "Maximum number of prefix accept from this peer\n"
4043 "maximum no. of prefix limit\n"
4044 "Threshold value (%) at which to generate a warning msg\n"
4045 "Restart bgp connection after limit is exceeded\n"
4046 "Restart interval in minutes")
4047{
4048 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4049 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4050}
hassoe0701b72004-05-20 09:19:34 +00004051
paul718e3742002-12-13 20:15:29 +00004052DEFUN (no_neighbor_maximum_prefix,
4053 no_neighbor_maximum_prefix_cmd,
4054 NO_NEIGHBOR_CMD2 "maximum-prefix",
4055 NO_STR
4056 NEIGHBOR_STR
4057 NEIGHBOR_ADDR_STR2
4058 "Maximum number of prefix accept from this peer\n")
4059{
4060 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4061 bgp_node_safi (vty));
4062}
4063
4064ALIAS (no_neighbor_maximum_prefix,
4065 no_neighbor_maximum_prefix_val_cmd,
4066 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4067 NO_STR
4068 NEIGHBOR_STR
4069 NEIGHBOR_ADDR_STR2
4070 "Maximum number of prefix accept from this peer\n"
4071 "maximum no. of prefix limit\n")
4072
4073ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004074 no_neighbor_maximum_prefix_threshold_cmd,
4075 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4076 NO_STR
4077 NEIGHBOR_STR
4078 NEIGHBOR_ADDR_STR2
4079 "Maximum number of prefix accept from this peer\n"
4080 "maximum no. of prefix limit\n"
4081 "Threshold value (%) at which to generate a warning msg\n")
4082
4083ALIAS (no_neighbor_maximum_prefix,
4084 no_neighbor_maximum_prefix_warning_cmd,
4085 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4086 NO_STR
4087 NEIGHBOR_STR
4088 NEIGHBOR_ADDR_STR2
4089 "Maximum number of prefix accept from this peer\n"
4090 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00004091 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004092
4093ALIAS (no_neighbor_maximum_prefix,
4094 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004095 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4096 NO_STR
4097 NEIGHBOR_STR
4098 NEIGHBOR_ADDR_STR2
4099 "Maximum number of prefix accept from this peer\n"
4100 "maximum no. of prefix limit\n"
4101 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004102 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004103
4104ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004105 no_neighbor_maximum_prefix_restart_cmd,
4106 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004107 NO_STR
4108 NEIGHBOR_STR
4109 NEIGHBOR_ADDR_STR2
4110 "Maximum number of prefix accept from this peer\n"
4111 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00004112 "Restart bgp connection after limit is exceeded\n"
4113 "Restart interval in minutes")
4114
4115ALIAS (no_neighbor_maximum_prefix,
4116 no_neighbor_maximum_prefix_threshold_restart_cmd,
4117 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4118 NO_STR
4119 NEIGHBOR_STR
4120 NEIGHBOR_ADDR_STR2
4121 "Maximum number of prefix accept from this peer\n"
4122 "maximum no. of prefix limit\n"
4123 "Threshold value (%) at which to generate a warning msg\n"
4124 "Restart bgp connection after limit is exceeded\n"
4125 "Restart interval in minutes")
David Lamparter6b0655a2014-06-04 06:53:35 +02004126
paul718e3742002-12-13 20:15:29 +00004127/* "neighbor allowas-in" */
4128DEFUN (neighbor_allowas_in,
4129 neighbor_allowas_in_cmd,
4130 NEIGHBOR_CMD2 "allowas-in",
4131 NEIGHBOR_STR
4132 NEIGHBOR_ADDR_STR2
4133 "Accept as-path with my AS present in it\n")
4134{
4135 int ret;
4136 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004137 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004138
4139 peer = peer_and_group_lookup_vty (vty, argv[0]);
4140 if (! peer)
4141 return CMD_WARNING;
4142
4143 if (argc == 1)
4144 allow_num = 3;
4145 else
4146 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4147
4148 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4149 allow_num);
4150
4151 return bgp_vty_return (vty, ret);
4152}
4153
4154ALIAS (neighbor_allowas_in,
4155 neighbor_allowas_in_arg_cmd,
4156 NEIGHBOR_CMD2 "allowas-in <1-10>",
4157 NEIGHBOR_STR
4158 NEIGHBOR_ADDR_STR2
4159 "Accept as-path with my AS present in it\n"
4160 "Number of occurances of AS number\n")
4161
4162DEFUN (no_neighbor_allowas_in,
4163 no_neighbor_allowas_in_cmd,
4164 NO_NEIGHBOR_CMD2 "allowas-in",
4165 NO_STR
4166 NEIGHBOR_STR
4167 NEIGHBOR_ADDR_STR2
4168 "allow local ASN appears in aspath attribute\n")
4169{
4170 int ret;
4171 struct peer *peer;
4172
4173 peer = peer_and_group_lookup_vty (vty, argv[0]);
4174 if (! peer)
4175 return CMD_WARNING;
4176
4177 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4178
4179 return bgp_vty_return (vty, ret);
4180}
David Lamparter6b0655a2014-06-04 06:53:35 +02004181
Nick Hilliardfa411a22011-03-23 15:33:17 +00004182DEFUN (neighbor_ttl_security,
4183 neighbor_ttl_security_cmd,
4184 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4185 NEIGHBOR_STR
4186 NEIGHBOR_ADDR_STR2
4187 "Specify the maximum number of hops to the BGP peer\n")
4188{
4189 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004190 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004191
4192 peer = peer_and_group_lookup_vty (vty, argv[0]);
4193 if (! peer)
4194 return CMD_WARNING;
4195
4196 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4197
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004198 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004199}
4200
4201DEFUN (no_neighbor_ttl_security,
4202 no_neighbor_ttl_security_cmd,
4203 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4204 NO_STR
4205 NEIGHBOR_STR
4206 NEIGHBOR_ADDR_STR2
4207 "Specify the maximum number of hops to the BGP peer\n")
4208{
4209 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004210
4211 peer = peer_and_group_lookup_vty (vty, argv[0]);
4212 if (! peer)
4213 return CMD_WARNING;
4214
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004215 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004216}
David Lamparter6b0655a2014-06-04 06:53:35 +02004217
paul718e3742002-12-13 20:15:29 +00004218/* Address family configuration. */
4219DEFUN (address_family_ipv4,
4220 address_family_ipv4_cmd,
4221 "address-family ipv4",
4222 "Enter Address Family command mode\n"
4223 "Address family\n")
4224{
4225 vty->node = BGP_IPV4_NODE;
4226 return CMD_SUCCESS;
4227}
4228
4229DEFUN (address_family_ipv4_safi,
4230 address_family_ipv4_safi_cmd,
4231 "address-family ipv4 (unicast|multicast)",
4232 "Enter Address Family command mode\n"
4233 "Address family\n"
4234 "Address Family modifier\n"
4235 "Address Family modifier\n")
4236{
4237 if (strncmp (argv[0], "m", 1) == 0)
4238 vty->node = BGP_IPV4M_NODE;
4239 else
4240 vty->node = BGP_IPV4_NODE;
4241
4242 return CMD_SUCCESS;
4243}
4244
paul25ffbdc2005-08-22 22:42:08 +00004245DEFUN (address_family_ipv6,
4246 address_family_ipv6_cmd,
4247 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004248 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004249 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004250{
4251 vty->node = BGP_IPV6_NODE;
4252 return CMD_SUCCESS;
4253}
4254
paul25ffbdc2005-08-22 22:42:08 +00004255DEFUN (address_family_ipv6_safi,
4256 address_family_ipv6_safi_cmd,
4257 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004258 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004259 "Address family\n"
4260 "Address Family modifier\n"
4261 "Address Family modifier\n")
4262{
4263 if (strncmp (argv[0], "m", 1) == 0)
4264 vty->node = BGP_IPV6M_NODE;
4265 else
4266 vty->node = BGP_IPV6_NODE;
4267
4268 return CMD_SUCCESS;
4269}
paul718e3742002-12-13 20:15:29 +00004270
4271DEFUN (address_family_vpnv4,
4272 address_family_vpnv4_cmd,
4273 "address-family vpnv4",
4274 "Enter Address Family command mode\n"
4275 "Address family\n")
4276{
4277 vty->node = BGP_VPNV4_NODE;
4278 return CMD_SUCCESS;
4279}
4280
4281ALIAS (address_family_vpnv4,
4282 address_family_vpnv4_unicast_cmd,
4283 "address-family vpnv4 unicast",
4284 "Enter Address Family command mode\n"
4285 "Address family\n"
4286 "Address Family Modifier\n")
4287
4288DEFUN (exit_address_family,
4289 exit_address_family_cmd,
4290 "exit-address-family",
4291 "Exit from Address Family configuration mode\n")
4292{
hassoa8a80d52005-04-09 13:07:47 +00004293 if (vty->node == BGP_IPV4_NODE
4294 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004295 || vty->node == BGP_VPNV4_NODE
paul25ffbdc2005-08-22 22:42:08 +00004296 || vty->node == BGP_IPV6_NODE
4297 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004298 vty->node = BGP_NODE;
4299 return CMD_SUCCESS;
4300}
David Lamparter6b0655a2014-06-04 06:53:35 +02004301
paul718e3742002-12-13 20:15:29 +00004302/* BGP clear sort. */
4303enum clear_sort
4304{
4305 clear_all,
4306 clear_peer,
4307 clear_group,
4308 clear_external,
4309 clear_as
4310};
4311
paul94f2b392005-06-28 12:44:16 +00004312static void
paul718e3742002-12-13 20:15:29 +00004313bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4314 safi_t safi, int error)
4315{
4316 switch (error)
4317 {
4318 case BGP_ERR_AF_UNCONFIGURED:
4319 vty_out (vty,
4320 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4321 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4322 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4323 peer->host, VTY_NEWLINE);
4324 break;
4325 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4326 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);
4327 break;
4328 default:
4329 break;
4330 }
4331}
4332
4333/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004334static int
paul718e3742002-12-13 20:15:29 +00004335bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004336 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004337{
4338 int ret;
4339 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004340 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004341
4342 /* Clear all neighbors. */
4343 if (sort == clear_all)
4344 {
paul1eb8ef22005-04-07 07:30:20 +00004345 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004346 {
4347 if (stype == BGP_CLEAR_SOFT_NONE)
4348 ret = peer_clear (peer);
4349 else
4350 ret = peer_clear_soft (peer, afi, safi, stype);
4351
4352 if (ret < 0)
4353 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4354 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004355 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004356 }
4357
4358 /* Clear specified neighbors. */
4359 if (sort == clear_peer)
4360 {
4361 union sockunion su;
4362 int ret;
4363
4364 /* Make sockunion for lookup. */
4365 ret = str2sockunion (arg, &su);
4366 if (ret < 0)
4367 {
4368 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004369 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004370 }
4371 peer = peer_lookup (bgp, &su);
4372 if (! peer)
4373 {
4374 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004375 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004376 }
4377
4378 if (stype == BGP_CLEAR_SOFT_NONE)
4379 ret = peer_clear (peer);
4380 else
4381 ret = peer_clear_soft (peer, afi, safi, stype);
4382
4383 if (ret < 0)
4384 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4385
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004386 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004387 }
4388
4389 /* Clear all peer-group members. */
4390 if (sort == clear_group)
4391 {
4392 struct peer_group *group;
4393
4394 group = peer_group_lookup (bgp, arg);
4395 if (! group)
4396 {
4397 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004398 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004399 }
4400
paul1eb8ef22005-04-07 07:30:20 +00004401 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004402 {
4403 if (stype == BGP_CLEAR_SOFT_NONE)
4404 {
4405 ret = peer_clear (peer);
4406 continue;
4407 }
4408
4409 if (! peer->af_group[afi][safi])
4410 continue;
4411
4412 ret = peer_clear_soft (peer, afi, safi, stype);
4413
4414 if (ret < 0)
4415 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4416 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004417 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004418 }
4419
4420 if (sort == clear_external)
4421 {
paul1eb8ef22005-04-07 07:30:20 +00004422 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004423 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004424 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004425 continue;
4426
4427 if (stype == BGP_CLEAR_SOFT_NONE)
4428 ret = peer_clear (peer);
4429 else
4430 ret = peer_clear_soft (peer, afi, safi, stype);
4431
4432 if (ret < 0)
4433 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4434 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004435 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004436 }
4437
4438 if (sort == clear_as)
4439 {
4440 as_t as;
paul718e3742002-12-13 20:15:29 +00004441 int find = 0;
4442
Ulrich Weberbde12e32011-11-16 19:32:12 +04004443 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004444
paul1eb8ef22005-04-07 07:30:20 +00004445 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004446 {
4447 if (peer->as != as)
4448 continue;
4449
4450 find = 1;
4451 if (stype == BGP_CLEAR_SOFT_NONE)
4452 ret = peer_clear (peer);
4453 else
4454 ret = peer_clear_soft (peer, afi, safi, stype);
4455
4456 if (ret < 0)
4457 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4458 }
4459 if (! find)
4460 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4461 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004462 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004463 }
4464
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004465 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004466}
4467
paul94f2b392005-06-28 12:44:16 +00004468static int
paulfd79ac92004-10-13 05:06:08 +00004469bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4470 enum clear_sort sort, enum bgp_clear_type stype,
4471 const char *arg)
paul718e3742002-12-13 20:15:29 +00004472{
paul718e3742002-12-13 20:15:29 +00004473 struct bgp *bgp;
4474
4475 /* BGP structure lookup. */
4476 if (name)
4477 {
4478 bgp = bgp_lookup_by_name (name);
4479 if (bgp == NULL)
4480 {
4481 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4482 return CMD_WARNING;
4483 }
4484 }
4485 else
4486 {
4487 bgp = bgp_get_default ();
4488 if (bgp == NULL)
4489 {
4490 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4491 return CMD_WARNING;
4492 }
4493 }
4494
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004495 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004496}
4497
4498DEFUN (clear_ip_bgp_all,
4499 clear_ip_bgp_all_cmd,
4500 "clear ip bgp *",
4501 CLEAR_STR
4502 IP_STR
4503 BGP_STR
4504 "Clear all peers\n")
4505{
4506 if (argc == 1)
4507 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4508
4509 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4510}
4511
4512ALIAS (clear_ip_bgp_all,
4513 clear_bgp_all_cmd,
4514 "clear bgp *",
4515 CLEAR_STR
4516 BGP_STR
4517 "Clear all peers\n")
4518
4519ALIAS (clear_ip_bgp_all,
4520 clear_bgp_ipv6_all_cmd,
4521 "clear bgp ipv6 *",
4522 CLEAR_STR
4523 BGP_STR
4524 "Address family\n"
4525 "Clear all peers\n")
4526
4527ALIAS (clear_ip_bgp_all,
4528 clear_ip_bgp_instance_all_cmd,
4529 "clear ip bgp view WORD *",
4530 CLEAR_STR
4531 IP_STR
4532 BGP_STR
4533 "BGP view\n"
4534 "view name\n"
4535 "Clear all peers\n")
4536
4537ALIAS (clear_ip_bgp_all,
4538 clear_bgp_instance_all_cmd,
4539 "clear bgp view WORD *",
4540 CLEAR_STR
4541 BGP_STR
4542 "BGP view\n"
4543 "view name\n"
4544 "Clear all peers\n")
4545
4546DEFUN (clear_ip_bgp_peer,
4547 clear_ip_bgp_peer_cmd,
4548 "clear ip bgp (A.B.C.D|X:X::X:X)",
4549 CLEAR_STR
4550 IP_STR
4551 BGP_STR
4552 "BGP neighbor IP address to clear\n"
4553 "BGP IPv6 neighbor to clear\n")
4554{
4555 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4556}
4557
4558ALIAS (clear_ip_bgp_peer,
4559 clear_bgp_peer_cmd,
4560 "clear bgp (A.B.C.D|X:X::X:X)",
4561 CLEAR_STR
4562 BGP_STR
4563 "BGP neighbor address to clear\n"
4564 "BGP IPv6 neighbor to clear\n")
4565
4566ALIAS (clear_ip_bgp_peer,
4567 clear_bgp_ipv6_peer_cmd,
4568 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4569 CLEAR_STR
4570 BGP_STR
4571 "Address family\n"
4572 "BGP neighbor address to clear\n"
4573 "BGP IPv6 neighbor to clear\n")
4574
4575DEFUN (clear_ip_bgp_peer_group,
4576 clear_ip_bgp_peer_group_cmd,
4577 "clear ip bgp peer-group WORD",
4578 CLEAR_STR
4579 IP_STR
4580 BGP_STR
4581 "Clear all members of peer-group\n"
4582 "BGP peer-group name\n")
4583{
4584 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4585}
4586
4587ALIAS (clear_ip_bgp_peer_group,
4588 clear_bgp_peer_group_cmd,
4589 "clear bgp peer-group WORD",
4590 CLEAR_STR
4591 BGP_STR
4592 "Clear all members of peer-group\n"
4593 "BGP peer-group name\n")
4594
4595ALIAS (clear_ip_bgp_peer_group,
4596 clear_bgp_ipv6_peer_group_cmd,
4597 "clear bgp ipv6 peer-group WORD",
4598 CLEAR_STR
4599 BGP_STR
4600 "Address family\n"
4601 "Clear all members of peer-group\n"
4602 "BGP peer-group name\n")
4603
4604DEFUN (clear_ip_bgp_external,
4605 clear_ip_bgp_external_cmd,
4606 "clear ip bgp external",
4607 CLEAR_STR
4608 IP_STR
4609 BGP_STR
4610 "Clear all external peers\n")
4611{
4612 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4613}
4614
4615ALIAS (clear_ip_bgp_external,
4616 clear_bgp_external_cmd,
4617 "clear bgp external",
4618 CLEAR_STR
4619 BGP_STR
4620 "Clear all external peers\n")
4621
4622ALIAS (clear_ip_bgp_external,
4623 clear_bgp_ipv6_external_cmd,
4624 "clear bgp ipv6 external",
4625 CLEAR_STR
4626 BGP_STR
4627 "Address family\n"
4628 "Clear all external peers\n")
4629
4630DEFUN (clear_ip_bgp_as,
4631 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004632 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004633 CLEAR_STR
4634 IP_STR
4635 BGP_STR
4636 "Clear peers with the AS number\n")
4637{
4638 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4639}
4640
4641ALIAS (clear_ip_bgp_as,
4642 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004643 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004644 CLEAR_STR
4645 BGP_STR
4646 "Clear peers with the AS number\n")
4647
4648ALIAS (clear_ip_bgp_as,
4649 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004650 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004651 CLEAR_STR
4652 BGP_STR
4653 "Address family\n"
4654 "Clear peers with the AS number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02004655
paul718e3742002-12-13 20:15:29 +00004656/* Outbound soft-reconfiguration */
4657DEFUN (clear_ip_bgp_all_soft_out,
4658 clear_ip_bgp_all_soft_out_cmd,
4659 "clear ip bgp * soft out",
4660 CLEAR_STR
4661 IP_STR
4662 BGP_STR
4663 "Clear all peers\n"
4664 "Soft reconfig\n"
4665 "Soft reconfig outbound update\n")
4666{
4667 if (argc == 1)
4668 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4669 BGP_CLEAR_SOFT_OUT, NULL);
4670
4671 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4672 BGP_CLEAR_SOFT_OUT, NULL);
4673}
4674
4675ALIAS (clear_ip_bgp_all_soft_out,
4676 clear_ip_bgp_all_out_cmd,
4677 "clear ip bgp * out",
4678 CLEAR_STR
4679 IP_STR
4680 BGP_STR
4681 "Clear all peers\n"
4682 "Soft reconfig outbound update\n")
4683
4684ALIAS (clear_ip_bgp_all_soft_out,
4685 clear_ip_bgp_instance_all_soft_out_cmd,
4686 "clear ip bgp view WORD * soft out",
4687 CLEAR_STR
4688 IP_STR
4689 BGP_STR
4690 "BGP view\n"
4691 "view name\n"
4692 "Clear all peers\n"
4693 "Soft reconfig\n"
4694 "Soft reconfig outbound update\n")
4695
4696DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4697 clear_ip_bgp_all_ipv4_soft_out_cmd,
4698 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4699 CLEAR_STR
4700 IP_STR
4701 BGP_STR
4702 "Clear all peers\n"
4703 "Address family\n"
4704 "Address Family modifier\n"
4705 "Address Family modifier\n"
4706 "Soft reconfig\n"
4707 "Soft reconfig outbound update\n")
4708{
4709 if (strncmp (argv[0], "m", 1) == 0)
4710 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4711 BGP_CLEAR_SOFT_OUT, NULL);
4712
4713 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4714 BGP_CLEAR_SOFT_OUT, NULL);
4715}
4716
4717ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4718 clear_ip_bgp_all_ipv4_out_cmd,
4719 "clear ip bgp * ipv4 (unicast|multicast) out",
4720 CLEAR_STR
4721 IP_STR
4722 BGP_STR
4723 "Clear all peers\n"
4724 "Address family\n"
4725 "Address Family modifier\n"
4726 "Address Family modifier\n"
4727 "Soft reconfig outbound update\n")
4728
4729DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4730 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4731 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4732 CLEAR_STR
4733 IP_STR
4734 BGP_STR
4735 "BGP view\n"
4736 "view name\n"
4737 "Clear all peers\n"
4738 "Address family\n"
4739 "Address Family modifier\n"
4740 "Address Family modifier\n"
4741 "Soft reconfig outbound update\n")
4742{
4743 if (strncmp (argv[1], "m", 1) == 0)
4744 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4745 BGP_CLEAR_SOFT_OUT, NULL);
4746
4747 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4748 BGP_CLEAR_SOFT_OUT, NULL);
4749}
4750
4751DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4752 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4753 "clear ip bgp * vpnv4 unicast soft out",
4754 CLEAR_STR
4755 IP_STR
4756 BGP_STR
4757 "Clear all peers\n"
4758 "Address family\n"
4759 "Address Family Modifier\n"
4760 "Soft reconfig\n"
4761 "Soft reconfig outbound update\n")
4762{
4763 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4764 BGP_CLEAR_SOFT_OUT, NULL);
4765}
4766
4767ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4768 clear_ip_bgp_all_vpnv4_out_cmd,
4769 "clear ip bgp * vpnv4 unicast out",
4770 CLEAR_STR
4771 IP_STR
4772 BGP_STR
4773 "Clear all peers\n"
4774 "Address family\n"
4775 "Address Family Modifier\n"
4776 "Soft reconfig outbound update\n")
4777
4778DEFUN (clear_bgp_all_soft_out,
4779 clear_bgp_all_soft_out_cmd,
4780 "clear bgp * soft out",
4781 CLEAR_STR
4782 BGP_STR
4783 "Clear all peers\n"
4784 "Soft reconfig\n"
4785 "Soft reconfig outbound update\n")
4786{
4787 if (argc == 1)
4788 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4789 BGP_CLEAR_SOFT_OUT, NULL);
4790
4791 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4792 BGP_CLEAR_SOFT_OUT, NULL);
4793}
4794
4795ALIAS (clear_bgp_all_soft_out,
4796 clear_bgp_instance_all_soft_out_cmd,
4797 "clear bgp view WORD * soft out",
4798 CLEAR_STR
4799 BGP_STR
4800 "BGP view\n"
4801 "view name\n"
4802 "Clear all peers\n"
4803 "Soft reconfig\n"
4804 "Soft reconfig outbound update\n")
4805
4806ALIAS (clear_bgp_all_soft_out,
4807 clear_bgp_all_out_cmd,
4808 "clear bgp * out",
4809 CLEAR_STR
4810 BGP_STR
4811 "Clear all peers\n"
4812 "Soft reconfig outbound update\n")
4813
4814ALIAS (clear_bgp_all_soft_out,
4815 clear_bgp_ipv6_all_soft_out_cmd,
4816 "clear bgp ipv6 * soft out",
4817 CLEAR_STR
4818 BGP_STR
4819 "Address family\n"
4820 "Clear all peers\n"
4821 "Soft reconfig\n"
4822 "Soft reconfig outbound update\n")
4823
4824ALIAS (clear_bgp_all_soft_out,
4825 clear_bgp_ipv6_all_out_cmd,
4826 "clear bgp ipv6 * out",
4827 CLEAR_STR
4828 BGP_STR
4829 "Address family\n"
4830 "Clear all peers\n"
4831 "Soft reconfig outbound update\n")
4832
4833DEFUN (clear_ip_bgp_peer_soft_out,
4834 clear_ip_bgp_peer_soft_out_cmd,
4835 "clear ip bgp A.B.C.D soft out",
4836 CLEAR_STR
4837 IP_STR
4838 BGP_STR
4839 "BGP neighbor address to clear\n"
4840 "Soft reconfig\n"
4841 "Soft reconfig outbound update\n")
4842{
4843 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4844 BGP_CLEAR_SOFT_OUT, argv[0]);
4845}
4846
4847ALIAS (clear_ip_bgp_peer_soft_out,
4848 clear_ip_bgp_peer_out_cmd,
4849 "clear ip bgp A.B.C.D out",
4850 CLEAR_STR
4851 IP_STR
4852 BGP_STR
4853 "BGP neighbor address to clear\n"
4854 "Soft reconfig outbound update\n")
4855
4856DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4857 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4858 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4859 CLEAR_STR
4860 IP_STR
4861 BGP_STR
4862 "BGP neighbor address to clear\n"
4863 "Address family\n"
4864 "Address Family modifier\n"
4865 "Address Family modifier\n"
4866 "Soft reconfig\n"
4867 "Soft reconfig outbound update\n")
4868{
4869 if (strncmp (argv[1], "m", 1) == 0)
4870 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4871 BGP_CLEAR_SOFT_OUT, argv[0]);
4872
4873 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4874 BGP_CLEAR_SOFT_OUT, argv[0]);
4875}
4876
4877ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
4878 clear_ip_bgp_peer_ipv4_out_cmd,
4879 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
4880 CLEAR_STR
4881 IP_STR
4882 BGP_STR
4883 "BGP neighbor address to clear\n"
4884 "Address family\n"
4885 "Address Family modifier\n"
4886 "Address Family modifier\n"
4887 "Soft reconfig outbound update\n")
4888
4889DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
4890 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
4891 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
4892 CLEAR_STR
4893 IP_STR
4894 BGP_STR
4895 "BGP neighbor address to clear\n"
4896 "Address family\n"
4897 "Address Family Modifier\n"
4898 "Soft reconfig\n"
4899 "Soft reconfig outbound update\n")
4900{
4901 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
4902 BGP_CLEAR_SOFT_OUT, argv[0]);
4903}
4904
4905ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
4906 clear_ip_bgp_peer_vpnv4_out_cmd,
4907 "clear ip bgp A.B.C.D vpnv4 unicast out",
4908 CLEAR_STR
4909 IP_STR
4910 BGP_STR
4911 "BGP neighbor address to clear\n"
4912 "Address family\n"
4913 "Address Family Modifier\n"
4914 "Soft reconfig outbound update\n")
4915
4916DEFUN (clear_bgp_peer_soft_out,
4917 clear_bgp_peer_soft_out_cmd,
4918 "clear bgp (A.B.C.D|X:X::X:X) soft out",
4919 CLEAR_STR
4920 BGP_STR
4921 "BGP neighbor address to clear\n"
4922 "BGP IPv6 neighbor to clear\n"
4923 "Soft reconfig\n"
4924 "Soft reconfig outbound update\n")
4925{
4926 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
4927 BGP_CLEAR_SOFT_OUT, argv[0]);
4928}
4929
4930ALIAS (clear_bgp_peer_soft_out,
4931 clear_bgp_ipv6_peer_soft_out_cmd,
4932 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
4933 CLEAR_STR
4934 BGP_STR
4935 "Address family\n"
4936 "BGP neighbor address to clear\n"
4937 "BGP IPv6 neighbor to clear\n"
4938 "Soft reconfig\n"
4939 "Soft reconfig outbound update\n")
4940
4941ALIAS (clear_bgp_peer_soft_out,
4942 clear_bgp_peer_out_cmd,
4943 "clear bgp (A.B.C.D|X:X::X:X) out",
4944 CLEAR_STR
4945 BGP_STR
4946 "BGP neighbor address to clear\n"
4947 "BGP IPv6 neighbor to clear\n"
4948 "Soft reconfig outbound update\n")
4949
4950ALIAS (clear_bgp_peer_soft_out,
4951 clear_bgp_ipv6_peer_out_cmd,
4952 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
4953 CLEAR_STR
4954 BGP_STR
4955 "Address family\n"
4956 "BGP neighbor address to clear\n"
4957 "BGP IPv6 neighbor to clear\n"
4958 "Soft reconfig outbound update\n")
4959
4960DEFUN (clear_ip_bgp_peer_group_soft_out,
4961 clear_ip_bgp_peer_group_soft_out_cmd,
4962 "clear ip bgp peer-group WORD soft out",
4963 CLEAR_STR
4964 IP_STR
4965 BGP_STR
4966 "Clear all members of peer-group\n"
4967 "BGP peer-group name\n"
4968 "Soft reconfig\n"
4969 "Soft reconfig outbound update\n")
4970{
4971 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4972 BGP_CLEAR_SOFT_OUT, argv[0]);
4973}
4974
4975ALIAS (clear_ip_bgp_peer_group_soft_out,
4976 clear_ip_bgp_peer_group_out_cmd,
4977 "clear ip bgp peer-group WORD out",
4978 CLEAR_STR
4979 IP_STR
4980 BGP_STR
4981 "Clear all members of peer-group\n"
4982 "BGP peer-group name\n"
4983 "Soft reconfig outbound update\n")
4984
4985DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
4986 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
4987 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
4988 CLEAR_STR
4989 IP_STR
4990 BGP_STR
4991 "Clear all members of peer-group\n"
4992 "BGP peer-group name\n"
4993 "Address family\n"
4994 "Address Family modifier\n"
4995 "Address Family modifier\n"
4996 "Soft reconfig\n"
4997 "Soft reconfig outbound update\n")
4998{
4999 if (strncmp (argv[1], "m", 1) == 0)
5000 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5001 BGP_CLEAR_SOFT_OUT, argv[0]);
5002
5003 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5004 BGP_CLEAR_SOFT_OUT, argv[0]);
5005}
5006
5007ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
5008 clear_ip_bgp_peer_group_ipv4_out_cmd,
5009 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
5010 CLEAR_STR
5011 IP_STR
5012 BGP_STR
5013 "Clear all members of peer-group\n"
5014 "BGP peer-group name\n"
5015 "Address family\n"
5016 "Address Family modifier\n"
5017 "Address Family modifier\n"
5018 "Soft reconfig outbound update\n")
5019
5020DEFUN (clear_bgp_peer_group_soft_out,
5021 clear_bgp_peer_group_soft_out_cmd,
5022 "clear bgp peer-group WORD soft out",
5023 CLEAR_STR
5024 BGP_STR
5025 "Clear all members of peer-group\n"
5026 "BGP peer-group name\n"
5027 "Soft reconfig\n"
5028 "Soft reconfig outbound update\n")
5029{
5030 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5031 BGP_CLEAR_SOFT_OUT, argv[0]);
5032}
5033
5034ALIAS (clear_bgp_peer_group_soft_out,
5035 clear_bgp_ipv6_peer_group_soft_out_cmd,
5036 "clear bgp ipv6 peer-group WORD soft out",
5037 CLEAR_STR
5038 BGP_STR
5039 "Address family\n"
5040 "Clear all members of peer-group\n"
5041 "BGP peer-group name\n"
5042 "Soft reconfig\n"
5043 "Soft reconfig outbound update\n")
5044
5045ALIAS (clear_bgp_peer_group_soft_out,
5046 clear_bgp_peer_group_out_cmd,
5047 "clear bgp peer-group WORD out",
5048 CLEAR_STR
5049 BGP_STR
5050 "Clear all members of peer-group\n"
5051 "BGP peer-group name\n"
5052 "Soft reconfig outbound update\n")
5053
5054ALIAS (clear_bgp_peer_group_soft_out,
5055 clear_bgp_ipv6_peer_group_out_cmd,
5056 "clear bgp ipv6 peer-group WORD out",
5057 CLEAR_STR
5058 BGP_STR
5059 "Address family\n"
5060 "Clear all members of peer-group\n"
5061 "BGP peer-group name\n"
5062 "Soft reconfig outbound update\n")
5063
5064DEFUN (clear_ip_bgp_external_soft_out,
5065 clear_ip_bgp_external_soft_out_cmd,
5066 "clear ip bgp external soft out",
5067 CLEAR_STR
5068 IP_STR
5069 BGP_STR
5070 "Clear all external peers\n"
5071 "Soft reconfig\n"
5072 "Soft reconfig outbound update\n")
5073{
5074 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5075 BGP_CLEAR_SOFT_OUT, NULL);
5076}
5077
5078ALIAS (clear_ip_bgp_external_soft_out,
5079 clear_ip_bgp_external_out_cmd,
5080 "clear ip bgp external out",
5081 CLEAR_STR
5082 IP_STR
5083 BGP_STR
5084 "Clear all external peers\n"
5085 "Soft reconfig outbound update\n")
5086
5087DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5088 clear_ip_bgp_external_ipv4_soft_out_cmd,
5089 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5090 CLEAR_STR
5091 IP_STR
5092 BGP_STR
5093 "Clear all external peers\n"
5094 "Address family\n"
5095 "Address Family modifier\n"
5096 "Address Family modifier\n"
5097 "Soft reconfig\n"
5098 "Soft reconfig outbound update\n")
5099{
5100 if (strncmp (argv[0], "m", 1) == 0)
5101 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5102 BGP_CLEAR_SOFT_OUT, NULL);
5103
5104 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5105 BGP_CLEAR_SOFT_OUT, NULL);
5106}
5107
5108ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5109 clear_ip_bgp_external_ipv4_out_cmd,
5110 "clear ip bgp external ipv4 (unicast|multicast) out",
5111 CLEAR_STR
5112 IP_STR
5113 BGP_STR
5114 "Clear all external peers\n"
5115 "Address family\n"
5116 "Address Family modifier\n"
5117 "Address Family modifier\n"
5118 "Soft reconfig outbound update\n")
5119
5120DEFUN (clear_bgp_external_soft_out,
5121 clear_bgp_external_soft_out_cmd,
5122 "clear bgp external soft out",
5123 CLEAR_STR
5124 BGP_STR
5125 "Clear all external peers\n"
5126 "Soft reconfig\n"
5127 "Soft reconfig outbound update\n")
5128{
5129 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5130 BGP_CLEAR_SOFT_OUT, NULL);
5131}
5132
5133ALIAS (clear_bgp_external_soft_out,
5134 clear_bgp_ipv6_external_soft_out_cmd,
5135 "clear bgp ipv6 external soft out",
5136 CLEAR_STR
5137 BGP_STR
5138 "Address family\n"
5139 "Clear all external peers\n"
5140 "Soft reconfig\n"
5141 "Soft reconfig outbound update\n")
5142
5143ALIAS (clear_bgp_external_soft_out,
5144 clear_bgp_external_out_cmd,
5145 "clear bgp external out",
5146 CLEAR_STR
5147 BGP_STR
5148 "Clear all external peers\n"
5149 "Soft reconfig outbound update\n")
5150
5151ALIAS (clear_bgp_external_soft_out,
5152 clear_bgp_ipv6_external_out_cmd,
5153 "clear bgp ipv6 external WORD out",
5154 CLEAR_STR
5155 BGP_STR
5156 "Address family\n"
5157 "Clear all external peers\n"
5158 "Soft reconfig outbound update\n")
5159
5160DEFUN (clear_ip_bgp_as_soft_out,
5161 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005162 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005163 CLEAR_STR
5164 IP_STR
5165 BGP_STR
5166 "Clear peers with the AS number\n"
5167 "Soft reconfig\n"
5168 "Soft reconfig outbound update\n")
5169{
5170 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5171 BGP_CLEAR_SOFT_OUT, argv[0]);
5172}
5173
5174ALIAS (clear_ip_bgp_as_soft_out,
5175 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005176 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005177 CLEAR_STR
5178 IP_STR
5179 BGP_STR
5180 "Clear peers with the AS number\n"
5181 "Soft reconfig outbound update\n")
5182
5183DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5184 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005185 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005186 CLEAR_STR
5187 IP_STR
5188 BGP_STR
5189 "Clear peers with the AS number\n"
5190 "Address family\n"
5191 "Address Family modifier\n"
5192 "Address Family modifier\n"
5193 "Soft reconfig\n"
5194 "Soft reconfig outbound update\n")
5195{
5196 if (strncmp (argv[1], "m", 1) == 0)
5197 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5198 BGP_CLEAR_SOFT_OUT, argv[0]);
5199
5200 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5201 BGP_CLEAR_SOFT_OUT, argv[0]);
5202}
5203
5204ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5205 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005206 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00005207 CLEAR_STR
5208 IP_STR
5209 BGP_STR
5210 "Clear peers with the AS number\n"
5211 "Address family\n"
5212 "Address Family modifier\n"
5213 "Address Family modifier\n"
5214 "Soft reconfig outbound update\n")
5215
5216DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5217 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005218 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00005219 CLEAR_STR
5220 IP_STR
5221 BGP_STR
5222 "Clear peers with the AS number\n"
5223 "Address family\n"
5224 "Address Family modifier\n"
5225 "Soft reconfig\n"
5226 "Soft reconfig outbound update\n")
5227{
5228 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5229 BGP_CLEAR_SOFT_OUT, argv[0]);
5230}
5231
5232ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5233 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005234 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005235 CLEAR_STR
5236 IP_STR
5237 BGP_STR
5238 "Clear peers with the AS number\n"
5239 "Address family\n"
5240 "Address Family modifier\n"
5241 "Soft reconfig outbound update\n")
5242
5243DEFUN (clear_bgp_as_soft_out,
5244 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005245 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005246 CLEAR_STR
5247 BGP_STR
5248 "Clear peers with the AS number\n"
5249 "Soft reconfig\n"
5250 "Soft reconfig outbound update\n")
5251{
5252 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5253 BGP_CLEAR_SOFT_OUT, argv[0]);
5254}
5255
5256ALIAS (clear_bgp_as_soft_out,
5257 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005258 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005259 CLEAR_STR
5260 BGP_STR
5261 "Address family\n"
5262 "Clear peers with the AS number\n"
5263 "Soft reconfig\n"
5264 "Soft reconfig outbound update\n")
5265
5266ALIAS (clear_bgp_as_soft_out,
5267 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005268 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005269 CLEAR_STR
5270 BGP_STR
5271 "Clear peers with the AS number\n"
5272 "Soft reconfig outbound update\n")
5273
5274ALIAS (clear_bgp_as_soft_out,
5275 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005276 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005277 CLEAR_STR
5278 BGP_STR
5279 "Address family\n"
5280 "Clear peers with the AS number\n"
5281 "Soft reconfig outbound update\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02005282
paul718e3742002-12-13 20:15:29 +00005283/* Inbound soft-reconfiguration */
5284DEFUN (clear_ip_bgp_all_soft_in,
5285 clear_ip_bgp_all_soft_in_cmd,
5286 "clear ip bgp * soft in",
5287 CLEAR_STR
5288 IP_STR
5289 BGP_STR
5290 "Clear all peers\n"
5291 "Soft reconfig\n"
5292 "Soft reconfig inbound update\n")
5293{
5294 if (argc == 1)
5295 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5296 BGP_CLEAR_SOFT_IN, NULL);
5297
5298 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5299 BGP_CLEAR_SOFT_IN, NULL);
5300}
5301
5302ALIAS (clear_ip_bgp_all_soft_in,
5303 clear_ip_bgp_instance_all_soft_in_cmd,
5304 "clear ip bgp view WORD * soft in",
5305 CLEAR_STR
5306 IP_STR
5307 BGP_STR
5308 "BGP view\n"
5309 "view name\n"
5310 "Clear all peers\n"
5311 "Soft reconfig\n"
5312 "Soft reconfig inbound update\n")
5313
5314ALIAS (clear_ip_bgp_all_soft_in,
5315 clear_ip_bgp_all_in_cmd,
5316 "clear ip bgp * in",
5317 CLEAR_STR
5318 IP_STR
5319 BGP_STR
5320 "Clear all peers\n"
5321 "Soft reconfig inbound update\n")
5322
5323DEFUN (clear_ip_bgp_all_in_prefix_filter,
5324 clear_ip_bgp_all_in_prefix_filter_cmd,
5325 "clear ip bgp * in prefix-filter",
5326 CLEAR_STR
5327 IP_STR
5328 BGP_STR
5329 "Clear all peers\n"
5330 "Soft reconfig inbound update\n"
5331 "Push out prefix-list ORF and do inbound soft reconfig\n")
5332{
5333 if (argc== 1)
5334 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5335 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5336
5337 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5338 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5339}
5340
5341ALIAS (clear_ip_bgp_all_in_prefix_filter,
5342 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5343 "clear ip bgp view WORD * in prefix-filter",
5344 CLEAR_STR
5345 IP_STR
5346 BGP_STR
5347 "BGP view\n"
5348 "view name\n"
5349 "Clear all peers\n"
5350 "Soft reconfig inbound update\n"
5351 "Push out prefix-list ORF and do inbound soft reconfig\n")
5352
5353
5354DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5355 clear_ip_bgp_all_ipv4_soft_in_cmd,
5356 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5357 CLEAR_STR
5358 IP_STR
5359 BGP_STR
5360 "Clear all peers\n"
5361 "Address family\n"
5362 "Address Family modifier\n"
5363 "Address Family modifier\n"
5364 "Soft reconfig\n"
5365 "Soft reconfig inbound update\n")
5366{
5367 if (strncmp (argv[0], "m", 1) == 0)
5368 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5369 BGP_CLEAR_SOFT_IN, NULL);
5370
5371 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5372 BGP_CLEAR_SOFT_IN, NULL);
5373}
5374
5375ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5376 clear_ip_bgp_all_ipv4_in_cmd,
5377 "clear ip bgp * ipv4 (unicast|multicast) in",
5378 CLEAR_STR
5379 IP_STR
5380 BGP_STR
5381 "Clear all peers\n"
5382 "Address family\n"
5383 "Address Family modifier\n"
5384 "Address Family modifier\n"
5385 "Soft reconfig inbound update\n")
5386
5387DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5388 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5389 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5390 CLEAR_STR
5391 IP_STR
5392 BGP_STR
5393 "BGP view\n"
5394 "view name\n"
5395 "Clear all peers\n"
5396 "Address family\n"
5397 "Address Family modifier\n"
5398 "Address Family modifier\n"
5399 "Soft reconfig\n"
5400 "Soft reconfig inbound update\n")
5401{
5402 if (strncmp (argv[1], "m", 1) == 0)
5403 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5404 BGP_CLEAR_SOFT_IN, NULL);
5405
5406 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5407 BGP_CLEAR_SOFT_IN, NULL);
5408}
5409
5410DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5411 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5412 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5413 CLEAR_STR
5414 IP_STR
5415 BGP_STR
5416 "Clear all peers\n"
5417 "Address family\n"
5418 "Address Family modifier\n"
5419 "Address Family modifier\n"
5420 "Soft reconfig inbound update\n"
5421 "Push out prefix-list ORF and do inbound soft reconfig\n")
5422{
5423 if (strncmp (argv[0], "m", 1) == 0)
5424 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5425 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5426
5427 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5428 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5429}
5430
5431DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5432 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5433 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5434 CLEAR_STR
5435 IP_STR
5436 BGP_STR
5437 "Clear all peers\n"
5438 "Address family\n"
5439 "Address Family modifier\n"
5440 "Address Family modifier\n"
5441 "Soft reconfig inbound update\n"
5442 "Push out prefix-list ORF and do inbound soft reconfig\n")
5443{
5444 if (strncmp (argv[1], "m", 1) == 0)
5445 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5446 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5447
5448 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5449 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5450}
5451
5452DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5453 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5454 "clear ip bgp * vpnv4 unicast soft in",
5455 CLEAR_STR
5456 IP_STR
5457 BGP_STR
5458 "Clear all peers\n"
5459 "Address family\n"
5460 "Address Family Modifier\n"
5461 "Soft reconfig\n"
5462 "Soft reconfig inbound update\n")
5463{
5464 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5465 BGP_CLEAR_SOFT_IN, NULL);
5466}
5467
5468ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5469 clear_ip_bgp_all_vpnv4_in_cmd,
5470 "clear ip bgp * vpnv4 unicast in",
5471 CLEAR_STR
5472 IP_STR
5473 BGP_STR
5474 "Clear all peers\n"
5475 "Address family\n"
5476 "Address Family Modifier\n"
5477 "Soft reconfig inbound update\n")
5478
5479DEFUN (clear_bgp_all_soft_in,
5480 clear_bgp_all_soft_in_cmd,
5481 "clear bgp * soft in",
5482 CLEAR_STR
5483 BGP_STR
5484 "Clear all peers\n"
5485 "Soft reconfig\n"
5486 "Soft reconfig inbound update\n")
5487{
5488 if (argc == 1)
5489 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5490 BGP_CLEAR_SOFT_IN, NULL);
5491
5492 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5493 BGP_CLEAR_SOFT_IN, NULL);
5494}
5495
5496ALIAS (clear_bgp_all_soft_in,
5497 clear_bgp_instance_all_soft_in_cmd,
5498 "clear bgp view WORD * soft in",
5499 CLEAR_STR
5500 BGP_STR
5501 "BGP view\n"
5502 "view name\n"
5503 "Clear all peers\n"
5504 "Soft reconfig\n"
5505 "Soft reconfig inbound update\n")
5506
5507ALIAS (clear_bgp_all_soft_in,
5508 clear_bgp_ipv6_all_soft_in_cmd,
5509 "clear bgp ipv6 * soft in",
5510 CLEAR_STR
5511 BGP_STR
5512 "Address family\n"
5513 "Clear all peers\n"
5514 "Soft reconfig\n"
5515 "Soft reconfig inbound update\n")
5516
5517ALIAS (clear_bgp_all_soft_in,
5518 clear_bgp_all_in_cmd,
5519 "clear bgp * in",
5520 CLEAR_STR
5521 BGP_STR
5522 "Clear all peers\n"
5523 "Soft reconfig inbound update\n")
5524
5525ALIAS (clear_bgp_all_soft_in,
5526 clear_bgp_ipv6_all_in_cmd,
5527 "clear bgp ipv6 * in",
5528 CLEAR_STR
5529 BGP_STR
5530 "Address family\n"
5531 "Clear all peers\n"
5532 "Soft reconfig inbound update\n")
5533
5534DEFUN (clear_bgp_all_in_prefix_filter,
5535 clear_bgp_all_in_prefix_filter_cmd,
5536 "clear bgp * in prefix-filter",
5537 CLEAR_STR
5538 BGP_STR
5539 "Clear all peers\n"
5540 "Soft reconfig inbound update\n"
5541 "Push out prefix-list ORF and do inbound soft reconfig\n")
5542{
5543 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5544 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5545}
5546
5547ALIAS (clear_bgp_all_in_prefix_filter,
5548 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5549 "clear bgp ipv6 * in prefix-filter",
5550 CLEAR_STR
5551 BGP_STR
5552 "Address family\n"
5553 "Clear all peers\n"
5554 "Soft reconfig inbound update\n"
5555 "Push out prefix-list ORF and do inbound soft reconfig\n")
5556
5557DEFUN (clear_ip_bgp_peer_soft_in,
5558 clear_ip_bgp_peer_soft_in_cmd,
5559 "clear ip bgp A.B.C.D soft in",
5560 CLEAR_STR
5561 IP_STR
5562 BGP_STR
5563 "BGP neighbor address to clear\n"
5564 "Soft reconfig\n"
5565 "Soft reconfig inbound update\n")
5566{
5567 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5568 BGP_CLEAR_SOFT_IN, argv[0]);
5569}
5570
5571ALIAS (clear_ip_bgp_peer_soft_in,
5572 clear_ip_bgp_peer_in_cmd,
5573 "clear ip bgp A.B.C.D in",
5574 CLEAR_STR
5575 IP_STR
5576 BGP_STR
5577 "BGP neighbor address to clear\n"
5578 "Soft reconfig inbound update\n")
5579
5580DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5581 clear_ip_bgp_peer_in_prefix_filter_cmd,
5582 "clear ip bgp A.B.C.D in prefix-filter",
5583 CLEAR_STR
5584 IP_STR
5585 BGP_STR
5586 "BGP neighbor address to clear\n"
5587 "Soft reconfig inbound update\n"
5588 "Push out the existing ORF prefix-list\n")
5589{
5590 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5591 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5592}
5593
5594DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5595 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5596 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5597 CLEAR_STR
5598 IP_STR
5599 BGP_STR
5600 "BGP neighbor address to clear\n"
5601 "Address family\n"
5602 "Address Family modifier\n"
5603 "Address Family modifier\n"
5604 "Soft reconfig\n"
5605 "Soft reconfig inbound update\n")
5606{
5607 if (strncmp (argv[1], "m", 1) == 0)
5608 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5609 BGP_CLEAR_SOFT_IN, argv[0]);
5610
5611 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5612 BGP_CLEAR_SOFT_IN, argv[0]);
5613}
5614
5615ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5616 clear_ip_bgp_peer_ipv4_in_cmd,
5617 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5618 CLEAR_STR
5619 IP_STR
5620 BGP_STR
5621 "BGP neighbor address to clear\n"
5622 "Address family\n"
5623 "Address Family modifier\n"
5624 "Address Family modifier\n"
5625 "Soft reconfig inbound update\n")
5626
5627DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5628 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5629 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5630 CLEAR_STR
5631 IP_STR
5632 BGP_STR
5633 "BGP neighbor address to clear\n"
5634 "Address family\n"
5635 "Address Family modifier\n"
5636 "Address Family modifier\n"
5637 "Soft reconfig inbound update\n"
5638 "Push out the existing ORF prefix-list\n")
5639{
5640 if (strncmp (argv[1], "m", 1) == 0)
5641 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5642 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5643
5644 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5645 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5646}
5647
5648DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5649 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5650 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5651 CLEAR_STR
5652 IP_STR
5653 BGP_STR
5654 "BGP neighbor address to clear\n"
5655 "Address family\n"
5656 "Address Family Modifier\n"
5657 "Soft reconfig\n"
5658 "Soft reconfig inbound update\n")
5659{
5660 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5661 BGP_CLEAR_SOFT_IN, argv[0]);
5662}
5663
5664ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5665 clear_ip_bgp_peer_vpnv4_in_cmd,
5666 "clear ip bgp A.B.C.D vpnv4 unicast in",
5667 CLEAR_STR
5668 IP_STR
5669 BGP_STR
5670 "BGP neighbor address to clear\n"
5671 "Address family\n"
5672 "Address Family Modifier\n"
5673 "Soft reconfig inbound update\n")
5674
5675DEFUN (clear_bgp_peer_soft_in,
5676 clear_bgp_peer_soft_in_cmd,
5677 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5678 CLEAR_STR
5679 BGP_STR
5680 "BGP neighbor address to clear\n"
5681 "BGP IPv6 neighbor to clear\n"
5682 "Soft reconfig\n"
5683 "Soft reconfig inbound update\n")
5684{
5685 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5686 BGP_CLEAR_SOFT_IN, argv[0]);
5687}
5688
5689ALIAS (clear_bgp_peer_soft_in,
5690 clear_bgp_ipv6_peer_soft_in_cmd,
5691 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5692 CLEAR_STR
5693 BGP_STR
5694 "Address family\n"
5695 "BGP neighbor address to clear\n"
5696 "BGP IPv6 neighbor to clear\n"
5697 "Soft reconfig\n"
5698 "Soft reconfig inbound update\n")
5699
5700ALIAS (clear_bgp_peer_soft_in,
5701 clear_bgp_peer_in_cmd,
5702 "clear bgp (A.B.C.D|X:X::X:X) in",
5703 CLEAR_STR
5704 BGP_STR
5705 "BGP neighbor address to clear\n"
5706 "BGP IPv6 neighbor to clear\n"
5707 "Soft reconfig inbound update\n")
5708
5709ALIAS (clear_bgp_peer_soft_in,
5710 clear_bgp_ipv6_peer_in_cmd,
5711 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5712 CLEAR_STR
5713 BGP_STR
5714 "Address family\n"
5715 "BGP neighbor address to clear\n"
5716 "BGP IPv6 neighbor to clear\n"
5717 "Soft reconfig inbound update\n")
5718
5719DEFUN (clear_bgp_peer_in_prefix_filter,
5720 clear_bgp_peer_in_prefix_filter_cmd,
5721 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5722 CLEAR_STR
5723 BGP_STR
5724 "BGP neighbor address to clear\n"
5725 "BGP IPv6 neighbor to clear\n"
5726 "Soft reconfig inbound update\n"
5727 "Push out the existing ORF prefix-list\n")
5728{
5729 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5730 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5731}
5732
5733ALIAS (clear_bgp_peer_in_prefix_filter,
5734 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5735 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5736 CLEAR_STR
5737 BGP_STR
5738 "Address family\n"
5739 "BGP neighbor address to clear\n"
5740 "BGP IPv6 neighbor to clear\n"
5741 "Soft reconfig inbound update\n"
5742 "Push out the existing ORF prefix-list\n")
5743
5744DEFUN (clear_ip_bgp_peer_group_soft_in,
5745 clear_ip_bgp_peer_group_soft_in_cmd,
5746 "clear ip bgp peer-group WORD soft in",
5747 CLEAR_STR
5748 IP_STR
5749 BGP_STR
5750 "Clear all members of peer-group\n"
5751 "BGP peer-group name\n"
5752 "Soft reconfig\n"
5753 "Soft reconfig inbound update\n")
5754{
5755 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5756 BGP_CLEAR_SOFT_IN, argv[0]);
5757}
5758
5759ALIAS (clear_ip_bgp_peer_group_soft_in,
5760 clear_ip_bgp_peer_group_in_cmd,
5761 "clear ip bgp peer-group WORD in",
5762 CLEAR_STR
5763 IP_STR
5764 BGP_STR
5765 "Clear all members of peer-group\n"
5766 "BGP peer-group name\n"
5767 "Soft reconfig inbound update\n")
5768
5769DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
5770 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
5771 "clear ip bgp peer-group WORD in prefix-filter",
5772 CLEAR_STR
5773 IP_STR
5774 BGP_STR
5775 "Clear all members of peer-group\n"
5776 "BGP peer-group name\n"
5777 "Soft reconfig inbound update\n"
5778 "Push out prefix-list ORF and do inbound soft reconfig\n")
5779{
5780 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5781 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5782}
5783
5784DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
5785 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
5786 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
5787 CLEAR_STR
5788 IP_STR
5789 BGP_STR
5790 "Clear all members of peer-group\n"
5791 "BGP peer-group name\n"
5792 "Address family\n"
5793 "Address Family modifier\n"
5794 "Address Family modifier\n"
5795 "Soft reconfig\n"
5796 "Soft reconfig inbound update\n")
5797{
5798 if (strncmp (argv[1], "m", 1) == 0)
5799 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5800 BGP_CLEAR_SOFT_IN, argv[0]);
5801
5802 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5803 BGP_CLEAR_SOFT_IN, argv[0]);
5804}
5805
5806ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
5807 clear_ip_bgp_peer_group_ipv4_in_cmd,
5808 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
5809 CLEAR_STR
5810 IP_STR
5811 BGP_STR
5812 "Clear all members of peer-group\n"
5813 "BGP peer-group name\n"
5814 "Address family\n"
5815 "Address Family modifier\n"
5816 "Address Family modifier\n"
5817 "Soft reconfig inbound update\n")
5818
5819DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
5820 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
5821 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
5822 CLEAR_STR
5823 IP_STR
5824 BGP_STR
5825 "Clear all members of peer-group\n"
5826 "BGP peer-group name\n"
5827 "Address family\n"
5828 "Address Family modifier\n"
5829 "Address Family modifier\n"
5830 "Soft reconfig inbound update\n"
5831 "Push out prefix-list ORF and do inbound soft reconfig\n")
5832{
5833 if (strncmp (argv[1], "m", 1) == 0)
5834 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5835 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5836
5837 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5838 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5839}
5840
5841DEFUN (clear_bgp_peer_group_soft_in,
5842 clear_bgp_peer_group_soft_in_cmd,
5843 "clear bgp peer-group WORD soft in",
5844 CLEAR_STR
5845 BGP_STR
5846 "Clear all members of peer-group\n"
5847 "BGP peer-group name\n"
5848 "Soft reconfig\n"
5849 "Soft reconfig inbound update\n")
5850{
5851 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5852 BGP_CLEAR_SOFT_IN, argv[0]);
5853}
5854
5855ALIAS (clear_bgp_peer_group_soft_in,
5856 clear_bgp_ipv6_peer_group_soft_in_cmd,
5857 "clear bgp ipv6 peer-group WORD soft in",
5858 CLEAR_STR
5859 BGP_STR
5860 "Address family\n"
5861 "Clear all members of peer-group\n"
5862 "BGP peer-group name\n"
5863 "Soft reconfig\n"
5864 "Soft reconfig inbound update\n")
5865
5866ALIAS (clear_bgp_peer_group_soft_in,
5867 clear_bgp_peer_group_in_cmd,
5868 "clear bgp peer-group WORD in",
5869 CLEAR_STR
5870 BGP_STR
5871 "Clear all members of peer-group\n"
5872 "BGP peer-group name\n"
5873 "Soft reconfig inbound update\n")
5874
5875ALIAS (clear_bgp_peer_group_soft_in,
5876 clear_bgp_ipv6_peer_group_in_cmd,
5877 "clear bgp ipv6 peer-group WORD in",
5878 CLEAR_STR
5879 BGP_STR
5880 "Address family\n"
5881 "Clear all members of peer-group\n"
5882 "BGP peer-group name\n"
5883 "Soft reconfig inbound update\n")
5884
5885DEFUN (clear_bgp_peer_group_in_prefix_filter,
5886 clear_bgp_peer_group_in_prefix_filter_cmd,
5887 "clear bgp peer-group WORD in prefix-filter",
5888 CLEAR_STR
5889 BGP_STR
5890 "Clear all members of peer-group\n"
5891 "BGP peer-group name\n"
5892 "Soft reconfig inbound update\n"
5893 "Push out prefix-list ORF and do inbound soft reconfig\n")
5894{
5895 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5896 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5897}
5898
5899ALIAS (clear_bgp_peer_group_in_prefix_filter,
5900 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
5901 "clear bgp ipv6 peer-group WORD in prefix-filter",
5902 CLEAR_STR
5903 BGP_STR
5904 "Address family\n"
5905 "Clear all members of peer-group\n"
5906 "BGP peer-group name\n"
5907 "Soft reconfig inbound update\n"
5908 "Push out prefix-list ORF and do inbound soft reconfig\n")
5909
5910DEFUN (clear_ip_bgp_external_soft_in,
5911 clear_ip_bgp_external_soft_in_cmd,
5912 "clear ip bgp external soft in",
5913 CLEAR_STR
5914 IP_STR
5915 BGP_STR
5916 "Clear all external peers\n"
5917 "Soft reconfig\n"
5918 "Soft reconfig inbound update\n")
5919{
5920 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5921 BGP_CLEAR_SOFT_IN, NULL);
5922}
5923
5924ALIAS (clear_ip_bgp_external_soft_in,
5925 clear_ip_bgp_external_in_cmd,
5926 "clear ip bgp external in",
5927 CLEAR_STR
5928 IP_STR
5929 BGP_STR
5930 "Clear all external peers\n"
5931 "Soft reconfig inbound update\n")
5932
5933DEFUN (clear_ip_bgp_external_in_prefix_filter,
5934 clear_ip_bgp_external_in_prefix_filter_cmd,
5935 "clear ip bgp external in prefix-filter",
5936 CLEAR_STR
5937 IP_STR
5938 BGP_STR
5939 "Clear all external peers\n"
5940 "Soft reconfig inbound update\n"
5941 "Push out prefix-list ORF and do inbound soft reconfig\n")
5942{
5943 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5944 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5945}
5946
5947DEFUN (clear_ip_bgp_external_ipv4_soft_in,
5948 clear_ip_bgp_external_ipv4_soft_in_cmd,
5949 "clear ip bgp external ipv4 (unicast|multicast) soft in",
5950 CLEAR_STR
5951 IP_STR
5952 BGP_STR
5953 "Clear all external peers\n"
5954 "Address family\n"
5955 "Address Family modifier\n"
5956 "Address Family modifier\n"
5957 "Soft reconfig\n"
5958 "Soft reconfig inbound update\n")
5959{
5960 if (strncmp (argv[0], "m", 1) == 0)
5961 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5962 BGP_CLEAR_SOFT_IN, NULL);
5963
5964 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5965 BGP_CLEAR_SOFT_IN, NULL);
5966}
5967
5968ALIAS (clear_ip_bgp_external_ipv4_soft_in,
5969 clear_ip_bgp_external_ipv4_in_cmd,
5970 "clear ip bgp external ipv4 (unicast|multicast) in",
5971 CLEAR_STR
5972 IP_STR
5973 BGP_STR
5974 "Clear all external peers\n"
5975 "Address family\n"
5976 "Address Family modifier\n"
5977 "Address Family modifier\n"
5978 "Soft reconfig inbound update\n")
5979
5980DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
5981 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
5982 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
5983 CLEAR_STR
5984 IP_STR
5985 BGP_STR
5986 "Clear all external peers\n"
5987 "Address family\n"
5988 "Address Family modifier\n"
5989 "Address Family modifier\n"
5990 "Soft reconfig inbound update\n"
5991 "Push out prefix-list ORF and do inbound soft reconfig\n")
5992{
5993 if (strncmp (argv[0], "m", 1) == 0)
5994 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5995 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5996
5997 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5998 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5999}
6000
6001DEFUN (clear_bgp_external_soft_in,
6002 clear_bgp_external_soft_in_cmd,
6003 "clear bgp external soft in",
6004 CLEAR_STR
6005 BGP_STR
6006 "Clear all external peers\n"
6007 "Soft reconfig\n"
6008 "Soft reconfig inbound update\n")
6009{
6010 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6011 BGP_CLEAR_SOFT_IN, NULL);
6012}
6013
6014ALIAS (clear_bgp_external_soft_in,
6015 clear_bgp_ipv6_external_soft_in_cmd,
6016 "clear bgp ipv6 external soft in",
6017 CLEAR_STR
6018 BGP_STR
6019 "Address family\n"
6020 "Clear all external peers\n"
6021 "Soft reconfig\n"
6022 "Soft reconfig inbound update\n")
6023
6024ALIAS (clear_bgp_external_soft_in,
6025 clear_bgp_external_in_cmd,
6026 "clear bgp external in",
6027 CLEAR_STR
6028 BGP_STR
6029 "Clear all external peers\n"
6030 "Soft reconfig inbound update\n")
6031
6032ALIAS (clear_bgp_external_soft_in,
6033 clear_bgp_ipv6_external_in_cmd,
6034 "clear bgp ipv6 external WORD in",
6035 CLEAR_STR
6036 BGP_STR
6037 "Address family\n"
6038 "Clear all external peers\n"
6039 "Soft reconfig inbound update\n")
6040
6041DEFUN (clear_bgp_external_in_prefix_filter,
6042 clear_bgp_external_in_prefix_filter_cmd,
6043 "clear bgp external in prefix-filter",
6044 CLEAR_STR
6045 BGP_STR
6046 "Clear all external peers\n"
6047 "Soft reconfig inbound update\n"
6048 "Push out prefix-list ORF and do inbound soft reconfig\n")
6049{
6050 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6051 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6052}
6053
6054ALIAS (clear_bgp_external_in_prefix_filter,
6055 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6056 "clear bgp ipv6 external in prefix-filter",
6057 CLEAR_STR
6058 BGP_STR
6059 "Address family\n"
6060 "Clear all external peers\n"
6061 "Soft reconfig inbound update\n"
6062 "Push out prefix-list ORF and do inbound soft reconfig\n")
6063
6064DEFUN (clear_ip_bgp_as_soft_in,
6065 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006066 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006067 CLEAR_STR
6068 IP_STR
6069 BGP_STR
6070 "Clear peers with the AS number\n"
6071 "Soft reconfig\n"
6072 "Soft reconfig inbound update\n")
6073{
6074 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6075 BGP_CLEAR_SOFT_IN, argv[0]);
6076}
6077
6078ALIAS (clear_ip_bgp_as_soft_in,
6079 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006080 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006081 CLEAR_STR
6082 IP_STR
6083 BGP_STR
6084 "Clear peers with the AS number\n"
6085 "Soft reconfig inbound update\n")
6086
6087DEFUN (clear_ip_bgp_as_in_prefix_filter,
6088 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006089 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006090 CLEAR_STR
6091 IP_STR
6092 BGP_STR
6093 "Clear peers with the AS number\n"
6094 "Soft reconfig inbound update\n"
6095 "Push out prefix-list ORF and do inbound soft reconfig\n")
6096{
6097 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6098 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6099}
6100
6101DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6102 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006103 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006104 CLEAR_STR
6105 IP_STR
6106 BGP_STR
6107 "Clear peers with the AS number\n"
6108 "Address family\n"
6109 "Address Family modifier\n"
6110 "Address Family modifier\n"
6111 "Soft reconfig\n"
6112 "Soft reconfig inbound update\n")
6113{
6114 if (strncmp (argv[1], "m", 1) == 0)
6115 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6116 BGP_CLEAR_SOFT_IN, argv[0]);
6117
6118 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6119 BGP_CLEAR_SOFT_IN, argv[0]);
6120}
6121
6122ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6123 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006124 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00006125 CLEAR_STR
6126 IP_STR
6127 BGP_STR
6128 "Clear peers with the AS number\n"
6129 "Address family\n"
6130 "Address Family modifier\n"
6131 "Address Family modifier\n"
6132 "Soft reconfig inbound update\n")
6133
6134DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6135 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006136 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006137 CLEAR_STR
6138 IP_STR
6139 BGP_STR
6140 "Clear peers with the AS number\n"
6141 "Address family\n"
6142 "Address Family modifier\n"
6143 "Address Family modifier\n"
6144 "Soft reconfig inbound update\n"
6145 "Push out prefix-list ORF and do inbound soft reconfig\n")
6146{
6147 if (strncmp (argv[1], "m", 1) == 0)
6148 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6149 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6150
6151 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6152 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6153}
6154
6155DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6156 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006157 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00006158 CLEAR_STR
6159 IP_STR
6160 BGP_STR
6161 "Clear peers with the AS number\n"
6162 "Address family\n"
6163 "Address Family modifier\n"
6164 "Soft reconfig\n"
6165 "Soft reconfig inbound update\n")
6166{
6167 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6168 BGP_CLEAR_SOFT_IN, argv[0]);
6169}
6170
6171ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6172 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006173 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006174 CLEAR_STR
6175 IP_STR
6176 BGP_STR
6177 "Clear peers with the AS number\n"
6178 "Address family\n"
6179 "Address Family modifier\n"
6180 "Soft reconfig inbound update\n")
6181
6182DEFUN (clear_bgp_as_soft_in,
6183 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006184 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006185 CLEAR_STR
6186 BGP_STR
6187 "Clear peers with the AS number\n"
6188 "Soft reconfig\n"
6189 "Soft reconfig inbound update\n")
6190{
6191 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6192 BGP_CLEAR_SOFT_IN, argv[0]);
6193}
6194
6195ALIAS (clear_bgp_as_soft_in,
6196 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006197 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006198 CLEAR_STR
6199 BGP_STR
6200 "Address family\n"
6201 "Clear peers with the AS number\n"
6202 "Soft reconfig\n"
6203 "Soft reconfig inbound update\n")
6204
6205ALIAS (clear_bgp_as_soft_in,
6206 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006207 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006208 CLEAR_STR
6209 BGP_STR
6210 "Clear peers with the AS number\n"
6211 "Soft reconfig inbound update\n")
6212
6213ALIAS (clear_bgp_as_soft_in,
6214 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006215 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006216 CLEAR_STR
6217 BGP_STR
6218 "Address family\n"
6219 "Clear peers with the AS number\n"
6220 "Soft reconfig inbound update\n")
6221
6222DEFUN (clear_bgp_as_in_prefix_filter,
6223 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006224 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006225 CLEAR_STR
6226 BGP_STR
6227 "Clear peers with the AS number\n"
6228 "Soft reconfig inbound update\n"
6229 "Push out prefix-list ORF and do inbound soft reconfig\n")
6230{
6231 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6232 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6233}
6234
6235ALIAS (clear_bgp_as_in_prefix_filter,
6236 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006237 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006238 CLEAR_STR
6239 BGP_STR
6240 "Address family\n"
6241 "Clear peers with the AS number\n"
6242 "Soft reconfig inbound update\n"
6243 "Push out prefix-list ORF and do inbound soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006244
paul718e3742002-12-13 20:15:29 +00006245/* Both soft-reconfiguration */
6246DEFUN (clear_ip_bgp_all_soft,
6247 clear_ip_bgp_all_soft_cmd,
6248 "clear ip bgp * soft",
6249 CLEAR_STR
6250 IP_STR
6251 BGP_STR
6252 "Clear all peers\n"
6253 "Soft reconfig\n")
6254{
6255 if (argc == 1)
6256 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6257 BGP_CLEAR_SOFT_BOTH, NULL);
6258
6259 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6260 BGP_CLEAR_SOFT_BOTH, NULL);
6261}
6262
6263ALIAS (clear_ip_bgp_all_soft,
6264 clear_ip_bgp_instance_all_soft_cmd,
6265 "clear ip bgp view WORD * soft",
6266 CLEAR_STR
6267 IP_STR
6268 BGP_STR
6269 "BGP view\n"
6270 "view name\n"
6271 "Clear all peers\n"
6272 "Soft reconfig\n")
6273
6274
6275DEFUN (clear_ip_bgp_all_ipv4_soft,
6276 clear_ip_bgp_all_ipv4_soft_cmd,
6277 "clear ip bgp * ipv4 (unicast|multicast) soft",
6278 CLEAR_STR
6279 IP_STR
6280 BGP_STR
6281 "Clear all peers\n"
6282 "Address family\n"
6283 "Address Family Modifier\n"
6284 "Address Family Modifier\n"
6285 "Soft reconfig\n")
6286{
6287 if (strncmp (argv[0], "m", 1) == 0)
6288 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6289 BGP_CLEAR_SOFT_BOTH, NULL);
6290
6291 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6292 BGP_CLEAR_SOFT_BOTH, NULL);
6293}
6294
6295DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6296 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6297 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6298 CLEAR_STR
6299 IP_STR
6300 BGP_STR
6301 "BGP view\n"
6302 "view name\n"
6303 "Clear all peers\n"
6304 "Address family\n"
6305 "Address Family Modifier\n"
6306 "Address Family Modifier\n"
6307 "Soft reconfig\n")
6308{
6309 if (strncmp (argv[1], "m", 1) == 0)
6310 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6311 BGP_CLEAR_SOFT_BOTH, NULL);
6312
6313 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6314 BGP_CLEAR_SOFT_BOTH, NULL);
6315}
6316
6317DEFUN (clear_ip_bgp_all_vpnv4_soft,
6318 clear_ip_bgp_all_vpnv4_soft_cmd,
6319 "clear ip bgp * vpnv4 unicast soft",
6320 CLEAR_STR
6321 IP_STR
6322 BGP_STR
6323 "Clear all peers\n"
6324 "Address family\n"
6325 "Address Family Modifier\n"
6326 "Soft reconfig\n")
6327{
6328 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6329 BGP_CLEAR_SOFT_BOTH, argv[0]);
6330}
6331
6332DEFUN (clear_bgp_all_soft,
6333 clear_bgp_all_soft_cmd,
6334 "clear bgp * soft",
6335 CLEAR_STR
6336 BGP_STR
6337 "Clear all peers\n"
6338 "Soft reconfig\n")
6339{
6340 if (argc == 1)
6341 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6342 BGP_CLEAR_SOFT_BOTH, argv[0]);
6343
6344 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6345 BGP_CLEAR_SOFT_BOTH, argv[0]);
6346}
6347
6348ALIAS (clear_bgp_all_soft,
6349 clear_bgp_instance_all_soft_cmd,
6350 "clear bgp view WORD * soft",
6351 CLEAR_STR
6352 BGP_STR
6353 "BGP view\n"
6354 "view name\n"
6355 "Clear all peers\n"
6356 "Soft reconfig\n")
6357
6358ALIAS (clear_bgp_all_soft,
6359 clear_bgp_ipv6_all_soft_cmd,
6360 "clear bgp ipv6 * soft",
6361 CLEAR_STR
6362 BGP_STR
6363 "Address family\n"
6364 "Clear all peers\n"
6365 "Soft reconfig\n")
6366
6367DEFUN (clear_ip_bgp_peer_soft,
6368 clear_ip_bgp_peer_soft_cmd,
6369 "clear ip bgp A.B.C.D soft",
6370 CLEAR_STR
6371 IP_STR
6372 BGP_STR
6373 "BGP neighbor address to clear\n"
6374 "Soft reconfig\n")
6375{
6376 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6377 BGP_CLEAR_SOFT_BOTH, argv[0]);
6378}
6379
6380DEFUN (clear_ip_bgp_peer_ipv4_soft,
6381 clear_ip_bgp_peer_ipv4_soft_cmd,
6382 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6383 CLEAR_STR
6384 IP_STR
6385 BGP_STR
6386 "BGP neighbor address to clear\n"
6387 "Address family\n"
6388 "Address Family Modifier\n"
6389 "Address Family Modifier\n"
6390 "Soft reconfig\n")
6391{
6392 if (strncmp (argv[1], "m", 1) == 0)
6393 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6394 BGP_CLEAR_SOFT_BOTH, argv[0]);
6395
6396 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6397 BGP_CLEAR_SOFT_BOTH, argv[0]);
6398}
6399
6400DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6401 clear_ip_bgp_peer_vpnv4_soft_cmd,
6402 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6403 CLEAR_STR
6404 IP_STR
6405 BGP_STR
6406 "BGP neighbor address to clear\n"
6407 "Address family\n"
6408 "Address Family Modifier\n"
6409 "Soft reconfig\n")
6410{
6411 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6412 BGP_CLEAR_SOFT_BOTH, argv[0]);
6413}
6414
6415DEFUN (clear_bgp_peer_soft,
6416 clear_bgp_peer_soft_cmd,
6417 "clear bgp (A.B.C.D|X:X::X:X) soft",
6418 CLEAR_STR
6419 BGP_STR
6420 "BGP neighbor address to clear\n"
6421 "BGP IPv6 neighbor to clear\n"
6422 "Soft reconfig\n")
6423{
6424 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6425 BGP_CLEAR_SOFT_BOTH, argv[0]);
6426}
6427
6428ALIAS (clear_bgp_peer_soft,
6429 clear_bgp_ipv6_peer_soft_cmd,
6430 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6431 CLEAR_STR
6432 BGP_STR
6433 "Address family\n"
6434 "BGP neighbor address to clear\n"
6435 "BGP IPv6 neighbor to clear\n"
6436 "Soft reconfig\n")
6437
6438DEFUN (clear_ip_bgp_peer_group_soft,
6439 clear_ip_bgp_peer_group_soft_cmd,
6440 "clear ip bgp peer-group WORD soft",
6441 CLEAR_STR
6442 IP_STR
6443 BGP_STR
6444 "Clear all members of peer-group\n"
6445 "BGP peer-group name\n"
6446 "Soft reconfig\n")
6447{
6448 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6449 BGP_CLEAR_SOFT_BOTH, argv[0]);
6450}
6451
6452DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6453 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6454 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6455 CLEAR_STR
6456 IP_STR
6457 BGP_STR
6458 "Clear all members of peer-group\n"
6459 "BGP peer-group name\n"
6460 "Address family\n"
6461 "Address Family modifier\n"
6462 "Address Family modifier\n"
6463 "Soft reconfig\n")
6464{
6465 if (strncmp (argv[1], "m", 1) == 0)
6466 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6467 BGP_CLEAR_SOFT_BOTH, argv[0]);
6468
6469 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6470 BGP_CLEAR_SOFT_BOTH, argv[0]);
6471}
6472
6473DEFUN (clear_bgp_peer_group_soft,
6474 clear_bgp_peer_group_soft_cmd,
6475 "clear bgp peer-group WORD soft",
6476 CLEAR_STR
6477 BGP_STR
6478 "Clear all members of peer-group\n"
6479 "BGP peer-group name\n"
6480 "Soft reconfig\n")
6481{
6482 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6483 BGP_CLEAR_SOFT_BOTH, argv[0]);
6484}
6485
6486ALIAS (clear_bgp_peer_group_soft,
6487 clear_bgp_ipv6_peer_group_soft_cmd,
6488 "clear bgp ipv6 peer-group WORD soft",
6489 CLEAR_STR
6490 BGP_STR
6491 "Address family\n"
6492 "Clear all members of peer-group\n"
6493 "BGP peer-group name\n"
6494 "Soft reconfig\n")
6495
6496DEFUN (clear_ip_bgp_external_soft,
6497 clear_ip_bgp_external_soft_cmd,
6498 "clear ip bgp external soft",
6499 CLEAR_STR
6500 IP_STR
6501 BGP_STR
6502 "Clear all external peers\n"
6503 "Soft reconfig\n")
6504{
6505 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6506 BGP_CLEAR_SOFT_BOTH, NULL);
6507}
6508
6509DEFUN (clear_ip_bgp_external_ipv4_soft,
6510 clear_ip_bgp_external_ipv4_soft_cmd,
6511 "clear ip bgp external ipv4 (unicast|multicast) soft",
6512 CLEAR_STR
6513 IP_STR
6514 BGP_STR
6515 "Clear all external peers\n"
6516 "Address family\n"
6517 "Address Family modifier\n"
6518 "Address Family modifier\n"
6519 "Soft reconfig\n")
6520{
6521 if (strncmp (argv[0], "m", 1) == 0)
6522 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6523 BGP_CLEAR_SOFT_BOTH, NULL);
6524
6525 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6526 BGP_CLEAR_SOFT_BOTH, NULL);
6527}
6528
6529DEFUN (clear_bgp_external_soft,
6530 clear_bgp_external_soft_cmd,
6531 "clear bgp external soft",
6532 CLEAR_STR
6533 BGP_STR
6534 "Clear all external peers\n"
6535 "Soft reconfig\n")
6536{
6537 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6538 BGP_CLEAR_SOFT_BOTH, NULL);
6539}
6540
6541ALIAS (clear_bgp_external_soft,
6542 clear_bgp_ipv6_external_soft_cmd,
6543 "clear bgp ipv6 external soft",
6544 CLEAR_STR
6545 BGP_STR
6546 "Address family\n"
6547 "Clear all external peers\n"
6548 "Soft reconfig\n")
6549
6550DEFUN (clear_ip_bgp_as_soft,
6551 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006552 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006553 CLEAR_STR
6554 IP_STR
6555 BGP_STR
6556 "Clear peers with the AS number\n"
6557 "Soft reconfig\n")
6558{
6559 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6560 BGP_CLEAR_SOFT_BOTH, argv[0]);
6561}
6562
6563DEFUN (clear_ip_bgp_as_ipv4_soft,
6564 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006565 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006566 CLEAR_STR
6567 IP_STR
6568 BGP_STR
6569 "Clear peers with the AS number\n"
6570 "Address family\n"
6571 "Address Family Modifier\n"
6572 "Address Family Modifier\n"
6573 "Soft reconfig\n")
6574{
6575 if (strncmp (argv[1], "m", 1) == 0)
6576 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6577 BGP_CLEAR_SOFT_BOTH, argv[0]);
6578
6579 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6580 BGP_CLEAR_SOFT_BOTH, argv[0]);
6581}
6582
6583DEFUN (clear_ip_bgp_as_vpnv4_soft,
6584 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006585 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00006586 CLEAR_STR
6587 IP_STR
6588 BGP_STR
6589 "Clear peers with the AS number\n"
6590 "Address family\n"
6591 "Address Family Modifier\n"
6592 "Soft reconfig\n")
6593{
6594 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6595 BGP_CLEAR_SOFT_BOTH, argv[0]);
6596}
6597
6598DEFUN (clear_bgp_as_soft,
6599 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006600 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006601 CLEAR_STR
6602 BGP_STR
6603 "Clear peers with the AS number\n"
6604 "Soft reconfig\n")
6605{
6606 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6607 BGP_CLEAR_SOFT_BOTH, argv[0]);
6608}
6609
6610ALIAS (clear_bgp_as_soft,
6611 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006612 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006613 CLEAR_STR
6614 BGP_STR
6615 "Address family\n"
6616 "Clear peers with the AS number\n"
6617 "Soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006618
paulfee0f4c2004-09-13 05:12:46 +00006619/* RS-client soft reconfiguration. */
6620#ifdef HAVE_IPV6
6621DEFUN (clear_bgp_all_rsclient,
6622 clear_bgp_all_rsclient_cmd,
6623 "clear bgp * rsclient",
6624 CLEAR_STR
6625 BGP_STR
6626 "Clear all peers\n"
6627 "Soft reconfig for rsclient RIB\n")
6628{
6629 if (argc == 1)
6630 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6631 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6632
6633 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6634 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6635}
6636
6637ALIAS (clear_bgp_all_rsclient,
6638 clear_bgp_ipv6_all_rsclient_cmd,
6639 "clear bgp ipv6 * rsclient",
6640 CLEAR_STR
6641 BGP_STR
6642 "Address family\n"
6643 "Clear all peers\n"
6644 "Soft reconfig for rsclient RIB\n")
6645
6646ALIAS (clear_bgp_all_rsclient,
6647 clear_bgp_instance_all_rsclient_cmd,
6648 "clear bgp view WORD * rsclient",
6649 CLEAR_STR
6650 BGP_STR
6651 "BGP view\n"
6652 "view name\n"
6653 "Clear all peers\n"
6654 "Soft reconfig for rsclient RIB\n")
6655
6656ALIAS (clear_bgp_all_rsclient,
6657 clear_bgp_ipv6_instance_all_rsclient_cmd,
6658 "clear bgp ipv6 view WORD * rsclient",
6659 CLEAR_STR
6660 BGP_STR
6661 "Address family\n"
6662 "BGP view\n"
6663 "view name\n"
6664 "Clear all peers\n"
6665 "Soft reconfig for rsclient RIB\n")
6666#endif /* HAVE_IPV6 */
6667
6668DEFUN (clear_ip_bgp_all_rsclient,
6669 clear_ip_bgp_all_rsclient_cmd,
6670 "clear ip bgp * rsclient",
6671 CLEAR_STR
6672 IP_STR
6673 BGP_STR
6674 "Clear all peers\n"
6675 "Soft reconfig for rsclient RIB\n")
6676{
6677 if (argc == 1)
6678 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6679 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6680
6681 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6682 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6683}
6684
6685ALIAS (clear_ip_bgp_all_rsclient,
6686 clear_ip_bgp_instance_all_rsclient_cmd,
6687 "clear ip bgp view WORD * rsclient",
6688 CLEAR_STR
6689 IP_STR
6690 BGP_STR
6691 "BGP view\n"
6692 "view name\n"
6693 "Clear all peers\n"
6694 "Soft reconfig for rsclient RIB\n")
6695
6696#ifdef HAVE_IPV6
6697DEFUN (clear_bgp_peer_rsclient,
6698 clear_bgp_peer_rsclient_cmd,
6699 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
6700 CLEAR_STR
6701 BGP_STR
6702 "BGP neighbor IP address to clear\n"
6703 "BGP IPv6 neighbor to clear\n"
6704 "Soft reconfig for rsclient RIB\n")
6705{
6706 if (argc == 2)
6707 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
6708 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6709
6710 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6711 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6712}
6713
6714ALIAS (clear_bgp_peer_rsclient,
6715 clear_bgp_ipv6_peer_rsclient_cmd,
6716 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
6717 CLEAR_STR
6718 BGP_STR
6719 "Address family\n"
6720 "BGP neighbor IP address to clear\n"
6721 "BGP IPv6 neighbor to clear\n"
6722 "Soft reconfig for rsclient RIB\n")
6723
6724ALIAS (clear_bgp_peer_rsclient,
6725 clear_bgp_instance_peer_rsclient_cmd,
6726 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6727 CLEAR_STR
6728 BGP_STR
6729 "BGP view\n"
6730 "view name\n"
6731 "BGP neighbor IP address to clear\n"
6732 "BGP IPv6 neighbor to clear\n"
6733 "Soft reconfig for rsclient RIB\n")
6734
6735ALIAS (clear_bgp_peer_rsclient,
6736 clear_bgp_ipv6_instance_peer_rsclient_cmd,
6737 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
6738 CLEAR_STR
6739 BGP_STR
6740 "Address family\n"
6741 "BGP view\n"
6742 "view name\n"
6743 "BGP neighbor IP address to clear\n"
6744 "BGP IPv6 neighbor to clear\n"
6745 "Soft reconfig for rsclient RIB\n")
6746#endif /* HAVE_IPV6 */
6747
6748DEFUN (clear_ip_bgp_peer_rsclient,
6749 clear_ip_bgp_peer_rsclient_cmd,
6750 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
6751 CLEAR_STR
6752 IP_STR
6753 BGP_STR
6754 "BGP neighbor IP address to clear\n"
6755 "BGP IPv6 neighbor to clear\n"
6756 "Soft reconfig for rsclient RIB\n")
6757{
6758 if (argc == 2)
6759 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
6760 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6761
6762 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6763 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6764}
6765
6766ALIAS (clear_ip_bgp_peer_rsclient,
6767 clear_ip_bgp_instance_peer_rsclient_cmd,
6768 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6769 CLEAR_STR
6770 IP_STR
6771 BGP_STR
6772 "BGP view\n"
6773 "view name\n"
6774 "BGP neighbor IP address to clear\n"
6775 "BGP IPv6 neighbor to clear\n"
6776 "Soft reconfig for rsclient RIB\n")
6777
Michael Lamberte0081f72008-11-16 20:12:04 +00006778DEFUN (show_bgp_views,
6779 show_bgp_views_cmd,
6780 "show bgp views",
6781 SHOW_STR
6782 BGP_STR
6783 "Show the defined BGP views\n")
6784{
6785 struct list *inst = bm->bgp;
6786 struct listnode *node;
6787 struct bgp *bgp;
6788
6789 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
6790 {
6791 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
6792 return CMD_WARNING;
6793 }
6794
6795 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
6796 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
6797 vty_out (vty, "\t%s (AS%u)%s",
6798 bgp->name ? bgp->name : "(null)",
6799 bgp->as, VTY_NEWLINE);
6800
6801 return CMD_SUCCESS;
6802}
6803
Paul Jakma4bf6a362006-03-30 14:05:23 +00006804DEFUN (show_bgp_memory,
6805 show_bgp_memory_cmd,
6806 "show bgp memory",
6807 SHOW_STR
6808 BGP_STR
6809 "Global BGP memory statistics\n")
6810{
6811 char memstrbuf[MTYPE_MEMSTR_LEN];
6812 unsigned long count;
6813
6814 /* RIB related usage stats */
6815 count = mtype_stats_alloc (MTYPE_BGP_NODE);
6816 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
6817 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6818 count * sizeof (struct bgp_node)),
6819 VTY_NEWLINE);
6820
6821 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
6822 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
6823 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6824 count * sizeof (struct bgp_info)),
6825 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006826 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
6827 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
6828 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6829 count * sizeof (struct bgp_info_extra)),
6830 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006831
6832 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
6833 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
6834 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6835 count * sizeof (struct bgp_static)),
6836 VTY_NEWLINE);
6837
6838 /* Adj-In/Out */
6839 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
6840 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
6841 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6842 count * sizeof (struct bgp_adj_in)),
6843 VTY_NEWLINE);
6844 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
6845 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
6846 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6847 count * sizeof (struct bgp_adj_out)),
6848 VTY_NEWLINE);
6849
6850 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
6851 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
6852 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6853 count * sizeof (struct bgp_nexthop_cache)),
6854 VTY_NEWLINE);
6855
6856 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
6857 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
6858 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6859 count * sizeof (struct bgp_damp_info)),
6860 VTY_NEWLINE);
6861
6862 /* Attributes */
6863 count = attr_count();
6864 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
6865 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6866 count * sizeof(struct attr)),
6867 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006868 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
6869 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
6870 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6871 count * sizeof(struct attr_extra)),
6872 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006873
6874 if ((count = attr_unknown_count()))
6875 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
6876
6877 /* AS_PATH attributes */
6878 count = aspath_count ();
6879 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
6880 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6881 count * sizeof (struct aspath)),
6882 VTY_NEWLINE);
6883
6884 count = mtype_stats_alloc (MTYPE_AS_SEG);
6885 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
6886 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6887 count * sizeof (struct assegment)),
6888 VTY_NEWLINE);
6889
6890 /* Other attributes */
6891 if ((count = community_count ()))
6892 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6893 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6894 count * sizeof (struct community)),
6895 VTY_NEWLINE);
6896 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
6897 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6898 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6899 count * sizeof (struct ecommunity)),
6900 VTY_NEWLINE);
6901
6902 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
6903 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
6904 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6905 count * sizeof (struct cluster_list)),
6906 VTY_NEWLINE);
6907
6908 /* Peer related usage */
6909 count = mtype_stats_alloc (MTYPE_BGP_PEER);
6910 vty_out (vty, "%ld peers, using %s of memory%s", count,
6911 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6912 count * sizeof (struct peer)),
6913 VTY_NEWLINE);
6914
6915 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
6916 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
6917 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6918 count * sizeof (struct peer_group)),
6919 VTY_NEWLINE);
6920
6921 /* Other */
6922 if ((count = mtype_stats_alloc (MTYPE_HASH)))
6923 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
6924 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6925 count * sizeof (struct hash)),
6926 VTY_NEWLINE);
6927 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
6928 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
6929 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6930 count * sizeof (struct hash_backet)),
6931 VTY_NEWLINE);
6932 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
6933 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
6934 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6935 count * sizeof (regex_t)),
6936 VTY_NEWLINE);
6937 return CMD_SUCCESS;
6938}
paulfee0f4c2004-09-13 05:12:46 +00006939
paul718e3742002-12-13 20:15:29 +00006940/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00006941static int
paul718e3742002-12-13 20:15:29 +00006942bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
6943{
6944 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00006945 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00006946 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00006947 char timebuf[BGP_UPTIME_LEN];
6948 int len;
6949
6950 /* Header string for each address family. */
6951 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00006952
paul1eb8ef22005-04-07 07:30:20 +00006953 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00006954 {
6955 if (peer->afc[afi][safi])
6956 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00006957 if (!count)
6958 {
6959 unsigned long ents;
6960 char memstrbuf[MTYPE_MEMSTR_LEN];
6961
6962 /* Usage summary and header */
6963 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04006964 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00006965 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006966
Paul Jakma4bf6a362006-03-30 14:05:23 +00006967 ents = bgp_table_count (bgp->rib[afi][safi]);
6968 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
6969 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6970 ents * sizeof (struct bgp_node)),
6971 VTY_NEWLINE);
6972
6973 /* Peer related usage */
6974 ents = listcount (bgp->peer);
6975 vty_out (vty, "Peers %ld, using %s of memory%s",
6976 ents,
6977 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6978 ents * sizeof (struct peer)),
6979 VTY_NEWLINE);
6980
6981 if ((ents = listcount (bgp->rsclient)))
6982 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
6983 ents,
6984 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6985 ents * sizeof (struct peer)),
6986 VTY_NEWLINE);
6987
6988 if ((ents = listcount (bgp->group)))
6989 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
6990 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6991 ents * sizeof (struct peer_group)),
6992 VTY_NEWLINE);
6993
6994 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
6995 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
6996 vty_out (vty, "%s", VTY_NEWLINE);
6997 vty_out (vty, "%s%s", header, VTY_NEWLINE);
6998 }
6999
paul718e3742002-12-13 20:15:29 +00007000 count++;
7001
7002 len = vty_out (vty, "%s", peer->host);
7003 len = 16 - len;
7004 if (len < 1)
7005 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7006 else
7007 vty_out (vty, "%*s", len, " ");
7008
hasso3d515fd2005-02-01 21:30:04 +00007009 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00007010
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007011 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00007012 peer->as,
7013 peer->open_in + peer->update_in + peer->keepalive_in
7014 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
7015 peer->open_out + peer->update_out + peer->keepalive_out
7016 + peer->notify_out + peer->refresh_out
7017 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007018 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00007019
7020 vty_out (vty, "%8s",
7021 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7022
7023 if (peer->status == Established)
7024 {
7025 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
7026 }
7027 else
7028 {
7029 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7030 vty_out (vty, " Idle (Admin)");
7031 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7032 vty_out (vty, " Idle (PfxCt)");
7033 else
7034 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7035 }
7036
7037 vty_out (vty, "%s", VTY_NEWLINE);
7038 }
7039 }
7040
7041 if (count)
7042 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7043 count, VTY_NEWLINE);
7044 else
7045 vty_out (vty, "No %s neighbor is configured%s",
7046 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7047 return CMD_SUCCESS;
7048}
7049
paul94f2b392005-06-28 12:44:16 +00007050static int
paulfd79ac92004-10-13 05:06:08 +00007051bgp_show_summary_vty (struct vty *vty, const char *name,
7052 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007053{
7054 struct bgp *bgp;
7055
7056 if (name)
7057 {
7058 bgp = bgp_lookup_by_name (name);
7059
7060 if (! bgp)
7061 {
7062 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7063 return CMD_WARNING;
7064 }
7065
7066 bgp_show_summary (vty, bgp, afi, safi);
7067 return CMD_SUCCESS;
7068 }
7069
7070 bgp = bgp_get_default ();
7071
7072 if (bgp)
7073 bgp_show_summary (vty, bgp, afi, safi);
7074
7075 return CMD_SUCCESS;
7076}
7077
7078/* `show ip bgp summary' commands. */
7079DEFUN (show_ip_bgp_summary,
7080 show_ip_bgp_summary_cmd,
7081 "show ip bgp summary",
7082 SHOW_STR
7083 IP_STR
7084 BGP_STR
7085 "Summary of BGP neighbor status\n")
7086{
7087 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7088}
7089
7090DEFUN (show_ip_bgp_instance_summary,
7091 show_ip_bgp_instance_summary_cmd,
7092 "show ip bgp view WORD summary",
7093 SHOW_STR
7094 IP_STR
7095 BGP_STR
7096 "BGP view\n"
7097 "View name\n"
7098 "Summary of BGP neighbor status\n")
7099{
7100 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7101}
7102
7103DEFUN (show_ip_bgp_ipv4_summary,
7104 show_ip_bgp_ipv4_summary_cmd,
7105 "show ip bgp ipv4 (unicast|multicast) summary",
7106 SHOW_STR
7107 IP_STR
7108 BGP_STR
7109 "Address family\n"
7110 "Address Family modifier\n"
7111 "Address Family modifier\n"
7112 "Summary of BGP neighbor status\n")
7113{
7114 if (strncmp (argv[0], "m", 1) == 0)
7115 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7116
7117 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7118}
7119
Michael Lambert95cbbd22010-07-23 14:43:04 -04007120ALIAS (show_ip_bgp_ipv4_summary,
7121 show_bgp_ipv4_safi_summary_cmd,
7122 "show bgp ipv4 (unicast|multicast) summary",
7123 SHOW_STR
7124 BGP_STR
7125 "Address family\n"
7126 "Address Family modifier\n"
7127 "Address Family modifier\n"
7128 "Summary of BGP neighbor status\n")
7129
paul718e3742002-12-13 20:15:29 +00007130DEFUN (show_ip_bgp_instance_ipv4_summary,
7131 show_ip_bgp_instance_ipv4_summary_cmd,
7132 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7133 SHOW_STR
7134 IP_STR
7135 BGP_STR
7136 "BGP view\n"
7137 "View name\n"
7138 "Address family\n"
7139 "Address Family modifier\n"
7140 "Address Family modifier\n"
7141 "Summary of BGP neighbor status\n")
7142{
7143 if (strncmp (argv[1], "m", 1) == 0)
7144 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7145 else
7146 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7147}
7148
Michael Lambert95cbbd22010-07-23 14:43:04 -04007149ALIAS (show_ip_bgp_instance_ipv4_summary,
7150 show_bgp_instance_ipv4_safi_summary_cmd,
7151 "show bgp view WORD ipv4 (unicast|multicast) summary",
7152 SHOW_STR
7153 BGP_STR
7154 "BGP view\n"
7155 "View name\n"
7156 "Address family\n"
7157 "Address Family modifier\n"
7158 "Address Family modifier\n"
7159 "Summary of BGP neighbor status\n")
7160
paul718e3742002-12-13 20:15:29 +00007161DEFUN (show_ip_bgp_vpnv4_all_summary,
7162 show_ip_bgp_vpnv4_all_summary_cmd,
7163 "show ip bgp vpnv4 all summary",
7164 SHOW_STR
7165 IP_STR
7166 BGP_STR
7167 "Display VPNv4 NLRI specific information\n"
7168 "Display information about all VPNv4 NLRIs\n"
7169 "Summary of BGP neighbor status\n")
7170{
7171 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7172}
7173
7174DEFUN (show_ip_bgp_vpnv4_rd_summary,
7175 show_ip_bgp_vpnv4_rd_summary_cmd,
7176 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7177 SHOW_STR
7178 IP_STR
7179 BGP_STR
7180 "Display VPNv4 NLRI specific information\n"
7181 "Display information for a route distinguisher\n"
7182 "VPN Route Distinguisher\n"
7183 "Summary of BGP neighbor status\n")
7184{
7185 int ret;
7186 struct prefix_rd prd;
7187
7188 ret = str2prefix_rd (argv[0], &prd);
7189 if (! ret)
7190 {
7191 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7192 return CMD_WARNING;
7193 }
7194
7195 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7196}
7197
7198#ifdef HAVE_IPV6
7199DEFUN (show_bgp_summary,
7200 show_bgp_summary_cmd,
7201 "show bgp summary",
7202 SHOW_STR
7203 BGP_STR
7204 "Summary of BGP neighbor status\n")
7205{
7206 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7207}
7208
7209DEFUN (show_bgp_instance_summary,
7210 show_bgp_instance_summary_cmd,
7211 "show bgp view WORD summary",
7212 SHOW_STR
7213 BGP_STR
7214 "BGP view\n"
7215 "View name\n"
7216 "Summary of BGP neighbor status\n")
7217{
7218 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7219}
7220
7221ALIAS (show_bgp_summary,
7222 show_bgp_ipv6_summary_cmd,
7223 "show bgp ipv6 summary",
7224 SHOW_STR
7225 BGP_STR
7226 "Address family\n"
7227 "Summary of BGP neighbor status\n")
7228
7229ALIAS (show_bgp_instance_summary,
7230 show_bgp_instance_ipv6_summary_cmd,
7231 "show bgp view WORD ipv6 summary",
7232 SHOW_STR
7233 BGP_STR
7234 "BGP view\n"
7235 "View name\n"
7236 "Address family\n"
7237 "Summary of BGP neighbor status\n")
7238
Michael Lambert95cbbd22010-07-23 14:43:04 -04007239DEFUN (show_bgp_ipv6_safi_summary,
7240 show_bgp_ipv6_safi_summary_cmd,
7241 "show bgp ipv6 (unicast|multicast) summary",
7242 SHOW_STR
7243 BGP_STR
7244 "Address family\n"
7245 "Address Family modifier\n"
7246 "Address Family modifier\n"
7247 "Summary of BGP neighbor status\n")
7248{
7249 if (strncmp (argv[0], "m", 1) == 0)
7250 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7251
7252 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7253}
7254
7255DEFUN (show_bgp_instance_ipv6_safi_summary,
7256 show_bgp_instance_ipv6_safi_summary_cmd,
7257 "show bgp view WORD ipv6 (unicast|multicast) summary",
7258 SHOW_STR
7259 BGP_STR
7260 "BGP view\n"
7261 "View name\n"
7262 "Address family\n"
7263 "Address Family modifier\n"
7264 "Address Family modifier\n"
7265 "Summary of BGP neighbor status\n")
7266{
7267 if (strncmp (argv[1], "m", 1) == 0)
7268 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7269
7270 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7271}
7272
paul718e3742002-12-13 20:15:29 +00007273/* old command */
7274DEFUN (show_ipv6_bgp_summary,
7275 show_ipv6_bgp_summary_cmd,
7276 "show ipv6 bgp summary",
7277 SHOW_STR
7278 IPV6_STR
7279 BGP_STR
7280 "Summary of BGP neighbor status\n")
7281{
7282 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7283}
7284
7285/* old command */
7286DEFUN (show_ipv6_mbgp_summary,
7287 show_ipv6_mbgp_summary_cmd,
7288 "show ipv6 mbgp summary",
7289 SHOW_STR
7290 IPV6_STR
7291 MBGP_STR
7292 "Summary of BGP neighbor status\n")
7293{
7294 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7295}
7296#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02007297
paulfd79ac92004-10-13 05:06:08 +00007298const char *
hasso538621f2004-05-21 09:31:30 +00007299afi_safi_print (afi_t afi, safi_t safi)
7300{
7301 if (afi == AFI_IP && safi == SAFI_UNICAST)
7302 return "IPv4 Unicast";
7303 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7304 return "IPv4 Multicast";
7305 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
7306 return "VPNv4 Unicast";
7307 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7308 return "IPv6 Unicast";
7309 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7310 return "IPv6 Multicast";
7311 else
7312 return "Unknown";
7313}
7314
paul718e3742002-12-13 20:15:29 +00007315/* Show BGP peer's information. */
7316enum show_type
7317{
7318 show_all,
7319 show_peer
7320};
7321
paul94f2b392005-06-28 12:44:16 +00007322static void
paul718e3742002-12-13 20:15:29 +00007323bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7324 afi_t afi, safi_t safi,
7325 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7326 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7327{
7328 /* Send-Mode */
7329 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7330 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7331 {
7332 vty_out (vty, " Send-mode: ");
7333 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7334 vty_out (vty, "advertised");
7335 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7336 vty_out (vty, "%sreceived",
7337 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7338 ", " : "");
7339 vty_out (vty, "%s", VTY_NEWLINE);
7340 }
7341
7342 /* Receive-Mode */
7343 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7344 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7345 {
7346 vty_out (vty, " Receive-mode: ");
7347 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7348 vty_out (vty, "advertised");
7349 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7350 vty_out (vty, "%sreceived",
7351 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7352 ", " : "");
7353 vty_out (vty, "%s", VTY_NEWLINE);
7354 }
7355}
7356
paul94f2b392005-06-28 12:44:16 +00007357static void
paul718e3742002-12-13 20:15:29 +00007358bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7359{
7360 struct bgp_filter *filter;
7361 char orf_pfx_name[BUFSIZ];
7362 int orf_pfx_count;
7363
7364 filter = &p->filter[afi][safi];
7365
hasso538621f2004-05-21 09:31:30 +00007366 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007367 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007368
paul718e3742002-12-13 20:15:29 +00007369 if (p->af_group[afi][safi])
7370 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7371
7372 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7373 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7374 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7375 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7376 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7377 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7378 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7379
7380 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7381 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7382 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7383 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7384 {
7385 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7386 ORF_TYPE_PREFIX, VTY_NEWLINE);
7387 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7388 PEER_CAP_ORF_PREFIX_SM_ADV,
7389 PEER_CAP_ORF_PREFIX_RM_ADV,
7390 PEER_CAP_ORF_PREFIX_SM_RCV,
7391 PEER_CAP_ORF_PREFIX_RM_RCV);
7392 }
7393 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7394 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7395 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7396 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7397 {
7398 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7399 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7400 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7401 PEER_CAP_ORF_PREFIX_SM_ADV,
7402 PEER_CAP_ORF_PREFIX_RM_ADV,
7403 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7404 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7405 }
7406
7407 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7408 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7409
7410 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7411 || orf_pfx_count)
7412 {
7413 vty_out (vty, " Outbound Route Filter (ORF):");
7414 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7415 vty_out (vty, " sent;");
7416 if (orf_pfx_count)
7417 vty_out (vty, " received (%d entries)", orf_pfx_count);
7418 vty_out (vty, "%s", VTY_NEWLINE);
7419 }
7420 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7421 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7422
7423 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7424 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7425 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7426 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7427 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7428 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7429 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7430 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7431 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7432 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
7433 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
7434 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7435 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
7436 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7437 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
7438 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7439 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7440 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
7441 {
7442 vty_out (vty, " Community attribute sent to this neighbor");
7443 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7444 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007445 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007446 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007447 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007448 else
hasso538621f2004-05-21 09:31:30 +00007449 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007450 }
7451 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
7452 {
7453 vty_out (vty, " Default information originate,");
7454
7455 if (p->default_rmap[afi][safi].name)
7456 vty_out (vty, " default route-map %s%s,",
7457 p->default_rmap[afi][safi].map ? "*" : "",
7458 p->default_rmap[afi][safi].name);
7459 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
7460 vty_out (vty, " default sent%s", VTY_NEWLINE);
7461 else
7462 vty_out (vty, " default not sent%s", VTY_NEWLINE);
7463 }
7464
7465 if (filter->plist[FILTER_IN].name
7466 || filter->dlist[FILTER_IN].name
7467 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00007468 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007469 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
7470 if (filter->plist[FILTER_OUT].name
7471 || filter->dlist[FILTER_OUT].name
7472 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00007473 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00007474 || filter->usmap.name)
7475 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007476 if (filter->map[RMAP_IMPORT].name)
7477 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
7478 if (filter->map[RMAP_EXPORT].name)
7479 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007480
7481 /* prefix-list */
7482 if (filter->plist[FILTER_IN].name)
7483 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
7484 filter->plist[FILTER_IN].plist ? "*" : "",
7485 filter->plist[FILTER_IN].name,
7486 VTY_NEWLINE);
7487 if (filter->plist[FILTER_OUT].name)
7488 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
7489 filter->plist[FILTER_OUT].plist ? "*" : "",
7490 filter->plist[FILTER_OUT].name,
7491 VTY_NEWLINE);
7492
7493 /* distribute-list */
7494 if (filter->dlist[FILTER_IN].name)
7495 vty_out (vty, " Incoming update network filter list is %s%s%s",
7496 filter->dlist[FILTER_IN].alist ? "*" : "",
7497 filter->dlist[FILTER_IN].name,
7498 VTY_NEWLINE);
7499 if (filter->dlist[FILTER_OUT].name)
7500 vty_out (vty, " Outgoing update network filter list is %s%s%s",
7501 filter->dlist[FILTER_OUT].alist ? "*" : "",
7502 filter->dlist[FILTER_OUT].name,
7503 VTY_NEWLINE);
7504
7505 /* filter-list. */
7506 if (filter->aslist[FILTER_IN].name)
7507 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
7508 filter->aslist[FILTER_IN].aslist ? "*" : "",
7509 filter->aslist[FILTER_IN].name,
7510 VTY_NEWLINE);
7511 if (filter->aslist[FILTER_OUT].name)
7512 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
7513 filter->aslist[FILTER_OUT].aslist ? "*" : "",
7514 filter->aslist[FILTER_OUT].name,
7515 VTY_NEWLINE);
7516
7517 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00007518 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007519 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007520 filter->map[RMAP_IN].map ? "*" : "",
7521 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00007522 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007523 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00007524 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007525 filter->map[RMAP_OUT].map ? "*" : "",
7526 filter->map[RMAP_OUT].name,
7527 VTY_NEWLINE);
7528 if (filter->map[RMAP_IMPORT].name)
7529 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
7530 filter->map[RMAP_IMPORT].map ? "*" : "",
7531 filter->map[RMAP_IMPORT].name,
7532 VTY_NEWLINE);
7533 if (filter->map[RMAP_EXPORT].name)
7534 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
7535 filter->map[RMAP_EXPORT].map ? "*" : "",
7536 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00007537 VTY_NEWLINE);
7538
7539 /* unsuppress-map */
7540 if (filter->usmap.name)
7541 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
7542 filter->usmap.map ? "*" : "",
7543 filter->usmap.name, VTY_NEWLINE);
7544
7545 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00007546 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
7547
paul718e3742002-12-13 20:15:29 +00007548 /* Maximum prefix */
7549 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
7550 {
hasso0a486e52005-02-01 20:57:17 +00007551 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00007552 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00007553 ? " (warning-only)" : "", VTY_NEWLINE);
7554 vty_out (vty, " Threshold for warning message %d%%",
7555 p->pmax_threshold[afi][safi]);
7556 if (p->pmax_restart[afi][safi])
7557 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
7558 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007559 }
paul718e3742002-12-13 20:15:29 +00007560
7561 vty_out (vty, "%s", VTY_NEWLINE);
7562}
7563
paul94f2b392005-06-28 12:44:16 +00007564static void
paul718e3742002-12-13 20:15:29 +00007565bgp_show_peer (struct vty *vty, struct peer *p)
7566{
7567 struct bgp *bgp;
7568 char buf1[BUFSIZ];
7569 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00007570 afi_t afi;
7571 safi_t safi;
paul718e3742002-12-13 20:15:29 +00007572
7573 bgp = p->bgp;
7574
7575 /* Configured IP address. */
7576 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007577 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00007578 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00007579 p->change_local_as ? p->change_local_as : p->local_as,
7580 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00007581 " no-prepend" : "",
7582 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
7583 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00007584 vty_out (vty, "%s link%s",
7585 p->as == p->local_as ? "internal" : "external",
7586 VTY_NEWLINE);
7587
7588 /* Description. */
7589 if (p->desc)
7590 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
7591
7592 /* Peer-group */
7593 if (p->group)
7594 vty_out (vty, " Member of peer-group %s for session parameters%s",
7595 p->group->name, VTY_NEWLINE);
7596
7597 /* Administrative shutdown. */
7598 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
7599 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
7600
7601 /* BGP Version. */
7602 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00007603 vty_out (vty, ", remote router ID %s%s",
7604 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
7605 VTY_NEWLINE);
7606
7607 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00007608 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
7609 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00007610 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
7611
7612 /* Status. */
7613 vty_out (vty, " BGP state = %s",
7614 LOOKUP (bgp_status_msg, p->status));
7615 if (p->status == Established)
7616 vty_out (vty, ", up for %8s",
7617 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00007618 else if (p->status == Active)
7619 {
7620 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7621 vty_out (vty, " (passive)");
7622 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7623 vty_out (vty, " (NSF passive)");
7624 }
paul718e3742002-12-13 20:15:29 +00007625 vty_out (vty, "%s", VTY_NEWLINE);
7626
7627 /* read timer */
7628 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7629
7630 /* Configured timer values. */
7631 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7632 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7633 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7634 {
7635 vty_out (vty, " Configured hold time is %d", p->holdtime);
7636 vty_out (vty, ", keepalive interval is %d seconds%s",
7637 p->keepalive, VTY_NEWLINE);
7638 }
hasso93406d82005-02-02 14:40:33 +00007639
paul718e3742002-12-13 20:15:29 +00007640 /* Capability. */
7641 if (p->status == Established)
7642 {
hasso538621f2004-05-21 09:31:30 +00007643 if (p->cap
paul718e3742002-12-13 20:15:29 +00007644 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7645 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7646 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7647 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7648#ifdef HAVE_IPV6
7649 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7650 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7651 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7652 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
7653#endif /* HAVE_IPV6 */
7654 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7655 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7656 {
7657 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7658
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007659 /* AS4 */
7660 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
7661 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7662 {
7663 vty_out (vty, " 4 Byte AS:");
7664 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7665 vty_out (vty, " advertised");
7666 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
7667 vty_out (vty, " %sreceived",
7668 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
7669 vty_out (vty, "%s", VTY_NEWLINE);
7670 }
paul718e3742002-12-13 20:15:29 +00007671 /* Dynamic */
7672 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
7673 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7674 {
7675 vty_out (vty, " Dynamic:");
7676 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7677 vty_out (vty, " advertised");
7678 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00007679 vty_out (vty, " %sreceived",
7680 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007681 vty_out (vty, "%s", VTY_NEWLINE);
7682 }
7683
7684 /* Route Refresh */
7685 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
7686 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7687 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
7688 {
7689 vty_out (vty, " Route refresh:");
7690 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
7691 vty_out (vty, " advertised");
7692 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7693 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00007694 vty_out (vty, " %sreceived(%s)",
7695 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
7696 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
7697 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
7698 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
7699
paul718e3742002-12-13 20:15:29 +00007700 vty_out (vty, "%s", VTY_NEWLINE);
7701 }
7702
hasso538621f2004-05-21 09:31:30 +00007703 /* Multiprotocol Extensions */
7704 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7705 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7706 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00007707 {
hasso538621f2004-05-21 09:31:30 +00007708 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
7709 if (p->afc_adv[afi][safi])
7710 vty_out (vty, " advertised");
7711 if (p->afc_recv[afi][safi])
7712 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
7713 vty_out (vty, "%s", VTY_NEWLINE);
7714 }
7715
7716 /* Gracefull Restart */
7717 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7718 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007719 {
hasso538621f2004-05-21 09:31:30 +00007720 vty_out (vty, " Graceful Restart Capabilty:");
7721 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007722 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00007723 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
7724 vty_out (vty, " %sreceived",
7725 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007726 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007727
7728 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00007729 {
hasso538621f2004-05-21 09:31:30 +00007730 int restart_af_count = 0;
7731
7732 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00007733 p->v_gr_restart, VTY_NEWLINE);
7734 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007735
7736 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7737 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7738 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
7739 {
hasso93406d82005-02-02 14:40:33 +00007740 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
7741 afi_safi_print (afi, safi),
7742 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
7743 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00007744 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00007745 }
hasso538621f2004-05-21 09:31:30 +00007746 if (! restart_af_count)
7747 vty_out (vty, "none");
7748 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007749 }
paul718e3742002-12-13 20:15:29 +00007750 }
paul718e3742002-12-13 20:15:29 +00007751 }
7752 }
7753
hasso93406d82005-02-02 14:40:33 +00007754 /* graceful restart information */
7755 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7756 || p->t_gr_restart
7757 || p->t_gr_stale)
7758 {
7759 int eor_send_af_count = 0;
7760 int eor_receive_af_count = 0;
7761
7762 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
7763 if (p->status == Established)
7764 {
7765 vty_out (vty, " End-of-RIB send: ");
7766 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7767 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7768 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
7769 {
7770 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
7771 afi_safi_print (afi, safi));
7772 eor_send_af_count++;
7773 }
7774 vty_out (vty, "%s", VTY_NEWLINE);
7775
7776 vty_out (vty, " End-of-RIB received: ");
7777 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7778 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7779 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
7780 {
7781 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
7782 afi_safi_print (afi, safi));
7783 eor_receive_af_count++;
7784 }
7785 vty_out (vty, "%s", VTY_NEWLINE);
7786 }
7787
7788 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007789 vty_out (vty, " The remaining time of restart timer is %ld%s",
7790 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
7791
hasso93406d82005-02-02 14:40:33 +00007792 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007793 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
7794 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007795 }
7796
paul718e3742002-12-13 20:15:29 +00007797 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00007798 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
7799 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007800 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007801 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
7802 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
7803 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
7804 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
7805 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
7806 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
7807 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
7808 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
7809 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
7810 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
7811 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007812
7813 /* advertisement-interval */
7814 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
7815 p->v_routeadv, VTY_NEWLINE);
7816
7817 /* Update-source. */
7818 if (p->update_if || p->update_source)
7819 {
7820 vty_out (vty, " Update source is ");
7821 if (p->update_if)
7822 vty_out (vty, "%s", p->update_if);
7823 else if (p->update_source)
7824 vty_out (vty, "%s",
7825 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
7826 vty_out (vty, "%s", VTY_NEWLINE);
7827 }
7828
7829 /* Default weight */
7830 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
7831 vty_out (vty, " Default weight %d%s", p->weight,
7832 VTY_NEWLINE);
7833
7834 vty_out (vty, "%s", VTY_NEWLINE);
7835
7836 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00007837 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7838 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7839 if (p->afc[afi][safi])
7840 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00007841
7842 vty_out (vty, " Connections established %d; dropped %d%s",
7843 p->established, p->dropped,
7844 VTY_NEWLINE);
7845
hassoe0701b72004-05-20 09:19:34 +00007846 if (! p->dropped)
7847 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
7848 else
7849 vty_out (vty, " Last reset %s, due to %s%s",
7850 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
7851 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00007852
paul718e3742002-12-13 20:15:29 +00007853 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7854 {
7855 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00007856
7857 if (p->t_pmax_restart)
7858 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
7859 p->host, thread_timer_remain_second (p->t_pmax_restart),
7860 VTY_NEWLINE);
7861 else
7862 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
7863 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007864 }
7865
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00007866 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00007867 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00007868 {
7869 if (p->gtsm_hops > 0)
7870 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7871 p->gtsm_hops, VTY_NEWLINE);
7872 else if (p->ttl > 1)
7873 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7874 p->ttl, VTY_NEWLINE);
7875 }
Pradosh Mohapatra5d804b42013-09-12 03:37:07 +00007876 else
7877 {
7878 if (p->gtsm_hops > 0)
7879 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
7880 p->gtsm_hops, VTY_NEWLINE);
7881 }
paul718e3742002-12-13 20:15:29 +00007882
7883 /* Local address. */
7884 if (p->su_local)
7885 {
hasso93406d82005-02-02 14:40:33 +00007886 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00007887 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
7888 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00007889 VTY_NEWLINE);
7890 }
7891
7892 /* Remote address. */
7893 if (p->su_remote)
7894 {
7895 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
7896 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
7897 ntohs (p->su_remote->sin.sin_port),
7898 VTY_NEWLINE);
7899 }
7900
7901 /* Nexthop display. */
7902 if (p->su_local)
7903 {
7904 vty_out (vty, "Nexthop: %s%s",
7905 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
7906 VTY_NEWLINE);
7907#ifdef HAVE_IPV6
7908 vty_out (vty, "Nexthop global: %s%s",
7909 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
7910 VTY_NEWLINE);
7911 vty_out (vty, "Nexthop local: %s%s",
7912 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
7913 VTY_NEWLINE);
7914 vty_out (vty, "BGP connection: %s%s",
7915 p->shared_network ? "shared network" : "non shared network",
7916 VTY_NEWLINE);
7917#endif /* HAVE_IPV6 */
7918 }
7919
7920 /* Timer information. */
7921 if (p->t_start)
7922 vty_out (vty, "Next start timer due in %ld seconds%s",
7923 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
7924 if (p->t_connect)
7925 vty_out (vty, "Next connect timer due in %ld seconds%s",
7926 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
7927
7928 vty_out (vty, "Read thread: %s Write thread: %s%s",
7929 p->t_read ? "on" : "off",
7930 p->t_write ? "on" : "off",
7931 VTY_NEWLINE);
7932
7933 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
7934 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
7935 bgp_capability_vty_out (vty, p);
7936
7937 vty_out (vty, "%s", VTY_NEWLINE);
7938}
7939
paul94f2b392005-06-28 12:44:16 +00007940static int
paul718e3742002-12-13 20:15:29 +00007941bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
7942 enum show_type type, union sockunion *su)
7943{
paul1eb8ef22005-04-07 07:30:20 +00007944 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00007945 struct peer *peer;
7946 int find = 0;
7947
paul1eb8ef22005-04-07 07:30:20 +00007948 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007949 {
7950 switch (type)
7951 {
7952 case show_all:
7953 bgp_show_peer (vty, peer);
7954 break;
7955 case show_peer:
7956 if (sockunion_same (&peer->su, su))
7957 {
7958 find = 1;
7959 bgp_show_peer (vty, peer);
7960 }
7961 break;
7962 }
7963 }
7964
7965 if (type == show_peer && ! find)
7966 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
7967
7968 return CMD_SUCCESS;
7969}
7970
paul94f2b392005-06-28 12:44:16 +00007971static int
paulfd79ac92004-10-13 05:06:08 +00007972bgp_show_neighbor_vty (struct vty *vty, const char *name,
7973 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00007974{
7975 int ret;
7976 struct bgp *bgp;
7977 union sockunion su;
7978
7979 if (ip_str)
7980 {
7981 ret = str2sockunion (ip_str, &su);
7982 if (ret < 0)
7983 {
7984 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
7985 return CMD_WARNING;
7986 }
7987 }
7988
7989 if (name)
7990 {
7991 bgp = bgp_lookup_by_name (name);
7992
7993 if (! bgp)
7994 {
7995 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7996 return CMD_WARNING;
7997 }
7998
7999 bgp_show_neighbor (vty, bgp, type, &su);
8000
8001 return CMD_SUCCESS;
8002 }
8003
8004 bgp = bgp_get_default ();
8005
8006 if (bgp)
8007 bgp_show_neighbor (vty, bgp, type, &su);
8008
8009 return CMD_SUCCESS;
8010}
8011
8012/* "show ip bgp neighbors" commands. */
8013DEFUN (show_ip_bgp_neighbors,
8014 show_ip_bgp_neighbors_cmd,
8015 "show ip bgp neighbors",
8016 SHOW_STR
8017 IP_STR
8018 BGP_STR
8019 "Detailed information on TCP and BGP neighbor connections\n")
8020{
8021 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8022}
8023
8024ALIAS (show_ip_bgp_neighbors,
8025 show_ip_bgp_ipv4_neighbors_cmd,
8026 "show ip bgp ipv4 (unicast|multicast) neighbors",
8027 SHOW_STR
8028 IP_STR
8029 BGP_STR
8030 "Address family\n"
8031 "Address Family modifier\n"
8032 "Address Family modifier\n"
8033 "Detailed information on TCP and BGP neighbor connections\n")
8034
8035ALIAS (show_ip_bgp_neighbors,
8036 show_ip_bgp_vpnv4_all_neighbors_cmd,
8037 "show ip bgp vpnv4 all neighbors",
8038 SHOW_STR
8039 IP_STR
8040 BGP_STR
8041 "Display VPNv4 NLRI specific information\n"
8042 "Display information about all VPNv4 NLRIs\n"
8043 "Detailed information on TCP and BGP neighbor connections\n")
8044
8045ALIAS (show_ip_bgp_neighbors,
8046 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8047 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8048 SHOW_STR
8049 IP_STR
8050 BGP_STR
8051 "Display VPNv4 NLRI specific information\n"
8052 "Display information for a route distinguisher\n"
8053 "VPN Route Distinguisher\n"
8054 "Detailed information on TCP and BGP neighbor connections\n")
8055
8056ALIAS (show_ip_bgp_neighbors,
8057 show_bgp_neighbors_cmd,
8058 "show bgp neighbors",
8059 SHOW_STR
8060 BGP_STR
8061 "Detailed information on TCP and BGP neighbor connections\n")
8062
8063ALIAS (show_ip_bgp_neighbors,
8064 show_bgp_ipv6_neighbors_cmd,
8065 "show bgp ipv6 neighbors",
8066 SHOW_STR
8067 BGP_STR
8068 "Address family\n"
8069 "Detailed information on TCP and BGP neighbor connections\n")
8070
8071DEFUN (show_ip_bgp_neighbors_peer,
8072 show_ip_bgp_neighbors_peer_cmd,
8073 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8074 SHOW_STR
8075 IP_STR
8076 BGP_STR
8077 "Detailed information on TCP and BGP neighbor connections\n"
8078 "Neighbor to display information about\n"
8079 "Neighbor to display information about\n")
8080{
8081 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8082}
8083
8084ALIAS (show_ip_bgp_neighbors_peer,
8085 show_ip_bgp_ipv4_neighbors_peer_cmd,
8086 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8087 SHOW_STR
8088 IP_STR
8089 BGP_STR
8090 "Address family\n"
8091 "Address Family modifier\n"
8092 "Address Family modifier\n"
8093 "Detailed information on TCP and BGP neighbor connections\n"
8094 "Neighbor to display information about\n"
8095 "Neighbor to display information about\n")
8096
8097ALIAS (show_ip_bgp_neighbors_peer,
8098 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8099 "show ip bgp vpnv4 all neighbors A.B.C.D",
8100 SHOW_STR
8101 IP_STR
8102 BGP_STR
8103 "Display VPNv4 NLRI specific information\n"
8104 "Display information about all VPNv4 NLRIs\n"
8105 "Detailed information on TCP and BGP neighbor connections\n"
8106 "Neighbor to display information about\n")
8107
8108ALIAS (show_ip_bgp_neighbors_peer,
8109 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8110 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8111 SHOW_STR
8112 IP_STR
8113 BGP_STR
8114 "Display VPNv4 NLRI specific information\n"
8115 "Display information about all VPNv4 NLRIs\n"
8116 "Detailed information on TCP and BGP neighbor connections\n"
8117 "Neighbor to display information about\n")
8118
8119ALIAS (show_ip_bgp_neighbors_peer,
8120 show_bgp_neighbors_peer_cmd,
8121 "show bgp neighbors (A.B.C.D|X:X::X:X)",
8122 SHOW_STR
8123 BGP_STR
8124 "Detailed information on TCP and BGP neighbor connections\n"
8125 "Neighbor to display information about\n"
8126 "Neighbor to display information about\n")
8127
8128ALIAS (show_ip_bgp_neighbors_peer,
8129 show_bgp_ipv6_neighbors_peer_cmd,
8130 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8131 SHOW_STR
8132 BGP_STR
8133 "Address family\n"
8134 "Detailed information on TCP and BGP neighbor connections\n"
8135 "Neighbor to display information about\n"
8136 "Neighbor to display information about\n")
8137
8138DEFUN (show_ip_bgp_instance_neighbors,
8139 show_ip_bgp_instance_neighbors_cmd,
8140 "show ip bgp view WORD neighbors",
8141 SHOW_STR
8142 IP_STR
8143 BGP_STR
8144 "BGP view\n"
8145 "View name\n"
8146 "Detailed information on TCP and BGP neighbor connections\n")
8147{
8148 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8149}
8150
paulbb46e942003-10-24 19:02:03 +00008151ALIAS (show_ip_bgp_instance_neighbors,
8152 show_bgp_instance_neighbors_cmd,
8153 "show bgp view WORD neighbors",
8154 SHOW_STR
8155 BGP_STR
8156 "BGP view\n"
8157 "View name\n"
8158 "Detailed information on TCP and BGP neighbor connections\n")
8159
8160ALIAS (show_ip_bgp_instance_neighbors,
8161 show_bgp_instance_ipv6_neighbors_cmd,
8162 "show bgp view WORD ipv6 neighbors",
8163 SHOW_STR
8164 BGP_STR
8165 "BGP view\n"
8166 "View name\n"
8167 "Address family\n"
8168 "Detailed information on TCP and BGP neighbor connections\n")
8169
paul718e3742002-12-13 20:15:29 +00008170DEFUN (show_ip_bgp_instance_neighbors_peer,
8171 show_ip_bgp_instance_neighbors_peer_cmd,
8172 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8173 SHOW_STR
8174 IP_STR
8175 BGP_STR
8176 "BGP view\n"
8177 "View name\n"
8178 "Detailed information on TCP and BGP neighbor connections\n"
8179 "Neighbor to display information about\n"
8180 "Neighbor to display information about\n")
8181{
8182 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8183}
paulbb46e942003-10-24 19:02:03 +00008184
8185ALIAS (show_ip_bgp_instance_neighbors_peer,
8186 show_bgp_instance_neighbors_peer_cmd,
8187 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8188 SHOW_STR
8189 BGP_STR
8190 "BGP view\n"
8191 "View name\n"
8192 "Detailed information on TCP and BGP neighbor connections\n"
8193 "Neighbor to display information about\n"
8194 "Neighbor to display information about\n")
8195
8196ALIAS (show_ip_bgp_instance_neighbors_peer,
8197 show_bgp_instance_ipv6_neighbors_peer_cmd,
8198 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8199 SHOW_STR
8200 BGP_STR
8201 "BGP view\n"
8202 "View name\n"
8203 "Address family\n"
8204 "Detailed information on TCP and BGP neighbor connections\n"
8205 "Neighbor to display information about\n"
8206 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008207
paul718e3742002-12-13 20:15:29 +00008208/* Show BGP's AS paths internal data. There are both `show ip bgp
8209 paths' and `show ip mbgp paths'. Those functions results are the
8210 same.*/
8211DEFUN (show_ip_bgp_paths,
8212 show_ip_bgp_paths_cmd,
8213 "show ip bgp paths",
8214 SHOW_STR
8215 IP_STR
8216 BGP_STR
8217 "Path information\n")
8218{
8219 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8220 aspath_print_all_vty (vty);
8221 return CMD_SUCCESS;
8222}
8223
8224DEFUN (show_ip_bgp_ipv4_paths,
8225 show_ip_bgp_ipv4_paths_cmd,
8226 "show ip bgp ipv4 (unicast|multicast) paths",
8227 SHOW_STR
8228 IP_STR
8229 BGP_STR
8230 "Address family\n"
8231 "Address Family modifier\n"
8232 "Address Family modifier\n"
8233 "Path information\n")
8234{
8235 vty_out (vty, "Address Refcnt Path\r\n");
8236 aspath_print_all_vty (vty);
8237
8238 return CMD_SUCCESS;
8239}
David Lamparter6b0655a2014-06-04 06:53:35 +02008240
paul718e3742002-12-13 20:15:29 +00008241#include "hash.h"
8242
paul94f2b392005-06-28 12:44:16 +00008243static void
paul718e3742002-12-13 20:15:29 +00008244community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8245{
8246 struct community *com;
8247
8248 com = (struct community *) backet->data;
8249 vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt,
8250 community_str (com), VTY_NEWLINE);
8251}
8252
8253/* Show BGP's community internal data. */
8254DEFUN (show_ip_bgp_community_info,
8255 show_ip_bgp_community_info_cmd,
8256 "show ip bgp community-info",
8257 SHOW_STR
8258 IP_STR
8259 BGP_STR
8260 "List all bgp community information\n")
8261{
8262 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8263
8264 hash_iterate (community_hash (),
8265 (void (*) (struct hash_backet *, void *))
8266 community_show_all_iterator,
8267 vty);
8268
8269 return CMD_SUCCESS;
8270}
8271
8272DEFUN (show_ip_bgp_attr_info,
8273 show_ip_bgp_attr_info_cmd,
8274 "show ip bgp attribute-info",
8275 SHOW_STR
8276 IP_STR
8277 BGP_STR
8278 "List all bgp attribute information\n")
8279{
8280 attr_show_all (vty);
8281 return CMD_SUCCESS;
8282}
David Lamparter6b0655a2014-06-04 06:53:35 +02008283
paul94f2b392005-06-28 12:44:16 +00008284static int
paulfee0f4c2004-09-13 05:12:46 +00008285bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8286 afi_t afi, safi_t safi)
8287{
8288 char timebuf[BGP_UPTIME_LEN];
8289 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008290 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008291 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008292 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008293 int len;
8294 int count = 0;
8295
8296 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8297 {
paul1eb8ef22005-04-07 07:30:20 +00008298 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008299 {
8300 count++;
8301 bgp_write_rsclient_summary (vty, peer, afi, safi);
8302 }
8303 return count;
8304 }
8305
8306 len = vty_out (vty, "%s", rsclient->host);
8307 len = 16 - len;
8308
8309 if (len < 1)
8310 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8311 else
8312 vty_out (vty, "%*s", len, " ");
8313
hasso3d515fd2005-02-01 21:30:04 +00008314 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008315
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008316 vty_out (vty, "%11d ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008317
8318 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8319 if ( rmname && strlen (rmname) > 13 )
8320 {
8321 sprintf (rmbuf, "%13s", "...");
8322 rmname = strncpy (rmbuf, rmname, 10);
8323 }
8324 else if (! rmname)
8325 rmname = "<none>";
8326 vty_out (vty, " %13s ", rmname);
8327
8328 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8329 if ( rmname && strlen (rmname) > 13 )
8330 {
8331 sprintf (rmbuf, "%13s", "...");
8332 rmname = strncpy (rmbuf, rmname, 10);
8333 }
8334 else if (! rmname)
8335 rmname = "<none>";
8336 vty_out (vty, " %13s ", rmname);
8337
8338 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8339
8340 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8341 vty_out (vty, " Idle (Admin)");
8342 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8343 vty_out (vty, " Idle (PfxCt)");
8344 else
8345 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8346
8347 vty_out (vty, "%s", VTY_NEWLINE);
8348
8349 return 1;
8350}
8351
paul94f2b392005-06-28 12:44:16 +00008352static int
paulfd79ac92004-10-13 05:06:08 +00008353bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8354 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008355{
8356 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008357 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008358 int count = 0;
8359
8360 /* Header string for each address family. */
8361 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
8362
paul1eb8ef22005-04-07 07:30:20 +00008363 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008364 {
8365 if (peer->afc[afi][safi] &&
8366 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8367 {
8368 if (! count)
8369 {
8370 vty_out (vty,
8371 "Route Server's BGP router identifier %s%s",
8372 inet_ntoa (bgp->router_id), VTY_NEWLINE);
8373 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008374 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00008375 VTY_NEWLINE);
8376
8377 vty_out (vty, "%s", VTY_NEWLINE);
8378 vty_out (vty, "%s%s", header, VTY_NEWLINE);
8379 }
8380
8381 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
8382 }
8383 }
8384
8385 if (count)
8386 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
8387 count, VTY_NEWLINE);
8388 else
8389 vty_out (vty, "No %s Route Server Client is configured%s",
8390 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
8391
8392 return CMD_SUCCESS;
8393}
8394
paul94f2b392005-06-28 12:44:16 +00008395static int
paulfd79ac92004-10-13 05:06:08 +00008396bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
8397 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008398{
8399 struct bgp *bgp;
8400
8401 if (name)
8402 {
8403 bgp = bgp_lookup_by_name (name);
8404
8405 if (! bgp)
8406 {
8407 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8408 return CMD_WARNING;
8409 }
8410
8411 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8412 return CMD_SUCCESS;
8413 }
8414
8415 bgp = bgp_get_default ();
8416
8417 if (bgp)
8418 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8419
8420 return CMD_SUCCESS;
8421}
8422
8423/* 'show bgp rsclient' commands. */
8424DEFUN (show_ip_bgp_rsclient_summary,
8425 show_ip_bgp_rsclient_summary_cmd,
8426 "show ip bgp rsclient summary",
8427 SHOW_STR
8428 IP_STR
8429 BGP_STR
8430 "Information about Route Server Clients\n"
8431 "Summary of all Route Server Clients\n")
8432{
8433 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8434}
8435
8436DEFUN (show_ip_bgp_instance_rsclient_summary,
8437 show_ip_bgp_instance_rsclient_summary_cmd,
8438 "show ip bgp view WORD rsclient summary",
8439 SHOW_STR
8440 IP_STR
8441 BGP_STR
8442 "BGP view\n"
8443 "View name\n"
8444 "Information about Route Server Clients\n"
8445 "Summary of all Route Server Clients\n")
8446{
8447 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8448}
8449
8450DEFUN (show_ip_bgp_ipv4_rsclient_summary,
8451 show_ip_bgp_ipv4_rsclient_summary_cmd,
8452 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
8453 SHOW_STR
8454 IP_STR
8455 BGP_STR
8456 "Address family\n"
8457 "Address Family modifier\n"
8458 "Address Family modifier\n"
8459 "Information about Route Server Clients\n"
8460 "Summary of all Route Server Clients\n")
8461{
8462 if (strncmp (argv[0], "m", 1) == 0)
8463 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
8464
8465 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8466}
8467
8468DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
8469 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
8470 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8471 SHOW_STR
8472 IP_STR
8473 BGP_STR
8474 "BGP view\n"
8475 "View name\n"
8476 "Address family\n"
8477 "Address Family modifier\n"
8478 "Address Family modifier\n"
8479 "Information about Route Server Clients\n"
8480 "Summary of all Route Server Clients\n")
8481{
8482 if (strncmp (argv[1], "m", 1) == 0)
8483 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
8484
8485 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8486}
8487
Michael Lambert95cbbd22010-07-23 14:43:04 -04008488DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
8489 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
8490 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8491 SHOW_STR
8492 BGP_STR
8493 "BGP view\n"
8494 "View name\n"
8495 "Address family\n"
8496 "Address Family modifier\n"
8497 "Address Family modifier\n"
8498 "Information about Route Server Clients\n"
8499 "Summary of all Route Server Clients\n")
8500{
8501 safi_t safi;
8502
8503 if (argc == 2) {
8504 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8505 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
8506 } else {
8507 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8508 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
8509 }
8510}
8511
8512ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
8513 show_bgp_ipv4_safi_rsclient_summary_cmd,
8514 "show bgp ipv4 (unicast|multicast) rsclient summary",
8515 SHOW_STR
8516 BGP_STR
8517 "Address family\n"
8518 "Address Family modifier\n"
8519 "Address Family modifier\n"
8520 "Information about Route Server Clients\n"
8521 "Summary of all Route Server Clients\n")
8522
paulfee0f4c2004-09-13 05:12:46 +00008523#ifdef HAVE_IPV6
8524DEFUN (show_bgp_rsclient_summary,
8525 show_bgp_rsclient_summary_cmd,
8526 "show bgp rsclient summary",
8527 SHOW_STR
8528 BGP_STR
8529 "Information about Route Server Clients\n"
8530 "Summary of all Route Server Clients\n")
8531{
8532 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8533}
8534
8535DEFUN (show_bgp_instance_rsclient_summary,
8536 show_bgp_instance_rsclient_summary_cmd,
8537 "show bgp view WORD rsclient summary",
8538 SHOW_STR
8539 BGP_STR
8540 "BGP view\n"
8541 "View name\n"
8542 "Information about Route Server Clients\n"
8543 "Summary of all Route Server Clients\n")
8544{
8545 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
8546}
8547
8548ALIAS (show_bgp_rsclient_summary,
8549 show_bgp_ipv6_rsclient_summary_cmd,
8550 "show bgp ipv6 rsclient summary",
8551 SHOW_STR
8552 BGP_STR
8553 "Address family\n"
8554 "Information about Route Server Clients\n"
8555 "Summary of all Route Server Clients\n")
8556
8557ALIAS (show_bgp_instance_rsclient_summary,
8558 show_bgp_instance_ipv6_rsclient_summary_cmd,
8559 "show bgp view WORD ipv6 rsclient summary",
8560 SHOW_STR
8561 BGP_STR
8562 "BGP view\n"
8563 "View name\n"
8564 "Address family\n"
8565 "Information about Route Server Clients\n"
8566 "Summary of all Route Server Clients\n")
Michael Lambert95cbbd22010-07-23 14:43:04 -04008567
8568DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
8569 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
8570 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
8571 SHOW_STR
8572 BGP_STR
8573 "BGP view\n"
8574 "View name\n"
8575 "Address family\n"
8576 "Address Family modifier\n"
8577 "Address Family modifier\n"
8578 "Information about Route Server Clients\n"
8579 "Summary of all Route Server Clients\n")
8580{
8581 safi_t safi;
8582
8583 if (argc == 2) {
8584 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8585 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
8586 } else {
8587 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8588 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
8589 }
8590}
8591
8592ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
8593 show_bgp_ipv6_safi_rsclient_summary_cmd,
8594 "show bgp ipv6 (unicast|multicast) rsclient summary",
8595 SHOW_STR
8596 BGP_STR
8597 "Address family\n"
8598 "Address Family modifier\n"
8599 "Address Family modifier\n"
8600 "Information about Route Server Clients\n"
8601 "Summary of all Route Server Clients\n")
8602
paulfee0f4c2004-09-13 05:12:46 +00008603#endif /* HAVE IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02008604
paul718e3742002-12-13 20:15:29 +00008605/* Redistribute VTY commands. */
8606
paul718e3742002-12-13 20:15:29 +00008607DEFUN (bgp_redistribute_ipv4,
8608 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008609 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008610 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008611 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008612{
8613 int type;
8614
David Lampartere0ca5fd2009-09-16 01:52:42 +02008615 type = proto_redistnum (AFI_IP, argv[0]);
8616 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008617 {
8618 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8619 return CMD_WARNING;
8620 }
8621 return bgp_redistribute_set (vty->index, AFI_IP, type);
8622}
8623
8624DEFUN (bgp_redistribute_ipv4_rmap,
8625 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008626 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008627 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008628 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008629 "Route map reference\n"
8630 "Pointer to route-map entries\n")
8631{
8632 int type;
8633
David Lampartere0ca5fd2009-09-16 01:52:42 +02008634 type = proto_redistnum (AFI_IP, argv[0]);
8635 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008636 {
8637 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8638 return CMD_WARNING;
8639 }
8640
8641 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8642 return bgp_redistribute_set (vty->index, AFI_IP, type);
8643}
8644
8645DEFUN (bgp_redistribute_ipv4_metric,
8646 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008647 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008648 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008649 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008650 "Metric for redistributed routes\n"
8651 "Default metric\n")
8652{
8653 int type;
8654 u_int32_t metric;
8655
David Lampartere0ca5fd2009-09-16 01:52:42 +02008656 type = proto_redistnum (AFI_IP, argv[0]);
8657 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008658 {
8659 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8660 return CMD_WARNING;
8661 }
8662 VTY_GET_INTEGER ("metric", metric, argv[1]);
8663
8664 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8665 return bgp_redistribute_set (vty->index, AFI_IP, type);
8666}
8667
8668DEFUN (bgp_redistribute_ipv4_rmap_metric,
8669 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008670 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008671 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008672 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008673 "Route map reference\n"
8674 "Pointer to route-map entries\n"
8675 "Metric for redistributed routes\n"
8676 "Default metric\n")
8677{
8678 int type;
8679 u_int32_t metric;
8680
David Lampartere0ca5fd2009-09-16 01:52:42 +02008681 type = proto_redistnum (AFI_IP, argv[0]);
8682 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008683 {
8684 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8685 return CMD_WARNING;
8686 }
8687 VTY_GET_INTEGER ("metric", metric, argv[2]);
8688
8689 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8690 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8691 return bgp_redistribute_set (vty->index, AFI_IP, type);
8692}
8693
8694DEFUN (bgp_redistribute_ipv4_metric_rmap,
8695 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008696 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008697 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008698 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008699 "Metric for redistributed routes\n"
8700 "Default metric\n"
8701 "Route map reference\n"
8702 "Pointer to route-map entries\n")
8703{
8704 int type;
8705 u_int32_t metric;
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 VTY_GET_INTEGER ("metric", metric, argv[1]);
8714
8715 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8716 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
8717 return bgp_redistribute_set (vty->index, AFI_IP, type);
8718}
8719
8720DEFUN (no_bgp_redistribute_ipv4,
8721 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008722 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008723 NO_STR
8724 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008725 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008726{
8727 int type;
8728
David Lampartere0ca5fd2009-09-16 01:52:42 +02008729 type = proto_redistnum (AFI_IP, argv[0]);
8730 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008731 {
8732 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8733 return CMD_WARNING;
8734 }
8735
8736 return bgp_redistribute_unset (vty->index, AFI_IP, type);
8737}
8738
8739DEFUN (no_bgp_redistribute_ipv4_rmap,
8740 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008741 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008742 NO_STR
8743 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008744 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008745 "Route map reference\n"
8746 "Pointer to route-map entries\n")
8747{
8748 int type;
8749
David Lampartere0ca5fd2009-09-16 01:52:42 +02008750 type = proto_redistnum (AFI_IP, argv[0]);
8751 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008752 {
8753 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8754 return CMD_WARNING;
8755 }
8756
8757 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8758 return CMD_SUCCESS;
8759}
8760
8761DEFUN (no_bgp_redistribute_ipv4_metric,
8762 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008763 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008764 NO_STR
8765 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008766 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008767 "Metric for redistributed routes\n"
8768 "Default metric\n")
8769{
8770 int type;
8771
David Lampartere0ca5fd2009-09-16 01:52:42 +02008772 type = proto_redistnum (AFI_IP, argv[0]);
8773 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008774 {
8775 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8776 return CMD_WARNING;
8777 }
8778
8779 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8780 return CMD_SUCCESS;
8781}
8782
8783DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
8784 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008785 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008786 NO_STR
8787 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008788 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008789 "Route map reference\n"
8790 "Pointer to route-map entries\n"
8791 "Metric for redistributed routes\n"
8792 "Default metric\n")
8793{
8794 int type;
8795
David Lampartere0ca5fd2009-09-16 01:52:42 +02008796 type = proto_redistnum (AFI_IP, argv[0]);
8797 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008798 {
8799 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8800 return CMD_WARNING;
8801 }
8802
8803 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8804 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8805 return CMD_SUCCESS;
8806}
8807
8808ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
8809 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008810 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008811 NO_STR
8812 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008813 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008814 "Metric for redistributed routes\n"
8815 "Default metric\n"
8816 "Route map reference\n"
8817 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008818
paul718e3742002-12-13 20:15:29 +00008819#ifdef HAVE_IPV6
8820DEFUN (bgp_redistribute_ipv6,
8821 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008822 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008823 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008824 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008825{
8826 int type;
8827
David Lampartere0ca5fd2009-09-16 01:52:42 +02008828 type = proto_redistnum (AFI_IP6, argv[0]);
8829 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008830 {
8831 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8832 return CMD_WARNING;
8833 }
8834
8835 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8836}
8837
8838DEFUN (bgp_redistribute_ipv6_rmap,
8839 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008840 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008841 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008842 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008843 "Route map reference\n"
8844 "Pointer to route-map entries\n")
8845{
8846 int type;
8847
David Lampartere0ca5fd2009-09-16 01:52:42 +02008848 type = proto_redistnum (AFI_IP6, argv[0]);
8849 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008850 {
8851 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8852 return CMD_WARNING;
8853 }
8854
8855 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8856 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8857}
8858
8859DEFUN (bgp_redistribute_ipv6_metric,
8860 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008861 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008862 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008863 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008864 "Metric for redistributed routes\n"
8865 "Default metric\n")
8866{
8867 int type;
8868 u_int32_t metric;
8869
David Lampartere0ca5fd2009-09-16 01:52:42 +02008870 type = proto_redistnum (AFI_IP6, argv[0]);
8871 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008872 {
8873 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8874 return CMD_WARNING;
8875 }
8876 VTY_GET_INTEGER ("metric", metric, argv[1]);
8877
8878 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8879 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8880}
8881
8882DEFUN (bgp_redistribute_ipv6_rmap_metric,
8883 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008884 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008885 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008886 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008887 "Route map reference\n"
8888 "Pointer to route-map entries\n"
8889 "Metric for redistributed routes\n"
8890 "Default metric\n")
8891{
8892 int type;
8893 u_int32_t metric;
8894
David Lampartere0ca5fd2009-09-16 01:52:42 +02008895 type = proto_redistnum (AFI_IP6, argv[0]);
8896 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008897 {
8898 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8899 return CMD_WARNING;
8900 }
8901 VTY_GET_INTEGER ("metric", metric, argv[2]);
8902
8903 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8904 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8905 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8906}
8907
8908DEFUN (bgp_redistribute_ipv6_metric_rmap,
8909 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008910 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008911 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008912 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008913 "Metric for redistributed routes\n"
8914 "Default metric\n"
8915 "Route map reference\n"
8916 "Pointer to route-map entries\n")
8917{
8918 int type;
8919 u_int32_t metric;
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 VTY_GET_INTEGER ("metric", metric, argv[1]);
8928
8929 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8930 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
8931 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8932}
8933
8934DEFUN (no_bgp_redistribute_ipv6,
8935 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008936 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008937 NO_STR
8938 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008939 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008940{
8941 int type;
8942
David Lampartere0ca5fd2009-09-16 01:52:42 +02008943 type = proto_redistnum (AFI_IP6, argv[0]);
8944 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008945 {
8946 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8947 return CMD_WARNING;
8948 }
8949
8950 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
8951}
8952
8953DEFUN (no_bgp_redistribute_ipv6_rmap,
8954 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008955 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008956 NO_STR
8957 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008958 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008959 "Route map reference\n"
8960 "Pointer to route-map entries\n")
8961{
8962 int type;
8963
David Lampartere0ca5fd2009-09-16 01:52:42 +02008964 type = proto_redistnum (AFI_IP6, argv[0]);
8965 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008966 {
8967 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8968 return CMD_WARNING;
8969 }
8970
8971 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8972 return CMD_SUCCESS;
8973}
8974
8975DEFUN (no_bgp_redistribute_ipv6_metric,
8976 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008977 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008978 NO_STR
8979 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008980 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008981 "Metric for redistributed routes\n"
8982 "Default metric\n")
8983{
8984 int type;
8985
David Lampartere0ca5fd2009-09-16 01:52:42 +02008986 type = proto_redistnum (AFI_IP6, argv[0]);
8987 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008988 {
8989 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8990 return CMD_WARNING;
8991 }
8992
8993 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8994 return CMD_SUCCESS;
8995}
8996
8997DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
8998 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008999 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009000 NO_STR
9001 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009002 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009003 "Route map reference\n"
9004 "Pointer to route-map entries\n"
9005 "Metric for redistributed routes\n"
9006 "Default metric\n")
9007{
9008 int type;
9009
David Lampartere0ca5fd2009-09-16 01:52:42 +02009010 type = proto_redistnum (AFI_IP6, argv[0]);
9011 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009012 {
9013 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9014 return CMD_WARNING;
9015 }
9016
9017 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9018 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9019 return CMD_SUCCESS;
9020}
9021
9022ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9023 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009024 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009025 NO_STR
9026 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009027 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009028 "Metric for redistributed routes\n"
9029 "Default metric\n"
9030 "Route map reference\n"
9031 "Pointer to route-map entries\n")
9032#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02009033
paul718e3742002-12-13 20:15:29 +00009034int
9035bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9036 safi_t safi, int *write)
9037{
9038 int i;
paul718e3742002-12-13 20:15:29 +00009039
9040 /* Unicast redistribution only. */
9041 if (safi != SAFI_UNICAST)
9042 return 0;
9043
9044 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9045 {
9046 /* Redistribute BGP does not make sense. */
9047 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9048 {
9049 /* Display "address-family" when it is not yet diplayed. */
9050 bgp_config_write_family_header (vty, afi, safi, write);
9051
9052 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009053 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009054
9055 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009056 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009057
9058 if (bgp->rmap[afi][i].name)
9059 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9060
9061 vty_out (vty, "%s", VTY_NEWLINE);
9062 }
9063 }
9064 return *write;
9065}
David Lamparter6b0655a2014-06-04 06:53:35 +02009066
paul718e3742002-12-13 20:15:29 +00009067/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009068static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009069{
9070 BGP_NODE,
9071 "%s(config-router)# ",
9072 1,
9073};
9074
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009075static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009076{
9077 BGP_IPV4_NODE,
9078 "%s(config-router-af)# ",
9079 1,
9080};
9081
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009082static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009083{
9084 BGP_IPV4M_NODE,
9085 "%s(config-router-af)# ",
9086 1,
9087};
9088
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009089static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009090{
9091 BGP_IPV6_NODE,
9092 "%s(config-router-af)# ",
9093 1,
9094};
9095
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009096static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009097{
9098 BGP_IPV6M_NODE,
9099 "%s(config-router-af)# ",
9100 1,
9101};
9102
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009103static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009104{
9105 BGP_VPNV4_NODE,
9106 "%s(config-router-af)# ",
9107 1
9108};
David Lamparter6b0655a2014-06-04 06:53:35 +02009109
paul1f8ae702005-09-09 23:49:49 +00009110static void community_list_vty (void);
9111
paul718e3742002-12-13 20:15:29 +00009112void
paul94f2b392005-06-28 12:44:16 +00009113bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009114{
paul718e3742002-12-13 20:15:29 +00009115 /* Install bgp top node. */
9116 install_node (&bgp_node, bgp_config_write);
9117 install_node (&bgp_ipv4_unicast_node, NULL);
9118 install_node (&bgp_ipv4_multicast_node, NULL);
9119 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009120 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009121 install_node (&bgp_vpnv4_node, NULL);
9122
9123 /* Install default VTY commands to new nodes. */
9124 install_default (BGP_NODE);
9125 install_default (BGP_IPV4_NODE);
9126 install_default (BGP_IPV4M_NODE);
9127 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009128 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009129 install_default (BGP_VPNV4_NODE);
9130
9131 /* "bgp multiple-instance" commands. */
9132 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9133 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9134
9135 /* "bgp config-type" commands. */
9136 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9137 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9138
9139 /* Dummy commands (Currently not supported) */
9140 install_element (BGP_NODE, &no_synchronization_cmd);
9141 install_element (BGP_NODE, &no_auto_summary_cmd);
9142
9143 /* "router bgp" commands. */
9144 install_element (CONFIG_NODE, &router_bgp_cmd);
9145 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9146
9147 /* "no router bgp" commands. */
9148 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9149 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9150
9151 /* "bgp router-id" commands. */
9152 install_element (BGP_NODE, &bgp_router_id_cmd);
9153 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9154 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9155
9156 /* "bgp cluster-id" commands. */
9157 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9158 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9159 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9160 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9161
9162 /* "bgp confederation" commands. */
9163 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9164 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9165 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9166
9167 /* "bgp confederation peers" commands. */
9168 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9169 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9170
Josh Bailey165b5ff2011-07-20 20:43:22 -07009171 /* "maximum-paths" commands. */
9172 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9173 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9174 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9175 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9176 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9177 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
9178 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9179 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9180 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9181 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9182 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9183 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9184
paul718e3742002-12-13 20:15:29 +00009185 /* "timers bgp" commands. */
9186 install_element (BGP_NODE, &bgp_timers_cmd);
9187 install_element (BGP_NODE, &no_bgp_timers_cmd);
9188 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9189
9190 /* "bgp client-to-client reflection" commands */
9191 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9192 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9193
9194 /* "bgp always-compare-med" commands */
9195 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9196 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9197
9198 /* "bgp deterministic-med" commands */
9199 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9200 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009201
hasso538621f2004-05-21 09:31:30 +00009202 /* "bgp graceful-restart" commands */
9203 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9204 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009205 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9206 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9207 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009208
9209 /* "bgp fast-external-failover" commands */
9210 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9211 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9212
9213 /* "bgp enforce-first-as" commands */
9214 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9215 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9216
9217 /* "bgp bestpath compare-routerid" commands */
9218 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9219 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9220
9221 /* "bgp bestpath as-path ignore" commands */
9222 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9223 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9224
hasso68118452005-04-08 15:40:36 +00009225 /* "bgp bestpath as-path confed" commands */
9226 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9227 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9228
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00009229 /* "bgp bestpath as-path multipath-relax" commands */
9230 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9231 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9232
paul848973c2003-08-13 00:32:49 +00009233 /* "bgp log-neighbor-changes" commands */
9234 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9235 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9236
paul718e3742002-12-13 20:15:29 +00009237 /* "bgp bestpath med" commands */
9238 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9239 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9240 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9241 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9242 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9243 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9244
9245 /* "no bgp default ipv4-unicast" commands. */
9246 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9247 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9248
9249 /* "bgp network import-check" commands. */
9250 install_element (BGP_NODE, &bgp_network_import_check_cmd);
9251 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
9252
9253 /* "bgp default local-preference" commands. */
9254 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
9255 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
9256 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
9257
9258 /* "neighbor remote-as" commands. */
9259 install_element (BGP_NODE, &neighbor_remote_as_cmd);
9260 install_element (BGP_NODE, &no_neighbor_cmd);
9261 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
9262
9263 /* "neighbor peer-group" commands. */
9264 install_element (BGP_NODE, &neighbor_peer_group_cmd);
9265 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
9266 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
9267
9268 /* "neighbor local-as" commands. */
9269 install_element (BGP_NODE, &neighbor_local_as_cmd);
9270 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009271 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +00009272 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
9273 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
9274 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009275 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +00009276
Paul Jakma0df7c912008-07-21 21:02:49 +00009277 /* "neighbor password" commands. */
9278 install_element (BGP_NODE, &neighbor_password_cmd);
9279 install_element (BGP_NODE, &no_neighbor_password_cmd);
9280
paul718e3742002-12-13 20:15:29 +00009281 /* "neighbor activate" commands. */
9282 install_element (BGP_NODE, &neighbor_activate_cmd);
9283 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
9284 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
9285 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009286 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009287 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
9288
9289 /* "no neighbor activate" commands. */
9290 install_element (BGP_NODE, &no_neighbor_activate_cmd);
9291 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
9292 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
9293 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009294 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009295 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
9296
9297 /* "neighbor peer-group set" commands. */
9298 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
9299 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
9300 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
9301 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009302 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009303 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
9304
paul718e3742002-12-13 20:15:29 +00009305 /* "no neighbor peer-group unset" commands. */
9306 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
9307 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
9308 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
9309 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009310 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009311 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
9312
paul718e3742002-12-13 20:15:29 +00009313 /* "neighbor softreconfiguration inbound" commands.*/
9314 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
9315 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
9316 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
9317 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
9318 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
9319 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
9320 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
9321 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009322 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
9323 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +00009324 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
9325 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +00009326
9327 /* "neighbor attribute-unchanged" commands. */
9328 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
9329 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
9330 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
9331 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
9332 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
9333 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
9334 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
9335 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
9336 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
9337 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
9338 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
9339 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
9340 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
9341 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
9342 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
9343 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
9344 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
9345 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
9346 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
9347 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
9348 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
9349 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
9350 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
9351 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
9352 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
9353 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
9354 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
9355 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
9356 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
9357 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
9358 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
9359 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
9360 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
9361 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
9362 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9363 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9364 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9365 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9366 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9367 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9368 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9369 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9370 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9371 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9372 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
9373 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
9374 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
9375 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
9376 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
9377 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
9378 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
9379 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
9380 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
9381 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
9382 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
9383 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
9384 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
9385 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
9386 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
9387 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
9388 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
9389 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
9390 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
9391 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
9392 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
9393 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
9394 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
9395 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
9396 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
9397 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
9398 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
9399 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
9400 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
9401 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
9402 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
9403 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
9404 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
9405 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9406 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9407 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9408 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9409 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9410 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9411 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9412 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9413 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9414 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9415 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009416 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
9417 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
9418 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
9419 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
9420 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
9421 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
9422 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
9423 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
9424 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
9425 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
9426 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
9427 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
9428 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
9429 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
9430 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
9431 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
9432 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
9433 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
9434 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
9435 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
9436 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
9437 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +00009438 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
9439 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
9440 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
9441 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
9442 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
9443 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
9444 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
9445 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
9446 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
9447 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
9448 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
9449 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
9450 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9451 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9452 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9453 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9454 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9455 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9456 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9457 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9458 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9459 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9460
paulfee0f4c2004-09-13 05:12:46 +00009461 /* "nexthop-local unchanged" commands */
9462 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
9463 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
9464
paul718e3742002-12-13 20:15:29 +00009465 /* "transparent-as" and "transparent-nexthop" for old version
9466 compatibility. */
9467 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
9468 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
9469
9470 /* "neighbor next-hop-self" commands. */
9471 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
9472 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
9473 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
9474 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
9475 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
9476 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
9477 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
9478 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009479 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
9480 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009481 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
9482 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
9483
9484 /* "neighbor remove-private-AS" commands. */
9485 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
9486 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
9487 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
9488 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
9489 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
9490 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
9491 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
9492 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009493 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
9494 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009495 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
9496 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
9497
9498 /* "neighbor send-community" commands.*/
9499 install_element (BGP_NODE, &neighbor_send_community_cmd);
9500 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
9501 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
9502 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
9503 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
9504 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
9505 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
9506 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
9507 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
9508 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
9509 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
9510 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
9511 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
9512 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
9513 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
9514 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009515 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
9516 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
9517 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
9518 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00009519 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
9520 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
9521 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
9522 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
9523
9524 /* "neighbor route-reflector" commands.*/
9525 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
9526 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
9527 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
9528 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
9529 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
9530 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
9531 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
9532 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009533 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
9534 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +00009535 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
9536 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
9537
9538 /* "neighbor route-server" commands.*/
9539 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
9540 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
9541 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
9542 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
9543 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
9544 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
9545 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
9546 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009547 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
9548 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +00009549 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
9550 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
9551
9552 /* "neighbor passive" commands. */
9553 install_element (BGP_NODE, &neighbor_passive_cmd);
9554 install_element (BGP_NODE, &no_neighbor_passive_cmd);
9555
9556 /* "neighbor shutdown" commands. */
9557 install_element (BGP_NODE, &neighbor_shutdown_cmd);
9558 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
9559
hassoc9502432005-02-01 22:01:48 +00009560 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +00009561 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
9562 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
9563
9564 /* "neighbor capability orf prefix-list" commands.*/
9565 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
9566 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
9567 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
9568 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
9569 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
9570 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
9571 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
9572 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009573 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
9574 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +00009575
9576 /* "neighbor capability dynamic" commands.*/
9577 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
9578 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
9579
9580 /* "neighbor dont-capability-negotiate" commands. */
9581 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
9582 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
9583
9584 /* "neighbor ebgp-multihop" commands. */
9585 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
9586 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
9587 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
9588 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
9589
hasso6ffd2072005-02-02 14:50:11 +00009590 /* "neighbor disable-connected-check" commands. */
9591 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
9592 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +00009593 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
9594 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
9595
9596 /* "neighbor description" commands. */
9597 install_element (BGP_NODE, &neighbor_description_cmd);
9598 install_element (BGP_NODE, &no_neighbor_description_cmd);
9599 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
9600
9601 /* "neighbor update-source" commands. "*/
9602 install_element (BGP_NODE, &neighbor_update_source_cmd);
9603 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
9604
9605 /* "neighbor default-originate" commands. */
9606 install_element (BGP_NODE, &neighbor_default_originate_cmd);
9607 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
9608 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
9609 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
9610 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
9611 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
9612 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
9613 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
9614 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
9615 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
9616 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
9617 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
9618 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
9619 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
9620 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
9621 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009622 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
9623 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
9624 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
9625 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +00009626
9627 /* "neighbor port" commands. */
9628 install_element (BGP_NODE, &neighbor_port_cmd);
9629 install_element (BGP_NODE, &no_neighbor_port_cmd);
9630 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
9631
9632 /* "neighbor weight" commands. */
9633 install_element (BGP_NODE, &neighbor_weight_cmd);
9634 install_element (BGP_NODE, &no_neighbor_weight_cmd);
9635 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
9636
9637 /* "neighbor override-capability" commands. */
9638 install_element (BGP_NODE, &neighbor_override_capability_cmd);
9639 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
9640
9641 /* "neighbor strict-capability-match" commands. */
9642 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
9643 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
9644
9645 /* "neighbor timers" commands. */
9646 install_element (BGP_NODE, &neighbor_timers_cmd);
9647 install_element (BGP_NODE, &no_neighbor_timers_cmd);
9648
9649 /* "neighbor timers connect" commands. */
9650 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
9651 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
9652 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
9653
9654 /* "neighbor advertisement-interval" commands. */
9655 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
9656 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
9657 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
9658
9659 /* "neighbor version" commands. */
9660 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +00009661
9662 /* "neighbor interface" commands. */
9663 install_element (BGP_NODE, &neighbor_interface_cmd);
9664 install_element (BGP_NODE, &no_neighbor_interface_cmd);
9665
9666 /* "neighbor distribute" commands. */
9667 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
9668 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
9669 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
9670 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
9671 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
9672 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
9673 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
9674 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009675 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
9676 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +00009677 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
9678 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
9679
9680 /* "neighbor prefix-list" commands. */
9681 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
9682 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
9683 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
9684 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
9685 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
9686 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
9687 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
9688 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009689 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
9690 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +00009691 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
9692 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
9693
9694 /* "neighbor filter-list" commands. */
9695 install_element (BGP_NODE, &neighbor_filter_list_cmd);
9696 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
9697 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
9698 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
9699 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
9700 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
9701 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
9702 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009703 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
9704 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +00009705 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
9706 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
9707
9708 /* "neighbor route-map" commands. */
9709 install_element (BGP_NODE, &neighbor_route_map_cmd);
9710 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
9711 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
9712 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
9713 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
9714 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
9715 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
9716 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009717 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
9718 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +00009719 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
9720 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
9721
9722 /* "neighbor unsuppress-map" commands. */
9723 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
9724 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
9725 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
9726 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
9727 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
9728 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
9729 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
9730 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009731 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
9732 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +00009733 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
9734 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +00009735
9736 /* "neighbor maximum-prefix" commands. */
9737 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009738 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009739 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009740 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009741 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
9742 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009743 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
9744 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009745 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9746 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9747 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9748 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9749 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009750 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009751 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009752 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009753 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009754 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9755 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009756 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
9757 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009758 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9759 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9760 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9761 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9762 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009763 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009764 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009765 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009766 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009767 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
9768 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009769 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
9770 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009771 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9772 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9773 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9774 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9775 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009776 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009777 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009778 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009779 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009780 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
9781 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009782 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
9783 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009784 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9785 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9786 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9787 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9788 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009789 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
9790 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
9791 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
9792 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9793 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
9794 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9795 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
9796 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
9797 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9798 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9799 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9800 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9801 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009802 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009803 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009804 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009805 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009806 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9807 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009808 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
9809 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009810 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9811 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9812 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9813 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9814 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009815
9816 /* "neighbor allowas-in" */
9817 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
9818 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
9819 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
9820 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
9821 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
9822 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
9823 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
9824 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
9825 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
9826 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
9827 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
9828 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009829 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
9830 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
9831 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +00009832 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
9833 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
9834 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
9835
9836 /* address-family commands. */
9837 install_element (BGP_NODE, &address_family_ipv4_cmd);
9838 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
9839#ifdef HAVE_IPV6
9840 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009841 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +00009842#endif /* HAVE_IPV6 */
9843 install_element (BGP_NODE, &address_family_vpnv4_cmd);
9844 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
9845
9846 /* "exit-address-family" command. */
9847 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
9848 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
9849 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009850 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +00009851 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
9852
9853 /* "clear ip bgp commands" */
9854 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
9855 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
9856 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
9857 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
9858 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
9859 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
9860#ifdef HAVE_IPV6
9861 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
9862 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
9863 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
9864 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
9865 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
9866 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
9867 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
9868 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
9869 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
9870 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
9871 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
9872#endif /* HAVE_IPV6 */
9873
9874 /* "clear ip bgp neighbor soft in" */
9875 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
9876 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
9877 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
9878 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
9879 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
9880 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
9881 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
9882 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
9883 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
9884 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
9885 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
9886 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
9887 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
9888 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
9889 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
9890 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
9891 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
9892 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
9893 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
9894 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
9895 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
9896 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
9897 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
9898 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
9899 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
9900 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
9901 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
9902 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
9903 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
9904 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
9905 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
9906 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
9907 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
9908 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
9909 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
9910 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
9911 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
9912 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
9913 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
9914 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
9915#ifdef HAVE_IPV6
9916 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
9917 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
9918 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
9919 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
9920 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
9921 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
9922 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
9923 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
9924 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
9925 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
9926 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
9927 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
9928 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
9929 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
9930 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
9931 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
9932 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
9933 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
9934 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
9935 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
9936 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
9937 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
9938 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
9939 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
9940 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
9941 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
9942 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
9943 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
9944 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
9945 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
9946 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
9947#endif /* HAVE_IPV6 */
9948
9949 /* "clear ip bgp neighbor soft out" */
9950 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
9951 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
9952 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
9953 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
9954 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
9955 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
9956 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
9957 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
9958 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
9959 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
9960 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
9961 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
9962 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
9963 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
9964 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
9965 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
9966 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
9967 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
9968 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
9969 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
9970 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
9971 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
9972 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
9973 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
9974 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
9975 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
9976 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
9977 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
9978#ifdef HAVE_IPV6
9979 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
9980 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
9981 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
9982 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
9983 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
9984 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
9985 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
9986 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
9987 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
9988 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
9989 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
9990 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
9991 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
9992 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
9993 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
9994 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
9995 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
9996 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
9997 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
9998 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
9999 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
10000#endif /* HAVE_IPV6 */
10001
10002 /* "clear ip bgp neighbor soft" */
10003 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
10004 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
10005 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
10006 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
10007 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
10008 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
10009 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
10010 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
10011 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
10012 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
10013 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
10014 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
10015 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
10016 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
10017 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
10018#ifdef HAVE_IPV6
10019 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
10020 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
10021 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
10022 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
10023 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
10024 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
10025 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
10026 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
10027 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
10028 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
10029 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
10030#endif /* HAVE_IPV6 */
10031
paulfee0f4c2004-09-13 05:12:46 +000010032 /* "clear ip bgp neighbor rsclient" */
10033 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
10034 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
10035 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
10036 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
10037#ifdef HAVE_IPV6
10038 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
10039 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
10040 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
10041 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
10042 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
10043 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
10044 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
10045 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
10046#endif /* HAVE_IPV6 */
10047
paul718e3742002-12-13 20:15:29 +000010048 /* "show ip bgp summary" commands. */
10049 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
10050 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
10051 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010052 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010053 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010054 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010055 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10056 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10057#ifdef HAVE_IPV6
10058 install_element (VIEW_NODE, &show_bgp_summary_cmd);
10059 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
10060 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010061 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010062 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010063 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010064#endif /* HAVE_IPV6 */
Paul Jakma62687ff2008-08-23 14:27:06 +010010065 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
10066 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
10067 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010068 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010069 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010070 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010071 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10072 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10073#ifdef HAVE_IPV6
10074 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
10075 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
10076 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010077 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010078 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010079 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010080#endif /* HAVE_IPV6 */
paul718e3742002-12-13 20:15:29 +000010081 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
10082 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
10083 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010084 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010085 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010086 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010087 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10088 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10089#ifdef HAVE_IPV6
10090 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
10091 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
10092 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010093 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010094 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010095 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010096#endif /* HAVE_IPV6 */
10097
10098 /* "show ip bgp neighbors" commands. */
10099 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
10100 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10101 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
10102 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10103 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10104 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10105 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10106 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10107 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
10108 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010109 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
10110 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10111 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10112 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10113 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010114 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
10115 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10116 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
10117 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10118 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10119 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10120 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10121 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10122 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
10123 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
10124
10125#ifdef HAVE_IPV6
10126 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
10127 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
10128 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
10129 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010130 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
10131 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10132 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
10133 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010134 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
10135 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
10136 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
10137 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010138 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
10139 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
10140 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
10141 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010142 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
10143 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10144 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
10145 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010146
10147 /* Old commands. */
10148 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
10149 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
10150 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
10151 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
10152#endif /* HAVE_IPV6 */
10153
paulfee0f4c2004-09-13 05:12:46 +000010154 /* "show ip bgp rsclient" commands. */
10155 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
10156 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10157 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10158 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010159 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10160 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010161 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
10162 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10163 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10164 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010165 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10166 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010167 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
10168 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10169 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10170 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010171 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10172 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010173
10174#ifdef HAVE_IPV6
10175 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
10176 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10177 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
10178 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010179 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10180 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010181 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
10182 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10183 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
10184 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010185 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10186 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010187 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
10188 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10189 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
10190 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010191 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10192 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010193#endif /* HAVE_IPV6 */
10194
paul718e3742002-12-13 20:15:29 +000010195 /* "show ip bgp paths" commands. */
10196 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
10197 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
10198 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
10199 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
10200
10201 /* "show ip bgp community" commands. */
10202 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
10203 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
10204
10205 /* "show ip bgp attribute-info" commands. */
10206 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
10207 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
10208
10209 /* "redistribute" commands. */
10210 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
10211 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
10212 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
10213 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
10214 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
10215 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
10216 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
10217 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
10218 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
10219 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
10220#ifdef HAVE_IPV6
10221 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
10222 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
10223 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
10224 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
10225 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
10226 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
10227 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
10228 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
10229 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
10230 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
10231#endif /* HAVE_IPV6 */
10232
Nick Hilliardfa411a22011-03-23 15:33:17 +000010233 /* ttl_security commands */
10234 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
10235 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
10236
Paul Jakma4bf6a362006-03-30 14:05:23 +000010237 /* "show bgp memory" commands. */
10238 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010239 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000010240 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
10241
Michael Lamberte0081f72008-11-16 20:12:04 +000010242 /* "show bgp views" commands. */
10243 install_element (VIEW_NODE, &show_bgp_views_cmd);
10244 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
10245 install_element (ENABLE_NODE, &show_bgp_views_cmd);
10246
paul718e3742002-12-13 20:15:29 +000010247 /* Community-list. */
10248 community_list_vty ();
10249}
David Lamparter6b0655a2014-06-04 06:53:35 +020010250
paul718e3742002-12-13 20:15:29 +000010251#include "memory.h"
10252#include "bgp_regex.h"
10253#include "bgp_clist.h"
10254#include "bgp_ecommunity.h"
10255
10256/* VTY functions. */
10257
10258/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000010259static const char *
paul718e3742002-12-13 20:15:29 +000010260community_direct_str (int direct)
10261{
10262 switch (direct)
10263 {
10264 case COMMUNITY_DENY:
10265 return "deny";
paul718e3742002-12-13 20:15:29 +000010266 case COMMUNITY_PERMIT:
10267 return "permit";
paul718e3742002-12-13 20:15:29 +000010268 default:
10269 return "unknown";
paul718e3742002-12-13 20:15:29 +000010270 }
10271}
10272
10273/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000010274static void
paul718e3742002-12-13 20:15:29 +000010275community_list_perror (struct vty *vty, int ret)
10276{
10277 switch (ret)
10278 {
10279 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030010280 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010281 break;
10282 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
10283 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
10284 break;
10285 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
10286 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
10287 break;
10288 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
10289 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
10290 break;
10291 }
10292}
10293
10294/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000010295static int
paulfd79ac92004-10-13 05:06:08 +000010296community_list_set_vty (struct vty *vty, int argc, const char **argv,
10297 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010298{
10299 int ret;
10300 int direct;
10301 char *str;
10302
10303 /* Check the list type. */
10304 if (strncmp (argv[1], "p", 1) == 0)
10305 direct = COMMUNITY_PERMIT;
10306 else if (strncmp (argv[1], "d", 1) == 0)
10307 direct = COMMUNITY_DENY;
10308 else
10309 {
10310 vty_out (vty, "%% Matching condition must be permit or deny%s",
10311 VTY_NEWLINE);
10312 return CMD_WARNING;
10313 }
10314
10315 /* All digit name check. */
10316 if (reject_all_digit_name && all_digit (argv[0]))
10317 {
10318 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10319 return CMD_WARNING;
10320 }
10321
10322 /* Concat community string argument. */
10323 if (argc > 1)
10324 str = argv_concat (argv, argc, 2);
10325 else
10326 str = NULL;
10327
10328 /* When community_list_set() return nevetive value, it means
10329 malformed community string. */
10330 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
10331
10332 /* Free temporary community list string allocated by
10333 argv_concat(). */
10334 if (str)
10335 XFREE (MTYPE_TMP, str);
10336
10337 if (ret < 0)
10338 {
10339 /* Display error string. */
10340 community_list_perror (vty, ret);
10341 return CMD_WARNING;
10342 }
10343
10344 return CMD_SUCCESS;
10345}
10346
paul718e3742002-12-13 20:15:29 +000010347/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000010348static int
hassofee6e4e2005-02-02 16:29:31 +000010349community_list_unset_vty (struct vty *vty, int argc, const char **argv,
10350 int style)
paul718e3742002-12-13 20:15:29 +000010351{
10352 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010353 int direct = 0;
10354 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010355
hassofee6e4e2005-02-02 16:29:31 +000010356 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010357 {
hassofee6e4e2005-02-02 16:29:31 +000010358 /* Check the list direct. */
10359 if (strncmp (argv[1], "p", 1) == 0)
10360 direct = COMMUNITY_PERMIT;
10361 else if (strncmp (argv[1], "d", 1) == 0)
10362 direct = COMMUNITY_DENY;
10363 else
10364 {
10365 vty_out (vty, "%% Matching condition must be permit or deny%s",
10366 VTY_NEWLINE);
10367 return CMD_WARNING;
10368 }
paul718e3742002-12-13 20:15:29 +000010369
hassofee6e4e2005-02-02 16:29:31 +000010370 /* Concat community string argument. */
10371 str = argv_concat (argv, argc, 2);
10372 }
paul718e3742002-12-13 20:15:29 +000010373
10374 /* Unset community list. */
10375 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
10376
10377 /* Free temporary community list string allocated by
10378 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010379 if (str)
10380 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010381
10382 if (ret < 0)
10383 {
10384 community_list_perror (vty, ret);
10385 return CMD_WARNING;
10386 }
10387
10388 return CMD_SUCCESS;
10389}
10390
10391/* "community-list" keyword help string. */
10392#define COMMUNITY_LIST_STR "Add a community list entry\n"
10393#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
10394
paul718e3742002-12-13 20:15:29 +000010395DEFUN (ip_community_list_standard,
10396 ip_community_list_standard_cmd,
10397 "ip community-list <1-99> (deny|permit) .AA:NN",
10398 IP_STR
10399 COMMUNITY_LIST_STR
10400 "Community list number (standard)\n"
10401 "Specify community to reject\n"
10402 "Specify community to accept\n"
10403 COMMUNITY_VAL_STR)
10404{
10405 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
10406}
10407
10408ALIAS (ip_community_list_standard,
10409 ip_community_list_standard2_cmd,
10410 "ip community-list <1-99> (deny|permit)",
10411 IP_STR
10412 COMMUNITY_LIST_STR
10413 "Community list number (standard)\n"
10414 "Specify community to reject\n"
10415 "Specify community to accept\n")
10416
10417DEFUN (ip_community_list_expanded,
10418 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010419 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010420 IP_STR
10421 COMMUNITY_LIST_STR
10422 "Community list number (expanded)\n"
10423 "Specify community to reject\n"
10424 "Specify community to accept\n"
10425 "An ordered list as a regular-expression\n")
10426{
10427 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
10428}
10429
10430DEFUN (ip_community_list_name_standard,
10431 ip_community_list_name_standard_cmd,
10432 "ip community-list standard WORD (deny|permit) .AA:NN",
10433 IP_STR
10434 COMMUNITY_LIST_STR
10435 "Add a standard community-list entry\n"
10436 "Community list name\n"
10437 "Specify community to reject\n"
10438 "Specify community to accept\n"
10439 COMMUNITY_VAL_STR)
10440{
10441 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
10442}
10443
10444ALIAS (ip_community_list_name_standard,
10445 ip_community_list_name_standard2_cmd,
10446 "ip community-list standard WORD (deny|permit)",
10447 IP_STR
10448 COMMUNITY_LIST_STR
10449 "Add a standard community-list entry\n"
10450 "Community list name\n"
10451 "Specify community to reject\n"
10452 "Specify community to accept\n")
10453
10454DEFUN (ip_community_list_name_expanded,
10455 ip_community_list_name_expanded_cmd,
10456 "ip community-list expanded WORD (deny|permit) .LINE",
10457 IP_STR
10458 COMMUNITY_LIST_STR
10459 "Add an expanded community-list entry\n"
10460 "Community list name\n"
10461 "Specify community to reject\n"
10462 "Specify community to accept\n"
10463 "An ordered list as a regular-expression\n")
10464{
10465 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
10466}
10467
hassofee6e4e2005-02-02 16:29:31 +000010468DEFUN (no_ip_community_list_standard_all,
10469 no_ip_community_list_standard_all_cmd,
10470 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010471 NO_STR
10472 IP_STR
10473 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010474 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010475{
hassofee6e4e2005-02-02 16:29:31 +000010476 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010477}
10478
hassofee6e4e2005-02-02 16:29:31 +000010479DEFUN (no_ip_community_list_expanded_all,
10480 no_ip_community_list_expanded_all_cmd,
10481 "no ip community-list <100-500>",
10482 NO_STR
10483 IP_STR
10484 COMMUNITY_LIST_STR
10485 "Community list number (expanded)\n")
10486{
10487 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10488}
10489
10490DEFUN (no_ip_community_list_name_standard_all,
10491 no_ip_community_list_name_standard_all_cmd,
10492 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010493 NO_STR
10494 IP_STR
10495 COMMUNITY_LIST_STR
10496 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000010497 "Community list name\n")
10498{
hassofee6e4e2005-02-02 16:29:31 +000010499 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010500}
10501
hassofee6e4e2005-02-02 16:29:31 +000010502DEFUN (no_ip_community_list_name_expanded_all,
10503 no_ip_community_list_name_expanded_all_cmd,
10504 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000010505 NO_STR
10506 IP_STR
10507 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010508 "Add an expanded community-list entry\n"
10509 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000010510{
hassofee6e4e2005-02-02 16:29:31 +000010511 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010512}
10513
10514DEFUN (no_ip_community_list_standard,
10515 no_ip_community_list_standard_cmd,
10516 "no ip community-list <1-99> (deny|permit) .AA:NN",
10517 NO_STR
10518 IP_STR
10519 COMMUNITY_LIST_STR
10520 "Community list number (standard)\n"
10521 "Specify community to reject\n"
10522 "Specify community to accept\n"
10523 COMMUNITY_VAL_STR)
10524{
10525 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10526}
10527
10528DEFUN (no_ip_community_list_expanded,
10529 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010530 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010531 NO_STR
10532 IP_STR
10533 COMMUNITY_LIST_STR
10534 "Community list number (expanded)\n"
10535 "Specify community to reject\n"
10536 "Specify community to accept\n"
10537 "An ordered list as a regular-expression\n")
10538{
10539 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10540}
10541
10542DEFUN (no_ip_community_list_name_standard,
10543 no_ip_community_list_name_standard_cmd,
10544 "no ip community-list standard WORD (deny|permit) .AA:NN",
10545 NO_STR
10546 IP_STR
10547 COMMUNITY_LIST_STR
10548 "Specify a standard community-list\n"
10549 "Community list name\n"
10550 "Specify community to reject\n"
10551 "Specify community to accept\n"
10552 COMMUNITY_VAL_STR)
10553{
10554 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10555}
10556
10557DEFUN (no_ip_community_list_name_expanded,
10558 no_ip_community_list_name_expanded_cmd,
10559 "no ip community-list expanded WORD (deny|permit) .LINE",
10560 NO_STR
10561 IP_STR
10562 COMMUNITY_LIST_STR
10563 "Specify an expanded community-list\n"
10564 "Community list name\n"
10565 "Specify community to reject\n"
10566 "Specify community to accept\n"
10567 "An ordered list as a regular-expression\n")
10568{
10569 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10570}
10571
paul94f2b392005-06-28 12:44:16 +000010572static void
paul718e3742002-12-13 20:15:29 +000010573community_list_show (struct vty *vty, struct community_list *list)
10574{
10575 struct community_entry *entry;
10576
10577 for (entry = list->head; entry; entry = entry->next)
10578 {
10579 if (entry == list->head)
10580 {
10581 if (all_digit (list->name))
10582 vty_out (vty, "Community %s list %s%s",
10583 entry->style == COMMUNITY_LIST_STANDARD ?
10584 "standard" : "(expanded) access",
10585 list->name, VTY_NEWLINE);
10586 else
10587 vty_out (vty, "Named Community %s list %s%s",
10588 entry->style == COMMUNITY_LIST_STANDARD ?
10589 "standard" : "expanded",
10590 list->name, VTY_NEWLINE);
10591 }
10592 if (entry->any)
10593 vty_out (vty, " %s%s",
10594 community_direct_str (entry->direct), VTY_NEWLINE);
10595 else
10596 vty_out (vty, " %s %s%s",
10597 community_direct_str (entry->direct),
10598 entry->style == COMMUNITY_LIST_STANDARD
10599 ? community_str (entry->u.com) : entry->config,
10600 VTY_NEWLINE);
10601 }
10602}
10603
10604DEFUN (show_ip_community_list,
10605 show_ip_community_list_cmd,
10606 "show ip community-list",
10607 SHOW_STR
10608 IP_STR
10609 "List community-list\n")
10610{
10611 struct community_list *list;
10612 struct community_list_master *cm;
10613
hassofee6e4e2005-02-02 16:29:31 +000010614 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010615 if (! cm)
10616 return CMD_SUCCESS;
10617
10618 for (list = cm->num.head; list; list = list->next)
10619 community_list_show (vty, list);
10620
10621 for (list = cm->str.head; list; list = list->next)
10622 community_list_show (vty, list);
10623
10624 return CMD_SUCCESS;
10625}
10626
10627DEFUN (show_ip_community_list_arg,
10628 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010629 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010630 SHOW_STR
10631 IP_STR
10632 "List community-list\n"
10633 "Community-list number\n"
10634 "Community-list name\n")
10635{
10636 struct community_list *list;
10637
hassofee6e4e2005-02-02 16:29:31 +000010638 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010639 if (! list)
10640 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030010641 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010642 return CMD_WARNING;
10643 }
10644
10645 community_list_show (vty, list);
10646
10647 return CMD_SUCCESS;
10648}
David Lamparter6b0655a2014-06-04 06:53:35 +020010649
paul94f2b392005-06-28 12:44:16 +000010650static int
paulfd79ac92004-10-13 05:06:08 +000010651extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
10652 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010653{
10654 int ret;
10655 int direct;
10656 char *str;
10657
10658 /* Check the list type. */
10659 if (strncmp (argv[1], "p", 1) == 0)
10660 direct = COMMUNITY_PERMIT;
10661 else if (strncmp (argv[1], "d", 1) == 0)
10662 direct = COMMUNITY_DENY;
10663 else
10664 {
10665 vty_out (vty, "%% Matching condition must be permit or deny%s",
10666 VTY_NEWLINE);
10667 return CMD_WARNING;
10668 }
10669
10670 /* All digit name check. */
10671 if (reject_all_digit_name && all_digit (argv[0]))
10672 {
10673 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10674 return CMD_WARNING;
10675 }
10676
10677 /* Concat community string argument. */
10678 if (argc > 1)
10679 str = argv_concat (argv, argc, 2);
10680 else
10681 str = NULL;
10682
10683 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
10684
10685 /* Free temporary community list string allocated by
10686 argv_concat(). */
10687 if (str)
10688 XFREE (MTYPE_TMP, str);
10689
10690 if (ret < 0)
10691 {
10692 community_list_perror (vty, ret);
10693 return CMD_WARNING;
10694 }
10695 return CMD_SUCCESS;
10696}
10697
paul94f2b392005-06-28 12:44:16 +000010698static int
hassofee6e4e2005-02-02 16:29:31 +000010699extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
10700 int style)
paul718e3742002-12-13 20:15:29 +000010701{
10702 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010703 int direct = 0;
10704 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010705
hassofee6e4e2005-02-02 16:29:31 +000010706 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010707 {
hassofee6e4e2005-02-02 16:29:31 +000010708 /* Check the list direct. */
10709 if (strncmp (argv[1], "p", 1) == 0)
10710 direct = COMMUNITY_PERMIT;
10711 else if (strncmp (argv[1], "d", 1) == 0)
10712 direct = COMMUNITY_DENY;
10713 else
10714 {
10715 vty_out (vty, "%% Matching condition must be permit or deny%s",
10716 VTY_NEWLINE);
10717 return CMD_WARNING;
10718 }
10719
10720 /* Concat community string argument. */
10721 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000010722 }
paul718e3742002-12-13 20:15:29 +000010723
10724 /* Unset community list. */
10725 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
10726
10727 /* Free temporary community list string allocated by
10728 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010729 if (str)
10730 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010731
10732 if (ret < 0)
10733 {
10734 community_list_perror (vty, ret);
10735 return CMD_WARNING;
10736 }
10737
10738 return CMD_SUCCESS;
10739}
10740
10741/* "extcommunity-list" keyword help string. */
10742#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
10743#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
10744
10745DEFUN (ip_extcommunity_list_standard,
10746 ip_extcommunity_list_standard_cmd,
10747 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10748 IP_STR
10749 EXTCOMMUNITY_LIST_STR
10750 "Extended Community list number (standard)\n"
10751 "Specify community to reject\n"
10752 "Specify community to accept\n"
10753 EXTCOMMUNITY_VAL_STR)
10754{
10755 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
10756}
10757
10758ALIAS (ip_extcommunity_list_standard,
10759 ip_extcommunity_list_standard2_cmd,
10760 "ip extcommunity-list <1-99> (deny|permit)",
10761 IP_STR
10762 EXTCOMMUNITY_LIST_STR
10763 "Extended Community list number (standard)\n"
10764 "Specify community to reject\n"
10765 "Specify community to accept\n")
10766
10767DEFUN (ip_extcommunity_list_expanded,
10768 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010769 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010770 IP_STR
10771 EXTCOMMUNITY_LIST_STR
10772 "Extended Community list number (expanded)\n"
10773 "Specify community to reject\n"
10774 "Specify community to accept\n"
10775 "An ordered list as a regular-expression\n")
10776{
10777 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
10778}
10779
10780DEFUN (ip_extcommunity_list_name_standard,
10781 ip_extcommunity_list_name_standard_cmd,
10782 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10783 IP_STR
10784 EXTCOMMUNITY_LIST_STR
10785 "Specify standard extcommunity-list\n"
10786 "Extended Community list name\n"
10787 "Specify community to reject\n"
10788 "Specify community to accept\n"
10789 EXTCOMMUNITY_VAL_STR)
10790{
10791 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
10792}
10793
10794ALIAS (ip_extcommunity_list_name_standard,
10795 ip_extcommunity_list_name_standard2_cmd,
10796 "ip extcommunity-list standard WORD (deny|permit)",
10797 IP_STR
10798 EXTCOMMUNITY_LIST_STR
10799 "Specify standard extcommunity-list\n"
10800 "Extended Community list name\n"
10801 "Specify community to reject\n"
10802 "Specify community to accept\n")
10803
10804DEFUN (ip_extcommunity_list_name_expanded,
10805 ip_extcommunity_list_name_expanded_cmd,
10806 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
10807 IP_STR
10808 EXTCOMMUNITY_LIST_STR
10809 "Specify expanded extcommunity-list\n"
10810 "Extended Community list name\n"
10811 "Specify community to reject\n"
10812 "Specify community to accept\n"
10813 "An ordered list as a regular-expression\n")
10814{
10815 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
10816}
10817
hassofee6e4e2005-02-02 16:29:31 +000010818DEFUN (no_ip_extcommunity_list_standard_all,
10819 no_ip_extcommunity_list_standard_all_cmd,
10820 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010821 NO_STR
10822 IP_STR
10823 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010824 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010825{
hassofee6e4e2005-02-02 16:29:31 +000010826 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010827}
10828
hassofee6e4e2005-02-02 16:29:31 +000010829DEFUN (no_ip_extcommunity_list_expanded_all,
10830 no_ip_extcommunity_list_expanded_all_cmd,
10831 "no ip extcommunity-list <100-500>",
10832 NO_STR
10833 IP_STR
10834 EXTCOMMUNITY_LIST_STR
10835 "Extended Community list number (expanded)\n")
10836{
10837 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10838}
10839
10840DEFUN (no_ip_extcommunity_list_name_standard_all,
10841 no_ip_extcommunity_list_name_standard_all_cmd,
10842 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010843 NO_STR
10844 IP_STR
10845 EXTCOMMUNITY_LIST_STR
10846 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000010847 "Extended Community list name\n")
10848{
10849 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10850}
10851
10852DEFUN (no_ip_extcommunity_list_name_expanded_all,
10853 no_ip_extcommunity_list_name_expanded_all_cmd,
10854 "no ip extcommunity-list expanded WORD",
10855 NO_STR
10856 IP_STR
10857 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000010858 "Specify expanded extcommunity-list\n"
10859 "Extended Community list name\n")
10860{
hassofee6e4e2005-02-02 16:29:31 +000010861 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010862}
10863
10864DEFUN (no_ip_extcommunity_list_standard,
10865 no_ip_extcommunity_list_standard_cmd,
10866 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10867 NO_STR
10868 IP_STR
10869 EXTCOMMUNITY_LIST_STR
10870 "Extended Community list number (standard)\n"
10871 "Specify community to reject\n"
10872 "Specify community to accept\n"
10873 EXTCOMMUNITY_VAL_STR)
10874{
10875 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10876}
10877
10878DEFUN (no_ip_extcommunity_list_expanded,
10879 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010880 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010881 NO_STR
10882 IP_STR
10883 EXTCOMMUNITY_LIST_STR
10884 "Extended Community list number (expanded)\n"
10885 "Specify community to reject\n"
10886 "Specify community to accept\n"
10887 "An ordered list as a regular-expression\n")
10888{
10889 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10890}
10891
10892DEFUN (no_ip_extcommunity_list_name_standard,
10893 no_ip_extcommunity_list_name_standard_cmd,
10894 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10895 NO_STR
10896 IP_STR
10897 EXTCOMMUNITY_LIST_STR
10898 "Specify standard extcommunity-list\n"
10899 "Extended Community list name\n"
10900 "Specify community to reject\n"
10901 "Specify community to accept\n"
10902 EXTCOMMUNITY_VAL_STR)
10903{
10904 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10905}
10906
10907DEFUN (no_ip_extcommunity_list_name_expanded,
10908 no_ip_extcommunity_list_name_expanded_cmd,
10909 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
10910 NO_STR
10911 IP_STR
10912 EXTCOMMUNITY_LIST_STR
10913 "Specify expanded extcommunity-list\n"
10914 "Community list name\n"
10915 "Specify community to reject\n"
10916 "Specify community to accept\n"
10917 "An ordered list as a regular-expression\n")
10918{
10919 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10920}
10921
paul94f2b392005-06-28 12:44:16 +000010922static void
paul718e3742002-12-13 20:15:29 +000010923extcommunity_list_show (struct vty *vty, struct community_list *list)
10924{
10925 struct community_entry *entry;
10926
10927 for (entry = list->head; entry; entry = entry->next)
10928 {
10929 if (entry == list->head)
10930 {
10931 if (all_digit (list->name))
10932 vty_out (vty, "Extended community %s list %s%s",
10933 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10934 "standard" : "(expanded) access",
10935 list->name, VTY_NEWLINE);
10936 else
10937 vty_out (vty, "Named extended community %s list %s%s",
10938 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10939 "standard" : "expanded",
10940 list->name, VTY_NEWLINE);
10941 }
10942 if (entry->any)
10943 vty_out (vty, " %s%s",
10944 community_direct_str (entry->direct), VTY_NEWLINE);
10945 else
10946 vty_out (vty, " %s %s%s",
10947 community_direct_str (entry->direct),
10948 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10949 entry->u.ecom->str : entry->config,
10950 VTY_NEWLINE);
10951 }
10952}
10953
10954DEFUN (show_ip_extcommunity_list,
10955 show_ip_extcommunity_list_cmd,
10956 "show ip extcommunity-list",
10957 SHOW_STR
10958 IP_STR
10959 "List extended-community list\n")
10960{
10961 struct community_list *list;
10962 struct community_list_master *cm;
10963
hassofee6e4e2005-02-02 16:29:31 +000010964 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010965 if (! cm)
10966 return CMD_SUCCESS;
10967
10968 for (list = cm->num.head; list; list = list->next)
10969 extcommunity_list_show (vty, list);
10970
10971 for (list = cm->str.head; list; list = list->next)
10972 extcommunity_list_show (vty, list);
10973
10974 return CMD_SUCCESS;
10975}
10976
10977DEFUN (show_ip_extcommunity_list_arg,
10978 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010979 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010980 SHOW_STR
10981 IP_STR
10982 "List extended-community list\n"
10983 "Extcommunity-list number\n"
10984 "Extcommunity-list name\n")
10985{
10986 struct community_list *list;
10987
hassofee6e4e2005-02-02 16:29:31 +000010988 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010989 if (! list)
10990 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030010991 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010992 return CMD_WARNING;
10993 }
10994
10995 extcommunity_list_show (vty, list);
10996
10997 return CMD_SUCCESS;
10998}
David Lamparter6b0655a2014-06-04 06:53:35 +020010999
paul718e3742002-12-13 20:15:29 +000011000/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000011001static const char *
paul718e3742002-12-13 20:15:29 +000011002community_list_config_str (struct community_entry *entry)
11003{
paulfd79ac92004-10-13 05:06:08 +000011004 const char *str;
paul718e3742002-12-13 20:15:29 +000011005
11006 if (entry->any)
11007 str = "";
11008 else
11009 {
11010 if (entry->style == COMMUNITY_LIST_STANDARD)
11011 str = community_str (entry->u.com);
11012 else
11013 str = entry->config;
11014 }
11015 return str;
11016}
11017
11018/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000011019static int
paul718e3742002-12-13 20:15:29 +000011020community_list_config_write (struct vty *vty)
11021{
11022 struct community_list *list;
11023 struct community_entry *entry;
11024 struct community_list_master *cm;
11025 int write = 0;
11026
11027 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000011028 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011029
11030 for (list = cm->num.head; list; list = list->next)
11031 for (entry = list->head; entry; entry = entry->next)
11032 {
hassofee6e4e2005-02-02 16:29:31 +000011033 vty_out (vty, "ip community-list %s %s %s%s",
11034 list->name, community_direct_str (entry->direct),
11035 community_list_config_str (entry),
11036 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011037 write++;
11038 }
11039 for (list = cm->str.head; list; list = list->next)
11040 for (entry = list->head; entry; entry = entry->next)
11041 {
11042 vty_out (vty, "ip community-list %s %s %s %s%s",
11043 entry->style == COMMUNITY_LIST_STANDARD
11044 ? "standard" : "expanded",
11045 list->name, community_direct_str (entry->direct),
11046 community_list_config_str (entry),
11047 VTY_NEWLINE);
11048 write++;
11049 }
11050
11051 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000011052 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011053
11054 for (list = cm->num.head; list; list = list->next)
11055 for (entry = list->head; entry; entry = entry->next)
11056 {
hassofee6e4e2005-02-02 16:29:31 +000011057 vty_out (vty, "ip extcommunity-list %s %s %s%s",
11058 list->name, community_direct_str (entry->direct),
11059 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011060 write++;
11061 }
11062 for (list = cm->str.head; list; list = list->next)
11063 for (entry = list->head; entry; entry = entry->next)
11064 {
11065 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
11066 entry->style == EXTCOMMUNITY_LIST_STANDARD
11067 ? "standard" : "expanded",
11068 list->name, community_direct_str (entry->direct),
11069 community_list_config_str (entry), VTY_NEWLINE);
11070 write++;
11071 }
11072 return write;
11073}
11074
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080011075static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000011076{
11077 COMMUNITY_LIST_NODE,
11078 "",
11079 1 /* Export to vtysh. */
11080};
11081
paul94f2b392005-06-28 12:44:16 +000011082static void
11083community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000011084{
11085 install_node (&community_list_node, community_list_config_write);
11086
11087 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000011088 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
11089 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
11090 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
11091 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
11092 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
11093 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011094 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
11095 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
11096 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
11097 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011098 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
11099 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
11100 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
11101 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
11102 install_element (VIEW_NODE, &show_ip_community_list_cmd);
11103 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
11104 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
11105 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
11106
11107 /* Extcommunity-list. */
11108 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
11109 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
11110 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
11111 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
11112 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
11113 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011114 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
11115 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
11116 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
11117 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011118 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
11119 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
11120 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
11121 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
11122 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
11123 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
11124 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
11125 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
11126}