blob: 4fd255fce2b5a83a20df3e20ac954dff381b9044 [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
Donald Sharp58a83f22015-09-11 10:11:42 -0400679 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
680 vty_out (vty,
681 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
682 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
683
Josh Bailey165b5ff2011-07-20 20:43:22 -0700684 return CMD_SUCCESS;
685}
686
687DEFUN (bgp_maxpaths_ibgp,
688 bgp_maxpaths_ibgp_cmd,
689 "maximum-paths ibgp <1-255>",
690 "Forward packets over multiple paths\n"
691 "iBGP-multipath\n"
692 "Number of paths\n")
693{
694 struct bgp *bgp;
695 u_int16_t maxpaths;
696 int ret;
697
698 bgp = vty->index;
699
700 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
701
702 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
703 BGP_PEER_IBGP, maxpaths);
704 if (ret < 0)
705 {
706 vty_out (vty,
707 "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
708 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
709 return CMD_WARNING;
710 }
711
Donald Sharp58a83f22015-09-11 10:11:42 -0400712 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
713 vty_out (vty,
714 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
715 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
716
Josh Bailey165b5ff2011-07-20 20:43:22 -0700717 return CMD_SUCCESS;
718}
719
720DEFUN (no_bgp_maxpaths,
721 no_bgp_maxpaths_cmd,
722 "no maximum-paths",
723 NO_STR
724 "Forward packets over multiple paths\n"
725 "Number of paths\n")
726{
727 struct bgp *bgp;
728 int ret;
729
730 bgp = vty->index;
731
732 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
733 BGP_PEER_EBGP);
734 if (ret < 0)
735 {
736 vty_out (vty,
737 "%% Failed to unset maximum-paths for afi %u, safi %u%s",
738 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
739 return CMD_WARNING;
740 }
741
742 return CMD_SUCCESS;
743}
744
745ALIAS (no_bgp_maxpaths,
746 no_bgp_maxpaths_arg_cmd,
747 "no maximum-paths <1-255>",
748 NO_STR
749 "Forward packets over multiple paths\n"
750 "Number of paths\n")
751
752DEFUN (no_bgp_maxpaths_ibgp,
753 no_bgp_maxpaths_ibgp_cmd,
754 "no maximum-paths ibgp",
755 NO_STR
756 "Forward packets over multiple paths\n"
757 "iBGP-multipath\n"
758 "Number of paths\n")
759{
760 struct bgp *bgp;
761 int ret;
762
763 bgp = vty->index;
764
765 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
766 BGP_PEER_IBGP);
767 if (ret < 0)
768 {
769 vty_out (vty,
770 "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
771 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
772 return CMD_WARNING;
773 }
774
775 return CMD_SUCCESS;
776}
777
778ALIAS (no_bgp_maxpaths_ibgp,
779 no_bgp_maxpaths_ibgp_arg_cmd,
780 "no maximum-paths ibgp <1-255>",
781 NO_STR
782 "Forward packets over multiple paths\n"
783 "iBGP-multipath\n"
784 "Number of paths\n")
785
786int
787bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
788 safi_t safi, int *write)
789{
790 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
791 {
792 bgp_config_write_family_header (vty, afi, safi, write);
793 vty_out (vty, " maximum-paths %d%s",
794 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
795 }
796
797 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
798 {
799 bgp_config_write_family_header (vty, afi, safi, write);
800 vty_out (vty, " maximum-paths ibgp %d%s",
801 bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
802 }
803
804 return 0;
805}
David Lamparter6b0655a2014-06-04 06:53:35 +0200806
paul718e3742002-12-13 20:15:29 +0000807/* BGP timers. */
808
809DEFUN (bgp_timers,
810 bgp_timers_cmd,
811 "timers bgp <0-65535> <0-65535>",
812 "Adjust routing timers\n"
813 "BGP timers\n"
814 "Keepalive interval\n"
815 "Holdtime\n")
816{
817 struct bgp *bgp;
818 unsigned long keepalive = 0;
819 unsigned long holdtime = 0;
820
821 bgp = vty->index;
822
823 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
824 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
825
826 /* Holdtime value check. */
827 if (holdtime < 3 && holdtime != 0)
828 {
829 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
830 VTY_NEWLINE);
831 return CMD_WARNING;
832 }
833
834 bgp_timers_set (bgp, keepalive, holdtime);
835
836 return CMD_SUCCESS;
837}
838
839DEFUN (no_bgp_timers,
840 no_bgp_timers_cmd,
841 "no timers bgp",
842 NO_STR
843 "Adjust routing timers\n"
844 "BGP timers\n")
845{
846 struct bgp *bgp;
847
848 bgp = vty->index;
849 bgp_timers_unset (bgp);
850
851 return CMD_SUCCESS;
852}
853
854ALIAS (no_bgp_timers,
855 no_bgp_timers_arg_cmd,
856 "no timers bgp <0-65535> <0-65535>",
857 NO_STR
858 "Adjust routing timers\n"
859 "BGP timers\n"
860 "Keepalive interval\n"
861 "Holdtime\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200862
paul718e3742002-12-13 20:15:29 +0000863DEFUN (bgp_client_to_client_reflection,
864 bgp_client_to_client_reflection_cmd,
865 "bgp client-to-client reflection",
866 "BGP specific commands\n"
867 "Configure client to client route reflection\n"
868 "reflection of routes allowed\n")
869{
870 struct bgp *bgp;
871
872 bgp = vty->index;
873 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
874 return CMD_SUCCESS;
875}
876
877DEFUN (no_bgp_client_to_client_reflection,
878 no_bgp_client_to_client_reflection_cmd,
879 "no bgp client-to-client reflection",
880 NO_STR
881 "BGP specific commands\n"
882 "Configure client to client route reflection\n"
883 "reflection of routes allowed\n")
884{
885 struct bgp *bgp;
886
887 bgp = vty->index;
888 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
889 return CMD_SUCCESS;
890}
891
892/* "bgp always-compare-med" configuration. */
893DEFUN (bgp_always_compare_med,
894 bgp_always_compare_med_cmd,
895 "bgp always-compare-med",
896 "BGP specific commands\n"
897 "Allow comparing MED from different neighbors\n")
898{
899 struct bgp *bgp;
900
901 bgp = vty->index;
902 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
903 return CMD_SUCCESS;
904}
905
906DEFUN (no_bgp_always_compare_med,
907 no_bgp_always_compare_med_cmd,
908 "no bgp always-compare-med",
909 NO_STR
910 "BGP specific commands\n"
911 "Allow comparing MED from different neighbors\n")
912{
913 struct bgp *bgp;
914
915 bgp = vty->index;
916 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
917 return CMD_SUCCESS;
918}
David Lamparter6b0655a2014-06-04 06:53:35 +0200919
paul718e3742002-12-13 20:15:29 +0000920/* "bgp deterministic-med" configuration. */
921DEFUN (bgp_deterministic_med,
922 bgp_deterministic_med_cmd,
923 "bgp deterministic-med",
924 "BGP specific commands\n"
925 "Pick the best-MED path among paths advertised from the neighboring AS\n")
926{
927 struct bgp *bgp;
928
929 bgp = vty->index;
930 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
931 return CMD_SUCCESS;
932}
933
934DEFUN (no_bgp_deterministic_med,
935 no_bgp_deterministic_med_cmd,
936 "no bgp deterministic-med",
937 NO_STR
938 "BGP specific commands\n"
939 "Pick the best-MED path among paths advertised from the neighboring AS\n")
940{
941 struct bgp *bgp;
942
943 bgp = vty->index;
944 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
945 return CMD_SUCCESS;
946}
hasso538621f2004-05-21 09:31:30 +0000947
948/* "bgp graceful-restart" configuration. */
949DEFUN (bgp_graceful_restart,
950 bgp_graceful_restart_cmd,
951 "bgp graceful-restart",
952 "BGP specific commands\n"
953 "Graceful restart capability parameters\n")
954{
955 struct bgp *bgp;
956
957 bgp = vty->index;
958 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
959 return CMD_SUCCESS;
960}
961
962DEFUN (no_bgp_graceful_restart,
963 no_bgp_graceful_restart_cmd,
964 "no bgp graceful-restart",
965 NO_STR
966 "BGP specific commands\n"
967 "Graceful restart capability parameters\n")
968{
969 struct bgp *bgp;
970
971 bgp = vty->index;
972 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
973 return CMD_SUCCESS;
974}
975
hasso93406d82005-02-02 14:40:33 +0000976DEFUN (bgp_graceful_restart_stalepath_time,
977 bgp_graceful_restart_stalepath_time_cmd,
978 "bgp graceful-restart stalepath-time <1-3600>",
979 "BGP specific commands\n"
980 "Graceful restart capability parameters\n"
981 "Set the max time to hold onto restarting peer's stale paths\n"
982 "Delay value (seconds)\n")
983{
984 struct bgp *bgp;
985 u_int32_t stalepath;
986
987 bgp = vty->index;
988 if (! bgp)
989 return CMD_WARNING;
990
991 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
992 bgp->stalepath_time = stalepath;
993 return CMD_SUCCESS;
994}
995
996DEFUN (no_bgp_graceful_restart_stalepath_time,
997 no_bgp_graceful_restart_stalepath_time_cmd,
998 "no bgp graceful-restart stalepath-time",
999 NO_STR
1000 "BGP specific commands\n"
1001 "Graceful restart capability parameters\n"
1002 "Set the max time to hold onto restarting peer's stale paths\n")
1003{
1004 struct bgp *bgp;
1005
1006 bgp = vty->index;
1007 if (! bgp)
1008 return CMD_WARNING;
1009
1010 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1011 return CMD_SUCCESS;
1012}
1013
1014ALIAS (no_bgp_graceful_restart_stalepath_time,
1015 no_bgp_graceful_restart_stalepath_time_val_cmd,
1016 "no bgp graceful-restart stalepath-time <1-3600>",
1017 NO_STR
1018 "BGP specific commands\n"
1019 "Graceful restart capability parameters\n"
1020 "Set the max time to hold onto restarting peer's stale paths\n"
1021 "Delay value (seconds)\n")
1022
paul718e3742002-12-13 20:15:29 +00001023/* "bgp fast-external-failover" configuration. */
1024DEFUN (bgp_fast_external_failover,
1025 bgp_fast_external_failover_cmd,
1026 "bgp fast-external-failover",
1027 BGP_STR
1028 "Immediately reset session if a link to a directly connected external peer goes down\n")
1029{
1030 struct bgp *bgp;
1031
1032 bgp = vty->index;
1033 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1034 return CMD_SUCCESS;
1035}
1036
1037DEFUN (no_bgp_fast_external_failover,
1038 no_bgp_fast_external_failover_cmd,
1039 "no bgp fast-external-failover",
1040 NO_STR
1041 BGP_STR
1042 "Immediately reset session if a link to a directly connected external peer goes down\n")
1043{
1044 struct bgp *bgp;
1045
1046 bgp = vty->index;
1047 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1048 return CMD_SUCCESS;
1049}
David Lamparter6b0655a2014-06-04 06:53:35 +02001050
paul718e3742002-12-13 20:15:29 +00001051/* "bgp enforce-first-as" configuration. */
1052DEFUN (bgp_enforce_first_as,
1053 bgp_enforce_first_as_cmd,
1054 "bgp enforce-first-as",
1055 BGP_STR
1056 "Enforce the first AS for EBGP routes\n")
1057{
1058 struct bgp *bgp;
1059
1060 bgp = vty->index;
1061 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1062 return CMD_SUCCESS;
1063}
1064
1065DEFUN (no_bgp_enforce_first_as,
1066 no_bgp_enforce_first_as_cmd,
1067 "no bgp enforce-first-as",
1068 NO_STR
1069 BGP_STR
1070 "Enforce the first AS for EBGP routes\n")
1071{
1072 struct bgp *bgp;
1073
1074 bgp = vty->index;
1075 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1076 return CMD_SUCCESS;
1077}
David Lamparter6b0655a2014-06-04 06:53:35 +02001078
paul718e3742002-12-13 20:15:29 +00001079/* "bgp bestpath compare-routerid" configuration. */
1080DEFUN (bgp_bestpath_compare_router_id,
1081 bgp_bestpath_compare_router_id_cmd,
1082 "bgp bestpath compare-routerid",
1083 "BGP specific commands\n"
1084 "Change the default bestpath selection\n"
1085 "Compare router-id for identical EBGP paths\n")
1086{
1087 struct bgp *bgp;
1088
1089 bgp = vty->index;
1090 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1091 return CMD_SUCCESS;
1092}
1093
1094DEFUN (no_bgp_bestpath_compare_router_id,
1095 no_bgp_bestpath_compare_router_id_cmd,
1096 "no bgp bestpath compare-routerid",
1097 NO_STR
1098 "BGP specific commands\n"
1099 "Change the default bestpath selection\n"
1100 "Compare router-id for identical EBGP paths\n")
1101{
1102 struct bgp *bgp;
1103
1104 bgp = vty->index;
1105 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1106 return CMD_SUCCESS;
1107}
David Lamparter6b0655a2014-06-04 06:53:35 +02001108
paul718e3742002-12-13 20:15:29 +00001109/* "bgp bestpath as-path ignore" configuration. */
1110DEFUN (bgp_bestpath_aspath_ignore,
1111 bgp_bestpath_aspath_ignore_cmd,
1112 "bgp bestpath as-path ignore",
1113 "BGP specific commands\n"
1114 "Change the default bestpath selection\n"
1115 "AS-path attribute\n"
1116 "Ignore as-path length in selecting a route\n")
1117{
1118 struct bgp *bgp;
1119
1120 bgp = vty->index;
1121 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
1122 return CMD_SUCCESS;
1123}
1124
1125DEFUN (no_bgp_bestpath_aspath_ignore,
1126 no_bgp_bestpath_aspath_ignore_cmd,
1127 "no bgp bestpath as-path ignore",
1128 NO_STR
1129 "BGP specific commands\n"
1130 "Change the default bestpath selection\n"
1131 "AS-path attribute\n"
1132 "Ignore as-path length in selecting a route\n")
1133{
1134 struct bgp *bgp;
1135
1136 bgp = vty->index;
1137 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1138 return CMD_SUCCESS;
1139}
David Lamparter6b0655a2014-06-04 06:53:35 +02001140
hasso68118452005-04-08 15:40:36 +00001141/* "bgp bestpath as-path confed" configuration. */
1142DEFUN (bgp_bestpath_aspath_confed,
1143 bgp_bestpath_aspath_confed_cmd,
1144 "bgp bestpath as-path confed",
1145 "BGP specific commands\n"
1146 "Change the default bestpath selection\n"
1147 "AS-path attribute\n"
1148 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1149{
1150 struct bgp *bgp;
1151
1152 bgp = vty->index;
1153 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1154 return CMD_SUCCESS;
1155}
1156
1157DEFUN (no_bgp_bestpath_aspath_confed,
1158 no_bgp_bestpath_aspath_confed_cmd,
1159 "no bgp bestpath as-path confed",
1160 NO_STR
1161 "BGP specific commands\n"
1162 "Change the default bestpath selection\n"
1163 "AS-path attribute\n"
1164 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1165{
1166 struct bgp *bgp;
1167
1168 bgp = vty->index;
1169 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1170 return CMD_SUCCESS;
1171}
David Lamparter6b0655a2014-06-04 06:53:35 +02001172
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00001173/* "bgp bestpath as-path multipath-relax" configuration. */
1174DEFUN (bgp_bestpath_aspath_multipath_relax,
1175 bgp_bestpath_aspath_multipath_relax_cmd,
1176 "bgp bestpath as-path multipath-relax",
1177 "BGP specific commands\n"
1178 "Change the default bestpath selection\n"
1179 "AS-path attribute\n"
1180 "Allow load sharing across routes that have different AS paths (but same length)\n")
1181{
1182 struct bgp *bgp;
1183
1184 bgp = vty->index;
1185 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1186 return CMD_SUCCESS;
1187}
1188
1189DEFUN (no_bgp_bestpath_aspath_multipath_relax,
1190 no_bgp_bestpath_aspath_multipath_relax_cmd,
1191 "no bgp bestpath as-path multipath-relax",
1192 NO_STR
1193 "BGP specific commands\n"
1194 "Change the default bestpath selection\n"
1195 "AS-path attribute\n"
1196 "Allow load sharing across routes that have different AS paths (but same length)\n")
1197{
1198 struct bgp *bgp;
1199
1200 bgp = vty->index;
1201 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1202 return CMD_SUCCESS;
1203}
David Lamparter6b0655a2014-06-04 06:53:35 +02001204
paul848973c2003-08-13 00:32:49 +00001205/* "bgp log-neighbor-changes" configuration. */
1206DEFUN (bgp_log_neighbor_changes,
1207 bgp_log_neighbor_changes_cmd,
1208 "bgp log-neighbor-changes",
1209 "BGP specific commands\n"
1210 "Log neighbor up/down and reset reason\n")
1211{
1212 struct bgp *bgp;
1213
1214 bgp = vty->index;
1215 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1216 return CMD_SUCCESS;
1217}
1218
1219DEFUN (no_bgp_log_neighbor_changes,
1220 no_bgp_log_neighbor_changes_cmd,
1221 "no bgp log-neighbor-changes",
1222 NO_STR
1223 "BGP specific commands\n"
1224 "Log neighbor up/down and reset reason\n")
1225{
1226 struct bgp *bgp;
1227
1228 bgp = vty->index;
1229 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1230 return CMD_SUCCESS;
1231}
David Lamparter6b0655a2014-06-04 06:53:35 +02001232
paul718e3742002-12-13 20:15:29 +00001233/* "bgp bestpath med" configuration. */
1234DEFUN (bgp_bestpath_med,
1235 bgp_bestpath_med_cmd,
1236 "bgp bestpath med (confed|missing-as-worst)",
1237 "BGP specific commands\n"
1238 "Change the default bestpath selection\n"
1239 "MED attribute\n"
1240 "Compare MED among confederation paths\n"
1241 "Treat missing MED as the least preferred one\n")
1242{
1243 struct bgp *bgp;
1244
1245 bgp = vty->index;
1246
1247 if (strncmp (argv[0], "confed", 1) == 0)
1248 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1249 else
1250 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1251
1252 return CMD_SUCCESS;
1253}
1254
1255DEFUN (bgp_bestpath_med2,
1256 bgp_bestpath_med2_cmd,
1257 "bgp bestpath med confed missing-as-worst",
1258 "BGP specific commands\n"
1259 "Change the default bestpath selection\n"
1260 "MED attribute\n"
1261 "Compare MED among confederation paths\n"
1262 "Treat missing MED as the least preferred one\n")
1263{
1264 struct bgp *bgp;
1265
1266 bgp = vty->index;
1267 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1268 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1269 return CMD_SUCCESS;
1270}
1271
1272ALIAS (bgp_bestpath_med2,
1273 bgp_bestpath_med3_cmd,
1274 "bgp bestpath med missing-as-worst confed",
1275 "BGP specific commands\n"
1276 "Change the default bestpath selection\n"
1277 "MED attribute\n"
1278 "Treat missing MED as the least preferred one\n"
1279 "Compare MED among confederation paths\n")
1280
1281DEFUN (no_bgp_bestpath_med,
1282 no_bgp_bestpath_med_cmd,
1283 "no bgp bestpath med (confed|missing-as-worst)",
1284 NO_STR
1285 "BGP specific commands\n"
1286 "Change the default bestpath selection\n"
1287 "MED attribute\n"
1288 "Compare MED among confederation paths\n"
1289 "Treat missing MED as the least preferred one\n")
1290{
1291 struct bgp *bgp;
1292
1293 bgp = vty->index;
1294
1295 if (strncmp (argv[0], "confed", 1) == 0)
1296 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1297 else
1298 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1299
1300 return CMD_SUCCESS;
1301}
1302
1303DEFUN (no_bgp_bestpath_med2,
1304 no_bgp_bestpath_med2_cmd,
1305 "no bgp bestpath med confed missing-as-worst",
1306 NO_STR
1307 "BGP specific commands\n"
1308 "Change the default bestpath selection\n"
1309 "MED attribute\n"
1310 "Compare MED among confederation paths\n"
1311 "Treat missing MED as the least preferred one\n")
1312{
1313 struct bgp *bgp;
1314
1315 bgp = vty->index;
1316 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1317 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1318 return CMD_SUCCESS;
1319}
1320
1321ALIAS (no_bgp_bestpath_med2,
1322 no_bgp_bestpath_med3_cmd,
1323 "no bgp bestpath med missing-as-worst confed",
1324 NO_STR
1325 "BGP specific commands\n"
1326 "Change the default bestpath selection\n"
1327 "MED attribute\n"
1328 "Treat missing MED as the least preferred one\n"
1329 "Compare MED among confederation paths\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001330
paul718e3742002-12-13 20:15:29 +00001331/* "no bgp default ipv4-unicast". */
1332DEFUN (no_bgp_default_ipv4_unicast,
1333 no_bgp_default_ipv4_unicast_cmd,
1334 "no bgp default ipv4-unicast",
1335 NO_STR
1336 "BGP specific commands\n"
1337 "Configure BGP defaults\n"
1338 "Activate ipv4-unicast for a peer by default\n")
1339{
1340 struct bgp *bgp;
1341
1342 bgp = vty->index;
1343 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1344 return CMD_SUCCESS;
1345}
1346
1347DEFUN (bgp_default_ipv4_unicast,
1348 bgp_default_ipv4_unicast_cmd,
1349 "bgp default ipv4-unicast",
1350 "BGP specific commands\n"
1351 "Configure BGP defaults\n"
1352 "Activate ipv4-unicast for a peer by default\n")
1353{
1354 struct bgp *bgp;
1355
1356 bgp = vty->index;
1357 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1358 return CMD_SUCCESS;
1359}
David Lamparter6b0655a2014-06-04 06:53:35 +02001360
paul718e3742002-12-13 20:15:29 +00001361/* "bgp import-check" configuration. */
1362DEFUN (bgp_network_import_check,
1363 bgp_network_import_check_cmd,
1364 "bgp network import-check",
1365 "BGP specific commands\n"
1366 "BGP network command\n"
1367 "Check BGP network route exists in IGP\n")
1368{
1369 struct bgp *bgp;
1370
1371 bgp = vty->index;
1372 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1373 return CMD_SUCCESS;
1374}
1375
1376DEFUN (no_bgp_network_import_check,
1377 no_bgp_network_import_check_cmd,
1378 "no bgp network import-check",
1379 NO_STR
1380 "BGP specific commands\n"
1381 "BGP network command\n"
1382 "Check BGP network route exists in IGP\n")
1383{
1384 struct bgp *bgp;
1385
1386 bgp = vty->index;
1387 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1388 return CMD_SUCCESS;
1389}
David Lamparter6b0655a2014-06-04 06:53:35 +02001390
paul718e3742002-12-13 20:15:29 +00001391DEFUN (bgp_default_local_preference,
1392 bgp_default_local_preference_cmd,
1393 "bgp default local-preference <0-4294967295>",
1394 "BGP specific commands\n"
1395 "Configure BGP defaults\n"
1396 "local preference (higher=more preferred)\n"
1397 "Configure default local preference value\n")
1398{
1399 struct bgp *bgp;
1400 u_int32_t local_pref;
1401
1402 bgp = vty->index;
1403
1404 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1405
1406 bgp_default_local_preference_set (bgp, local_pref);
1407
1408 return CMD_SUCCESS;
1409}
1410
1411DEFUN (no_bgp_default_local_preference,
1412 no_bgp_default_local_preference_cmd,
1413 "no bgp default local-preference",
1414 NO_STR
1415 "BGP specific commands\n"
1416 "Configure BGP defaults\n"
1417 "local preference (higher=more preferred)\n")
1418{
1419 struct bgp *bgp;
1420
1421 bgp = vty->index;
1422 bgp_default_local_preference_unset (bgp);
1423 return CMD_SUCCESS;
1424}
1425
1426ALIAS (no_bgp_default_local_preference,
1427 no_bgp_default_local_preference_val_cmd,
1428 "no bgp default local-preference <0-4294967295>",
1429 NO_STR
1430 "BGP specific commands\n"
1431 "Configure BGP defaults\n"
1432 "local preference (higher=more preferred)\n"
1433 "Configure default local preference value\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001434
paul718e3742002-12-13 20:15:29 +00001435static int
paulfd79ac92004-10-13 05:06:08 +00001436peer_remote_as_vty (struct vty *vty, const char *peer_str,
1437 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001438{
1439 int ret;
1440 struct bgp *bgp;
1441 as_t as;
1442 union sockunion su;
1443
1444 bgp = vty->index;
1445
1446 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001447 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001448
1449 /* If peer is peer group, call proper function. */
1450 ret = str2sockunion (peer_str, &su);
1451 if (ret < 0)
1452 {
1453 ret = peer_group_remote_as (bgp, peer_str, &as);
1454 if (ret < 0)
1455 {
1456 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1457 return CMD_WARNING;
1458 }
1459 return CMD_SUCCESS;
1460 }
1461
1462 if (peer_address_self_check (&su))
1463 {
1464 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1465 VTY_NEWLINE);
1466 return CMD_WARNING;
1467 }
1468
1469 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1470
1471 /* This peer belongs to peer group. */
1472 switch (ret)
1473 {
1474 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001475 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001476 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001477 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001478 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 +00001479 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001480 }
1481 return bgp_vty_return (vty, ret);
1482}
1483
1484DEFUN (neighbor_remote_as,
1485 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001486 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001487 NEIGHBOR_STR
1488 NEIGHBOR_ADDR_STR2
1489 "Specify a BGP neighbor\n"
1490 AS_STR)
1491{
1492 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1493}
David Lamparter6b0655a2014-06-04 06:53:35 +02001494
paul718e3742002-12-13 20:15:29 +00001495DEFUN (neighbor_peer_group,
1496 neighbor_peer_group_cmd,
1497 "neighbor WORD peer-group",
1498 NEIGHBOR_STR
1499 "Neighbor tag\n"
1500 "Configure peer-group\n")
1501{
1502 struct bgp *bgp;
1503 struct peer_group *group;
1504
1505 bgp = vty->index;
1506
1507 group = peer_group_get (bgp, argv[0]);
1508 if (! group)
1509 return CMD_WARNING;
1510
1511 return CMD_SUCCESS;
1512}
1513
1514DEFUN (no_neighbor,
1515 no_neighbor_cmd,
1516 NO_NEIGHBOR_CMD2,
1517 NO_STR
1518 NEIGHBOR_STR
1519 NEIGHBOR_ADDR_STR2)
1520{
1521 int ret;
1522 union sockunion su;
1523 struct peer_group *group;
1524 struct peer *peer;
1525
1526 ret = str2sockunion (argv[0], &su);
1527 if (ret < 0)
1528 {
1529 group = peer_group_lookup (vty->index, argv[0]);
1530 if (group)
1531 peer_group_delete (group);
1532 else
1533 {
1534 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1535 return CMD_WARNING;
1536 }
1537 }
1538 else
1539 {
1540 peer = peer_lookup (vty->index, &su);
1541 if (peer)
paul200df112005-06-01 11:17:05 +00001542 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001543 }
1544
1545 return CMD_SUCCESS;
1546}
1547
1548ALIAS (no_neighbor,
1549 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001550 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001551 NO_STR
1552 NEIGHBOR_STR
1553 NEIGHBOR_ADDR_STR
1554 "Specify a BGP neighbor\n"
1555 AS_STR)
1556
1557DEFUN (no_neighbor_peer_group,
1558 no_neighbor_peer_group_cmd,
1559 "no neighbor WORD peer-group",
1560 NO_STR
1561 NEIGHBOR_STR
1562 "Neighbor tag\n"
1563 "Configure peer-group\n")
1564{
1565 struct peer_group *group;
1566
1567 group = peer_group_lookup (vty->index, argv[0]);
1568 if (group)
1569 peer_group_delete (group);
1570 else
1571 {
1572 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1573 return CMD_WARNING;
1574 }
1575 return CMD_SUCCESS;
1576}
1577
1578DEFUN (no_neighbor_peer_group_remote_as,
1579 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001580 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001581 NO_STR
1582 NEIGHBOR_STR
1583 "Neighbor tag\n"
1584 "Specify a BGP neighbor\n"
1585 AS_STR)
1586{
1587 struct peer_group *group;
1588
1589 group = peer_group_lookup (vty->index, argv[0]);
1590 if (group)
1591 peer_group_remote_as_delete (group);
1592 else
1593 {
1594 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1595 return CMD_WARNING;
1596 }
1597 return CMD_SUCCESS;
1598}
David Lamparter6b0655a2014-06-04 06:53:35 +02001599
paul718e3742002-12-13 20:15:29 +00001600DEFUN (neighbor_local_as,
1601 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001602 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001603 NEIGHBOR_STR
1604 NEIGHBOR_ADDR_STR2
1605 "Specify a local-as number\n"
1606 "AS number used as local AS\n")
1607{
1608 struct peer *peer;
1609 int ret;
1610
1611 peer = peer_and_group_lookup_vty (vty, argv[0]);
1612 if (! peer)
1613 return CMD_WARNING;
1614
Andrew Certain9d3f9702012-11-07 23:50:07 +00001615 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
paul718e3742002-12-13 20:15:29 +00001616 return bgp_vty_return (vty, ret);
1617}
1618
1619DEFUN (neighbor_local_as_no_prepend,
1620 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001621 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001622 NEIGHBOR_STR
1623 NEIGHBOR_ADDR_STR2
1624 "Specify a local-as number\n"
1625 "AS number used as local AS\n"
1626 "Do not prepend local-as to updates from ebgp peers\n")
1627{
1628 struct peer *peer;
1629 int ret;
1630
1631 peer = peer_and_group_lookup_vty (vty, argv[0]);
1632 if (! peer)
1633 return CMD_WARNING;
1634
Andrew Certain9d3f9702012-11-07 23:50:07 +00001635 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
paul718e3742002-12-13 20:15:29 +00001636 return bgp_vty_return (vty, ret);
1637}
1638
Andrew Certain9d3f9702012-11-07 23:50:07 +00001639DEFUN (neighbor_local_as_no_prepend_replace_as,
1640 neighbor_local_as_no_prepend_replace_as_cmd,
1641 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1642 NEIGHBOR_STR
1643 NEIGHBOR_ADDR_STR2
1644 "Specify a local-as number\n"
1645 "AS number used as local AS\n"
1646 "Do not prepend local-as to updates from ebgp peers\n"
1647 "Do not prepend local-as to updates from ibgp peers\n")
1648{
1649 struct peer *peer;
1650 int ret;
1651
1652 peer = peer_and_group_lookup_vty (vty, argv[0]);
1653 if (! peer)
1654 return CMD_WARNING;
1655
1656 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
1657 return bgp_vty_return (vty, ret);
1658}
1659
1660
paul718e3742002-12-13 20:15:29 +00001661DEFUN (no_neighbor_local_as,
1662 no_neighbor_local_as_cmd,
1663 NO_NEIGHBOR_CMD2 "local-as",
1664 NO_STR
1665 NEIGHBOR_STR
1666 NEIGHBOR_ADDR_STR2
1667 "Specify a local-as number\n")
1668{
1669 struct peer *peer;
1670 int ret;
1671
1672 peer = peer_and_group_lookup_vty (vty, argv[0]);
1673 if (! peer)
1674 return CMD_WARNING;
1675
1676 ret = peer_local_as_unset (peer);
1677 return bgp_vty_return (vty, ret);
1678}
1679
1680ALIAS (no_neighbor_local_as,
1681 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001682 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001683 NO_STR
1684 NEIGHBOR_STR
1685 NEIGHBOR_ADDR_STR2
1686 "Specify a local-as number\n"
1687 "AS number used as local AS\n")
1688
1689ALIAS (no_neighbor_local_as,
1690 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001691 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001692 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")
Andrew Certain9d3f9702012-11-07 23:50:07 +00001698
1699ALIAS (no_neighbor_local_as,
1700 no_neighbor_local_as_val3_cmd,
1701 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1702 NO_STR
1703 NEIGHBOR_STR
1704 NEIGHBOR_ADDR_STR2
1705 "Specify a local-as number\n"
1706 "AS number used as local AS\n"
1707 "Do not prepend local-as to updates from ebgp peers\n"
1708 "Do not prepend local-as to updates from ibgp peers\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001709
Paul Jakma0df7c912008-07-21 21:02:49 +00001710DEFUN (neighbor_password,
1711 neighbor_password_cmd,
1712 NEIGHBOR_CMD2 "password LINE",
1713 NEIGHBOR_STR
1714 NEIGHBOR_ADDR_STR2
1715 "Set a password\n"
1716 "The password\n")
1717{
1718 struct peer *peer;
1719 int ret;
1720
1721 peer = peer_and_group_lookup_vty (vty, argv[0]);
1722 if (! peer)
1723 return CMD_WARNING;
1724
1725 ret = peer_password_set (peer, argv[1]);
1726 return bgp_vty_return (vty, ret);
1727}
1728
1729DEFUN (no_neighbor_password,
1730 no_neighbor_password_cmd,
1731 NO_NEIGHBOR_CMD2 "password",
1732 NO_STR
1733 NEIGHBOR_STR
1734 NEIGHBOR_ADDR_STR2
1735 "Set a password\n")
1736{
1737 struct peer *peer;
1738 int ret;
1739
1740 peer = peer_and_group_lookup_vty (vty, argv[0]);
1741 if (! peer)
1742 return CMD_WARNING;
1743
1744 ret = peer_password_unset (peer);
1745 return bgp_vty_return (vty, ret);
1746}
David Lamparter6b0655a2014-06-04 06:53:35 +02001747
paul718e3742002-12-13 20:15:29 +00001748DEFUN (neighbor_activate,
1749 neighbor_activate_cmd,
1750 NEIGHBOR_CMD2 "activate",
1751 NEIGHBOR_STR
1752 NEIGHBOR_ADDR_STR2
1753 "Enable the Address Family for this Neighbor\n")
1754{
1755 struct peer *peer;
1756
1757 peer = peer_and_group_lookup_vty (vty, argv[0]);
1758 if (! peer)
1759 return CMD_WARNING;
1760
1761 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1762
1763 return CMD_SUCCESS;
1764}
1765
1766DEFUN (no_neighbor_activate,
1767 no_neighbor_activate_cmd,
1768 NO_NEIGHBOR_CMD2 "activate",
1769 NO_STR
1770 NEIGHBOR_STR
1771 NEIGHBOR_ADDR_STR2
1772 "Enable the Address Family for this Neighbor\n")
1773{
1774 int ret;
1775 struct peer *peer;
1776
1777 /* Lookup peer. */
1778 peer = peer_and_group_lookup_vty (vty, argv[0]);
1779 if (! peer)
1780 return CMD_WARNING;
1781
1782 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1783
1784 return bgp_vty_return (vty, ret);
1785}
David Lamparter6b0655a2014-06-04 06:53:35 +02001786
paul718e3742002-12-13 20:15:29 +00001787DEFUN (neighbor_set_peer_group,
1788 neighbor_set_peer_group_cmd,
1789 NEIGHBOR_CMD "peer-group WORD",
1790 NEIGHBOR_STR
1791 NEIGHBOR_ADDR_STR
1792 "Member of the peer-group\n"
1793 "peer-group name\n")
1794{
1795 int ret;
1796 as_t as;
1797 union sockunion su;
1798 struct bgp *bgp;
1799 struct peer_group *group;
1800
1801 bgp = vty->index;
1802
1803 ret = str2sockunion (argv[0], &su);
1804 if (ret < 0)
1805 {
1806 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1807 return CMD_WARNING;
1808 }
1809
1810 group = peer_group_lookup (bgp, argv[1]);
1811 if (! group)
1812 {
1813 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1814 return CMD_WARNING;
1815 }
1816
1817 if (peer_address_self_check (&su))
1818 {
1819 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1820 VTY_NEWLINE);
1821 return CMD_WARNING;
1822 }
1823
1824 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1825 bgp_node_safi (vty), &as);
1826
1827 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1828 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001829 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 +00001830 return CMD_WARNING;
1831 }
1832
1833 return bgp_vty_return (vty, ret);
1834}
1835
1836DEFUN (no_neighbor_set_peer_group,
1837 no_neighbor_set_peer_group_cmd,
1838 NO_NEIGHBOR_CMD "peer-group WORD",
1839 NO_STR
1840 NEIGHBOR_STR
1841 NEIGHBOR_ADDR_STR
1842 "Member of the peer-group\n"
1843 "peer-group name\n")
1844{
1845 int ret;
1846 struct bgp *bgp;
1847 struct peer *peer;
1848 struct peer_group *group;
1849
1850 bgp = vty->index;
1851
1852 peer = peer_lookup_vty (vty, argv[0]);
1853 if (! peer)
1854 return CMD_WARNING;
1855
1856 group = peer_group_lookup (bgp, argv[1]);
1857 if (! group)
1858 {
1859 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1860 return CMD_WARNING;
1861 }
1862
1863 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1864 bgp_node_safi (vty));
1865
1866 return bgp_vty_return (vty, ret);
1867}
David Lamparter6b0655a2014-06-04 06:53:35 +02001868
paul94f2b392005-06-28 12:44:16 +00001869static int
paulfd79ac92004-10-13 05:06:08 +00001870peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1871 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001872{
1873 int ret;
1874 struct peer *peer;
1875
1876 peer = peer_and_group_lookup_vty (vty, ip_str);
1877 if (! peer)
1878 return CMD_WARNING;
1879
1880 if (set)
1881 ret = peer_flag_set (peer, flag);
1882 else
1883 ret = peer_flag_unset (peer, flag);
1884
1885 return bgp_vty_return (vty, ret);
1886}
1887
paul94f2b392005-06-28 12:44:16 +00001888static int
paulfd79ac92004-10-13 05:06:08 +00001889peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001890{
1891 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1892}
1893
paul94f2b392005-06-28 12:44:16 +00001894static int
paulfd79ac92004-10-13 05:06:08 +00001895peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001896{
1897 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1898}
1899
1900/* neighbor passive. */
1901DEFUN (neighbor_passive,
1902 neighbor_passive_cmd,
1903 NEIGHBOR_CMD2 "passive",
1904 NEIGHBOR_STR
1905 NEIGHBOR_ADDR_STR2
1906 "Don't send open messages to this neighbor\n")
1907{
1908 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1909}
1910
1911DEFUN (no_neighbor_passive,
1912 no_neighbor_passive_cmd,
1913 NO_NEIGHBOR_CMD2 "passive",
1914 NO_STR
1915 NEIGHBOR_STR
1916 NEIGHBOR_ADDR_STR2
1917 "Don't send open messages to this neighbor\n")
1918{
1919 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1920}
David Lamparter6b0655a2014-06-04 06:53:35 +02001921
paul718e3742002-12-13 20:15:29 +00001922/* neighbor shutdown. */
1923DEFUN (neighbor_shutdown,
1924 neighbor_shutdown_cmd,
1925 NEIGHBOR_CMD2 "shutdown",
1926 NEIGHBOR_STR
1927 NEIGHBOR_ADDR_STR2
1928 "Administratively shut down this neighbor\n")
1929{
1930 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1931}
1932
1933DEFUN (no_neighbor_shutdown,
1934 no_neighbor_shutdown_cmd,
1935 NO_NEIGHBOR_CMD2 "shutdown",
1936 NO_STR
1937 NEIGHBOR_STR
1938 NEIGHBOR_ADDR_STR2
1939 "Administratively shut down this neighbor\n")
1940{
1941 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1942}
David Lamparter6b0655a2014-06-04 06:53:35 +02001943
hassoc9502432005-02-01 22:01:48 +00001944/* Deprecated neighbor capability route-refresh. */
1945DEFUN_DEPRECATED (neighbor_capability_route_refresh,
1946 neighbor_capability_route_refresh_cmd,
1947 NEIGHBOR_CMD2 "capability route-refresh",
1948 NEIGHBOR_STR
1949 NEIGHBOR_ADDR_STR2
1950 "Advertise capability to the peer\n"
1951 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001952{
hassoc9502432005-02-01 22:01:48 +00001953 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001954}
1955
hassoc9502432005-02-01 22:01:48 +00001956DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
1957 no_neighbor_capability_route_refresh_cmd,
1958 NO_NEIGHBOR_CMD2 "capability route-refresh",
1959 NO_STR
1960 NEIGHBOR_STR
1961 NEIGHBOR_ADDR_STR2
1962 "Advertise capability to the peer\n"
1963 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001964{
hassoc9502432005-02-01 22:01:48 +00001965 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001966}
David Lamparter6b0655a2014-06-04 06:53:35 +02001967
paul718e3742002-12-13 20:15:29 +00001968/* neighbor capability dynamic. */
1969DEFUN (neighbor_capability_dynamic,
1970 neighbor_capability_dynamic_cmd,
1971 NEIGHBOR_CMD2 "capability dynamic",
1972 NEIGHBOR_STR
1973 NEIGHBOR_ADDR_STR2
1974 "Advertise capability to the peer\n"
1975 "Advertise dynamic capability to this neighbor\n")
1976{
1977 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1978}
1979
1980DEFUN (no_neighbor_capability_dynamic,
1981 no_neighbor_capability_dynamic_cmd,
1982 NO_NEIGHBOR_CMD2 "capability dynamic",
1983 NO_STR
1984 NEIGHBOR_STR
1985 NEIGHBOR_ADDR_STR2
1986 "Advertise capability to the peer\n"
1987 "Advertise dynamic capability to this neighbor\n")
1988{
1989 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1990}
David Lamparter6b0655a2014-06-04 06:53:35 +02001991
paul718e3742002-12-13 20:15:29 +00001992/* neighbor dont-capability-negotiate */
1993DEFUN (neighbor_dont_capability_negotiate,
1994 neighbor_dont_capability_negotiate_cmd,
1995 NEIGHBOR_CMD2 "dont-capability-negotiate",
1996 NEIGHBOR_STR
1997 NEIGHBOR_ADDR_STR2
1998 "Do not perform capability negotiation\n")
1999{
2000 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2001}
2002
2003DEFUN (no_neighbor_dont_capability_negotiate,
2004 no_neighbor_dont_capability_negotiate_cmd,
2005 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
2006 NO_STR
2007 NEIGHBOR_STR
2008 NEIGHBOR_ADDR_STR2
2009 "Do not perform capability negotiation\n")
2010{
2011 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2012}
David Lamparter6b0655a2014-06-04 06:53:35 +02002013
paul94f2b392005-06-28 12:44:16 +00002014static int
paulfd79ac92004-10-13 05:06:08 +00002015peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002016 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002017{
2018 int ret;
2019 struct peer *peer;
2020
2021 peer = peer_and_group_lookup_vty (vty, peer_str);
2022 if (! peer)
2023 return CMD_WARNING;
2024
2025 if (set)
2026 ret = peer_af_flag_set (peer, afi, safi, flag);
2027 else
2028 ret = peer_af_flag_unset (peer, afi, safi, flag);
2029
2030 return bgp_vty_return (vty, ret);
2031}
2032
paul94f2b392005-06-28 12:44:16 +00002033static int
paulfd79ac92004-10-13 05:06:08 +00002034peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002035 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002036{
2037 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
2038}
2039
paul94f2b392005-06-28 12:44:16 +00002040static int
paulfd79ac92004-10-13 05:06:08 +00002041peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002042 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002043{
2044 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
2045}
David Lamparter6b0655a2014-06-04 06:53:35 +02002046
paul718e3742002-12-13 20:15:29 +00002047/* neighbor capability orf prefix-list. */
2048DEFUN (neighbor_capability_orf_prefix,
2049 neighbor_capability_orf_prefix_cmd,
2050 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2051 NEIGHBOR_STR
2052 NEIGHBOR_ADDR_STR2
2053 "Advertise capability to the peer\n"
2054 "Advertise ORF capability to the peer\n"
2055 "Advertise prefixlist ORF capability to this neighbor\n"
2056 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2057 "Capability to RECEIVE the ORF from this neighbor\n"
2058 "Capability to SEND the ORF to this neighbor\n")
2059{
2060 u_int16_t flag = 0;
2061
2062 if (strncmp (argv[1], "s", 1) == 0)
2063 flag = PEER_FLAG_ORF_PREFIX_SM;
2064 else if (strncmp (argv[1], "r", 1) == 0)
2065 flag = PEER_FLAG_ORF_PREFIX_RM;
2066 else if (strncmp (argv[1], "b", 1) == 0)
2067 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2068 else
2069 return CMD_WARNING;
2070
2071 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2072 bgp_node_safi (vty), flag);
2073}
2074
2075DEFUN (no_neighbor_capability_orf_prefix,
2076 no_neighbor_capability_orf_prefix_cmd,
2077 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2078 NO_STR
2079 NEIGHBOR_STR
2080 NEIGHBOR_ADDR_STR2
2081 "Advertise capability to the peer\n"
2082 "Advertise ORF capability to the peer\n"
2083 "Advertise prefixlist ORF capability to this neighbor\n"
2084 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2085 "Capability to RECEIVE the ORF from this neighbor\n"
2086 "Capability to SEND the ORF to this neighbor\n")
2087{
2088 u_int16_t flag = 0;
2089
2090 if (strncmp (argv[1], "s", 1) == 0)
2091 flag = PEER_FLAG_ORF_PREFIX_SM;
2092 else if (strncmp (argv[1], "r", 1) == 0)
2093 flag = PEER_FLAG_ORF_PREFIX_RM;
2094 else if (strncmp (argv[1], "b", 1) == 0)
2095 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2096 else
2097 return CMD_WARNING;
2098
2099 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2100 bgp_node_safi (vty), flag);
2101}
David Lamparter6b0655a2014-06-04 06:53:35 +02002102
paul718e3742002-12-13 20:15:29 +00002103/* neighbor next-hop-self. */
2104DEFUN (neighbor_nexthop_self,
2105 neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002106 NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002107 NEIGHBOR_STR
2108 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002109 "Disable the next hop calculation for this neighbor\n"
2110 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002111{
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002112 u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
2113 int rc;
2114
2115 /* Check if "all" is specified */
2116 if (argv[1] != NULL)
2117 flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
2118 else
2119 unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
2120
2121 rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2122 bgp_node_safi (vty), flags);
2123 if ( rc == CMD_SUCCESS && unset )
2124 rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2125 bgp_node_safi (vty), unset);
2126 return rc;
paul718e3742002-12-13 20:15:29 +00002127}
2128
2129DEFUN (no_neighbor_nexthop_self,
2130 no_neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002131 NO_NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002132 NO_STR
2133 NEIGHBOR_STR
2134 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002135 "Disable the next hop calculation for this neighbor\n"
2136 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002137{
2138 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002139 bgp_node_safi (vty),
2140 PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
paul718e3742002-12-13 20:15:29 +00002141}
David Lamparter6b0655a2014-06-04 06:53:35 +02002142
paul718e3742002-12-13 20:15:29 +00002143/* neighbor remove-private-AS. */
2144DEFUN (neighbor_remove_private_as,
2145 neighbor_remove_private_as_cmd,
2146 NEIGHBOR_CMD2 "remove-private-AS",
2147 NEIGHBOR_STR
2148 NEIGHBOR_ADDR_STR2
2149 "Remove private AS number from outbound updates\n")
2150{
2151 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2152 bgp_node_safi (vty),
2153 PEER_FLAG_REMOVE_PRIVATE_AS);
2154}
2155
2156DEFUN (no_neighbor_remove_private_as,
2157 no_neighbor_remove_private_as_cmd,
2158 NO_NEIGHBOR_CMD2 "remove-private-AS",
2159 NO_STR
2160 NEIGHBOR_STR
2161 NEIGHBOR_ADDR_STR2
2162 "Remove private AS number from outbound updates\n")
2163{
2164 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2165 bgp_node_safi (vty),
2166 PEER_FLAG_REMOVE_PRIVATE_AS);
2167}
David Lamparter6b0655a2014-06-04 06:53:35 +02002168
paul718e3742002-12-13 20:15:29 +00002169/* neighbor send-community. */
2170DEFUN (neighbor_send_community,
2171 neighbor_send_community_cmd,
2172 NEIGHBOR_CMD2 "send-community",
2173 NEIGHBOR_STR
2174 NEIGHBOR_ADDR_STR2
2175 "Send Community attribute to this neighbor\n")
2176{
2177 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2178 bgp_node_safi (vty),
2179 PEER_FLAG_SEND_COMMUNITY);
2180}
2181
2182DEFUN (no_neighbor_send_community,
2183 no_neighbor_send_community_cmd,
2184 NO_NEIGHBOR_CMD2 "send-community",
2185 NO_STR
2186 NEIGHBOR_STR
2187 NEIGHBOR_ADDR_STR2
2188 "Send Community attribute to this neighbor\n")
2189{
2190 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2191 bgp_node_safi (vty),
2192 PEER_FLAG_SEND_COMMUNITY);
2193}
David Lamparter6b0655a2014-06-04 06:53:35 +02002194
paul718e3742002-12-13 20:15:29 +00002195/* neighbor send-community extended. */
2196DEFUN (neighbor_send_community_type,
2197 neighbor_send_community_type_cmd,
2198 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2199 NEIGHBOR_STR
2200 NEIGHBOR_ADDR_STR2
2201 "Send Community attribute to this neighbor\n"
2202 "Send Standard and Extended Community attributes\n"
2203 "Send Extended Community attributes\n"
2204 "Send Standard Community attributes\n")
2205{
2206 if (strncmp (argv[1], "s", 1) == 0)
2207 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2208 bgp_node_safi (vty),
2209 PEER_FLAG_SEND_COMMUNITY);
2210 if (strncmp (argv[1], "e", 1) == 0)
2211 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2212 bgp_node_safi (vty),
2213 PEER_FLAG_SEND_EXT_COMMUNITY);
2214
2215 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2216 bgp_node_safi (vty),
2217 (PEER_FLAG_SEND_COMMUNITY|
2218 PEER_FLAG_SEND_EXT_COMMUNITY));
2219}
2220
2221DEFUN (no_neighbor_send_community_type,
2222 no_neighbor_send_community_type_cmd,
2223 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2224 NO_STR
2225 NEIGHBOR_STR
2226 NEIGHBOR_ADDR_STR2
2227 "Send Community attribute to this neighbor\n"
2228 "Send Standard and Extended Community attributes\n"
2229 "Send Extended Community attributes\n"
2230 "Send Standard Community attributes\n")
2231{
2232 if (strncmp (argv[1], "s", 1) == 0)
2233 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2234 bgp_node_safi (vty),
2235 PEER_FLAG_SEND_COMMUNITY);
2236 if (strncmp (argv[1], "e", 1) == 0)
2237 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2238 bgp_node_safi (vty),
2239 PEER_FLAG_SEND_EXT_COMMUNITY);
2240
2241 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2242 bgp_node_safi (vty),
2243 (PEER_FLAG_SEND_COMMUNITY |
2244 PEER_FLAG_SEND_EXT_COMMUNITY));
2245}
David Lamparter6b0655a2014-06-04 06:53:35 +02002246
paul718e3742002-12-13 20:15:29 +00002247/* neighbor soft-reconfig. */
2248DEFUN (neighbor_soft_reconfiguration,
2249 neighbor_soft_reconfiguration_cmd,
2250 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2251 NEIGHBOR_STR
2252 NEIGHBOR_ADDR_STR2
2253 "Per neighbor soft reconfiguration\n"
2254 "Allow inbound soft reconfiguration for this neighbor\n")
2255{
2256 return peer_af_flag_set_vty (vty, argv[0],
2257 bgp_node_afi (vty), bgp_node_safi (vty),
2258 PEER_FLAG_SOFT_RECONFIG);
2259}
2260
2261DEFUN (no_neighbor_soft_reconfiguration,
2262 no_neighbor_soft_reconfiguration_cmd,
2263 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2264 NO_STR
2265 NEIGHBOR_STR
2266 NEIGHBOR_ADDR_STR2
2267 "Per neighbor soft reconfiguration\n"
2268 "Allow inbound soft reconfiguration for this neighbor\n")
2269{
2270 return peer_af_flag_unset_vty (vty, argv[0],
2271 bgp_node_afi (vty), bgp_node_safi (vty),
2272 PEER_FLAG_SOFT_RECONFIG);
2273}
David Lamparter6b0655a2014-06-04 06:53:35 +02002274
paul718e3742002-12-13 20:15:29 +00002275DEFUN (neighbor_route_reflector_client,
2276 neighbor_route_reflector_client_cmd,
2277 NEIGHBOR_CMD2 "route-reflector-client",
2278 NEIGHBOR_STR
2279 NEIGHBOR_ADDR_STR2
2280 "Configure a neighbor as Route Reflector client\n")
2281{
2282 struct peer *peer;
2283
2284
2285 peer = peer_and_group_lookup_vty (vty, argv[0]);
2286 if (! peer)
2287 return CMD_WARNING;
2288
2289 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2290 bgp_node_safi (vty),
2291 PEER_FLAG_REFLECTOR_CLIENT);
2292}
2293
2294DEFUN (no_neighbor_route_reflector_client,
2295 no_neighbor_route_reflector_client_cmd,
2296 NO_NEIGHBOR_CMD2 "route-reflector-client",
2297 NO_STR
2298 NEIGHBOR_STR
2299 NEIGHBOR_ADDR_STR2
2300 "Configure a neighbor as Route Reflector client\n")
2301{
2302 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2303 bgp_node_safi (vty),
2304 PEER_FLAG_REFLECTOR_CLIENT);
2305}
David Lamparter6b0655a2014-06-04 06:53:35 +02002306
paul94f2b392005-06-28 12:44:16 +00002307static int
paulfd79ac92004-10-13 05:06:08 +00002308peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2309 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002310{
2311 int ret;
2312 struct bgp *bgp;
2313 struct peer *peer;
2314 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002315 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002316 struct bgp_filter *pfilter;
2317 struct bgp_filter *gfilter;
Chris Caputo228da422009-07-18 05:44:03 +00002318 int locked_and_added = 0;
paulfee0f4c2004-09-13 05:12:46 +00002319
2320 bgp = vty->index;
2321
2322 peer = peer_and_group_lookup_vty (vty, peer_str);
2323 if ( ! peer )
2324 return CMD_WARNING;
2325
2326 /* If it is already a RS-Client, don't do anything. */
2327 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2328 return CMD_SUCCESS;
2329
2330 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002331 {
2332 peer = peer_lock (peer); /* rsclient peer list reference */
2333 listnode_add_sort (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002334 locked_and_added = 1;
paul200df112005-06-01 11:17:05 +00002335 }
paulfee0f4c2004-09-13 05:12:46 +00002336
2337 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2338 if (ret < 0)
Chris Caputo228da422009-07-18 05:44:03 +00002339 {
2340 if (locked_and_added)
2341 {
2342 listnode_delete (bgp->rsclient, peer);
2343 peer_unlock (peer); /* rsclient peer list reference */
2344 }
2345
2346 return bgp_vty_return (vty, ret);
2347 }
paulfee0f4c2004-09-13 05:12:46 +00002348
Paul Jakma64e580a2006-02-21 01:09:01 +00002349 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002350 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
Chris Caputo228da422009-07-18 05:44:03 +00002351 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2352 peer->rib[afi][safi]->owner = peer_lock (peer);
paulfee0f4c2004-09-13 05:12:46 +00002353
2354 /* Check for existing 'network' and 'redistribute' routes. */
2355 bgp_check_local_routes_rsclient (peer, afi, safi);
2356
2357 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2358 bgp_soft_reconfig_rsclient (peer, afi, safi);
2359
2360 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2361 {
2362 group = peer->group;
2363 gfilter = &peer->filter[afi][safi];
2364
paul1eb8ef22005-04-07 07:30:20 +00002365 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002366 {
2367 pfilter = &peer->filter[afi][safi];
2368
2369 /* Members of a non-RS-Client group should not be RS-Clients, as that
2370 is checked when the become part of the peer-group */
2371 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2372 if (ret < 0)
2373 return bgp_vty_return (vty, ret);
2374
2375 /* Make peer's RIB point to group's RIB. */
2376 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2377
2378 /* Import policy. */
2379 if (pfilter->map[RMAP_IMPORT].name)
2380 free (pfilter->map[RMAP_IMPORT].name);
2381 if (gfilter->map[RMAP_IMPORT].name)
2382 {
2383 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2384 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2385 }
2386 else
2387 {
2388 pfilter->map[RMAP_IMPORT].name = NULL;
2389 pfilter->map[RMAP_IMPORT].map =NULL;
2390 }
2391
2392 /* Export policy. */
2393 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2394 {
2395 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2396 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2397 }
2398 }
2399 }
2400 return CMD_SUCCESS;
2401}
2402
paul94f2b392005-06-28 12:44:16 +00002403static int
paulfd79ac92004-10-13 05:06:08 +00002404peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2405 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002406{
2407 int ret;
2408 struct bgp *bgp;
2409 struct peer *peer;
2410 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002411 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002412
2413 bgp = vty->index;
2414
2415 peer = peer_and_group_lookup_vty (vty, peer_str);
2416 if ( ! peer )
2417 return CMD_WARNING;
2418
2419 /* If it is not a RS-Client, don't do anything. */
2420 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2421 return CMD_SUCCESS;
2422
2423 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2424 {
2425 group = peer->group;
2426
paul1eb8ef22005-04-07 07:30:20 +00002427 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002428 {
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 peer->rib[afi][safi] = NULL;
2434 }
2435
2436 peer = group->conf;
2437 }
2438
2439 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2440 if (ret < 0)
2441 return bgp_vty_return (vty, ret);
2442
2443 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002444 {
Chris Caputo228da422009-07-18 05:44:03 +00002445 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
paul200df112005-06-01 11:17:05 +00002446 listnode_delete (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002447 peer_unlock (peer); /* peer bgp rsclient reference */
paul200df112005-06-01 11:17:05 +00002448 }
paulfee0f4c2004-09-13 05:12:46 +00002449
Paul Jakmab608d5b2008-07-02 02:12:07 +00002450 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002451
2452 return CMD_SUCCESS;
2453}
David Lamparter6b0655a2014-06-04 06:53:35 +02002454
paul718e3742002-12-13 20:15:29 +00002455/* neighbor route-server-client. */
2456DEFUN (neighbor_route_server_client,
2457 neighbor_route_server_client_cmd,
2458 NEIGHBOR_CMD2 "route-server-client",
2459 NEIGHBOR_STR
2460 NEIGHBOR_ADDR_STR2
2461 "Configure a neighbor as Route Server client\n")
2462{
paulfee0f4c2004-09-13 05:12:46 +00002463 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2464 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002465}
2466
2467DEFUN (no_neighbor_route_server_client,
2468 no_neighbor_route_server_client_cmd,
2469 NO_NEIGHBOR_CMD2 "route-server-client",
2470 NO_STR
2471 NEIGHBOR_STR
2472 NEIGHBOR_ADDR_STR2
2473 "Configure a neighbor as Route Server client\n")
2474{
paulfee0f4c2004-09-13 05:12:46 +00002475 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2476 bgp_node_safi(vty));
2477}
David Lamparter6b0655a2014-06-04 06:53:35 +02002478
paulfee0f4c2004-09-13 05:12:46 +00002479DEFUN (neighbor_nexthop_local_unchanged,
2480 neighbor_nexthop_local_unchanged_cmd,
2481 NEIGHBOR_CMD2 "nexthop-local unchanged",
2482 NEIGHBOR_STR
2483 NEIGHBOR_ADDR_STR2
2484 "Configure treatment of outgoing link-local nexthop attribute\n"
2485 "Leave link-local nexthop unchanged for this peer\n")
2486{
2487 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2488 bgp_node_safi (vty),
2489 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2490}
David Lamparter6b0655a2014-06-04 06:53:35 +02002491
paulfee0f4c2004-09-13 05:12:46 +00002492DEFUN (no_neighbor_nexthop_local_unchanged,
2493 no_neighbor_nexthop_local_unchanged_cmd,
2494 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2495 NO_STR
2496 NEIGHBOR_STR
2497 NEIGHBOR_ADDR_STR2
2498 "Configure treatment of outgoing link-local-nexthop attribute\n"
2499 "Leave link-local nexthop unchanged for this peer\n")
2500{
paul718e3742002-12-13 20:15:29 +00002501 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2502 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002503 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002504}
David Lamparter6b0655a2014-06-04 06:53:35 +02002505
paul718e3742002-12-13 20:15:29 +00002506DEFUN (neighbor_attr_unchanged,
2507 neighbor_attr_unchanged_cmd,
2508 NEIGHBOR_CMD2 "attribute-unchanged",
2509 NEIGHBOR_STR
2510 NEIGHBOR_ADDR_STR2
2511 "BGP attribute is propagated unchanged to this neighbor\n")
2512{
2513 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2514 bgp_node_safi (vty),
2515 (PEER_FLAG_AS_PATH_UNCHANGED |
2516 PEER_FLAG_NEXTHOP_UNCHANGED |
2517 PEER_FLAG_MED_UNCHANGED));
2518}
2519
2520DEFUN (neighbor_attr_unchanged1,
2521 neighbor_attr_unchanged1_cmd,
2522 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2523 NEIGHBOR_STR
2524 NEIGHBOR_ADDR_STR2
2525 "BGP attribute is propagated unchanged to this neighbor\n"
2526 "As-path attribute\n"
2527 "Nexthop attribute\n"
2528 "Med attribute\n")
2529{
2530 u_int16_t flags = 0;
2531
2532 if (strncmp (argv[1], "as-path", 1) == 0)
2533 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2534 else if (strncmp (argv[1], "next-hop", 1) == 0)
2535 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2536 else if (strncmp (argv[1], "med", 1) == 0)
2537 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2538
2539 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2540 bgp_node_safi (vty), flags);
2541}
2542
2543DEFUN (neighbor_attr_unchanged2,
2544 neighbor_attr_unchanged2_cmd,
2545 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2546 NEIGHBOR_STR
2547 NEIGHBOR_ADDR_STR2
2548 "BGP attribute is propagated unchanged to this neighbor\n"
2549 "As-path attribute\n"
2550 "Nexthop attribute\n"
2551 "Med attribute\n")
2552{
2553 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2554
2555 if (strncmp (argv[1], "next-hop", 1) == 0)
2556 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2557 else if (strncmp (argv[1], "med", 1) == 0)
2558 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2559
2560 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2561 bgp_node_safi (vty), flags);
2562
2563}
2564
2565DEFUN (neighbor_attr_unchanged3,
2566 neighbor_attr_unchanged3_cmd,
2567 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2568 NEIGHBOR_STR
2569 NEIGHBOR_ADDR_STR2
2570 "BGP attribute is propagated unchanged to this neighbor\n"
2571 "Nexthop attribute\n"
2572 "As-path attribute\n"
2573 "Med attribute\n")
2574{
2575 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2576
2577 if (strncmp (argv[1], "as-path", 1) == 0)
2578 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2579 else if (strncmp (argv[1], "med", 1) == 0)
2580 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2581
2582 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2583 bgp_node_safi (vty), flags);
2584}
2585
2586DEFUN (neighbor_attr_unchanged4,
2587 neighbor_attr_unchanged4_cmd,
2588 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2589 NEIGHBOR_STR
2590 NEIGHBOR_ADDR_STR2
2591 "BGP attribute is propagated unchanged to this neighbor\n"
2592 "Med attribute\n"
2593 "As-path attribute\n"
2594 "Nexthop attribute\n")
2595{
2596 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2597
2598 if (strncmp (argv[1], "as-path", 1) == 0)
2599 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2600 else if (strncmp (argv[1], "next-hop", 1) == 0)
2601 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2602
2603 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2604 bgp_node_safi (vty), flags);
2605}
2606
2607ALIAS (neighbor_attr_unchanged,
2608 neighbor_attr_unchanged5_cmd,
2609 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2610 NEIGHBOR_STR
2611 NEIGHBOR_ADDR_STR2
2612 "BGP attribute is propagated unchanged to this neighbor\n"
2613 "As-path attribute\n"
2614 "Nexthop attribute\n"
2615 "Med attribute\n")
2616
2617ALIAS (neighbor_attr_unchanged,
2618 neighbor_attr_unchanged6_cmd,
2619 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2620 NEIGHBOR_STR
2621 NEIGHBOR_ADDR_STR2
2622 "BGP attribute is propagated unchanged to this neighbor\n"
2623 "As-path attribute\n"
2624 "Med attribute\n"
2625 "Nexthop attribute\n")
2626
2627ALIAS (neighbor_attr_unchanged,
2628 neighbor_attr_unchanged7_cmd,
2629 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2630 NEIGHBOR_STR
2631 NEIGHBOR_ADDR_STR2
2632 "BGP attribute is propagated unchanged to this neighbor\n"
2633 "Nexthop attribute\n"
2634 "Med attribute\n"
2635 "As-path attribute\n")
2636
2637ALIAS (neighbor_attr_unchanged,
2638 neighbor_attr_unchanged8_cmd,
2639 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2640 NEIGHBOR_STR
2641 NEIGHBOR_ADDR_STR2
2642 "BGP attribute is propagated unchanged to this neighbor\n"
2643 "Nexthop attribute\n"
2644 "As-path attribute\n"
2645 "Med attribute\n")
2646
2647ALIAS (neighbor_attr_unchanged,
2648 neighbor_attr_unchanged9_cmd,
2649 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2650 NEIGHBOR_STR
2651 NEIGHBOR_ADDR_STR2
2652 "BGP attribute is propagated unchanged to this neighbor\n"
2653 "Med attribute\n"
2654 "Nexthop attribute\n"
2655 "As-path attribute\n")
2656
2657ALIAS (neighbor_attr_unchanged,
2658 neighbor_attr_unchanged10_cmd,
2659 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2660 NEIGHBOR_STR
2661 NEIGHBOR_ADDR_STR2
2662 "BGP attribute is propagated unchanged to this neighbor\n"
2663 "Med attribute\n"
2664 "As-path attribute\n"
2665 "Nexthop attribute\n")
2666
2667DEFUN (no_neighbor_attr_unchanged,
2668 no_neighbor_attr_unchanged_cmd,
2669 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2670 NO_STR
2671 NEIGHBOR_STR
2672 NEIGHBOR_ADDR_STR2
2673 "BGP attribute is propagated unchanged to this neighbor\n")
2674{
2675 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2676 bgp_node_safi (vty),
2677 (PEER_FLAG_AS_PATH_UNCHANGED |
2678 PEER_FLAG_NEXTHOP_UNCHANGED |
2679 PEER_FLAG_MED_UNCHANGED));
2680}
2681
2682DEFUN (no_neighbor_attr_unchanged1,
2683 no_neighbor_attr_unchanged1_cmd,
2684 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2685 NO_STR
2686 NEIGHBOR_STR
2687 NEIGHBOR_ADDR_STR2
2688 "BGP attribute is propagated unchanged to this neighbor\n"
2689 "As-path attribute\n"
2690 "Nexthop attribute\n"
2691 "Med attribute\n")
2692{
2693 u_int16_t flags = 0;
2694
2695 if (strncmp (argv[1], "as-path", 1) == 0)
2696 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2697 else if (strncmp (argv[1], "next-hop", 1) == 0)
2698 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2699 else if (strncmp (argv[1], "med", 1) == 0)
2700 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2701
2702 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2703 bgp_node_safi (vty), flags);
2704}
2705
2706DEFUN (no_neighbor_attr_unchanged2,
2707 no_neighbor_attr_unchanged2_cmd,
2708 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2709 NO_STR
2710 NEIGHBOR_STR
2711 NEIGHBOR_ADDR_STR2
2712 "BGP attribute is propagated unchanged to this neighbor\n"
2713 "As-path attribute\n"
2714 "Nexthop attribute\n"
2715 "Med attribute\n")
2716{
2717 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2718
2719 if (strncmp (argv[1], "next-hop", 1) == 0)
2720 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2721 else if (strncmp (argv[1], "med", 1) == 0)
2722 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2723
2724 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2725 bgp_node_safi (vty), flags);
2726}
2727
2728DEFUN (no_neighbor_attr_unchanged3,
2729 no_neighbor_attr_unchanged3_cmd,
2730 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2731 NO_STR
2732 NEIGHBOR_STR
2733 NEIGHBOR_ADDR_STR2
2734 "BGP attribute is propagated unchanged to this neighbor\n"
2735 "Nexthop attribute\n"
2736 "As-path attribute\n"
2737 "Med attribute\n")
2738{
2739 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2740
2741 if (strncmp (argv[1], "as-path", 1) == 0)
2742 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2743 else if (strncmp (argv[1], "med", 1) == 0)
2744 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2745
2746 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2747 bgp_node_safi (vty), flags);
2748}
2749
2750DEFUN (no_neighbor_attr_unchanged4,
2751 no_neighbor_attr_unchanged4_cmd,
2752 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2753 NO_STR
2754 NEIGHBOR_STR
2755 NEIGHBOR_ADDR_STR2
2756 "BGP attribute is propagated unchanged to this neighbor\n"
2757 "Med attribute\n"
2758 "As-path attribute\n"
2759 "Nexthop attribute\n")
2760{
2761 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2762
2763 if (strncmp (argv[1], "as-path", 1) == 0)
2764 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2765 else if (strncmp (argv[1], "next-hop", 1) == 0)
2766 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2767
2768 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2769 bgp_node_safi (vty), flags);
2770}
2771
2772ALIAS (no_neighbor_attr_unchanged,
2773 no_neighbor_attr_unchanged5_cmd,
2774 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2775 NO_STR
2776 NEIGHBOR_STR
2777 NEIGHBOR_ADDR_STR2
2778 "BGP attribute is propagated unchanged to this neighbor\n"
2779 "As-path attribute\n"
2780 "Nexthop attribute\n"
2781 "Med attribute\n")
2782
2783ALIAS (no_neighbor_attr_unchanged,
2784 no_neighbor_attr_unchanged6_cmd,
2785 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2786 NO_STR
2787 NEIGHBOR_STR
2788 NEIGHBOR_ADDR_STR2
2789 "BGP attribute is propagated unchanged to this neighbor\n"
2790 "As-path attribute\n"
2791 "Med attribute\n"
2792 "Nexthop attribute\n")
2793
2794ALIAS (no_neighbor_attr_unchanged,
2795 no_neighbor_attr_unchanged7_cmd,
2796 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2797 NO_STR
2798 NEIGHBOR_STR
2799 NEIGHBOR_ADDR_STR2
2800 "BGP attribute is propagated unchanged to this neighbor\n"
2801 "Nexthop attribute\n"
2802 "Med attribute\n"
2803 "As-path attribute\n")
2804
2805ALIAS (no_neighbor_attr_unchanged,
2806 no_neighbor_attr_unchanged8_cmd,
2807 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2808 NO_STR
2809 NEIGHBOR_STR
2810 NEIGHBOR_ADDR_STR2
2811 "BGP attribute is propagated unchanged to this neighbor\n"
2812 "Nexthop attribute\n"
2813 "As-path attribute\n"
2814 "Med attribute\n")
2815
2816ALIAS (no_neighbor_attr_unchanged,
2817 no_neighbor_attr_unchanged9_cmd,
2818 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2819 NO_STR
2820 NEIGHBOR_STR
2821 NEIGHBOR_ADDR_STR2
2822 "BGP attribute is propagated unchanged to this neighbor\n"
2823 "Med attribute\n"
2824 "Nexthop attribute\n"
2825 "As-path attribute\n")
2826
2827ALIAS (no_neighbor_attr_unchanged,
2828 no_neighbor_attr_unchanged10_cmd,
2829 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2830 NO_STR
2831 NEIGHBOR_STR
2832 NEIGHBOR_ADDR_STR2
2833 "BGP attribute is propagated unchanged to this neighbor\n"
2834 "Med attribute\n"
2835 "As-path attribute\n"
2836 "Nexthop attribute\n")
2837
2838/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002839DEFUN_DEPRECATED (neighbor_transparent_as,
2840 neighbor_transparent_as_cmd,
2841 NEIGHBOR_CMD "transparent-as",
2842 NEIGHBOR_STR
2843 NEIGHBOR_ADDR_STR
2844 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002845{
2846 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2847 bgp_node_safi (vty),
2848 PEER_FLAG_AS_PATH_UNCHANGED);
2849}
2850
hassodd4c5932005-02-02 17:15:34 +00002851DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2852 neighbor_transparent_nexthop_cmd,
2853 NEIGHBOR_CMD "transparent-nexthop",
2854 NEIGHBOR_STR
2855 NEIGHBOR_ADDR_STR
2856 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002857{
2858 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2859 bgp_node_safi (vty),
2860 PEER_FLAG_NEXTHOP_UNCHANGED);
2861}
David Lamparter6b0655a2014-06-04 06:53:35 +02002862
paul718e3742002-12-13 20:15:29 +00002863/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00002864static int
paulfd79ac92004-10-13 05:06:08 +00002865peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2866 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002867{
2868 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002869 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002870
2871 peer = peer_and_group_lookup_vty (vty, ip_str);
2872 if (! peer)
2873 return CMD_WARNING;
2874
2875 if (! ttl_str)
2876 ttl = TTL_MAX;
2877 else
2878 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2879
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002880 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
paul718e3742002-12-13 20:15:29 +00002881}
2882
paul94f2b392005-06-28 12:44:16 +00002883static int
paulfd79ac92004-10-13 05:06:08 +00002884peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002885{
2886 struct peer *peer;
2887
2888 peer = peer_and_group_lookup_vty (vty, ip_str);
2889 if (! peer)
2890 return CMD_WARNING;
2891
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002892 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
paul718e3742002-12-13 20:15:29 +00002893}
2894
2895/* neighbor ebgp-multihop. */
2896DEFUN (neighbor_ebgp_multihop,
2897 neighbor_ebgp_multihop_cmd,
2898 NEIGHBOR_CMD2 "ebgp-multihop",
2899 NEIGHBOR_STR
2900 NEIGHBOR_ADDR_STR2
2901 "Allow EBGP neighbors not on directly connected networks\n")
2902{
2903 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2904}
2905
2906DEFUN (neighbor_ebgp_multihop_ttl,
2907 neighbor_ebgp_multihop_ttl_cmd,
2908 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2909 NEIGHBOR_STR
2910 NEIGHBOR_ADDR_STR2
2911 "Allow EBGP neighbors not on directly connected networks\n"
2912 "maximum hop count\n")
2913{
2914 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
2915}
2916
2917DEFUN (no_neighbor_ebgp_multihop,
2918 no_neighbor_ebgp_multihop_cmd,
2919 NO_NEIGHBOR_CMD2 "ebgp-multihop",
2920 NO_STR
2921 NEIGHBOR_STR
2922 NEIGHBOR_ADDR_STR2
2923 "Allow EBGP neighbors not on directly connected networks\n")
2924{
2925 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
2926}
2927
2928ALIAS (no_neighbor_ebgp_multihop,
2929 no_neighbor_ebgp_multihop_ttl_cmd,
2930 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2931 NO_STR
2932 NEIGHBOR_STR
2933 NEIGHBOR_ADDR_STR2
2934 "Allow EBGP neighbors not on directly connected networks\n"
2935 "maximum hop count\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02002936
hasso6ffd2072005-02-02 14:50:11 +00002937/* disable-connected-check */
2938DEFUN (neighbor_disable_connected_check,
2939 neighbor_disable_connected_check_cmd,
2940 NEIGHBOR_CMD2 "disable-connected-check",
2941 NEIGHBOR_STR
2942 NEIGHBOR_ADDR_STR2
2943 "one-hop away EBGP peer using loopback address\n")
2944{
2945 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2946}
2947
2948DEFUN (no_neighbor_disable_connected_check,
2949 no_neighbor_disable_connected_check_cmd,
2950 NO_NEIGHBOR_CMD2 "disable-connected-check",
2951 NO_STR
2952 NEIGHBOR_STR
2953 NEIGHBOR_ADDR_STR2
2954 "one-hop away EBGP peer using loopback address\n")
2955{
2956 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2957}
2958
paul718e3742002-12-13 20:15:29 +00002959/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00002960ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002961 neighbor_enforce_multihop_cmd,
2962 NEIGHBOR_CMD2 "enforce-multihop",
2963 NEIGHBOR_STR
2964 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002965 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00002966
hasso6ffd2072005-02-02 14:50:11 +00002967/* Enforce multihop. */
2968ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002969 no_neighbor_enforce_multihop_cmd,
2970 NO_NEIGHBOR_CMD2 "enforce-multihop",
2971 NO_STR
2972 NEIGHBOR_STR
2973 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002974 "Enforce EBGP neighbors perform multihop\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02002975
paul718e3742002-12-13 20:15:29 +00002976DEFUN (neighbor_description,
2977 neighbor_description_cmd,
2978 NEIGHBOR_CMD2 "description .LINE",
2979 NEIGHBOR_STR
2980 NEIGHBOR_ADDR_STR2
2981 "Neighbor specific description\n"
2982 "Up to 80 characters describing this neighbor\n")
2983{
2984 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00002985 char *str;
paul718e3742002-12-13 20:15:29 +00002986
2987 peer = peer_and_group_lookup_vty (vty, argv[0]);
2988 if (! peer)
2989 return CMD_WARNING;
2990
2991 if (argc == 1)
2992 return CMD_SUCCESS;
2993
ajs3b8b1852005-01-29 18:19:13 +00002994 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00002995
2996 peer_description_set (peer, str);
2997
ajs3b8b1852005-01-29 18:19:13 +00002998 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00002999
3000 return CMD_SUCCESS;
3001}
3002
3003DEFUN (no_neighbor_description,
3004 no_neighbor_description_cmd,
3005 NO_NEIGHBOR_CMD2 "description",
3006 NO_STR
3007 NEIGHBOR_STR
3008 NEIGHBOR_ADDR_STR2
3009 "Neighbor specific description\n")
3010{
3011 struct peer *peer;
3012
3013 peer = peer_and_group_lookup_vty (vty, argv[0]);
3014 if (! peer)
3015 return CMD_WARNING;
3016
3017 peer_description_unset (peer);
3018
3019 return CMD_SUCCESS;
3020}
3021
3022ALIAS (no_neighbor_description,
3023 no_neighbor_description_val_cmd,
3024 NO_NEIGHBOR_CMD2 "description .LINE",
3025 NO_STR
3026 NEIGHBOR_STR
3027 NEIGHBOR_ADDR_STR2
3028 "Neighbor specific description\n"
3029 "Up to 80 characters describing this neighbor\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003030
paul718e3742002-12-13 20:15:29 +00003031/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00003032static int
paulfd79ac92004-10-13 05:06:08 +00003033peer_update_source_vty (struct vty *vty, const char *peer_str,
3034 const char *source_str)
paul718e3742002-12-13 20:15:29 +00003035{
3036 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003037
3038 peer = peer_and_group_lookup_vty (vty, peer_str);
3039 if (! peer)
3040 return CMD_WARNING;
3041
3042 if (source_str)
3043 {
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +02003044 union sockunion su;
3045 int ret = str2sockunion (source_str, &su);
3046
3047 if (ret == 0)
3048 peer_update_source_addr_set (peer, &su);
paul718e3742002-12-13 20:15:29 +00003049 else
3050 peer_update_source_if_set (peer, source_str);
3051 }
3052 else
3053 peer_update_source_unset (peer);
3054
3055 return CMD_SUCCESS;
3056}
3057
Paul Jakma9a1a3312009-07-27 12:27:55 +01003058#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
Paul Jakma369688c2006-05-23 22:27:55 +00003059#define BGP_UPDATE_SOURCE_HELP_STR \
3060 "IPv4 address\n" \
Paul Jakma9a1a3312009-07-27 12:27:55 +01003061 "IPv6 address\n" \
3062 "Interface name (requires zebra to be running)\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003063
paul718e3742002-12-13 20:15:29 +00003064DEFUN (neighbor_update_source,
3065 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00003066 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00003067 NEIGHBOR_STR
3068 NEIGHBOR_ADDR_STR2
3069 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003070 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00003071{
3072 return peer_update_source_vty (vty, argv[0], argv[1]);
3073}
3074
3075DEFUN (no_neighbor_update_source,
3076 no_neighbor_update_source_cmd,
3077 NO_NEIGHBOR_CMD2 "update-source",
3078 NO_STR
3079 NEIGHBOR_STR
3080 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00003081 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00003082{
3083 return peer_update_source_vty (vty, argv[0], NULL);
3084}
David Lamparter6b0655a2014-06-04 06:53:35 +02003085
paul94f2b392005-06-28 12:44:16 +00003086static int
paulfd79ac92004-10-13 05:06:08 +00003087peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
3088 afi_t afi, safi_t safi,
3089 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00003090{
3091 int ret;
3092 struct peer *peer;
3093
3094 peer = peer_and_group_lookup_vty (vty, peer_str);
3095 if (! peer)
3096 return CMD_WARNING;
3097
3098 if (set)
3099 ret = peer_default_originate_set (peer, afi, safi, rmap);
3100 else
3101 ret = peer_default_originate_unset (peer, afi, safi);
3102
3103 return bgp_vty_return (vty, ret);
3104}
3105
3106/* neighbor default-originate. */
3107DEFUN (neighbor_default_originate,
3108 neighbor_default_originate_cmd,
3109 NEIGHBOR_CMD2 "default-originate",
3110 NEIGHBOR_STR
3111 NEIGHBOR_ADDR_STR2
3112 "Originate default route to this neighbor\n")
3113{
3114 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3115 bgp_node_safi (vty), NULL, 1);
3116}
3117
3118DEFUN (neighbor_default_originate_rmap,
3119 neighbor_default_originate_rmap_cmd,
3120 NEIGHBOR_CMD2 "default-originate route-map WORD",
3121 NEIGHBOR_STR
3122 NEIGHBOR_ADDR_STR2
3123 "Originate default route to this neighbor\n"
3124 "Route-map to specify criteria to originate default\n"
3125 "route-map name\n")
3126{
3127 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3128 bgp_node_safi (vty), argv[1], 1);
3129}
3130
3131DEFUN (no_neighbor_default_originate,
3132 no_neighbor_default_originate_cmd,
3133 NO_NEIGHBOR_CMD2 "default-originate",
3134 NO_STR
3135 NEIGHBOR_STR
3136 NEIGHBOR_ADDR_STR2
3137 "Originate default route to this neighbor\n")
3138{
3139 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3140 bgp_node_safi (vty), NULL, 0);
3141}
3142
3143ALIAS (no_neighbor_default_originate,
3144 no_neighbor_default_originate_rmap_cmd,
3145 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3146 NO_STR
3147 NEIGHBOR_STR
3148 NEIGHBOR_ADDR_STR2
3149 "Originate default route to this neighbor\n"
3150 "Route-map to specify criteria to originate default\n"
3151 "route-map name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003152
paul718e3742002-12-13 20:15:29 +00003153/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00003154static int
paulfd79ac92004-10-13 05:06:08 +00003155peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3156 const char *port_str)
paul718e3742002-12-13 20:15:29 +00003157{
3158 struct peer *peer;
3159 u_int16_t port;
3160 struct servent *sp;
3161
3162 peer = peer_lookup_vty (vty, ip_str);
3163 if (! peer)
3164 return CMD_WARNING;
3165
3166 if (! port_str)
3167 {
3168 sp = getservbyname ("bgp", "tcp");
3169 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3170 }
3171 else
3172 {
3173 VTY_GET_INTEGER("port", port, port_str);
3174 }
3175
3176 peer_port_set (peer, port);
3177
3178 return CMD_SUCCESS;
3179}
3180
hassof4184462005-02-01 20:13:16 +00003181/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00003182DEFUN (neighbor_port,
3183 neighbor_port_cmd,
3184 NEIGHBOR_CMD "port <0-65535>",
3185 NEIGHBOR_STR
3186 NEIGHBOR_ADDR_STR
3187 "Neighbor's BGP port\n"
3188 "TCP port number\n")
3189{
3190 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3191}
3192
3193DEFUN (no_neighbor_port,
3194 no_neighbor_port_cmd,
3195 NO_NEIGHBOR_CMD "port",
3196 NO_STR
3197 NEIGHBOR_STR
3198 NEIGHBOR_ADDR_STR
3199 "Neighbor's BGP port\n")
3200{
3201 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3202}
3203
3204ALIAS (no_neighbor_port,
3205 no_neighbor_port_val_cmd,
3206 NO_NEIGHBOR_CMD "port <0-65535>",
3207 NO_STR
3208 NEIGHBOR_STR
3209 NEIGHBOR_ADDR_STR
3210 "Neighbor's BGP port\n"
3211 "TCP port number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003212
paul718e3742002-12-13 20:15:29 +00003213/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00003214static int
paulfd79ac92004-10-13 05:06:08 +00003215peer_weight_set_vty (struct vty *vty, const char *ip_str,
3216 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00003217{
paul718e3742002-12-13 20:15:29 +00003218 struct peer *peer;
3219 unsigned long weight;
3220
3221 peer = peer_and_group_lookup_vty (vty, ip_str);
3222 if (! peer)
3223 return CMD_WARNING;
3224
3225 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3226
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003227 return bgp_vty_return (vty, peer_weight_set (peer, weight));
paul718e3742002-12-13 20:15:29 +00003228}
3229
paul94f2b392005-06-28 12:44:16 +00003230static int
paulfd79ac92004-10-13 05:06:08 +00003231peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003232{
3233 struct peer *peer;
3234
3235 peer = peer_and_group_lookup_vty (vty, ip_str);
3236 if (! peer)
3237 return CMD_WARNING;
3238
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003239 return bgp_vty_return (vty, peer_weight_unset (peer));
paul718e3742002-12-13 20:15:29 +00003240}
3241
3242DEFUN (neighbor_weight,
3243 neighbor_weight_cmd,
3244 NEIGHBOR_CMD2 "weight <0-65535>",
3245 NEIGHBOR_STR
3246 NEIGHBOR_ADDR_STR2
3247 "Set default weight for routes from this neighbor\n"
3248 "default weight\n")
3249{
3250 return peer_weight_set_vty (vty, argv[0], argv[1]);
3251}
3252
3253DEFUN (no_neighbor_weight,
3254 no_neighbor_weight_cmd,
3255 NO_NEIGHBOR_CMD2 "weight",
3256 NO_STR
3257 NEIGHBOR_STR
3258 NEIGHBOR_ADDR_STR2
3259 "Set default weight for routes from this neighbor\n")
3260{
3261 return peer_weight_unset_vty (vty, argv[0]);
3262}
3263
3264ALIAS (no_neighbor_weight,
3265 no_neighbor_weight_val_cmd,
3266 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3267 NO_STR
3268 NEIGHBOR_STR
3269 NEIGHBOR_ADDR_STR2
3270 "Set default weight for routes from this neighbor\n"
3271 "default weight\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003272
paul718e3742002-12-13 20:15:29 +00003273/* Override capability negotiation. */
3274DEFUN (neighbor_override_capability,
3275 neighbor_override_capability_cmd,
3276 NEIGHBOR_CMD2 "override-capability",
3277 NEIGHBOR_STR
3278 NEIGHBOR_ADDR_STR2
3279 "Override capability negotiation result\n")
3280{
3281 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3282}
3283
3284DEFUN (no_neighbor_override_capability,
3285 no_neighbor_override_capability_cmd,
3286 NO_NEIGHBOR_CMD2 "override-capability",
3287 NO_STR
3288 NEIGHBOR_STR
3289 NEIGHBOR_ADDR_STR2
3290 "Override capability negotiation result\n")
3291{
3292 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3293}
David Lamparter6b0655a2014-06-04 06:53:35 +02003294
paul718e3742002-12-13 20:15:29 +00003295DEFUN (neighbor_strict_capability,
3296 neighbor_strict_capability_cmd,
3297 NEIGHBOR_CMD "strict-capability-match",
3298 NEIGHBOR_STR
3299 NEIGHBOR_ADDR_STR
3300 "Strict capability negotiation match\n")
3301{
3302 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3303}
3304
3305DEFUN (no_neighbor_strict_capability,
3306 no_neighbor_strict_capability_cmd,
3307 NO_NEIGHBOR_CMD "strict-capability-match",
3308 NO_STR
3309 NEIGHBOR_STR
3310 NEIGHBOR_ADDR_STR
3311 "Strict capability negotiation match\n")
3312{
3313 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3314}
David Lamparter6b0655a2014-06-04 06:53:35 +02003315
paul94f2b392005-06-28 12:44:16 +00003316static int
paulfd79ac92004-10-13 05:06:08 +00003317peer_timers_set_vty (struct vty *vty, const char *ip_str,
3318 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003319{
3320 int ret;
3321 struct peer *peer;
3322 u_int32_t keepalive;
3323 u_int32_t holdtime;
3324
3325 peer = peer_and_group_lookup_vty (vty, ip_str);
3326 if (! peer)
3327 return CMD_WARNING;
3328
3329 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3330 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3331
3332 ret = peer_timers_set (peer, keepalive, holdtime);
3333
3334 return bgp_vty_return (vty, ret);
3335}
David Lamparter6b0655a2014-06-04 06:53:35 +02003336
paul94f2b392005-06-28 12:44:16 +00003337static int
paulfd79ac92004-10-13 05:06:08 +00003338peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003339{
3340 int ret;
3341 struct peer *peer;
3342
3343 peer = peer_lookup_vty (vty, ip_str);
3344 if (! peer)
3345 return CMD_WARNING;
3346
3347 ret = peer_timers_unset (peer);
3348
3349 return bgp_vty_return (vty, ret);
3350}
3351
3352DEFUN (neighbor_timers,
3353 neighbor_timers_cmd,
3354 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3355 NEIGHBOR_STR
3356 NEIGHBOR_ADDR_STR2
3357 "BGP per neighbor timers\n"
3358 "Keepalive interval\n"
3359 "Holdtime\n")
3360{
3361 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3362}
3363
3364DEFUN (no_neighbor_timers,
3365 no_neighbor_timers_cmd,
3366 NO_NEIGHBOR_CMD2 "timers",
3367 NO_STR
3368 NEIGHBOR_STR
3369 NEIGHBOR_ADDR_STR2
3370 "BGP per neighbor timers\n")
3371{
3372 return peer_timers_unset_vty (vty, argv[0]);
3373}
David Lamparter6b0655a2014-06-04 06:53:35 +02003374
paul94f2b392005-06-28 12:44:16 +00003375static int
paulfd79ac92004-10-13 05:06:08 +00003376peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3377 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003378{
paul718e3742002-12-13 20:15:29 +00003379 struct peer *peer;
3380 u_int32_t connect;
3381
3382 peer = peer_lookup_vty (vty, ip_str);
3383 if (! peer)
3384 return CMD_WARNING;
3385
3386 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3387
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003388 return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
paul718e3742002-12-13 20:15:29 +00003389}
3390
paul94f2b392005-06-28 12:44:16 +00003391static int
paulfd79ac92004-10-13 05:06:08 +00003392peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003393{
paul718e3742002-12-13 20:15:29 +00003394 struct peer *peer;
3395
3396 peer = peer_and_group_lookup_vty (vty, ip_str);
3397 if (! peer)
3398 return CMD_WARNING;
3399
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003400 return bgp_vty_return (vty, peer_timers_connect_unset (peer));
paul718e3742002-12-13 20:15:29 +00003401}
3402
3403DEFUN (neighbor_timers_connect,
3404 neighbor_timers_connect_cmd,
3405 NEIGHBOR_CMD "timers connect <0-65535>",
3406 NEIGHBOR_STR
3407 NEIGHBOR_ADDR_STR
3408 "BGP per neighbor timers\n"
3409 "BGP connect timer\n"
3410 "Connect timer\n")
3411{
3412 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3413}
3414
3415DEFUN (no_neighbor_timers_connect,
3416 no_neighbor_timers_connect_cmd,
3417 NO_NEIGHBOR_CMD "timers connect",
3418 NO_STR
3419 NEIGHBOR_STR
3420 NEIGHBOR_ADDR_STR
3421 "BGP per neighbor timers\n"
3422 "BGP connect timer\n")
3423{
3424 return peer_timers_connect_unset_vty (vty, argv[0]);
3425}
3426
3427ALIAS (no_neighbor_timers_connect,
3428 no_neighbor_timers_connect_val_cmd,
3429 NO_NEIGHBOR_CMD "timers connect <0-65535>",
3430 NO_STR
3431 NEIGHBOR_STR
3432 NEIGHBOR_ADDR_STR
3433 "BGP per neighbor timers\n"
3434 "BGP connect timer\n"
3435 "Connect timer\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003436
paul94f2b392005-06-28 12:44:16 +00003437static int
paulfd79ac92004-10-13 05:06:08 +00003438peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3439 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003440{
3441 int ret;
3442 struct peer *peer;
3443 u_int32_t routeadv = 0;
3444
3445 peer = peer_lookup_vty (vty, ip_str);
3446 if (! peer)
3447 return CMD_WARNING;
3448
3449 if (time_str)
3450 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3451
3452 if (set)
3453 ret = peer_advertise_interval_set (peer, routeadv);
3454 else
3455 ret = peer_advertise_interval_unset (peer);
3456
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003457 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003458}
3459
3460DEFUN (neighbor_advertise_interval,
3461 neighbor_advertise_interval_cmd,
3462 NEIGHBOR_CMD "advertisement-interval <0-600>",
3463 NEIGHBOR_STR
3464 NEIGHBOR_ADDR_STR
3465 "Minimum interval between sending BGP routing updates\n"
3466 "time in seconds\n")
3467{
3468 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3469}
3470
3471DEFUN (no_neighbor_advertise_interval,
3472 no_neighbor_advertise_interval_cmd,
3473 NO_NEIGHBOR_CMD "advertisement-interval",
3474 NO_STR
3475 NEIGHBOR_STR
3476 NEIGHBOR_ADDR_STR
3477 "Minimum interval between sending BGP routing updates\n")
3478{
3479 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3480}
3481
3482ALIAS (no_neighbor_advertise_interval,
3483 no_neighbor_advertise_interval_val_cmd,
3484 NO_NEIGHBOR_CMD "advertisement-interval <0-600>",
3485 NO_STR
3486 NEIGHBOR_STR
3487 NEIGHBOR_ADDR_STR
3488 "Minimum interval between sending BGP routing updates\n"
3489 "time in seconds\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003490
paul718e3742002-12-13 20:15:29 +00003491/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003492static int
paulfd79ac92004-10-13 05:06:08 +00003493peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003494{
3495 int ret;
3496 struct peer *peer;
3497
3498 peer = peer_lookup_vty (vty, ip_str);
3499 if (! peer)
3500 return CMD_WARNING;
3501
3502 if (str)
3503 ret = peer_interface_set (peer, str);
3504 else
3505 ret = peer_interface_unset (peer);
3506
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003507 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003508}
3509
3510DEFUN (neighbor_interface,
3511 neighbor_interface_cmd,
3512 NEIGHBOR_CMD "interface WORD",
3513 NEIGHBOR_STR
3514 NEIGHBOR_ADDR_STR
3515 "Interface\n"
3516 "Interface name\n")
3517{
3518 return peer_interface_vty (vty, argv[0], argv[1]);
3519}
3520
3521DEFUN (no_neighbor_interface,
3522 no_neighbor_interface_cmd,
3523 NO_NEIGHBOR_CMD "interface WORD",
3524 NO_STR
3525 NEIGHBOR_STR
3526 NEIGHBOR_ADDR_STR
3527 "Interface\n"
3528 "Interface name\n")
3529{
3530 return peer_interface_vty (vty, argv[0], NULL);
3531}
David Lamparter6b0655a2014-06-04 06:53:35 +02003532
paul718e3742002-12-13 20:15:29 +00003533/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003534static int
paulfd79ac92004-10-13 05:06:08 +00003535peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3536 afi_t afi, safi_t safi,
3537 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003538{
3539 int ret;
3540 struct peer *peer;
3541 int direct = FILTER_IN;
3542
3543 peer = peer_and_group_lookup_vty (vty, ip_str);
3544 if (! peer)
3545 return CMD_WARNING;
3546
3547 /* Check filter direction. */
3548 if (strncmp (direct_str, "i", 1) == 0)
3549 direct = FILTER_IN;
3550 else if (strncmp (direct_str, "o", 1) == 0)
3551 direct = FILTER_OUT;
3552
3553 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3554
3555 return bgp_vty_return (vty, ret);
3556}
3557
paul94f2b392005-06-28 12:44:16 +00003558static int
paulfd79ac92004-10-13 05:06:08 +00003559peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3560 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003561{
3562 int ret;
3563 struct peer *peer;
3564 int direct = FILTER_IN;
3565
3566 peer = peer_and_group_lookup_vty (vty, ip_str);
3567 if (! peer)
3568 return CMD_WARNING;
3569
3570 /* Check filter direction. */
3571 if (strncmp (direct_str, "i", 1) == 0)
3572 direct = FILTER_IN;
3573 else if (strncmp (direct_str, "o", 1) == 0)
3574 direct = FILTER_OUT;
3575
3576 ret = peer_distribute_unset (peer, afi, safi, direct);
3577
3578 return bgp_vty_return (vty, ret);
3579}
3580
3581DEFUN (neighbor_distribute_list,
3582 neighbor_distribute_list_cmd,
3583 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3584 NEIGHBOR_STR
3585 NEIGHBOR_ADDR_STR2
3586 "Filter updates to/from this neighbor\n"
3587 "IP access-list number\n"
3588 "IP access-list number (expanded range)\n"
3589 "IP Access-list name\n"
3590 "Filter incoming updates\n"
3591 "Filter outgoing updates\n")
3592{
3593 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3594 bgp_node_safi (vty), argv[1], argv[2]);
3595}
3596
3597DEFUN (no_neighbor_distribute_list,
3598 no_neighbor_distribute_list_cmd,
3599 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3600 NO_STR
3601 NEIGHBOR_STR
3602 NEIGHBOR_ADDR_STR2
3603 "Filter updates to/from this neighbor\n"
3604 "IP access-list number\n"
3605 "IP access-list number (expanded range)\n"
3606 "IP Access-list name\n"
3607 "Filter incoming updates\n"
3608 "Filter outgoing updates\n")
3609{
3610 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3611 bgp_node_safi (vty), argv[2]);
3612}
David Lamparter6b0655a2014-06-04 06:53:35 +02003613
paul718e3742002-12-13 20:15:29 +00003614/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003615static int
paulfd79ac92004-10-13 05:06:08 +00003616peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3617 safi_t safi, const char *name_str,
3618 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003619{
3620 int ret;
3621 struct peer *peer;
3622 int direct = FILTER_IN;
3623
3624 peer = peer_and_group_lookup_vty (vty, ip_str);
3625 if (! peer)
3626 return CMD_WARNING;
3627
3628 /* Check filter direction. */
3629 if (strncmp (direct_str, "i", 1) == 0)
3630 direct = FILTER_IN;
3631 else if (strncmp (direct_str, "o", 1) == 0)
3632 direct = FILTER_OUT;
3633
3634 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3635
3636 return bgp_vty_return (vty, ret);
3637}
3638
paul94f2b392005-06-28 12:44:16 +00003639static int
paulfd79ac92004-10-13 05:06:08 +00003640peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3641 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003642{
3643 int ret;
3644 struct peer *peer;
3645 int direct = FILTER_IN;
3646
3647 peer = peer_and_group_lookup_vty (vty, ip_str);
3648 if (! peer)
3649 return CMD_WARNING;
3650
3651 /* Check filter direction. */
3652 if (strncmp (direct_str, "i", 1) == 0)
3653 direct = FILTER_IN;
3654 else if (strncmp (direct_str, "o", 1) == 0)
3655 direct = FILTER_OUT;
3656
3657 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3658
3659 return bgp_vty_return (vty, ret);
3660}
3661
3662DEFUN (neighbor_prefix_list,
3663 neighbor_prefix_list_cmd,
3664 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3665 NEIGHBOR_STR
3666 NEIGHBOR_ADDR_STR2
3667 "Filter updates to/from this neighbor\n"
3668 "Name of a prefix list\n"
3669 "Filter incoming updates\n"
3670 "Filter outgoing updates\n")
3671{
3672 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3673 bgp_node_safi (vty), argv[1], argv[2]);
3674}
3675
3676DEFUN (no_neighbor_prefix_list,
3677 no_neighbor_prefix_list_cmd,
3678 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3679 NO_STR
3680 NEIGHBOR_STR
3681 NEIGHBOR_ADDR_STR2
3682 "Filter updates to/from this neighbor\n"
3683 "Name of a prefix list\n"
3684 "Filter incoming updates\n"
3685 "Filter outgoing updates\n")
3686{
3687 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3688 bgp_node_safi (vty), argv[2]);
3689}
David Lamparter6b0655a2014-06-04 06:53:35 +02003690
paul94f2b392005-06-28 12:44:16 +00003691static int
paulfd79ac92004-10-13 05:06:08 +00003692peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3693 afi_t afi, safi_t safi,
3694 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003695{
3696 int ret;
3697 struct peer *peer;
3698 int direct = FILTER_IN;
3699
3700 peer = peer_and_group_lookup_vty (vty, ip_str);
3701 if (! peer)
3702 return CMD_WARNING;
3703
3704 /* Check filter direction. */
3705 if (strncmp (direct_str, "i", 1) == 0)
3706 direct = FILTER_IN;
3707 else if (strncmp (direct_str, "o", 1) == 0)
3708 direct = FILTER_OUT;
3709
3710 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3711
3712 return bgp_vty_return (vty, ret);
3713}
3714
paul94f2b392005-06-28 12:44:16 +00003715static int
paulfd79ac92004-10-13 05:06:08 +00003716peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3717 afi_t afi, safi_t safi,
3718 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003719{
3720 int ret;
3721 struct peer *peer;
3722 int direct = FILTER_IN;
3723
3724 peer = peer_and_group_lookup_vty (vty, ip_str);
3725 if (! peer)
3726 return CMD_WARNING;
3727
3728 /* Check filter direction. */
3729 if (strncmp (direct_str, "i", 1) == 0)
3730 direct = FILTER_IN;
3731 else if (strncmp (direct_str, "o", 1) == 0)
3732 direct = FILTER_OUT;
3733
3734 ret = peer_aslist_unset (peer, afi, safi, direct);
3735
3736 return bgp_vty_return (vty, ret);
3737}
3738
3739DEFUN (neighbor_filter_list,
3740 neighbor_filter_list_cmd,
3741 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3742 NEIGHBOR_STR
3743 NEIGHBOR_ADDR_STR2
3744 "Establish BGP filters\n"
3745 "AS path access-list name\n"
3746 "Filter incoming routes\n"
3747 "Filter outgoing routes\n")
3748{
3749 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3750 bgp_node_safi (vty), argv[1], argv[2]);
3751}
3752
3753DEFUN (no_neighbor_filter_list,
3754 no_neighbor_filter_list_cmd,
3755 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3756 NO_STR
3757 NEIGHBOR_STR
3758 NEIGHBOR_ADDR_STR2
3759 "Establish BGP filters\n"
3760 "AS path access-list name\n"
3761 "Filter incoming routes\n"
3762 "Filter outgoing routes\n")
3763{
3764 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3765 bgp_node_safi (vty), argv[2]);
3766}
David Lamparter6b0655a2014-06-04 06:53:35 +02003767
paul718e3742002-12-13 20:15:29 +00003768/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003769static int
paulfd79ac92004-10-13 05:06:08 +00003770peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3771 afi_t afi, safi_t safi,
3772 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003773{
3774 int ret;
3775 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003776 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003777
3778 peer = peer_and_group_lookup_vty (vty, ip_str);
3779 if (! peer)
3780 return CMD_WARNING;
3781
3782 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003783 if (strncmp (direct_str, "in", 2) == 0)
3784 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003785 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003786 direct = RMAP_OUT;
3787 else if (strncmp (direct_str, "im", 2) == 0)
3788 direct = RMAP_IMPORT;
3789 else if (strncmp (direct_str, "e", 1) == 0)
3790 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003791
3792 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3793
3794 return bgp_vty_return (vty, ret);
3795}
3796
paul94f2b392005-06-28 12:44:16 +00003797static int
paulfd79ac92004-10-13 05:06:08 +00003798peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3799 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003800{
3801 int ret;
3802 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003803 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003804
3805 peer = peer_and_group_lookup_vty (vty, ip_str);
3806 if (! peer)
3807 return CMD_WARNING;
3808
3809 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003810 if (strncmp (direct_str, "in", 2) == 0)
3811 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003812 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003813 direct = RMAP_OUT;
3814 else if (strncmp (direct_str, "im", 2) == 0)
3815 direct = RMAP_IMPORT;
3816 else if (strncmp (direct_str, "e", 1) == 0)
3817 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003818
3819 ret = peer_route_map_unset (peer, afi, safi, direct);
3820
3821 return bgp_vty_return (vty, ret);
3822}
3823
3824DEFUN (neighbor_route_map,
3825 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003826 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003827 NEIGHBOR_STR
3828 NEIGHBOR_ADDR_STR2
3829 "Apply route map to neighbor\n"
3830 "Name of route map\n"
3831 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003832 "Apply map to outbound routes\n"
3833 "Apply map to routes going into a Route-Server client's table\n"
3834 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003835{
3836 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3837 bgp_node_safi (vty), argv[1], argv[2]);
3838}
3839
3840DEFUN (no_neighbor_route_map,
3841 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003842 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003843 NO_STR
3844 NEIGHBOR_STR
3845 NEIGHBOR_ADDR_STR2
3846 "Apply route map to neighbor\n"
3847 "Name of route map\n"
3848 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003849 "Apply map to outbound routes\n"
3850 "Apply map to routes going into a Route-Server client's table\n"
3851 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003852{
3853 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3854 bgp_node_safi (vty), argv[2]);
3855}
David Lamparter6b0655a2014-06-04 06:53:35 +02003856
paul718e3742002-12-13 20:15:29 +00003857/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003858static int
paulfd79ac92004-10-13 05:06:08 +00003859peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3860 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003861{
3862 int ret;
3863 struct peer *peer;
3864
3865 peer = peer_and_group_lookup_vty (vty, ip_str);
3866 if (! peer)
3867 return CMD_WARNING;
3868
3869 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3870
3871 return bgp_vty_return (vty, ret);
3872}
3873
3874/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003875static int
paulfd79ac92004-10-13 05:06:08 +00003876peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003877 safi_t safi)
3878{
3879 int ret;
3880 struct peer *peer;
3881
3882 peer = peer_and_group_lookup_vty (vty, ip_str);
3883 if (! peer)
3884 return CMD_WARNING;
3885
3886 ret = peer_unsuppress_map_unset (peer, afi, safi);
3887
3888 return bgp_vty_return (vty, ret);
3889}
3890
3891DEFUN (neighbor_unsuppress_map,
3892 neighbor_unsuppress_map_cmd,
3893 NEIGHBOR_CMD2 "unsuppress-map WORD",
3894 NEIGHBOR_STR
3895 NEIGHBOR_ADDR_STR2
3896 "Route-map to selectively unsuppress suppressed routes\n"
3897 "Name of route map\n")
3898{
3899 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3900 bgp_node_safi (vty), argv[1]);
3901}
3902
3903DEFUN (no_neighbor_unsuppress_map,
3904 no_neighbor_unsuppress_map_cmd,
3905 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3906 NO_STR
3907 NEIGHBOR_STR
3908 NEIGHBOR_ADDR_STR2
3909 "Route-map to selectively unsuppress suppressed routes\n"
3910 "Name of route map\n")
3911{
3912 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3913 bgp_node_safi (vty));
3914}
David Lamparter6b0655a2014-06-04 06:53:35 +02003915
paul94f2b392005-06-28 12:44:16 +00003916static int
paulfd79ac92004-10-13 05:06:08 +00003917peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3918 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003919 const char *threshold_str, int warning,
3920 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003921{
3922 int ret;
3923 struct peer *peer;
3924 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003925 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003926 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003927
3928 peer = peer_and_group_lookup_vty (vty, ip_str);
3929 if (! peer)
3930 return CMD_WARNING;
3931
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04003932 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003933 if (threshold_str)
3934 threshold = atoi (threshold_str);
3935 else
3936 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00003937
hasso0a486e52005-02-01 20:57:17 +00003938 if (restart_str)
3939 restart = atoi (restart_str);
3940 else
3941 restart = 0;
3942
3943 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00003944
3945 return bgp_vty_return (vty, ret);
3946}
3947
paul94f2b392005-06-28 12:44:16 +00003948static int
paulfd79ac92004-10-13 05:06:08 +00003949peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003950 safi_t safi)
3951{
3952 int ret;
3953 struct peer *peer;
3954
3955 peer = peer_and_group_lookup_vty (vty, ip_str);
3956 if (! peer)
3957 return CMD_WARNING;
3958
3959 ret = peer_maximum_prefix_unset (peer, afi, safi);
3960
3961 return bgp_vty_return (vty, ret);
3962}
3963
3964/* Maximum number of prefix configuration. prefix count is different
3965 for each peer configuration. So this configuration can be set for
3966 each peer configuration. */
3967DEFUN (neighbor_maximum_prefix,
3968 neighbor_maximum_prefix_cmd,
3969 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3970 NEIGHBOR_STR
3971 NEIGHBOR_ADDR_STR2
3972 "Maximum number of prefix accept from this peer\n"
3973 "maximum no. of prefix limit\n")
3974{
3975 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003976 bgp_node_safi (vty), argv[1], NULL, 0,
3977 NULL);
paul718e3742002-12-13 20:15:29 +00003978}
3979
hassoe0701b72004-05-20 09:19:34 +00003980DEFUN (neighbor_maximum_prefix_threshold,
3981 neighbor_maximum_prefix_threshold_cmd,
3982 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
3983 NEIGHBOR_STR
3984 NEIGHBOR_ADDR_STR2
3985 "Maximum number of prefix accept from this peer\n"
3986 "maximum no. of prefix limit\n"
3987 "Threshold value (%) at which to generate a warning msg\n")
3988{
3989 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003990 bgp_node_safi (vty), argv[1], argv[2], 0,
3991 NULL);
3992}
hassoe0701b72004-05-20 09:19:34 +00003993
paul718e3742002-12-13 20:15:29 +00003994DEFUN (neighbor_maximum_prefix_warning,
3995 neighbor_maximum_prefix_warning_cmd,
3996 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3997 NEIGHBOR_STR
3998 NEIGHBOR_ADDR_STR2
3999 "Maximum number of prefix accept from this peer\n"
4000 "maximum no. of prefix limit\n"
4001 "Only give warning message when limit is exceeded\n")
4002{
4003 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004004 bgp_node_safi (vty), argv[1], NULL, 1,
4005 NULL);
paul718e3742002-12-13 20:15:29 +00004006}
4007
hassoe0701b72004-05-20 09:19:34 +00004008DEFUN (neighbor_maximum_prefix_threshold_warning,
4009 neighbor_maximum_prefix_threshold_warning_cmd,
4010 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4011 NEIGHBOR_STR
4012 NEIGHBOR_ADDR_STR2
4013 "Maximum number of prefix accept from this peer\n"
4014 "maximum no. of prefix limit\n"
4015 "Threshold value (%) at which to generate a warning msg\n"
4016 "Only give warning message when limit is exceeded\n")
4017{
4018 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004019 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4020}
4021
4022DEFUN (neighbor_maximum_prefix_restart,
4023 neighbor_maximum_prefix_restart_cmd,
4024 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
4025 NEIGHBOR_STR
4026 NEIGHBOR_ADDR_STR2
4027 "Maximum number of prefix accept from this peer\n"
4028 "maximum no. of prefix limit\n"
4029 "Restart bgp connection after limit is exceeded\n"
4030 "Restart interval in minutes")
4031{
4032 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4033 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
4034}
4035
4036DEFUN (neighbor_maximum_prefix_threshold_restart,
4037 neighbor_maximum_prefix_threshold_restart_cmd,
4038 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4039 NEIGHBOR_STR
4040 NEIGHBOR_ADDR_STR2
4041 "Maximum number of prefix accept from this peer\n"
4042 "maximum no. of prefix limit\n"
4043 "Threshold value (%) at which to generate a warning msg\n"
4044 "Restart bgp connection after limit is exceeded\n"
4045 "Restart interval in minutes")
4046{
4047 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4048 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4049}
hassoe0701b72004-05-20 09:19:34 +00004050
paul718e3742002-12-13 20:15:29 +00004051DEFUN (no_neighbor_maximum_prefix,
4052 no_neighbor_maximum_prefix_cmd,
4053 NO_NEIGHBOR_CMD2 "maximum-prefix",
4054 NO_STR
4055 NEIGHBOR_STR
4056 NEIGHBOR_ADDR_STR2
4057 "Maximum number of prefix accept from this peer\n")
4058{
4059 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4060 bgp_node_safi (vty));
4061}
4062
4063ALIAS (no_neighbor_maximum_prefix,
4064 no_neighbor_maximum_prefix_val_cmd,
4065 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4066 NO_STR
4067 NEIGHBOR_STR
4068 NEIGHBOR_ADDR_STR2
4069 "Maximum number of prefix accept from this peer\n"
4070 "maximum no. of prefix limit\n")
4071
4072ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004073 no_neighbor_maximum_prefix_threshold_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"
4080 "Threshold value (%) at which to generate a warning msg\n")
4081
4082ALIAS (no_neighbor_maximum_prefix,
4083 no_neighbor_maximum_prefix_warning_cmd,
4084 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> 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"
paule8e19462006-01-19 20:16:55 +00004090 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004091
4092ALIAS (no_neighbor_maximum_prefix,
4093 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004094 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4095 NO_STR
4096 NEIGHBOR_STR
4097 NEIGHBOR_ADDR_STR2
4098 "Maximum number of prefix accept from this peer\n"
4099 "maximum no. of prefix limit\n"
4100 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004101 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004102
4103ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004104 no_neighbor_maximum_prefix_restart_cmd,
4105 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004106 NO_STR
4107 NEIGHBOR_STR
4108 NEIGHBOR_ADDR_STR2
4109 "Maximum number of prefix accept from this peer\n"
4110 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00004111 "Restart bgp connection after limit is exceeded\n"
4112 "Restart interval in minutes")
4113
4114ALIAS (no_neighbor_maximum_prefix,
4115 no_neighbor_maximum_prefix_threshold_restart_cmd,
4116 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4117 NO_STR
4118 NEIGHBOR_STR
4119 NEIGHBOR_ADDR_STR2
4120 "Maximum number of prefix accept from this peer\n"
4121 "maximum no. of prefix limit\n"
4122 "Threshold value (%) at which to generate a warning msg\n"
4123 "Restart bgp connection after limit is exceeded\n"
4124 "Restart interval in minutes")
David Lamparter6b0655a2014-06-04 06:53:35 +02004125
paul718e3742002-12-13 20:15:29 +00004126/* "neighbor allowas-in" */
4127DEFUN (neighbor_allowas_in,
4128 neighbor_allowas_in_cmd,
4129 NEIGHBOR_CMD2 "allowas-in",
4130 NEIGHBOR_STR
4131 NEIGHBOR_ADDR_STR2
4132 "Accept as-path with my AS present in it\n")
4133{
4134 int ret;
4135 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004136 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004137
4138 peer = peer_and_group_lookup_vty (vty, argv[0]);
4139 if (! peer)
4140 return CMD_WARNING;
4141
4142 if (argc == 1)
4143 allow_num = 3;
4144 else
4145 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4146
4147 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4148 allow_num);
4149
4150 return bgp_vty_return (vty, ret);
4151}
4152
4153ALIAS (neighbor_allowas_in,
4154 neighbor_allowas_in_arg_cmd,
4155 NEIGHBOR_CMD2 "allowas-in <1-10>",
4156 NEIGHBOR_STR
4157 NEIGHBOR_ADDR_STR2
4158 "Accept as-path with my AS present in it\n"
4159 "Number of occurances of AS number\n")
4160
4161DEFUN (no_neighbor_allowas_in,
4162 no_neighbor_allowas_in_cmd,
4163 NO_NEIGHBOR_CMD2 "allowas-in",
4164 NO_STR
4165 NEIGHBOR_STR
4166 NEIGHBOR_ADDR_STR2
4167 "allow local ASN appears in aspath attribute\n")
4168{
4169 int ret;
4170 struct peer *peer;
4171
4172 peer = peer_and_group_lookup_vty (vty, argv[0]);
4173 if (! peer)
4174 return CMD_WARNING;
4175
4176 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4177
4178 return bgp_vty_return (vty, ret);
4179}
David Lamparter6b0655a2014-06-04 06:53:35 +02004180
Nick Hilliardfa411a22011-03-23 15:33:17 +00004181DEFUN (neighbor_ttl_security,
4182 neighbor_ttl_security_cmd,
4183 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4184 NEIGHBOR_STR
4185 NEIGHBOR_ADDR_STR2
4186 "Specify the maximum number of hops to the BGP peer\n")
4187{
4188 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004189 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004190
4191 peer = peer_and_group_lookup_vty (vty, argv[0]);
4192 if (! peer)
4193 return CMD_WARNING;
4194
4195 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4196
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004197 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004198}
4199
4200DEFUN (no_neighbor_ttl_security,
4201 no_neighbor_ttl_security_cmd,
4202 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4203 NO_STR
4204 NEIGHBOR_STR
4205 NEIGHBOR_ADDR_STR2
4206 "Specify the maximum number of hops to the BGP peer\n")
4207{
4208 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004209
4210 peer = peer_and_group_lookup_vty (vty, argv[0]);
4211 if (! peer)
4212 return CMD_WARNING;
4213
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004214 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004215}
David Lamparter6b0655a2014-06-04 06:53:35 +02004216
paul718e3742002-12-13 20:15:29 +00004217/* Address family configuration. */
4218DEFUN (address_family_ipv4,
4219 address_family_ipv4_cmd,
4220 "address-family ipv4",
4221 "Enter Address Family command mode\n"
4222 "Address family\n")
4223{
4224 vty->node = BGP_IPV4_NODE;
4225 return CMD_SUCCESS;
4226}
4227
4228DEFUN (address_family_ipv4_safi,
4229 address_family_ipv4_safi_cmd,
4230 "address-family ipv4 (unicast|multicast)",
4231 "Enter Address Family command mode\n"
4232 "Address family\n"
4233 "Address Family modifier\n"
4234 "Address Family modifier\n")
4235{
4236 if (strncmp (argv[0], "m", 1) == 0)
4237 vty->node = BGP_IPV4M_NODE;
4238 else
4239 vty->node = BGP_IPV4_NODE;
4240
4241 return CMD_SUCCESS;
4242}
4243
paul25ffbdc2005-08-22 22:42:08 +00004244DEFUN (address_family_ipv6,
4245 address_family_ipv6_cmd,
4246 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004247 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004248 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004249{
4250 vty->node = BGP_IPV6_NODE;
4251 return CMD_SUCCESS;
4252}
4253
paul25ffbdc2005-08-22 22:42:08 +00004254DEFUN (address_family_ipv6_safi,
4255 address_family_ipv6_safi_cmd,
4256 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004257 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004258 "Address family\n"
4259 "Address Family modifier\n"
4260 "Address Family modifier\n")
4261{
4262 if (strncmp (argv[0], "m", 1) == 0)
4263 vty->node = BGP_IPV6M_NODE;
4264 else
4265 vty->node = BGP_IPV6_NODE;
4266
4267 return CMD_SUCCESS;
4268}
paul718e3742002-12-13 20:15:29 +00004269
4270DEFUN (address_family_vpnv4,
4271 address_family_vpnv4_cmd,
4272 "address-family vpnv4",
4273 "Enter Address Family command mode\n"
4274 "Address family\n")
4275{
4276 vty->node = BGP_VPNV4_NODE;
4277 return CMD_SUCCESS;
4278}
4279
4280ALIAS (address_family_vpnv4,
4281 address_family_vpnv4_unicast_cmd,
4282 "address-family vpnv4 unicast",
4283 "Enter Address Family command mode\n"
4284 "Address family\n"
4285 "Address Family Modifier\n")
4286
4287DEFUN (exit_address_family,
4288 exit_address_family_cmd,
4289 "exit-address-family",
4290 "Exit from Address Family configuration mode\n")
4291{
hassoa8a80d52005-04-09 13:07:47 +00004292 if (vty->node == BGP_IPV4_NODE
4293 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004294 || vty->node == BGP_VPNV4_NODE
paul25ffbdc2005-08-22 22:42:08 +00004295 || vty->node == BGP_IPV6_NODE
4296 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004297 vty->node = BGP_NODE;
4298 return CMD_SUCCESS;
4299}
David Lamparter6b0655a2014-06-04 06:53:35 +02004300
paul718e3742002-12-13 20:15:29 +00004301/* BGP clear sort. */
4302enum clear_sort
4303{
4304 clear_all,
4305 clear_peer,
4306 clear_group,
4307 clear_external,
4308 clear_as
4309};
4310
paul94f2b392005-06-28 12:44:16 +00004311static void
paul718e3742002-12-13 20:15:29 +00004312bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4313 safi_t safi, int error)
4314{
4315 switch (error)
4316 {
4317 case BGP_ERR_AF_UNCONFIGURED:
4318 vty_out (vty,
4319 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4320 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4321 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4322 peer->host, VTY_NEWLINE);
4323 break;
4324 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4325 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);
4326 break;
4327 default:
4328 break;
4329 }
4330}
4331
4332/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004333static int
paul718e3742002-12-13 20:15:29 +00004334bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004335 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004336{
4337 int ret;
4338 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004339 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004340
4341 /* Clear all neighbors. */
4342 if (sort == clear_all)
4343 {
paul1eb8ef22005-04-07 07:30:20 +00004344 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004345 {
4346 if (stype == BGP_CLEAR_SOFT_NONE)
4347 ret = peer_clear (peer);
4348 else
4349 ret = peer_clear_soft (peer, afi, safi, stype);
4350
4351 if (ret < 0)
4352 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4353 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004354 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004355 }
4356
4357 /* Clear specified neighbors. */
4358 if (sort == clear_peer)
4359 {
4360 union sockunion su;
4361 int ret;
4362
4363 /* Make sockunion for lookup. */
4364 ret = str2sockunion (arg, &su);
4365 if (ret < 0)
4366 {
4367 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004368 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004369 }
4370 peer = peer_lookup (bgp, &su);
4371 if (! peer)
4372 {
4373 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004374 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004375 }
4376
4377 if (stype == BGP_CLEAR_SOFT_NONE)
4378 ret = peer_clear (peer);
4379 else
4380 ret = peer_clear_soft (peer, afi, safi, stype);
4381
4382 if (ret < 0)
4383 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4384
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004385 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004386 }
4387
4388 /* Clear all peer-group members. */
4389 if (sort == clear_group)
4390 {
4391 struct peer_group *group;
4392
4393 group = peer_group_lookup (bgp, arg);
4394 if (! group)
4395 {
4396 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004397 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004398 }
4399
paul1eb8ef22005-04-07 07:30:20 +00004400 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004401 {
4402 if (stype == BGP_CLEAR_SOFT_NONE)
4403 {
4404 ret = peer_clear (peer);
4405 continue;
4406 }
4407
4408 if (! peer->af_group[afi][safi])
4409 continue;
4410
4411 ret = peer_clear_soft (peer, afi, safi, stype);
4412
4413 if (ret < 0)
4414 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4415 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004416 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004417 }
4418
4419 if (sort == clear_external)
4420 {
paul1eb8ef22005-04-07 07:30:20 +00004421 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004422 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004423 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004424 continue;
4425
4426 if (stype == BGP_CLEAR_SOFT_NONE)
4427 ret = peer_clear (peer);
4428 else
4429 ret = peer_clear_soft (peer, afi, safi, stype);
4430
4431 if (ret < 0)
4432 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4433 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004434 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004435 }
4436
4437 if (sort == clear_as)
4438 {
4439 as_t as;
paul718e3742002-12-13 20:15:29 +00004440 int find = 0;
4441
Ulrich Weberbde12e32011-11-16 19:32:12 +04004442 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004443
paul1eb8ef22005-04-07 07:30:20 +00004444 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004445 {
4446 if (peer->as != as)
4447 continue;
4448
4449 find = 1;
4450 if (stype == BGP_CLEAR_SOFT_NONE)
4451 ret = peer_clear (peer);
4452 else
4453 ret = peer_clear_soft (peer, afi, safi, stype);
4454
4455 if (ret < 0)
4456 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4457 }
4458 if (! find)
4459 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4460 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004461 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004462 }
4463
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004464 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004465}
4466
paul94f2b392005-06-28 12:44:16 +00004467static int
paulfd79ac92004-10-13 05:06:08 +00004468bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4469 enum clear_sort sort, enum bgp_clear_type stype,
4470 const char *arg)
paul718e3742002-12-13 20:15:29 +00004471{
paul718e3742002-12-13 20:15:29 +00004472 struct bgp *bgp;
4473
4474 /* BGP structure lookup. */
4475 if (name)
4476 {
4477 bgp = bgp_lookup_by_name (name);
4478 if (bgp == NULL)
4479 {
4480 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4481 return CMD_WARNING;
4482 }
4483 }
4484 else
4485 {
4486 bgp = bgp_get_default ();
4487 if (bgp == NULL)
4488 {
4489 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4490 return CMD_WARNING;
4491 }
4492 }
4493
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004494 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004495}
4496
4497DEFUN (clear_ip_bgp_all,
4498 clear_ip_bgp_all_cmd,
4499 "clear ip bgp *",
4500 CLEAR_STR
4501 IP_STR
4502 BGP_STR
4503 "Clear all peers\n")
4504{
4505 if (argc == 1)
4506 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4507
4508 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4509}
4510
4511ALIAS (clear_ip_bgp_all,
4512 clear_bgp_all_cmd,
4513 "clear bgp *",
4514 CLEAR_STR
4515 BGP_STR
4516 "Clear all peers\n")
4517
4518ALIAS (clear_ip_bgp_all,
4519 clear_bgp_ipv6_all_cmd,
4520 "clear bgp ipv6 *",
4521 CLEAR_STR
4522 BGP_STR
4523 "Address family\n"
4524 "Clear all peers\n")
4525
4526ALIAS (clear_ip_bgp_all,
4527 clear_ip_bgp_instance_all_cmd,
4528 "clear ip bgp view WORD *",
4529 CLEAR_STR
4530 IP_STR
4531 BGP_STR
4532 "BGP view\n"
4533 "view name\n"
4534 "Clear all peers\n")
4535
4536ALIAS (clear_ip_bgp_all,
4537 clear_bgp_instance_all_cmd,
4538 "clear bgp view WORD *",
4539 CLEAR_STR
4540 BGP_STR
4541 "BGP view\n"
4542 "view name\n"
4543 "Clear all peers\n")
4544
4545DEFUN (clear_ip_bgp_peer,
4546 clear_ip_bgp_peer_cmd,
4547 "clear ip bgp (A.B.C.D|X:X::X:X)",
4548 CLEAR_STR
4549 IP_STR
4550 BGP_STR
4551 "BGP neighbor IP address to clear\n"
4552 "BGP IPv6 neighbor to clear\n")
4553{
4554 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4555}
4556
4557ALIAS (clear_ip_bgp_peer,
4558 clear_bgp_peer_cmd,
4559 "clear bgp (A.B.C.D|X:X::X:X)",
4560 CLEAR_STR
4561 BGP_STR
4562 "BGP neighbor address to clear\n"
4563 "BGP IPv6 neighbor to clear\n")
4564
4565ALIAS (clear_ip_bgp_peer,
4566 clear_bgp_ipv6_peer_cmd,
4567 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4568 CLEAR_STR
4569 BGP_STR
4570 "Address family\n"
4571 "BGP neighbor address to clear\n"
4572 "BGP IPv6 neighbor to clear\n")
4573
4574DEFUN (clear_ip_bgp_peer_group,
4575 clear_ip_bgp_peer_group_cmd,
4576 "clear ip bgp peer-group WORD",
4577 CLEAR_STR
4578 IP_STR
4579 BGP_STR
4580 "Clear all members of peer-group\n"
4581 "BGP peer-group name\n")
4582{
4583 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4584}
4585
4586ALIAS (clear_ip_bgp_peer_group,
4587 clear_bgp_peer_group_cmd,
4588 "clear bgp peer-group WORD",
4589 CLEAR_STR
4590 BGP_STR
4591 "Clear all members of peer-group\n"
4592 "BGP peer-group name\n")
4593
4594ALIAS (clear_ip_bgp_peer_group,
4595 clear_bgp_ipv6_peer_group_cmd,
4596 "clear bgp ipv6 peer-group WORD",
4597 CLEAR_STR
4598 BGP_STR
4599 "Address family\n"
4600 "Clear all members of peer-group\n"
4601 "BGP peer-group name\n")
4602
4603DEFUN (clear_ip_bgp_external,
4604 clear_ip_bgp_external_cmd,
4605 "clear ip bgp external",
4606 CLEAR_STR
4607 IP_STR
4608 BGP_STR
4609 "Clear all external peers\n")
4610{
4611 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4612}
4613
4614ALIAS (clear_ip_bgp_external,
4615 clear_bgp_external_cmd,
4616 "clear bgp external",
4617 CLEAR_STR
4618 BGP_STR
4619 "Clear all external peers\n")
4620
4621ALIAS (clear_ip_bgp_external,
4622 clear_bgp_ipv6_external_cmd,
4623 "clear bgp ipv6 external",
4624 CLEAR_STR
4625 BGP_STR
4626 "Address family\n"
4627 "Clear all external peers\n")
4628
4629DEFUN (clear_ip_bgp_as,
4630 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004631 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004632 CLEAR_STR
4633 IP_STR
4634 BGP_STR
4635 "Clear peers with the AS number\n")
4636{
4637 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4638}
4639
4640ALIAS (clear_ip_bgp_as,
4641 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004642 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004643 CLEAR_STR
4644 BGP_STR
4645 "Clear peers with the AS number\n")
4646
4647ALIAS (clear_ip_bgp_as,
4648 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004649 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004650 CLEAR_STR
4651 BGP_STR
4652 "Address family\n"
4653 "Clear peers with the AS number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02004654
paul718e3742002-12-13 20:15:29 +00004655/* Outbound soft-reconfiguration */
4656DEFUN (clear_ip_bgp_all_soft_out,
4657 clear_ip_bgp_all_soft_out_cmd,
4658 "clear ip bgp * soft out",
4659 CLEAR_STR
4660 IP_STR
4661 BGP_STR
4662 "Clear all peers\n"
4663 "Soft reconfig\n"
4664 "Soft reconfig outbound update\n")
4665{
4666 if (argc == 1)
4667 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4668 BGP_CLEAR_SOFT_OUT, NULL);
4669
4670 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4671 BGP_CLEAR_SOFT_OUT, NULL);
4672}
4673
4674ALIAS (clear_ip_bgp_all_soft_out,
4675 clear_ip_bgp_all_out_cmd,
4676 "clear ip bgp * out",
4677 CLEAR_STR
4678 IP_STR
4679 BGP_STR
4680 "Clear all peers\n"
4681 "Soft reconfig outbound update\n")
4682
4683ALIAS (clear_ip_bgp_all_soft_out,
4684 clear_ip_bgp_instance_all_soft_out_cmd,
4685 "clear ip bgp view WORD * soft out",
4686 CLEAR_STR
4687 IP_STR
4688 BGP_STR
4689 "BGP view\n"
4690 "view name\n"
4691 "Clear all peers\n"
4692 "Soft reconfig\n"
4693 "Soft reconfig outbound update\n")
4694
4695DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4696 clear_ip_bgp_all_ipv4_soft_out_cmd,
4697 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4698 CLEAR_STR
4699 IP_STR
4700 BGP_STR
4701 "Clear all peers\n"
4702 "Address family\n"
4703 "Address Family modifier\n"
4704 "Address Family modifier\n"
4705 "Soft reconfig\n"
4706 "Soft reconfig outbound update\n")
4707{
4708 if (strncmp (argv[0], "m", 1) == 0)
4709 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4710 BGP_CLEAR_SOFT_OUT, NULL);
4711
4712 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4713 BGP_CLEAR_SOFT_OUT, NULL);
4714}
4715
4716ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4717 clear_ip_bgp_all_ipv4_out_cmd,
4718 "clear ip bgp * ipv4 (unicast|multicast) out",
4719 CLEAR_STR
4720 IP_STR
4721 BGP_STR
4722 "Clear all peers\n"
4723 "Address family\n"
4724 "Address Family modifier\n"
4725 "Address Family modifier\n"
4726 "Soft reconfig outbound update\n")
4727
4728DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4729 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4730 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4731 CLEAR_STR
4732 IP_STR
4733 BGP_STR
4734 "BGP view\n"
4735 "view name\n"
4736 "Clear all peers\n"
4737 "Address family\n"
4738 "Address Family modifier\n"
4739 "Address Family modifier\n"
4740 "Soft reconfig outbound update\n")
4741{
4742 if (strncmp (argv[1], "m", 1) == 0)
4743 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4744 BGP_CLEAR_SOFT_OUT, NULL);
4745
4746 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4747 BGP_CLEAR_SOFT_OUT, NULL);
4748}
4749
4750DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4751 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4752 "clear ip bgp * vpnv4 unicast soft out",
4753 CLEAR_STR
4754 IP_STR
4755 BGP_STR
4756 "Clear all peers\n"
4757 "Address family\n"
4758 "Address Family Modifier\n"
4759 "Soft reconfig\n"
4760 "Soft reconfig outbound update\n")
4761{
4762 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4763 BGP_CLEAR_SOFT_OUT, NULL);
4764}
4765
4766ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4767 clear_ip_bgp_all_vpnv4_out_cmd,
4768 "clear ip bgp * vpnv4 unicast out",
4769 CLEAR_STR
4770 IP_STR
4771 BGP_STR
4772 "Clear all peers\n"
4773 "Address family\n"
4774 "Address Family Modifier\n"
4775 "Soft reconfig outbound update\n")
4776
4777DEFUN (clear_bgp_all_soft_out,
4778 clear_bgp_all_soft_out_cmd,
4779 "clear bgp * soft out",
4780 CLEAR_STR
4781 BGP_STR
4782 "Clear all peers\n"
4783 "Soft reconfig\n"
4784 "Soft reconfig outbound update\n")
4785{
4786 if (argc == 1)
4787 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4788 BGP_CLEAR_SOFT_OUT, NULL);
4789
4790 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4791 BGP_CLEAR_SOFT_OUT, NULL);
4792}
4793
4794ALIAS (clear_bgp_all_soft_out,
4795 clear_bgp_instance_all_soft_out_cmd,
4796 "clear bgp view WORD * soft out",
4797 CLEAR_STR
4798 BGP_STR
4799 "BGP view\n"
4800 "view name\n"
4801 "Clear all peers\n"
4802 "Soft reconfig\n"
4803 "Soft reconfig outbound update\n")
4804
4805ALIAS (clear_bgp_all_soft_out,
4806 clear_bgp_all_out_cmd,
4807 "clear bgp * out",
4808 CLEAR_STR
4809 BGP_STR
4810 "Clear all peers\n"
4811 "Soft reconfig outbound update\n")
4812
4813ALIAS (clear_bgp_all_soft_out,
4814 clear_bgp_ipv6_all_soft_out_cmd,
4815 "clear bgp ipv6 * soft out",
4816 CLEAR_STR
4817 BGP_STR
4818 "Address family\n"
4819 "Clear all peers\n"
4820 "Soft reconfig\n"
4821 "Soft reconfig outbound update\n")
4822
4823ALIAS (clear_bgp_all_soft_out,
4824 clear_bgp_ipv6_all_out_cmd,
4825 "clear bgp ipv6 * out",
4826 CLEAR_STR
4827 BGP_STR
4828 "Address family\n"
4829 "Clear all peers\n"
4830 "Soft reconfig outbound update\n")
4831
4832DEFUN (clear_ip_bgp_peer_soft_out,
4833 clear_ip_bgp_peer_soft_out_cmd,
4834 "clear ip bgp A.B.C.D soft out",
4835 CLEAR_STR
4836 IP_STR
4837 BGP_STR
4838 "BGP neighbor address to clear\n"
4839 "Soft reconfig\n"
4840 "Soft reconfig outbound update\n")
4841{
4842 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4843 BGP_CLEAR_SOFT_OUT, argv[0]);
4844}
4845
4846ALIAS (clear_ip_bgp_peer_soft_out,
4847 clear_ip_bgp_peer_out_cmd,
4848 "clear ip bgp A.B.C.D out",
4849 CLEAR_STR
4850 IP_STR
4851 BGP_STR
4852 "BGP neighbor address to clear\n"
4853 "Soft reconfig outbound update\n")
4854
4855DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4856 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4857 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4858 CLEAR_STR
4859 IP_STR
4860 BGP_STR
4861 "BGP neighbor address to clear\n"
4862 "Address family\n"
4863 "Address Family modifier\n"
4864 "Address Family modifier\n"
4865 "Soft reconfig\n"
4866 "Soft reconfig outbound update\n")
4867{
4868 if (strncmp (argv[1], "m", 1) == 0)
4869 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4870 BGP_CLEAR_SOFT_OUT, argv[0]);
4871
4872 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4873 BGP_CLEAR_SOFT_OUT, argv[0]);
4874}
4875
4876ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
4877 clear_ip_bgp_peer_ipv4_out_cmd,
4878 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
4879 CLEAR_STR
4880 IP_STR
4881 BGP_STR
4882 "BGP neighbor address to clear\n"
4883 "Address family\n"
4884 "Address Family modifier\n"
4885 "Address Family modifier\n"
4886 "Soft reconfig outbound update\n")
4887
4888DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
4889 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
4890 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
4891 CLEAR_STR
4892 IP_STR
4893 BGP_STR
4894 "BGP neighbor address to clear\n"
4895 "Address family\n"
4896 "Address Family Modifier\n"
4897 "Soft reconfig\n"
4898 "Soft reconfig outbound update\n")
4899{
4900 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
4901 BGP_CLEAR_SOFT_OUT, argv[0]);
4902}
4903
4904ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
4905 clear_ip_bgp_peer_vpnv4_out_cmd,
4906 "clear ip bgp A.B.C.D vpnv4 unicast out",
4907 CLEAR_STR
4908 IP_STR
4909 BGP_STR
4910 "BGP neighbor address to clear\n"
4911 "Address family\n"
4912 "Address Family Modifier\n"
4913 "Soft reconfig outbound update\n")
4914
4915DEFUN (clear_bgp_peer_soft_out,
4916 clear_bgp_peer_soft_out_cmd,
4917 "clear bgp (A.B.C.D|X:X::X:X) soft out",
4918 CLEAR_STR
4919 BGP_STR
4920 "BGP neighbor address to clear\n"
4921 "BGP IPv6 neighbor to clear\n"
4922 "Soft reconfig\n"
4923 "Soft reconfig outbound update\n")
4924{
4925 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
4926 BGP_CLEAR_SOFT_OUT, argv[0]);
4927}
4928
4929ALIAS (clear_bgp_peer_soft_out,
4930 clear_bgp_ipv6_peer_soft_out_cmd,
4931 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
4932 CLEAR_STR
4933 BGP_STR
4934 "Address family\n"
4935 "BGP neighbor address to clear\n"
4936 "BGP IPv6 neighbor to clear\n"
4937 "Soft reconfig\n"
4938 "Soft reconfig outbound update\n")
4939
4940ALIAS (clear_bgp_peer_soft_out,
4941 clear_bgp_peer_out_cmd,
4942 "clear bgp (A.B.C.D|X:X::X:X) out",
4943 CLEAR_STR
4944 BGP_STR
4945 "BGP neighbor address to clear\n"
4946 "BGP IPv6 neighbor to clear\n"
4947 "Soft reconfig outbound update\n")
4948
4949ALIAS (clear_bgp_peer_soft_out,
4950 clear_bgp_ipv6_peer_out_cmd,
4951 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
4952 CLEAR_STR
4953 BGP_STR
4954 "Address family\n"
4955 "BGP neighbor address to clear\n"
4956 "BGP IPv6 neighbor to clear\n"
4957 "Soft reconfig outbound update\n")
4958
4959DEFUN (clear_ip_bgp_peer_group_soft_out,
4960 clear_ip_bgp_peer_group_soft_out_cmd,
4961 "clear ip bgp peer-group WORD soft out",
4962 CLEAR_STR
4963 IP_STR
4964 BGP_STR
4965 "Clear all members of peer-group\n"
4966 "BGP peer-group name\n"
4967 "Soft reconfig\n"
4968 "Soft reconfig outbound update\n")
4969{
4970 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4971 BGP_CLEAR_SOFT_OUT, argv[0]);
4972}
4973
4974ALIAS (clear_ip_bgp_peer_group_soft_out,
4975 clear_ip_bgp_peer_group_out_cmd,
4976 "clear ip bgp peer-group WORD 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 "Soft reconfig outbound update\n")
4983
4984DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
4985 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
4986 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
4987 CLEAR_STR
4988 IP_STR
4989 BGP_STR
4990 "Clear all members of peer-group\n"
4991 "BGP peer-group name\n"
4992 "Address family\n"
4993 "Address Family modifier\n"
4994 "Address Family modifier\n"
4995 "Soft reconfig\n"
4996 "Soft reconfig outbound update\n")
4997{
4998 if (strncmp (argv[1], "m", 1) == 0)
4999 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5000 BGP_CLEAR_SOFT_OUT, argv[0]);
5001
5002 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5003 BGP_CLEAR_SOFT_OUT, argv[0]);
5004}
5005
5006ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
5007 clear_ip_bgp_peer_group_ipv4_out_cmd,
5008 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
5009 CLEAR_STR
5010 IP_STR
5011 BGP_STR
5012 "Clear all members of peer-group\n"
5013 "BGP peer-group name\n"
5014 "Address family\n"
5015 "Address Family modifier\n"
5016 "Address Family modifier\n"
5017 "Soft reconfig outbound update\n")
5018
5019DEFUN (clear_bgp_peer_group_soft_out,
5020 clear_bgp_peer_group_soft_out_cmd,
5021 "clear bgp peer-group WORD soft out",
5022 CLEAR_STR
5023 BGP_STR
5024 "Clear all members of peer-group\n"
5025 "BGP peer-group name\n"
5026 "Soft reconfig\n"
5027 "Soft reconfig outbound update\n")
5028{
5029 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5030 BGP_CLEAR_SOFT_OUT, argv[0]);
5031}
5032
5033ALIAS (clear_bgp_peer_group_soft_out,
5034 clear_bgp_ipv6_peer_group_soft_out_cmd,
5035 "clear bgp ipv6 peer-group WORD soft out",
5036 CLEAR_STR
5037 BGP_STR
5038 "Address family\n"
5039 "Clear all members of peer-group\n"
5040 "BGP peer-group name\n"
5041 "Soft reconfig\n"
5042 "Soft reconfig outbound update\n")
5043
5044ALIAS (clear_bgp_peer_group_soft_out,
5045 clear_bgp_peer_group_out_cmd,
5046 "clear bgp peer-group WORD out",
5047 CLEAR_STR
5048 BGP_STR
5049 "Clear all members of peer-group\n"
5050 "BGP peer-group name\n"
5051 "Soft reconfig outbound update\n")
5052
5053ALIAS (clear_bgp_peer_group_soft_out,
5054 clear_bgp_ipv6_peer_group_out_cmd,
5055 "clear bgp ipv6 peer-group WORD out",
5056 CLEAR_STR
5057 BGP_STR
5058 "Address family\n"
5059 "Clear all members of peer-group\n"
5060 "BGP peer-group name\n"
5061 "Soft reconfig outbound update\n")
5062
5063DEFUN (clear_ip_bgp_external_soft_out,
5064 clear_ip_bgp_external_soft_out_cmd,
5065 "clear ip bgp external soft out",
5066 CLEAR_STR
5067 IP_STR
5068 BGP_STR
5069 "Clear all external peers\n"
5070 "Soft reconfig\n"
5071 "Soft reconfig outbound update\n")
5072{
5073 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5074 BGP_CLEAR_SOFT_OUT, NULL);
5075}
5076
5077ALIAS (clear_ip_bgp_external_soft_out,
5078 clear_ip_bgp_external_out_cmd,
5079 "clear ip bgp external out",
5080 CLEAR_STR
5081 IP_STR
5082 BGP_STR
5083 "Clear all external peers\n"
5084 "Soft reconfig outbound update\n")
5085
5086DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5087 clear_ip_bgp_external_ipv4_soft_out_cmd,
5088 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5089 CLEAR_STR
5090 IP_STR
5091 BGP_STR
5092 "Clear all external peers\n"
5093 "Address family\n"
5094 "Address Family modifier\n"
5095 "Address Family modifier\n"
5096 "Soft reconfig\n"
5097 "Soft reconfig outbound update\n")
5098{
5099 if (strncmp (argv[0], "m", 1) == 0)
5100 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5101 BGP_CLEAR_SOFT_OUT, NULL);
5102
5103 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5104 BGP_CLEAR_SOFT_OUT, NULL);
5105}
5106
5107ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5108 clear_ip_bgp_external_ipv4_out_cmd,
5109 "clear ip bgp external ipv4 (unicast|multicast) out",
5110 CLEAR_STR
5111 IP_STR
5112 BGP_STR
5113 "Clear all external peers\n"
5114 "Address family\n"
5115 "Address Family modifier\n"
5116 "Address Family modifier\n"
5117 "Soft reconfig outbound update\n")
5118
5119DEFUN (clear_bgp_external_soft_out,
5120 clear_bgp_external_soft_out_cmd,
5121 "clear bgp external soft out",
5122 CLEAR_STR
5123 BGP_STR
5124 "Clear all external peers\n"
5125 "Soft reconfig\n"
5126 "Soft reconfig outbound update\n")
5127{
5128 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5129 BGP_CLEAR_SOFT_OUT, NULL);
5130}
5131
5132ALIAS (clear_bgp_external_soft_out,
5133 clear_bgp_ipv6_external_soft_out_cmd,
5134 "clear bgp ipv6 external soft out",
5135 CLEAR_STR
5136 BGP_STR
5137 "Address family\n"
5138 "Clear all external peers\n"
5139 "Soft reconfig\n"
5140 "Soft reconfig outbound update\n")
5141
5142ALIAS (clear_bgp_external_soft_out,
5143 clear_bgp_external_out_cmd,
5144 "clear bgp external out",
5145 CLEAR_STR
5146 BGP_STR
5147 "Clear all external peers\n"
5148 "Soft reconfig outbound update\n")
5149
5150ALIAS (clear_bgp_external_soft_out,
5151 clear_bgp_ipv6_external_out_cmd,
5152 "clear bgp ipv6 external WORD out",
5153 CLEAR_STR
5154 BGP_STR
5155 "Address family\n"
5156 "Clear all external peers\n"
5157 "Soft reconfig outbound update\n")
5158
5159DEFUN (clear_ip_bgp_as_soft_out,
5160 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005161 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005162 CLEAR_STR
5163 IP_STR
5164 BGP_STR
5165 "Clear peers with the AS number\n"
5166 "Soft reconfig\n"
5167 "Soft reconfig outbound update\n")
5168{
5169 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5170 BGP_CLEAR_SOFT_OUT, argv[0]);
5171}
5172
5173ALIAS (clear_ip_bgp_as_soft_out,
5174 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005175 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005176 CLEAR_STR
5177 IP_STR
5178 BGP_STR
5179 "Clear peers with the AS number\n"
5180 "Soft reconfig outbound update\n")
5181
5182DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5183 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005184 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005185 CLEAR_STR
5186 IP_STR
5187 BGP_STR
5188 "Clear peers with the AS number\n"
5189 "Address family\n"
5190 "Address Family modifier\n"
5191 "Address Family modifier\n"
5192 "Soft reconfig\n"
5193 "Soft reconfig outbound update\n")
5194{
5195 if (strncmp (argv[1], "m", 1) == 0)
5196 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5197 BGP_CLEAR_SOFT_OUT, argv[0]);
5198
5199 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5200 BGP_CLEAR_SOFT_OUT, argv[0]);
5201}
5202
5203ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5204 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005205 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00005206 CLEAR_STR
5207 IP_STR
5208 BGP_STR
5209 "Clear peers with the AS number\n"
5210 "Address family\n"
5211 "Address Family modifier\n"
5212 "Address Family modifier\n"
5213 "Soft reconfig outbound update\n")
5214
5215DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5216 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005217 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00005218 CLEAR_STR
5219 IP_STR
5220 BGP_STR
5221 "Clear peers with the AS number\n"
5222 "Address family\n"
5223 "Address Family modifier\n"
5224 "Soft reconfig\n"
5225 "Soft reconfig outbound update\n")
5226{
5227 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5228 BGP_CLEAR_SOFT_OUT, argv[0]);
5229}
5230
5231ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5232 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005233 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005234 CLEAR_STR
5235 IP_STR
5236 BGP_STR
5237 "Clear peers with the AS number\n"
5238 "Address family\n"
5239 "Address Family modifier\n"
5240 "Soft reconfig outbound update\n")
5241
5242DEFUN (clear_bgp_as_soft_out,
5243 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005244 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005245 CLEAR_STR
5246 BGP_STR
5247 "Clear peers with the AS number\n"
5248 "Soft reconfig\n"
5249 "Soft reconfig outbound update\n")
5250{
5251 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5252 BGP_CLEAR_SOFT_OUT, argv[0]);
5253}
5254
5255ALIAS (clear_bgp_as_soft_out,
5256 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005257 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005258 CLEAR_STR
5259 BGP_STR
5260 "Address family\n"
5261 "Clear peers with the AS number\n"
5262 "Soft reconfig\n"
5263 "Soft reconfig outbound update\n")
5264
5265ALIAS (clear_bgp_as_soft_out,
5266 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005267 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005268 CLEAR_STR
5269 BGP_STR
5270 "Clear peers with the AS number\n"
5271 "Soft reconfig outbound update\n")
5272
5273ALIAS (clear_bgp_as_soft_out,
5274 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005275 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005276 CLEAR_STR
5277 BGP_STR
5278 "Address family\n"
5279 "Clear peers with the AS number\n"
5280 "Soft reconfig outbound update\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02005281
paul718e3742002-12-13 20:15:29 +00005282/* Inbound soft-reconfiguration */
5283DEFUN (clear_ip_bgp_all_soft_in,
5284 clear_ip_bgp_all_soft_in_cmd,
5285 "clear ip bgp * soft in",
5286 CLEAR_STR
5287 IP_STR
5288 BGP_STR
5289 "Clear all peers\n"
5290 "Soft reconfig\n"
5291 "Soft reconfig inbound update\n")
5292{
5293 if (argc == 1)
5294 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5295 BGP_CLEAR_SOFT_IN, NULL);
5296
5297 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5298 BGP_CLEAR_SOFT_IN, NULL);
5299}
5300
5301ALIAS (clear_ip_bgp_all_soft_in,
5302 clear_ip_bgp_instance_all_soft_in_cmd,
5303 "clear ip bgp view WORD * soft in",
5304 CLEAR_STR
5305 IP_STR
5306 BGP_STR
5307 "BGP view\n"
5308 "view name\n"
5309 "Clear all peers\n"
5310 "Soft reconfig\n"
5311 "Soft reconfig inbound update\n")
5312
5313ALIAS (clear_ip_bgp_all_soft_in,
5314 clear_ip_bgp_all_in_cmd,
5315 "clear ip bgp * in",
5316 CLEAR_STR
5317 IP_STR
5318 BGP_STR
5319 "Clear all peers\n"
5320 "Soft reconfig inbound update\n")
5321
5322DEFUN (clear_ip_bgp_all_in_prefix_filter,
5323 clear_ip_bgp_all_in_prefix_filter_cmd,
5324 "clear ip bgp * in prefix-filter",
5325 CLEAR_STR
5326 IP_STR
5327 BGP_STR
5328 "Clear all peers\n"
5329 "Soft reconfig inbound update\n"
5330 "Push out prefix-list ORF and do inbound soft reconfig\n")
5331{
5332 if (argc== 1)
5333 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5334 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5335
5336 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5337 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5338}
5339
5340ALIAS (clear_ip_bgp_all_in_prefix_filter,
5341 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5342 "clear ip bgp view WORD * in prefix-filter",
5343 CLEAR_STR
5344 IP_STR
5345 BGP_STR
5346 "BGP view\n"
5347 "view name\n"
5348 "Clear all peers\n"
5349 "Soft reconfig inbound update\n"
5350 "Push out prefix-list ORF and do inbound soft reconfig\n")
5351
5352
5353DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5354 clear_ip_bgp_all_ipv4_soft_in_cmd,
5355 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5356 CLEAR_STR
5357 IP_STR
5358 BGP_STR
5359 "Clear all peers\n"
5360 "Address family\n"
5361 "Address Family modifier\n"
5362 "Address Family modifier\n"
5363 "Soft reconfig\n"
5364 "Soft reconfig inbound update\n")
5365{
5366 if (strncmp (argv[0], "m", 1) == 0)
5367 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5368 BGP_CLEAR_SOFT_IN, NULL);
5369
5370 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5371 BGP_CLEAR_SOFT_IN, NULL);
5372}
5373
5374ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5375 clear_ip_bgp_all_ipv4_in_cmd,
5376 "clear ip bgp * ipv4 (unicast|multicast) in",
5377 CLEAR_STR
5378 IP_STR
5379 BGP_STR
5380 "Clear all peers\n"
5381 "Address family\n"
5382 "Address Family modifier\n"
5383 "Address Family modifier\n"
5384 "Soft reconfig inbound update\n")
5385
5386DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5387 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5388 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5389 CLEAR_STR
5390 IP_STR
5391 BGP_STR
5392 "BGP view\n"
5393 "view name\n"
5394 "Clear all peers\n"
5395 "Address family\n"
5396 "Address Family modifier\n"
5397 "Address Family modifier\n"
5398 "Soft reconfig\n"
5399 "Soft reconfig inbound update\n")
5400{
5401 if (strncmp (argv[1], "m", 1) == 0)
5402 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5403 BGP_CLEAR_SOFT_IN, NULL);
5404
5405 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5406 BGP_CLEAR_SOFT_IN, NULL);
5407}
5408
5409DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5410 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5411 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5412 CLEAR_STR
5413 IP_STR
5414 BGP_STR
5415 "Clear all peers\n"
5416 "Address family\n"
5417 "Address Family modifier\n"
5418 "Address Family modifier\n"
5419 "Soft reconfig inbound update\n"
5420 "Push out prefix-list ORF and do inbound soft reconfig\n")
5421{
5422 if (strncmp (argv[0], "m", 1) == 0)
5423 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5424 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5425
5426 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5427 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5428}
5429
5430DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5431 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5432 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5433 CLEAR_STR
5434 IP_STR
5435 BGP_STR
5436 "Clear all peers\n"
5437 "Address family\n"
5438 "Address Family modifier\n"
5439 "Address Family modifier\n"
5440 "Soft reconfig inbound update\n"
5441 "Push out prefix-list ORF and do inbound soft reconfig\n")
5442{
5443 if (strncmp (argv[1], "m", 1) == 0)
5444 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5445 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5446
5447 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5448 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5449}
5450
5451DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5452 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5453 "clear ip bgp * vpnv4 unicast soft in",
5454 CLEAR_STR
5455 IP_STR
5456 BGP_STR
5457 "Clear all peers\n"
5458 "Address family\n"
5459 "Address Family Modifier\n"
5460 "Soft reconfig\n"
5461 "Soft reconfig inbound update\n")
5462{
5463 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5464 BGP_CLEAR_SOFT_IN, NULL);
5465}
5466
5467ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5468 clear_ip_bgp_all_vpnv4_in_cmd,
5469 "clear ip bgp * vpnv4 unicast in",
5470 CLEAR_STR
5471 IP_STR
5472 BGP_STR
5473 "Clear all peers\n"
5474 "Address family\n"
5475 "Address Family Modifier\n"
5476 "Soft reconfig inbound update\n")
5477
5478DEFUN (clear_bgp_all_soft_in,
5479 clear_bgp_all_soft_in_cmd,
5480 "clear bgp * soft in",
5481 CLEAR_STR
5482 BGP_STR
5483 "Clear all peers\n"
5484 "Soft reconfig\n"
5485 "Soft reconfig inbound update\n")
5486{
5487 if (argc == 1)
5488 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5489 BGP_CLEAR_SOFT_IN, NULL);
5490
5491 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5492 BGP_CLEAR_SOFT_IN, NULL);
5493}
5494
5495ALIAS (clear_bgp_all_soft_in,
5496 clear_bgp_instance_all_soft_in_cmd,
5497 "clear bgp view WORD * soft in",
5498 CLEAR_STR
5499 BGP_STR
5500 "BGP view\n"
5501 "view name\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_ipv6_all_soft_in_cmd,
5508 "clear bgp ipv6 * soft in",
5509 CLEAR_STR
5510 BGP_STR
5511 "Address family\n"
5512 "Clear all peers\n"
5513 "Soft reconfig\n"
5514 "Soft reconfig inbound update\n")
5515
5516ALIAS (clear_bgp_all_soft_in,
5517 clear_bgp_all_in_cmd,
5518 "clear bgp * in",
5519 CLEAR_STR
5520 BGP_STR
5521 "Clear all peers\n"
5522 "Soft reconfig inbound update\n")
5523
5524ALIAS (clear_bgp_all_soft_in,
5525 clear_bgp_ipv6_all_in_cmd,
5526 "clear bgp ipv6 * in",
5527 CLEAR_STR
5528 BGP_STR
5529 "Address family\n"
5530 "Clear all peers\n"
5531 "Soft reconfig inbound update\n")
5532
5533DEFUN (clear_bgp_all_in_prefix_filter,
5534 clear_bgp_all_in_prefix_filter_cmd,
5535 "clear bgp * in prefix-filter",
5536 CLEAR_STR
5537 BGP_STR
5538 "Clear all peers\n"
5539 "Soft reconfig inbound update\n"
5540 "Push out prefix-list ORF and do inbound soft reconfig\n")
5541{
5542 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5543 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5544}
5545
5546ALIAS (clear_bgp_all_in_prefix_filter,
5547 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5548 "clear bgp ipv6 * in prefix-filter",
5549 CLEAR_STR
5550 BGP_STR
5551 "Address family\n"
5552 "Clear all peers\n"
5553 "Soft reconfig inbound update\n"
5554 "Push out prefix-list ORF and do inbound soft reconfig\n")
5555
5556DEFUN (clear_ip_bgp_peer_soft_in,
5557 clear_ip_bgp_peer_soft_in_cmd,
5558 "clear ip bgp A.B.C.D soft in",
5559 CLEAR_STR
5560 IP_STR
5561 BGP_STR
5562 "BGP neighbor address to clear\n"
5563 "Soft reconfig\n"
5564 "Soft reconfig inbound update\n")
5565{
5566 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5567 BGP_CLEAR_SOFT_IN, argv[0]);
5568}
5569
5570ALIAS (clear_ip_bgp_peer_soft_in,
5571 clear_ip_bgp_peer_in_cmd,
5572 "clear ip bgp A.B.C.D in",
5573 CLEAR_STR
5574 IP_STR
5575 BGP_STR
5576 "BGP neighbor address to clear\n"
5577 "Soft reconfig inbound update\n")
5578
5579DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5580 clear_ip_bgp_peer_in_prefix_filter_cmd,
5581 "clear ip bgp A.B.C.D in prefix-filter",
5582 CLEAR_STR
5583 IP_STR
5584 BGP_STR
5585 "BGP neighbor address to clear\n"
5586 "Soft reconfig inbound update\n"
5587 "Push out the existing ORF prefix-list\n")
5588{
5589 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5590 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5591}
5592
5593DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5594 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5595 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5596 CLEAR_STR
5597 IP_STR
5598 BGP_STR
5599 "BGP neighbor address to clear\n"
5600 "Address family\n"
5601 "Address Family modifier\n"
5602 "Address Family modifier\n"
5603 "Soft reconfig\n"
5604 "Soft reconfig inbound update\n")
5605{
5606 if (strncmp (argv[1], "m", 1) == 0)
5607 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5608 BGP_CLEAR_SOFT_IN, argv[0]);
5609
5610 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5611 BGP_CLEAR_SOFT_IN, argv[0]);
5612}
5613
5614ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5615 clear_ip_bgp_peer_ipv4_in_cmd,
5616 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5617 CLEAR_STR
5618 IP_STR
5619 BGP_STR
5620 "BGP neighbor address to clear\n"
5621 "Address family\n"
5622 "Address Family modifier\n"
5623 "Address Family modifier\n"
5624 "Soft reconfig inbound update\n")
5625
5626DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5627 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5628 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5629 CLEAR_STR
5630 IP_STR
5631 BGP_STR
5632 "BGP neighbor address to clear\n"
5633 "Address family\n"
5634 "Address Family modifier\n"
5635 "Address Family modifier\n"
5636 "Soft reconfig inbound update\n"
5637 "Push out the existing ORF prefix-list\n")
5638{
5639 if (strncmp (argv[1], "m", 1) == 0)
5640 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5641 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5642
5643 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5644 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5645}
5646
5647DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5648 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5649 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5650 CLEAR_STR
5651 IP_STR
5652 BGP_STR
5653 "BGP neighbor address to clear\n"
5654 "Address family\n"
5655 "Address Family Modifier\n"
5656 "Soft reconfig\n"
5657 "Soft reconfig inbound update\n")
5658{
5659 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5660 BGP_CLEAR_SOFT_IN, argv[0]);
5661}
5662
5663ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5664 clear_ip_bgp_peer_vpnv4_in_cmd,
5665 "clear ip bgp A.B.C.D vpnv4 unicast in",
5666 CLEAR_STR
5667 IP_STR
5668 BGP_STR
5669 "BGP neighbor address to clear\n"
5670 "Address family\n"
5671 "Address Family Modifier\n"
5672 "Soft reconfig inbound update\n")
5673
5674DEFUN (clear_bgp_peer_soft_in,
5675 clear_bgp_peer_soft_in_cmd,
5676 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5677 CLEAR_STR
5678 BGP_STR
5679 "BGP neighbor address to clear\n"
5680 "BGP IPv6 neighbor to clear\n"
5681 "Soft reconfig\n"
5682 "Soft reconfig inbound update\n")
5683{
5684 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5685 BGP_CLEAR_SOFT_IN, argv[0]);
5686}
5687
5688ALIAS (clear_bgp_peer_soft_in,
5689 clear_bgp_ipv6_peer_soft_in_cmd,
5690 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5691 CLEAR_STR
5692 BGP_STR
5693 "Address family\n"
5694 "BGP neighbor address to clear\n"
5695 "BGP IPv6 neighbor to clear\n"
5696 "Soft reconfig\n"
5697 "Soft reconfig inbound update\n")
5698
5699ALIAS (clear_bgp_peer_soft_in,
5700 clear_bgp_peer_in_cmd,
5701 "clear bgp (A.B.C.D|X:X::X:X) in",
5702 CLEAR_STR
5703 BGP_STR
5704 "BGP neighbor address to clear\n"
5705 "BGP IPv6 neighbor to clear\n"
5706 "Soft reconfig inbound update\n")
5707
5708ALIAS (clear_bgp_peer_soft_in,
5709 clear_bgp_ipv6_peer_in_cmd,
5710 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5711 CLEAR_STR
5712 BGP_STR
5713 "Address family\n"
5714 "BGP neighbor address to clear\n"
5715 "BGP IPv6 neighbor to clear\n"
5716 "Soft reconfig inbound update\n")
5717
5718DEFUN (clear_bgp_peer_in_prefix_filter,
5719 clear_bgp_peer_in_prefix_filter_cmd,
5720 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5721 CLEAR_STR
5722 BGP_STR
5723 "BGP neighbor address to clear\n"
5724 "BGP IPv6 neighbor to clear\n"
5725 "Soft reconfig inbound update\n"
5726 "Push out the existing ORF prefix-list\n")
5727{
5728 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5729 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5730}
5731
5732ALIAS (clear_bgp_peer_in_prefix_filter,
5733 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5734 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5735 CLEAR_STR
5736 BGP_STR
5737 "Address family\n"
5738 "BGP neighbor address to clear\n"
5739 "BGP IPv6 neighbor to clear\n"
5740 "Soft reconfig inbound update\n"
5741 "Push out the existing ORF prefix-list\n")
5742
5743DEFUN (clear_ip_bgp_peer_group_soft_in,
5744 clear_ip_bgp_peer_group_soft_in_cmd,
5745 "clear ip bgp peer-group WORD soft in",
5746 CLEAR_STR
5747 IP_STR
5748 BGP_STR
5749 "Clear all members of peer-group\n"
5750 "BGP peer-group name\n"
5751 "Soft reconfig\n"
5752 "Soft reconfig inbound update\n")
5753{
5754 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5755 BGP_CLEAR_SOFT_IN, argv[0]);
5756}
5757
5758ALIAS (clear_ip_bgp_peer_group_soft_in,
5759 clear_ip_bgp_peer_group_in_cmd,
5760 "clear ip bgp peer-group WORD in",
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
5768DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
5769 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
5770 "clear ip bgp peer-group WORD in prefix-filter",
5771 CLEAR_STR
5772 IP_STR
5773 BGP_STR
5774 "Clear all members of peer-group\n"
5775 "BGP peer-group name\n"
5776 "Soft reconfig inbound update\n"
5777 "Push out prefix-list ORF and do inbound soft reconfig\n")
5778{
5779 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5780 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5781}
5782
5783DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
5784 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
5785 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
5786 CLEAR_STR
5787 IP_STR
5788 BGP_STR
5789 "Clear all members of peer-group\n"
5790 "BGP peer-group name\n"
5791 "Address family\n"
5792 "Address Family modifier\n"
5793 "Address Family modifier\n"
5794 "Soft reconfig\n"
5795 "Soft reconfig inbound update\n")
5796{
5797 if (strncmp (argv[1], "m", 1) == 0)
5798 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5799 BGP_CLEAR_SOFT_IN, argv[0]);
5800
5801 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5802 BGP_CLEAR_SOFT_IN, argv[0]);
5803}
5804
5805ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
5806 clear_ip_bgp_peer_group_ipv4_in_cmd,
5807 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
5808 CLEAR_STR
5809 IP_STR
5810 BGP_STR
5811 "Clear all members of peer-group\n"
5812 "BGP peer-group name\n"
5813 "Address family\n"
5814 "Address Family modifier\n"
5815 "Address Family modifier\n"
5816 "Soft reconfig inbound update\n")
5817
5818DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
5819 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
5820 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
5821 CLEAR_STR
5822 IP_STR
5823 BGP_STR
5824 "Clear all members of peer-group\n"
5825 "BGP peer-group name\n"
5826 "Address family\n"
5827 "Address Family modifier\n"
5828 "Address Family modifier\n"
5829 "Soft reconfig inbound update\n"
5830 "Push out prefix-list ORF and do inbound soft reconfig\n")
5831{
5832 if (strncmp (argv[1], "m", 1) == 0)
5833 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5834 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5835
5836 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5837 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5838}
5839
5840DEFUN (clear_bgp_peer_group_soft_in,
5841 clear_bgp_peer_group_soft_in_cmd,
5842 "clear bgp peer-group WORD soft in",
5843 CLEAR_STR
5844 BGP_STR
5845 "Clear all members of peer-group\n"
5846 "BGP peer-group name\n"
5847 "Soft reconfig\n"
5848 "Soft reconfig inbound update\n")
5849{
5850 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5851 BGP_CLEAR_SOFT_IN, argv[0]);
5852}
5853
5854ALIAS (clear_bgp_peer_group_soft_in,
5855 clear_bgp_ipv6_peer_group_soft_in_cmd,
5856 "clear bgp ipv6 peer-group WORD soft in",
5857 CLEAR_STR
5858 BGP_STR
5859 "Address family\n"
5860 "Clear all members of peer-group\n"
5861 "BGP peer-group name\n"
5862 "Soft reconfig\n"
5863 "Soft reconfig inbound update\n")
5864
5865ALIAS (clear_bgp_peer_group_soft_in,
5866 clear_bgp_peer_group_in_cmd,
5867 "clear bgp peer-group WORD in",
5868 CLEAR_STR
5869 BGP_STR
5870 "Clear all members of peer-group\n"
5871 "BGP peer-group name\n"
5872 "Soft reconfig inbound update\n")
5873
5874ALIAS (clear_bgp_peer_group_soft_in,
5875 clear_bgp_ipv6_peer_group_in_cmd,
5876 "clear bgp ipv6 peer-group WORD in",
5877 CLEAR_STR
5878 BGP_STR
5879 "Address family\n"
5880 "Clear all members of peer-group\n"
5881 "BGP peer-group name\n"
5882 "Soft reconfig inbound update\n")
5883
5884DEFUN (clear_bgp_peer_group_in_prefix_filter,
5885 clear_bgp_peer_group_in_prefix_filter_cmd,
5886 "clear bgp peer-group WORD in prefix-filter",
5887 CLEAR_STR
5888 BGP_STR
5889 "Clear all members of peer-group\n"
5890 "BGP peer-group name\n"
5891 "Soft reconfig inbound update\n"
5892 "Push out prefix-list ORF and do inbound soft reconfig\n")
5893{
5894 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5895 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5896}
5897
5898ALIAS (clear_bgp_peer_group_in_prefix_filter,
5899 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
5900 "clear bgp ipv6 peer-group WORD in prefix-filter",
5901 CLEAR_STR
5902 BGP_STR
5903 "Address family\n"
5904 "Clear all members of peer-group\n"
5905 "BGP peer-group name\n"
5906 "Soft reconfig inbound update\n"
5907 "Push out prefix-list ORF and do inbound soft reconfig\n")
5908
5909DEFUN (clear_ip_bgp_external_soft_in,
5910 clear_ip_bgp_external_soft_in_cmd,
5911 "clear ip bgp external soft in",
5912 CLEAR_STR
5913 IP_STR
5914 BGP_STR
5915 "Clear all external peers\n"
5916 "Soft reconfig\n"
5917 "Soft reconfig inbound update\n")
5918{
5919 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5920 BGP_CLEAR_SOFT_IN, NULL);
5921}
5922
5923ALIAS (clear_ip_bgp_external_soft_in,
5924 clear_ip_bgp_external_in_cmd,
5925 "clear ip bgp external in",
5926 CLEAR_STR
5927 IP_STR
5928 BGP_STR
5929 "Clear all external peers\n"
5930 "Soft reconfig inbound update\n")
5931
5932DEFUN (clear_ip_bgp_external_in_prefix_filter,
5933 clear_ip_bgp_external_in_prefix_filter_cmd,
5934 "clear ip bgp external in prefix-filter",
5935 CLEAR_STR
5936 IP_STR
5937 BGP_STR
5938 "Clear all external peers\n"
5939 "Soft reconfig inbound update\n"
5940 "Push out prefix-list ORF and do inbound soft reconfig\n")
5941{
5942 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5943 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5944}
5945
5946DEFUN (clear_ip_bgp_external_ipv4_soft_in,
5947 clear_ip_bgp_external_ipv4_soft_in_cmd,
5948 "clear ip bgp external ipv4 (unicast|multicast) soft in",
5949 CLEAR_STR
5950 IP_STR
5951 BGP_STR
5952 "Clear all external peers\n"
5953 "Address family\n"
5954 "Address Family modifier\n"
5955 "Address Family modifier\n"
5956 "Soft reconfig\n"
5957 "Soft reconfig inbound update\n")
5958{
5959 if (strncmp (argv[0], "m", 1) == 0)
5960 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5961 BGP_CLEAR_SOFT_IN, NULL);
5962
5963 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5964 BGP_CLEAR_SOFT_IN, NULL);
5965}
5966
5967ALIAS (clear_ip_bgp_external_ipv4_soft_in,
5968 clear_ip_bgp_external_ipv4_in_cmd,
5969 "clear ip bgp external ipv4 (unicast|multicast) in",
5970 CLEAR_STR
5971 IP_STR
5972 BGP_STR
5973 "Clear all external peers\n"
5974 "Address family\n"
5975 "Address Family modifier\n"
5976 "Address Family modifier\n"
5977 "Soft reconfig inbound update\n")
5978
5979DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
5980 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
5981 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
5982 CLEAR_STR
5983 IP_STR
5984 BGP_STR
5985 "Clear all external peers\n"
5986 "Address family\n"
5987 "Address Family modifier\n"
5988 "Address Family modifier\n"
5989 "Soft reconfig inbound update\n"
5990 "Push out prefix-list ORF and do inbound soft reconfig\n")
5991{
5992 if (strncmp (argv[0], "m", 1) == 0)
5993 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5994 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5995
5996 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5997 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5998}
5999
6000DEFUN (clear_bgp_external_soft_in,
6001 clear_bgp_external_soft_in_cmd,
6002 "clear bgp external soft in",
6003 CLEAR_STR
6004 BGP_STR
6005 "Clear all external peers\n"
6006 "Soft reconfig\n"
6007 "Soft reconfig inbound update\n")
6008{
6009 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6010 BGP_CLEAR_SOFT_IN, NULL);
6011}
6012
6013ALIAS (clear_bgp_external_soft_in,
6014 clear_bgp_ipv6_external_soft_in_cmd,
6015 "clear bgp ipv6 external soft in",
6016 CLEAR_STR
6017 BGP_STR
6018 "Address family\n"
6019 "Clear all external peers\n"
6020 "Soft reconfig\n"
6021 "Soft reconfig inbound update\n")
6022
6023ALIAS (clear_bgp_external_soft_in,
6024 clear_bgp_external_in_cmd,
6025 "clear bgp external in",
6026 CLEAR_STR
6027 BGP_STR
6028 "Clear all external peers\n"
6029 "Soft reconfig inbound update\n")
6030
6031ALIAS (clear_bgp_external_soft_in,
6032 clear_bgp_ipv6_external_in_cmd,
6033 "clear bgp ipv6 external WORD in",
6034 CLEAR_STR
6035 BGP_STR
6036 "Address family\n"
6037 "Clear all external peers\n"
6038 "Soft reconfig inbound update\n")
6039
6040DEFUN (clear_bgp_external_in_prefix_filter,
6041 clear_bgp_external_in_prefix_filter_cmd,
6042 "clear bgp external in prefix-filter",
6043 CLEAR_STR
6044 BGP_STR
6045 "Clear all external peers\n"
6046 "Soft reconfig inbound update\n"
6047 "Push out prefix-list ORF and do inbound soft reconfig\n")
6048{
6049 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6050 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6051}
6052
6053ALIAS (clear_bgp_external_in_prefix_filter,
6054 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6055 "clear bgp ipv6 external in prefix-filter",
6056 CLEAR_STR
6057 BGP_STR
6058 "Address family\n"
6059 "Clear all external peers\n"
6060 "Soft reconfig inbound update\n"
6061 "Push out prefix-list ORF and do inbound soft reconfig\n")
6062
6063DEFUN (clear_ip_bgp_as_soft_in,
6064 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006065 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006066 CLEAR_STR
6067 IP_STR
6068 BGP_STR
6069 "Clear peers with the AS number\n"
6070 "Soft reconfig\n"
6071 "Soft reconfig inbound update\n")
6072{
6073 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6074 BGP_CLEAR_SOFT_IN, argv[0]);
6075}
6076
6077ALIAS (clear_ip_bgp_as_soft_in,
6078 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006079 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006080 CLEAR_STR
6081 IP_STR
6082 BGP_STR
6083 "Clear peers with the AS number\n"
6084 "Soft reconfig inbound update\n")
6085
6086DEFUN (clear_ip_bgp_as_in_prefix_filter,
6087 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006088 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006089 CLEAR_STR
6090 IP_STR
6091 BGP_STR
6092 "Clear peers with the AS number\n"
6093 "Soft reconfig inbound update\n"
6094 "Push out prefix-list ORF and do inbound soft reconfig\n")
6095{
6096 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6097 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6098}
6099
6100DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6101 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006102 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006103 CLEAR_STR
6104 IP_STR
6105 BGP_STR
6106 "Clear peers with the AS number\n"
6107 "Address family\n"
6108 "Address Family modifier\n"
6109 "Address Family modifier\n"
6110 "Soft reconfig\n"
6111 "Soft reconfig inbound update\n")
6112{
6113 if (strncmp (argv[1], "m", 1) == 0)
6114 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6115 BGP_CLEAR_SOFT_IN, argv[0]);
6116
6117 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6118 BGP_CLEAR_SOFT_IN, argv[0]);
6119}
6120
6121ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6122 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006123 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00006124 CLEAR_STR
6125 IP_STR
6126 BGP_STR
6127 "Clear peers with the AS number\n"
6128 "Address family\n"
6129 "Address Family modifier\n"
6130 "Address Family modifier\n"
6131 "Soft reconfig inbound update\n")
6132
6133DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6134 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006135 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006136 CLEAR_STR
6137 IP_STR
6138 BGP_STR
6139 "Clear peers with the AS number\n"
6140 "Address family\n"
6141 "Address Family modifier\n"
6142 "Address Family modifier\n"
6143 "Soft reconfig inbound update\n"
6144 "Push out prefix-list ORF and do inbound soft reconfig\n")
6145{
6146 if (strncmp (argv[1], "m", 1) == 0)
6147 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6148 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6149
6150 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6151 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6152}
6153
6154DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6155 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006156 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00006157 CLEAR_STR
6158 IP_STR
6159 BGP_STR
6160 "Clear peers with the AS number\n"
6161 "Address family\n"
6162 "Address Family modifier\n"
6163 "Soft reconfig\n"
6164 "Soft reconfig inbound update\n")
6165{
6166 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6167 BGP_CLEAR_SOFT_IN, argv[0]);
6168}
6169
6170ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6171 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006172 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006173 CLEAR_STR
6174 IP_STR
6175 BGP_STR
6176 "Clear peers with the AS number\n"
6177 "Address family\n"
6178 "Address Family modifier\n"
6179 "Soft reconfig inbound update\n")
6180
6181DEFUN (clear_bgp_as_soft_in,
6182 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006183 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006184 CLEAR_STR
6185 BGP_STR
6186 "Clear peers with the AS number\n"
6187 "Soft reconfig\n"
6188 "Soft reconfig inbound update\n")
6189{
6190 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6191 BGP_CLEAR_SOFT_IN, argv[0]);
6192}
6193
6194ALIAS (clear_bgp_as_soft_in,
6195 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006196 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006197 CLEAR_STR
6198 BGP_STR
6199 "Address family\n"
6200 "Clear peers with the AS number\n"
6201 "Soft reconfig\n"
6202 "Soft reconfig inbound update\n")
6203
6204ALIAS (clear_bgp_as_soft_in,
6205 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006206 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006207 CLEAR_STR
6208 BGP_STR
6209 "Clear peers with the AS number\n"
6210 "Soft reconfig inbound update\n")
6211
6212ALIAS (clear_bgp_as_soft_in,
6213 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006214 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006215 CLEAR_STR
6216 BGP_STR
6217 "Address family\n"
6218 "Clear peers with the AS number\n"
6219 "Soft reconfig inbound update\n")
6220
6221DEFUN (clear_bgp_as_in_prefix_filter,
6222 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006223 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006224 CLEAR_STR
6225 BGP_STR
6226 "Clear peers with the AS number\n"
6227 "Soft reconfig inbound update\n"
6228 "Push out prefix-list ORF and do inbound soft reconfig\n")
6229{
6230 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6231 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6232}
6233
6234ALIAS (clear_bgp_as_in_prefix_filter,
6235 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006236 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006237 CLEAR_STR
6238 BGP_STR
6239 "Address family\n"
6240 "Clear peers with the AS number\n"
6241 "Soft reconfig inbound update\n"
6242 "Push out prefix-list ORF and do inbound soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006243
paul718e3742002-12-13 20:15:29 +00006244/* Both soft-reconfiguration */
6245DEFUN (clear_ip_bgp_all_soft,
6246 clear_ip_bgp_all_soft_cmd,
6247 "clear ip bgp * soft",
6248 CLEAR_STR
6249 IP_STR
6250 BGP_STR
6251 "Clear all peers\n"
6252 "Soft reconfig\n")
6253{
6254 if (argc == 1)
6255 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6256 BGP_CLEAR_SOFT_BOTH, NULL);
6257
6258 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6259 BGP_CLEAR_SOFT_BOTH, NULL);
6260}
6261
6262ALIAS (clear_ip_bgp_all_soft,
6263 clear_ip_bgp_instance_all_soft_cmd,
6264 "clear ip bgp view WORD * soft",
6265 CLEAR_STR
6266 IP_STR
6267 BGP_STR
6268 "BGP view\n"
6269 "view name\n"
6270 "Clear all peers\n"
6271 "Soft reconfig\n")
6272
6273
6274DEFUN (clear_ip_bgp_all_ipv4_soft,
6275 clear_ip_bgp_all_ipv4_soft_cmd,
6276 "clear ip bgp * ipv4 (unicast|multicast) soft",
6277 CLEAR_STR
6278 IP_STR
6279 BGP_STR
6280 "Clear all peers\n"
6281 "Address family\n"
6282 "Address Family Modifier\n"
6283 "Address Family Modifier\n"
6284 "Soft reconfig\n")
6285{
6286 if (strncmp (argv[0], "m", 1) == 0)
6287 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6288 BGP_CLEAR_SOFT_BOTH, NULL);
6289
6290 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6291 BGP_CLEAR_SOFT_BOTH, NULL);
6292}
6293
6294DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6295 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6296 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6297 CLEAR_STR
6298 IP_STR
6299 BGP_STR
6300 "BGP view\n"
6301 "view name\n"
6302 "Clear all peers\n"
6303 "Address family\n"
6304 "Address Family Modifier\n"
6305 "Address Family Modifier\n"
6306 "Soft reconfig\n")
6307{
6308 if (strncmp (argv[1], "m", 1) == 0)
6309 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6310 BGP_CLEAR_SOFT_BOTH, NULL);
6311
6312 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6313 BGP_CLEAR_SOFT_BOTH, NULL);
6314}
6315
6316DEFUN (clear_ip_bgp_all_vpnv4_soft,
6317 clear_ip_bgp_all_vpnv4_soft_cmd,
6318 "clear ip bgp * vpnv4 unicast soft",
6319 CLEAR_STR
6320 IP_STR
6321 BGP_STR
6322 "Clear all peers\n"
6323 "Address family\n"
6324 "Address Family Modifier\n"
6325 "Soft reconfig\n")
6326{
6327 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6328 BGP_CLEAR_SOFT_BOTH, argv[0]);
6329}
6330
6331DEFUN (clear_bgp_all_soft,
6332 clear_bgp_all_soft_cmd,
6333 "clear bgp * soft",
6334 CLEAR_STR
6335 BGP_STR
6336 "Clear all peers\n"
6337 "Soft reconfig\n")
6338{
6339 if (argc == 1)
6340 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6341 BGP_CLEAR_SOFT_BOTH, argv[0]);
6342
6343 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6344 BGP_CLEAR_SOFT_BOTH, argv[0]);
6345}
6346
6347ALIAS (clear_bgp_all_soft,
6348 clear_bgp_instance_all_soft_cmd,
6349 "clear bgp view WORD * soft",
6350 CLEAR_STR
6351 BGP_STR
6352 "BGP view\n"
6353 "view name\n"
6354 "Clear all peers\n"
6355 "Soft reconfig\n")
6356
6357ALIAS (clear_bgp_all_soft,
6358 clear_bgp_ipv6_all_soft_cmd,
6359 "clear bgp ipv6 * soft",
6360 CLEAR_STR
6361 BGP_STR
6362 "Address family\n"
6363 "Clear all peers\n"
6364 "Soft reconfig\n")
6365
6366DEFUN (clear_ip_bgp_peer_soft,
6367 clear_ip_bgp_peer_soft_cmd,
6368 "clear ip bgp A.B.C.D soft",
6369 CLEAR_STR
6370 IP_STR
6371 BGP_STR
6372 "BGP neighbor address to clear\n"
6373 "Soft reconfig\n")
6374{
6375 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6376 BGP_CLEAR_SOFT_BOTH, argv[0]);
6377}
6378
6379DEFUN (clear_ip_bgp_peer_ipv4_soft,
6380 clear_ip_bgp_peer_ipv4_soft_cmd,
6381 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6382 CLEAR_STR
6383 IP_STR
6384 BGP_STR
6385 "BGP neighbor address to clear\n"
6386 "Address family\n"
6387 "Address Family Modifier\n"
6388 "Address Family Modifier\n"
6389 "Soft reconfig\n")
6390{
6391 if (strncmp (argv[1], "m", 1) == 0)
6392 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6393 BGP_CLEAR_SOFT_BOTH, argv[0]);
6394
6395 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6396 BGP_CLEAR_SOFT_BOTH, argv[0]);
6397}
6398
6399DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6400 clear_ip_bgp_peer_vpnv4_soft_cmd,
6401 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6402 CLEAR_STR
6403 IP_STR
6404 BGP_STR
6405 "BGP neighbor address to clear\n"
6406 "Address family\n"
6407 "Address Family Modifier\n"
6408 "Soft reconfig\n")
6409{
6410 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6411 BGP_CLEAR_SOFT_BOTH, argv[0]);
6412}
6413
6414DEFUN (clear_bgp_peer_soft,
6415 clear_bgp_peer_soft_cmd,
6416 "clear bgp (A.B.C.D|X:X::X:X) soft",
6417 CLEAR_STR
6418 BGP_STR
6419 "BGP neighbor address to clear\n"
6420 "BGP IPv6 neighbor to clear\n"
6421 "Soft reconfig\n")
6422{
6423 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6424 BGP_CLEAR_SOFT_BOTH, argv[0]);
6425}
6426
6427ALIAS (clear_bgp_peer_soft,
6428 clear_bgp_ipv6_peer_soft_cmd,
6429 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6430 CLEAR_STR
6431 BGP_STR
6432 "Address family\n"
6433 "BGP neighbor address to clear\n"
6434 "BGP IPv6 neighbor to clear\n"
6435 "Soft reconfig\n")
6436
6437DEFUN (clear_ip_bgp_peer_group_soft,
6438 clear_ip_bgp_peer_group_soft_cmd,
6439 "clear ip bgp peer-group WORD soft",
6440 CLEAR_STR
6441 IP_STR
6442 BGP_STR
6443 "Clear all members of peer-group\n"
6444 "BGP peer-group name\n"
6445 "Soft reconfig\n")
6446{
6447 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6448 BGP_CLEAR_SOFT_BOTH, argv[0]);
6449}
6450
6451DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6452 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6453 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6454 CLEAR_STR
6455 IP_STR
6456 BGP_STR
6457 "Clear all members of peer-group\n"
6458 "BGP peer-group name\n"
6459 "Address family\n"
6460 "Address Family modifier\n"
6461 "Address Family modifier\n"
6462 "Soft reconfig\n")
6463{
6464 if (strncmp (argv[1], "m", 1) == 0)
6465 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6466 BGP_CLEAR_SOFT_BOTH, argv[0]);
6467
6468 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6469 BGP_CLEAR_SOFT_BOTH, argv[0]);
6470}
6471
6472DEFUN (clear_bgp_peer_group_soft,
6473 clear_bgp_peer_group_soft_cmd,
6474 "clear bgp peer-group WORD soft",
6475 CLEAR_STR
6476 BGP_STR
6477 "Clear all members of peer-group\n"
6478 "BGP peer-group name\n"
6479 "Soft reconfig\n")
6480{
6481 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6482 BGP_CLEAR_SOFT_BOTH, argv[0]);
6483}
6484
6485ALIAS (clear_bgp_peer_group_soft,
6486 clear_bgp_ipv6_peer_group_soft_cmd,
6487 "clear bgp ipv6 peer-group WORD soft",
6488 CLEAR_STR
6489 BGP_STR
6490 "Address family\n"
6491 "Clear all members of peer-group\n"
6492 "BGP peer-group name\n"
6493 "Soft reconfig\n")
6494
6495DEFUN (clear_ip_bgp_external_soft,
6496 clear_ip_bgp_external_soft_cmd,
6497 "clear ip bgp external soft",
6498 CLEAR_STR
6499 IP_STR
6500 BGP_STR
6501 "Clear all external peers\n"
6502 "Soft reconfig\n")
6503{
6504 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6505 BGP_CLEAR_SOFT_BOTH, NULL);
6506}
6507
6508DEFUN (clear_ip_bgp_external_ipv4_soft,
6509 clear_ip_bgp_external_ipv4_soft_cmd,
6510 "clear ip bgp external ipv4 (unicast|multicast) soft",
6511 CLEAR_STR
6512 IP_STR
6513 BGP_STR
6514 "Clear all external peers\n"
6515 "Address family\n"
6516 "Address Family modifier\n"
6517 "Address Family modifier\n"
6518 "Soft reconfig\n")
6519{
6520 if (strncmp (argv[0], "m", 1) == 0)
6521 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6522 BGP_CLEAR_SOFT_BOTH, NULL);
6523
6524 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6525 BGP_CLEAR_SOFT_BOTH, NULL);
6526}
6527
6528DEFUN (clear_bgp_external_soft,
6529 clear_bgp_external_soft_cmd,
6530 "clear bgp external soft",
6531 CLEAR_STR
6532 BGP_STR
6533 "Clear all external peers\n"
6534 "Soft reconfig\n")
6535{
6536 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6537 BGP_CLEAR_SOFT_BOTH, NULL);
6538}
6539
6540ALIAS (clear_bgp_external_soft,
6541 clear_bgp_ipv6_external_soft_cmd,
6542 "clear bgp ipv6 external soft",
6543 CLEAR_STR
6544 BGP_STR
6545 "Address family\n"
6546 "Clear all external peers\n"
6547 "Soft reconfig\n")
6548
6549DEFUN (clear_ip_bgp_as_soft,
6550 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006551 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006552 CLEAR_STR
6553 IP_STR
6554 BGP_STR
6555 "Clear peers with the AS number\n"
6556 "Soft reconfig\n")
6557{
6558 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6559 BGP_CLEAR_SOFT_BOTH, argv[0]);
6560}
6561
6562DEFUN (clear_ip_bgp_as_ipv4_soft,
6563 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006564 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006565 CLEAR_STR
6566 IP_STR
6567 BGP_STR
6568 "Clear peers with the AS number\n"
6569 "Address family\n"
6570 "Address Family Modifier\n"
6571 "Address Family Modifier\n"
6572 "Soft reconfig\n")
6573{
6574 if (strncmp (argv[1], "m", 1) == 0)
6575 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6576 BGP_CLEAR_SOFT_BOTH, argv[0]);
6577
6578 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6579 BGP_CLEAR_SOFT_BOTH, argv[0]);
6580}
6581
6582DEFUN (clear_ip_bgp_as_vpnv4_soft,
6583 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006584 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00006585 CLEAR_STR
6586 IP_STR
6587 BGP_STR
6588 "Clear peers with the AS number\n"
6589 "Address family\n"
6590 "Address Family Modifier\n"
6591 "Soft reconfig\n")
6592{
6593 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6594 BGP_CLEAR_SOFT_BOTH, argv[0]);
6595}
6596
6597DEFUN (clear_bgp_as_soft,
6598 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006599 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006600 CLEAR_STR
6601 BGP_STR
6602 "Clear peers with the AS number\n"
6603 "Soft reconfig\n")
6604{
6605 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6606 BGP_CLEAR_SOFT_BOTH, argv[0]);
6607}
6608
6609ALIAS (clear_bgp_as_soft,
6610 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006611 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006612 CLEAR_STR
6613 BGP_STR
6614 "Address family\n"
6615 "Clear peers with the AS number\n"
6616 "Soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006617
paulfee0f4c2004-09-13 05:12:46 +00006618/* RS-client soft reconfiguration. */
6619#ifdef HAVE_IPV6
6620DEFUN (clear_bgp_all_rsclient,
6621 clear_bgp_all_rsclient_cmd,
6622 "clear bgp * rsclient",
6623 CLEAR_STR
6624 BGP_STR
6625 "Clear all peers\n"
6626 "Soft reconfig for rsclient RIB\n")
6627{
6628 if (argc == 1)
6629 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6630 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6631
6632 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6633 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6634}
6635
6636ALIAS (clear_bgp_all_rsclient,
6637 clear_bgp_ipv6_all_rsclient_cmd,
6638 "clear bgp ipv6 * rsclient",
6639 CLEAR_STR
6640 BGP_STR
6641 "Address family\n"
6642 "Clear all peers\n"
6643 "Soft reconfig for rsclient RIB\n")
6644
6645ALIAS (clear_bgp_all_rsclient,
6646 clear_bgp_instance_all_rsclient_cmd,
6647 "clear bgp view WORD * rsclient",
6648 CLEAR_STR
6649 BGP_STR
6650 "BGP view\n"
6651 "view name\n"
6652 "Clear all peers\n"
6653 "Soft reconfig for rsclient RIB\n")
6654
6655ALIAS (clear_bgp_all_rsclient,
6656 clear_bgp_ipv6_instance_all_rsclient_cmd,
6657 "clear bgp ipv6 view WORD * rsclient",
6658 CLEAR_STR
6659 BGP_STR
6660 "Address family\n"
6661 "BGP view\n"
6662 "view name\n"
6663 "Clear all peers\n"
6664 "Soft reconfig for rsclient RIB\n")
6665#endif /* HAVE_IPV6 */
6666
6667DEFUN (clear_ip_bgp_all_rsclient,
6668 clear_ip_bgp_all_rsclient_cmd,
6669 "clear ip bgp * rsclient",
6670 CLEAR_STR
6671 IP_STR
6672 BGP_STR
6673 "Clear all peers\n"
6674 "Soft reconfig for rsclient RIB\n")
6675{
6676 if (argc == 1)
6677 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6678 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6679
6680 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6681 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6682}
6683
6684ALIAS (clear_ip_bgp_all_rsclient,
6685 clear_ip_bgp_instance_all_rsclient_cmd,
6686 "clear ip bgp view WORD * rsclient",
6687 CLEAR_STR
6688 IP_STR
6689 BGP_STR
6690 "BGP view\n"
6691 "view name\n"
6692 "Clear all peers\n"
6693 "Soft reconfig for rsclient RIB\n")
6694
6695#ifdef HAVE_IPV6
6696DEFUN (clear_bgp_peer_rsclient,
6697 clear_bgp_peer_rsclient_cmd,
6698 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
6699 CLEAR_STR
6700 BGP_STR
6701 "BGP neighbor IP address to clear\n"
6702 "BGP IPv6 neighbor to clear\n"
6703 "Soft reconfig for rsclient RIB\n")
6704{
6705 if (argc == 2)
6706 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
6707 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6708
6709 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6710 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6711}
6712
6713ALIAS (clear_bgp_peer_rsclient,
6714 clear_bgp_ipv6_peer_rsclient_cmd,
6715 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
6716 CLEAR_STR
6717 BGP_STR
6718 "Address family\n"
6719 "BGP neighbor IP address to clear\n"
6720 "BGP IPv6 neighbor to clear\n"
6721 "Soft reconfig for rsclient RIB\n")
6722
6723ALIAS (clear_bgp_peer_rsclient,
6724 clear_bgp_instance_peer_rsclient_cmd,
6725 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6726 CLEAR_STR
6727 BGP_STR
6728 "BGP view\n"
6729 "view name\n"
6730 "BGP neighbor IP address to clear\n"
6731 "BGP IPv6 neighbor to clear\n"
6732 "Soft reconfig for rsclient RIB\n")
6733
6734ALIAS (clear_bgp_peer_rsclient,
6735 clear_bgp_ipv6_instance_peer_rsclient_cmd,
6736 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
6737 CLEAR_STR
6738 BGP_STR
6739 "Address family\n"
6740 "BGP view\n"
6741 "view name\n"
6742 "BGP neighbor IP address to clear\n"
6743 "BGP IPv6 neighbor to clear\n"
6744 "Soft reconfig for rsclient RIB\n")
6745#endif /* HAVE_IPV6 */
6746
6747DEFUN (clear_ip_bgp_peer_rsclient,
6748 clear_ip_bgp_peer_rsclient_cmd,
6749 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
6750 CLEAR_STR
6751 IP_STR
6752 BGP_STR
6753 "BGP neighbor IP address to clear\n"
6754 "BGP IPv6 neighbor to clear\n"
6755 "Soft reconfig for rsclient RIB\n")
6756{
6757 if (argc == 2)
6758 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
6759 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6760
6761 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6762 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6763}
6764
6765ALIAS (clear_ip_bgp_peer_rsclient,
6766 clear_ip_bgp_instance_peer_rsclient_cmd,
6767 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6768 CLEAR_STR
6769 IP_STR
6770 BGP_STR
6771 "BGP view\n"
6772 "view name\n"
6773 "BGP neighbor IP address to clear\n"
6774 "BGP IPv6 neighbor to clear\n"
6775 "Soft reconfig for rsclient RIB\n")
6776
Michael Lamberte0081f72008-11-16 20:12:04 +00006777DEFUN (show_bgp_views,
6778 show_bgp_views_cmd,
6779 "show bgp views",
6780 SHOW_STR
6781 BGP_STR
6782 "Show the defined BGP views\n")
6783{
6784 struct list *inst = bm->bgp;
6785 struct listnode *node;
6786 struct bgp *bgp;
6787
6788 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
6789 {
6790 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
6791 return CMD_WARNING;
6792 }
6793
6794 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
6795 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
6796 vty_out (vty, "\t%s (AS%u)%s",
6797 bgp->name ? bgp->name : "(null)",
6798 bgp->as, VTY_NEWLINE);
6799
6800 return CMD_SUCCESS;
6801}
6802
Paul Jakma4bf6a362006-03-30 14:05:23 +00006803DEFUN (show_bgp_memory,
6804 show_bgp_memory_cmd,
6805 "show bgp memory",
6806 SHOW_STR
6807 BGP_STR
6808 "Global BGP memory statistics\n")
6809{
6810 char memstrbuf[MTYPE_MEMSTR_LEN];
6811 unsigned long count;
6812
6813 /* RIB related usage stats */
6814 count = mtype_stats_alloc (MTYPE_BGP_NODE);
6815 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
6816 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6817 count * sizeof (struct bgp_node)),
6818 VTY_NEWLINE);
6819
6820 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
6821 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
6822 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6823 count * sizeof (struct bgp_info)),
6824 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006825 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
6826 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
6827 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6828 count * sizeof (struct bgp_info_extra)),
6829 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006830
6831 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
6832 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
6833 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6834 count * sizeof (struct bgp_static)),
6835 VTY_NEWLINE);
6836
6837 /* Adj-In/Out */
6838 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
6839 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
6840 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6841 count * sizeof (struct bgp_adj_in)),
6842 VTY_NEWLINE);
6843 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
6844 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
6845 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6846 count * sizeof (struct bgp_adj_out)),
6847 VTY_NEWLINE);
6848
6849 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
6850 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
6851 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6852 count * sizeof (struct bgp_nexthop_cache)),
6853 VTY_NEWLINE);
6854
6855 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
6856 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
6857 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6858 count * sizeof (struct bgp_damp_info)),
6859 VTY_NEWLINE);
6860
6861 /* Attributes */
6862 count = attr_count();
6863 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
6864 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6865 count * sizeof(struct attr)),
6866 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006867 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
6868 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
6869 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6870 count * sizeof(struct attr_extra)),
6871 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006872
6873 if ((count = attr_unknown_count()))
6874 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
6875
6876 /* AS_PATH attributes */
6877 count = aspath_count ();
6878 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
6879 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6880 count * sizeof (struct aspath)),
6881 VTY_NEWLINE);
6882
6883 count = mtype_stats_alloc (MTYPE_AS_SEG);
6884 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
6885 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6886 count * sizeof (struct assegment)),
6887 VTY_NEWLINE);
6888
6889 /* Other attributes */
6890 if ((count = community_count ()))
6891 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6892 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6893 count * sizeof (struct community)),
6894 VTY_NEWLINE);
6895 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
6896 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6897 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6898 count * sizeof (struct ecommunity)),
6899 VTY_NEWLINE);
6900
6901 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
6902 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
6903 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6904 count * sizeof (struct cluster_list)),
6905 VTY_NEWLINE);
6906
6907 /* Peer related usage */
6908 count = mtype_stats_alloc (MTYPE_BGP_PEER);
6909 vty_out (vty, "%ld peers, using %s of memory%s", count,
6910 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6911 count * sizeof (struct peer)),
6912 VTY_NEWLINE);
6913
6914 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
6915 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
6916 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6917 count * sizeof (struct peer_group)),
6918 VTY_NEWLINE);
6919
6920 /* Other */
6921 if ((count = mtype_stats_alloc (MTYPE_HASH)))
6922 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
6923 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6924 count * sizeof (struct hash)),
6925 VTY_NEWLINE);
6926 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
6927 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
6928 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6929 count * sizeof (struct hash_backet)),
6930 VTY_NEWLINE);
6931 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
6932 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
6933 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6934 count * sizeof (regex_t)),
6935 VTY_NEWLINE);
6936 return CMD_SUCCESS;
6937}
paulfee0f4c2004-09-13 05:12:46 +00006938
paul718e3742002-12-13 20:15:29 +00006939/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00006940static int
paul718e3742002-12-13 20:15:29 +00006941bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
6942{
6943 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00006944 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00006945 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00006946 char timebuf[BGP_UPTIME_LEN];
6947 int len;
6948
6949 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00006950 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00006951
paul1eb8ef22005-04-07 07:30:20 +00006952 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00006953 {
6954 if (peer->afc[afi][safi])
6955 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00006956 if (!count)
6957 {
6958 unsigned long ents;
6959 char memstrbuf[MTYPE_MEMSTR_LEN];
6960
6961 /* Usage summary and header */
6962 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04006963 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00006964 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006965
Paul Jakma4bf6a362006-03-30 14:05:23 +00006966 ents = bgp_table_count (bgp->rib[afi][safi]);
6967 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
6968 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6969 ents * sizeof (struct bgp_node)),
6970 VTY_NEWLINE);
6971
6972 /* Peer related usage */
6973 ents = listcount (bgp->peer);
6974 vty_out (vty, "Peers %ld, using %s of memory%s",
6975 ents,
6976 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6977 ents * sizeof (struct peer)),
6978 VTY_NEWLINE);
6979
6980 if ((ents = listcount (bgp->rsclient)))
6981 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
6982 ents,
6983 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6984 ents * sizeof (struct peer)),
6985 VTY_NEWLINE);
6986
6987 if ((ents = listcount (bgp->group)))
6988 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
6989 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6990 ents * sizeof (struct peer_group)),
6991 VTY_NEWLINE);
6992
6993 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
6994 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
6995 vty_out (vty, "%s", VTY_NEWLINE);
6996 vty_out (vty, "%s%s", header, VTY_NEWLINE);
6997 }
6998
paul718e3742002-12-13 20:15:29 +00006999 count++;
7000
7001 len = vty_out (vty, "%s", peer->host);
7002 len = 16 - len;
7003 if (len < 1)
7004 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7005 else
7006 vty_out (vty, "%*s", len, " ");
7007
hasso3d515fd2005-02-01 21:30:04 +00007008 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00007009
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007010 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00007011 peer->as,
7012 peer->open_in + peer->update_in + peer->keepalive_in
7013 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
7014 peer->open_out + peer->update_out + peer->keepalive_out
7015 + peer->notify_out + peer->refresh_out
7016 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007017 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00007018
7019 vty_out (vty, "%8s",
7020 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7021
7022 if (peer->status == Established)
7023 {
7024 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
7025 }
7026 else
7027 {
7028 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7029 vty_out (vty, " Idle (Admin)");
7030 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7031 vty_out (vty, " Idle (PfxCt)");
7032 else
7033 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7034 }
7035
7036 vty_out (vty, "%s", VTY_NEWLINE);
7037 }
7038 }
7039
7040 if (count)
7041 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7042 count, VTY_NEWLINE);
7043 else
7044 vty_out (vty, "No %s neighbor is configured%s",
7045 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7046 return CMD_SUCCESS;
7047}
7048
paul94f2b392005-06-28 12:44:16 +00007049static int
paulfd79ac92004-10-13 05:06:08 +00007050bgp_show_summary_vty (struct vty *vty, const char *name,
7051 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007052{
7053 struct bgp *bgp;
7054
7055 if (name)
7056 {
7057 bgp = bgp_lookup_by_name (name);
7058
7059 if (! bgp)
7060 {
7061 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7062 return CMD_WARNING;
7063 }
7064
7065 bgp_show_summary (vty, bgp, afi, safi);
7066 return CMD_SUCCESS;
7067 }
7068
7069 bgp = bgp_get_default ();
7070
7071 if (bgp)
7072 bgp_show_summary (vty, bgp, afi, safi);
7073
7074 return CMD_SUCCESS;
7075}
7076
7077/* `show ip bgp summary' commands. */
7078DEFUN (show_ip_bgp_summary,
7079 show_ip_bgp_summary_cmd,
7080 "show ip bgp summary",
7081 SHOW_STR
7082 IP_STR
7083 BGP_STR
7084 "Summary of BGP neighbor status\n")
7085{
7086 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7087}
7088
7089DEFUN (show_ip_bgp_instance_summary,
7090 show_ip_bgp_instance_summary_cmd,
7091 "show ip bgp view WORD summary",
7092 SHOW_STR
7093 IP_STR
7094 BGP_STR
7095 "BGP view\n"
7096 "View name\n"
7097 "Summary of BGP neighbor status\n")
7098{
7099 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7100}
7101
7102DEFUN (show_ip_bgp_ipv4_summary,
7103 show_ip_bgp_ipv4_summary_cmd,
7104 "show ip bgp ipv4 (unicast|multicast) summary",
7105 SHOW_STR
7106 IP_STR
7107 BGP_STR
7108 "Address family\n"
7109 "Address Family modifier\n"
7110 "Address Family modifier\n"
7111 "Summary of BGP neighbor status\n")
7112{
7113 if (strncmp (argv[0], "m", 1) == 0)
7114 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7115
7116 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7117}
7118
Michael Lambert95cbbd22010-07-23 14:43:04 -04007119ALIAS (show_ip_bgp_ipv4_summary,
7120 show_bgp_ipv4_safi_summary_cmd,
7121 "show bgp ipv4 (unicast|multicast) summary",
7122 SHOW_STR
7123 BGP_STR
7124 "Address family\n"
7125 "Address Family modifier\n"
7126 "Address Family modifier\n"
7127 "Summary of BGP neighbor status\n")
7128
paul718e3742002-12-13 20:15:29 +00007129DEFUN (show_ip_bgp_instance_ipv4_summary,
7130 show_ip_bgp_instance_ipv4_summary_cmd,
7131 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7132 SHOW_STR
7133 IP_STR
7134 BGP_STR
7135 "BGP view\n"
7136 "View name\n"
7137 "Address family\n"
7138 "Address Family modifier\n"
7139 "Address Family modifier\n"
7140 "Summary of BGP neighbor status\n")
7141{
7142 if (strncmp (argv[1], "m", 1) == 0)
7143 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7144 else
7145 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7146}
7147
Michael Lambert95cbbd22010-07-23 14:43:04 -04007148ALIAS (show_ip_bgp_instance_ipv4_summary,
7149 show_bgp_instance_ipv4_safi_summary_cmd,
7150 "show bgp view WORD ipv4 (unicast|multicast) summary",
7151 SHOW_STR
7152 BGP_STR
7153 "BGP view\n"
7154 "View name\n"
7155 "Address family\n"
7156 "Address Family modifier\n"
7157 "Address Family modifier\n"
7158 "Summary of BGP neighbor status\n")
7159
paul718e3742002-12-13 20:15:29 +00007160DEFUN (show_ip_bgp_vpnv4_all_summary,
7161 show_ip_bgp_vpnv4_all_summary_cmd,
7162 "show ip bgp vpnv4 all summary",
7163 SHOW_STR
7164 IP_STR
7165 BGP_STR
7166 "Display VPNv4 NLRI specific information\n"
7167 "Display information about all VPNv4 NLRIs\n"
7168 "Summary of BGP neighbor status\n")
7169{
7170 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7171}
7172
7173DEFUN (show_ip_bgp_vpnv4_rd_summary,
7174 show_ip_bgp_vpnv4_rd_summary_cmd,
7175 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7176 SHOW_STR
7177 IP_STR
7178 BGP_STR
7179 "Display VPNv4 NLRI specific information\n"
7180 "Display information for a route distinguisher\n"
7181 "VPN Route Distinguisher\n"
7182 "Summary of BGP neighbor status\n")
7183{
7184 int ret;
7185 struct prefix_rd prd;
7186
7187 ret = str2prefix_rd (argv[0], &prd);
7188 if (! ret)
7189 {
7190 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7191 return CMD_WARNING;
7192 }
7193
7194 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7195}
7196
7197#ifdef HAVE_IPV6
7198DEFUN (show_bgp_summary,
7199 show_bgp_summary_cmd,
7200 "show bgp summary",
7201 SHOW_STR
7202 BGP_STR
7203 "Summary of BGP neighbor status\n")
7204{
7205 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7206}
7207
7208DEFUN (show_bgp_instance_summary,
7209 show_bgp_instance_summary_cmd,
7210 "show bgp view WORD summary",
7211 SHOW_STR
7212 BGP_STR
7213 "BGP view\n"
7214 "View name\n"
7215 "Summary of BGP neighbor status\n")
7216{
7217 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7218}
7219
7220ALIAS (show_bgp_summary,
7221 show_bgp_ipv6_summary_cmd,
7222 "show bgp ipv6 summary",
7223 SHOW_STR
7224 BGP_STR
7225 "Address family\n"
7226 "Summary of BGP neighbor status\n")
7227
7228ALIAS (show_bgp_instance_summary,
7229 show_bgp_instance_ipv6_summary_cmd,
7230 "show bgp view WORD ipv6 summary",
7231 SHOW_STR
7232 BGP_STR
7233 "BGP view\n"
7234 "View name\n"
7235 "Address family\n"
7236 "Summary of BGP neighbor status\n")
7237
Michael Lambert95cbbd22010-07-23 14:43:04 -04007238DEFUN (show_bgp_ipv6_safi_summary,
7239 show_bgp_ipv6_safi_summary_cmd,
7240 "show bgp ipv6 (unicast|multicast) summary",
7241 SHOW_STR
7242 BGP_STR
7243 "Address family\n"
7244 "Address Family modifier\n"
7245 "Address Family modifier\n"
7246 "Summary of BGP neighbor status\n")
7247{
7248 if (strncmp (argv[0], "m", 1) == 0)
7249 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7250
7251 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7252}
7253
7254DEFUN (show_bgp_instance_ipv6_safi_summary,
7255 show_bgp_instance_ipv6_safi_summary_cmd,
7256 "show bgp view WORD ipv6 (unicast|multicast) summary",
7257 SHOW_STR
7258 BGP_STR
7259 "BGP view\n"
7260 "View name\n"
7261 "Address family\n"
7262 "Address Family modifier\n"
7263 "Address Family modifier\n"
7264 "Summary of BGP neighbor status\n")
7265{
7266 if (strncmp (argv[1], "m", 1) == 0)
7267 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7268
7269 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7270}
7271
paul718e3742002-12-13 20:15:29 +00007272/* old command */
7273DEFUN (show_ipv6_bgp_summary,
7274 show_ipv6_bgp_summary_cmd,
7275 "show ipv6 bgp summary",
7276 SHOW_STR
7277 IPV6_STR
7278 BGP_STR
7279 "Summary of BGP neighbor status\n")
7280{
7281 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7282}
7283
7284/* old command */
7285DEFUN (show_ipv6_mbgp_summary,
7286 show_ipv6_mbgp_summary_cmd,
7287 "show ipv6 mbgp summary",
7288 SHOW_STR
7289 IPV6_STR
7290 MBGP_STR
7291 "Summary of BGP neighbor status\n")
7292{
7293 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7294}
7295#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02007296
paulfd79ac92004-10-13 05:06:08 +00007297const char *
hasso538621f2004-05-21 09:31:30 +00007298afi_safi_print (afi_t afi, safi_t safi)
7299{
7300 if (afi == AFI_IP && safi == SAFI_UNICAST)
7301 return "IPv4 Unicast";
7302 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7303 return "IPv4 Multicast";
7304 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
7305 return "VPNv4 Unicast";
7306 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7307 return "IPv6 Unicast";
7308 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7309 return "IPv6 Multicast";
7310 else
7311 return "Unknown";
7312}
7313
paul718e3742002-12-13 20:15:29 +00007314/* Show BGP peer's information. */
7315enum show_type
7316{
7317 show_all,
7318 show_peer
7319};
7320
paul94f2b392005-06-28 12:44:16 +00007321static void
paul718e3742002-12-13 20:15:29 +00007322bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7323 afi_t afi, safi_t safi,
7324 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7325 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7326{
7327 /* Send-Mode */
7328 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7329 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7330 {
7331 vty_out (vty, " Send-mode: ");
7332 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7333 vty_out (vty, "advertised");
7334 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7335 vty_out (vty, "%sreceived",
7336 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7337 ", " : "");
7338 vty_out (vty, "%s", VTY_NEWLINE);
7339 }
7340
7341 /* Receive-Mode */
7342 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7343 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7344 {
7345 vty_out (vty, " Receive-mode: ");
7346 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7347 vty_out (vty, "advertised");
7348 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7349 vty_out (vty, "%sreceived",
7350 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7351 ", " : "");
7352 vty_out (vty, "%s", VTY_NEWLINE);
7353 }
7354}
7355
paul94f2b392005-06-28 12:44:16 +00007356static void
paul718e3742002-12-13 20:15:29 +00007357bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7358{
7359 struct bgp_filter *filter;
7360 char orf_pfx_name[BUFSIZ];
7361 int orf_pfx_count;
7362
7363 filter = &p->filter[afi][safi];
7364
hasso538621f2004-05-21 09:31:30 +00007365 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007366 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007367
paul718e3742002-12-13 20:15:29 +00007368 if (p->af_group[afi][safi])
7369 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7370
7371 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7372 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7373 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7374 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7375 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7376 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7377 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7378
7379 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7380 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7381 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7382 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7383 {
7384 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7385 ORF_TYPE_PREFIX, VTY_NEWLINE);
7386 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7387 PEER_CAP_ORF_PREFIX_SM_ADV,
7388 PEER_CAP_ORF_PREFIX_RM_ADV,
7389 PEER_CAP_ORF_PREFIX_SM_RCV,
7390 PEER_CAP_ORF_PREFIX_RM_RCV);
7391 }
7392 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7393 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7394 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7395 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7396 {
7397 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7398 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7399 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7400 PEER_CAP_ORF_PREFIX_SM_ADV,
7401 PEER_CAP_ORF_PREFIX_RM_ADV,
7402 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7403 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7404 }
7405
7406 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7407 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7408
7409 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7410 || orf_pfx_count)
7411 {
7412 vty_out (vty, " Outbound Route Filter (ORF):");
7413 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7414 vty_out (vty, " sent;");
7415 if (orf_pfx_count)
7416 vty_out (vty, " received (%d entries)", orf_pfx_count);
7417 vty_out (vty, "%s", VTY_NEWLINE);
7418 }
7419 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7420 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7421
7422 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7423 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7424 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7425 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7426 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7427 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7428 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7429 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7430 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7431 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
7432 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
7433 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7434 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
7435 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7436 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
7437 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7438 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7439 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
7440 {
7441 vty_out (vty, " Community attribute sent to this neighbor");
7442 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7443 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007444 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007445 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007446 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007447 else
hasso538621f2004-05-21 09:31:30 +00007448 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007449 }
7450 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
7451 {
7452 vty_out (vty, " Default information originate,");
7453
7454 if (p->default_rmap[afi][safi].name)
7455 vty_out (vty, " default route-map %s%s,",
7456 p->default_rmap[afi][safi].map ? "*" : "",
7457 p->default_rmap[afi][safi].name);
7458 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
7459 vty_out (vty, " default sent%s", VTY_NEWLINE);
7460 else
7461 vty_out (vty, " default not sent%s", VTY_NEWLINE);
7462 }
7463
7464 if (filter->plist[FILTER_IN].name
7465 || filter->dlist[FILTER_IN].name
7466 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00007467 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007468 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
7469 if (filter->plist[FILTER_OUT].name
7470 || filter->dlist[FILTER_OUT].name
7471 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00007472 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00007473 || filter->usmap.name)
7474 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007475 if (filter->map[RMAP_IMPORT].name)
7476 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
7477 if (filter->map[RMAP_EXPORT].name)
7478 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007479
7480 /* prefix-list */
7481 if (filter->plist[FILTER_IN].name)
7482 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
7483 filter->plist[FILTER_IN].plist ? "*" : "",
7484 filter->plist[FILTER_IN].name,
7485 VTY_NEWLINE);
7486 if (filter->plist[FILTER_OUT].name)
7487 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
7488 filter->plist[FILTER_OUT].plist ? "*" : "",
7489 filter->plist[FILTER_OUT].name,
7490 VTY_NEWLINE);
7491
7492 /* distribute-list */
7493 if (filter->dlist[FILTER_IN].name)
7494 vty_out (vty, " Incoming update network filter list is %s%s%s",
7495 filter->dlist[FILTER_IN].alist ? "*" : "",
7496 filter->dlist[FILTER_IN].name,
7497 VTY_NEWLINE);
7498 if (filter->dlist[FILTER_OUT].name)
7499 vty_out (vty, " Outgoing update network filter list is %s%s%s",
7500 filter->dlist[FILTER_OUT].alist ? "*" : "",
7501 filter->dlist[FILTER_OUT].name,
7502 VTY_NEWLINE);
7503
7504 /* filter-list. */
7505 if (filter->aslist[FILTER_IN].name)
7506 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
7507 filter->aslist[FILTER_IN].aslist ? "*" : "",
7508 filter->aslist[FILTER_IN].name,
7509 VTY_NEWLINE);
7510 if (filter->aslist[FILTER_OUT].name)
7511 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
7512 filter->aslist[FILTER_OUT].aslist ? "*" : "",
7513 filter->aslist[FILTER_OUT].name,
7514 VTY_NEWLINE);
7515
7516 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00007517 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007518 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007519 filter->map[RMAP_IN].map ? "*" : "",
7520 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00007521 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007522 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00007523 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007524 filter->map[RMAP_OUT].map ? "*" : "",
7525 filter->map[RMAP_OUT].name,
7526 VTY_NEWLINE);
7527 if (filter->map[RMAP_IMPORT].name)
7528 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
7529 filter->map[RMAP_IMPORT].map ? "*" : "",
7530 filter->map[RMAP_IMPORT].name,
7531 VTY_NEWLINE);
7532 if (filter->map[RMAP_EXPORT].name)
7533 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
7534 filter->map[RMAP_EXPORT].map ? "*" : "",
7535 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00007536 VTY_NEWLINE);
7537
7538 /* unsuppress-map */
7539 if (filter->usmap.name)
7540 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
7541 filter->usmap.map ? "*" : "",
7542 filter->usmap.name, VTY_NEWLINE);
7543
7544 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00007545 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
7546
paul718e3742002-12-13 20:15:29 +00007547 /* Maximum prefix */
7548 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
7549 {
hasso0a486e52005-02-01 20:57:17 +00007550 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00007551 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00007552 ? " (warning-only)" : "", VTY_NEWLINE);
7553 vty_out (vty, " Threshold for warning message %d%%",
7554 p->pmax_threshold[afi][safi]);
7555 if (p->pmax_restart[afi][safi])
7556 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
7557 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007558 }
paul718e3742002-12-13 20:15:29 +00007559
7560 vty_out (vty, "%s", VTY_NEWLINE);
7561}
7562
paul94f2b392005-06-28 12:44:16 +00007563static void
paul718e3742002-12-13 20:15:29 +00007564bgp_show_peer (struct vty *vty, struct peer *p)
7565{
7566 struct bgp *bgp;
7567 char buf1[BUFSIZ];
7568 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00007569 afi_t afi;
7570 safi_t safi;
paul718e3742002-12-13 20:15:29 +00007571
7572 bgp = p->bgp;
7573
7574 /* Configured IP address. */
7575 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007576 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00007577 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00007578 p->change_local_as ? p->change_local_as : p->local_as,
7579 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00007580 " no-prepend" : "",
7581 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
7582 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00007583 vty_out (vty, "%s link%s",
7584 p->as == p->local_as ? "internal" : "external",
7585 VTY_NEWLINE);
7586
7587 /* Description. */
7588 if (p->desc)
7589 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
7590
7591 /* Peer-group */
7592 if (p->group)
7593 vty_out (vty, " Member of peer-group %s for session parameters%s",
7594 p->group->name, VTY_NEWLINE);
7595
7596 /* Administrative shutdown. */
7597 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
7598 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
7599
7600 /* BGP Version. */
7601 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00007602 vty_out (vty, ", remote router ID %s%s",
7603 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
7604 VTY_NEWLINE);
7605
7606 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00007607 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
7608 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00007609 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
7610
7611 /* Status. */
7612 vty_out (vty, " BGP state = %s",
7613 LOOKUP (bgp_status_msg, p->status));
7614 if (p->status == Established)
7615 vty_out (vty, ", up for %8s",
7616 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00007617 else if (p->status == Active)
7618 {
7619 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7620 vty_out (vty, " (passive)");
7621 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7622 vty_out (vty, " (NSF passive)");
7623 }
paul718e3742002-12-13 20:15:29 +00007624 vty_out (vty, "%s", VTY_NEWLINE);
7625
7626 /* read timer */
7627 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7628
7629 /* Configured timer values. */
7630 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7631 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7632 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7633 {
7634 vty_out (vty, " Configured hold time is %d", p->holdtime);
7635 vty_out (vty, ", keepalive interval is %d seconds%s",
7636 p->keepalive, VTY_NEWLINE);
7637 }
hasso93406d82005-02-02 14:40:33 +00007638
paul718e3742002-12-13 20:15:29 +00007639 /* Capability. */
7640 if (p->status == Established)
7641 {
hasso538621f2004-05-21 09:31:30 +00007642 if (p->cap
paul718e3742002-12-13 20:15:29 +00007643 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7644 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7645 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7646 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7647#ifdef HAVE_IPV6
7648 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7649 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7650 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7651 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
7652#endif /* HAVE_IPV6 */
7653 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7654 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7655 {
7656 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7657
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007658 /* AS4 */
7659 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
7660 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7661 {
7662 vty_out (vty, " 4 Byte AS:");
7663 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7664 vty_out (vty, " advertised");
7665 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
7666 vty_out (vty, " %sreceived",
7667 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
7668 vty_out (vty, "%s", VTY_NEWLINE);
7669 }
paul718e3742002-12-13 20:15:29 +00007670 /* Dynamic */
7671 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
7672 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7673 {
7674 vty_out (vty, " Dynamic:");
7675 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7676 vty_out (vty, " advertised");
7677 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00007678 vty_out (vty, " %sreceived",
7679 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007680 vty_out (vty, "%s", VTY_NEWLINE);
7681 }
7682
7683 /* Route Refresh */
7684 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
7685 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7686 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
7687 {
7688 vty_out (vty, " Route refresh:");
7689 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
7690 vty_out (vty, " advertised");
7691 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7692 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00007693 vty_out (vty, " %sreceived(%s)",
7694 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
7695 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
7696 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
7697 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
7698
paul718e3742002-12-13 20:15:29 +00007699 vty_out (vty, "%s", VTY_NEWLINE);
7700 }
7701
hasso538621f2004-05-21 09:31:30 +00007702 /* Multiprotocol Extensions */
7703 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7704 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7705 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00007706 {
hasso538621f2004-05-21 09:31:30 +00007707 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
7708 if (p->afc_adv[afi][safi])
7709 vty_out (vty, " advertised");
7710 if (p->afc_recv[afi][safi])
7711 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
7712 vty_out (vty, "%s", VTY_NEWLINE);
7713 }
7714
7715 /* Gracefull Restart */
7716 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7717 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007718 {
hasso538621f2004-05-21 09:31:30 +00007719 vty_out (vty, " Graceful Restart Capabilty:");
7720 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007721 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00007722 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
7723 vty_out (vty, " %sreceived",
7724 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007725 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007726
7727 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00007728 {
hasso538621f2004-05-21 09:31:30 +00007729 int restart_af_count = 0;
7730
7731 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00007732 p->v_gr_restart, VTY_NEWLINE);
7733 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007734
7735 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7736 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7737 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
7738 {
hasso93406d82005-02-02 14:40:33 +00007739 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
7740 afi_safi_print (afi, safi),
7741 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
7742 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00007743 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00007744 }
hasso538621f2004-05-21 09:31:30 +00007745 if (! restart_af_count)
7746 vty_out (vty, "none");
7747 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007748 }
paul718e3742002-12-13 20:15:29 +00007749 }
paul718e3742002-12-13 20:15:29 +00007750 }
7751 }
7752
hasso93406d82005-02-02 14:40:33 +00007753 /* graceful restart information */
7754 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7755 || p->t_gr_restart
7756 || p->t_gr_stale)
7757 {
7758 int eor_send_af_count = 0;
7759 int eor_receive_af_count = 0;
7760
7761 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
7762 if (p->status == Established)
7763 {
7764 vty_out (vty, " End-of-RIB send: ");
7765 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7766 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7767 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
7768 {
7769 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
7770 afi_safi_print (afi, safi));
7771 eor_send_af_count++;
7772 }
7773 vty_out (vty, "%s", VTY_NEWLINE);
7774
7775 vty_out (vty, " End-of-RIB received: ");
7776 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7777 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7778 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
7779 {
7780 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
7781 afi_safi_print (afi, safi));
7782 eor_receive_af_count++;
7783 }
7784 vty_out (vty, "%s", VTY_NEWLINE);
7785 }
7786
7787 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007788 vty_out (vty, " The remaining time of restart timer is %ld%s",
7789 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
7790
hasso93406d82005-02-02 14:40:33 +00007791 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007792 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
7793 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007794 }
7795
paul718e3742002-12-13 20:15:29 +00007796 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00007797 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
7798 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007799 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007800 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
7801 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
7802 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
7803 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
7804 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
7805 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
7806 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
7807 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
7808 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
7809 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
7810 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007811
7812 /* advertisement-interval */
7813 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
7814 p->v_routeadv, VTY_NEWLINE);
7815
7816 /* Update-source. */
7817 if (p->update_if || p->update_source)
7818 {
7819 vty_out (vty, " Update source is ");
7820 if (p->update_if)
7821 vty_out (vty, "%s", p->update_if);
7822 else if (p->update_source)
7823 vty_out (vty, "%s",
7824 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
7825 vty_out (vty, "%s", VTY_NEWLINE);
7826 }
7827
7828 /* Default weight */
7829 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
7830 vty_out (vty, " Default weight %d%s", p->weight,
7831 VTY_NEWLINE);
7832
7833 vty_out (vty, "%s", VTY_NEWLINE);
7834
7835 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00007836 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7837 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7838 if (p->afc[afi][safi])
7839 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00007840
7841 vty_out (vty, " Connections established %d; dropped %d%s",
7842 p->established, p->dropped,
7843 VTY_NEWLINE);
7844
hassoe0701b72004-05-20 09:19:34 +00007845 if (! p->dropped)
7846 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
7847 else
7848 vty_out (vty, " Last reset %s, due to %s%s",
7849 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
7850 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00007851
paul718e3742002-12-13 20:15:29 +00007852 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7853 {
7854 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00007855
7856 if (p->t_pmax_restart)
7857 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
7858 p->host, thread_timer_remain_second (p->t_pmax_restart),
7859 VTY_NEWLINE);
7860 else
7861 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
7862 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007863 }
7864
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00007865 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00007866 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00007867 {
7868 if (p->gtsm_hops > 0)
7869 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7870 p->gtsm_hops, VTY_NEWLINE);
7871 else if (p->ttl > 1)
7872 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7873 p->ttl, VTY_NEWLINE);
7874 }
Pradosh Mohapatra5d804b42013-09-12 03:37:07 +00007875 else
7876 {
7877 if (p->gtsm_hops > 0)
7878 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
7879 p->gtsm_hops, VTY_NEWLINE);
7880 }
paul718e3742002-12-13 20:15:29 +00007881
7882 /* Local address. */
7883 if (p->su_local)
7884 {
hasso93406d82005-02-02 14:40:33 +00007885 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00007886 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
7887 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00007888 VTY_NEWLINE);
7889 }
7890
7891 /* Remote address. */
7892 if (p->su_remote)
7893 {
7894 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
7895 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
7896 ntohs (p->su_remote->sin.sin_port),
7897 VTY_NEWLINE);
7898 }
7899
7900 /* Nexthop display. */
7901 if (p->su_local)
7902 {
7903 vty_out (vty, "Nexthop: %s%s",
7904 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
7905 VTY_NEWLINE);
7906#ifdef HAVE_IPV6
7907 vty_out (vty, "Nexthop global: %s%s",
7908 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
7909 VTY_NEWLINE);
7910 vty_out (vty, "Nexthop local: %s%s",
7911 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
7912 VTY_NEWLINE);
7913 vty_out (vty, "BGP connection: %s%s",
7914 p->shared_network ? "shared network" : "non shared network",
7915 VTY_NEWLINE);
7916#endif /* HAVE_IPV6 */
7917 }
7918
Timo Teräsef757702015-04-29 09:43:04 +03007919 /* TCP metrics. */
7920 if (p->status == Established && p->rtt)
7921 vty_out (vty, "Estimated round trip time: %d ms%s",
7922 p->rtt, VTY_NEWLINE);
7923
paul718e3742002-12-13 20:15:29 +00007924 /* Timer information. */
7925 if (p->t_start)
7926 vty_out (vty, "Next start timer due in %ld seconds%s",
7927 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
7928 if (p->t_connect)
7929 vty_out (vty, "Next connect timer due in %ld seconds%s",
7930 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
7931
7932 vty_out (vty, "Read thread: %s Write thread: %s%s",
7933 p->t_read ? "on" : "off",
7934 p->t_write ? "on" : "off",
7935 VTY_NEWLINE);
7936
7937 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
7938 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
7939 bgp_capability_vty_out (vty, p);
7940
7941 vty_out (vty, "%s", VTY_NEWLINE);
7942}
7943
paul94f2b392005-06-28 12:44:16 +00007944static int
paul718e3742002-12-13 20:15:29 +00007945bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
7946 enum show_type type, union sockunion *su)
7947{
paul1eb8ef22005-04-07 07:30:20 +00007948 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00007949 struct peer *peer;
7950 int find = 0;
7951
paul1eb8ef22005-04-07 07:30:20 +00007952 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007953 {
7954 switch (type)
7955 {
7956 case show_all:
7957 bgp_show_peer (vty, peer);
7958 break;
7959 case show_peer:
7960 if (sockunion_same (&peer->su, su))
7961 {
7962 find = 1;
7963 bgp_show_peer (vty, peer);
7964 }
7965 break;
7966 }
7967 }
7968
7969 if (type == show_peer && ! find)
7970 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
7971
7972 return CMD_SUCCESS;
7973}
7974
paul94f2b392005-06-28 12:44:16 +00007975static int
paulfd79ac92004-10-13 05:06:08 +00007976bgp_show_neighbor_vty (struct vty *vty, const char *name,
7977 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00007978{
7979 int ret;
7980 struct bgp *bgp;
7981 union sockunion su;
7982
7983 if (ip_str)
7984 {
7985 ret = str2sockunion (ip_str, &su);
7986 if (ret < 0)
7987 {
7988 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
7989 return CMD_WARNING;
7990 }
7991 }
7992
7993 if (name)
7994 {
7995 bgp = bgp_lookup_by_name (name);
7996
7997 if (! bgp)
7998 {
7999 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8000 return CMD_WARNING;
8001 }
8002
8003 bgp_show_neighbor (vty, bgp, type, &su);
8004
8005 return CMD_SUCCESS;
8006 }
8007
8008 bgp = bgp_get_default ();
8009
8010 if (bgp)
8011 bgp_show_neighbor (vty, bgp, type, &su);
8012
8013 return CMD_SUCCESS;
8014}
8015
8016/* "show ip bgp neighbors" commands. */
8017DEFUN (show_ip_bgp_neighbors,
8018 show_ip_bgp_neighbors_cmd,
8019 "show ip bgp neighbors",
8020 SHOW_STR
8021 IP_STR
8022 BGP_STR
8023 "Detailed information on TCP and BGP neighbor connections\n")
8024{
8025 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8026}
8027
8028ALIAS (show_ip_bgp_neighbors,
8029 show_ip_bgp_ipv4_neighbors_cmd,
8030 "show ip bgp ipv4 (unicast|multicast) neighbors",
8031 SHOW_STR
8032 IP_STR
8033 BGP_STR
8034 "Address family\n"
8035 "Address Family modifier\n"
8036 "Address Family modifier\n"
8037 "Detailed information on TCP and BGP neighbor connections\n")
8038
8039ALIAS (show_ip_bgp_neighbors,
8040 show_ip_bgp_vpnv4_all_neighbors_cmd,
8041 "show ip bgp vpnv4 all neighbors",
8042 SHOW_STR
8043 IP_STR
8044 BGP_STR
8045 "Display VPNv4 NLRI specific information\n"
8046 "Display information about all VPNv4 NLRIs\n"
8047 "Detailed information on TCP and BGP neighbor connections\n")
8048
8049ALIAS (show_ip_bgp_neighbors,
8050 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8051 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8052 SHOW_STR
8053 IP_STR
8054 BGP_STR
8055 "Display VPNv4 NLRI specific information\n"
8056 "Display information for a route distinguisher\n"
8057 "VPN Route Distinguisher\n"
8058 "Detailed information on TCP and BGP neighbor connections\n")
8059
8060ALIAS (show_ip_bgp_neighbors,
8061 show_bgp_neighbors_cmd,
8062 "show bgp neighbors",
8063 SHOW_STR
8064 BGP_STR
8065 "Detailed information on TCP and BGP neighbor connections\n")
8066
8067ALIAS (show_ip_bgp_neighbors,
8068 show_bgp_ipv6_neighbors_cmd,
8069 "show bgp ipv6 neighbors",
8070 SHOW_STR
8071 BGP_STR
8072 "Address family\n"
8073 "Detailed information on TCP and BGP neighbor connections\n")
8074
8075DEFUN (show_ip_bgp_neighbors_peer,
8076 show_ip_bgp_neighbors_peer_cmd,
8077 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8078 SHOW_STR
8079 IP_STR
8080 BGP_STR
8081 "Detailed information on TCP and BGP neighbor connections\n"
8082 "Neighbor to display information about\n"
8083 "Neighbor to display information about\n")
8084{
8085 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8086}
8087
8088ALIAS (show_ip_bgp_neighbors_peer,
8089 show_ip_bgp_ipv4_neighbors_peer_cmd,
8090 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8091 SHOW_STR
8092 IP_STR
8093 BGP_STR
8094 "Address family\n"
8095 "Address Family modifier\n"
8096 "Address Family modifier\n"
8097 "Detailed information on TCP and BGP neighbor connections\n"
8098 "Neighbor to display information about\n"
8099 "Neighbor to display information about\n")
8100
8101ALIAS (show_ip_bgp_neighbors_peer,
8102 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8103 "show ip bgp vpnv4 all neighbors A.B.C.D",
8104 SHOW_STR
8105 IP_STR
8106 BGP_STR
8107 "Display VPNv4 NLRI specific information\n"
8108 "Display information about all VPNv4 NLRIs\n"
8109 "Detailed information on TCP and BGP neighbor connections\n"
8110 "Neighbor to display information about\n")
8111
8112ALIAS (show_ip_bgp_neighbors_peer,
8113 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8114 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8115 SHOW_STR
8116 IP_STR
8117 BGP_STR
8118 "Display VPNv4 NLRI specific information\n"
8119 "Display information about all VPNv4 NLRIs\n"
8120 "Detailed information on TCP and BGP neighbor connections\n"
8121 "Neighbor to display information about\n")
8122
8123ALIAS (show_ip_bgp_neighbors_peer,
8124 show_bgp_neighbors_peer_cmd,
8125 "show bgp neighbors (A.B.C.D|X:X::X:X)",
8126 SHOW_STR
8127 BGP_STR
8128 "Detailed information on TCP and BGP neighbor connections\n"
8129 "Neighbor to display information about\n"
8130 "Neighbor to display information about\n")
8131
8132ALIAS (show_ip_bgp_neighbors_peer,
8133 show_bgp_ipv6_neighbors_peer_cmd,
8134 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8135 SHOW_STR
8136 BGP_STR
8137 "Address family\n"
8138 "Detailed information on TCP and BGP neighbor connections\n"
8139 "Neighbor to display information about\n"
8140 "Neighbor to display information about\n")
8141
8142DEFUN (show_ip_bgp_instance_neighbors,
8143 show_ip_bgp_instance_neighbors_cmd,
8144 "show ip bgp view WORD neighbors",
8145 SHOW_STR
8146 IP_STR
8147 BGP_STR
8148 "BGP view\n"
8149 "View name\n"
8150 "Detailed information on TCP and BGP neighbor connections\n")
8151{
8152 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8153}
8154
paulbb46e942003-10-24 19:02:03 +00008155ALIAS (show_ip_bgp_instance_neighbors,
8156 show_bgp_instance_neighbors_cmd,
8157 "show bgp view WORD neighbors",
8158 SHOW_STR
8159 BGP_STR
8160 "BGP view\n"
8161 "View name\n"
8162 "Detailed information on TCP and BGP neighbor connections\n")
8163
8164ALIAS (show_ip_bgp_instance_neighbors,
8165 show_bgp_instance_ipv6_neighbors_cmd,
8166 "show bgp view WORD ipv6 neighbors",
8167 SHOW_STR
8168 BGP_STR
8169 "BGP view\n"
8170 "View name\n"
8171 "Address family\n"
8172 "Detailed information on TCP and BGP neighbor connections\n")
8173
paul718e3742002-12-13 20:15:29 +00008174DEFUN (show_ip_bgp_instance_neighbors_peer,
8175 show_ip_bgp_instance_neighbors_peer_cmd,
8176 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8177 SHOW_STR
8178 IP_STR
8179 BGP_STR
8180 "BGP view\n"
8181 "View name\n"
8182 "Detailed information on TCP and BGP neighbor connections\n"
8183 "Neighbor to display information about\n"
8184 "Neighbor to display information about\n")
8185{
8186 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8187}
paulbb46e942003-10-24 19:02:03 +00008188
8189ALIAS (show_ip_bgp_instance_neighbors_peer,
8190 show_bgp_instance_neighbors_peer_cmd,
8191 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8192 SHOW_STR
8193 BGP_STR
8194 "BGP view\n"
8195 "View name\n"
8196 "Detailed information on TCP and BGP neighbor connections\n"
8197 "Neighbor to display information about\n"
8198 "Neighbor to display information about\n")
8199
8200ALIAS (show_ip_bgp_instance_neighbors_peer,
8201 show_bgp_instance_ipv6_neighbors_peer_cmd,
8202 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8203 SHOW_STR
8204 BGP_STR
8205 "BGP view\n"
8206 "View name\n"
8207 "Address family\n"
8208 "Detailed information on TCP and BGP neighbor connections\n"
8209 "Neighbor to display information about\n"
8210 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008211
paul718e3742002-12-13 20:15:29 +00008212/* Show BGP's AS paths internal data. There are both `show ip bgp
8213 paths' and `show ip mbgp paths'. Those functions results are the
8214 same.*/
8215DEFUN (show_ip_bgp_paths,
8216 show_ip_bgp_paths_cmd,
8217 "show ip bgp paths",
8218 SHOW_STR
8219 IP_STR
8220 BGP_STR
8221 "Path information\n")
8222{
8223 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8224 aspath_print_all_vty (vty);
8225 return CMD_SUCCESS;
8226}
8227
8228DEFUN (show_ip_bgp_ipv4_paths,
8229 show_ip_bgp_ipv4_paths_cmd,
8230 "show ip bgp ipv4 (unicast|multicast) paths",
8231 SHOW_STR
8232 IP_STR
8233 BGP_STR
8234 "Address family\n"
8235 "Address Family modifier\n"
8236 "Address Family modifier\n"
8237 "Path information\n")
8238{
8239 vty_out (vty, "Address Refcnt Path\r\n");
8240 aspath_print_all_vty (vty);
8241
8242 return CMD_SUCCESS;
8243}
David Lamparter6b0655a2014-06-04 06:53:35 +02008244
paul718e3742002-12-13 20:15:29 +00008245#include "hash.h"
8246
paul94f2b392005-06-28 12:44:16 +00008247static void
paul718e3742002-12-13 20:15:29 +00008248community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8249{
8250 struct community *com;
8251
8252 com = (struct community *) backet->data;
David Lampartereed3c482015-03-03 08:51:53 +01008253 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
paul718e3742002-12-13 20:15:29 +00008254 community_str (com), VTY_NEWLINE);
8255}
8256
8257/* Show BGP's community internal data. */
8258DEFUN (show_ip_bgp_community_info,
8259 show_ip_bgp_community_info_cmd,
8260 "show ip bgp community-info",
8261 SHOW_STR
8262 IP_STR
8263 BGP_STR
8264 "List all bgp community information\n")
8265{
8266 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8267
8268 hash_iterate (community_hash (),
8269 (void (*) (struct hash_backet *, void *))
8270 community_show_all_iterator,
8271 vty);
8272
8273 return CMD_SUCCESS;
8274}
8275
8276DEFUN (show_ip_bgp_attr_info,
8277 show_ip_bgp_attr_info_cmd,
8278 "show ip bgp attribute-info",
8279 SHOW_STR
8280 IP_STR
8281 BGP_STR
8282 "List all bgp attribute information\n")
8283{
8284 attr_show_all (vty);
8285 return CMD_SUCCESS;
8286}
David Lamparter6b0655a2014-06-04 06:53:35 +02008287
paul94f2b392005-06-28 12:44:16 +00008288static int
paulfee0f4c2004-09-13 05:12:46 +00008289bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8290 afi_t afi, safi_t safi)
8291{
8292 char timebuf[BGP_UPTIME_LEN];
8293 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008294 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008295 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008296 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008297 int len;
8298 int count = 0;
8299
8300 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8301 {
paul1eb8ef22005-04-07 07:30:20 +00008302 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008303 {
8304 count++;
8305 bgp_write_rsclient_summary (vty, peer, afi, safi);
8306 }
8307 return count;
8308 }
8309
8310 len = vty_out (vty, "%s", rsclient->host);
8311 len = 16 - len;
8312
8313 if (len < 1)
8314 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8315 else
8316 vty_out (vty, "%*s", len, " ");
8317
hasso3d515fd2005-02-01 21:30:04 +00008318 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008319
Milan Kociancb4fc592014-12-01 12:48:25 +00008320 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008321
8322 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8323 if ( rmname && strlen (rmname) > 13 )
8324 {
8325 sprintf (rmbuf, "%13s", "...");
8326 rmname = strncpy (rmbuf, rmname, 10);
8327 }
8328 else if (! rmname)
8329 rmname = "<none>";
8330 vty_out (vty, " %13s ", rmname);
8331
8332 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8333 if ( rmname && strlen (rmname) > 13 )
8334 {
8335 sprintf (rmbuf, "%13s", "...");
8336 rmname = strncpy (rmbuf, rmname, 10);
8337 }
8338 else if (! rmname)
8339 rmname = "<none>";
8340 vty_out (vty, " %13s ", rmname);
8341
8342 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8343
8344 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8345 vty_out (vty, " Idle (Admin)");
8346 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8347 vty_out (vty, " Idle (PfxCt)");
8348 else
8349 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8350
8351 vty_out (vty, "%s", VTY_NEWLINE);
8352
8353 return 1;
8354}
8355
paul94f2b392005-06-28 12:44:16 +00008356static int
paulfd79ac92004-10-13 05:06:08 +00008357bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8358 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008359{
8360 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008361 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008362 int count = 0;
8363
8364 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00008365 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00008366
paul1eb8ef22005-04-07 07:30:20 +00008367 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008368 {
8369 if (peer->afc[afi][safi] &&
8370 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8371 {
8372 if (! count)
8373 {
8374 vty_out (vty,
8375 "Route Server's BGP router identifier %s%s",
8376 inet_ntoa (bgp->router_id), VTY_NEWLINE);
8377 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008378 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00008379 VTY_NEWLINE);
8380
8381 vty_out (vty, "%s", VTY_NEWLINE);
8382 vty_out (vty, "%s%s", header, VTY_NEWLINE);
8383 }
8384
8385 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
8386 }
8387 }
8388
8389 if (count)
8390 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
8391 count, VTY_NEWLINE);
8392 else
8393 vty_out (vty, "No %s Route Server Client is configured%s",
8394 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
8395
8396 return CMD_SUCCESS;
8397}
8398
paul94f2b392005-06-28 12:44:16 +00008399static int
paulfd79ac92004-10-13 05:06:08 +00008400bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
8401 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008402{
8403 struct bgp *bgp;
8404
8405 if (name)
8406 {
8407 bgp = bgp_lookup_by_name (name);
8408
8409 if (! bgp)
8410 {
8411 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8412 return CMD_WARNING;
8413 }
8414
8415 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8416 return CMD_SUCCESS;
8417 }
8418
8419 bgp = bgp_get_default ();
8420
8421 if (bgp)
8422 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8423
8424 return CMD_SUCCESS;
8425}
8426
8427/* 'show bgp rsclient' commands. */
8428DEFUN (show_ip_bgp_rsclient_summary,
8429 show_ip_bgp_rsclient_summary_cmd,
8430 "show ip bgp rsclient summary",
8431 SHOW_STR
8432 IP_STR
8433 BGP_STR
8434 "Information about Route Server Clients\n"
8435 "Summary of all Route Server Clients\n")
8436{
8437 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8438}
8439
8440DEFUN (show_ip_bgp_instance_rsclient_summary,
8441 show_ip_bgp_instance_rsclient_summary_cmd,
8442 "show ip bgp view WORD rsclient summary",
8443 SHOW_STR
8444 IP_STR
8445 BGP_STR
8446 "BGP view\n"
8447 "View name\n"
8448 "Information about Route Server Clients\n"
8449 "Summary of all Route Server Clients\n")
8450{
8451 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8452}
8453
8454DEFUN (show_ip_bgp_ipv4_rsclient_summary,
8455 show_ip_bgp_ipv4_rsclient_summary_cmd,
8456 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
8457 SHOW_STR
8458 IP_STR
8459 BGP_STR
8460 "Address family\n"
8461 "Address Family modifier\n"
8462 "Address Family modifier\n"
8463 "Information about Route Server Clients\n"
8464 "Summary of all Route Server Clients\n")
8465{
8466 if (strncmp (argv[0], "m", 1) == 0)
8467 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
8468
8469 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8470}
8471
8472DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
8473 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
8474 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8475 SHOW_STR
8476 IP_STR
8477 BGP_STR
8478 "BGP view\n"
8479 "View name\n"
8480 "Address family\n"
8481 "Address Family modifier\n"
8482 "Address Family modifier\n"
8483 "Information about Route Server Clients\n"
8484 "Summary of all Route Server Clients\n")
8485{
8486 if (strncmp (argv[1], "m", 1) == 0)
8487 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
8488
8489 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8490}
8491
Michael Lambert95cbbd22010-07-23 14:43:04 -04008492DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
8493 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
8494 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8495 SHOW_STR
8496 BGP_STR
8497 "BGP view\n"
8498 "View name\n"
8499 "Address family\n"
8500 "Address Family modifier\n"
8501 "Address Family modifier\n"
8502 "Information about Route Server Clients\n"
8503 "Summary of all Route Server Clients\n")
8504{
8505 safi_t safi;
8506
8507 if (argc == 2) {
8508 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8509 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
8510 } else {
8511 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8512 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
8513 }
8514}
8515
8516ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
8517 show_bgp_ipv4_safi_rsclient_summary_cmd,
8518 "show bgp ipv4 (unicast|multicast) rsclient summary",
8519 SHOW_STR
8520 BGP_STR
8521 "Address family\n"
8522 "Address Family modifier\n"
8523 "Address Family modifier\n"
8524 "Information about Route Server Clients\n"
8525 "Summary of all Route Server Clients\n")
8526
paulfee0f4c2004-09-13 05:12:46 +00008527#ifdef HAVE_IPV6
8528DEFUN (show_bgp_rsclient_summary,
8529 show_bgp_rsclient_summary_cmd,
8530 "show bgp rsclient summary",
8531 SHOW_STR
8532 BGP_STR
8533 "Information about Route Server Clients\n"
8534 "Summary of all Route Server Clients\n")
8535{
8536 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8537}
8538
8539DEFUN (show_bgp_instance_rsclient_summary,
8540 show_bgp_instance_rsclient_summary_cmd,
8541 "show bgp view WORD rsclient summary",
8542 SHOW_STR
8543 BGP_STR
8544 "BGP view\n"
8545 "View name\n"
8546 "Information about Route Server Clients\n"
8547 "Summary of all Route Server Clients\n")
8548{
8549 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
8550}
8551
8552ALIAS (show_bgp_rsclient_summary,
8553 show_bgp_ipv6_rsclient_summary_cmd,
8554 "show bgp ipv6 rsclient summary",
8555 SHOW_STR
8556 BGP_STR
8557 "Address family\n"
8558 "Information about Route Server Clients\n"
8559 "Summary of all Route Server Clients\n")
8560
8561ALIAS (show_bgp_instance_rsclient_summary,
8562 show_bgp_instance_ipv6_rsclient_summary_cmd,
8563 "show bgp view WORD ipv6 rsclient summary",
8564 SHOW_STR
8565 BGP_STR
8566 "BGP view\n"
8567 "View name\n"
8568 "Address family\n"
8569 "Information about Route Server Clients\n"
8570 "Summary of all Route Server Clients\n")
Michael Lambert95cbbd22010-07-23 14:43:04 -04008571
8572DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
8573 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
8574 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
8575 SHOW_STR
8576 BGP_STR
8577 "BGP view\n"
8578 "View name\n"
8579 "Address family\n"
8580 "Address Family modifier\n"
8581 "Address Family modifier\n"
8582 "Information about Route Server Clients\n"
8583 "Summary of all Route Server Clients\n")
8584{
8585 safi_t safi;
8586
8587 if (argc == 2) {
8588 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8589 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
8590 } else {
8591 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8592 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
8593 }
8594}
8595
8596ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
8597 show_bgp_ipv6_safi_rsclient_summary_cmd,
8598 "show bgp ipv6 (unicast|multicast) rsclient summary",
8599 SHOW_STR
8600 BGP_STR
8601 "Address family\n"
8602 "Address Family modifier\n"
8603 "Address Family modifier\n"
8604 "Information about Route Server Clients\n"
8605 "Summary of all Route Server Clients\n")
8606
paulfee0f4c2004-09-13 05:12:46 +00008607#endif /* HAVE IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02008608
paul718e3742002-12-13 20:15:29 +00008609/* Redistribute VTY commands. */
8610
paul718e3742002-12-13 20:15:29 +00008611DEFUN (bgp_redistribute_ipv4,
8612 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008613 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008614 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008615 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008616{
8617 int type;
8618
David Lampartere0ca5fd2009-09-16 01:52:42 +02008619 type = proto_redistnum (AFI_IP, argv[0]);
8620 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008621 {
8622 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8623 return CMD_WARNING;
8624 }
8625 return bgp_redistribute_set (vty->index, AFI_IP, type);
8626}
8627
8628DEFUN (bgp_redistribute_ipv4_rmap,
8629 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008630 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008631 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008632 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008633 "Route map reference\n"
8634 "Pointer to route-map entries\n")
8635{
8636 int type;
8637
David Lampartere0ca5fd2009-09-16 01:52:42 +02008638 type = proto_redistnum (AFI_IP, argv[0]);
8639 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008640 {
8641 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8642 return CMD_WARNING;
8643 }
8644
8645 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8646 return bgp_redistribute_set (vty->index, AFI_IP, type);
8647}
8648
8649DEFUN (bgp_redistribute_ipv4_metric,
8650 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008651 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008652 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008653 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008654 "Metric for redistributed routes\n"
8655 "Default metric\n")
8656{
8657 int type;
8658 u_int32_t metric;
8659
David Lampartere0ca5fd2009-09-16 01:52:42 +02008660 type = proto_redistnum (AFI_IP, argv[0]);
8661 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008662 {
8663 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8664 return CMD_WARNING;
8665 }
8666 VTY_GET_INTEGER ("metric", metric, argv[1]);
8667
8668 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8669 return bgp_redistribute_set (vty->index, AFI_IP, type);
8670}
8671
8672DEFUN (bgp_redistribute_ipv4_rmap_metric,
8673 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008674 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008675 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008676 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008677 "Route map reference\n"
8678 "Pointer to route-map entries\n"
8679 "Metric for redistributed routes\n"
8680 "Default metric\n")
8681{
8682 int type;
8683 u_int32_t metric;
8684
David Lampartere0ca5fd2009-09-16 01:52:42 +02008685 type = proto_redistnum (AFI_IP, argv[0]);
8686 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008687 {
8688 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8689 return CMD_WARNING;
8690 }
8691 VTY_GET_INTEGER ("metric", metric, argv[2]);
8692
8693 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8694 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8695 return bgp_redistribute_set (vty->index, AFI_IP, type);
8696}
8697
8698DEFUN (bgp_redistribute_ipv4_metric_rmap,
8699 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008700 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008701 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008702 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008703 "Metric for redistributed routes\n"
8704 "Default metric\n"
8705 "Route map reference\n"
8706 "Pointer to route-map entries\n")
8707{
8708 int type;
8709 u_int32_t metric;
8710
David Lampartere0ca5fd2009-09-16 01:52:42 +02008711 type = proto_redistnum (AFI_IP, argv[0]);
8712 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008713 {
8714 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8715 return CMD_WARNING;
8716 }
8717 VTY_GET_INTEGER ("metric", metric, argv[1]);
8718
8719 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8720 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
8721 return bgp_redistribute_set (vty->index, AFI_IP, type);
8722}
8723
8724DEFUN (no_bgp_redistribute_ipv4,
8725 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008726 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008727 NO_STR
8728 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008729 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008730{
8731 int type;
8732
David Lampartere0ca5fd2009-09-16 01:52:42 +02008733 type = proto_redistnum (AFI_IP, argv[0]);
8734 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008735 {
8736 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8737 return CMD_WARNING;
8738 }
8739
8740 return bgp_redistribute_unset (vty->index, AFI_IP, type);
8741}
8742
8743DEFUN (no_bgp_redistribute_ipv4_rmap,
8744 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008745 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008746 NO_STR
8747 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008748 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008749 "Route map reference\n"
8750 "Pointer to route-map entries\n")
8751{
8752 int type;
8753
David Lampartere0ca5fd2009-09-16 01:52:42 +02008754 type = proto_redistnum (AFI_IP, argv[0]);
8755 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008756 {
8757 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8758 return CMD_WARNING;
8759 }
8760
8761 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8762 return CMD_SUCCESS;
8763}
8764
8765DEFUN (no_bgp_redistribute_ipv4_metric,
8766 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008767 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008768 NO_STR
8769 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008770 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008771 "Metric for redistributed routes\n"
8772 "Default metric\n")
8773{
8774 int type;
8775
David Lampartere0ca5fd2009-09-16 01:52:42 +02008776 type = proto_redistnum (AFI_IP, argv[0]);
8777 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008778 {
8779 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8780 return CMD_WARNING;
8781 }
8782
8783 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8784 return CMD_SUCCESS;
8785}
8786
8787DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
8788 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008789 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008790 NO_STR
8791 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008792 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008793 "Route map reference\n"
8794 "Pointer to route-map entries\n"
8795 "Metric for redistributed routes\n"
8796 "Default metric\n")
8797{
8798 int type;
8799
David Lampartere0ca5fd2009-09-16 01:52:42 +02008800 type = proto_redistnum (AFI_IP, argv[0]);
8801 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008802 {
8803 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8804 return CMD_WARNING;
8805 }
8806
8807 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8808 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8809 return CMD_SUCCESS;
8810}
8811
8812ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
8813 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008814 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008815 NO_STR
8816 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008817 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008818 "Metric for redistributed routes\n"
8819 "Default metric\n"
8820 "Route map reference\n"
8821 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008822
paul718e3742002-12-13 20:15:29 +00008823#ifdef HAVE_IPV6
8824DEFUN (bgp_redistribute_ipv6,
8825 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008826 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008827 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008828 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008829{
8830 int type;
8831
David Lampartere0ca5fd2009-09-16 01:52:42 +02008832 type = proto_redistnum (AFI_IP6, argv[0]);
8833 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008834 {
8835 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8836 return CMD_WARNING;
8837 }
8838
8839 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8840}
8841
8842DEFUN (bgp_redistribute_ipv6_rmap,
8843 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008844 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008845 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008846 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008847 "Route map reference\n"
8848 "Pointer to route-map entries\n")
8849{
8850 int type;
8851
David Lampartere0ca5fd2009-09-16 01:52:42 +02008852 type = proto_redistnum (AFI_IP6, argv[0]);
8853 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008854 {
8855 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8856 return CMD_WARNING;
8857 }
8858
8859 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8860 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8861}
8862
8863DEFUN (bgp_redistribute_ipv6_metric,
8864 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008865 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008866 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008867 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008868 "Metric for redistributed routes\n"
8869 "Default metric\n")
8870{
8871 int type;
8872 u_int32_t metric;
8873
David Lampartere0ca5fd2009-09-16 01:52:42 +02008874 type = proto_redistnum (AFI_IP6, argv[0]);
8875 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008876 {
8877 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8878 return CMD_WARNING;
8879 }
8880 VTY_GET_INTEGER ("metric", metric, argv[1]);
8881
8882 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8883 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8884}
8885
8886DEFUN (bgp_redistribute_ipv6_rmap_metric,
8887 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008888 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008889 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008890 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008891 "Route map reference\n"
8892 "Pointer to route-map entries\n"
8893 "Metric for redistributed routes\n"
8894 "Default metric\n")
8895{
8896 int type;
8897 u_int32_t metric;
8898
David Lampartere0ca5fd2009-09-16 01:52:42 +02008899 type = proto_redistnum (AFI_IP6, argv[0]);
8900 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008901 {
8902 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8903 return CMD_WARNING;
8904 }
8905 VTY_GET_INTEGER ("metric", metric, argv[2]);
8906
8907 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8908 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8909 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8910}
8911
8912DEFUN (bgp_redistribute_ipv6_metric_rmap,
8913 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008914 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008915 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008916 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008917 "Metric for redistributed routes\n"
8918 "Default metric\n"
8919 "Route map reference\n"
8920 "Pointer to route-map entries\n")
8921{
8922 int type;
8923 u_int32_t metric;
8924
David Lampartere0ca5fd2009-09-16 01:52:42 +02008925 type = proto_redistnum (AFI_IP6, argv[0]);
8926 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008927 {
8928 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8929 return CMD_WARNING;
8930 }
8931 VTY_GET_INTEGER ("metric", metric, argv[1]);
8932
8933 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8934 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
8935 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8936}
8937
8938DEFUN (no_bgp_redistribute_ipv6,
8939 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008940 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008941 NO_STR
8942 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008943 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008944{
8945 int type;
8946
David Lampartere0ca5fd2009-09-16 01:52:42 +02008947 type = proto_redistnum (AFI_IP6, argv[0]);
8948 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008949 {
8950 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8951 return CMD_WARNING;
8952 }
8953
8954 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
8955}
8956
8957DEFUN (no_bgp_redistribute_ipv6_rmap,
8958 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008959 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008960 NO_STR
8961 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008962 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008963 "Route map reference\n"
8964 "Pointer to route-map entries\n")
8965{
8966 int type;
8967
David Lampartere0ca5fd2009-09-16 01:52:42 +02008968 type = proto_redistnum (AFI_IP6, argv[0]);
8969 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008970 {
8971 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8972 return CMD_WARNING;
8973 }
8974
8975 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8976 return CMD_SUCCESS;
8977}
8978
8979DEFUN (no_bgp_redistribute_ipv6_metric,
8980 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008981 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008982 NO_STR
8983 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008984 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008985 "Metric for redistributed routes\n"
8986 "Default metric\n")
8987{
8988 int type;
8989
David Lampartere0ca5fd2009-09-16 01:52:42 +02008990 type = proto_redistnum (AFI_IP6, argv[0]);
8991 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008992 {
8993 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8994 return CMD_WARNING;
8995 }
8996
8997 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
8998 return CMD_SUCCESS;
8999}
9000
9001DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
9002 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009003 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009004 NO_STR
9005 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009006 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009007 "Route map reference\n"
9008 "Pointer to route-map entries\n"
9009 "Metric for redistributed routes\n"
9010 "Default metric\n")
9011{
9012 int type;
9013
David Lampartere0ca5fd2009-09-16 01:52:42 +02009014 type = proto_redistnum (AFI_IP6, argv[0]);
9015 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009016 {
9017 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9018 return CMD_WARNING;
9019 }
9020
9021 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9022 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9023 return CMD_SUCCESS;
9024}
9025
9026ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9027 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009028 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009029 NO_STR
9030 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009031 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009032 "Metric for redistributed routes\n"
9033 "Default metric\n"
9034 "Route map reference\n"
9035 "Pointer to route-map entries\n")
9036#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02009037
paul718e3742002-12-13 20:15:29 +00009038int
9039bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9040 safi_t safi, int *write)
9041{
9042 int i;
paul718e3742002-12-13 20:15:29 +00009043
9044 /* Unicast redistribution only. */
9045 if (safi != SAFI_UNICAST)
9046 return 0;
9047
9048 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9049 {
9050 /* Redistribute BGP does not make sense. */
9051 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9052 {
9053 /* Display "address-family" when it is not yet diplayed. */
9054 bgp_config_write_family_header (vty, afi, safi, write);
9055
9056 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009057 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009058
9059 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009060 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009061
9062 if (bgp->rmap[afi][i].name)
9063 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9064
9065 vty_out (vty, "%s", VTY_NEWLINE);
9066 }
9067 }
9068 return *write;
9069}
David Lamparter6b0655a2014-06-04 06:53:35 +02009070
paul718e3742002-12-13 20:15:29 +00009071/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009072static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009073{
9074 BGP_NODE,
9075 "%s(config-router)# ",
9076 1,
9077};
9078
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009079static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009080{
9081 BGP_IPV4_NODE,
9082 "%s(config-router-af)# ",
9083 1,
9084};
9085
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009086static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009087{
9088 BGP_IPV4M_NODE,
9089 "%s(config-router-af)# ",
9090 1,
9091};
9092
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009093static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009094{
9095 BGP_IPV6_NODE,
9096 "%s(config-router-af)# ",
9097 1,
9098};
9099
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009100static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009101{
9102 BGP_IPV6M_NODE,
9103 "%s(config-router-af)# ",
9104 1,
9105};
9106
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009107static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009108{
9109 BGP_VPNV4_NODE,
9110 "%s(config-router-af)# ",
9111 1
9112};
David Lamparter6b0655a2014-06-04 06:53:35 +02009113
paul1f8ae702005-09-09 23:49:49 +00009114static void community_list_vty (void);
9115
paul718e3742002-12-13 20:15:29 +00009116void
paul94f2b392005-06-28 12:44:16 +00009117bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009118{
paul718e3742002-12-13 20:15:29 +00009119 /* Install bgp top node. */
9120 install_node (&bgp_node, bgp_config_write);
9121 install_node (&bgp_ipv4_unicast_node, NULL);
9122 install_node (&bgp_ipv4_multicast_node, NULL);
9123 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009124 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009125 install_node (&bgp_vpnv4_node, NULL);
9126
9127 /* Install default VTY commands to new nodes. */
9128 install_default (BGP_NODE);
9129 install_default (BGP_IPV4_NODE);
9130 install_default (BGP_IPV4M_NODE);
9131 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009132 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009133 install_default (BGP_VPNV4_NODE);
9134
9135 /* "bgp multiple-instance" commands. */
9136 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9137 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9138
9139 /* "bgp config-type" commands. */
9140 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9141 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9142
9143 /* Dummy commands (Currently not supported) */
9144 install_element (BGP_NODE, &no_synchronization_cmd);
9145 install_element (BGP_NODE, &no_auto_summary_cmd);
9146
9147 /* "router bgp" commands. */
9148 install_element (CONFIG_NODE, &router_bgp_cmd);
9149 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9150
9151 /* "no router bgp" commands. */
9152 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9153 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9154
9155 /* "bgp router-id" commands. */
9156 install_element (BGP_NODE, &bgp_router_id_cmd);
9157 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9158 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9159
9160 /* "bgp cluster-id" commands. */
9161 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9162 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9163 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9164 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9165
9166 /* "bgp confederation" commands. */
9167 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9168 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9169 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9170
9171 /* "bgp confederation peers" commands. */
9172 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9173 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9174
Josh Bailey165b5ff2011-07-20 20:43:22 -07009175 /* "maximum-paths" commands. */
9176 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9177 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9178 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9179 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9180 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9181 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
9182 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9183 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9184 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9185 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9186 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9187 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9188
paul718e3742002-12-13 20:15:29 +00009189 /* "timers bgp" commands. */
9190 install_element (BGP_NODE, &bgp_timers_cmd);
9191 install_element (BGP_NODE, &no_bgp_timers_cmd);
9192 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9193
9194 /* "bgp client-to-client reflection" commands */
9195 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9196 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9197
9198 /* "bgp always-compare-med" commands */
9199 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9200 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9201
9202 /* "bgp deterministic-med" commands */
9203 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9204 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009205
hasso538621f2004-05-21 09:31:30 +00009206 /* "bgp graceful-restart" commands */
9207 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9208 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009209 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9210 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9211 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009212
9213 /* "bgp fast-external-failover" commands */
9214 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9215 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9216
9217 /* "bgp enforce-first-as" commands */
9218 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9219 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9220
9221 /* "bgp bestpath compare-routerid" commands */
9222 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9223 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9224
9225 /* "bgp bestpath as-path ignore" commands */
9226 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9227 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9228
hasso68118452005-04-08 15:40:36 +00009229 /* "bgp bestpath as-path confed" commands */
9230 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9231 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9232
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00009233 /* "bgp bestpath as-path multipath-relax" commands */
9234 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9235 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9236
paul848973c2003-08-13 00:32:49 +00009237 /* "bgp log-neighbor-changes" commands */
9238 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9239 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9240
paul718e3742002-12-13 20:15:29 +00009241 /* "bgp bestpath med" commands */
9242 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9243 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9244 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9245 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9246 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9247 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9248
9249 /* "no bgp default ipv4-unicast" commands. */
9250 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9251 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9252
9253 /* "bgp network import-check" commands. */
9254 install_element (BGP_NODE, &bgp_network_import_check_cmd);
9255 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
9256
9257 /* "bgp default local-preference" commands. */
9258 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
9259 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
9260 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
9261
9262 /* "neighbor remote-as" commands. */
9263 install_element (BGP_NODE, &neighbor_remote_as_cmd);
9264 install_element (BGP_NODE, &no_neighbor_cmd);
9265 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
9266
9267 /* "neighbor peer-group" commands. */
9268 install_element (BGP_NODE, &neighbor_peer_group_cmd);
9269 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
9270 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
9271
9272 /* "neighbor local-as" commands. */
9273 install_element (BGP_NODE, &neighbor_local_as_cmd);
9274 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009275 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +00009276 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
9277 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
9278 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009279 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +00009280
Paul Jakma0df7c912008-07-21 21:02:49 +00009281 /* "neighbor password" commands. */
9282 install_element (BGP_NODE, &neighbor_password_cmd);
9283 install_element (BGP_NODE, &no_neighbor_password_cmd);
9284
paul718e3742002-12-13 20:15:29 +00009285 /* "neighbor activate" commands. */
9286 install_element (BGP_NODE, &neighbor_activate_cmd);
9287 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
9288 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
9289 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009290 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009291 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
9292
9293 /* "no neighbor activate" commands. */
9294 install_element (BGP_NODE, &no_neighbor_activate_cmd);
9295 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
9296 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
9297 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009298 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009299 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
9300
9301 /* "neighbor peer-group set" commands. */
9302 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
9303 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
9304 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
9305 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009306 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009307 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
9308
paul718e3742002-12-13 20:15:29 +00009309 /* "no neighbor peer-group unset" commands. */
9310 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
9311 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
9312 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
9313 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009314 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009315 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
9316
paul718e3742002-12-13 20:15:29 +00009317 /* "neighbor softreconfiguration inbound" commands.*/
9318 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
9319 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
9320 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
9321 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
9322 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
9323 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
9324 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
9325 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009326 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
9327 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +00009328 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
9329 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +00009330
9331 /* "neighbor attribute-unchanged" commands. */
9332 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
9333 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
9334 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
9335 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
9336 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
9337 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
9338 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
9339 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
9340 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
9341 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
9342 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
9343 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
9344 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
9345 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
9346 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
9347 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
9348 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
9349 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
9350 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
9351 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
9352 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
9353 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
9354 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
9355 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
9356 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
9357 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
9358 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
9359 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
9360 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
9361 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
9362 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
9363 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
9364 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
9365 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
9366 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9367 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9368 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9369 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9370 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9371 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9372 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9373 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9374 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9375 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9376 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
9377 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
9378 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
9379 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
9380 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
9381 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
9382 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
9383 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
9384 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
9385 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
9386 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
9387 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
9388 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
9389 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
9390 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
9391 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
9392 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
9393 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
9394 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
9395 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
9396 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
9397 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
9398 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
9399 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
9400 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
9401 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
9402 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
9403 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
9404 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
9405 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
9406 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
9407 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
9408 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
9409 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9410 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9411 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9412 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9413 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9414 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9415 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9416 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9417 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9418 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9419 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009420 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
9421 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
9422 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
9423 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
9424 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
9425 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
9426 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
9427 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
9428 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
9429 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
9430 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
9431 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
9432 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
9433 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
9434 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
9435 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
9436 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
9437 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
9438 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
9439 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
9440 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
9441 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +00009442 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
9443 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
9444 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
9445 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
9446 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
9447 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
9448 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
9449 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
9450 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
9451 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
9452 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
9453 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
9454 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9455 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9456 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9457 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9458 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9459 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9460 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9461 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9462 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9463 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9464
paulfee0f4c2004-09-13 05:12:46 +00009465 /* "nexthop-local unchanged" commands */
9466 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
9467 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
9468
paul718e3742002-12-13 20:15:29 +00009469 /* "transparent-as" and "transparent-nexthop" for old version
9470 compatibility. */
9471 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
9472 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
9473
9474 /* "neighbor next-hop-self" commands. */
9475 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
9476 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
9477 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
9478 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
9479 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
9480 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
9481 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
9482 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009483 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
9484 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009485 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
9486 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
9487
9488 /* "neighbor remove-private-AS" commands. */
9489 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
9490 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
9491 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
9492 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
9493 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
9494 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
9495 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
9496 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009497 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
9498 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009499 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
9500 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
9501
9502 /* "neighbor send-community" commands.*/
9503 install_element (BGP_NODE, &neighbor_send_community_cmd);
9504 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
9505 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
9506 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
9507 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
9508 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
9509 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
9510 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
9511 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
9512 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
9513 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
9514 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
9515 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
9516 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
9517 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
9518 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009519 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
9520 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
9521 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
9522 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00009523 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
9524 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
9525 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
9526 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
9527
9528 /* "neighbor route-reflector" commands.*/
9529 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
9530 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
9531 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
9532 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
9533 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
9534 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
9535 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
9536 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009537 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
9538 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +00009539 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
9540 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
9541
9542 /* "neighbor route-server" commands.*/
9543 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
9544 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
9545 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
9546 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
9547 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
9548 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
9549 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
9550 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009551 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
9552 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +00009553 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
9554 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
9555
9556 /* "neighbor passive" commands. */
9557 install_element (BGP_NODE, &neighbor_passive_cmd);
9558 install_element (BGP_NODE, &no_neighbor_passive_cmd);
9559
9560 /* "neighbor shutdown" commands. */
9561 install_element (BGP_NODE, &neighbor_shutdown_cmd);
9562 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
9563
hassoc9502432005-02-01 22:01:48 +00009564 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +00009565 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
9566 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
9567
9568 /* "neighbor capability orf prefix-list" commands.*/
9569 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
9570 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
9571 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
9572 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
9573 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
9574 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
9575 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
9576 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009577 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
9578 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +00009579
9580 /* "neighbor capability dynamic" commands.*/
9581 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
9582 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
9583
9584 /* "neighbor dont-capability-negotiate" commands. */
9585 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
9586 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
9587
9588 /* "neighbor ebgp-multihop" commands. */
9589 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
9590 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
9591 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
9592 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
9593
hasso6ffd2072005-02-02 14:50:11 +00009594 /* "neighbor disable-connected-check" commands. */
9595 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
9596 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +00009597 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
9598 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
9599
9600 /* "neighbor description" commands. */
9601 install_element (BGP_NODE, &neighbor_description_cmd);
9602 install_element (BGP_NODE, &no_neighbor_description_cmd);
9603 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
9604
9605 /* "neighbor update-source" commands. "*/
9606 install_element (BGP_NODE, &neighbor_update_source_cmd);
9607 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
9608
9609 /* "neighbor default-originate" commands. */
9610 install_element (BGP_NODE, &neighbor_default_originate_cmd);
9611 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
9612 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
9613 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
9614 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
9615 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
9616 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
9617 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
9618 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
9619 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
9620 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
9621 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
9622 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
9623 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
9624 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
9625 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009626 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
9627 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
9628 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
9629 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +00009630
9631 /* "neighbor port" commands. */
9632 install_element (BGP_NODE, &neighbor_port_cmd);
9633 install_element (BGP_NODE, &no_neighbor_port_cmd);
9634 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
9635
9636 /* "neighbor weight" commands. */
9637 install_element (BGP_NODE, &neighbor_weight_cmd);
9638 install_element (BGP_NODE, &no_neighbor_weight_cmd);
9639 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
9640
9641 /* "neighbor override-capability" commands. */
9642 install_element (BGP_NODE, &neighbor_override_capability_cmd);
9643 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
9644
9645 /* "neighbor strict-capability-match" commands. */
9646 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
9647 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
9648
9649 /* "neighbor timers" commands. */
9650 install_element (BGP_NODE, &neighbor_timers_cmd);
9651 install_element (BGP_NODE, &no_neighbor_timers_cmd);
9652
9653 /* "neighbor timers connect" commands. */
9654 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
9655 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
9656 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
9657
9658 /* "neighbor advertisement-interval" commands. */
9659 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
9660 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
9661 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
9662
9663 /* "neighbor version" commands. */
9664 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +00009665
9666 /* "neighbor interface" commands. */
9667 install_element (BGP_NODE, &neighbor_interface_cmd);
9668 install_element (BGP_NODE, &no_neighbor_interface_cmd);
9669
9670 /* "neighbor distribute" commands. */
9671 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
9672 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
9673 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
9674 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
9675 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
9676 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
9677 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
9678 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009679 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
9680 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +00009681 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
9682 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
9683
9684 /* "neighbor prefix-list" commands. */
9685 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
9686 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
9687 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
9688 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
9689 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
9690 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
9691 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
9692 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009693 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
9694 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +00009695 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
9696 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
9697
9698 /* "neighbor filter-list" commands. */
9699 install_element (BGP_NODE, &neighbor_filter_list_cmd);
9700 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
9701 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
9702 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
9703 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
9704 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
9705 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
9706 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009707 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
9708 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +00009709 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
9710 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
9711
9712 /* "neighbor route-map" commands. */
9713 install_element (BGP_NODE, &neighbor_route_map_cmd);
9714 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
9715 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
9716 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
9717 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
9718 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
9719 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
9720 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009721 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
9722 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +00009723 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
9724 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
9725
9726 /* "neighbor unsuppress-map" commands. */
9727 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
9728 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
9729 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
9730 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
9731 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
9732 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
9733 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
9734 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009735 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
9736 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +00009737 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
9738 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +00009739
9740 /* "neighbor maximum-prefix" commands. */
9741 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009742 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009743 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009744 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009745 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
9746 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009747 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
9748 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009749 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9750 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9751 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9752 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9753 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009754 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009755 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009756 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009757 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009758 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9759 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009760 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
9761 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009762 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9763 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9764 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9765 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9766 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009767 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009768 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009769 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009770 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009771 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
9772 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009773 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
9774 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009775 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9776 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9777 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9778 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9779 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009780 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009781 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009782 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009783 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009784 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
9785 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009786 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
9787 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009788 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9789 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9790 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9791 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9792 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009793 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
9794 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
9795 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
9796 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9797 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
9798 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9799 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
9800 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
9801 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9802 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9803 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9804 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9805 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009806 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009807 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009808 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009809 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009810 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9811 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009812 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
9813 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009814 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9815 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9816 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9817 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9818 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009819
9820 /* "neighbor allowas-in" */
9821 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
9822 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
9823 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
9824 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
9825 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
9826 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
9827 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
9828 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
9829 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
9830 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
9831 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
9832 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009833 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
9834 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
9835 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +00009836 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
9837 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
9838 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
9839
9840 /* address-family commands. */
9841 install_element (BGP_NODE, &address_family_ipv4_cmd);
9842 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
9843#ifdef HAVE_IPV6
9844 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009845 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +00009846#endif /* HAVE_IPV6 */
9847 install_element (BGP_NODE, &address_family_vpnv4_cmd);
9848 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
9849
9850 /* "exit-address-family" command. */
9851 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
9852 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
9853 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009854 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +00009855 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
9856
9857 /* "clear ip bgp commands" */
9858 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
9859 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
9860 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
9861 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
9862 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
9863 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
9864#ifdef HAVE_IPV6
9865 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
9866 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
9867 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
9868 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
9869 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
9870 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
9871 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
9872 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
9873 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
9874 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
9875 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
9876#endif /* HAVE_IPV6 */
9877
9878 /* "clear ip bgp neighbor soft in" */
9879 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
9880 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
9881 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
9882 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
9883 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
9884 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
9885 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
9886 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
9887 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
9888 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
9889 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
9890 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
9891 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
9892 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
9893 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
9894 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
9895 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
9896 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
9897 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
9898 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
9899 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
9900 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
9901 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
9902 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
9903 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
9904 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
9905 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
9906 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
9907 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
9908 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
9909 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
9910 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
9911 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
9912 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
9913 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
9914 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
9915 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
9916 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
9917 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
9918 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
9919#ifdef HAVE_IPV6
9920 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
9921 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
9922 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
9923 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
9924 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
9925 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
9926 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
9927 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
9928 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
9929 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
9930 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
9931 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
9932 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
9933 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
9934 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
9935 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
9936 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
9937 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
9938 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
9939 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
9940 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
9941 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
9942 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
9943 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
9944 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
9945 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
9946 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
9947 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
9948 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
9949 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
9950 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
9951#endif /* HAVE_IPV6 */
9952
9953 /* "clear ip bgp neighbor soft out" */
9954 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
9955 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
9956 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
9957 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
9958 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
9959 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
9960 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
9961 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
9962 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
9963 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
9964 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
9965 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
9966 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
9967 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
9968 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
9969 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
9970 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
9971 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
9972 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
9973 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
9974 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
9975 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
9976 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
9977 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
9978 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
9979 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
9980 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
9981 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
9982#ifdef HAVE_IPV6
9983 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
9984 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
9985 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
9986 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
9987 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
9988 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
9989 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
9990 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
9991 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
9992 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
9993 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
9994 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
9995 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
9996 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
9997 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
9998 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
9999 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
10000 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
10001 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
10002 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
10003 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
10004#endif /* HAVE_IPV6 */
10005
10006 /* "clear ip bgp neighbor soft" */
10007 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
10008 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
10009 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
10010 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
10011 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
10012 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
10013 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
10014 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
10015 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
10016 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
10017 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
10018 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
10019 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
10020 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
10021 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
10022#ifdef HAVE_IPV6
10023 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
10024 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
10025 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
10026 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
10027 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
10028 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
10029 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
10030 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
10031 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
10032 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
10033 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
10034#endif /* HAVE_IPV6 */
10035
paulfee0f4c2004-09-13 05:12:46 +000010036 /* "clear ip bgp neighbor rsclient" */
10037 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
10038 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
10039 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
10040 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
10041#ifdef HAVE_IPV6
10042 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
10043 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
10044 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
10045 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
10046 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
10047 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
10048 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
10049 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
10050#endif /* HAVE_IPV6 */
10051
paul718e3742002-12-13 20:15:29 +000010052 /* "show ip bgp summary" commands. */
10053 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
10054 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
10055 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010056 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010057 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010058 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010059 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10060 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10061#ifdef HAVE_IPV6
10062 install_element (VIEW_NODE, &show_bgp_summary_cmd);
10063 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
10064 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010065 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010066 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010067 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010068#endif /* HAVE_IPV6 */
Paul Jakma62687ff2008-08-23 14:27:06 +010010069 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
10070 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
10071 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010072 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010073 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010074 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010075 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10076 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10077#ifdef HAVE_IPV6
10078 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
10079 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
10080 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010081 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010082 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010083 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010084#endif /* HAVE_IPV6 */
paul718e3742002-12-13 20:15:29 +000010085 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
10086 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
10087 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010088 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010089 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010090 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010091 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10092 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10093#ifdef HAVE_IPV6
10094 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
10095 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
10096 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010097 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010098 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010099 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010100#endif /* HAVE_IPV6 */
10101
10102 /* "show ip bgp neighbors" commands. */
10103 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
10104 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10105 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
10106 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10107 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10108 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10109 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10110 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10111 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
10112 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010113 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
10114 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10115 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10116 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10117 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010118 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
10119 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10120 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
10121 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10122 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10123 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10124 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10125 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10126 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
10127 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
10128
10129#ifdef HAVE_IPV6
10130 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
10131 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
10132 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
10133 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010134 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
10135 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10136 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
10137 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010138 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
10139 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
10140 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
10141 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010142 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
10143 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
10144 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
10145 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010146 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
10147 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10148 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
10149 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010150
10151 /* Old commands. */
10152 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
10153 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
10154 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
10155 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
10156#endif /* HAVE_IPV6 */
10157
paulfee0f4c2004-09-13 05:12:46 +000010158 /* "show ip bgp rsclient" commands. */
10159 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
10160 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10161 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10162 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010163 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10164 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010165 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
10166 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10167 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10168 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010169 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10170 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010171 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
10172 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10173 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10174 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010175 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10176 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010177
10178#ifdef HAVE_IPV6
10179 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
10180 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10181 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
10182 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010183 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10184 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010185 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
10186 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10187 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
10188 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010189 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10190 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010191 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
10192 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10193 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
10194 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010195 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10196 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010197#endif /* HAVE_IPV6 */
10198
paul718e3742002-12-13 20:15:29 +000010199 /* "show ip bgp paths" commands. */
10200 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
10201 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
10202 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
10203 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
10204
10205 /* "show ip bgp community" commands. */
10206 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
10207 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
10208
10209 /* "show ip bgp attribute-info" commands. */
10210 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
10211 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
10212
10213 /* "redistribute" commands. */
10214 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
10215 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
10216 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
10217 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
10218 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
10219 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
10220 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
10221 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
10222 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
10223 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
10224#ifdef HAVE_IPV6
10225 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
10226 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
10227 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
10228 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
10229 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
10230 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
10231 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
10232 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
10233 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
10234 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
10235#endif /* HAVE_IPV6 */
10236
Nick Hilliardfa411a22011-03-23 15:33:17 +000010237 /* ttl_security commands */
10238 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
10239 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
10240
Paul Jakma4bf6a362006-03-30 14:05:23 +000010241 /* "show bgp memory" commands. */
10242 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010243 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000010244 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
10245
Michael Lamberte0081f72008-11-16 20:12:04 +000010246 /* "show bgp views" commands. */
10247 install_element (VIEW_NODE, &show_bgp_views_cmd);
10248 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
10249 install_element (ENABLE_NODE, &show_bgp_views_cmd);
10250
paul718e3742002-12-13 20:15:29 +000010251 /* Community-list. */
10252 community_list_vty ();
10253}
David Lamparter6b0655a2014-06-04 06:53:35 +020010254
paul718e3742002-12-13 20:15:29 +000010255#include "memory.h"
10256#include "bgp_regex.h"
10257#include "bgp_clist.h"
10258#include "bgp_ecommunity.h"
10259
10260/* VTY functions. */
10261
10262/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000010263static const char *
paul718e3742002-12-13 20:15:29 +000010264community_direct_str (int direct)
10265{
10266 switch (direct)
10267 {
10268 case COMMUNITY_DENY:
10269 return "deny";
paul718e3742002-12-13 20:15:29 +000010270 case COMMUNITY_PERMIT:
10271 return "permit";
paul718e3742002-12-13 20:15:29 +000010272 default:
10273 return "unknown";
paul718e3742002-12-13 20:15:29 +000010274 }
10275}
10276
10277/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000010278static void
paul718e3742002-12-13 20:15:29 +000010279community_list_perror (struct vty *vty, int ret)
10280{
10281 switch (ret)
10282 {
10283 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030010284 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010285 break;
10286 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
10287 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
10288 break;
10289 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
10290 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
10291 break;
10292 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
10293 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
10294 break;
10295 }
10296}
10297
10298/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000010299static int
paulfd79ac92004-10-13 05:06:08 +000010300community_list_set_vty (struct vty *vty, int argc, const char **argv,
10301 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010302{
10303 int ret;
10304 int direct;
10305 char *str;
10306
10307 /* Check the list type. */
10308 if (strncmp (argv[1], "p", 1) == 0)
10309 direct = COMMUNITY_PERMIT;
10310 else if (strncmp (argv[1], "d", 1) == 0)
10311 direct = COMMUNITY_DENY;
10312 else
10313 {
10314 vty_out (vty, "%% Matching condition must be permit or deny%s",
10315 VTY_NEWLINE);
10316 return CMD_WARNING;
10317 }
10318
10319 /* All digit name check. */
10320 if (reject_all_digit_name && all_digit (argv[0]))
10321 {
10322 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10323 return CMD_WARNING;
10324 }
10325
10326 /* Concat community string argument. */
10327 if (argc > 1)
10328 str = argv_concat (argv, argc, 2);
10329 else
10330 str = NULL;
10331
10332 /* When community_list_set() return nevetive value, it means
10333 malformed community string. */
10334 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
10335
10336 /* Free temporary community list string allocated by
10337 argv_concat(). */
10338 if (str)
10339 XFREE (MTYPE_TMP, str);
10340
10341 if (ret < 0)
10342 {
10343 /* Display error string. */
10344 community_list_perror (vty, ret);
10345 return CMD_WARNING;
10346 }
10347
10348 return CMD_SUCCESS;
10349}
10350
paul718e3742002-12-13 20:15:29 +000010351/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000010352static int
hassofee6e4e2005-02-02 16:29:31 +000010353community_list_unset_vty (struct vty *vty, int argc, const char **argv,
10354 int style)
paul718e3742002-12-13 20:15:29 +000010355{
10356 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010357 int direct = 0;
10358 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010359
hassofee6e4e2005-02-02 16:29:31 +000010360 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010361 {
hassofee6e4e2005-02-02 16:29:31 +000010362 /* Check the list direct. */
10363 if (strncmp (argv[1], "p", 1) == 0)
10364 direct = COMMUNITY_PERMIT;
10365 else if (strncmp (argv[1], "d", 1) == 0)
10366 direct = COMMUNITY_DENY;
10367 else
10368 {
10369 vty_out (vty, "%% Matching condition must be permit or deny%s",
10370 VTY_NEWLINE);
10371 return CMD_WARNING;
10372 }
paul718e3742002-12-13 20:15:29 +000010373
hassofee6e4e2005-02-02 16:29:31 +000010374 /* Concat community string argument. */
10375 str = argv_concat (argv, argc, 2);
10376 }
paul718e3742002-12-13 20:15:29 +000010377
10378 /* Unset community list. */
10379 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
10380
10381 /* Free temporary community list string allocated by
10382 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010383 if (str)
10384 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010385
10386 if (ret < 0)
10387 {
10388 community_list_perror (vty, ret);
10389 return CMD_WARNING;
10390 }
10391
10392 return CMD_SUCCESS;
10393}
10394
10395/* "community-list" keyword help string. */
10396#define COMMUNITY_LIST_STR "Add a community list entry\n"
10397#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
10398
paul718e3742002-12-13 20:15:29 +000010399DEFUN (ip_community_list_standard,
10400 ip_community_list_standard_cmd,
10401 "ip community-list <1-99> (deny|permit) .AA:NN",
10402 IP_STR
10403 COMMUNITY_LIST_STR
10404 "Community list number (standard)\n"
10405 "Specify community to reject\n"
10406 "Specify community to accept\n"
10407 COMMUNITY_VAL_STR)
10408{
10409 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
10410}
10411
10412ALIAS (ip_community_list_standard,
10413 ip_community_list_standard2_cmd,
10414 "ip community-list <1-99> (deny|permit)",
10415 IP_STR
10416 COMMUNITY_LIST_STR
10417 "Community list number (standard)\n"
10418 "Specify community to reject\n"
10419 "Specify community to accept\n")
10420
10421DEFUN (ip_community_list_expanded,
10422 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010423 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010424 IP_STR
10425 COMMUNITY_LIST_STR
10426 "Community list number (expanded)\n"
10427 "Specify community to reject\n"
10428 "Specify community to accept\n"
10429 "An ordered list as a regular-expression\n")
10430{
10431 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
10432}
10433
10434DEFUN (ip_community_list_name_standard,
10435 ip_community_list_name_standard_cmd,
10436 "ip community-list standard WORD (deny|permit) .AA:NN",
10437 IP_STR
10438 COMMUNITY_LIST_STR
10439 "Add a standard community-list entry\n"
10440 "Community list name\n"
10441 "Specify community to reject\n"
10442 "Specify community to accept\n"
10443 COMMUNITY_VAL_STR)
10444{
10445 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
10446}
10447
10448ALIAS (ip_community_list_name_standard,
10449 ip_community_list_name_standard2_cmd,
10450 "ip community-list standard WORD (deny|permit)",
10451 IP_STR
10452 COMMUNITY_LIST_STR
10453 "Add a standard community-list entry\n"
10454 "Community list name\n"
10455 "Specify community to reject\n"
10456 "Specify community to accept\n")
10457
10458DEFUN (ip_community_list_name_expanded,
10459 ip_community_list_name_expanded_cmd,
10460 "ip community-list expanded WORD (deny|permit) .LINE",
10461 IP_STR
10462 COMMUNITY_LIST_STR
10463 "Add an expanded community-list entry\n"
10464 "Community list name\n"
10465 "Specify community to reject\n"
10466 "Specify community to accept\n"
10467 "An ordered list as a regular-expression\n")
10468{
10469 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
10470}
10471
hassofee6e4e2005-02-02 16:29:31 +000010472DEFUN (no_ip_community_list_standard_all,
10473 no_ip_community_list_standard_all_cmd,
10474 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010475 NO_STR
10476 IP_STR
10477 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010478 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010479{
hassofee6e4e2005-02-02 16:29:31 +000010480 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010481}
10482
hassofee6e4e2005-02-02 16:29:31 +000010483DEFUN (no_ip_community_list_expanded_all,
10484 no_ip_community_list_expanded_all_cmd,
10485 "no ip community-list <100-500>",
10486 NO_STR
10487 IP_STR
10488 COMMUNITY_LIST_STR
10489 "Community list number (expanded)\n")
10490{
10491 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10492}
10493
10494DEFUN (no_ip_community_list_name_standard_all,
10495 no_ip_community_list_name_standard_all_cmd,
10496 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010497 NO_STR
10498 IP_STR
10499 COMMUNITY_LIST_STR
10500 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000010501 "Community list name\n")
10502{
hassofee6e4e2005-02-02 16:29:31 +000010503 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010504}
10505
hassofee6e4e2005-02-02 16:29:31 +000010506DEFUN (no_ip_community_list_name_expanded_all,
10507 no_ip_community_list_name_expanded_all_cmd,
10508 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000010509 NO_STR
10510 IP_STR
10511 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010512 "Add an expanded community-list entry\n"
10513 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000010514{
hassofee6e4e2005-02-02 16:29:31 +000010515 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010516}
10517
10518DEFUN (no_ip_community_list_standard,
10519 no_ip_community_list_standard_cmd,
10520 "no ip community-list <1-99> (deny|permit) .AA:NN",
10521 NO_STR
10522 IP_STR
10523 COMMUNITY_LIST_STR
10524 "Community list number (standard)\n"
10525 "Specify community to reject\n"
10526 "Specify community to accept\n"
10527 COMMUNITY_VAL_STR)
10528{
10529 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10530}
10531
10532DEFUN (no_ip_community_list_expanded,
10533 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010534 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010535 NO_STR
10536 IP_STR
10537 COMMUNITY_LIST_STR
10538 "Community list number (expanded)\n"
10539 "Specify community to reject\n"
10540 "Specify community to accept\n"
10541 "An ordered list as a regular-expression\n")
10542{
10543 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10544}
10545
10546DEFUN (no_ip_community_list_name_standard,
10547 no_ip_community_list_name_standard_cmd,
10548 "no ip community-list standard WORD (deny|permit) .AA:NN",
10549 NO_STR
10550 IP_STR
10551 COMMUNITY_LIST_STR
10552 "Specify a standard community-list\n"
10553 "Community list name\n"
10554 "Specify community to reject\n"
10555 "Specify community to accept\n"
10556 COMMUNITY_VAL_STR)
10557{
10558 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10559}
10560
10561DEFUN (no_ip_community_list_name_expanded,
10562 no_ip_community_list_name_expanded_cmd,
10563 "no ip community-list expanded WORD (deny|permit) .LINE",
10564 NO_STR
10565 IP_STR
10566 COMMUNITY_LIST_STR
10567 "Specify an expanded community-list\n"
10568 "Community list name\n"
10569 "Specify community to reject\n"
10570 "Specify community to accept\n"
10571 "An ordered list as a regular-expression\n")
10572{
10573 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10574}
10575
paul94f2b392005-06-28 12:44:16 +000010576static void
paul718e3742002-12-13 20:15:29 +000010577community_list_show (struct vty *vty, struct community_list *list)
10578{
10579 struct community_entry *entry;
10580
10581 for (entry = list->head; entry; entry = entry->next)
10582 {
10583 if (entry == list->head)
10584 {
10585 if (all_digit (list->name))
10586 vty_out (vty, "Community %s list %s%s",
10587 entry->style == COMMUNITY_LIST_STANDARD ?
10588 "standard" : "(expanded) access",
10589 list->name, VTY_NEWLINE);
10590 else
10591 vty_out (vty, "Named Community %s list %s%s",
10592 entry->style == COMMUNITY_LIST_STANDARD ?
10593 "standard" : "expanded",
10594 list->name, VTY_NEWLINE);
10595 }
10596 if (entry->any)
10597 vty_out (vty, " %s%s",
10598 community_direct_str (entry->direct), VTY_NEWLINE);
10599 else
10600 vty_out (vty, " %s %s%s",
10601 community_direct_str (entry->direct),
10602 entry->style == COMMUNITY_LIST_STANDARD
10603 ? community_str (entry->u.com) : entry->config,
10604 VTY_NEWLINE);
10605 }
10606}
10607
10608DEFUN (show_ip_community_list,
10609 show_ip_community_list_cmd,
10610 "show ip community-list",
10611 SHOW_STR
10612 IP_STR
10613 "List community-list\n")
10614{
10615 struct community_list *list;
10616 struct community_list_master *cm;
10617
hassofee6e4e2005-02-02 16:29:31 +000010618 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010619 if (! cm)
10620 return CMD_SUCCESS;
10621
10622 for (list = cm->num.head; list; list = list->next)
10623 community_list_show (vty, list);
10624
10625 for (list = cm->str.head; list; list = list->next)
10626 community_list_show (vty, list);
10627
10628 return CMD_SUCCESS;
10629}
10630
10631DEFUN (show_ip_community_list_arg,
10632 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010633 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010634 SHOW_STR
10635 IP_STR
10636 "List community-list\n"
10637 "Community-list number\n"
10638 "Community-list name\n")
10639{
10640 struct community_list *list;
10641
hassofee6e4e2005-02-02 16:29:31 +000010642 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010643 if (! list)
10644 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030010645 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010646 return CMD_WARNING;
10647 }
10648
10649 community_list_show (vty, list);
10650
10651 return CMD_SUCCESS;
10652}
David Lamparter6b0655a2014-06-04 06:53:35 +020010653
paul94f2b392005-06-28 12:44:16 +000010654static int
paulfd79ac92004-10-13 05:06:08 +000010655extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
10656 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010657{
10658 int ret;
10659 int direct;
10660 char *str;
10661
10662 /* Check the list type. */
10663 if (strncmp (argv[1], "p", 1) == 0)
10664 direct = COMMUNITY_PERMIT;
10665 else if (strncmp (argv[1], "d", 1) == 0)
10666 direct = COMMUNITY_DENY;
10667 else
10668 {
10669 vty_out (vty, "%% Matching condition must be permit or deny%s",
10670 VTY_NEWLINE);
10671 return CMD_WARNING;
10672 }
10673
10674 /* All digit name check. */
10675 if (reject_all_digit_name && all_digit (argv[0]))
10676 {
10677 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10678 return CMD_WARNING;
10679 }
10680
10681 /* Concat community string argument. */
10682 if (argc > 1)
10683 str = argv_concat (argv, argc, 2);
10684 else
10685 str = NULL;
10686
10687 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
10688
10689 /* Free temporary community list string allocated by
10690 argv_concat(). */
10691 if (str)
10692 XFREE (MTYPE_TMP, str);
10693
10694 if (ret < 0)
10695 {
10696 community_list_perror (vty, ret);
10697 return CMD_WARNING;
10698 }
10699 return CMD_SUCCESS;
10700}
10701
paul94f2b392005-06-28 12:44:16 +000010702static int
hassofee6e4e2005-02-02 16:29:31 +000010703extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
10704 int style)
paul718e3742002-12-13 20:15:29 +000010705{
10706 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010707 int direct = 0;
10708 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010709
hassofee6e4e2005-02-02 16:29:31 +000010710 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010711 {
hassofee6e4e2005-02-02 16:29:31 +000010712 /* Check the list direct. */
10713 if (strncmp (argv[1], "p", 1) == 0)
10714 direct = COMMUNITY_PERMIT;
10715 else if (strncmp (argv[1], "d", 1) == 0)
10716 direct = COMMUNITY_DENY;
10717 else
10718 {
10719 vty_out (vty, "%% Matching condition must be permit or deny%s",
10720 VTY_NEWLINE);
10721 return CMD_WARNING;
10722 }
10723
10724 /* Concat community string argument. */
10725 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000010726 }
paul718e3742002-12-13 20:15:29 +000010727
10728 /* Unset community list. */
10729 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
10730
10731 /* Free temporary community list string allocated by
10732 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010733 if (str)
10734 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010735
10736 if (ret < 0)
10737 {
10738 community_list_perror (vty, ret);
10739 return CMD_WARNING;
10740 }
10741
10742 return CMD_SUCCESS;
10743}
10744
10745/* "extcommunity-list" keyword help string. */
10746#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
10747#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
10748
10749DEFUN (ip_extcommunity_list_standard,
10750 ip_extcommunity_list_standard_cmd,
10751 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10752 IP_STR
10753 EXTCOMMUNITY_LIST_STR
10754 "Extended Community list number (standard)\n"
10755 "Specify community to reject\n"
10756 "Specify community to accept\n"
10757 EXTCOMMUNITY_VAL_STR)
10758{
10759 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
10760}
10761
10762ALIAS (ip_extcommunity_list_standard,
10763 ip_extcommunity_list_standard2_cmd,
10764 "ip extcommunity-list <1-99> (deny|permit)",
10765 IP_STR
10766 EXTCOMMUNITY_LIST_STR
10767 "Extended Community list number (standard)\n"
10768 "Specify community to reject\n"
10769 "Specify community to accept\n")
10770
10771DEFUN (ip_extcommunity_list_expanded,
10772 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010773 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010774 IP_STR
10775 EXTCOMMUNITY_LIST_STR
10776 "Extended Community list number (expanded)\n"
10777 "Specify community to reject\n"
10778 "Specify community to accept\n"
10779 "An ordered list as a regular-expression\n")
10780{
10781 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
10782}
10783
10784DEFUN (ip_extcommunity_list_name_standard,
10785 ip_extcommunity_list_name_standard_cmd,
10786 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10787 IP_STR
10788 EXTCOMMUNITY_LIST_STR
10789 "Specify standard extcommunity-list\n"
10790 "Extended Community list name\n"
10791 "Specify community to reject\n"
10792 "Specify community to accept\n"
10793 EXTCOMMUNITY_VAL_STR)
10794{
10795 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
10796}
10797
10798ALIAS (ip_extcommunity_list_name_standard,
10799 ip_extcommunity_list_name_standard2_cmd,
10800 "ip extcommunity-list standard WORD (deny|permit)",
10801 IP_STR
10802 EXTCOMMUNITY_LIST_STR
10803 "Specify standard extcommunity-list\n"
10804 "Extended Community list name\n"
10805 "Specify community to reject\n"
10806 "Specify community to accept\n")
10807
10808DEFUN (ip_extcommunity_list_name_expanded,
10809 ip_extcommunity_list_name_expanded_cmd,
10810 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
10811 IP_STR
10812 EXTCOMMUNITY_LIST_STR
10813 "Specify expanded extcommunity-list\n"
10814 "Extended Community list name\n"
10815 "Specify community to reject\n"
10816 "Specify community to accept\n"
10817 "An ordered list as a regular-expression\n")
10818{
10819 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
10820}
10821
hassofee6e4e2005-02-02 16:29:31 +000010822DEFUN (no_ip_extcommunity_list_standard_all,
10823 no_ip_extcommunity_list_standard_all_cmd,
10824 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010825 NO_STR
10826 IP_STR
10827 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010828 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010829{
hassofee6e4e2005-02-02 16:29:31 +000010830 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010831}
10832
hassofee6e4e2005-02-02 16:29:31 +000010833DEFUN (no_ip_extcommunity_list_expanded_all,
10834 no_ip_extcommunity_list_expanded_all_cmd,
10835 "no ip extcommunity-list <100-500>",
10836 NO_STR
10837 IP_STR
10838 EXTCOMMUNITY_LIST_STR
10839 "Extended Community list number (expanded)\n")
10840{
10841 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10842}
10843
10844DEFUN (no_ip_extcommunity_list_name_standard_all,
10845 no_ip_extcommunity_list_name_standard_all_cmd,
10846 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010847 NO_STR
10848 IP_STR
10849 EXTCOMMUNITY_LIST_STR
10850 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000010851 "Extended Community list name\n")
10852{
10853 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10854}
10855
10856DEFUN (no_ip_extcommunity_list_name_expanded_all,
10857 no_ip_extcommunity_list_name_expanded_all_cmd,
10858 "no ip extcommunity-list expanded WORD",
10859 NO_STR
10860 IP_STR
10861 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000010862 "Specify expanded extcommunity-list\n"
10863 "Extended Community list name\n")
10864{
hassofee6e4e2005-02-02 16:29:31 +000010865 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010866}
10867
10868DEFUN (no_ip_extcommunity_list_standard,
10869 no_ip_extcommunity_list_standard_cmd,
10870 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10871 NO_STR
10872 IP_STR
10873 EXTCOMMUNITY_LIST_STR
10874 "Extended Community list number (standard)\n"
10875 "Specify community to reject\n"
10876 "Specify community to accept\n"
10877 EXTCOMMUNITY_VAL_STR)
10878{
10879 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10880}
10881
10882DEFUN (no_ip_extcommunity_list_expanded,
10883 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010884 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010885 NO_STR
10886 IP_STR
10887 EXTCOMMUNITY_LIST_STR
10888 "Extended Community list number (expanded)\n"
10889 "Specify community to reject\n"
10890 "Specify community to accept\n"
10891 "An ordered list as a regular-expression\n")
10892{
10893 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10894}
10895
10896DEFUN (no_ip_extcommunity_list_name_standard,
10897 no_ip_extcommunity_list_name_standard_cmd,
10898 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10899 NO_STR
10900 IP_STR
10901 EXTCOMMUNITY_LIST_STR
10902 "Specify standard extcommunity-list\n"
10903 "Extended Community list name\n"
10904 "Specify community to reject\n"
10905 "Specify community to accept\n"
10906 EXTCOMMUNITY_VAL_STR)
10907{
10908 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10909}
10910
10911DEFUN (no_ip_extcommunity_list_name_expanded,
10912 no_ip_extcommunity_list_name_expanded_cmd,
10913 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
10914 NO_STR
10915 IP_STR
10916 EXTCOMMUNITY_LIST_STR
10917 "Specify expanded extcommunity-list\n"
10918 "Community list name\n"
10919 "Specify community to reject\n"
10920 "Specify community to accept\n"
10921 "An ordered list as a regular-expression\n")
10922{
10923 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10924}
10925
paul94f2b392005-06-28 12:44:16 +000010926static void
paul718e3742002-12-13 20:15:29 +000010927extcommunity_list_show (struct vty *vty, struct community_list *list)
10928{
10929 struct community_entry *entry;
10930
10931 for (entry = list->head; entry; entry = entry->next)
10932 {
10933 if (entry == list->head)
10934 {
10935 if (all_digit (list->name))
10936 vty_out (vty, "Extended community %s list %s%s",
10937 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10938 "standard" : "(expanded) access",
10939 list->name, VTY_NEWLINE);
10940 else
10941 vty_out (vty, "Named extended community %s list %s%s",
10942 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10943 "standard" : "expanded",
10944 list->name, VTY_NEWLINE);
10945 }
10946 if (entry->any)
10947 vty_out (vty, " %s%s",
10948 community_direct_str (entry->direct), VTY_NEWLINE);
10949 else
10950 vty_out (vty, " %s %s%s",
10951 community_direct_str (entry->direct),
10952 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10953 entry->u.ecom->str : entry->config,
10954 VTY_NEWLINE);
10955 }
10956}
10957
10958DEFUN (show_ip_extcommunity_list,
10959 show_ip_extcommunity_list_cmd,
10960 "show ip extcommunity-list",
10961 SHOW_STR
10962 IP_STR
10963 "List extended-community list\n")
10964{
10965 struct community_list *list;
10966 struct community_list_master *cm;
10967
hassofee6e4e2005-02-02 16:29:31 +000010968 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010969 if (! cm)
10970 return CMD_SUCCESS;
10971
10972 for (list = cm->num.head; list; list = list->next)
10973 extcommunity_list_show (vty, list);
10974
10975 for (list = cm->str.head; list; list = list->next)
10976 extcommunity_list_show (vty, list);
10977
10978 return CMD_SUCCESS;
10979}
10980
10981DEFUN (show_ip_extcommunity_list_arg,
10982 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010983 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010984 SHOW_STR
10985 IP_STR
10986 "List extended-community list\n"
10987 "Extcommunity-list number\n"
10988 "Extcommunity-list name\n")
10989{
10990 struct community_list *list;
10991
hassofee6e4e2005-02-02 16:29:31 +000010992 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010993 if (! list)
10994 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030010995 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010996 return CMD_WARNING;
10997 }
10998
10999 extcommunity_list_show (vty, list);
11000
11001 return CMD_SUCCESS;
11002}
David Lamparter6b0655a2014-06-04 06:53:35 +020011003
paul718e3742002-12-13 20:15:29 +000011004/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000011005static const char *
paul718e3742002-12-13 20:15:29 +000011006community_list_config_str (struct community_entry *entry)
11007{
paulfd79ac92004-10-13 05:06:08 +000011008 const char *str;
paul718e3742002-12-13 20:15:29 +000011009
11010 if (entry->any)
11011 str = "";
11012 else
11013 {
11014 if (entry->style == COMMUNITY_LIST_STANDARD)
11015 str = community_str (entry->u.com);
11016 else
11017 str = entry->config;
11018 }
11019 return str;
11020}
11021
11022/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000011023static int
paul718e3742002-12-13 20:15:29 +000011024community_list_config_write (struct vty *vty)
11025{
11026 struct community_list *list;
11027 struct community_entry *entry;
11028 struct community_list_master *cm;
11029 int write = 0;
11030
11031 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000011032 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011033
11034 for (list = cm->num.head; list; list = list->next)
11035 for (entry = list->head; entry; entry = entry->next)
11036 {
hassofee6e4e2005-02-02 16:29:31 +000011037 vty_out (vty, "ip community-list %s %s %s%s",
11038 list->name, community_direct_str (entry->direct),
11039 community_list_config_str (entry),
11040 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011041 write++;
11042 }
11043 for (list = cm->str.head; list; list = list->next)
11044 for (entry = list->head; entry; entry = entry->next)
11045 {
11046 vty_out (vty, "ip community-list %s %s %s %s%s",
11047 entry->style == COMMUNITY_LIST_STANDARD
11048 ? "standard" : "expanded",
11049 list->name, community_direct_str (entry->direct),
11050 community_list_config_str (entry),
11051 VTY_NEWLINE);
11052 write++;
11053 }
11054
11055 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000011056 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011057
11058 for (list = cm->num.head; list; list = list->next)
11059 for (entry = list->head; entry; entry = entry->next)
11060 {
hassofee6e4e2005-02-02 16:29:31 +000011061 vty_out (vty, "ip extcommunity-list %s %s %s%s",
11062 list->name, community_direct_str (entry->direct),
11063 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011064 write++;
11065 }
11066 for (list = cm->str.head; list; list = list->next)
11067 for (entry = list->head; entry; entry = entry->next)
11068 {
11069 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
11070 entry->style == EXTCOMMUNITY_LIST_STANDARD
11071 ? "standard" : "expanded",
11072 list->name, community_direct_str (entry->direct),
11073 community_list_config_str (entry), VTY_NEWLINE);
11074 write++;
11075 }
11076 return write;
11077}
11078
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080011079static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000011080{
11081 COMMUNITY_LIST_NODE,
11082 "",
11083 1 /* Export to vtysh. */
11084};
11085
paul94f2b392005-06-28 12:44:16 +000011086static void
11087community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000011088{
11089 install_node (&community_list_node, community_list_config_write);
11090
11091 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000011092 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
11093 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
11094 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
11095 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
11096 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
11097 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011098 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
11099 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
11100 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
11101 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011102 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
11103 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
11104 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
11105 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
11106 install_element (VIEW_NODE, &show_ip_community_list_cmd);
11107 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
11108 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
11109 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
11110
11111 /* Extcommunity-list. */
11112 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
11113 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
11114 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
11115 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
11116 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
11117 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011118 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
11119 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
11120 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
11121 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011122 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
11123 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
11124 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
11125 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
11126 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
11127 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
11128 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
11129 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
11130}