blob: e0f1c2b414d73e78eda9c4a6ff812a5bdbc9b40c [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"
Donald Sharp04907292016-01-07 10:03:01 -050033#include "filter.h"
paul718e3742002-12-13 20:15:29 +000034
35#include "bgpd/bgpd.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000036#include "bgpd/bgp_advertise.h"
paul718e3742002-12-13 20:15:29 +000037#include "bgpd/bgp_attr.h"
38#include "bgpd/bgp_aspath.h"
39#include "bgpd/bgp_community.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000040#include "bgpd/bgp_ecommunity.h"
41#include "bgpd/bgp_damp.h"
paul718e3742002-12-13 20:15:29 +000042#include "bgpd/bgp_debug.h"
hassoe0701b72004-05-20 09:19:34 +000043#include "bgpd/bgp_fsm.h"
paul718e3742002-12-13 20:15:29 +000044#include "bgpd/bgp_mplsvpn.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000045#include "bgpd/bgp_nexthop.h"
paul718e3742002-12-13 20:15:29 +000046#include "bgpd/bgp_open.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000047#include "bgpd/bgp_regex.h"
paul718e3742002-12-13 20:15:29 +000048#include "bgpd/bgp_route.h"
49#include "bgpd/bgp_zebra.h"
paulfee0f4c2004-09-13 05:12:46 +000050#include "bgpd/bgp_table.h"
paul94f2b392005-06-28 12:44:16 +000051#include "bgpd/bgp_vty.h"
Josh Bailey165b5ff2011-07-20 20:43:22 -070052#include "bgpd/bgp_mpath.h"
paul718e3742002-12-13 20:15:29 +000053
hasso18a6dce2004-10-03 18:18:34 +000054extern struct in_addr router_id_zebra;
55
paul718e3742002-12-13 20:15:29 +000056/* Utility function to get address family from current node. */
57afi_t
58bgp_node_afi (struct vty *vty)
59{
Lou Berger13c378d2016-01-12 13:41:56 -050060 switch (vty->node)
61 {
62 case BGP_IPV6_NODE:
63 case BGP_IPV6M_NODE:
64 case BGP_VPNV6_NODE:
65 return AFI_IP6;
66 break;
67 }
68
paul718e3742002-12-13 20:15:29 +000069 return AFI_IP;
70}
71
72/* Utility function to get subsequent address family from current
73 node. */
74safi_t
75bgp_node_safi (struct vty *vty)
76{
Lou Berger13c378d2016-01-12 13:41:56 -050077 if (vty->node == BGP_VPNV6_NODE)
78 return SAFI_MPLS_VPN;
paul718e3742002-12-13 20:15:29 +000079 if (vty->node == BGP_VPNV4_NODE)
80 return SAFI_MPLS_VPN;
paul25ffbdc2005-08-22 22:42:08 +000081 if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +000082 return SAFI_MULTICAST;
83 return SAFI_UNICAST;
84}
85
paul94f2b392005-06-28 12:44:16 +000086static int
paul718e3742002-12-13 20:15:29 +000087peer_address_self_check (union sockunion *su)
88{
89 struct interface *ifp = NULL;
90
91 if (su->sa.sa_family == AF_INET)
92 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
93#ifdef HAVE_IPV6
94 else if (su->sa.sa_family == AF_INET6)
95 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
96#endif /* HAVE IPV6 */
97
98 if (ifp)
99 return 1;
100
101 return 0;
102}
103
104/* Utility function for looking up peer from VTY. */
paul94f2b392005-06-28 12:44:16 +0000105static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000106peer_lookup_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +0000107{
108 int ret;
109 struct bgp *bgp;
110 union sockunion su;
111 struct peer *peer;
112
113 bgp = vty->index;
114
115 ret = str2sockunion (ip_str, &su);
116 if (ret < 0)
117 {
118 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
119 return NULL;
120 }
121
122 peer = peer_lookup (bgp, &su);
123 if (! peer)
124 {
125 vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
126 return NULL;
127 }
128 return peer;
129}
130
131/* Utility function for looking up peer or peer group. */
paul94f2b392005-06-28 12:44:16 +0000132static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000133peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
paul718e3742002-12-13 20:15:29 +0000134{
135 int ret;
136 struct bgp *bgp;
137 union sockunion su;
138 struct peer *peer;
139 struct peer_group *group;
140
141 bgp = vty->index;
142
143 ret = str2sockunion (peer_str, &su);
144 if (ret == 0)
145 {
146 peer = peer_lookup (bgp, &su);
147 if (peer)
148 return peer;
149 }
150 else
151 {
152 group = peer_group_lookup (bgp, peer_str);
153 if (group)
154 return group->conf;
155 }
156
157 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
158 VTY_NEWLINE);
159
160 return NULL;
161}
162
paul94f2b392005-06-28 12:44:16 +0000163static int
paul718e3742002-12-13 20:15:29 +0000164bgp_vty_return (struct vty *vty, int ret)
165{
paulfd79ac92004-10-13 05:06:08 +0000166 const char *str = NULL;
paul718e3742002-12-13 20:15:29 +0000167
168 switch (ret)
169 {
170 case BGP_ERR_INVALID_VALUE:
171 str = "Invalid value";
172 break;
173 case BGP_ERR_INVALID_FLAG:
174 str = "Invalid flag";
175 break;
176 case BGP_ERR_PEER_INACTIVE:
177 str = "Activate the neighbor for the address family first";
178 break;
179 case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
180 str = "Invalid command for a peer-group member";
181 break;
182 case BGP_ERR_PEER_GROUP_SHUTDOWN:
183 str = "Peer-group has been shutdown. Activate the peer-group first";
184 break;
185 case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
186 str = "This peer is a peer-group member. Please change peer-group configuration";
187 break;
188 case BGP_ERR_PEER_FLAG_CONFLICT:
189 str = "Can't set override-capability and strict-capability-match at the same time";
190 break;
191 case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
192 str = "No activate for peergroup can be given only if peer-group has no members";
193 break;
194 case BGP_ERR_PEER_BELONGS_TO_GROUP:
195 str = "No activate for an individual peer-group member is invalid";
196 break;
197 case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
198 str = "Activate the peer-group for the address family first";
199 break;
200 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
201 str = "Specify remote-as or peer-group remote AS first";
202 break;
203 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
204 str = "Cannot change the peer-group. Deconfigure first";
205 break;
206 case BGP_ERR_PEER_GROUP_MISMATCH:
207 str = "Cannot have different peer-group for the neighbor";
208 break;
209 case BGP_ERR_PEER_FILTER_CONFLICT:
210 str = "Prefix/distribute list can not co-exist";
211 break;
212 case BGP_ERR_NOT_INTERNAL_PEER:
213 str = "Invalid command. Not an internal neighbor";
214 break;
215 case BGP_ERR_REMOVE_PRIVATE_AS:
216 str = "Private AS cannot be removed for IBGP peers";
217 break;
218 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
219 str = "Local-AS allowed only for EBGP peers";
220 break;
221 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
222 str = "Cannot have local-as same as BGP AS number";
223 break;
Paul Jakma0df7c912008-07-21 21:02:49 +0000224 case BGP_ERR_TCPSIG_FAILED:
225 str = "Error while applying TCP-Sig to session(s)";
226 break;
Nick Hilliardfa411a22011-03-23 15:33:17 +0000227 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
228 str = "ebgp-multihop and ttl-security cannot be configured together";
229 break;
Stephen Hemmingerf5a48272011-03-24 17:30:21 +0000230 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
231 str = "ttl-security only allowed for EBGP peers";
232 break;
paul718e3742002-12-13 20:15:29 +0000233 }
234 if (str)
235 {
236 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
237 return CMD_WARNING;
238 }
239 return CMD_SUCCESS;
240}
241
242/* BGP global configuration. */
243
244DEFUN (bgp_multiple_instance_func,
245 bgp_multiple_instance_cmd,
246 "bgp multiple-instance",
247 BGP_STR
248 "Enable bgp multiple instance\n")
249{
250 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
251 return CMD_SUCCESS;
252}
253
254DEFUN (no_bgp_multiple_instance,
255 no_bgp_multiple_instance_cmd,
256 "no bgp multiple-instance",
257 NO_STR
258 BGP_STR
259 "BGP multiple instance\n")
260{
261 int ret;
262
263 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
264 if (ret < 0)
265 {
266 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
267 return CMD_WARNING;
268 }
269 return CMD_SUCCESS;
270}
271
272DEFUN (bgp_config_type,
273 bgp_config_type_cmd,
274 "bgp config-type (cisco|zebra)",
275 BGP_STR
276 "Configuration type\n"
277 "cisco\n"
278 "zebra\n")
279{
280 if (strncmp (argv[0], "c", 1) == 0)
281 bgp_option_set (BGP_OPT_CONFIG_CISCO);
282 else
283 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
284
285 return CMD_SUCCESS;
286}
287
288DEFUN (no_bgp_config_type,
289 no_bgp_config_type_cmd,
290 "no bgp config-type",
291 NO_STR
292 BGP_STR
293 "Display configuration type\n")
294{
295 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
296 return CMD_SUCCESS;
297}
298
299DEFUN (no_synchronization,
300 no_synchronization_cmd,
301 "no synchronization",
302 NO_STR
303 "Perform IGP synchronization\n")
304{
305 return CMD_SUCCESS;
306}
307
308DEFUN (no_auto_summary,
309 no_auto_summary_cmd,
310 "no auto-summary",
311 NO_STR
312 "Enable automatic network number summarization\n")
313{
314 return CMD_SUCCESS;
315}
hasso3d515fd2005-02-01 21:30:04 +0000316
317DEFUN_DEPRECATED (neighbor_version,
318 neighbor_version_cmd,
319 NEIGHBOR_CMD "version (4|4-)",
320 NEIGHBOR_STR
321 NEIGHBOR_ADDR_STR
322 "Set the BGP version to match a neighbor\n"
323 "Neighbor's BGP version\n")
324{
325 return CMD_SUCCESS;
326}
David Lamparter6b0655a2014-06-04 06:53:35 +0200327
paul718e3742002-12-13 20:15:29 +0000328/* "router bgp" commands. */
329DEFUN (router_bgp,
330 router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000331 "router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000332 ROUTER_STR
333 BGP_STR
334 AS_STR)
335{
336 int ret;
337 as_t as;
338 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000339 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000340
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000341 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000342
343 if (argc == 2)
344 name = argv[1];
345
346 ret = bgp_get (&bgp, &as, name);
347 switch (ret)
348 {
349 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
350 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
351 VTY_NEWLINE);
352 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000353 case BGP_ERR_AS_MISMATCH:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400354 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000355 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000356 case BGP_ERR_INSTANCE_MISMATCH:
357 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400358 vty_out (vty, "BGP instance is already running; AS is %u%s",
paul718e3742002-12-13 20:15:29 +0000359 as, VTY_NEWLINE);
360 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000361 }
362
363 vty->node = BGP_NODE;
364 vty->index = bgp;
365
366 return CMD_SUCCESS;
367}
368
369ALIAS (router_bgp,
370 router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000371 "router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000372 ROUTER_STR
373 BGP_STR
374 AS_STR
375 "BGP view\n"
376 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200377
paul718e3742002-12-13 20:15:29 +0000378/* "no router bgp" commands. */
379DEFUN (no_router_bgp,
380 no_router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000381 "no router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000382 NO_STR
383 ROUTER_STR
384 BGP_STR
385 AS_STR)
386{
387 as_t as;
388 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000389 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000390
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000391 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000392
393 if (argc == 2)
394 name = argv[1];
395
396 /* Lookup bgp structure. */
397 bgp = bgp_lookup (as, name);
398 if (! bgp)
399 {
400 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
401 return CMD_WARNING;
402 }
403
404 bgp_delete (bgp);
405
406 return CMD_SUCCESS;
407}
408
409ALIAS (no_router_bgp,
410 no_router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000411 "no router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000412 NO_STR
413 ROUTER_STR
414 BGP_STR
415 AS_STR
416 "BGP view\n"
417 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200418
paul718e3742002-12-13 20:15:29 +0000419/* BGP router-id. */
420
421DEFUN (bgp_router_id,
422 bgp_router_id_cmd,
423 "bgp router-id A.B.C.D",
424 BGP_STR
425 "Override configured router identifier\n"
426 "Manually configured router identifier\n")
427{
428 int ret;
429 struct in_addr id;
430 struct bgp *bgp;
431
432 bgp = vty->index;
433
434 ret = inet_aton (argv[0], &id);
435 if (! ret)
436 {
437 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
438 return CMD_WARNING;
439 }
440
hasso18a6dce2004-10-03 18:18:34 +0000441 bgp->router_id_static = id;
paul718e3742002-12-13 20:15:29 +0000442 bgp_router_id_set (bgp, &id);
443
444 return CMD_SUCCESS;
445}
446
447DEFUN (no_bgp_router_id,
448 no_bgp_router_id_cmd,
449 "no bgp router-id",
450 NO_STR
451 BGP_STR
452 "Override configured router identifier\n")
453{
454 int ret;
455 struct in_addr id;
456 struct bgp *bgp;
457
458 bgp = vty->index;
459
460 if (argc == 1)
461 {
462 ret = inet_aton (argv[0], &id);
463 if (! ret)
464 {
465 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
466 return CMD_WARNING;
467 }
468
hasso18a6dce2004-10-03 18:18:34 +0000469 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
paul718e3742002-12-13 20:15:29 +0000470 {
471 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
472 return CMD_WARNING;
473 }
474 }
475
hasso18a6dce2004-10-03 18:18:34 +0000476 bgp->router_id_static.s_addr = 0;
477 bgp_router_id_set (bgp, &router_id_zebra);
paul718e3742002-12-13 20:15:29 +0000478
479 return CMD_SUCCESS;
480}
481
482ALIAS (no_bgp_router_id,
483 no_bgp_router_id_val_cmd,
484 "no bgp router-id A.B.C.D",
485 NO_STR
486 BGP_STR
487 "Override configured router identifier\n"
488 "Manually configured router identifier\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200489
paul718e3742002-12-13 20:15:29 +0000490/* BGP Cluster ID. */
491
492DEFUN (bgp_cluster_id,
493 bgp_cluster_id_cmd,
494 "bgp cluster-id A.B.C.D",
495 BGP_STR
496 "Configure Route-Reflector Cluster-id\n"
497 "Route-Reflector Cluster-id in IP address format\n")
498{
499 int ret;
500 struct bgp *bgp;
501 struct in_addr cluster;
502
503 bgp = vty->index;
504
505 ret = inet_aton (argv[0], &cluster);
506 if (! ret)
507 {
508 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
509 return CMD_WARNING;
510 }
511
512 bgp_cluster_id_set (bgp, &cluster);
513
514 return CMD_SUCCESS;
515}
516
517ALIAS (bgp_cluster_id,
518 bgp_cluster_id32_cmd,
519 "bgp cluster-id <1-4294967295>",
520 BGP_STR
521 "Configure Route-Reflector Cluster-id\n"
522 "Route-Reflector Cluster-id as 32 bit quantity\n")
523
524DEFUN (no_bgp_cluster_id,
525 no_bgp_cluster_id_cmd,
526 "no bgp cluster-id",
527 NO_STR
528 BGP_STR
529 "Configure Route-Reflector Cluster-id\n")
530{
531 int ret;
532 struct bgp *bgp;
533 struct in_addr cluster;
534
535 bgp = vty->index;
536
537 if (argc == 1)
538 {
539 ret = inet_aton (argv[0], &cluster);
540 if (! ret)
541 {
542 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
543 return CMD_WARNING;
544 }
545 }
546
547 bgp_cluster_id_unset (bgp);
548
549 return CMD_SUCCESS;
550}
551
552ALIAS (no_bgp_cluster_id,
553 no_bgp_cluster_id_arg_cmd,
554 "no bgp cluster-id A.B.C.D",
555 NO_STR
556 BGP_STR
557 "Configure Route-Reflector Cluster-id\n"
558 "Route-Reflector Cluster-id in IP address format\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200559
paul718e3742002-12-13 20:15:29 +0000560DEFUN (bgp_confederation_identifier,
561 bgp_confederation_identifier_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000562 "bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000563 "BGP specific commands\n"
564 "AS confederation parameters\n"
565 "AS number\n"
566 "Set routing domain confederation AS\n")
567{
568 struct bgp *bgp;
569 as_t as;
570
571 bgp = vty->index;
572
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000573 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000574
575 bgp_confederation_id_set (bgp, as);
576
577 return CMD_SUCCESS;
578}
579
580DEFUN (no_bgp_confederation_identifier,
581 no_bgp_confederation_identifier_cmd,
582 "no bgp confederation identifier",
583 NO_STR
584 "BGP specific commands\n"
585 "AS confederation parameters\n"
586 "AS number\n")
587{
588 struct bgp *bgp;
Paul Jakma7aa9dce2014-09-19 14:42:23 +0100589 as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */
paul718e3742002-12-13 20:15:29 +0000590
591 bgp = vty->index;
592
593 if (argc == 1)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000594 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000595
596 bgp_confederation_id_unset (bgp);
597
598 return CMD_SUCCESS;
599}
600
601ALIAS (no_bgp_confederation_identifier,
602 no_bgp_confederation_identifier_arg_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000603 "no bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000604 NO_STR
605 "BGP specific commands\n"
606 "AS confederation parameters\n"
607 "AS number\n"
608 "Set routing domain confederation AS\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200609
paul718e3742002-12-13 20:15:29 +0000610DEFUN (bgp_confederation_peers,
611 bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000612 "bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000613 "BGP specific commands\n"
614 "AS confederation parameters\n"
615 "Peer ASs in BGP confederation\n"
616 AS_STR)
617{
618 struct bgp *bgp;
619 as_t as;
620 int i;
621
622 bgp = vty->index;
623
624 for (i = 0; i < argc; i++)
625 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000626 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000627
628 if (bgp->as == as)
629 {
630 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
631 VTY_NEWLINE);
632 continue;
633 }
634
635 bgp_confederation_peers_add (bgp, as);
636 }
637 return CMD_SUCCESS;
638}
639
640DEFUN (no_bgp_confederation_peers,
641 no_bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000642 "no bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000643 NO_STR
644 "BGP specific commands\n"
645 "AS confederation parameters\n"
646 "Peer ASs in BGP confederation\n"
647 AS_STR)
648{
649 struct bgp *bgp;
650 as_t as;
651 int i;
652
653 bgp = vty->index;
654
655 for (i = 0; i < argc; i++)
656 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000657 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
658
paul718e3742002-12-13 20:15:29 +0000659 bgp_confederation_peers_remove (bgp, as);
660 }
661 return CMD_SUCCESS;
662}
David Lamparter6b0655a2014-06-04 06:53:35 +0200663
Josh Bailey165b5ff2011-07-20 20:43:22 -0700664/* Maximum-paths configuration */
665DEFUN (bgp_maxpaths,
666 bgp_maxpaths_cmd,
667 "maximum-paths <1-255>",
668 "Forward packets over multiple paths\n"
669 "Number of paths\n")
670{
671 struct bgp *bgp;
672 u_int16_t maxpaths;
673 int ret;
674
675 bgp = vty->index;
676
677 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
678
679 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
680 BGP_PEER_EBGP, maxpaths);
681 if (ret < 0)
682 {
683 vty_out (vty,
684 "%% Failed to set maximum-paths %u for afi %u, safi %u%s",
685 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
686 return CMD_WARNING;
687 }
688
Donald Sharp58a83f22015-09-11 10:11:42 -0400689 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
690 vty_out (vty,
691 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
692 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
693
Josh Bailey165b5ff2011-07-20 20:43:22 -0700694 return CMD_SUCCESS;
695}
696
697DEFUN (bgp_maxpaths_ibgp,
698 bgp_maxpaths_ibgp_cmd,
699 "maximum-paths ibgp <1-255>",
700 "Forward packets over multiple paths\n"
701 "iBGP-multipath\n"
702 "Number of paths\n")
703{
704 struct bgp *bgp;
705 u_int16_t maxpaths;
706 int ret;
707
708 bgp = vty->index;
709
710 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
711
712 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
713 BGP_PEER_IBGP, maxpaths);
714 if (ret < 0)
715 {
716 vty_out (vty,
717 "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
718 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
719 return CMD_WARNING;
720 }
721
Donald Sharp58a83f22015-09-11 10:11:42 -0400722 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
723 vty_out (vty,
724 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
725 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
726
Josh Bailey165b5ff2011-07-20 20:43:22 -0700727 return CMD_SUCCESS;
728}
729
730DEFUN (no_bgp_maxpaths,
731 no_bgp_maxpaths_cmd,
732 "no maximum-paths",
733 NO_STR
734 "Forward packets over multiple paths\n"
735 "Number of paths\n")
736{
737 struct bgp *bgp;
738 int ret;
739
740 bgp = vty->index;
741
742 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
743 BGP_PEER_EBGP);
744 if (ret < 0)
745 {
746 vty_out (vty,
747 "%% Failed to unset maximum-paths for afi %u, safi %u%s",
748 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
749 return CMD_WARNING;
750 }
751
752 return CMD_SUCCESS;
753}
754
755ALIAS (no_bgp_maxpaths,
756 no_bgp_maxpaths_arg_cmd,
757 "no maximum-paths <1-255>",
758 NO_STR
759 "Forward packets over multiple paths\n"
760 "Number of paths\n")
761
762DEFUN (no_bgp_maxpaths_ibgp,
763 no_bgp_maxpaths_ibgp_cmd,
764 "no maximum-paths ibgp",
765 NO_STR
766 "Forward packets over multiple paths\n"
767 "iBGP-multipath\n"
768 "Number of paths\n")
769{
770 struct bgp *bgp;
771 int ret;
772
773 bgp = vty->index;
774
775 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
776 BGP_PEER_IBGP);
777 if (ret < 0)
778 {
779 vty_out (vty,
780 "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
781 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
782 return CMD_WARNING;
783 }
784
785 return CMD_SUCCESS;
786}
787
788ALIAS (no_bgp_maxpaths_ibgp,
789 no_bgp_maxpaths_ibgp_arg_cmd,
790 "no maximum-paths ibgp <1-255>",
791 NO_STR
792 "Forward packets over multiple paths\n"
793 "iBGP-multipath\n"
794 "Number of paths\n")
795
796int
797bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
798 safi_t safi, int *write)
799{
800 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
801 {
802 bgp_config_write_family_header (vty, afi, safi, write);
803 vty_out (vty, " maximum-paths %d%s",
804 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
805 }
806
807 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
808 {
809 bgp_config_write_family_header (vty, afi, safi, write);
810 vty_out (vty, " maximum-paths ibgp %d%s",
811 bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
812 }
813
814 return 0;
815}
David Lamparter6b0655a2014-06-04 06:53:35 +0200816
paul718e3742002-12-13 20:15:29 +0000817/* BGP timers. */
818
819DEFUN (bgp_timers,
820 bgp_timers_cmd,
821 "timers bgp <0-65535> <0-65535>",
822 "Adjust routing timers\n"
823 "BGP timers\n"
824 "Keepalive interval\n"
825 "Holdtime\n")
826{
827 struct bgp *bgp;
828 unsigned long keepalive = 0;
829 unsigned long holdtime = 0;
830
831 bgp = vty->index;
832
833 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
834 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
835
836 /* Holdtime value check. */
837 if (holdtime < 3 && holdtime != 0)
838 {
839 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
840 VTY_NEWLINE);
841 return CMD_WARNING;
842 }
843
844 bgp_timers_set (bgp, keepalive, holdtime);
845
846 return CMD_SUCCESS;
847}
848
849DEFUN (no_bgp_timers,
850 no_bgp_timers_cmd,
851 "no timers bgp",
852 NO_STR
853 "Adjust routing timers\n"
854 "BGP timers\n")
855{
856 struct bgp *bgp;
857
858 bgp = vty->index;
859 bgp_timers_unset (bgp);
860
861 return CMD_SUCCESS;
862}
863
864ALIAS (no_bgp_timers,
865 no_bgp_timers_arg_cmd,
866 "no timers bgp <0-65535> <0-65535>",
867 NO_STR
868 "Adjust routing timers\n"
869 "BGP timers\n"
870 "Keepalive interval\n"
871 "Holdtime\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200872
paul718e3742002-12-13 20:15:29 +0000873DEFUN (bgp_client_to_client_reflection,
874 bgp_client_to_client_reflection_cmd,
875 "bgp client-to-client reflection",
876 "BGP specific commands\n"
877 "Configure client to client route reflection\n"
878 "reflection of routes allowed\n")
879{
880 struct bgp *bgp;
881
882 bgp = vty->index;
883 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
884 return CMD_SUCCESS;
885}
886
887DEFUN (no_bgp_client_to_client_reflection,
888 no_bgp_client_to_client_reflection_cmd,
889 "no bgp client-to-client reflection",
890 NO_STR
891 "BGP specific commands\n"
892 "Configure client to client route reflection\n"
893 "reflection of routes allowed\n")
894{
895 struct bgp *bgp;
896
897 bgp = vty->index;
898 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
899 return CMD_SUCCESS;
900}
901
902/* "bgp always-compare-med" configuration. */
903DEFUN (bgp_always_compare_med,
904 bgp_always_compare_med_cmd,
905 "bgp always-compare-med",
906 "BGP specific commands\n"
907 "Allow comparing MED from different neighbors\n")
908{
909 struct bgp *bgp;
910
911 bgp = vty->index;
912 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
913 return CMD_SUCCESS;
914}
915
916DEFUN (no_bgp_always_compare_med,
917 no_bgp_always_compare_med_cmd,
918 "no bgp always-compare-med",
919 NO_STR
920 "BGP specific commands\n"
921 "Allow comparing MED from different neighbors\n")
922{
923 struct bgp *bgp;
924
925 bgp = vty->index;
926 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
927 return CMD_SUCCESS;
928}
David Lamparter6b0655a2014-06-04 06:53:35 +0200929
paul718e3742002-12-13 20:15:29 +0000930/* "bgp deterministic-med" configuration. */
931DEFUN (bgp_deterministic_med,
932 bgp_deterministic_med_cmd,
933 "bgp deterministic-med",
934 "BGP specific commands\n"
935 "Pick the best-MED path among paths advertised from the neighboring AS\n")
936{
937 struct bgp *bgp;
938
939 bgp = vty->index;
940 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
941 return CMD_SUCCESS;
942}
943
944DEFUN (no_bgp_deterministic_med,
945 no_bgp_deterministic_med_cmd,
946 "no bgp deterministic-med",
947 NO_STR
948 "BGP specific commands\n"
949 "Pick the best-MED path among paths advertised from the neighboring AS\n")
950{
951 struct bgp *bgp;
952
953 bgp = vty->index;
954 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
955 return CMD_SUCCESS;
956}
hasso538621f2004-05-21 09:31:30 +0000957
958/* "bgp graceful-restart" configuration. */
959DEFUN (bgp_graceful_restart,
960 bgp_graceful_restart_cmd,
961 "bgp graceful-restart",
962 "BGP specific commands\n"
963 "Graceful restart capability parameters\n")
964{
965 struct bgp *bgp;
966
967 bgp = vty->index;
968 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
969 return CMD_SUCCESS;
970}
971
972DEFUN (no_bgp_graceful_restart,
973 no_bgp_graceful_restart_cmd,
974 "no bgp graceful-restart",
975 NO_STR
976 "BGP specific commands\n"
977 "Graceful restart capability parameters\n")
978{
979 struct bgp *bgp;
980
981 bgp = vty->index;
982 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
983 return CMD_SUCCESS;
984}
985
hasso93406d82005-02-02 14:40:33 +0000986DEFUN (bgp_graceful_restart_stalepath_time,
987 bgp_graceful_restart_stalepath_time_cmd,
988 "bgp graceful-restart stalepath-time <1-3600>",
989 "BGP specific commands\n"
990 "Graceful restart capability parameters\n"
991 "Set the max time to hold onto restarting peer's stale paths\n"
992 "Delay value (seconds)\n")
993{
994 struct bgp *bgp;
995 u_int32_t stalepath;
996
997 bgp = vty->index;
998 if (! bgp)
999 return CMD_WARNING;
1000
1001 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
1002 bgp->stalepath_time = stalepath;
1003 return CMD_SUCCESS;
1004}
1005
1006DEFUN (no_bgp_graceful_restart_stalepath_time,
1007 no_bgp_graceful_restart_stalepath_time_cmd,
1008 "no bgp graceful-restart stalepath-time",
1009 NO_STR
1010 "BGP specific commands\n"
1011 "Graceful restart capability parameters\n"
1012 "Set the max time to hold onto restarting peer's stale paths\n")
1013{
1014 struct bgp *bgp;
1015
1016 bgp = vty->index;
1017 if (! bgp)
1018 return CMD_WARNING;
1019
1020 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1021 return CMD_SUCCESS;
1022}
1023
1024ALIAS (no_bgp_graceful_restart_stalepath_time,
1025 no_bgp_graceful_restart_stalepath_time_val_cmd,
1026 "no bgp graceful-restart stalepath-time <1-3600>",
1027 NO_STR
1028 "BGP specific commands\n"
1029 "Graceful restart capability parameters\n"
1030 "Set the max time to hold onto restarting peer's stale paths\n"
1031 "Delay value (seconds)\n")
1032
paul718e3742002-12-13 20:15:29 +00001033/* "bgp fast-external-failover" configuration. */
1034DEFUN (bgp_fast_external_failover,
1035 bgp_fast_external_failover_cmd,
1036 "bgp fast-external-failover",
1037 BGP_STR
1038 "Immediately reset session if a link to a directly connected external peer goes down\n")
1039{
1040 struct bgp *bgp;
1041
1042 bgp = vty->index;
1043 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1044 return CMD_SUCCESS;
1045}
1046
1047DEFUN (no_bgp_fast_external_failover,
1048 no_bgp_fast_external_failover_cmd,
1049 "no bgp fast-external-failover",
1050 NO_STR
1051 BGP_STR
1052 "Immediately reset session if a link to a directly connected external peer goes down\n")
1053{
1054 struct bgp *bgp;
1055
1056 bgp = vty->index;
1057 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1058 return CMD_SUCCESS;
1059}
David Lamparter6b0655a2014-06-04 06:53:35 +02001060
paul718e3742002-12-13 20:15:29 +00001061/* "bgp enforce-first-as" configuration. */
1062DEFUN (bgp_enforce_first_as,
1063 bgp_enforce_first_as_cmd,
1064 "bgp enforce-first-as",
1065 BGP_STR
1066 "Enforce the first AS for EBGP routes\n")
1067{
1068 struct bgp *bgp;
1069
1070 bgp = vty->index;
1071 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1072 return CMD_SUCCESS;
1073}
1074
1075DEFUN (no_bgp_enforce_first_as,
1076 no_bgp_enforce_first_as_cmd,
1077 "no bgp enforce-first-as",
1078 NO_STR
1079 BGP_STR
1080 "Enforce the first AS for EBGP routes\n")
1081{
1082 struct bgp *bgp;
1083
1084 bgp = vty->index;
1085 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1086 return CMD_SUCCESS;
1087}
David Lamparter6b0655a2014-06-04 06:53:35 +02001088
paul718e3742002-12-13 20:15:29 +00001089/* "bgp bestpath compare-routerid" configuration. */
1090DEFUN (bgp_bestpath_compare_router_id,
1091 bgp_bestpath_compare_router_id_cmd,
1092 "bgp bestpath compare-routerid",
1093 "BGP specific commands\n"
1094 "Change the default bestpath selection\n"
1095 "Compare router-id for identical EBGP paths\n")
1096{
1097 struct bgp *bgp;
1098
1099 bgp = vty->index;
1100 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1101 return CMD_SUCCESS;
1102}
1103
1104DEFUN (no_bgp_bestpath_compare_router_id,
1105 no_bgp_bestpath_compare_router_id_cmd,
1106 "no bgp bestpath compare-routerid",
1107 NO_STR
1108 "BGP specific commands\n"
1109 "Change the default bestpath selection\n"
1110 "Compare router-id for identical EBGP paths\n")
1111{
1112 struct bgp *bgp;
1113
1114 bgp = vty->index;
1115 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1116 return CMD_SUCCESS;
1117}
David Lamparter6b0655a2014-06-04 06:53:35 +02001118
paul718e3742002-12-13 20:15:29 +00001119/* "bgp bestpath as-path ignore" configuration. */
1120DEFUN (bgp_bestpath_aspath_ignore,
1121 bgp_bestpath_aspath_ignore_cmd,
1122 "bgp bestpath as-path ignore",
1123 "BGP specific commands\n"
1124 "Change the default bestpath selection\n"
1125 "AS-path attribute\n"
1126 "Ignore as-path length in selecting a route\n")
1127{
1128 struct bgp *bgp;
1129
1130 bgp = vty->index;
1131 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
1132 return CMD_SUCCESS;
1133}
1134
1135DEFUN (no_bgp_bestpath_aspath_ignore,
1136 no_bgp_bestpath_aspath_ignore_cmd,
1137 "no bgp bestpath as-path ignore",
1138 NO_STR
1139 "BGP specific commands\n"
1140 "Change the default bestpath selection\n"
1141 "AS-path attribute\n"
1142 "Ignore as-path length in selecting a route\n")
1143{
1144 struct bgp *bgp;
1145
1146 bgp = vty->index;
1147 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1148 return CMD_SUCCESS;
1149}
David Lamparter6b0655a2014-06-04 06:53:35 +02001150
hasso68118452005-04-08 15:40:36 +00001151/* "bgp bestpath as-path confed" configuration. */
1152DEFUN (bgp_bestpath_aspath_confed,
1153 bgp_bestpath_aspath_confed_cmd,
1154 "bgp bestpath as-path confed",
1155 "BGP specific commands\n"
1156 "Change the default bestpath selection\n"
1157 "AS-path attribute\n"
1158 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1159{
1160 struct bgp *bgp;
1161
1162 bgp = vty->index;
1163 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1164 return CMD_SUCCESS;
1165}
1166
1167DEFUN (no_bgp_bestpath_aspath_confed,
1168 no_bgp_bestpath_aspath_confed_cmd,
1169 "no bgp bestpath as-path confed",
1170 NO_STR
1171 "BGP specific commands\n"
1172 "Change the default bestpath selection\n"
1173 "AS-path attribute\n"
1174 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1175{
1176 struct bgp *bgp;
1177
1178 bgp = vty->index;
1179 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1180 return CMD_SUCCESS;
1181}
David Lamparter6b0655a2014-06-04 06:53:35 +02001182
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00001183/* "bgp bestpath as-path multipath-relax" configuration. */
1184DEFUN (bgp_bestpath_aspath_multipath_relax,
1185 bgp_bestpath_aspath_multipath_relax_cmd,
1186 "bgp bestpath as-path multipath-relax",
1187 "BGP specific commands\n"
1188 "Change the default bestpath selection\n"
1189 "AS-path attribute\n"
1190 "Allow load sharing across routes that have different AS paths (but same length)\n")
1191{
1192 struct bgp *bgp;
1193
1194 bgp = vty->index;
1195 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1196 return CMD_SUCCESS;
1197}
1198
1199DEFUN (no_bgp_bestpath_aspath_multipath_relax,
1200 no_bgp_bestpath_aspath_multipath_relax_cmd,
1201 "no bgp bestpath as-path multipath-relax",
1202 NO_STR
1203 "BGP specific commands\n"
1204 "Change the default bestpath selection\n"
1205 "AS-path attribute\n"
1206 "Allow load sharing across routes that have different AS paths (but same length)\n")
1207{
1208 struct bgp *bgp;
1209
1210 bgp = vty->index;
1211 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1212 return CMD_SUCCESS;
1213}
David Lamparter6b0655a2014-06-04 06:53:35 +02001214
paul848973c2003-08-13 00:32:49 +00001215/* "bgp log-neighbor-changes" configuration. */
1216DEFUN (bgp_log_neighbor_changes,
1217 bgp_log_neighbor_changes_cmd,
1218 "bgp log-neighbor-changes",
1219 "BGP specific commands\n"
1220 "Log neighbor up/down and reset reason\n")
1221{
1222 struct bgp *bgp;
1223
1224 bgp = vty->index;
1225 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1226 return CMD_SUCCESS;
1227}
1228
1229DEFUN (no_bgp_log_neighbor_changes,
1230 no_bgp_log_neighbor_changes_cmd,
1231 "no bgp log-neighbor-changes",
1232 NO_STR
1233 "BGP specific commands\n"
1234 "Log neighbor up/down and reset reason\n")
1235{
1236 struct bgp *bgp;
1237
1238 bgp = vty->index;
1239 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1240 return CMD_SUCCESS;
1241}
David Lamparter6b0655a2014-06-04 06:53:35 +02001242
paul718e3742002-12-13 20:15:29 +00001243/* "bgp bestpath med" configuration. */
1244DEFUN (bgp_bestpath_med,
1245 bgp_bestpath_med_cmd,
1246 "bgp bestpath med (confed|missing-as-worst)",
1247 "BGP specific commands\n"
1248 "Change the default bestpath selection\n"
1249 "MED attribute\n"
1250 "Compare MED among confederation paths\n"
1251 "Treat missing MED as the least preferred one\n")
1252{
1253 struct bgp *bgp;
1254
1255 bgp = vty->index;
1256
1257 if (strncmp (argv[0], "confed", 1) == 0)
1258 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1259 else
1260 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1261
1262 return CMD_SUCCESS;
1263}
1264
1265DEFUN (bgp_bestpath_med2,
1266 bgp_bestpath_med2_cmd,
1267 "bgp bestpath med confed missing-as-worst",
1268 "BGP specific commands\n"
1269 "Change the default bestpath selection\n"
1270 "MED attribute\n"
1271 "Compare MED among confederation paths\n"
1272 "Treat missing MED as the least preferred one\n")
1273{
1274 struct bgp *bgp;
1275
1276 bgp = vty->index;
1277 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1278 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1279 return CMD_SUCCESS;
1280}
1281
1282ALIAS (bgp_bestpath_med2,
1283 bgp_bestpath_med3_cmd,
1284 "bgp bestpath med missing-as-worst confed",
1285 "BGP specific commands\n"
1286 "Change the default bestpath selection\n"
1287 "MED attribute\n"
1288 "Treat missing MED as the least preferred one\n"
1289 "Compare MED among confederation paths\n")
1290
1291DEFUN (no_bgp_bestpath_med,
1292 no_bgp_bestpath_med_cmd,
1293 "no bgp bestpath med (confed|missing-as-worst)",
1294 NO_STR
1295 "BGP specific commands\n"
1296 "Change the default bestpath selection\n"
1297 "MED attribute\n"
1298 "Compare MED among confederation paths\n"
1299 "Treat missing MED as the least preferred one\n")
1300{
1301 struct bgp *bgp;
1302
1303 bgp = vty->index;
1304
1305 if (strncmp (argv[0], "confed", 1) == 0)
1306 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1307 else
1308 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1309
1310 return CMD_SUCCESS;
1311}
1312
1313DEFUN (no_bgp_bestpath_med2,
1314 no_bgp_bestpath_med2_cmd,
1315 "no bgp bestpath med confed missing-as-worst",
1316 NO_STR
1317 "BGP specific commands\n"
1318 "Change the default bestpath selection\n"
1319 "MED attribute\n"
1320 "Compare MED among confederation paths\n"
1321 "Treat missing MED as the least preferred one\n")
1322{
1323 struct bgp *bgp;
1324
1325 bgp = vty->index;
1326 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1327 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1328 return CMD_SUCCESS;
1329}
1330
1331ALIAS (no_bgp_bestpath_med2,
1332 no_bgp_bestpath_med3_cmd,
1333 "no bgp bestpath med missing-as-worst confed",
1334 NO_STR
1335 "BGP specific commands\n"
1336 "Change the default bestpath selection\n"
1337 "MED attribute\n"
1338 "Treat missing MED as the least preferred one\n"
1339 "Compare MED among confederation paths\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001340
paul718e3742002-12-13 20:15:29 +00001341/* "no bgp default ipv4-unicast". */
1342DEFUN (no_bgp_default_ipv4_unicast,
1343 no_bgp_default_ipv4_unicast_cmd,
1344 "no bgp default ipv4-unicast",
1345 NO_STR
1346 "BGP specific commands\n"
1347 "Configure BGP defaults\n"
1348 "Activate ipv4-unicast for a peer by default\n")
1349{
1350 struct bgp *bgp;
1351
1352 bgp = vty->index;
1353 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1354 return CMD_SUCCESS;
1355}
1356
1357DEFUN (bgp_default_ipv4_unicast,
1358 bgp_default_ipv4_unicast_cmd,
1359 "bgp default ipv4-unicast",
1360 "BGP specific commands\n"
1361 "Configure BGP defaults\n"
1362 "Activate ipv4-unicast for a peer by default\n")
1363{
1364 struct bgp *bgp;
1365
1366 bgp = vty->index;
1367 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1368 return CMD_SUCCESS;
1369}
David Lamparter6b0655a2014-06-04 06:53:35 +02001370
paul718e3742002-12-13 20:15:29 +00001371/* "bgp import-check" configuration. */
1372DEFUN (bgp_network_import_check,
1373 bgp_network_import_check_cmd,
1374 "bgp network import-check",
1375 "BGP specific commands\n"
1376 "BGP network command\n"
1377 "Check BGP network route exists in IGP\n")
1378{
1379 struct bgp *bgp;
1380
1381 bgp = vty->index;
1382 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1383 return CMD_SUCCESS;
1384}
1385
1386DEFUN (no_bgp_network_import_check,
1387 no_bgp_network_import_check_cmd,
1388 "no bgp network import-check",
1389 NO_STR
1390 "BGP specific commands\n"
1391 "BGP network command\n"
1392 "Check BGP network route exists in IGP\n")
1393{
1394 struct bgp *bgp;
1395
1396 bgp = vty->index;
1397 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1398 return CMD_SUCCESS;
1399}
David Lamparter6b0655a2014-06-04 06:53:35 +02001400
paul718e3742002-12-13 20:15:29 +00001401DEFUN (bgp_default_local_preference,
1402 bgp_default_local_preference_cmd,
1403 "bgp default local-preference <0-4294967295>",
1404 "BGP specific commands\n"
1405 "Configure BGP defaults\n"
1406 "local preference (higher=more preferred)\n"
1407 "Configure default local preference value\n")
1408{
1409 struct bgp *bgp;
1410 u_int32_t local_pref;
1411
1412 bgp = vty->index;
1413
1414 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1415
1416 bgp_default_local_preference_set (bgp, local_pref);
1417
1418 return CMD_SUCCESS;
1419}
1420
1421DEFUN (no_bgp_default_local_preference,
1422 no_bgp_default_local_preference_cmd,
1423 "no bgp default local-preference",
1424 NO_STR
1425 "BGP specific commands\n"
1426 "Configure BGP defaults\n"
1427 "local preference (higher=more preferred)\n")
1428{
1429 struct bgp *bgp;
1430
1431 bgp = vty->index;
1432 bgp_default_local_preference_unset (bgp);
1433 return CMD_SUCCESS;
1434}
1435
1436ALIAS (no_bgp_default_local_preference,
1437 no_bgp_default_local_preference_val_cmd,
1438 "no bgp default local-preference <0-4294967295>",
1439 NO_STR
1440 "BGP specific commands\n"
1441 "Configure BGP defaults\n"
1442 "local preference (higher=more preferred)\n"
1443 "Configure default local preference value\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001444
paul718e3742002-12-13 20:15:29 +00001445static int
paulfd79ac92004-10-13 05:06:08 +00001446peer_remote_as_vty (struct vty *vty, const char *peer_str,
1447 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001448{
1449 int ret;
1450 struct bgp *bgp;
1451 as_t as;
1452 union sockunion su;
1453
1454 bgp = vty->index;
1455
1456 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001457 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001458
1459 /* If peer is peer group, call proper function. */
1460 ret = str2sockunion (peer_str, &su);
1461 if (ret < 0)
1462 {
1463 ret = peer_group_remote_as (bgp, peer_str, &as);
1464 if (ret < 0)
1465 {
1466 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1467 return CMD_WARNING;
1468 }
1469 return CMD_SUCCESS;
1470 }
1471
1472 if (peer_address_self_check (&su))
1473 {
1474 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1475 VTY_NEWLINE);
1476 return CMD_WARNING;
1477 }
1478
1479 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1480
1481 /* This peer belongs to peer group. */
1482 switch (ret)
1483 {
1484 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001485 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001486 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001487 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001488 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 +00001489 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001490 }
1491 return bgp_vty_return (vty, ret);
1492}
1493
1494DEFUN (neighbor_remote_as,
1495 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001496 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001497 NEIGHBOR_STR
1498 NEIGHBOR_ADDR_STR2
1499 "Specify a BGP neighbor\n"
1500 AS_STR)
1501{
1502 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1503}
David Lamparter6b0655a2014-06-04 06:53:35 +02001504
paul718e3742002-12-13 20:15:29 +00001505DEFUN (neighbor_peer_group,
1506 neighbor_peer_group_cmd,
1507 "neighbor WORD peer-group",
1508 NEIGHBOR_STR
1509 "Neighbor tag\n"
1510 "Configure peer-group\n")
1511{
1512 struct bgp *bgp;
1513 struct peer_group *group;
1514
1515 bgp = vty->index;
1516
1517 group = peer_group_get (bgp, argv[0]);
1518 if (! group)
1519 return CMD_WARNING;
1520
1521 return CMD_SUCCESS;
1522}
1523
1524DEFUN (no_neighbor,
1525 no_neighbor_cmd,
1526 NO_NEIGHBOR_CMD2,
1527 NO_STR
1528 NEIGHBOR_STR
1529 NEIGHBOR_ADDR_STR2)
1530{
1531 int ret;
1532 union sockunion su;
1533 struct peer_group *group;
1534 struct peer *peer;
1535
1536 ret = str2sockunion (argv[0], &su);
1537 if (ret < 0)
1538 {
1539 group = peer_group_lookup (vty->index, argv[0]);
1540 if (group)
1541 peer_group_delete (group);
1542 else
1543 {
1544 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1545 return CMD_WARNING;
1546 }
1547 }
1548 else
1549 {
1550 peer = peer_lookup (vty->index, &su);
1551 if (peer)
paul200df112005-06-01 11:17:05 +00001552 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001553 }
1554
1555 return CMD_SUCCESS;
1556}
1557
1558ALIAS (no_neighbor,
1559 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001560 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001561 NO_STR
1562 NEIGHBOR_STR
1563 NEIGHBOR_ADDR_STR
1564 "Specify a BGP neighbor\n"
1565 AS_STR)
1566
1567DEFUN (no_neighbor_peer_group,
1568 no_neighbor_peer_group_cmd,
1569 "no neighbor WORD peer-group",
1570 NO_STR
1571 NEIGHBOR_STR
1572 "Neighbor tag\n"
1573 "Configure peer-group\n")
1574{
1575 struct peer_group *group;
1576
1577 group = peer_group_lookup (vty->index, argv[0]);
1578 if (group)
1579 peer_group_delete (group);
1580 else
1581 {
1582 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1583 return CMD_WARNING;
1584 }
1585 return CMD_SUCCESS;
1586}
1587
1588DEFUN (no_neighbor_peer_group_remote_as,
1589 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001590 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001591 NO_STR
1592 NEIGHBOR_STR
1593 "Neighbor tag\n"
1594 "Specify a BGP neighbor\n"
1595 AS_STR)
1596{
1597 struct peer_group *group;
1598
1599 group = peer_group_lookup (vty->index, argv[0]);
1600 if (group)
1601 peer_group_remote_as_delete (group);
1602 else
1603 {
1604 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1605 return CMD_WARNING;
1606 }
1607 return CMD_SUCCESS;
1608}
David Lamparter6b0655a2014-06-04 06:53:35 +02001609
paul718e3742002-12-13 20:15:29 +00001610DEFUN (neighbor_local_as,
1611 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001612 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001613 NEIGHBOR_STR
1614 NEIGHBOR_ADDR_STR2
1615 "Specify a local-as number\n"
1616 "AS number used as local AS\n")
1617{
1618 struct peer *peer;
1619 int ret;
1620
1621 peer = peer_and_group_lookup_vty (vty, argv[0]);
1622 if (! peer)
1623 return CMD_WARNING;
1624
Andrew Certain9d3f9702012-11-07 23:50:07 +00001625 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
paul718e3742002-12-13 20:15:29 +00001626 return bgp_vty_return (vty, ret);
1627}
1628
1629DEFUN (neighbor_local_as_no_prepend,
1630 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001631 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001632 NEIGHBOR_STR
1633 NEIGHBOR_ADDR_STR2
1634 "Specify a local-as number\n"
1635 "AS number used as local AS\n"
1636 "Do not prepend local-as to updates from ebgp peers\n")
1637{
1638 struct peer *peer;
1639 int ret;
1640
1641 peer = peer_and_group_lookup_vty (vty, argv[0]);
1642 if (! peer)
1643 return CMD_WARNING;
1644
Andrew Certain9d3f9702012-11-07 23:50:07 +00001645 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
paul718e3742002-12-13 20:15:29 +00001646 return bgp_vty_return (vty, ret);
1647}
1648
Andrew Certain9d3f9702012-11-07 23:50:07 +00001649DEFUN (neighbor_local_as_no_prepend_replace_as,
1650 neighbor_local_as_no_prepend_replace_as_cmd,
1651 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1652 NEIGHBOR_STR
1653 NEIGHBOR_ADDR_STR2
1654 "Specify a local-as number\n"
1655 "AS number used as local AS\n"
1656 "Do not prepend local-as to updates from ebgp peers\n"
1657 "Do not prepend local-as to updates from ibgp peers\n")
1658{
1659 struct peer *peer;
1660 int ret;
1661
1662 peer = peer_and_group_lookup_vty (vty, argv[0]);
1663 if (! peer)
1664 return CMD_WARNING;
1665
1666 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
1667 return bgp_vty_return (vty, ret);
1668}
1669
1670
paul718e3742002-12-13 20:15:29 +00001671DEFUN (no_neighbor_local_as,
1672 no_neighbor_local_as_cmd,
1673 NO_NEIGHBOR_CMD2 "local-as",
1674 NO_STR
1675 NEIGHBOR_STR
1676 NEIGHBOR_ADDR_STR2
1677 "Specify a local-as number\n")
1678{
1679 struct peer *peer;
1680 int ret;
1681
1682 peer = peer_and_group_lookup_vty (vty, argv[0]);
1683 if (! peer)
1684 return CMD_WARNING;
1685
1686 ret = peer_local_as_unset (peer);
1687 return bgp_vty_return (vty, ret);
1688}
1689
1690ALIAS (no_neighbor_local_as,
1691 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001692 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001693 NO_STR
1694 NEIGHBOR_STR
1695 NEIGHBOR_ADDR_STR2
1696 "Specify a local-as number\n"
1697 "AS number used as local AS\n")
1698
1699ALIAS (no_neighbor_local_as,
1700 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001701 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001702 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")
Andrew Certain9d3f9702012-11-07 23:50:07 +00001708
1709ALIAS (no_neighbor_local_as,
1710 no_neighbor_local_as_val3_cmd,
1711 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1712 NO_STR
1713 NEIGHBOR_STR
1714 NEIGHBOR_ADDR_STR2
1715 "Specify a local-as number\n"
1716 "AS number used as local AS\n"
1717 "Do not prepend local-as to updates from ebgp peers\n"
1718 "Do not prepend local-as to updates from ibgp peers\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001719
Paul Jakma0df7c912008-07-21 21:02:49 +00001720DEFUN (neighbor_password,
1721 neighbor_password_cmd,
1722 NEIGHBOR_CMD2 "password LINE",
1723 NEIGHBOR_STR
1724 NEIGHBOR_ADDR_STR2
1725 "Set a password\n"
1726 "The password\n")
1727{
1728 struct peer *peer;
1729 int ret;
1730
1731 peer = peer_and_group_lookup_vty (vty, argv[0]);
1732 if (! peer)
1733 return CMD_WARNING;
1734
1735 ret = peer_password_set (peer, argv[1]);
1736 return bgp_vty_return (vty, ret);
1737}
1738
1739DEFUN (no_neighbor_password,
1740 no_neighbor_password_cmd,
1741 NO_NEIGHBOR_CMD2 "password",
1742 NO_STR
1743 NEIGHBOR_STR
1744 NEIGHBOR_ADDR_STR2
1745 "Set a password\n")
1746{
1747 struct peer *peer;
1748 int ret;
1749
1750 peer = peer_and_group_lookup_vty (vty, argv[0]);
1751 if (! peer)
1752 return CMD_WARNING;
1753
1754 ret = peer_password_unset (peer);
1755 return bgp_vty_return (vty, ret);
1756}
David Lamparter6b0655a2014-06-04 06:53:35 +02001757
paul718e3742002-12-13 20:15:29 +00001758DEFUN (neighbor_activate,
1759 neighbor_activate_cmd,
1760 NEIGHBOR_CMD2 "activate",
1761 NEIGHBOR_STR
1762 NEIGHBOR_ADDR_STR2
1763 "Enable the Address Family for this Neighbor\n")
1764{
1765 struct peer *peer;
1766
1767 peer = peer_and_group_lookup_vty (vty, argv[0]);
1768 if (! peer)
1769 return CMD_WARNING;
1770
1771 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1772
1773 return CMD_SUCCESS;
1774}
1775
1776DEFUN (no_neighbor_activate,
1777 no_neighbor_activate_cmd,
1778 NO_NEIGHBOR_CMD2 "activate",
1779 NO_STR
1780 NEIGHBOR_STR
1781 NEIGHBOR_ADDR_STR2
1782 "Enable the Address Family for this Neighbor\n")
1783{
1784 int ret;
1785 struct peer *peer;
1786
1787 /* Lookup peer. */
1788 peer = peer_and_group_lookup_vty (vty, argv[0]);
1789 if (! peer)
1790 return CMD_WARNING;
1791
1792 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1793
1794 return bgp_vty_return (vty, ret);
1795}
David Lamparter6b0655a2014-06-04 06:53:35 +02001796
paul718e3742002-12-13 20:15:29 +00001797DEFUN (neighbor_set_peer_group,
1798 neighbor_set_peer_group_cmd,
1799 NEIGHBOR_CMD "peer-group WORD",
1800 NEIGHBOR_STR
1801 NEIGHBOR_ADDR_STR
1802 "Member of the peer-group\n"
1803 "peer-group name\n")
1804{
1805 int ret;
1806 as_t as;
1807 union sockunion su;
1808 struct bgp *bgp;
1809 struct peer_group *group;
1810
1811 bgp = vty->index;
1812
1813 ret = str2sockunion (argv[0], &su);
1814 if (ret < 0)
1815 {
1816 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1817 return CMD_WARNING;
1818 }
1819
1820 group = peer_group_lookup (bgp, argv[1]);
1821 if (! group)
1822 {
1823 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1824 return CMD_WARNING;
1825 }
1826
1827 if (peer_address_self_check (&su))
1828 {
1829 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1830 VTY_NEWLINE);
1831 return CMD_WARNING;
1832 }
1833
1834 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1835 bgp_node_safi (vty), &as);
1836
1837 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1838 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001839 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 +00001840 return CMD_WARNING;
1841 }
1842
1843 return bgp_vty_return (vty, ret);
1844}
1845
1846DEFUN (no_neighbor_set_peer_group,
1847 no_neighbor_set_peer_group_cmd,
1848 NO_NEIGHBOR_CMD "peer-group WORD",
1849 NO_STR
1850 NEIGHBOR_STR
1851 NEIGHBOR_ADDR_STR
1852 "Member of the peer-group\n"
1853 "peer-group name\n")
1854{
1855 int ret;
1856 struct bgp *bgp;
1857 struct peer *peer;
1858 struct peer_group *group;
1859
1860 bgp = vty->index;
1861
1862 peer = peer_lookup_vty (vty, argv[0]);
1863 if (! peer)
1864 return CMD_WARNING;
1865
1866 group = peer_group_lookup (bgp, argv[1]);
1867 if (! group)
1868 {
1869 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1870 return CMD_WARNING;
1871 }
1872
1873 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1874 bgp_node_safi (vty));
1875
1876 return bgp_vty_return (vty, ret);
1877}
David Lamparter6b0655a2014-06-04 06:53:35 +02001878
paul94f2b392005-06-28 12:44:16 +00001879static int
paulfd79ac92004-10-13 05:06:08 +00001880peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1881 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001882{
1883 int ret;
1884 struct peer *peer;
1885
1886 peer = peer_and_group_lookup_vty (vty, ip_str);
1887 if (! peer)
1888 return CMD_WARNING;
1889
1890 if (set)
1891 ret = peer_flag_set (peer, flag);
1892 else
1893 ret = peer_flag_unset (peer, flag);
1894
1895 return bgp_vty_return (vty, ret);
1896}
1897
paul94f2b392005-06-28 12:44:16 +00001898static int
paulfd79ac92004-10-13 05:06:08 +00001899peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001900{
1901 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1902}
1903
paul94f2b392005-06-28 12:44:16 +00001904static int
paulfd79ac92004-10-13 05:06:08 +00001905peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001906{
1907 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1908}
1909
1910/* neighbor passive. */
1911DEFUN (neighbor_passive,
1912 neighbor_passive_cmd,
1913 NEIGHBOR_CMD2 "passive",
1914 NEIGHBOR_STR
1915 NEIGHBOR_ADDR_STR2
1916 "Don't send open messages to this neighbor\n")
1917{
1918 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1919}
1920
1921DEFUN (no_neighbor_passive,
1922 no_neighbor_passive_cmd,
1923 NO_NEIGHBOR_CMD2 "passive",
1924 NO_STR
1925 NEIGHBOR_STR
1926 NEIGHBOR_ADDR_STR2
1927 "Don't send open messages to this neighbor\n")
1928{
1929 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1930}
David Lamparter6b0655a2014-06-04 06:53:35 +02001931
paul718e3742002-12-13 20:15:29 +00001932/* neighbor shutdown. */
1933DEFUN (neighbor_shutdown,
1934 neighbor_shutdown_cmd,
1935 NEIGHBOR_CMD2 "shutdown",
1936 NEIGHBOR_STR
1937 NEIGHBOR_ADDR_STR2
1938 "Administratively shut down this neighbor\n")
1939{
1940 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1941}
1942
1943DEFUN (no_neighbor_shutdown,
1944 no_neighbor_shutdown_cmd,
1945 NO_NEIGHBOR_CMD2 "shutdown",
1946 NO_STR
1947 NEIGHBOR_STR
1948 NEIGHBOR_ADDR_STR2
1949 "Administratively shut down this neighbor\n")
1950{
1951 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1952}
David Lamparter6b0655a2014-06-04 06:53:35 +02001953
hassoc9502432005-02-01 22:01:48 +00001954/* Deprecated neighbor capability route-refresh. */
1955DEFUN_DEPRECATED (neighbor_capability_route_refresh,
1956 neighbor_capability_route_refresh_cmd,
1957 NEIGHBOR_CMD2 "capability route-refresh",
1958 NEIGHBOR_STR
1959 NEIGHBOR_ADDR_STR2
1960 "Advertise capability to the peer\n"
1961 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001962{
hassoc9502432005-02-01 22:01:48 +00001963 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001964}
1965
hassoc9502432005-02-01 22:01:48 +00001966DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
1967 no_neighbor_capability_route_refresh_cmd,
1968 NO_NEIGHBOR_CMD2 "capability route-refresh",
1969 NO_STR
1970 NEIGHBOR_STR
1971 NEIGHBOR_ADDR_STR2
1972 "Advertise capability to the peer\n"
1973 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001974{
hassoc9502432005-02-01 22:01:48 +00001975 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001976}
David Lamparter6b0655a2014-06-04 06:53:35 +02001977
paul718e3742002-12-13 20:15:29 +00001978/* neighbor capability dynamic. */
1979DEFUN (neighbor_capability_dynamic,
1980 neighbor_capability_dynamic_cmd,
1981 NEIGHBOR_CMD2 "capability dynamic",
1982 NEIGHBOR_STR
1983 NEIGHBOR_ADDR_STR2
1984 "Advertise capability to the peer\n"
1985 "Advertise dynamic capability to this neighbor\n")
1986{
1987 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1988}
1989
1990DEFUN (no_neighbor_capability_dynamic,
1991 no_neighbor_capability_dynamic_cmd,
1992 NO_NEIGHBOR_CMD2 "capability dynamic",
1993 NO_STR
1994 NEIGHBOR_STR
1995 NEIGHBOR_ADDR_STR2
1996 "Advertise capability to the peer\n"
1997 "Advertise dynamic capability to this neighbor\n")
1998{
1999 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2000}
David Lamparter6b0655a2014-06-04 06:53:35 +02002001
paul718e3742002-12-13 20:15:29 +00002002/* neighbor dont-capability-negotiate */
2003DEFUN (neighbor_dont_capability_negotiate,
2004 neighbor_dont_capability_negotiate_cmd,
2005 NEIGHBOR_CMD2 "dont-capability-negotiate",
2006 NEIGHBOR_STR
2007 NEIGHBOR_ADDR_STR2
2008 "Do not perform capability negotiation\n")
2009{
2010 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2011}
2012
2013DEFUN (no_neighbor_dont_capability_negotiate,
2014 no_neighbor_dont_capability_negotiate_cmd,
2015 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
2016 NO_STR
2017 NEIGHBOR_STR
2018 NEIGHBOR_ADDR_STR2
2019 "Do not perform capability negotiation\n")
2020{
2021 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2022}
David Lamparter6b0655a2014-06-04 06:53:35 +02002023
paul94f2b392005-06-28 12:44:16 +00002024static int
paulfd79ac92004-10-13 05:06:08 +00002025peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002026 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002027{
2028 int ret;
2029 struct peer *peer;
2030
2031 peer = peer_and_group_lookup_vty (vty, peer_str);
2032 if (! peer)
2033 return CMD_WARNING;
2034
2035 if (set)
2036 ret = peer_af_flag_set (peer, afi, safi, flag);
2037 else
2038 ret = peer_af_flag_unset (peer, afi, safi, flag);
2039
2040 return bgp_vty_return (vty, ret);
2041}
2042
paul94f2b392005-06-28 12:44:16 +00002043static int
paulfd79ac92004-10-13 05:06:08 +00002044peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002045 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002046{
2047 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
2048}
2049
paul94f2b392005-06-28 12:44:16 +00002050static int
paulfd79ac92004-10-13 05:06:08 +00002051peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002052 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002053{
2054 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
2055}
David Lamparter6b0655a2014-06-04 06:53:35 +02002056
paul718e3742002-12-13 20:15:29 +00002057/* neighbor capability orf prefix-list. */
2058DEFUN (neighbor_capability_orf_prefix,
2059 neighbor_capability_orf_prefix_cmd,
2060 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2061 NEIGHBOR_STR
2062 NEIGHBOR_ADDR_STR2
2063 "Advertise capability to the peer\n"
2064 "Advertise ORF capability to the peer\n"
2065 "Advertise prefixlist ORF capability to this neighbor\n"
2066 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2067 "Capability to RECEIVE the ORF from this neighbor\n"
2068 "Capability to SEND the ORF to this neighbor\n")
2069{
2070 u_int16_t flag = 0;
2071
2072 if (strncmp (argv[1], "s", 1) == 0)
2073 flag = PEER_FLAG_ORF_PREFIX_SM;
2074 else if (strncmp (argv[1], "r", 1) == 0)
2075 flag = PEER_FLAG_ORF_PREFIX_RM;
2076 else if (strncmp (argv[1], "b", 1) == 0)
2077 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2078 else
2079 return CMD_WARNING;
2080
2081 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2082 bgp_node_safi (vty), flag);
2083}
2084
2085DEFUN (no_neighbor_capability_orf_prefix,
2086 no_neighbor_capability_orf_prefix_cmd,
2087 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2088 NO_STR
2089 NEIGHBOR_STR
2090 NEIGHBOR_ADDR_STR2
2091 "Advertise capability to the peer\n"
2092 "Advertise ORF capability to the peer\n"
2093 "Advertise prefixlist ORF capability to this neighbor\n"
2094 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2095 "Capability to RECEIVE the ORF from this neighbor\n"
2096 "Capability to SEND the ORF to this neighbor\n")
2097{
2098 u_int16_t flag = 0;
2099
2100 if (strncmp (argv[1], "s", 1) == 0)
2101 flag = PEER_FLAG_ORF_PREFIX_SM;
2102 else if (strncmp (argv[1], "r", 1) == 0)
2103 flag = PEER_FLAG_ORF_PREFIX_RM;
2104 else if (strncmp (argv[1], "b", 1) == 0)
2105 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2106 else
2107 return CMD_WARNING;
2108
2109 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2110 bgp_node_safi (vty), flag);
2111}
David Lamparter6b0655a2014-06-04 06:53:35 +02002112
paul718e3742002-12-13 20:15:29 +00002113/* neighbor next-hop-self. */
2114DEFUN (neighbor_nexthop_self,
2115 neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002116 NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002117 NEIGHBOR_STR
2118 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002119 "Disable the next hop calculation for this neighbor\n"
2120 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002121{
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002122 u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
2123 int rc;
2124
2125 /* Check if "all" is specified */
2126 if (argv[1] != NULL)
2127 flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
2128 else
2129 unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
2130
2131 rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2132 bgp_node_safi (vty), flags);
2133 if ( rc == CMD_SUCCESS && unset )
2134 rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2135 bgp_node_safi (vty), unset);
2136 return rc;
paul718e3742002-12-13 20:15:29 +00002137}
2138
2139DEFUN (no_neighbor_nexthop_self,
2140 no_neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002141 NO_NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002142 NO_STR
2143 NEIGHBOR_STR
2144 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002145 "Disable the next hop calculation for this neighbor\n"
2146 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002147{
2148 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002149 bgp_node_safi (vty),
2150 PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
paul718e3742002-12-13 20:15:29 +00002151}
David Lamparter6b0655a2014-06-04 06:53:35 +02002152
paul718e3742002-12-13 20:15:29 +00002153/* neighbor remove-private-AS. */
2154DEFUN (neighbor_remove_private_as,
2155 neighbor_remove_private_as_cmd,
2156 NEIGHBOR_CMD2 "remove-private-AS",
2157 NEIGHBOR_STR
2158 NEIGHBOR_ADDR_STR2
2159 "Remove private AS number from outbound updates\n")
2160{
2161 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2162 bgp_node_safi (vty),
2163 PEER_FLAG_REMOVE_PRIVATE_AS);
2164}
2165
2166DEFUN (no_neighbor_remove_private_as,
2167 no_neighbor_remove_private_as_cmd,
2168 NO_NEIGHBOR_CMD2 "remove-private-AS",
2169 NO_STR
2170 NEIGHBOR_STR
2171 NEIGHBOR_ADDR_STR2
2172 "Remove private AS number from outbound updates\n")
2173{
2174 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2175 bgp_node_safi (vty),
2176 PEER_FLAG_REMOVE_PRIVATE_AS);
2177}
David Lamparter6b0655a2014-06-04 06:53:35 +02002178
paul718e3742002-12-13 20:15:29 +00002179/* neighbor send-community. */
2180DEFUN (neighbor_send_community,
2181 neighbor_send_community_cmd,
2182 NEIGHBOR_CMD2 "send-community",
2183 NEIGHBOR_STR
2184 NEIGHBOR_ADDR_STR2
2185 "Send Community attribute to this neighbor\n")
2186{
2187 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2188 bgp_node_safi (vty),
2189 PEER_FLAG_SEND_COMMUNITY);
2190}
2191
2192DEFUN (no_neighbor_send_community,
2193 no_neighbor_send_community_cmd,
2194 NO_NEIGHBOR_CMD2 "send-community",
2195 NO_STR
2196 NEIGHBOR_STR
2197 NEIGHBOR_ADDR_STR2
2198 "Send Community attribute to this neighbor\n")
2199{
2200 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2201 bgp_node_safi (vty),
2202 PEER_FLAG_SEND_COMMUNITY);
2203}
David Lamparter6b0655a2014-06-04 06:53:35 +02002204
paul718e3742002-12-13 20:15:29 +00002205/* neighbor send-community extended. */
2206DEFUN (neighbor_send_community_type,
2207 neighbor_send_community_type_cmd,
2208 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2209 NEIGHBOR_STR
2210 NEIGHBOR_ADDR_STR2
2211 "Send Community attribute to this neighbor\n"
2212 "Send Standard and Extended Community attributes\n"
2213 "Send Extended Community attributes\n"
2214 "Send Standard Community attributes\n")
2215{
2216 if (strncmp (argv[1], "s", 1) == 0)
2217 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2218 bgp_node_safi (vty),
2219 PEER_FLAG_SEND_COMMUNITY);
2220 if (strncmp (argv[1], "e", 1) == 0)
2221 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2222 bgp_node_safi (vty),
2223 PEER_FLAG_SEND_EXT_COMMUNITY);
2224
2225 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2226 bgp_node_safi (vty),
2227 (PEER_FLAG_SEND_COMMUNITY|
2228 PEER_FLAG_SEND_EXT_COMMUNITY));
2229}
2230
2231DEFUN (no_neighbor_send_community_type,
2232 no_neighbor_send_community_type_cmd,
2233 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2234 NO_STR
2235 NEIGHBOR_STR
2236 NEIGHBOR_ADDR_STR2
2237 "Send Community attribute to this neighbor\n"
2238 "Send Standard and Extended Community attributes\n"
2239 "Send Extended Community attributes\n"
2240 "Send Standard Community attributes\n")
2241{
2242 if (strncmp (argv[1], "s", 1) == 0)
2243 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2244 bgp_node_safi (vty),
2245 PEER_FLAG_SEND_COMMUNITY);
2246 if (strncmp (argv[1], "e", 1) == 0)
2247 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2248 bgp_node_safi (vty),
2249 PEER_FLAG_SEND_EXT_COMMUNITY);
2250
2251 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2252 bgp_node_safi (vty),
2253 (PEER_FLAG_SEND_COMMUNITY |
2254 PEER_FLAG_SEND_EXT_COMMUNITY));
2255}
David Lamparter6b0655a2014-06-04 06:53:35 +02002256
paul718e3742002-12-13 20:15:29 +00002257/* neighbor soft-reconfig. */
2258DEFUN (neighbor_soft_reconfiguration,
2259 neighbor_soft_reconfiguration_cmd,
2260 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2261 NEIGHBOR_STR
2262 NEIGHBOR_ADDR_STR2
2263 "Per neighbor soft reconfiguration\n"
2264 "Allow inbound soft reconfiguration for this neighbor\n")
2265{
2266 return peer_af_flag_set_vty (vty, argv[0],
2267 bgp_node_afi (vty), bgp_node_safi (vty),
2268 PEER_FLAG_SOFT_RECONFIG);
2269}
2270
2271DEFUN (no_neighbor_soft_reconfiguration,
2272 no_neighbor_soft_reconfiguration_cmd,
2273 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2274 NO_STR
2275 NEIGHBOR_STR
2276 NEIGHBOR_ADDR_STR2
2277 "Per neighbor soft reconfiguration\n"
2278 "Allow inbound soft reconfiguration for this neighbor\n")
2279{
2280 return peer_af_flag_unset_vty (vty, argv[0],
2281 bgp_node_afi (vty), bgp_node_safi (vty),
2282 PEER_FLAG_SOFT_RECONFIG);
2283}
David Lamparter6b0655a2014-06-04 06:53:35 +02002284
paul718e3742002-12-13 20:15:29 +00002285DEFUN (neighbor_route_reflector_client,
2286 neighbor_route_reflector_client_cmd,
2287 NEIGHBOR_CMD2 "route-reflector-client",
2288 NEIGHBOR_STR
2289 NEIGHBOR_ADDR_STR2
2290 "Configure a neighbor as Route Reflector client\n")
2291{
2292 struct peer *peer;
2293
2294
2295 peer = peer_and_group_lookup_vty (vty, argv[0]);
2296 if (! peer)
2297 return CMD_WARNING;
2298
2299 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2300 bgp_node_safi (vty),
2301 PEER_FLAG_REFLECTOR_CLIENT);
2302}
2303
2304DEFUN (no_neighbor_route_reflector_client,
2305 no_neighbor_route_reflector_client_cmd,
2306 NO_NEIGHBOR_CMD2 "route-reflector-client",
2307 NO_STR
2308 NEIGHBOR_STR
2309 NEIGHBOR_ADDR_STR2
2310 "Configure a neighbor as Route Reflector client\n")
2311{
2312 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2313 bgp_node_safi (vty),
2314 PEER_FLAG_REFLECTOR_CLIENT);
2315}
David Lamparter6b0655a2014-06-04 06:53:35 +02002316
paul94f2b392005-06-28 12:44:16 +00002317static int
paulfd79ac92004-10-13 05:06:08 +00002318peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2319 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002320{
2321 int ret;
2322 struct bgp *bgp;
2323 struct peer *peer;
2324 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002325 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002326 struct bgp_filter *pfilter;
2327 struct bgp_filter *gfilter;
Chris Caputo228da422009-07-18 05:44:03 +00002328 int locked_and_added = 0;
paulfee0f4c2004-09-13 05:12:46 +00002329
2330 bgp = vty->index;
2331
2332 peer = peer_and_group_lookup_vty (vty, peer_str);
2333 if ( ! peer )
2334 return CMD_WARNING;
2335
2336 /* If it is already a RS-Client, don't do anything. */
2337 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2338 return CMD_SUCCESS;
2339
2340 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002341 {
2342 peer = peer_lock (peer); /* rsclient peer list reference */
2343 listnode_add_sort (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002344 locked_and_added = 1;
paul200df112005-06-01 11:17:05 +00002345 }
paulfee0f4c2004-09-13 05:12:46 +00002346
2347 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2348 if (ret < 0)
Chris Caputo228da422009-07-18 05:44:03 +00002349 {
2350 if (locked_and_added)
2351 {
2352 listnode_delete (bgp->rsclient, peer);
2353 peer_unlock (peer); /* rsclient peer list reference */
2354 }
2355
2356 return bgp_vty_return (vty, ret);
2357 }
paulfee0f4c2004-09-13 05:12:46 +00002358
Paul Jakma64e580a2006-02-21 01:09:01 +00002359 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002360 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
Chris Caputo228da422009-07-18 05:44:03 +00002361 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2362 peer->rib[afi][safi]->owner = peer_lock (peer);
paulfee0f4c2004-09-13 05:12:46 +00002363
2364 /* Check for existing 'network' and 'redistribute' routes. */
2365 bgp_check_local_routes_rsclient (peer, afi, safi);
2366
2367 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2368 bgp_soft_reconfig_rsclient (peer, afi, safi);
2369
2370 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2371 {
2372 group = peer->group;
2373 gfilter = &peer->filter[afi][safi];
2374
paul1eb8ef22005-04-07 07:30:20 +00002375 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002376 {
2377 pfilter = &peer->filter[afi][safi];
2378
2379 /* Members of a non-RS-Client group should not be RS-Clients, as that
2380 is checked when the become part of the peer-group */
2381 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2382 if (ret < 0)
2383 return bgp_vty_return (vty, ret);
2384
2385 /* Make peer's RIB point to group's RIB. */
2386 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2387
2388 /* Import policy. */
2389 if (pfilter->map[RMAP_IMPORT].name)
2390 free (pfilter->map[RMAP_IMPORT].name);
2391 if (gfilter->map[RMAP_IMPORT].name)
2392 {
2393 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2394 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2395 }
2396 else
2397 {
2398 pfilter->map[RMAP_IMPORT].name = NULL;
2399 pfilter->map[RMAP_IMPORT].map =NULL;
2400 }
2401
2402 /* Export policy. */
2403 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2404 {
2405 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2406 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2407 }
2408 }
2409 }
2410 return CMD_SUCCESS;
2411}
2412
paul94f2b392005-06-28 12:44:16 +00002413static int
paulfd79ac92004-10-13 05:06:08 +00002414peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2415 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002416{
2417 int ret;
2418 struct bgp *bgp;
2419 struct peer *peer;
2420 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002421 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002422
2423 bgp = vty->index;
2424
2425 peer = peer_and_group_lookup_vty (vty, peer_str);
2426 if ( ! peer )
2427 return CMD_WARNING;
2428
2429 /* If it is not a RS-Client, don't do anything. */
2430 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2431 return CMD_SUCCESS;
2432
2433 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2434 {
2435 group = peer->group;
2436
paul1eb8ef22005-04-07 07:30:20 +00002437 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002438 {
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 peer->rib[afi][safi] = NULL;
2444 }
2445
2446 peer = group->conf;
2447 }
2448
2449 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2450 if (ret < 0)
2451 return bgp_vty_return (vty, ret);
2452
2453 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002454 {
Chris Caputo228da422009-07-18 05:44:03 +00002455 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
paul200df112005-06-01 11:17:05 +00002456 listnode_delete (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002457 peer_unlock (peer); /* peer bgp rsclient reference */
paul200df112005-06-01 11:17:05 +00002458 }
paulfee0f4c2004-09-13 05:12:46 +00002459
Paul Jakmab608d5b2008-07-02 02:12:07 +00002460 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002461
2462 return CMD_SUCCESS;
2463}
David Lamparter6b0655a2014-06-04 06:53:35 +02002464
paul718e3742002-12-13 20:15:29 +00002465/* neighbor route-server-client. */
2466DEFUN (neighbor_route_server_client,
2467 neighbor_route_server_client_cmd,
2468 NEIGHBOR_CMD2 "route-server-client",
2469 NEIGHBOR_STR
2470 NEIGHBOR_ADDR_STR2
2471 "Configure a neighbor as Route Server client\n")
2472{
paulfee0f4c2004-09-13 05:12:46 +00002473 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2474 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002475}
2476
2477DEFUN (no_neighbor_route_server_client,
2478 no_neighbor_route_server_client_cmd,
2479 NO_NEIGHBOR_CMD2 "route-server-client",
2480 NO_STR
2481 NEIGHBOR_STR
2482 NEIGHBOR_ADDR_STR2
2483 "Configure a neighbor as Route Server client\n")
2484{
paulfee0f4c2004-09-13 05:12:46 +00002485 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2486 bgp_node_safi(vty));
2487}
David Lamparter6b0655a2014-06-04 06:53:35 +02002488
paulfee0f4c2004-09-13 05:12:46 +00002489DEFUN (neighbor_nexthop_local_unchanged,
2490 neighbor_nexthop_local_unchanged_cmd,
2491 NEIGHBOR_CMD2 "nexthop-local unchanged",
2492 NEIGHBOR_STR
2493 NEIGHBOR_ADDR_STR2
2494 "Configure treatment of outgoing link-local nexthop attribute\n"
2495 "Leave link-local nexthop unchanged for this peer\n")
2496{
2497 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2498 bgp_node_safi (vty),
2499 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2500}
David Lamparter6b0655a2014-06-04 06:53:35 +02002501
paulfee0f4c2004-09-13 05:12:46 +00002502DEFUN (no_neighbor_nexthop_local_unchanged,
2503 no_neighbor_nexthop_local_unchanged_cmd,
2504 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2505 NO_STR
2506 NEIGHBOR_STR
2507 NEIGHBOR_ADDR_STR2
2508 "Configure treatment of outgoing link-local-nexthop attribute\n"
2509 "Leave link-local nexthop unchanged for this peer\n")
2510{
paul718e3742002-12-13 20:15:29 +00002511 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2512 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002513 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002514}
David Lamparter6b0655a2014-06-04 06:53:35 +02002515
paul718e3742002-12-13 20:15:29 +00002516DEFUN (neighbor_attr_unchanged,
2517 neighbor_attr_unchanged_cmd,
2518 NEIGHBOR_CMD2 "attribute-unchanged",
2519 NEIGHBOR_STR
2520 NEIGHBOR_ADDR_STR2
2521 "BGP attribute is propagated unchanged to this neighbor\n")
2522{
2523 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2524 bgp_node_safi (vty),
2525 (PEER_FLAG_AS_PATH_UNCHANGED |
2526 PEER_FLAG_NEXTHOP_UNCHANGED |
2527 PEER_FLAG_MED_UNCHANGED));
2528}
2529
2530DEFUN (neighbor_attr_unchanged1,
2531 neighbor_attr_unchanged1_cmd,
2532 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2533 NEIGHBOR_STR
2534 NEIGHBOR_ADDR_STR2
2535 "BGP attribute is propagated unchanged to this neighbor\n"
2536 "As-path attribute\n"
2537 "Nexthop attribute\n"
2538 "Med attribute\n")
2539{
2540 u_int16_t flags = 0;
2541
2542 if (strncmp (argv[1], "as-path", 1) == 0)
2543 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2544 else if (strncmp (argv[1], "next-hop", 1) == 0)
2545 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2546 else if (strncmp (argv[1], "med", 1) == 0)
2547 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2548
2549 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2550 bgp_node_safi (vty), flags);
2551}
2552
2553DEFUN (neighbor_attr_unchanged2,
2554 neighbor_attr_unchanged2_cmd,
2555 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2556 NEIGHBOR_STR
2557 NEIGHBOR_ADDR_STR2
2558 "BGP attribute is propagated unchanged to this neighbor\n"
2559 "As-path attribute\n"
2560 "Nexthop attribute\n"
2561 "Med attribute\n")
2562{
2563 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2564
2565 if (strncmp (argv[1], "next-hop", 1) == 0)
2566 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2567 else if (strncmp (argv[1], "med", 1) == 0)
2568 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2569
2570 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2571 bgp_node_safi (vty), flags);
2572
2573}
2574
2575DEFUN (neighbor_attr_unchanged3,
2576 neighbor_attr_unchanged3_cmd,
2577 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2578 NEIGHBOR_STR
2579 NEIGHBOR_ADDR_STR2
2580 "BGP attribute is propagated unchanged to this neighbor\n"
2581 "Nexthop attribute\n"
2582 "As-path attribute\n"
2583 "Med attribute\n")
2584{
2585 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2586
2587 if (strncmp (argv[1], "as-path", 1) == 0)
2588 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2589 else if (strncmp (argv[1], "med", 1) == 0)
2590 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2591
2592 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2593 bgp_node_safi (vty), flags);
2594}
2595
2596DEFUN (neighbor_attr_unchanged4,
2597 neighbor_attr_unchanged4_cmd,
2598 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2599 NEIGHBOR_STR
2600 NEIGHBOR_ADDR_STR2
2601 "BGP attribute is propagated unchanged to this neighbor\n"
2602 "Med attribute\n"
2603 "As-path attribute\n"
2604 "Nexthop attribute\n")
2605{
2606 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2607
2608 if (strncmp (argv[1], "as-path", 1) == 0)
2609 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2610 else if (strncmp (argv[1], "next-hop", 1) == 0)
2611 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2612
2613 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2614 bgp_node_safi (vty), flags);
2615}
2616
2617ALIAS (neighbor_attr_unchanged,
2618 neighbor_attr_unchanged5_cmd,
2619 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2620 NEIGHBOR_STR
2621 NEIGHBOR_ADDR_STR2
2622 "BGP attribute is propagated unchanged to this neighbor\n"
2623 "As-path attribute\n"
2624 "Nexthop attribute\n"
2625 "Med attribute\n")
2626
2627ALIAS (neighbor_attr_unchanged,
2628 neighbor_attr_unchanged6_cmd,
2629 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2630 NEIGHBOR_STR
2631 NEIGHBOR_ADDR_STR2
2632 "BGP attribute is propagated unchanged to this neighbor\n"
2633 "As-path attribute\n"
2634 "Med attribute\n"
2635 "Nexthop attribute\n")
2636
2637ALIAS (neighbor_attr_unchanged,
2638 neighbor_attr_unchanged7_cmd,
2639 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2640 NEIGHBOR_STR
2641 NEIGHBOR_ADDR_STR2
2642 "BGP attribute is propagated unchanged to this neighbor\n"
2643 "Nexthop attribute\n"
2644 "Med attribute\n"
2645 "As-path attribute\n")
2646
2647ALIAS (neighbor_attr_unchanged,
2648 neighbor_attr_unchanged8_cmd,
2649 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2650 NEIGHBOR_STR
2651 NEIGHBOR_ADDR_STR2
2652 "BGP attribute is propagated unchanged to this neighbor\n"
2653 "Nexthop attribute\n"
2654 "As-path attribute\n"
2655 "Med attribute\n")
2656
2657ALIAS (neighbor_attr_unchanged,
2658 neighbor_attr_unchanged9_cmd,
2659 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2660 NEIGHBOR_STR
2661 NEIGHBOR_ADDR_STR2
2662 "BGP attribute is propagated unchanged to this neighbor\n"
2663 "Med attribute\n"
2664 "Nexthop attribute\n"
2665 "As-path attribute\n")
2666
2667ALIAS (neighbor_attr_unchanged,
2668 neighbor_attr_unchanged10_cmd,
2669 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2670 NEIGHBOR_STR
2671 NEIGHBOR_ADDR_STR2
2672 "BGP attribute is propagated unchanged to this neighbor\n"
2673 "Med attribute\n"
2674 "As-path attribute\n"
2675 "Nexthop attribute\n")
2676
2677DEFUN (no_neighbor_attr_unchanged,
2678 no_neighbor_attr_unchanged_cmd,
2679 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2680 NO_STR
2681 NEIGHBOR_STR
2682 NEIGHBOR_ADDR_STR2
2683 "BGP attribute is propagated unchanged to this neighbor\n")
2684{
2685 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2686 bgp_node_safi (vty),
2687 (PEER_FLAG_AS_PATH_UNCHANGED |
2688 PEER_FLAG_NEXTHOP_UNCHANGED |
2689 PEER_FLAG_MED_UNCHANGED));
2690}
2691
2692DEFUN (no_neighbor_attr_unchanged1,
2693 no_neighbor_attr_unchanged1_cmd,
2694 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2695 NO_STR
2696 NEIGHBOR_STR
2697 NEIGHBOR_ADDR_STR2
2698 "BGP attribute is propagated unchanged to this neighbor\n"
2699 "As-path attribute\n"
2700 "Nexthop attribute\n"
2701 "Med attribute\n")
2702{
2703 u_int16_t flags = 0;
2704
2705 if (strncmp (argv[1], "as-path", 1) == 0)
2706 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2707 else if (strncmp (argv[1], "next-hop", 1) == 0)
2708 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2709 else if (strncmp (argv[1], "med", 1) == 0)
2710 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2711
2712 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2713 bgp_node_safi (vty), flags);
2714}
2715
2716DEFUN (no_neighbor_attr_unchanged2,
2717 no_neighbor_attr_unchanged2_cmd,
2718 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2719 NO_STR
2720 NEIGHBOR_STR
2721 NEIGHBOR_ADDR_STR2
2722 "BGP attribute is propagated unchanged to this neighbor\n"
2723 "As-path attribute\n"
2724 "Nexthop attribute\n"
2725 "Med attribute\n")
2726{
2727 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2728
2729 if (strncmp (argv[1], "next-hop", 1) == 0)
2730 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2731 else if (strncmp (argv[1], "med", 1) == 0)
2732 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2733
2734 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2735 bgp_node_safi (vty), flags);
2736}
2737
2738DEFUN (no_neighbor_attr_unchanged3,
2739 no_neighbor_attr_unchanged3_cmd,
2740 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2741 NO_STR
2742 NEIGHBOR_STR
2743 NEIGHBOR_ADDR_STR2
2744 "BGP attribute is propagated unchanged to this neighbor\n"
2745 "Nexthop attribute\n"
2746 "As-path attribute\n"
2747 "Med attribute\n")
2748{
2749 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2750
2751 if (strncmp (argv[1], "as-path", 1) == 0)
2752 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2753 else if (strncmp (argv[1], "med", 1) == 0)
2754 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2755
2756 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2757 bgp_node_safi (vty), flags);
2758}
2759
2760DEFUN (no_neighbor_attr_unchanged4,
2761 no_neighbor_attr_unchanged4_cmd,
2762 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2763 NO_STR
2764 NEIGHBOR_STR
2765 NEIGHBOR_ADDR_STR2
2766 "BGP attribute is propagated unchanged to this neighbor\n"
2767 "Med attribute\n"
2768 "As-path attribute\n"
2769 "Nexthop attribute\n")
2770{
2771 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2772
2773 if (strncmp (argv[1], "as-path", 1) == 0)
2774 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2775 else if (strncmp (argv[1], "next-hop", 1) == 0)
2776 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2777
2778 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2779 bgp_node_safi (vty), flags);
2780}
2781
2782ALIAS (no_neighbor_attr_unchanged,
2783 no_neighbor_attr_unchanged5_cmd,
2784 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2785 NO_STR
2786 NEIGHBOR_STR
2787 NEIGHBOR_ADDR_STR2
2788 "BGP attribute is propagated unchanged to this neighbor\n"
2789 "As-path attribute\n"
2790 "Nexthop attribute\n"
2791 "Med attribute\n")
2792
2793ALIAS (no_neighbor_attr_unchanged,
2794 no_neighbor_attr_unchanged6_cmd,
2795 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2796 NO_STR
2797 NEIGHBOR_STR
2798 NEIGHBOR_ADDR_STR2
2799 "BGP attribute is propagated unchanged to this neighbor\n"
2800 "As-path attribute\n"
2801 "Med attribute\n"
2802 "Nexthop attribute\n")
2803
2804ALIAS (no_neighbor_attr_unchanged,
2805 no_neighbor_attr_unchanged7_cmd,
2806 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2807 NO_STR
2808 NEIGHBOR_STR
2809 NEIGHBOR_ADDR_STR2
2810 "BGP attribute is propagated unchanged to this neighbor\n"
2811 "Nexthop attribute\n"
2812 "Med attribute\n"
2813 "As-path attribute\n")
2814
2815ALIAS (no_neighbor_attr_unchanged,
2816 no_neighbor_attr_unchanged8_cmd,
2817 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2818 NO_STR
2819 NEIGHBOR_STR
2820 NEIGHBOR_ADDR_STR2
2821 "BGP attribute is propagated unchanged to this neighbor\n"
2822 "Nexthop attribute\n"
2823 "As-path attribute\n"
2824 "Med attribute\n")
2825
2826ALIAS (no_neighbor_attr_unchanged,
2827 no_neighbor_attr_unchanged9_cmd,
2828 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2829 NO_STR
2830 NEIGHBOR_STR
2831 NEIGHBOR_ADDR_STR2
2832 "BGP attribute is propagated unchanged to this neighbor\n"
2833 "Med attribute\n"
2834 "Nexthop attribute\n"
2835 "As-path attribute\n")
2836
2837ALIAS (no_neighbor_attr_unchanged,
2838 no_neighbor_attr_unchanged10_cmd,
2839 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2840 NO_STR
2841 NEIGHBOR_STR
2842 NEIGHBOR_ADDR_STR2
2843 "BGP attribute is propagated unchanged to this neighbor\n"
2844 "Med attribute\n"
2845 "As-path attribute\n"
2846 "Nexthop attribute\n")
2847
2848/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002849DEFUN_DEPRECATED (neighbor_transparent_as,
2850 neighbor_transparent_as_cmd,
2851 NEIGHBOR_CMD "transparent-as",
2852 NEIGHBOR_STR
2853 NEIGHBOR_ADDR_STR
2854 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002855{
2856 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2857 bgp_node_safi (vty),
2858 PEER_FLAG_AS_PATH_UNCHANGED);
2859}
2860
hassodd4c5932005-02-02 17:15:34 +00002861DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2862 neighbor_transparent_nexthop_cmd,
2863 NEIGHBOR_CMD "transparent-nexthop",
2864 NEIGHBOR_STR
2865 NEIGHBOR_ADDR_STR
2866 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002867{
2868 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2869 bgp_node_safi (vty),
2870 PEER_FLAG_NEXTHOP_UNCHANGED);
2871}
David Lamparter6b0655a2014-06-04 06:53:35 +02002872
paul718e3742002-12-13 20:15:29 +00002873/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00002874static int
paulfd79ac92004-10-13 05:06:08 +00002875peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2876 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002877{
2878 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002879 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002880
2881 peer = peer_and_group_lookup_vty (vty, ip_str);
2882 if (! peer)
2883 return CMD_WARNING;
2884
2885 if (! ttl_str)
2886 ttl = TTL_MAX;
2887 else
2888 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2889
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002890 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
paul718e3742002-12-13 20:15:29 +00002891}
2892
paul94f2b392005-06-28 12:44:16 +00002893static int
paulfd79ac92004-10-13 05:06:08 +00002894peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002895{
2896 struct peer *peer;
2897
2898 peer = peer_and_group_lookup_vty (vty, ip_str);
2899 if (! peer)
2900 return CMD_WARNING;
2901
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002902 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
paul718e3742002-12-13 20:15:29 +00002903}
2904
2905/* neighbor ebgp-multihop. */
2906DEFUN (neighbor_ebgp_multihop,
2907 neighbor_ebgp_multihop_cmd,
2908 NEIGHBOR_CMD2 "ebgp-multihop",
2909 NEIGHBOR_STR
2910 NEIGHBOR_ADDR_STR2
2911 "Allow EBGP neighbors not on directly connected networks\n")
2912{
2913 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2914}
2915
2916DEFUN (neighbor_ebgp_multihop_ttl,
2917 neighbor_ebgp_multihop_ttl_cmd,
2918 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2919 NEIGHBOR_STR
2920 NEIGHBOR_ADDR_STR2
2921 "Allow EBGP neighbors not on directly connected networks\n"
2922 "maximum hop count\n")
2923{
2924 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
2925}
2926
2927DEFUN (no_neighbor_ebgp_multihop,
2928 no_neighbor_ebgp_multihop_cmd,
2929 NO_NEIGHBOR_CMD2 "ebgp-multihop",
2930 NO_STR
2931 NEIGHBOR_STR
2932 NEIGHBOR_ADDR_STR2
2933 "Allow EBGP neighbors not on directly connected networks\n")
2934{
2935 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
2936}
2937
2938ALIAS (no_neighbor_ebgp_multihop,
2939 no_neighbor_ebgp_multihop_ttl_cmd,
2940 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2941 NO_STR
2942 NEIGHBOR_STR
2943 NEIGHBOR_ADDR_STR2
2944 "Allow EBGP neighbors not on directly connected networks\n"
2945 "maximum hop count\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02002946
hasso6ffd2072005-02-02 14:50:11 +00002947/* disable-connected-check */
2948DEFUN (neighbor_disable_connected_check,
2949 neighbor_disable_connected_check_cmd,
2950 NEIGHBOR_CMD2 "disable-connected-check",
2951 NEIGHBOR_STR
2952 NEIGHBOR_ADDR_STR2
2953 "one-hop away EBGP peer using loopback address\n")
2954{
2955 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2956}
2957
2958DEFUN (no_neighbor_disable_connected_check,
2959 no_neighbor_disable_connected_check_cmd,
2960 NO_NEIGHBOR_CMD2 "disable-connected-check",
2961 NO_STR
2962 NEIGHBOR_STR
2963 NEIGHBOR_ADDR_STR2
2964 "one-hop away EBGP peer using loopback address\n")
2965{
2966 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2967}
2968
paul718e3742002-12-13 20:15:29 +00002969/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00002970ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002971 neighbor_enforce_multihop_cmd,
2972 NEIGHBOR_CMD2 "enforce-multihop",
2973 NEIGHBOR_STR
2974 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002975 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00002976
hasso6ffd2072005-02-02 14:50:11 +00002977/* Enforce multihop. */
2978ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002979 no_neighbor_enforce_multihop_cmd,
2980 NO_NEIGHBOR_CMD2 "enforce-multihop",
2981 NO_STR
2982 NEIGHBOR_STR
2983 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002984 "Enforce EBGP neighbors perform multihop\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02002985
paul718e3742002-12-13 20:15:29 +00002986DEFUN (neighbor_description,
2987 neighbor_description_cmd,
2988 NEIGHBOR_CMD2 "description .LINE",
2989 NEIGHBOR_STR
2990 NEIGHBOR_ADDR_STR2
2991 "Neighbor specific description\n"
2992 "Up to 80 characters describing this neighbor\n")
2993{
2994 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00002995 char *str;
paul718e3742002-12-13 20:15:29 +00002996
2997 peer = peer_and_group_lookup_vty (vty, argv[0]);
2998 if (! peer)
2999 return CMD_WARNING;
3000
3001 if (argc == 1)
3002 return CMD_SUCCESS;
3003
ajs3b8b1852005-01-29 18:19:13 +00003004 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00003005
3006 peer_description_set (peer, str);
3007
ajs3b8b1852005-01-29 18:19:13 +00003008 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00003009
3010 return CMD_SUCCESS;
3011}
3012
3013DEFUN (no_neighbor_description,
3014 no_neighbor_description_cmd,
3015 NO_NEIGHBOR_CMD2 "description",
3016 NO_STR
3017 NEIGHBOR_STR
3018 NEIGHBOR_ADDR_STR2
3019 "Neighbor specific description\n")
3020{
3021 struct peer *peer;
3022
3023 peer = peer_and_group_lookup_vty (vty, argv[0]);
3024 if (! peer)
3025 return CMD_WARNING;
3026
3027 peer_description_unset (peer);
3028
3029 return CMD_SUCCESS;
3030}
3031
3032ALIAS (no_neighbor_description,
3033 no_neighbor_description_val_cmd,
3034 NO_NEIGHBOR_CMD2 "description .LINE",
3035 NO_STR
3036 NEIGHBOR_STR
3037 NEIGHBOR_ADDR_STR2
3038 "Neighbor specific description\n"
3039 "Up to 80 characters describing this neighbor\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003040
paul718e3742002-12-13 20:15:29 +00003041/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00003042static int
paulfd79ac92004-10-13 05:06:08 +00003043peer_update_source_vty (struct vty *vty, const char *peer_str,
3044 const char *source_str)
paul718e3742002-12-13 20:15:29 +00003045{
3046 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003047
3048 peer = peer_and_group_lookup_vty (vty, peer_str);
3049 if (! peer)
3050 return CMD_WARNING;
3051
3052 if (source_str)
3053 {
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +02003054 union sockunion su;
3055 int ret = str2sockunion (source_str, &su);
3056
3057 if (ret == 0)
3058 peer_update_source_addr_set (peer, &su);
paul718e3742002-12-13 20:15:29 +00003059 else
3060 peer_update_source_if_set (peer, source_str);
3061 }
3062 else
3063 peer_update_source_unset (peer);
3064
3065 return CMD_SUCCESS;
3066}
3067
Paul Jakma9a1a3312009-07-27 12:27:55 +01003068#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
Paul Jakma369688c2006-05-23 22:27:55 +00003069#define BGP_UPDATE_SOURCE_HELP_STR \
3070 "IPv4 address\n" \
Paul Jakma9a1a3312009-07-27 12:27:55 +01003071 "IPv6 address\n" \
3072 "Interface name (requires zebra to be running)\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003073
paul718e3742002-12-13 20:15:29 +00003074DEFUN (neighbor_update_source,
3075 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00003076 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00003077 NEIGHBOR_STR
3078 NEIGHBOR_ADDR_STR2
3079 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003080 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00003081{
3082 return peer_update_source_vty (vty, argv[0], argv[1]);
3083}
3084
3085DEFUN (no_neighbor_update_source,
3086 no_neighbor_update_source_cmd,
3087 NO_NEIGHBOR_CMD2 "update-source",
3088 NO_STR
3089 NEIGHBOR_STR
3090 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00003091 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00003092{
3093 return peer_update_source_vty (vty, argv[0], NULL);
3094}
David Lamparter6b0655a2014-06-04 06:53:35 +02003095
paul94f2b392005-06-28 12:44:16 +00003096static int
paulfd79ac92004-10-13 05:06:08 +00003097peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
3098 afi_t afi, safi_t safi,
3099 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00003100{
3101 int ret;
3102 struct peer *peer;
3103
3104 peer = peer_and_group_lookup_vty (vty, peer_str);
3105 if (! peer)
3106 return CMD_WARNING;
3107
3108 if (set)
3109 ret = peer_default_originate_set (peer, afi, safi, rmap);
3110 else
3111 ret = peer_default_originate_unset (peer, afi, safi);
3112
3113 return bgp_vty_return (vty, ret);
3114}
3115
3116/* neighbor default-originate. */
3117DEFUN (neighbor_default_originate,
3118 neighbor_default_originate_cmd,
3119 NEIGHBOR_CMD2 "default-originate",
3120 NEIGHBOR_STR
3121 NEIGHBOR_ADDR_STR2
3122 "Originate default route to this neighbor\n")
3123{
3124 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3125 bgp_node_safi (vty), NULL, 1);
3126}
3127
3128DEFUN (neighbor_default_originate_rmap,
3129 neighbor_default_originate_rmap_cmd,
3130 NEIGHBOR_CMD2 "default-originate route-map WORD",
3131 NEIGHBOR_STR
3132 NEIGHBOR_ADDR_STR2
3133 "Originate default route to this neighbor\n"
3134 "Route-map to specify criteria to originate default\n"
3135 "route-map name\n")
3136{
3137 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3138 bgp_node_safi (vty), argv[1], 1);
3139}
3140
3141DEFUN (no_neighbor_default_originate,
3142 no_neighbor_default_originate_cmd,
3143 NO_NEIGHBOR_CMD2 "default-originate",
3144 NO_STR
3145 NEIGHBOR_STR
3146 NEIGHBOR_ADDR_STR2
3147 "Originate default route to this neighbor\n")
3148{
3149 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3150 bgp_node_safi (vty), NULL, 0);
3151}
3152
3153ALIAS (no_neighbor_default_originate,
3154 no_neighbor_default_originate_rmap_cmd,
3155 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3156 NO_STR
3157 NEIGHBOR_STR
3158 NEIGHBOR_ADDR_STR2
3159 "Originate default route to this neighbor\n"
3160 "Route-map to specify criteria to originate default\n"
3161 "route-map name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003162
paul718e3742002-12-13 20:15:29 +00003163/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00003164static int
paulfd79ac92004-10-13 05:06:08 +00003165peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3166 const char *port_str)
paul718e3742002-12-13 20:15:29 +00003167{
3168 struct peer *peer;
3169 u_int16_t port;
3170 struct servent *sp;
3171
3172 peer = peer_lookup_vty (vty, ip_str);
3173 if (! peer)
3174 return CMD_WARNING;
3175
3176 if (! port_str)
3177 {
3178 sp = getservbyname ("bgp", "tcp");
3179 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3180 }
3181 else
3182 {
3183 VTY_GET_INTEGER("port", port, port_str);
3184 }
3185
3186 peer_port_set (peer, port);
3187
3188 return CMD_SUCCESS;
3189}
3190
hassof4184462005-02-01 20:13:16 +00003191/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00003192DEFUN (neighbor_port,
3193 neighbor_port_cmd,
3194 NEIGHBOR_CMD "port <0-65535>",
3195 NEIGHBOR_STR
3196 NEIGHBOR_ADDR_STR
3197 "Neighbor's BGP port\n"
3198 "TCP port number\n")
3199{
3200 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3201}
3202
3203DEFUN (no_neighbor_port,
3204 no_neighbor_port_cmd,
3205 NO_NEIGHBOR_CMD "port",
3206 NO_STR
3207 NEIGHBOR_STR
3208 NEIGHBOR_ADDR_STR
3209 "Neighbor's BGP port\n")
3210{
3211 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3212}
3213
3214ALIAS (no_neighbor_port,
3215 no_neighbor_port_val_cmd,
3216 NO_NEIGHBOR_CMD "port <0-65535>",
3217 NO_STR
3218 NEIGHBOR_STR
3219 NEIGHBOR_ADDR_STR
3220 "Neighbor's BGP port\n"
3221 "TCP port number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003222
paul718e3742002-12-13 20:15:29 +00003223/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00003224static int
paulfd79ac92004-10-13 05:06:08 +00003225peer_weight_set_vty (struct vty *vty, const char *ip_str,
3226 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00003227{
paul718e3742002-12-13 20:15:29 +00003228 struct peer *peer;
3229 unsigned long weight;
3230
3231 peer = peer_and_group_lookup_vty (vty, ip_str);
3232 if (! peer)
3233 return CMD_WARNING;
3234
3235 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3236
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003237 return bgp_vty_return (vty, peer_weight_set (peer, weight));
paul718e3742002-12-13 20:15:29 +00003238}
3239
paul94f2b392005-06-28 12:44:16 +00003240static int
paulfd79ac92004-10-13 05:06:08 +00003241peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003242{
3243 struct peer *peer;
3244
3245 peer = peer_and_group_lookup_vty (vty, ip_str);
3246 if (! peer)
3247 return CMD_WARNING;
3248
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003249 return bgp_vty_return (vty, peer_weight_unset (peer));
paul718e3742002-12-13 20:15:29 +00003250}
3251
3252DEFUN (neighbor_weight,
3253 neighbor_weight_cmd,
3254 NEIGHBOR_CMD2 "weight <0-65535>",
3255 NEIGHBOR_STR
3256 NEIGHBOR_ADDR_STR2
3257 "Set default weight for routes from this neighbor\n"
3258 "default weight\n")
3259{
3260 return peer_weight_set_vty (vty, argv[0], argv[1]);
3261}
3262
3263DEFUN (no_neighbor_weight,
3264 no_neighbor_weight_cmd,
3265 NO_NEIGHBOR_CMD2 "weight",
3266 NO_STR
3267 NEIGHBOR_STR
3268 NEIGHBOR_ADDR_STR2
3269 "Set default weight for routes from this neighbor\n")
3270{
3271 return peer_weight_unset_vty (vty, argv[0]);
3272}
3273
3274ALIAS (no_neighbor_weight,
3275 no_neighbor_weight_val_cmd,
3276 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3277 NO_STR
3278 NEIGHBOR_STR
3279 NEIGHBOR_ADDR_STR2
3280 "Set default weight for routes from this neighbor\n"
3281 "default weight\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003282
paul718e3742002-12-13 20:15:29 +00003283/* Override capability negotiation. */
3284DEFUN (neighbor_override_capability,
3285 neighbor_override_capability_cmd,
3286 NEIGHBOR_CMD2 "override-capability",
3287 NEIGHBOR_STR
3288 NEIGHBOR_ADDR_STR2
3289 "Override capability negotiation result\n")
3290{
3291 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3292}
3293
3294DEFUN (no_neighbor_override_capability,
3295 no_neighbor_override_capability_cmd,
3296 NO_NEIGHBOR_CMD2 "override-capability",
3297 NO_STR
3298 NEIGHBOR_STR
3299 NEIGHBOR_ADDR_STR2
3300 "Override capability negotiation result\n")
3301{
3302 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3303}
David Lamparter6b0655a2014-06-04 06:53:35 +02003304
paul718e3742002-12-13 20:15:29 +00003305DEFUN (neighbor_strict_capability,
3306 neighbor_strict_capability_cmd,
3307 NEIGHBOR_CMD "strict-capability-match",
3308 NEIGHBOR_STR
3309 NEIGHBOR_ADDR_STR
3310 "Strict capability negotiation match\n")
3311{
3312 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3313}
3314
3315DEFUN (no_neighbor_strict_capability,
3316 no_neighbor_strict_capability_cmd,
3317 NO_NEIGHBOR_CMD "strict-capability-match",
3318 NO_STR
3319 NEIGHBOR_STR
3320 NEIGHBOR_ADDR_STR
3321 "Strict capability negotiation match\n")
3322{
3323 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3324}
David Lamparter6b0655a2014-06-04 06:53:35 +02003325
paul94f2b392005-06-28 12:44:16 +00003326static int
paulfd79ac92004-10-13 05:06:08 +00003327peer_timers_set_vty (struct vty *vty, const char *ip_str,
3328 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003329{
3330 int ret;
3331 struct peer *peer;
3332 u_int32_t keepalive;
3333 u_int32_t holdtime;
3334
3335 peer = peer_and_group_lookup_vty (vty, ip_str);
3336 if (! peer)
3337 return CMD_WARNING;
3338
3339 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3340 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3341
3342 ret = peer_timers_set (peer, keepalive, holdtime);
3343
3344 return bgp_vty_return (vty, ret);
3345}
David Lamparter6b0655a2014-06-04 06:53:35 +02003346
paul94f2b392005-06-28 12:44:16 +00003347static int
paulfd79ac92004-10-13 05:06:08 +00003348peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003349{
3350 int ret;
3351 struct peer *peer;
3352
3353 peer = peer_lookup_vty (vty, ip_str);
3354 if (! peer)
3355 return CMD_WARNING;
3356
3357 ret = peer_timers_unset (peer);
3358
3359 return bgp_vty_return (vty, ret);
3360}
3361
3362DEFUN (neighbor_timers,
3363 neighbor_timers_cmd,
3364 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3365 NEIGHBOR_STR
3366 NEIGHBOR_ADDR_STR2
3367 "BGP per neighbor timers\n"
3368 "Keepalive interval\n"
3369 "Holdtime\n")
3370{
3371 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3372}
3373
3374DEFUN (no_neighbor_timers,
3375 no_neighbor_timers_cmd,
3376 NO_NEIGHBOR_CMD2 "timers",
3377 NO_STR
3378 NEIGHBOR_STR
3379 NEIGHBOR_ADDR_STR2
3380 "BGP per neighbor timers\n")
3381{
3382 return peer_timers_unset_vty (vty, argv[0]);
3383}
David Lamparter6b0655a2014-06-04 06:53:35 +02003384
paul94f2b392005-06-28 12:44:16 +00003385static int
paulfd79ac92004-10-13 05:06:08 +00003386peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3387 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003388{
paul718e3742002-12-13 20:15:29 +00003389 struct peer *peer;
3390 u_int32_t connect;
3391
Daniel Walton0d7435f2015-10-22 11:35:20 +03003392 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003393 if (! peer)
3394 return CMD_WARNING;
3395
3396 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3397
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003398 return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
paul718e3742002-12-13 20:15:29 +00003399}
3400
paul94f2b392005-06-28 12:44:16 +00003401static int
paulfd79ac92004-10-13 05:06:08 +00003402peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003403{
paul718e3742002-12-13 20:15:29 +00003404 struct peer *peer;
3405
3406 peer = peer_and_group_lookup_vty (vty, ip_str);
3407 if (! peer)
3408 return CMD_WARNING;
3409
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003410 return bgp_vty_return (vty, peer_timers_connect_unset (peer));
paul718e3742002-12-13 20:15:29 +00003411}
3412
3413DEFUN (neighbor_timers_connect,
3414 neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003415 NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003416 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003417 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003418 "BGP per neighbor timers\n"
3419 "BGP connect timer\n"
3420 "Connect timer\n")
3421{
3422 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3423}
3424
3425DEFUN (no_neighbor_timers_connect,
3426 no_neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003427 NO_NEIGHBOR_CMD2 "timers connect",
paul718e3742002-12-13 20:15:29 +00003428 NO_STR
3429 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003430 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003431 "BGP per neighbor timers\n"
3432 "BGP connect timer\n")
3433{
3434 return peer_timers_connect_unset_vty (vty, argv[0]);
3435}
3436
3437ALIAS (no_neighbor_timers_connect,
3438 no_neighbor_timers_connect_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003439 NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003440 NO_STR
3441 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003442 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003443 "BGP per neighbor timers\n"
3444 "BGP connect timer\n"
3445 "Connect timer\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003446
paul94f2b392005-06-28 12:44:16 +00003447static int
paulfd79ac92004-10-13 05:06:08 +00003448peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3449 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003450{
3451 int ret;
3452 struct peer *peer;
3453 u_int32_t routeadv = 0;
3454
Daniel Walton0d7435f2015-10-22 11:35:20 +03003455 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003456 if (! peer)
3457 return CMD_WARNING;
3458
3459 if (time_str)
3460 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3461
3462 if (set)
3463 ret = peer_advertise_interval_set (peer, routeadv);
3464 else
3465 ret = peer_advertise_interval_unset (peer);
3466
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003467 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003468}
3469
3470DEFUN (neighbor_advertise_interval,
3471 neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003472 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003473 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003474 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003475 "Minimum interval between sending BGP routing updates\n"
3476 "time in seconds\n")
3477{
3478 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3479}
3480
3481DEFUN (no_neighbor_advertise_interval,
3482 no_neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003483 NO_NEIGHBOR_CMD2 "advertisement-interval",
paul718e3742002-12-13 20:15:29 +00003484 NO_STR
3485 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003486 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003487 "Minimum interval between sending BGP routing updates\n")
3488{
3489 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3490}
3491
3492ALIAS (no_neighbor_advertise_interval,
3493 no_neighbor_advertise_interval_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003494 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003495 NO_STR
3496 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003497 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003498 "Minimum interval between sending BGP routing updates\n"
3499 "time in seconds\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003500
paul718e3742002-12-13 20:15:29 +00003501/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003502static int
paulfd79ac92004-10-13 05:06:08 +00003503peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003504{
3505 int ret;
3506 struct peer *peer;
3507
3508 peer = peer_lookup_vty (vty, ip_str);
3509 if (! peer)
3510 return CMD_WARNING;
3511
3512 if (str)
3513 ret = peer_interface_set (peer, str);
3514 else
3515 ret = peer_interface_unset (peer);
3516
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003517 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003518}
3519
3520DEFUN (neighbor_interface,
3521 neighbor_interface_cmd,
3522 NEIGHBOR_CMD "interface WORD",
3523 NEIGHBOR_STR
3524 NEIGHBOR_ADDR_STR
3525 "Interface\n"
3526 "Interface name\n")
3527{
3528 return peer_interface_vty (vty, argv[0], argv[1]);
3529}
3530
3531DEFUN (no_neighbor_interface,
3532 no_neighbor_interface_cmd,
3533 NO_NEIGHBOR_CMD "interface WORD",
3534 NO_STR
3535 NEIGHBOR_STR
3536 NEIGHBOR_ADDR_STR
3537 "Interface\n"
3538 "Interface name\n")
3539{
3540 return peer_interface_vty (vty, argv[0], NULL);
3541}
David Lamparter6b0655a2014-06-04 06:53:35 +02003542
paul718e3742002-12-13 20:15:29 +00003543/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003544static int
paulfd79ac92004-10-13 05:06:08 +00003545peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3546 afi_t afi, safi_t safi,
3547 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003548{
3549 int ret;
3550 struct peer *peer;
3551 int direct = FILTER_IN;
3552
3553 peer = peer_and_group_lookup_vty (vty, ip_str);
3554 if (! peer)
3555 return CMD_WARNING;
3556
3557 /* Check filter direction. */
3558 if (strncmp (direct_str, "i", 1) == 0)
3559 direct = FILTER_IN;
3560 else if (strncmp (direct_str, "o", 1) == 0)
3561 direct = FILTER_OUT;
3562
3563 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3564
3565 return bgp_vty_return (vty, ret);
3566}
3567
paul94f2b392005-06-28 12:44:16 +00003568static int
paulfd79ac92004-10-13 05:06:08 +00003569peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3570 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003571{
3572 int ret;
3573 struct peer *peer;
3574 int direct = FILTER_IN;
3575
3576 peer = peer_and_group_lookup_vty (vty, ip_str);
3577 if (! peer)
3578 return CMD_WARNING;
3579
3580 /* Check filter direction. */
3581 if (strncmp (direct_str, "i", 1) == 0)
3582 direct = FILTER_IN;
3583 else if (strncmp (direct_str, "o", 1) == 0)
3584 direct = FILTER_OUT;
3585
3586 ret = peer_distribute_unset (peer, afi, safi, direct);
3587
3588 return bgp_vty_return (vty, ret);
3589}
3590
3591DEFUN (neighbor_distribute_list,
3592 neighbor_distribute_list_cmd,
3593 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3594 NEIGHBOR_STR
3595 NEIGHBOR_ADDR_STR2
3596 "Filter updates to/from this neighbor\n"
3597 "IP access-list number\n"
3598 "IP access-list number (expanded range)\n"
3599 "IP Access-list name\n"
3600 "Filter incoming updates\n"
3601 "Filter outgoing updates\n")
3602{
3603 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3604 bgp_node_safi (vty), argv[1], argv[2]);
3605}
3606
3607DEFUN (no_neighbor_distribute_list,
3608 no_neighbor_distribute_list_cmd,
3609 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3610 NO_STR
3611 NEIGHBOR_STR
3612 NEIGHBOR_ADDR_STR2
3613 "Filter updates to/from this neighbor\n"
3614 "IP access-list number\n"
3615 "IP access-list number (expanded range)\n"
3616 "IP Access-list name\n"
3617 "Filter incoming updates\n"
3618 "Filter outgoing updates\n")
3619{
3620 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3621 bgp_node_safi (vty), argv[2]);
3622}
David Lamparter6b0655a2014-06-04 06:53:35 +02003623
paul718e3742002-12-13 20:15:29 +00003624/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003625static int
paulfd79ac92004-10-13 05:06:08 +00003626peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3627 safi_t safi, const char *name_str,
3628 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003629{
3630 int ret;
3631 struct peer *peer;
3632 int direct = FILTER_IN;
3633
3634 peer = peer_and_group_lookup_vty (vty, ip_str);
3635 if (! peer)
3636 return CMD_WARNING;
3637
3638 /* Check filter direction. */
3639 if (strncmp (direct_str, "i", 1) == 0)
3640 direct = FILTER_IN;
3641 else if (strncmp (direct_str, "o", 1) == 0)
3642 direct = FILTER_OUT;
3643
3644 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3645
3646 return bgp_vty_return (vty, ret);
3647}
3648
paul94f2b392005-06-28 12:44:16 +00003649static int
paulfd79ac92004-10-13 05:06:08 +00003650peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3651 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003652{
3653 int ret;
3654 struct peer *peer;
3655 int direct = FILTER_IN;
3656
3657 peer = peer_and_group_lookup_vty (vty, ip_str);
3658 if (! peer)
3659 return CMD_WARNING;
3660
3661 /* Check filter direction. */
3662 if (strncmp (direct_str, "i", 1) == 0)
3663 direct = FILTER_IN;
3664 else if (strncmp (direct_str, "o", 1) == 0)
3665 direct = FILTER_OUT;
3666
3667 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3668
3669 return bgp_vty_return (vty, ret);
3670}
3671
3672DEFUN (neighbor_prefix_list,
3673 neighbor_prefix_list_cmd,
3674 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3675 NEIGHBOR_STR
3676 NEIGHBOR_ADDR_STR2
3677 "Filter updates to/from this neighbor\n"
3678 "Name of a prefix list\n"
3679 "Filter incoming updates\n"
3680 "Filter outgoing updates\n")
3681{
3682 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3683 bgp_node_safi (vty), argv[1], argv[2]);
3684}
3685
3686DEFUN (no_neighbor_prefix_list,
3687 no_neighbor_prefix_list_cmd,
3688 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3689 NO_STR
3690 NEIGHBOR_STR
3691 NEIGHBOR_ADDR_STR2
3692 "Filter updates to/from this neighbor\n"
3693 "Name of a prefix list\n"
3694 "Filter incoming updates\n"
3695 "Filter outgoing updates\n")
3696{
3697 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3698 bgp_node_safi (vty), argv[2]);
3699}
David Lamparter6b0655a2014-06-04 06:53:35 +02003700
paul94f2b392005-06-28 12:44:16 +00003701static int
paulfd79ac92004-10-13 05:06:08 +00003702peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3703 afi_t afi, safi_t safi,
3704 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003705{
3706 int ret;
3707 struct peer *peer;
3708 int direct = FILTER_IN;
3709
3710 peer = peer_and_group_lookup_vty (vty, ip_str);
3711 if (! peer)
3712 return CMD_WARNING;
3713
3714 /* Check filter direction. */
3715 if (strncmp (direct_str, "i", 1) == 0)
3716 direct = FILTER_IN;
3717 else if (strncmp (direct_str, "o", 1) == 0)
3718 direct = FILTER_OUT;
3719
3720 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3721
3722 return bgp_vty_return (vty, ret);
3723}
3724
paul94f2b392005-06-28 12:44:16 +00003725static int
paulfd79ac92004-10-13 05:06:08 +00003726peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3727 afi_t afi, safi_t safi,
3728 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003729{
3730 int ret;
3731 struct peer *peer;
3732 int direct = FILTER_IN;
3733
3734 peer = peer_and_group_lookup_vty (vty, ip_str);
3735 if (! peer)
3736 return CMD_WARNING;
3737
3738 /* Check filter direction. */
3739 if (strncmp (direct_str, "i", 1) == 0)
3740 direct = FILTER_IN;
3741 else if (strncmp (direct_str, "o", 1) == 0)
3742 direct = FILTER_OUT;
3743
3744 ret = peer_aslist_unset (peer, afi, safi, direct);
3745
3746 return bgp_vty_return (vty, ret);
3747}
3748
3749DEFUN (neighbor_filter_list,
3750 neighbor_filter_list_cmd,
3751 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3752 NEIGHBOR_STR
3753 NEIGHBOR_ADDR_STR2
3754 "Establish BGP filters\n"
3755 "AS path access-list name\n"
3756 "Filter incoming routes\n"
3757 "Filter outgoing routes\n")
3758{
3759 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3760 bgp_node_safi (vty), argv[1], argv[2]);
3761}
3762
3763DEFUN (no_neighbor_filter_list,
3764 no_neighbor_filter_list_cmd,
3765 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3766 NO_STR
3767 NEIGHBOR_STR
3768 NEIGHBOR_ADDR_STR2
3769 "Establish BGP filters\n"
3770 "AS path access-list name\n"
3771 "Filter incoming routes\n"
3772 "Filter outgoing routes\n")
3773{
3774 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3775 bgp_node_safi (vty), argv[2]);
3776}
David Lamparter6b0655a2014-06-04 06:53:35 +02003777
paul718e3742002-12-13 20:15:29 +00003778/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003779static int
paulfd79ac92004-10-13 05:06:08 +00003780peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3781 afi_t afi, safi_t safi,
3782 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003783{
3784 int ret;
3785 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003786 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003787
3788 peer = peer_and_group_lookup_vty (vty, ip_str);
3789 if (! peer)
3790 return CMD_WARNING;
3791
3792 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003793 if (strncmp (direct_str, "in", 2) == 0)
3794 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003795 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003796 direct = RMAP_OUT;
3797 else if (strncmp (direct_str, "im", 2) == 0)
3798 direct = RMAP_IMPORT;
3799 else if (strncmp (direct_str, "e", 1) == 0)
3800 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003801
3802 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3803
3804 return bgp_vty_return (vty, ret);
3805}
3806
paul94f2b392005-06-28 12:44:16 +00003807static int
paulfd79ac92004-10-13 05:06:08 +00003808peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3809 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003810{
3811 int ret;
3812 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003813 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003814
3815 peer = peer_and_group_lookup_vty (vty, ip_str);
3816 if (! peer)
3817 return CMD_WARNING;
3818
3819 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003820 if (strncmp (direct_str, "in", 2) == 0)
3821 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003822 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003823 direct = RMAP_OUT;
3824 else if (strncmp (direct_str, "im", 2) == 0)
3825 direct = RMAP_IMPORT;
3826 else if (strncmp (direct_str, "e", 1) == 0)
3827 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003828
3829 ret = peer_route_map_unset (peer, afi, safi, direct);
3830
3831 return bgp_vty_return (vty, ret);
3832}
3833
3834DEFUN (neighbor_route_map,
3835 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003836 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003837 NEIGHBOR_STR
3838 NEIGHBOR_ADDR_STR2
3839 "Apply route map to neighbor\n"
3840 "Name of route map\n"
3841 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003842 "Apply map to outbound routes\n"
3843 "Apply map to routes going into a Route-Server client's table\n"
3844 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003845{
3846 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3847 bgp_node_safi (vty), argv[1], argv[2]);
3848}
3849
3850DEFUN (no_neighbor_route_map,
3851 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003852 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003853 NO_STR
3854 NEIGHBOR_STR
3855 NEIGHBOR_ADDR_STR2
3856 "Apply route map to neighbor\n"
3857 "Name of route map\n"
3858 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003859 "Apply map to outbound routes\n"
3860 "Apply map to routes going into a Route-Server client's table\n"
3861 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003862{
3863 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3864 bgp_node_safi (vty), argv[2]);
3865}
David Lamparter6b0655a2014-06-04 06:53:35 +02003866
paul718e3742002-12-13 20:15:29 +00003867/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003868static int
paulfd79ac92004-10-13 05:06:08 +00003869peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3870 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003871{
3872 int ret;
3873 struct peer *peer;
3874
3875 peer = peer_and_group_lookup_vty (vty, ip_str);
3876 if (! peer)
3877 return CMD_WARNING;
3878
3879 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3880
3881 return bgp_vty_return (vty, ret);
3882}
3883
3884/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003885static int
paulfd79ac92004-10-13 05:06:08 +00003886peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003887 safi_t safi)
3888{
3889 int ret;
3890 struct peer *peer;
3891
3892 peer = peer_and_group_lookup_vty (vty, ip_str);
3893 if (! peer)
3894 return CMD_WARNING;
3895
3896 ret = peer_unsuppress_map_unset (peer, afi, safi);
3897
3898 return bgp_vty_return (vty, ret);
3899}
3900
3901DEFUN (neighbor_unsuppress_map,
3902 neighbor_unsuppress_map_cmd,
3903 NEIGHBOR_CMD2 "unsuppress-map WORD",
3904 NEIGHBOR_STR
3905 NEIGHBOR_ADDR_STR2
3906 "Route-map to selectively unsuppress suppressed routes\n"
3907 "Name of route map\n")
3908{
3909 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3910 bgp_node_safi (vty), argv[1]);
3911}
3912
3913DEFUN (no_neighbor_unsuppress_map,
3914 no_neighbor_unsuppress_map_cmd,
3915 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3916 NO_STR
3917 NEIGHBOR_STR
3918 NEIGHBOR_ADDR_STR2
3919 "Route-map to selectively unsuppress suppressed routes\n"
3920 "Name of route map\n")
3921{
3922 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3923 bgp_node_safi (vty));
3924}
David Lamparter6b0655a2014-06-04 06:53:35 +02003925
paul94f2b392005-06-28 12:44:16 +00003926static int
paulfd79ac92004-10-13 05:06:08 +00003927peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3928 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003929 const char *threshold_str, int warning,
3930 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003931{
3932 int ret;
3933 struct peer *peer;
3934 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003935 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003936 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003937
3938 peer = peer_and_group_lookup_vty (vty, ip_str);
3939 if (! peer)
3940 return CMD_WARNING;
3941
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04003942 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003943 if (threshold_str)
3944 threshold = atoi (threshold_str);
3945 else
3946 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00003947
hasso0a486e52005-02-01 20:57:17 +00003948 if (restart_str)
3949 restart = atoi (restart_str);
3950 else
3951 restart = 0;
3952
3953 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00003954
3955 return bgp_vty_return (vty, ret);
3956}
3957
paul94f2b392005-06-28 12:44:16 +00003958static int
paulfd79ac92004-10-13 05:06:08 +00003959peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003960 safi_t safi)
3961{
3962 int ret;
3963 struct peer *peer;
3964
3965 peer = peer_and_group_lookup_vty (vty, ip_str);
3966 if (! peer)
3967 return CMD_WARNING;
3968
3969 ret = peer_maximum_prefix_unset (peer, afi, safi);
3970
3971 return bgp_vty_return (vty, ret);
3972}
3973
3974/* Maximum number of prefix configuration. prefix count is different
3975 for each peer configuration. So this configuration can be set for
3976 each peer configuration. */
3977DEFUN (neighbor_maximum_prefix,
3978 neighbor_maximum_prefix_cmd,
3979 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3980 NEIGHBOR_STR
3981 NEIGHBOR_ADDR_STR2
3982 "Maximum number of prefix accept from this peer\n"
3983 "maximum no. of prefix limit\n")
3984{
3985 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003986 bgp_node_safi (vty), argv[1], NULL, 0,
3987 NULL);
paul718e3742002-12-13 20:15:29 +00003988}
3989
hassoe0701b72004-05-20 09:19:34 +00003990DEFUN (neighbor_maximum_prefix_threshold,
3991 neighbor_maximum_prefix_threshold_cmd,
3992 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
3993 NEIGHBOR_STR
3994 NEIGHBOR_ADDR_STR2
3995 "Maximum number of prefix accept from this peer\n"
3996 "maximum no. of prefix limit\n"
3997 "Threshold value (%) at which to generate a warning msg\n")
3998{
3999 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004000 bgp_node_safi (vty), argv[1], argv[2], 0,
4001 NULL);
4002}
hassoe0701b72004-05-20 09:19:34 +00004003
paul718e3742002-12-13 20:15:29 +00004004DEFUN (neighbor_maximum_prefix_warning,
4005 neighbor_maximum_prefix_warning_cmd,
4006 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4007 NEIGHBOR_STR
4008 NEIGHBOR_ADDR_STR2
4009 "Maximum number of prefix accept from this peer\n"
4010 "maximum no. of prefix limit\n"
4011 "Only give warning message when limit is exceeded\n")
4012{
4013 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004014 bgp_node_safi (vty), argv[1], NULL, 1,
4015 NULL);
paul718e3742002-12-13 20:15:29 +00004016}
4017
hassoe0701b72004-05-20 09:19:34 +00004018DEFUN (neighbor_maximum_prefix_threshold_warning,
4019 neighbor_maximum_prefix_threshold_warning_cmd,
4020 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4021 NEIGHBOR_STR
4022 NEIGHBOR_ADDR_STR2
4023 "Maximum number of prefix accept from this peer\n"
4024 "maximum no. of prefix limit\n"
4025 "Threshold value (%) at which to generate a warning msg\n"
4026 "Only give warning message when limit is exceeded\n")
4027{
4028 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004029 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4030}
4031
4032DEFUN (neighbor_maximum_prefix_restart,
4033 neighbor_maximum_prefix_restart_cmd,
4034 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
4035 NEIGHBOR_STR
4036 NEIGHBOR_ADDR_STR2
4037 "Maximum number of prefix accept from this peer\n"
4038 "maximum no. of prefix limit\n"
4039 "Restart bgp connection after limit is exceeded\n"
4040 "Restart interval in minutes")
4041{
4042 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4043 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
4044}
4045
4046DEFUN (neighbor_maximum_prefix_threshold_restart,
4047 neighbor_maximum_prefix_threshold_restart_cmd,
4048 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4049 NEIGHBOR_STR
4050 NEIGHBOR_ADDR_STR2
4051 "Maximum number of prefix accept from this peer\n"
4052 "maximum no. of prefix limit\n"
4053 "Threshold value (%) at which to generate a warning msg\n"
4054 "Restart bgp connection after limit is exceeded\n"
4055 "Restart interval in minutes")
4056{
4057 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4058 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4059}
hassoe0701b72004-05-20 09:19:34 +00004060
paul718e3742002-12-13 20:15:29 +00004061DEFUN (no_neighbor_maximum_prefix,
4062 no_neighbor_maximum_prefix_cmd,
4063 NO_NEIGHBOR_CMD2 "maximum-prefix",
4064 NO_STR
4065 NEIGHBOR_STR
4066 NEIGHBOR_ADDR_STR2
4067 "Maximum number of prefix accept from this peer\n")
4068{
4069 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4070 bgp_node_safi (vty));
4071}
4072
4073ALIAS (no_neighbor_maximum_prefix,
4074 no_neighbor_maximum_prefix_val_cmd,
4075 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4076 NO_STR
4077 NEIGHBOR_STR
4078 NEIGHBOR_ADDR_STR2
4079 "Maximum number of prefix accept from this peer\n"
4080 "maximum no. of prefix limit\n")
4081
4082ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004083 no_neighbor_maximum_prefix_threshold_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"
4090 "Threshold value (%) at which to generate a warning msg\n")
4091
4092ALIAS (no_neighbor_maximum_prefix,
4093 no_neighbor_maximum_prefix_warning_cmd,
4094 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> 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"
paule8e19462006-01-19 20:16:55 +00004100 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004101
4102ALIAS (no_neighbor_maximum_prefix,
4103 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004104 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4105 NO_STR
4106 NEIGHBOR_STR
4107 NEIGHBOR_ADDR_STR2
4108 "Maximum number of prefix accept from this peer\n"
4109 "maximum no. of prefix limit\n"
4110 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004111 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004112
4113ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004114 no_neighbor_maximum_prefix_restart_cmd,
4115 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004116 NO_STR
4117 NEIGHBOR_STR
4118 NEIGHBOR_ADDR_STR2
4119 "Maximum number of prefix accept from this peer\n"
4120 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00004121 "Restart bgp connection after limit is exceeded\n"
4122 "Restart interval in minutes")
4123
4124ALIAS (no_neighbor_maximum_prefix,
4125 no_neighbor_maximum_prefix_threshold_restart_cmd,
4126 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4127 NO_STR
4128 NEIGHBOR_STR
4129 NEIGHBOR_ADDR_STR2
4130 "Maximum number of prefix accept from this peer\n"
4131 "maximum no. of prefix limit\n"
4132 "Threshold value (%) at which to generate a warning msg\n"
4133 "Restart bgp connection after limit is exceeded\n"
4134 "Restart interval in minutes")
David Lamparter6b0655a2014-06-04 06:53:35 +02004135
paul718e3742002-12-13 20:15:29 +00004136/* "neighbor allowas-in" */
4137DEFUN (neighbor_allowas_in,
4138 neighbor_allowas_in_cmd,
4139 NEIGHBOR_CMD2 "allowas-in",
4140 NEIGHBOR_STR
4141 NEIGHBOR_ADDR_STR2
4142 "Accept as-path with my AS present in it\n")
4143{
4144 int ret;
4145 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004146 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004147
4148 peer = peer_and_group_lookup_vty (vty, argv[0]);
4149 if (! peer)
4150 return CMD_WARNING;
4151
4152 if (argc == 1)
4153 allow_num = 3;
4154 else
4155 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4156
4157 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4158 allow_num);
4159
4160 return bgp_vty_return (vty, ret);
4161}
4162
4163ALIAS (neighbor_allowas_in,
4164 neighbor_allowas_in_arg_cmd,
4165 NEIGHBOR_CMD2 "allowas-in <1-10>",
4166 NEIGHBOR_STR
4167 NEIGHBOR_ADDR_STR2
4168 "Accept as-path with my AS present in it\n"
4169 "Number of occurances of AS number\n")
4170
4171DEFUN (no_neighbor_allowas_in,
4172 no_neighbor_allowas_in_cmd,
4173 NO_NEIGHBOR_CMD2 "allowas-in",
4174 NO_STR
4175 NEIGHBOR_STR
4176 NEIGHBOR_ADDR_STR2
4177 "allow local ASN appears in aspath attribute\n")
4178{
4179 int ret;
4180 struct peer *peer;
4181
4182 peer = peer_and_group_lookup_vty (vty, argv[0]);
4183 if (! peer)
4184 return CMD_WARNING;
4185
4186 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4187
4188 return bgp_vty_return (vty, ret);
4189}
David Lamparter6b0655a2014-06-04 06:53:35 +02004190
Nick Hilliardfa411a22011-03-23 15:33:17 +00004191DEFUN (neighbor_ttl_security,
4192 neighbor_ttl_security_cmd,
4193 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4194 NEIGHBOR_STR
4195 NEIGHBOR_ADDR_STR2
4196 "Specify the maximum number of hops to the BGP peer\n")
4197{
4198 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004199 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004200
4201 peer = peer_and_group_lookup_vty (vty, argv[0]);
4202 if (! peer)
4203 return CMD_WARNING;
4204
4205 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4206
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004207 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004208}
4209
4210DEFUN (no_neighbor_ttl_security,
4211 no_neighbor_ttl_security_cmd,
4212 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4213 NO_STR
4214 NEIGHBOR_STR
4215 NEIGHBOR_ADDR_STR2
4216 "Specify the maximum number of hops to the BGP peer\n")
4217{
4218 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004219
4220 peer = peer_and_group_lookup_vty (vty, argv[0]);
4221 if (! peer)
4222 return CMD_WARNING;
4223
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004224 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004225}
David Lamparter6b0655a2014-06-04 06:53:35 +02004226
paul718e3742002-12-13 20:15:29 +00004227/* Address family configuration. */
4228DEFUN (address_family_ipv4,
4229 address_family_ipv4_cmd,
4230 "address-family ipv4",
4231 "Enter Address Family command mode\n"
4232 "Address family\n")
4233{
4234 vty->node = BGP_IPV4_NODE;
4235 return CMD_SUCCESS;
4236}
4237
4238DEFUN (address_family_ipv4_safi,
4239 address_family_ipv4_safi_cmd,
4240 "address-family ipv4 (unicast|multicast)",
4241 "Enter Address Family command mode\n"
4242 "Address family\n"
4243 "Address Family modifier\n"
4244 "Address Family modifier\n")
4245{
4246 if (strncmp (argv[0], "m", 1) == 0)
4247 vty->node = BGP_IPV4M_NODE;
4248 else
4249 vty->node = BGP_IPV4_NODE;
4250
4251 return CMD_SUCCESS;
4252}
4253
paul25ffbdc2005-08-22 22:42:08 +00004254DEFUN (address_family_ipv6,
4255 address_family_ipv6_cmd,
4256 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004257 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004258 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004259{
4260 vty->node = BGP_IPV6_NODE;
4261 return CMD_SUCCESS;
4262}
4263
paul25ffbdc2005-08-22 22:42:08 +00004264DEFUN (address_family_ipv6_safi,
4265 address_family_ipv6_safi_cmd,
4266 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004267 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004268 "Address family\n"
4269 "Address Family modifier\n"
4270 "Address Family modifier\n")
4271{
4272 if (strncmp (argv[0], "m", 1) == 0)
4273 vty->node = BGP_IPV6M_NODE;
4274 else
4275 vty->node = BGP_IPV6_NODE;
4276
4277 return CMD_SUCCESS;
4278}
paul718e3742002-12-13 20:15:29 +00004279
4280DEFUN (address_family_vpnv4,
4281 address_family_vpnv4_cmd,
4282 "address-family vpnv4",
4283 "Enter Address Family command mode\n"
4284 "Address family\n")
4285{
4286 vty->node = BGP_VPNV4_NODE;
4287 return CMD_SUCCESS;
4288}
4289
4290ALIAS (address_family_vpnv4,
4291 address_family_vpnv4_unicast_cmd,
4292 "address-family vpnv4 unicast",
4293 "Enter Address Family command mode\n"
4294 "Address family\n"
4295 "Address Family Modifier\n")
4296
Lou Berger13c378d2016-01-12 13:41:56 -05004297DEFUN (address_family_vpnv6,
4298 address_family_vpnv6_cmd,
4299 "address-family vpnv6",
4300 "Enter Address Family command mode\n"
4301 "Address family\n")
4302{
4303 vty->node = BGP_VPNV6_NODE;
4304 return CMD_SUCCESS;
4305}
4306
4307ALIAS (address_family_vpnv6,
4308 address_family_vpnv6_unicast_cmd,
4309 "address-family vpnv6 unicast",
4310 "Enter Address Family command mode\n"
4311 "Address family\n"
4312 "Address Family Modifier\n")
4313
paul718e3742002-12-13 20:15:29 +00004314DEFUN (exit_address_family,
4315 exit_address_family_cmd,
4316 "exit-address-family",
4317 "Exit from Address Family configuration mode\n")
4318{
hassoa8a80d52005-04-09 13:07:47 +00004319 if (vty->node == BGP_IPV4_NODE
4320 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004321 || vty->node == BGP_VPNV4_NODE
Lou Berger13c378d2016-01-12 13:41:56 -05004322 || vty->node == BGP_VPNV6_NODE
paul25ffbdc2005-08-22 22:42:08 +00004323 || vty->node == BGP_IPV6_NODE
4324 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004325 vty->node = BGP_NODE;
4326 return CMD_SUCCESS;
4327}
David Lamparter6b0655a2014-06-04 06:53:35 +02004328
paul718e3742002-12-13 20:15:29 +00004329/* BGP clear sort. */
4330enum clear_sort
4331{
4332 clear_all,
4333 clear_peer,
4334 clear_group,
4335 clear_external,
4336 clear_as
4337};
4338
paul94f2b392005-06-28 12:44:16 +00004339static void
paul718e3742002-12-13 20:15:29 +00004340bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4341 safi_t safi, int error)
4342{
4343 switch (error)
4344 {
4345 case BGP_ERR_AF_UNCONFIGURED:
4346 vty_out (vty,
4347 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4348 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4349 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4350 peer->host, VTY_NEWLINE);
4351 break;
4352 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4353 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);
4354 break;
4355 default:
4356 break;
4357 }
4358}
4359
4360/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004361static int
paul718e3742002-12-13 20:15:29 +00004362bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004363 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004364{
4365 int ret;
4366 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004367 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004368
4369 /* Clear all neighbors. */
4370 if (sort == clear_all)
4371 {
paul1eb8ef22005-04-07 07:30:20 +00004372 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004373 {
4374 if (stype == BGP_CLEAR_SOFT_NONE)
4375 ret = peer_clear (peer);
4376 else
4377 ret = peer_clear_soft (peer, afi, safi, stype);
4378
4379 if (ret < 0)
4380 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4381 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004382 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004383 }
4384
4385 /* Clear specified neighbors. */
4386 if (sort == clear_peer)
4387 {
4388 union sockunion su;
4389 int ret;
4390
4391 /* Make sockunion for lookup. */
4392 ret = str2sockunion (arg, &su);
4393 if (ret < 0)
4394 {
4395 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004396 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004397 }
4398 peer = peer_lookup (bgp, &su);
4399 if (! peer)
4400 {
4401 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004402 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004403 }
4404
4405 if (stype == BGP_CLEAR_SOFT_NONE)
4406 ret = peer_clear (peer);
4407 else
4408 ret = peer_clear_soft (peer, afi, safi, stype);
4409
4410 if (ret < 0)
4411 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4412
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004413 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004414 }
4415
4416 /* Clear all peer-group members. */
4417 if (sort == clear_group)
4418 {
4419 struct peer_group *group;
4420
4421 group = peer_group_lookup (bgp, arg);
4422 if (! group)
4423 {
4424 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004425 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004426 }
4427
paul1eb8ef22005-04-07 07:30:20 +00004428 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004429 {
4430 if (stype == BGP_CLEAR_SOFT_NONE)
4431 {
4432 ret = peer_clear (peer);
4433 continue;
4434 }
4435
4436 if (! peer->af_group[afi][safi])
4437 continue;
4438
4439 ret = peer_clear_soft (peer, afi, safi, stype);
4440
4441 if (ret < 0)
4442 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4443 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004444 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004445 }
4446
4447 if (sort == clear_external)
4448 {
paul1eb8ef22005-04-07 07:30:20 +00004449 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004450 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004451 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004452 continue;
4453
4454 if (stype == BGP_CLEAR_SOFT_NONE)
4455 ret = peer_clear (peer);
4456 else
4457 ret = peer_clear_soft (peer, afi, safi, stype);
4458
4459 if (ret < 0)
4460 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4461 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004462 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004463 }
4464
4465 if (sort == clear_as)
4466 {
4467 as_t as;
paul718e3742002-12-13 20:15:29 +00004468 int find = 0;
4469
Ulrich Weberbde12e32011-11-16 19:32:12 +04004470 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004471
paul1eb8ef22005-04-07 07:30:20 +00004472 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004473 {
4474 if (peer->as != as)
4475 continue;
4476
4477 find = 1;
4478 if (stype == BGP_CLEAR_SOFT_NONE)
4479 ret = peer_clear (peer);
4480 else
4481 ret = peer_clear_soft (peer, afi, safi, stype);
4482
4483 if (ret < 0)
4484 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4485 }
4486 if (! find)
4487 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4488 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004489 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004490 }
4491
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004492 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004493}
4494
paul94f2b392005-06-28 12:44:16 +00004495static int
paulfd79ac92004-10-13 05:06:08 +00004496bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4497 enum clear_sort sort, enum bgp_clear_type stype,
4498 const char *arg)
paul718e3742002-12-13 20:15:29 +00004499{
paul718e3742002-12-13 20:15:29 +00004500 struct bgp *bgp;
4501
4502 /* BGP structure lookup. */
4503 if (name)
4504 {
4505 bgp = bgp_lookup_by_name (name);
4506 if (bgp == NULL)
4507 {
4508 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4509 return CMD_WARNING;
4510 }
4511 }
4512 else
4513 {
4514 bgp = bgp_get_default ();
4515 if (bgp == NULL)
4516 {
4517 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4518 return CMD_WARNING;
4519 }
4520 }
4521
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004522 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004523}
4524
4525DEFUN (clear_ip_bgp_all,
4526 clear_ip_bgp_all_cmd,
4527 "clear ip bgp *",
4528 CLEAR_STR
4529 IP_STR
4530 BGP_STR
4531 "Clear all peers\n")
4532{
4533 if (argc == 1)
4534 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4535
4536 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4537}
4538
4539ALIAS (clear_ip_bgp_all,
4540 clear_bgp_all_cmd,
4541 "clear bgp *",
4542 CLEAR_STR
4543 BGP_STR
4544 "Clear all peers\n")
4545
4546ALIAS (clear_ip_bgp_all,
4547 clear_bgp_ipv6_all_cmd,
4548 "clear bgp ipv6 *",
4549 CLEAR_STR
4550 BGP_STR
4551 "Address family\n"
4552 "Clear all peers\n")
4553
4554ALIAS (clear_ip_bgp_all,
4555 clear_ip_bgp_instance_all_cmd,
4556 "clear ip bgp view WORD *",
4557 CLEAR_STR
4558 IP_STR
4559 BGP_STR
4560 "BGP view\n"
4561 "view name\n"
4562 "Clear all peers\n")
4563
4564ALIAS (clear_ip_bgp_all,
4565 clear_bgp_instance_all_cmd,
4566 "clear bgp view WORD *",
4567 CLEAR_STR
4568 BGP_STR
4569 "BGP view\n"
4570 "view name\n"
4571 "Clear all peers\n")
4572
4573DEFUN (clear_ip_bgp_peer,
4574 clear_ip_bgp_peer_cmd,
4575 "clear ip bgp (A.B.C.D|X:X::X:X)",
4576 CLEAR_STR
4577 IP_STR
4578 BGP_STR
4579 "BGP neighbor IP address to clear\n"
4580 "BGP IPv6 neighbor to clear\n")
4581{
4582 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4583}
4584
4585ALIAS (clear_ip_bgp_peer,
4586 clear_bgp_peer_cmd,
4587 "clear bgp (A.B.C.D|X:X::X:X)",
4588 CLEAR_STR
4589 BGP_STR
4590 "BGP neighbor address to clear\n"
4591 "BGP IPv6 neighbor to clear\n")
4592
4593ALIAS (clear_ip_bgp_peer,
4594 clear_bgp_ipv6_peer_cmd,
4595 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4596 CLEAR_STR
4597 BGP_STR
4598 "Address family\n"
4599 "BGP neighbor address to clear\n"
4600 "BGP IPv6 neighbor to clear\n")
4601
4602DEFUN (clear_ip_bgp_peer_group,
4603 clear_ip_bgp_peer_group_cmd,
4604 "clear ip bgp peer-group WORD",
4605 CLEAR_STR
4606 IP_STR
4607 BGP_STR
4608 "Clear all members of peer-group\n"
4609 "BGP peer-group name\n")
4610{
4611 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4612}
4613
4614ALIAS (clear_ip_bgp_peer_group,
4615 clear_bgp_peer_group_cmd,
4616 "clear bgp peer-group WORD",
4617 CLEAR_STR
4618 BGP_STR
4619 "Clear all members of peer-group\n"
4620 "BGP peer-group name\n")
4621
4622ALIAS (clear_ip_bgp_peer_group,
4623 clear_bgp_ipv6_peer_group_cmd,
4624 "clear bgp ipv6 peer-group WORD",
4625 CLEAR_STR
4626 BGP_STR
4627 "Address family\n"
4628 "Clear all members of peer-group\n"
4629 "BGP peer-group name\n")
4630
4631DEFUN (clear_ip_bgp_external,
4632 clear_ip_bgp_external_cmd,
4633 "clear ip bgp external",
4634 CLEAR_STR
4635 IP_STR
4636 BGP_STR
4637 "Clear all external peers\n")
4638{
4639 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4640}
4641
4642ALIAS (clear_ip_bgp_external,
4643 clear_bgp_external_cmd,
4644 "clear bgp external",
4645 CLEAR_STR
4646 BGP_STR
4647 "Clear all external peers\n")
4648
4649ALIAS (clear_ip_bgp_external,
4650 clear_bgp_ipv6_external_cmd,
4651 "clear bgp ipv6 external",
4652 CLEAR_STR
4653 BGP_STR
4654 "Address family\n"
4655 "Clear all external peers\n")
4656
4657DEFUN (clear_ip_bgp_as,
4658 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004659 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004660 CLEAR_STR
4661 IP_STR
4662 BGP_STR
4663 "Clear peers with the AS number\n")
4664{
4665 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4666}
4667
4668ALIAS (clear_ip_bgp_as,
4669 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004670 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004671 CLEAR_STR
4672 BGP_STR
4673 "Clear peers with the AS number\n")
4674
4675ALIAS (clear_ip_bgp_as,
4676 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004677 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004678 CLEAR_STR
4679 BGP_STR
4680 "Address family\n"
4681 "Clear peers with the AS number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02004682
paul718e3742002-12-13 20:15:29 +00004683/* Outbound soft-reconfiguration */
4684DEFUN (clear_ip_bgp_all_soft_out,
4685 clear_ip_bgp_all_soft_out_cmd,
4686 "clear ip bgp * soft out",
4687 CLEAR_STR
4688 IP_STR
4689 BGP_STR
4690 "Clear all peers\n"
4691 "Soft reconfig\n"
4692 "Soft reconfig outbound update\n")
4693{
4694 if (argc == 1)
4695 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4696 BGP_CLEAR_SOFT_OUT, NULL);
4697
4698 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4699 BGP_CLEAR_SOFT_OUT, NULL);
4700}
4701
4702ALIAS (clear_ip_bgp_all_soft_out,
4703 clear_ip_bgp_all_out_cmd,
4704 "clear ip bgp * out",
4705 CLEAR_STR
4706 IP_STR
4707 BGP_STR
4708 "Clear all peers\n"
4709 "Soft reconfig outbound update\n")
4710
4711ALIAS (clear_ip_bgp_all_soft_out,
4712 clear_ip_bgp_instance_all_soft_out_cmd,
4713 "clear ip bgp view WORD * soft out",
4714 CLEAR_STR
4715 IP_STR
4716 BGP_STR
4717 "BGP view\n"
4718 "view name\n"
4719 "Clear all peers\n"
4720 "Soft reconfig\n"
4721 "Soft reconfig outbound update\n")
4722
4723DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4724 clear_ip_bgp_all_ipv4_soft_out_cmd,
4725 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4726 CLEAR_STR
4727 IP_STR
4728 BGP_STR
4729 "Clear all peers\n"
4730 "Address family\n"
4731 "Address Family modifier\n"
4732 "Address Family modifier\n"
4733 "Soft reconfig\n"
4734 "Soft reconfig outbound update\n")
4735{
4736 if (strncmp (argv[0], "m", 1) == 0)
4737 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4738 BGP_CLEAR_SOFT_OUT, NULL);
4739
4740 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4741 BGP_CLEAR_SOFT_OUT, NULL);
4742}
4743
4744ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4745 clear_ip_bgp_all_ipv4_out_cmd,
4746 "clear ip bgp * ipv4 (unicast|multicast) out",
4747 CLEAR_STR
4748 IP_STR
4749 BGP_STR
4750 "Clear all peers\n"
4751 "Address family\n"
4752 "Address Family modifier\n"
4753 "Address Family modifier\n"
4754 "Soft reconfig outbound update\n")
4755
4756DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4757 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4758 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4759 CLEAR_STR
4760 IP_STR
4761 BGP_STR
4762 "BGP view\n"
4763 "view name\n"
4764 "Clear all peers\n"
4765 "Address family\n"
4766 "Address Family modifier\n"
4767 "Address Family modifier\n"
4768 "Soft reconfig outbound update\n")
4769{
4770 if (strncmp (argv[1], "m", 1) == 0)
4771 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4772 BGP_CLEAR_SOFT_OUT, NULL);
4773
4774 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4775 BGP_CLEAR_SOFT_OUT, NULL);
4776}
4777
4778DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4779 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4780 "clear ip bgp * vpnv4 unicast soft out",
4781 CLEAR_STR
4782 IP_STR
4783 BGP_STR
4784 "Clear all peers\n"
4785 "Address family\n"
4786 "Address Family Modifier\n"
4787 "Soft reconfig\n"
4788 "Soft reconfig outbound update\n")
4789{
4790 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4791 BGP_CLEAR_SOFT_OUT, NULL);
4792}
4793
4794ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4795 clear_ip_bgp_all_vpnv4_out_cmd,
4796 "clear ip bgp * vpnv4 unicast out",
4797 CLEAR_STR
4798 IP_STR
4799 BGP_STR
4800 "Clear all peers\n"
4801 "Address family\n"
4802 "Address Family Modifier\n"
4803 "Soft reconfig outbound update\n")
4804
Lou Berger298cc2f2016-01-12 13:42:02 -05004805DEFUN (clear_ip_bgp_all_encap_soft_out,
4806 clear_ip_bgp_all_encap_soft_out_cmd,
4807 "clear ip bgp * encap unicast soft out",
4808 CLEAR_STR
4809 IP_STR
4810 BGP_STR
4811 "Clear all peers\n"
4812 "Address family\n"
4813 "Address Family Modifier\n"
4814 "Soft reconfig\n"
4815 "Soft reconfig outbound update\n")
4816{
4817 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
4818 BGP_CLEAR_SOFT_OUT, NULL);
4819}
4820
4821ALIAS (clear_ip_bgp_all_encap_soft_out,
4822 clear_ip_bgp_all_encap_out_cmd,
4823 "clear ip bgp * encap unicast out",
4824 CLEAR_STR
4825 IP_STR
4826 BGP_STR
4827 "Clear all peers\n"
4828 "Address family\n"
4829 "Address Family Modifier\n"
4830 "Soft reconfig outbound update\n")
4831
paul718e3742002-12-13 20:15:29 +00004832DEFUN (clear_bgp_all_soft_out,
4833 clear_bgp_all_soft_out_cmd,
4834 "clear bgp * soft out",
4835 CLEAR_STR
4836 BGP_STR
4837 "Clear all peers\n"
4838 "Soft reconfig\n"
4839 "Soft reconfig outbound update\n")
4840{
4841 if (argc == 1)
4842 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4843 BGP_CLEAR_SOFT_OUT, NULL);
4844
4845 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4846 BGP_CLEAR_SOFT_OUT, NULL);
4847}
4848
4849ALIAS (clear_bgp_all_soft_out,
4850 clear_bgp_instance_all_soft_out_cmd,
4851 "clear bgp view WORD * soft out",
4852 CLEAR_STR
4853 BGP_STR
4854 "BGP view\n"
4855 "view name\n"
4856 "Clear all peers\n"
4857 "Soft reconfig\n"
4858 "Soft reconfig outbound update\n")
4859
4860ALIAS (clear_bgp_all_soft_out,
4861 clear_bgp_all_out_cmd,
4862 "clear bgp * out",
4863 CLEAR_STR
4864 BGP_STR
4865 "Clear all peers\n"
4866 "Soft reconfig outbound update\n")
4867
4868ALIAS (clear_bgp_all_soft_out,
4869 clear_bgp_ipv6_all_soft_out_cmd,
4870 "clear bgp ipv6 * soft out",
4871 CLEAR_STR
4872 BGP_STR
4873 "Address family\n"
4874 "Clear all peers\n"
4875 "Soft reconfig\n"
4876 "Soft reconfig outbound update\n")
4877
4878ALIAS (clear_bgp_all_soft_out,
4879 clear_bgp_ipv6_all_out_cmd,
4880 "clear bgp ipv6 * out",
4881 CLEAR_STR
4882 BGP_STR
4883 "Address family\n"
4884 "Clear all peers\n"
4885 "Soft reconfig outbound update\n")
4886
4887DEFUN (clear_ip_bgp_peer_soft_out,
4888 clear_ip_bgp_peer_soft_out_cmd,
4889 "clear ip bgp A.B.C.D soft out",
4890 CLEAR_STR
4891 IP_STR
4892 BGP_STR
4893 "BGP neighbor address to clear\n"
4894 "Soft reconfig\n"
4895 "Soft reconfig outbound update\n")
4896{
4897 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4898 BGP_CLEAR_SOFT_OUT, argv[0]);
4899}
4900
4901ALIAS (clear_ip_bgp_peer_soft_out,
4902 clear_ip_bgp_peer_out_cmd,
4903 "clear ip bgp A.B.C.D out",
4904 CLEAR_STR
4905 IP_STR
4906 BGP_STR
4907 "BGP neighbor address to clear\n"
4908 "Soft reconfig outbound update\n")
4909
4910DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4911 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4912 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4913 CLEAR_STR
4914 IP_STR
4915 BGP_STR
4916 "BGP neighbor address to clear\n"
4917 "Address family\n"
4918 "Address Family modifier\n"
4919 "Address Family modifier\n"
4920 "Soft reconfig\n"
4921 "Soft reconfig outbound update\n")
4922{
4923 if (strncmp (argv[1], "m", 1) == 0)
4924 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4925 BGP_CLEAR_SOFT_OUT, argv[0]);
4926
4927 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4928 BGP_CLEAR_SOFT_OUT, argv[0]);
4929}
4930
4931ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
4932 clear_ip_bgp_peer_ipv4_out_cmd,
4933 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
4934 CLEAR_STR
4935 IP_STR
4936 BGP_STR
4937 "BGP neighbor address to clear\n"
4938 "Address family\n"
4939 "Address Family modifier\n"
4940 "Address Family modifier\n"
4941 "Soft reconfig outbound update\n")
4942
4943DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
4944 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
4945 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
4946 CLEAR_STR
4947 IP_STR
4948 BGP_STR
4949 "BGP neighbor address to clear\n"
4950 "Address family\n"
4951 "Address Family Modifier\n"
4952 "Soft reconfig\n"
4953 "Soft reconfig outbound update\n")
4954{
4955 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
4956 BGP_CLEAR_SOFT_OUT, argv[0]);
4957}
4958
4959ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
4960 clear_ip_bgp_peer_vpnv4_out_cmd,
4961 "clear ip bgp A.B.C.D vpnv4 unicast out",
4962 CLEAR_STR
4963 IP_STR
4964 BGP_STR
4965 "BGP neighbor address to clear\n"
4966 "Address family\n"
4967 "Address Family Modifier\n"
4968 "Soft reconfig outbound update\n")
4969
Lou Berger298cc2f2016-01-12 13:42:02 -05004970DEFUN (clear_ip_bgp_peer_encap_soft_out,
4971 clear_ip_bgp_peer_encap_soft_out_cmd,
4972 "clear ip bgp A.B.C.D encap unicast soft out",
4973 CLEAR_STR
4974 IP_STR
4975 BGP_STR
4976 "BGP neighbor address to clear\n"
4977 "Address family\n"
4978 "Address Family Modifier\n"
4979 "Soft reconfig\n"
4980 "Soft reconfig outbound update\n")
4981{
4982 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
4983 BGP_CLEAR_SOFT_OUT, argv[0]);
4984}
4985
4986ALIAS (clear_ip_bgp_peer_encap_soft_out,
4987 clear_ip_bgp_peer_encap_out_cmd,
4988 "clear ip bgp A.B.C.D encap unicast out",
4989 CLEAR_STR
4990 IP_STR
4991 BGP_STR
4992 "BGP neighbor address to clear\n"
4993 "Address family\n"
4994 "Address Family Modifier\n"
4995 "Soft reconfig outbound update\n")
4996
paul718e3742002-12-13 20:15:29 +00004997DEFUN (clear_bgp_peer_soft_out,
4998 clear_bgp_peer_soft_out_cmd,
4999 "clear bgp (A.B.C.D|X:X::X:X) soft out",
5000 CLEAR_STR
5001 BGP_STR
5002 "BGP neighbor address to clear\n"
5003 "BGP IPv6 neighbor to clear\n"
5004 "Soft reconfig\n"
5005 "Soft reconfig outbound update\n")
5006{
5007 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5008 BGP_CLEAR_SOFT_OUT, argv[0]);
5009}
5010
5011ALIAS (clear_bgp_peer_soft_out,
5012 clear_bgp_ipv6_peer_soft_out_cmd,
5013 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
5014 CLEAR_STR
5015 BGP_STR
5016 "Address family\n"
5017 "BGP neighbor address to clear\n"
5018 "BGP IPv6 neighbor to clear\n"
5019 "Soft reconfig\n"
5020 "Soft reconfig outbound update\n")
5021
5022ALIAS (clear_bgp_peer_soft_out,
5023 clear_bgp_peer_out_cmd,
5024 "clear bgp (A.B.C.D|X:X::X:X) out",
5025 CLEAR_STR
5026 BGP_STR
5027 "BGP neighbor address to clear\n"
5028 "BGP IPv6 neighbor to clear\n"
5029 "Soft reconfig outbound update\n")
5030
5031ALIAS (clear_bgp_peer_soft_out,
5032 clear_bgp_ipv6_peer_out_cmd,
5033 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
5034 CLEAR_STR
5035 BGP_STR
5036 "Address family\n"
5037 "BGP neighbor address to clear\n"
5038 "BGP IPv6 neighbor to clear\n"
5039 "Soft reconfig outbound update\n")
5040
5041DEFUN (clear_ip_bgp_peer_group_soft_out,
5042 clear_ip_bgp_peer_group_soft_out_cmd,
5043 "clear ip bgp peer-group WORD soft out",
5044 CLEAR_STR
5045 IP_STR
5046 BGP_STR
5047 "Clear all members of peer-group\n"
5048 "BGP peer-group name\n"
5049 "Soft reconfig\n"
5050 "Soft reconfig outbound update\n")
5051{
5052 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5053 BGP_CLEAR_SOFT_OUT, argv[0]);
5054}
5055
5056ALIAS (clear_ip_bgp_peer_group_soft_out,
5057 clear_ip_bgp_peer_group_out_cmd,
5058 "clear ip bgp peer-group WORD out",
5059 CLEAR_STR
5060 IP_STR
5061 BGP_STR
5062 "Clear all members of peer-group\n"
5063 "BGP peer-group name\n"
5064 "Soft reconfig outbound update\n")
5065
5066DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
5067 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
5068 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
5069 CLEAR_STR
5070 IP_STR
5071 BGP_STR
5072 "Clear all members of peer-group\n"
5073 "BGP peer-group name\n"
5074 "Address family\n"
5075 "Address Family modifier\n"
5076 "Address Family modifier\n"
5077 "Soft reconfig\n"
5078 "Soft reconfig outbound update\n")
5079{
5080 if (strncmp (argv[1], "m", 1) == 0)
5081 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5082 BGP_CLEAR_SOFT_OUT, argv[0]);
5083
5084 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5085 BGP_CLEAR_SOFT_OUT, argv[0]);
5086}
5087
5088ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
5089 clear_ip_bgp_peer_group_ipv4_out_cmd,
5090 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
5091 CLEAR_STR
5092 IP_STR
5093 BGP_STR
5094 "Clear all members of peer-group\n"
5095 "BGP peer-group name\n"
5096 "Address family\n"
5097 "Address Family modifier\n"
5098 "Address Family modifier\n"
5099 "Soft reconfig outbound update\n")
5100
5101DEFUN (clear_bgp_peer_group_soft_out,
5102 clear_bgp_peer_group_soft_out_cmd,
5103 "clear bgp peer-group WORD soft out",
5104 CLEAR_STR
5105 BGP_STR
5106 "Clear all members of peer-group\n"
5107 "BGP peer-group name\n"
5108 "Soft reconfig\n"
5109 "Soft reconfig outbound update\n")
5110{
5111 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5112 BGP_CLEAR_SOFT_OUT, argv[0]);
5113}
5114
5115ALIAS (clear_bgp_peer_group_soft_out,
5116 clear_bgp_ipv6_peer_group_soft_out_cmd,
5117 "clear bgp ipv6 peer-group WORD soft out",
5118 CLEAR_STR
5119 BGP_STR
5120 "Address family\n"
5121 "Clear all members of peer-group\n"
5122 "BGP peer-group name\n"
5123 "Soft reconfig\n"
5124 "Soft reconfig outbound update\n")
5125
5126ALIAS (clear_bgp_peer_group_soft_out,
5127 clear_bgp_peer_group_out_cmd,
5128 "clear bgp peer-group WORD out",
5129 CLEAR_STR
5130 BGP_STR
5131 "Clear all members of peer-group\n"
5132 "BGP peer-group name\n"
5133 "Soft reconfig outbound update\n")
5134
5135ALIAS (clear_bgp_peer_group_soft_out,
5136 clear_bgp_ipv6_peer_group_out_cmd,
5137 "clear bgp ipv6 peer-group WORD out",
5138 CLEAR_STR
5139 BGP_STR
5140 "Address family\n"
5141 "Clear all members of peer-group\n"
5142 "BGP peer-group name\n"
5143 "Soft reconfig outbound update\n")
5144
5145DEFUN (clear_ip_bgp_external_soft_out,
5146 clear_ip_bgp_external_soft_out_cmd,
5147 "clear ip bgp external soft out",
5148 CLEAR_STR
5149 IP_STR
5150 BGP_STR
5151 "Clear all external peers\n"
5152 "Soft reconfig\n"
5153 "Soft reconfig outbound update\n")
5154{
5155 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5156 BGP_CLEAR_SOFT_OUT, NULL);
5157}
5158
5159ALIAS (clear_ip_bgp_external_soft_out,
5160 clear_ip_bgp_external_out_cmd,
5161 "clear ip bgp external out",
5162 CLEAR_STR
5163 IP_STR
5164 BGP_STR
5165 "Clear all external peers\n"
5166 "Soft reconfig outbound update\n")
5167
5168DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5169 clear_ip_bgp_external_ipv4_soft_out_cmd,
5170 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5171 CLEAR_STR
5172 IP_STR
5173 BGP_STR
5174 "Clear all external peers\n"
5175 "Address family\n"
5176 "Address Family modifier\n"
5177 "Address Family modifier\n"
5178 "Soft reconfig\n"
5179 "Soft reconfig outbound update\n")
5180{
5181 if (strncmp (argv[0], "m", 1) == 0)
5182 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5183 BGP_CLEAR_SOFT_OUT, NULL);
5184
5185 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5186 BGP_CLEAR_SOFT_OUT, NULL);
5187}
5188
5189ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5190 clear_ip_bgp_external_ipv4_out_cmd,
5191 "clear ip bgp external ipv4 (unicast|multicast) out",
5192 CLEAR_STR
5193 IP_STR
5194 BGP_STR
5195 "Clear all external peers\n"
5196 "Address family\n"
5197 "Address Family modifier\n"
5198 "Address Family modifier\n"
5199 "Soft reconfig outbound update\n")
5200
5201DEFUN (clear_bgp_external_soft_out,
5202 clear_bgp_external_soft_out_cmd,
5203 "clear bgp external soft out",
5204 CLEAR_STR
5205 BGP_STR
5206 "Clear all external peers\n"
5207 "Soft reconfig\n"
5208 "Soft reconfig outbound update\n")
5209{
5210 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5211 BGP_CLEAR_SOFT_OUT, NULL);
5212}
5213
5214ALIAS (clear_bgp_external_soft_out,
5215 clear_bgp_ipv6_external_soft_out_cmd,
5216 "clear bgp ipv6 external soft out",
5217 CLEAR_STR
5218 BGP_STR
5219 "Address family\n"
5220 "Clear all external peers\n"
5221 "Soft reconfig\n"
5222 "Soft reconfig outbound update\n")
5223
5224ALIAS (clear_bgp_external_soft_out,
5225 clear_bgp_external_out_cmd,
5226 "clear bgp external out",
5227 CLEAR_STR
5228 BGP_STR
5229 "Clear all external peers\n"
5230 "Soft reconfig outbound update\n")
5231
5232ALIAS (clear_bgp_external_soft_out,
5233 clear_bgp_ipv6_external_out_cmd,
5234 "clear bgp ipv6 external WORD out",
5235 CLEAR_STR
5236 BGP_STR
5237 "Address family\n"
5238 "Clear all external peers\n"
5239 "Soft reconfig outbound update\n")
5240
5241DEFUN (clear_ip_bgp_as_soft_out,
5242 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005243 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005244 CLEAR_STR
5245 IP_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_IP, SAFI_UNICAST, clear_as,
5252 BGP_CLEAR_SOFT_OUT, argv[0]);
5253}
5254
5255ALIAS (clear_ip_bgp_as_soft_out,
5256 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005257 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005258 CLEAR_STR
5259 IP_STR
5260 BGP_STR
5261 "Clear peers with the AS number\n"
5262 "Soft reconfig outbound update\n")
5263
5264DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5265 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005266 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005267 CLEAR_STR
5268 IP_STR
5269 BGP_STR
5270 "Clear peers with the AS number\n"
5271 "Address family\n"
5272 "Address Family modifier\n"
5273 "Address Family modifier\n"
5274 "Soft reconfig\n"
5275 "Soft reconfig outbound update\n")
5276{
5277 if (strncmp (argv[1], "m", 1) == 0)
5278 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5279 BGP_CLEAR_SOFT_OUT, argv[0]);
5280
5281 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5282 BGP_CLEAR_SOFT_OUT, argv[0]);
5283}
5284
5285ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5286 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005287 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00005288 CLEAR_STR
5289 IP_STR
5290 BGP_STR
5291 "Clear peers with the AS number\n"
5292 "Address family\n"
5293 "Address Family modifier\n"
5294 "Address Family modifier\n"
5295 "Soft reconfig outbound update\n")
5296
5297DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5298 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005299 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00005300 CLEAR_STR
5301 IP_STR
5302 BGP_STR
5303 "Clear peers with the AS number\n"
5304 "Address family\n"
5305 "Address Family modifier\n"
5306 "Soft reconfig\n"
5307 "Soft reconfig outbound update\n")
5308{
5309 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5310 BGP_CLEAR_SOFT_OUT, argv[0]);
5311}
5312
5313ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5314 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005315 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005316 CLEAR_STR
5317 IP_STR
5318 BGP_STR
5319 "Clear peers with the AS number\n"
5320 "Address family\n"
5321 "Address Family modifier\n"
5322 "Soft reconfig outbound update\n")
5323
Lou Berger298cc2f2016-01-12 13:42:02 -05005324DEFUN (clear_ip_bgp_as_encap_soft_out,
5325 clear_ip_bgp_as_encap_soft_out_cmd,
5326 "clear ip bgp " CMD_AS_RANGE " encap unicast soft out",
5327 CLEAR_STR
5328 IP_STR
5329 BGP_STR
5330 "Clear peers with the AS number\n"
5331 "Address family\n"
5332 "Address Family modifier\n"
5333 "Soft reconfig\n"
5334 "Soft reconfig outbound update\n")
5335{
5336 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
5337 BGP_CLEAR_SOFT_OUT, argv[0]);
5338}
5339
5340ALIAS (clear_ip_bgp_as_encap_soft_out,
5341 clear_ip_bgp_as_encap_out_cmd,
5342 "clear ip bgp " CMD_AS_RANGE " encap unicast out",
5343 CLEAR_STR
5344 IP_STR
5345 BGP_STR
5346 "Clear peers with the AS number\n"
5347 "Address family\n"
5348 "Address Family modifier\n"
5349 "Soft reconfig outbound update\n")
5350
paul718e3742002-12-13 20:15:29 +00005351DEFUN (clear_bgp_as_soft_out,
5352 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005353 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005354 CLEAR_STR
5355 BGP_STR
5356 "Clear peers with the AS number\n"
5357 "Soft reconfig\n"
5358 "Soft reconfig outbound update\n")
5359{
5360 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5361 BGP_CLEAR_SOFT_OUT, argv[0]);
5362}
5363
5364ALIAS (clear_bgp_as_soft_out,
5365 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005366 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005367 CLEAR_STR
5368 BGP_STR
5369 "Address family\n"
5370 "Clear peers with the AS number\n"
5371 "Soft reconfig\n"
5372 "Soft reconfig outbound update\n")
5373
5374ALIAS (clear_bgp_as_soft_out,
5375 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005376 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005377 CLEAR_STR
5378 BGP_STR
5379 "Clear peers with the AS number\n"
5380 "Soft reconfig outbound update\n")
5381
5382ALIAS (clear_bgp_as_soft_out,
5383 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005384 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005385 CLEAR_STR
5386 BGP_STR
5387 "Address family\n"
5388 "Clear peers with the AS number\n"
5389 "Soft reconfig outbound update\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02005390
paul718e3742002-12-13 20:15:29 +00005391/* Inbound soft-reconfiguration */
5392DEFUN (clear_ip_bgp_all_soft_in,
5393 clear_ip_bgp_all_soft_in_cmd,
5394 "clear ip bgp * soft in",
5395 CLEAR_STR
5396 IP_STR
5397 BGP_STR
5398 "Clear all peers\n"
5399 "Soft reconfig\n"
5400 "Soft reconfig inbound update\n")
5401{
5402 if (argc == 1)
5403 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5404 BGP_CLEAR_SOFT_IN, NULL);
5405
5406 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5407 BGP_CLEAR_SOFT_IN, NULL);
5408}
5409
5410ALIAS (clear_ip_bgp_all_soft_in,
5411 clear_ip_bgp_instance_all_soft_in_cmd,
5412 "clear ip bgp view WORD * soft in",
5413 CLEAR_STR
5414 IP_STR
5415 BGP_STR
5416 "BGP view\n"
5417 "view name\n"
5418 "Clear all peers\n"
5419 "Soft reconfig\n"
5420 "Soft reconfig inbound update\n")
5421
5422ALIAS (clear_ip_bgp_all_soft_in,
5423 clear_ip_bgp_all_in_cmd,
5424 "clear ip bgp * in",
5425 CLEAR_STR
5426 IP_STR
5427 BGP_STR
5428 "Clear all peers\n"
5429 "Soft reconfig inbound update\n")
5430
5431DEFUN (clear_ip_bgp_all_in_prefix_filter,
5432 clear_ip_bgp_all_in_prefix_filter_cmd,
5433 "clear ip bgp * in prefix-filter",
5434 CLEAR_STR
5435 IP_STR
5436 BGP_STR
5437 "Clear all peers\n"
5438 "Soft reconfig inbound update\n"
5439 "Push out prefix-list ORF and do inbound soft reconfig\n")
5440{
5441 if (argc== 1)
5442 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5443 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5444
5445 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5446 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5447}
5448
5449ALIAS (clear_ip_bgp_all_in_prefix_filter,
5450 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5451 "clear ip bgp view WORD * in prefix-filter",
5452 CLEAR_STR
5453 IP_STR
5454 BGP_STR
5455 "BGP view\n"
5456 "view name\n"
5457 "Clear all peers\n"
5458 "Soft reconfig inbound update\n"
5459 "Push out prefix-list ORF and do inbound soft reconfig\n")
5460
5461
5462DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5463 clear_ip_bgp_all_ipv4_soft_in_cmd,
5464 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5465 CLEAR_STR
5466 IP_STR
5467 BGP_STR
5468 "Clear all peers\n"
5469 "Address family\n"
5470 "Address Family modifier\n"
5471 "Address Family modifier\n"
5472 "Soft reconfig\n"
5473 "Soft reconfig inbound update\n")
5474{
5475 if (strncmp (argv[0], "m", 1) == 0)
5476 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5477 BGP_CLEAR_SOFT_IN, NULL);
5478
5479 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5480 BGP_CLEAR_SOFT_IN, NULL);
5481}
5482
5483ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5484 clear_ip_bgp_all_ipv4_in_cmd,
5485 "clear ip bgp * ipv4 (unicast|multicast) in",
5486 CLEAR_STR
5487 IP_STR
5488 BGP_STR
5489 "Clear all peers\n"
5490 "Address family\n"
5491 "Address Family modifier\n"
5492 "Address Family modifier\n"
5493 "Soft reconfig inbound update\n")
5494
5495DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5496 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5497 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5498 CLEAR_STR
5499 IP_STR
5500 BGP_STR
5501 "BGP view\n"
5502 "view name\n"
5503 "Clear all peers\n"
5504 "Address family\n"
5505 "Address Family modifier\n"
5506 "Address Family modifier\n"
5507 "Soft reconfig\n"
5508 "Soft reconfig inbound update\n")
5509{
5510 if (strncmp (argv[1], "m", 1) == 0)
5511 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5512 BGP_CLEAR_SOFT_IN, NULL);
5513
5514 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5515 BGP_CLEAR_SOFT_IN, NULL);
5516}
5517
5518DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5519 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5520 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5521 CLEAR_STR
5522 IP_STR
5523 BGP_STR
5524 "Clear all peers\n"
5525 "Address family\n"
5526 "Address Family modifier\n"
5527 "Address Family modifier\n"
5528 "Soft reconfig inbound update\n"
5529 "Push out prefix-list ORF and do inbound soft reconfig\n")
5530{
5531 if (strncmp (argv[0], "m", 1) == 0)
5532 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5533 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5534
5535 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5536 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5537}
5538
5539DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5540 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5541 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5542 CLEAR_STR
5543 IP_STR
5544 BGP_STR
5545 "Clear all peers\n"
5546 "Address family\n"
5547 "Address Family modifier\n"
5548 "Address Family modifier\n"
5549 "Soft reconfig inbound update\n"
5550 "Push out prefix-list ORF and do inbound soft reconfig\n")
5551{
5552 if (strncmp (argv[1], "m", 1) == 0)
5553 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5554 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5555
5556 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5557 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5558}
5559
5560DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5561 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5562 "clear ip bgp * vpnv4 unicast soft in",
5563 CLEAR_STR
5564 IP_STR
5565 BGP_STR
5566 "Clear all peers\n"
5567 "Address family\n"
5568 "Address Family Modifier\n"
5569 "Soft reconfig\n"
5570 "Soft reconfig inbound update\n")
5571{
5572 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5573 BGP_CLEAR_SOFT_IN, NULL);
5574}
5575
5576ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5577 clear_ip_bgp_all_vpnv4_in_cmd,
5578 "clear ip bgp * vpnv4 unicast in",
5579 CLEAR_STR
5580 IP_STR
5581 BGP_STR
5582 "Clear all peers\n"
5583 "Address family\n"
5584 "Address Family Modifier\n"
5585 "Soft reconfig inbound update\n")
5586
Lou Berger298cc2f2016-01-12 13:42:02 -05005587DEFUN (clear_ip_bgp_all_encap_soft_in,
5588 clear_ip_bgp_all_encap_soft_in_cmd,
5589 "clear ip bgp * encap unicast soft in",
5590 CLEAR_STR
5591 IP_STR
5592 BGP_STR
5593 "Clear all peers\n"
5594 "Address family\n"
5595 "Address Family Modifier\n"
5596 "Soft reconfig\n"
5597 "Soft reconfig inbound update\n")
5598{
5599 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
5600 BGP_CLEAR_SOFT_IN, NULL);
5601}
5602
5603ALIAS (clear_ip_bgp_all_encap_soft_in,
5604 clear_ip_bgp_all_encap_in_cmd,
5605 "clear ip bgp * encap unicast in",
5606 CLEAR_STR
5607 IP_STR
5608 BGP_STR
5609 "Clear all peers\n"
5610 "Address family\n"
5611 "Address Family Modifier\n"
5612 "Soft reconfig inbound update\n")
5613
paul718e3742002-12-13 20:15:29 +00005614DEFUN (clear_bgp_all_soft_in,
5615 clear_bgp_all_soft_in_cmd,
5616 "clear bgp * soft in",
5617 CLEAR_STR
5618 BGP_STR
5619 "Clear all peers\n"
5620 "Soft reconfig\n"
5621 "Soft reconfig inbound update\n")
5622{
5623 if (argc == 1)
5624 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5625 BGP_CLEAR_SOFT_IN, NULL);
5626
5627 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5628 BGP_CLEAR_SOFT_IN, NULL);
5629}
5630
5631ALIAS (clear_bgp_all_soft_in,
5632 clear_bgp_instance_all_soft_in_cmd,
5633 "clear bgp view WORD * soft in",
5634 CLEAR_STR
5635 BGP_STR
5636 "BGP view\n"
5637 "view name\n"
5638 "Clear all peers\n"
5639 "Soft reconfig\n"
5640 "Soft reconfig inbound update\n")
5641
5642ALIAS (clear_bgp_all_soft_in,
5643 clear_bgp_ipv6_all_soft_in_cmd,
5644 "clear bgp ipv6 * soft in",
5645 CLEAR_STR
5646 BGP_STR
5647 "Address family\n"
5648 "Clear all peers\n"
5649 "Soft reconfig\n"
5650 "Soft reconfig inbound update\n")
5651
5652ALIAS (clear_bgp_all_soft_in,
5653 clear_bgp_all_in_cmd,
5654 "clear bgp * in",
5655 CLEAR_STR
5656 BGP_STR
5657 "Clear all peers\n"
5658 "Soft reconfig inbound update\n")
5659
5660ALIAS (clear_bgp_all_soft_in,
5661 clear_bgp_ipv6_all_in_cmd,
5662 "clear bgp ipv6 * in",
5663 CLEAR_STR
5664 BGP_STR
5665 "Address family\n"
5666 "Clear all peers\n"
5667 "Soft reconfig inbound update\n")
5668
5669DEFUN (clear_bgp_all_in_prefix_filter,
5670 clear_bgp_all_in_prefix_filter_cmd,
5671 "clear bgp * in prefix-filter",
5672 CLEAR_STR
5673 BGP_STR
5674 "Clear all peers\n"
5675 "Soft reconfig inbound update\n"
5676 "Push out prefix-list ORF and do inbound soft reconfig\n")
5677{
5678 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5679 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5680}
5681
5682ALIAS (clear_bgp_all_in_prefix_filter,
5683 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5684 "clear bgp ipv6 * in prefix-filter",
5685 CLEAR_STR
5686 BGP_STR
5687 "Address family\n"
5688 "Clear all peers\n"
5689 "Soft reconfig inbound update\n"
5690 "Push out prefix-list ORF and do inbound soft reconfig\n")
5691
5692DEFUN (clear_ip_bgp_peer_soft_in,
5693 clear_ip_bgp_peer_soft_in_cmd,
5694 "clear ip bgp A.B.C.D soft in",
5695 CLEAR_STR
5696 IP_STR
5697 BGP_STR
5698 "BGP neighbor address to clear\n"
5699 "Soft reconfig\n"
5700 "Soft reconfig inbound update\n")
5701{
5702 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5703 BGP_CLEAR_SOFT_IN, argv[0]);
5704}
5705
5706ALIAS (clear_ip_bgp_peer_soft_in,
5707 clear_ip_bgp_peer_in_cmd,
5708 "clear ip bgp A.B.C.D in",
5709 CLEAR_STR
5710 IP_STR
5711 BGP_STR
5712 "BGP neighbor address to clear\n"
5713 "Soft reconfig inbound update\n")
5714
5715DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5716 clear_ip_bgp_peer_in_prefix_filter_cmd,
5717 "clear ip bgp A.B.C.D in prefix-filter",
5718 CLEAR_STR
5719 IP_STR
5720 BGP_STR
5721 "BGP neighbor address to clear\n"
5722 "Soft reconfig inbound update\n"
5723 "Push out the existing ORF prefix-list\n")
5724{
5725 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5726 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5727}
5728
5729DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5730 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5731 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5732 CLEAR_STR
5733 IP_STR
5734 BGP_STR
5735 "BGP neighbor address to clear\n"
5736 "Address family\n"
5737 "Address Family modifier\n"
5738 "Address Family modifier\n"
5739 "Soft reconfig\n"
5740 "Soft reconfig inbound update\n")
5741{
5742 if (strncmp (argv[1], "m", 1) == 0)
5743 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5744 BGP_CLEAR_SOFT_IN, argv[0]);
5745
5746 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5747 BGP_CLEAR_SOFT_IN, argv[0]);
5748}
5749
5750ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5751 clear_ip_bgp_peer_ipv4_in_cmd,
5752 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5753 CLEAR_STR
5754 IP_STR
5755 BGP_STR
5756 "BGP neighbor address to clear\n"
5757 "Address family\n"
5758 "Address Family modifier\n"
5759 "Address Family modifier\n"
5760 "Soft reconfig inbound update\n")
5761
5762DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5763 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5764 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5765 CLEAR_STR
5766 IP_STR
5767 BGP_STR
5768 "BGP neighbor address to clear\n"
5769 "Address family\n"
5770 "Address Family modifier\n"
5771 "Address Family modifier\n"
5772 "Soft reconfig inbound update\n"
5773 "Push out the existing ORF prefix-list\n")
5774{
5775 if (strncmp (argv[1], "m", 1) == 0)
5776 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5777 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5778
5779 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5780 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5781}
5782
5783DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5784 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5785 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5786 CLEAR_STR
5787 IP_STR
5788 BGP_STR
5789 "BGP neighbor address to clear\n"
5790 "Address family\n"
5791 "Address Family Modifier\n"
5792 "Soft reconfig\n"
5793 "Soft reconfig inbound update\n")
5794{
5795 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5796 BGP_CLEAR_SOFT_IN, argv[0]);
5797}
5798
5799ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5800 clear_ip_bgp_peer_vpnv4_in_cmd,
5801 "clear ip bgp A.B.C.D vpnv4 unicast in",
5802 CLEAR_STR
5803 IP_STR
5804 BGP_STR
5805 "BGP neighbor address to clear\n"
5806 "Address family\n"
5807 "Address Family Modifier\n"
5808 "Soft reconfig inbound update\n")
5809
Lou Berger298cc2f2016-01-12 13:42:02 -05005810DEFUN (clear_ip_bgp_peer_encap_soft_in,
5811 clear_ip_bgp_peer_encap_soft_in_cmd,
5812 "clear ip bgp A.B.C.D encap unicast soft in",
5813 CLEAR_STR
5814 IP_STR
5815 BGP_STR
5816 "BGP neighbor address to clear\n"
5817 "Address family\n"
5818 "Address Family Modifier\n"
5819 "Soft reconfig\n"
5820 "Soft reconfig inbound update\n")
5821{
5822 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5823 BGP_CLEAR_SOFT_IN, argv[0]);
5824}
5825
5826ALIAS (clear_ip_bgp_peer_encap_soft_in,
5827 clear_ip_bgp_peer_encap_in_cmd,
5828 "clear ip bgp A.B.C.D encap unicast in",
5829 CLEAR_STR
5830 IP_STR
5831 BGP_STR
5832 "BGP neighbor address to clear\n"
5833 "Address family\n"
5834 "Address Family Modifier\n"
5835 "Soft reconfig inbound update\n")
5836
paul718e3742002-12-13 20:15:29 +00005837DEFUN (clear_bgp_peer_soft_in,
5838 clear_bgp_peer_soft_in_cmd,
5839 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5840 CLEAR_STR
5841 BGP_STR
5842 "BGP neighbor address to clear\n"
5843 "BGP IPv6 neighbor to clear\n"
5844 "Soft reconfig\n"
5845 "Soft reconfig inbound update\n")
5846{
5847 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5848 BGP_CLEAR_SOFT_IN, argv[0]);
5849}
5850
5851ALIAS (clear_bgp_peer_soft_in,
5852 clear_bgp_ipv6_peer_soft_in_cmd,
5853 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5854 CLEAR_STR
5855 BGP_STR
5856 "Address family\n"
5857 "BGP neighbor address to clear\n"
5858 "BGP IPv6 neighbor to clear\n"
5859 "Soft reconfig\n"
5860 "Soft reconfig inbound update\n")
5861
5862ALIAS (clear_bgp_peer_soft_in,
5863 clear_bgp_peer_in_cmd,
5864 "clear bgp (A.B.C.D|X:X::X:X) in",
5865 CLEAR_STR
5866 BGP_STR
5867 "BGP neighbor address to clear\n"
5868 "BGP IPv6 neighbor to clear\n"
5869 "Soft reconfig inbound update\n")
5870
5871ALIAS (clear_bgp_peer_soft_in,
5872 clear_bgp_ipv6_peer_in_cmd,
5873 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5874 CLEAR_STR
5875 BGP_STR
5876 "Address family\n"
5877 "BGP neighbor address to clear\n"
5878 "BGP IPv6 neighbor to clear\n"
5879 "Soft reconfig inbound update\n")
5880
5881DEFUN (clear_bgp_peer_in_prefix_filter,
5882 clear_bgp_peer_in_prefix_filter_cmd,
5883 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5884 CLEAR_STR
5885 BGP_STR
5886 "BGP neighbor address to clear\n"
5887 "BGP IPv6 neighbor to clear\n"
5888 "Soft reconfig inbound update\n"
5889 "Push out the existing ORF prefix-list\n")
5890{
5891 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5892 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5893}
5894
5895ALIAS (clear_bgp_peer_in_prefix_filter,
5896 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5897 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5898 CLEAR_STR
5899 BGP_STR
5900 "Address family\n"
5901 "BGP neighbor address to clear\n"
5902 "BGP IPv6 neighbor to clear\n"
5903 "Soft reconfig inbound update\n"
5904 "Push out the existing ORF prefix-list\n")
5905
5906DEFUN (clear_ip_bgp_peer_group_soft_in,
5907 clear_ip_bgp_peer_group_soft_in_cmd,
5908 "clear ip bgp peer-group WORD soft in",
5909 CLEAR_STR
5910 IP_STR
5911 BGP_STR
5912 "Clear all members of peer-group\n"
5913 "BGP peer-group name\n"
5914 "Soft reconfig\n"
5915 "Soft reconfig inbound update\n")
5916{
5917 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5918 BGP_CLEAR_SOFT_IN, argv[0]);
5919}
5920
5921ALIAS (clear_ip_bgp_peer_group_soft_in,
5922 clear_ip_bgp_peer_group_in_cmd,
5923 "clear ip bgp peer-group WORD in",
5924 CLEAR_STR
5925 IP_STR
5926 BGP_STR
5927 "Clear all members of peer-group\n"
5928 "BGP peer-group name\n"
5929 "Soft reconfig inbound update\n")
5930
5931DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
5932 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
5933 "clear ip bgp peer-group WORD in prefix-filter",
5934 CLEAR_STR
5935 IP_STR
5936 BGP_STR
5937 "Clear all members of peer-group\n"
5938 "BGP peer-group name\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_group,
5943 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5944}
5945
5946DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
5947 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
5948 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
5949 CLEAR_STR
5950 IP_STR
5951 BGP_STR
5952 "Clear all members of peer-group\n"
5953 "BGP peer-group name\n"
5954 "Address family\n"
5955 "Address Family modifier\n"
5956 "Address Family modifier\n"
5957 "Soft reconfig\n"
5958 "Soft reconfig inbound update\n")
5959{
5960 if (strncmp (argv[1], "m", 1) == 0)
5961 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5962 BGP_CLEAR_SOFT_IN, argv[0]);
5963
5964 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5965 BGP_CLEAR_SOFT_IN, argv[0]);
5966}
5967
5968ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
5969 clear_ip_bgp_peer_group_ipv4_in_cmd,
5970 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
5971 CLEAR_STR
5972 IP_STR
5973 BGP_STR
5974 "Clear all members of peer-group\n"
5975 "BGP peer-group name\n"
5976 "Address family\n"
5977 "Address Family modifier\n"
5978 "Address Family modifier\n"
5979 "Soft reconfig inbound update\n")
5980
5981DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
5982 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
5983 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
5984 CLEAR_STR
5985 IP_STR
5986 BGP_STR
5987 "Clear all members of peer-group\n"
5988 "BGP peer-group name\n"
5989 "Address family\n"
5990 "Address Family modifier\n"
5991 "Address Family modifier\n"
5992 "Soft reconfig inbound update\n"
5993 "Push out prefix-list ORF and do inbound soft reconfig\n")
5994{
5995 if (strncmp (argv[1], "m", 1) == 0)
5996 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5997 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5998
5999 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6000 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6001}
6002
6003DEFUN (clear_bgp_peer_group_soft_in,
6004 clear_bgp_peer_group_soft_in_cmd,
6005 "clear bgp peer-group WORD soft in",
6006 CLEAR_STR
6007 BGP_STR
6008 "Clear all members of peer-group\n"
6009 "BGP peer-group name\n"
6010 "Soft reconfig\n"
6011 "Soft reconfig inbound update\n")
6012{
6013 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6014 BGP_CLEAR_SOFT_IN, argv[0]);
6015}
6016
6017ALIAS (clear_bgp_peer_group_soft_in,
6018 clear_bgp_ipv6_peer_group_soft_in_cmd,
6019 "clear bgp ipv6 peer-group WORD soft in",
6020 CLEAR_STR
6021 BGP_STR
6022 "Address family\n"
6023 "Clear all members of peer-group\n"
6024 "BGP peer-group name\n"
6025 "Soft reconfig\n"
6026 "Soft reconfig inbound update\n")
6027
6028ALIAS (clear_bgp_peer_group_soft_in,
6029 clear_bgp_peer_group_in_cmd,
6030 "clear bgp peer-group WORD in",
6031 CLEAR_STR
6032 BGP_STR
6033 "Clear all members of peer-group\n"
6034 "BGP peer-group name\n"
6035 "Soft reconfig inbound update\n")
6036
6037ALIAS (clear_bgp_peer_group_soft_in,
6038 clear_bgp_ipv6_peer_group_in_cmd,
6039 "clear bgp ipv6 peer-group WORD in",
6040 CLEAR_STR
6041 BGP_STR
6042 "Address family\n"
6043 "Clear all members of peer-group\n"
6044 "BGP peer-group name\n"
6045 "Soft reconfig inbound update\n")
6046
6047DEFUN (clear_bgp_peer_group_in_prefix_filter,
6048 clear_bgp_peer_group_in_prefix_filter_cmd,
6049 "clear bgp peer-group WORD in prefix-filter",
6050 CLEAR_STR
6051 BGP_STR
6052 "Clear all members of peer-group\n"
6053 "BGP peer-group name\n"
6054 "Soft reconfig inbound update\n"
6055 "Push out prefix-list ORF and do inbound soft reconfig\n")
6056{
6057 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6058 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6059}
6060
6061ALIAS (clear_bgp_peer_group_in_prefix_filter,
6062 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
6063 "clear bgp ipv6 peer-group WORD in prefix-filter",
6064 CLEAR_STR
6065 BGP_STR
6066 "Address family\n"
6067 "Clear all members of peer-group\n"
6068 "BGP peer-group name\n"
6069 "Soft reconfig inbound update\n"
6070 "Push out prefix-list ORF and do inbound soft reconfig\n")
6071
6072DEFUN (clear_ip_bgp_external_soft_in,
6073 clear_ip_bgp_external_soft_in_cmd,
6074 "clear ip bgp external soft in",
6075 CLEAR_STR
6076 IP_STR
6077 BGP_STR
6078 "Clear all external peers\n"
6079 "Soft reconfig\n"
6080 "Soft reconfig inbound update\n")
6081{
6082 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6083 BGP_CLEAR_SOFT_IN, NULL);
6084}
6085
6086ALIAS (clear_ip_bgp_external_soft_in,
6087 clear_ip_bgp_external_in_cmd,
6088 "clear ip bgp external in",
6089 CLEAR_STR
6090 IP_STR
6091 BGP_STR
6092 "Clear all external peers\n"
6093 "Soft reconfig inbound update\n")
6094
6095DEFUN (clear_ip_bgp_external_in_prefix_filter,
6096 clear_ip_bgp_external_in_prefix_filter_cmd,
6097 "clear ip bgp external in prefix-filter",
6098 CLEAR_STR
6099 IP_STR
6100 BGP_STR
6101 "Clear all external peers\n"
6102 "Soft reconfig inbound update\n"
6103 "Push out prefix-list ORF and do inbound soft reconfig\n")
6104{
6105 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6106 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6107}
6108
6109DEFUN (clear_ip_bgp_external_ipv4_soft_in,
6110 clear_ip_bgp_external_ipv4_soft_in_cmd,
6111 "clear ip bgp external ipv4 (unicast|multicast) soft in",
6112 CLEAR_STR
6113 IP_STR
6114 BGP_STR
6115 "Clear all external peers\n"
6116 "Address family\n"
6117 "Address Family modifier\n"
6118 "Address Family modifier\n"
6119 "Soft reconfig\n"
6120 "Soft reconfig inbound update\n")
6121{
6122 if (strncmp (argv[0], "m", 1) == 0)
6123 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6124 BGP_CLEAR_SOFT_IN, NULL);
6125
6126 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6127 BGP_CLEAR_SOFT_IN, NULL);
6128}
6129
6130ALIAS (clear_ip_bgp_external_ipv4_soft_in,
6131 clear_ip_bgp_external_ipv4_in_cmd,
6132 "clear ip bgp external ipv4 (unicast|multicast) in",
6133 CLEAR_STR
6134 IP_STR
6135 BGP_STR
6136 "Clear all external peers\n"
6137 "Address family\n"
6138 "Address Family modifier\n"
6139 "Address Family modifier\n"
6140 "Soft reconfig inbound update\n")
6141
6142DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
6143 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
6144 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
6145 CLEAR_STR
6146 IP_STR
6147 BGP_STR
6148 "Clear all external peers\n"
6149 "Address family\n"
6150 "Address Family modifier\n"
6151 "Address Family modifier\n"
6152 "Soft reconfig inbound update\n"
6153 "Push out prefix-list ORF and do inbound soft reconfig\n")
6154{
6155 if (strncmp (argv[0], "m", 1) == 0)
6156 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6157 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6158
6159 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6160 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6161}
6162
6163DEFUN (clear_bgp_external_soft_in,
6164 clear_bgp_external_soft_in_cmd,
6165 "clear bgp external soft in",
6166 CLEAR_STR
6167 BGP_STR
6168 "Clear all external peers\n"
6169 "Soft reconfig\n"
6170 "Soft reconfig inbound update\n")
6171{
6172 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6173 BGP_CLEAR_SOFT_IN, NULL);
6174}
6175
6176ALIAS (clear_bgp_external_soft_in,
6177 clear_bgp_ipv6_external_soft_in_cmd,
6178 "clear bgp ipv6 external soft in",
6179 CLEAR_STR
6180 BGP_STR
6181 "Address family\n"
6182 "Clear all external peers\n"
6183 "Soft reconfig\n"
6184 "Soft reconfig inbound update\n")
6185
6186ALIAS (clear_bgp_external_soft_in,
6187 clear_bgp_external_in_cmd,
6188 "clear bgp external in",
6189 CLEAR_STR
6190 BGP_STR
6191 "Clear all external peers\n"
6192 "Soft reconfig inbound update\n")
6193
6194ALIAS (clear_bgp_external_soft_in,
6195 clear_bgp_ipv6_external_in_cmd,
6196 "clear bgp ipv6 external WORD in",
6197 CLEAR_STR
6198 BGP_STR
6199 "Address family\n"
6200 "Clear all external peers\n"
6201 "Soft reconfig inbound update\n")
6202
6203DEFUN (clear_bgp_external_in_prefix_filter,
6204 clear_bgp_external_in_prefix_filter_cmd,
6205 "clear bgp external in prefix-filter",
6206 CLEAR_STR
6207 BGP_STR
6208 "Clear all external peers\n"
6209 "Soft reconfig inbound update\n"
6210 "Push out prefix-list ORF and do inbound soft reconfig\n")
6211{
6212 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6213 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6214}
6215
6216ALIAS (clear_bgp_external_in_prefix_filter,
6217 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6218 "clear bgp ipv6 external in prefix-filter",
6219 CLEAR_STR
6220 BGP_STR
6221 "Address family\n"
6222 "Clear all external peers\n"
6223 "Soft reconfig inbound update\n"
6224 "Push out prefix-list ORF and do inbound soft reconfig\n")
6225
6226DEFUN (clear_ip_bgp_as_soft_in,
6227 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006228 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006229 CLEAR_STR
6230 IP_STR
6231 BGP_STR
6232 "Clear peers with the AS number\n"
6233 "Soft reconfig\n"
6234 "Soft reconfig inbound update\n")
6235{
6236 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6237 BGP_CLEAR_SOFT_IN, argv[0]);
6238}
6239
6240ALIAS (clear_ip_bgp_as_soft_in,
6241 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006242 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006243 CLEAR_STR
6244 IP_STR
6245 BGP_STR
6246 "Clear peers with the AS number\n"
6247 "Soft reconfig inbound update\n")
6248
6249DEFUN (clear_ip_bgp_as_in_prefix_filter,
6250 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006251 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006252 CLEAR_STR
6253 IP_STR
6254 BGP_STR
6255 "Clear peers with the AS number\n"
6256 "Soft reconfig inbound update\n"
6257 "Push out prefix-list ORF and do inbound soft reconfig\n")
6258{
6259 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6260 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6261}
6262
6263DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6264 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006265 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006266 CLEAR_STR
6267 IP_STR
6268 BGP_STR
6269 "Clear peers with the AS number\n"
6270 "Address family\n"
6271 "Address Family modifier\n"
6272 "Address Family modifier\n"
6273 "Soft reconfig\n"
6274 "Soft reconfig inbound update\n")
6275{
6276 if (strncmp (argv[1], "m", 1) == 0)
6277 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6278 BGP_CLEAR_SOFT_IN, argv[0]);
6279
6280 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6281 BGP_CLEAR_SOFT_IN, argv[0]);
6282}
6283
6284ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6285 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006286 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00006287 CLEAR_STR
6288 IP_STR
6289 BGP_STR
6290 "Clear peers with the AS number\n"
6291 "Address family\n"
6292 "Address Family modifier\n"
6293 "Address Family modifier\n"
6294 "Soft reconfig inbound update\n")
6295
6296DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6297 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006298 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006299 CLEAR_STR
6300 IP_STR
6301 BGP_STR
6302 "Clear peers with the AS number\n"
6303 "Address family\n"
6304 "Address Family modifier\n"
6305 "Address Family modifier\n"
6306 "Soft reconfig inbound update\n"
6307 "Push out prefix-list ORF and do inbound soft reconfig\n")
6308{
6309 if (strncmp (argv[1], "m", 1) == 0)
6310 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6311 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6312
6313 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6314 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6315}
6316
6317DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6318 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006319 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00006320 CLEAR_STR
6321 IP_STR
6322 BGP_STR
6323 "Clear peers with the AS number\n"
6324 "Address family\n"
6325 "Address Family modifier\n"
6326 "Soft reconfig\n"
6327 "Soft reconfig inbound update\n")
6328{
6329 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6330 BGP_CLEAR_SOFT_IN, argv[0]);
6331}
6332
6333ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6334 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006335 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006336 CLEAR_STR
6337 IP_STR
6338 BGP_STR
6339 "Clear peers with the AS number\n"
6340 "Address family\n"
6341 "Address Family modifier\n"
6342 "Soft reconfig inbound update\n")
6343
Lou Berger298cc2f2016-01-12 13:42:02 -05006344DEFUN (clear_ip_bgp_as_encap_soft_in,
6345 clear_ip_bgp_as_encap_soft_in_cmd,
6346 "clear ip bgp " CMD_AS_RANGE " encap unicast soft in",
6347 CLEAR_STR
6348 IP_STR
6349 BGP_STR
6350 "Clear peers with the AS number\n"
6351 "Address family\n"
6352 "Address Family modifier\n"
6353 "Soft reconfig\n"
6354 "Soft reconfig inbound update\n")
6355{
6356 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6357 BGP_CLEAR_SOFT_IN, argv[0]);
6358}
6359
6360ALIAS (clear_ip_bgp_as_encap_soft_in,
6361 clear_ip_bgp_as_encap_in_cmd,
6362 "clear ip bgp " CMD_AS_RANGE " encap unicast in",
6363 CLEAR_STR
6364 IP_STR
6365 BGP_STR
6366 "Clear peers with the AS number\n"
6367 "Address family\n"
6368 "Address Family modifier\n"
6369 "Soft reconfig inbound update\n")
6370
paul718e3742002-12-13 20:15:29 +00006371DEFUN (clear_bgp_as_soft_in,
6372 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006373 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006374 CLEAR_STR
6375 BGP_STR
6376 "Clear peers with the AS number\n"
6377 "Soft reconfig\n"
6378 "Soft reconfig inbound update\n")
6379{
6380 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6381 BGP_CLEAR_SOFT_IN, argv[0]);
6382}
6383
6384ALIAS (clear_bgp_as_soft_in,
6385 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006386 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006387 CLEAR_STR
6388 BGP_STR
6389 "Address family\n"
6390 "Clear peers with the AS number\n"
6391 "Soft reconfig\n"
6392 "Soft reconfig inbound update\n")
6393
6394ALIAS (clear_bgp_as_soft_in,
6395 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006396 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006397 CLEAR_STR
6398 BGP_STR
6399 "Clear peers with the AS number\n"
6400 "Soft reconfig inbound update\n")
6401
6402ALIAS (clear_bgp_as_soft_in,
6403 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006404 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006405 CLEAR_STR
6406 BGP_STR
6407 "Address family\n"
6408 "Clear peers with the AS number\n"
6409 "Soft reconfig inbound update\n")
6410
6411DEFUN (clear_bgp_as_in_prefix_filter,
6412 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006413 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006414 CLEAR_STR
6415 BGP_STR
6416 "Clear peers with the AS number\n"
6417 "Soft reconfig inbound update\n"
6418 "Push out prefix-list ORF and do inbound soft reconfig\n")
6419{
6420 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6421 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6422}
6423
6424ALIAS (clear_bgp_as_in_prefix_filter,
6425 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006426 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006427 CLEAR_STR
6428 BGP_STR
6429 "Address family\n"
6430 "Clear peers with the AS number\n"
6431 "Soft reconfig inbound update\n"
6432 "Push out prefix-list ORF and do inbound soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006433
paul718e3742002-12-13 20:15:29 +00006434/* Both soft-reconfiguration */
6435DEFUN (clear_ip_bgp_all_soft,
6436 clear_ip_bgp_all_soft_cmd,
6437 "clear ip bgp * soft",
6438 CLEAR_STR
6439 IP_STR
6440 BGP_STR
6441 "Clear all peers\n"
6442 "Soft reconfig\n")
6443{
6444 if (argc == 1)
6445 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6446 BGP_CLEAR_SOFT_BOTH, NULL);
6447
6448 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6449 BGP_CLEAR_SOFT_BOTH, NULL);
6450}
6451
6452ALIAS (clear_ip_bgp_all_soft,
6453 clear_ip_bgp_instance_all_soft_cmd,
6454 "clear ip bgp view WORD * soft",
6455 CLEAR_STR
6456 IP_STR
6457 BGP_STR
6458 "BGP view\n"
6459 "view name\n"
6460 "Clear all peers\n"
6461 "Soft reconfig\n")
6462
6463
6464DEFUN (clear_ip_bgp_all_ipv4_soft,
6465 clear_ip_bgp_all_ipv4_soft_cmd,
6466 "clear ip bgp * ipv4 (unicast|multicast) soft",
6467 CLEAR_STR
6468 IP_STR
6469 BGP_STR
6470 "Clear all peers\n"
6471 "Address family\n"
6472 "Address Family Modifier\n"
6473 "Address Family Modifier\n"
6474 "Soft reconfig\n")
6475{
6476 if (strncmp (argv[0], "m", 1) == 0)
6477 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6478 BGP_CLEAR_SOFT_BOTH, NULL);
6479
6480 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6481 BGP_CLEAR_SOFT_BOTH, NULL);
6482}
6483
6484DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6485 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6486 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6487 CLEAR_STR
6488 IP_STR
6489 BGP_STR
6490 "BGP view\n"
6491 "view name\n"
6492 "Clear all peers\n"
6493 "Address family\n"
6494 "Address Family Modifier\n"
6495 "Address Family Modifier\n"
6496 "Soft reconfig\n")
6497{
6498 if (strncmp (argv[1], "m", 1) == 0)
6499 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6500 BGP_CLEAR_SOFT_BOTH, NULL);
6501
6502 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6503 BGP_CLEAR_SOFT_BOTH, NULL);
6504}
6505
6506DEFUN (clear_ip_bgp_all_vpnv4_soft,
6507 clear_ip_bgp_all_vpnv4_soft_cmd,
6508 "clear ip bgp * vpnv4 unicast soft",
6509 CLEAR_STR
6510 IP_STR
6511 BGP_STR
6512 "Clear all peers\n"
6513 "Address family\n"
6514 "Address Family Modifier\n"
6515 "Soft reconfig\n")
6516{
6517 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6518 BGP_CLEAR_SOFT_BOTH, argv[0]);
6519}
6520
Lou Berger298cc2f2016-01-12 13:42:02 -05006521DEFUN (clear_ip_bgp_all_encap_soft,
6522 clear_ip_bgp_all_encap_soft_cmd,
6523 "clear ip bgp * encap unicast soft",
6524 CLEAR_STR
6525 IP_STR
6526 BGP_STR
6527 "Clear all peers\n"
6528 "Address family\n"
6529 "Address Family Modifier\n"
6530 "Soft reconfig\n")
6531{
6532 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
6533 BGP_CLEAR_SOFT_BOTH, argv[0]);
6534}
6535
paul718e3742002-12-13 20:15:29 +00006536DEFUN (clear_bgp_all_soft,
6537 clear_bgp_all_soft_cmd,
6538 "clear bgp * soft",
6539 CLEAR_STR
6540 BGP_STR
6541 "Clear all peers\n"
6542 "Soft reconfig\n")
6543{
6544 if (argc == 1)
6545 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6546 BGP_CLEAR_SOFT_BOTH, argv[0]);
6547
6548 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6549 BGP_CLEAR_SOFT_BOTH, argv[0]);
6550}
6551
6552ALIAS (clear_bgp_all_soft,
6553 clear_bgp_instance_all_soft_cmd,
6554 "clear bgp view WORD * soft",
6555 CLEAR_STR
6556 BGP_STR
6557 "BGP view\n"
6558 "view name\n"
6559 "Clear all peers\n"
6560 "Soft reconfig\n")
6561
6562ALIAS (clear_bgp_all_soft,
6563 clear_bgp_ipv6_all_soft_cmd,
6564 "clear bgp ipv6 * soft",
6565 CLEAR_STR
6566 BGP_STR
6567 "Address family\n"
6568 "Clear all peers\n"
6569 "Soft reconfig\n")
6570
6571DEFUN (clear_ip_bgp_peer_soft,
6572 clear_ip_bgp_peer_soft_cmd,
6573 "clear ip bgp A.B.C.D soft",
6574 CLEAR_STR
6575 IP_STR
6576 BGP_STR
6577 "BGP neighbor address to clear\n"
6578 "Soft reconfig\n")
6579{
6580 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6581 BGP_CLEAR_SOFT_BOTH, argv[0]);
6582}
6583
6584DEFUN (clear_ip_bgp_peer_ipv4_soft,
6585 clear_ip_bgp_peer_ipv4_soft_cmd,
6586 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6587 CLEAR_STR
6588 IP_STR
6589 BGP_STR
6590 "BGP neighbor address to clear\n"
6591 "Address family\n"
6592 "Address Family Modifier\n"
6593 "Address Family Modifier\n"
6594 "Soft reconfig\n")
6595{
6596 if (strncmp (argv[1], "m", 1) == 0)
6597 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6598 BGP_CLEAR_SOFT_BOTH, argv[0]);
6599
6600 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6601 BGP_CLEAR_SOFT_BOTH, argv[0]);
6602}
6603
6604DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6605 clear_ip_bgp_peer_vpnv4_soft_cmd,
6606 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6607 CLEAR_STR
6608 IP_STR
6609 BGP_STR
6610 "BGP neighbor address to clear\n"
6611 "Address family\n"
6612 "Address Family Modifier\n"
6613 "Soft reconfig\n")
6614{
6615 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6616 BGP_CLEAR_SOFT_BOTH, argv[0]);
6617}
6618
Lou Berger298cc2f2016-01-12 13:42:02 -05006619DEFUN (clear_ip_bgp_peer_encap_soft,
6620 clear_ip_bgp_peer_encap_soft_cmd,
6621 "clear ip bgp A.B.C.D encap unicast soft",
6622 CLEAR_STR
6623 IP_STR
6624 BGP_STR
6625 "BGP neighbor address to clear\n"
6626 "Address family\n"
6627 "Address Family Modifier\n"
6628 "Soft reconfig\n")
6629{
6630 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
6631 BGP_CLEAR_SOFT_BOTH, argv[0]);
6632}
6633
paul718e3742002-12-13 20:15:29 +00006634DEFUN (clear_bgp_peer_soft,
6635 clear_bgp_peer_soft_cmd,
6636 "clear bgp (A.B.C.D|X:X::X:X) soft",
6637 CLEAR_STR
6638 BGP_STR
6639 "BGP neighbor address to clear\n"
6640 "BGP IPv6 neighbor to clear\n"
6641 "Soft reconfig\n")
6642{
6643 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6644 BGP_CLEAR_SOFT_BOTH, argv[0]);
6645}
6646
6647ALIAS (clear_bgp_peer_soft,
6648 clear_bgp_ipv6_peer_soft_cmd,
6649 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6650 CLEAR_STR
6651 BGP_STR
6652 "Address family\n"
6653 "BGP neighbor address to clear\n"
6654 "BGP IPv6 neighbor to clear\n"
6655 "Soft reconfig\n")
6656
6657DEFUN (clear_ip_bgp_peer_group_soft,
6658 clear_ip_bgp_peer_group_soft_cmd,
6659 "clear ip bgp peer-group WORD soft",
6660 CLEAR_STR
6661 IP_STR
6662 BGP_STR
6663 "Clear all members of peer-group\n"
6664 "BGP peer-group name\n"
6665 "Soft reconfig\n")
6666{
6667 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6668 BGP_CLEAR_SOFT_BOTH, argv[0]);
6669}
6670
6671DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6672 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6673 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6674 CLEAR_STR
6675 IP_STR
6676 BGP_STR
6677 "Clear all members of peer-group\n"
6678 "BGP peer-group name\n"
6679 "Address family\n"
6680 "Address Family modifier\n"
6681 "Address Family modifier\n"
6682 "Soft reconfig\n")
6683{
6684 if (strncmp (argv[1], "m", 1) == 0)
6685 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6686 BGP_CLEAR_SOFT_BOTH, argv[0]);
6687
6688 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6689 BGP_CLEAR_SOFT_BOTH, argv[0]);
6690}
6691
6692DEFUN (clear_bgp_peer_group_soft,
6693 clear_bgp_peer_group_soft_cmd,
6694 "clear bgp peer-group WORD soft",
6695 CLEAR_STR
6696 BGP_STR
6697 "Clear all members of peer-group\n"
6698 "BGP peer-group name\n"
6699 "Soft reconfig\n")
6700{
6701 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6702 BGP_CLEAR_SOFT_BOTH, argv[0]);
6703}
6704
6705ALIAS (clear_bgp_peer_group_soft,
6706 clear_bgp_ipv6_peer_group_soft_cmd,
6707 "clear bgp ipv6 peer-group WORD soft",
6708 CLEAR_STR
6709 BGP_STR
6710 "Address family\n"
6711 "Clear all members of peer-group\n"
6712 "BGP peer-group name\n"
6713 "Soft reconfig\n")
6714
6715DEFUN (clear_ip_bgp_external_soft,
6716 clear_ip_bgp_external_soft_cmd,
6717 "clear ip bgp external soft",
6718 CLEAR_STR
6719 IP_STR
6720 BGP_STR
6721 "Clear all external peers\n"
6722 "Soft reconfig\n")
6723{
6724 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6725 BGP_CLEAR_SOFT_BOTH, NULL);
6726}
6727
6728DEFUN (clear_ip_bgp_external_ipv4_soft,
6729 clear_ip_bgp_external_ipv4_soft_cmd,
6730 "clear ip bgp external ipv4 (unicast|multicast) soft",
6731 CLEAR_STR
6732 IP_STR
6733 BGP_STR
6734 "Clear all external peers\n"
6735 "Address family\n"
6736 "Address Family modifier\n"
6737 "Address Family modifier\n"
6738 "Soft reconfig\n")
6739{
6740 if (strncmp (argv[0], "m", 1) == 0)
6741 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6742 BGP_CLEAR_SOFT_BOTH, NULL);
6743
6744 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6745 BGP_CLEAR_SOFT_BOTH, NULL);
6746}
6747
6748DEFUN (clear_bgp_external_soft,
6749 clear_bgp_external_soft_cmd,
6750 "clear bgp external soft",
6751 CLEAR_STR
6752 BGP_STR
6753 "Clear all external peers\n"
6754 "Soft reconfig\n")
6755{
6756 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6757 BGP_CLEAR_SOFT_BOTH, NULL);
6758}
6759
6760ALIAS (clear_bgp_external_soft,
6761 clear_bgp_ipv6_external_soft_cmd,
6762 "clear bgp ipv6 external soft",
6763 CLEAR_STR
6764 BGP_STR
6765 "Address family\n"
6766 "Clear all external peers\n"
6767 "Soft reconfig\n")
6768
6769DEFUN (clear_ip_bgp_as_soft,
6770 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006771 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006772 CLEAR_STR
6773 IP_STR
6774 BGP_STR
6775 "Clear peers with the AS number\n"
6776 "Soft reconfig\n")
6777{
6778 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6779 BGP_CLEAR_SOFT_BOTH, argv[0]);
6780}
6781
6782DEFUN (clear_ip_bgp_as_ipv4_soft,
6783 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006784 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006785 CLEAR_STR
6786 IP_STR
6787 BGP_STR
6788 "Clear peers with the AS number\n"
6789 "Address family\n"
6790 "Address Family Modifier\n"
6791 "Address Family Modifier\n"
6792 "Soft reconfig\n")
6793{
6794 if (strncmp (argv[1], "m", 1) == 0)
6795 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6796 BGP_CLEAR_SOFT_BOTH, argv[0]);
6797
6798 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6799 BGP_CLEAR_SOFT_BOTH, argv[0]);
6800}
6801
6802DEFUN (clear_ip_bgp_as_vpnv4_soft,
6803 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006804 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00006805 CLEAR_STR
6806 IP_STR
6807 BGP_STR
6808 "Clear peers with the AS number\n"
6809 "Address family\n"
6810 "Address Family Modifier\n"
6811 "Soft reconfig\n")
6812{
6813 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6814 BGP_CLEAR_SOFT_BOTH, argv[0]);
6815}
6816
Lou Berger298cc2f2016-01-12 13:42:02 -05006817DEFUN (clear_ip_bgp_as_encap_soft,
6818 clear_ip_bgp_as_encap_soft_cmd,
6819 "clear ip bgp " CMD_AS_RANGE " encap unicast soft",
6820 CLEAR_STR
6821 IP_STR
6822 BGP_STR
6823 "Clear peers with the AS number\n"
6824 "Address family\n"
6825 "Address Family Modifier\n"
6826 "Soft reconfig\n")
6827{
6828 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6829 BGP_CLEAR_SOFT_BOTH, argv[0]);
6830}
6831
paul718e3742002-12-13 20:15:29 +00006832DEFUN (clear_bgp_as_soft,
6833 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006834 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006835 CLEAR_STR
6836 BGP_STR
6837 "Clear peers with the AS number\n"
6838 "Soft reconfig\n")
6839{
6840 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6841 BGP_CLEAR_SOFT_BOTH, argv[0]);
6842}
6843
6844ALIAS (clear_bgp_as_soft,
6845 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006846 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006847 CLEAR_STR
6848 BGP_STR
6849 "Address family\n"
6850 "Clear peers with the AS number\n"
6851 "Soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006852
paulfee0f4c2004-09-13 05:12:46 +00006853/* RS-client soft reconfiguration. */
6854#ifdef HAVE_IPV6
6855DEFUN (clear_bgp_all_rsclient,
6856 clear_bgp_all_rsclient_cmd,
6857 "clear bgp * rsclient",
6858 CLEAR_STR
6859 BGP_STR
6860 "Clear all peers\n"
6861 "Soft reconfig for rsclient RIB\n")
6862{
6863 if (argc == 1)
6864 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6865 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6866
6867 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6868 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6869}
6870
6871ALIAS (clear_bgp_all_rsclient,
6872 clear_bgp_ipv6_all_rsclient_cmd,
6873 "clear bgp ipv6 * rsclient",
6874 CLEAR_STR
6875 BGP_STR
6876 "Address family\n"
6877 "Clear all peers\n"
6878 "Soft reconfig for rsclient RIB\n")
6879
6880ALIAS (clear_bgp_all_rsclient,
6881 clear_bgp_instance_all_rsclient_cmd,
6882 "clear bgp view WORD * rsclient",
6883 CLEAR_STR
6884 BGP_STR
6885 "BGP view\n"
6886 "view name\n"
6887 "Clear all peers\n"
6888 "Soft reconfig for rsclient RIB\n")
6889
6890ALIAS (clear_bgp_all_rsclient,
6891 clear_bgp_ipv6_instance_all_rsclient_cmd,
6892 "clear bgp ipv6 view WORD * rsclient",
6893 CLEAR_STR
6894 BGP_STR
6895 "Address family\n"
6896 "BGP view\n"
6897 "view name\n"
6898 "Clear all peers\n"
6899 "Soft reconfig for rsclient RIB\n")
6900#endif /* HAVE_IPV6 */
6901
6902DEFUN (clear_ip_bgp_all_rsclient,
6903 clear_ip_bgp_all_rsclient_cmd,
6904 "clear ip bgp * rsclient",
6905 CLEAR_STR
6906 IP_STR
6907 BGP_STR
6908 "Clear all peers\n"
6909 "Soft reconfig for rsclient RIB\n")
6910{
6911 if (argc == 1)
6912 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6913 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6914
6915 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6916 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6917}
6918
6919ALIAS (clear_ip_bgp_all_rsclient,
6920 clear_ip_bgp_instance_all_rsclient_cmd,
6921 "clear ip bgp view WORD * rsclient",
6922 CLEAR_STR
6923 IP_STR
6924 BGP_STR
6925 "BGP view\n"
6926 "view name\n"
6927 "Clear all peers\n"
6928 "Soft reconfig for rsclient RIB\n")
6929
6930#ifdef HAVE_IPV6
6931DEFUN (clear_bgp_peer_rsclient,
6932 clear_bgp_peer_rsclient_cmd,
6933 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
6934 CLEAR_STR
6935 BGP_STR
6936 "BGP neighbor IP address to clear\n"
6937 "BGP IPv6 neighbor to clear\n"
6938 "Soft reconfig for rsclient RIB\n")
6939{
6940 if (argc == 2)
6941 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
6942 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6943
6944 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6945 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6946}
6947
6948ALIAS (clear_bgp_peer_rsclient,
6949 clear_bgp_ipv6_peer_rsclient_cmd,
6950 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
6951 CLEAR_STR
6952 BGP_STR
6953 "Address family\n"
6954 "BGP neighbor IP address to clear\n"
6955 "BGP IPv6 neighbor to clear\n"
6956 "Soft reconfig for rsclient RIB\n")
6957
6958ALIAS (clear_bgp_peer_rsclient,
6959 clear_bgp_instance_peer_rsclient_cmd,
6960 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6961 CLEAR_STR
6962 BGP_STR
6963 "BGP view\n"
6964 "view name\n"
6965 "BGP neighbor IP address to clear\n"
6966 "BGP IPv6 neighbor to clear\n"
6967 "Soft reconfig for rsclient RIB\n")
6968
6969ALIAS (clear_bgp_peer_rsclient,
6970 clear_bgp_ipv6_instance_peer_rsclient_cmd,
6971 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
6972 CLEAR_STR
6973 BGP_STR
6974 "Address family\n"
6975 "BGP view\n"
6976 "view name\n"
6977 "BGP neighbor IP address to clear\n"
6978 "BGP IPv6 neighbor to clear\n"
6979 "Soft reconfig for rsclient RIB\n")
6980#endif /* HAVE_IPV6 */
6981
6982DEFUN (clear_ip_bgp_peer_rsclient,
6983 clear_ip_bgp_peer_rsclient_cmd,
6984 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
6985 CLEAR_STR
6986 IP_STR
6987 BGP_STR
6988 "BGP neighbor IP address to clear\n"
6989 "BGP IPv6 neighbor to clear\n"
6990 "Soft reconfig for rsclient RIB\n")
6991{
6992 if (argc == 2)
6993 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
6994 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6995
6996 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6997 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6998}
6999
7000ALIAS (clear_ip_bgp_peer_rsclient,
7001 clear_ip_bgp_instance_peer_rsclient_cmd,
7002 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7003 CLEAR_STR
7004 IP_STR
7005 BGP_STR
7006 "BGP view\n"
7007 "view name\n"
7008 "BGP neighbor IP address to clear\n"
7009 "BGP IPv6 neighbor to clear\n"
7010 "Soft reconfig for rsclient RIB\n")
7011
Michael Lamberte0081f72008-11-16 20:12:04 +00007012DEFUN (show_bgp_views,
7013 show_bgp_views_cmd,
7014 "show bgp views",
7015 SHOW_STR
7016 BGP_STR
7017 "Show the defined BGP views\n")
7018{
7019 struct list *inst = bm->bgp;
7020 struct listnode *node;
7021 struct bgp *bgp;
7022
7023 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
7024 {
7025 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
7026 return CMD_WARNING;
7027 }
7028
7029 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
7030 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
7031 vty_out (vty, "\t%s (AS%u)%s",
7032 bgp->name ? bgp->name : "(null)",
7033 bgp->as, VTY_NEWLINE);
7034
7035 return CMD_SUCCESS;
7036}
7037
Paul Jakma4bf6a362006-03-30 14:05:23 +00007038DEFUN (show_bgp_memory,
7039 show_bgp_memory_cmd,
7040 "show bgp memory",
7041 SHOW_STR
7042 BGP_STR
7043 "Global BGP memory statistics\n")
7044{
7045 char memstrbuf[MTYPE_MEMSTR_LEN];
7046 unsigned long count;
7047
7048 /* RIB related usage stats */
7049 count = mtype_stats_alloc (MTYPE_BGP_NODE);
7050 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
7051 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7052 count * sizeof (struct bgp_node)),
7053 VTY_NEWLINE);
7054
7055 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
7056 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
7057 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7058 count * sizeof (struct bgp_info)),
7059 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007060 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
7061 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
7062 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7063 count * sizeof (struct bgp_info_extra)),
7064 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007065
7066 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
7067 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
7068 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7069 count * sizeof (struct bgp_static)),
7070 VTY_NEWLINE);
7071
7072 /* Adj-In/Out */
7073 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
7074 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
7075 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7076 count * sizeof (struct bgp_adj_in)),
7077 VTY_NEWLINE);
7078 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
7079 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
7080 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7081 count * sizeof (struct bgp_adj_out)),
7082 VTY_NEWLINE);
7083
7084 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
7085 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
7086 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7087 count * sizeof (struct bgp_nexthop_cache)),
7088 VTY_NEWLINE);
7089
7090 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
7091 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
7092 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7093 count * sizeof (struct bgp_damp_info)),
7094 VTY_NEWLINE);
7095
7096 /* Attributes */
7097 count = attr_count();
7098 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
7099 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7100 count * sizeof(struct attr)),
7101 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007102 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
7103 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
7104 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7105 count * sizeof(struct attr_extra)),
7106 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007107
7108 if ((count = attr_unknown_count()))
7109 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
7110
7111 /* AS_PATH attributes */
7112 count = aspath_count ();
7113 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
7114 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7115 count * sizeof (struct aspath)),
7116 VTY_NEWLINE);
7117
7118 count = mtype_stats_alloc (MTYPE_AS_SEG);
7119 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
7120 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7121 count * sizeof (struct assegment)),
7122 VTY_NEWLINE);
7123
7124 /* Other attributes */
7125 if ((count = community_count ()))
7126 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7127 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7128 count * sizeof (struct community)),
7129 VTY_NEWLINE);
7130 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
7131 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7132 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7133 count * sizeof (struct ecommunity)),
7134 VTY_NEWLINE);
7135
7136 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
7137 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
7138 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7139 count * sizeof (struct cluster_list)),
7140 VTY_NEWLINE);
7141
7142 /* Peer related usage */
7143 count = mtype_stats_alloc (MTYPE_BGP_PEER);
7144 vty_out (vty, "%ld peers, using %s of memory%s", count,
7145 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7146 count * sizeof (struct peer)),
7147 VTY_NEWLINE);
7148
7149 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
7150 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
7151 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7152 count * sizeof (struct peer_group)),
7153 VTY_NEWLINE);
7154
7155 /* Other */
7156 if ((count = mtype_stats_alloc (MTYPE_HASH)))
7157 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
7158 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7159 count * sizeof (struct hash)),
7160 VTY_NEWLINE);
7161 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
7162 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
7163 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7164 count * sizeof (struct hash_backet)),
7165 VTY_NEWLINE);
7166 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
7167 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
7168 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7169 count * sizeof (regex_t)),
7170 VTY_NEWLINE);
7171 return CMD_SUCCESS;
7172}
paulfee0f4c2004-09-13 05:12:46 +00007173
paul718e3742002-12-13 20:15:29 +00007174/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00007175static int
paul718e3742002-12-13 20:15:29 +00007176bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
7177{
7178 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007179 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00007180 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00007181 char timebuf[BGP_UPTIME_LEN];
7182 int len;
7183
7184 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00007185 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00007186
paul1eb8ef22005-04-07 07:30:20 +00007187 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007188 {
7189 if (peer->afc[afi][safi])
7190 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00007191 if (!count)
7192 {
7193 unsigned long ents;
7194 char memstrbuf[MTYPE_MEMSTR_LEN];
7195
7196 /* Usage summary and header */
7197 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007198 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00007199 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007200
Paul Jakma4bf6a362006-03-30 14:05:23 +00007201 ents = bgp_table_count (bgp->rib[afi][safi]);
7202 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
7203 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7204 ents * sizeof (struct bgp_node)),
7205 VTY_NEWLINE);
7206
7207 /* Peer related usage */
7208 ents = listcount (bgp->peer);
7209 vty_out (vty, "Peers %ld, using %s of memory%s",
7210 ents,
7211 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7212 ents * sizeof (struct peer)),
7213 VTY_NEWLINE);
7214
7215 if ((ents = listcount (bgp->rsclient)))
7216 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
7217 ents,
7218 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7219 ents * sizeof (struct peer)),
7220 VTY_NEWLINE);
7221
7222 if ((ents = listcount (bgp->group)))
7223 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
7224 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7225 ents * sizeof (struct peer_group)),
7226 VTY_NEWLINE);
7227
7228 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
7229 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
7230 vty_out (vty, "%s", VTY_NEWLINE);
7231 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7232 }
7233
paul718e3742002-12-13 20:15:29 +00007234 count++;
7235
7236 len = vty_out (vty, "%s", peer->host);
7237 len = 16 - len;
7238 if (len < 1)
7239 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7240 else
7241 vty_out (vty, "%*s", len, " ");
7242
hasso3d515fd2005-02-01 21:30:04 +00007243 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00007244
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007245 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00007246 peer->as,
7247 peer->open_in + peer->update_in + peer->keepalive_in
7248 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
7249 peer->open_out + peer->update_out + peer->keepalive_out
7250 + peer->notify_out + peer->refresh_out
7251 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007252 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00007253
7254 vty_out (vty, "%8s",
7255 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7256
7257 if (peer->status == Established)
7258 {
7259 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
7260 }
7261 else
7262 {
7263 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7264 vty_out (vty, " Idle (Admin)");
7265 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7266 vty_out (vty, " Idle (PfxCt)");
7267 else
7268 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7269 }
7270
7271 vty_out (vty, "%s", VTY_NEWLINE);
7272 }
7273 }
7274
7275 if (count)
7276 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7277 count, VTY_NEWLINE);
7278 else
7279 vty_out (vty, "No %s neighbor is configured%s",
7280 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7281 return CMD_SUCCESS;
7282}
7283
paul94f2b392005-06-28 12:44:16 +00007284static int
paulfd79ac92004-10-13 05:06:08 +00007285bgp_show_summary_vty (struct vty *vty, const char *name,
7286 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007287{
7288 struct bgp *bgp;
7289
7290 if (name)
7291 {
7292 bgp = bgp_lookup_by_name (name);
7293
7294 if (! bgp)
7295 {
7296 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7297 return CMD_WARNING;
7298 }
7299
7300 bgp_show_summary (vty, bgp, afi, safi);
7301 return CMD_SUCCESS;
7302 }
7303
7304 bgp = bgp_get_default ();
7305
7306 if (bgp)
7307 bgp_show_summary (vty, bgp, afi, safi);
7308
7309 return CMD_SUCCESS;
7310}
7311
7312/* `show ip bgp summary' commands. */
7313DEFUN (show_ip_bgp_summary,
7314 show_ip_bgp_summary_cmd,
7315 "show ip bgp summary",
7316 SHOW_STR
7317 IP_STR
7318 BGP_STR
7319 "Summary of BGP neighbor status\n")
7320{
7321 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7322}
7323
7324DEFUN (show_ip_bgp_instance_summary,
7325 show_ip_bgp_instance_summary_cmd,
7326 "show ip bgp view WORD summary",
7327 SHOW_STR
7328 IP_STR
7329 BGP_STR
7330 "BGP view\n"
7331 "View name\n"
7332 "Summary of BGP neighbor status\n")
7333{
7334 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7335}
7336
7337DEFUN (show_ip_bgp_ipv4_summary,
7338 show_ip_bgp_ipv4_summary_cmd,
7339 "show ip bgp ipv4 (unicast|multicast) summary",
7340 SHOW_STR
7341 IP_STR
7342 BGP_STR
7343 "Address family\n"
7344 "Address Family modifier\n"
7345 "Address Family modifier\n"
7346 "Summary of BGP neighbor status\n")
7347{
7348 if (strncmp (argv[0], "m", 1) == 0)
7349 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7350
7351 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7352}
7353
Michael Lambert95cbbd22010-07-23 14:43:04 -04007354ALIAS (show_ip_bgp_ipv4_summary,
7355 show_bgp_ipv4_safi_summary_cmd,
7356 "show bgp ipv4 (unicast|multicast) summary",
7357 SHOW_STR
7358 BGP_STR
7359 "Address family\n"
7360 "Address Family modifier\n"
7361 "Address Family modifier\n"
7362 "Summary of BGP neighbor status\n")
7363
paul718e3742002-12-13 20:15:29 +00007364DEFUN (show_ip_bgp_instance_ipv4_summary,
7365 show_ip_bgp_instance_ipv4_summary_cmd,
7366 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7367 SHOW_STR
7368 IP_STR
7369 BGP_STR
7370 "BGP view\n"
7371 "View name\n"
7372 "Address family\n"
7373 "Address Family modifier\n"
7374 "Address Family modifier\n"
7375 "Summary of BGP neighbor status\n")
7376{
7377 if (strncmp (argv[1], "m", 1) == 0)
7378 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7379 else
7380 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7381}
7382
Michael Lambert95cbbd22010-07-23 14:43:04 -04007383ALIAS (show_ip_bgp_instance_ipv4_summary,
7384 show_bgp_instance_ipv4_safi_summary_cmd,
7385 "show bgp view WORD ipv4 (unicast|multicast) summary",
7386 SHOW_STR
7387 BGP_STR
7388 "BGP view\n"
7389 "View name\n"
7390 "Address family\n"
7391 "Address Family modifier\n"
7392 "Address Family modifier\n"
7393 "Summary of BGP neighbor status\n")
7394
paul718e3742002-12-13 20:15:29 +00007395DEFUN (show_ip_bgp_vpnv4_all_summary,
7396 show_ip_bgp_vpnv4_all_summary_cmd,
7397 "show ip bgp vpnv4 all summary",
7398 SHOW_STR
7399 IP_STR
7400 BGP_STR
7401 "Display VPNv4 NLRI specific information\n"
7402 "Display information about all VPNv4 NLRIs\n"
7403 "Summary of BGP neighbor status\n")
7404{
7405 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7406}
7407
7408DEFUN (show_ip_bgp_vpnv4_rd_summary,
7409 show_ip_bgp_vpnv4_rd_summary_cmd,
7410 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7411 SHOW_STR
7412 IP_STR
7413 BGP_STR
7414 "Display VPNv4 NLRI specific information\n"
7415 "Display information for a route distinguisher\n"
7416 "VPN Route Distinguisher\n"
7417 "Summary of BGP neighbor status\n")
7418{
7419 int ret;
7420 struct prefix_rd prd;
7421
7422 ret = str2prefix_rd (argv[0], &prd);
7423 if (! ret)
7424 {
7425 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7426 return CMD_WARNING;
7427 }
7428
7429 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7430}
7431
7432#ifdef HAVE_IPV6
7433DEFUN (show_bgp_summary,
7434 show_bgp_summary_cmd,
7435 "show bgp summary",
7436 SHOW_STR
7437 BGP_STR
7438 "Summary of BGP neighbor status\n")
7439{
7440 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7441}
7442
7443DEFUN (show_bgp_instance_summary,
7444 show_bgp_instance_summary_cmd,
7445 "show bgp view WORD summary",
7446 SHOW_STR
7447 BGP_STR
7448 "BGP view\n"
7449 "View name\n"
7450 "Summary of BGP neighbor status\n")
7451{
7452 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7453}
7454
7455ALIAS (show_bgp_summary,
7456 show_bgp_ipv6_summary_cmd,
7457 "show bgp ipv6 summary",
7458 SHOW_STR
7459 BGP_STR
7460 "Address family\n"
7461 "Summary of BGP neighbor status\n")
7462
7463ALIAS (show_bgp_instance_summary,
7464 show_bgp_instance_ipv6_summary_cmd,
7465 "show bgp view WORD ipv6 summary",
7466 SHOW_STR
7467 BGP_STR
7468 "BGP view\n"
7469 "View name\n"
7470 "Address family\n"
7471 "Summary of BGP neighbor status\n")
7472
Michael Lambert95cbbd22010-07-23 14:43:04 -04007473DEFUN (show_bgp_ipv6_safi_summary,
7474 show_bgp_ipv6_safi_summary_cmd,
7475 "show bgp ipv6 (unicast|multicast) summary",
7476 SHOW_STR
7477 BGP_STR
7478 "Address family\n"
7479 "Address Family modifier\n"
7480 "Address Family modifier\n"
7481 "Summary of BGP neighbor status\n")
7482{
7483 if (strncmp (argv[0], "m", 1) == 0)
7484 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7485
7486 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7487}
7488
7489DEFUN (show_bgp_instance_ipv6_safi_summary,
7490 show_bgp_instance_ipv6_safi_summary_cmd,
7491 "show bgp view WORD ipv6 (unicast|multicast) summary",
7492 SHOW_STR
7493 BGP_STR
7494 "BGP view\n"
7495 "View name\n"
7496 "Address family\n"
7497 "Address Family modifier\n"
7498 "Address Family modifier\n"
7499 "Summary of BGP neighbor status\n")
7500{
7501 if (strncmp (argv[1], "m", 1) == 0)
7502 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7503
7504 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7505}
7506
paul718e3742002-12-13 20:15:29 +00007507/* old command */
7508DEFUN (show_ipv6_bgp_summary,
7509 show_ipv6_bgp_summary_cmd,
7510 "show ipv6 bgp summary",
7511 SHOW_STR
7512 IPV6_STR
7513 BGP_STR
7514 "Summary of BGP neighbor status\n")
7515{
7516 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7517}
7518
7519/* old command */
7520DEFUN (show_ipv6_mbgp_summary,
7521 show_ipv6_mbgp_summary_cmd,
7522 "show ipv6 mbgp summary",
7523 SHOW_STR
7524 IPV6_STR
7525 MBGP_STR
7526 "Summary of BGP neighbor status\n")
7527{
7528 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7529}
7530#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02007531
paulfd79ac92004-10-13 05:06:08 +00007532const char *
hasso538621f2004-05-21 09:31:30 +00007533afi_safi_print (afi_t afi, safi_t safi)
7534{
7535 if (afi == AFI_IP && safi == SAFI_UNICAST)
7536 return "IPv4 Unicast";
7537 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7538 return "IPv4 Multicast";
7539 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
Lou Berger9da04bc2016-01-12 13:41:55 -05007540 return "VPN-IPv4 Unicast";
hasso538621f2004-05-21 09:31:30 +00007541 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7542 return "IPv6 Unicast";
7543 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7544 return "IPv6 Multicast";
Lou Berger9da04bc2016-01-12 13:41:55 -05007545 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
7546 return "VPN-IPv6 Unicast";
hasso538621f2004-05-21 09:31:30 +00007547 else
7548 return "Unknown";
7549}
7550
paul718e3742002-12-13 20:15:29 +00007551/* Show BGP peer's information. */
7552enum show_type
7553{
7554 show_all,
7555 show_peer
7556};
7557
paul94f2b392005-06-28 12:44:16 +00007558static void
paul718e3742002-12-13 20:15:29 +00007559bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7560 afi_t afi, safi_t safi,
7561 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7562 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7563{
7564 /* Send-Mode */
7565 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7566 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7567 {
7568 vty_out (vty, " Send-mode: ");
7569 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7570 vty_out (vty, "advertised");
7571 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7572 vty_out (vty, "%sreceived",
7573 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7574 ", " : "");
7575 vty_out (vty, "%s", VTY_NEWLINE);
7576 }
7577
7578 /* Receive-Mode */
7579 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7580 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7581 {
7582 vty_out (vty, " Receive-mode: ");
7583 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7584 vty_out (vty, "advertised");
7585 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7586 vty_out (vty, "%sreceived",
7587 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7588 ", " : "");
7589 vty_out (vty, "%s", VTY_NEWLINE);
7590 }
7591}
7592
paul94f2b392005-06-28 12:44:16 +00007593static void
paul718e3742002-12-13 20:15:29 +00007594bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7595{
7596 struct bgp_filter *filter;
7597 char orf_pfx_name[BUFSIZ];
7598 int orf_pfx_count;
7599
7600 filter = &p->filter[afi][safi];
7601
hasso538621f2004-05-21 09:31:30 +00007602 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007603 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007604
paul718e3742002-12-13 20:15:29 +00007605 if (p->af_group[afi][safi])
7606 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7607
7608 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7609 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7610 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7611 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7612 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7613 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7614 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7615
7616 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7617 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7618 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7619 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7620 {
7621 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7622 ORF_TYPE_PREFIX, VTY_NEWLINE);
7623 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7624 PEER_CAP_ORF_PREFIX_SM_ADV,
7625 PEER_CAP_ORF_PREFIX_RM_ADV,
7626 PEER_CAP_ORF_PREFIX_SM_RCV,
7627 PEER_CAP_ORF_PREFIX_RM_RCV);
7628 }
7629 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7630 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7631 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7632 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7633 {
7634 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7635 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7636 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7637 PEER_CAP_ORF_PREFIX_SM_ADV,
7638 PEER_CAP_ORF_PREFIX_RM_ADV,
7639 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7640 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7641 }
7642
7643 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7644 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7645
7646 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7647 || orf_pfx_count)
7648 {
7649 vty_out (vty, " Outbound Route Filter (ORF):");
7650 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7651 vty_out (vty, " sent;");
7652 if (orf_pfx_count)
7653 vty_out (vty, " received (%d entries)", orf_pfx_count);
7654 vty_out (vty, "%s", VTY_NEWLINE);
7655 }
7656 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7657 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7658
7659 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7660 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7661 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7662 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7663 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7664 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7665 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7666 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7667 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7668 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
7669 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
7670 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7671 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
7672 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7673 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
7674 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7675 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7676 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
7677 {
7678 vty_out (vty, " Community attribute sent to this neighbor");
7679 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7680 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007681 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007682 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007683 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007684 else
hasso538621f2004-05-21 09:31:30 +00007685 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007686 }
7687 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
7688 {
7689 vty_out (vty, " Default information originate,");
7690
7691 if (p->default_rmap[afi][safi].name)
7692 vty_out (vty, " default route-map %s%s,",
7693 p->default_rmap[afi][safi].map ? "*" : "",
7694 p->default_rmap[afi][safi].name);
7695 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
7696 vty_out (vty, " default sent%s", VTY_NEWLINE);
7697 else
7698 vty_out (vty, " default not sent%s", VTY_NEWLINE);
7699 }
7700
7701 if (filter->plist[FILTER_IN].name
7702 || filter->dlist[FILTER_IN].name
7703 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00007704 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007705 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
7706 if (filter->plist[FILTER_OUT].name
7707 || filter->dlist[FILTER_OUT].name
7708 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00007709 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00007710 || filter->usmap.name)
7711 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007712 if (filter->map[RMAP_IMPORT].name)
7713 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
7714 if (filter->map[RMAP_EXPORT].name)
7715 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007716
7717 /* prefix-list */
7718 if (filter->plist[FILTER_IN].name)
7719 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
7720 filter->plist[FILTER_IN].plist ? "*" : "",
7721 filter->plist[FILTER_IN].name,
7722 VTY_NEWLINE);
7723 if (filter->plist[FILTER_OUT].name)
7724 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
7725 filter->plist[FILTER_OUT].plist ? "*" : "",
7726 filter->plist[FILTER_OUT].name,
7727 VTY_NEWLINE);
7728
7729 /* distribute-list */
7730 if (filter->dlist[FILTER_IN].name)
7731 vty_out (vty, " Incoming update network filter list is %s%s%s",
7732 filter->dlist[FILTER_IN].alist ? "*" : "",
7733 filter->dlist[FILTER_IN].name,
7734 VTY_NEWLINE);
7735 if (filter->dlist[FILTER_OUT].name)
7736 vty_out (vty, " Outgoing update network filter list is %s%s%s",
7737 filter->dlist[FILTER_OUT].alist ? "*" : "",
7738 filter->dlist[FILTER_OUT].name,
7739 VTY_NEWLINE);
7740
7741 /* filter-list. */
7742 if (filter->aslist[FILTER_IN].name)
7743 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
7744 filter->aslist[FILTER_IN].aslist ? "*" : "",
7745 filter->aslist[FILTER_IN].name,
7746 VTY_NEWLINE);
7747 if (filter->aslist[FILTER_OUT].name)
7748 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
7749 filter->aslist[FILTER_OUT].aslist ? "*" : "",
7750 filter->aslist[FILTER_OUT].name,
7751 VTY_NEWLINE);
7752
7753 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00007754 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007755 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007756 filter->map[RMAP_IN].map ? "*" : "",
7757 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00007758 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007759 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00007760 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007761 filter->map[RMAP_OUT].map ? "*" : "",
7762 filter->map[RMAP_OUT].name,
7763 VTY_NEWLINE);
7764 if (filter->map[RMAP_IMPORT].name)
7765 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
7766 filter->map[RMAP_IMPORT].map ? "*" : "",
7767 filter->map[RMAP_IMPORT].name,
7768 VTY_NEWLINE);
7769 if (filter->map[RMAP_EXPORT].name)
7770 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
7771 filter->map[RMAP_EXPORT].map ? "*" : "",
7772 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00007773 VTY_NEWLINE);
7774
7775 /* unsuppress-map */
7776 if (filter->usmap.name)
7777 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
7778 filter->usmap.map ? "*" : "",
7779 filter->usmap.name, VTY_NEWLINE);
7780
7781 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00007782 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
7783
paul718e3742002-12-13 20:15:29 +00007784 /* Maximum prefix */
7785 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
7786 {
hasso0a486e52005-02-01 20:57:17 +00007787 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00007788 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00007789 ? " (warning-only)" : "", VTY_NEWLINE);
7790 vty_out (vty, " Threshold for warning message %d%%",
7791 p->pmax_threshold[afi][safi]);
7792 if (p->pmax_restart[afi][safi])
7793 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
7794 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007795 }
paul718e3742002-12-13 20:15:29 +00007796
7797 vty_out (vty, "%s", VTY_NEWLINE);
7798}
7799
paul94f2b392005-06-28 12:44:16 +00007800static void
paul718e3742002-12-13 20:15:29 +00007801bgp_show_peer (struct vty *vty, struct peer *p)
7802{
7803 struct bgp *bgp;
7804 char buf1[BUFSIZ];
7805 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00007806 afi_t afi;
7807 safi_t safi;
paul718e3742002-12-13 20:15:29 +00007808
7809 bgp = p->bgp;
7810
7811 /* Configured IP address. */
7812 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007813 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00007814 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00007815 p->change_local_as ? p->change_local_as : p->local_as,
7816 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00007817 " no-prepend" : "",
7818 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
7819 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00007820 vty_out (vty, "%s link%s",
7821 p->as == p->local_as ? "internal" : "external",
7822 VTY_NEWLINE);
7823
7824 /* Description. */
7825 if (p->desc)
7826 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
7827
7828 /* Peer-group */
7829 if (p->group)
7830 vty_out (vty, " Member of peer-group %s for session parameters%s",
7831 p->group->name, VTY_NEWLINE);
7832
7833 /* Administrative shutdown. */
7834 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
7835 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
7836
7837 /* BGP Version. */
7838 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00007839 vty_out (vty, ", remote router ID %s%s",
7840 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
7841 VTY_NEWLINE);
7842
7843 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00007844 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
7845 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00007846 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
7847
7848 /* Status. */
7849 vty_out (vty, " BGP state = %s",
7850 LOOKUP (bgp_status_msg, p->status));
7851 if (p->status == Established)
7852 vty_out (vty, ", up for %8s",
7853 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00007854 else if (p->status == Active)
7855 {
7856 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7857 vty_out (vty, " (passive)");
7858 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7859 vty_out (vty, " (NSF passive)");
7860 }
paul718e3742002-12-13 20:15:29 +00007861 vty_out (vty, "%s", VTY_NEWLINE);
7862
7863 /* read timer */
7864 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7865
7866 /* Configured timer values. */
7867 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7868 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7869 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7870 {
7871 vty_out (vty, " Configured hold time is %d", p->holdtime);
7872 vty_out (vty, ", keepalive interval is %d seconds%s",
7873 p->keepalive, VTY_NEWLINE);
7874 }
hasso93406d82005-02-02 14:40:33 +00007875
paul718e3742002-12-13 20:15:29 +00007876 /* Capability. */
7877 if (p->status == Established)
7878 {
hasso538621f2004-05-21 09:31:30 +00007879 if (p->cap
paul718e3742002-12-13 20:15:29 +00007880 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7881 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7882 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7883 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7884#ifdef HAVE_IPV6
7885 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7886 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7887 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7888 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
Lou Berger9da04bc2016-01-12 13:41:55 -05007889 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
7890 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
paul718e3742002-12-13 20:15:29 +00007891#endif /* HAVE_IPV6 */
7892 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7893 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7894 {
7895 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7896
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007897 /* AS4 */
7898 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
7899 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7900 {
7901 vty_out (vty, " 4 Byte AS:");
7902 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7903 vty_out (vty, " advertised");
7904 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
7905 vty_out (vty, " %sreceived",
7906 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
7907 vty_out (vty, "%s", VTY_NEWLINE);
7908 }
paul718e3742002-12-13 20:15:29 +00007909 /* Dynamic */
7910 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
7911 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7912 {
7913 vty_out (vty, " Dynamic:");
7914 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7915 vty_out (vty, " advertised");
7916 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00007917 vty_out (vty, " %sreceived",
7918 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007919 vty_out (vty, "%s", VTY_NEWLINE);
7920 }
7921
7922 /* Route Refresh */
7923 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
7924 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7925 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
7926 {
7927 vty_out (vty, " Route refresh:");
7928 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
7929 vty_out (vty, " advertised");
7930 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7931 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00007932 vty_out (vty, " %sreceived(%s)",
7933 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
7934 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
7935 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
7936 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
7937
paul718e3742002-12-13 20:15:29 +00007938 vty_out (vty, "%s", VTY_NEWLINE);
7939 }
7940
hasso538621f2004-05-21 09:31:30 +00007941 /* Multiprotocol Extensions */
7942 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7943 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7944 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00007945 {
hasso538621f2004-05-21 09:31:30 +00007946 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
7947 if (p->afc_adv[afi][safi])
7948 vty_out (vty, " advertised");
7949 if (p->afc_recv[afi][safi])
7950 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
7951 vty_out (vty, "%s", VTY_NEWLINE);
7952 }
7953
7954 /* Gracefull Restart */
7955 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7956 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007957 {
hasso538621f2004-05-21 09:31:30 +00007958 vty_out (vty, " Graceful Restart Capabilty:");
7959 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007960 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00007961 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
7962 vty_out (vty, " %sreceived",
7963 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007964 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007965
7966 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00007967 {
hasso538621f2004-05-21 09:31:30 +00007968 int restart_af_count = 0;
7969
7970 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00007971 p->v_gr_restart, VTY_NEWLINE);
7972 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007973
7974 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7975 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7976 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
7977 {
hasso93406d82005-02-02 14:40:33 +00007978 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
7979 afi_safi_print (afi, safi),
7980 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
7981 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00007982 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00007983 }
hasso538621f2004-05-21 09:31:30 +00007984 if (! restart_af_count)
7985 vty_out (vty, "none");
7986 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007987 }
paul718e3742002-12-13 20:15:29 +00007988 }
paul718e3742002-12-13 20:15:29 +00007989 }
7990 }
7991
hasso93406d82005-02-02 14:40:33 +00007992 /* graceful restart information */
7993 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7994 || p->t_gr_restart
7995 || p->t_gr_stale)
7996 {
7997 int eor_send_af_count = 0;
7998 int eor_receive_af_count = 0;
7999
8000 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
8001 if (p->status == Established)
8002 {
8003 vty_out (vty, " End-of-RIB send: ");
8004 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8005 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8006 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
8007 {
8008 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
8009 afi_safi_print (afi, safi));
8010 eor_send_af_count++;
8011 }
8012 vty_out (vty, "%s", VTY_NEWLINE);
8013
8014 vty_out (vty, " End-of-RIB received: ");
8015 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8016 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8017 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
8018 {
8019 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
8020 afi_safi_print (afi, safi));
8021 eor_receive_af_count++;
8022 }
8023 vty_out (vty, "%s", VTY_NEWLINE);
8024 }
8025
8026 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008027 vty_out (vty, " The remaining time of restart timer is %ld%s",
8028 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
8029
hasso93406d82005-02-02 14:40:33 +00008030 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008031 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
8032 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008033 }
8034
paul718e3742002-12-13 20:15:29 +00008035 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00008036 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
8037 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008038 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008039 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
8040 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
8041 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
8042 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
8043 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
8044 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
8045 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
8046 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
8047 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
8048 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
8049 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008050
8051 /* advertisement-interval */
8052 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
8053 p->v_routeadv, VTY_NEWLINE);
8054
8055 /* Update-source. */
8056 if (p->update_if || p->update_source)
8057 {
8058 vty_out (vty, " Update source is ");
8059 if (p->update_if)
8060 vty_out (vty, "%s", p->update_if);
8061 else if (p->update_source)
8062 vty_out (vty, "%s",
8063 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
8064 vty_out (vty, "%s", VTY_NEWLINE);
8065 }
8066
8067 /* Default weight */
8068 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
8069 vty_out (vty, " Default weight %d%s", p->weight,
8070 VTY_NEWLINE);
8071
8072 vty_out (vty, "%s", VTY_NEWLINE);
8073
8074 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00008075 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8076 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8077 if (p->afc[afi][safi])
8078 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00008079
8080 vty_out (vty, " Connections established %d; dropped %d%s",
8081 p->established, p->dropped,
8082 VTY_NEWLINE);
8083
hassoe0701b72004-05-20 09:19:34 +00008084 if (! p->dropped)
8085 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
8086 else
8087 vty_out (vty, " Last reset %s, due to %s%s",
8088 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
8089 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00008090
paul718e3742002-12-13 20:15:29 +00008091 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8092 {
8093 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00008094
8095 if (p->t_pmax_restart)
8096 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8097 p->host, thread_timer_remain_second (p->t_pmax_restart),
8098 VTY_NEWLINE);
8099 else
8100 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8101 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008102 }
8103
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008104 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00008105 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008106 {
8107 if (p->gtsm_hops > 0)
8108 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8109 p->gtsm_hops, VTY_NEWLINE);
8110 else if (p->ttl > 1)
8111 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8112 p->ttl, VTY_NEWLINE);
8113 }
Pradosh Mohapatra5d804b42013-09-12 03:37:07 +00008114 else
8115 {
8116 if (p->gtsm_hops > 0)
8117 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
8118 p->gtsm_hops, VTY_NEWLINE);
8119 }
paul718e3742002-12-13 20:15:29 +00008120
8121 /* Local address. */
8122 if (p->su_local)
8123 {
hasso93406d82005-02-02 14:40:33 +00008124 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00008125 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
8126 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00008127 VTY_NEWLINE);
8128 }
8129
8130 /* Remote address. */
8131 if (p->su_remote)
8132 {
8133 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
8134 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
8135 ntohs (p->su_remote->sin.sin_port),
8136 VTY_NEWLINE);
8137 }
8138
8139 /* Nexthop display. */
8140 if (p->su_local)
8141 {
8142 vty_out (vty, "Nexthop: %s%s",
8143 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
8144 VTY_NEWLINE);
8145#ifdef HAVE_IPV6
8146 vty_out (vty, "Nexthop global: %s%s",
8147 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
8148 VTY_NEWLINE);
8149 vty_out (vty, "Nexthop local: %s%s",
8150 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
8151 VTY_NEWLINE);
8152 vty_out (vty, "BGP connection: %s%s",
8153 p->shared_network ? "shared network" : "non shared network",
8154 VTY_NEWLINE);
8155#endif /* HAVE_IPV6 */
8156 }
8157
Timo Teräsef757702015-04-29 09:43:04 +03008158 /* TCP metrics. */
8159 if (p->status == Established && p->rtt)
8160 vty_out (vty, "Estimated round trip time: %d ms%s",
8161 p->rtt, VTY_NEWLINE);
8162
paul718e3742002-12-13 20:15:29 +00008163 /* Timer information. */
8164 if (p->t_start)
8165 vty_out (vty, "Next start timer due in %ld seconds%s",
8166 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
8167 if (p->t_connect)
8168 vty_out (vty, "Next connect timer due in %ld seconds%s",
8169 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
8170
8171 vty_out (vty, "Read thread: %s Write thread: %s%s",
8172 p->t_read ? "on" : "off",
8173 p->t_write ? "on" : "off",
8174 VTY_NEWLINE);
8175
8176 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
8177 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
8178 bgp_capability_vty_out (vty, p);
8179
8180 vty_out (vty, "%s", VTY_NEWLINE);
8181}
8182
paul94f2b392005-06-28 12:44:16 +00008183static int
paul718e3742002-12-13 20:15:29 +00008184bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
8185 enum show_type type, union sockunion *su)
8186{
paul1eb8ef22005-04-07 07:30:20 +00008187 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00008188 struct peer *peer;
8189 int find = 0;
8190
paul1eb8ef22005-04-07 07:30:20 +00008191 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00008192 {
8193 switch (type)
8194 {
8195 case show_all:
8196 bgp_show_peer (vty, peer);
8197 break;
8198 case show_peer:
8199 if (sockunion_same (&peer->su, su))
8200 {
8201 find = 1;
8202 bgp_show_peer (vty, peer);
8203 }
8204 break;
8205 }
8206 }
8207
8208 if (type == show_peer && ! find)
8209 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
8210
8211 return CMD_SUCCESS;
8212}
8213
paul94f2b392005-06-28 12:44:16 +00008214static int
paulfd79ac92004-10-13 05:06:08 +00008215bgp_show_neighbor_vty (struct vty *vty, const char *name,
8216 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00008217{
8218 int ret;
8219 struct bgp *bgp;
8220 union sockunion su;
8221
8222 if (ip_str)
8223 {
8224 ret = str2sockunion (ip_str, &su);
8225 if (ret < 0)
8226 {
8227 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
8228 return CMD_WARNING;
8229 }
8230 }
8231
8232 if (name)
8233 {
8234 bgp = bgp_lookup_by_name (name);
8235
8236 if (! bgp)
8237 {
8238 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8239 return CMD_WARNING;
8240 }
8241
8242 bgp_show_neighbor (vty, bgp, type, &su);
8243
8244 return CMD_SUCCESS;
8245 }
8246
8247 bgp = bgp_get_default ();
8248
8249 if (bgp)
8250 bgp_show_neighbor (vty, bgp, type, &su);
8251
8252 return CMD_SUCCESS;
8253}
8254
8255/* "show ip bgp neighbors" commands. */
8256DEFUN (show_ip_bgp_neighbors,
8257 show_ip_bgp_neighbors_cmd,
8258 "show ip bgp neighbors",
8259 SHOW_STR
8260 IP_STR
8261 BGP_STR
8262 "Detailed information on TCP and BGP neighbor connections\n")
8263{
8264 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8265}
8266
8267ALIAS (show_ip_bgp_neighbors,
8268 show_ip_bgp_ipv4_neighbors_cmd,
8269 "show ip bgp ipv4 (unicast|multicast) neighbors",
8270 SHOW_STR
8271 IP_STR
8272 BGP_STR
8273 "Address family\n"
8274 "Address Family modifier\n"
8275 "Address Family modifier\n"
8276 "Detailed information on TCP and BGP neighbor connections\n")
8277
8278ALIAS (show_ip_bgp_neighbors,
8279 show_ip_bgp_vpnv4_all_neighbors_cmd,
8280 "show ip bgp vpnv4 all neighbors",
8281 SHOW_STR
8282 IP_STR
8283 BGP_STR
8284 "Display VPNv4 NLRI specific information\n"
8285 "Display information about all VPNv4 NLRIs\n"
8286 "Detailed information on TCP and BGP neighbor connections\n")
8287
8288ALIAS (show_ip_bgp_neighbors,
8289 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8290 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8291 SHOW_STR
8292 IP_STR
8293 BGP_STR
8294 "Display VPNv4 NLRI specific information\n"
8295 "Display information for a route distinguisher\n"
8296 "VPN Route Distinguisher\n"
8297 "Detailed information on TCP and BGP neighbor connections\n")
8298
8299ALIAS (show_ip_bgp_neighbors,
8300 show_bgp_neighbors_cmd,
8301 "show bgp neighbors",
8302 SHOW_STR
8303 BGP_STR
8304 "Detailed information on TCP and BGP neighbor connections\n")
8305
8306ALIAS (show_ip_bgp_neighbors,
8307 show_bgp_ipv6_neighbors_cmd,
8308 "show bgp ipv6 neighbors",
8309 SHOW_STR
8310 BGP_STR
8311 "Address family\n"
8312 "Detailed information on TCP and BGP neighbor connections\n")
8313
8314DEFUN (show_ip_bgp_neighbors_peer,
8315 show_ip_bgp_neighbors_peer_cmd,
8316 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8317 SHOW_STR
8318 IP_STR
8319 BGP_STR
8320 "Detailed information on TCP and BGP neighbor connections\n"
8321 "Neighbor to display information about\n"
8322 "Neighbor to display information about\n")
8323{
8324 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8325}
8326
8327ALIAS (show_ip_bgp_neighbors_peer,
8328 show_ip_bgp_ipv4_neighbors_peer_cmd,
8329 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8330 SHOW_STR
8331 IP_STR
8332 BGP_STR
8333 "Address family\n"
8334 "Address Family modifier\n"
8335 "Address Family modifier\n"
8336 "Detailed information on TCP and BGP neighbor connections\n"
8337 "Neighbor to display information about\n"
8338 "Neighbor to display information about\n")
8339
8340ALIAS (show_ip_bgp_neighbors_peer,
8341 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8342 "show ip bgp vpnv4 all neighbors A.B.C.D",
8343 SHOW_STR
8344 IP_STR
8345 BGP_STR
8346 "Display VPNv4 NLRI specific information\n"
8347 "Display information about all VPNv4 NLRIs\n"
8348 "Detailed information on TCP and BGP neighbor connections\n"
8349 "Neighbor to display information about\n")
8350
8351ALIAS (show_ip_bgp_neighbors_peer,
8352 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8353 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8354 SHOW_STR
8355 IP_STR
8356 BGP_STR
8357 "Display VPNv4 NLRI specific information\n"
8358 "Display information about all VPNv4 NLRIs\n"
8359 "Detailed information on TCP and BGP neighbor connections\n"
8360 "Neighbor to display information about\n")
8361
8362ALIAS (show_ip_bgp_neighbors_peer,
8363 show_bgp_neighbors_peer_cmd,
8364 "show bgp neighbors (A.B.C.D|X:X::X:X)",
8365 SHOW_STR
8366 BGP_STR
8367 "Detailed information on TCP and BGP neighbor connections\n"
8368 "Neighbor to display information about\n"
8369 "Neighbor to display information about\n")
8370
8371ALIAS (show_ip_bgp_neighbors_peer,
8372 show_bgp_ipv6_neighbors_peer_cmd,
8373 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8374 SHOW_STR
8375 BGP_STR
8376 "Address family\n"
8377 "Detailed information on TCP and BGP neighbor connections\n"
8378 "Neighbor to display information about\n"
8379 "Neighbor to display information about\n")
8380
8381DEFUN (show_ip_bgp_instance_neighbors,
8382 show_ip_bgp_instance_neighbors_cmd,
8383 "show ip bgp view WORD neighbors",
8384 SHOW_STR
8385 IP_STR
8386 BGP_STR
8387 "BGP view\n"
8388 "View name\n"
8389 "Detailed information on TCP and BGP neighbor connections\n")
8390{
8391 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8392}
8393
paulbb46e942003-10-24 19:02:03 +00008394ALIAS (show_ip_bgp_instance_neighbors,
8395 show_bgp_instance_neighbors_cmd,
8396 "show bgp view WORD neighbors",
8397 SHOW_STR
8398 BGP_STR
8399 "BGP view\n"
8400 "View name\n"
8401 "Detailed information on TCP and BGP neighbor connections\n")
8402
8403ALIAS (show_ip_bgp_instance_neighbors,
8404 show_bgp_instance_ipv6_neighbors_cmd,
8405 "show bgp view WORD ipv6 neighbors",
8406 SHOW_STR
8407 BGP_STR
8408 "BGP view\n"
8409 "View name\n"
8410 "Address family\n"
8411 "Detailed information on TCP and BGP neighbor connections\n")
8412
paul718e3742002-12-13 20:15:29 +00008413DEFUN (show_ip_bgp_instance_neighbors_peer,
8414 show_ip_bgp_instance_neighbors_peer_cmd,
8415 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8416 SHOW_STR
8417 IP_STR
8418 BGP_STR
8419 "BGP view\n"
8420 "View name\n"
8421 "Detailed information on TCP and BGP neighbor connections\n"
8422 "Neighbor to display information about\n"
8423 "Neighbor to display information about\n")
8424{
8425 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8426}
paulbb46e942003-10-24 19:02:03 +00008427
8428ALIAS (show_ip_bgp_instance_neighbors_peer,
8429 show_bgp_instance_neighbors_peer_cmd,
8430 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8431 SHOW_STR
8432 BGP_STR
8433 "BGP view\n"
8434 "View name\n"
8435 "Detailed information on TCP and BGP neighbor connections\n"
8436 "Neighbor to display information about\n"
8437 "Neighbor to display information about\n")
8438
8439ALIAS (show_ip_bgp_instance_neighbors_peer,
8440 show_bgp_instance_ipv6_neighbors_peer_cmd,
8441 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8442 SHOW_STR
8443 BGP_STR
8444 "BGP view\n"
8445 "View name\n"
8446 "Address family\n"
8447 "Detailed information on TCP and BGP neighbor connections\n"
8448 "Neighbor to display information about\n"
8449 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008450
paul718e3742002-12-13 20:15:29 +00008451/* Show BGP's AS paths internal data. There are both `show ip bgp
8452 paths' and `show ip mbgp paths'. Those functions results are the
8453 same.*/
8454DEFUN (show_ip_bgp_paths,
8455 show_ip_bgp_paths_cmd,
8456 "show ip bgp paths",
8457 SHOW_STR
8458 IP_STR
8459 BGP_STR
8460 "Path information\n")
8461{
8462 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8463 aspath_print_all_vty (vty);
8464 return CMD_SUCCESS;
8465}
8466
8467DEFUN (show_ip_bgp_ipv4_paths,
8468 show_ip_bgp_ipv4_paths_cmd,
8469 "show ip bgp ipv4 (unicast|multicast) paths",
8470 SHOW_STR
8471 IP_STR
8472 BGP_STR
8473 "Address family\n"
8474 "Address Family modifier\n"
8475 "Address Family modifier\n"
8476 "Path information\n")
8477{
8478 vty_out (vty, "Address Refcnt Path\r\n");
8479 aspath_print_all_vty (vty);
8480
8481 return CMD_SUCCESS;
8482}
David Lamparter6b0655a2014-06-04 06:53:35 +02008483
paul718e3742002-12-13 20:15:29 +00008484#include "hash.h"
8485
paul94f2b392005-06-28 12:44:16 +00008486static void
paul718e3742002-12-13 20:15:29 +00008487community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8488{
8489 struct community *com;
8490
8491 com = (struct community *) backet->data;
David Lampartereed3c482015-03-03 08:51:53 +01008492 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
paul718e3742002-12-13 20:15:29 +00008493 community_str (com), VTY_NEWLINE);
8494}
8495
8496/* Show BGP's community internal data. */
8497DEFUN (show_ip_bgp_community_info,
8498 show_ip_bgp_community_info_cmd,
8499 "show ip bgp community-info",
8500 SHOW_STR
8501 IP_STR
8502 BGP_STR
8503 "List all bgp community information\n")
8504{
8505 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8506
8507 hash_iterate (community_hash (),
8508 (void (*) (struct hash_backet *, void *))
8509 community_show_all_iterator,
8510 vty);
8511
8512 return CMD_SUCCESS;
8513}
8514
8515DEFUN (show_ip_bgp_attr_info,
8516 show_ip_bgp_attr_info_cmd,
8517 "show ip bgp attribute-info",
8518 SHOW_STR
8519 IP_STR
8520 BGP_STR
8521 "List all bgp attribute information\n")
8522{
8523 attr_show_all (vty);
8524 return CMD_SUCCESS;
8525}
David Lamparter6b0655a2014-06-04 06:53:35 +02008526
paul94f2b392005-06-28 12:44:16 +00008527static int
paulfee0f4c2004-09-13 05:12:46 +00008528bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8529 afi_t afi, safi_t safi)
8530{
8531 char timebuf[BGP_UPTIME_LEN];
8532 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008533 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008534 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008535 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008536 int len;
8537 int count = 0;
8538
8539 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8540 {
paul1eb8ef22005-04-07 07:30:20 +00008541 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008542 {
8543 count++;
8544 bgp_write_rsclient_summary (vty, peer, afi, safi);
8545 }
8546 return count;
8547 }
8548
8549 len = vty_out (vty, "%s", rsclient->host);
8550 len = 16 - len;
8551
8552 if (len < 1)
8553 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8554 else
8555 vty_out (vty, "%*s", len, " ");
8556
hasso3d515fd2005-02-01 21:30:04 +00008557 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008558
Milan Kociancb4fc592014-12-01 12:48:25 +00008559 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008560
8561 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8562 if ( rmname && strlen (rmname) > 13 )
8563 {
8564 sprintf (rmbuf, "%13s", "...");
8565 rmname = strncpy (rmbuf, rmname, 10);
8566 }
8567 else if (! rmname)
8568 rmname = "<none>";
8569 vty_out (vty, " %13s ", rmname);
8570
8571 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8572 if ( rmname && strlen (rmname) > 13 )
8573 {
8574 sprintf (rmbuf, "%13s", "...");
8575 rmname = strncpy (rmbuf, rmname, 10);
8576 }
8577 else if (! rmname)
8578 rmname = "<none>";
8579 vty_out (vty, " %13s ", rmname);
8580
8581 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8582
8583 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8584 vty_out (vty, " Idle (Admin)");
8585 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8586 vty_out (vty, " Idle (PfxCt)");
8587 else
8588 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8589
8590 vty_out (vty, "%s", VTY_NEWLINE);
8591
8592 return 1;
8593}
8594
paul94f2b392005-06-28 12:44:16 +00008595static int
paulfd79ac92004-10-13 05:06:08 +00008596bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8597 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008598{
8599 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008600 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008601 int count = 0;
8602
8603 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00008604 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00008605
paul1eb8ef22005-04-07 07:30:20 +00008606 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008607 {
8608 if (peer->afc[afi][safi] &&
8609 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8610 {
8611 if (! count)
8612 {
8613 vty_out (vty,
8614 "Route Server's BGP router identifier %s%s",
8615 inet_ntoa (bgp->router_id), VTY_NEWLINE);
8616 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008617 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00008618 VTY_NEWLINE);
8619
8620 vty_out (vty, "%s", VTY_NEWLINE);
8621 vty_out (vty, "%s%s", header, VTY_NEWLINE);
8622 }
8623
8624 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
8625 }
8626 }
8627
8628 if (count)
8629 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
8630 count, VTY_NEWLINE);
8631 else
8632 vty_out (vty, "No %s Route Server Client is configured%s",
8633 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
8634
8635 return CMD_SUCCESS;
8636}
8637
paul94f2b392005-06-28 12:44:16 +00008638static int
paulfd79ac92004-10-13 05:06:08 +00008639bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
8640 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008641{
8642 struct bgp *bgp;
8643
8644 if (name)
8645 {
8646 bgp = bgp_lookup_by_name (name);
8647
8648 if (! bgp)
8649 {
8650 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8651 return CMD_WARNING;
8652 }
8653
8654 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8655 return CMD_SUCCESS;
8656 }
8657
8658 bgp = bgp_get_default ();
8659
8660 if (bgp)
8661 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8662
8663 return CMD_SUCCESS;
8664}
8665
8666/* 'show bgp rsclient' commands. */
8667DEFUN (show_ip_bgp_rsclient_summary,
8668 show_ip_bgp_rsclient_summary_cmd,
8669 "show ip bgp rsclient summary",
8670 SHOW_STR
8671 IP_STR
8672 BGP_STR
8673 "Information about Route Server Clients\n"
8674 "Summary of all Route Server Clients\n")
8675{
8676 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8677}
8678
8679DEFUN (show_ip_bgp_instance_rsclient_summary,
8680 show_ip_bgp_instance_rsclient_summary_cmd,
8681 "show ip bgp view WORD rsclient summary",
8682 SHOW_STR
8683 IP_STR
8684 BGP_STR
8685 "BGP view\n"
8686 "View name\n"
8687 "Information about Route Server Clients\n"
8688 "Summary of all Route Server Clients\n")
8689{
8690 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8691}
8692
8693DEFUN (show_ip_bgp_ipv4_rsclient_summary,
8694 show_ip_bgp_ipv4_rsclient_summary_cmd,
8695 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
8696 SHOW_STR
8697 IP_STR
8698 BGP_STR
8699 "Address family\n"
8700 "Address Family modifier\n"
8701 "Address Family modifier\n"
8702 "Information about Route Server Clients\n"
8703 "Summary of all Route Server Clients\n")
8704{
8705 if (strncmp (argv[0], "m", 1) == 0)
8706 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
8707
8708 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8709}
8710
8711DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
8712 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
8713 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8714 SHOW_STR
8715 IP_STR
8716 BGP_STR
8717 "BGP view\n"
8718 "View name\n"
8719 "Address family\n"
8720 "Address Family modifier\n"
8721 "Address Family modifier\n"
8722 "Information about Route Server Clients\n"
8723 "Summary of all Route Server Clients\n")
8724{
8725 if (strncmp (argv[1], "m", 1) == 0)
8726 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
8727
8728 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8729}
8730
Michael Lambert95cbbd22010-07-23 14:43:04 -04008731DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
8732 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
8733 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8734 SHOW_STR
8735 BGP_STR
8736 "BGP view\n"
8737 "View name\n"
8738 "Address family\n"
8739 "Address Family modifier\n"
8740 "Address Family modifier\n"
8741 "Information about Route Server Clients\n"
8742 "Summary of all Route Server Clients\n")
8743{
8744 safi_t safi;
8745
8746 if (argc == 2) {
8747 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8748 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
8749 } else {
8750 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8751 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
8752 }
8753}
8754
8755ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
8756 show_bgp_ipv4_safi_rsclient_summary_cmd,
8757 "show bgp ipv4 (unicast|multicast) rsclient summary",
8758 SHOW_STR
8759 BGP_STR
8760 "Address family\n"
8761 "Address Family modifier\n"
8762 "Address Family modifier\n"
8763 "Information about Route Server Clients\n"
8764 "Summary of all Route Server Clients\n")
8765
paulfee0f4c2004-09-13 05:12:46 +00008766#ifdef HAVE_IPV6
8767DEFUN (show_bgp_rsclient_summary,
8768 show_bgp_rsclient_summary_cmd,
8769 "show bgp rsclient summary",
8770 SHOW_STR
8771 BGP_STR
8772 "Information about Route Server Clients\n"
8773 "Summary of all Route Server Clients\n")
8774{
8775 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8776}
8777
8778DEFUN (show_bgp_instance_rsclient_summary,
8779 show_bgp_instance_rsclient_summary_cmd,
8780 "show bgp view WORD rsclient summary",
8781 SHOW_STR
8782 BGP_STR
8783 "BGP view\n"
8784 "View name\n"
8785 "Information about Route Server Clients\n"
8786 "Summary of all Route Server Clients\n")
8787{
8788 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
8789}
8790
8791ALIAS (show_bgp_rsclient_summary,
8792 show_bgp_ipv6_rsclient_summary_cmd,
8793 "show bgp ipv6 rsclient summary",
8794 SHOW_STR
8795 BGP_STR
8796 "Address family\n"
8797 "Information about Route Server Clients\n"
8798 "Summary of all Route Server Clients\n")
8799
8800ALIAS (show_bgp_instance_rsclient_summary,
8801 show_bgp_instance_ipv6_rsclient_summary_cmd,
8802 "show bgp view WORD ipv6 rsclient summary",
8803 SHOW_STR
8804 BGP_STR
8805 "BGP view\n"
8806 "View name\n"
8807 "Address family\n"
8808 "Information about Route Server Clients\n"
8809 "Summary of all Route Server Clients\n")
Michael Lambert95cbbd22010-07-23 14:43:04 -04008810
8811DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
8812 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
8813 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
8814 SHOW_STR
8815 BGP_STR
8816 "BGP view\n"
8817 "View name\n"
8818 "Address family\n"
8819 "Address Family modifier\n"
8820 "Address Family modifier\n"
8821 "Information about Route Server Clients\n"
8822 "Summary of all Route Server Clients\n")
8823{
8824 safi_t safi;
8825
8826 if (argc == 2) {
8827 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8828 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
8829 } else {
8830 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8831 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
8832 }
8833}
8834
8835ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
8836 show_bgp_ipv6_safi_rsclient_summary_cmd,
8837 "show bgp ipv6 (unicast|multicast) rsclient summary",
8838 SHOW_STR
8839 BGP_STR
8840 "Address family\n"
8841 "Address Family modifier\n"
8842 "Address Family modifier\n"
8843 "Information about Route Server Clients\n"
8844 "Summary of all Route Server Clients\n")
8845
paulfee0f4c2004-09-13 05:12:46 +00008846#endif /* HAVE IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02008847
paul718e3742002-12-13 20:15:29 +00008848/* Redistribute VTY commands. */
8849
paul718e3742002-12-13 20:15:29 +00008850DEFUN (bgp_redistribute_ipv4,
8851 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008852 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008853 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008854 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008855{
8856 int type;
8857
David Lampartere0ca5fd2009-09-16 01:52:42 +02008858 type = proto_redistnum (AFI_IP, argv[0]);
8859 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008860 {
8861 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8862 return CMD_WARNING;
8863 }
8864 return bgp_redistribute_set (vty->index, AFI_IP, type);
8865}
8866
8867DEFUN (bgp_redistribute_ipv4_rmap,
8868 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008869 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008870 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008871 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008872 "Route map reference\n"
8873 "Pointer to route-map entries\n")
8874{
8875 int type;
8876
David Lampartere0ca5fd2009-09-16 01:52:42 +02008877 type = proto_redistnum (AFI_IP, argv[0]);
8878 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008879 {
8880 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8881 return CMD_WARNING;
8882 }
8883
8884 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8885 return bgp_redistribute_set (vty->index, AFI_IP, type);
8886}
8887
8888DEFUN (bgp_redistribute_ipv4_metric,
8889 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008890 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008891 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008892 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008893 "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_IP, 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[1]);
8906
8907 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8908 return bgp_redistribute_set (vty->index, AFI_IP, type);
8909}
8910
8911DEFUN (bgp_redistribute_ipv4_rmap_metric,
8912 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008913 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008914 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008915 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008916 "Route map reference\n"
8917 "Pointer to route-map entries\n"
8918 "Metric for redistributed routes\n"
8919 "Default metric\n")
8920{
8921 int type;
8922 u_int32_t metric;
8923
David Lampartere0ca5fd2009-09-16 01:52:42 +02008924 type = proto_redistnum (AFI_IP, argv[0]);
8925 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008926 {
8927 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8928 return CMD_WARNING;
8929 }
8930 VTY_GET_INTEGER ("metric", metric, argv[2]);
8931
8932 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8933 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8934 return bgp_redistribute_set (vty->index, AFI_IP, type);
8935}
8936
8937DEFUN (bgp_redistribute_ipv4_metric_rmap,
8938 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008939 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008940 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008941 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008942 "Metric for redistributed routes\n"
8943 "Default metric\n"
8944 "Route map reference\n"
8945 "Pointer to route-map entries\n")
8946{
8947 int type;
8948 u_int32_t metric;
8949
David Lampartere0ca5fd2009-09-16 01:52:42 +02008950 type = proto_redistnum (AFI_IP, argv[0]);
8951 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008952 {
8953 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8954 return CMD_WARNING;
8955 }
8956 VTY_GET_INTEGER ("metric", metric, argv[1]);
8957
8958 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8959 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
8960 return bgp_redistribute_set (vty->index, AFI_IP, type);
8961}
8962
8963DEFUN (no_bgp_redistribute_ipv4,
8964 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008965 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008966 NO_STR
8967 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008968 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008969{
8970 int type;
8971
David Lampartere0ca5fd2009-09-16 01:52:42 +02008972 type = proto_redistnum (AFI_IP, argv[0]);
8973 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008974 {
8975 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8976 return CMD_WARNING;
8977 }
8978
8979 return bgp_redistribute_unset (vty->index, AFI_IP, type);
8980}
8981
8982DEFUN (no_bgp_redistribute_ipv4_rmap,
8983 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008984 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008985 NO_STR
8986 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008987 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008988 "Route map reference\n"
8989 "Pointer to route-map entries\n")
8990{
8991 int type;
8992
David Lampartere0ca5fd2009-09-16 01:52:42 +02008993 type = proto_redistnum (AFI_IP, argv[0]);
8994 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008995 {
8996 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8997 return CMD_WARNING;
8998 }
8999
9000 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9001 return CMD_SUCCESS;
9002}
9003
9004DEFUN (no_bgp_redistribute_ipv4_metric,
9005 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009006 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009007 NO_STR
9008 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009009 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009010 "Metric for redistributed routes\n"
9011 "Default metric\n")
9012{
9013 int type;
9014
David Lampartere0ca5fd2009-09-16 01:52:42 +02009015 type = proto_redistnum (AFI_IP, argv[0]);
9016 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009017 {
9018 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9019 return CMD_WARNING;
9020 }
9021
9022 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9023 return CMD_SUCCESS;
9024}
9025
9026DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
9027 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009028 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
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_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009032 "Route map reference\n"
9033 "Pointer to route-map entries\n"
9034 "Metric for redistributed routes\n"
9035 "Default metric\n")
9036{
9037 int type;
9038
David Lampartere0ca5fd2009-09-16 01:52:42 +02009039 type = proto_redistnum (AFI_IP, argv[0]);
9040 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009041 {
9042 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9043 return CMD_WARNING;
9044 }
9045
9046 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9047 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9048 return CMD_SUCCESS;
9049}
9050
9051ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
9052 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009053 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009054 NO_STR
9055 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009056 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009057 "Metric for redistributed routes\n"
9058 "Default metric\n"
9059 "Route map reference\n"
9060 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009061
paul718e3742002-12-13 20:15:29 +00009062#ifdef HAVE_IPV6
9063DEFUN (bgp_redistribute_ipv6,
9064 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009065 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009066 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009067 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009068{
9069 int type;
9070
David Lampartere0ca5fd2009-09-16 01:52:42 +02009071 type = proto_redistnum (AFI_IP6, argv[0]);
9072 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009073 {
9074 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9075 return CMD_WARNING;
9076 }
9077
9078 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9079}
9080
9081DEFUN (bgp_redistribute_ipv6_rmap,
9082 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009083 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009084 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009085 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009086 "Route map reference\n"
9087 "Pointer to route-map entries\n")
9088{
9089 int type;
9090
David Lampartere0ca5fd2009-09-16 01:52:42 +02009091 type = proto_redistnum (AFI_IP6, argv[0]);
9092 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009093 {
9094 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9095 return CMD_WARNING;
9096 }
9097
9098 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9099 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9100}
9101
9102DEFUN (bgp_redistribute_ipv6_metric,
9103 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009104 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009105 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009106 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009107 "Metric for redistributed routes\n"
9108 "Default metric\n")
9109{
9110 int type;
9111 u_int32_t metric;
9112
David Lampartere0ca5fd2009-09-16 01:52:42 +02009113 type = proto_redistnum (AFI_IP6, argv[0]);
9114 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009115 {
9116 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9117 return CMD_WARNING;
9118 }
9119 VTY_GET_INTEGER ("metric", metric, argv[1]);
9120
9121 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9122 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9123}
9124
9125DEFUN (bgp_redistribute_ipv6_rmap_metric,
9126 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009127 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009128 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009129 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009130 "Route map reference\n"
9131 "Pointer to route-map entries\n"
9132 "Metric for redistributed routes\n"
9133 "Default metric\n")
9134{
9135 int type;
9136 u_int32_t metric;
9137
David Lampartere0ca5fd2009-09-16 01:52:42 +02009138 type = proto_redistnum (AFI_IP6, argv[0]);
9139 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009140 {
9141 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9142 return CMD_WARNING;
9143 }
9144 VTY_GET_INTEGER ("metric", metric, argv[2]);
9145
9146 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9147 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9148 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9149}
9150
9151DEFUN (bgp_redistribute_ipv6_metric_rmap,
9152 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009153 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009154 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009155 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009156 "Metric for redistributed routes\n"
9157 "Default metric\n"
9158 "Route map reference\n"
9159 "Pointer to route-map entries\n")
9160{
9161 int type;
9162 u_int32_t metric;
9163
David Lampartere0ca5fd2009-09-16 01:52:42 +02009164 type = proto_redistnum (AFI_IP6, argv[0]);
9165 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009166 {
9167 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9168 return CMD_WARNING;
9169 }
9170 VTY_GET_INTEGER ("metric", metric, argv[1]);
9171
9172 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9173 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
9174 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9175}
9176
9177DEFUN (no_bgp_redistribute_ipv6,
9178 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009179 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009180 NO_STR
9181 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009182 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009183{
9184 int type;
9185
David Lampartere0ca5fd2009-09-16 01:52:42 +02009186 type = proto_redistnum (AFI_IP6, argv[0]);
9187 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009188 {
9189 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9190 return CMD_WARNING;
9191 }
9192
9193 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
9194}
9195
9196DEFUN (no_bgp_redistribute_ipv6_rmap,
9197 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009198 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009199 NO_STR
9200 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009201 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009202 "Route map reference\n"
9203 "Pointer to route-map entries\n")
9204{
9205 int type;
9206
David Lampartere0ca5fd2009-09-16 01:52:42 +02009207 type = proto_redistnum (AFI_IP6, argv[0]);
9208 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009209 {
9210 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9211 return CMD_WARNING;
9212 }
9213
9214 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9215 return CMD_SUCCESS;
9216}
9217
9218DEFUN (no_bgp_redistribute_ipv6_metric,
9219 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009220 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009221 NO_STR
9222 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009223 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009224 "Metric for redistributed routes\n"
9225 "Default metric\n")
9226{
9227 int type;
9228
David Lampartere0ca5fd2009-09-16 01:52:42 +02009229 type = proto_redistnum (AFI_IP6, argv[0]);
9230 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009231 {
9232 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9233 return CMD_WARNING;
9234 }
9235
9236 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9237 return CMD_SUCCESS;
9238}
9239
9240DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
9241 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009242 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009243 NO_STR
9244 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009245 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009246 "Route map reference\n"
9247 "Pointer to route-map entries\n"
9248 "Metric for redistributed routes\n"
9249 "Default metric\n")
9250{
9251 int type;
9252
David Lampartere0ca5fd2009-09-16 01:52:42 +02009253 type = proto_redistnum (AFI_IP6, argv[0]);
9254 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009255 {
9256 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9257 return CMD_WARNING;
9258 }
9259
9260 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9261 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9262 return CMD_SUCCESS;
9263}
9264
9265ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9266 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009267 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009268 NO_STR
9269 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009270 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009271 "Metric for redistributed routes\n"
9272 "Default metric\n"
9273 "Route map reference\n"
9274 "Pointer to route-map entries\n")
9275#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02009276
paul718e3742002-12-13 20:15:29 +00009277int
9278bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9279 safi_t safi, int *write)
9280{
9281 int i;
paul718e3742002-12-13 20:15:29 +00009282
9283 /* Unicast redistribution only. */
9284 if (safi != SAFI_UNICAST)
9285 return 0;
9286
9287 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9288 {
9289 /* Redistribute BGP does not make sense. */
9290 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9291 {
9292 /* Display "address-family" when it is not yet diplayed. */
9293 bgp_config_write_family_header (vty, afi, safi, write);
9294
9295 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009296 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009297
9298 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009299 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009300
9301 if (bgp->rmap[afi][i].name)
9302 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9303
9304 vty_out (vty, "%s", VTY_NEWLINE);
9305 }
9306 }
9307 return *write;
9308}
David Lamparter6b0655a2014-06-04 06:53:35 +02009309
paul718e3742002-12-13 20:15:29 +00009310/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009311static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009312{
9313 BGP_NODE,
9314 "%s(config-router)# ",
9315 1,
9316};
9317
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009318static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009319{
9320 BGP_IPV4_NODE,
9321 "%s(config-router-af)# ",
9322 1,
9323};
9324
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009325static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009326{
9327 BGP_IPV4M_NODE,
9328 "%s(config-router-af)# ",
9329 1,
9330};
9331
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009332static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009333{
9334 BGP_IPV6_NODE,
9335 "%s(config-router-af)# ",
9336 1,
9337};
9338
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009339static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009340{
9341 BGP_IPV6M_NODE,
9342 "%s(config-router-af)# ",
9343 1,
9344};
9345
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009346static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009347{
9348 BGP_VPNV4_NODE,
9349 "%s(config-router-af)# ",
9350 1
9351};
David Lamparter6b0655a2014-06-04 06:53:35 +02009352
Lou Berger13c378d2016-01-12 13:41:56 -05009353static struct cmd_node bgp_vpnv6_node =
9354{
9355 BGP_VPNV6_NODE,
9356 "%s(config-router-af-vpnv6)# ",
9357 1
9358};
9359
paul1f8ae702005-09-09 23:49:49 +00009360static void community_list_vty (void);
9361
paul718e3742002-12-13 20:15:29 +00009362void
paul94f2b392005-06-28 12:44:16 +00009363bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009364{
paul718e3742002-12-13 20:15:29 +00009365 /* Install bgp top node. */
9366 install_node (&bgp_node, bgp_config_write);
9367 install_node (&bgp_ipv4_unicast_node, NULL);
9368 install_node (&bgp_ipv4_multicast_node, NULL);
9369 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009370 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009371 install_node (&bgp_vpnv4_node, NULL);
Lou Berger13c378d2016-01-12 13:41:56 -05009372 install_node (&bgp_vpnv6_node, NULL);
paul718e3742002-12-13 20:15:29 +00009373
9374 /* Install default VTY commands to new nodes. */
9375 install_default (BGP_NODE);
9376 install_default (BGP_IPV4_NODE);
9377 install_default (BGP_IPV4M_NODE);
9378 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009379 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009380 install_default (BGP_VPNV4_NODE);
Lou Berger13c378d2016-01-12 13:41:56 -05009381 install_default (BGP_VPNV6_NODE);
paul718e3742002-12-13 20:15:29 +00009382
9383 /* "bgp multiple-instance" commands. */
9384 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9385 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9386
9387 /* "bgp config-type" commands. */
9388 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9389 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9390
9391 /* Dummy commands (Currently not supported) */
9392 install_element (BGP_NODE, &no_synchronization_cmd);
9393 install_element (BGP_NODE, &no_auto_summary_cmd);
9394
9395 /* "router bgp" commands. */
9396 install_element (CONFIG_NODE, &router_bgp_cmd);
9397 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9398
9399 /* "no router bgp" commands. */
9400 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9401 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9402
9403 /* "bgp router-id" commands. */
9404 install_element (BGP_NODE, &bgp_router_id_cmd);
9405 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9406 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9407
9408 /* "bgp cluster-id" commands. */
9409 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9410 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9411 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9412 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9413
9414 /* "bgp confederation" commands. */
9415 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9416 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9417 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9418
9419 /* "bgp confederation peers" commands. */
9420 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9421 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9422
Josh Bailey165b5ff2011-07-20 20:43:22 -07009423 /* "maximum-paths" commands. */
9424 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9425 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9426 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9427 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9428 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9429 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
9430 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9431 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9432 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9433 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9434 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9435 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9436
paul718e3742002-12-13 20:15:29 +00009437 /* "timers bgp" commands. */
9438 install_element (BGP_NODE, &bgp_timers_cmd);
9439 install_element (BGP_NODE, &no_bgp_timers_cmd);
9440 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9441
9442 /* "bgp client-to-client reflection" commands */
9443 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9444 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9445
9446 /* "bgp always-compare-med" commands */
9447 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9448 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9449
9450 /* "bgp deterministic-med" commands */
9451 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9452 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009453
hasso538621f2004-05-21 09:31:30 +00009454 /* "bgp graceful-restart" commands */
9455 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9456 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009457 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9458 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9459 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009460
9461 /* "bgp fast-external-failover" commands */
9462 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9463 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9464
9465 /* "bgp enforce-first-as" commands */
9466 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9467 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9468
9469 /* "bgp bestpath compare-routerid" commands */
9470 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9471 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9472
9473 /* "bgp bestpath as-path ignore" commands */
9474 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9475 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9476
hasso68118452005-04-08 15:40:36 +00009477 /* "bgp bestpath as-path confed" commands */
9478 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9479 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9480
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00009481 /* "bgp bestpath as-path multipath-relax" commands */
9482 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9483 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9484
paul848973c2003-08-13 00:32:49 +00009485 /* "bgp log-neighbor-changes" commands */
9486 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9487 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9488
paul718e3742002-12-13 20:15:29 +00009489 /* "bgp bestpath med" commands */
9490 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9491 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9492 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9493 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9494 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9495 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9496
9497 /* "no bgp default ipv4-unicast" commands. */
9498 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9499 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9500
9501 /* "bgp network import-check" commands. */
9502 install_element (BGP_NODE, &bgp_network_import_check_cmd);
9503 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
9504
9505 /* "bgp default local-preference" commands. */
9506 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
9507 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
9508 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
9509
9510 /* "neighbor remote-as" commands. */
9511 install_element (BGP_NODE, &neighbor_remote_as_cmd);
9512 install_element (BGP_NODE, &no_neighbor_cmd);
9513 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
9514
9515 /* "neighbor peer-group" commands. */
9516 install_element (BGP_NODE, &neighbor_peer_group_cmd);
9517 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
9518 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
9519
9520 /* "neighbor local-as" commands. */
9521 install_element (BGP_NODE, &neighbor_local_as_cmd);
9522 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009523 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +00009524 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
9525 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
9526 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009527 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +00009528
Paul Jakma0df7c912008-07-21 21:02:49 +00009529 /* "neighbor password" commands. */
9530 install_element (BGP_NODE, &neighbor_password_cmd);
9531 install_element (BGP_NODE, &no_neighbor_password_cmd);
9532
paul718e3742002-12-13 20:15:29 +00009533 /* "neighbor activate" commands. */
9534 install_element (BGP_NODE, &neighbor_activate_cmd);
9535 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
9536 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
9537 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009538 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009539 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009540 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009541
9542 /* "no neighbor activate" commands. */
9543 install_element (BGP_NODE, &no_neighbor_activate_cmd);
9544 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
9545 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
9546 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009547 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009548 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009549 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009550
9551 /* "neighbor peer-group set" commands. */
9552 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
9553 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
9554 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
9555 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009556 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009557 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009558 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009559
paul718e3742002-12-13 20:15:29 +00009560 /* "no neighbor peer-group unset" commands. */
9561 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
9562 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
9563 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
9564 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009565 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009566 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009567 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009568
paul718e3742002-12-13 20:15:29 +00009569 /* "neighbor softreconfiguration inbound" commands.*/
9570 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
9571 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
9572 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
9573 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
9574 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
9575 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
9576 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
9577 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009578 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
9579 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +00009580 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
9581 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009582 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
9583 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +00009584
9585 /* "neighbor attribute-unchanged" commands. */
9586 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
9587 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
9588 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
9589 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
9590 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
9591 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
9592 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
9593 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
9594 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
9595 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
9596 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
9597 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
9598 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
9599 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
9600 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
9601 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
9602 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
9603 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
9604 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
9605 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
9606 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
9607 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
9608 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
9609 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
9610 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
9611 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
9612 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
9613 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
9614 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
9615 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
9616 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
9617 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
9618 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
9619 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
9620 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9621 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9622 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9623 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9624 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9625 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9626 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9627 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9628 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9629 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9630 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
9631 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
9632 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
9633 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
9634 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
9635 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
9636 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
9637 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
9638 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
9639 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
9640 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
9641 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
9642 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
9643 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
9644 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
9645 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
9646 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
9647 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
9648 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
9649 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
9650 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
9651 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
9652 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
9653 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
9654 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
9655 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
9656 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
9657 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
9658 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
9659 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
9660 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
9661 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
9662 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
9663 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9664 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9665 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9666 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9667 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9668 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9669 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9670 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9671 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9672 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9673 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009674 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
9675 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
9676 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
9677 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
9678 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
9679 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
9680 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
9681 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
9682 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
9683 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
9684 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
9685 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
9686 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
9687 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
9688 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
9689 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
9690 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
9691 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
9692 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
9693 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
9694 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
9695 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +00009696 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
9697 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
9698 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
9699 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
9700 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
9701 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
9702 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
9703 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
9704 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
9705 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
9706 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
9707 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
9708 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9709 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9710 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9711 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9712 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9713 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9714 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9715 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9716 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9717 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9718
Lou Berger13c378d2016-01-12 13:41:56 -05009719 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
9720 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
9721 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
9722 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
9723 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
9724 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
9725 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
9726 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
9727 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
9728 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
9729 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
9730 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
9731 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9732 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9733 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9734 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9735 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9736 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9737 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9738 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9739 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9740 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
9741
paulfee0f4c2004-09-13 05:12:46 +00009742 /* "nexthop-local unchanged" commands */
9743 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
9744 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
9745
paul718e3742002-12-13 20:15:29 +00009746 /* "transparent-as" and "transparent-nexthop" for old version
9747 compatibility. */
9748 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
9749 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
9750
9751 /* "neighbor next-hop-self" commands. */
9752 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
9753 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
9754 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
9755 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
9756 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
9757 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
9758 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
9759 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009760 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
9761 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009762 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
9763 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009764 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
9765 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009766
9767 /* "neighbor remove-private-AS" commands. */
9768 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
9769 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
9770 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
9771 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
9772 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
9773 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
9774 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
9775 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009776 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
9777 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009778 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
9779 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009780 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
9781 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009782
9783 /* "neighbor send-community" commands.*/
9784 install_element (BGP_NODE, &neighbor_send_community_cmd);
9785 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
9786 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
9787 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
9788 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
9789 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
9790 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
9791 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
9792 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
9793 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
9794 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
9795 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
9796 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
9797 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
9798 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
9799 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009800 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
9801 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
9802 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
9803 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00009804 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
9805 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
9806 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
9807 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009808 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
9809 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
9810 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
9811 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00009812
9813 /* "neighbor route-reflector" commands.*/
9814 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
9815 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
9816 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
9817 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
9818 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
9819 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
9820 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
9821 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009822 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
9823 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +00009824 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
9825 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009826 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
9827 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +00009828
9829 /* "neighbor route-server" commands.*/
9830 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
9831 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
9832 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
9833 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
9834 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
9835 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
9836 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
9837 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009838 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
9839 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +00009840 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
9841 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009842 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
9843 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +00009844
9845 /* "neighbor passive" commands. */
9846 install_element (BGP_NODE, &neighbor_passive_cmd);
9847 install_element (BGP_NODE, &no_neighbor_passive_cmd);
9848
9849 /* "neighbor shutdown" commands. */
9850 install_element (BGP_NODE, &neighbor_shutdown_cmd);
9851 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
9852
hassoc9502432005-02-01 22:01:48 +00009853 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +00009854 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
9855 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
9856
9857 /* "neighbor capability orf prefix-list" commands.*/
9858 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
9859 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
9860 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
9861 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
9862 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
9863 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
9864 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
9865 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009866 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
9867 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +00009868
9869 /* "neighbor capability dynamic" commands.*/
9870 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
9871 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
9872
9873 /* "neighbor dont-capability-negotiate" commands. */
9874 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
9875 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
9876
9877 /* "neighbor ebgp-multihop" commands. */
9878 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
9879 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
9880 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
9881 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
9882
hasso6ffd2072005-02-02 14:50:11 +00009883 /* "neighbor disable-connected-check" commands. */
9884 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
9885 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +00009886 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
9887 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
9888
9889 /* "neighbor description" commands. */
9890 install_element (BGP_NODE, &neighbor_description_cmd);
9891 install_element (BGP_NODE, &no_neighbor_description_cmd);
9892 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
9893
9894 /* "neighbor update-source" commands. "*/
9895 install_element (BGP_NODE, &neighbor_update_source_cmd);
9896 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
9897
9898 /* "neighbor default-originate" commands. */
9899 install_element (BGP_NODE, &neighbor_default_originate_cmd);
9900 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
9901 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
9902 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
9903 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
9904 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
9905 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
9906 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
9907 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
9908 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
9909 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
9910 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
9911 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
9912 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
9913 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
9914 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009915 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
9916 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
9917 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
9918 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +00009919
9920 /* "neighbor port" commands. */
9921 install_element (BGP_NODE, &neighbor_port_cmd);
9922 install_element (BGP_NODE, &no_neighbor_port_cmd);
9923 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
9924
9925 /* "neighbor weight" commands. */
9926 install_element (BGP_NODE, &neighbor_weight_cmd);
9927 install_element (BGP_NODE, &no_neighbor_weight_cmd);
9928 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
9929
9930 /* "neighbor override-capability" commands. */
9931 install_element (BGP_NODE, &neighbor_override_capability_cmd);
9932 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
9933
9934 /* "neighbor strict-capability-match" commands. */
9935 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
9936 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
9937
9938 /* "neighbor timers" commands. */
9939 install_element (BGP_NODE, &neighbor_timers_cmd);
9940 install_element (BGP_NODE, &no_neighbor_timers_cmd);
9941
9942 /* "neighbor timers connect" commands. */
9943 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
9944 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
9945 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
9946
9947 /* "neighbor advertisement-interval" commands. */
9948 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
9949 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
9950 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
9951
9952 /* "neighbor version" commands. */
9953 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +00009954
9955 /* "neighbor interface" commands. */
9956 install_element (BGP_NODE, &neighbor_interface_cmd);
9957 install_element (BGP_NODE, &no_neighbor_interface_cmd);
9958
9959 /* "neighbor distribute" commands. */
9960 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
9961 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
9962 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
9963 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
9964 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
9965 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
9966 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
9967 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009968 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
9969 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +00009970 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
9971 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009972 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
9973 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +00009974
9975 /* "neighbor prefix-list" commands. */
9976 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
9977 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
9978 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
9979 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
9980 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
9981 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
9982 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
9983 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009984 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
9985 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +00009986 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
9987 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009988 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
9989 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +00009990
9991 /* "neighbor filter-list" commands. */
9992 install_element (BGP_NODE, &neighbor_filter_list_cmd);
9993 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
9994 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
9995 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
9996 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
9997 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
9998 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
9999 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010000 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
10001 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010002 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
10003 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010004 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
10005 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010006
10007 /* "neighbor route-map" commands. */
10008 install_element (BGP_NODE, &neighbor_route_map_cmd);
10009 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
10010 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
10011 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
10012 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
10013 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
10014 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
10015 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010016 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
10017 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010018 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
10019 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010020 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
10021 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010022
10023 /* "neighbor unsuppress-map" commands. */
10024 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
10025 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
10026 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
10027 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
10028 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
10029 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
10030 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
10031 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010032 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
10033 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +000010034 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010035 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010036 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010037 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +000010038
10039 /* "neighbor maximum-prefix" commands. */
10040 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010041 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010042 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010043 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010044 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
10045 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010046 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
10047 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010048 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10049 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10050 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10051 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10052 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010053 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010054 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010055 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010056 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010057 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10058 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010059 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
10060 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010061 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10062 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10063 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10064 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10065 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010066 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010067 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010068 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010069 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010070 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
10071 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010072 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
10073 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010074 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10075 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10076 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10077 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10078 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010079 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010080 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010081 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010082 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010083 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10084 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010085 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10086 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010087 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10088 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10089 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10090 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10091 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010092 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
10093 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
10094 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
10095 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10096 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
10097 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10098 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
10099 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
10100 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10101 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10102 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10103 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10104 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010105 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010106 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010107 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010108 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010109 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10110 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010111 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
10112 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010113 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10114 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10115 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10116 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10117 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010118
Lou Berger13c378d2016-01-12 13:41:56 -050010119 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
10120 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10121 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10122 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10123 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10124 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10125 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
10126 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10127 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10128 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10129 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10130 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10131 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10132
paul718e3742002-12-13 20:15:29 +000010133 /* "neighbor allowas-in" */
10134 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
10135 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
10136 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
10137 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
10138 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
10139 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
10140 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
10141 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
10142 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
10143 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
10144 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
10145 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010146 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
10147 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
10148 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010149 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
10150 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
10151 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010152 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
10153 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
10154 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010155
10156 /* address-family commands. */
10157 install_element (BGP_NODE, &address_family_ipv4_cmd);
10158 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
10159#ifdef HAVE_IPV6
10160 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010161 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010162#endif /* HAVE_IPV6 */
10163 install_element (BGP_NODE, &address_family_vpnv4_cmd);
10164 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
10165
Lou Berger13c378d2016-01-12 13:41:56 -050010166 install_element (BGP_NODE, &address_family_vpnv6_cmd);
10167 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
10168
paul718e3742002-12-13 20:15:29 +000010169 /* "exit-address-family" command. */
10170 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
10171 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
10172 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010173 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010174 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010175 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010176
10177 /* "clear ip bgp commands" */
10178 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
10179 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
10180 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
10181 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
10182 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
10183 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
10184#ifdef HAVE_IPV6
10185 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
10186 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
10187 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
10188 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
10189 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
10190 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
10191 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
10192 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
10193 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
10194 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
10195 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
10196#endif /* HAVE_IPV6 */
10197
10198 /* "clear ip bgp neighbor soft in" */
10199 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
10200 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
10201 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
10202 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
10203 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
10204 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
10205 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
10206 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
10207 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
10208 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
10209 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
10210 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
10211 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
10212 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
10213 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
10214 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
10215 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
10216 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
10217 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
10218 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
10219 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
10220 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
10221 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
10222 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
10223 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
10224 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
10225 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
10226 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
10227 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
10228 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
10229 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
10230 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
10231 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
10232 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
10233 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
10234 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
10235 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
10236 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
10237 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
10238 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010239 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
10240 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
10241 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
10242 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
10243 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
10244 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
paul718e3742002-12-13 20:15:29 +000010245#ifdef HAVE_IPV6
10246 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
10247 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
10248 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
10249 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
10250 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
10251 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
10252 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
10253 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
10254 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
10255 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
10256 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
10257 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
10258 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
10259 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
10260 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
10261 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
10262 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
10263 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
10264 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
10265 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
10266 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
10267 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
10268 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
10269 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
10270 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
10271 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
10272 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
10273 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
10274 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
10275 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
10276 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
10277#endif /* HAVE_IPV6 */
10278
10279 /* "clear ip bgp neighbor soft out" */
10280 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
10281 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
10282 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
10283 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
10284 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
10285 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
10286 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
10287 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
10288 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
10289 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
10290 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
10291 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
10292 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
10293 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
10294 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
10295 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
10296 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
10297 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
10298 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
10299 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
10300 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
10301 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
10302 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
10303 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
10304 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
10305 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
10306 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
10307 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010308 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
10309 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
10310 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
10311 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
10312 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
10313 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
paul718e3742002-12-13 20:15:29 +000010314#ifdef HAVE_IPV6
10315 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
10316 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
10317 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
10318 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
10319 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
10320 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
10321 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
10322 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
10323 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
10324 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
10325 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
10326 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
10327 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
10328 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
10329 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
10330 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
10331 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
10332 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
10333 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
10334 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
10335 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
10336#endif /* HAVE_IPV6 */
10337
10338 /* "clear ip bgp neighbor soft" */
10339 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
10340 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
10341 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
10342 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
10343 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
10344 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
10345 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
10346 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
10347 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
10348 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
10349 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
10350 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
10351 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
10352 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
10353 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010354 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
10355 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
10356 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
paul718e3742002-12-13 20:15:29 +000010357#ifdef HAVE_IPV6
10358 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
10359 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
10360 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
10361 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
10362 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
10363 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
10364 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
10365 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
10366 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
10367 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
10368 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
10369#endif /* HAVE_IPV6 */
10370
paulfee0f4c2004-09-13 05:12:46 +000010371 /* "clear ip bgp neighbor rsclient" */
10372 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
10373 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
10374 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
10375 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
10376#ifdef HAVE_IPV6
10377 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
10378 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
10379 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
10380 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
10381 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
10382 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
10383 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
10384 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
10385#endif /* HAVE_IPV6 */
10386
paul718e3742002-12-13 20:15:29 +000010387 /* "show ip bgp summary" commands. */
10388 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
10389 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
10390 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010391 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010392 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010393 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010394 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10395 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10396#ifdef HAVE_IPV6
10397 install_element (VIEW_NODE, &show_bgp_summary_cmd);
10398 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
10399 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010400 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010401 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010402 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010403#endif /* HAVE_IPV6 */
Paul Jakma62687ff2008-08-23 14:27:06 +010010404 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
10405 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
10406 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010407 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010408 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010409 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010410 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10411 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10412#ifdef HAVE_IPV6
10413 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
10414 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
10415 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010416 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010417 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010418 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010419#endif /* HAVE_IPV6 */
paul718e3742002-12-13 20:15:29 +000010420 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
10421 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
10422 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010423 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010424 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010425 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010426 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10427 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10428#ifdef HAVE_IPV6
10429 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
10430 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
10431 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010432 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010433 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010434 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010435#endif /* HAVE_IPV6 */
10436
10437 /* "show ip bgp neighbors" commands. */
10438 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
10439 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10440 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
10441 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10442 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10443 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10444 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10445 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10446 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
10447 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010448 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
10449 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10450 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10451 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10452 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010453 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
10454 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10455 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
10456 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10457 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10458 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10459 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10460 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10461 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
10462 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
10463
10464#ifdef HAVE_IPV6
10465 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
10466 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
10467 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
10468 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010469 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
10470 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10471 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
10472 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010473 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
10474 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
10475 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
10476 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010477 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
10478 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
10479 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
10480 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010481 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
10482 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10483 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
10484 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010485
10486 /* Old commands. */
10487 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
10488 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
10489 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
10490 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
10491#endif /* HAVE_IPV6 */
10492
paulfee0f4c2004-09-13 05:12:46 +000010493 /* "show ip bgp rsclient" commands. */
10494 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
10495 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10496 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10497 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010498 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10499 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010500 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
10501 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10502 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10503 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010504 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10505 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010506 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
10507 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10508 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10509 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010510 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10511 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010512
10513#ifdef HAVE_IPV6
10514 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
10515 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10516 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
10517 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010518 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10519 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010520 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
10521 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10522 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
10523 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010524 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10525 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010526 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
10527 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10528 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
10529 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010530 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10531 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010532#endif /* HAVE_IPV6 */
10533
paul718e3742002-12-13 20:15:29 +000010534 /* "show ip bgp paths" commands. */
10535 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
10536 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
10537 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
10538 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
10539
10540 /* "show ip bgp community" commands. */
10541 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
10542 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
10543
10544 /* "show ip bgp attribute-info" commands. */
10545 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
10546 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
10547
10548 /* "redistribute" commands. */
10549 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
10550 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
10551 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
10552 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
10553 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
10554 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
10555 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
10556 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
10557 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
10558 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
10559#ifdef HAVE_IPV6
10560 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
10561 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
10562 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
10563 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
10564 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
10565 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
10566 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
10567 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
10568 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
10569 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
10570#endif /* HAVE_IPV6 */
10571
Nick Hilliardfa411a22011-03-23 15:33:17 +000010572 /* ttl_security commands */
10573 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
10574 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
10575
Paul Jakma4bf6a362006-03-30 14:05:23 +000010576 /* "show bgp memory" commands. */
10577 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010578 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000010579 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
10580
Michael Lamberte0081f72008-11-16 20:12:04 +000010581 /* "show bgp views" commands. */
10582 install_element (VIEW_NODE, &show_bgp_views_cmd);
10583 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
10584 install_element (ENABLE_NODE, &show_bgp_views_cmd);
10585
paul718e3742002-12-13 20:15:29 +000010586 /* Community-list. */
10587 community_list_vty ();
10588}
David Lamparter6b0655a2014-06-04 06:53:35 +020010589
paul718e3742002-12-13 20:15:29 +000010590#include "memory.h"
10591#include "bgp_regex.h"
10592#include "bgp_clist.h"
10593#include "bgp_ecommunity.h"
10594
10595/* VTY functions. */
10596
10597/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000010598static const char *
paul718e3742002-12-13 20:15:29 +000010599community_direct_str (int direct)
10600{
10601 switch (direct)
10602 {
10603 case COMMUNITY_DENY:
10604 return "deny";
paul718e3742002-12-13 20:15:29 +000010605 case COMMUNITY_PERMIT:
10606 return "permit";
paul718e3742002-12-13 20:15:29 +000010607 default:
10608 return "unknown";
paul718e3742002-12-13 20:15:29 +000010609 }
10610}
10611
10612/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000010613static void
paul718e3742002-12-13 20:15:29 +000010614community_list_perror (struct vty *vty, int ret)
10615{
10616 switch (ret)
10617 {
10618 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030010619 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010620 break;
10621 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
10622 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
10623 break;
10624 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
10625 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
10626 break;
10627 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
10628 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
10629 break;
10630 }
10631}
10632
10633/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000010634static int
paulfd79ac92004-10-13 05:06:08 +000010635community_list_set_vty (struct vty *vty, int argc, const char **argv,
10636 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010637{
10638 int ret;
10639 int direct;
10640 char *str;
10641
10642 /* Check the list type. */
10643 if (strncmp (argv[1], "p", 1) == 0)
10644 direct = COMMUNITY_PERMIT;
10645 else if (strncmp (argv[1], "d", 1) == 0)
10646 direct = COMMUNITY_DENY;
10647 else
10648 {
10649 vty_out (vty, "%% Matching condition must be permit or deny%s",
10650 VTY_NEWLINE);
10651 return CMD_WARNING;
10652 }
10653
10654 /* All digit name check. */
10655 if (reject_all_digit_name && all_digit (argv[0]))
10656 {
10657 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10658 return CMD_WARNING;
10659 }
10660
10661 /* Concat community string argument. */
10662 if (argc > 1)
10663 str = argv_concat (argv, argc, 2);
10664 else
10665 str = NULL;
10666
10667 /* When community_list_set() return nevetive value, it means
10668 malformed community string. */
10669 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
10670
10671 /* Free temporary community list string allocated by
10672 argv_concat(). */
10673 if (str)
10674 XFREE (MTYPE_TMP, str);
10675
10676 if (ret < 0)
10677 {
10678 /* Display error string. */
10679 community_list_perror (vty, ret);
10680 return CMD_WARNING;
10681 }
10682
10683 return CMD_SUCCESS;
10684}
10685
paul718e3742002-12-13 20:15:29 +000010686/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000010687static int
hassofee6e4e2005-02-02 16:29:31 +000010688community_list_unset_vty (struct vty *vty, int argc, const char **argv,
10689 int style)
paul718e3742002-12-13 20:15:29 +000010690{
10691 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010692 int direct = 0;
10693 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010694
hassofee6e4e2005-02-02 16:29:31 +000010695 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010696 {
hassofee6e4e2005-02-02 16:29:31 +000010697 /* Check the list direct. */
10698 if (strncmp (argv[1], "p", 1) == 0)
10699 direct = COMMUNITY_PERMIT;
10700 else if (strncmp (argv[1], "d", 1) == 0)
10701 direct = COMMUNITY_DENY;
10702 else
10703 {
10704 vty_out (vty, "%% Matching condition must be permit or deny%s",
10705 VTY_NEWLINE);
10706 return CMD_WARNING;
10707 }
paul718e3742002-12-13 20:15:29 +000010708
hassofee6e4e2005-02-02 16:29:31 +000010709 /* Concat community string argument. */
10710 str = argv_concat (argv, argc, 2);
10711 }
paul718e3742002-12-13 20:15:29 +000010712
10713 /* Unset community list. */
10714 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
10715
10716 /* Free temporary community list string allocated by
10717 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010718 if (str)
10719 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010720
10721 if (ret < 0)
10722 {
10723 community_list_perror (vty, ret);
10724 return CMD_WARNING;
10725 }
10726
10727 return CMD_SUCCESS;
10728}
10729
10730/* "community-list" keyword help string. */
10731#define COMMUNITY_LIST_STR "Add a community list entry\n"
10732#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
10733
paul718e3742002-12-13 20:15:29 +000010734DEFUN (ip_community_list_standard,
10735 ip_community_list_standard_cmd,
10736 "ip community-list <1-99> (deny|permit) .AA:NN",
10737 IP_STR
10738 COMMUNITY_LIST_STR
10739 "Community list number (standard)\n"
10740 "Specify community to reject\n"
10741 "Specify community to accept\n"
10742 COMMUNITY_VAL_STR)
10743{
10744 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
10745}
10746
10747ALIAS (ip_community_list_standard,
10748 ip_community_list_standard2_cmd,
10749 "ip community-list <1-99> (deny|permit)",
10750 IP_STR
10751 COMMUNITY_LIST_STR
10752 "Community list number (standard)\n"
10753 "Specify community to reject\n"
10754 "Specify community to accept\n")
10755
10756DEFUN (ip_community_list_expanded,
10757 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010758 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010759 IP_STR
10760 COMMUNITY_LIST_STR
10761 "Community list number (expanded)\n"
10762 "Specify community to reject\n"
10763 "Specify community to accept\n"
10764 "An ordered list as a regular-expression\n")
10765{
10766 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
10767}
10768
10769DEFUN (ip_community_list_name_standard,
10770 ip_community_list_name_standard_cmd,
10771 "ip community-list standard WORD (deny|permit) .AA:NN",
10772 IP_STR
10773 COMMUNITY_LIST_STR
10774 "Add a standard community-list entry\n"
10775 "Community list name\n"
10776 "Specify community to reject\n"
10777 "Specify community to accept\n"
10778 COMMUNITY_VAL_STR)
10779{
10780 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
10781}
10782
10783ALIAS (ip_community_list_name_standard,
10784 ip_community_list_name_standard2_cmd,
10785 "ip community-list standard WORD (deny|permit)",
10786 IP_STR
10787 COMMUNITY_LIST_STR
10788 "Add a standard community-list entry\n"
10789 "Community list name\n"
10790 "Specify community to reject\n"
10791 "Specify community to accept\n")
10792
10793DEFUN (ip_community_list_name_expanded,
10794 ip_community_list_name_expanded_cmd,
10795 "ip community-list expanded WORD (deny|permit) .LINE",
10796 IP_STR
10797 COMMUNITY_LIST_STR
10798 "Add an expanded community-list entry\n"
10799 "Community list name\n"
10800 "Specify community to reject\n"
10801 "Specify community to accept\n"
10802 "An ordered list as a regular-expression\n")
10803{
10804 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
10805}
10806
hassofee6e4e2005-02-02 16:29:31 +000010807DEFUN (no_ip_community_list_standard_all,
10808 no_ip_community_list_standard_all_cmd,
10809 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010810 NO_STR
10811 IP_STR
10812 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010813 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010814{
hassofee6e4e2005-02-02 16:29:31 +000010815 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010816}
10817
hassofee6e4e2005-02-02 16:29:31 +000010818DEFUN (no_ip_community_list_expanded_all,
10819 no_ip_community_list_expanded_all_cmd,
10820 "no ip community-list <100-500>",
10821 NO_STR
10822 IP_STR
10823 COMMUNITY_LIST_STR
10824 "Community list number (expanded)\n")
10825{
10826 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10827}
10828
10829DEFUN (no_ip_community_list_name_standard_all,
10830 no_ip_community_list_name_standard_all_cmd,
10831 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010832 NO_STR
10833 IP_STR
10834 COMMUNITY_LIST_STR
10835 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000010836 "Community list name\n")
10837{
hassofee6e4e2005-02-02 16:29:31 +000010838 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010839}
10840
hassofee6e4e2005-02-02 16:29:31 +000010841DEFUN (no_ip_community_list_name_expanded_all,
10842 no_ip_community_list_name_expanded_all_cmd,
10843 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000010844 NO_STR
10845 IP_STR
10846 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010847 "Add an expanded community-list entry\n"
10848 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000010849{
hassofee6e4e2005-02-02 16:29:31 +000010850 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010851}
10852
10853DEFUN (no_ip_community_list_standard,
10854 no_ip_community_list_standard_cmd,
10855 "no ip community-list <1-99> (deny|permit) .AA:NN",
10856 NO_STR
10857 IP_STR
10858 COMMUNITY_LIST_STR
10859 "Community list number (standard)\n"
10860 "Specify community to reject\n"
10861 "Specify community to accept\n"
10862 COMMUNITY_VAL_STR)
10863{
10864 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10865}
10866
10867DEFUN (no_ip_community_list_expanded,
10868 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010869 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010870 NO_STR
10871 IP_STR
10872 COMMUNITY_LIST_STR
10873 "Community list number (expanded)\n"
10874 "Specify community to reject\n"
10875 "Specify community to accept\n"
10876 "An ordered list as a regular-expression\n")
10877{
10878 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10879}
10880
10881DEFUN (no_ip_community_list_name_standard,
10882 no_ip_community_list_name_standard_cmd,
10883 "no ip community-list standard WORD (deny|permit) .AA:NN",
10884 NO_STR
10885 IP_STR
10886 COMMUNITY_LIST_STR
10887 "Specify a standard community-list\n"
10888 "Community list name\n"
10889 "Specify community to reject\n"
10890 "Specify community to accept\n"
10891 COMMUNITY_VAL_STR)
10892{
10893 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10894}
10895
10896DEFUN (no_ip_community_list_name_expanded,
10897 no_ip_community_list_name_expanded_cmd,
10898 "no ip community-list expanded WORD (deny|permit) .LINE",
10899 NO_STR
10900 IP_STR
10901 COMMUNITY_LIST_STR
10902 "Specify an expanded community-list\n"
10903 "Community list name\n"
10904 "Specify community to reject\n"
10905 "Specify community to accept\n"
10906 "An ordered list as a regular-expression\n")
10907{
10908 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10909}
10910
paul94f2b392005-06-28 12:44:16 +000010911static void
paul718e3742002-12-13 20:15:29 +000010912community_list_show (struct vty *vty, struct community_list *list)
10913{
10914 struct community_entry *entry;
10915
10916 for (entry = list->head; entry; entry = entry->next)
10917 {
10918 if (entry == list->head)
10919 {
10920 if (all_digit (list->name))
10921 vty_out (vty, "Community %s list %s%s",
10922 entry->style == COMMUNITY_LIST_STANDARD ?
10923 "standard" : "(expanded) access",
10924 list->name, VTY_NEWLINE);
10925 else
10926 vty_out (vty, "Named Community %s list %s%s",
10927 entry->style == COMMUNITY_LIST_STANDARD ?
10928 "standard" : "expanded",
10929 list->name, VTY_NEWLINE);
10930 }
10931 if (entry->any)
10932 vty_out (vty, " %s%s",
10933 community_direct_str (entry->direct), VTY_NEWLINE);
10934 else
10935 vty_out (vty, " %s %s%s",
10936 community_direct_str (entry->direct),
10937 entry->style == COMMUNITY_LIST_STANDARD
10938 ? community_str (entry->u.com) : entry->config,
10939 VTY_NEWLINE);
10940 }
10941}
10942
10943DEFUN (show_ip_community_list,
10944 show_ip_community_list_cmd,
10945 "show ip community-list",
10946 SHOW_STR
10947 IP_STR
10948 "List community-list\n")
10949{
10950 struct community_list *list;
10951 struct community_list_master *cm;
10952
hassofee6e4e2005-02-02 16:29:31 +000010953 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010954 if (! cm)
10955 return CMD_SUCCESS;
10956
10957 for (list = cm->num.head; list; list = list->next)
10958 community_list_show (vty, list);
10959
10960 for (list = cm->str.head; list; list = list->next)
10961 community_list_show (vty, list);
10962
10963 return CMD_SUCCESS;
10964}
10965
10966DEFUN (show_ip_community_list_arg,
10967 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010968 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010969 SHOW_STR
10970 IP_STR
10971 "List community-list\n"
10972 "Community-list number\n"
10973 "Community-list name\n")
10974{
10975 struct community_list *list;
10976
hassofee6e4e2005-02-02 16:29:31 +000010977 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010978 if (! list)
10979 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030010980 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010981 return CMD_WARNING;
10982 }
10983
10984 community_list_show (vty, list);
10985
10986 return CMD_SUCCESS;
10987}
David Lamparter6b0655a2014-06-04 06:53:35 +020010988
paul94f2b392005-06-28 12:44:16 +000010989static int
paulfd79ac92004-10-13 05:06:08 +000010990extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
10991 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010992{
10993 int ret;
10994 int direct;
10995 char *str;
10996
10997 /* Check the list type. */
10998 if (strncmp (argv[1], "p", 1) == 0)
10999 direct = COMMUNITY_PERMIT;
11000 else if (strncmp (argv[1], "d", 1) == 0)
11001 direct = COMMUNITY_DENY;
11002 else
11003 {
11004 vty_out (vty, "%% Matching condition must be permit or deny%s",
11005 VTY_NEWLINE);
11006 return CMD_WARNING;
11007 }
11008
11009 /* All digit name check. */
11010 if (reject_all_digit_name && all_digit (argv[0]))
11011 {
11012 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11013 return CMD_WARNING;
11014 }
11015
11016 /* Concat community string argument. */
11017 if (argc > 1)
11018 str = argv_concat (argv, argc, 2);
11019 else
11020 str = NULL;
11021
11022 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
11023
11024 /* Free temporary community list string allocated by
11025 argv_concat(). */
11026 if (str)
11027 XFREE (MTYPE_TMP, str);
11028
11029 if (ret < 0)
11030 {
11031 community_list_perror (vty, ret);
11032 return CMD_WARNING;
11033 }
11034 return CMD_SUCCESS;
11035}
11036
paul94f2b392005-06-28 12:44:16 +000011037static int
hassofee6e4e2005-02-02 16:29:31 +000011038extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
11039 int style)
paul718e3742002-12-13 20:15:29 +000011040{
11041 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011042 int direct = 0;
11043 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011044
hassofee6e4e2005-02-02 16:29:31 +000011045 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011046 {
hassofee6e4e2005-02-02 16:29:31 +000011047 /* Check the list direct. */
11048 if (strncmp (argv[1], "p", 1) == 0)
11049 direct = COMMUNITY_PERMIT;
11050 else if (strncmp (argv[1], "d", 1) == 0)
11051 direct = COMMUNITY_DENY;
11052 else
11053 {
11054 vty_out (vty, "%% Matching condition must be permit or deny%s",
11055 VTY_NEWLINE);
11056 return CMD_WARNING;
11057 }
11058
11059 /* Concat community string argument. */
11060 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000011061 }
paul718e3742002-12-13 20:15:29 +000011062
11063 /* Unset community list. */
11064 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
11065
11066 /* Free temporary community list string allocated by
11067 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011068 if (str)
11069 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011070
11071 if (ret < 0)
11072 {
11073 community_list_perror (vty, ret);
11074 return CMD_WARNING;
11075 }
11076
11077 return CMD_SUCCESS;
11078}
11079
11080/* "extcommunity-list" keyword help string. */
11081#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
11082#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
11083
11084DEFUN (ip_extcommunity_list_standard,
11085 ip_extcommunity_list_standard_cmd,
11086 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11087 IP_STR
11088 EXTCOMMUNITY_LIST_STR
11089 "Extended Community list number (standard)\n"
11090 "Specify community to reject\n"
11091 "Specify community to accept\n"
11092 EXTCOMMUNITY_VAL_STR)
11093{
11094 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
11095}
11096
11097ALIAS (ip_extcommunity_list_standard,
11098 ip_extcommunity_list_standard2_cmd,
11099 "ip extcommunity-list <1-99> (deny|permit)",
11100 IP_STR
11101 EXTCOMMUNITY_LIST_STR
11102 "Extended Community list number (standard)\n"
11103 "Specify community to reject\n"
11104 "Specify community to accept\n")
11105
11106DEFUN (ip_extcommunity_list_expanded,
11107 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011108 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011109 IP_STR
11110 EXTCOMMUNITY_LIST_STR
11111 "Extended Community list number (expanded)\n"
11112 "Specify community to reject\n"
11113 "Specify community to accept\n"
11114 "An ordered list as a regular-expression\n")
11115{
11116 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
11117}
11118
11119DEFUN (ip_extcommunity_list_name_standard,
11120 ip_extcommunity_list_name_standard_cmd,
11121 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11122 IP_STR
11123 EXTCOMMUNITY_LIST_STR
11124 "Specify standard extcommunity-list\n"
11125 "Extended Community list name\n"
11126 "Specify community to reject\n"
11127 "Specify community to accept\n"
11128 EXTCOMMUNITY_VAL_STR)
11129{
11130 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
11131}
11132
11133ALIAS (ip_extcommunity_list_name_standard,
11134 ip_extcommunity_list_name_standard2_cmd,
11135 "ip extcommunity-list standard WORD (deny|permit)",
11136 IP_STR
11137 EXTCOMMUNITY_LIST_STR
11138 "Specify standard extcommunity-list\n"
11139 "Extended Community list name\n"
11140 "Specify community to reject\n"
11141 "Specify community to accept\n")
11142
11143DEFUN (ip_extcommunity_list_name_expanded,
11144 ip_extcommunity_list_name_expanded_cmd,
11145 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
11146 IP_STR
11147 EXTCOMMUNITY_LIST_STR
11148 "Specify expanded extcommunity-list\n"
11149 "Extended Community list name\n"
11150 "Specify community to reject\n"
11151 "Specify community to accept\n"
11152 "An ordered list as a regular-expression\n")
11153{
11154 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
11155}
11156
hassofee6e4e2005-02-02 16:29:31 +000011157DEFUN (no_ip_extcommunity_list_standard_all,
11158 no_ip_extcommunity_list_standard_all_cmd,
11159 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011160 NO_STR
11161 IP_STR
11162 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011163 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011164{
hassofee6e4e2005-02-02 16:29:31 +000011165 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011166}
11167
hassofee6e4e2005-02-02 16:29:31 +000011168DEFUN (no_ip_extcommunity_list_expanded_all,
11169 no_ip_extcommunity_list_expanded_all_cmd,
11170 "no ip extcommunity-list <100-500>",
11171 NO_STR
11172 IP_STR
11173 EXTCOMMUNITY_LIST_STR
11174 "Extended Community list number (expanded)\n")
11175{
11176 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11177}
11178
11179DEFUN (no_ip_extcommunity_list_name_standard_all,
11180 no_ip_extcommunity_list_name_standard_all_cmd,
11181 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011182 NO_STR
11183 IP_STR
11184 EXTCOMMUNITY_LIST_STR
11185 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000011186 "Extended Community list name\n")
11187{
11188 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11189}
11190
11191DEFUN (no_ip_extcommunity_list_name_expanded_all,
11192 no_ip_extcommunity_list_name_expanded_all_cmd,
11193 "no ip extcommunity-list expanded WORD",
11194 NO_STR
11195 IP_STR
11196 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000011197 "Specify expanded extcommunity-list\n"
11198 "Extended Community list name\n")
11199{
hassofee6e4e2005-02-02 16:29:31 +000011200 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011201}
11202
11203DEFUN (no_ip_extcommunity_list_standard,
11204 no_ip_extcommunity_list_standard_cmd,
11205 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11206 NO_STR
11207 IP_STR
11208 EXTCOMMUNITY_LIST_STR
11209 "Extended Community list number (standard)\n"
11210 "Specify community to reject\n"
11211 "Specify community to accept\n"
11212 EXTCOMMUNITY_VAL_STR)
11213{
11214 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11215}
11216
11217DEFUN (no_ip_extcommunity_list_expanded,
11218 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011219 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011220 NO_STR
11221 IP_STR
11222 EXTCOMMUNITY_LIST_STR
11223 "Extended Community list number (expanded)\n"
11224 "Specify community to reject\n"
11225 "Specify community to accept\n"
11226 "An ordered list as a regular-expression\n")
11227{
11228 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11229}
11230
11231DEFUN (no_ip_extcommunity_list_name_standard,
11232 no_ip_extcommunity_list_name_standard_cmd,
11233 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11234 NO_STR
11235 IP_STR
11236 EXTCOMMUNITY_LIST_STR
11237 "Specify standard extcommunity-list\n"
11238 "Extended Community list name\n"
11239 "Specify community to reject\n"
11240 "Specify community to accept\n"
11241 EXTCOMMUNITY_VAL_STR)
11242{
11243 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11244}
11245
11246DEFUN (no_ip_extcommunity_list_name_expanded,
11247 no_ip_extcommunity_list_name_expanded_cmd,
11248 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
11249 NO_STR
11250 IP_STR
11251 EXTCOMMUNITY_LIST_STR
11252 "Specify expanded extcommunity-list\n"
11253 "Community list name\n"
11254 "Specify community to reject\n"
11255 "Specify community to accept\n"
11256 "An ordered list as a regular-expression\n")
11257{
11258 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11259}
11260
paul94f2b392005-06-28 12:44:16 +000011261static void
paul718e3742002-12-13 20:15:29 +000011262extcommunity_list_show (struct vty *vty, struct community_list *list)
11263{
11264 struct community_entry *entry;
11265
11266 for (entry = list->head; entry; entry = entry->next)
11267 {
11268 if (entry == list->head)
11269 {
11270 if (all_digit (list->name))
11271 vty_out (vty, "Extended community %s list %s%s",
11272 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11273 "standard" : "(expanded) access",
11274 list->name, VTY_NEWLINE);
11275 else
11276 vty_out (vty, "Named extended community %s list %s%s",
11277 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11278 "standard" : "expanded",
11279 list->name, VTY_NEWLINE);
11280 }
11281 if (entry->any)
11282 vty_out (vty, " %s%s",
11283 community_direct_str (entry->direct), VTY_NEWLINE);
11284 else
11285 vty_out (vty, " %s %s%s",
11286 community_direct_str (entry->direct),
11287 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11288 entry->u.ecom->str : entry->config,
11289 VTY_NEWLINE);
11290 }
11291}
11292
11293DEFUN (show_ip_extcommunity_list,
11294 show_ip_extcommunity_list_cmd,
11295 "show ip extcommunity-list",
11296 SHOW_STR
11297 IP_STR
11298 "List extended-community list\n")
11299{
11300 struct community_list *list;
11301 struct community_list_master *cm;
11302
hassofee6e4e2005-02-02 16:29:31 +000011303 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011304 if (! cm)
11305 return CMD_SUCCESS;
11306
11307 for (list = cm->num.head; list; list = list->next)
11308 extcommunity_list_show (vty, list);
11309
11310 for (list = cm->str.head; list; list = list->next)
11311 extcommunity_list_show (vty, list);
11312
11313 return CMD_SUCCESS;
11314}
11315
11316DEFUN (show_ip_extcommunity_list_arg,
11317 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011318 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011319 SHOW_STR
11320 IP_STR
11321 "List extended-community list\n"
11322 "Extcommunity-list number\n"
11323 "Extcommunity-list name\n")
11324{
11325 struct community_list *list;
11326
hassofee6e4e2005-02-02 16:29:31 +000011327 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011328 if (! list)
11329 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011330 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011331 return CMD_WARNING;
11332 }
11333
11334 extcommunity_list_show (vty, list);
11335
11336 return CMD_SUCCESS;
11337}
David Lamparter6b0655a2014-06-04 06:53:35 +020011338
paul718e3742002-12-13 20:15:29 +000011339/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000011340static const char *
paul718e3742002-12-13 20:15:29 +000011341community_list_config_str (struct community_entry *entry)
11342{
paulfd79ac92004-10-13 05:06:08 +000011343 const char *str;
paul718e3742002-12-13 20:15:29 +000011344
11345 if (entry->any)
11346 str = "";
11347 else
11348 {
11349 if (entry->style == COMMUNITY_LIST_STANDARD)
11350 str = community_str (entry->u.com);
11351 else
11352 str = entry->config;
11353 }
11354 return str;
11355}
11356
11357/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000011358static int
paul718e3742002-12-13 20:15:29 +000011359community_list_config_write (struct vty *vty)
11360{
11361 struct community_list *list;
11362 struct community_entry *entry;
11363 struct community_list_master *cm;
11364 int write = 0;
11365
11366 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000011367 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011368
11369 for (list = cm->num.head; list; list = list->next)
11370 for (entry = list->head; entry; entry = entry->next)
11371 {
hassofee6e4e2005-02-02 16:29:31 +000011372 vty_out (vty, "ip community-list %s %s %s%s",
11373 list->name, community_direct_str (entry->direct),
11374 community_list_config_str (entry),
11375 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011376 write++;
11377 }
11378 for (list = cm->str.head; list; list = list->next)
11379 for (entry = list->head; entry; entry = entry->next)
11380 {
11381 vty_out (vty, "ip community-list %s %s %s %s%s",
11382 entry->style == COMMUNITY_LIST_STANDARD
11383 ? "standard" : "expanded",
11384 list->name, community_direct_str (entry->direct),
11385 community_list_config_str (entry),
11386 VTY_NEWLINE);
11387 write++;
11388 }
11389
11390 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000011391 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011392
11393 for (list = cm->num.head; list; list = list->next)
11394 for (entry = list->head; entry; entry = entry->next)
11395 {
hassofee6e4e2005-02-02 16:29:31 +000011396 vty_out (vty, "ip extcommunity-list %s %s %s%s",
11397 list->name, community_direct_str (entry->direct),
11398 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011399 write++;
11400 }
11401 for (list = cm->str.head; list; list = list->next)
11402 for (entry = list->head; entry; entry = entry->next)
11403 {
11404 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
11405 entry->style == EXTCOMMUNITY_LIST_STANDARD
11406 ? "standard" : "expanded",
11407 list->name, community_direct_str (entry->direct),
11408 community_list_config_str (entry), VTY_NEWLINE);
11409 write++;
11410 }
11411 return write;
11412}
11413
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080011414static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000011415{
11416 COMMUNITY_LIST_NODE,
11417 "",
11418 1 /* Export to vtysh. */
11419};
11420
paul94f2b392005-06-28 12:44:16 +000011421static void
11422community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000011423{
11424 install_node (&community_list_node, community_list_config_write);
11425
11426 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000011427 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
11428 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
11429 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
11430 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
11431 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
11432 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011433 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
11434 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
11435 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
11436 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011437 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
11438 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
11439 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
11440 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
11441 install_element (VIEW_NODE, &show_ip_community_list_cmd);
11442 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
11443 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
11444 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
11445
11446 /* Extcommunity-list. */
11447 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
11448 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
11449 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
11450 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
11451 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
11452 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011453 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
11454 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
11455 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
11456 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011457 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
11458 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
11459 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
11460 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
11461 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
11462 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
11463 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
11464 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
11465}