blob: e6a36605f158555f4d8b2c216cdc14094cd6f223 [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;
Paul Jakma7aa9dce2014-09-19 14:42:23 +0100579 as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */
paul718e3742002-12-13 20:15:29 +0000580
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{
paul718e3742002-12-13 20:15:29 +00003208 struct peer *peer;
3209 unsigned long weight;
3210
3211 peer = peer_and_group_lookup_vty (vty, ip_str);
3212 if (! peer)
3213 return CMD_WARNING;
3214
3215 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3216
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003217 return bgp_vty_return (vty, peer_weight_set (peer, weight));
paul718e3742002-12-13 20:15:29 +00003218}
3219
paul94f2b392005-06-28 12:44:16 +00003220static int
paulfd79ac92004-10-13 05:06:08 +00003221peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003222{
3223 struct peer *peer;
3224
3225 peer = peer_and_group_lookup_vty (vty, ip_str);
3226 if (! peer)
3227 return CMD_WARNING;
3228
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003229 return bgp_vty_return (vty, peer_weight_unset (peer));
paul718e3742002-12-13 20:15:29 +00003230}
3231
3232DEFUN (neighbor_weight,
3233 neighbor_weight_cmd,
3234 NEIGHBOR_CMD2 "weight <0-65535>",
3235 NEIGHBOR_STR
3236 NEIGHBOR_ADDR_STR2
3237 "Set default weight for routes from this neighbor\n"
3238 "default weight\n")
3239{
3240 return peer_weight_set_vty (vty, argv[0], argv[1]);
3241}
3242
3243DEFUN (no_neighbor_weight,
3244 no_neighbor_weight_cmd,
3245 NO_NEIGHBOR_CMD2 "weight",
3246 NO_STR
3247 NEIGHBOR_STR
3248 NEIGHBOR_ADDR_STR2
3249 "Set default weight for routes from this neighbor\n")
3250{
3251 return peer_weight_unset_vty (vty, argv[0]);
3252}
3253
3254ALIAS (no_neighbor_weight,
3255 no_neighbor_weight_val_cmd,
3256 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3257 NO_STR
3258 NEIGHBOR_STR
3259 NEIGHBOR_ADDR_STR2
3260 "Set default weight for routes from this neighbor\n"
3261 "default weight\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003262
paul718e3742002-12-13 20:15:29 +00003263/* Override capability negotiation. */
3264DEFUN (neighbor_override_capability,
3265 neighbor_override_capability_cmd,
3266 NEIGHBOR_CMD2 "override-capability",
3267 NEIGHBOR_STR
3268 NEIGHBOR_ADDR_STR2
3269 "Override capability negotiation result\n")
3270{
3271 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3272}
3273
3274DEFUN (no_neighbor_override_capability,
3275 no_neighbor_override_capability_cmd,
3276 NO_NEIGHBOR_CMD2 "override-capability",
3277 NO_STR
3278 NEIGHBOR_STR
3279 NEIGHBOR_ADDR_STR2
3280 "Override capability negotiation result\n")
3281{
3282 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3283}
David Lamparter6b0655a2014-06-04 06:53:35 +02003284
paul718e3742002-12-13 20:15:29 +00003285DEFUN (neighbor_strict_capability,
3286 neighbor_strict_capability_cmd,
3287 NEIGHBOR_CMD "strict-capability-match",
3288 NEIGHBOR_STR
3289 NEIGHBOR_ADDR_STR
3290 "Strict capability negotiation match\n")
3291{
3292 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3293}
3294
3295DEFUN (no_neighbor_strict_capability,
3296 no_neighbor_strict_capability_cmd,
3297 NO_NEIGHBOR_CMD "strict-capability-match",
3298 NO_STR
3299 NEIGHBOR_STR
3300 NEIGHBOR_ADDR_STR
3301 "Strict capability negotiation match\n")
3302{
3303 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3304}
David Lamparter6b0655a2014-06-04 06:53:35 +02003305
paul94f2b392005-06-28 12:44:16 +00003306static int
paulfd79ac92004-10-13 05:06:08 +00003307peer_timers_set_vty (struct vty *vty, const char *ip_str,
3308 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003309{
3310 int ret;
3311 struct peer *peer;
3312 u_int32_t keepalive;
3313 u_int32_t holdtime;
3314
3315 peer = peer_and_group_lookup_vty (vty, ip_str);
3316 if (! peer)
3317 return CMD_WARNING;
3318
3319 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3320 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3321
3322 ret = peer_timers_set (peer, keepalive, holdtime);
3323
3324 return bgp_vty_return (vty, ret);
3325}
David Lamparter6b0655a2014-06-04 06:53:35 +02003326
paul94f2b392005-06-28 12:44:16 +00003327static int
paulfd79ac92004-10-13 05:06:08 +00003328peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003329{
3330 int ret;
3331 struct peer *peer;
3332
3333 peer = peer_lookup_vty (vty, ip_str);
3334 if (! peer)
3335 return CMD_WARNING;
3336
3337 ret = peer_timers_unset (peer);
3338
3339 return bgp_vty_return (vty, ret);
3340}
3341
3342DEFUN (neighbor_timers,
3343 neighbor_timers_cmd,
3344 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3345 NEIGHBOR_STR
3346 NEIGHBOR_ADDR_STR2
3347 "BGP per neighbor timers\n"
3348 "Keepalive interval\n"
3349 "Holdtime\n")
3350{
3351 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3352}
3353
3354DEFUN (no_neighbor_timers,
3355 no_neighbor_timers_cmd,
3356 NO_NEIGHBOR_CMD2 "timers",
3357 NO_STR
3358 NEIGHBOR_STR
3359 NEIGHBOR_ADDR_STR2
3360 "BGP per neighbor timers\n")
3361{
3362 return peer_timers_unset_vty (vty, argv[0]);
3363}
David Lamparter6b0655a2014-06-04 06:53:35 +02003364
paul94f2b392005-06-28 12:44:16 +00003365static int
paulfd79ac92004-10-13 05:06:08 +00003366peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3367 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003368{
paul718e3742002-12-13 20:15:29 +00003369 struct peer *peer;
3370 u_int32_t connect;
3371
3372 peer = peer_lookup_vty (vty, ip_str);
3373 if (! peer)
3374 return CMD_WARNING;
3375
3376 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3377
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003378 return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
paul718e3742002-12-13 20:15:29 +00003379}
3380
paul94f2b392005-06-28 12:44:16 +00003381static int
paulfd79ac92004-10-13 05:06:08 +00003382peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003383{
paul718e3742002-12-13 20:15:29 +00003384 struct peer *peer;
3385
3386 peer = peer_and_group_lookup_vty (vty, ip_str);
3387 if (! peer)
3388 return CMD_WARNING;
3389
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003390 return bgp_vty_return (vty, peer_timers_connect_unset (peer));
paul718e3742002-12-13 20:15:29 +00003391}
3392
3393DEFUN (neighbor_timers_connect,
3394 neighbor_timers_connect_cmd,
3395 NEIGHBOR_CMD "timers connect <0-65535>",
3396 NEIGHBOR_STR
3397 NEIGHBOR_ADDR_STR
3398 "BGP per neighbor timers\n"
3399 "BGP connect timer\n"
3400 "Connect timer\n")
3401{
3402 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3403}
3404
3405DEFUN (no_neighbor_timers_connect,
3406 no_neighbor_timers_connect_cmd,
3407 NO_NEIGHBOR_CMD "timers connect",
3408 NO_STR
3409 NEIGHBOR_STR
3410 NEIGHBOR_ADDR_STR
3411 "BGP per neighbor timers\n"
3412 "BGP connect timer\n")
3413{
3414 return peer_timers_connect_unset_vty (vty, argv[0]);
3415}
3416
3417ALIAS (no_neighbor_timers_connect,
3418 no_neighbor_timers_connect_val_cmd,
3419 NO_NEIGHBOR_CMD "timers connect <0-65535>",
3420 NO_STR
3421 NEIGHBOR_STR
3422 NEIGHBOR_ADDR_STR
3423 "BGP per neighbor timers\n"
3424 "BGP connect timer\n"
3425 "Connect timer\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003426
paul94f2b392005-06-28 12:44:16 +00003427static int
paulfd79ac92004-10-13 05:06:08 +00003428peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3429 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003430{
3431 int ret;
3432 struct peer *peer;
3433 u_int32_t routeadv = 0;
3434
3435 peer = peer_lookup_vty (vty, ip_str);
3436 if (! peer)
3437 return CMD_WARNING;
3438
3439 if (time_str)
3440 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3441
3442 if (set)
3443 ret = peer_advertise_interval_set (peer, routeadv);
3444 else
3445 ret = peer_advertise_interval_unset (peer);
3446
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003447 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003448}
3449
3450DEFUN (neighbor_advertise_interval,
3451 neighbor_advertise_interval_cmd,
3452 NEIGHBOR_CMD "advertisement-interval <0-600>",
3453 NEIGHBOR_STR
3454 NEIGHBOR_ADDR_STR
3455 "Minimum interval between sending BGP routing updates\n"
3456 "time in seconds\n")
3457{
3458 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3459}
3460
3461DEFUN (no_neighbor_advertise_interval,
3462 no_neighbor_advertise_interval_cmd,
3463 NO_NEIGHBOR_CMD "advertisement-interval",
3464 NO_STR
3465 NEIGHBOR_STR
3466 NEIGHBOR_ADDR_STR
3467 "Minimum interval between sending BGP routing updates\n")
3468{
3469 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3470}
3471
3472ALIAS (no_neighbor_advertise_interval,
3473 no_neighbor_advertise_interval_val_cmd,
3474 NO_NEIGHBOR_CMD "advertisement-interval <0-600>",
3475 NO_STR
3476 NEIGHBOR_STR
3477 NEIGHBOR_ADDR_STR
3478 "Minimum interval between sending BGP routing updates\n"
3479 "time in seconds\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003480
paul718e3742002-12-13 20:15:29 +00003481/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003482static int
paulfd79ac92004-10-13 05:06:08 +00003483peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003484{
3485 int ret;
3486 struct peer *peer;
3487
3488 peer = peer_lookup_vty (vty, ip_str);
3489 if (! peer)
3490 return CMD_WARNING;
3491
3492 if (str)
3493 ret = peer_interface_set (peer, str);
3494 else
3495 ret = peer_interface_unset (peer);
3496
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003497 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003498}
3499
3500DEFUN (neighbor_interface,
3501 neighbor_interface_cmd,
3502 NEIGHBOR_CMD "interface WORD",
3503 NEIGHBOR_STR
3504 NEIGHBOR_ADDR_STR
3505 "Interface\n"
3506 "Interface name\n")
3507{
3508 return peer_interface_vty (vty, argv[0], argv[1]);
3509}
3510
3511DEFUN (no_neighbor_interface,
3512 no_neighbor_interface_cmd,
3513 NO_NEIGHBOR_CMD "interface WORD",
3514 NO_STR
3515 NEIGHBOR_STR
3516 NEIGHBOR_ADDR_STR
3517 "Interface\n"
3518 "Interface name\n")
3519{
3520 return peer_interface_vty (vty, argv[0], NULL);
3521}
David Lamparter6b0655a2014-06-04 06:53:35 +02003522
paul718e3742002-12-13 20:15:29 +00003523/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003524static int
paulfd79ac92004-10-13 05:06:08 +00003525peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3526 afi_t afi, safi_t safi,
3527 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003528{
3529 int ret;
3530 struct peer *peer;
3531 int direct = FILTER_IN;
3532
3533 peer = peer_and_group_lookup_vty (vty, ip_str);
3534 if (! peer)
3535 return CMD_WARNING;
3536
3537 /* Check filter direction. */
3538 if (strncmp (direct_str, "i", 1) == 0)
3539 direct = FILTER_IN;
3540 else if (strncmp (direct_str, "o", 1) == 0)
3541 direct = FILTER_OUT;
3542
3543 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3544
3545 return bgp_vty_return (vty, ret);
3546}
3547
paul94f2b392005-06-28 12:44:16 +00003548static int
paulfd79ac92004-10-13 05:06:08 +00003549peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3550 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003551{
3552 int ret;
3553 struct peer *peer;
3554 int direct = FILTER_IN;
3555
3556 peer = peer_and_group_lookup_vty (vty, ip_str);
3557 if (! peer)
3558 return CMD_WARNING;
3559
3560 /* Check filter direction. */
3561 if (strncmp (direct_str, "i", 1) == 0)
3562 direct = FILTER_IN;
3563 else if (strncmp (direct_str, "o", 1) == 0)
3564 direct = FILTER_OUT;
3565
3566 ret = peer_distribute_unset (peer, afi, safi, direct);
3567
3568 return bgp_vty_return (vty, ret);
3569}
3570
3571DEFUN (neighbor_distribute_list,
3572 neighbor_distribute_list_cmd,
3573 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3574 NEIGHBOR_STR
3575 NEIGHBOR_ADDR_STR2
3576 "Filter updates to/from this neighbor\n"
3577 "IP access-list number\n"
3578 "IP access-list number (expanded range)\n"
3579 "IP Access-list name\n"
3580 "Filter incoming updates\n"
3581 "Filter outgoing updates\n")
3582{
3583 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3584 bgp_node_safi (vty), argv[1], argv[2]);
3585}
3586
3587DEFUN (no_neighbor_distribute_list,
3588 no_neighbor_distribute_list_cmd,
3589 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3590 NO_STR
3591 NEIGHBOR_STR
3592 NEIGHBOR_ADDR_STR2
3593 "Filter updates to/from this neighbor\n"
3594 "IP access-list number\n"
3595 "IP access-list number (expanded range)\n"
3596 "IP Access-list name\n"
3597 "Filter incoming updates\n"
3598 "Filter outgoing updates\n")
3599{
3600 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3601 bgp_node_safi (vty), argv[2]);
3602}
David Lamparter6b0655a2014-06-04 06:53:35 +02003603
paul718e3742002-12-13 20:15:29 +00003604/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003605static int
paulfd79ac92004-10-13 05:06:08 +00003606peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3607 safi_t safi, const char *name_str,
3608 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003609{
3610 int ret;
3611 struct peer *peer;
3612 int direct = FILTER_IN;
3613
3614 peer = peer_and_group_lookup_vty (vty, ip_str);
3615 if (! peer)
3616 return CMD_WARNING;
3617
3618 /* Check filter direction. */
3619 if (strncmp (direct_str, "i", 1) == 0)
3620 direct = FILTER_IN;
3621 else if (strncmp (direct_str, "o", 1) == 0)
3622 direct = FILTER_OUT;
3623
3624 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3625
3626 return bgp_vty_return (vty, ret);
3627}
3628
paul94f2b392005-06-28 12:44:16 +00003629static int
paulfd79ac92004-10-13 05:06:08 +00003630peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3631 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003632{
3633 int ret;
3634 struct peer *peer;
3635 int direct = FILTER_IN;
3636
3637 peer = peer_and_group_lookup_vty (vty, ip_str);
3638 if (! peer)
3639 return CMD_WARNING;
3640
3641 /* Check filter direction. */
3642 if (strncmp (direct_str, "i", 1) == 0)
3643 direct = FILTER_IN;
3644 else if (strncmp (direct_str, "o", 1) == 0)
3645 direct = FILTER_OUT;
3646
3647 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3648
3649 return bgp_vty_return (vty, ret);
3650}
3651
3652DEFUN (neighbor_prefix_list,
3653 neighbor_prefix_list_cmd,
3654 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3655 NEIGHBOR_STR
3656 NEIGHBOR_ADDR_STR2
3657 "Filter updates to/from this neighbor\n"
3658 "Name of a prefix list\n"
3659 "Filter incoming updates\n"
3660 "Filter outgoing updates\n")
3661{
3662 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3663 bgp_node_safi (vty), argv[1], argv[2]);
3664}
3665
3666DEFUN (no_neighbor_prefix_list,
3667 no_neighbor_prefix_list_cmd,
3668 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3669 NO_STR
3670 NEIGHBOR_STR
3671 NEIGHBOR_ADDR_STR2
3672 "Filter updates to/from this neighbor\n"
3673 "Name of a prefix list\n"
3674 "Filter incoming updates\n"
3675 "Filter outgoing updates\n")
3676{
3677 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3678 bgp_node_safi (vty), argv[2]);
3679}
David Lamparter6b0655a2014-06-04 06:53:35 +02003680
paul94f2b392005-06-28 12:44:16 +00003681static int
paulfd79ac92004-10-13 05:06:08 +00003682peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3683 afi_t afi, safi_t safi,
3684 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003685{
3686 int ret;
3687 struct peer *peer;
3688 int direct = FILTER_IN;
3689
3690 peer = peer_and_group_lookup_vty (vty, ip_str);
3691 if (! peer)
3692 return CMD_WARNING;
3693
3694 /* Check filter direction. */
3695 if (strncmp (direct_str, "i", 1) == 0)
3696 direct = FILTER_IN;
3697 else if (strncmp (direct_str, "o", 1) == 0)
3698 direct = FILTER_OUT;
3699
3700 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3701
3702 return bgp_vty_return (vty, ret);
3703}
3704
paul94f2b392005-06-28 12:44:16 +00003705static int
paulfd79ac92004-10-13 05:06:08 +00003706peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3707 afi_t afi, safi_t safi,
3708 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003709{
3710 int ret;
3711 struct peer *peer;
3712 int direct = FILTER_IN;
3713
3714 peer = peer_and_group_lookup_vty (vty, ip_str);
3715 if (! peer)
3716 return CMD_WARNING;
3717
3718 /* Check filter direction. */
3719 if (strncmp (direct_str, "i", 1) == 0)
3720 direct = FILTER_IN;
3721 else if (strncmp (direct_str, "o", 1) == 0)
3722 direct = FILTER_OUT;
3723
3724 ret = peer_aslist_unset (peer, afi, safi, direct);
3725
3726 return bgp_vty_return (vty, ret);
3727}
3728
3729DEFUN (neighbor_filter_list,
3730 neighbor_filter_list_cmd,
3731 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3732 NEIGHBOR_STR
3733 NEIGHBOR_ADDR_STR2
3734 "Establish BGP filters\n"
3735 "AS path access-list name\n"
3736 "Filter incoming routes\n"
3737 "Filter outgoing routes\n")
3738{
3739 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3740 bgp_node_safi (vty), argv[1], argv[2]);
3741}
3742
3743DEFUN (no_neighbor_filter_list,
3744 no_neighbor_filter_list_cmd,
3745 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3746 NO_STR
3747 NEIGHBOR_STR
3748 NEIGHBOR_ADDR_STR2
3749 "Establish BGP filters\n"
3750 "AS path access-list name\n"
3751 "Filter incoming routes\n"
3752 "Filter outgoing routes\n")
3753{
3754 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3755 bgp_node_safi (vty), argv[2]);
3756}
David Lamparter6b0655a2014-06-04 06:53:35 +02003757
paul718e3742002-12-13 20:15:29 +00003758/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003759static int
paulfd79ac92004-10-13 05:06:08 +00003760peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3761 afi_t afi, safi_t safi,
3762 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003763{
3764 int ret;
3765 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003766 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003767
3768 peer = peer_and_group_lookup_vty (vty, ip_str);
3769 if (! peer)
3770 return CMD_WARNING;
3771
3772 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003773 if (strncmp (direct_str, "in", 2) == 0)
3774 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003775 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003776 direct = RMAP_OUT;
3777 else if (strncmp (direct_str, "im", 2) == 0)
3778 direct = RMAP_IMPORT;
3779 else if (strncmp (direct_str, "e", 1) == 0)
3780 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003781
3782 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3783
3784 return bgp_vty_return (vty, ret);
3785}
3786
paul94f2b392005-06-28 12:44:16 +00003787static int
paulfd79ac92004-10-13 05:06:08 +00003788peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3789 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003790{
3791 int ret;
3792 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003793 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003794
3795 peer = peer_and_group_lookup_vty (vty, ip_str);
3796 if (! peer)
3797 return CMD_WARNING;
3798
3799 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003800 if (strncmp (direct_str, "in", 2) == 0)
3801 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003802 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003803 direct = RMAP_OUT;
3804 else if (strncmp (direct_str, "im", 2) == 0)
3805 direct = RMAP_IMPORT;
3806 else if (strncmp (direct_str, "e", 1) == 0)
3807 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003808
3809 ret = peer_route_map_unset (peer, afi, safi, direct);
3810
3811 return bgp_vty_return (vty, ret);
3812}
3813
3814DEFUN (neighbor_route_map,
3815 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003816 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003817 NEIGHBOR_STR
3818 NEIGHBOR_ADDR_STR2
3819 "Apply route map to neighbor\n"
3820 "Name of route map\n"
3821 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003822 "Apply map to outbound routes\n"
3823 "Apply map to routes going into a Route-Server client's table\n"
3824 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003825{
3826 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3827 bgp_node_safi (vty), argv[1], argv[2]);
3828}
3829
3830DEFUN (no_neighbor_route_map,
3831 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003832 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003833 NO_STR
3834 NEIGHBOR_STR
3835 NEIGHBOR_ADDR_STR2
3836 "Apply route map to neighbor\n"
3837 "Name of route map\n"
3838 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003839 "Apply map to outbound routes\n"
3840 "Apply map to routes going into a Route-Server client's table\n"
3841 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003842{
3843 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3844 bgp_node_safi (vty), argv[2]);
3845}
David Lamparter6b0655a2014-06-04 06:53:35 +02003846
paul718e3742002-12-13 20:15:29 +00003847/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003848static int
paulfd79ac92004-10-13 05:06:08 +00003849peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3850 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003851{
3852 int ret;
3853 struct peer *peer;
3854
3855 peer = peer_and_group_lookup_vty (vty, ip_str);
3856 if (! peer)
3857 return CMD_WARNING;
3858
3859 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3860
3861 return bgp_vty_return (vty, ret);
3862}
3863
3864/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003865static int
paulfd79ac92004-10-13 05:06:08 +00003866peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003867 safi_t safi)
3868{
3869 int ret;
3870 struct peer *peer;
3871
3872 peer = peer_and_group_lookup_vty (vty, ip_str);
3873 if (! peer)
3874 return CMD_WARNING;
3875
3876 ret = peer_unsuppress_map_unset (peer, afi, safi);
3877
3878 return bgp_vty_return (vty, ret);
3879}
3880
3881DEFUN (neighbor_unsuppress_map,
3882 neighbor_unsuppress_map_cmd,
3883 NEIGHBOR_CMD2 "unsuppress-map WORD",
3884 NEIGHBOR_STR
3885 NEIGHBOR_ADDR_STR2
3886 "Route-map to selectively unsuppress suppressed routes\n"
3887 "Name of route map\n")
3888{
3889 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3890 bgp_node_safi (vty), argv[1]);
3891}
3892
3893DEFUN (no_neighbor_unsuppress_map,
3894 no_neighbor_unsuppress_map_cmd,
3895 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3896 NO_STR
3897 NEIGHBOR_STR
3898 NEIGHBOR_ADDR_STR2
3899 "Route-map to selectively unsuppress suppressed routes\n"
3900 "Name of route map\n")
3901{
3902 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3903 bgp_node_safi (vty));
3904}
David Lamparter6b0655a2014-06-04 06:53:35 +02003905
paul94f2b392005-06-28 12:44:16 +00003906static int
paulfd79ac92004-10-13 05:06:08 +00003907peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3908 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003909 const char *threshold_str, int warning,
3910 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003911{
3912 int ret;
3913 struct peer *peer;
3914 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003915 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003916 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003917
3918 peer = peer_and_group_lookup_vty (vty, ip_str);
3919 if (! peer)
3920 return CMD_WARNING;
3921
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04003922 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003923 if (threshold_str)
3924 threshold = atoi (threshold_str);
3925 else
3926 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00003927
hasso0a486e52005-02-01 20:57:17 +00003928 if (restart_str)
3929 restart = atoi (restart_str);
3930 else
3931 restart = 0;
3932
3933 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00003934
3935 return bgp_vty_return (vty, ret);
3936}
3937
paul94f2b392005-06-28 12:44:16 +00003938static int
paulfd79ac92004-10-13 05:06:08 +00003939peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003940 safi_t safi)
3941{
3942 int ret;
3943 struct peer *peer;
3944
3945 peer = peer_and_group_lookup_vty (vty, ip_str);
3946 if (! peer)
3947 return CMD_WARNING;
3948
3949 ret = peer_maximum_prefix_unset (peer, afi, safi);
3950
3951 return bgp_vty_return (vty, ret);
3952}
3953
3954/* Maximum number of prefix configuration. prefix count is different
3955 for each peer configuration. So this configuration can be set for
3956 each peer configuration. */
3957DEFUN (neighbor_maximum_prefix,
3958 neighbor_maximum_prefix_cmd,
3959 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3960 NEIGHBOR_STR
3961 NEIGHBOR_ADDR_STR2
3962 "Maximum number of prefix accept from this peer\n"
3963 "maximum no. of prefix limit\n")
3964{
3965 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003966 bgp_node_safi (vty), argv[1], NULL, 0,
3967 NULL);
paul718e3742002-12-13 20:15:29 +00003968}
3969
hassoe0701b72004-05-20 09:19:34 +00003970DEFUN (neighbor_maximum_prefix_threshold,
3971 neighbor_maximum_prefix_threshold_cmd,
3972 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
3973 NEIGHBOR_STR
3974 NEIGHBOR_ADDR_STR2
3975 "Maximum number of prefix accept from this peer\n"
3976 "maximum no. of prefix limit\n"
3977 "Threshold value (%) at which to generate a warning msg\n")
3978{
3979 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003980 bgp_node_safi (vty), argv[1], argv[2], 0,
3981 NULL);
3982}
hassoe0701b72004-05-20 09:19:34 +00003983
paul718e3742002-12-13 20:15:29 +00003984DEFUN (neighbor_maximum_prefix_warning,
3985 neighbor_maximum_prefix_warning_cmd,
3986 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3987 NEIGHBOR_STR
3988 NEIGHBOR_ADDR_STR2
3989 "Maximum number of prefix accept from this peer\n"
3990 "maximum no. of prefix limit\n"
3991 "Only give warning message when limit is exceeded\n")
3992{
3993 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003994 bgp_node_safi (vty), argv[1], NULL, 1,
3995 NULL);
paul718e3742002-12-13 20:15:29 +00003996}
3997
hassoe0701b72004-05-20 09:19:34 +00003998DEFUN (neighbor_maximum_prefix_threshold_warning,
3999 neighbor_maximum_prefix_threshold_warning_cmd,
4000 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4001 NEIGHBOR_STR
4002 NEIGHBOR_ADDR_STR2
4003 "Maximum number of prefix accept from this peer\n"
4004 "maximum no. of prefix limit\n"
4005 "Threshold value (%) at which to generate a warning msg\n"
4006 "Only give warning message when limit is exceeded\n")
4007{
4008 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004009 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4010}
4011
4012DEFUN (neighbor_maximum_prefix_restart,
4013 neighbor_maximum_prefix_restart_cmd,
4014 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
4015 NEIGHBOR_STR
4016 NEIGHBOR_ADDR_STR2
4017 "Maximum number of prefix accept from this peer\n"
4018 "maximum no. of prefix limit\n"
4019 "Restart bgp connection after limit is exceeded\n"
4020 "Restart interval in minutes")
4021{
4022 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4023 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
4024}
4025
4026DEFUN (neighbor_maximum_prefix_threshold_restart,
4027 neighbor_maximum_prefix_threshold_restart_cmd,
4028 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4029 NEIGHBOR_STR
4030 NEIGHBOR_ADDR_STR2
4031 "Maximum number of prefix accept from this peer\n"
4032 "maximum no. of prefix limit\n"
4033 "Threshold value (%) at which to generate a warning msg\n"
4034 "Restart bgp connection after limit is exceeded\n"
4035 "Restart interval in minutes")
4036{
4037 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4038 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4039}
hassoe0701b72004-05-20 09:19:34 +00004040
paul718e3742002-12-13 20:15:29 +00004041DEFUN (no_neighbor_maximum_prefix,
4042 no_neighbor_maximum_prefix_cmd,
4043 NO_NEIGHBOR_CMD2 "maximum-prefix",
4044 NO_STR
4045 NEIGHBOR_STR
4046 NEIGHBOR_ADDR_STR2
4047 "Maximum number of prefix accept from this peer\n")
4048{
4049 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4050 bgp_node_safi (vty));
4051}
4052
4053ALIAS (no_neighbor_maximum_prefix,
4054 no_neighbor_maximum_prefix_val_cmd,
4055 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4056 NO_STR
4057 NEIGHBOR_STR
4058 NEIGHBOR_ADDR_STR2
4059 "Maximum number of prefix accept from this peer\n"
4060 "maximum no. of prefix limit\n")
4061
4062ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004063 no_neighbor_maximum_prefix_threshold_cmd,
4064 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4065 NO_STR
4066 NEIGHBOR_STR
4067 NEIGHBOR_ADDR_STR2
4068 "Maximum number of prefix accept from this peer\n"
4069 "maximum no. of prefix limit\n"
4070 "Threshold value (%) at which to generate a warning msg\n")
4071
4072ALIAS (no_neighbor_maximum_prefix,
4073 no_neighbor_maximum_prefix_warning_cmd,
4074 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4075 NO_STR
4076 NEIGHBOR_STR
4077 NEIGHBOR_ADDR_STR2
4078 "Maximum number of prefix accept from this peer\n"
4079 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00004080 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004081
4082ALIAS (no_neighbor_maximum_prefix,
4083 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004084 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4085 NO_STR
4086 NEIGHBOR_STR
4087 NEIGHBOR_ADDR_STR2
4088 "Maximum number of prefix accept from this peer\n"
4089 "maximum no. of prefix limit\n"
4090 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004091 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004092
4093ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004094 no_neighbor_maximum_prefix_restart_cmd,
4095 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004096 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"
hasso0a486e52005-02-01 20:57:17 +00004101 "Restart bgp connection after limit is exceeded\n"
4102 "Restart interval in minutes")
4103
4104ALIAS (no_neighbor_maximum_prefix,
4105 no_neighbor_maximum_prefix_threshold_restart_cmd,
4106 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4107 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"
4112 "Threshold value (%) at which to generate a warning msg\n"
4113 "Restart bgp connection after limit is exceeded\n"
4114 "Restart interval in minutes")
David Lamparter6b0655a2014-06-04 06:53:35 +02004115
paul718e3742002-12-13 20:15:29 +00004116/* "neighbor allowas-in" */
4117DEFUN (neighbor_allowas_in,
4118 neighbor_allowas_in_cmd,
4119 NEIGHBOR_CMD2 "allowas-in",
4120 NEIGHBOR_STR
4121 NEIGHBOR_ADDR_STR2
4122 "Accept as-path with my AS present in it\n")
4123{
4124 int ret;
4125 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004126 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004127
4128 peer = peer_and_group_lookup_vty (vty, argv[0]);
4129 if (! peer)
4130 return CMD_WARNING;
4131
4132 if (argc == 1)
4133 allow_num = 3;
4134 else
4135 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4136
4137 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4138 allow_num);
4139
4140 return bgp_vty_return (vty, ret);
4141}
4142
4143ALIAS (neighbor_allowas_in,
4144 neighbor_allowas_in_arg_cmd,
4145 NEIGHBOR_CMD2 "allowas-in <1-10>",
4146 NEIGHBOR_STR
4147 NEIGHBOR_ADDR_STR2
4148 "Accept as-path with my AS present in it\n"
4149 "Number of occurances of AS number\n")
4150
4151DEFUN (no_neighbor_allowas_in,
4152 no_neighbor_allowas_in_cmd,
4153 NO_NEIGHBOR_CMD2 "allowas-in",
4154 NO_STR
4155 NEIGHBOR_STR
4156 NEIGHBOR_ADDR_STR2
4157 "allow local ASN appears in aspath attribute\n")
4158{
4159 int ret;
4160 struct peer *peer;
4161
4162 peer = peer_and_group_lookup_vty (vty, argv[0]);
4163 if (! peer)
4164 return CMD_WARNING;
4165
4166 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4167
4168 return bgp_vty_return (vty, ret);
4169}
David Lamparter6b0655a2014-06-04 06:53:35 +02004170
Nick Hilliardfa411a22011-03-23 15:33:17 +00004171DEFUN (neighbor_ttl_security,
4172 neighbor_ttl_security_cmd,
4173 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4174 NEIGHBOR_STR
4175 NEIGHBOR_ADDR_STR2
4176 "Specify the maximum number of hops to the BGP peer\n")
4177{
4178 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004179 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004180
4181 peer = peer_and_group_lookup_vty (vty, argv[0]);
4182 if (! peer)
4183 return CMD_WARNING;
4184
4185 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4186
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004187 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004188}
4189
4190DEFUN (no_neighbor_ttl_security,
4191 no_neighbor_ttl_security_cmd,
4192 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4193 NO_STR
4194 NEIGHBOR_STR
4195 NEIGHBOR_ADDR_STR2
4196 "Specify the maximum number of hops to the BGP peer\n")
4197{
4198 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004199
4200 peer = peer_and_group_lookup_vty (vty, argv[0]);
4201 if (! peer)
4202 return CMD_WARNING;
4203
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004204 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004205}
David Lamparter6b0655a2014-06-04 06:53:35 +02004206
paul718e3742002-12-13 20:15:29 +00004207/* Address family configuration. */
4208DEFUN (address_family_ipv4,
4209 address_family_ipv4_cmd,
4210 "address-family ipv4",
4211 "Enter Address Family command mode\n"
4212 "Address family\n")
4213{
4214 vty->node = BGP_IPV4_NODE;
4215 return CMD_SUCCESS;
4216}
4217
4218DEFUN (address_family_ipv4_safi,
4219 address_family_ipv4_safi_cmd,
4220 "address-family ipv4 (unicast|multicast)",
4221 "Enter Address Family command mode\n"
4222 "Address family\n"
4223 "Address Family modifier\n"
4224 "Address Family modifier\n")
4225{
4226 if (strncmp (argv[0], "m", 1) == 0)
4227 vty->node = BGP_IPV4M_NODE;
4228 else
4229 vty->node = BGP_IPV4_NODE;
4230
4231 return CMD_SUCCESS;
4232}
4233
paul25ffbdc2005-08-22 22:42:08 +00004234DEFUN (address_family_ipv6,
4235 address_family_ipv6_cmd,
4236 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004237 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004238 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004239{
4240 vty->node = BGP_IPV6_NODE;
4241 return CMD_SUCCESS;
4242}
4243
paul25ffbdc2005-08-22 22:42:08 +00004244DEFUN (address_family_ipv6_safi,
4245 address_family_ipv6_safi_cmd,
4246 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004247 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004248 "Address family\n"
4249 "Address Family modifier\n"
4250 "Address Family modifier\n")
4251{
4252 if (strncmp (argv[0], "m", 1) == 0)
4253 vty->node = BGP_IPV6M_NODE;
4254 else
4255 vty->node = BGP_IPV6_NODE;
4256
4257 return CMD_SUCCESS;
4258}
paul718e3742002-12-13 20:15:29 +00004259
4260DEFUN (address_family_vpnv4,
4261 address_family_vpnv4_cmd,
4262 "address-family vpnv4",
4263 "Enter Address Family command mode\n"
4264 "Address family\n")
4265{
4266 vty->node = BGP_VPNV4_NODE;
4267 return CMD_SUCCESS;
4268}
4269
4270ALIAS (address_family_vpnv4,
4271 address_family_vpnv4_unicast_cmd,
4272 "address-family vpnv4 unicast",
4273 "Enter Address Family command mode\n"
4274 "Address family\n"
4275 "Address Family Modifier\n")
4276
4277DEFUN (exit_address_family,
4278 exit_address_family_cmd,
4279 "exit-address-family",
4280 "Exit from Address Family configuration mode\n")
4281{
hassoa8a80d52005-04-09 13:07:47 +00004282 if (vty->node == BGP_IPV4_NODE
4283 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004284 || vty->node == BGP_VPNV4_NODE
paul25ffbdc2005-08-22 22:42:08 +00004285 || vty->node == BGP_IPV6_NODE
4286 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004287 vty->node = BGP_NODE;
4288 return CMD_SUCCESS;
4289}
David Lamparter6b0655a2014-06-04 06:53:35 +02004290
paul718e3742002-12-13 20:15:29 +00004291/* BGP clear sort. */
4292enum clear_sort
4293{
4294 clear_all,
4295 clear_peer,
4296 clear_group,
4297 clear_external,
4298 clear_as
4299};
4300
paul94f2b392005-06-28 12:44:16 +00004301static void
paul718e3742002-12-13 20:15:29 +00004302bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4303 safi_t safi, int error)
4304{
4305 switch (error)
4306 {
4307 case BGP_ERR_AF_UNCONFIGURED:
4308 vty_out (vty,
4309 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4310 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4311 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4312 peer->host, VTY_NEWLINE);
4313 break;
4314 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4315 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);
4316 break;
4317 default:
4318 break;
4319 }
4320}
4321
4322/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004323static int
paul718e3742002-12-13 20:15:29 +00004324bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004325 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004326{
4327 int ret;
4328 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004329 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004330
4331 /* Clear all neighbors. */
4332 if (sort == clear_all)
4333 {
paul1eb8ef22005-04-07 07:30:20 +00004334 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004335 {
4336 if (stype == BGP_CLEAR_SOFT_NONE)
4337 ret = peer_clear (peer);
4338 else
4339 ret = peer_clear_soft (peer, afi, safi, stype);
4340
4341 if (ret < 0)
4342 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4343 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004344 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004345 }
4346
4347 /* Clear specified neighbors. */
4348 if (sort == clear_peer)
4349 {
4350 union sockunion su;
4351 int ret;
4352
4353 /* Make sockunion for lookup. */
4354 ret = str2sockunion (arg, &su);
4355 if (ret < 0)
4356 {
4357 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004358 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004359 }
4360 peer = peer_lookup (bgp, &su);
4361 if (! peer)
4362 {
4363 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004364 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004365 }
4366
4367 if (stype == BGP_CLEAR_SOFT_NONE)
4368 ret = peer_clear (peer);
4369 else
4370 ret = peer_clear_soft (peer, afi, safi, stype);
4371
4372 if (ret < 0)
4373 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4374
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004375 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004376 }
4377
4378 /* Clear all peer-group members. */
4379 if (sort == clear_group)
4380 {
4381 struct peer_group *group;
4382
4383 group = peer_group_lookup (bgp, arg);
4384 if (! group)
4385 {
4386 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004387 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004388 }
4389
paul1eb8ef22005-04-07 07:30:20 +00004390 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004391 {
4392 if (stype == BGP_CLEAR_SOFT_NONE)
4393 {
4394 ret = peer_clear (peer);
4395 continue;
4396 }
4397
4398 if (! peer->af_group[afi][safi])
4399 continue;
4400
4401 ret = peer_clear_soft (peer, afi, safi, stype);
4402
4403 if (ret < 0)
4404 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4405 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004406 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004407 }
4408
4409 if (sort == clear_external)
4410 {
paul1eb8ef22005-04-07 07:30:20 +00004411 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004412 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004413 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004414 continue;
4415
4416 if (stype == BGP_CLEAR_SOFT_NONE)
4417 ret = peer_clear (peer);
4418 else
4419 ret = peer_clear_soft (peer, afi, safi, stype);
4420
4421 if (ret < 0)
4422 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4423 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004424 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004425 }
4426
4427 if (sort == clear_as)
4428 {
4429 as_t as;
paul718e3742002-12-13 20:15:29 +00004430 int find = 0;
4431
Ulrich Weberbde12e32011-11-16 19:32:12 +04004432 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004433
paul1eb8ef22005-04-07 07:30:20 +00004434 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004435 {
4436 if (peer->as != as)
4437 continue;
4438
4439 find = 1;
4440 if (stype == BGP_CLEAR_SOFT_NONE)
4441 ret = peer_clear (peer);
4442 else
4443 ret = peer_clear_soft (peer, afi, safi, stype);
4444
4445 if (ret < 0)
4446 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4447 }
4448 if (! find)
4449 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4450 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004451 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004452 }
4453
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004454 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004455}
4456
paul94f2b392005-06-28 12:44:16 +00004457static int
paulfd79ac92004-10-13 05:06:08 +00004458bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4459 enum clear_sort sort, enum bgp_clear_type stype,
4460 const char *arg)
paul718e3742002-12-13 20:15:29 +00004461{
paul718e3742002-12-13 20:15:29 +00004462 struct bgp *bgp;
4463
4464 /* BGP structure lookup. */
4465 if (name)
4466 {
4467 bgp = bgp_lookup_by_name (name);
4468 if (bgp == NULL)
4469 {
4470 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4471 return CMD_WARNING;
4472 }
4473 }
4474 else
4475 {
4476 bgp = bgp_get_default ();
4477 if (bgp == NULL)
4478 {
4479 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4480 return CMD_WARNING;
4481 }
4482 }
4483
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004484 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004485}
4486
4487DEFUN (clear_ip_bgp_all,
4488 clear_ip_bgp_all_cmd,
4489 "clear ip bgp *",
4490 CLEAR_STR
4491 IP_STR
4492 BGP_STR
4493 "Clear all peers\n")
4494{
4495 if (argc == 1)
4496 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4497
4498 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4499}
4500
4501ALIAS (clear_ip_bgp_all,
4502 clear_bgp_all_cmd,
4503 "clear bgp *",
4504 CLEAR_STR
4505 BGP_STR
4506 "Clear all peers\n")
4507
4508ALIAS (clear_ip_bgp_all,
4509 clear_bgp_ipv6_all_cmd,
4510 "clear bgp ipv6 *",
4511 CLEAR_STR
4512 BGP_STR
4513 "Address family\n"
4514 "Clear all peers\n")
4515
4516ALIAS (clear_ip_bgp_all,
4517 clear_ip_bgp_instance_all_cmd,
4518 "clear ip bgp view WORD *",
4519 CLEAR_STR
4520 IP_STR
4521 BGP_STR
4522 "BGP view\n"
4523 "view name\n"
4524 "Clear all peers\n")
4525
4526ALIAS (clear_ip_bgp_all,
4527 clear_bgp_instance_all_cmd,
4528 "clear bgp view WORD *",
4529 CLEAR_STR
4530 BGP_STR
4531 "BGP view\n"
4532 "view name\n"
4533 "Clear all peers\n")
4534
4535DEFUN (clear_ip_bgp_peer,
4536 clear_ip_bgp_peer_cmd,
4537 "clear ip bgp (A.B.C.D|X:X::X:X)",
4538 CLEAR_STR
4539 IP_STR
4540 BGP_STR
4541 "BGP neighbor IP address to clear\n"
4542 "BGP IPv6 neighbor to clear\n")
4543{
4544 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4545}
4546
4547ALIAS (clear_ip_bgp_peer,
4548 clear_bgp_peer_cmd,
4549 "clear bgp (A.B.C.D|X:X::X:X)",
4550 CLEAR_STR
4551 BGP_STR
4552 "BGP neighbor address to clear\n"
4553 "BGP IPv6 neighbor to clear\n")
4554
4555ALIAS (clear_ip_bgp_peer,
4556 clear_bgp_ipv6_peer_cmd,
4557 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4558 CLEAR_STR
4559 BGP_STR
4560 "Address family\n"
4561 "BGP neighbor address to clear\n"
4562 "BGP IPv6 neighbor to clear\n")
4563
4564DEFUN (clear_ip_bgp_peer_group,
4565 clear_ip_bgp_peer_group_cmd,
4566 "clear ip bgp peer-group WORD",
4567 CLEAR_STR
4568 IP_STR
4569 BGP_STR
4570 "Clear all members of peer-group\n"
4571 "BGP peer-group name\n")
4572{
4573 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4574}
4575
4576ALIAS (clear_ip_bgp_peer_group,
4577 clear_bgp_peer_group_cmd,
4578 "clear bgp peer-group WORD",
4579 CLEAR_STR
4580 BGP_STR
4581 "Clear all members of peer-group\n"
4582 "BGP peer-group name\n")
4583
4584ALIAS (clear_ip_bgp_peer_group,
4585 clear_bgp_ipv6_peer_group_cmd,
4586 "clear bgp ipv6 peer-group WORD",
4587 CLEAR_STR
4588 BGP_STR
4589 "Address family\n"
4590 "Clear all members of peer-group\n"
4591 "BGP peer-group name\n")
4592
4593DEFUN (clear_ip_bgp_external,
4594 clear_ip_bgp_external_cmd,
4595 "clear ip bgp external",
4596 CLEAR_STR
4597 IP_STR
4598 BGP_STR
4599 "Clear all external peers\n")
4600{
4601 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4602}
4603
4604ALIAS (clear_ip_bgp_external,
4605 clear_bgp_external_cmd,
4606 "clear bgp external",
4607 CLEAR_STR
4608 BGP_STR
4609 "Clear all external peers\n")
4610
4611ALIAS (clear_ip_bgp_external,
4612 clear_bgp_ipv6_external_cmd,
4613 "clear bgp ipv6 external",
4614 CLEAR_STR
4615 BGP_STR
4616 "Address family\n"
4617 "Clear all external peers\n")
4618
4619DEFUN (clear_ip_bgp_as,
4620 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004621 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004622 CLEAR_STR
4623 IP_STR
4624 BGP_STR
4625 "Clear peers with the AS number\n")
4626{
4627 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4628}
4629
4630ALIAS (clear_ip_bgp_as,
4631 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004632 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004633 CLEAR_STR
4634 BGP_STR
4635 "Clear peers with the AS number\n")
4636
4637ALIAS (clear_ip_bgp_as,
4638 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004639 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004640 CLEAR_STR
4641 BGP_STR
4642 "Address family\n"
4643 "Clear peers with the AS number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02004644
paul718e3742002-12-13 20:15:29 +00004645/* Outbound soft-reconfiguration */
4646DEFUN (clear_ip_bgp_all_soft_out,
4647 clear_ip_bgp_all_soft_out_cmd,
4648 "clear ip bgp * soft out",
4649 CLEAR_STR
4650 IP_STR
4651 BGP_STR
4652 "Clear all peers\n"
4653 "Soft reconfig\n"
4654 "Soft reconfig outbound update\n")
4655{
4656 if (argc == 1)
4657 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4658 BGP_CLEAR_SOFT_OUT, NULL);
4659
4660 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4661 BGP_CLEAR_SOFT_OUT, NULL);
4662}
4663
4664ALIAS (clear_ip_bgp_all_soft_out,
4665 clear_ip_bgp_all_out_cmd,
4666 "clear ip bgp * out",
4667 CLEAR_STR
4668 IP_STR
4669 BGP_STR
4670 "Clear all peers\n"
4671 "Soft reconfig outbound update\n")
4672
4673ALIAS (clear_ip_bgp_all_soft_out,
4674 clear_ip_bgp_instance_all_soft_out_cmd,
4675 "clear ip bgp view WORD * soft out",
4676 CLEAR_STR
4677 IP_STR
4678 BGP_STR
4679 "BGP view\n"
4680 "view name\n"
4681 "Clear all peers\n"
4682 "Soft reconfig\n"
4683 "Soft reconfig outbound update\n")
4684
4685DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4686 clear_ip_bgp_all_ipv4_soft_out_cmd,
4687 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4688 CLEAR_STR
4689 IP_STR
4690 BGP_STR
4691 "Clear all peers\n"
4692 "Address family\n"
4693 "Address Family modifier\n"
4694 "Address Family modifier\n"
4695 "Soft reconfig\n"
4696 "Soft reconfig outbound update\n")
4697{
4698 if (strncmp (argv[0], "m", 1) == 0)
4699 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4700 BGP_CLEAR_SOFT_OUT, NULL);
4701
4702 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4703 BGP_CLEAR_SOFT_OUT, NULL);
4704}
4705
4706ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4707 clear_ip_bgp_all_ipv4_out_cmd,
4708 "clear ip bgp * ipv4 (unicast|multicast) out",
4709 CLEAR_STR
4710 IP_STR
4711 BGP_STR
4712 "Clear all peers\n"
4713 "Address family\n"
4714 "Address Family modifier\n"
4715 "Address Family modifier\n"
4716 "Soft reconfig outbound update\n")
4717
4718DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4719 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4720 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4721 CLEAR_STR
4722 IP_STR
4723 BGP_STR
4724 "BGP view\n"
4725 "view name\n"
4726 "Clear all peers\n"
4727 "Address family\n"
4728 "Address Family modifier\n"
4729 "Address Family modifier\n"
4730 "Soft reconfig outbound update\n")
4731{
4732 if (strncmp (argv[1], "m", 1) == 0)
4733 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4734 BGP_CLEAR_SOFT_OUT, NULL);
4735
4736 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4737 BGP_CLEAR_SOFT_OUT, NULL);
4738}
4739
4740DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4741 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4742 "clear ip bgp * vpnv4 unicast soft out",
4743 CLEAR_STR
4744 IP_STR
4745 BGP_STR
4746 "Clear all peers\n"
4747 "Address family\n"
4748 "Address Family Modifier\n"
4749 "Soft reconfig\n"
4750 "Soft reconfig outbound update\n")
4751{
4752 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4753 BGP_CLEAR_SOFT_OUT, NULL);
4754}
4755
4756ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4757 clear_ip_bgp_all_vpnv4_out_cmd,
4758 "clear ip bgp * vpnv4 unicast out",
4759 CLEAR_STR
4760 IP_STR
4761 BGP_STR
4762 "Clear all peers\n"
4763 "Address family\n"
4764 "Address Family Modifier\n"
4765 "Soft reconfig outbound update\n")
4766
4767DEFUN (clear_bgp_all_soft_out,
4768 clear_bgp_all_soft_out_cmd,
4769 "clear bgp * soft out",
4770 CLEAR_STR
4771 BGP_STR
4772 "Clear all peers\n"
4773 "Soft reconfig\n"
4774 "Soft reconfig outbound update\n")
4775{
4776 if (argc == 1)
4777 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4778 BGP_CLEAR_SOFT_OUT, NULL);
4779
4780 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4781 BGP_CLEAR_SOFT_OUT, NULL);
4782}
4783
4784ALIAS (clear_bgp_all_soft_out,
4785 clear_bgp_instance_all_soft_out_cmd,
4786 "clear bgp view WORD * soft out",
4787 CLEAR_STR
4788 BGP_STR
4789 "BGP view\n"
4790 "view name\n"
4791 "Clear all peers\n"
4792 "Soft reconfig\n"
4793 "Soft reconfig outbound update\n")
4794
4795ALIAS (clear_bgp_all_soft_out,
4796 clear_bgp_all_out_cmd,
4797 "clear bgp * out",
4798 CLEAR_STR
4799 BGP_STR
4800 "Clear all peers\n"
4801 "Soft reconfig outbound update\n")
4802
4803ALIAS (clear_bgp_all_soft_out,
4804 clear_bgp_ipv6_all_soft_out_cmd,
4805 "clear bgp ipv6 * soft out",
4806 CLEAR_STR
4807 BGP_STR
4808 "Address family\n"
4809 "Clear all peers\n"
4810 "Soft reconfig\n"
4811 "Soft reconfig outbound update\n")
4812
4813ALIAS (clear_bgp_all_soft_out,
4814 clear_bgp_ipv6_all_out_cmd,
4815 "clear bgp ipv6 * out",
4816 CLEAR_STR
4817 BGP_STR
4818 "Address family\n"
4819 "Clear all peers\n"
4820 "Soft reconfig outbound update\n")
4821
4822DEFUN (clear_ip_bgp_peer_soft_out,
4823 clear_ip_bgp_peer_soft_out_cmd,
4824 "clear ip bgp A.B.C.D soft out",
4825 CLEAR_STR
4826 IP_STR
4827 BGP_STR
4828 "BGP neighbor address to clear\n"
4829 "Soft reconfig\n"
4830 "Soft reconfig outbound update\n")
4831{
4832 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4833 BGP_CLEAR_SOFT_OUT, argv[0]);
4834}
4835
4836ALIAS (clear_ip_bgp_peer_soft_out,
4837 clear_ip_bgp_peer_out_cmd,
4838 "clear ip bgp A.B.C.D out",
4839 CLEAR_STR
4840 IP_STR
4841 BGP_STR
4842 "BGP neighbor address to clear\n"
4843 "Soft reconfig outbound update\n")
4844
4845DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4846 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4847 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4848 CLEAR_STR
4849 IP_STR
4850 BGP_STR
4851 "BGP neighbor address to clear\n"
4852 "Address family\n"
4853 "Address Family modifier\n"
4854 "Address Family modifier\n"
4855 "Soft reconfig\n"
4856 "Soft reconfig outbound update\n")
4857{
4858 if (strncmp (argv[1], "m", 1) == 0)
4859 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4860 BGP_CLEAR_SOFT_OUT, argv[0]);
4861
4862 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4863 BGP_CLEAR_SOFT_OUT, argv[0]);
4864}
4865
4866ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
4867 clear_ip_bgp_peer_ipv4_out_cmd,
4868 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
4869 CLEAR_STR
4870 IP_STR
4871 BGP_STR
4872 "BGP neighbor address to clear\n"
4873 "Address family\n"
4874 "Address Family modifier\n"
4875 "Address Family modifier\n"
4876 "Soft reconfig outbound update\n")
4877
4878DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
4879 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
4880 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
4881 CLEAR_STR
4882 IP_STR
4883 BGP_STR
4884 "BGP neighbor address to clear\n"
4885 "Address family\n"
4886 "Address Family Modifier\n"
4887 "Soft reconfig\n"
4888 "Soft reconfig outbound update\n")
4889{
4890 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
4891 BGP_CLEAR_SOFT_OUT, argv[0]);
4892}
4893
4894ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
4895 clear_ip_bgp_peer_vpnv4_out_cmd,
4896 "clear ip bgp A.B.C.D vpnv4 unicast out",
4897 CLEAR_STR
4898 IP_STR
4899 BGP_STR
4900 "BGP neighbor address to clear\n"
4901 "Address family\n"
4902 "Address Family Modifier\n"
4903 "Soft reconfig outbound update\n")
4904
4905DEFUN (clear_bgp_peer_soft_out,
4906 clear_bgp_peer_soft_out_cmd,
4907 "clear bgp (A.B.C.D|X:X::X:X) soft out",
4908 CLEAR_STR
4909 BGP_STR
4910 "BGP neighbor address to clear\n"
4911 "BGP IPv6 neighbor to clear\n"
4912 "Soft reconfig\n"
4913 "Soft reconfig outbound update\n")
4914{
4915 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
4916 BGP_CLEAR_SOFT_OUT, argv[0]);
4917}
4918
4919ALIAS (clear_bgp_peer_soft_out,
4920 clear_bgp_ipv6_peer_soft_out_cmd,
4921 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
4922 CLEAR_STR
4923 BGP_STR
4924 "Address family\n"
4925 "BGP neighbor address to clear\n"
4926 "BGP IPv6 neighbor to clear\n"
4927 "Soft reconfig\n"
4928 "Soft reconfig outbound update\n")
4929
4930ALIAS (clear_bgp_peer_soft_out,
4931 clear_bgp_peer_out_cmd,
4932 "clear bgp (A.B.C.D|X:X::X:X) out",
4933 CLEAR_STR
4934 BGP_STR
4935 "BGP neighbor address to clear\n"
4936 "BGP IPv6 neighbor to clear\n"
4937 "Soft reconfig outbound update\n")
4938
4939ALIAS (clear_bgp_peer_soft_out,
4940 clear_bgp_ipv6_peer_out_cmd,
4941 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
4942 CLEAR_STR
4943 BGP_STR
4944 "Address family\n"
4945 "BGP neighbor address to clear\n"
4946 "BGP IPv6 neighbor to clear\n"
4947 "Soft reconfig outbound update\n")
4948
4949DEFUN (clear_ip_bgp_peer_group_soft_out,
4950 clear_ip_bgp_peer_group_soft_out_cmd,
4951 "clear ip bgp peer-group WORD soft out",
4952 CLEAR_STR
4953 IP_STR
4954 BGP_STR
4955 "Clear all members of peer-group\n"
4956 "BGP peer-group name\n"
4957 "Soft reconfig\n"
4958 "Soft reconfig outbound update\n")
4959{
4960 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4961 BGP_CLEAR_SOFT_OUT, argv[0]);
4962}
4963
4964ALIAS (clear_ip_bgp_peer_group_soft_out,
4965 clear_ip_bgp_peer_group_out_cmd,
4966 "clear ip bgp peer-group WORD out",
4967 CLEAR_STR
4968 IP_STR
4969 BGP_STR
4970 "Clear all members of peer-group\n"
4971 "BGP peer-group name\n"
4972 "Soft reconfig outbound update\n")
4973
4974DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
4975 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
4976 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
4977 CLEAR_STR
4978 IP_STR
4979 BGP_STR
4980 "Clear all members of peer-group\n"
4981 "BGP peer-group name\n"
4982 "Address family\n"
4983 "Address Family modifier\n"
4984 "Address Family modifier\n"
4985 "Soft reconfig\n"
4986 "Soft reconfig outbound update\n")
4987{
4988 if (strncmp (argv[1], "m", 1) == 0)
4989 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
4990 BGP_CLEAR_SOFT_OUT, argv[0]);
4991
4992 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4993 BGP_CLEAR_SOFT_OUT, argv[0]);
4994}
4995
4996ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
4997 clear_ip_bgp_peer_group_ipv4_out_cmd,
4998 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
4999 CLEAR_STR
5000 IP_STR
5001 BGP_STR
5002 "Clear all members of peer-group\n"
5003 "BGP peer-group name\n"
5004 "Address family\n"
5005 "Address Family modifier\n"
5006 "Address Family modifier\n"
5007 "Soft reconfig outbound update\n")
5008
5009DEFUN (clear_bgp_peer_group_soft_out,
5010 clear_bgp_peer_group_soft_out_cmd,
5011 "clear bgp peer-group WORD soft out",
5012 CLEAR_STR
5013 BGP_STR
5014 "Clear all members of peer-group\n"
5015 "BGP peer-group name\n"
5016 "Soft reconfig\n"
5017 "Soft reconfig outbound update\n")
5018{
5019 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5020 BGP_CLEAR_SOFT_OUT, argv[0]);
5021}
5022
5023ALIAS (clear_bgp_peer_group_soft_out,
5024 clear_bgp_ipv6_peer_group_soft_out_cmd,
5025 "clear bgp ipv6 peer-group WORD soft out",
5026 CLEAR_STR
5027 BGP_STR
5028 "Address family\n"
5029 "Clear all members of peer-group\n"
5030 "BGP peer-group name\n"
5031 "Soft reconfig\n"
5032 "Soft reconfig outbound update\n")
5033
5034ALIAS (clear_bgp_peer_group_soft_out,
5035 clear_bgp_peer_group_out_cmd,
5036 "clear bgp peer-group WORD out",
5037 CLEAR_STR
5038 BGP_STR
5039 "Clear all members of peer-group\n"
5040 "BGP peer-group name\n"
5041 "Soft reconfig outbound update\n")
5042
5043ALIAS (clear_bgp_peer_group_soft_out,
5044 clear_bgp_ipv6_peer_group_out_cmd,
5045 "clear bgp ipv6 peer-group WORD out",
5046 CLEAR_STR
5047 BGP_STR
5048 "Address family\n"
5049 "Clear all members of peer-group\n"
5050 "BGP peer-group name\n"
5051 "Soft reconfig outbound update\n")
5052
5053DEFUN (clear_ip_bgp_external_soft_out,
5054 clear_ip_bgp_external_soft_out_cmd,
5055 "clear ip bgp external soft out",
5056 CLEAR_STR
5057 IP_STR
5058 BGP_STR
5059 "Clear all external peers\n"
5060 "Soft reconfig\n"
5061 "Soft reconfig outbound update\n")
5062{
5063 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5064 BGP_CLEAR_SOFT_OUT, NULL);
5065}
5066
5067ALIAS (clear_ip_bgp_external_soft_out,
5068 clear_ip_bgp_external_out_cmd,
5069 "clear ip bgp external out",
5070 CLEAR_STR
5071 IP_STR
5072 BGP_STR
5073 "Clear all external peers\n"
5074 "Soft reconfig outbound update\n")
5075
5076DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5077 clear_ip_bgp_external_ipv4_soft_out_cmd,
5078 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5079 CLEAR_STR
5080 IP_STR
5081 BGP_STR
5082 "Clear all external peers\n"
5083 "Address family\n"
5084 "Address Family modifier\n"
5085 "Address Family modifier\n"
5086 "Soft reconfig\n"
5087 "Soft reconfig outbound update\n")
5088{
5089 if (strncmp (argv[0], "m", 1) == 0)
5090 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5091 BGP_CLEAR_SOFT_OUT, NULL);
5092
5093 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5094 BGP_CLEAR_SOFT_OUT, NULL);
5095}
5096
5097ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5098 clear_ip_bgp_external_ipv4_out_cmd,
5099 "clear ip bgp external ipv4 (unicast|multicast) out",
5100 CLEAR_STR
5101 IP_STR
5102 BGP_STR
5103 "Clear all external peers\n"
5104 "Address family\n"
5105 "Address Family modifier\n"
5106 "Address Family modifier\n"
5107 "Soft reconfig outbound update\n")
5108
5109DEFUN (clear_bgp_external_soft_out,
5110 clear_bgp_external_soft_out_cmd,
5111 "clear bgp external soft out",
5112 CLEAR_STR
5113 BGP_STR
5114 "Clear all external peers\n"
5115 "Soft reconfig\n"
5116 "Soft reconfig outbound update\n")
5117{
5118 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5119 BGP_CLEAR_SOFT_OUT, NULL);
5120}
5121
5122ALIAS (clear_bgp_external_soft_out,
5123 clear_bgp_ipv6_external_soft_out_cmd,
5124 "clear bgp ipv6 external soft out",
5125 CLEAR_STR
5126 BGP_STR
5127 "Address family\n"
5128 "Clear all external peers\n"
5129 "Soft reconfig\n"
5130 "Soft reconfig outbound update\n")
5131
5132ALIAS (clear_bgp_external_soft_out,
5133 clear_bgp_external_out_cmd,
5134 "clear bgp external out",
5135 CLEAR_STR
5136 BGP_STR
5137 "Clear all external peers\n"
5138 "Soft reconfig outbound update\n")
5139
5140ALIAS (clear_bgp_external_soft_out,
5141 clear_bgp_ipv6_external_out_cmd,
5142 "clear bgp ipv6 external WORD out",
5143 CLEAR_STR
5144 BGP_STR
5145 "Address family\n"
5146 "Clear all external peers\n"
5147 "Soft reconfig outbound update\n")
5148
5149DEFUN (clear_ip_bgp_as_soft_out,
5150 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005151 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005152 CLEAR_STR
5153 IP_STR
5154 BGP_STR
5155 "Clear peers with the AS number\n"
5156 "Soft reconfig\n"
5157 "Soft reconfig outbound update\n")
5158{
5159 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5160 BGP_CLEAR_SOFT_OUT, argv[0]);
5161}
5162
5163ALIAS (clear_ip_bgp_as_soft_out,
5164 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005165 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005166 CLEAR_STR
5167 IP_STR
5168 BGP_STR
5169 "Clear peers with the AS number\n"
5170 "Soft reconfig outbound update\n")
5171
5172DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5173 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005174 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005175 CLEAR_STR
5176 IP_STR
5177 BGP_STR
5178 "Clear peers with the AS number\n"
5179 "Address family\n"
5180 "Address Family modifier\n"
5181 "Address Family modifier\n"
5182 "Soft reconfig\n"
5183 "Soft reconfig outbound update\n")
5184{
5185 if (strncmp (argv[1], "m", 1) == 0)
5186 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5187 BGP_CLEAR_SOFT_OUT, argv[0]);
5188
5189 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5190 BGP_CLEAR_SOFT_OUT, argv[0]);
5191}
5192
5193ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5194 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005195 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00005196 CLEAR_STR
5197 IP_STR
5198 BGP_STR
5199 "Clear peers with the AS number\n"
5200 "Address family\n"
5201 "Address Family modifier\n"
5202 "Address Family modifier\n"
5203 "Soft reconfig outbound update\n")
5204
5205DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5206 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005207 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00005208 CLEAR_STR
5209 IP_STR
5210 BGP_STR
5211 "Clear peers with the AS number\n"
5212 "Address family\n"
5213 "Address Family modifier\n"
5214 "Soft reconfig\n"
5215 "Soft reconfig outbound update\n")
5216{
5217 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5218 BGP_CLEAR_SOFT_OUT, argv[0]);
5219}
5220
5221ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5222 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005223 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005224 CLEAR_STR
5225 IP_STR
5226 BGP_STR
5227 "Clear peers with the AS number\n"
5228 "Address family\n"
5229 "Address Family modifier\n"
5230 "Soft reconfig outbound update\n")
5231
5232DEFUN (clear_bgp_as_soft_out,
5233 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005234 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005235 CLEAR_STR
5236 BGP_STR
5237 "Clear peers with the AS number\n"
5238 "Soft reconfig\n"
5239 "Soft reconfig outbound update\n")
5240{
5241 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5242 BGP_CLEAR_SOFT_OUT, argv[0]);
5243}
5244
5245ALIAS (clear_bgp_as_soft_out,
5246 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005247 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005248 CLEAR_STR
5249 BGP_STR
5250 "Address family\n"
5251 "Clear peers with the AS number\n"
5252 "Soft reconfig\n"
5253 "Soft reconfig outbound update\n")
5254
5255ALIAS (clear_bgp_as_soft_out,
5256 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005257 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005258 CLEAR_STR
5259 BGP_STR
5260 "Clear peers with the AS number\n"
5261 "Soft reconfig outbound update\n")
5262
5263ALIAS (clear_bgp_as_soft_out,
5264 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005265 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005266 CLEAR_STR
5267 BGP_STR
5268 "Address family\n"
5269 "Clear peers with the AS number\n"
5270 "Soft reconfig outbound update\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02005271
paul718e3742002-12-13 20:15:29 +00005272/* Inbound soft-reconfiguration */
5273DEFUN (clear_ip_bgp_all_soft_in,
5274 clear_ip_bgp_all_soft_in_cmd,
5275 "clear ip bgp * soft in",
5276 CLEAR_STR
5277 IP_STR
5278 BGP_STR
5279 "Clear all peers\n"
5280 "Soft reconfig\n"
5281 "Soft reconfig inbound update\n")
5282{
5283 if (argc == 1)
5284 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5285 BGP_CLEAR_SOFT_IN, NULL);
5286
5287 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5288 BGP_CLEAR_SOFT_IN, NULL);
5289}
5290
5291ALIAS (clear_ip_bgp_all_soft_in,
5292 clear_ip_bgp_instance_all_soft_in_cmd,
5293 "clear ip bgp view WORD * soft in",
5294 CLEAR_STR
5295 IP_STR
5296 BGP_STR
5297 "BGP view\n"
5298 "view name\n"
5299 "Clear all peers\n"
5300 "Soft reconfig\n"
5301 "Soft reconfig inbound update\n")
5302
5303ALIAS (clear_ip_bgp_all_soft_in,
5304 clear_ip_bgp_all_in_cmd,
5305 "clear ip bgp * in",
5306 CLEAR_STR
5307 IP_STR
5308 BGP_STR
5309 "Clear all peers\n"
5310 "Soft reconfig inbound update\n")
5311
5312DEFUN (clear_ip_bgp_all_in_prefix_filter,
5313 clear_ip_bgp_all_in_prefix_filter_cmd,
5314 "clear ip bgp * in prefix-filter",
5315 CLEAR_STR
5316 IP_STR
5317 BGP_STR
5318 "Clear all peers\n"
5319 "Soft reconfig inbound update\n"
5320 "Push out prefix-list ORF and do inbound soft reconfig\n")
5321{
5322 if (argc== 1)
5323 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5324 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5325
5326 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5327 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5328}
5329
5330ALIAS (clear_ip_bgp_all_in_prefix_filter,
5331 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5332 "clear ip bgp view WORD * in prefix-filter",
5333 CLEAR_STR
5334 IP_STR
5335 BGP_STR
5336 "BGP view\n"
5337 "view name\n"
5338 "Clear all peers\n"
5339 "Soft reconfig inbound update\n"
5340 "Push out prefix-list ORF and do inbound soft reconfig\n")
5341
5342
5343DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5344 clear_ip_bgp_all_ipv4_soft_in_cmd,
5345 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5346 CLEAR_STR
5347 IP_STR
5348 BGP_STR
5349 "Clear all peers\n"
5350 "Address family\n"
5351 "Address Family modifier\n"
5352 "Address Family modifier\n"
5353 "Soft reconfig\n"
5354 "Soft reconfig inbound update\n")
5355{
5356 if (strncmp (argv[0], "m", 1) == 0)
5357 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5358 BGP_CLEAR_SOFT_IN, NULL);
5359
5360 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5361 BGP_CLEAR_SOFT_IN, NULL);
5362}
5363
5364ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5365 clear_ip_bgp_all_ipv4_in_cmd,
5366 "clear ip bgp * ipv4 (unicast|multicast) in",
5367 CLEAR_STR
5368 IP_STR
5369 BGP_STR
5370 "Clear all peers\n"
5371 "Address family\n"
5372 "Address Family modifier\n"
5373 "Address Family modifier\n"
5374 "Soft reconfig inbound update\n")
5375
5376DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5377 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5378 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5379 CLEAR_STR
5380 IP_STR
5381 BGP_STR
5382 "BGP view\n"
5383 "view name\n"
5384 "Clear all peers\n"
5385 "Address family\n"
5386 "Address Family modifier\n"
5387 "Address Family modifier\n"
5388 "Soft reconfig\n"
5389 "Soft reconfig inbound update\n")
5390{
5391 if (strncmp (argv[1], "m", 1) == 0)
5392 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5393 BGP_CLEAR_SOFT_IN, NULL);
5394
5395 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5396 BGP_CLEAR_SOFT_IN, NULL);
5397}
5398
5399DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5400 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5401 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5402 CLEAR_STR
5403 IP_STR
5404 BGP_STR
5405 "Clear all peers\n"
5406 "Address family\n"
5407 "Address Family modifier\n"
5408 "Address Family modifier\n"
5409 "Soft reconfig inbound update\n"
5410 "Push out prefix-list ORF and do inbound soft reconfig\n")
5411{
5412 if (strncmp (argv[0], "m", 1) == 0)
5413 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5414 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5415
5416 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5417 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5418}
5419
5420DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5421 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5422 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5423 CLEAR_STR
5424 IP_STR
5425 BGP_STR
5426 "Clear all peers\n"
5427 "Address family\n"
5428 "Address Family modifier\n"
5429 "Address Family modifier\n"
5430 "Soft reconfig inbound update\n"
5431 "Push out prefix-list ORF and do inbound soft reconfig\n")
5432{
5433 if (strncmp (argv[1], "m", 1) == 0)
5434 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5435 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5436
5437 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5438 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5439}
5440
5441DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5442 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5443 "clear ip bgp * vpnv4 unicast soft in",
5444 CLEAR_STR
5445 IP_STR
5446 BGP_STR
5447 "Clear all peers\n"
5448 "Address family\n"
5449 "Address Family Modifier\n"
5450 "Soft reconfig\n"
5451 "Soft reconfig inbound update\n")
5452{
5453 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5454 BGP_CLEAR_SOFT_IN, NULL);
5455}
5456
5457ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5458 clear_ip_bgp_all_vpnv4_in_cmd,
5459 "clear ip bgp * vpnv4 unicast in",
5460 CLEAR_STR
5461 IP_STR
5462 BGP_STR
5463 "Clear all peers\n"
5464 "Address family\n"
5465 "Address Family Modifier\n"
5466 "Soft reconfig inbound update\n")
5467
5468DEFUN (clear_bgp_all_soft_in,
5469 clear_bgp_all_soft_in_cmd,
5470 "clear bgp * soft in",
5471 CLEAR_STR
5472 BGP_STR
5473 "Clear all peers\n"
5474 "Soft reconfig\n"
5475 "Soft reconfig inbound update\n")
5476{
5477 if (argc == 1)
5478 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5479 BGP_CLEAR_SOFT_IN, NULL);
5480
5481 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5482 BGP_CLEAR_SOFT_IN, NULL);
5483}
5484
5485ALIAS (clear_bgp_all_soft_in,
5486 clear_bgp_instance_all_soft_in_cmd,
5487 "clear bgp view WORD * soft in",
5488 CLEAR_STR
5489 BGP_STR
5490 "BGP view\n"
5491 "view name\n"
5492 "Clear all peers\n"
5493 "Soft reconfig\n"
5494 "Soft reconfig inbound update\n")
5495
5496ALIAS (clear_bgp_all_soft_in,
5497 clear_bgp_ipv6_all_soft_in_cmd,
5498 "clear bgp ipv6 * soft in",
5499 CLEAR_STR
5500 BGP_STR
5501 "Address family\n"
5502 "Clear all peers\n"
5503 "Soft reconfig\n"
5504 "Soft reconfig inbound update\n")
5505
5506ALIAS (clear_bgp_all_soft_in,
5507 clear_bgp_all_in_cmd,
5508 "clear bgp * in",
5509 CLEAR_STR
5510 BGP_STR
5511 "Clear all peers\n"
5512 "Soft reconfig inbound update\n")
5513
5514ALIAS (clear_bgp_all_soft_in,
5515 clear_bgp_ipv6_all_in_cmd,
5516 "clear bgp ipv6 * in",
5517 CLEAR_STR
5518 BGP_STR
5519 "Address family\n"
5520 "Clear all peers\n"
5521 "Soft reconfig inbound update\n")
5522
5523DEFUN (clear_bgp_all_in_prefix_filter,
5524 clear_bgp_all_in_prefix_filter_cmd,
5525 "clear bgp * in prefix-filter",
5526 CLEAR_STR
5527 BGP_STR
5528 "Clear all peers\n"
5529 "Soft reconfig inbound update\n"
5530 "Push out prefix-list ORF and do inbound soft reconfig\n")
5531{
5532 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5533 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5534}
5535
5536ALIAS (clear_bgp_all_in_prefix_filter,
5537 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5538 "clear bgp ipv6 * in prefix-filter",
5539 CLEAR_STR
5540 BGP_STR
5541 "Address family\n"
5542 "Clear all peers\n"
5543 "Soft reconfig inbound update\n"
5544 "Push out prefix-list ORF and do inbound soft reconfig\n")
5545
5546DEFUN (clear_ip_bgp_peer_soft_in,
5547 clear_ip_bgp_peer_soft_in_cmd,
5548 "clear ip bgp A.B.C.D soft in",
5549 CLEAR_STR
5550 IP_STR
5551 BGP_STR
5552 "BGP neighbor address to clear\n"
5553 "Soft reconfig\n"
5554 "Soft reconfig inbound update\n")
5555{
5556 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5557 BGP_CLEAR_SOFT_IN, argv[0]);
5558}
5559
5560ALIAS (clear_ip_bgp_peer_soft_in,
5561 clear_ip_bgp_peer_in_cmd,
5562 "clear ip bgp A.B.C.D in",
5563 CLEAR_STR
5564 IP_STR
5565 BGP_STR
5566 "BGP neighbor address to clear\n"
5567 "Soft reconfig inbound update\n")
5568
5569DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5570 clear_ip_bgp_peer_in_prefix_filter_cmd,
5571 "clear ip bgp A.B.C.D in prefix-filter",
5572 CLEAR_STR
5573 IP_STR
5574 BGP_STR
5575 "BGP neighbor address to clear\n"
5576 "Soft reconfig inbound update\n"
5577 "Push out the existing ORF prefix-list\n")
5578{
5579 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5580 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5581}
5582
5583DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5584 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5585 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5586 CLEAR_STR
5587 IP_STR
5588 BGP_STR
5589 "BGP neighbor address to clear\n"
5590 "Address family\n"
5591 "Address Family modifier\n"
5592 "Address Family modifier\n"
5593 "Soft reconfig\n"
5594 "Soft reconfig inbound update\n")
5595{
5596 if (strncmp (argv[1], "m", 1) == 0)
5597 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5598 BGP_CLEAR_SOFT_IN, argv[0]);
5599
5600 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5601 BGP_CLEAR_SOFT_IN, argv[0]);
5602}
5603
5604ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5605 clear_ip_bgp_peer_ipv4_in_cmd,
5606 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5607 CLEAR_STR
5608 IP_STR
5609 BGP_STR
5610 "BGP neighbor address to clear\n"
5611 "Address family\n"
5612 "Address Family modifier\n"
5613 "Address Family modifier\n"
5614 "Soft reconfig inbound update\n")
5615
5616DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5617 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5618 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5619 CLEAR_STR
5620 IP_STR
5621 BGP_STR
5622 "BGP neighbor address to clear\n"
5623 "Address family\n"
5624 "Address Family modifier\n"
5625 "Address Family modifier\n"
5626 "Soft reconfig inbound update\n"
5627 "Push out the existing ORF prefix-list\n")
5628{
5629 if (strncmp (argv[1], "m", 1) == 0)
5630 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5631 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5632
5633 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5634 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5635}
5636
5637DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5638 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5639 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5640 CLEAR_STR
5641 IP_STR
5642 BGP_STR
5643 "BGP neighbor address to clear\n"
5644 "Address family\n"
5645 "Address Family Modifier\n"
5646 "Soft reconfig\n"
5647 "Soft reconfig inbound update\n")
5648{
5649 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5650 BGP_CLEAR_SOFT_IN, argv[0]);
5651}
5652
5653ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5654 clear_ip_bgp_peer_vpnv4_in_cmd,
5655 "clear ip bgp A.B.C.D vpnv4 unicast in",
5656 CLEAR_STR
5657 IP_STR
5658 BGP_STR
5659 "BGP neighbor address to clear\n"
5660 "Address family\n"
5661 "Address Family Modifier\n"
5662 "Soft reconfig inbound update\n")
5663
5664DEFUN (clear_bgp_peer_soft_in,
5665 clear_bgp_peer_soft_in_cmd,
5666 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5667 CLEAR_STR
5668 BGP_STR
5669 "BGP neighbor address to clear\n"
5670 "BGP IPv6 neighbor to clear\n"
5671 "Soft reconfig\n"
5672 "Soft reconfig inbound update\n")
5673{
5674 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5675 BGP_CLEAR_SOFT_IN, argv[0]);
5676}
5677
5678ALIAS (clear_bgp_peer_soft_in,
5679 clear_bgp_ipv6_peer_soft_in_cmd,
5680 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5681 CLEAR_STR
5682 BGP_STR
5683 "Address family\n"
5684 "BGP neighbor address to clear\n"
5685 "BGP IPv6 neighbor to clear\n"
5686 "Soft reconfig\n"
5687 "Soft reconfig inbound update\n")
5688
5689ALIAS (clear_bgp_peer_soft_in,
5690 clear_bgp_peer_in_cmd,
5691 "clear bgp (A.B.C.D|X:X::X:X) in",
5692 CLEAR_STR
5693 BGP_STR
5694 "BGP neighbor address to clear\n"
5695 "BGP IPv6 neighbor to clear\n"
5696 "Soft reconfig inbound update\n")
5697
5698ALIAS (clear_bgp_peer_soft_in,
5699 clear_bgp_ipv6_peer_in_cmd,
5700 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5701 CLEAR_STR
5702 BGP_STR
5703 "Address family\n"
5704 "BGP neighbor address to clear\n"
5705 "BGP IPv6 neighbor to clear\n"
5706 "Soft reconfig inbound update\n")
5707
5708DEFUN (clear_bgp_peer_in_prefix_filter,
5709 clear_bgp_peer_in_prefix_filter_cmd,
5710 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5711 CLEAR_STR
5712 BGP_STR
5713 "BGP neighbor address to clear\n"
5714 "BGP IPv6 neighbor to clear\n"
5715 "Soft reconfig inbound update\n"
5716 "Push out the existing ORF prefix-list\n")
5717{
5718 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5719 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5720}
5721
5722ALIAS (clear_bgp_peer_in_prefix_filter,
5723 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5724 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5725 CLEAR_STR
5726 BGP_STR
5727 "Address family\n"
5728 "BGP neighbor address to clear\n"
5729 "BGP IPv6 neighbor to clear\n"
5730 "Soft reconfig inbound update\n"
5731 "Push out the existing ORF prefix-list\n")
5732
5733DEFUN (clear_ip_bgp_peer_group_soft_in,
5734 clear_ip_bgp_peer_group_soft_in_cmd,
5735 "clear ip bgp peer-group WORD soft in",
5736 CLEAR_STR
5737 IP_STR
5738 BGP_STR
5739 "Clear all members of peer-group\n"
5740 "BGP peer-group name\n"
5741 "Soft reconfig\n"
5742 "Soft reconfig inbound update\n")
5743{
5744 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5745 BGP_CLEAR_SOFT_IN, argv[0]);
5746}
5747
5748ALIAS (clear_ip_bgp_peer_group_soft_in,
5749 clear_ip_bgp_peer_group_in_cmd,
5750 "clear ip bgp peer-group WORD in",
5751 CLEAR_STR
5752 IP_STR
5753 BGP_STR
5754 "Clear all members of peer-group\n"
5755 "BGP peer-group name\n"
5756 "Soft reconfig inbound update\n")
5757
5758DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
5759 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
5760 "clear ip bgp peer-group WORD in prefix-filter",
5761 CLEAR_STR
5762 IP_STR
5763 BGP_STR
5764 "Clear all members of peer-group\n"
5765 "BGP peer-group name\n"
5766 "Soft reconfig inbound update\n"
5767 "Push out prefix-list ORF and do inbound soft reconfig\n")
5768{
5769 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5770 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5771}
5772
5773DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
5774 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
5775 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
5776 CLEAR_STR
5777 IP_STR
5778 BGP_STR
5779 "Clear all members of peer-group\n"
5780 "BGP peer-group name\n"
5781 "Address family\n"
5782 "Address Family modifier\n"
5783 "Address Family modifier\n"
5784 "Soft reconfig\n"
5785 "Soft reconfig inbound update\n")
5786{
5787 if (strncmp (argv[1], "m", 1) == 0)
5788 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5789 BGP_CLEAR_SOFT_IN, argv[0]);
5790
5791 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5792 BGP_CLEAR_SOFT_IN, argv[0]);
5793}
5794
5795ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
5796 clear_ip_bgp_peer_group_ipv4_in_cmd,
5797 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
5798 CLEAR_STR
5799 IP_STR
5800 BGP_STR
5801 "Clear all members of peer-group\n"
5802 "BGP peer-group name\n"
5803 "Address family\n"
5804 "Address Family modifier\n"
5805 "Address Family modifier\n"
5806 "Soft reconfig inbound update\n")
5807
5808DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
5809 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
5810 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
5811 CLEAR_STR
5812 IP_STR
5813 BGP_STR
5814 "Clear all members of peer-group\n"
5815 "BGP peer-group name\n"
5816 "Address family\n"
5817 "Address Family modifier\n"
5818 "Address Family modifier\n"
5819 "Soft reconfig inbound update\n"
5820 "Push out prefix-list ORF and do inbound soft reconfig\n")
5821{
5822 if (strncmp (argv[1], "m", 1) == 0)
5823 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5824 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5825
5826 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5827 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5828}
5829
5830DEFUN (clear_bgp_peer_group_soft_in,
5831 clear_bgp_peer_group_soft_in_cmd,
5832 "clear bgp peer-group WORD soft in",
5833 CLEAR_STR
5834 BGP_STR
5835 "Clear all members of peer-group\n"
5836 "BGP peer-group name\n"
5837 "Soft reconfig\n"
5838 "Soft reconfig inbound update\n")
5839{
5840 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5841 BGP_CLEAR_SOFT_IN, argv[0]);
5842}
5843
5844ALIAS (clear_bgp_peer_group_soft_in,
5845 clear_bgp_ipv6_peer_group_soft_in_cmd,
5846 "clear bgp ipv6 peer-group WORD soft in",
5847 CLEAR_STR
5848 BGP_STR
5849 "Address family\n"
5850 "Clear all members of peer-group\n"
5851 "BGP peer-group name\n"
5852 "Soft reconfig\n"
5853 "Soft reconfig inbound update\n")
5854
5855ALIAS (clear_bgp_peer_group_soft_in,
5856 clear_bgp_peer_group_in_cmd,
5857 "clear bgp peer-group WORD in",
5858 CLEAR_STR
5859 BGP_STR
5860 "Clear all members of peer-group\n"
5861 "BGP peer-group name\n"
5862 "Soft reconfig inbound update\n")
5863
5864ALIAS (clear_bgp_peer_group_soft_in,
5865 clear_bgp_ipv6_peer_group_in_cmd,
5866 "clear bgp ipv6 peer-group WORD in",
5867 CLEAR_STR
5868 BGP_STR
5869 "Address family\n"
5870 "Clear all members of peer-group\n"
5871 "BGP peer-group name\n"
5872 "Soft reconfig inbound update\n")
5873
5874DEFUN (clear_bgp_peer_group_in_prefix_filter,
5875 clear_bgp_peer_group_in_prefix_filter_cmd,
5876 "clear bgp peer-group WORD in prefix-filter",
5877 CLEAR_STR
5878 BGP_STR
5879 "Clear all members of peer-group\n"
5880 "BGP peer-group name\n"
5881 "Soft reconfig inbound update\n"
5882 "Push out prefix-list ORF and do inbound soft reconfig\n")
5883{
5884 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5885 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5886}
5887
5888ALIAS (clear_bgp_peer_group_in_prefix_filter,
5889 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
5890 "clear bgp ipv6 peer-group WORD in prefix-filter",
5891 CLEAR_STR
5892 BGP_STR
5893 "Address family\n"
5894 "Clear all members of peer-group\n"
5895 "BGP peer-group name\n"
5896 "Soft reconfig inbound update\n"
5897 "Push out prefix-list ORF and do inbound soft reconfig\n")
5898
5899DEFUN (clear_ip_bgp_external_soft_in,
5900 clear_ip_bgp_external_soft_in_cmd,
5901 "clear ip bgp external soft in",
5902 CLEAR_STR
5903 IP_STR
5904 BGP_STR
5905 "Clear all external peers\n"
5906 "Soft reconfig\n"
5907 "Soft reconfig inbound update\n")
5908{
5909 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5910 BGP_CLEAR_SOFT_IN, NULL);
5911}
5912
5913ALIAS (clear_ip_bgp_external_soft_in,
5914 clear_ip_bgp_external_in_cmd,
5915 "clear ip bgp external in",
5916 CLEAR_STR
5917 IP_STR
5918 BGP_STR
5919 "Clear all external peers\n"
5920 "Soft reconfig inbound update\n")
5921
5922DEFUN (clear_ip_bgp_external_in_prefix_filter,
5923 clear_ip_bgp_external_in_prefix_filter_cmd,
5924 "clear ip bgp external in prefix-filter",
5925 CLEAR_STR
5926 IP_STR
5927 BGP_STR
5928 "Clear all external peers\n"
5929 "Soft reconfig inbound update\n"
5930 "Push out prefix-list ORF and do inbound soft reconfig\n")
5931{
5932 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5933 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5934}
5935
5936DEFUN (clear_ip_bgp_external_ipv4_soft_in,
5937 clear_ip_bgp_external_ipv4_soft_in_cmd,
5938 "clear ip bgp external ipv4 (unicast|multicast) soft in",
5939 CLEAR_STR
5940 IP_STR
5941 BGP_STR
5942 "Clear all external peers\n"
5943 "Address family\n"
5944 "Address Family modifier\n"
5945 "Address Family modifier\n"
5946 "Soft reconfig\n"
5947 "Soft reconfig inbound update\n")
5948{
5949 if (strncmp (argv[0], "m", 1) == 0)
5950 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5951 BGP_CLEAR_SOFT_IN, NULL);
5952
5953 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5954 BGP_CLEAR_SOFT_IN, NULL);
5955}
5956
5957ALIAS (clear_ip_bgp_external_ipv4_soft_in,
5958 clear_ip_bgp_external_ipv4_in_cmd,
5959 "clear ip bgp external ipv4 (unicast|multicast) in",
5960 CLEAR_STR
5961 IP_STR
5962 BGP_STR
5963 "Clear all external peers\n"
5964 "Address family\n"
5965 "Address Family modifier\n"
5966 "Address Family modifier\n"
5967 "Soft reconfig inbound update\n")
5968
5969DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
5970 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
5971 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
5972 CLEAR_STR
5973 IP_STR
5974 BGP_STR
5975 "Clear all external peers\n"
5976 "Address family\n"
5977 "Address Family modifier\n"
5978 "Address Family modifier\n"
5979 "Soft reconfig inbound update\n"
5980 "Push out prefix-list ORF and do inbound soft reconfig\n")
5981{
5982 if (strncmp (argv[0], "m", 1) == 0)
5983 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5984 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5985
5986 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5987 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5988}
5989
5990DEFUN (clear_bgp_external_soft_in,
5991 clear_bgp_external_soft_in_cmd,
5992 "clear bgp external soft in",
5993 CLEAR_STR
5994 BGP_STR
5995 "Clear all external peers\n"
5996 "Soft reconfig\n"
5997 "Soft reconfig inbound update\n")
5998{
5999 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6000 BGP_CLEAR_SOFT_IN, NULL);
6001}
6002
6003ALIAS (clear_bgp_external_soft_in,
6004 clear_bgp_ipv6_external_soft_in_cmd,
6005 "clear bgp ipv6 external soft in",
6006 CLEAR_STR
6007 BGP_STR
6008 "Address family\n"
6009 "Clear all external peers\n"
6010 "Soft reconfig\n"
6011 "Soft reconfig inbound update\n")
6012
6013ALIAS (clear_bgp_external_soft_in,
6014 clear_bgp_external_in_cmd,
6015 "clear bgp external in",
6016 CLEAR_STR
6017 BGP_STR
6018 "Clear all external peers\n"
6019 "Soft reconfig inbound update\n")
6020
6021ALIAS (clear_bgp_external_soft_in,
6022 clear_bgp_ipv6_external_in_cmd,
6023 "clear bgp ipv6 external WORD in",
6024 CLEAR_STR
6025 BGP_STR
6026 "Address family\n"
6027 "Clear all external peers\n"
6028 "Soft reconfig inbound update\n")
6029
6030DEFUN (clear_bgp_external_in_prefix_filter,
6031 clear_bgp_external_in_prefix_filter_cmd,
6032 "clear bgp external in prefix-filter",
6033 CLEAR_STR
6034 BGP_STR
6035 "Clear all external peers\n"
6036 "Soft reconfig inbound update\n"
6037 "Push out prefix-list ORF and do inbound soft reconfig\n")
6038{
6039 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6040 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6041}
6042
6043ALIAS (clear_bgp_external_in_prefix_filter,
6044 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6045 "clear bgp ipv6 external in prefix-filter",
6046 CLEAR_STR
6047 BGP_STR
6048 "Address family\n"
6049 "Clear all external peers\n"
6050 "Soft reconfig inbound update\n"
6051 "Push out prefix-list ORF and do inbound soft reconfig\n")
6052
6053DEFUN (clear_ip_bgp_as_soft_in,
6054 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006055 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006056 CLEAR_STR
6057 IP_STR
6058 BGP_STR
6059 "Clear peers with the AS number\n"
6060 "Soft reconfig\n"
6061 "Soft reconfig inbound update\n")
6062{
6063 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6064 BGP_CLEAR_SOFT_IN, argv[0]);
6065}
6066
6067ALIAS (clear_ip_bgp_as_soft_in,
6068 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006069 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006070 CLEAR_STR
6071 IP_STR
6072 BGP_STR
6073 "Clear peers with the AS number\n"
6074 "Soft reconfig inbound update\n")
6075
6076DEFUN (clear_ip_bgp_as_in_prefix_filter,
6077 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006078 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006079 CLEAR_STR
6080 IP_STR
6081 BGP_STR
6082 "Clear peers with the AS number\n"
6083 "Soft reconfig inbound update\n"
6084 "Push out prefix-list ORF and do inbound soft reconfig\n")
6085{
6086 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6087 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6088}
6089
6090DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6091 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006092 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006093 CLEAR_STR
6094 IP_STR
6095 BGP_STR
6096 "Clear peers with the AS number\n"
6097 "Address family\n"
6098 "Address Family modifier\n"
6099 "Address Family modifier\n"
6100 "Soft reconfig\n"
6101 "Soft reconfig inbound update\n")
6102{
6103 if (strncmp (argv[1], "m", 1) == 0)
6104 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6105 BGP_CLEAR_SOFT_IN, argv[0]);
6106
6107 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6108 BGP_CLEAR_SOFT_IN, argv[0]);
6109}
6110
6111ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6112 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006113 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00006114 CLEAR_STR
6115 IP_STR
6116 BGP_STR
6117 "Clear peers with the AS number\n"
6118 "Address family\n"
6119 "Address Family modifier\n"
6120 "Address Family modifier\n"
6121 "Soft reconfig inbound update\n")
6122
6123DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6124 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006125 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006126 CLEAR_STR
6127 IP_STR
6128 BGP_STR
6129 "Clear peers with the AS number\n"
6130 "Address family\n"
6131 "Address Family modifier\n"
6132 "Address Family modifier\n"
6133 "Soft reconfig inbound update\n"
6134 "Push out prefix-list ORF and do inbound soft reconfig\n")
6135{
6136 if (strncmp (argv[1], "m", 1) == 0)
6137 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6138 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6139
6140 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6141 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6142}
6143
6144DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6145 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006146 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00006147 CLEAR_STR
6148 IP_STR
6149 BGP_STR
6150 "Clear peers with the AS number\n"
6151 "Address family\n"
6152 "Address Family modifier\n"
6153 "Soft reconfig\n"
6154 "Soft reconfig inbound update\n")
6155{
6156 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6157 BGP_CLEAR_SOFT_IN, argv[0]);
6158}
6159
6160ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6161 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006162 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006163 CLEAR_STR
6164 IP_STR
6165 BGP_STR
6166 "Clear peers with the AS number\n"
6167 "Address family\n"
6168 "Address Family modifier\n"
6169 "Soft reconfig inbound update\n")
6170
6171DEFUN (clear_bgp_as_soft_in,
6172 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006173 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006174 CLEAR_STR
6175 BGP_STR
6176 "Clear peers with the AS number\n"
6177 "Soft reconfig\n"
6178 "Soft reconfig inbound update\n")
6179{
6180 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6181 BGP_CLEAR_SOFT_IN, argv[0]);
6182}
6183
6184ALIAS (clear_bgp_as_soft_in,
6185 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006186 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006187 CLEAR_STR
6188 BGP_STR
6189 "Address family\n"
6190 "Clear peers with the AS number\n"
6191 "Soft reconfig\n"
6192 "Soft reconfig inbound update\n")
6193
6194ALIAS (clear_bgp_as_soft_in,
6195 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006196 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006197 CLEAR_STR
6198 BGP_STR
6199 "Clear peers with the AS number\n"
6200 "Soft reconfig inbound update\n")
6201
6202ALIAS (clear_bgp_as_soft_in,
6203 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006204 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006205 CLEAR_STR
6206 BGP_STR
6207 "Address family\n"
6208 "Clear peers with the AS number\n"
6209 "Soft reconfig inbound update\n")
6210
6211DEFUN (clear_bgp_as_in_prefix_filter,
6212 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006213 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006214 CLEAR_STR
6215 BGP_STR
6216 "Clear peers with the AS number\n"
6217 "Soft reconfig inbound update\n"
6218 "Push out prefix-list ORF and do inbound soft reconfig\n")
6219{
6220 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6221 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6222}
6223
6224ALIAS (clear_bgp_as_in_prefix_filter,
6225 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006226 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006227 CLEAR_STR
6228 BGP_STR
6229 "Address family\n"
6230 "Clear peers with the AS number\n"
6231 "Soft reconfig inbound update\n"
6232 "Push out prefix-list ORF and do inbound soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006233
paul718e3742002-12-13 20:15:29 +00006234/* Both soft-reconfiguration */
6235DEFUN (clear_ip_bgp_all_soft,
6236 clear_ip_bgp_all_soft_cmd,
6237 "clear ip bgp * soft",
6238 CLEAR_STR
6239 IP_STR
6240 BGP_STR
6241 "Clear all peers\n"
6242 "Soft reconfig\n")
6243{
6244 if (argc == 1)
6245 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6246 BGP_CLEAR_SOFT_BOTH, NULL);
6247
6248 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6249 BGP_CLEAR_SOFT_BOTH, NULL);
6250}
6251
6252ALIAS (clear_ip_bgp_all_soft,
6253 clear_ip_bgp_instance_all_soft_cmd,
6254 "clear ip bgp view WORD * soft",
6255 CLEAR_STR
6256 IP_STR
6257 BGP_STR
6258 "BGP view\n"
6259 "view name\n"
6260 "Clear all peers\n"
6261 "Soft reconfig\n")
6262
6263
6264DEFUN (clear_ip_bgp_all_ipv4_soft,
6265 clear_ip_bgp_all_ipv4_soft_cmd,
6266 "clear ip bgp * ipv4 (unicast|multicast) soft",
6267 CLEAR_STR
6268 IP_STR
6269 BGP_STR
6270 "Clear all peers\n"
6271 "Address family\n"
6272 "Address Family Modifier\n"
6273 "Address Family Modifier\n"
6274 "Soft reconfig\n")
6275{
6276 if (strncmp (argv[0], "m", 1) == 0)
6277 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6278 BGP_CLEAR_SOFT_BOTH, NULL);
6279
6280 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6281 BGP_CLEAR_SOFT_BOTH, NULL);
6282}
6283
6284DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6285 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6286 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6287 CLEAR_STR
6288 IP_STR
6289 BGP_STR
6290 "BGP view\n"
6291 "view name\n"
6292 "Clear all peers\n"
6293 "Address family\n"
6294 "Address Family Modifier\n"
6295 "Address Family Modifier\n"
6296 "Soft reconfig\n")
6297{
6298 if (strncmp (argv[1], "m", 1) == 0)
6299 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6300 BGP_CLEAR_SOFT_BOTH, NULL);
6301
6302 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6303 BGP_CLEAR_SOFT_BOTH, NULL);
6304}
6305
6306DEFUN (clear_ip_bgp_all_vpnv4_soft,
6307 clear_ip_bgp_all_vpnv4_soft_cmd,
6308 "clear ip bgp * vpnv4 unicast soft",
6309 CLEAR_STR
6310 IP_STR
6311 BGP_STR
6312 "Clear all peers\n"
6313 "Address family\n"
6314 "Address Family Modifier\n"
6315 "Soft reconfig\n")
6316{
6317 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6318 BGP_CLEAR_SOFT_BOTH, argv[0]);
6319}
6320
6321DEFUN (clear_bgp_all_soft,
6322 clear_bgp_all_soft_cmd,
6323 "clear bgp * soft",
6324 CLEAR_STR
6325 BGP_STR
6326 "Clear all peers\n"
6327 "Soft reconfig\n")
6328{
6329 if (argc == 1)
6330 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6331 BGP_CLEAR_SOFT_BOTH, argv[0]);
6332
6333 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6334 BGP_CLEAR_SOFT_BOTH, argv[0]);
6335}
6336
6337ALIAS (clear_bgp_all_soft,
6338 clear_bgp_instance_all_soft_cmd,
6339 "clear bgp view WORD * soft",
6340 CLEAR_STR
6341 BGP_STR
6342 "BGP view\n"
6343 "view name\n"
6344 "Clear all peers\n"
6345 "Soft reconfig\n")
6346
6347ALIAS (clear_bgp_all_soft,
6348 clear_bgp_ipv6_all_soft_cmd,
6349 "clear bgp ipv6 * soft",
6350 CLEAR_STR
6351 BGP_STR
6352 "Address family\n"
6353 "Clear all peers\n"
6354 "Soft reconfig\n")
6355
6356DEFUN (clear_ip_bgp_peer_soft,
6357 clear_ip_bgp_peer_soft_cmd,
6358 "clear ip bgp A.B.C.D soft",
6359 CLEAR_STR
6360 IP_STR
6361 BGP_STR
6362 "BGP neighbor address to clear\n"
6363 "Soft reconfig\n")
6364{
6365 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6366 BGP_CLEAR_SOFT_BOTH, argv[0]);
6367}
6368
6369DEFUN (clear_ip_bgp_peer_ipv4_soft,
6370 clear_ip_bgp_peer_ipv4_soft_cmd,
6371 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6372 CLEAR_STR
6373 IP_STR
6374 BGP_STR
6375 "BGP neighbor address to clear\n"
6376 "Address family\n"
6377 "Address Family Modifier\n"
6378 "Address Family Modifier\n"
6379 "Soft reconfig\n")
6380{
6381 if (strncmp (argv[1], "m", 1) == 0)
6382 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6383 BGP_CLEAR_SOFT_BOTH, argv[0]);
6384
6385 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6386 BGP_CLEAR_SOFT_BOTH, argv[0]);
6387}
6388
6389DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6390 clear_ip_bgp_peer_vpnv4_soft_cmd,
6391 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6392 CLEAR_STR
6393 IP_STR
6394 BGP_STR
6395 "BGP neighbor address to clear\n"
6396 "Address family\n"
6397 "Address Family Modifier\n"
6398 "Soft reconfig\n")
6399{
6400 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6401 BGP_CLEAR_SOFT_BOTH, argv[0]);
6402}
6403
6404DEFUN (clear_bgp_peer_soft,
6405 clear_bgp_peer_soft_cmd,
6406 "clear bgp (A.B.C.D|X:X::X:X) soft",
6407 CLEAR_STR
6408 BGP_STR
6409 "BGP neighbor address to clear\n"
6410 "BGP IPv6 neighbor to clear\n"
6411 "Soft reconfig\n")
6412{
6413 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6414 BGP_CLEAR_SOFT_BOTH, argv[0]);
6415}
6416
6417ALIAS (clear_bgp_peer_soft,
6418 clear_bgp_ipv6_peer_soft_cmd,
6419 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6420 CLEAR_STR
6421 BGP_STR
6422 "Address family\n"
6423 "BGP neighbor address to clear\n"
6424 "BGP IPv6 neighbor to clear\n"
6425 "Soft reconfig\n")
6426
6427DEFUN (clear_ip_bgp_peer_group_soft,
6428 clear_ip_bgp_peer_group_soft_cmd,
6429 "clear ip bgp peer-group WORD soft",
6430 CLEAR_STR
6431 IP_STR
6432 BGP_STR
6433 "Clear all members of peer-group\n"
6434 "BGP peer-group name\n"
6435 "Soft reconfig\n")
6436{
6437 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6438 BGP_CLEAR_SOFT_BOTH, argv[0]);
6439}
6440
6441DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6442 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6443 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6444 CLEAR_STR
6445 IP_STR
6446 BGP_STR
6447 "Clear all members of peer-group\n"
6448 "BGP peer-group name\n"
6449 "Address family\n"
6450 "Address Family modifier\n"
6451 "Address Family modifier\n"
6452 "Soft reconfig\n")
6453{
6454 if (strncmp (argv[1], "m", 1) == 0)
6455 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6456 BGP_CLEAR_SOFT_BOTH, argv[0]);
6457
6458 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6459 BGP_CLEAR_SOFT_BOTH, argv[0]);
6460}
6461
6462DEFUN (clear_bgp_peer_group_soft,
6463 clear_bgp_peer_group_soft_cmd,
6464 "clear bgp peer-group WORD soft",
6465 CLEAR_STR
6466 BGP_STR
6467 "Clear all members of peer-group\n"
6468 "BGP peer-group name\n"
6469 "Soft reconfig\n")
6470{
6471 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6472 BGP_CLEAR_SOFT_BOTH, argv[0]);
6473}
6474
6475ALIAS (clear_bgp_peer_group_soft,
6476 clear_bgp_ipv6_peer_group_soft_cmd,
6477 "clear bgp ipv6 peer-group WORD soft",
6478 CLEAR_STR
6479 BGP_STR
6480 "Address family\n"
6481 "Clear all members of peer-group\n"
6482 "BGP peer-group name\n"
6483 "Soft reconfig\n")
6484
6485DEFUN (clear_ip_bgp_external_soft,
6486 clear_ip_bgp_external_soft_cmd,
6487 "clear ip bgp external soft",
6488 CLEAR_STR
6489 IP_STR
6490 BGP_STR
6491 "Clear all external peers\n"
6492 "Soft reconfig\n")
6493{
6494 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6495 BGP_CLEAR_SOFT_BOTH, NULL);
6496}
6497
6498DEFUN (clear_ip_bgp_external_ipv4_soft,
6499 clear_ip_bgp_external_ipv4_soft_cmd,
6500 "clear ip bgp external ipv4 (unicast|multicast) soft",
6501 CLEAR_STR
6502 IP_STR
6503 BGP_STR
6504 "Clear all external peers\n"
6505 "Address family\n"
6506 "Address Family modifier\n"
6507 "Address Family modifier\n"
6508 "Soft reconfig\n")
6509{
6510 if (strncmp (argv[0], "m", 1) == 0)
6511 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6512 BGP_CLEAR_SOFT_BOTH, NULL);
6513
6514 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6515 BGP_CLEAR_SOFT_BOTH, NULL);
6516}
6517
6518DEFUN (clear_bgp_external_soft,
6519 clear_bgp_external_soft_cmd,
6520 "clear bgp external soft",
6521 CLEAR_STR
6522 BGP_STR
6523 "Clear all external peers\n"
6524 "Soft reconfig\n")
6525{
6526 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6527 BGP_CLEAR_SOFT_BOTH, NULL);
6528}
6529
6530ALIAS (clear_bgp_external_soft,
6531 clear_bgp_ipv6_external_soft_cmd,
6532 "clear bgp ipv6 external soft",
6533 CLEAR_STR
6534 BGP_STR
6535 "Address family\n"
6536 "Clear all external peers\n"
6537 "Soft reconfig\n")
6538
6539DEFUN (clear_ip_bgp_as_soft,
6540 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006541 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006542 CLEAR_STR
6543 IP_STR
6544 BGP_STR
6545 "Clear peers with the AS number\n"
6546 "Soft reconfig\n")
6547{
6548 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6549 BGP_CLEAR_SOFT_BOTH, argv[0]);
6550}
6551
6552DEFUN (clear_ip_bgp_as_ipv4_soft,
6553 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006554 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006555 CLEAR_STR
6556 IP_STR
6557 BGP_STR
6558 "Clear peers with the AS number\n"
6559 "Address family\n"
6560 "Address Family Modifier\n"
6561 "Address Family Modifier\n"
6562 "Soft reconfig\n")
6563{
6564 if (strncmp (argv[1], "m", 1) == 0)
6565 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6566 BGP_CLEAR_SOFT_BOTH, argv[0]);
6567
6568 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6569 BGP_CLEAR_SOFT_BOTH, argv[0]);
6570}
6571
6572DEFUN (clear_ip_bgp_as_vpnv4_soft,
6573 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006574 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00006575 CLEAR_STR
6576 IP_STR
6577 BGP_STR
6578 "Clear peers with the AS number\n"
6579 "Address family\n"
6580 "Address Family Modifier\n"
6581 "Soft reconfig\n")
6582{
6583 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6584 BGP_CLEAR_SOFT_BOTH, argv[0]);
6585}
6586
6587DEFUN (clear_bgp_as_soft,
6588 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006589 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006590 CLEAR_STR
6591 BGP_STR
6592 "Clear peers with the AS number\n"
6593 "Soft reconfig\n")
6594{
6595 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6596 BGP_CLEAR_SOFT_BOTH, argv[0]);
6597}
6598
6599ALIAS (clear_bgp_as_soft,
6600 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006601 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006602 CLEAR_STR
6603 BGP_STR
6604 "Address family\n"
6605 "Clear peers with the AS number\n"
6606 "Soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006607
paulfee0f4c2004-09-13 05:12:46 +00006608/* RS-client soft reconfiguration. */
6609#ifdef HAVE_IPV6
6610DEFUN (clear_bgp_all_rsclient,
6611 clear_bgp_all_rsclient_cmd,
6612 "clear bgp * rsclient",
6613 CLEAR_STR
6614 BGP_STR
6615 "Clear all peers\n"
6616 "Soft reconfig for rsclient RIB\n")
6617{
6618 if (argc == 1)
6619 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6620 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6621
6622 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6623 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6624}
6625
6626ALIAS (clear_bgp_all_rsclient,
6627 clear_bgp_ipv6_all_rsclient_cmd,
6628 "clear bgp ipv6 * rsclient",
6629 CLEAR_STR
6630 BGP_STR
6631 "Address family\n"
6632 "Clear all peers\n"
6633 "Soft reconfig for rsclient RIB\n")
6634
6635ALIAS (clear_bgp_all_rsclient,
6636 clear_bgp_instance_all_rsclient_cmd,
6637 "clear bgp view WORD * rsclient",
6638 CLEAR_STR
6639 BGP_STR
6640 "BGP view\n"
6641 "view name\n"
6642 "Clear all peers\n"
6643 "Soft reconfig for rsclient RIB\n")
6644
6645ALIAS (clear_bgp_all_rsclient,
6646 clear_bgp_ipv6_instance_all_rsclient_cmd,
6647 "clear bgp ipv6 view WORD * rsclient",
6648 CLEAR_STR
6649 BGP_STR
6650 "Address family\n"
6651 "BGP view\n"
6652 "view name\n"
6653 "Clear all peers\n"
6654 "Soft reconfig for rsclient RIB\n")
6655#endif /* HAVE_IPV6 */
6656
6657DEFUN (clear_ip_bgp_all_rsclient,
6658 clear_ip_bgp_all_rsclient_cmd,
6659 "clear ip bgp * rsclient",
6660 CLEAR_STR
6661 IP_STR
6662 BGP_STR
6663 "Clear all peers\n"
6664 "Soft reconfig for rsclient RIB\n")
6665{
6666 if (argc == 1)
6667 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6668 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6669
6670 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6671 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6672}
6673
6674ALIAS (clear_ip_bgp_all_rsclient,
6675 clear_ip_bgp_instance_all_rsclient_cmd,
6676 "clear ip bgp view WORD * rsclient",
6677 CLEAR_STR
6678 IP_STR
6679 BGP_STR
6680 "BGP view\n"
6681 "view name\n"
6682 "Clear all peers\n"
6683 "Soft reconfig for rsclient RIB\n")
6684
6685#ifdef HAVE_IPV6
6686DEFUN (clear_bgp_peer_rsclient,
6687 clear_bgp_peer_rsclient_cmd,
6688 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
6689 CLEAR_STR
6690 BGP_STR
6691 "BGP neighbor IP address to clear\n"
6692 "BGP IPv6 neighbor to clear\n"
6693 "Soft reconfig for rsclient RIB\n")
6694{
6695 if (argc == 2)
6696 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
6697 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6698
6699 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6700 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6701}
6702
6703ALIAS (clear_bgp_peer_rsclient,
6704 clear_bgp_ipv6_peer_rsclient_cmd,
6705 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
6706 CLEAR_STR
6707 BGP_STR
6708 "Address family\n"
6709 "BGP neighbor IP address to clear\n"
6710 "BGP IPv6 neighbor to clear\n"
6711 "Soft reconfig for rsclient RIB\n")
6712
6713ALIAS (clear_bgp_peer_rsclient,
6714 clear_bgp_instance_peer_rsclient_cmd,
6715 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6716 CLEAR_STR
6717 BGP_STR
6718 "BGP view\n"
6719 "view name\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_ipv6_instance_peer_rsclient_cmd,
6726 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
6727 CLEAR_STR
6728 BGP_STR
6729 "Address family\n"
6730 "BGP view\n"
6731 "view name\n"
6732 "BGP neighbor IP address to clear\n"
6733 "BGP IPv6 neighbor to clear\n"
6734 "Soft reconfig for rsclient RIB\n")
6735#endif /* HAVE_IPV6 */
6736
6737DEFUN (clear_ip_bgp_peer_rsclient,
6738 clear_ip_bgp_peer_rsclient_cmd,
6739 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
6740 CLEAR_STR
6741 IP_STR
6742 BGP_STR
6743 "BGP neighbor IP address to clear\n"
6744 "BGP IPv6 neighbor to clear\n"
6745 "Soft reconfig for rsclient RIB\n")
6746{
6747 if (argc == 2)
6748 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
6749 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6750
6751 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6752 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6753}
6754
6755ALIAS (clear_ip_bgp_peer_rsclient,
6756 clear_ip_bgp_instance_peer_rsclient_cmd,
6757 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6758 CLEAR_STR
6759 IP_STR
6760 BGP_STR
6761 "BGP view\n"
6762 "view name\n"
6763 "BGP neighbor IP address to clear\n"
6764 "BGP IPv6 neighbor to clear\n"
6765 "Soft reconfig for rsclient RIB\n")
6766
Michael Lamberte0081f72008-11-16 20:12:04 +00006767DEFUN (show_bgp_views,
6768 show_bgp_views_cmd,
6769 "show bgp views",
6770 SHOW_STR
6771 BGP_STR
6772 "Show the defined BGP views\n")
6773{
6774 struct list *inst = bm->bgp;
6775 struct listnode *node;
6776 struct bgp *bgp;
6777
6778 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
6779 {
6780 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
6781 return CMD_WARNING;
6782 }
6783
6784 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
6785 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
6786 vty_out (vty, "\t%s (AS%u)%s",
6787 bgp->name ? bgp->name : "(null)",
6788 bgp->as, VTY_NEWLINE);
6789
6790 return CMD_SUCCESS;
6791}
6792
Paul Jakma4bf6a362006-03-30 14:05:23 +00006793DEFUN (show_bgp_memory,
6794 show_bgp_memory_cmd,
6795 "show bgp memory",
6796 SHOW_STR
6797 BGP_STR
6798 "Global BGP memory statistics\n")
6799{
6800 char memstrbuf[MTYPE_MEMSTR_LEN];
6801 unsigned long count;
6802
6803 /* RIB related usage stats */
6804 count = mtype_stats_alloc (MTYPE_BGP_NODE);
6805 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
6806 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6807 count * sizeof (struct bgp_node)),
6808 VTY_NEWLINE);
6809
6810 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
6811 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
6812 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6813 count * sizeof (struct bgp_info)),
6814 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006815 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
6816 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
6817 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6818 count * sizeof (struct bgp_info_extra)),
6819 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006820
6821 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
6822 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
6823 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6824 count * sizeof (struct bgp_static)),
6825 VTY_NEWLINE);
6826
6827 /* Adj-In/Out */
6828 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
6829 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
6830 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6831 count * sizeof (struct bgp_adj_in)),
6832 VTY_NEWLINE);
6833 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
6834 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
6835 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6836 count * sizeof (struct bgp_adj_out)),
6837 VTY_NEWLINE);
6838
6839 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
6840 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
6841 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6842 count * sizeof (struct bgp_nexthop_cache)),
6843 VTY_NEWLINE);
6844
6845 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
6846 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
6847 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6848 count * sizeof (struct bgp_damp_info)),
6849 VTY_NEWLINE);
6850
6851 /* Attributes */
6852 count = attr_count();
6853 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
6854 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6855 count * sizeof(struct attr)),
6856 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006857 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
6858 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
6859 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6860 count * sizeof(struct attr_extra)),
6861 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006862
6863 if ((count = attr_unknown_count()))
6864 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
6865
6866 /* AS_PATH attributes */
6867 count = aspath_count ();
6868 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
6869 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6870 count * sizeof (struct aspath)),
6871 VTY_NEWLINE);
6872
6873 count = mtype_stats_alloc (MTYPE_AS_SEG);
6874 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
6875 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6876 count * sizeof (struct assegment)),
6877 VTY_NEWLINE);
6878
6879 /* Other attributes */
6880 if ((count = community_count ()))
6881 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6882 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6883 count * sizeof (struct community)),
6884 VTY_NEWLINE);
6885 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
6886 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6887 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6888 count * sizeof (struct ecommunity)),
6889 VTY_NEWLINE);
6890
6891 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
6892 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
6893 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6894 count * sizeof (struct cluster_list)),
6895 VTY_NEWLINE);
6896
6897 /* Peer related usage */
6898 count = mtype_stats_alloc (MTYPE_BGP_PEER);
6899 vty_out (vty, "%ld peers, using %s of memory%s", count,
6900 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6901 count * sizeof (struct peer)),
6902 VTY_NEWLINE);
6903
6904 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
6905 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
6906 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6907 count * sizeof (struct peer_group)),
6908 VTY_NEWLINE);
6909
6910 /* Other */
6911 if ((count = mtype_stats_alloc (MTYPE_HASH)))
6912 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
6913 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6914 count * sizeof (struct hash)),
6915 VTY_NEWLINE);
6916 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
6917 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
6918 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6919 count * sizeof (struct hash_backet)),
6920 VTY_NEWLINE);
6921 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
6922 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
6923 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6924 count * sizeof (regex_t)),
6925 VTY_NEWLINE);
6926 return CMD_SUCCESS;
6927}
paulfee0f4c2004-09-13 05:12:46 +00006928
paul718e3742002-12-13 20:15:29 +00006929/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00006930static int
paul718e3742002-12-13 20:15:29 +00006931bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
6932{
6933 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00006934 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00006935 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00006936 char timebuf[BGP_UPTIME_LEN];
6937 int len;
6938
6939 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00006940 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00006941
paul1eb8ef22005-04-07 07:30:20 +00006942 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00006943 {
6944 if (peer->afc[afi][safi])
6945 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00006946 if (!count)
6947 {
6948 unsigned long ents;
6949 char memstrbuf[MTYPE_MEMSTR_LEN];
6950
6951 /* Usage summary and header */
6952 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04006953 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00006954 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006955
Paul Jakma4bf6a362006-03-30 14:05:23 +00006956 ents = bgp_table_count (bgp->rib[afi][safi]);
6957 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
6958 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6959 ents * sizeof (struct bgp_node)),
6960 VTY_NEWLINE);
6961
6962 /* Peer related usage */
6963 ents = listcount (bgp->peer);
6964 vty_out (vty, "Peers %ld, using %s of memory%s",
6965 ents,
6966 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6967 ents * sizeof (struct peer)),
6968 VTY_NEWLINE);
6969
6970 if ((ents = listcount (bgp->rsclient)))
6971 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
6972 ents,
6973 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6974 ents * sizeof (struct peer)),
6975 VTY_NEWLINE);
6976
6977 if ((ents = listcount (bgp->group)))
6978 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
6979 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6980 ents * sizeof (struct peer_group)),
6981 VTY_NEWLINE);
6982
6983 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
6984 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
6985 vty_out (vty, "%s", VTY_NEWLINE);
6986 vty_out (vty, "%s%s", header, VTY_NEWLINE);
6987 }
6988
paul718e3742002-12-13 20:15:29 +00006989 count++;
6990
6991 len = vty_out (vty, "%s", peer->host);
6992 len = 16 - len;
6993 if (len < 1)
6994 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
6995 else
6996 vty_out (vty, "%*s", len, " ");
6997
hasso3d515fd2005-02-01 21:30:04 +00006998 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00006999
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007000 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00007001 peer->as,
7002 peer->open_in + peer->update_in + peer->keepalive_in
7003 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
7004 peer->open_out + peer->update_out + peer->keepalive_out
7005 + peer->notify_out + peer->refresh_out
7006 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007007 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00007008
7009 vty_out (vty, "%8s",
7010 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7011
7012 if (peer->status == Established)
7013 {
7014 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
7015 }
7016 else
7017 {
7018 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7019 vty_out (vty, " Idle (Admin)");
7020 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7021 vty_out (vty, " Idle (PfxCt)");
7022 else
7023 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7024 }
7025
7026 vty_out (vty, "%s", VTY_NEWLINE);
7027 }
7028 }
7029
7030 if (count)
7031 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7032 count, VTY_NEWLINE);
7033 else
7034 vty_out (vty, "No %s neighbor is configured%s",
7035 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7036 return CMD_SUCCESS;
7037}
7038
paul94f2b392005-06-28 12:44:16 +00007039static int
paulfd79ac92004-10-13 05:06:08 +00007040bgp_show_summary_vty (struct vty *vty, const char *name,
7041 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007042{
7043 struct bgp *bgp;
7044
7045 if (name)
7046 {
7047 bgp = bgp_lookup_by_name (name);
7048
7049 if (! bgp)
7050 {
7051 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7052 return CMD_WARNING;
7053 }
7054
7055 bgp_show_summary (vty, bgp, afi, safi);
7056 return CMD_SUCCESS;
7057 }
7058
7059 bgp = bgp_get_default ();
7060
7061 if (bgp)
7062 bgp_show_summary (vty, bgp, afi, safi);
7063
7064 return CMD_SUCCESS;
7065}
7066
7067/* `show ip bgp summary' commands. */
7068DEFUN (show_ip_bgp_summary,
7069 show_ip_bgp_summary_cmd,
7070 "show ip bgp summary",
7071 SHOW_STR
7072 IP_STR
7073 BGP_STR
7074 "Summary of BGP neighbor status\n")
7075{
7076 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7077}
7078
7079DEFUN (show_ip_bgp_instance_summary,
7080 show_ip_bgp_instance_summary_cmd,
7081 "show ip bgp view WORD summary",
7082 SHOW_STR
7083 IP_STR
7084 BGP_STR
7085 "BGP view\n"
7086 "View name\n"
7087 "Summary of BGP neighbor status\n")
7088{
7089 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7090}
7091
7092DEFUN (show_ip_bgp_ipv4_summary,
7093 show_ip_bgp_ipv4_summary_cmd,
7094 "show ip bgp ipv4 (unicast|multicast) summary",
7095 SHOW_STR
7096 IP_STR
7097 BGP_STR
7098 "Address family\n"
7099 "Address Family modifier\n"
7100 "Address Family modifier\n"
7101 "Summary of BGP neighbor status\n")
7102{
7103 if (strncmp (argv[0], "m", 1) == 0)
7104 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7105
7106 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7107}
7108
Michael Lambert95cbbd22010-07-23 14:43:04 -04007109ALIAS (show_ip_bgp_ipv4_summary,
7110 show_bgp_ipv4_safi_summary_cmd,
7111 "show bgp ipv4 (unicast|multicast) summary",
7112 SHOW_STR
7113 BGP_STR
7114 "Address family\n"
7115 "Address Family modifier\n"
7116 "Address Family modifier\n"
7117 "Summary of BGP neighbor status\n")
7118
paul718e3742002-12-13 20:15:29 +00007119DEFUN (show_ip_bgp_instance_ipv4_summary,
7120 show_ip_bgp_instance_ipv4_summary_cmd,
7121 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7122 SHOW_STR
7123 IP_STR
7124 BGP_STR
7125 "BGP view\n"
7126 "View name\n"
7127 "Address family\n"
7128 "Address Family modifier\n"
7129 "Address Family modifier\n"
7130 "Summary of BGP neighbor status\n")
7131{
7132 if (strncmp (argv[1], "m", 1) == 0)
7133 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7134 else
7135 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7136}
7137
Michael Lambert95cbbd22010-07-23 14:43:04 -04007138ALIAS (show_ip_bgp_instance_ipv4_summary,
7139 show_bgp_instance_ipv4_safi_summary_cmd,
7140 "show bgp view WORD ipv4 (unicast|multicast) summary",
7141 SHOW_STR
7142 BGP_STR
7143 "BGP view\n"
7144 "View name\n"
7145 "Address family\n"
7146 "Address Family modifier\n"
7147 "Address Family modifier\n"
7148 "Summary of BGP neighbor status\n")
7149
paul718e3742002-12-13 20:15:29 +00007150DEFUN (show_ip_bgp_vpnv4_all_summary,
7151 show_ip_bgp_vpnv4_all_summary_cmd,
7152 "show ip bgp vpnv4 all summary",
7153 SHOW_STR
7154 IP_STR
7155 BGP_STR
7156 "Display VPNv4 NLRI specific information\n"
7157 "Display information about all VPNv4 NLRIs\n"
7158 "Summary of BGP neighbor status\n")
7159{
7160 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7161}
7162
7163DEFUN (show_ip_bgp_vpnv4_rd_summary,
7164 show_ip_bgp_vpnv4_rd_summary_cmd,
7165 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7166 SHOW_STR
7167 IP_STR
7168 BGP_STR
7169 "Display VPNv4 NLRI specific information\n"
7170 "Display information for a route distinguisher\n"
7171 "VPN Route Distinguisher\n"
7172 "Summary of BGP neighbor status\n")
7173{
7174 int ret;
7175 struct prefix_rd prd;
7176
7177 ret = str2prefix_rd (argv[0], &prd);
7178 if (! ret)
7179 {
7180 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7181 return CMD_WARNING;
7182 }
7183
7184 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7185}
7186
7187#ifdef HAVE_IPV6
7188DEFUN (show_bgp_summary,
7189 show_bgp_summary_cmd,
7190 "show bgp summary",
7191 SHOW_STR
7192 BGP_STR
7193 "Summary of BGP neighbor status\n")
7194{
7195 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7196}
7197
7198DEFUN (show_bgp_instance_summary,
7199 show_bgp_instance_summary_cmd,
7200 "show bgp view WORD summary",
7201 SHOW_STR
7202 BGP_STR
7203 "BGP view\n"
7204 "View name\n"
7205 "Summary of BGP neighbor status\n")
7206{
7207 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7208}
7209
7210ALIAS (show_bgp_summary,
7211 show_bgp_ipv6_summary_cmd,
7212 "show bgp ipv6 summary",
7213 SHOW_STR
7214 BGP_STR
7215 "Address family\n"
7216 "Summary of BGP neighbor status\n")
7217
7218ALIAS (show_bgp_instance_summary,
7219 show_bgp_instance_ipv6_summary_cmd,
7220 "show bgp view WORD ipv6 summary",
7221 SHOW_STR
7222 BGP_STR
7223 "BGP view\n"
7224 "View name\n"
7225 "Address family\n"
7226 "Summary of BGP neighbor status\n")
7227
Michael Lambert95cbbd22010-07-23 14:43:04 -04007228DEFUN (show_bgp_ipv6_safi_summary,
7229 show_bgp_ipv6_safi_summary_cmd,
7230 "show bgp ipv6 (unicast|multicast) summary",
7231 SHOW_STR
7232 BGP_STR
7233 "Address family\n"
7234 "Address Family modifier\n"
7235 "Address Family modifier\n"
7236 "Summary of BGP neighbor status\n")
7237{
7238 if (strncmp (argv[0], "m", 1) == 0)
7239 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7240
7241 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7242}
7243
7244DEFUN (show_bgp_instance_ipv6_safi_summary,
7245 show_bgp_instance_ipv6_safi_summary_cmd,
7246 "show bgp view WORD ipv6 (unicast|multicast) summary",
7247 SHOW_STR
7248 BGP_STR
7249 "BGP view\n"
7250 "View name\n"
7251 "Address family\n"
7252 "Address Family modifier\n"
7253 "Address Family modifier\n"
7254 "Summary of BGP neighbor status\n")
7255{
7256 if (strncmp (argv[1], "m", 1) == 0)
7257 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7258
7259 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7260}
7261
paul718e3742002-12-13 20:15:29 +00007262/* old command */
7263DEFUN (show_ipv6_bgp_summary,
7264 show_ipv6_bgp_summary_cmd,
7265 "show ipv6 bgp summary",
7266 SHOW_STR
7267 IPV6_STR
7268 BGP_STR
7269 "Summary of BGP neighbor status\n")
7270{
7271 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7272}
7273
7274/* old command */
7275DEFUN (show_ipv6_mbgp_summary,
7276 show_ipv6_mbgp_summary_cmd,
7277 "show ipv6 mbgp summary",
7278 SHOW_STR
7279 IPV6_STR
7280 MBGP_STR
7281 "Summary of BGP neighbor status\n")
7282{
7283 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7284}
7285#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02007286
paulfd79ac92004-10-13 05:06:08 +00007287const char *
hasso538621f2004-05-21 09:31:30 +00007288afi_safi_print (afi_t afi, safi_t safi)
7289{
7290 if (afi == AFI_IP && safi == SAFI_UNICAST)
7291 return "IPv4 Unicast";
7292 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7293 return "IPv4 Multicast";
7294 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
7295 return "VPNv4 Unicast";
7296 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7297 return "IPv6 Unicast";
7298 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7299 return "IPv6 Multicast";
7300 else
7301 return "Unknown";
7302}
7303
paul718e3742002-12-13 20:15:29 +00007304/* Show BGP peer's information. */
7305enum show_type
7306{
7307 show_all,
7308 show_peer
7309};
7310
paul94f2b392005-06-28 12:44:16 +00007311static void
paul718e3742002-12-13 20:15:29 +00007312bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7313 afi_t afi, safi_t safi,
7314 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7315 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7316{
7317 /* Send-Mode */
7318 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7319 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7320 {
7321 vty_out (vty, " Send-mode: ");
7322 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7323 vty_out (vty, "advertised");
7324 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7325 vty_out (vty, "%sreceived",
7326 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7327 ", " : "");
7328 vty_out (vty, "%s", VTY_NEWLINE);
7329 }
7330
7331 /* Receive-Mode */
7332 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7333 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7334 {
7335 vty_out (vty, " Receive-mode: ");
7336 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7337 vty_out (vty, "advertised");
7338 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7339 vty_out (vty, "%sreceived",
7340 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7341 ", " : "");
7342 vty_out (vty, "%s", VTY_NEWLINE);
7343 }
7344}
7345
paul94f2b392005-06-28 12:44:16 +00007346static void
paul718e3742002-12-13 20:15:29 +00007347bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7348{
7349 struct bgp_filter *filter;
7350 char orf_pfx_name[BUFSIZ];
7351 int orf_pfx_count;
7352
7353 filter = &p->filter[afi][safi];
7354
hasso538621f2004-05-21 09:31:30 +00007355 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007356 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007357
paul718e3742002-12-13 20:15:29 +00007358 if (p->af_group[afi][safi])
7359 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7360
7361 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7362 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7363 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7364 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7365 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7366 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7367 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7368
7369 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7370 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7371 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7372 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7373 {
7374 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7375 ORF_TYPE_PREFIX, VTY_NEWLINE);
7376 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7377 PEER_CAP_ORF_PREFIX_SM_ADV,
7378 PEER_CAP_ORF_PREFIX_RM_ADV,
7379 PEER_CAP_ORF_PREFIX_SM_RCV,
7380 PEER_CAP_ORF_PREFIX_RM_RCV);
7381 }
7382 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7383 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7384 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7385 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7386 {
7387 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7388 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7389 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7390 PEER_CAP_ORF_PREFIX_SM_ADV,
7391 PEER_CAP_ORF_PREFIX_RM_ADV,
7392 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7393 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7394 }
7395
7396 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7397 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7398
7399 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7400 || orf_pfx_count)
7401 {
7402 vty_out (vty, " Outbound Route Filter (ORF):");
7403 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7404 vty_out (vty, " sent;");
7405 if (orf_pfx_count)
7406 vty_out (vty, " received (%d entries)", orf_pfx_count);
7407 vty_out (vty, "%s", VTY_NEWLINE);
7408 }
7409 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7410 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7411
7412 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7413 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7414 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7415 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7416 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7417 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7418 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7419 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7420 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7421 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
7422 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
7423 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7424 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
7425 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7426 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
7427 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7428 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7429 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
7430 {
7431 vty_out (vty, " Community attribute sent to this neighbor");
7432 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7433 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007434 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007435 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007436 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007437 else
hasso538621f2004-05-21 09:31:30 +00007438 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007439 }
7440 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
7441 {
7442 vty_out (vty, " Default information originate,");
7443
7444 if (p->default_rmap[afi][safi].name)
7445 vty_out (vty, " default route-map %s%s,",
7446 p->default_rmap[afi][safi].map ? "*" : "",
7447 p->default_rmap[afi][safi].name);
7448 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
7449 vty_out (vty, " default sent%s", VTY_NEWLINE);
7450 else
7451 vty_out (vty, " default not sent%s", VTY_NEWLINE);
7452 }
7453
7454 if (filter->plist[FILTER_IN].name
7455 || filter->dlist[FILTER_IN].name
7456 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00007457 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007458 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
7459 if (filter->plist[FILTER_OUT].name
7460 || filter->dlist[FILTER_OUT].name
7461 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00007462 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00007463 || filter->usmap.name)
7464 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007465 if (filter->map[RMAP_IMPORT].name)
7466 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
7467 if (filter->map[RMAP_EXPORT].name)
7468 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007469
7470 /* prefix-list */
7471 if (filter->plist[FILTER_IN].name)
7472 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
7473 filter->plist[FILTER_IN].plist ? "*" : "",
7474 filter->plist[FILTER_IN].name,
7475 VTY_NEWLINE);
7476 if (filter->plist[FILTER_OUT].name)
7477 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
7478 filter->plist[FILTER_OUT].plist ? "*" : "",
7479 filter->plist[FILTER_OUT].name,
7480 VTY_NEWLINE);
7481
7482 /* distribute-list */
7483 if (filter->dlist[FILTER_IN].name)
7484 vty_out (vty, " Incoming update network filter list is %s%s%s",
7485 filter->dlist[FILTER_IN].alist ? "*" : "",
7486 filter->dlist[FILTER_IN].name,
7487 VTY_NEWLINE);
7488 if (filter->dlist[FILTER_OUT].name)
7489 vty_out (vty, " Outgoing update network filter list is %s%s%s",
7490 filter->dlist[FILTER_OUT].alist ? "*" : "",
7491 filter->dlist[FILTER_OUT].name,
7492 VTY_NEWLINE);
7493
7494 /* filter-list. */
7495 if (filter->aslist[FILTER_IN].name)
7496 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
7497 filter->aslist[FILTER_IN].aslist ? "*" : "",
7498 filter->aslist[FILTER_IN].name,
7499 VTY_NEWLINE);
7500 if (filter->aslist[FILTER_OUT].name)
7501 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
7502 filter->aslist[FILTER_OUT].aslist ? "*" : "",
7503 filter->aslist[FILTER_OUT].name,
7504 VTY_NEWLINE);
7505
7506 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00007507 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007508 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007509 filter->map[RMAP_IN].map ? "*" : "",
7510 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00007511 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007512 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00007513 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007514 filter->map[RMAP_OUT].map ? "*" : "",
7515 filter->map[RMAP_OUT].name,
7516 VTY_NEWLINE);
7517 if (filter->map[RMAP_IMPORT].name)
7518 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
7519 filter->map[RMAP_IMPORT].map ? "*" : "",
7520 filter->map[RMAP_IMPORT].name,
7521 VTY_NEWLINE);
7522 if (filter->map[RMAP_EXPORT].name)
7523 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
7524 filter->map[RMAP_EXPORT].map ? "*" : "",
7525 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00007526 VTY_NEWLINE);
7527
7528 /* unsuppress-map */
7529 if (filter->usmap.name)
7530 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
7531 filter->usmap.map ? "*" : "",
7532 filter->usmap.name, VTY_NEWLINE);
7533
7534 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00007535 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
7536
paul718e3742002-12-13 20:15:29 +00007537 /* Maximum prefix */
7538 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
7539 {
hasso0a486e52005-02-01 20:57:17 +00007540 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00007541 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00007542 ? " (warning-only)" : "", VTY_NEWLINE);
7543 vty_out (vty, " Threshold for warning message %d%%",
7544 p->pmax_threshold[afi][safi]);
7545 if (p->pmax_restart[afi][safi])
7546 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
7547 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007548 }
paul718e3742002-12-13 20:15:29 +00007549
7550 vty_out (vty, "%s", VTY_NEWLINE);
7551}
7552
paul94f2b392005-06-28 12:44:16 +00007553static void
paul718e3742002-12-13 20:15:29 +00007554bgp_show_peer (struct vty *vty, struct peer *p)
7555{
7556 struct bgp *bgp;
7557 char buf1[BUFSIZ];
7558 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00007559 afi_t afi;
7560 safi_t safi;
paul718e3742002-12-13 20:15:29 +00007561
7562 bgp = p->bgp;
7563
7564 /* Configured IP address. */
7565 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007566 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00007567 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00007568 p->change_local_as ? p->change_local_as : p->local_as,
7569 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00007570 " no-prepend" : "",
7571 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
7572 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00007573 vty_out (vty, "%s link%s",
7574 p->as == p->local_as ? "internal" : "external",
7575 VTY_NEWLINE);
7576
7577 /* Description. */
7578 if (p->desc)
7579 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
7580
7581 /* Peer-group */
7582 if (p->group)
7583 vty_out (vty, " Member of peer-group %s for session parameters%s",
7584 p->group->name, VTY_NEWLINE);
7585
7586 /* Administrative shutdown. */
7587 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
7588 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
7589
7590 /* BGP Version. */
7591 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00007592 vty_out (vty, ", remote router ID %s%s",
7593 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
7594 VTY_NEWLINE);
7595
7596 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00007597 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
7598 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00007599 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
7600
7601 /* Status. */
7602 vty_out (vty, " BGP state = %s",
7603 LOOKUP (bgp_status_msg, p->status));
7604 if (p->status == Established)
7605 vty_out (vty, ", up for %8s",
7606 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00007607 else if (p->status == Active)
7608 {
7609 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7610 vty_out (vty, " (passive)");
7611 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7612 vty_out (vty, " (NSF passive)");
7613 }
paul718e3742002-12-13 20:15:29 +00007614 vty_out (vty, "%s", VTY_NEWLINE);
7615
7616 /* read timer */
7617 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7618
7619 /* Configured timer values. */
7620 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7621 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7622 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7623 {
7624 vty_out (vty, " Configured hold time is %d", p->holdtime);
7625 vty_out (vty, ", keepalive interval is %d seconds%s",
7626 p->keepalive, VTY_NEWLINE);
7627 }
hasso93406d82005-02-02 14:40:33 +00007628
paul718e3742002-12-13 20:15:29 +00007629 /* Capability. */
7630 if (p->status == Established)
7631 {
hasso538621f2004-05-21 09:31:30 +00007632 if (p->cap
paul718e3742002-12-13 20:15:29 +00007633 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7634 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7635 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7636 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7637#ifdef HAVE_IPV6
7638 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7639 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7640 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7641 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
7642#endif /* HAVE_IPV6 */
7643 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7644 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7645 {
7646 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7647
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007648 /* AS4 */
7649 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
7650 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7651 {
7652 vty_out (vty, " 4 Byte AS:");
7653 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7654 vty_out (vty, " advertised");
7655 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
7656 vty_out (vty, " %sreceived",
7657 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
7658 vty_out (vty, "%s", VTY_NEWLINE);
7659 }
paul718e3742002-12-13 20:15:29 +00007660 /* Dynamic */
7661 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
7662 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7663 {
7664 vty_out (vty, " Dynamic:");
7665 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7666 vty_out (vty, " advertised");
7667 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00007668 vty_out (vty, " %sreceived",
7669 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007670 vty_out (vty, "%s", VTY_NEWLINE);
7671 }
7672
7673 /* Route Refresh */
7674 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
7675 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7676 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
7677 {
7678 vty_out (vty, " Route refresh:");
7679 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
7680 vty_out (vty, " advertised");
7681 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7682 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00007683 vty_out (vty, " %sreceived(%s)",
7684 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
7685 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
7686 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
7687 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
7688
paul718e3742002-12-13 20:15:29 +00007689 vty_out (vty, "%s", VTY_NEWLINE);
7690 }
7691
hasso538621f2004-05-21 09:31:30 +00007692 /* Multiprotocol Extensions */
7693 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7694 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7695 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00007696 {
hasso538621f2004-05-21 09:31:30 +00007697 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
7698 if (p->afc_adv[afi][safi])
7699 vty_out (vty, " advertised");
7700 if (p->afc_recv[afi][safi])
7701 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
7702 vty_out (vty, "%s", VTY_NEWLINE);
7703 }
7704
7705 /* Gracefull Restart */
7706 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7707 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007708 {
hasso538621f2004-05-21 09:31:30 +00007709 vty_out (vty, " Graceful Restart Capabilty:");
7710 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007711 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00007712 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
7713 vty_out (vty, " %sreceived",
7714 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007715 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007716
7717 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00007718 {
hasso538621f2004-05-21 09:31:30 +00007719 int restart_af_count = 0;
7720
7721 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00007722 p->v_gr_restart, VTY_NEWLINE);
7723 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007724
7725 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7726 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7727 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
7728 {
hasso93406d82005-02-02 14:40:33 +00007729 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
7730 afi_safi_print (afi, safi),
7731 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
7732 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00007733 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00007734 }
hasso538621f2004-05-21 09:31:30 +00007735 if (! restart_af_count)
7736 vty_out (vty, "none");
7737 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007738 }
paul718e3742002-12-13 20:15:29 +00007739 }
paul718e3742002-12-13 20:15:29 +00007740 }
7741 }
7742
hasso93406d82005-02-02 14:40:33 +00007743 /* graceful restart information */
7744 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7745 || p->t_gr_restart
7746 || p->t_gr_stale)
7747 {
7748 int eor_send_af_count = 0;
7749 int eor_receive_af_count = 0;
7750
7751 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
7752 if (p->status == Established)
7753 {
7754 vty_out (vty, " End-of-RIB send: ");
7755 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7756 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7757 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
7758 {
7759 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
7760 afi_safi_print (afi, safi));
7761 eor_send_af_count++;
7762 }
7763 vty_out (vty, "%s", VTY_NEWLINE);
7764
7765 vty_out (vty, " End-of-RIB received: ");
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_RECEIVED))
7769 {
7770 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
7771 afi_safi_print (afi, safi));
7772 eor_receive_af_count++;
7773 }
7774 vty_out (vty, "%s", VTY_NEWLINE);
7775 }
7776
7777 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007778 vty_out (vty, " The remaining time of restart timer is %ld%s",
7779 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
7780
hasso93406d82005-02-02 14:40:33 +00007781 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007782 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
7783 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007784 }
7785
paul718e3742002-12-13 20:15:29 +00007786 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00007787 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
7788 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007789 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007790 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
7791 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
7792 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
7793 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
7794 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
7795 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
7796 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
7797 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
7798 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
7799 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
7800 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007801
7802 /* advertisement-interval */
7803 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
7804 p->v_routeadv, VTY_NEWLINE);
7805
7806 /* Update-source. */
7807 if (p->update_if || p->update_source)
7808 {
7809 vty_out (vty, " Update source is ");
7810 if (p->update_if)
7811 vty_out (vty, "%s", p->update_if);
7812 else if (p->update_source)
7813 vty_out (vty, "%s",
7814 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
7815 vty_out (vty, "%s", VTY_NEWLINE);
7816 }
7817
7818 /* Default weight */
7819 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
7820 vty_out (vty, " Default weight %d%s", p->weight,
7821 VTY_NEWLINE);
7822
7823 vty_out (vty, "%s", VTY_NEWLINE);
7824
7825 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00007826 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7827 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7828 if (p->afc[afi][safi])
7829 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00007830
7831 vty_out (vty, " Connections established %d; dropped %d%s",
7832 p->established, p->dropped,
7833 VTY_NEWLINE);
7834
hassoe0701b72004-05-20 09:19:34 +00007835 if (! p->dropped)
7836 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
7837 else
7838 vty_out (vty, " Last reset %s, due to %s%s",
7839 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
7840 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00007841
paul718e3742002-12-13 20:15:29 +00007842 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7843 {
7844 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00007845
7846 if (p->t_pmax_restart)
7847 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
7848 p->host, thread_timer_remain_second (p->t_pmax_restart),
7849 VTY_NEWLINE);
7850 else
7851 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
7852 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007853 }
7854
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00007855 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00007856 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00007857 {
7858 if (p->gtsm_hops > 0)
7859 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7860 p->gtsm_hops, VTY_NEWLINE);
7861 else if (p->ttl > 1)
7862 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7863 p->ttl, VTY_NEWLINE);
7864 }
Pradosh Mohapatra5d804b42013-09-12 03:37:07 +00007865 else
7866 {
7867 if (p->gtsm_hops > 0)
7868 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
7869 p->gtsm_hops, VTY_NEWLINE);
7870 }
paul718e3742002-12-13 20:15:29 +00007871
7872 /* Local address. */
7873 if (p->su_local)
7874 {
hasso93406d82005-02-02 14:40:33 +00007875 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00007876 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
7877 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00007878 VTY_NEWLINE);
7879 }
7880
7881 /* Remote address. */
7882 if (p->su_remote)
7883 {
7884 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
7885 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
7886 ntohs (p->su_remote->sin.sin_port),
7887 VTY_NEWLINE);
7888 }
7889
7890 /* Nexthop display. */
7891 if (p->su_local)
7892 {
7893 vty_out (vty, "Nexthop: %s%s",
7894 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
7895 VTY_NEWLINE);
7896#ifdef HAVE_IPV6
7897 vty_out (vty, "Nexthop global: %s%s",
7898 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
7899 VTY_NEWLINE);
7900 vty_out (vty, "Nexthop local: %s%s",
7901 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
7902 VTY_NEWLINE);
7903 vty_out (vty, "BGP connection: %s%s",
7904 p->shared_network ? "shared network" : "non shared network",
7905 VTY_NEWLINE);
7906#endif /* HAVE_IPV6 */
7907 }
7908
7909 /* Timer information. */
7910 if (p->t_start)
7911 vty_out (vty, "Next start timer due in %ld seconds%s",
7912 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
7913 if (p->t_connect)
7914 vty_out (vty, "Next connect timer due in %ld seconds%s",
7915 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
7916
7917 vty_out (vty, "Read thread: %s Write thread: %s%s",
7918 p->t_read ? "on" : "off",
7919 p->t_write ? "on" : "off",
7920 VTY_NEWLINE);
7921
7922 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
7923 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
7924 bgp_capability_vty_out (vty, p);
7925
7926 vty_out (vty, "%s", VTY_NEWLINE);
7927}
7928
paul94f2b392005-06-28 12:44:16 +00007929static int
paul718e3742002-12-13 20:15:29 +00007930bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
7931 enum show_type type, union sockunion *su)
7932{
paul1eb8ef22005-04-07 07:30:20 +00007933 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00007934 struct peer *peer;
7935 int find = 0;
7936
paul1eb8ef22005-04-07 07:30:20 +00007937 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007938 {
7939 switch (type)
7940 {
7941 case show_all:
7942 bgp_show_peer (vty, peer);
7943 break;
7944 case show_peer:
7945 if (sockunion_same (&peer->su, su))
7946 {
7947 find = 1;
7948 bgp_show_peer (vty, peer);
7949 }
7950 break;
7951 }
7952 }
7953
7954 if (type == show_peer && ! find)
7955 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
7956
7957 return CMD_SUCCESS;
7958}
7959
paul94f2b392005-06-28 12:44:16 +00007960static int
paulfd79ac92004-10-13 05:06:08 +00007961bgp_show_neighbor_vty (struct vty *vty, const char *name,
7962 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00007963{
7964 int ret;
7965 struct bgp *bgp;
7966 union sockunion su;
7967
7968 if (ip_str)
7969 {
7970 ret = str2sockunion (ip_str, &su);
7971 if (ret < 0)
7972 {
7973 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
7974 return CMD_WARNING;
7975 }
7976 }
7977
7978 if (name)
7979 {
7980 bgp = bgp_lookup_by_name (name);
7981
7982 if (! bgp)
7983 {
7984 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7985 return CMD_WARNING;
7986 }
7987
7988 bgp_show_neighbor (vty, bgp, type, &su);
7989
7990 return CMD_SUCCESS;
7991 }
7992
7993 bgp = bgp_get_default ();
7994
7995 if (bgp)
7996 bgp_show_neighbor (vty, bgp, type, &su);
7997
7998 return CMD_SUCCESS;
7999}
8000
8001/* "show ip bgp neighbors" commands. */
8002DEFUN (show_ip_bgp_neighbors,
8003 show_ip_bgp_neighbors_cmd,
8004 "show ip bgp neighbors",
8005 SHOW_STR
8006 IP_STR
8007 BGP_STR
8008 "Detailed information on TCP and BGP neighbor connections\n")
8009{
8010 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8011}
8012
8013ALIAS (show_ip_bgp_neighbors,
8014 show_ip_bgp_ipv4_neighbors_cmd,
8015 "show ip bgp ipv4 (unicast|multicast) neighbors",
8016 SHOW_STR
8017 IP_STR
8018 BGP_STR
8019 "Address family\n"
8020 "Address Family modifier\n"
8021 "Address Family modifier\n"
8022 "Detailed information on TCP and BGP neighbor connections\n")
8023
8024ALIAS (show_ip_bgp_neighbors,
8025 show_ip_bgp_vpnv4_all_neighbors_cmd,
8026 "show ip bgp vpnv4 all neighbors",
8027 SHOW_STR
8028 IP_STR
8029 BGP_STR
8030 "Display VPNv4 NLRI specific information\n"
8031 "Display information about all VPNv4 NLRIs\n"
8032 "Detailed information on TCP and BGP neighbor connections\n")
8033
8034ALIAS (show_ip_bgp_neighbors,
8035 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8036 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8037 SHOW_STR
8038 IP_STR
8039 BGP_STR
8040 "Display VPNv4 NLRI specific information\n"
8041 "Display information for a route distinguisher\n"
8042 "VPN Route Distinguisher\n"
8043 "Detailed information on TCP and BGP neighbor connections\n")
8044
8045ALIAS (show_ip_bgp_neighbors,
8046 show_bgp_neighbors_cmd,
8047 "show bgp neighbors",
8048 SHOW_STR
8049 BGP_STR
8050 "Detailed information on TCP and BGP neighbor connections\n")
8051
8052ALIAS (show_ip_bgp_neighbors,
8053 show_bgp_ipv6_neighbors_cmd,
8054 "show bgp ipv6 neighbors",
8055 SHOW_STR
8056 BGP_STR
8057 "Address family\n"
8058 "Detailed information on TCP and BGP neighbor connections\n")
8059
8060DEFUN (show_ip_bgp_neighbors_peer,
8061 show_ip_bgp_neighbors_peer_cmd,
8062 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8063 SHOW_STR
8064 IP_STR
8065 BGP_STR
8066 "Detailed information on TCP and BGP neighbor connections\n"
8067 "Neighbor to display information about\n"
8068 "Neighbor to display information about\n")
8069{
8070 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8071}
8072
8073ALIAS (show_ip_bgp_neighbors_peer,
8074 show_ip_bgp_ipv4_neighbors_peer_cmd,
8075 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8076 SHOW_STR
8077 IP_STR
8078 BGP_STR
8079 "Address family\n"
8080 "Address Family modifier\n"
8081 "Address Family modifier\n"
8082 "Detailed information on TCP and BGP neighbor connections\n"
8083 "Neighbor to display information about\n"
8084 "Neighbor to display information about\n")
8085
8086ALIAS (show_ip_bgp_neighbors_peer,
8087 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8088 "show ip bgp vpnv4 all neighbors A.B.C.D",
8089 SHOW_STR
8090 IP_STR
8091 BGP_STR
8092 "Display VPNv4 NLRI specific information\n"
8093 "Display information about all VPNv4 NLRIs\n"
8094 "Detailed information on TCP and BGP neighbor connections\n"
8095 "Neighbor to display information about\n")
8096
8097ALIAS (show_ip_bgp_neighbors_peer,
8098 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8099 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn 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_bgp_neighbors_peer_cmd,
8110 "show bgp neighbors (A.B.C.D|X:X::X:X)",
8111 SHOW_STR
8112 BGP_STR
8113 "Detailed information on TCP and BGP neighbor connections\n"
8114 "Neighbor to display information about\n"
8115 "Neighbor to display information about\n")
8116
8117ALIAS (show_ip_bgp_neighbors_peer,
8118 show_bgp_ipv6_neighbors_peer_cmd,
8119 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8120 SHOW_STR
8121 BGP_STR
8122 "Address family\n"
8123 "Detailed information on TCP and BGP neighbor connections\n"
8124 "Neighbor to display information about\n"
8125 "Neighbor to display information about\n")
8126
8127DEFUN (show_ip_bgp_instance_neighbors,
8128 show_ip_bgp_instance_neighbors_cmd,
8129 "show ip bgp view WORD neighbors",
8130 SHOW_STR
8131 IP_STR
8132 BGP_STR
8133 "BGP view\n"
8134 "View name\n"
8135 "Detailed information on TCP and BGP neighbor connections\n")
8136{
8137 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8138}
8139
paulbb46e942003-10-24 19:02:03 +00008140ALIAS (show_ip_bgp_instance_neighbors,
8141 show_bgp_instance_neighbors_cmd,
8142 "show bgp view WORD neighbors",
8143 SHOW_STR
8144 BGP_STR
8145 "BGP view\n"
8146 "View name\n"
8147 "Detailed information on TCP and BGP neighbor connections\n")
8148
8149ALIAS (show_ip_bgp_instance_neighbors,
8150 show_bgp_instance_ipv6_neighbors_cmd,
8151 "show bgp view WORD ipv6 neighbors",
8152 SHOW_STR
8153 BGP_STR
8154 "BGP view\n"
8155 "View name\n"
8156 "Address family\n"
8157 "Detailed information on TCP and BGP neighbor connections\n")
8158
paul718e3742002-12-13 20:15:29 +00008159DEFUN (show_ip_bgp_instance_neighbors_peer,
8160 show_ip_bgp_instance_neighbors_peer_cmd,
8161 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8162 SHOW_STR
8163 IP_STR
8164 BGP_STR
8165 "BGP view\n"
8166 "View name\n"
8167 "Detailed information on TCP and BGP neighbor connections\n"
8168 "Neighbor to display information about\n"
8169 "Neighbor to display information about\n")
8170{
8171 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8172}
paulbb46e942003-10-24 19:02:03 +00008173
8174ALIAS (show_ip_bgp_instance_neighbors_peer,
8175 show_bgp_instance_neighbors_peer_cmd,
8176 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8177 SHOW_STR
8178 BGP_STR
8179 "BGP view\n"
8180 "View name\n"
8181 "Detailed information on TCP and BGP neighbor connections\n"
8182 "Neighbor to display information about\n"
8183 "Neighbor to display information about\n")
8184
8185ALIAS (show_ip_bgp_instance_neighbors_peer,
8186 show_bgp_instance_ipv6_neighbors_peer_cmd,
8187 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8188 SHOW_STR
8189 BGP_STR
8190 "BGP view\n"
8191 "View name\n"
8192 "Address family\n"
8193 "Detailed information on TCP and BGP neighbor connections\n"
8194 "Neighbor to display information about\n"
8195 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008196
paul718e3742002-12-13 20:15:29 +00008197/* Show BGP's AS paths internal data. There are both `show ip bgp
8198 paths' and `show ip mbgp paths'. Those functions results are the
8199 same.*/
8200DEFUN (show_ip_bgp_paths,
8201 show_ip_bgp_paths_cmd,
8202 "show ip bgp paths",
8203 SHOW_STR
8204 IP_STR
8205 BGP_STR
8206 "Path information\n")
8207{
8208 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8209 aspath_print_all_vty (vty);
8210 return CMD_SUCCESS;
8211}
8212
8213DEFUN (show_ip_bgp_ipv4_paths,
8214 show_ip_bgp_ipv4_paths_cmd,
8215 "show ip bgp ipv4 (unicast|multicast) paths",
8216 SHOW_STR
8217 IP_STR
8218 BGP_STR
8219 "Address family\n"
8220 "Address Family modifier\n"
8221 "Address Family modifier\n"
8222 "Path information\n")
8223{
8224 vty_out (vty, "Address Refcnt Path\r\n");
8225 aspath_print_all_vty (vty);
8226
8227 return CMD_SUCCESS;
8228}
David Lamparter6b0655a2014-06-04 06:53:35 +02008229
paul718e3742002-12-13 20:15:29 +00008230#include "hash.h"
8231
paul94f2b392005-06-28 12:44:16 +00008232static void
paul718e3742002-12-13 20:15:29 +00008233community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8234{
8235 struct community *com;
8236
8237 com = (struct community *) backet->data;
8238 vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt,
8239 community_str (com), VTY_NEWLINE);
8240}
8241
8242/* Show BGP's community internal data. */
8243DEFUN (show_ip_bgp_community_info,
8244 show_ip_bgp_community_info_cmd,
8245 "show ip bgp community-info",
8246 SHOW_STR
8247 IP_STR
8248 BGP_STR
8249 "List all bgp community information\n")
8250{
8251 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8252
8253 hash_iterate (community_hash (),
8254 (void (*) (struct hash_backet *, void *))
8255 community_show_all_iterator,
8256 vty);
8257
8258 return CMD_SUCCESS;
8259}
8260
8261DEFUN (show_ip_bgp_attr_info,
8262 show_ip_bgp_attr_info_cmd,
8263 "show ip bgp attribute-info",
8264 SHOW_STR
8265 IP_STR
8266 BGP_STR
8267 "List all bgp attribute information\n")
8268{
8269 attr_show_all (vty);
8270 return CMD_SUCCESS;
8271}
David Lamparter6b0655a2014-06-04 06:53:35 +02008272
paul94f2b392005-06-28 12:44:16 +00008273static int
paulfee0f4c2004-09-13 05:12:46 +00008274bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8275 afi_t afi, safi_t safi)
8276{
8277 char timebuf[BGP_UPTIME_LEN];
8278 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008279 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008280 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008281 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008282 int len;
8283 int count = 0;
8284
8285 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8286 {
paul1eb8ef22005-04-07 07:30:20 +00008287 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008288 {
8289 count++;
8290 bgp_write_rsclient_summary (vty, peer, afi, safi);
8291 }
8292 return count;
8293 }
8294
8295 len = vty_out (vty, "%s", rsclient->host);
8296 len = 16 - len;
8297
8298 if (len < 1)
8299 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8300 else
8301 vty_out (vty, "%*s", len, " ");
8302
hasso3d515fd2005-02-01 21:30:04 +00008303 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008304
Milan Kociancb4fc592014-12-01 12:48:25 +00008305 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008306
8307 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8308 if ( rmname && strlen (rmname) > 13 )
8309 {
8310 sprintf (rmbuf, "%13s", "...");
8311 rmname = strncpy (rmbuf, rmname, 10);
8312 }
8313 else if (! rmname)
8314 rmname = "<none>";
8315 vty_out (vty, " %13s ", rmname);
8316
8317 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8318 if ( rmname && strlen (rmname) > 13 )
8319 {
8320 sprintf (rmbuf, "%13s", "...");
8321 rmname = strncpy (rmbuf, rmname, 10);
8322 }
8323 else if (! rmname)
8324 rmname = "<none>";
8325 vty_out (vty, " %13s ", rmname);
8326
8327 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8328
8329 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8330 vty_out (vty, " Idle (Admin)");
8331 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8332 vty_out (vty, " Idle (PfxCt)");
8333 else
8334 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8335
8336 vty_out (vty, "%s", VTY_NEWLINE);
8337
8338 return 1;
8339}
8340
paul94f2b392005-06-28 12:44:16 +00008341static int
paulfd79ac92004-10-13 05:06:08 +00008342bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8343 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008344{
8345 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008346 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008347 int count = 0;
8348
8349 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00008350 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00008351
paul1eb8ef22005-04-07 07:30:20 +00008352 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008353 {
8354 if (peer->afc[afi][safi] &&
8355 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8356 {
8357 if (! count)
8358 {
8359 vty_out (vty,
8360 "Route Server's BGP router identifier %s%s",
8361 inet_ntoa (bgp->router_id), VTY_NEWLINE);
8362 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008363 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00008364 VTY_NEWLINE);
8365
8366 vty_out (vty, "%s", VTY_NEWLINE);
8367 vty_out (vty, "%s%s", header, VTY_NEWLINE);
8368 }
8369
8370 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
8371 }
8372 }
8373
8374 if (count)
8375 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
8376 count, VTY_NEWLINE);
8377 else
8378 vty_out (vty, "No %s Route Server Client is configured%s",
8379 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
8380
8381 return CMD_SUCCESS;
8382}
8383
paul94f2b392005-06-28 12:44:16 +00008384static int
paulfd79ac92004-10-13 05:06:08 +00008385bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
8386 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008387{
8388 struct bgp *bgp;
8389
8390 if (name)
8391 {
8392 bgp = bgp_lookup_by_name (name);
8393
8394 if (! bgp)
8395 {
8396 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8397 return CMD_WARNING;
8398 }
8399
8400 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8401 return CMD_SUCCESS;
8402 }
8403
8404 bgp = bgp_get_default ();
8405
8406 if (bgp)
8407 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8408
8409 return CMD_SUCCESS;
8410}
8411
8412/* 'show bgp rsclient' commands. */
8413DEFUN (show_ip_bgp_rsclient_summary,
8414 show_ip_bgp_rsclient_summary_cmd,
8415 "show ip bgp rsclient summary",
8416 SHOW_STR
8417 IP_STR
8418 BGP_STR
8419 "Information about Route Server Clients\n"
8420 "Summary of all Route Server Clients\n")
8421{
8422 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8423}
8424
8425DEFUN (show_ip_bgp_instance_rsclient_summary,
8426 show_ip_bgp_instance_rsclient_summary_cmd,
8427 "show ip bgp view WORD rsclient summary",
8428 SHOW_STR
8429 IP_STR
8430 BGP_STR
8431 "BGP view\n"
8432 "View name\n"
8433 "Information about Route Server Clients\n"
8434 "Summary of all Route Server Clients\n")
8435{
8436 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8437}
8438
8439DEFUN (show_ip_bgp_ipv4_rsclient_summary,
8440 show_ip_bgp_ipv4_rsclient_summary_cmd,
8441 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
8442 SHOW_STR
8443 IP_STR
8444 BGP_STR
8445 "Address family\n"
8446 "Address Family modifier\n"
8447 "Address Family modifier\n"
8448 "Information about Route Server Clients\n"
8449 "Summary of all Route Server Clients\n")
8450{
8451 if (strncmp (argv[0], "m", 1) == 0)
8452 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
8453
8454 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8455}
8456
8457DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
8458 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
8459 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8460 SHOW_STR
8461 IP_STR
8462 BGP_STR
8463 "BGP view\n"
8464 "View name\n"
8465 "Address family\n"
8466 "Address Family modifier\n"
8467 "Address Family modifier\n"
8468 "Information about Route Server Clients\n"
8469 "Summary of all Route Server Clients\n")
8470{
8471 if (strncmp (argv[1], "m", 1) == 0)
8472 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
8473
8474 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8475}
8476
Michael Lambert95cbbd22010-07-23 14:43:04 -04008477DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
8478 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
8479 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8480 SHOW_STR
8481 BGP_STR
8482 "BGP view\n"
8483 "View name\n"
8484 "Address family\n"
8485 "Address Family modifier\n"
8486 "Address Family modifier\n"
8487 "Information about Route Server Clients\n"
8488 "Summary of all Route Server Clients\n")
8489{
8490 safi_t safi;
8491
8492 if (argc == 2) {
8493 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8494 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
8495 } else {
8496 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8497 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
8498 }
8499}
8500
8501ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
8502 show_bgp_ipv4_safi_rsclient_summary_cmd,
8503 "show bgp ipv4 (unicast|multicast) rsclient summary",
8504 SHOW_STR
8505 BGP_STR
8506 "Address family\n"
8507 "Address Family modifier\n"
8508 "Address Family modifier\n"
8509 "Information about Route Server Clients\n"
8510 "Summary of all Route Server Clients\n")
8511
paulfee0f4c2004-09-13 05:12:46 +00008512#ifdef HAVE_IPV6
8513DEFUN (show_bgp_rsclient_summary,
8514 show_bgp_rsclient_summary_cmd,
8515 "show bgp rsclient summary",
8516 SHOW_STR
8517 BGP_STR
8518 "Information about Route Server Clients\n"
8519 "Summary of all Route Server Clients\n")
8520{
8521 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8522}
8523
8524DEFUN (show_bgp_instance_rsclient_summary,
8525 show_bgp_instance_rsclient_summary_cmd,
8526 "show bgp view WORD rsclient summary",
8527 SHOW_STR
8528 BGP_STR
8529 "BGP view\n"
8530 "View name\n"
8531 "Information about Route Server Clients\n"
8532 "Summary of all Route Server Clients\n")
8533{
8534 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
8535}
8536
8537ALIAS (show_bgp_rsclient_summary,
8538 show_bgp_ipv6_rsclient_summary_cmd,
8539 "show bgp ipv6 rsclient summary",
8540 SHOW_STR
8541 BGP_STR
8542 "Address family\n"
8543 "Information about Route Server Clients\n"
8544 "Summary of all Route Server Clients\n")
8545
8546ALIAS (show_bgp_instance_rsclient_summary,
8547 show_bgp_instance_ipv6_rsclient_summary_cmd,
8548 "show bgp view WORD ipv6 rsclient summary",
8549 SHOW_STR
8550 BGP_STR
8551 "BGP view\n"
8552 "View name\n"
8553 "Address family\n"
8554 "Information about Route Server Clients\n"
8555 "Summary of all Route Server Clients\n")
Michael Lambert95cbbd22010-07-23 14:43:04 -04008556
8557DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
8558 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
8559 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
8560 SHOW_STR
8561 BGP_STR
8562 "BGP view\n"
8563 "View name\n"
8564 "Address family\n"
8565 "Address Family modifier\n"
8566 "Address Family modifier\n"
8567 "Information about Route Server Clients\n"
8568 "Summary of all Route Server Clients\n")
8569{
8570 safi_t safi;
8571
8572 if (argc == 2) {
8573 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8574 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
8575 } else {
8576 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8577 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
8578 }
8579}
8580
8581ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
8582 show_bgp_ipv6_safi_rsclient_summary_cmd,
8583 "show bgp ipv6 (unicast|multicast) rsclient summary",
8584 SHOW_STR
8585 BGP_STR
8586 "Address family\n"
8587 "Address Family modifier\n"
8588 "Address Family modifier\n"
8589 "Information about Route Server Clients\n"
8590 "Summary of all Route Server Clients\n")
8591
paulfee0f4c2004-09-13 05:12:46 +00008592#endif /* HAVE IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02008593
paul718e3742002-12-13 20:15:29 +00008594/* Redistribute VTY commands. */
8595
paul718e3742002-12-13 20:15:29 +00008596DEFUN (bgp_redistribute_ipv4,
8597 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008598 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008599 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008600 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008601{
8602 int type;
8603
David Lampartere0ca5fd2009-09-16 01:52:42 +02008604 type = proto_redistnum (AFI_IP, argv[0]);
8605 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008606 {
8607 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8608 return CMD_WARNING;
8609 }
8610 return bgp_redistribute_set (vty->index, AFI_IP, type);
8611}
8612
8613DEFUN (bgp_redistribute_ipv4_rmap,
8614 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008615 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008616 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008617 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008618 "Route map reference\n"
8619 "Pointer to route-map entries\n")
8620{
8621 int type;
8622
David Lampartere0ca5fd2009-09-16 01:52:42 +02008623 type = proto_redistnum (AFI_IP, argv[0]);
8624 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008625 {
8626 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8627 return CMD_WARNING;
8628 }
8629
8630 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8631 return bgp_redistribute_set (vty->index, AFI_IP, type);
8632}
8633
8634DEFUN (bgp_redistribute_ipv4_metric,
8635 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008636 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008637 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008638 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008639 "Metric for redistributed routes\n"
8640 "Default metric\n")
8641{
8642 int type;
8643 u_int32_t metric;
8644
David Lampartere0ca5fd2009-09-16 01:52:42 +02008645 type = proto_redistnum (AFI_IP, argv[0]);
8646 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008647 {
8648 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8649 return CMD_WARNING;
8650 }
8651 VTY_GET_INTEGER ("metric", metric, argv[1]);
8652
8653 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8654 return bgp_redistribute_set (vty->index, AFI_IP, type);
8655}
8656
8657DEFUN (bgp_redistribute_ipv4_rmap_metric,
8658 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008659 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008660 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008661 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008662 "Route map reference\n"
8663 "Pointer to route-map entries\n"
8664 "Metric for redistributed routes\n"
8665 "Default metric\n")
8666{
8667 int type;
8668 u_int32_t metric;
8669
David Lampartere0ca5fd2009-09-16 01:52:42 +02008670 type = proto_redistnum (AFI_IP, argv[0]);
8671 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008672 {
8673 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8674 return CMD_WARNING;
8675 }
8676 VTY_GET_INTEGER ("metric", metric, argv[2]);
8677
8678 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8679 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8680 return bgp_redistribute_set (vty->index, AFI_IP, type);
8681}
8682
8683DEFUN (bgp_redistribute_ipv4_metric_rmap,
8684 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008685 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008686 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008687 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008688 "Metric for redistributed routes\n"
8689 "Default metric\n"
8690 "Route map reference\n"
8691 "Pointer to route-map entries\n")
8692{
8693 int type;
8694 u_int32_t metric;
8695
David Lampartere0ca5fd2009-09-16 01:52:42 +02008696 type = proto_redistnum (AFI_IP, argv[0]);
8697 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008698 {
8699 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8700 return CMD_WARNING;
8701 }
8702 VTY_GET_INTEGER ("metric", metric, argv[1]);
8703
8704 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8705 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
8706 return bgp_redistribute_set (vty->index, AFI_IP, type);
8707}
8708
8709DEFUN (no_bgp_redistribute_ipv4,
8710 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008711 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008712 NO_STR
8713 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008714 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008715{
8716 int type;
8717
David Lampartere0ca5fd2009-09-16 01:52:42 +02008718 type = proto_redistnum (AFI_IP, argv[0]);
8719 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008720 {
8721 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8722 return CMD_WARNING;
8723 }
8724
8725 return bgp_redistribute_unset (vty->index, AFI_IP, type);
8726}
8727
8728DEFUN (no_bgp_redistribute_ipv4_rmap,
8729 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008730 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008731 NO_STR
8732 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008733 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008734 "Route map reference\n"
8735 "Pointer to route-map entries\n")
8736{
8737 int type;
8738
David Lampartere0ca5fd2009-09-16 01:52:42 +02008739 type = proto_redistnum (AFI_IP, argv[0]);
8740 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008741 {
8742 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8743 return CMD_WARNING;
8744 }
8745
8746 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8747 return CMD_SUCCESS;
8748}
8749
8750DEFUN (no_bgp_redistribute_ipv4_metric,
8751 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008752 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008753 NO_STR
8754 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008755 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008756 "Metric for redistributed routes\n"
8757 "Default metric\n")
8758{
8759 int type;
8760
David Lampartere0ca5fd2009-09-16 01:52:42 +02008761 type = proto_redistnum (AFI_IP, argv[0]);
8762 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008763 {
8764 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8765 return CMD_WARNING;
8766 }
8767
8768 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8769 return CMD_SUCCESS;
8770}
8771
8772DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
8773 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008774 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008775 NO_STR
8776 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008777 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008778 "Route map reference\n"
8779 "Pointer to route-map entries\n"
8780 "Metric for redistributed routes\n"
8781 "Default metric\n")
8782{
8783 int type;
8784
David Lampartere0ca5fd2009-09-16 01:52:42 +02008785 type = proto_redistnum (AFI_IP, argv[0]);
8786 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008787 {
8788 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8789 return CMD_WARNING;
8790 }
8791
8792 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8793 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8794 return CMD_SUCCESS;
8795}
8796
8797ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
8798 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008799 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008800 NO_STR
8801 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008802 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008803 "Metric for redistributed routes\n"
8804 "Default metric\n"
8805 "Route map reference\n"
8806 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008807
paul718e3742002-12-13 20:15:29 +00008808#ifdef HAVE_IPV6
8809DEFUN (bgp_redistribute_ipv6,
8810 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008811 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008812 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008813 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008814{
8815 int type;
8816
David Lampartere0ca5fd2009-09-16 01:52:42 +02008817 type = proto_redistnum (AFI_IP6, argv[0]);
8818 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008819 {
8820 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8821 return CMD_WARNING;
8822 }
8823
8824 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8825}
8826
8827DEFUN (bgp_redistribute_ipv6_rmap,
8828 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008829 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008830 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008831 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008832 "Route map reference\n"
8833 "Pointer to route-map entries\n")
8834{
8835 int type;
8836
David Lampartere0ca5fd2009-09-16 01:52:42 +02008837 type = proto_redistnum (AFI_IP6, argv[0]);
8838 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008839 {
8840 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8841 return CMD_WARNING;
8842 }
8843
8844 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8845 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8846}
8847
8848DEFUN (bgp_redistribute_ipv6_metric,
8849 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008850 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008851 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008852 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008853 "Metric for redistributed routes\n"
8854 "Default metric\n")
8855{
8856 int type;
8857 u_int32_t metric;
8858
David Lampartere0ca5fd2009-09-16 01:52:42 +02008859 type = proto_redistnum (AFI_IP6, argv[0]);
8860 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008861 {
8862 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8863 return CMD_WARNING;
8864 }
8865 VTY_GET_INTEGER ("metric", metric, argv[1]);
8866
8867 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8868 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8869}
8870
8871DEFUN (bgp_redistribute_ipv6_rmap_metric,
8872 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008873 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008874 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008875 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008876 "Route map reference\n"
8877 "Pointer to route-map entries\n"
8878 "Metric for redistributed routes\n"
8879 "Default metric\n")
8880{
8881 int type;
8882 u_int32_t metric;
8883
David Lampartere0ca5fd2009-09-16 01:52:42 +02008884 type = proto_redistnum (AFI_IP6, argv[0]);
8885 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008886 {
8887 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8888 return CMD_WARNING;
8889 }
8890 VTY_GET_INTEGER ("metric", metric, argv[2]);
8891
8892 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8893 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8894 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8895}
8896
8897DEFUN (bgp_redistribute_ipv6_metric_rmap,
8898 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008899 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008900 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008901 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008902 "Metric for redistributed routes\n"
8903 "Default metric\n"
8904 "Route map reference\n"
8905 "Pointer to route-map entries\n")
8906{
8907 int type;
8908 u_int32_t metric;
8909
David Lampartere0ca5fd2009-09-16 01:52:42 +02008910 type = proto_redistnum (AFI_IP6, argv[0]);
8911 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008912 {
8913 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8914 return CMD_WARNING;
8915 }
8916 VTY_GET_INTEGER ("metric", metric, argv[1]);
8917
8918 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8919 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
8920 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8921}
8922
8923DEFUN (no_bgp_redistribute_ipv6,
8924 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008925 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008926 NO_STR
8927 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008928 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008929{
8930 int type;
8931
David Lampartere0ca5fd2009-09-16 01:52:42 +02008932 type = proto_redistnum (AFI_IP6, argv[0]);
8933 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008934 {
8935 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8936 return CMD_WARNING;
8937 }
8938
8939 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
8940}
8941
8942DEFUN (no_bgp_redistribute_ipv6_rmap,
8943 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008944 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008945 NO_STR
8946 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008947 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008948 "Route map reference\n"
8949 "Pointer to route-map entries\n")
8950{
8951 int type;
8952
David Lampartere0ca5fd2009-09-16 01:52:42 +02008953 type = proto_redistnum (AFI_IP6, argv[0]);
8954 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008955 {
8956 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8957 return CMD_WARNING;
8958 }
8959
8960 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8961 return CMD_SUCCESS;
8962}
8963
8964DEFUN (no_bgp_redistribute_ipv6_metric,
8965 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008966 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008967 NO_STR
8968 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008969 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008970 "Metric for redistributed routes\n"
8971 "Default metric\n")
8972{
8973 int type;
8974
David Lampartere0ca5fd2009-09-16 01:52:42 +02008975 type = proto_redistnum (AFI_IP6, argv[0]);
8976 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008977 {
8978 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8979 return CMD_WARNING;
8980 }
8981
8982 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8983 return CMD_SUCCESS;
8984}
8985
8986DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
8987 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008988 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008989 NO_STR
8990 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008991 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008992 "Route map reference\n"
8993 "Pointer to route-map entries\n"
8994 "Metric for redistributed routes\n"
8995 "Default metric\n")
8996{
8997 int type;
8998
David Lampartere0ca5fd2009-09-16 01:52:42 +02008999 type = proto_redistnum (AFI_IP6, argv[0]);
9000 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009001 {
9002 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9003 return CMD_WARNING;
9004 }
9005
9006 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9007 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9008 return CMD_SUCCESS;
9009}
9010
9011ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9012 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009013 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009014 NO_STR
9015 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009016 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009017 "Metric for redistributed routes\n"
9018 "Default metric\n"
9019 "Route map reference\n"
9020 "Pointer to route-map entries\n")
9021#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02009022
paul718e3742002-12-13 20:15:29 +00009023int
9024bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9025 safi_t safi, int *write)
9026{
9027 int i;
paul718e3742002-12-13 20:15:29 +00009028
9029 /* Unicast redistribution only. */
9030 if (safi != SAFI_UNICAST)
9031 return 0;
9032
9033 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9034 {
9035 /* Redistribute BGP does not make sense. */
9036 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9037 {
9038 /* Display "address-family" when it is not yet diplayed. */
9039 bgp_config_write_family_header (vty, afi, safi, write);
9040
9041 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009042 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009043
9044 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009045 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009046
9047 if (bgp->rmap[afi][i].name)
9048 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9049
9050 vty_out (vty, "%s", VTY_NEWLINE);
9051 }
9052 }
9053 return *write;
9054}
David Lamparter6b0655a2014-06-04 06:53:35 +02009055
paul718e3742002-12-13 20:15:29 +00009056/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009057static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009058{
9059 BGP_NODE,
9060 "%s(config-router)# ",
9061 1,
9062};
9063
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009064static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009065{
9066 BGP_IPV4_NODE,
9067 "%s(config-router-af)# ",
9068 1,
9069};
9070
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009071static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009072{
9073 BGP_IPV4M_NODE,
9074 "%s(config-router-af)# ",
9075 1,
9076};
9077
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009078static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009079{
9080 BGP_IPV6_NODE,
9081 "%s(config-router-af)# ",
9082 1,
9083};
9084
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009085static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009086{
9087 BGP_IPV6M_NODE,
9088 "%s(config-router-af)# ",
9089 1,
9090};
9091
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009092static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009093{
9094 BGP_VPNV4_NODE,
9095 "%s(config-router-af)# ",
9096 1
9097};
David Lamparter6b0655a2014-06-04 06:53:35 +02009098
paul1f8ae702005-09-09 23:49:49 +00009099static void community_list_vty (void);
9100
paul718e3742002-12-13 20:15:29 +00009101void
paul94f2b392005-06-28 12:44:16 +00009102bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009103{
paul718e3742002-12-13 20:15:29 +00009104 /* Install bgp top node. */
9105 install_node (&bgp_node, bgp_config_write);
9106 install_node (&bgp_ipv4_unicast_node, NULL);
9107 install_node (&bgp_ipv4_multicast_node, NULL);
9108 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009109 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009110 install_node (&bgp_vpnv4_node, NULL);
9111
9112 /* Install default VTY commands to new nodes. */
9113 install_default (BGP_NODE);
9114 install_default (BGP_IPV4_NODE);
9115 install_default (BGP_IPV4M_NODE);
9116 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009117 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009118 install_default (BGP_VPNV4_NODE);
9119
9120 /* "bgp multiple-instance" commands. */
9121 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9122 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9123
9124 /* "bgp config-type" commands. */
9125 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9126 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9127
9128 /* Dummy commands (Currently not supported) */
9129 install_element (BGP_NODE, &no_synchronization_cmd);
9130 install_element (BGP_NODE, &no_auto_summary_cmd);
9131
9132 /* "router bgp" commands. */
9133 install_element (CONFIG_NODE, &router_bgp_cmd);
9134 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9135
9136 /* "no router bgp" commands. */
9137 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9138 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9139
9140 /* "bgp router-id" commands. */
9141 install_element (BGP_NODE, &bgp_router_id_cmd);
9142 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9143 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9144
9145 /* "bgp cluster-id" commands. */
9146 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9147 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9148 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9149 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9150
9151 /* "bgp confederation" commands. */
9152 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9153 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9154 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9155
9156 /* "bgp confederation peers" commands. */
9157 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9158 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9159
Josh Bailey165b5ff2011-07-20 20:43:22 -07009160 /* "maximum-paths" commands. */
9161 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9162 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9163 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9164 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9165 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9166 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
9167 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9168 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9169 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9170 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9171 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9172 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9173
paul718e3742002-12-13 20:15:29 +00009174 /* "timers bgp" commands. */
9175 install_element (BGP_NODE, &bgp_timers_cmd);
9176 install_element (BGP_NODE, &no_bgp_timers_cmd);
9177 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9178
9179 /* "bgp client-to-client reflection" commands */
9180 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9181 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9182
9183 /* "bgp always-compare-med" commands */
9184 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9185 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9186
9187 /* "bgp deterministic-med" commands */
9188 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9189 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009190
hasso538621f2004-05-21 09:31:30 +00009191 /* "bgp graceful-restart" commands */
9192 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9193 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009194 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9195 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9196 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009197
9198 /* "bgp fast-external-failover" commands */
9199 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9200 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9201
9202 /* "bgp enforce-first-as" commands */
9203 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9204 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9205
9206 /* "bgp bestpath compare-routerid" commands */
9207 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9208 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9209
9210 /* "bgp bestpath as-path ignore" commands */
9211 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9212 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9213
hasso68118452005-04-08 15:40:36 +00009214 /* "bgp bestpath as-path confed" commands */
9215 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9216 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9217
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00009218 /* "bgp bestpath as-path multipath-relax" commands */
9219 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9220 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9221
paul848973c2003-08-13 00:32:49 +00009222 /* "bgp log-neighbor-changes" commands */
9223 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9224 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9225
paul718e3742002-12-13 20:15:29 +00009226 /* "bgp bestpath med" commands */
9227 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9228 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9229 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9230 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9231 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9232 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9233
9234 /* "no bgp default ipv4-unicast" commands. */
9235 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9236 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9237
9238 /* "bgp network import-check" commands. */
9239 install_element (BGP_NODE, &bgp_network_import_check_cmd);
9240 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
9241
9242 /* "bgp default local-preference" commands. */
9243 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
9244 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
9245 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
9246
9247 /* "neighbor remote-as" commands. */
9248 install_element (BGP_NODE, &neighbor_remote_as_cmd);
9249 install_element (BGP_NODE, &no_neighbor_cmd);
9250 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
9251
9252 /* "neighbor peer-group" commands. */
9253 install_element (BGP_NODE, &neighbor_peer_group_cmd);
9254 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
9255 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
9256
9257 /* "neighbor local-as" commands. */
9258 install_element (BGP_NODE, &neighbor_local_as_cmd);
9259 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009260 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +00009261 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
9262 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
9263 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009264 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +00009265
Paul Jakma0df7c912008-07-21 21:02:49 +00009266 /* "neighbor password" commands. */
9267 install_element (BGP_NODE, &neighbor_password_cmd);
9268 install_element (BGP_NODE, &no_neighbor_password_cmd);
9269
paul718e3742002-12-13 20:15:29 +00009270 /* "neighbor activate" commands. */
9271 install_element (BGP_NODE, &neighbor_activate_cmd);
9272 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
9273 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
9274 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009275 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009276 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
9277
9278 /* "no neighbor activate" commands. */
9279 install_element (BGP_NODE, &no_neighbor_activate_cmd);
9280 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
9281 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
9282 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009283 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009284 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
9285
9286 /* "neighbor peer-group set" commands. */
9287 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
9288 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
9289 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
9290 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009291 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009292 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
9293
paul718e3742002-12-13 20:15:29 +00009294 /* "no neighbor peer-group unset" commands. */
9295 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
9296 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
9297 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
9298 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009299 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009300 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
9301
paul718e3742002-12-13 20:15:29 +00009302 /* "neighbor softreconfiguration inbound" commands.*/
9303 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
9304 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
9305 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
9306 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
9307 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
9308 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
9309 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
9310 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009311 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
9312 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +00009313 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
9314 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +00009315
9316 /* "neighbor attribute-unchanged" commands. */
9317 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
9318 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
9319 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
9320 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
9321 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
9322 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
9323 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
9324 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
9325 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
9326 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
9327 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
9328 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
9329 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
9330 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
9331 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
9332 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
9333 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
9334 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
9335 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
9336 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
9337 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
9338 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
9339 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
9340 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
9341 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
9342 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
9343 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
9344 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
9345 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
9346 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
9347 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
9348 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
9349 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
9350 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
9351 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9352 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9353 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9354 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9355 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9356 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9357 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9358 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9359 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9360 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9361 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
9362 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
9363 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
9364 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
9365 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
9366 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
9367 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
9368 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
9369 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
9370 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
9371 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
9372 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
9373 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
9374 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
9375 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
9376 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
9377 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
9378 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
9379 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
9380 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
9381 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
9382 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
9383 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
9384 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
9385 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
9386 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
9387 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
9388 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
9389 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
9390 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
9391 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
9392 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
9393 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
9394 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9395 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9396 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9397 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9398 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9399 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9400 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9401 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9402 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9403 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9404 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009405 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
9406 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
9407 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
9408 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
9409 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
9410 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
9411 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
9412 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
9413 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
9414 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
9415 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
9416 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
9417 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
9418 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
9419 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
9420 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
9421 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
9422 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
9423 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
9424 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
9425 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
9426 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +00009427 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
9428 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
9429 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
9430 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
9431 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
9432 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
9433 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
9434 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
9435 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
9436 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
9437 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
9438 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
9439 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9440 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9441 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9442 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9443 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9444 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9445 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9446 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9447 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9448 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9449
paulfee0f4c2004-09-13 05:12:46 +00009450 /* "nexthop-local unchanged" commands */
9451 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
9452 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
9453
paul718e3742002-12-13 20:15:29 +00009454 /* "transparent-as" and "transparent-nexthop" for old version
9455 compatibility. */
9456 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
9457 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
9458
9459 /* "neighbor next-hop-self" commands. */
9460 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
9461 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
9462 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
9463 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
9464 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
9465 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
9466 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
9467 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009468 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
9469 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009470 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
9471 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
9472
9473 /* "neighbor remove-private-AS" commands. */
9474 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
9475 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
9476 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
9477 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
9478 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
9479 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
9480 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
9481 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009482 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
9483 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009484 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
9485 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
9486
9487 /* "neighbor send-community" commands.*/
9488 install_element (BGP_NODE, &neighbor_send_community_cmd);
9489 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
9490 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
9491 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
9492 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
9493 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
9494 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
9495 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
9496 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
9497 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
9498 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
9499 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
9500 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
9501 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
9502 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
9503 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009504 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
9505 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
9506 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
9507 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00009508 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
9509 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
9510 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
9511 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
9512
9513 /* "neighbor route-reflector" commands.*/
9514 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
9515 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
9516 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
9517 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
9518 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
9519 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
9520 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
9521 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009522 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
9523 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +00009524 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
9525 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
9526
9527 /* "neighbor route-server" commands.*/
9528 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
9529 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
9530 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
9531 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
9532 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
9533 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
9534 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
9535 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009536 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
9537 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +00009538 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
9539 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
9540
9541 /* "neighbor passive" commands. */
9542 install_element (BGP_NODE, &neighbor_passive_cmd);
9543 install_element (BGP_NODE, &no_neighbor_passive_cmd);
9544
9545 /* "neighbor shutdown" commands. */
9546 install_element (BGP_NODE, &neighbor_shutdown_cmd);
9547 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
9548
hassoc9502432005-02-01 22:01:48 +00009549 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +00009550 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
9551 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
9552
9553 /* "neighbor capability orf prefix-list" commands.*/
9554 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
9555 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
9556 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
9557 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
9558 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
9559 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
9560 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
9561 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009562 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
9563 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +00009564
9565 /* "neighbor capability dynamic" commands.*/
9566 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
9567 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
9568
9569 /* "neighbor dont-capability-negotiate" commands. */
9570 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
9571 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
9572
9573 /* "neighbor ebgp-multihop" commands. */
9574 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
9575 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
9576 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
9577 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
9578
hasso6ffd2072005-02-02 14:50:11 +00009579 /* "neighbor disable-connected-check" commands. */
9580 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
9581 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +00009582 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
9583 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
9584
9585 /* "neighbor description" commands. */
9586 install_element (BGP_NODE, &neighbor_description_cmd);
9587 install_element (BGP_NODE, &no_neighbor_description_cmd);
9588 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
9589
9590 /* "neighbor update-source" commands. "*/
9591 install_element (BGP_NODE, &neighbor_update_source_cmd);
9592 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
9593
9594 /* "neighbor default-originate" commands. */
9595 install_element (BGP_NODE, &neighbor_default_originate_cmd);
9596 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
9597 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
9598 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
9599 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
9600 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
9601 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
9602 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
9603 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
9604 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
9605 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
9606 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
9607 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
9608 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
9609 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
9610 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009611 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
9612 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
9613 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
9614 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +00009615
9616 /* "neighbor port" commands. */
9617 install_element (BGP_NODE, &neighbor_port_cmd);
9618 install_element (BGP_NODE, &no_neighbor_port_cmd);
9619 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
9620
9621 /* "neighbor weight" commands. */
9622 install_element (BGP_NODE, &neighbor_weight_cmd);
9623 install_element (BGP_NODE, &no_neighbor_weight_cmd);
9624 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
9625
9626 /* "neighbor override-capability" commands. */
9627 install_element (BGP_NODE, &neighbor_override_capability_cmd);
9628 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
9629
9630 /* "neighbor strict-capability-match" commands. */
9631 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
9632 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
9633
9634 /* "neighbor timers" commands. */
9635 install_element (BGP_NODE, &neighbor_timers_cmd);
9636 install_element (BGP_NODE, &no_neighbor_timers_cmd);
9637
9638 /* "neighbor timers connect" commands. */
9639 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
9640 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
9641 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
9642
9643 /* "neighbor advertisement-interval" commands. */
9644 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
9645 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
9646 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
9647
9648 /* "neighbor version" commands. */
9649 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +00009650
9651 /* "neighbor interface" commands. */
9652 install_element (BGP_NODE, &neighbor_interface_cmd);
9653 install_element (BGP_NODE, &no_neighbor_interface_cmd);
9654
9655 /* "neighbor distribute" commands. */
9656 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
9657 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
9658 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
9659 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
9660 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
9661 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
9662 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
9663 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009664 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
9665 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +00009666 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
9667 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
9668
9669 /* "neighbor prefix-list" commands. */
9670 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
9671 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
9672 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
9673 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
9674 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
9675 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
9676 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
9677 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009678 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
9679 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +00009680 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
9681 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
9682
9683 /* "neighbor filter-list" commands. */
9684 install_element (BGP_NODE, &neighbor_filter_list_cmd);
9685 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
9686 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
9687 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
9688 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
9689 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
9690 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
9691 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009692 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
9693 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +00009694 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
9695 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
9696
9697 /* "neighbor route-map" commands. */
9698 install_element (BGP_NODE, &neighbor_route_map_cmd);
9699 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
9700 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
9701 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
9702 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
9703 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
9704 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
9705 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009706 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
9707 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +00009708 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
9709 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
9710
9711 /* "neighbor unsuppress-map" commands. */
9712 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
9713 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
9714 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
9715 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
9716 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
9717 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
9718 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
9719 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009720 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
9721 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +00009722 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
9723 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +00009724
9725 /* "neighbor maximum-prefix" commands. */
9726 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009727 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009728 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009729 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009730 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
9731 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009732 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
9733 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009734 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9735 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9736 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9737 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9738 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009739 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009740 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009741 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009742 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009743 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9744 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009745 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
9746 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009747 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9748 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9749 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9750 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9751 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009752 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009753 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009754 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009755 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009756 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
9757 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009758 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
9759 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009760 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9761 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9762 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9763 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9764 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009765 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009766 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009767 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009768 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009769 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
9770 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009771 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
9772 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009773 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9774 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9775 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9776 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9777 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009778 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
9779 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
9780 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
9781 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9782 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
9783 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9784 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
9785 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
9786 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9787 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9788 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9789 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9790 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009791 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009792 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009793 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009794 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009795 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9796 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009797 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
9798 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009799 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9800 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9801 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9802 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9803 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009804
9805 /* "neighbor allowas-in" */
9806 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
9807 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
9808 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
9809 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
9810 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
9811 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
9812 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
9813 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
9814 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
9815 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
9816 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
9817 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009818 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
9819 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
9820 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +00009821 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
9822 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
9823 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
9824
9825 /* address-family commands. */
9826 install_element (BGP_NODE, &address_family_ipv4_cmd);
9827 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
9828#ifdef HAVE_IPV6
9829 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009830 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +00009831#endif /* HAVE_IPV6 */
9832 install_element (BGP_NODE, &address_family_vpnv4_cmd);
9833 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
9834
9835 /* "exit-address-family" command. */
9836 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
9837 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
9838 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009839 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +00009840 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
9841
9842 /* "clear ip bgp commands" */
9843 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
9844 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
9845 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
9846 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
9847 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
9848 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
9849#ifdef HAVE_IPV6
9850 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
9851 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
9852 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
9853 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
9854 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
9855 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
9856 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
9857 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
9858 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
9859 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
9860 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
9861#endif /* HAVE_IPV6 */
9862
9863 /* "clear ip bgp neighbor soft in" */
9864 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
9865 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
9866 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
9867 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
9868 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
9869 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
9870 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
9871 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
9872 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
9873 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
9874 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
9875 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
9876 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
9877 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
9878 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
9879 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
9880 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
9881 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
9882 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
9883 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
9884 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
9885 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
9886 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
9887 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
9888 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
9889 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
9890 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
9891 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
9892 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
9893 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
9894 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
9895 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
9896 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
9897 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
9898 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
9899 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
9900 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
9901 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
9902 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
9903 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
9904#ifdef HAVE_IPV6
9905 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
9906 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
9907 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
9908 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
9909 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
9910 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
9911 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
9912 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
9913 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
9914 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
9915 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
9916 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
9917 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
9918 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
9919 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
9920 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
9921 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
9922 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
9923 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
9924 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
9925 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
9926 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
9927 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
9928 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
9929 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
9930 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
9931 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
9932 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
9933 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
9934 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
9935 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
9936#endif /* HAVE_IPV6 */
9937
9938 /* "clear ip bgp neighbor soft out" */
9939 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
9940 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
9941 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
9942 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
9943 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
9944 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
9945 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
9946 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
9947 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
9948 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
9949 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
9950 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
9951 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
9952 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
9953 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
9954 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
9955 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
9956 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
9957 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
9958 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
9959 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
9960 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
9961 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
9962 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
9963 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
9964 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
9965 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
9966 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
9967#ifdef HAVE_IPV6
9968 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
9969 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
9970 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
9971 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
9972 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
9973 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
9974 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
9975 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
9976 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
9977 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
9978 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
9979 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
9980 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
9981 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
9982 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
9983 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
9984 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
9985 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
9986 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
9987 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
9988 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
9989#endif /* HAVE_IPV6 */
9990
9991 /* "clear ip bgp neighbor soft" */
9992 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
9993 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
9994 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
9995 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
9996 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
9997 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
9998 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
9999 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
10000 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
10001 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
10002 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
10003 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
10004 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
10005 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
10006 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
10007#ifdef HAVE_IPV6
10008 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
10009 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
10010 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
10011 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
10012 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
10013 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
10014 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
10015 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
10016 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
10017 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
10018 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
10019#endif /* HAVE_IPV6 */
10020
paulfee0f4c2004-09-13 05:12:46 +000010021 /* "clear ip bgp neighbor rsclient" */
10022 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
10023 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
10024 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
10025 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
10026#ifdef HAVE_IPV6
10027 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
10028 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
10029 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
10030 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
10031 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
10032 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
10033 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
10034 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
10035#endif /* HAVE_IPV6 */
10036
paul718e3742002-12-13 20:15:29 +000010037 /* "show ip bgp summary" commands. */
10038 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
10039 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
10040 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010041 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010042 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010043 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010044 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10045 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10046#ifdef HAVE_IPV6
10047 install_element (VIEW_NODE, &show_bgp_summary_cmd);
10048 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
10049 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010050 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010051 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010052 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010053#endif /* HAVE_IPV6 */
Paul Jakma62687ff2008-08-23 14:27:06 +010010054 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
10055 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
10056 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010057 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010058 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010059 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010060 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10061 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10062#ifdef HAVE_IPV6
10063 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
10064 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
10065 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010066 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010067 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010068 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010069#endif /* HAVE_IPV6 */
paul718e3742002-12-13 20:15:29 +000010070 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
10071 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
10072 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010073 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010074 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010075 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010076 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10077 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10078#ifdef HAVE_IPV6
10079 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
10080 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
10081 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010082 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010083 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010084 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010085#endif /* HAVE_IPV6 */
10086
10087 /* "show ip bgp neighbors" commands. */
10088 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
10089 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10090 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
10091 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10092 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10093 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10094 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10095 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10096 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
10097 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010098 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
10099 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10100 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10101 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10102 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010103 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
10104 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10105 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
10106 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10107 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10108 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10109 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10110 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10111 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
10112 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
10113
10114#ifdef HAVE_IPV6
10115 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
10116 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
10117 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
10118 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010119 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
10120 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10121 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
10122 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010123 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
10124 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
10125 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
10126 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010127 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
10128 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
10129 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
10130 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010131 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
10132 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10133 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
10134 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010135
10136 /* Old commands. */
10137 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
10138 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
10139 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
10140 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
10141#endif /* HAVE_IPV6 */
10142
paulfee0f4c2004-09-13 05:12:46 +000010143 /* "show ip bgp rsclient" commands. */
10144 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
10145 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10146 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10147 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010148 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10149 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010150 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
10151 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10152 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10153 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010154 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10155 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010156 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
10157 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10158 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10159 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010160 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10161 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010162
10163#ifdef HAVE_IPV6
10164 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
10165 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10166 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
10167 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010168 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10169 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010170 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
10171 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10172 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
10173 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010174 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10175 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010176 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
10177 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10178 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
10179 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010180 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10181 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010182#endif /* HAVE_IPV6 */
10183
paul718e3742002-12-13 20:15:29 +000010184 /* "show ip bgp paths" commands. */
10185 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
10186 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
10187 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
10188 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
10189
10190 /* "show ip bgp community" commands. */
10191 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
10192 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
10193
10194 /* "show ip bgp attribute-info" commands. */
10195 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
10196 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
10197
10198 /* "redistribute" commands. */
10199 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
10200 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
10201 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
10202 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
10203 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
10204 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
10205 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
10206 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
10207 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
10208 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
10209#ifdef HAVE_IPV6
10210 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
10211 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
10212 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
10213 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
10214 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
10215 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
10216 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
10217 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
10218 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
10219 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
10220#endif /* HAVE_IPV6 */
10221
Nick Hilliardfa411a22011-03-23 15:33:17 +000010222 /* ttl_security commands */
10223 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
10224 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
10225
Paul Jakma4bf6a362006-03-30 14:05:23 +000010226 /* "show bgp memory" commands. */
10227 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010228 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000010229 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
10230
Michael Lamberte0081f72008-11-16 20:12:04 +000010231 /* "show bgp views" commands. */
10232 install_element (VIEW_NODE, &show_bgp_views_cmd);
10233 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
10234 install_element (ENABLE_NODE, &show_bgp_views_cmd);
10235
paul718e3742002-12-13 20:15:29 +000010236 /* Community-list. */
10237 community_list_vty ();
10238}
David Lamparter6b0655a2014-06-04 06:53:35 +020010239
paul718e3742002-12-13 20:15:29 +000010240#include "memory.h"
10241#include "bgp_regex.h"
10242#include "bgp_clist.h"
10243#include "bgp_ecommunity.h"
10244
10245/* VTY functions. */
10246
10247/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000010248static const char *
paul718e3742002-12-13 20:15:29 +000010249community_direct_str (int direct)
10250{
10251 switch (direct)
10252 {
10253 case COMMUNITY_DENY:
10254 return "deny";
paul718e3742002-12-13 20:15:29 +000010255 case COMMUNITY_PERMIT:
10256 return "permit";
paul718e3742002-12-13 20:15:29 +000010257 default:
10258 return "unknown";
paul718e3742002-12-13 20:15:29 +000010259 }
10260}
10261
10262/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000010263static void
paul718e3742002-12-13 20:15:29 +000010264community_list_perror (struct vty *vty, int ret)
10265{
10266 switch (ret)
10267 {
10268 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030010269 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010270 break;
10271 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
10272 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
10273 break;
10274 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
10275 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
10276 break;
10277 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
10278 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
10279 break;
10280 }
10281}
10282
10283/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000010284static int
paulfd79ac92004-10-13 05:06:08 +000010285community_list_set_vty (struct vty *vty, int argc, const char **argv,
10286 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010287{
10288 int ret;
10289 int direct;
10290 char *str;
10291
10292 /* Check the list type. */
10293 if (strncmp (argv[1], "p", 1) == 0)
10294 direct = COMMUNITY_PERMIT;
10295 else if (strncmp (argv[1], "d", 1) == 0)
10296 direct = COMMUNITY_DENY;
10297 else
10298 {
10299 vty_out (vty, "%% Matching condition must be permit or deny%s",
10300 VTY_NEWLINE);
10301 return CMD_WARNING;
10302 }
10303
10304 /* All digit name check. */
10305 if (reject_all_digit_name && all_digit (argv[0]))
10306 {
10307 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10308 return CMD_WARNING;
10309 }
10310
10311 /* Concat community string argument. */
10312 if (argc > 1)
10313 str = argv_concat (argv, argc, 2);
10314 else
10315 str = NULL;
10316
10317 /* When community_list_set() return nevetive value, it means
10318 malformed community string. */
10319 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
10320
10321 /* Free temporary community list string allocated by
10322 argv_concat(). */
10323 if (str)
10324 XFREE (MTYPE_TMP, str);
10325
10326 if (ret < 0)
10327 {
10328 /* Display error string. */
10329 community_list_perror (vty, ret);
10330 return CMD_WARNING;
10331 }
10332
10333 return CMD_SUCCESS;
10334}
10335
paul718e3742002-12-13 20:15:29 +000010336/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000010337static int
hassofee6e4e2005-02-02 16:29:31 +000010338community_list_unset_vty (struct vty *vty, int argc, const char **argv,
10339 int style)
paul718e3742002-12-13 20:15:29 +000010340{
10341 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010342 int direct = 0;
10343 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010344
hassofee6e4e2005-02-02 16:29:31 +000010345 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010346 {
hassofee6e4e2005-02-02 16:29:31 +000010347 /* Check the list direct. */
10348 if (strncmp (argv[1], "p", 1) == 0)
10349 direct = COMMUNITY_PERMIT;
10350 else if (strncmp (argv[1], "d", 1) == 0)
10351 direct = COMMUNITY_DENY;
10352 else
10353 {
10354 vty_out (vty, "%% Matching condition must be permit or deny%s",
10355 VTY_NEWLINE);
10356 return CMD_WARNING;
10357 }
paul718e3742002-12-13 20:15:29 +000010358
hassofee6e4e2005-02-02 16:29:31 +000010359 /* Concat community string argument. */
10360 str = argv_concat (argv, argc, 2);
10361 }
paul718e3742002-12-13 20:15:29 +000010362
10363 /* Unset community list. */
10364 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
10365
10366 /* Free temporary community list string allocated by
10367 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010368 if (str)
10369 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010370
10371 if (ret < 0)
10372 {
10373 community_list_perror (vty, ret);
10374 return CMD_WARNING;
10375 }
10376
10377 return CMD_SUCCESS;
10378}
10379
10380/* "community-list" keyword help string. */
10381#define COMMUNITY_LIST_STR "Add a community list entry\n"
10382#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
10383
paul718e3742002-12-13 20:15:29 +000010384DEFUN (ip_community_list_standard,
10385 ip_community_list_standard_cmd,
10386 "ip community-list <1-99> (deny|permit) .AA:NN",
10387 IP_STR
10388 COMMUNITY_LIST_STR
10389 "Community list number (standard)\n"
10390 "Specify community to reject\n"
10391 "Specify community to accept\n"
10392 COMMUNITY_VAL_STR)
10393{
10394 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
10395}
10396
10397ALIAS (ip_community_list_standard,
10398 ip_community_list_standard2_cmd,
10399 "ip community-list <1-99> (deny|permit)",
10400 IP_STR
10401 COMMUNITY_LIST_STR
10402 "Community list number (standard)\n"
10403 "Specify community to reject\n"
10404 "Specify community to accept\n")
10405
10406DEFUN (ip_community_list_expanded,
10407 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010408 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010409 IP_STR
10410 COMMUNITY_LIST_STR
10411 "Community list number (expanded)\n"
10412 "Specify community to reject\n"
10413 "Specify community to accept\n"
10414 "An ordered list as a regular-expression\n")
10415{
10416 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
10417}
10418
10419DEFUN (ip_community_list_name_standard,
10420 ip_community_list_name_standard_cmd,
10421 "ip community-list standard WORD (deny|permit) .AA:NN",
10422 IP_STR
10423 COMMUNITY_LIST_STR
10424 "Add a standard community-list entry\n"
10425 "Community list name\n"
10426 "Specify community to reject\n"
10427 "Specify community to accept\n"
10428 COMMUNITY_VAL_STR)
10429{
10430 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
10431}
10432
10433ALIAS (ip_community_list_name_standard,
10434 ip_community_list_name_standard2_cmd,
10435 "ip community-list standard WORD (deny|permit)",
10436 IP_STR
10437 COMMUNITY_LIST_STR
10438 "Add a standard community-list entry\n"
10439 "Community list name\n"
10440 "Specify community to reject\n"
10441 "Specify community to accept\n")
10442
10443DEFUN (ip_community_list_name_expanded,
10444 ip_community_list_name_expanded_cmd,
10445 "ip community-list expanded WORD (deny|permit) .LINE",
10446 IP_STR
10447 COMMUNITY_LIST_STR
10448 "Add an expanded community-list entry\n"
10449 "Community list name\n"
10450 "Specify community to reject\n"
10451 "Specify community to accept\n"
10452 "An ordered list as a regular-expression\n")
10453{
10454 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
10455}
10456
hassofee6e4e2005-02-02 16:29:31 +000010457DEFUN (no_ip_community_list_standard_all,
10458 no_ip_community_list_standard_all_cmd,
10459 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010460 NO_STR
10461 IP_STR
10462 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010463 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010464{
hassofee6e4e2005-02-02 16:29:31 +000010465 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010466}
10467
hassofee6e4e2005-02-02 16:29:31 +000010468DEFUN (no_ip_community_list_expanded_all,
10469 no_ip_community_list_expanded_all_cmd,
10470 "no ip community-list <100-500>",
10471 NO_STR
10472 IP_STR
10473 COMMUNITY_LIST_STR
10474 "Community list number (expanded)\n")
10475{
10476 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10477}
10478
10479DEFUN (no_ip_community_list_name_standard_all,
10480 no_ip_community_list_name_standard_all_cmd,
10481 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010482 NO_STR
10483 IP_STR
10484 COMMUNITY_LIST_STR
10485 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000010486 "Community list name\n")
10487{
hassofee6e4e2005-02-02 16:29:31 +000010488 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010489}
10490
hassofee6e4e2005-02-02 16:29:31 +000010491DEFUN (no_ip_community_list_name_expanded_all,
10492 no_ip_community_list_name_expanded_all_cmd,
10493 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000010494 NO_STR
10495 IP_STR
10496 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010497 "Add an expanded community-list entry\n"
10498 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000010499{
hassofee6e4e2005-02-02 16:29:31 +000010500 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010501}
10502
10503DEFUN (no_ip_community_list_standard,
10504 no_ip_community_list_standard_cmd,
10505 "no ip community-list <1-99> (deny|permit) .AA:NN",
10506 NO_STR
10507 IP_STR
10508 COMMUNITY_LIST_STR
10509 "Community list number (standard)\n"
10510 "Specify community to reject\n"
10511 "Specify community to accept\n"
10512 COMMUNITY_VAL_STR)
10513{
10514 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10515}
10516
10517DEFUN (no_ip_community_list_expanded,
10518 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010519 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010520 NO_STR
10521 IP_STR
10522 COMMUNITY_LIST_STR
10523 "Community list number (expanded)\n"
10524 "Specify community to reject\n"
10525 "Specify community to accept\n"
10526 "An ordered list as a regular-expression\n")
10527{
10528 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10529}
10530
10531DEFUN (no_ip_community_list_name_standard,
10532 no_ip_community_list_name_standard_cmd,
10533 "no ip community-list standard WORD (deny|permit) .AA:NN",
10534 NO_STR
10535 IP_STR
10536 COMMUNITY_LIST_STR
10537 "Specify a standard community-list\n"
10538 "Community list name\n"
10539 "Specify community to reject\n"
10540 "Specify community to accept\n"
10541 COMMUNITY_VAL_STR)
10542{
10543 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10544}
10545
10546DEFUN (no_ip_community_list_name_expanded,
10547 no_ip_community_list_name_expanded_cmd,
10548 "no ip community-list expanded WORD (deny|permit) .LINE",
10549 NO_STR
10550 IP_STR
10551 COMMUNITY_LIST_STR
10552 "Specify an expanded community-list\n"
10553 "Community list name\n"
10554 "Specify community to reject\n"
10555 "Specify community to accept\n"
10556 "An ordered list as a regular-expression\n")
10557{
10558 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10559}
10560
paul94f2b392005-06-28 12:44:16 +000010561static void
paul718e3742002-12-13 20:15:29 +000010562community_list_show (struct vty *vty, struct community_list *list)
10563{
10564 struct community_entry *entry;
10565
10566 for (entry = list->head; entry; entry = entry->next)
10567 {
10568 if (entry == list->head)
10569 {
10570 if (all_digit (list->name))
10571 vty_out (vty, "Community %s list %s%s",
10572 entry->style == COMMUNITY_LIST_STANDARD ?
10573 "standard" : "(expanded) access",
10574 list->name, VTY_NEWLINE);
10575 else
10576 vty_out (vty, "Named Community %s list %s%s",
10577 entry->style == COMMUNITY_LIST_STANDARD ?
10578 "standard" : "expanded",
10579 list->name, VTY_NEWLINE);
10580 }
10581 if (entry->any)
10582 vty_out (vty, " %s%s",
10583 community_direct_str (entry->direct), VTY_NEWLINE);
10584 else
10585 vty_out (vty, " %s %s%s",
10586 community_direct_str (entry->direct),
10587 entry->style == COMMUNITY_LIST_STANDARD
10588 ? community_str (entry->u.com) : entry->config,
10589 VTY_NEWLINE);
10590 }
10591}
10592
10593DEFUN (show_ip_community_list,
10594 show_ip_community_list_cmd,
10595 "show ip community-list",
10596 SHOW_STR
10597 IP_STR
10598 "List community-list\n")
10599{
10600 struct community_list *list;
10601 struct community_list_master *cm;
10602
hassofee6e4e2005-02-02 16:29:31 +000010603 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010604 if (! cm)
10605 return CMD_SUCCESS;
10606
10607 for (list = cm->num.head; list; list = list->next)
10608 community_list_show (vty, list);
10609
10610 for (list = cm->str.head; list; list = list->next)
10611 community_list_show (vty, list);
10612
10613 return CMD_SUCCESS;
10614}
10615
10616DEFUN (show_ip_community_list_arg,
10617 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010618 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010619 SHOW_STR
10620 IP_STR
10621 "List community-list\n"
10622 "Community-list number\n"
10623 "Community-list name\n")
10624{
10625 struct community_list *list;
10626
hassofee6e4e2005-02-02 16:29:31 +000010627 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010628 if (! list)
10629 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030010630 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010631 return CMD_WARNING;
10632 }
10633
10634 community_list_show (vty, list);
10635
10636 return CMD_SUCCESS;
10637}
David Lamparter6b0655a2014-06-04 06:53:35 +020010638
paul94f2b392005-06-28 12:44:16 +000010639static int
paulfd79ac92004-10-13 05:06:08 +000010640extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
10641 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010642{
10643 int ret;
10644 int direct;
10645 char *str;
10646
10647 /* Check the list type. */
10648 if (strncmp (argv[1], "p", 1) == 0)
10649 direct = COMMUNITY_PERMIT;
10650 else if (strncmp (argv[1], "d", 1) == 0)
10651 direct = COMMUNITY_DENY;
10652 else
10653 {
10654 vty_out (vty, "%% Matching condition must be permit or deny%s",
10655 VTY_NEWLINE);
10656 return CMD_WARNING;
10657 }
10658
10659 /* All digit name check. */
10660 if (reject_all_digit_name && all_digit (argv[0]))
10661 {
10662 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10663 return CMD_WARNING;
10664 }
10665
10666 /* Concat community string argument. */
10667 if (argc > 1)
10668 str = argv_concat (argv, argc, 2);
10669 else
10670 str = NULL;
10671
10672 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
10673
10674 /* Free temporary community list string allocated by
10675 argv_concat(). */
10676 if (str)
10677 XFREE (MTYPE_TMP, str);
10678
10679 if (ret < 0)
10680 {
10681 community_list_perror (vty, ret);
10682 return CMD_WARNING;
10683 }
10684 return CMD_SUCCESS;
10685}
10686
paul94f2b392005-06-28 12:44:16 +000010687static int
hassofee6e4e2005-02-02 16:29:31 +000010688extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
10689 int style)
paul718e3742002-12-13 20:15:29 +000010690{
10691 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010692 int direct = 0;
10693 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010694
hassofee6e4e2005-02-02 16:29:31 +000010695 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010696 {
hassofee6e4e2005-02-02 16:29:31 +000010697 /* Check the list direct. */
10698 if (strncmp (argv[1], "p", 1) == 0)
10699 direct = COMMUNITY_PERMIT;
10700 else if (strncmp (argv[1], "d", 1) == 0)
10701 direct = COMMUNITY_DENY;
10702 else
10703 {
10704 vty_out (vty, "%% Matching condition must be permit or deny%s",
10705 VTY_NEWLINE);
10706 return CMD_WARNING;
10707 }
10708
10709 /* Concat community string argument. */
10710 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000010711 }
paul718e3742002-12-13 20:15:29 +000010712
10713 /* Unset community list. */
10714 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
10715
10716 /* Free temporary community list string allocated by
10717 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010718 if (str)
10719 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010720
10721 if (ret < 0)
10722 {
10723 community_list_perror (vty, ret);
10724 return CMD_WARNING;
10725 }
10726
10727 return CMD_SUCCESS;
10728}
10729
10730/* "extcommunity-list" keyword help string. */
10731#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
10732#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
10733
10734DEFUN (ip_extcommunity_list_standard,
10735 ip_extcommunity_list_standard_cmd,
10736 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10737 IP_STR
10738 EXTCOMMUNITY_LIST_STR
10739 "Extended Community list number (standard)\n"
10740 "Specify community to reject\n"
10741 "Specify community to accept\n"
10742 EXTCOMMUNITY_VAL_STR)
10743{
10744 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
10745}
10746
10747ALIAS (ip_extcommunity_list_standard,
10748 ip_extcommunity_list_standard2_cmd,
10749 "ip extcommunity-list <1-99> (deny|permit)",
10750 IP_STR
10751 EXTCOMMUNITY_LIST_STR
10752 "Extended Community list number (standard)\n"
10753 "Specify community to reject\n"
10754 "Specify community to accept\n")
10755
10756DEFUN (ip_extcommunity_list_expanded,
10757 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010758 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010759 IP_STR
10760 EXTCOMMUNITY_LIST_STR
10761 "Extended Community list number (expanded)\n"
10762 "Specify community to reject\n"
10763 "Specify community to accept\n"
10764 "An ordered list as a regular-expression\n")
10765{
10766 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
10767}
10768
10769DEFUN (ip_extcommunity_list_name_standard,
10770 ip_extcommunity_list_name_standard_cmd,
10771 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10772 IP_STR
10773 EXTCOMMUNITY_LIST_STR
10774 "Specify standard extcommunity-list\n"
10775 "Extended Community list name\n"
10776 "Specify community to reject\n"
10777 "Specify community to accept\n"
10778 EXTCOMMUNITY_VAL_STR)
10779{
10780 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
10781}
10782
10783ALIAS (ip_extcommunity_list_name_standard,
10784 ip_extcommunity_list_name_standard2_cmd,
10785 "ip extcommunity-list standard WORD (deny|permit)",
10786 IP_STR
10787 EXTCOMMUNITY_LIST_STR
10788 "Specify standard extcommunity-list\n"
10789 "Extended Community list name\n"
10790 "Specify community to reject\n"
10791 "Specify community to accept\n")
10792
10793DEFUN (ip_extcommunity_list_name_expanded,
10794 ip_extcommunity_list_name_expanded_cmd,
10795 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
10796 IP_STR
10797 EXTCOMMUNITY_LIST_STR
10798 "Specify expanded extcommunity-list\n"
10799 "Extended Community list name\n"
10800 "Specify community to reject\n"
10801 "Specify community to accept\n"
10802 "An ordered list as a regular-expression\n")
10803{
10804 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
10805}
10806
hassofee6e4e2005-02-02 16:29:31 +000010807DEFUN (no_ip_extcommunity_list_standard_all,
10808 no_ip_extcommunity_list_standard_all_cmd,
10809 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010810 NO_STR
10811 IP_STR
10812 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010813 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010814{
hassofee6e4e2005-02-02 16:29:31 +000010815 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010816}
10817
hassofee6e4e2005-02-02 16:29:31 +000010818DEFUN (no_ip_extcommunity_list_expanded_all,
10819 no_ip_extcommunity_list_expanded_all_cmd,
10820 "no ip extcommunity-list <100-500>",
10821 NO_STR
10822 IP_STR
10823 EXTCOMMUNITY_LIST_STR
10824 "Extended Community list number (expanded)\n")
10825{
10826 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10827}
10828
10829DEFUN (no_ip_extcommunity_list_name_standard_all,
10830 no_ip_extcommunity_list_name_standard_all_cmd,
10831 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010832 NO_STR
10833 IP_STR
10834 EXTCOMMUNITY_LIST_STR
10835 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000010836 "Extended Community list name\n")
10837{
10838 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10839}
10840
10841DEFUN (no_ip_extcommunity_list_name_expanded_all,
10842 no_ip_extcommunity_list_name_expanded_all_cmd,
10843 "no ip extcommunity-list expanded WORD",
10844 NO_STR
10845 IP_STR
10846 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000010847 "Specify expanded extcommunity-list\n"
10848 "Extended Community list name\n")
10849{
hassofee6e4e2005-02-02 16:29:31 +000010850 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010851}
10852
10853DEFUN (no_ip_extcommunity_list_standard,
10854 no_ip_extcommunity_list_standard_cmd,
10855 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10856 NO_STR
10857 IP_STR
10858 EXTCOMMUNITY_LIST_STR
10859 "Extended Community list number (standard)\n"
10860 "Specify community to reject\n"
10861 "Specify community to accept\n"
10862 EXTCOMMUNITY_VAL_STR)
10863{
10864 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10865}
10866
10867DEFUN (no_ip_extcommunity_list_expanded,
10868 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010869 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010870 NO_STR
10871 IP_STR
10872 EXTCOMMUNITY_LIST_STR
10873 "Extended Community list number (expanded)\n"
10874 "Specify community to reject\n"
10875 "Specify community to accept\n"
10876 "An ordered list as a regular-expression\n")
10877{
10878 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10879}
10880
10881DEFUN (no_ip_extcommunity_list_name_standard,
10882 no_ip_extcommunity_list_name_standard_cmd,
10883 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10884 NO_STR
10885 IP_STR
10886 EXTCOMMUNITY_LIST_STR
10887 "Specify standard extcommunity-list\n"
10888 "Extended Community list name\n"
10889 "Specify community to reject\n"
10890 "Specify community to accept\n"
10891 EXTCOMMUNITY_VAL_STR)
10892{
10893 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10894}
10895
10896DEFUN (no_ip_extcommunity_list_name_expanded,
10897 no_ip_extcommunity_list_name_expanded_cmd,
10898 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
10899 NO_STR
10900 IP_STR
10901 EXTCOMMUNITY_LIST_STR
10902 "Specify expanded extcommunity-list\n"
10903 "Community list name\n"
10904 "Specify community to reject\n"
10905 "Specify community to accept\n"
10906 "An ordered list as a regular-expression\n")
10907{
10908 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10909}
10910
paul94f2b392005-06-28 12:44:16 +000010911static void
paul718e3742002-12-13 20:15:29 +000010912extcommunity_list_show (struct vty *vty, struct community_list *list)
10913{
10914 struct community_entry *entry;
10915
10916 for (entry = list->head; entry; entry = entry->next)
10917 {
10918 if (entry == list->head)
10919 {
10920 if (all_digit (list->name))
10921 vty_out (vty, "Extended community %s list %s%s",
10922 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10923 "standard" : "(expanded) access",
10924 list->name, VTY_NEWLINE);
10925 else
10926 vty_out (vty, "Named extended community %s list %s%s",
10927 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10928 "standard" : "expanded",
10929 list->name, VTY_NEWLINE);
10930 }
10931 if (entry->any)
10932 vty_out (vty, " %s%s",
10933 community_direct_str (entry->direct), VTY_NEWLINE);
10934 else
10935 vty_out (vty, " %s %s%s",
10936 community_direct_str (entry->direct),
10937 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10938 entry->u.ecom->str : entry->config,
10939 VTY_NEWLINE);
10940 }
10941}
10942
10943DEFUN (show_ip_extcommunity_list,
10944 show_ip_extcommunity_list_cmd,
10945 "show ip extcommunity-list",
10946 SHOW_STR
10947 IP_STR
10948 "List extended-community list\n")
10949{
10950 struct community_list *list;
10951 struct community_list_master *cm;
10952
hassofee6e4e2005-02-02 16:29:31 +000010953 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010954 if (! cm)
10955 return CMD_SUCCESS;
10956
10957 for (list = cm->num.head; list; list = list->next)
10958 extcommunity_list_show (vty, list);
10959
10960 for (list = cm->str.head; list; list = list->next)
10961 extcommunity_list_show (vty, list);
10962
10963 return CMD_SUCCESS;
10964}
10965
10966DEFUN (show_ip_extcommunity_list_arg,
10967 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010968 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010969 SHOW_STR
10970 IP_STR
10971 "List extended-community list\n"
10972 "Extcommunity-list number\n"
10973 "Extcommunity-list name\n")
10974{
10975 struct community_list *list;
10976
hassofee6e4e2005-02-02 16:29:31 +000010977 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010978 if (! list)
10979 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030010980 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010981 return CMD_WARNING;
10982 }
10983
10984 extcommunity_list_show (vty, list);
10985
10986 return CMD_SUCCESS;
10987}
David Lamparter6b0655a2014-06-04 06:53:35 +020010988
paul718e3742002-12-13 20:15:29 +000010989/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000010990static const char *
paul718e3742002-12-13 20:15:29 +000010991community_list_config_str (struct community_entry *entry)
10992{
paulfd79ac92004-10-13 05:06:08 +000010993 const char *str;
paul718e3742002-12-13 20:15:29 +000010994
10995 if (entry->any)
10996 str = "";
10997 else
10998 {
10999 if (entry->style == COMMUNITY_LIST_STANDARD)
11000 str = community_str (entry->u.com);
11001 else
11002 str = entry->config;
11003 }
11004 return str;
11005}
11006
11007/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000011008static int
paul718e3742002-12-13 20:15:29 +000011009community_list_config_write (struct vty *vty)
11010{
11011 struct community_list *list;
11012 struct community_entry *entry;
11013 struct community_list_master *cm;
11014 int write = 0;
11015
11016 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000011017 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011018
11019 for (list = cm->num.head; list; list = list->next)
11020 for (entry = list->head; entry; entry = entry->next)
11021 {
hassofee6e4e2005-02-02 16:29:31 +000011022 vty_out (vty, "ip community-list %s %s %s%s",
11023 list->name, community_direct_str (entry->direct),
11024 community_list_config_str (entry),
11025 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011026 write++;
11027 }
11028 for (list = cm->str.head; list; list = list->next)
11029 for (entry = list->head; entry; entry = entry->next)
11030 {
11031 vty_out (vty, "ip community-list %s %s %s %s%s",
11032 entry->style == COMMUNITY_LIST_STANDARD
11033 ? "standard" : "expanded",
11034 list->name, community_direct_str (entry->direct),
11035 community_list_config_str (entry),
11036 VTY_NEWLINE);
11037 write++;
11038 }
11039
11040 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000011041 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011042
11043 for (list = cm->num.head; list; list = list->next)
11044 for (entry = list->head; entry; entry = entry->next)
11045 {
hassofee6e4e2005-02-02 16:29:31 +000011046 vty_out (vty, "ip extcommunity-list %s %s %s%s",
11047 list->name, community_direct_str (entry->direct),
11048 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011049 write++;
11050 }
11051 for (list = cm->str.head; list; list = list->next)
11052 for (entry = list->head; entry; entry = entry->next)
11053 {
11054 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
11055 entry->style == EXTCOMMUNITY_LIST_STANDARD
11056 ? "standard" : "expanded",
11057 list->name, community_direct_str (entry->direct),
11058 community_list_config_str (entry), VTY_NEWLINE);
11059 write++;
11060 }
11061 return write;
11062}
11063
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080011064static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000011065{
11066 COMMUNITY_LIST_NODE,
11067 "",
11068 1 /* Export to vtysh. */
11069};
11070
paul94f2b392005-06-28 12:44:16 +000011071static void
11072community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000011073{
11074 install_node (&community_list_node, community_list_config_write);
11075
11076 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000011077 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
11078 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
11079 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
11080 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
11081 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
11082 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011083 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
11084 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
11085 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
11086 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011087 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
11088 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
11089 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
11090 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
11091 install_element (VIEW_NODE, &show_ip_community_list_cmd);
11092 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
11093 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
11094 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
11095
11096 /* Extcommunity-list. */
11097 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
11098 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
11099 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
11100 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
11101 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
11102 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011103 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
11104 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
11105 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
11106 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011107 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
11108 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
11109 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
11110 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
11111 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
11112 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
11113 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
11114 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
11115}