blob: 1a1a9b9b22c870ee66e9a509f82ea84e704e1918 [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:
Lou Bergera3fda882016-01-12 13:42:04 -050065 case BGP_ENCAPV6_NODE:
Lou Berger13c378d2016-01-12 13:41:56 -050066 return AFI_IP6;
67 break;
68 }
69
paul718e3742002-12-13 20:15:29 +000070 return AFI_IP;
71}
72
73/* Utility function to get subsequent address family from current
74 node. */
75safi_t
76bgp_node_safi (struct vty *vty)
77{
Lou Bergera3fda882016-01-12 13:42:04 -050078 if (vty->node == BGP_ENCAP_NODE)
79 return SAFI_ENCAP;
80 if (vty->node == BGP_ENCAPV6_NODE)
81 return SAFI_ENCAP;
Lou Berger13c378d2016-01-12 13:41:56 -050082 if (vty->node == BGP_VPNV6_NODE)
83 return SAFI_MPLS_VPN;
paul718e3742002-12-13 20:15:29 +000084 if (vty->node == BGP_VPNV4_NODE)
85 return SAFI_MPLS_VPN;
paul25ffbdc2005-08-22 22:42:08 +000086 if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +000087 return SAFI_MULTICAST;
88 return SAFI_UNICAST;
89}
90
Lou Bergera3fda882016-01-12 13:42:04 -050091int
92bgp_parse_afi(const char *str, afi_t *afi)
93{
94 if (!strcmp(str, "ipv4")) {
95 *afi = AFI_IP;
96 return 0;
97 }
98#ifdef HAVE_IPV6
99 if (!strcmp(str, "ipv6")) {
100 *afi = AFI_IP6;
101 return 0;
102 }
103#endif /* HAVE_IPV6 */
104 return -1;
105}
106
107int
108bgp_parse_safi(const char *str, safi_t *safi)
109{
110 if (!strcmp(str, "encap")) {
111 *safi = SAFI_ENCAP;
112 return 0;
113 }
114 if (!strcmp(str, "multicast")) {
115 *safi = SAFI_MULTICAST;
116 return 0;
117 }
118 if (!strcmp(str, "unicast")) {
119 *safi = SAFI_UNICAST;
120 return 0;
121 }
122 if (!strcmp(str, "vpn")) {
123 *safi = SAFI_MPLS_VPN;
124 return 0;
125 }
126 return -1;
127}
128
paul94f2b392005-06-28 12:44:16 +0000129static int
paul718e3742002-12-13 20:15:29 +0000130peer_address_self_check (union sockunion *su)
131{
132 struct interface *ifp = NULL;
133
134 if (su->sa.sa_family == AF_INET)
135 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
136#ifdef HAVE_IPV6
137 else if (su->sa.sa_family == AF_INET6)
138 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
139#endif /* HAVE IPV6 */
140
141 if (ifp)
142 return 1;
143
144 return 0;
145}
146
147/* Utility function for looking up peer from VTY. */
paul94f2b392005-06-28 12:44:16 +0000148static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000149peer_lookup_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +0000150{
151 int ret;
152 struct bgp *bgp;
153 union sockunion su;
154 struct peer *peer;
155
156 bgp = vty->index;
157
158 ret = str2sockunion (ip_str, &su);
159 if (ret < 0)
160 {
161 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
162 return NULL;
163 }
164
165 peer = peer_lookup (bgp, &su);
166 if (! peer)
167 {
168 vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
169 return NULL;
170 }
171 return peer;
172}
173
174/* Utility function for looking up peer or peer group. */
paul94f2b392005-06-28 12:44:16 +0000175static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000176peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
paul718e3742002-12-13 20:15:29 +0000177{
178 int ret;
179 struct bgp *bgp;
180 union sockunion su;
181 struct peer *peer;
182 struct peer_group *group;
183
184 bgp = vty->index;
185
186 ret = str2sockunion (peer_str, &su);
187 if (ret == 0)
188 {
189 peer = peer_lookup (bgp, &su);
190 if (peer)
191 return peer;
192 }
193 else
194 {
195 group = peer_group_lookup (bgp, peer_str);
196 if (group)
197 return group->conf;
198 }
199
200 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
201 VTY_NEWLINE);
202
203 return NULL;
204}
205
paul94f2b392005-06-28 12:44:16 +0000206static int
paul718e3742002-12-13 20:15:29 +0000207bgp_vty_return (struct vty *vty, int ret)
208{
paulfd79ac92004-10-13 05:06:08 +0000209 const char *str = NULL;
paul718e3742002-12-13 20:15:29 +0000210
211 switch (ret)
212 {
213 case BGP_ERR_INVALID_VALUE:
214 str = "Invalid value";
215 break;
216 case BGP_ERR_INVALID_FLAG:
217 str = "Invalid flag";
218 break;
219 case BGP_ERR_PEER_INACTIVE:
220 str = "Activate the neighbor for the address family first";
221 break;
222 case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
223 str = "Invalid command for a peer-group member";
224 break;
225 case BGP_ERR_PEER_GROUP_SHUTDOWN:
226 str = "Peer-group has been shutdown. Activate the peer-group first";
227 break;
228 case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
229 str = "This peer is a peer-group member. Please change peer-group configuration";
230 break;
231 case BGP_ERR_PEER_FLAG_CONFLICT:
232 str = "Can't set override-capability and strict-capability-match at the same time";
233 break;
234 case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
235 str = "No activate for peergroup can be given only if peer-group has no members";
236 break;
237 case BGP_ERR_PEER_BELONGS_TO_GROUP:
238 str = "No activate for an individual peer-group member is invalid";
239 break;
240 case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
241 str = "Activate the peer-group for the address family first";
242 break;
243 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
244 str = "Specify remote-as or peer-group remote AS first";
245 break;
246 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
247 str = "Cannot change the peer-group. Deconfigure first";
248 break;
249 case BGP_ERR_PEER_GROUP_MISMATCH:
250 str = "Cannot have different peer-group for the neighbor";
251 break;
252 case BGP_ERR_PEER_FILTER_CONFLICT:
253 str = "Prefix/distribute list can not co-exist";
254 break;
255 case BGP_ERR_NOT_INTERNAL_PEER:
256 str = "Invalid command. Not an internal neighbor";
257 break;
258 case BGP_ERR_REMOVE_PRIVATE_AS:
259 str = "Private AS cannot be removed for IBGP peers";
260 break;
261 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
262 str = "Local-AS allowed only for EBGP peers";
263 break;
264 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
265 str = "Cannot have local-as same as BGP AS number";
266 break;
Paul Jakma0df7c912008-07-21 21:02:49 +0000267 case BGP_ERR_TCPSIG_FAILED:
268 str = "Error while applying TCP-Sig to session(s)";
269 break;
Nick Hilliardfa411a22011-03-23 15:33:17 +0000270 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
271 str = "ebgp-multihop and ttl-security cannot be configured together";
272 break;
Stephen Hemmingerf5a48272011-03-24 17:30:21 +0000273 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
274 str = "ttl-security only allowed for EBGP peers";
275 break;
paul718e3742002-12-13 20:15:29 +0000276 }
277 if (str)
278 {
279 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
280 return CMD_WARNING;
281 }
282 return CMD_SUCCESS;
283}
284
285/* BGP global configuration. */
286
287DEFUN (bgp_multiple_instance_func,
288 bgp_multiple_instance_cmd,
289 "bgp multiple-instance",
290 BGP_STR
291 "Enable bgp multiple instance\n")
292{
293 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
294 return CMD_SUCCESS;
295}
296
297DEFUN (no_bgp_multiple_instance,
298 no_bgp_multiple_instance_cmd,
299 "no bgp multiple-instance",
300 NO_STR
301 BGP_STR
302 "BGP multiple instance\n")
303{
304 int ret;
305
306 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
307 if (ret < 0)
308 {
309 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
310 return CMD_WARNING;
311 }
312 return CMD_SUCCESS;
313}
314
315DEFUN (bgp_config_type,
316 bgp_config_type_cmd,
317 "bgp config-type (cisco|zebra)",
318 BGP_STR
319 "Configuration type\n"
320 "cisco\n"
321 "zebra\n")
322{
323 if (strncmp (argv[0], "c", 1) == 0)
324 bgp_option_set (BGP_OPT_CONFIG_CISCO);
325 else
326 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
327
328 return CMD_SUCCESS;
329}
330
331DEFUN (no_bgp_config_type,
332 no_bgp_config_type_cmd,
333 "no bgp config-type",
334 NO_STR
335 BGP_STR
336 "Display configuration type\n")
337{
338 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
339 return CMD_SUCCESS;
340}
341
342DEFUN (no_synchronization,
343 no_synchronization_cmd,
344 "no synchronization",
345 NO_STR
346 "Perform IGP synchronization\n")
347{
348 return CMD_SUCCESS;
349}
350
351DEFUN (no_auto_summary,
352 no_auto_summary_cmd,
353 "no auto-summary",
354 NO_STR
355 "Enable automatic network number summarization\n")
356{
357 return CMD_SUCCESS;
358}
hasso3d515fd2005-02-01 21:30:04 +0000359
360DEFUN_DEPRECATED (neighbor_version,
361 neighbor_version_cmd,
362 NEIGHBOR_CMD "version (4|4-)",
363 NEIGHBOR_STR
364 NEIGHBOR_ADDR_STR
365 "Set the BGP version to match a neighbor\n"
366 "Neighbor's BGP version\n")
367{
368 return CMD_SUCCESS;
369}
David Lamparter6b0655a2014-06-04 06:53:35 +0200370
paul718e3742002-12-13 20:15:29 +0000371/* "router bgp" commands. */
372DEFUN (router_bgp,
373 router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000374 "router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000375 ROUTER_STR
376 BGP_STR
377 AS_STR)
378{
379 int ret;
380 as_t as;
381 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000382 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000383
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000384 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000385
386 if (argc == 2)
387 name = argv[1];
388
389 ret = bgp_get (&bgp, &as, name);
390 switch (ret)
391 {
392 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
393 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
394 VTY_NEWLINE);
395 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000396 case BGP_ERR_AS_MISMATCH:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400397 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000398 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000399 case BGP_ERR_INSTANCE_MISMATCH:
400 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400401 vty_out (vty, "BGP instance is already running; AS is %u%s",
paul718e3742002-12-13 20:15:29 +0000402 as, VTY_NEWLINE);
403 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000404 }
405
406 vty->node = BGP_NODE;
407 vty->index = bgp;
408
409 return CMD_SUCCESS;
410}
411
412ALIAS (router_bgp,
413 router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000414 "router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000415 ROUTER_STR
416 BGP_STR
417 AS_STR
418 "BGP view\n"
419 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200420
paul718e3742002-12-13 20:15:29 +0000421/* "no router bgp" commands. */
422DEFUN (no_router_bgp,
423 no_router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000424 "no router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000425 NO_STR
426 ROUTER_STR
427 BGP_STR
428 AS_STR)
429{
430 as_t as;
431 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000432 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000433
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000434 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000435
436 if (argc == 2)
437 name = argv[1];
438
439 /* Lookup bgp structure. */
440 bgp = bgp_lookup (as, name);
441 if (! bgp)
442 {
443 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
444 return CMD_WARNING;
445 }
446
447 bgp_delete (bgp);
448
449 return CMD_SUCCESS;
450}
451
452ALIAS (no_router_bgp,
453 no_router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000454 "no router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000455 NO_STR
456 ROUTER_STR
457 BGP_STR
458 AS_STR
459 "BGP view\n"
460 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200461
paul718e3742002-12-13 20:15:29 +0000462/* BGP router-id. */
463
464DEFUN (bgp_router_id,
465 bgp_router_id_cmd,
466 "bgp router-id A.B.C.D",
467 BGP_STR
468 "Override configured router identifier\n"
469 "Manually configured router identifier\n")
470{
471 int ret;
472 struct in_addr id;
473 struct bgp *bgp;
474
475 bgp = vty->index;
476
477 ret = inet_aton (argv[0], &id);
478 if (! ret)
479 {
480 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
481 return CMD_WARNING;
482 }
483
hasso18a6dce2004-10-03 18:18:34 +0000484 bgp->router_id_static = id;
paul718e3742002-12-13 20:15:29 +0000485 bgp_router_id_set (bgp, &id);
486
487 return CMD_SUCCESS;
488}
489
490DEFUN (no_bgp_router_id,
491 no_bgp_router_id_cmd,
492 "no bgp router-id",
493 NO_STR
494 BGP_STR
495 "Override configured router identifier\n")
496{
497 int ret;
498 struct in_addr id;
499 struct bgp *bgp;
500
501 bgp = vty->index;
502
503 if (argc == 1)
504 {
505 ret = inet_aton (argv[0], &id);
506 if (! ret)
507 {
508 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
509 return CMD_WARNING;
510 }
511
hasso18a6dce2004-10-03 18:18:34 +0000512 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
paul718e3742002-12-13 20:15:29 +0000513 {
514 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
515 return CMD_WARNING;
516 }
517 }
518
hasso18a6dce2004-10-03 18:18:34 +0000519 bgp->router_id_static.s_addr = 0;
520 bgp_router_id_set (bgp, &router_id_zebra);
paul718e3742002-12-13 20:15:29 +0000521
522 return CMD_SUCCESS;
523}
524
525ALIAS (no_bgp_router_id,
526 no_bgp_router_id_val_cmd,
527 "no bgp router-id A.B.C.D",
528 NO_STR
529 BGP_STR
530 "Override configured router identifier\n"
531 "Manually configured router identifier\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200532
paul718e3742002-12-13 20:15:29 +0000533/* BGP Cluster ID. */
534
535DEFUN (bgp_cluster_id,
536 bgp_cluster_id_cmd,
537 "bgp cluster-id A.B.C.D",
538 BGP_STR
539 "Configure Route-Reflector Cluster-id\n"
540 "Route-Reflector Cluster-id in IP address format\n")
541{
542 int ret;
543 struct bgp *bgp;
544 struct in_addr cluster;
545
546 bgp = vty->index;
547
548 ret = inet_aton (argv[0], &cluster);
549 if (! ret)
550 {
551 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
552 return CMD_WARNING;
553 }
554
555 bgp_cluster_id_set (bgp, &cluster);
556
557 return CMD_SUCCESS;
558}
559
560ALIAS (bgp_cluster_id,
561 bgp_cluster_id32_cmd,
562 "bgp cluster-id <1-4294967295>",
563 BGP_STR
564 "Configure Route-Reflector Cluster-id\n"
565 "Route-Reflector Cluster-id as 32 bit quantity\n")
566
567DEFUN (no_bgp_cluster_id,
568 no_bgp_cluster_id_cmd,
569 "no bgp cluster-id",
570 NO_STR
571 BGP_STR
572 "Configure Route-Reflector Cluster-id\n")
573{
574 int ret;
575 struct bgp *bgp;
576 struct in_addr cluster;
577
578 bgp = vty->index;
579
580 if (argc == 1)
581 {
582 ret = inet_aton (argv[0], &cluster);
583 if (! ret)
584 {
585 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
586 return CMD_WARNING;
587 }
588 }
589
590 bgp_cluster_id_unset (bgp);
591
592 return CMD_SUCCESS;
593}
594
595ALIAS (no_bgp_cluster_id,
596 no_bgp_cluster_id_arg_cmd,
597 "no bgp cluster-id A.B.C.D",
598 NO_STR
599 BGP_STR
600 "Configure Route-Reflector Cluster-id\n"
601 "Route-Reflector Cluster-id in IP address format\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200602
paul718e3742002-12-13 20:15:29 +0000603DEFUN (bgp_confederation_identifier,
604 bgp_confederation_identifier_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000605 "bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000606 "BGP specific commands\n"
607 "AS confederation parameters\n"
608 "AS number\n"
609 "Set routing domain confederation AS\n")
610{
611 struct bgp *bgp;
612 as_t as;
613
614 bgp = vty->index;
615
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000616 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000617
618 bgp_confederation_id_set (bgp, as);
619
620 return CMD_SUCCESS;
621}
622
623DEFUN (no_bgp_confederation_identifier,
624 no_bgp_confederation_identifier_cmd,
625 "no bgp confederation identifier",
626 NO_STR
627 "BGP specific commands\n"
628 "AS confederation parameters\n"
629 "AS number\n")
630{
631 struct bgp *bgp;
Paul Jakma7aa9dce2014-09-19 14:42:23 +0100632 as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */
paul718e3742002-12-13 20:15:29 +0000633
634 bgp = vty->index;
635
636 if (argc == 1)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000637 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000638
639 bgp_confederation_id_unset (bgp);
640
641 return CMD_SUCCESS;
642}
643
644ALIAS (no_bgp_confederation_identifier,
645 no_bgp_confederation_identifier_arg_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000646 "no bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000647 NO_STR
648 "BGP specific commands\n"
649 "AS confederation parameters\n"
650 "AS number\n"
651 "Set routing domain confederation AS\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200652
paul718e3742002-12-13 20:15:29 +0000653DEFUN (bgp_confederation_peers,
654 bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000655 "bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000656 "BGP specific commands\n"
657 "AS confederation parameters\n"
658 "Peer ASs in BGP confederation\n"
659 AS_STR)
660{
661 struct bgp *bgp;
662 as_t as;
663 int i;
664
665 bgp = vty->index;
666
667 for (i = 0; i < argc; i++)
668 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000669 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000670
671 if (bgp->as == as)
672 {
673 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
674 VTY_NEWLINE);
675 continue;
676 }
677
678 bgp_confederation_peers_add (bgp, as);
679 }
680 return CMD_SUCCESS;
681}
682
683DEFUN (no_bgp_confederation_peers,
684 no_bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000685 "no bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000686 NO_STR
687 "BGP specific commands\n"
688 "AS confederation parameters\n"
689 "Peer ASs in BGP confederation\n"
690 AS_STR)
691{
692 struct bgp *bgp;
693 as_t as;
694 int i;
695
696 bgp = vty->index;
697
698 for (i = 0; i < argc; i++)
699 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000700 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
701
paul718e3742002-12-13 20:15:29 +0000702 bgp_confederation_peers_remove (bgp, as);
703 }
704 return CMD_SUCCESS;
705}
David Lamparter6b0655a2014-06-04 06:53:35 +0200706
Josh Bailey165b5ff2011-07-20 20:43:22 -0700707/* Maximum-paths configuration */
708DEFUN (bgp_maxpaths,
709 bgp_maxpaths_cmd,
710 "maximum-paths <1-255>",
711 "Forward packets over multiple paths\n"
712 "Number of paths\n")
713{
714 struct bgp *bgp;
715 u_int16_t maxpaths;
716 int ret;
717
718 bgp = vty->index;
719
720 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
721
722 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
723 BGP_PEER_EBGP, maxpaths);
724 if (ret < 0)
725 {
726 vty_out (vty,
727 "%% Failed to set maximum-paths %u for afi %u, safi %u%s",
728 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
729 return CMD_WARNING;
730 }
731
Donald Sharp58a83f22015-09-11 10:11:42 -0400732 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
733 vty_out (vty,
734 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
735 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
736
Josh Bailey165b5ff2011-07-20 20:43:22 -0700737 return CMD_SUCCESS;
738}
739
740DEFUN (bgp_maxpaths_ibgp,
741 bgp_maxpaths_ibgp_cmd,
742 "maximum-paths ibgp <1-255>",
743 "Forward packets over multiple paths\n"
744 "iBGP-multipath\n"
745 "Number of paths\n")
746{
747 struct bgp *bgp;
748 u_int16_t maxpaths;
749 int ret;
750
751 bgp = vty->index;
752
753 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
754
755 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
756 BGP_PEER_IBGP, maxpaths);
757 if (ret < 0)
758 {
759 vty_out (vty,
760 "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
761 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
762 return CMD_WARNING;
763 }
764
Donald Sharp58a83f22015-09-11 10:11:42 -0400765 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
766 vty_out (vty,
767 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
768 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
769
Josh Bailey165b5ff2011-07-20 20:43:22 -0700770 return CMD_SUCCESS;
771}
772
773DEFUN (no_bgp_maxpaths,
774 no_bgp_maxpaths_cmd,
775 "no maximum-paths",
776 NO_STR
777 "Forward packets over multiple paths\n"
778 "Number of paths\n")
779{
780 struct bgp *bgp;
781 int ret;
782
783 bgp = vty->index;
784
785 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
786 BGP_PEER_EBGP);
787 if (ret < 0)
788 {
789 vty_out (vty,
790 "%% Failed to unset maximum-paths for afi %u, safi %u%s",
791 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
792 return CMD_WARNING;
793 }
794
795 return CMD_SUCCESS;
796}
797
798ALIAS (no_bgp_maxpaths,
799 no_bgp_maxpaths_arg_cmd,
800 "no maximum-paths <1-255>",
801 NO_STR
802 "Forward packets over multiple paths\n"
803 "Number of paths\n")
804
805DEFUN (no_bgp_maxpaths_ibgp,
806 no_bgp_maxpaths_ibgp_cmd,
807 "no maximum-paths ibgp",
808 NO_STR
809 "Forward packets over multiple paths\n"
810 "iBGP-multipath\n"
811 "Number of paths\n")
812{
813 struct bgp *bgp;
814 int ret;
815
816 bgp = vty->index;
817
818 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
819 BGP_PEER_IBGP);
820 if (ret < 0)
821 {
822 vty_out (vty,
823 "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
824 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
825 return CMD_WARNING;
826 }
827
828 return CMD_SUCCESS;
829}
830
831ALIAS (no_bgp_maxpaths_ibgp,
832 no_bgp_maxpaths_ibgp_arg_cmd,
833 "no maximum-paths ibgp <1-255>",
834 NO_STR
835 "Forward packets over multiple paths\n"
836 "iBGP-multipath\n"
837 "Number of paths\n")
838
839int
840bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
841 safi_t safi, int *write)
842{
843 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
844 {
845 bgp_config_write_family_header (vty, afi, safi, write);
846 vty_out (vty, " maximum-paths %d%s",
847 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
848 }
849
850 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
851 {
852 bgp_config_write_family_header (vty, afi, safi, write);
853 vty_out (vty, " maximum-paths ibgp %d%s",
854 bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
855 }
856
857 return 0;
858}
David Lamparter6b0655a2014-06-04 06:53:35 +0200859
paul718e3742002-12-13 20:15:29 +0000860/* BGP timers. */
861
862DEFUN (bgp_timers,
863 bgp_timers_cmd,
864 "timers bgp <0-65535> <0-65535>",
865 "Adjust routing timers\n"
866 "BGP timers\n"
867 "Keepalive interval\n"
868 "Holdtime\n")
869{
870 struct bgp *bgp;
871 unsigned long keepalive = 0;
872 unsigned long holdtime = 0;
873
874 bgp = vty->index;
875
876 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
877 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
878
879 /* Holdtime value check. */
880 if (holdtime < 3 && holdtime != 0)
881 {
882 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
883 VTY_NEWLINE);
884 return CMD_WARNING;
885 }
886
887 bgp_timers_set (bgp, keepalive, holdtime);
888
889 return CMD_SUCCESS;
890}
891
892DEFUN (no_bgp_timers,
893 no_bgp_timers_cmd,
894 "no timers bgp",
895 NO_STR
896 "Adjust routing timers\n"
897 "BGP timers\n")
898{
899 struct bgp *bgp;
900
901 bgp = vty->index;
902 bgp_timers_unset (bgp);
903
904 return CMD_SUCCESS;
905}
906
907ALIAS (no_bgp_timers,
908 no_bgp_timers_arg_cmd,
909 "no timers bgp <0-65535> <0-65535>",
910 NO_STR
911 "Adjust routing timers\n"
912 "BGP timers\n"
913 "Keepalive interval\n"
914 "Holdtime\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200915
paul718e3742002-12-13 20:15:29 +0000916DEFUN (bgp_client_to_client_reflection,
917 bgp_client_to_client_reflection_cmd,
918 "bgp client-to-client reflection",
919 "BGP specific commands\n"
920 "Configure client to client route reflection\n"
921 "reflection of routes allowed\n")
922{
923 struct bgp *bgp;
924
925 bgp = vty->index;
926 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
927 return CMD_SUCCESS;
928}
929
930DEFUN (no_bgp_client_to_client_reflection,
931 no_bgp_client_to_client_reflection_cmd,
932 "no bgp client-to-client reflection",
933 NO_STR
934 "BGP specific commands\n"
935 "Configure client to client route reflection\n"
936 "reflection of routes allowed\n")
937{
938 struct bgp *bgp;
939
940 bgp = vty->index;
941 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
942 return CMD_SUCCESS;
943}
944
945/* "bgp always-compare-med" configuration. */
946DEFUN (bgp_always_compare_med,
947 bgp_always_compare_med_cmd,
948 "bgp always-compare-med",
949 "BGP specific commands\n"
950 "Allow comparing MED from different neighbors\n")
951{
952 struct bgp *bgp;
953
954 bgp = vty->index;
955 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
956 return CMD_SUCCESS;
957}
958
959DEFUN (no_bgp_always_compare_med,
960 no_bgp_always_compare_med_cmd,
961 "no bgp always-compare-med",
962 NO_STR
963 "BGP specific commands\n"
964 "Allow comparing MED from different neighbors\n")
965{
966 struct bgp *bgp;
967
968 bgp = vty->index;
969 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
970 return CMD_SUCCESS;
971}
David Lamparter6b0655a2014-06-04 06:53:35 +0200972
paul718e3742002-12-13 20:15:29 +0000973/* "bgp deterministic-med" configuration. */
974DEFUN (bgp_deterministic_med,
975 bgp_deterministic_med_cmd,
976 "bgp deterministic-med",
977 "BGP specific commands\n"
978 "Pick the best-MED path among paths advertised from the neighboring AS\n")
979{
980 struct bgp *bgp;
981
982 bgp = vty->index;
983 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
984 return CMD_SUCCESS;
985}
986
987DEFUN (no_bgp_deterministic_med,
988 no_bgp_deterministic_med_cmd,
989 "no bgp deterministic-med",
990 NO_STR
991 "BGP specific commands\n"
992 "Pick the best-MED path among paths advertised from the neighboring AS\n")
993{
994 struct bgp *bgp;
995
996 bgp = vty->index;
997 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
998 return CMD_SUCCESS;
999}
hasso538621f2004-05-21 09:31:30 +00001000
1001/* "bgp graceful-restart" configuration. */
1002DEFUN (bgp_graceful_restart,
1003 bgp_graceful_restart_cmd,
1004 "bgp graceful-restart",
1005 "BGP specific commands\n"
1006 "Graceful restart capability parameters\n")
1007{
1008 struct bgp *bgp;
1009
1010 bgp = vty->index;
1011 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
1012 return CMD_SUCCESS;
1013}
1014
1015DEFUN (no_bgp_graceful_restart,
1016 no_bgp_graceful_restart_cmd,
1017 "no bgp graceful-restart",
1018 NO_STR
1019 "BGP specific commands\n"
1020 "Graceful restart capability parameters\n")
1021{
1022 struct bgp *bgp;
1023
1024 bgp = vty->index;
1025 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
1026 return CMD_SUCCESS;
1027}
1028
hasso93406d82005-02-02 14:40:33 +00001029DEFUN (bgp_graceful_restart_stalepath_time,
1030 bgp_graceful_restart_stalepath_time_cmd,
1031 "bgp graceful-restart stalepath-time <1-3600>",
1032 "BGP specific commands\n"
1033 "Graceful restart capability parameters\n"
1034 "Set the max time to hold onto restarting peer's stale paths\n"
1035 "Delay value (seconds)\n")
1036{
1037 struct bgp *bgp;
1038 u_int32_t stalepath;
1039
1040 bgp = vty->index;
1041 if (! bgp)
1042 return CMD_WARNING;
1043
1044 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
1045 bgp->stalepath_time = stalepath;
1046 return CMD_SUCCESS;
1047}
1048
1049DEFUN (no_bgp_graceful_restart_stalepath_time,
1050 no_bgp_graceful_restart_stalepath_time_cmd,
1051 "no bgp graceful-restart stalepath-time",
1052 NO_STR
1053 "BGP specific commands\n"
1054 "Graceful restart capability parameters\n"
1055 "Set the max time to hold onto restarting peer's stale paths\n")
1056{
1057 struct bgp *bgp;
1058
1059 bgp = vty->index;
1060 if (! bgp)
1061 return CMD_WARNING;
1062
1063 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1064 return CMD_SUCCESS;
1065}
1066
1067ALIAS (no_bgp_graceful_restart_stalepath_time,
1068 no_bgp_graceful_restart_stalepath_time_val_cmd,
1069 "no bgp graceful-restart stalepath-time <1-3600>",
1070 NO_STR
1071 "BGP specific commands\n"
1072 "Graceful restart capability parameters\n"
1073 "Set the max time to hold onto restarting peer's stale paths\n"
1074 "Delay value (seconds)\n")
1075
paul718e3742002-12-13 20:15:29 +00001076/* "bgp fast-external-failover" configuration. */
1077DEFUN (bgp_fast_external_failover,
1078 bgp_fast_external_failover_cmd,
1079 "bgp fast-external-failover",
1080 BGP_STR
1081 "Immediately reset session if a link to a directly connected external peer goes down\n")
1082{
1083 struct bgp *bgp;
1084
1085 bgp = vty->index;
1086 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1087 return CMD_SUCCESS;
1088}
1089
1090DEFUN (no_bgp_fast_external_failover,
1091 no_bgp_fast_external_failover_cmd,
1092 "no bgp fast-external-failover",
1093 NO_STR
1094 BGP_STR
1095 "Immediately reset session if a link to a directly connected external peer goes down\n")
1096{
1097 struct bgp *bgp;
1098
1099 bgp = vty->index;
1100 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1101 return CMD_SUCCESS;
1102}
David Lamparter6b0655a2014-06-04 06:53:35 +02001103
paul718e3742002-12-13 20:15:29 +00001104/* "bgp enforce-first-as" configuration. */
1105DEFUN (bgp_enforce_first_as,
1106 bgp_enforce_first_as_cmd,
1107 "bgp enforce-first-as",
1108 BGP_STR
1109 "Enforce the first AS for EBGP routes\n")
1110{
1111 struct bgp *bgp;
1112
1113 bgp = vty->index;
1114 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1115 return CMD_SUCCESS;
1116}
1117
1118DEFUN (no_bgp_enforce_first_as,
1119 no_bgp_enforce_first_as_cmd,
1120 "no bgp enforce-first-as",
1121 NO_STR
1122 BGP_STR
1123 "Enforce the first AS for EBGP routes\n")
1124{
1125 struct bgp *bgp;
1126
1127 bgp = vty->index;
1128 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1129 return CMD_SUCCESS;
1130}
David Lamparter6b0655a2014-06-04 06:53:35 +02001131
paul718e3742002-12-13 20:15:29 +00001132/* "bgp bestpath compare-routerid" configuration. */
1133DEFUN (bgp_bestpath_compare_router_id,
1134 bgp_bestpath_compare_router_id_cmd,
1135 "bgp bestpath compare-routerid",
1136 "BGP specific commands\n"
1137 "Change the default bestpath selection\n"
1138 "Compare router-id for identical EBGP paths\n")
1139{
1140 struct bgp *bgp;
1141
1142 bgp = vty->index;
1143 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1144 return CMD_SUCCESS;
1145}
1146
1147DEFUN (no_bgp_bestpath_compare_router_id,
1148 no_bgp_bestpath_compare_router_id_cmd,
1149 "no bgp bestpath compare-routerid",
1150 NO_STR
1151 "BGP specific commands\n"
1152 "Change the default bestpath selection\n"
1153 "Compare router-id for identical EBGP paths\n")
1154{
1155 struct bgp *bgp;
1156
1157 bgp = vty->index;
1158 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1159 return CMD_SUCCESS;
1160}
David Lamparter6b0655a2014-06-04 06:53:35 +02001161
paul718e3742002-12-13 20:15:29 +00001162/* "bgp bestpath as-path ignore" configuration. */
1163DEFUN (bgp_bestpath_aspath_ignore,
1164 bgp_bestpath_aspath_ignore_cmd,
1165 "bgp bestpath as-path ignore",
1166 "BGP specific commands\n"
1167 "Change the default bestpath selection\n"
1168 "AS-path attribute\n"
1169 "Ignore as-path length in selecting a route\n")
1170{
1171 struct bgp *bgp;
1172
1173 bgp = vty->index;
1174 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
1175 return CMD_SUCCESS;
1176}
1177
1178DEFUN (no_bgp_bestpath_aspath_ignore,
1179 no_bgp_bestpath_aspath_ignore_cmd,
1180 "no bgp bestpath as-path ignore",
1181 NO_STR
1182 "BGP specific commands\n"
1183 "Change the default bestpath selection\n"
1184 "AS-path attribute\n"
1185 "Ignore as-path length in selecting a route\n")
1186{
1187 struct bgp *bgp;
1188
1189 bgp = vty->index;
1190 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1191 return CMD_SUCCESS;
1192}
David Lamparter6b0655a2014-06-04 06:53:35 +02001193
hasso68118452005-04-08 15:40:36 +00001194/* "bgp bestpath as-path confed" configuration. */
1195DEFUN (bgp_bestpath_aspath_confed,
1196 bgp_bestpath_aspath_confed_cmd,
1197 "bgp bestpath as-path confed",
1198 "BGP specific commands\n"
1199 "Change the default bestpath selection\n"
1200 "AS-path attribute\n"
1201 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1202{
1203 struct bgp *bgp;
1204
1205 bgp = vty->index;
1206 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1207 return CMD_SUCCESS;
1208}
1209
1210DEFUN (no_bgp_bestpath_aspath_confed,
1211 no_bgp_bestpath_aspath_confed_cmd,
1212 "no bgp bestpath as-path confed",
1213 NO_STR
1214 "BGP specific commands\n"
1215 "Change the default bestpath selection\n"
1216 "AS-path attribute\n"
1217 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1218{
1219 struct bgp *bgp;
1220
1221 bgp = vty->index;
1222 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1223 return CMD_SUCCESS;
1224}
David Lamparter6b0655a2014-06-04 06:53:35 +02001225
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00001226/* "bgp bestpath as-path multipath-relax" configuration. */
1227DEFUN (bgp_bestpath_aspath_multipath_relax,
1228 bgp_bestpath_aspath_multipath_relax_cmd,
1229 "bgp bestpath as-path multipath-relax",
1230 "BGP specific commands\n"
1231 "Change the default bestpath selection\n"
1232 "AS-path attribute\n"
1233 "Allow load sharing across routes that have different AS paths (but same length)\n")
1234{
1235 struct bgp *bgp;
1236
1237 bgp = vty->index;
1238 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1239 return CMD_SUCCESS;
1240}
1241
1242DEFUN (no_bgp_bestpath_aspath_multipath_relax,
1243 no_bgp_bestpath_aspath_multipath_relax_cmd,
1244 "no bgp bestpath as-path multipath-relax",
1245 NO_STR
1246 "BGP specific commands\n"
1247 "Change the default bestpath selection\n"
1248 "AS-path attribute\n"
1249 "Allow load sharing across routes that have different AS paths (but same length)\n")
1250{
1251 struct bgp *bgp;
1252
1253 bgp = vty->index;
1254 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1255 return CMD_SUCCESS;
1256}
David Lamparter6b0655a2014-06-04 06:53:35 +02001257
paul848973c2003-08-13 00:32:49 +00001258/* "bgp log-neighbor-changes" configuration. */
1259DEFUN (bgp_log_neighbor_changes,
1260 bgp_log_neighbor_changes_cmd,
1261 "bgp log-neighbor-changes",
1262 "BGP specific commands\n"
1263 "Log neighbor up/down and reset reason\n")
1264{
1265 struct bgp *bgp;
1266
1267 bgp = vty->index;
1268 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1269 return CMD_SUCCESS;
1270}
1271
1272DEFUN (no_bgp_log_neighbor_changes,
1273 no_bgp_log_neighbor_changes_cmd,
1274 "no bgp log-neighbor-changes",
1275 NO_STR
1276 "BGP specific commands\n"
1277 "Log neighbor up/down and reset reason\n")
1278{
1279 struct bgp *bgp;
1280
1281 bgp = vty->index;
1282 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1283 return CMD_SUCCESS;
1284}
David Lamparter6b0655a2014-06-04 06:53:35 +02001285
paul718e3742002-12-13 20:15:29 +00001286/* "bgp bestpath med" configuration. */
1287DEFUN (bgp_bestpath_med,
1288 bgp_bestpath_med_cmd,
1289 "bgp bestpath med (confed|missing-as-worst)",
1290 "BGP specific commands\n"
1291 "Change the default bestpath selection\n"
1292 "MED attribute\n"
1293 "Compare MED among confederation paths\n"
1294 "Treat missing MED as the least preferred one\n")
1295{
1296 struct bgp *bgp;
1297
1298 bgp = vty->index;
1299
1300 if (strncmp (argv[0], "confed", 1) == 0)
1301 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1302 else
1303 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1304
1305 return CMD_SUCCESS;
1306}
1307
1308DEFUN (bgp_bestpath_med2,
1309 bgp_bestpath_med2_cmd,
1310 "bgp bestpath med confed missing-as-worst",
1311 "BGP specific commands\n"
1312 "Change the default bestpath selection\n"
1313 "MED attribute\n"
1314 "Compare MED among confederation paths\n"
1315 "Treat missing MED as the least preferred one\n")
1316{
1317 struct bgp *bgp;
1318
1319 bgp = vty->index;
1320 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1321 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1322 return CMD_SUCCESS;
1323}
1324
1325ALIAS (bgp_bestpath_med2,
1326 bgp_bestpath_med3_cmd,
1327 "bgp bestpath med missing-as-worst confed",
1328 "BGP specific commands\n"
1329 "Change the default bestpath selection\n"
1330 "MED attribute\n"
1331 "Treat missing MED as the least preferred one\n"
1332 "Compare MED among confederation paths\n")
1333
1334DEFUN (no_bgp_bestpath_med,
1335 no_bgp_bestpath_med_cmd,
1336 "no bgp bestpath med (confed|missing-as-worst)",
1337 NO_STR
1338 "BGP specific commands\n"
1339 "Change the default bestpath selection\n"
1340 "MED attribute\n"
1341 "Compare MED among confederation paths\n"
1342 "Treat missing MED as the least preferred one\n")
1343{
1344 struct bgp *bgp;
1345
1346 bgp = vty->index;
1347
1348 if (strncmp (argv[0], "confed", 1) == 0)
1349 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1350 else
1351 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1352
1353 return CMD_SUCCESS;
1354}
1355
1356DEFUN (no_bgp_bestpath_med2,
1357 no_bgp_bestpath_med2_cmd,
1358 "no bgp bestpath med confed missing-as-worst",
1359 NO_STR
1360 "BGP specific commands\n"
1361 "Change the default bestpath selection\n"
1362 "MED attribute\n"
1363 "Compare MED among confederation paths\n"
1364 "Treat missing MED as the least preferred one\n")
1365{
1366 struct bgp *bgp;
1367
1368 bgp = vty->index;
1369 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1370 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1371 return CMD_SUCCESS;
1372}
1373
1374ALIAS (no_bgp_bestpath_med2,
1375 no_bgp_bestpath_med3_cmd,
1376 "no bgp bestpath med missing-as-worst confed",
1377 NO_STR
1378 "BGP specific commands\n"
1379 "Change the default bestpath selection\n"
1380 "MED attribute\n"
1381 "Treat missing MED as the least preferred one\n"
1382 "Compare MED among confederation paths\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001383
paul718e3742002-12-13 20:15:29 +00001384/* "no bgp default ipv4-unicast". */
1385DEFUN (no_bgp_default_ipv4_unicast,
1386 no_bgp_default_ipv4_unicast_cmd,
1387 "no bgp default ipv4-unicast",
1388 NO_STR
1389 "BGP specific commands\n"
1390 "Configure BGP defaults\n"
1391 "Activate ipv4-unicast for a peer by default\n")
1392{
1393 struct bgp *bgp;
1394
1395 bgp = vty->index;
1396 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1397 return CMD_SUCCESS;
1398}
1399
1400DEFUN (bgp_default_ipv4_unicast,
1401 bgp_default_ipv4_unicast_cmd,
1402 "bgp default ipv4-unicast",
1403 "BGP specific commands\n"
1404 "Configure BGP defaults\n"
1405 "Activate ipv4-unicast for a peer by default\n")
1406{
1407 struct bgp *bgp;
1408
1409 bgp = vty->index;
1410 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1411 return CMD_SUCCESS;
1412}
David Lamparter6b0655a2014-06-04 06:53:35 +02001413
paul718e3742002-12-13 20:15:29 +00001414/* "bgp import-check" configuration. */
1415DEFUN (bgp_network_import_check,
1416 bgp_network_import_check_cmd,
1417 "bgp network import-check",
1418 "BGP specific commands\n"
1419 "BGP network command\n"
1420 "Check BGP network route exists in IGP\n")
1421{
1422 struct bgp *bgp;
1423
1424 bgp = vty->index;
1425 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1426 return CMD_SUCCESS;
1427}
1428
1429DEFUN (no_bgp_network_import_check,
1430 no_bgp_network_import_check_cmd,
1431 "no bgp network import-check",
1432 NO_STR
1433 "BGP specific commands\n"
1434 "BGP network command\n"
1435 "Check BGP network route exists in IGP\n")
1436{
1437 struct bgp *bgp;
1438
1439 bgp = vty->index;
1440 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1441 return CMD_SUCCESS;
1442}
David Lamparter6b0655a2014-06-04 06:53:35 +02001443
paul718e3742002-12-13 20:15:29 +00001444DEFUN (bgp_default_local_preference,
1445 bgp_default_local_preference_cmd,
1446 "bgp default local-preference <0-4294967295>",
1447 "BGP specific commands\n"
1448 "Configure BGP defaults\n"
1449 "local preference (higher=more preferred)\n"
1450 "Configure default local preference value\n")
1451{
1452 struct bgp *bgp;
1453 u_int32_t local_pref;
1454
1455 bgp = vty->index;
1456
1457 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1458
1459 bgp_default_local_preference_set (bgp, local_pref);
1460
1461 return CMD_SUCCESS;
1462}
1463
1464DEFUN (no_bgp_default_local_preference,
1465 no_bgp_default_local_preference_cmd,
1466 "no bgp default local-preference",
1467 NO_STR
1468 "BGP specific commands\n"
1469 "Configure BGP defaults\n"
1470 "local preference (higher=more preferred)\n")
1471{
1472 struct bgp *bgp;
1473
1474 bgp = vty->index;
1475 bgp_default_local_preference_unset (bgp);
1476 return CMD_SUCCESS;
1477}
1478
1479ALIAS (no_bgp_default_local_preference,
1480 no_bgp_default_local_preference_val_cmd,
1481 "no bgp default local-preference <0-4294967295>",
1482 NO_STR
1483 "BGP specific commands\n"
1484 "Configure BGP defaults\n"
1485 "local preference (higher=more preferred)\n"
1486 "Configure default local preference value\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001487
paul718e3742002-12-13 20:15:29 +00001488static int
paulfd79ac92004-10-13 05:06:08 +00001489peer_remote_as_vty (struct vty *vty, const char *peer_str,
1490 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001491{
1492 int ret;
1493 struct bgp *bgp;
1494 as_t as;
1495 union sockunion su;
1496
1497 bgp = vty->index;
1498
1499 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001500 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001501
1502 /* If peer is peer group, call proper function. */
1503 ret = str2sockunion (peer_str, &su);
1504 if (ret < 0)
1505 {
1506 ret = peer_group_remote_as (bgp, peer_str, &as);
1507 if (ret < 0)
1508 {
1509 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1510 return CMD_WARNING;
1511 }
1512 return CMD_SUCCESS;
1513 }
1514
1515 if (peer_address_self_check (&su))
1516 {
1517 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1518 VTY_NEWLINE);
1519 return CMD_WARNING;
1520 }
1521
1522 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1523
1524 /* This peer belongs to peer group. */
1525 switch (ret)
1526 {
1527 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001528 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001529 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001530 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001531 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 +00001532 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001533 }
1534 return bgp_vty_return (vty, ret);
1535}
1536
1537DEFUN (neighbor_remote_as,
1538 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001539 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001540 NEIGHBOR_STR
1541 NEIGHBOR_ADDR_STR2
1542 "Specify a BGP neighbor\n"
1543 AS_STR)
1544{
1545 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1546}
David Lamparter6b0655a2014-06-04 06:53:35 +02001547
paul718e3742002-12-13 20:15:29 +00001548DEFUN (neighbor_peer_group,
1549 neighbor_peer_group_cmd,
1550 "neighbor WORD peer-group",
1551 NEIGHBOR_STR
1552 "Neighbor tag\n"
1553 "Configure peer-group\n")
1554{
1555 struct bgp *bgp;
1556 struct peer_group *group;
1557
1558 bgp = vty->index;
1559
1560 group = peer_group_get (bgp, argv[0]);
1561 if (! group)
1562 return CMD_WARNING;
1563
1564 return CMD_SUCCESS;
1565}
1566
1567DEFUN (no_neighbor,
1568 no_neighbor_cmd,
1569 NO_NEIGHBOR_CMD2,
1570 NO_STR
1571 NEIGHBOR_STR
1572 NEIGHBOR_ADDR_STR2)
1573{
1574 int ret;
1575 union sockunion su;
1576 struct peer_group *group;
1577 struct peer *peer;
1578
1579 ret = str2sockunion (argv[0], &su);
1580 if (ret < 0)
1581 {
1582 group = peer_group_lookup (vty->index, argv[0]);
1583 if (group)
1584 peer_group_delete (group);
1585 else
1586 {
1587 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1588 return CMD_WARNING;
1589 }
1590 }
1591 else
1592 {
1593 peer = peer_lookup (vty->index, &su);
1594 if (peer)
paul200df112005-06-01 11:17:05 +00001595 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001596 }
1597
1598 return CMD_SUCCESS;
1599}
1600
1601ALIAS (no_neighbor,
1602 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001603 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001604 NO_STR
1605 NEIGHBOR_STR
1606 NEIGHBOR_ADDR_STR
1607 "Specify a BGP neighbor\n"
1608 AS_STR)
1609
1610DEFUN (no_neighbor_peer_group,
1611 no_neighbor_peer_group_cmd,
1612 "no neighbor WORD peer-group",
1613 NO_STR
1614 NEIGHBOR_STR
1615 "Neighbor tag\n"
1616 "Configure peer-group\n")
1617{
1618 struct peer_group *group;
1619
1620 group = peer_group_lookup (vty->index, argv[0]);
1621 if (group)
1622 peer_group_delete (group);
1623 else
1624 {
1625 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1626 return CMD_WARNING;
1627 }
1628 return CMD_SUCCESS;
1629}
1630
1631DEFUN (no_neighbor_peer_group_remote_as,
1632 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001633 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001634 NO_STR
1635 NEIGHBOR_STR
1636 "Neighbor tag\n"
1637 "Specify a BGP neighbor\n"
1638 AS_STR)
1639{
1640 struct peer_group *group;
1641
1642 group = peer_group_lookup (vty->index, argv[0]);
1643 if (group)
1644 peer_group_remote_as_delete (group);
1645 else
1646 {
1647 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1648 return CMD_WARNING;
1649 }
1650 return CMD_SUCCESS;
1651}
David Lamparter6b0655a2014-06-04 06:53:35 +02001652
paul718e3742002-12-13 20:15:29 +00001653DEFUN (neighbor_local_as,
1654 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001655 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001656 NEIGHBOR_STR
1657 NEIGHBOR_ADDR_STR2
1658 "Specify a local-as number\n"
1659 "AS number used as local AS\n")
1660{
1661 struct peer *peer;
1662 int ret;
1663
1664 peer = peer_and_group_lookup_vty (vty, argv[0]);
1665 if (! peer)
1666 return CMD_WARNING;
1667
Andrew Certain9d3f9702012-11-07 23:50:07 +00001668 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
paul718e3742002-12-13 20:15:29 +00001669 return bgp_vty_return (vty, ret);
1670}
1671
1672DEFUN (neighbor_local_as_no_prepend,
1673 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001674 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001675 NEIGHBOR_STR
1676 NEIGHBOR_ADDR_STR2
1677 "Specify a local-as number\n"
1678 "AS number used as local AS\n"
1679 "Do not prepend local-as to updates from ebgp peers\n")
1680{
1681 struct peer *peer;
1682 int ret;
1683
1684 peer = peer_and_group_lookup_vty (vty, argv[0]);
1685 if (! peer)
1686 return CMD_WARNING;
1687
Andrew Certain9d3f9702012-11-07 23:50:07 +00001688 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
paul718e3742002-12-13 20:15:29 +00001689 return bgp_vty_return (vty, ret);
1690}
1691
Andrew Certain9d3f9702012-11-07 23:50:07 +00001692DEFUN (neighbor_local_as_no_prepend_replace_as,
1693 neighbor_local_as_no_prepend_replace_as_cmd,
1694 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1695 NEIGHBOR_STR
1696 NEIGHBOR_ADDR_STR2
1697 "Specify a local-as number\n"
1698 "AS number used as local AS\n"
1699 "Do not prepend local-as to updates from ebgp peers\n"
1700 "Do not prepend local-as to updates from ibgp peers\n")
1701{
1702 struct peer *peer;
1703 int ret;
1704
1705 peer = peer_and_group_lookup_vty (vty, argv[0]);
1706 if (! peer)
1707 return CMD_WARNING;
1708
1709 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
1710 return bgp_vty_return (vty, ret);
1711}
1712
1713
paul718e3742002-12-13 20:15:29 +00001714DEFUN (no_neighbor_local_as,
1715 no_neighbor_local_as_cmd,
1716 NO_NEIGHBOR_CMD2 "local-as",
1717 NO_STR
1718 NEIGHBOR_STR
1719 NEIGHBOR_ADDR_STR2
1720 "Specify a local-as number\n")
1721{
1722 struct peer *peer;
1723 int ret;
1724
1725 peer = peer_and_group_lookup_vty (vty, argv[0]);
1726 if (! peer)
1727 return CMD_WARNING;
1728
1729 ret = peer_local_as_unset (peer);
1730 return bgp_vty_return (vty, ret);
1731}
1732
1733ALIAS (no_neighbor_local_as,
1734 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001735 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001736 NO_STR
1737 NEIGHBOR_STR
1738 NEIGHBOR_ADDR_STR2
1739 "Specify a local-as number\n"
1740 "AS number used as local AS\n")
1741
1742ALIAS (no_neighbor_local_as,
1743 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001744 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001745 NO_STR
1746 NEIGHBOR_STR
1747 NEIGHBOR_ADDR_STR2
1748 "Specify a local-as number\n"
1749 "AS number used as local AS\n"
1750 "Do not prepend local-as to updates from ebgp peers\n")
Andrew Certain9d3f9702012-11-07 23:50:07 +00001751
1752ALIAS (no_neighbor_local_as,
1753 no_neighbor_local_as_val3_cmd,
1754 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1755 NO_STR
1756 NEIGHBOR_STR
1757 NEIGHBOR_ADDR_STR2
1758 "Specify a local-as number\n"
1759 "AS number used as local AS\n"
1760 "Do not prepend local-as to updates from ebgp peers\n"
1761 "Do not prepend local-as to updates from ibgp peers\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001762
Paul Jakma0df7c912008-07-21 21:02:49 +00001763DEFUN (neighbor_password,
1764 neighbor_password_cmd,
1765 NEIGHBOR_CMD2 "password LINE",
1766 NEIGHBOR_STR
1767 NEIGHBOR_ADDR_STR2
1768 "Set a password\n"
1769 "The password\n")
1770{
1771 struct peer *peer;
1772 int ret;
1773
1774 peer = peer_and_group_lookup_vty (vty, argv[0]);
1775 if (! peer)
1776 return CMD_WARNING;
1777
1778 ret = peer_password_set (peer, argv[1]);
1779 return bgp_vty_return (vty, ret);
1780}
1781
1782DEFUN (no_neighbor_password,
1783 no_neighbor_password_cmd,
1784 NO_NEIGHBOR_CMD2 "password",
1785 NO_STR
1786 NEIGHBOR_STR
1787 NEIGHBOR_ADDR_STR2
1788 "Set a password\n")
1789{
1790 struct peer *peer;
1791 int ret;
1792
1793 peer = peer_and_group_lookup_vty (vty, argv[0]);
1794 if (! peer)
1795 return CMD_WARNING;
1796
1797 ret = peer_password_unset (peer);
1798 return bgp_vty_return (vty, ret);
1799}
David Lamparter6b0655a2014-06-04 06:53:35 +02001800
paul718e3742002-12-13 20:15:29 +00001801DEFUN (neighbor_activate,
1802 neighbor_activate_cmd,
1803 NEIGHBOR_CMD2 "activate",
1804 NEIGHBOR_STR
1805 NEIGHBOR_ADDR_STR2
1806 "Enable the Address Family for this Neighbor\n")
1807{
1808 struct peer *peer;
1809
1810 peer = peer_and_group_lookup_vty (vty, argv[0]);
1811 if (! peer)
1812 return CMD_WARNING;
1813
1814 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1815
1816 return CMD_SUCCESS;
1817}
1818
1819DEFUN (no_neighbor_activate,
1820 no_neighbor_activate_cmd,
1821 NO_NEIGHBOR_CMD2 "activate",
1822 NO_STR
1823 NEIGHBOR_STR
1824 NEIGHBOR_ADDR_STR2
1825 "Enable the Address Family for this Neighbor\n")
1826{
1827 int ret;
1828 struct peer *peer;
1829
1830 /* Lookup peer. */
1831 peer = peer_and_group_lookup_vty (vty, argv[0]);
1832 if (! peer)
1833 return CMD_WARNING;
1834
1835 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1836
1837 return bgp_vty_return (vty, ret);
1838}
David Lamparter6b0655a2014-06-04 06:53:35 +02001839
paul718e3742002-12-13 20:15:29 +00001840DEFUN (neighbor_set_peer_group,
1841 neighbor_set_peer_group_cmd,
1842 NEIGHBOR_CMD "peer-group WORD",
1843 NEIGHBOR_STR
1844 NEIGHBOR_ADDR_STR
1845 "Member of the peer-group\n"
1846 "peer-group name\n")
1847{
1848 int ret;
1849 as_t as;
1850 union sockunion su;
1851 struct bgp *bgp;
1852 struct peer_group *group;
1853
1854 bgp = vty->index;
1855
1856 ret = str2sockunion (argv[0], &su);
1857 if (ret < 0)
1858 {
1859 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1860 return CMD_WARNING;
1861 }
1862
1863 group = peer_group_lookup (bgp, argv[1]);
1864 if (! group)
1865 {
1866 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1867 return CMD_WARNING;
1868 }
1869
1870 if (peer_address_self_check (&su))
1871 {
1872 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1873 VTY_NEWLINE);
1874 return CMD_WARNING;
1875 }
1876
1877 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1878 bgp_node_safi (vty), &as);
1879
1880 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1881 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001882 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 +00001883 return CMD_WARNING;
1884 }
1885
1886 return bgp_vty_return (vty, ret);
1887}
1888
1889DEFUN (no_neighbor_set_peer_group,
1890 no_neighbor_set_peer_group_cmd,
1891 NO_NEIGHBOR_CMD "peer-group WORD",
1892 NO_STR
1893 NEIGHBOR_STR
1894 NEIGHBOR_ADDR_STR
1895 "Member of the peer-group\n"
1896 "peer-group name\n")
1897{
1898 int ret;
1899 struct bgp *bgp;
1900 struct peer *peer;
1901 struct peer_group *group;
1902
1903 bgp = vty->index;
1904
1905 peer = peer_lookup_vty (vty, argv[0]);
1906 if (! peer)
1907 return CMD_WARNING;
1908
1909 group = peer_group_lookup (bgp, argv[1]);
1910 if (! group)
1911 {
1912 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1913 return CMD_WARNING;
1914 }
1915
1916 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1917 bgp_node_safi (vty));
1918
1919 return bgp_vty_return (vty, ret);
1920}
David Lamparter6b0655a2014-06-04 06:53:35 +02001921
paul94f2b392005-06-28 12:44:16 +00001922static int
paulfd79ac92004-10-13 05:06:08 +00001923peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1924 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001925{
1926 int ret;
1927 struct peer *peer;
1928
1929 peer = peer_and_group_lookup_vty (vty, ip_str);
1930 if (! peer)
1931 return CMD_WARNING;
1932
1933 if (set)
1934 ret = peer_flag_set (peer, flag);
1935 else
1936 ret = peer_flag_unset (peer, flag);
1937
1938 return bgp_vty_return (vty, ret);
1939}
1940
paul94f2b392005-06-28 12:44:16 +00001941static int
paulfd79ac92004-10-13 05:06:08 +00001942peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001943{
1944 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1945}
1946
paul94f2b392005-06-28 12:44:16 +00001947static int
paulfd79ac92004-10-13 05:06:08 +00001948peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001949{
1950 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1951}
1952
1953/* neighbor passive. */
1954DEFUN (neighbor_passive,
1955 neighbor_passive_cmd,
1956 NEIGHBOR_CMD2 "passive",
1957 NEIGHBOR_STR
1958 NEIGHBOR_ADDR_STR2
1959 "Don't send open messages to this neighbor\n")
1960{
1961 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1962}
1963
1964DEFUN (no_neighbor_passive,
1965 no_neighbor_passive_cmd,
1966 NO_NEIGHBOR_CMD2 "passive",
1967 NO_STR
1968 NEIGHBOR_STR
1969 NEIGHBOR_ADDR_STR2
1970 "Don't send open messages to this neighbor\n")
1971{
1972 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1973}
David Lamparter6b0655a2014-06-04 06:53:35 +02001974
paul718e3742002-12-13 20:15:29 +00001975/* neighbor shutdown. */
1976DEFUN (neighbor_shutdown,
1977 neighbor_shutdown_cmd,
1978 NEIGHBOR_CMD2 "shutdown",
1979 NEIGHBOR_STR
1980 NEIGHBOR_ADDR_STR2
1981 "Administratively shut down this neighbor\n")
1982{
1983 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1984}
1985
1986DEFUN (no_neighbor_shutdown,
1987 no_neighbor_shutdown_cmd,
1988 NO_NEIGHBOR_CMD2 "shutdown",
1989 NO_STR
1990 NEIGHBOR_STR
1991 NEIGHBOR_ADDR_STR2
1992 "Administratively shut down this neighbor\n")
1993{
1994 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1995}
David Lamparter6b0655a2014-06-04 06:53:35 +02001996
hassoc9502432005-02-01 22:01:48 +00001997/* Deprecated neighbor capability route-refresh. */
1998DEFUN_DEPRECATED (neighbor_capability_route_refresh,
1999 neighbor_capability_route_refresh_cmd,
2000 NEIGHBOR_CMD2 "capability route-refresh",
2001 NEIGHBOR_STR
2002 NEIGHBOR_ADDR_STR2
2003 "Advertise capability to the peer\n"
2004 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002005{
hassoc9502432005-02-01 22:01:48 +00002006 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002007}
2008
hassoc9502432005-02-01 22:01:48 +00002009DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
2010 no_neighbor_capability_route_refresh_cmd,
2011 NO_NEIGHBOR_CMD2 "capability route-refresh",
2012 NO_STR
2013 NEIGHBOR_STR
2014 NEIGHBOR_ADDR_STR2
2015 "Advertise capability to the peer\n"
2016 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002017{
hassoc9502432005-02-01 22:01:48 +00002018 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002019}
David Lamparter6b0655a2014-06-04 06:53:35 +02002020
paul718e3742002-12-13 20:15:29 +00002021/* neighbor capability dynamic. */
2022DEFUN (neighbor_capability_dynamic,
2023 neighbor_capability_dynamic_cmd,
2024 NEIGHBOR_CMD2 "capability dynamic",
2025 NEIGHBOR_STR
2026 NEIGHBOR_ADDR_STR2
2027 "Advertise capability to the peer\n"
2028 "Advertise dynamic capability to this neighbor\n")
2029{
2030 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2031}
2032
2033DEFUN (no_neighbor_capability_dynamic,
2034 no_neighbor_capability_dynamic_cmd,
2035 NO_NEIGHBOR_CMD2 "capability dynamic",
2036 NO_STR
2037 NEIGHBOR_STR
2038 NEIGHBOR_ADDR_STR2
2039 "Advertise capability to the peer\n"
2040 "Advertise dynamic capability to this neighbor\n")
2041{
2042 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2043}
David Lamparter6b0655a2014-06-04 06:53:35 +02002044
paul718e3742002-12-13 20:15:29 +00002045/* neighbor dont-capability-negotiate */
2046DEFUN (neighbor_dont_capability_negotiate,
2047 neighbor_dont_capability_negotiate_cmd,
2048 NEIGHBOR_CMD2 "dont-capability-negotiate",
2049 NEIGHBOR_STR
2050 NEIGHBOR_ADDR_STR2
2051 "Do not perform capability negotiation\n")
2052{
2053 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2054}
2055
2056DEFUN (no_neighbor_dont_capability_negotiate,
2057 no_neighbor_dont_capability_negotiate_cmd,
2058 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
2059 NO_STR
2060 NEIGHBOR_STR
2061 NEIGHBOR_ADDR_STR2
2062 "Do not perform capability negotiation\n")
2063{
2064 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2065}
David Lamparter6b0655a2014-06-04 06:53:35 +02002066
paul94f2b392005-06-28 12:44:16 +00002067static int
paulfd79ac92004-10-13 05:06:08 +00002068peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002069 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002070{
2071 int ret;
2072 struct peer *peer;
2073
2074 peer = peer_and_group_lookup_vty (vty, peer_str);
2075 if (! peer)
2076 return CMD_WARNING;
2077
2078 if (set)
2079 ret = peer_af_flag_set (peer, afi, safi, flag);
2080 else
2081 ret = peer_af_flag_unset (peer, afi, safi, flag);
2082
2083 return bgp_vty_return (vty, ret);
2084}
2085
paul94f2b392005-06-28 12:44:16 +00002086static int
paulfd79ac92004-10-13 05:06:08 +00002087peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002088 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002089{
2090 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
2091}
2092
paul94f2b392005-06-28 12:44:16 +00002093static int
paulfd79ac92004-10-13 05:06:08 +00002094peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002095 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002096{
2097 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
2098}
David Lamparter6b0655a2014-06-04 06:53:35 +02002099
paul718e3742002-12-13 20:15:29 +00002100/* neighbor capability orf prefix-list. */
2101DEFUN (neighbor_capability_orf_prefix,
2102 neighbor_capability_orf_prefix_cmd,
2103 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2104 NEIGHBOR_STR
2105 NEIGHBOR_ADDR_STR2
2106 "Advertise capability to the peer\n"
2107 "Advertise ORF capability to the peer\n"
2108 "Advertise prefixlist ORF capability to this neighbor\n"
2109 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2110 "Capability to RECEIVE the ORF from this neighbor\n"
2111 "Capability to SEND the ORF to this neighbor\n")
2112{
2113 u_int16_t flag = 0;
2114
2115 if (strncmp (argv[1], "s", 1) == 0)
2116 flag = PEER_FLAG_ORF_PREFIX_SM;
2117 else if (strncmp (argv[1], "r", 1) == 0)
2118 flag = PEER_FLAG_ORF_PREFIX_RM;
2119 else if (strncmp (argv[1], "b", 1) == 0)
2120 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2121 else
2122 return CMD_WARNING;
2123
2124 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2125 bgp_node_safi (vty), flag);
2126}
2127
2128DEFUN (no_neighbor_capability_orf_prefix,
2129 no_neighbor_capability_orf_prefix_cmd,
2130 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2131 NO_STR
2132 NEIGHBOR_STR
2133 NEIGHBOR_ADDR_STR2
2134 "Advertise capability to the peer\n"
2135 "Advertise ORF capability to the peer\n"
2136 "Advertise prefixlist ORF capability to this neighbor\n"
2137 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2138 "Capability to RECEIVE the ORF from this neighbor\n"
2139 "Capability to SEND the ORF to this neighbor\n")
2140{
2141 u_int16_t flag = 0;
2142
2143 if (strncmp (argv[1], "s", 1) == 0)
2144 flag = PEER_FLAG_ORF_PREFIX_SM;
2145 else if (strncmp (argv[1], "r", 1) == 0)
2146 flag = PEER_FLAG_ORF_PREFIX_RM;
2147 else if (strncmp (argv[1], "b", 1) == 0)
2148 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2149 else
2150 return CMD_WARNING;
2151
2152 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2153 bgp_node_safi (vty), flag);
2154}
David Lamparter6b0655a2014-06-04 06:53:35 +02002155
paul718e3742002-12-13 20:15:29 +00002156/* neighbor next-hop-self. */
2157DEFUN (neighbor_nexthop_self,
2158 neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002159 NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002160 NEIGHBOR_STR
2161 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002162 "Disable the next hop calculation for this neighbor\n"
2163 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002164{
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002165 u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
2166 int rc;
2167
2168 /* Check if "all" is specified */
2169 if (argv[1] != NULL)
2170 flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
2171 else
2172 unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
2173
2174 rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2175 bgp_node_safi (vty), flags);
2176 if ( rc == CMD_SUCCESS && unset )
2177 rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2178 bgp_node_safi (vty), unset);
2179 return rc;
paul718e3742002-12-13 20:15:29 +00002180}
2181
2182DEFUN (no_neighbor_nexthop_self,
2183 no_neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002184 NO_NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002185 NO_STR
2186 NEIGHBOR_STR
2187 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002188 "Disable the next hop calculation for this neighbor\n"
2189 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002190{
2191 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002192 bgp_node_safi (vty),
2193 PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
paul718e3742002-12-13 20:15:29 +00002194}
David Lamparter6b0655a2014-06-04 06:53:35 +02002195
paul718e3742002-12-13 20:15:29 +00002196/* neighbor remove-private-AS. */
2197DEFUN (neighbor_remove_private_as,
2198 neighbor_remove_private_as_cmd,
2199 NEIGHBOR_CMD2 "remove-private-AS",
2200 NEIGHBOR_STR
2201 NEIGHBOR_ADDR_STR2
2202 "Remove private AS number from outbound updates\n")
2203{
2204 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2205 bgp_node_safi (vty),
2206 PEER_FLAG_REMOVE_PRIVATE_AS);
2207}
2208
2209DEFUN (no_neighbor_remove_private_as,
2210 no_neighbor_remove_private_as_cmd,
2211 NO_NEIGHBOR_CMD2 "remove-private-AS",
2212 NO_STR
2213 NEIGHBOR_STR
2214 NEIGHBOR_ADDR_STR2
2215 "Remove private AS number from outbound updates\n")
2216{
2217 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2218 bgp_node_safi (vty),
2219 PEER_FLAG_REMOVE_PRIVATE_AS);
2220}
David Lamparter6b0655a2014-06-04 06:53:35 +02002221
paul718e3742002-12-13 20:15:29 +00002222/* neighbor send-community. */
2223DEFUN (neighbor_send_community,
2224 neighbor_send_community_cmd,
2225 NEIGHBOR_CMD2 "send-community",
2226 NEIGHBOR_STR
2227 NEIGHBOR_ADDR_STR2
2228 "Send Community attribute to this neighbor\n")
2229{
2230 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2231 bgp_node_safi (vty),
2232 PEER_FLAG_SEND_COMMUNITY);
2233}
2234
2235DEFUN (no_neighbor_send_community,
2236 no_neighbor_send_community_cmd,
2237 NO_NEIGHBOR_CMD2 "send-community",
2238 NO_STR
2239 NEIGHBOR_STR
2240 NEIGHBOR_ADDR_STR2
2241 "Send Community attribute to this neighbor\n")
2242{
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}
David Lamparter6b0655a2014-06-04 06:53:35 +02002247
paul718e3742002-12-13 20:15:29 +00002248/* neighbor send-community extended. */
2249DEFUN (neighbor_send_community_type,
2250 neighbor_send_community_type_cmd,
2251 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2252 NEIGHBOR_STR
2253 NEIGHBOR_ADDR_STR2
2254 "Send Community attribute to this neighbor\n"
2255 "Send Standard and Extended Community attributes\n"
2256 "Send Extended Community attributes\n"
2257 "Send Standard Community attributes\n")
2258{
2259 if (strncmp (argv[1], "s", 1) == 0)
2260 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2261 bgp_node_safi (vty),
2262 PEER_FLAG_SEND_COMMUNITY);
2263 if (strncmp (argv[1], "e", 1) == 0)
2264 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2265 bgp_node_safi (vty),
2266 PEER_FLAG_SEND_EXT_COMMUNITY);
2267
2268 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2269 bgp_node_safi (vty),
2270 (PEER_FLAG_SEND_COMMUNITY|
2271 PEER_FLAG_SEND_EXT_COMMUNITY));
2272}
2273
2274DEFUN (no_neighbor_send_community_type,
2275 no_neighbor_send_community_type_cmd,
2276 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2277 NO_STR
2278 NEIGHBOR_STR
2279 NEIGHBOR_ADDR_STR2
2280 "Send Community attribute to this neighbor\n"
2281 "Send Standard and Extended Community attributes\n"
2282 "Send Extended Community attributes\n"
2283 "Send Standard Community attributes\n")
2284{
2285 if (strncmp (argv[1], "s", 1) == 0)
2286 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2287 bgp_node_safi (vty),
2288 PEER_FLAG_SEND_COMMUNITY);
2289 if (strncmp (argv[1], "e", 1) == 0)
2290 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2291 bgp_node_safi (vty),
2292 PEER_FLAG_SEND_EXT_COMMUNITY);
2293
2294 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2295 bgp_node_safi (vty),
2296 (PEER_FLAG_SEND_COMMUNITY |
2297 PEER_FLAG_SEND_EXT_COMMUNITY));
2298}
David Lamparter6b0655a2014-06-04 06:53:35 +02002299
paul718e3742002-12-13 20:15:29 +00002300/* neighbor soft-reconfig. */
2301DEFUN (neighbor_soft_reconfiguration,
2302 neighbor_soft_reconfiguration_cmd,
2303 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2304 NEIGHBOR_STR
2305 NEIGHBOR_ADDR_STR2
2306 "Per neighbor soft reconfiguration\n"
2307 "Allow inbound soft reconfiguration for this neighbor\n")
2308{
2309 return peer_af_flag_set_vty (vty, argv[0],
2310 bgp_node_afi (vty), bgp_node_safi (vty),
2311 PEER_FLAG_SOFT_RECONFIG);
2312}
2313
2314DEFUN (no_neighbor_soft_reconfiguration,
2315 no_neighbor_soft_reconfiguration_cmd,
2316 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2317 NO_STR
2318 NEIGHBOR_STR
2319 NEIGHBOR_ADDR_STR2
2320 "Per neighbor soft reconfiguration\n"
2321 "Allow inbound soft reconfiguration for this neighbor\n")
2322{
2323 return peer_af_flag_unset_vty (vty, argv[0],
2324 bgp_node_afi (vty), bgp_node_safi (vty),
2325 PEER_FLAG_SOFT_RECONFIG);
2326}
David Lamparter6b0655a2014-06-04 06:53:35 +02002327
paul718e3742002-12-13 20:15:29 +00002328DEFUN (neighbor_route_reflector_client,
2329 neighbor_route_reflector_client_cmd,
2330 NEIGHBOR_CMD2 "route-reflector-client",
2331 NEIGHBOR_STR
2332 NEIGHBOR_ADDR_STR2
2333 "Configure a neighbor as Route Reflector client\n")
2334{
2335 struct peer *peer;
2336
2337
2338 peer = peer_and_group_lookup_vty (vty, argv[0]);
2339 if (! peer)
2340 return CMD_WARNING;
2341
2342 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2343 bgp_node_safi (vty),
2344 PEER_FLAG_REFLECTOR_CLIENT);
2345}
2346
2347DEFUN (no_neighbor_route_reflector_client,
2348 no_neighbor_route_reflector_client_cmd,
2349 NO_NEIGHBOR_CMD2 "route-reflector-client",
2350 NO_STR
2351 NEIGHBOR_STR
2352 NEIGHBOR_ADDR_STR2
2353 "Configure a neighbor as Route Reflector client\n")
2354{
2355 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2356 bgp_node_safi (vty),
2357 PEER_FLAG_REFLECTOR_CLIENT);
2358}
David Lamparter6b0655a2014-06-04 06:53:35 +02002359
paul94f2b392005-06-28 12:44:16 +00002360static int
paulfd79ac92004-10-13 05:06:08 +00002361peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2362 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002363{
2364 int ret;
2365 struct bgp *bgp;
2366 struct peer *peer;
2367 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002368 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002369 struct bgp_filter *pfilter;
2370 struct bgp_filter *gfilter;
Chris Caputo228da422009-07-18 05:44:03 +00002371 int locked_and_added = 0;
paulfee0f4c2004-09-13 05:12:46 +00002372
2373 bgp = vty->index;
2374
2375 peer = peer_and_group_lookup_vty (vty, peer_str);
2376 if ( ! peer )
2377 return CMD_WARNING;
2378
2379 /* If it is already a RS-Client, don't do anything. */
2380 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2381 return CMD_SUCCESS;
2382
2383 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002384 {
2385 peer = peer_lock (peer); /* rsclient peer list reference */
2386 listnode_add_sort (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002387 locked_and_added = 1;
paul200df112005-06-01 11:17:05 +00002388 }
paulfee0f4c2004-09-13 05:12:46 +00002389
2390 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2391 if (ret < 0)
Chris Caputo228da422009-07-18 05:44:03 +00002392 {
2393 if (locked_and_added)
2394 {
2395 listnode_delete (bgp->rsclient, peer);
2396 peer_unlock (peer); /* rsclient peer list reference */
2397 }
2398
2399 return bgp_vty_return (vty, ret);
2400 }
paulfee0f4c2004-09-13 05:12:46 +00002401
Paul Jakma64e580a2006-02-21 01:09:01 +00002402 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002403 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
Chris Caputo228da422009-07-18 05:44:03 +00002404 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2405 peer->rib[afi][safi]->owner = peer_lock (peer);
paulfee0f4c2004-09-13 05:12:46 +00002406
2407 /* Check for existing 'network' and 'redistribute' routes. */
2408 bgp_check_local_routes_rsclient (peer, afi, safi);
2409
2410 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2411 bgp_soft_reconfig_rsclient (peer, afi, safi);
2412
2413 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2414 {
2415 group = peer->group;
2416 gfilter = &peer->filter[afi][safi];
2417
paul1eb8ef22005-04-07 07:30:20 +00002418 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002419 {
2420 pfilter = &peer->filter[afi][safi];
2421
2422 /* Members of a non-RS-Client group should not be RS-Clients, as that
2423 is checked when the become part of the peer-group */
2424 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2425 if (ret < 0)
2426 return bgp_vty_return (vty, ret);
2427
2428 /* Make peer's RIB point to group's RIB. */
2429 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2430
2431 /* Import policy. */
2432 if (pfilter->map[RMAP_IMPORT].name)
2433 free (pfilter->map[RMAP_IMPORT].name);
2434 if (gfilter->map[RMAP_IMPORT].name)
2435 {
2436 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2437 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2438 }
2439 else
2440 {
2441 pfilter->map[RMAP_IMPORT].name = NULL;
2442 pfilter->map[RMAP_IMPORT].map =NULL;
2443 }
2444
2445 /* Export policy. */
2446 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2447 {
2448 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2449 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2450 }
2451 }
2452 }
2453 return CMD_SUCCESS;
2454}
2455
paul94f2b392005-06-28 12:44:16 +00002456static int
paulfd79ac92004-10-13 05:06:08 +00002457peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2458 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002459{
2460 int ret;
2461 struct bgp *bgp;
2462 struct peer *peer;
2463 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002464 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002465
2466 bgp = vty->index;
2467
2468 peer = peer_and_group_lookup_vty (vty, peer_str);
2469 if ( ! peer )
2470 return CMD_WARNING;
2471
2472 /* If it is not a RS-Client, don't do anything. */
2473 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2474 return CMD_SUCCESS;
2475
2476 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2477 {
2478 group = peer->group;
2479
paul1eb8ef22005-04-07 07:30:20 +00002480 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002481 {
2482 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2483 if (ret < 0)
2484 return bgp_vty_return (vty, ret);
2485
2486 peer->rib[afi][safi] = NULL;
2487 }
2488
2489 peer = group->conf;
2490 }
2491
2492 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2493 if (ret < 0)
2494 return bgp_vty_return (vty, ret);
2495
2496 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002497 {
Chris Caputo228da422009-07-18 05:44:03 +00002498 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
paul200df112005-06-01 11:17:05 +00002499 listnode_delete (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002500 peer_unlock (peer); /* peer bgp rsclient reference */
paul200df112005-06-01 11:17:05 +00002501 }
paulfee0f4c2004-09-13 05:12:46 +00002502
Paul Jakmab608d5b2008-07-02 02:12:07 +00002503 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002504
2505 return CMD_SUCCESS;
2506}
David Lamparter6b0655a2014-06-04 06:53:35 +02002507
paul718e3742002-12-13 20:15:29 +00002508/* neighbor route-server-client. */
2509DEFUN (neighbor_route_server_client,
2510 neighbor_route_server_client_cmd,
2511 NEIGHBOR_CMD2 "route-server-client",
2512 NEIGHBOR_STR
2513 NEIGHBOR_ADDR_STR2
2514 "Configure a neighbor as Route Server client\n")
2515{
paulfee0f4c2004-09-13 05:12:46 +00002516 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2517 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002518}
2519
2520DEFUN (no_neighbor_route_server_client,
2521 no_neighbor_route_server_client_cmd,
2522 NO_NEIGHBOR_CMD2 "route-server-client",
2523 NO_STR
2524 NEIGHBOR_STR
2525 NEIGHBOR_ADDR_STR2
2526 "Configure a neighbor as Route Server client\n")
2527{
paulfee0f4c2004-09-13 05:12:46 +00002528 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2529 bgp_node_safi(vty));
2530}
David Lamparter6b0655a2014-06-04 06:53:35 +02002531
paulfee0f4c2004-09-13 05:12:46 +00002532DEFUN (neighbor_nexthop_local_unchanged,
2533 neighbor_nexthop_local_unchanged_cmd,
2534 NEIGHBOR_CMD2 "nexthop-local unchanged",
2535 NEIGHBOR_STR
2536 NEIGHBOR_ADDR_STR2
2537 "Configure treatment of outgoing link-local nexthop attribute\n"
2538 "Leave link-local nexthop unchanged for this peer\n")
2539{
2540 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2541 bgp_node_safi (vty),
2542 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2543}
David Lamparter6b0655a2014-06-04 06:53:35 +02002544
paulfee0f4c2004-09-13 05:12:46 +00002545DEFUN (no_neighbor_nexthop_local_unchanged,
2546 no_neighbor_nexthop_local_unchanged_cmd,
2547 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2548 NO_STR
2549 NEIGHBOR_STR
2550 NEIGHBOR_ADDR_STR2
2551 "Configure treatment of outgoing link-local-nexthop attribute\n"
2552 "Leave link-local nexthop unchanged for this peer\n")
2553{
paul718e3742002-12-13 20:15:29 +00002554 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2555 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002556 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002557}
David Lamparter6b0655a2014-06-04 06:53:35 +02002558
paul718e3742002-12-13 20:15:29 +00002559DEFUN (neighbor_attr_unchanged,
2560 neighbor_attr_unchanged_cmd,
2561 NEIGHBOR_CMD2 "attribute-unchanged",
2562 NEIGHBOR_STR
2563 NEIGHBOR_ADDR_STR2
2564 "BGP attribute is propagated unchanged to this neighbor\n")
2565{
2566 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2567 bgp_node_safi (vty),
2568 (PEER_FLAG_AS_PATH_UNCHANGED |
2569 PEER_FLAG_NEXTHOP_UNCHANGED |
2570 PEER_FLAG_MED_UNCHANGED));
2571}
2572
2573DEFUN (neighbor_attr_unchanged1,
2574 neighbor_attr_unchanged1_cmd,
2575 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2576 NEIGHBOR_STR
2577 NEIGHBOR_ADDR_STR2
2578 "BGP attribute is propagated unchanged to this neighbor\n"
2579 "As-path attribute\n"
2580 "Nexthop attribute\n"
2581 "Med attribute\n")
2582{
2583 u_int16_t flags = 0;
2584
2585 if (strncmp (argv[1], "as-path", 1) == 0)
2586 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2587 else if (strncmp (argv[1], "next-hop", 1) == 0)
2588 SET_FLAG (flags, PEER_FLAG_NEXTHOP_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_unchanged2,
2597 neighbor_attr_unchanged2_cmd,
2598 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2599 NEIGHBOR_STR
2600 NEIGHBOR_ADDR_STR2
2601 "BGP attribute is propagated unchanged to this neighbor\n"
2602 "As-path attribute\n"
2603 "Nexthop attribute\n"
2604 "Med attribute\n")
2605{
2606 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2607
2608 if (strncmp (argv[1], "next-hop", 1) == 0)
2609 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2610 else if (strncmp (argv[1], "med", 1) == 0)
2611 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2612
2613 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2614 bgp_node_safi (vty), flags);
2615
2616}
2617
2618DEFUN (neighbor_attr_unchanged3,
2619 neighbor_attr_unchanged3_cmd,
2620 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2621 NEIGHBOR_STR
2622 NEIGHBOR_ADDR_STR2
2623 "BGP attribute is propagated unchanged to this neighbor\n"
2624 "Nexthop attribute\n"
2625 "As-path attribute\n"
2626 "Med attribute\n")
2627{
2628 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2629
2630 if (strncmp (argv[1], "as-path", 1) == 0)
2631 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2632 else if (strncmp (argv[1], "med", 1) == 0)
2633 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2634
2635 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2636 bgp_node_safi (vty), flags);
2637}
2638
2639DEFUN (neighbor_attr_unchanged4,
2640 neighbor_attr_unchanged4_cmd,
2641 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2642 NEIGHBOR_STR
2643 NEIGHBOR_ADDR_STR2
2644 "BGP attribute is propagated unchanged to this neighbor\n"
2645 "Med attribute\n"
2646 "As-path attribute\n"
2647 "Nexthop attribute\n")
2648{
2649 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2650
2651 if (strncmp (argv[1], "as-path", 1) == 0)
2652 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2653 else if (strncmp (argv[1], "next-hop", 1) == 0)
2654 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2655
2656 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2657 bgp_node_safi (vty), flags);
2658}
2659
2660ALIAS (neighbor_attr_unchanged,
2661 neighbor_attr_unchanged5_cmd,
2662 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2663 NEIGHBOR_STR
2664 NEIGHBOR_ADDR_STR2
2665 "BGP attribute is propagated unchanged to this neighbor\n"
2666 "As-path attribute\n"
2667 "Nexthop attribute\n"
2668 "Med attribute\n")
2669
2670ALIAS (neighbor_attr_unchanged,
2671 neighbor_attr_unchanged6_cmd,
2672 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2673 NEIGHBOR_STR
2674 NEIGHBOR_ADDR_STR2
2675 "BGP attribute is propagated unchanged to this neighbor\n"
2676 "As-path attribute\n"
2677 "Med attribute\n"
2678 "Nexthop attribute\n")
2679
2680ALIAS (neighbor_attr_unchanged,
2681 neighbor_attr_unchanged7_cmd,
2682 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2683 NEIGHBOR_STR
2684 NEIGHBOR_ADDR_STR2
2685 "BGP attribute is propagated unchanged to this neighbor\n"
2686 "Nexthop attribute\n"
2687 "Med attribute\n"
2688 "As-path attribute\n")
2689
2690ALIAS (neighbor_attr_unchanged,
2691 neighbor_attr_unchanged8_cmd,
2692 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2693 NEIGHBOR_STR
2694 NEIGHBOR_ADDR_STR2
2695 "BGP attribute is propagated unchanged to this neighbor\n"
2696 "Nexthop attribute\n"
2697 "As-path attribute\n"
2698 "Med attribute\n")
2699
2700ALIAS (neighbor_attr_unchanged,
2701 neighbor_attr_unchanged9_cmd,
2702 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2703 NEIGHBOR_STR
2704 NEIGHBOR_ADDR_STR2
2705 "BGP attribute is propagated unchanged to this neighbor\n"
2706 "Med attribute\n"
2707 "Nexthop attribute\n"
2708 "As-path attribute\n")
2709
2710ALIAS (neighbor_attr_unchanged,
2711 neighbor_attr_unchanged10_cmd,
2712 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2713 NEIGHBOR_STR
2714 NEIGHBOR_ADDR_STR2
2715 "BGP attribute is propagated unchanged to this neighbor\n"
2716 "Med attribute\n"
2717 "As-path attribute\n"
2718 "Nexthop attribute\n")
2719
2720DEFUN (no_neighbor_attr_unchanged,
2721 no_neighbor_attr_unchanged_cmd,
2722 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2723 NO_STR
2724 NEIGHBOR_STR
2725 NEIGHBOR_ADDR_STR2
2726 "BGP attribute is propagated unchanged to this neighbor\n")
2727{
2728 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2729 bgp_node_safi (vty),
2730 (PEER_FLAG_AS_PATH_UNCHANGED |
2731 PEER_FLAG_NEXTHOP_UNCHANGED |
2732 PEER_FLAG_MED_UNCHANGED));
2733}
2734
2735DEFUN (no_neighbor_attr_unchanged1,
2736 no_neighbor_attr_unchanged1_cmd,
2737 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2738 NO_STR
2739 NEIGHBOR_STR
2740 NEIGHBOR_ADDR_STR2
2741 "BGP attribute is propagated unchanged to this neighbor\n"
2742 "As-path attribute\n"
2743 "Nexthop attribute\n"
2744 "Med attribute\n")
2745{
2746 u_int16_t flags = 0;
2747
2748 if (strncmp (argv[1], "as-path", 1) == 0)
2749 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2750 else if (strncmp (argv[1], "next-hop", 1) == 0)
2751 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2752 else if (strncmp (argv[1], "med", 1) == 0)
2753 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2754
2755 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2756 bgp_node_safi (vty), flags);
2757}
2758
2759DEFUN (no_neighbor_attr_unchanged2,
2760 no_neighbor_attr_unchanged2_cmd,
2761 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2762 NO_STR
2763 NEIGHBOR_STR
2764 NEIGHBOR_ADDR_STR2
2765 "BGP attribute is propagated unchanged to this neighbor\n"
2766 "As-path attribute\n"
2767 "Nexthop attribute\n"
2768 "Med attribute\n")
2769{
2770 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2771
2772 if (strncmp (argv[1], "next-hop", 1) == 0)
2773 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2774 else if (strncmp (argv[1], "med", 1) == 0)
2775 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2776
2777 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2778 bgp_node_safi (vty), flags);
2779}
2780
2781DEFUN (no_neighbor_attr_unchanged3,
2782 no_neighbor_attr_unchanged3_cmd,
2783 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2784 NO_STR
2785 NEIGHBOR_STR
2786 NEIGHBOR_ADDR_STR2
2787 "BGP attribute is propagated unchanged to this neighbor\n"
2788 "Nexthop attribute\n"
2789 "As-path attribute\n"
2790 "Med attribute\n")
2791{
2792 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2793
2794 if (strncmp (argv[1], "as-path", 1) == 0)
2795 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2796 else if (strncmp (argv[1], "med", 1) == 0)
2797 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2798
2799 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2800 bgp_node_safi (vty), flags);
2801}
2802
2803DEFUN (no_neighbor_attr_unchanged4,
2804 no_neighbor_attr_unchanged4_cmd,
2805 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2806 NO_STR
2807 NEIGHBOR_STR
2808 NEIGHBOR_ADDR_STR2
2809 "BGP attribute is propagated unchanged to this neighbor\n"
2810 "Med attribute\n"
2811 "As-path attribute\n"
2812 "Nexthop attribute\n")
2813{
2814 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2815
2816 if (strncmp (argv[1], "as-path", 1) == 0)
2817 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2818 else if (strncmp (argv[1], "next-hop", 1) == 0)
2819 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2820
2821 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2822 bgp_node_safi (vty), flags);
2823}
2824
2825ALIAS (no_neighbor_attr_unchanged,
2826 no_neighbor_attr_unchanged5_cmd,
2827 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2828 NO_STR
2829 NEIGHBOR_STR
2830 NEIGHBOR_ADDR_STR2
2831 "BGP attribute is propagated unchanged to this neighbor\n"
2832 "As-path attribute\n"
2833 "Nexthop attribute\n"
2834 "Med attribute\n")
2835
2836ALIAS (no_neighbor_attr_unchanged,
2837 no_neighbor_attr_unchanged6_cmd,
2838 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2839 NO_STR
2840 NEIGHBOR_STR
2841 NEIGHBOR_ADDR_STR2
2842 "BGP attribute is propagated unchanged to this neighbor\n"
2843 "As-path attribute\n"
2844 "Med attribute\n"
2845 "Nexthop attribute\n")
2846
2847ALIAS (no_neighbor_attr_unchanged,
2848 no_neighbor_attr_unchanged7_cmd,
2849 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2850 NO_STR
2851 NEIGHBOR_STR
2852 NEIGHBOR_ADDR_STR2
2853 "BGP attribute is propagated unchanged to this neighbor\n"
2854 "Nexthop attribute\n"
2855 "Med attribute\n"
2856 "As-path attribute\n")
2857
2858ALIAS (no_neighbor_attr_unchanged,
2859 no_neighbor_attr_unchanged8_cmd,
2860 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2861 NO_STR
2862 NEIGHBOR_STR
2863 NEIGHBOR_ADDR_STR2
2864 "BGP attribute is propagated unchanged to this neighbor\n"
2865 "Nexthop attribute\n"
2866 "As-path attribute\n"
2867 "Med attribute\n")
2868
2869ALIAS (no_neighbor_attr_unchanged,
2870 no_neighbor_attr_unchanged9_cmd,
2871 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2872 NO_STR
2873 NEIGHBOR_STR
2874 NEIGHBOR_ADDR_STR2
2875 "BGP attribute is propagated unchanged to this neighbor\n"
2876 "Med attribute\n"
2877 "Nexthop attribute\n"
2878 "As-path attribute\n")
2879
2880ALIAS (no_neighbor_attr_unchanged,
2881 no_neighbor_attr_unchanged10_cmd,
2882 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2883 NO_STR
2884 NEIGHBOR_STR
2885 NEIGHBOR_ADDR_STR2
2886 "BGP attribute is propagated unchanged to this neighbor\n"
2887 "Med attribute\n"
2888 "As-path attribute\n"
2889 "Nexthop attribute\n")
2890
2891/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002892DEFUN_DEPRECATED (neighbor_transparent_as,
2893 neighbor_transparent_as_cmd,
2894 NEIGHBOR_CMD "transparent-as",
2895 NEIGHBOR_STR
2896 NEIGHBOR_ADDR_STR
2897 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002898{
2899 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2900 bgp_node_safi (vty),
2901 PEER_FLAG_AS_PATH_UNCHANGED);
2902}
2903
hassodd4c5932005-02-02 17:15:34 +00002904DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2905 neighbor_transparent_nexthop_cmd,
2906 NEIGHBOR_CMD "transparent-nexthop",
2907 NEIGHBOR_STR
2908 NEIGHBOR_ADDR_STR
2909 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002910{
2911 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2912 bgp_node_safi (vty),
2913 PEER_FLAG_NEXTHOP_UNCHANGED);
2914}
David Lamparter6b0655a2014-06-04 06:53:35 +02002915
paul718e3742002-12-13 20:15:29 +00002916/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00002917static int
paulfd79ac92004-10-13 05:06:08 +00002918peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2919 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002920{
2921 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002922 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002923
2924 peer = peer_and_group_lookup_vty (vty, ip_str);
2925 if (! peer)
2926 return CMD_WARNING;
2927
2928 if (! ttl_str)
2929 ttl = TTL_MAX;
2930 else
2931 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2932
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002933 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
paul718e3742002-12-13 20:15:29 +00002934}
2935
paul94f2b392005-06-28 12:44:16 +00002936static int
paulfd79ac92004-10-13 05:06:08 +00002937peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002938{
2939 struct peer *peer;
2940
2941 peer = peer_and_group_lookup_vty (vty, ip_str);
2942 if (! peer)
2943 return CMD_WARNING;
2944
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002945 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
paul718e3742002-12-13 20:15:29 +00002946}
2947
2948/* neighbor ebgp-multihop. */
2949DEFUN (neighbor_ebgp_multihop,
2950 neighbor_ebgp_multihop_cmd,
2951 NEIGHBOR_CMD2 "ebgp-multihop",
2952 NEIGHBOR_STR
2953 NEIGHBOR_ADDR_STR2
2954 "Allow EBGP neighbors not on directly connected networks\n")
2955{
2956 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2957}
2958
2959DEFUN (neighbor_ebgp_multihop_ttl,
2960 neighbor_ebgp_multihop_ttl_cmd,
2961 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2962 NEIGHBOR_STR
2963 NEIGHBOR_ADDR_STR2
2964 "Allow EBGP neighbors not on directly connected networks\n"
2965 "maximum hop count\n")
2966{
2967 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
2968}
2969
2970DEFUN (no_neighbor_ebgp_multihop,
2971 no_neighbor_ebgp_multihop_cmd,
2972 NO_NEIGHBOR_CMD2 "ebgp-multihop",
2973 NO_STR
2974 NEIGHBOR_STR
2975 NEIGHBOR_ADDR_STR2
2976 "Allow EBGP neighbors not on directly connected networks\n")
2977{
2978 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
2979}
2980
2981ALIAS (no_neighbor_ebgp_multihop,
2982 no_neighbor_ebgp_multihop_ttl_cmd,
2983 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2984 NO_STR
2985 NEIGHBOR_STR
2986 NEIGHBOR_ADDR_STR2
2987 "Allow EBGP neighbors not on directly connected networks\n"
2988 "maximum hop count\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02002989
hasso6ffd2072005-02-02 14:50:11 +00002990/* disable-connected-check */
2991DEFUN (neighbor_disable_connected_check,
2992 neighbor_disable_connected_check_cmd,
2993 NEIGHBOR_CMD2 "disable-connected-check",
2994 NEIGHBOR_STR
2995 NEIGHBOR_ADDR_STR2
2996 "one-hop away EBGP peer using loopback address\n")
2997{
2998 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2999}
3000
3001DEFUN (no_neighbor_disable_connected_check,
3002 no_neighbor_disable_connected_check_cmd,
3003 NO_NEIGHBOR_CMD2 "disable-connected-check",
3004 NO_STR
3005 NEIGHBOR_STR
3006 NEIGHBOR_ADDR_STR2
3007 "one-hop away EBGP peer using loopback address\n")
3008{
3009 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3010}
3011
paul718e3742002-12-13 20:15:29 +00003012/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00003013ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003014 neighbor_enforce_multihop_cmd,
3015 NEIGHBOR_CMD2 "enforce-multihop",
3016 NEIGHBOR_STR
3017 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003018 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00003019
hasso6ffd2072005-02-02 14:50:11 +00003020/* Enforce multihop. */
3021ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003022 no_neighbor_enforce_multihop_cmd,
3023 NO_NEIGHBOR_CMD2 "enforce-multihop",
3024 NO_STR
3025 NEIGHBOR_STR
3026 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003027 "Enforce EBGP neighbors perform multihop\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003028
paul718e3742002-12-13 20:15:29 +00003029DEFUN (neighbor_description,
3030 neighbor_description_cmd,
3031 NEIGHBOR_CMD2 "description .LINE",
3032 NEIGHBOR_STR
3033 NEIGHBOR_ADDR_STR2
3034 "Neighbor specific description\n"
3035 "Up to 80 characters describing this neighbor\n")
3036{
3037 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003038 char *str;
paul718e3742002-12-13 20:15:29 +00003039
3040 peer = peer_and_group_lookup_vty (vty, argv[0]);
3041 if (! peer)
3042 return CMD_WARNING;
3043
3044 if (argc == 1)
3045 return CMD_SUCCESS;
3046
ajs3b8b1852005-01-29 18:19:13 +00003047 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00003048
3049 peer_description_set (peer, str);
3050
ajs3b8b1852005-01-29 18:19:13 +00003051 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00003052
3053 return CMD_SUCCESS;
3054}
3055
3056DEFUN (no_neighbor_description,
3057 no_neighbor_description_cmd,
3058 NO_NEIGHBOR_CMD2 "description",
3059 NO_STR
3060 NEIGHBOR_STR
3061 NEIGHBOR_ADDR_STR2
3062 "Neighbor specific description\n")
3063{
3064 struct peer *peer;
3065
3066 peer = peer_and_group_lookup_vty (vty, argv[0]);
3067 if (! peer)
3068 return CMD_WARNING;
3069
3070 peer_description_unset (peer);
3071
3072 return CMD_SUCCESS;
3073}
3074
3075ALIAS (no_neighbor_description,
3076 no_neighbor_description_val_cmd,
3077 NO_NEIGHBOR_CMD2 "description .LINE",
3078 NO_STR
3079 NEIGHBOR_STR
3080 NEIGHBOR_ADDR_STR2
3081 "Neighbor specific description\n"
3082 "Up to 80 characters describing this neighbor\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003083
paul718e3742002-12-13 20:15:29 +00003084/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00003085static int
paulfd79ac92004-10-13 05:06:08 +00003086peer_update_source_vty (struct vty *vty, const char *peer_str,
3087 const char *source_str)
paul718e3742002-12-13 20:15:29 +00003088{
3089 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003090
3091 peer = peer_and_group_lookup_vty (vty, peer_str);
3092 if (! peer)
3093 return CMD_WARNING;
3094
3095 if (source_str)
3096 {
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +02003097 union sockunion su;
3098 int ret = str2sockunion (source_str, &su);
3099
3100 if (ret == 0)
3101 peer_update_source_addr_set (peer, &su);
paul718e3742002-12-13 20:15:29 +00003102 else
3103 peer_update_source_if_set (peer, source_str);
3104 }
3105 else
3106 peer_update_source_unset (peer);
3107
3108 return CMD_SUCCESS;
3109}
3110
Paul Jakma9a1a3312009-07-27 12:27:55 +01003111#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
Paul Jakma369688c2006-05-23 22:27:55 +00003112#define BGP_UPDATE_SOURCE_HELP_STR \
3113 "IPv4 address\n" \
Paul Jakma9a1a3312009-07-27 12:27:55 +01003114 "IPv6 address\n" \
3115 "Interface name (requires zebra to be running)\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003116
paul718e3742002-12-13 20:15:29 +00003117DEFUN (neighbor_update_source,
3118 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00003119 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00003120 NEIGHBOR_STR
3121 NEIGHBOR_ADDR_STR2
3122 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003123 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00003124{
3125 return peer_update_source_vty (vty, argv[0], argv[1]);
3126}
3127
3128DEFUN (no_neighbor_update_source,
3129 no_neighbor_update_source_cmd,
3130 NO_NEIGHBOR_CMD2 "update-source",
3131 NO_STR
3132 NEIGHBOR_STR
3133 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00003134 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00003135{
3136 return peer_update_source_vty (vty, argv[0], NULL);
3137}
David Lamparter6b0655a2014-06-04 06:53:35 +02003138
paul94f2b392005-06-28 12:44:16 +00003139static int
paulfd79ac92004-10-13 05:06:08 +00003140peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
3141 afi_t afi, safi_t safi,
3142 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00003143{
3144 int ret;
3145 struct peer *peer;
3146
3147 peer = peer_and_group_lookup_vty (vty, peer_str);
3148 if (! peer)
3149 return CMD_WARNING;
3150
3151 if (set)
3152 ret = peer_default_originate_set (peer, afi, safi, rmap);
3153 else
3154 ret = peer_default_originate_unset (peer, afi, safi);
3155
3156 return bgp_vty_return (vty, ret);
3157}
3158
3159/* neighbor default-originate. */
3160DEFUN (neighbor_default_originate,
3161 neighbor_default_originate_cmd,
3162 NEIGHBOR_CMD2 "default-originate",
3163 NEIGHBOR_STR
3164 NEIGHBOR_ADDR_STR2
3165 "Originate default route to this neighbor\n")
3166{
3167 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3168 bgp_node_safi (vty), NULL, 1);
3169}
3170
3171DEFUN (neighbor_default_originate_rmap,
3172 neighbor_default_originate_rmap_cmd,
3173 NEIGHBOR_CMD2 "default-originate route-map WORD",
3174 NEIGHBOR_STR
3175 NEIGHBOR_ADDR_STR2
3176 "Originate default route to this neighbor\n"
3177 "Route-map to specify criteria to originate default\n"
3178 "route-map name\n")
3179{
3180 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3181 bgp_node_safi (vty), argv[1], 1);
3182}
3183
3184DEFUN (no_neighbor_default_originate,
3185 no_neighbor_default_originate_cmd,
3186 NO_NEIGHBOR_CMD2 "default-originate",
3187 NO_STR
3188 NEIGHBOR_STR
3189 NEIGHBOR_ADDR_STR2
3190 "Originate default route to this neighbor\n")
3191{
3192 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3193 bgp_node_safi (vty), NULL, 0);
3194}
3195
3196ALIAS (no_neighbor_default_originate,
3197 no_neighbor_default_originate_rmap_cmd,
3198 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3199 NO_STR
3200 NEIGHBOR_STR
3201 NEIGHBOR_ADDR_STR2
3202 "Originate default route to this neighbor\n"
3203 "Route-map to specify criteria to originate default\n"
3204 "route-map name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003205
paul718e3742002-12-13 20:15:29 +00003206/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00003207static int
paulfd79ac92004-10-13 05:06:08 +00003208peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3209 const char *port_str)
paul718e3742002-12-13 20:15:29 +00003210{
3211 struct peer *peer;
3212 u_int16_t port;
3213 struct servent *sp;
3214
3215 peer = peer_lookup_vty (vty, ip_str);
3216 if (! peer)
3217 return CMD_WARNING;
3218
3219 if (! port_str)
3220 {
3221 sp = getservbyname ("bgp", "tcp");
3222 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3223 }
3224 else
3225 {
3226 VTY_GET_INTEGER("port", port, port_str);
3227 }
3228
3229 peer_port_set (peer, port);
3230
3231 return CMD_SUCCESS;
3232}
3233
hassof4184462005-02-01 20:13:16 +00003234/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00003235DEFUN (neighbor_port,
3236 neighbor_port_cmd,
3237 NEIGHBOR_CMD "port <0-65535>",
3238 NEIGHBOR_STR
3239 NEIGHBOR_ADDR_STR
3240 "Neighbor's BGP port\n"
3241 "TCP port number\n")
3242{
3243 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3244}
3245
3246DEFUN (no_neighbor_port,
3247 no_neighbor_port_cmd,
3248 NO_NEIGHBOR_CMD "port",
3249 NO_STR
3250 NEIGHBOR_STR
3251 NEIGHBOR_ADDR_STR
3252 "Neighbor's BGP port\n")
3253{
3254 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3255}
3256
3257ALIAS (no_neighbor_port,
3258 no_neighbor_port_val_cmd,
3259 NO_NEIGHBOR_CMD "port <0-65535>",
3260 NO_STR
3261 NEIGHBOR_STR
3262 NEIGHBOR_ADDR_STR
3263 "Neighbor's BGP port\n"
3264 "TCP port number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003265
paul718e3742002-12-13 20:15:29 +00003266/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00003267static int
paulfd79ac92004-10-13 05:06:08 +00003268peer_weight_set_vty (struct vty *vty, const char *ip_str,
3269 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00003270{
paul718e3742002-12-13 20:15:29 +00003271 struct peer *peer;
3272 unsigned long weight;
3273
3274 peer = peer_and_group_lookup_vty (vty, ip_str);
3275 if (! peer)
3276 return CMD_WARNING;
3277
3278 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3279
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003280 return bgp_vty_return (vty, peer_weight_set (peer, weight));
paul718e3742002-12-13 20:15:29 +00003281}
3282
paul94f2b392005-06-28 12:44:16 +00003283static int
paulfd79ac92004-10-13 05:06:08 +00003284peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003285{
3286 struct peer *peer;
3287
3288 peer = peer_and_group_lookup_vty (vty, ip_str);
3289 if (! peer)
3290 return CMD_WARNING;
3291
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003292 return bgp_vty_return (vty, peer_weight_unset (peer));
paul718e3742002-12-13 20:15:29 +00003293}
3294
3295DEFUN (neighbor_weight,
3296 neighbor_weight_cmd,
3297 NEIGHBOR_CMD2 "weight <0-65535>",
3298 NEIGHBOR_STR
3299 NEIGHBOR_ADDR_STR2
3300 "Set default weight for routes from this neighbor\n"
3301 "default weight\n")
3302{
3303 return peer_weight_set_vty (vty, argv[0], argv[1]);
3304}
3305
3306DEFUN (no_neighbor_weight,
3307 no_neighbor_weight_cmd,
3308 NO_NEIGHBOR_CMD2 "weight",
3309 NO_STR
3310 NEIGHBOR_STR
3311 NEIGHBOR_ADDR_STR2
3312 "Set default weight for routes from this neighbor\n")
3313{
3314 return peer_weight_unset_vty (vty, argv[0]);
3315}
3316
3317ALIAS (no_neighbor_weight,
3318 no_neighbor_weight_val_cmd,
3319 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3320 NO_STR
3321 NEIGHBOR_STR
3322 NEIGHBOR_ADDR_STR2
3323 "Set default weight for routes from this neighbor\n"
3324 "default weight\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003325
paul718e3742002-12-13 20:15:29 +00003326/* Override capability negotiation. */
3327DEFUN (neighbor_override_capability,
3328 neighbor_override_capability_cmd,
3329 NEIGHBOR_CMD2 "override-capability",
3330 NEIGHBOR_STR
3331 NEIGHBOR_ADDR_STR2
3332 "Override capability negotiation result\n")
3333{
3334 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3335}
3336
3337DEFUN (no_neighbor_override_capability,
3338 no_neighbor_override_capability_cmd,
3339 NO_NEIGHBOR_CMD2 "override-capability",
3340 NO_STR
3341 NEIGHBOR_STR
3342 NEIGHBOR_ADDR_STR2
3343 "Override capability negotiation result\n")
3344{
3345 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3346}
David Lamparter6b0655a2014-06-04 06:53:35 +02003347
paul718e3742002-12-13 20:15:29 +00003348DEFUN (neighbor_strict_capability,
3349 neighbor_strict_capability_cmd,
3350 NEIGHBOR_CMD "strict-capability-match",
3351 NEIGHBOR_STR
3352 NEIGHBOR_ADDR_STR
3353 "Strict capability negotiation match\n")
3354{
3355 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3356}
3357
3358DEFUN (no_neighbor_strict_capability,
3359 no_neighbor_strict_capability_cmd,
3360 NO_NEIGHBOR_CMD "strict-capability-match",
3361 NO_STR
3362 NEIGHBOR_STR
3363 NEIGHBOR_ADDR_STR
3364 "Strict capability negotiation match\n")
3365{
3366 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3367}
David Lamparter6b0655a2014-06-04 06:53:35 +02003368
paul94f2b392005-06-28 12:44:16 +00003369static int
paulfd79ac92004-10-13 05:06:08 +00003370peer_timers_set_vty (struct vty *vty, const char *ip_str,
3371 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003372{
3373 int ret;
3374 struct peer *peer;
3375 u_int32_t keepalive;
3376 u_int32_t holdtime;
3377
3378 peer = peer_and_group_lookup_vty (vty, ip_str);
3379 if (! peer)
3380 return CMD_WARNING;
3381
3382 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3383 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3384
3385 ret = peer_timers_set (peer, keepalive, holdtime);
3386
3387 return bgp_vty_return (vty, ret);
3388}
David Lamparter6b0655a2014-06-04 06:53:35 +02003389
paul94f2b392005-06-28 12:44:16 +00003390static int
paulfd79ac92004-10-13 05:06:08 +00003391peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003392{
3393 int ret;
3394 struct peer *peer;
3395
3396 peer = peer_lookup_vty (vty, ip_str);
3397 if (! peer)
3398 return CMD_WARNING;
3399
3400 ret = peer_timers_unset (peer);
3401
3402 return bgp_vty_return (vty, ret);
3403}
3404
3405DEFUN (neighbor_timers,
3406 neighbor_timers_cmd,
3407 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3408 NEIGHBOR_STR
3409 NEIGHBOR_ADDR_STR2
3410 "BGP per neighbor timers\n"
3411 "Keepalive interval\n"
3412 "Holdtime\n")
3413{
3414 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3415}
3416
3417DEFUN (no_neighbor_timers,
3418 no_neighbor_timers_cmd,
3419 NO_NEIGHBOR_CMD2 "timers",
3420 NO_STR
3421 NEIGHBOR_STR
3422 NEIGHBOR_ADDR_STR2
3423 "BGP per neighbor timers\n")
3424{
3425 return peer_timers_unset_vty (vty, argv[0]);
3426}
David Lamparter6b0655a2014-06-04 06:53:35 +02003427
paul94f2b392005-06-28 12:44:16 +00003428static int
paulfd79ac92004-10-13 05:06:08 +00003429peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3430 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003431{
paul718e3742002-12-13 20:15:29 +00003432 struct peer *peer;
3433 u_int32_t connect;
3434
Daniel Walton0d7435f2015-10-22 11:35:20 +03003435 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003436 if (! peer)
3437 return CMD_WARNING;
3438
3439 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3440
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003441 return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
paul718e3742002-12-13 20:15:29 +00003442}
3443
paul94f2b392005-06-28 12:44:16 +00003444static int
paulfd79ac92004-10-13 05:06:08 +00003445peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003446{
paul718e3742002-12-13 20:15:29 +00003447 struct peer *peer;
3448
3449 peer = peer_and_group_lookup_vty (vty, ip_str);
3450 if (! peer)
3451 return CMD_WARNING;
3452
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003453 return bgp_vty_return (vty, peer_timers_connect_unset (peer));
paul718e3742002-12-13 20:15:29 +00003454}
3455
3456DEFUN (neighbor_timers_connect,
3457 neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003458 NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003459 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003460 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003461 "BGP per neighbor timers\n"
3462 "BGP connect timer\n"
3463 "Connect timer\n")
3464{
3465 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3466}
3467
3468DEFUN (no_neighbor_timers_connect,
3469 no_neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003470 NO_NEIGHBOR_CMD2 "timers connect",
paul718e3742002-12-13 20:15:29 +00003471 NO_STR
3472 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003473 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003474 "BGP per neighbor timers\n"
3475 "BGP connect timer\n")
3476{
3477 return peer_timers_connect_unset_vty (vty, argv[0]);
3478}
3479
3480ALIAS (no_neighbor_timers_connect,
3481 no_neighbor_timers_connect_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003482 NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003483 NO_STR
3484 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003485 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003486 "BGP per neighbor timers\n"
3487 "BGP connect timer\n"
3488 "Connect timer\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003489
paul94f2b392005-06-28 12:44:16 +00003490static int
paulfd79ac92004-10-13 05:06:08 +00003491peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3492 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003493{
3494 int ret;
3495 struct peer *peer;
3496 u_int32_t routeadv = 0;
3497
Daniel Walton0d7435f2015-10-22 11:35:20 +03003498 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003499 if (! peer)
3500 return CMD_WARNING;
3501
3502 if (time_str)
3503 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3504
3505 if (set)
3506 ret = peer_advertise_interval_set (peer, routeadv);
3507 else
3508 ret = peer_advertise_interval_unset (peer);
3509
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003510 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003511}
3512
3513DEFUN (neighbor_advertise_interval,
3514 neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003515 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003516 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003517 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003518 "Minimum interval between sending BGP routing updates\n"
3519 "time in seconds\n")
3520{
3521 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3522}
3523
3524DEFUN (no_neighbor_advertise_interval,
3525 no_neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003526 NO_NEIGHBOR_CMD2 "advertisement-interval",
paul718e3742002-12-13 20:15:29 +00003527 NO_STR
3528 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003529 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003530 "Minimum interval between sending BGP routing updates\n")
3531{
3532 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3533}
3534
3535ALIAS (no_neighbor_advertise_interval,
3536 no_neighbor_advertise_interval_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003537 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003538 NO_STR
3539 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003540 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003541 "Minimum interval between sending BGP routing updates\n"
3542 "time in seconds\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003543
paul718e3742002-12-13 20:15:29 +00003544/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003545static int
paulfd79ac92004-10-13 05:06:08 +00003546peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003547{
3548 int ret;
3549 struct peer *peer;
3550
3551 peer = peer_lookup_vty (vty, ip_str);
3552 if (! peer)
3553 return CMD_WARNING;
3554
3555 if (str)
3556 ret = peer_interface_set (peer, str);
3557 else
3558 ret = peer_interface_unset (peer);
3559
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003560 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003561}
3562
3563DEFUN (neighbor_interface,
3564 neighbor_interface_cmd,
3565 NEIGHBOR_CMD "interface WORD",
3566 NEIGHBOR_STR
3567 NEIGHBOR_ADDR_STR
3568 "Interface\n"
3569 "Interface name\n")
3570{
3571 return peer_interface_vty (vty, argv[0], argv[1]);
3572}
3573
3574DEFUN (no_neighbor_interface,
3575 no_neighbor_interface_cmd,
3576 NO_NEIGHBOR_CMD "interface WORD",
3577 NO_STR
3578 NEIGHBOR_STR
3579 NEIGHBOR_ADDR_STR
3580 "Interface\n"
3581 "Interface name\n")
3582{
3583 return peer_interface_vty (vty, argv[0], NULL);
3584}
David Lamparter6b0655a2014-06-04 06:53:35 +02003585
paul718e3742002-12-13 20:15:29 +00003586/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003587static int
paulfd79ac92004-10-13 05:06:08 +00003588peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3589 afi_t afi, safi_t safi,
3590 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003591{
3592 int ret;
3593 struct peer *peer;
3594 int direct = FILTER_IN;
3595
3596 peer = peer_and_group_lookup_vty (vty, ip_str);
3597 if (! peer)
3598 return CMD_WARNING;
3599
3600 /* Check filter direction. */
3601 if (strncmp (direct_str, "i", 1) == 0)
3602 direct = FILTER_IN;
3603 else if (strncmp (direct_str, "o", 1) == 0)
3604 direct = FILTER_OUT;
3605
3606 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3607
3608 return bgp_vty_return (vty, ret);
3609}
3610
paul94f2b392005-06-28 12:44:16 +00003611static int
paulfd79ac92004-10-13 05:06:08 +00003612peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3613 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003614{
3615 int ret;
3616 struct peer *peer;
3617 int direct = FILTER_IN;
3618
3619 peer = peer_and_group_lookup_vty (vty, ip_str);
3620 if (! peer)
3621 return CMD_WARNING;
3622
3623 /* Check filter direction. */
3624 if (strncmp (direct_str, "i", 1) == 0)
3625 direct = FILTER_IN;
3626 else if (strncmp (direct_str, "o", 1) == 0)
3627 direct = FILTER_OUT;
3628
3629 ret = peer_distribute_unset (peer, afi, safi, direct);
3630
3631 return bgp_vty_return (vty, ret);
3632}
3633
3634DEFUN (neighbor_distribute_list,
3635 neighbor_distribute_list_cmd,
3636 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3637 NEIGHBOR_STR
3638 NEIGHBOR_ADDR_STR2
3639 "Filter updates to/from this neighbor\n"
3640 "IP access-list number\n"
3641 "IP access-list number (expanded range)\n"
3642 "IP Access-list name\n"
3643 "Filter incoming updates\n"
3644 "Filter outgoing updates\n")
3645{
3646 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3647 bgp_node_safi (vty), argv[1], argv[2]);
3648}
3649
3650DEFUN (no_neighbor_distribute_list,
3651 no_neighbor_distribute_list_cmd,
3652 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3653 NO_STR
3654 NEIGHBOR_STR
3655 NEIGHBOR_ADDR_STR2
3656 "Filter updates to/from this neighbor\n"
3657 "IP access-list number\n"
3658 "IP access-list number (expanded range)\n"
3659 "IP Access-list name\n"
3660 "Filter incoming updates\n"
3661 "Filter outgoing updates\n")
3662{
3663 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3664 bgp_node_safi (vty), argv[2]);
3665}
David Lamparter6b0655a2014-06-04 06:53:35 +02003666
paul718e3742002-12-13 20:15:29 +00003667/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003668static int
paulfd79ac92004-10-13 05:06:08 +00003669peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3670 safi_t safi, const char *name_str,
3671 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003672{
3673 int ret;
3674 struct peer *peer;
3675 int direct = FILTER_IN;
3676
3677 peer = peer_and_group_lookup_vty (vty, ip_str);
3678 if (! peer)
3679 return CMD_WARNING;
3680
3681 /* Check filter direction. */
3682 if (strncmp (direct_str, "i", 1) == 0)
3683 direct = FILTER_IN;
3684 else if (strncmp (direct_str, "o", 1) == 0)
3685 direct = FILTER_OUT;
3686
3687 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3688
3689 return bgp_vty_return (vty, ret);
3690}
3691
paul94f2b392005-06-28 12:44:16 +00003692static int
paulfd79ac92004-10-13 05:06:08 +00003693peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3694 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003695{
3696 int ret;
3697 struct peer *peer;
3698 int direct = FILTER_IN;
3699
3700 peer = peer_and_group_lookup_vty (vty, ip_str);
3701 if (! peer)
3702 return CMD_WARNING;
3703
3704 /* Check filter direction. */
3705 if (strncmp (direct_str, "i", 1) == 0)
3706 direct = FILTER_IN;
3707 else if (strncmp (direct_str, "o", 1) == 0)
3708 direct = FILTER_OUT;
3709
3710 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3711
3712 return bgp_vty_return (vty, ret);
3713}
3714
3715DEFUN (neighbor_prefix_list,
3716 neighbor_prefix_list_cmd,
3717 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3718 NEIGHBOR_STR
3719 NEIGHBOR_ADDR_STR2
3720 "Filter updates to/from this neighbor\n"
3721 "Name of a prefix list\n"
3722 "Filter incoming updates\n"
3723 "Filter outgoing updates\n")
3724{
3725 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3726 bgp_node_safi (vty), argv[1], argv[2]);
3727}
3728
3729DEFUN (no_neighbor_prefix_list,
3730 no_neighbor_prefix_list_cmd,
3731 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3732 NO_STR
3733 NEIGHBOR_STR
3734 NEIGHBOR_ADDR_STR2
3735 "Filter updates to/from this neighbor\n"
3736 "Name of a prefix list\n"
3737 "Filter incoming updates\n"
3738 "Filter outgoing updates\n")
3739{
3740 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3741 bgp_node_safi (vty), argv[2]);
3742}
David Lamparter6b0655a2014-06-04 06:53:35 +02003743
paul94f2b392005-06-28 12:44:16 +00003744static int
paulfd79ac92004-10-13 05:06:08 +00003745peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3746 afi_t afi, safi_t safi,
3747 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003748{
3749 int ret;
3750 struct peer *peer;
3751 int direct = FILTER_IN;
3752
3753 peer = peer_and_group_lookup_vty (vty, ip_str);
3754 if (! peer)
3755 return CMD_WARNING;
3756
3757 /* Check filter direction. */
3758 if (strncmp (direct_str, "i", 1) == 0)
3759 direct = FILTER_IN;
3760 else if (strncmp (direct_str, "o", 1) == 0)
3761 direct = FILTER_OUT;
3762
3763 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3764
3765 return bgp_vty_return (vty, ret);
3766}
3767
paul94f2b392005-06-28 12:44:16 +00003768static int
paulfd79ac92004-10-13 05:06:08 +00003769peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3770 afi_t afi, safi_t safi,
3771 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003772{
3773 int ret;
3774 struct peer *peer;
3775 int direct = FILTER_IN;
3776
3777 peer = peer_and_group_lookup_vty (vty, ip_str);
3778 if (! peer)
3779 return CMD_WARNING;
3780
3781 /* Check filter direction. */
3782 if (strncmp (direct_str, "i", 1) == 0)
3783 direct = FILTER_IN;
3784 else if (strncmp (direct_str, "o", 1) == 0)
3785 direct = FILTER_OUT;
3786
3787 ret = peer_aslist_unset (peer, afi, safi, direct);
3788
3789 return bgp_vty_return (vty, ret);
3790}
3791
3792DEFUN (neighbor_filter_list,
3793 neighbor_filter_list_cmd,
3794 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3795 NEIGHBOR_STR
3796 NEIGHBOR_ADDR_STR2
3797 "Establish BGP filters\n"
3798 "AS path access-list name\n"
3799 "Filter incoming routes\n"
3800 "Filter outgoing routes\n")
3801{
3802 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3803 bgp_node_safi (vty), argv[1], argv[2]);
3804}
3805
3806DEFUN (no_neighbor_filter_list,
3807 no_neighbor_filter_list_cmd,
3808 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3809 NO_STR
3810 NEIGHBOR_STR
3811 NEIGHBOR_ADDR_STR2
3812 "Establish BGP filters\n"
3813 "AS path access-list name\n"
3814 "Filter incoming routes\n"
3815 "Filter outgoing routes\n")
3816{
3817 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3818 bgp_node_safi (vty), argv[2]);
3819}
David Lamparter6b0655a2014-06-04 06:53:35 +02003820
paul718e3742002-12-13 20:15:29 +00003821/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003822static int
paulfd79ac92004-10-13 05:06:08 +00003823peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3824 afi_t afi, safi_t safi,
3825 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003826{
3827 int ret;
3828 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003829 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003830
3831 peer = peer_and_group_lookup_vty (vty, ip_str);
3832 if (! peer)
3833 return CMD_WARNING;
3834
3835 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003836 if (strncmp (direct_str, "in", 2) == 0)
3837 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003838 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003839 direct = RMAP_OUT;
3840 else if (strncmp (direct_str, "im", 2) == 0)
3841 direct = RMAP_IMPORT;
3842 else if (strncmp (direct_str, "e", 1) == 0)
3843 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003844
3845 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3846
3847 return bgp_vty_return (vty, ret);
3848}
3849
paul94f2b392005-06-28 12:44:16 +00003850static int
paulfd79ac92004-10-13 05:06:08 +00003851peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3852 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003853{
3854 int ret;
3855 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003856 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003857
3858 peer = peer_and_group_lookup_vty (vty, ip_str);
3859 if (! peer)
3860 return CMD_WARNING;
3861
3862 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003863 if (strncmp (direct_str, "in", 2) == 0)
3864 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003865 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003866 direct = RMAP_OUT;
3867 else if (strncmp (direct_str, "im", 2) == 0)
3868 direct = RMAP_IMPORT;
3869 else if (strncmp (direct_str, "e", 1) == 0)
3870 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003871
3872 ret = peer_route_map_unset (peer, afi, safi, direct);
3873
3874 return bgp_vty_return (vty, ret);
3875}
3876
3877DEFUN (neighbor_route_map,
3878 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003879 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003880 NEIGHBOR_STR
3881 NEIGHBOR_ADDR_STR2
3882 "Apply route map to neighbor\n"
3883 "Name of route map\n"
3884 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003885 "Apply map to outbound routes\n"
3886 "Apply map to routes going into a Route-Server client's table\n"
3887 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003888{
3889 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3890 bgp_node_safi (vty), argv[1], argv[2]);
3891}
3892
3893DEFUN (no_neighbor_route_map,
3894 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003895 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003896 NO_STR
3897 NEIGHBOR_STR
3898 NEIGHBOR_ADDR_STR2
3899 "Apply route map to neighbor\n"
3900 "Name of route map\n"
3901 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003902 "Apply map to outbound routes\n"
3903 "Apply map to routes going into a Route-Server client's table\n"
3904 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003905{
3906 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3907 bgp_node_safi (vty), argv[2]);
3908}
David Lamparter6b0655a2014-06-04 06:53:35 +02003909
paul718e3742002-12-13 20:15:29 +00003910/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003911static int
paulfd79ac92004-10-13 05:06:08 +00003912peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3913 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003914{
3915 int ret;
3916 struct peer *peer;
3917
3918 peer = peer_and_group_lookup_vty (vty, ip_str);
3919 if (! peer)
3920 return CMD_WARNING;
3921
3922 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3923
3924 return bgp_vty_return (vty, ret);
3925}
3926
3927/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003928static int
paulfd79ac92004-10-13 05:06:08 +00003929peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003930 safi_t safi)
3931{
3932 int ret;
3933 struct peer *peer;
3934
3935 peer = peer_and_group_lookup_vty (vty, ip_str);
3936 if (! peer)
3937 return CMD_WARNING;
3938
3939 ret = peer_unsuppress_map_unset (peer, afi, safi);
3940
3941 return bgp_vty_return (vty, ret);
3942}
3943
3944DEFUN (neighbor_unsuppress_map,
3945 neighbor_unsuppress_map_cmd,
3946 NEIGHBOR_CMD2 "unsuppress-map WORD",
3947 NEIGHBOR_STR
3948 NEIGHBOR_ADDR_STR2
3949 "Route-map to selectively unsuppress suppressed routes\n"
3950 "Name of route map\n")
3951{
3952 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3953 bgp_node_safi (vty), argv[1]);
3954}
3955
3956DEFUN (no_neighbor_unsuppress_map,
3957 no_neighbor_unsuppress_map_cmd,
3958 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3959 NO_STR
3960 NEIGHBOR_STR
3961 NEIGHBOR_ADDR_STR2
3962 "Route-map to selectively unsuppress suppressed routes\n"
3963 "Name of route map\n")
3964{
3965 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3966 bgp_node_safi (vty));
3967}
David Lamparter6b0655a2014-06-04 06:53:35 +02003968
paul94f2b392005-06-28 12:44:16 +00003969static int
paulfd79ac92004-10-13 05:06:08 +00003970peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3971 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003972 const char *threshold_str, int warning,
3973 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003974{
3975 int ret;
3976 struct peer *peer;
3977 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003978 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003979 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003980
3981 peer = peer_and_group_lookup_vty (vty, ip_str);
3982 if (! peer)
3983 return CMD_WARNING;
3984
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04003985 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003986 if (threshold_str)
3987 threshold = atoi (threshold_str);
3988 else
3989 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00003990
hasso0a486e52005-02-01 20:57:17 +00003991 if (restart_str)
3992 restart = atoi (restart_str);
3993 else
3994 restart = 0;
3995
3996 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00003997
3998 return bgp_vty_return (vty, ret);
3999}
4000
paul94f2b392005-06-28 12:44:16 +00004001static int
paulfd79ac92004-10-13 05:06:08 +00004002peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00004003 safi_t safi)
4004{
4005 int ret;
4006 struct peer *peer;
4007
4008 peer = peer_and_group_lookup_vty (vty, ip_str);
4009 if (! peer)
4010 return CMD_WARNING;
4011
4012 ret = peer_maximum_prefix_unset (peer, afi, safi);
4013
4014 return bgp_vty_return (vty, ret);
4015}
4016
4017/* Maximum number of prefix configuration. prefix count is different
4018 for each peer configuration. So this configuration can be set for
4019 each peer configuration. */
4020DEFUN (neighbor_maximum_prefix,
4021 neighbor_maximum_prefix_cmd,
4022 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4023 NEIGHBOR_STR
4024 NEIGHBOR_ADDR_STR2
4025 "Maximum number of prefix accept from this peer\n"
4026 "maximum no. of prefix limit\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], NULL, 0,
4030 NULL);
paul718e3742002-12-13 20:15:29 +00004031}
4032
hassoe0701b72004-05-20 09:19:34 +00004033DEFUN (neighbor_maximum_prefix_threshold,
4034 neighbor_maximum_prefix_threshold_cmd,
4035 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
4036 NEIGHBOR_STR
4037 NEIGHBOR_ADDR_STR2
4038 "Maximum number of prefix accept from this peer\n"
4039 "maximum no. of prefix limit\n"
4040 "Threshold value (%) at which to generate a warning msg\n")
4041{
4042 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004043 bgp_node_safi (vty), argv[1], argv[2], 0,
4044 NULL);
4045}
hassoe0701b72004-05-20 09:19:34 +00004046
paul718e3742002-12-13 20:15:29 +00004047DEFUN (neighbor_maximum_prefix_warning,
4048 neighbor_maximum_prefix_warning_cmd,
4049 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4050 NEIGHBOR_STR
4051 NEIGHBOR_ADDR_STR2
4052 "Maximum number of prefix accept from this peer\n"
4053 "maximum no. of prefix limit\n"
4054 "Only give warning message when limit is exceeded\n")
4055{
4056 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004057 bgp_node_safi (vty), argv[1], NULL, 1,
4058 NULL);
paul718e3742002-12-13 20:15:29 +00004059}
4060
hassoe0701b72004-05-20 09:19:34 +00004061DEFUN (neighbor_maximum_prefix_threshold_warning,
4062 neighbor_maximum_prefix_threshold_warning_cmd,
4063 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4064 NEIGHBOR_STR
4065 NEIGHBOR_ADDR_STR2
4066 "Maximum number of prefix accept from this peer\n"
4067 "maximum no. of prefix limit\n"
4068 "Threshold value (%) at which to generate a warning msg\n"
4069 "Only give warning message when limit is exceeded\n")
4070{
4071 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004072 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4073}
4074
4075DEFUN (neighbor_maximum_prefix_restart,
4076 neighbor_maximum_prefix_restart_cmd,
4077 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
4078 NEIGHBOR_STR
4079 NEIGHBOR_ADDR_STR2
4080 "Maximum number of prefix accept from this peer\n"
4081 "maximum no. of prefix limit\n"
4082 "Restart bgp connection after limit is exceeded\n"
4083 "Restart interval in minutes")
4084{
4085 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4086 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
4087}
4088
4089DEFUN (neighbor_maximum_prefix_threshold_restart,
4090 neighbor_maximum_prefix_threshold_restart_cmd,
4091 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4092 NEIGHBOR_STR
4093 NEIGHBOR_ADDR_STR2
4094 "Maximum number of prefix accept from this peer\n"
4095 "maximum no. of prefix limit\n"
4096 "Threshold value (%) at which to generate a warning msg\n"
4097 "Restart bgp connection after limit is exceeded\n"
4098 "Restart interval in minutes")
4099{
4100 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4101 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4102}
hassoe0701b72004-05-20 09:19:34 +00004103
paul718e3742002-12-13 20:15:29 +00004104DEFUN (no_neighbor_maximum_prefix,
4105 no_neighbor_maximum_prefix_cmd,
4106 NO_NEIGHBOR_CMD2 "maximum-prefix",
4107 NO_STR
4108 NEIGHBOR_STR
4109 NEIGHBOR_ADDR_STR2
4110 "Maximum number of prefix accept from this peer\n")
4111{
4112 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4113 bgp_node_safi (vty));
4114}
4115
4116ALIAS (no_neighbor_maximum_prefix,
4117 no_neighbor_maximum_prefix_val_cmd,
4118 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4119 NO_STR
4120 NEIGHBOR_STR
4121 NEIGHBOR_ADDR_STR2
4122 "Maximum number of prefix accept from this peer\n"
4123 "maximum no. of prefix limit\n")
4124
4125ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004126 no_neighbor_maximum_prefix_threshold_cmd,
4127 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4128 NO_STR
4129 NEIGHBOR_STR
4130 NEIGHBOR_ADDR_STR2
4131 "Maximum number of prefix accept from this peer\n"
4132 "maximum no. of prefix limit\n"
4133 "Threshold value (%) at which to generate a warning msg\n")
4134
4135ALIAS (no_neighbor_maximum_prefix,
4136 no_neighbor_maximum_prefix_warning_cmd,
4137 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4138 NO_STR
4139 NEIGHBOR_STR
4140 NEIGHBOR_ADDR_STR2
4141 "Maximum number of prefix accept from this peer\n"
4142 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00004143 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004144
4145ALIAS (no_neighbor_maximum_prefix,
4146 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004147 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4148 NO_STR
4149 NEIGHBOR_STR
4150 NEIGHBOR_ADDR_STR2
4151 "Maximum number of prefix accept from this peer\n"
4152 "maximum no. of prefix limit\n"
4153 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004154 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004155
4156ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004157 no_neighbor_maximum_prefix_restart_cmd,
4158 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004159 NO_STR
4160 NEIGHBOR_STR
4161 NEIGHBOR_ADDR_STR2
4162 "Maximum number of prefix accept from this peer\n"
4163 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00004164 "Restart bgp connection after limit is exceeded\n"
4165 "Restart interval in minutes")
4166
4167ALIAS (no_neighbor_maximum_prefix,
4168 no_neighbor_maximum_prefix_threshold_restart_cmd,
4169 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4170 NO_STR
4171 NEIGHBOR_STR
4172 NEIGHBOR_ADDR_STR2
4173 "Maximum number of prefix accept from this peer\n"
4174 "maximum no. of prefix limit\n"
4175 "Threshold value (%) at which to generate a warning msg\n"
4176 "Restart bgp connection after limit is exceeded\n"
4177 "Restart interval in minutes")
David Lamparter6b0655a2014-06-04 06:53:35 +02004178
paul718e3742002-12-13 20:15:29 +00004179/* "neighbor allowas-in" */
4180DEFUN (neighbor_allowas_in,
4181 neighbor_allowas_in_cmd,
4182 NEIGHBOR_CMD2 "allowas-in",
4183 NEIGHBOR_STR
4184 NEIGHBOR_ADDR_STR2
4185 "Accept as-path with my AS present in it\n")
4186{
4187 int ret;
4188 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004189 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004190
4191 peer = peer_and_group_lookup_vty (vty, argv[0]);
4192 if (! peer)
4193 return CMD_WARNING;
4194
4195 if (argc == 1)
4196 allow_num = 3;
4197 else
4198 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4199
4200 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4201 allow_num);
4202
4203 return bgp_vty_return (vty, ret);
4204}
4205
4206ALIAS (neighbor_allowas_in,
4207 neighbor_allowas_in_arg_cmd,
4208 NEIGHBOR_CMD2 "allowas-in <1-10>",
4209 NEIGHBOR_STR
4210 NEIGHBOR_ADDR_STR2
4211 "Accept as-path with my AS present in it\n"
4212 "Number of occurances of AS number\n")
4213
4214DEFUN (no_neighbor_allowas_in,
4215 no_neighbor_allowas_in_cmd,
4216 NO_NEIGHBOR_CMD2 "allowas-in",
4217 NO_STR
4218 NEIGHBOR_STR
4219 NEIGHBOR_ADDR_STR2
4220 "allow local ASN appears in aspath attribute\n")
4221{
4222 int ret;
4223 struct peer *peer;
4224
4225 peer = peer_and_group_lookup_vty (vty, argv[0]);
4226 if (! peer)
4227 return CMD_WARNING;
4228
4229 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4230
4231 return bgp_vty_return (vty, ret);
4232}
David Lamparter6b0655a2014-06-04 06:53:35 +02004233
Nick Hilliardfa411a22011-03-23 15:33:17 +00004234DEFUN (neighbor_ttl_security,
4235 neighbor_ttl_security_cmd,
4236 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4237 NEIGHBOR_STR
4238 NEIGHBOR_ADDR_STR2
4239 "Specify the maximum number of hops to the BGP peer\n")
4240{
4241 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004242 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004243
4244 peer = peer_and_group_lookup_vty (vty, argv[0]);
4245 if (! peer)
4246 return CMD_WARNING;
4247
4248 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4249
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004250 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004251}
4252
4253DEFUN (no_neighbor_ttl_security,
4254 no_neighbor_ttl_security_cmd,
4255 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4256 NO_STR
4257 NEIGHBOR_STR
4258 NEIGHBOR_ADDR_STR2
4259 "Specify the maximum number of hops to the BGP peer\n")
4260{
4261 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004262
4263 peer = peer_and_group_lookup_vty (vty, argv[0]);
4264 if (! peer)
4265 return CMD_WARNING;
4266
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004267 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004268}
David Lamparter6b0655a2014-06-04 06:53:35 +02004269
paul718e3742002-12-13 20:15:29 +00004270/* Address family configuration. */
4271DEFUN (address_family_ipv4,
4272 address_family_ipv4_cmd,
4273 "address-family ipv4",
4274 "Enter Address Family command mode\n"
4275 "Address family\n")
4276{
4277 vty->node = BGP_IPV4_NODE;
4278 return CMD_SUCCESS;
4279}
4280
4281DEFUN (address_family_ipv4_safi,
4282 address_family_ipv4_safi_cmd,
4283 "address-family ipv4 (unicast|multicast)",
4284 "Enter Address Family command mode\n"
4285 "Address family\n"
4286 "Address Family modifier\n"
4287 "Address Family modifier\n")
4288{
4289 if (strncmp (argv[0], "m", 1) == 0)
4290 vty->node = BGP_IPV4M_NODE;
4291 else
4292 vty->node = BGP_IPV4_NODE;
4293
4294 return CMD_SUCCESS;
4295}
4296
paul25ffbdc2005-08-22 22:42:08 +00004297DEFUN (address_family_ipv6,
4298 address_family_ipv6_cmd,
4299 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004300 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004301 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004302{
4303 vty->node = BGP_IPV6_NODE;
4304 return CMD_SUCCESS;
4305}
4306
paul25ffbdc2005-08-22 22:42:08 +00004307DEFUN (address_family_ipv6_safi,
4308 address_family_ipv6_safi_cmd,
4309 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004310 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004311 "Address family\n"
4312 "Address Family modifier\n"
4313 "Address Family modifier\n")
4314{
4315 if (strncmp (argv[0], "m", 1) == 0)
4316 vty->node = BGP_IPV6M_NODE;
4317 else
4318 vty->node = BGP_IPV6_NODE;
4319
4320 return CMD_SUCCESS;
4321}
paul718e3742002-12-13 20:15:29 +00004322
4323DEFUN (address_family_vpnv4,
4324 address_family_vpnv4_cmd,
4325 "address-family vpnv4",
4326 "Enter Address Family command mode\n"
4327 "Address family\n")
4328{
4329 vty->node = BGP_VPNV4_NODE;
4330 return CMD_SUCCESS;
4331}
4332
4333ALIAS (address_family_vpnv4,
4334 address_family_vpnv4_unicast_cmd,
4335 "address-family vpnv4 unicast",
4336 "Enter Address Family command mode\n"
4337 "Address family\n"
4338 "Address Family Modifier\n")
4339
Lou Berger13c378d2016-01-12 13:41:56 -05004340DEFUN (address_family_vpnv6,
4341 address_family_vpnv6_cmd,
4342 "address-family vpnv6",
4343 "Enter Address Family command mode\n"
4344 "Address family\n")
4345{
4346 vty->node = BGP_VPNV6_NODE;
4347 return CMD_SUCCESS;
4348}
4349
4350ALIAS (address_family_vpnv6,
4351 address_family_vpnv6_unicast_cmd,
4352 "address-family vpnv6 unicast",
4353 "Enter Address Family command mode\n"
4354 "Address family\n"
4355 "Address Family Modifier\n")
4356
Lou Bergera3fda882016-01-12 13:42:04 -05004357DEFUN (address_family_encap,
4358 address_family_encap_cmd,
4359 "address-family encap",
4360 "Enter Address Family command mode\n"
4361 "Address family\n")
4362{
4363 vty->node = BGP_ENCAP_NODE;
4364 return CMD_SUCCESS;
4365}
4366
4367ALIAS (address_family_encap,
4368 address_family_encapv4_cmd,
4369 "address-family encapv4",
4370 "Enter Address Family command mode\n"
4371 "Address family\n")
4372
4373DEFUN (address_family_encapv6,
4374 address_family_encapv6_cmd,
4375 "address-family encapv6",
4376 "Enter Address Family command mode\n"
4377 "Address family\n")
4378{
4379 vty->node = BGP_ENCAPV6_NODE;
4380 return CMD_SUCCESS;
4381}
4382
paul718e3742002-12-13 20:15:29 +00004383DEFUN (exit_address_family,
4384 exit_address_family_cmd,
4385 "exit-address-family",
4386 "Exit from Address Family configuration mode\n")
4387{
Lou Bergera3fda882016-01-12 13:42:04 -05004388 /* should match list in command.c:config_exit */
hassoa8a80d52005-04-09 13:07:47 +00004389 if (vty->node == BGP_IPV4_NODE
Lou Bergera3fda882016-01-12 13:42:04 -05004390 || vty->node == BGP_ENCAP_NODE
4391 || vty->node == BGP_ENCAPV6_NODE
hassoa8a80d52005-04-09 13:07:47 +00004392 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004393 || vty->node == BGP_VPNV4_NODE
Lou Berger13c378d2016-01-12 13:41:56 -05004394 || vty->node == BGP_VPNV6_NODE
paul25ffbdc2005-08-22 22:42:08 +00004395 || vty->node == BGP_IPV6_NODE
4396 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004397 vty->node = BGP_NODE;
4398 return CMD_SUCCESS;
4399}
David Lamparter6b0655a2014-06-04 06:53:35 +02004400
paul718e3742002-12-13 20:15:29 +00004401/* BGP clear sort. */
4402enum clear_sort
4403{
4404 clear_all,
4405 clear_peer,
4406 clear_group,
4407 clear_external,
4408 clear_as
4409};
4410
paul94f2b392005-06-28 12:44:16 +00004411static void
paul718e3742002-12-13 20:15:29 +00004412bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4413 safi_t safi, int error)
4414{
4415 switch (error)
4416 {
4417 case BGP_ERR_AF_UNCONFIGURED:
4418 vty_out (vty,
4419 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4420 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4421 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4422 peer->host, VTY_NEWLINE);
4423 break;
4424 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4425 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);
4426 break;
4427 default:
4428 break;
4429 }
4430}
4431
4432/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004433static int
paul718e3742002-12-13 20:15:29 +00004434bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004435 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004436{
4437 int ret;
4438 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004439 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004440
4441 /* Clear all neighbors. */
4442 if (sort == clear_all)
4443 {
paul1eb8ef22005-04-07 07:30:20 +00004444 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004445 {
4446 if (stype == BGP_CLEAR_SOFT_NONE)
4447 ret = peer_clear (peer);
4448 else
4449 ret = peer_clear_soft (peer, afi, safi, stype);
4450
4451 if (ret < 0)
4452 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4453 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004454 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004455 }
4456
4457 /* Clear specified neighbors. */
4458 if (sort == clear_peer)
4459 {
4460 union sockunion su;
4461 int ret;
4462
4463 /* Make sockunion for lookup. */
4464 ret = str2sockunion (arg, &su);
4465 if (ret < 0)
4466 {
4467 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004468 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004469 }
4470 peer = peer_lookup (bgp, &su);
4471 if (! peer)
4472 {
4473 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004474 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004475 }
4476
4477 if (stype == BGP_CLEAR_SOFT_NONE)
4478 ret = peer_clear (peer);
4479 else
4480 ret = peer_clear_soft (peer, afi, safi, stype);
4481
4482 if (ret < 0)
4483 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4484
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004485 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004486 }
4487
4488 /* Clear all peer-group members. */
4489 if (sort == clear_group)
4490 {
4491 struct peer_group *group;
4492
4493 group = peer_group_lookup (bgp, arg);
4494 if (! group)
4495 {
4496 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004497 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004498 }
4499
paul1eb8ef22005-04-07 07:30:20 +00004500 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004501 {
4502 if (stype == BGP_CLEAR_SOFT_NONE)
4503 {
4504 ret = peer_clear (peer);
4505 continue;
4506 }
4507
4508 if (! peer->af_group[afi][safi])
4509 continue;
4510
4511 ret = peer_clear_soft (peer, afi, safi, stype);
4512
4513 if (ret < 0)
4514 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4515 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004516 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004517 }
4518
4519 if (sort == clear_external)
4520 {
paul1eb8ef22005-04-07 07:30:20 +00004521 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004522 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004523 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004524 continue;
4525
4526 if (stype == BGP_CLEAR_SOFT_NONE)
4527 ret = peer_clear (peer);
4528 else
4529 ret = peer_clear_soft (peer, afi, safi, stype);
4530
4531 if (ret < 0)
4532 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4533 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004534 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004535 }
4536
4537 if (sort == clear_as)
4538 {
4539 as_t as;
paul718e3742002-12-13 20:15:29 +00004540 int find = 0;
4541
Ulrich Weberbde12e32011-11-16 19:32:12 +04004542 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004543
paul1eb8ef22005-04-07 07:30:20 +00004544 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004545 {
4546 if (peer->as != as)
4547 continue;
4548
4549 find = 1;
4550 if (stype == BGP_CLEAR_SOFT_NONE)
4551 ret = peer_clear (peer);
4552 else
4553 ret = peer_clear_soft (peer, afi, safi, stype);
4554
4555 if (ret < 0)
4556 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4557 }
4558 if (! find)
4559 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4560 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004561 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004562 }
4563
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004564 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004565}
4566
paul94f2b392005-06-28 12:44:16 +00004567static int
paulfd79ac92004-10-13 05:06:08 +00004568bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4569 enum clear_sort sort, enum bgp_clear_type stype,
4570 const char *arg)
paul718e3742002-12-13 20:15:29 +00004571{
paul718e3742002-12-13 20:15:29 +00004572 struct bgp *bgp;
4573
4574 /* BGP structure lookup. */
4575 if (name)
4576 {
4577 bgp = bgp_lookup_by_name (name);
4578 if (bgp == NULL)
4579 {
4580 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4581 return CMD_WARNING;
4582 }
4583 }
4584 else
4585 {
4586 bgp = bgp_get_default ();
4587 if (bgp == NULL)
4588 {
4589 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4590 return CMD_WARNING;
4591 }
4592 }
4593
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004594 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004595}
4596
4597DEFUN (clear_ip_bgp_all,
4598 clear_ip_bgp_all_cmd,
4599 "clear ip bgp *",
4600 CLEAR_STR
4601 IP_STR
4602 BGP_STR
4603 "Clear all peers\n")
4604{
4605 if (argc == 1)
4606 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4607
4608 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4609}
4610
4611ALIAS (clear_ip_bgp_all,
4612 clear_bgp_all_cmd,
4613 "clear bgp *",
4614 CLEAR_STR
4615 BGP_STR
4616 "Clear all peers\n")
4617
4618ALIAS (clear_ip_bgp_all,
4619 clear_bgp_ipv6_all_cmd,
4620 "clear bgp ipv6 *",
4621 CLEAR_STR
4622 BGP_STR
4623 "Address family\n"
4624 "Clear all peers\n")
4625
4626ALIAS (clear_ip_bgp_all,
4627 clear_ip_bgp_instance_all_cmd,
4628 "clear ip bgp view WORD *",
4629 CLEAR_STR
4630 IP_STR
4631 BGP_STR
4632 "BGP view\n"
4633 "view name\n"
4634 "Clear all peers\n")
4635
4636ALIAS (clear_ip_bgp_all,
4637 clear_bgp_instance_all_cmd,
4638 "clear bgp view WORD *",
4639 CLEAR_STR
4640 BGP_STR
4641 "BGP view\n"
4642 "view name\n"
4643 "Clear all peers\n")
4644
4645DEFUN (clear_ip_bgp_peer,
4646 clear_ip_bgp_peer_cmd,
4647 "clear ip bgp (A.B.C.D|X:X::X:X)",
4648 CLEAR_STR
4649 IP_STR
4650 BGP_STR
4651 "BGP neighbor IP address to clear\n"
4652 "BGP IPv6 neighbor to clear\n")
4653{
4654 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4655}
4656
4657ALIAS (clear_ip_bgp_peer,
4658 clear_bgp_peer_cmd,
4659 "clear bgp (A.B.C.D|X:X::X:X)",
4660 CLEAR_STR
4661 BGP_STR
4662 "BGP neighbor address to clear\n"
4663 "BGP IPv6 neighbor to clear\n")
4664
4665ALIAS (clear_ip_bgp_peer,
4666 clear_bgp_ipv6_peer_cmd,
4667 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4668 CLEAR_STR
4669 BGP_STR
4670 "Address family\n"
4671 "BGP neighbor address to clear\n"
4672 "BGP IPv6 neighbor to clear\n")
4673
4674DEFUN (clear_ip_bgp_peer_group,
4675 clear_ip_bgp_peer_group_cmd,
4676 "clear ip bgp peer-group WORD",
4677 CLEAR_STR
4678 IP_STR
4679 BGP_STR
4680 "Clear all members of peer-group\n"
4681 "BGP peer-group name\n")
4682{
4683 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4684}
4685
4686ALIAS (clear_ip_bgp_peer_group,
4687 clear_bgp_peer_group_cmd,
4688 "clear bgp peer-group WORD",
4689 CLEAR_STR
4690 BGP_STR
4691 "Clear all members of peer-group\n"
4692 "BGP peer-group name\n")
4693
4694ALIAS (clear_ip_bgp_peer_group,
4695 clear_bgp_ipv6_peer_group_cmd,
4696 "clear bgp ipv6 peer-group WORD",
4697 CLEAR_STR
4698 BGP_STR
4699 "Address family\n"
4700 "Clear all members of peer-group\n"
4701 "BGP peer-group name\n")
4702
4703DEFUN (clear_ip_bgp_external,
4704 clear_ip_bgp_external_cmd,
4705 "clear ip bgp external",
4706 CLEAR_STR
4707 IP_STR
4708 BGP_STR
4709 "Clear all external peers\n")
4710{
4711 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4712}
4713
4714ALIAS (clear_ip_bgp_external,
4715 clear_bgp_external_cmd,
4716 "clear bgp external",
4717 CLEAR_STR
4718 BGP_STR
4719 "Clear all external peers\n")
4720
4721ALIAS (clear_ip_bgp_external,
4722 clear_bgp_ipv6_external_cmd,
4723 "clear bgp ipv6 external",
4724 CLEAR_STR
4725 BGP_STR
4726 "Address family\n"
4727 "Clear all external peers\n")
4728
4729DEFUN (clear_ip_bgp_as,
4730 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004731 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004732 CLEAR_STR
4733 IP_STR
4734 BGP_STR
4735 "Clear peers with the AS number\n")
4736{
4737 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4738}
4739
4740ALIAS (clear_ip_bgp_as,
4741 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004742 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004743 CLEAR_STR
4744 BGP_STR
4745 "Clear peers with the AS number\n")
4746
4747ALIAS (clear_ip_bgp_as,
4748 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004749 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004750 CLEAR_STR
4751 BGP_STR
4752 "Address family\n"
4753 "Clear peers with the AS number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02004754
paul718e3742002-12-13 20:15:29 +00004755/* Outbound soft-reconfiguration */
4756DEFUN (clear_ip_bgp_all_soft_out,
4757 clear_ip_bgp_all_soft_out_cmd,
4758 "clear ip bgp * soft out",
4759 CLEAR_STR
4760 IP_STR
4761 BGP_STR
4762 "Clear all peers\n"
4763 "Soft reconfig\n"
4764 "Soft reconfig outbound update\n")
4765{
4766 if (argc == 1)
4767 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4768 BGP_CLEAR_SOFT_OUT, NULL);
4769
4770 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4771 BGP_CLEAR_SOFT_OUT, NULL);
4772}
4773
4774ALIAS (clear_ip_bgp_all_soft_out,
4775 clear_ip_bgp_all_out_cmd,
4776 "clear ip bgp * out",
4777 CLEAR_STR
4778 IP_STR
4779 BGP_STR
4780 "Clear all peers\n"
4781 "Soft reconfig outbound update\n")
4782
4783ALIAS (clear_ip_bgp_all_soft_out,
4784 clear_ip_bgp_instance_all_soft_out_cmd,
4785 "clear ip bgp view WORD * soft out",
4786 CLEAR_STR
4787 IP_STR
4788 BGP_STR
4789 "BGP view\n"
4790 "view name\n"
4791 "Clear all peers\n"
4792 "Soft reconfig\n"
4793 "Soft reconfig outbound update\n")
4794
4795DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4796 clear_ip_bgp_all_ipv4_soft_out_cmd,
4797 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4798 CLEAR_STR
4799 IP_STR
4800 BGP_STR
4801 "Clear all peers\n"
4802 "Address family\n"
4803 "Address Family modifier\n"
4804 "Address Family modifier\n"
4805 "Soft reconfig\n"
4806 "Soft reconfig outbound update\n")
4807{
4808 if (strncmp (argv[0], "m", 1) == 0)
4809 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4810 BGP_CLEAR_SOFT_OUT, NULL);
4811
4812 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4813 BGP_CLEAR_SOFT_OUT, NULL);
4814}
4815
4816ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4817 clear_ip_bgp_all_ipv4_out_cmd,
4818 "clear ip bgp * ipv4 (unicast|multicast) out",
4819 CLEAR_STR
4820 IP_STR
4821 BGP_STR
4822 "Clear all peers\n"
4823 "Address family\n"
4824 "Address Family modifier\n"
4825 "Address Family modifier\n"
4826 "Soft reconfig outbound update\n")
4827
4828DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4829 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4830 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4831 CLEAR_STR
4832 IP_STR
4833 BGP_STR
4834 "BGP view\n"
4835 "view name\n"
4836 "Clear all peers\n"
4837 "Address family\n"
4838 "Address Family modifier\n"
4839 "Address Family modifier\n"
4840 "Soft reconfig outbound update\n")
4841{
4842 if (strncmp (argv[1], "m", 1) == 0)
4843 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4844 BGP_CLEAR_SOFT_OUT, NULL);
4845
4846 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4847 BGP_CLEAR_SOFT_OUT, NULL);
4848}
4849
4850DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4851 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4852 "clear ip bgp * vpnv4 unicast soft out",
4853 CLEAR_STR
4854 IP_STR
4855 BGP_STR
4856 "Clear all peers\n"
4857 "Address family\n"
4858 "Address Family Modifier\n"
4859 "Soft reconfig\n"
4860 "Soft reconfig outbound update\n")
4861{
4862 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4863 BGP_CLEAR_SOFT_OUT, NULL);
4864}
4865
4866ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4867 clear_ip_bgp_all_vpnv4_out_cmd,
4868 "clear ip bgp * vpnv4 unicast out",
4869 CLEAR_STR
4870 IP_STR
4871 BGP_STR
4872 "Clear all peers\n"
4873 "Address family\n"
4874 "Address Family Modifier\n"
4875 "Soft reconfig outbound update\n")
4876
Lou Berger298cc2f2016-01-12 13:42:02 -05004877DEFUN (clear_ip_bgp_all_encap_soft_out,
4878 clear_ip_bgp_all_encap_soft_out_cmd,
4879 "clear ip bgp * encap unicast soft out",
4880 CLEAR_STR
4881 IP_STR
4882 BGP_STR
4883 "Clear all peers\n"
4884 "Address family\n"
4885 "Address Family Modifier\n"
4886 "Soft reconfig\n"
4887 "Soft reconfig outbound update\n")
4888{
4889 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
4890 BGP_CLEAR_SOFT_OUT, NULL);
4891}
4892
4893ALIAS (clear_ip_bgp_all_encap_soft_out,
4894 clear_ip_bgp_all_encap_out_cmd,
4895 "clear ip bgp * encap unicast out",
4896 CLEAR_STR
4897 IP_STR
4898 BGP_STR
4899 "Clear all peers\n"
4900 "Address family\n"
4901 "Address Family Modifier\n"
4902 "Soft reconfig outbound update\n")
4903
paul718e3742002-12-13 20:15:29 +00004904DEFUN (clear_bgp_all_soft_out,
4905 clear_bgp_all_soft_out_cmd,
4906 "clear bgp * soft out",
4907 CLEAR_STR
4908 BGP_STR
4909 "Clear all peers\n"
4910 "Soft reconfig\n"
4911 "Soft reconfig outbound update\n")
4912{
4913 if (argc == 1)
4914 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4915 BGP_CLEAR_SOFT_OUT, NULL);
4916
4917 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4918 BGP_CLEAR_SOFT_OUT, NULL);
4919}
4920
4921ALIAS (clear_bgp_all_soft_out,
4922 clear_bgp_instance_all_soft_out_cmd,
4923 "clear bgp view WORD * soft out",
4924 CLEAR_STR
4925 BGP_STR
4926 "BGP view\n"
4927 "view name\n"
4928 "Clear all peers\n"
4929 "Soft reconfig\n"
4930 "Soft reconfig outbound update\n")
4931
4932ALIAS (clear_bgp_all_soft_out,
4933 clear_bgp_all_out_cmd,
4934 "clear bgp * out",
4935 CLEAR_STR
4936 BGP_STR
4937 "Clear all peers\n"
4938 "Soft reconfig outbound update\n")
4939
4940ALIAS (clear_bgp_all_soft_out,
4941 clear_bgp_ipv6_all_soft_out_cmd,
4942 "clear bgp ipv6 * soft out",
4943 CLEAR_STR
4944 BGP_STR
4945 "Address family\n"
4946 "Clear all peers\n"
4947 "Soft reconfig\n"
4948 "Soft reconfig outbound update\n")
4949
4950ALIAS (clear_bgp_all_soft_out,
4951 clear_bgp_ipv6_all_out_cmd,
4952 "clear bgp ipv6 * out",
4953 CLEAR_STR
4954 BGP_STR
4955 "Address family\n"
4956 "Clear all peers\n"
4957 "Soft reconfig outbound update\n")
4958
4959DEFUN (clear_ip_bgp_peer_soft_out,
4960 clear_ip_bgp_peer_soft_out_cmd,
4961 "clear ip bgp A.B.C.D soft out",
4962 CLEAR_STR
4963 IP_STR
4964 BGP_STR
4965 "BGP neighbor address to clear\n"
4966 "Soft reconfig\n"
4967 "Soft reconfig outbound update\n")
4968{
4969 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4970 BGP_CLEAR_SOFT_OUT, argv[0]);
4971}
4972
4973ALIAS (clear_ip_bgp_peer_soft_out,
4974 clear_ip_bgp_peer_out_cmd,
4975 "clear ip bgp A.B.C.D out",
4976 CLEAR_STR
4977 IP_STR
4978 BGP_STR
4979 "BGP neighbor address to clear\n"
4980 "Soft reconfig outbound update\n")
4981
4982DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4983 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4984 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4985 CLEAR_STR
4986 IP_STR
4987 BGP_STR
4988 "BGP neighbor address to clear\n"
4989 "Address family\n"
4990 "Address Family modifier\n"
4991 "Address Family modifier\n"
4992 "Soft reconfig\n"
4993 "Soft reconfig outbound update\n")
4994{
4995 if (strncmp (argv[1], "m", 1) == 0)
4996 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4997 BGP_CLEAR_SOFT_OUT, argv[0]);
4998
4999 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5000 BGP_CLEAR_SOFT_OUT, argv[0]);
5001}
5002
5003ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
5004 clear_ip_bgp_peer_ipv4_out_cmd,
5005 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
5006 CLEAR_STR
5007 IP_STR
5008 BGP_STR
5009 "BGP neighbor address to clear\n"
5010 "Address family\n"
5011 "Address Family modifier\n"
5012 "Address Family modifier\n"
5013 "Soft reconfig outbound update\n")
5014
5015DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
5016 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
5017 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
5018 CLEAR_STR
5019 IP_STR
5020 BGP_STR
5021 "BGP neighbor address to clear\n"
5022 "Address family\n"
5023 "Address Family Modifier\n"
5024 "Soft reconfig\n"
5025 "Soft reconfig outbound update\n")
5026{
5027 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5028 BGP_CLEAR_SOFT_OUT, argv[0]);
5029}
5030
5031ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
5032 clear_ip_bgp_peer_vpnv4_out_cmd,
5033 "clear ip bgp A.B.C.D vpnv4 unicast out",
5034 CLEAR_STR
5035 IP_STR
5036 BGP_STR
5037 "BGP neighbor address to clear\n"
5038 "Address family\n"
5039 "Address Family Modifier\n"
5040 "Soft reconfig outbound update\n")
5041
Lou Berger298cc2f2016-01-12 13:42:02 -05005042DEFUN (clear_ip_bgp_peer_encap_soft_out,
5043 clear_ip_bgp_peer_encap_soft_out_cmd,
5044 "clear ip bgp A.B.C.D encap unicast soft out",
5045 CLEAR_STR
5046 IP_STR
5047 BGP_STR
5048 "BGP neighbor address to clear\n"
5049 "Address family\n"
5050 "Address Family Modifier\n"
5051 "Soft reconfig\n"
5052 "Soft reconfig outbound update\n")
5053{
5054 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5055 BGP_CLEAR_SOFT_OUT, argv[0]);
5056}
5057
5058ALIAS (clear_ip_bgp_peer_encap_soft_out,
5059 clear_ip_bgp_peer_encap_out_cmd,
5060 "clear ip bgp A.B.C.D encap unicast out",
5061 CLEAR_STR
5062 IP_STR
5063 BGP_STR
5064 "BGP neighbor address to clear\n"
5065 "Address family\n"
5066 "Address Family Modifier\n"
5067 "Soft reconfig outbound update\n")
5068
paul718e3742002-12-13 20:15:29 +00005069DEFUN (clear_bgp_peer_soft_out,
5070 clear_bgp_peer_soft_out_cmd,
5071 "clear bgp (A.B.C.D|X:X::X:X) soft out",
5072 CLEAR_STR
5073 BGP_STR
5074 "BGP neighbor address to clear\n"
5075 "BGP IPv6 neighbor to clear\n"
5076 "Soft reconfig\n"
5077 "Soft reconfig outbound update\n")
5078{
5079 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5080 BGP_CLEAR_SOFT_OUT, argv[0]);
5081}
5082
5083ALIAS (clear_bgp_peer_soft_out,
5084 clear_bgp_ipv6_peer_soft_out_cmd,
5085 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
5086 CLEAR_STR
5087 BGP_STR
5088 "Address family\n"
5089 "BGP neighbor address to clear\n"
5090 "BGP IPv6 neighbor to clear\n"
5091 "Soft reconfig\n"
5092 "Soft reconfig outbound update\n")
5093
5094ALIAS (clear_bgp_peer_soft_out,
5095 clear_bgp_peer_out_cmd,
5096 "clear bgp (A.B.C.D|X:X::X:X) out",
5097 CLEAR_STR
5098 BGP_STR
5099 "BGP neighbor address to clear\n"
5100 "BGP IPv6 neighbor to clear\n"
5101 "Soft reconfig outbound update\n")
5102
5103ALIAS (clear_bgp_peer_soft_out,
5104 clear_bgp_ipv6_peer_out_cmd,
5105 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
5106 CLEAR_STR
5107 BGP_STR
5108 "Address family\n"
5109 "BGP neighbor address to clear\n"
5110 "BGP IPv6 neighbor to clear\n"
5111 "Soft reconfig outbound update\n")
5112
5113DEFUN (clear_ip_bgp_peer_group_soft_out,
5114 clear_ip_bgp_peer_group_soft_out_cmd,
5115 "clear ip bgp peer-group WORD soft out",
5116 CLEAR_STR
5117 IP_STR
5118 BGP_STR
5119 "Clear all members of peer-group\n"
5120 "BGP peer-group name\n"
5121 "Soft reconfig\n"
5122 "Soft reconfig outbound update\n")
5123{
5124 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5125 BGP_CLEAR_SOFT_OUT, argv[0]);
5126}
5127
5128ALIAS (clear_ip_bgp_peer_group_soft_out,
5129 clear_ip_bgp_peer_group_out_cmd,
5130 "clear ip bgp peer-group WORD out",
5131 CLEAR_STR
5132 IP_STR
5133 BGP_STR
5134 "Clear all members of peer-group\n"
5135 "BGP peer-group name\n"
5136 "Soft reconfig outbound update\n")
5137
5138DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
5139 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
5140 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
5141 CLEAR_STR
5142 IP_STR
5143 BGP_STR
5144 "Clear all members of peer-group\n"
5145 "BGP peer-group name\n"
5146 "Address family\n"
5147 "Address Family modifier\n"
5148 "Address Family modifier\n"
5149 "Soft reconfig\n"
5150 "Soft reconfig outbound update\n")
5151{
5152 if (strncmp (argv[1], "m", 1) == 0)
5153 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5154 BGP_CLEAR_SOFT_OUT, argv[0]);
5155
5156 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5157 BGP_CLEAR_SOFT_OUT, argv[0]);
5158}
5159
5160ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
5161 clear_ip_bgp_peer_group_ipv4_out_cmd,
5162 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
5163 CLEAR_STR
5164 IP_STR
5165 BGP_STR
5166 "Clear all members of peer-group\n"
5167 "BGP peer-group name\n"
5168 "Address family\n"
5169 "Address Family modifier\n"
5170 "Address Family modifier\n"
5171 "Soft reconfig outbound update\n")
5172
5173DEFUN (clear_bgp_peer_group_soft_out,
5174 clear_bgp_peer_group_soft_out_cmd,
5175 "clear bgp peer-group WORD soft out",
5176 CLEAR_STR
5177 BGP_STR
5178 "Clear all members of peer-group\n"
5179 "BGP peer-group name\n"
5180 "Soft reconfig\n"
5181 "Soft reconfig outbound update\n")
5182{
5183 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5184 BGP_CLEAR_SOFT_OUT, argv[0]);
5185}
5186
5187ALIAS (clear_bgp_peer_group_soft_out,
5188 clear_bgp_ipv6_peer_group_soft_out_cmd,
5189 "clear bgp ipv6 peer-group WORD soft out",
5190 CLEAR_STR
5191 BGP_STR
5192 "Address family\n"
5193 "Clear all members of peer-group\n"
5194 "BGP peer-group name\n"
5195 "Soft reconfig\n"
5196 "Soft reconfig outbound update\n")
5197
5198ALIAS (clear_bgp_peer_group_soft_out,
5199 clear_bgp_peer_group_out_cmd,
5200 "clear bgp peer-group WORD out",
5201 CLEAR_STR
5202 BGP_STR
5203 "Clear all members of peer-group\n"
5204 "BGP peer-group name\n"
5205 "Soft reconfig outbound update\n")
5206
5207ALIAS (clear_bgp_peer_group_soft_out,
5208 clear_bgp_ipv6_peer_group_out_cmd,
5209 "clear bgp ipv6 peer-group WORD out",
5210 CLEAR_STR
5211 BGP_STR
5212 "Address family\n"
5213 "Clear all members of peer-group\n"
5214 "BGP peer-group name\n"
5215 "Soft reconfig outbound update\n")
5216
5217DEFUN (clear_ip_bgp_external_soft_out,
5218 clear_ip_bgp_external_soft_out_cmd,
5219 "clear ip bgp external soft out",
5220 CLEAR_STR
5221 IP_STR
5222 BGP_STR
5223 "Clear all external peers\n"
5224 "Soft reconfig\n"
5225 "Soft reconfig outbound update\n")
5226{
5227 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5228 BGP_CLEAR_SOFT_OUT, NULL);
5229}
5230
5231ALIAS (clear_ip_bgp_external_soft_out,
5232 clear_ip_bgp_external_out_cmd,
5233 "clear ip bgp external out",
5234 CLEAR_STR
5235 IP_STR
5236 BGP_STR
5237 "Clear all external peers\n"
5238 "Soft reconfig outbound update\n")
5239
5240DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5241 clear_ip_bgp_external_ipv4_soft_out_cmd,
5242 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5243 CLEAR_STR
5244 IP_STR
5245 BGP_STR
5246 "Clear all external peers\n"
5247 "Address family\n"
5248 "Address Family modifier\n"
5249 "Address Family modifier\n"
5250 "Soft reconfig\n"
5251 "Soft reconfig outbound update\n")
5252{
5253 if (strncmp (argv[0], "m", 1) == 0)
5254 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5255 BGP_CLEAR_SOFT_OUT, NULL);
5256
5257 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5258 BGP_CLEAR_SOFT_OUT, NULL);
5259}
5260
5261ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5262 clear_ip_bgp_external_ipv4_out_cmd,
5263 "clear ip bgp external ipv4 (unicast|multicast) out",
5264 CLEAR_STR
5265 IP_STR
5266 BGP_STR
5267 "Clear all external peers\n"
5268 "Address family\n"
5269 "Address Family modifier\n"
5270 "Address Family modifier\n"
5271 "Soft reconfig outbound update\n")
5272
5273DEFUN (clear_bgp_external_soft_out,
5274 clear_bgp_external_soft_out_cmd,
5275 "clear bgp external soft out",
5276 CLEAR_STR
5277 BGP_STR
5278 "Clear all external peers\n"
5279 "Soft reconfig\n"
5280 "Soft reconfig outbound update\n")
5281{
5282 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5283 BGP_CLEAR_SOFT_OUT, NULL);
5284}
5285
5286ALIAS (clear_bgp_external_soft_out,
5287 clear_bgp_ipv6_external_soft_out_cmd,
5288 "clear bgp ipv6 external soft out",
5289 CLEAR_STR
5290 BGP_STR
5291 "Address family\n"
5292 "Clear all external peers\n"
5293 "Soft reconfig\n"
5294 "Soft reconfig outbound update\n")
5295
5296ALIAS (clear_bgp_external_soft_out,
5297 clear_bgp_external_out_cmd,
5298 "clear bgp external out",
5299 CLEAR_STR
5300 BGP_STR
5301 "Clear all external peers\n"
5302 "Soft reconfig outbound update\n")
5303
5304ALIAS (clear_bgp_external_soft_out,
5305 clear_bgp_ipv6_external_out_cmd,
5306 "clear bgp ipv6 external WORD out",
5307 CLEAR_STR
5308 BGP_STR
5309 "Address family\n"
5310 "Clear all external peers\n"
5311 "Soft reconfig outbound update\n")
5312
5313DEFUN (clear_ip_bgp_as_soft_out,
5314 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005315 "clear ip bgp " CMD_AS_RANGE " soft 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 "Soft reconfig\n"
5321 "Soft reconfig outbound update\n")
5322{
5323 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5324 BGP_CLEAR_SOFT_OUT, argv[0]);
5325}
5326
5327ALIAS (clear_ip_bgp_as_soft_out,
5328 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005329 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005330 CLEAR_STR
5331 IP_STR
5332 BGP_STR
5333 "Clear peers with the AS number\n"
5334 "Soft reconfig outbound update\n")
5335
5336DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5337 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005338 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005339 CLEAR_STR
5340 IP_STR
5341 BGP_STR
5342 "Clear peers with the AS number\n"
5343 "Address family\n"
5344 "Address Family modifier\n"
5345 "Address Family modifier\n"
5346 "Soft reconfig\n"
5347 "Soft reconfig outbound update\n")
5348{
5349 if (strncmp (argv[1], "m", 1) == 0)
5350 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5351 BGP_CLEAR_SOFT_OUT, argv[0]);
5352
5353 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5354 BGP_CLEAR_SOFT_OUT, argv[0]);
5355}
5356
5357ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5358 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005359 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00005360 CLEAR_STR
5361 IP_STR
5362 BGP_STR
5363 "Clear peers with the AS number\n"
5364 "Address family\n"
5365 "Address Family modifier\n"
5366 "Address Family modifier\n"
5367 "Soft reconfig outbound update\n")
5368
5369DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5370 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005371 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00005372 CLEAR_STR
5373 IP_STR
5374 BGP_STR
5375 "Clear peers with the AS number\n"
5376 "Address family\n"
5377 "Address Family modifier\n"
5378 "Soft reconfig\n"
5379 "Soft reconfig outbound update\n")
5380{
5381 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5382 BGP_CLEAR_SOFT_OUT, argv[0]);
5383}
5384
5385ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5386 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005387 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005388 CLEAR_STR
5389 IP_STR
5390 BGP_STR
5391 "Clear peers with the AS number\n"
5392 "Address family\n"
5393 "Address Family modifier\n"
5394 "Soft reconfig outbound update\n")
5395
Lou Berger298cc2f2016-01-12 13:42:02 -05005396DEFUN (clear_ip_bgp_as_encap_soft_out,
5397 clear_ip_bgp_as_encap_soft_out_cmd,
5398 "clear ip bgp " CMD_AS_RANGE " encap unicast soft out",
5399 CLEAR_STR
5400 IP_STR
5401 BGP_STR
5402 "Clear peers with the AS number\n"
5403 "Address family\n"
5404 "Address Family modifier\n"
5405 "Soft reconfig\n"
5406 "Soft reconfig outbound update\n")
5407{
5408 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
5409 BGP_CLEAR_SOFT_OUT, argv[0]);
5410}
5411
5412ALIAS (clear_ip_bgp_as_encap_soft_out,
5413 clear_ip_bgp_as_encap_out_cmd,
5414 "clear ip bgp " CMD_AS_RANGE " encap unicast out",
5415 CLEAR_STR
5416 IP_STR
5417 BGP_STR
5418 "Clear peers with the AS number\n"
5419 "Address family\n"
5420 "Address Family modifier\n"
5421 "Soft reconfig outbound update\n")
5422
paul718e3742002-12-13 20:15:29 +00005423DEFUN (clear_bgp_as_soft_out,
5424 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005425 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005426 CLEAR_STR
5427 BGP_STR
5428 "Clear peers with the AS number\n"
5429 "Soft reconfig\n"
5430 "Soft reconfig outbound update\n")
5431{
5432 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5433 BGP_CLEAR_SOFT_OUT, argv[0]);
5434}
5435
5436ALIAS (clear_bgp_as_soft_out,
5437 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005438 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005439 CLEAR_STR
5440 BGP_STR
5441 "Address family\n"
5442 "Clear peers with the AS number\n"
5443 "Soft reconfig\n"
5444 "Soft reconfig outbound update\n")
5445
5446ALIAS (clear_bgp_as_soft_out,
5447 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005448 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005449 CLEAR_STR
5450 BGP_STR
5451 "Clear peers with the AS number\n"
5452 "Soft reconfig outbound update\n")
5453
5454ALIAS (clear_bgp_as_soft_out,
5455 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005456 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005457 CLEAR_STR
5458 BGP_STR
5459 "Address family\n"
5460 "Clear peers with the AS number\n"
5461 "Soft reconfig outbound update\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02005462
paul718e3742002-12-13 20:15:29 +00005463/* Inbound soft-reconfiguration */
5464DEFUN (clear_ip_bgp_all_soft_in,
5465 clear_ip_bgp_all_soft_in_cmd,
5466 "clear ip bgp * soft in",
5467 CLEAR_STR
5468 IP_STR
5469 BGP_STR
5470 "Clear all peers\n"
5471 "Soft reconfig\n"
5472 "Soft reconfig inbound update\n")
5473{
5474 if (argc == 1)
5475 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5476 BGP_CLEAR_SOFT_IN, NULL);
5477
5478 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5479 BGP_CLEAR_SOFT_IN, NULL);
5480}
5481
5482ALIAS (clear_ip_bgp_all_soft_in,
5483 clear_ip_bgp_instance_all_soft_in_cmd,
5484 "clear ip bgp view WORD * soft in",
5485 CLEAR_STR
5486 IP_STR
5487 BGP_STR
5488 "BGP view\n"
5489 "view name\n"
5490 "Clear all peers\n"
5491 "Soft reconfig\n"
5492 "Soft reconfig inbound update\n")
5493
5494ALIAS (clear_ip_bgp_all_soft_in,
5495 clear_ip_bgp_all_in_cmd,
5496 "clear ip bgp * in",
5497 CLEAR_STR
5498 IP_STR
5499 BGP_STR
5500 "Clear all peers\n"
5501 "Soft reconfig inbound update\n")
5502
5503DEFUN (clear_ip_bgp_all_in_prefix_filter,
5504 clear_ip_bgp_all_in_prefix_filter_cmd,
5505 "clear ip bgp * in prefix-filter",
5506 CLEAR_STR
5507 IP_STR
5508 BGP_STR
5509 "Clear all peers\n"
5510 "Soft reconfig inbound update\n"
5511 "Push out prefix-list ORF and do inbound soft reconfig\n")
5512{
5513 if (argc== 1)
5514 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5515 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5516
5517 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5518 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5519}
5520
5521ALIAS (clear_ip_bgp_all_in_prefix_filter,
5522 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5523 "clear ip bgp view WORD * in prefix-filter",
5524 CLEAR_STR
5525 IP_STR
5526 BGP_STR
5527 "BGP view\n"
5528 "view name\n"
5529 "Clear all peers\n"
5530 "Soft reconfig inbound update\n"
5531 "Push out prefix-list ORF and do inbound soft reconfig\n")
5532
5533
5534DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5535 clear_ip_bgp_all_ipv4_soft_in_cmd,
5536 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5537 CLEAR_STR
5538 IP_STR
5539 BGP_STR
5540 "Clear all peers\n"
5541 "Address family\n"
5542 "Address Family modifier\n"
5543 "Address Family modifier\n"
5544 "Soft reconfig\n"
5545 "Soft reconfig inbound update\n")
5546{
5547 if (strncmp (argv[0], "m", 1) == 0)
5548 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5549 BGP_CLEAR_SOFT_IN, NULL);
5550
5551 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5552 BGP_CLEAR_SOFT_IN, NULL);
5553}
5554
5555ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5556 clear_ip_bgp_all_ipv4_in_cmd,
5557 "clear ip bgp * ipv4 (unicast|multicast) in",
5558 CLEAR_STR
5559 IP_STR
5560 BGP_STR
5561 "Clear all peers\n"
5562 "Address family\n"
5563 "Address Family modifier\n"
5564 "Address Family modifier\n"
5565 "Soft reconfig inbound update\n")
5566
5567DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5568 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5569 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5570 CLEAR_STR
5571 IP_STR
5572 BGP_STR
5573 "BGP view\n"
5574 "view name\n"
5575 "Clear all peers\n"
5576 "Address family\n"
5577 "Address Family modifier\n"
5578 "Address Family modifier\n"
5579 "Soft reconfig\n"
5580 "Soft reconfig inbound update\n")
5581{
5582 if (strncmp (argv[1], "m", 1) == 0)
5583 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5584 BGP_CLEAR_SOFT_IN, NULL);
5585
5586 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5587 BGP_CLEAR_SOFT_IN, NULL);
5588}
5589
5590DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5591 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5592 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5593 CLEAR_STR
5594 IP_STR
5595 BGP_STR
5596 "Clear all peers\n"
5597 "Address family\n"
5598 "Address Family modifier\n"
5599 "Address Family modifier\n"
5600 "Soft reconfig inbound update\n"
5601 "Push out prefix-list ORF and do inbound soft reconfig\n")
5602{
5603 if (strncmp (argv[0], "m", 1) == 0)
5604 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5605 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5606
5607 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5608 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5609}
5610
5611DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5612 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5613 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5614 CLEAR_STR
5615 IP_STR
5616 BGP_STR
5617 "Clear all peers\n"
5618 "Address family\n"
5619 "Address Family modifier\n"
5620 "Address Family modifier\n"
5621 "Soft reconfig inbound update\n"
5622 "Push out prefix-list ORF and do inbound soft reconfig\n")
5623{
5624 if (strncmp (argv[1], "m", 1) == 0)
5625 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5626 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5627
5628 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5629 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5630}
5631
5632DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5633 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5634 "clear ip bgp * vpnv4 unicast soft in",
5635 CLEAR_STR
5636 IP_STR
5637 BGP_STR
5638 "Clear all peers\n"
5639 "Address family\n"
5640 "Address Family Modifier\n"
5641 "Soft reconfig\n"
5642 "Soft reconfig inbound update\n")
5643{
5644 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5645 BGP_CLEAR_SOFT_IN, NULL);
5646}
5647
5648ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5649 clear_ip_bgp_all_vpnv4_in_cmd,
5650 "clear ip bgp * vpnv4 unicast in",
5651 CLEAR_STR
5652 IP_STR
5653 BGP_STR
5654 "Clear all peers\n"
5655 "Address family\n"
5656 "Address Family Modifier\n"
5657 "Soft reconfig inbound update\n")
5658
Lou Berger298cc2f2016-01-12 13:42:02 -05005659DEFUN (clear_ip_bgp_all_encap_soft_in,
5660 clear_ip_bgp_all_encap_soft_in_cmd,
5661 "clear ip bgp * encap unicast soft in",
5662 CLEAR_STR
5663 IP_STR
5664 BGP_STR
5665 "Clear all peers\n"
5666 "Address family\n"
5667 "Address Family Modifier\n"
5668 "Soft reconfig\n"
5669 "Soft reconfig inbound update\n")
5670{
5671 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
5672 BGP_CLEAR_SOFT_IN, NULL);
5673}
5674
5675ALIAS (clear_ip_bgp_all_encap_soft_in,
5676 clear_ip_bgp_all_encap_in_cmd,
5677 "clear ip bgp * encap unicast in",
5678 CLEAR_STR
5679 IP_STR
5680 BGP_STR
5681 "Clear all peers\n"
5682 "Address family\n"
5683 "Address Family Modifier\n"
5684 "Soft reconfig inbound update\n")
5685
paul718e3742002-12-13 20:15:29 +00005686DEFUN (clear_bgp_all_soft_in,
5687 clear_bgp_all_soft_in_cmd,
5688 "clear bgp * soft in",
5689 CLEAR_STR
5690 BGP_STR
5691 "Clear all peers\n"
5692 "Soft reconfig\n"
5693 "Soft reconfig inbound update\n")
5694{
5695 if (argc == 1)
5696 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5697 BGP_CLEAR_SOFT_IN, NULL);
5698
5699 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5700 BGP_CLEAR_SOFT_IN, NULL);
5701}
5702
5703ALIAS (clear_bgp_all_soft_in,
5704 clear_bgp_instance_all_soft_in_cmd,
5705 "clear bgp view WORD * soft in",
5706 CLEAR_STR
5707 BGP_STR
5708 "BGP view\n"
5709 "view name\n"
5710 "Clear all peers\n"
5711 "Soft reconfig\n"
5712 "Soft reconfig inbound update\n")
5713
5714ALIAS (clear_bgp_all_soft_in,
5715 clear_bgp_ipv6_all_soft_in_cmd,
5716 "clear bgp ipv6 * soft in",
5717 CLEAR_STR
5718 BGP_STR
5719 "Address family\n"
5720 "Clear all peers\n"
5721 "Soft reconfig\n"
5722 "Soft reconfig inbound update\n")
5723
5724ALIAS (clear_bgp_all_soft_in,
5725 clear_bgp_all_in_cmd,
5726 "clear bgp * in",
5727 CLEAR_STR
5728 BGP_STR
5729 "Clear all peers\n"
5730 "Soft reconfig inbound update\n")
5731
5732ALIAS (clear_bgp_all_soft_in,
5733 clear_bgp_ipv6_all_in_cmd,
5734 "clear bgp ipv6 * in",
5735 CLEAR_STR
5736 BGP_STR
5737 "Address family\n"
5738 "Clear all peers\n"
5739 "Soft reconfig inbound update\n")
5740
5741DEFUN (clear_bgp_all_in_prefix_filter,
5742 clear_bgp_all_in_prefix_filter_cmd,
5743 "clear bgp * in prefix-filter",
5744 CLEAR_STR
5745 BGP_STR
5746 "Clear all peers\n"
5747 "Soft reconfig inbound update\n"
5748 "Push out prefix-list ORF and do inbound soft reconfig\n")
5749{
5750 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5751 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5752}
5753
5754ALIAS (clear_bgp_all_in_prefix_filter,
5755 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5756 "clear bgp ipv6 * in prefix-filter",
5757 CLEAR_STR
5758 BGP_STR
5759 "Address family\n"
5760 "Clear all peers\n"
5761 "Soft reconfig inbound update\n"
5762 "Push out prefix-list ORF and do inbound soft reconfig\n")
5763
5764DEFUN (clear_ip_bgp_peer_soft_in,
5765 clear_ip_bgp_peer_soft_in_cmd,
5766 "clear ip bgp A.B.C.D soft in",
5767 CLEAR_STR
5768 IP_STR
5769 BGP_STR
5770 "BGP neighbor address to clear\n"
5771 "Soft reconfig\n"
5772 "Soft reconfig inbound update\n")
5773{
5774 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5775 BGP_CLEAR_SOFT_IN, argv[0]);
5776}
5777
5778ALIAS (clear_ip_bgp_peer_soft_in,
5779 clear_ip_bgp_peer_in_cmd,
5780 "clear ip bgp A.B.C.D in",
5781 CLEAR_STR
5782 IP_STR
5783 BGP_STR
5784 "BGP neighbor address to clear\n"
5785 "Soft reconfig inbound update\n")
5786
5787DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5788 clear_ip_bgp_peer_in_prefix_filter_cmd,
5789 "clear ip bgp A.B.C.D in prefix-filter",
5790 CLEAR_STR
5791 IP_STR
5792 BGP_STR
5793 "BGP neighbor address to clear\n"
5794 "Soft reconfig inbound update\n"
5795 "Push out the existing ORF prefix-list\n")
5796{
5797 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5798 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5799}
5800
5801DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5802 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5803 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5804 CLEAR_STR
5805 IP_STR
5806 BGP_STR
5807 "BGP neighbor address to clear\n"
5808 "Address family\n"
5809 "Address Family modifier\n"
5810 "Address Family modifier\n"
5811 "Soft reconfig\n"
5812 "Soft reconfig inbound update\n")
5813{
5814 if (strncmp (argv[1], "m", 1) == 0)
5815 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5816 BGP_CLEAR_SOFT_IN, argv[0]);
5817
5818 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5819 BGP_CLEAR_SOFT_IN, argv[0]);
5820}
5821
5822ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5823 clear_ip_bgp_peer_ipv4_in_cmd,
5824 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5825 CLEAR_STR
5826 IP_STR
5827 BGP_STR
5828 "BGP neighbor address to clear\n"
5829 "Address family\n"
5830 "Address Family modifier\n"
5831 "Address Family modifier\n"
5832 "Soft reconfig inbound update\n")
5833
5834DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5835 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5836 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5837 CLEAR_STR
5838 IP_STR
5839 BGP_STR
5840 "BGP neighbor address to clear\n"
5841 "Address family\n"
5842 "Address Family modifier\n"
5843 "Address Family modifier\n"
5844 "Soft reconfig inbound update\n"
5845 "Push out the existing ORF prefix-list\n")
5846{
5847 if (strncmp (argv[1], "m", 1) == 0)
5848 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5849 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5850
5851 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5852 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5853}
5854
5855DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5856 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5857 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5858 CLEAR_STR
5859 IP_STR
5860 BGP_STR
5861 "BGP neighbor address to clear\n"
5862 "Address family\n"
5863 "Address Family Modifier\n"
5864 "Soft reconfig\n"
5865 "Soft reconfig inbound update\n")
5866{
5867 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5868 BGP_CLEAR_SOFT_IN, argv[0]);
5869}
5870
5871ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5872 clear_ip_bgp_peer_vpnv4_in_cmd,
5873 "clear ip bgp A.B.C.D vpnv4 unicast in",
5874 CLEAR_STR
5875 IP_STR
5876 BGP_STR
5877 "BGP neighbor address to clear\n"
5878 "Address family\n"
5879 "Address Family Modifier\n"
5880 "Soft reconfig inbound update\n")
5881
Lou Berger298cc2f2016-01-12 13:42:02 -05005882DEFUN (clear_ip_bgp_peer_encap_soft_in,
5883 clear_ip_bgp_peer_encap_soft_in_cmd,
5884 "clear ip bgp A.B.C.D encap unicast soft in",
5885 CLEAR_STR
5886 IP_STR
5887 BGP_STR
5888 "BGP neighbor address to clear\n"
5889 "Address family\n"
5890 "Address Family Modifier\n"
5891 "Soft reconfig\n"
5892 "Soft reconfig inbound update\n")
5893{
5894 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5895 BGP_CLEAR_SOFT_IN, argv[0]);
5896}
5897
5898ALIAS (clear_ip_bgp_peer_encap_soft_in,
5899 clear_ip_bgp_peer_encap_in_cmd,
5900 "clear ip bgp A.B.C.D encap unicast in",
5901 CLEAR_STR
5902 IP_STR
5903 BGP_STR
5904 "BGP neighbor address to clear\n"
5905 "Address family\n"
5906 "Address Family Modifier\n"
5907 "Soft reconfig inbound update\n")
5908
paul718e3742002-12-13 20:15:29 +00005909DEFUN (clear_bgp_peer_soft_in,
5910 clear_bgp_peer_soft_in_cmd,
5911 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5912 CLEAR_STR
5913 BGP_STR
5914 "BGP neighbor address to clear\n"
5915 "BGP IPv6 neighbor to clear\n"
5916 "Soft reconfig\n"
5917 "Soft reconfig inbound update\n")
5918{
5919 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5920 BGP_CLEAR_SOFT_IN, argv[0]);
5921}
5922
5923ALIAS (clear_bgp_peer_soft_in,
5924 clear_bgp_ipv6_peer_soft_in_cmd,
5925 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5926 CLEAR_STR
5927 BGP_STR
5928 "Address family\n"
5929 "BGP neighbor address to clear\n"
5930 "BGP IPv6 neighbor to clear\n"
5931 "Soft reconfig\n"
5932 "Soft reconfig inbound update\n")
5933
5934ALIAS (clear_bgp_peer_soft_in,
5935 clear_bgp_peer_in_cmd,
5936 "clear bgp (A.B.C.D|X:X::X:X) in",
5937 CLEAR_STR
5938 BGP_STR
5939 "BGP neighbor address to clear\n"
5940 "BGP IPv6 neighbor to clear\n"
5941 "Soft reconfig inbound update\n")
5942
5943ALIAS (clear_bgp_peer_soft_in,
5944 clear_bgp_ipv6_peer_in_cmd,
5945 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5946 CLEAR_STR
5947 BGP_STR
5948 "Address family\n"
5949 "BGP neighbor address to clear\n"
5950 "BGP IPv6 neighbor to clear\n"
5951 "Soft reconfig inbound update\n")
5952
5953DEFUN (clear_bgp_peer_in_prefix_filter,
5954 clear_bgp_peer_in_prefix_filter_cmd,
5955 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5956 CLEAR_STR
5957 BGP_STR
5958 "BGP neighbor address to clear\n"
5959 "BGP IPv6 neighbor to clear\n"
5960 "Soft reconfig inbound update\n"
5961 "Push out the existing ORF prefix-list\n")
5962{
5963 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5964 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5965}
5966
5967ALIAS (clear_bgp_peer_in_prefix_filter,
5968 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5969 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5970 CLEAR_STR
5971 BGP_STR
5972 "Address family\n"
5973 "BGP neighbor address to clear\n"
5974 "BGP IPv6 neighbor to clear\n"
5975 "Soft reconfig inbound update\n"
5976 "Push out the existing ORF prefix-list\n")
5977
5978DEFUN (clear_ip_bgp_peer_group_soft_in,
5979 clear_ip_bgp_peer_group_soft_in_cmd,
5980 "clear ip bgp peer-group WORD soft in",
5981 CLEAR_STR
5982 IP_STR
5983 BGP_STR
5984 "Clear all members of peer-group\n"
5985 "BGP peer-group name\n"
5986 "Soft reconfig\n"
5987 "Soft reconfig inbound update\n")
5988{
5989 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5990 BGP_CLEAR_SOFT_IN, argv[0]);
5991}
5992
5993ALIAS (clear_ip_bgp_peer_group_soft_in,
5994 clear_ip_bgp_peer_group_in_cmd,
5995 "clear ip bgp peer-group WORD in",
5996 CLEAR_STR
5997 IP_STR
5998 BGP_STR
5999 "Clear all members of peer-group\n"
6000 "BGP peer-group name\n"
6001 "Soft reconfig inbound update\n")
6002
6003DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
6004 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
6005 "clear ip bgp peer-group WORD in prefix-filter",
6006 CLEAR_STR
6007 IP_STR
6008 BGP_STR
6009 "Clear all members of peer-group\n"
6010 "BGP peer-group name\n"
6011 "Soft reconfig inbound update\n"
6012 "Push out prefix-list ORF and do inbound soft reconfig\n")
6013{
6014 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6015 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6016}
6017
6018DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
6019 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
6020 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
6021 CLEAR_STR
6022 IP_STR
6023 BGP_STR
6024 "Clear all members of peer-group\n"
6025 "BGP peer-group name\n"
6026 "Address family\n"
6027 "Address Family modifier\n"
6028 "Address Family modifier\n"
6029 "Soft reconfig\n"
6030 "Soft reconfig inbound update\n")
6031{
6032 if (strncmp (argv[1], "m", 1) == 0)
6033 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6034 BGP_CLEAR_SOFT_IN, argv[0]);
6035
6036 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6037 BGP_CLEAR_SOFT_IN, argv[0]);
6038}
6039
6040ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
6041 clear_ip_bgp_peer_group_ipv4_in_cmd,
6042 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
6043 CLEAR_STR
6044 IP_STR
6045 BGP_STR
6046 "Clear all members of peer-group\n"
6047 "BGP peer-group name\n"
6048 "Address family\n"
6049 "Address Family modifier\n"
6050 "Address Family modifier\n"
6051 "Soft reconfig inbound update\n")
6052
6053DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
6054 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
6055 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
6056 CLEAR_STR
6057 IP_STR
6058 BGP_STR
6059 "Clear all members of peer-group\n"
6060 "BGP peer-group name\n"
6061 "Address family\n"
6062 "Address Family modifier\n"
6063 "Address Family modifier\n"
6064 "Soft reconfig inbound update\n"
6065 "Push out prefix-list ORF and do inbound soft reconfig\n")
6066{
6067 if (strncmp (argv[1], "m", 1) == 0)
6068 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6069 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6070
6071 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6072 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6073}
6074
6075DEFUN (clear_bgp_peer_group_soft_in,
6076 clear_bgp_peer_group_soft_in_cmd,
6077 "clear bgp peer-group WORD soft in",
6078 CLEAR_STR
6079 BGP_STR
6080 "Clear all members of peer-group\n"
6081 "BGP peer-group name\n"
6082 "Soft reconfig\n"
6083 "Soft reconfig inbound update\n")
6084{
6085 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6086 BGP_CLEAR_SOFT_IN, argv[0]);
6087}
6088
6089ALIAS (clear_bgp_peer_group_soft_in,
6090 clear_bgp_ipv6_peer_group_soft_in_cmd,
6091 "clear bgp ipv6 peer-group WORD soft in",
6092 CLEAR_STR
6093 BGP_STR
6094 "Address family\n"
6095 "Clear all members of peer-group\n"
6096 "BGP peer-group name\n"
6097 "Soft reconfig\n"
6098 "Soft reconfig inbound update\n")
6099
6100ALIAS (clear_bgp_peer_group_soft_in,
6101 clear_bgp_peer_group_in_cmd,
6102 "clear bgp peer-group WORD in",
6103 CLEAR_STR
6104 BGP_STR
6105 "Clear all members of peer-group\n"
6106 "BGP peer-group name\n"
6107 "Soft reconfig inbound update\n")
6108
6109ALIAS (clear_bgp_peer_group_soft_in,
6110 clear_bgp_ipv6_peer_group_in_cmd,
6111 "clear bgp ipv6 peer-group WORD in",
6112 CLEAR_STR
6113 BGP_STR
6114 "Address family\n"
6115 "Clear all members of peer-group\n"
6116 "BGP peer-group name\n"
6117 "Soft reconfig inbound update\n")
6118
6119DEFUN (clear_bgp_peer_group_in_prefix_filter,
6120 clear_bgp_peer_group_in_prefix_filter_cmd,
6121 "clear bgp peer-group WORD in prefix-filter",
6122 CLEAR_STR
6123 BGP_STR
6124 "Clear all members of peer-group\n"
6125 "BGP peer-group name\n"
6126 "Soft reconfig inbound update\n"
6127 "Push out prefix-list ORF and do inbound soft reconfig\n")
6128{
6129 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6130 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6131}
6132
6133ALIAS (clear_bgp_peer_group_in_prefix_filter,
6134 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
6135 "clear bgp ipv6 peer-group WORD in prefix-filter",
6136 CLEAR_STR
6137 BGP_STR
6138 "Address family\n"
6139 "Clear all members of peer-group\n"
6140 "BGP peer-group name\n"
6141 "Soft reconfig inbound update\n"
6142 "Push out prefix-list ORF and do inbound soft reconfig\n")
6143
6144DEFUN (clear_ip_bgp_external_soft_in,
6145 clear_ip_bgp_external_soft_in_cmd,
6146 "clear ip bgp external soft in",
6147 CLEAR_STR
6148 IP_STR
6149 BGP_STR
6150 "Clear all external peers\n"
6151 "Soft reconfig\n"
6152 "Soft reconfig inbound update\n")
6153{
6154 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6155 BGP_CLEAR_SOFT_IN, NULL);
6156}
6157
6158ALIAS (clear_ip_bgp_external_soft_in,
6159 clear_ip_bgp_external_in_cmd,
6160 "clear ip bgp external in",
6161 CLEAR_STR
6162 IP_STR
6163 BGP_STR
6164 "Clear all external peers\n"
6165 "Soft reconfig inbound update\n")
6166
6167DEFUN (clear_ip_bgp_external_in_prefix_filter,
6168 clear_ip_bgp_external_in_prefix_filter_cmd,
6169 "clear ip bgp external in prefix-filter",
6170 CLEAR_STR
6171 IP_STR
6172 BGP_STR
6173 "Clear all external peers\n"
6174 "Soft reconfig inbound update\n"
6175 "Push out prefix-list ORF and do inbound soft reconfig\n")
6176{
6177 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6178 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6179}
6180
6181DEFUN (clear_ip_bgp_external_ipv4_soft_in,
6182 clear_ip_bgp_external_ipv4_soft_in_cmd,
6183 "clear ip bgp external ipv4 (unicast|multicast) soft in",
6184 CLEAR_STR
6185 IP_STR
6186 BGP_STR
6187 "Clear all external peers\n"
6188 "Address family\n"
6189 "Address Family modifier\n"
6190 "Address Family modifier\n"
6191 "Soft reconfig\n"
6192 "Soft reconfig inbound update\n")
6193{
6194 if (strncmp (argv[0], "m", 1) == 0)
6195 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6196 BGP_CLEAR_SOFT_IN, NULL);
6197
6198 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6199 BGP_CLEAR_SOFT_IN, NULL);
6200}
6201
6202ALIAS (clear_ip_bgp_external_ipv4_soft_in,
6203 clear_ip_bgp_external_ipv4_in_cmd,
6204 "clear ip bgp external ipv4 (unicast|multicast) in",
6205 CLEAR_STR
6206 IP_STR
6207 BGP_STR
6208 "Clear all external peers\n"
6209 "Address family\n"
6210 "Address Family modifier\n"
6211 "Address Family modifier\n"
6212 "Soft reconfig inbound update\n")
6213
6214DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
6215 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
6216 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
6217 CLEAR_STR
6218 IP_STR
6219 BGP_STR
6220 "Clear all external peers\n"
6221 "Address family\n"
6222 "Address Family modifier\n"
6223 "Address Family modifier\n"
6224 "Soft reconfig inbound update\n"
6225 "Push out prefix-list ORF and do inbound soft reconfig\n")
6226{
6227 if (strncmp (argv[0], "m", 1) == 0)
6228 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6229 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6230
6231 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6232 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6233}
6234
6235DEFUN (clear_bgp_external_soft_in,
6236 clear_bgp_external_soft_in_cmd,
6237 "clear bgp external soft in",
6238 CLEAR_STR
6239 BGP_STR
6240 "Clear all external peers\n"
6241 "Soft reconfig\n"
6242 "Soft reconfig inbound update\n")
6243{
6244 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6245 BGP_CLEAR_SOFT_IN, NULL);
6246}
6247
6248ALIAS (clear_bgp_external_soft_in,
6249 clear_bgp_ipv6_external_soft_in_cmd,
6250 "clear bgp ipv6 external soft in",
6251 CLEAR_STR
6252 BGP_STR
6253 "Address family\n"
6254 "Clear all external peers\n"
6255 "Soft reconfig\n"
6256 "Soft reconfig inbound update\n")
6257
6258ALIAS (clear_bgp_external_soft_in,
6259 clear_bgp_external_in_cmd,
6260 "clear bgp external in",
6261 CLEAR_STR
6262 BGP_STR
6263 "Clear all external peers\n"
6264 "Soft reconfig inbound update\n")
6265
6266ALIAS (clear_bgp_external_soft_in,
6267 clear_bgp_ipv6_external_in_cmd,
6268 "clear bgp ipv6 external WORD in",
6269 CLEAR_STR
6270 BGP_STR
6271 "Address family\n"
6272 "Clear all external peers\n"
6273 "Soft reconfig inbound update\n")
6274
6275DEFUN (clear_bgp_external_in_prefix_filter,
6276 clear_bgp_external_in_prefix_filter_cmd,
6277 "clear bgp external in prefix-filter",
6278 CLEAR_STR
6279 BGP_STR
6280 "Clear all external peers\n"
6281 "Soft reconfig inbound update\n"
6282 "Push out prefix-list ORF and do inbound soft reconfig\n")
6283{
6284 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6285 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6286}
6287
6288ALIAS (clear_bgp_external_in_prefix_filter,
6289 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6290 "clear bgp ipv6 external in prefix-filter",
6291 CLEAR_STR
6292 BGP_STR
6293 "Address family\n"
6294 "Clear all external peers\n"
6295 "Soft reconfig inbound update\n"
6296 "Push out prefix-list ORF and do inbound soft reconfig\n")
6297
6298DEFUN (clear_ip_bgp_as_soft_in,
6299 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006300 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006301 CLEAR_STR
6302 IP_STR
6303 BGP_STR
6304 "Clear peers with the AS number\n"
6305 "Soft reconfig\n"
6306 "Soft reconfig inbound update\n")
6307{
6308 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6309 BGP_CLEAR_SOFT_IN, argv[0]);
6310}
6311
6312ALIAS (clear_ip_bgp_as_soft_in,
6313 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006314 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006315 CLEAR_STR
6316 IP_STR
6317 BGP_STR
6318 "Clear peers with the AS number\n"
6319 "Soft reconfig inbound update\n")
6320
6321DEFUN (clear_ip_bgp_as_in_prefix_filter,
6322 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006323 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006324 CLEAR_STR
6325 IP_STR
6326 BGP_STR
6327 "Clear peers with the AS number\n"
6328 "Soft reconfig inbound update\n"
6329 "Push out prefix-list ORF and do inbound soft reconfig\n")
6330{
6331 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6332 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6333}
6334
6335DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6336 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006337 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006338 CLEAR_STR
6339 IP_STR
6340 BGP_STR
6341 "Clear peers with the AS number\n"
6342 "Address family\n"
6343 "Address Family modifier\n"
6344 "Address Family modifier\n"
6345 "Soft reconfig\n"
6346 "Soft reconfig inbound update\n")
6347{
6348 if (strncmp (argv[1], "m", 1) == 0)
6349 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6350 BGP_CLEAR_SOFT_IN, argv[0]);
6351
6352 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6353 BGP_CLEAR_SOFT_IN, argv[0]);
6354}
6355
6356ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6357 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006358 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00006359 CLEAR_STR
6360 IP_STR
6361 BGP_STR
6362 "Clear peers with the AS number\n"
6363 "Address family\n"
6364 "Address Family modifier\n"
6365 "Address Family modifier\n"
6366 "Soft reconfig inbound update\n")
6367
6368DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6369 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006370 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006371 CLEAR_STR
6372 IP_STR
6373 BGP_STR
6374 "Clear peers with the AS number\n"
6375 "Address family\n"
6376 "Address Family modifier\n"
6377 "Address Family modifier\n"
6378 "Soft reconfig inbound update\n"
6379 "Push out prefix-list ORF and do inbound soft reconfig\n")
6380{
6381 if (strncmp (argv[1], "m", 1) == 0)
6382 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6383 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6384
6385 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6386 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6387}
6388
6389DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6390 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006391 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00006392 CLEAR_STR
6393 IP_STR
6394 BGP_STR
6395 "Clear peers with the AS number\n"
6396 "Address family\n"
6397 "Address Family modifier\n"
6398 "Soft reconfig\n"
6399 "Soft reconfig inbound update\n")
6400{
6401 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6402 BGP_CLEAR_SOFT_IN, argv[0]);
6403}
6404
6405ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6406 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006407 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006408 CLEAR_STR
6409 IP_STR
6410 BGP_STR
6411 "Clear peers with the AS number\n"
6412 "Address family\n"
6413 "Address Family modifier\n"
6414 "Soft reconfig inbound update\n")
6415
Lou Berger298cc2f2016-01-12 13:42:02 -05006416DEFUN (clear_ip_bgp_as_encap_soft_in,
6417 clear_ip_bgp_as_encap_soft_in_cmd,
6418 "clear ip bgp " CMD_AS_RANGE " encap unicast soft in",
6419 CLEAR_STR
6420 IP_STR
6421 BGP_STR
6422 "Clear peers with the AS number\n"
6423 "Address family\n"
6424 "Address Family modifier\n"
6425 "Soft reconfig\n"
6426 "Soft reconfig inbound update\n")
6427{
6428 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6429 BGP_CLEAR_SOFT_IN, argv[0]);
6430}
6431
6432ALIAS (clear_ip_bgp_as_encap_soft_in,
6433 clear_ip_bgp_as_encap_in_cmd,
6434 "clear ip bgp " CMD_AS_RANGE " encap unicast in",
6435 CLEAR_STR
6436 IP_STR
6437 BGP_STR
6438 "Clear peers with the AS number\n"
6439 "Address family\n"
6440 "Address Family modifier\n"
6441 "Soft reconfig inbound update\n")
6442
paul718e3742002-12-13 20:15:29 +00006443DEFUN (clear_bgp_as_soft_in,
6444 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006445 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006446 CLEAR_STR
6447 BGP_STR
6448 "Clear peers with the AS number\n"
6449 "Soft reconfig\n"
6450 "Soft reconfig inbound update\n")
6451{
6452 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6453 BGP_CLEAR_SOFT_IN, argv[0]);
6454}
6455
6456ALIAS (clear_bgp_as_soft_in,
6457 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006458 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006459 CLEAR_STR
6460 BGP_STR
6461 "Address family\n"
6462 "Clear peers with the AS number\n"
6463 "Soft reconfig\n"
6464 "Soft reconfig inbound update\n")
6465
6466ALIAS (clear_bgp_as_soft_in,
6467 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006468 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006469 CLEAR_STR
6470 BGP_STR
6471 "Clear peers with the AS number\n"
6472 "Soft reconfig inbound update\n")
6473
6474ALIAS (clear_bgp_as_soft_in,
6475 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006476 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006477 CLEAR_STR
6478 BGP_STR
6479 "Address family\n"
6480 "Clear peers with the AS number\n"
6481 "Soft reconfig inbound update\n")
6482
6483DEFUN (clear_bgp_as_in_prefix_filter,
6484 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006485 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006486 CLEAR_STR
6487 BGP_STR
6488 "Clear peers with the AS number\n"
6489 "Soft reconfig inbound update\n"
6490 "Push out prefix-list ORF and do inbound soft reconfig\n")
6491{
6492 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6493 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6494}
6495
6496ALIAS (clear_bgp_as_in_prefix_filter,
6497 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006498 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006499 CLEAR_STR
6500 BGP_STR
6501 "Address family\n"
6502 "Clear peers with the AS number\n"
6503 "Soft reconfig inbound update\n"
6504 "Push out prefix-list ORF and do inbound soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006505
paul718e3742002-12-13 20:15:29 +00006506/* Both soft-reconfiguration */
6507DEFUN (clear_ip_bgp_all_soft,
6508 clear_ip_bgp_all_soft_cmd,
6509 "clear ip bgp * soft",
6510 CLEAR_STR
6511 IP_STR
6512 BGP_STR
6513 "Clear all peers\n"
6514 "Soft reconfig\n")
6515{
6516 if (argc == 1)
6517 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6518 BGP_CLEAR_SOFT_BOTH, NULL);
6519
6520 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6521 BGP_CLEAR_SOFT_BOTH, NULL);
6522}
6523
6524ALIAS (clear_ip_bgp_all_soft,
6525 clear_ip_bgp_instance_all_soft_cmd,
6526 "clear ip bgp view WORD * soft",
6527 CLEAR_STR
6528 IP_STR
6529 BGP_STR
6530 "BGP view\n"
6531 "view name\n"
6532 "Clear all peers\n"
6533 "Soft reconfig\n")
6534
6535
6536DEFUN (clear_ip_bgp_all_ipv4_soft,
6537 clear_ip_bgp_all_ipv4_soft_cmd,
6538 "clear ip bgp * ipv4 (unicast|multicast) soft",
6539 CLEAR_STR
6540 IP_STR
6541 BGP_STR
6542 "Clear all peers\n"
6543 "Address family\n"
6544 "Address Family Modifier\n"
6545 "Address Family Modifier\n"
6546 "Soft reconfig\n")
6547{
6548 if (strncmp (argv[0], "m", 1) == 0)
6549 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6550 BGP_CLEAR_SOFT_BOTH, NULL);
6551
6552 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6553 BGP_CLEAR_SOFT_BOTH, NULL);
6554}
6555
6556DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6557 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6558 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6559 CLEAR_STR
6560 IP_STR
6561 BGP_STR
6562 "BGP view\n"
6563 "view name\n"
6564 "Clear all peers\n"
6565 "Address family\n"
6566 "Address Family Modifier\n"
6567 "Address Family Modifier\n"
6568 "Soft reconfig\n")
6569{
6570 if (strncmp (argv[1], "m", 1) == 0)
6571 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6572 BGP_CLEAR_SOFT_BOTH, NULL);
6573
6574 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6575 BGP_CLEAR_SOFT_BOTH, NULL);
6576}
6577
6578DEFUN (clear_ip_bgp_all_vpnv4_soft,
6579 clear_ip_bgp_all_vpnv4_soft_cmd,
6580 "clear ip bgp * vpnv4 unicast soft",
6581 CLEAR_STR
6582 IP_STR
6583 BGP_STR
6584 "Clear all peers\n"
6585 "Address family\n"
6586 "Address Family Modifier\n"
6587 "Soft reconfig\n")
6588{
6589 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6590 BGP_CLEAR_SOFT_BOTH, argv[0]);
6591}
6592
Lou Berger298cc2f2016-01-12 13:42:02 -05006593DEFUN (clear_ip_bgp_all_encap_soft,
6594 clear_ip_bgp_all_encap_soft_cmd,
6595 "clear ip bgp * encap unicast soft",
6596 CLEAR_STR
6597 IP_STR
6598 BGP_STR
6599 "Clear all peers\n"
6600 "Address family\n"
6601 "Address Family Modifier\n"
6602 "Soft reconfig\n")
6603{
6604 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
6605 BGP_CLEAR_SOFT_BOTH, argv[0]);
6606}
6607
paul718e3742002-12-13 20:15:29 +00006608DEFUN (clear_bgp_all_soft,
6609 clear_bgp_all_soft_cmd,
6610 "clear bgp * soft",
6611 CLEAR_STR
6612 BGP_STR
6613 "Clear all peers\n"
6614 "Soft reconfig\n")
6615{
6616 if (argc == 1)
6617 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6618 BGP_CLEAR_SOFT_BOTH, argv[0]);
6619
6620 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6621 BGP_CLEAR_SOFT_BOTH, argv[0]);
6622}
6623
6624ALIAS (clear_bgp_all_soft,
6625 clear_bgp_instance_all_soft_cmd,
6626 "clear bgp view WORD * soft",
6627 CLEAR_STR
6628 BGP_STR
6629 "BGP view\n"
6630 "view name\n"
6631 "Clear all peers\n"
6632 "Soft reconfig\n")
6633
6634ALIAS (clear_bgp_all_soft,
6635 clear_bgp_ipv6_all_soft_cmd,
6636 "clear bgp ipv6 * soft",
6637 CLEAR_STR
6638 BGP_STR
6639 "Address family\n"
6640 "Clear all peers\n"
6641 "Soft reconfig\n")
6642
6643DEFUN (clear_ip_bgp_peer_soft,
6644 clear_ip_bgp_peer_soft_cmd,
6645 "clear ip bgp A.B.C.D soft",
6646 CLEAR_STR
6647 IP_STR
6648 BGP_STR
6649 "BGP neighbor address to clear\n"
6650 "Soft reconfig\n")
6651{
6652 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6653 BGP_CLEAR_SOFT_BOTH, argv[0]);
6654}
6655
6656DEFUN (clear_ip_bgp_peer_ipv4_soft,
6657 clear_ip_bgp_peer_ipv4_soft_cmd,
6658 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6659 CLEAR_STR
6660 IP_STR
6661 BGP_STR
6662 "BGP neighbor address to clear\n"
6663 "Address family\n"
6664 "Address Family Modifier\n"
6665 "Address Family Modifier\n"
6666 "Soft reconfig\n")
6667{
6668 if (strncmp (argv[1], "m", 1) == 0)
6669 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6670 BGP_CLEAR_SOFT_BOTH, argv[0]);
6671
6672 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6673 BGP_CLEAR_SOFT_BOTH, argv[0]);
6674}
6675
6676DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6677 clear_ip_bgp_peer_vpnv4_soft_cmd,
6678 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6679 CLEAR_STR
6680 IP_STR
6681 BGP_STR
6682 "BGP neighbor address to clear\n"
6683 "Address family\n"
6684 "Address Family Modifier\n"
6685 "Soft reconfig\n")
6686{
6687 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6688 BGP_CLEAR_SOFT_BOTH, argv[0]);
6689}
6690
Lou Berger298cc2f2016-01-12 13:42:02 -05006691DEFUN (clear_ip_bgp_peer_encap_soft,
6692 clear_ip_bgp_peer_encap_soft_cmd,
6693 "clear ip bgp A.B.C.D encap unicast soft",
6694 CLEAR_STR
6695 IP_STR
6696 BGP_STR
6697 "BGP neighbor address to clear\n"
6698 "Address family\n"
6699 "Address Family Modifier\n"
6700 "Soft reconfig\n")
6701{
6702 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
6703 BGP_CLEAR_SOFT_BOTH, argv[0]);
6704}
6705
paul718e3742002-12-13 20:15:29 +00006706DEFUN (clear_bgp_peer_soft,
6707 clear_bgp_peer_soft_cmd,
6708 "clear bgp (A.B.C.D|X:X::X:X) soft",
6709 CLEAR_STR
6710 BGP_STR
6711 "BGP neighbor address to clear\n"
6712 "BGP IPv6 neighbor to clear\n"
6713 "Soft reconfig\n")
6714{
6715 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6716 BGP_CLEAR_SOFT_BOTH, argv[0]);
6717}
6718
6719ALIAS (clear_bgp_peer_soft,
6720 clear_bgp_ipv6_peer_soft_cmd,
6721 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6722 CLEAR_STR
6723 BGP_STR
6724 "Address family\n"
6725 "BGP neighbor address to clear\n"
6726 "BGP IPv6 neighbor to clear\n"
6727 "Soft reconfig\n")
6728
6729DEFUN (clear_ip_bgp_peer_group_soft,
6730 clear_ip_bgp_peer_group_soft_cmd,
6731 "clear ip bgp peer-group WORD soft",
6732 CLEAR_STR
6733 IP_STR
6734 BGP_STR
6735 "Clear all members of peer-group\n"
6736 "BGP peer-group name\n"
6737 "Soft reconfig\n")
6738{
6739 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6740 BGP_CLEAR_SOFT_BOTH, argv[0]);
6741}
6742
6743DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6744 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6745 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6746 CLEAR_STR
6747 IP_STR
6748 BGP_STR
6749 "Clear all members of peer-group\n"
6750 "BGP peer-group name\n"
6751 "Address family\n"
6752 "Address Family modifier\n"
6753 "Address Family modifier\n"
6754 "Soft reconfig\n")
6755{
6756 if (strncmp (argv[1], "m", 1) == 0)
6757 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6758 BGP_CLEAR_SOFT_BOTH, argv[0]);
6759
6760 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6761 BGP_CLEAR_SOFT_BOTH, argv[0]);
6762}
6763
6764DEFUN (clear_bgp_peer_group_soft,
6765 clear_bgp_peer_group_soft_cmd,
6766 "clear bgp peer-group WORD soft",
6767 CLEAR_STR
6768 BGP_STR
6769 "Clear all members of peer-group\n"
6770 "BGP peer-group name\n"
6771 "Soft reconfig\n")
6772{
6773 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6774 BGP_CLEAR_SOFT_BOTH, argv[0]);
6775}
6776
6777ALIAS (clear_bgp_peer_group_soft,
6778 clear_bgp_ipv6_peer_group_soft_cmd,
6779 "clear bgp ipv6 peer-group WORD soft",
6780 CLEAR_STR
6781 BGP_STR
6782 "Address family\n"
6783 "Clear all members of peer-group\n"
6784 "BGP peer-group name\n"
6785 "Soft reconfig\n")
6786
6787DEFUN (clear_ip_bgp_external_soft,
6788 clear_ip_bgp_external_soft_cmd,
6789 "clear ip bgp external soft",
6790 CLEAR_STR
6791 IP_STR
6792 BGP_STR
6793 "Clear all external peers\n"
6794 "Soft reconfig\n")
6795{
6796 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6797 BGP_CLEAR_SOFT_BOTH, NULL);
6798}
6799
6800DEFUN (clear_ip_bgp_external_ipv4_soft,
6801 clear_ip_bgp_external_ipv4_soft_cmd,
6802 "clear ip bgp external ipv4 (unicast|multicast) soft",
6803 CLEAR_STR
6804 IP_STR
6805 BGP_STR
6806 "Clear all external peers\n"
6807 "Address family\n"
6808 "Address Family modifier\n"
6809 "Address Family modifier\n"
6810 "Soft reconfig\n")
6811{
6812 if (strncmp (argv[0], "m", 1) == 0)
6813 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6814 BGP_CLEAR_SOFT_BOTH, NULL);
6815
6816 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6817 BGP_CLEAR_SOFT_BOTH, NULL);
6818}
6819
6820DEFUN (clear_bgp_external_soft,
6821 clear_bgp_external_soft_cmd,
6822 "clear bgp external soft",
6823 CLEAR_STR
6824 BGP_STR
6825 "Clear all external peers\n"
6826 "Soft reconfig\n")
6827{
6828 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6829 BGP_CLEAR_SOFT_BOTH, NULL);
6830}
6831
6832ALIAS (clear_bgp_external_soft,
6833 clear_bgp_ipv6_external_soft_cmd,
6834 "clear bgp ipv6 external soft",
6835 CLEAR_STR
6836 BGP_STR
6837 "Address family\n"
6838 "Clear all external peers\n"
6839 "Soft reconfig\n")
6840
6841DEFUN (clear_ip_bgp_as_soft,
6842 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006843 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006844 CLEAR_STR
6845 IP_STR
6846 BGP_STR
6847 "Clear peers with the AS number\n"
6848 "Soft reconfig\n")
6849{
6850 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6851 BGP_CLEAR_SOFT_BOTH, argv[0]);
6852}
6853
6854DEFUN (clear_ip_bgp_as_ipv4_soft,
6855 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006856 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006857 CLEAR_STR
6858 IP_STR
6859 BGP_STR
6860 "Clear peers with the AS number\n"
6861 "Address family\n"
6862 "Address Family Modifier\n"
6863 "Address Family Modifier\n"
6864 "Soft reconfig\n")
6865{
6866 if (strncmp (argv[1], "m", 1) == 0)
6867 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6868 BGP_CLEAR_SOFT_BOTH, argv[0]);
6869
6870 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6871 BGP_CLEAR_SOFT_BOTH, argv[0]);
6872}
6873
6874DEFUN (clear_ip_bgp_as_vpnv4_soft,
6875 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006876 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00006877 CLEAR_STR
6878 IP_STR
6879 BGP_STR
6880 "Clear peers with the AS number\n"
6881 "Address family\n"
6882 "Address Family Modifier\n"
6883 "Soft reconfig\n")
6884{
6885 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6886 BGP_CLEAR_SOFT_BOTH, argv[0]);
6887}
6888
Lou Berger298cc2f2016-01-12 13:42:02 -05006889DEFUN (clear_ip_bgp_as_encap_soft,
6890 clear_ip_bgp_as_encap_soft_cmd,
6891 "clear ip bgp " CMD_AS_RANGE " encap unicast soft",
6892 CLEAR_STR
6893 IP_STR
6894 BGP_STR
6895 "Clear peers with the AS number\n"
6896 "Address family\n"
6897 "Address Family Modifier\n"
6898 "Soft reconfig\n")
6899{
6900 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6901 BGP_CLEAR_SOFT_BOTH, argv[0]);
6902}
6903
paul718e3742002-12-13 20:15:29 +00006904DEFUN (clear_bgp_as_soft,
6905 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006906 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006907 CLEAR_STR
6908 BGP_STR
6909 "Clear peers with the AS number\n"
6910 "Soft reconfig\n")
6911{
6912 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6913 BGP_CLEAR_SOFT_BOTH, argv[0]);
6914}
6915
6916ALIAS (clear_bgp_as_soft,
6917 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006918 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006919 CLEAR_STR
6920 BGP_STR
6921 "Address family\n"
6922 "Clear peers with the AS number\n"
6923 "Soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006924
paulfee0f4c2004-09-13 05:12:46 +00006925/* RS-client soft reconfiguration. */
6926#ifdef HAVE_IPV6
6927DEFUN (clear_bgp_all_rsclient,
6928 clear_bgp_all_rsclient_cmd,
6929 "clear bgp * rsclient",
6930 CLEAR_STR
6931 BGP_STR
6932 "Clear all peers\n"
6933 "Soft reconfig for rsclient RIB\n")
6934{
6935 if (argc == 1)
6936 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6937 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6938
6939 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6940 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6941}
6942
6943ALIAS (clear_bgp_all_rsclient,
6944 clear_bgp_ipv6_all_rsclient_cmd,
6945 "clear bgp ipv6 * rsclient",
6946 CLEAR_STR
6947 BGP_STR
6948 "Address family\n"
6949 "Clear all peers\n"
6950 "Soft reconfig for rsclient RIB\n")
6951
6952ALIAS (clear_bgp_all_rsclient,
6953 clear_bgp_instance_all_rsclient_cmd,
6954 "clear bgp view WORD * rsclient",
6955 CLEAR_STR
6956 BGP_STR
6957 "BGP view\n"
6958 "view name\n"
6959 "Clear all peers\n"
6960 "Soft reconfig for rsclient RIB\n")
6961
6962ALIAS (clear_bgp_all_rsclient,
6963 clear_bgp_ipv6_instance_all_rsclient_cmd,
6964 "clear bgp ipv6 view WORD * rsclient",
6965 CLEAR_STR
6966 BGP_STR
6967 "Address family\n"
6968 "BGP view\n"
6969 "view name\n"
6970 "Clear all peers\n"
6971 "Soft reconfig for rsclient RIB\n")
6972#endif /* HAVE_IPV6 */
6973
6974DEFUN (clear_ip_bgp_all_rsclient,
6975 clear_ip_bgp_all_rsclient_cmd,
6976 "clear ip bgp * rsclient",
6977 CLEAR_STR
6978 IP_STR
6979 BGP_STR
6980 "Clear all peers\n"
6981 "Soft reconfig for rsclient RIB\n")
6982{
6983 if (argc == 1)
6984 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6985 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6986
6987 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6988 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6989}
6990
6991ALIAS (clear_ip_bgp_all_rsclient,
6992 clear_ip_bgp_instance_all_rsclient_cmd,
6993 "clear ip bgp view WORD * rsclient",
6994 CLEAR_STR
6995 IP_STR
6996 BGP_STR
6997 "BGP view\n"
6998 "view name\n"
6999 "Clear all peers\n"
7000 "Soft reconfig for rsclient RIB\n")
7001
7002#ifdef HAVE_IPV6
7003DEFUN (clear_bgp_peer_rsclient,
7004 clear_bgp_peer_rsclient_cmd,
7005 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
7006 CLEAR_STR
7007 BGP_STR
7008 "BGP neighbor IP address to clear\n"
7009 "BGP IPv6 neighbor to clear\n"
7010 "Soft reconfig for rsclient RIB\n")
7011{
7012 if (argc == 2)
7013 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
7014 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7015
7016 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
7017 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7018}
7019
7020ALIAS (clear_bgp_peer_rsclient,
7021 clear_bgp_ipv6_peer_rsclient_cmd,
7022 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
7023 CLEAR_STR
7024 BGP_STR
7025 "Address family\n"
7026 "BGP neighbor IP address to clear\n"
7027 "BGP IPv6 neighbor to clear\n"
7028 "Soft reconfig for rsclient RIB\n")
7029
7030ALIAS (clear_bgp_peer_rsclient,
7031 clear_bgp_instance_peer_rsclient_cmd,
7032 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7033 CLEAR_STR
7034 BGP_STR
7035 "BGP view\n"
7036 "view name\n"
7037 "BGP neighbor IP address to clear\n"
7038 "BGP IPv6 neighbor to clear\n"
7039 "Soft reconfig for rsclient RIB\n")
7040
7041ALIAS (clear_bgp_peer_rsclient,
7042 clear_bgp_ipv6_instance_peer_rsclient_cmd,
7043 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
7044 CLEAR_STR
7045 BGP_STR
7046 "Address family\n"
7047 "BGP view\n"
7048 "view name\n"
7049 "BGP neighbor IP address to clear\n"
7050 "BGP IPv6 neighbor to clear\n"
7051 "Soft reconfig for rsclient RIB\n")
7052#endif /* HAVE_IPV6 */
7053
7054DEFUN (clear_ip_bgp_peer_rsclient,
7055 clear_ip_bgp_peer_rsclient_cmd,
7056 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
7057 CLEAR_STR
7058 IP_STR
7059 BGP_STR
7060 "BGP neighbor IP address to clear\n"
7061 "BGP IPv6 neighbor to clear\n"
7062 "Soft reconfig for rsclient RIB\n")
7063{
7064 if (argc == 2)
7065 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
7066 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7067
7068 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
7069 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7070}
7071
7072ALIAS (clear_ip_bgp_peer_rsclient,
7073 clear_ip_bgp_instance_peer_rsclient_cmd,
7074 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7075 CLEAR_STR
7076 IP_STR
7077 BGP_STR
7078 "BGP view\n"
7079 "view name\n"
7080 "BGP neighbor IP address to clear\n"
7081 "BGP IPv6 neighbor to clear\n"
7082 "Soft reconfig for rsclient RIB\n")
7083
Michael Lamberte0081f72008-11-16 20:12:04 +00007084DEFUN (show_bgp_views,
7085 show_bgp_views_cmd,
7086 "show bgp views",
7087 SHOW_STR
7088 BGP_STR
7089 "Show the defined BGP views\n")
7090{
7091 struct list *inst = bm->bgp;
7092 struct listnode *node;
7093 struct bgp *bgp;
7094
7095 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
7096 {
7097 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
7098 return CMD_WARNING;
7099 }
7100
7101 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
7102 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
7103 vty_out (vty, "\t%s (AS%u)%s",
7104 bgp->name ? bgp->name : "(null)",
7105 bgp->as, VTY_NEWLINE);
7106
7107 return CMD_SUCCESS;
7108}
7109
Paul Jakma4bf6a362006-03-30 14:05:23 +00007110DEFUN (show_bgp_memory,
7111 show_bgp_memory_cmd,
7112 "show bgp memory",
7113 SHOW_STR
7114 BGP_STR
7115 "Global BGP memory statistics\n")
7116{
7117 char memstrbuf[MTYPE_MEMSTR_LEN];
7118 unsigned long count;
7119
7120 /* RIB related usage stats */
7121 count = mtype_stats_alloc (MTYPE_BGP_NODE);
7122 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
7123 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7124 count * sizeof (struct bgp_node)),
7125 VTY_NEWLINE);
7126
7127 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
7128 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
7129 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7130 count * sizeof (struct bgp_info)),
7131 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007132 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
7133 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
7134 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7135 count * sizeof (struct bgp_info_extra)),
7136 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007137
7138 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
7139 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
7140 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7141 count * sizeof (struct bgp_static)),
7142 VTY_NEWLINE);
7143
7144 /* Adj-In/Out */
7145 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
7146 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
7147 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7148 count * sizeof (struct bgp_adj_in)),
7149 VTY_NEWLINE);
7150 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
7151 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
7152 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7153 count * sizeof (struct bgp_adj_out)),
7154 VTY_NEWLINE);
7155
7156 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
7157 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
7158 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7159 count * sizeof (struct bgp_nexthop_cache)),
7160 VTY_NEWLINE);
7161
7162 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
7163 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
7164 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7165 count * sizeof (struct bgp_damp_info)),
7166 VTY_NEWLINE);
7167
7168 /* Attributes */
7169 count = attr_count();
7170 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
7171 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7172 count * sizeof(struct attr)),
7173 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007174 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
7175 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
7176 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7177 count * sizeof(struct attr_extra)),
7178 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007179
7180 if ((count = attr_unknown_count()))
7181 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
7182
7183 /* AS_PATH attributes */
7184 count = aspath_count ();
7185 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
7186 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7187 count * sizeof (struct aspath)),
7188 VTY_NEWLINE);
7189
7190 count = mtype_stats_alloc (MTYPE_AS_SEG);
7191 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
7192 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7193 count * sizeof (struct assegment)),
7194 VTY_NEWLINE);
7195
7196 /* Other attributes */
7197 if ((count = community_count ()))
7198 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7199 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7200 count * sizeof (struct community)),
7201 VTY_NEWLINE);
7202 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
7203 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7204 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7205 count * sizeof (struct ecommunity)),
7206 VTY_NEWLINE);
7207
7208 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
7209 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
7210 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7211 count * sizeof (struct cluster_list)),
7212 VTY_NEWLINE);
7213
7214 /* Peer related usage */
7215 count = mtype_stats_alloc (MTYPE_BGP_PEER);
7216 vty_out (vty, "%ld peers, using %s of memory%s", count,
7217 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7218 count * sizeof (struct peer)),
7219 VTY_NEWLINE);
7220
7221 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
7222 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
7223 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7224 count * sizeof (struct peer_group)),
7225 VTY_NEWLINE);
7226
7227 /* Other */
7228 if ((count = mtype_stats_alloc (MTYPE_HASH)))
7229 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
7230 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7231 count * sizeof (struct hash)),
7232 VTY_NEWLINE);
7233 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
7234 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
7235 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7236 count * sizeof (struct hash_backet)),
7237 VTY_NEWLINE);
7238 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
7239 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
7240 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7241 count * sizeof (regex_t)),
7242 VTY_NEWLINE);
7243 return CMD_SUCCESS;
7244}
paulfee0f4c2004-09-13 05:12:46 +00007245
paul718e3742002-12-13 20:15:29 +00007246/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00007247static int
paul718e3742002-12-13 20:15:29 +00007248bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
7249{
7250 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007251 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00007252 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00007253 char timebuf[BGP_UPTIME_LEN];
7254 int len;
7255
7256 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00007257 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00007258
paul1eb8ef22005-04-07 07:30:20 +00007259 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007260 {
7261 if (peer->afc[afi][safi])
7262 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00007263 if (!count)
7264 {
7265 unsigned long ents;
7266 char memstrbuf[MTYPE_MEMSTR_LEN];
7267
7268 /* Usage summary and header */
7269 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007270 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00007271 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007272
Paul Jakma4bf6a362006-03-30 14:05:23 +00007273 ents = bgp_table_count (bgp->rib[afi][safi]);
7274 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
7275 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7276 ents * sizeof (struct bgp_node)),
7277 VTY_NEWLINE);
7278
7279 /* Peer related usage */
7280 ents = listcount (bgp->peer);
7281 vty_out (vty, "Peers %ld, using %s of memory%s",
7282 ents,
7283 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7284 ents * sizeof (struct peer)),
7285 VTY_NEWLINE);
7286
7287 if ((ents = listcount (bgp->rsclient)))
7288 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
7289 ents,
7290 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7291 ents * sizeof (struct peer)),
7292 VTY_NEWLINE);
7293
7294 if ((ents = listcount (bgp->group)))
7295 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
7296 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7297 ents * sizeof (struct peer_group)),
7298 VTY_NEWLINE);
7299
7300 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
7301 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
7302 vty_out (vty, "%s", VTY_NEWLINE);
7303 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7304 }
7305
paul718e3742002-12-13 20:15:29 +00007306 count++;
7307
7308 len = vty_out (vty, "%s", peer->host);
7309 len = 16 - len;
7310 if (len < 1)
7311 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7312 else
7313 vty_out (vty, "%*s", len, " ");
7314
hasso3d515fd2005-02-01 21:30:04 +00007315 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00007316
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007317 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00007318 peer->as,
7319 peer->open_in + peer->update_in + peer->keepalive_in
7320 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
7321 peer->open_out + peer->update_out + peer->keepalive_out
7322 + peer->notify_out + peer->refresh_out
7323 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007324 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00007325
7326 vty_out (vty, "%8s",
7327 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7328
7329 if (peer->status == Established)
7330 {
7331 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
7332 }
7333 else
7334 {
7335 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7336 vty_out (vty, " Idle (Admin)");
7337 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7338 vty_out (vty, " Idle (PfxCt)");
7339 else
7340 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7341 }
7342
7343 vty_out (vty, "%s", VTY_NEWLINE);
7344 }
7345 }
7346
7347 if (count)
7348 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7349 count, VTY_NEWLINE);
7350 else
7351 vty_out (vty, "No %s neighbor is configured%s",
7352 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7353 return CMD_SUCCESS;
7354}
7355
paul94f2b392005-06-28 12:44:16 +00007356static int
paulfd79ac92004-10-13 05:06:08 +00007357bgp_show_summary_vty (struct vty *vty, const char *name,
7358 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007359{
7360 struct bgp *bgp;
7361
7362 if (name)
7363 {
7364 bgp = bgp_lookup_by_name (name);
7365
7366 if (! bgp)
7367 {
7368 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7369 return CMD_WARNING;
7370 }
7371
7372 bgp_show_summary (vty, bgp, afi, safi);
7373 return CMD_SUCCESS;
7374 }
7375
7376 bgp = bgp_get_default ();
7377
7378 if (bgp)
7379 bgp_show_summary (vty, bgp, afi, safi);
7380
7381 return CMD_SUCCESS;
7382}
7383
7384/* `show ip bgp summary' commands. */
7385DEFUN (show_ip_bgp_summary,
7386 show_ip_bgp_summary_cmd,
7387 "show ip bgp summary",
7388 SHOW_STR
7389 IP_STR
7390 BGP_STR
7391 "Summary of BGP neighbor status\n")
7392{
7393 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7394}
7395
7396DEFUN (show_ip_bgp_instance_summary,
7397 show_ip_bgp_instance_summary_cmd,
7398 "show ip bgp view WORD summary",
7399 SHOW_STR
7400 IP_STR
7401 BGP_STR
7402 "BGP view\n"
7403 "View name\n"
7404 "Summary of BGP neighbor status\n")
7405{
7406 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7407}
7408
7409DEFUN (show_ip_bgp_ipv4_summary,
7410 show_ip_bgp_ipv4_summary_cmd,
7411 "show ip bgp ipv4 (unicast|multicast) summary",
7412 SHOW_STR
7413 IP_STR
7414 BGP_STR
7415 "Address family\n"
7416 "Address Family modifier\n"
7417 "Address Family modifier\n"
7418 "Summary of BGP neighbor status\n")
7419{
7420 if (strncmp (argv[0], "m", 1) == 0)
7421 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7422
7423 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7424}
7425
Michael Lambert95cbbd22010-07-23 14:43:04 -04007426ALIAS (show_ip_bgp_ipv4_summary,
7427 show_bgp_ipv4_safi_summary_cmd,
7428 "show bgp ipv4 (unicast|multicast) summary",
7429 SHOW_STR
7430 BGP_STR
7431 "Address family\n"
7432 "Address Family modifier\n"
7433 "Address Family modifier\n"
7434 "Summary of BGP neighbor status\n")
7435
paul718e3742002-12-13 20:15:29 +00007436DEFUN (show_ip_bgp_instance_ipv4_summary,
7437 show_ip_bgp_instance_ipv4_summary_cmd,
7438 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7439 SHOW_STR
7440 IP_STR
7441 BGP_STR
7442 "BGP view\n"
7443 "View name\n"
7444 "Address family\n"
7445 "Address Family modifier\n"
7446 "Address Family modifier\n"
7447 "Summary of BGP neighbor status\n")
7448{
7449 if (strncmp (argv[1], "m", 1) == 0)
7450 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7451 else
7452 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7453}
7454
Michael Lambert95cbbd22010-07-23 14:43:04 -04007455ALIAS (show_ip_bgp_instance_ipv4_summary,
7456 show_bgp_instance_ipv4_safi_summary_cmd,
7457 "show bgp view WORD ipv4 (unicast|multicast) summary",
7458 SHOW_STR
7459 BGP_STR
7460 "BGP view\n"
7461 "View name\n"
7462 "Address family\n"
7463 "Address Family modifier\n"
7464 "Address Family modifier\n"
7465 "Summary of BGP neighbor status\n")
7466
paul718e3742002-12-13 20:15:29 +00007467DEFUN (show_ip_bgp_vpnv4_all_summary,
7468 show_ip_bgp_vpnv4_all_summary_cmd,
7469 "show ip bgp vpnv4 all summary",
7470 SHOW_STR
7471 IP_STR
7472 BGP_STR
7473 "Display VPNv4 NLRI specific information\n"
7474 "Display information about all VPNv4 NLRIs\n"
7475 "Summary of BGP neighbor status\n")
7476{
7477 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7478}
7479
7480DEFUN (show_ip_bgp_vpnv4_rd_summary,
7481 show_ip_bgp_vpnv4_rd_summary_cmd,
7482 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7483 SHOW_STR
7484 IP_STR
7485 BGP_STR
7486 "Display VPNv4 NLRI specific information\n"
7487 "Display information for a route distinguisher\n"
7488 "VPN Route Distinguisher\n"
7489 "Summary of BGP neighbor status\n")
7490{
7491 int ret;
7492 struct prefix_rd prd;
7493
7494 ret = str2prefix_rd (argv[0], &prd);
7495 if (! ret)
7496 {
7497 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7498 return CMD_WARNING;
7499 }
7500
7501 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7502}
7503
7504#ifdef HAVE_IPV6
7505DEFUN (show_bgp_summary,
7506 show_bgp_summary_cmd,
7507 "show bgp summary",
7508 SHOW_STR
7509 BGP_STR
7510 "Summary of BGP neighbor status\n")
7511{
7512 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7513}
7514
7515DEFUN (show_bgp_instance_summary,
7516 show_bgp_instance_summary_cmd,
7517 "show bgp view WORD summary",
7518 SHOW_STR
7519 BGP_STR
7520 "BGP view\n"
7521 "View name\n"
7522 "Summary of BGP neighbor status\n")
7523{
7524 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7525}
7526
7527ALIAS (show_bgp_summary,
7528 show_bgp_ipv6_summary_cmd,
7529 "show bgp ipv6 summary",
7530 SHOW_STR
7531 BGP_STR
7532 "Address family\n"
7533 "Summary of BGP neighbor status\n")
7534
7535ALIAS (show_bgp_instance_summary,
7536 show_bgp_instance_ipv6_summary_cmd,
7537 "show bgp view WORD ipv6 summary",
7538 SHOW_STR
7539 BGP_STR
7540 "BGP view\n"
7541 "View name\n"
7542 "Address family\n"
7543 "Summary of BGP neighbor status\n")
7544
Michael Lambert95cbbd22010-07-23 14:43:04 -04007545DEFUN (show_bgp_ipv6_safi_summary,
7546 show_bgp_ipv6_safi_summary_cmd,
7547 "show bgp ipv6 (unicast|multicast) summary",
7548 SHOW_STR
7549 BGP_STR
7550 "Address family\n"
7551 "Address Family modifier\n"
7552 "Address Family modifier\n"
7553 "Summary of BGP neighbor status\n")
7554{
7555 if (strncmp (argv[0], "m", 1) == 0)
7556 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7557
7558 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7559}
7560
7561DEFUN (show_bgp_instance_ipv6_safi_summary,
7562 show_bgp_instance_ipv6_safi_summary_cmd,
7563 "show bgp view WORD ipv6 (unicast|multicast) summary",
7564 SHOW_STR
7565 BGP_STR
7566 "BGP view\n"
7567 "View name\n"
7568 "Address family\n"
7569 "Address Family modifier\n"
7570 "Address Family modifier\n"
7571 "Summary of BGP neighbor status\n")
7572{
7573 if (strncmp (argv[1], "m", 1) == 0)
7574 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7575
7576 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7577}
7578
paul718e3742002-12-13 20:15:29 +00007579/* old command */
7580DEFUN (show_ipv6_bgp_summary,
7581 show_ipv6_bgp_summary_cmd,
7582 "show ipv6 bgp summary",
7583 SHOW_STR
7584 IPV6_STR
7585 BGP_STR
7586 "Summary of BGP neighbor status\n")
7587{
7588 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7589}
7590
7591/* old command */
7592DEFUN (show_ipv6_mbgp_summary,
7593 show_ipv6_mbgp_summary_cmd,
7594 "show ipv6 mbgp summary",
7595 SHOW_STR
7596 IPV6_STR
7597 MBGP_STR
7598 "Summary of BGP neighbor status\n")
7599{
7600 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7601}
7602#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02007603
paulfd79ac92004-10-13 05:06:08 +00007604const char *
hasso538621f2004-05-21 09:31:30 +00007605afi_safi_print (afi_t afi, safi_t safi)
7606{
7607 if (afi == AFI_IP && safi == SAFI_UNICAST)
7608 return "IPv4 Unicast";
7609 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7610 return "IPv4 Multicast";
7611 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
Lou Berger9da04bc2016-01-12 13:41:55 -05007612 return "VPN-IPv4 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007613 else if (afi == AFI_IP && safi == SAFI_ENCAP)
7614 return "ENCAP-IPv4 Unicast";
hasso538621f2004-05-21 09:31:30 +00007615 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7616 return "IPv6 Unicast";
7617 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7618 return "IPv6 Multicast";
Lou Berger9da04bc2016-01-12 13:41:55 -05007619 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
7620 return "VPN-IPv6 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007621 else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
7622 return "ENCAP-IPv6 Unicast";
hasso538621f2004-05-21 09:31:30 +00007623 else
7624 return "Unknown";
7625}
7626
paul718e3742002-12-13 20:15:29 +00007627/* Show BGP peer's information. */
7628enum show_type
7629{
7630 show_all,
7631 show_peer
7632};
7633
paul94f2b392005-06-28 12:44:16 +00007634static void
paul718e3742002-12-13 20:15:29 +00007635bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7636 afi_t afi, safi_t safi,
7637 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7638 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7639{
7640 /* Send-Mode */
7641 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7642 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7643 {
7644 vty_out (vty, " Send-mode: ");
7645 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7646 vty_out (vty, "advertised");
7647 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7648 vty_out (vty, "%sreceived",
7649 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7650 ", " : "");
7651 vty_out (vty, "%s", VTY_NEWLINE);
7652 }
7653
7654 /* Receive-Mode */
7655 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7656 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7657 {
7658 vty_out (vty, " Receive-mode: ");
7659 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7660 vty_out (vty, "advertised");
7661 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7662 vty_out (vty, "%sreceived",
7663 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7664 ", " : "");
7665 vty_out (vty, "%s", VTY_NEWLINE);
7666 }
7667}
7668
paul94f2b392005-06-28 12:44:16 +00007669static void
paul718e3742002-12-13 20:15:29 +00007670bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7671{
7672 struct bgp_filter *filter;
7673 char orf_pfx_name[BUFSIZ];
7674 int orf_pfx_count;
7675
7676 filter = &p->filter[afi][safi];
7677
hasso538621f2004-05-21 09:31:30 +00007678 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007679 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007680
paul718e3742002-12-13 20:15:29 +00007681 if (p->af_group[afi][safi])
7682 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7683
7684 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7685 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7686 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7687 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7688 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7689 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7690 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7691
7692 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7693 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7694 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7695 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7696 {
7697 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7698 ORF_TYPE_PREFIX, VTY_NEWLINE);
7699 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7700 PEER_CAP_ORF_PREFIX_SM_ADV,
7701 PEER_CAP_ORF_PREFIX_RM_ADV,
7702 PEER_CAP_ORF_PREFIX_SM_RCV,
7703 PEER_CAP_ORF_PREFIX_RM_RCV);
7704 }
7705 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7706 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7707 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7708 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7709 {
7710 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7711 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7712 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7713 PEER_CAP_ORF_PREFIX_SM_ADV,
7714 PEER_CAP_ORF_PREFIX_RM_ADV,
7715 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7716 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7717 }
7718
7719 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7720 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7721
7722 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7723 || orf_pfx_count)
7724 {
7725 vty_out (vty, " Outbound Route Filter (ORF):");
7726 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7727 vty_out (vty, " sent;");
7728 if (orf_pfx_count)
7729 vty_out (vty, " received (%d entries)", orf_pfx_count);
7730 vty_out (vty, "%s", VTY_NEWLINE);
7731 }
7732 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7733 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7734
7735 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7736 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7737 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7738 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7739 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7740 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7741 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7742 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7743 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7744 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
7745 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
7746 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7747 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
7748 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7749 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
7750 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7751 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7752 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
7753 {
7754 vty_out (vty, " Community attribute sent to this neighbor");
7755 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7756 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007757 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007758 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007759 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007760 else
hasso538621f2004-05-21 09:31:30 +00007761 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007762 }
7763 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
7764 {
7765 vty_out (vty, " Default information originate,");
7766
7767 if (p->default_rmap[afi][safi].name)
7768 vty_out (vty, " default route-map %s%s,",
7769 p->default_rmap[afi][safi].map ? "*" : "",
7770 p->default_rmap[afi][safi].name);
7771 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
7772 vty_out (vty, " default sent%s", VTY_NEWLINE);
7773 else
7774 vty_out (vty, " default not sent%s", VTY_NEWLINE);
7775 }
7776
7777 if (filter->plist[FILTER_IN].name
7778 || filter->dlist[FILTER_IN].name
7779 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00007780 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007781 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
7782 if (filter->plist[FILTER_OUT].name
7783 || filter->dlist[FILTER_OUT].name
7784 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00007785 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00007786 || filter->usmap.name)
7787 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007788 if (filter->map[RMAP_IMPORT].name)
7789 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
7790 if (filter->map[RMAP_EXPORT].name)
7791 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007792
7793 /* prefix-list */
7794 if (filter->plist[FILTER_IN].name)
7795 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
7796 filter->plist[FILTER_IN].plist ? "*" : "",
7797 filter->plist[FILTER_IN].name,
7798 VTY_NEWLINE);
7799 if (filter->plist[FILTER_OUT].name)
7800 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
7801 filter->plist[FILTER_OUT].plist ? "*" : "",
7802 filter->plist[FILTER_OUT].name,
7803 VTY_NEWLINE);
7804
7805 /* distribute-list */
7806 if (filter->dlist[FILTER_IN].name)
7807 vty_out (vty, " Incoming update network filter list is %s%s%s",
7808 filter->dlist[FILTER_IN].alist ? "*" : "",
7809 filter->dlist[FILTER_IN].name,
7810 VTY_NEWLINE);
7811 if (filter->dlist[FILTER_OUT].name)
7812 vty_out (vty, " Outgoing update network filter list is %s%s%s",
7813 filter->dlist[FILTER_OUT].alist ? "*" : "",
7814 filter->dlist[FILTER_OUT].name,
7815 VTY_NEWLINE);
7816
7817 /* filter-list. */
7818 if (filter->aslist[FILTER_IN].name)
7819 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
7820 filter->aslist[FILTER_IN].aslist ? "*" : "",
7821 filter->aslist[FILTER_IN].name,
7822 VTY_NEWLINE);
7823 if (filter->aslist[FILTER_OUT].name)
7824 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
7825 filter->aslist[FILTER_OUT].aslist ? "*" : "",
7826 filter->aslist[FILTER_OUT].name,
7827 VTY_NEWLINE);
7828
7829 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00007830 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007831 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007832 filter->map[RMAP_IN].map ? "*" : "",
7833 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00007834 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007835 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00007836 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007837 filter->map[RMAP_OUT].map ? "*" : "",
7838 filter->map[RMAP_OUT].name,
7839 VTY_NEWLINE);
7840 if (filter->map[RMAP_IMPORT].name)
7841 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
7842 filter->map[RMAP_IMPORT].map ? "*" : "",
7843 filter->map[RMAP_IMPORT].name,
7844 VTY_NEWLINE);
7845 if (filter->map[RMAP_EXPORT].name)
7846 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
7847 filter->map[RMAP_EXPORT].map ? "*" : "",
7848 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00007849 VTY_NEWLINE);
7850
7851 /* unsuppress-map */
7852 if (filter->usmap.name)
7853 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
7854 filter->usmap.map ? "*" : "",
7855 filter->usmap.name, VTY_NEWLINE);
7856
7857 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00007858 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
7859
paul718e3742002-12-13 20:15:29 +00007860 /* Maximum prefix */
7861 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
7862 {
hasso0a486e52005-02-01 20:57:17 +00007863 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00007864 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00007865 ? " (warning-only)" : "", VTY_NEWLINE);
7866 vty_out (vty, " Threshold for warning message %d%%",
7867 p->pmax_threshold[afi][safi]);
7868 if (p->pmax_restart[afi][safi])
7869 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
7870 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007871 }
paul718e3742002-12-13 20:15:29 +00007872
7873 vty_out (vty, "%s", VTY_NEWLINE);
7874}
7875
paul94f2b392005-06-28 12:44:16 +00007876static void
paul718e3742002-12-13 20:15:29 +00007877bgp_show_peer (struct vty *vty, struct peer *p)
7878{
7879 struct bgp *bgp;
7880 char buf1[BUFSIZ];
7881 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00007882 afi_t afi;
7883 safi_t safi;
paul718e3742002-12-13 20:15:29 +00007884
7885 bgp = p->bgp;
7886
7887 /* Configured IP address. */
7888 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007889 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00007890 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00007891 p->change_local_as ? p->change_local_as : p->local_as,
7892 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00007893 " no-prepend" : "",
7894 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
7895 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00007896 vty_out (vty, "%s link%s",
7897 p->as == p->local_as ? "internal" : "external",
7898 VTY_NEWLINE);
7899
7900 /* Description. */
7901 if (p->desc)
7902 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
7903
7904 /* Peer-group */
7905 if (p->group)
7906 vty_out (vty, " Member of peer-group %s for session parameters%s",
7907 p->group->name, VTY_NEWLINE);
7908
7909 /* Administrative shutdown. */
7910 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
7911 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
7912
7913 /* BGP Version. */
7914 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00007915 vty_out (vty, ", remote router ID %s%s",
7916 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
7917 VTY_NEWLINE);
7918
7919 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00007920 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
7921 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00007922 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
7923
7924 /* Status. */
7925 vty_out (vty, " BGP state = %s",
7926 LOOKUP (bgp_status_msg, p->status));
7927 if (p->status == Established)
7928 vty_out (vty, ", up for %8s",
7929 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00007930 else if (p->status == Active)
7931 {
7932 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7933 vty_out (vty, " (passive)");
7934 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7935 vty_out (vty, " (NSF passive)");
7936 }
paul718e3742002-12-13 20:15:29 +00007937 vty_out (vty, "%s", VTY_NEWLINE);
7938
7939 /* read timer */
7940 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7941
7942 /* Configured timer values. */
7943 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7944 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7945 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7946 {
7947 vty_out (vty, " Configured hold time is %d", p->holdtime);
7948 vty_out (vty, ", keepalive interval is %d seconds%s",
7949 p->keepalive, VTY_NEWLINE);
7950 }
hasso93406d82005-02-02 14:40:33 +00007951
paul718e3742002-12-13 20:15:29 +00007952 /* Capability. */
7953 if (p->status == Established)
7954 {
hasso538621f2004-05-21 09:31:30 +00007955 if (p->cap
paul718e3742002-12-13 20:15:29 +00007956 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7957 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7958 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7959 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7960#ifdef HAVE_IPV6
7961 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7962 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7963 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7964 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
Lou Berger9da04bc2016-01-12 13:41:55 -05007965 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
7966 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
Lou Bergera3fda882016-01-12 13:42:04 -05007967 || p->afc_adv[AFI_IP6][SAFI_ENCAP]
7968 || p->afc_recv[AFI_IP6][SAFI_ENCAP]
paul718e3742002-12-13 20:15:29 +00007969#endif /* HAVE_IPV6 */
Lou Bergera3fda882016-01-12 13:42:04 -05007970 || p->afc_adv[AFI_IP][SAFI_ENCAP]
7971 || p->afc_recv[AFI_IP][SAFI_ENCAP]
paul718e3742002-12-13 20:15:29 +00007972 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7973 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7974 {
7975 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7976
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007977 /* AS4 */
7978 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
7979 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7980 {
7981 vty_out (vty, " 4 Byte AS:");
7982 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7983 vty_out (vty, " advertised");
7984 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
7985 vty_out (vty, " %sreceived",
7986 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
7987 vty_out (vty, "%s", VTY_NEWLINE);
7988 }
paul718e3742002-12-13 20:15:29 +00007989 /* Dynamic */
7990 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
7991 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7992 {
7993 vty_out (vty, " Dynamic:");
7994 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7995 vty_out (vty, " advertised");
7996 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00007997 vty_out (vty, " %sreceived",
7998 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007999 vty_out (vty, "%s", VTY_NEWLINE);
8000 }
8001
8002 /* Route Refresh */
8003 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
8004 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8005 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
8006 {
8007 vty_out (vty, " Route refresh:");
8008 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
8009 vty_out (vty, " advertised");
8010 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8011 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00008012 vty_out (vty, " %sreceived(%s)",
8013 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
8014 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
8015 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
8016 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
8017
paul718e3742002-12-13 20:15:29 +00008018 vty_out (vty, "%s", VTY_NEWLINE);
8019 }
8020
hasso538621f2004-05-21 09:31:30 +00008021 /* Multiprotocol Extensions */
8022 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8023 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8024 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00008025 {
hasso538621f2004-05-21 09:31:30 +00008026 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
8027 if (p->afc_adv[afi][safi])
8028 vty_out (vty, " advertised");
8029 if (p->afc_recv[afi][safi])
8030 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
8031 vty_out (vty, "%s", VTY_NEWLINE);
8032 }
8033
8034 /* Gracefull Restart */
8035 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8036 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008037 {
hasso538621f2004-05-21 09:31:30 +00008038 vty_out (vty, " Graceful Restart Capabilty:");
8039 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008040 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00008041 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
8042 vty_out (vty, " %sreceived",
8043 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008044 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008045
8046 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00008047 {
hasso538621f2004-05-21 09:31:30 +00008048 int restart_af_count = 0;
8049
8050 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00008051 p->v_gr_restart, VTY_NEWLINE);
8052 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008053
8054 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8055 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8056 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
8057 {
hasso93406d82005-02-02 14:40:33 +00008058 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
8059 afi_safi_print (afi, safi),
8060 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
8061 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00008062 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00008063 }
hasso538621f2004-05-21 09:31:30 +00008064 if (! restart_af_count)
8065 vty_out (vty, "none");
8066 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008067 }
paul718e3742002-12-13 20:15:29 +00008068 }
paul718e3742002-12-13 20:15:29 +00008069 }
8070 }
8071
hasso93406d82005-02-02 14:40:33 +00008072 /* graceful restart information */
8073 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8074 || p->t_gr_restart
8075 || p->t_gr_stale)
8076 {
8077 int eor_send_af_count = 0;
8078 int eor_receive_af_count = 0;
8079
8080 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
8081 if (p->status == Established)
8082 {
8083 vty_out (vty, " End-of-RIB send: ");
8084 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8085 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8086 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
8087 {
8088 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
8089 afi_safi_print (afi, safi));
8090 eor_send_af_count++;
8091 }
8092 vty_out (vty, "%s", VTY_NEWLINE);
8093
8094 vty_out (vty, " End-of-RIB received: ");
8095 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8096 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8097 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
8098 {
8099 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
8100 afi_safi_print (afi, safi));
8101 eor_receive_af_count++;
8102 }
8103 vty_out (vty, "%s", VTY_NEWLINE);
8104 }
8105
8106 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008107 vty_out (vty, " The remaining time of restart timer is %ld%s",
8108 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
8109
hasso93406d82005-02-02 14:40:33 +00008110 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008111 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
8112 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008113 }
8114
paul718e3742002-12-13 20:15:29 +00008115 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00008116 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
8117 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008118 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008119 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
8120 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
8121 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
8122 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
8123 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
8124 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
8125 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
8126 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
8127 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
8128 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
8129 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008130
8131 /* advertisement-interval */
8132 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
8133 p->v_routeadv, VTY_NEWLINE);
8134
8135 /* Update-source. */
8136 if (p->update_if || p->update_source)
8137 {
8138 vty_out (vty, " Update source is ");
8139 if (p->update_if)
8140 vty_out (vty, "%s", p->update_if);
8141 else if (p->update_source)
8142 vty_out (vty, "%s",
8143 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
8144 vty_out (vty, "%s", VTY_NEWLINE);
8145 }
8146
8147 /* Default weight */
8148 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
8149 vty_out (vty, " Default weight %d%s", p->weight,
8150 VTY_NEWLINE);
8151
8152 vty_out (vty, "%s", VTY_NEWLINE);
8153
8154 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00008155 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8156 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8157 if (p->afc[afi][safi])
8158 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00008159
8160 vty_out (vty, " Connections established %d; dropped %d%s",
8161 p->established, p->dropped,
8162 VTY_NEWLINE);
8163
hassoe0701b72004-05-20 09:19:34 +00008164 if (! p->dropped)
8165 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
8166 else
8167 vty_out (vty, " Last reset %s, due to %s%s",
8168 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
8169 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00008170
paul718e3742002-12-13 20:15:29 +00008171 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8172 {
8173 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00008174
8175 if (p->t_pmax_restart)
8176 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8177 p->host, thread_timer_remain_second (p->t_pmax_restart),
8178 VTY_NEWLINE);
8179 else
8180 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8181 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008182 }
8183
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008184 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00008185 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008186 {
8187 if (p->gtsm_hops > 0)
8188 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8189 p->gtsm_hops, VTY_NEWLINE);
8190 else if (p->ttl > 1)
8191 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8192 p->ttl, VTY_NEWLINE);
8193 }
Pradosh Mohapatra5d804b42013-09-12 03:37:07 +00008194 else
8195 {
8196 if (p->gtsm_hops > 0)
8197 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
8198 p->gtsm_hops, VTY_NEWLINE);
8199 }
paul718e3742002-12-13 20:15:29 +00008200
8201 /* Local address. */
8202 if (p->su_local)
8203 {
hasso93406d82005-02-02 14:40:33 +00008204 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00008205 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
8206 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00008207 VTY_NEWLINE);
8208 }
8209
8210 /* Remote address. */
8211 if (p->su_remote)
8212 {
8213 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
8214 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
8215 ntohs (p->su_remote->sin.sin_port),
8216 VTY_NEWLINE);
8217 }
8218
8219 /* Nexthop display. */
8220 if (p->su_local)
8221 {
8222 vty_out (vty, "Nexthop: %s%s",
8223 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
8224 VTY_NEWLINE);
8225#ifdef HAVE_IPV6
8226 vty_out (vty, "Nexthop global: %s%s",
8227 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
8228 VTY_NEWLINE);
8229 vty_out (vty, "Nexthop local: %s%s",
8230 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
8231 VTY_NEWLINE);
8232 vty_out (vty, "BGP connection: %s%s",
8233 p->shared_network ? "shared network" : "non shared network",
8234 VTY_NEWLINE);
8235#endif /* HAVE_IPV6 */
8236 }
8237
Timo Teräsef757702015-04-29 09:43:04 +03008238 /* TCP metrics. */
8239 if (p->status == Established && p->rtt)
8240 vty_out (vty, "Estimated round trip time: %d ms%s",
8241 p->rtt, VTY_NEWLINE);
8242
paul718e3742002-12-13 20:15:29 +00008243 /* Timer information. */
8244 if (p->t_start)
8245 vty_out (vty, "Next start timer due in %ld seconds%s",
8246 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
8247 if (p->t_connect)
8248 vty_out (vty, "Next connect timer due in %ld seconds%s",
8249 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
8250
8251 vty_out (vty, "Read thread: %s Write thread: %s%s",
8252 p->t_read ? "on" : "off",
8253 p->t_write ? "on" : "off",
8254 VTY_NEWLINE);
8255
8256 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
8257 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
8258 bgp_capability_vty_out (vty, p);
8259
8260 vty_out (vty, "%s", VTY_NEWLINE);
8261}
8262
paul94f2b392005-06-28 12:44:16 +00008263static int
paul718e3742002-12-13 20:15:29 +00008264bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
8265 enum show_type type, union sockunion *su)
8266{
paul1eb8ef22005-04-07 07:30:20 +00008267 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00008268 struct peer *peer;
8269 int find = 0;
8270
paul1eb8ef22005-04-07 07:30:20 +00008271 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00008272 {
8273 switch (type)
8274 {
8275 case show_all:
8276 bgp_show_peer (vty, peer);
8277 break;
8278 case show_peer:
8279 if (sockunion_same (&peer->su, su))
8280 {
8281 find = 1;
8282 bgp_show_peer (vty, peer);
8283 }
8284 break;
8285 }
8286 }
8287
8288 if (type == show_peer && ! find)
8289 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
8290
8291 return CMD_SUCCESS;
8292}
8293
paul94f2b392005-06-28 12:44:16 +00008294static int
paulfd79ac92004-10-13 05:06:08 +00008295bgp_show_neighbor_vty (struct vty *vty, const char *name,
8296 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00008297{
8298 int ret;
8299 struct bgp *bgp;
8300 union sockunion su;
8301
8302 if (ip_str)
8303 {
8304 ret = str2sockunion (ip_str, &su);
8305 if (ret < 0)
8306 {
8307 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
8308 return CMD_WARNING;
8309 }
8310 }
8311
8312 if (name)
8313 {
8314 bgp = bgp_lookup_by_name (name);
8315
8316 if (! bgp)
8317 {
8318 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8319 return CMD_WARNING;
8320 }
8321
8322 bgp_show_neighbor (vty, bgp, type, &su);
8323
8324 return CMD_SUCCESS;
8325 }
8326
8327 bgp = bgp_get_default ();
8328
8329 if (bgp)
8330 bgp_show_neighbor (vty, bgp, type, &su);
8331
8332 return CMD_SUCCESS;
8333}
8334
8335/* "show ip bgp neighbors" commands. */
8336DEFUN (show_ip_bgp_neighbors,
8337 show_ip_bgp_neighbors_cmd,
8338 "show ip bgp neighbors",
8339 SHOW_STR
8340 IP_STR
8341 BGP_STR
8342 "Detailed information on TCP and BGP neighbor connections\n")
8343{
8344 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8345}
8346
8347ALIAS (show_ip_bgp_neighbors,
8348 show_ip_bgp_ipv4_neighbors_cmd,
8349 "show ip bgp ipv4 (unicast|multicast) neighbors",
8350 SHOW_STR
8351 IP_STR
8352 BGP_STR
8353 "Address family\n"
8354 "Address Family modifier\n"
8355 "Address Family modifier\n"
8356 "Detailed information on TCP and BGP neighbor connections\n")
8357
8358ALIAS (show_ip_bgp_neighbors,
8359 show_ip_bgp_vpnv4_all_neighbors_cmd,
8360 "show ip bgp vpnv4 all neighbors",
8361 SHOW_STR
8362 IP_STR
8363 BGP_STR
8364 "Display VPNv4 NLRI specific information\n"
8365 "Display information about all VPNv4 NLRIs\n"
8366 "Detailed information on TCP and BGP neighbor connections\n")
8367
8368ALIAS (show_ip_bgp_neighbors,
8369 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8370 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8371 SHOW_STR
8372 IP_STR
8373 BGP_STR
8374 "Display VPNv4 NLRI specific information\n"
8375 "Display information for a route distinguisher\n"
8376 "VPN Route Distinguisher\n"
8377 "Detailed information on TCP and BGP neighbor connections\n")
8378
8379ALIAS (show_ip_bgp_neighbors,
8380 show_bgp_neighbors_cmd,
8381 "show bgp neighbors",
8382 SHOW_STR
8383 BGP_STR
8384 "Detailed information on TCP and BGP neighbor connections\n")
8385
8386ALIAS (show_ip_bgp_neighbors,
8387 show_bgp_ipv6_neighbors_cmd,
8388 "show bgp ipv6 neighbors",
8389 SHOW_STR
8390 BGP_STR
8391 "Address family\n"
8392 "Detailed information on TCP and BGP neighbor connections\n")
8393
8394DEFUN (show_ip_bgp_neighbors_peer,
8395 show_ip_bgp_neighbors_peer_cmd,
8396 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8397 SHOW_STR
8398 IP_STR
8399 BGP_STR
8400 "Detailed information on TCP and BGP neighbor connections\n"
8401 "Neighbor to display information about\n"
8402 "Neighbor to display information about\n")
8403{
8404 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8405}
8406
8407ALIAS (show_ip_bgp_neighbors_peer,
8408 show_ip_bgp_ipv4_neighbors_peer_cmd,
8409 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8410 SHOW_STR
8411 IP_STR
8412 BGP_STR
8413 "Address family\n"
8414 "Address Family modifier\n"
8415 "Address Family modifier\n"
8416 "Detailed information on TCP and BGP neighbor connections\n"
8417 "Neighbor to display information about\n"
8418 "Neighbor to display information about\n")
8419
8420ALIAS (show_ip_bgp_neighbors_peer,
8421 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8422 "show ip bgp vpnv4 all neighbors A.B.C.D",
8423 SHOW_STR
8424 IP_STR
8425 BGP_STR
8426 "Display VPNv4 NLRI specific information\n"
8427 "Display information about all VPNv4 NLRIs\n"
8428 "Detailed information on TCP and BGP neighbor connections\n"
8429 "Neighbor to display information about\n")
8430
8431ALIAS (show_ip_bgp_neighbors_peer,
8432 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8433 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8434 SHOW_STR
8435 IP_STR
8436 BGP_STR
8437 "Display VPNv4 NLRI specific information\n"
8438 "Display information about all VPNv4 NLRIs\n"
8439 "Detailed information on TCP and BGP neighbor connections\n"
8440 "Neighbor to display information about\n")
8441
8442ALIAS (show_ip_bgp_neighbors_peer,
8443 show_bgp_neighbors_peer_cmd,
8444 "show bgp neighbors (A.B.C.D|X:X::X:X)",
8445 SHOW_STR
8446 BGP_STR
8447 "Detailed information on TCP and BGP neighbor connections\n"
8448 "Neighbor to display information about\n"
8449 "Neighbor to display information about\n")
8450
8451ALIAS (show_ip_bgp_neighbors_peer,
8452 show_bgp_ipv6_neighbors_peer_cmd,
8453 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8454 SHOW_STR
8455 BGP_STR
8456 "Address family\n"
8457 "Detailed information on TCP and BGP neighbor connections\n"
8458 "Neighbor to display information about\n"
8459 "Neighbor to display information about\n")
8460
8461DEFUN (show_ip_bgp_instance_neighbors,
8462 show_ip_bgp_instance_neighbors_cmd,
8463 "show ip bgp view WORD neighbors",
8464 SHOW_STR
8465 IP_STR
8466 BGP_STR
8467 "BGP view\n"
8468 "View name\n"
8469 "Detailed information on TCP and BGP neighbor connections\n")
8470{
8471 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8472}
8473
paulbb46e942003-10-24 19:02:03 +00008474ALIAS (show_ip_bgp_instance_neighbors,
8475 show_bgp_instance_neighbors_cmd,
8476 "show bgp view WORD neighbors",
8477 SHOW_STR
8478 BGP_STR
8479 "BGP view\n"
8480 "View name\n"
8481 "Detailed information on TCP and BGP neighbor connections\n")
8482
8483ALIAS (show_ip_bgp_instance_neighbors,
8484 show_bgp_instance_ipv6_neighbors_cmd,
8485 "show bgp view WORD ipv6 neighbors",
8486 SHOW_STR
8487 BGP_STR
8488 "BGP view\n"
8489 "View name\n"
8490 "Address family\n"
8491 "Detailed information on TCP and BGP neighbor connections\n")
8492
paul718e3742002-12-13 20:15:29 +00008493DEFUN (show_ip_bgp_instance_neighbors_peer,
8494 show_ip_bgp_instance_neighbors_peer_cmd,
8495 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8496 SHOW_STR
8497 IP_STR
8498 BGP_STR
8499 "BGP view\n"
8500 "View name\n"
8501 "Detailed information on TCP and BGP neighbor connections\n"
8502 "Neighbor to display information about\n"
8503 "Neighbor to display information about\n")
8504{
8505 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8506}
paulbb46e942003-10-24 19:02:03 +00008507
8508ALIAS (show_ip_bgp_instance_neighbors_peer,
8509 show_bgp_instance_neighbors_peer_cmd,
8510 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8511 SHOW_STR
8512 BGP_STR
8513 "BGP view\n"
8514 "View name\n"
8515 "Detailed information on TCP and BGP neighbor connections\n"
8516 "Neighbor to display information about\n"
8517 "Neighbor to display information about\n")
8518
8519ALIAS (show_ip_bgp_instance_neighbors_peer,
8520 show_bgp_instance_ipv6_neighbors_peer_cmd,
8521 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8522 SHOW_STR
8523 BGP_STR
8524 "BGP view\n"
8525 "View name\n"
8526 "Address family\n"
8527 "Detailed information on TCP and BGP neighbor connections\n"
8528 "Neighbor to display information about\n"
8529 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008530
paul718e3742002-12-13 20:15:29 +00008531/* Show BGP's AS paths internal data. There are both `show ip bgp
8532 paths' and `show ip mbgp paths'. Those functions results are the
8533 same.*/
8534DEFUN (show_ip_bgp_paths,
8535 show_ip_bgp_paths_cmd,
8536 "show ip bgp paths",
8537 SHOW_STR
8538 IP_STR
8539 BGP_STR
8540 "Path information\n")
8541{
8542 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8543 aspath_print_all_vty (vty);
8544 return CMD_SUCCESS;
8545}
8546
8547DEFUN (show_ip_bgp_ipv4_paths,
8548 show_ip_bgp_ipv4_paths_cmd,
8549 "show ip bgp ipv4 (unicast|multicast) paths",
8550 SHOW_STR
8551 IP_STR
8552 BGP_STR
8553 "Address family\n"
8554 "Address Family modifier\n"
8555 "Address Family modifier\n"
8556 "Path information\n")
8557{
8558 vty_out (vty, "Address Refcnt Path\r\n");
8559 aspath_print_all_vty (vty);
8560
8561 return CMD_SUCCESS;
8562}
David Lamparter6b0655a2014-06-04 06:53:35 +02008563
paul718e3742002-12-13 20:15:29 +00008564#include "hash.h"
8565
paul94f2b392005-06-28 12:44:16 +00008566static void
paul718e3742002-12-13 20:15:29 +00008567community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8568{
8569 struct community *com;
8570
8571 com = (struct community *) backet->data;
David Lampartereed3c482015-03-03 08:51:53 +01008572 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
paul718e3742002-12-13 20:15:29 +00008573 community_str (com), VTY_NEWLINE);
8574}
8575
8576/* Show BGP's community internal data. */
8577DEFUN (show_ip_bgp_community_info,
8578 show_ip_bgp_community_info_cmd,
8579 "show ip bgp community-info",
8580 SHOW_STR
8581 IP_STR
8582 BGP_STR
8583 "List all bgp community information\n")
8584{
8585 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8586
8587 hash_iterate (community_hash (),
8588 (void (*) (struct hash_backet *, void *))
8589 community_show_all_iterator,
8590 vty);
8591
8592 return CMD_SUCCESS;
8593}
8594
8595DEFUN (show_ip_bgp_attr_info,
8596 show_ip_bgp_attr_info_cmd,
8597 "show ip bgp attribute-info",
8598 SHOW_STR
8599 IP_STR
8600 BGP_STR
8601 "List all bgp attribute information\n")
8602{
8603 attr_show_all (vty);
8604 return CMD_SUCCESS;
8605}
David Lamparter6b0655a2014-06-04 06:53:35 +02008606
paul94f2b392005-06-28 12:44:16 +00008607static int
paulfee0f4c2004-09-13 05:12:46 +00008608bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8609 afi_t afi, safi_t safi)
8610{
8611 char timebuf[BGP_UPTIME_LEN];
8612 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008613 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008614 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008615 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008616 int len;
8617 int count = 0;
8618
8619 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8620 {
paul1eb8ef22005-04-07 07:30:20 +00008621 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008622 {
8623 count++;
8624 bgp_write_rsclient_summary (vty, peer, afi, safi);
8625 }
8626 return count;
8627 }
8628
8629 len = vty_out (vty, "%s", rsclient->host);
8630 len = 16 - len;
8631
8632 if (len < 1)
8633 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8634 else
8635 vty_out (vty, "%*s", len, " ");
8636
hasso3d515fd2005-02-01 21:30:04 +00008637 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008638
Milan Kociancb4fc592014-12-01 12:48:25 +00008639 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008640
8641 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8642 if ( rmname && strlen (rmname) > 13 )
8643 {
8644 sprintf (rmbuf, "%13s", "...");
8645 rmname = strncpy (rmbuf, rmname, 10);
8646 }
8647 else if (! rmname)
8648 rmname = "<none>";
8649 vty_out (vty, " %13s ", rmname);
8650
8651 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8652 if ( rmname && strlen (rmname) > 13 )
8653 {
8654 sprintf (rmbuf, "%13s", "...");
8655 rmname = strncpy (rmbuf, rmname, 10);
8656 }
8657 else if (! rmname)
8658 rmname = "<none>";
8659 vty_out (vty, " %13s ", rmname);
8660
8661 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8662
8663 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8664 vty_out (vty, " Idle (Admin)");
8665 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8666 vty_out (vty, " Idle (PfxCt)");
8667 else
8668 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8669
8670 vty_out (vty, "%s", VTY_NEWLINE);
8671
8672 return 1;
8673}
8674
paul94f2b392005-06-28 12:44:16 +00008675static int
paulfd79ac92004-10-13 05:06:08 +00008676bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8677 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008678{
8679 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008680 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008681 int count = 0;
8682
8683 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00008684 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00008685
paul1eb8ef22005-04-07 07:30:20 +00008686 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008687 {
8688 if (peer->afc[afi][safi] &&
8689 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8690 {
8691 if (! count)
8692 {
8693 vty_out (vty,
8694 "Route Server's BGP router identifier %s%s",
8695 inet_ntoa (bgp->router_id), VTY_NEWLINE);
8696 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008697 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00008698 VTY_NEWLINE);
8699
8700 vty_out (vty, "%s", VTY_NEWLINE);
8701 vty_out (vty, "%s%s", header, VTY_NEWLINE);
8702 }
8703
8704 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
8705 }
8706 }
8707
8708 if (count)
8709 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
8710 count, VTY_NEWLINE);
8711 else
8712 vty_out (vty, "No %s Route Server Client is configured%s",
8713 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
8714
8715 return CMD_SUCCESS;
8716}
8717
paul94f2b392005-06-28 12:44:16 +00008718static int
paulfd79ac92004-10-13 05:06:08 +00008719bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
8720 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008721{
8722 struct bgp *bgp;
8723
8724 if (name)
8725 {
8726 bgp = bgp_lookup_by_name (name);
8727
8728 if (! bgp)
8729 {
8730 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8731 return CMD_WARNING;
8732 }
8733
8734 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8735 return CMD_SUCCESS;
8736 }
8737
8738 bgp = bgp_get_default ();
8739
8740 if (bgp)
8741 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8742
8743 return CMD_SUCCESS;
8744}
8745
8746/* 'show bgp rsclient' commands. */
8747DEFUN (show_ip_bgp_rsclient_summary,
8748 show_ip_bgp_rsclient_summary_cmd,
8749 "show ip bgp rsclient summary",
8750 SHOW_STR
8751 IP_STR
8752 BGP_STR
8753 "Information about Route Server Clients\n"
8754 "Summary of all Route Server Clients\n")
8755{
8756 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8757}
8758
8759DEFUN (show_ip_bgp_instance_rsclient_summary,
8760 show_ip_bgp_instance_rsclient_summary_cmd,
8761 "show ip bgp view WORD rsclient summary",
8762 SHOW_STR
8763 IP_STR
8764 BGP_STR
8765 "BGP view\n"
8766 "View name\n"
8767 "Information about Route Server Clients\n"
8768 "Summary of all Route Server Clients\n")
8769{
8770 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8771}
8772
8773DEFUN (show_ip_bgp_ipv4_rsclient_summary,
8774 show_ip_bgp_ipv4_rsclient_summary_cmd,
8775 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
8776 SHOW_STR
8777 IP_STR
8778 BGP_STR
8779 "Address family\n"
8780 "Address Family modifier\n"
8781 "Address Family modifier\n"
8782 "Information about Route Server Clients\n"
8783 "Summary of all Route Server Clients\n")
8784{
8785 if (strncmp (argv[0], "m", 1) == 0)
8786 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
8787
8788 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8789}
8790
8791DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
8792 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
8793 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8794 SHOW_STR
8795 IP_STR
8796 BGP_STR
8797 "BGP view\n"
8798 "View name\n"
8799 "Address family\n"
8800 "Address Family modifier\n"
8801 "Address Family modifier\n"
8802 "Information about Route Server Clients\n"
8803 "Summary of all Route Server Clients\n")
8804{
8805 if (strncmp (argv[1], "m", 1) == 0)
8806 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
8807
8808 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8809}
8810
Michael Lambert95cbbd22010-07-23 14:43:04 -04008811DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
8812 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
8813 "show bgp view WORD ipv4 (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_IP, 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_IP, safi);
8832 }
8833}
8834
8835ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
8836 show_bgp_ipv4_safi_rsclient_summary_cmd,
8837 "show bgp ipv4 (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#ifdef HAVE_IPV6
8847DEFUN (show_bgp_rsclient_summary,
8848 show_bgp_rsclient_summary_cmd,
8849 "show bgp rsclient summary",
8850 SHOW_STR
8851 BGP_STR
8852 "Information about Route Server Clients\n"
8853 "Summary of all Route Server Clients\n")
8854{
8855 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8856}
8857
8858DEFUN (show_bgp_instance_rsclient_summary,
8859 show_bgp_instance_rsclient_summary_cmd,
8860 "show bgp view WORD rsclient summary",
8861 SHOW_STR
8862 BGP_STR
8863 "BGP view\n"
8864 "View name\n"
8865 "Information about Route Server Clients\n"
8866 "Summary of all Route Server Clients\n")
8867{
8868 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
8869}
8870
8871ALIAS (show_bgp_rsclient_summary,
8872 show_bgp_ipv6_rsclient_summary_cmd,
8873 "show bgp ipv6 rsclient summary",
8874 SHOW_STR
8875 BGP_STR
8876 "Address family\n"
8877 "Information about Route Server Clients\n"
8878 "Summary of all Route Server Clients\n")
8879
8880ALIAS (show_bgp_instance_rsclient_summary,
8881 show_bgp_instance_ipv6_rsclient_summary_cmd,
8882 "show bgp view WORD ipv6 rsclient summary",
8883 SHOW_STR
8884 BGP_STR
8885 "BGP view\n"
8886 "View name\n"
8887 "Address family\n"
8888 "Information about Route Server Clients\n"
8889 "Summary of all Route Server Clients\n")
Michael Lambert95cbbd22010-07-23 14:43:04 -04008890
8891DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
8892 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
8893 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
8894 SHOW_STR
8895 BGP_STR
8896 "BGP view\n"
8897 "View name\n"
8898 "Address family\n"
8899 "Address Family modifier\n"
8900 "Address Family modifier\n"
8901 "Information about Route Server Clients\n"
8902 "Summary of all Route Server Clients\n")
8903{
8904 safi_t safi;
8905
8906 if (argc == 2) {
8907 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8908 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
8909 } else {
8910 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8911 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
8912 }
8913}
8914
8915ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
8916 show_bgp_ipv6_safi_rsclient_summary_cmd,
8917 "show bgp ipv6 (unicast|multicast) rsclient summary",
8918 SHOW_STR
8919 BGP_STR
8920 "Address family\n"
8921 "Address Family modifier\n"
8922 "Address Family modifier\n"
8923 "Information about Route Server Clients\n"
8924 "Summary of all Route Server Clients\n")
8925
paulfee0f4c2004-09-13 05:12:46 +00008926#endif /* HAVE IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02008927
paul718e3742002-12-13 20:15:29 +00008928/* Redistribute VTY commands. */
8929
paul718e3742002-12-13 20:15:29 +00008930DEFUN (bgp_redistribute_ipv4,
8931 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008932 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008933 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008934 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008935{
8936 int type;
8937
David Lampartere0ca5fd2009-09-16 01:52:42 +02008938 type = proto_redistnum (AFI_IP, argv[0]);
8939 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008940 {
8941 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8942 return CMD_WARNING;
8943 }
8944 return bgp_redistribute_set (vty->index, AFI_IP, type);
8945}
8946
8947DEFUN (bgp_redistribute_ipv4_rmap,
8948 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008949 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008950 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008951 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008952 "Route map reference\n"
8953 "Pointer to route-map entries\n")
8954{
8955 int type;
8956
David Lampartere0ca5fd2009-09-16 01:52:42 +02008957 type = proto_redistnum (AFI_IP, argv[0]);
8958 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008959 {
8960 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8961 return CMD_WARNING;
8962 }
8963
8964 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8965 return bgp_redistribute_set (vty->index, AFI_IP, type);
8966}
8967
8968DEFUN (bgp_redistribute_ipv4_metric,
8969 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008970 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008971 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008972 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008973 "Metric for redistributed routes\n"
8974 "Default metric\n")
8975{
8976 int type;
8977 u_int32_t metric;
8978
David Lampartere0ca5fd2009-09-16 01:52:42 +02008979 type = proto_redistnum (AFI_IP, argv[0]);
8980 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008981 {
8982 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8983 return CMD_WARNING;
8984 }
8985 VTY_GET_INTEGER ("metric", metric, argv[1]);
8986
8987 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8988 return bgp_redistribute_set (vty->index, AFI_IP, type);
8989}
8990
8991DEFUN (bgp_redistribute_ipv4_rmap_metric,
8992 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008993 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008994 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008995 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008996 "Route map reference\n"
8997 "Pointer to route-map entries\n"
8998 "Metric for redistributed routes\n"
8999 "Default metric\n")
9000{
9001 int type;
9002 u_int32_t metric;
9003
David Lampartere0ca5fd2009-09-16 01:52:42 +02009004 type = proto_redistnum (AFI_IP, argv[0]);
9005 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009006 {
9007 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9008 return CMD_WARNING;
9009 }
9010 VTY_GET_INTEGER ("metric", metric, argv[2]);
9011
9012 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9013 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9014 return bgp_redistribute_set (vty->index, AFI_IP, type);
9015}
9016
9017DEFUN (bgp_redistribute_ipv4_metric_rmap,
9018 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009019 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009020 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009021 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009022 "Metric for redistributed routes\n"
9023 "Default metric\n"
9024 "Route map reference\n"
9025 "Pointer to route-map entries\n")
9026{
9027 int type;
9028 u_int32_t metric;
9029
David Lampartere0ca5fd2009-09-16 01:52:42 +02009030 type = proto_redistnum (AFI_IP, argv[0]);
9031 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009032 {
9033 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9034 return CMD_WARNING;
9035 }
9036 VTY_GET_INTEGER ("metric", metric, argv[1]);
9037
9038 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9039 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
9040 return bgp_redistribute_set (vty->index, AFI_IP, type);
9041}
9042
9043DEFUN (no_bgp_redistribute_ipv4,
9044 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009045 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009046 NO_STR
9047 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009048 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009049{
9050 int type;
9051
David Lampartere0ca5fd2009-09-16 01:52:42 +02009052 type = proto_redistnum (AFI_IP, argv[0]);
9053 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009054 {
9055 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9056 return CMD_WARNING;
9057 }
9058
9059 return bgp_redistribute_unset (vty->index, AFI_IP, type);
9060}
9061
9062DEFUN (no_bgp_redistribute_ipv4_rmap,
9063 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009064 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009065 NO_STR
9066 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009067 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009068 "Route map reference\n"
9069 "Pointer to route-map entries\n")
9070{
9071 int type;
9072
David Lampartere0ca5fd2009-09-16 01:52:42 +02009073 type = proto_redistnum (AFI_IP, argv[0]);
9074 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009075 {
9076 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9077 return CMD_WARNING;
9078 }
9079
9080 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9081 return CMD_SUCCESS;
9082}
9083
9084DEFUN (no_bgp_redistribute_ipv4_metric,
9085 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009086 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009087 NO_STR
9088 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009089 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009090 "Metric for redistributed routes\n"
9091 "Default metric\n")
9092{
9093 int type;
9094
David Lampartere0ca5fd2009-09-16 01:52:42 +02009095 type = proto_redistnum (AFI_IP, argv[0]);
9096 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009097 {
9098 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9099 return CMD_WARNING;
9100 }
9101
9102 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9103 return CMD_SUCCESS;
9104}
9105
9106DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
9107 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009108 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009109 NO_STR
9110 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009111 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009112 "Route map reference\n"
9113 "Pointer to route-map entries\n"
9114 "Metric for redistributed routes\n"
9115 "Default metric\n")
9116{
9117 int type;
9118
David Lampartere0ca5fd2009-09-16 01:52:42 +02009119 type = proto_redistnum (AFI_IP, argv[0]);
9120 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009121 {
9122 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9123 return CMD_WARNING;
9124 }
9125
9126 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9127 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9128 return CMD_SUCCESS;
9129}
9130
9131ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
9132 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009133 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009134 NO_STR
9135 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009136 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009137 "Metric for redistributed routes\n"
9138 "Default metric\n"
9139 "Route map reference\n"
9140 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009141
paul718e3742002-12-13 20:15:29 +00009142#ifdef HAVE_IPV6
9143DEFUN (bgp_redistribute_ipv6,
9144 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009145 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009146 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009147 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009148{
9149 int type;
9150
David Lampartere0ca5fd2009-09-16 01:52:42 +02009151 type = proto_redistnum (AFI_IP6, argv[0]);
9152 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009153 {
9154 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9155 return CMD_WARNING;
9156 }
9157
9158 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9159}
9160
9161DEFUN (bgp_redistribute_ipv6_rmap,
9162 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009163 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009164 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009165 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009166 "Route map reference\n"
9167 "Pointer to route-map entries\n")
9168{
9169 int type;
9170
David Lampartere0ca5fd2009-09-16 01:52:42 +02009171 type = proto_redistnum (AFI_IP6, argv[0]);
9172 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009173 {
9174 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9175 return CMD_WARNING;
9176 }
9177
9178 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9179 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9180}
9181
9182DEFUN (bgp_redistribute_ipv6_metric,
9183 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009184 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009185 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009186 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009187 "Metric for redistributed routes\n"
9188 "Default metric\n")
9189{
9190 int type;
9191 u_int32_t metric;
9192
David Lampartere0ca5fd2009-09-16 01:52:42 +02009193 type = proto_redistnum (AFI_IP6, argv[0]);
9194 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009195 {
9196 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9197 return CMD_WARNING;
9198 }
9199 VTY_GET_INTEGER ("metric", metric, argv[1]);
9200
9201 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9202 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9203}
9204
9205DEFUN (bgp_redistribute_ipv6_rmap_metric,
9206 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009207 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009208 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009209 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009210 "Route map reference\n"
9211 "Pointer to route-map entries\n"
9212 "Metric for redistributed routes\n"
9213 "Default metric\n")
9214{
9215 int type;
9216 u_int32_t metric;
9217
David Lampartere0ca5fd2009-09-16 01:52:42 +02009218 type = proto_redistnum (AFI_IP6, argv[0]);
9219 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009220 {
9221 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9222 return CMD_WARNING;
9223 }
9224 VTY_GET_INTEGER ("metric", metric, argv[2]);
9225
9226 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9227 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9228 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9229}
9230
9231DEFUN (bgp_redistribute_ipv6_metric_rmap,
9232 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009233 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009234 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009235 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009236 "Metric for redistributed routes\n"
9237 "Default metric\n"
9238 "Route map reference\n"
9239 "Pointer to route-map entries\n")
9240{
9241 int type;
9242 u_int32_t metric;
9243
David Lampartere0ca5fd2009-09-16 01:52:42 +02009244 type = proto_redistnum (AFI_IP6, argv[0]);
9245 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009246 {
9247 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9248 return CMD_WARNING;
9249 }
9250 VTY_GET_INTEGER ("metric", metric, argv[1]);
9251
9252 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9253 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
9254 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9255}
9256
9257DEFUN (no_bgp_redistribute_ipv6,
9258 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009259 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009260 NO_STR
9261 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009262 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009263{
9264 int type;
9265
David Lampartere0ca5fd2009-09-16 01:52:42 +02009266 type = proto_redistnum (AFI_IP6, argv[0]);
9267 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009268 {
9269 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9270 return CMD_WARNING;
9271 }
9272
9273 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
9274}
9275
9276DEFUN (no_bgp_redistribute_ipv6_rmap,
9277 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009278 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009279 NO_STR
9280 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009281 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009282 "Route map reference\n"
9283 "Pointer to route-map entries\n")
9284{
9285 int type;
9286
David Lampartere0ca5fd2009-09-16 01:52:42 +02009287 type = proto_redistnum (AFI_IP6, argv[0]);
9288 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009289 {
9290 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9291 return CMD_WARNING;
9292 }
9293
9294 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9295 return CMD_SUCCESS;
9296}
9297
9298DEFUN (no_bgp_redistribute_ipv6_metric,
9299 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009300 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009301 NO_STR
9302 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009303 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009304 "Metric for redistributed routes\n"
9305 "Default metric\n")
9306{
9307 int type;
9308
David Lampartere0ca5fd2009-09-16 01:52:42 +02009309 type = proto_redistnum (AFI_IP6, argv[0]);
9310 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009311 {
9312 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9313 return CMD_WARNING;
9314 }
9315
9316 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9317 return CMD_SUCCESS;
9318}
9319
9320DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
9321 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009322 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009323 NO_STR
9324 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009325 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009326 "Route map reference\n"
9327 "Pointer to route-map entries\n"
9328 "Metric for redistributed routes\n"
9329 "Default metric\n")
9330{
9331 int type;
9332
David Lampartere0ca5fd2009-09-16 01:52:42 +02009333 type = proto_redistnum (AFI_IP6, argv[0]);
9334 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009335 {
9336 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9337 return CMD_WARNING;
9338 }
9339
9340 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9341 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9342 return CMD_SUCCESS;
9343}
9344
9345ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9346 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009347 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009348 NO_STR
9349 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009350 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009351 "Metric for redistributed routes\n"
9352 "Default metric\n"
9353 "Route map reference\n"
9354 "Pointer to route-map entries\n")
9355#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02009356
paul718e3742002-12-13 20:15:29 +00009357int
9358bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9359 safi_t safi, int *write)
9360{
9361 int i;
paul718e3742002-12-13 20:15:29 +00009362
9363 /* Unicast redistribution only. */
9364 if (safi != SAFI_UNICAST)
9365 return 0;
9366
9367 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9368 {
9369 /* Redistribute BGP does not make sense. */
9370 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9371 {
9372 /* Display "address-family" when it is not yet diplayed. */
9373 bgp_config_write_family_header (vty, afi, safi, write);
9374
9375 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009376 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009377
9378 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009379 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009380
9381 if (bgp->rmap[afi][i].name)
9382 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9383
9384 vty_out (vty, "%s", VTY_NEWLINE);
9385 }
9386 }
9387 return *write;
9388}
David Lamparter6b0655a2014-06-04 06:53:35 +02009389
paul718e3742002-12-13 20:15:29 +00009390/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009391static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009392{
9393 BGP_NODE,
9394 "%s(config-router)# ",
9395 1,
9396};
9397
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009398static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009399{
9400 BGP_IPV4_NODE,
9401 "%s(config-router-af)# ",
9402 1,
9403};
9404
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009405static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009406{
9407 BGP_IPV4M_NODE,
9408 "%s(config-router-af)# ",
9409 1,
9410};
9411
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009412static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009413{
9414 BGP_IPV6_NODE,
9415 "%s(config-router-af)# ",
9416 1,
9417};
9418
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009419static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009420{
9421 BGP_IPV6M_NODE,
9422 "%s(config-router-af)# ",
9423 1,
9424};
9425
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009426static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009427{
9428 BGP_VPNV4_NODE,
9429 "%s(config-router-af)# ",
9430 1
9431};
David Lamparter6b0655a2014-06-04 06:53:35 +02009432
Lou Berger13c378d2016-01-12 13:41:56 -05009433static struct cmd_node bgp_vpnv6_node =
9434{
9435 BGP_VPNV6_NODE,
9436 "%s(config-router-af-vpnv6)# ",
9437 1
9438};
9439
Lou Bergera3fda882016-01-12 13:42:04 -05009440static struct cmd_node bgp_encap_node =
9441{
9442 BGP_ENCAP_NODE,
9443 "%s(config-router-af-encap)# ",
9444 1
9445};
9446
9447static struct cmd_node bgp_encapv6_node =
9448{
9449 BGP_ENCAPV6_NODE,
9450 "%s(config-router-af-encapv6)# ",
9451 1
9452};
9453
paul1f8ae702005-09-09 23:49:49 +00009454static void community_list_vty (void);
9455
paul718e3742002-12-13 20:15:29 +00009456void
paul94f2b392005-06-28 12:44:16 +00009457bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009458{
paul718e3742002-12-13 20:15:29 +00009459 /* Install bgp top node. */
9460 install_node (&bgp_node, bgp_config_write);
9461 install_node (&bgp_ipv4_unicast_node, NULL);
9462 install_node (&bgp_ipv4_multicast_node, NULL);
9463 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009464 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009465 install_node (&bgp_vpnv4_node, NULL);
Lou Berger13c378d2016-01-12 13:41:56 -05009466 install_node (&bgp_vpnv6_node, NULL);
Lou Bergera3fda882016-01-12 13:42:04 -05009467 install_node (&bgp_encap_node, NULL);
9468 install_node (&bgp_encapv6_node, NULL);
paul718e3742002-12-13 20:15:29 +00009469
9470 /* Install default VTY commands to new nodes. */
9471 install_default (BGP_NODE);
9472 install_default (BGP_IPV4_NODE);
9473 install_default (BGP_IPV4M_NODE);
9474 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009475 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009476 install_default (BGP_VPNV4_NODE);
Lou Berger13c378d2016-01-12 13:41:56 -05009477 install_default (BGP_VPNV6_NODE);
Lou Bergera3fda882016-01-12 13:42:04 -05009478 install_default (BGP_ENCAP_NODE);
9479 install_default (BGP_ENCAPV6_NODE);
paul718e3742002-12-13 20:15:29 +00009480
9481 /* "bgp multiple-instance" commands. */
9482 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9483 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9484
9485 /* "bgp config-type" commands. */
9486 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9487 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9488
9489 /* Dummy commands (Currently not supported) */
9490 install_element (BGP_NODE, &no_synchronization_cmd);
9491 install_element (BGP_NODE, &no_auto_summary_cmd);
9492
9493 /* "router bgp" commands. */
9494 install_element (CONFIG_NODE, &router_bgp_cmd);
9495 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9496
9497 /* "no router bgp" commands. */
9498 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9499 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9500
9501 /* "bgp router-id" commands. */
9502 install_element (BGP_NODE, &bgp_router_id_cmd);
9503 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9504 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9505
9506 /* "bgp cluster-id" commands. */
9507 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9508 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9509 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9510 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9511
9512 /* "bgp confederation" commands. */
9513 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9514 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9515 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9516
9517 /* "bgp confederation peers" commands. */
9518 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9519 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9520
Josh Bailey165b5ff2011-07-20 20:43:22 -07009521 /* "maximum-paths" commands. */
9522 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9523 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9524 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9525 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9526 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9527 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
9528 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9529 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9530 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9531 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9532 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9533 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9534
paul718e3742002-12-13 20:15:29 +00009535 /* "timers bgp" commands. */
9536 install_element (BGP_NODE, &bgp_timers_cmd);
9537 install_element (BGP_NODE, &no_bgp_timers_cmd);
9538 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9539
9540 /* "bgp client-to-client reflection" commands */
9541 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9542 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9543
9544 /* "bgp always-compare-med" commands */
9545 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9546 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9547
9548 /* "bgp deterministic-med" commands */
9549 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9550 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009551
hasso538621f2004-05-21 09:31:30 +00009552 /* "bgp graceful-restart" commands */
9553 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9554 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009555 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9556 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9557 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009558
9559 /* "bgp fast-external-failover" commands */
9560 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9561 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9562
9563 /* "bgp enforce-first-as" commands */
9564 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9565 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9566
9567 /* "bgp bestpath compare-routerid" commands */
9568 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9569 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9570
9571 /* "bgp bestpath as-path ignore" commands */
9572 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9573 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9574
hasso68118452005-04-08 15:40:36 +00009575 /* "bgp bestpath as-path confed" commands */
9576 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9577 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9578
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00009579 /* "bgp bestpath as-path multipath-relax" commands */
9580 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9581 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9582
paul848973c2003-08-13 00:32:49 +00009583 /* "bgp log-neighbor-changes" commands */
9584 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9585 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9586
paul718e3742002-12-13 20:15:29 +00009587 /* "bgp bestpath med" commands */
9588 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9589 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9590 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9591 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9592 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9593 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9594
9595 /* "no bgp default ipv4-unicast" commands. */
9596 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9597 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9598
9599 /* "bgp network import-check" commands. */
9600 install_element (BGP_NODE, &bgp_network_import_check_cmd);
9601 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
9602
9603 /* "bgp default local-preference" commands. */
9604 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
9605 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
9606 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
9607
9608 /* "neighbor remote-as" commands. */
9609 install_element (BGP_NODE, &neighbor_remote_as_cmd);
9610 install_element (BGP_NODE, &no_neighbor_cmd);
9611 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
9612
9613 /* "neighbor peer-group" commands. */
9614 install_element (BGP_NODE, &neighbor_peer_group_cmd);
9615 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
9616 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
9617
9618 /* "neighbor local-as" commands. */
9619 install_element (BGP_NODE, &neighbor_local_as_cmd);
9620 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009621 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +00009622 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
9623 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
9624 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009625 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +00009626
Paul Jakma0df7c912008-07-21 21:02:49 +00009627 /* "neighbor password" commands. */
9628 install_element (BGP_NODE, &neighbor_password_cmd);
9629 install_element (BGP_NODE, &no_neighbor_password_cmd);
9630
paul718e3742002-12-13 20:15:29 +00009631 /* "neighbor activate" commands. */
9632 install_element (BGP_NODE, &neighbor_activate_cmd);
9633 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
9634 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
9635 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009636 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009637 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009638 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009639 install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd);
9640 install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009641
9642 /* "no neighbor activate" commands. */
9643 install_element (BGP_NODE, &no_neighbor_activate_cmd);
9644 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
9645 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
9646 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009647 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009648 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009649 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009650 install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd);
9651 install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009652
9653 /* "neighbor peer-group set" commands. */
9654 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
9655 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
9656 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
9657 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009658 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009659 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009660 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009661 install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd);
9662 install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009663
paul718e3742002-12-13 20:15:29 +00009664 /* "no neighbor peer-group unset" commands. */
9665 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
9666 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
9667 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
9668 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009669 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009670 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009671 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009672 install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd);
9673 install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009674
paul718e3742002-12-13 20:15:29 +00009675 /* "neighbor softreconfiguration inbound" commands.*/
9676 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
9677 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
9678 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
9679 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
9680 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
9681 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
9682 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
9683 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009684 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
9685 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +00009686 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
9687 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009688 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
9689 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009690 install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd);
9691 install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd);
9692 install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd);
9693 install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +00009694
9695 /* "neighbor attribute-unchanged" commands. */
9696 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
9697 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
9698 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
9699 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
9700 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
9701 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
9702 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
9703 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
9704 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
9705 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
9706 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
9707 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
9708 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
9709 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
9710 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
9711 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
9712 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
9713 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
9714 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
9715 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
9716 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
9717 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
9718 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
9719 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
9720 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
9721 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
9722 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
9723 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
9724 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
9725 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
9726 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
9727 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
9728 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
9729 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
9730 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9731 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9732 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9733 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9734 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9735 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9736 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9737 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9738 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9739 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9740 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
9741 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
9742 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
9743 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
9744 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
9745 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
9746 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
9747 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
9748 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
9749 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
9750 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
9751 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
9752 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
9753 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
9754 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
9755 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
9756 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
9757 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
9758 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
9759 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
9760 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
9761 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
9762 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
9763 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
9764 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
9765 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
9766 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
9767 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
9768 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
9769 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
9770 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
9771 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
9772 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
9773 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9774 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9775 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9776 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9777 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9778 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9779 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9780 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9781 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9782 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9783 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009784 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
9785 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
9786 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
9787 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
9788 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
9789 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
9790 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
9791 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
9792 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
9793 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
9794 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
9795 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
9796 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
9797 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
9798 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
9799 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
9800 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
9801 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
9802 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
9803 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
9804 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
9805 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +00009806 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
9807 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
9808 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
9809 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
9810 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
9811 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
9812 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
9813 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
9814 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
9815 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
9816 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
9817 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
9818 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9819 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9820 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9821 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9822 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9823 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9824 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9825 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9826 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9827 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9828
Lou Berger13c378d2016-01-12 13:41:56 -05009829 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
9830 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
9831 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
9832 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
9833 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
9834 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
9835 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
9836 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
9837 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
9838 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
9839 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
9840 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
9841 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9842 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9843 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9844 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9845 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9846 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9847 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9848 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9849 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9850 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
9851
Lou Bergera3fda882016-01-12 13:42:04 -05009852 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd);
9853 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd);
9854 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd);
9855 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd);
9856 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd);
9857 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd);
9858 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd);
9859 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd);
9860 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd);
9861 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd);
9862 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd);
9863 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd);
9864 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd);
9865 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd);
9866 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd);
9867 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd);
9868 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd);
9869 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd);
9870 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd);
9871 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd);
9872 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd);
9873 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd);
9874
9875 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd);
9876 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd);
9877 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd);
9878 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd);
9879 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd);
9880 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd);
9881 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd);
9882 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd);
9883 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd);
9884 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd);
9885 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd);
9886 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9887 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9888 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9889 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9890 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9891 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9892 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9893 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9894 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9895 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9896 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
9897
paulfee0f4c2004-09-13 05:12:46 +00009898 /* "nexthop-local unchanged" commands */
9899 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
9900 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
9901
paul718e3742002-12-13 20:15:29 +00009902 /* "transparent-as" and "transparent-nexthop" for old version
9903 compatibility. */
9904 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
9905 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
9906
9907 /* "neighbor next-hop-self" commands. */
9908 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
9909 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
9910 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
9911 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
9912 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
9913 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
9914 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
9915 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009916 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
9917 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009918 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
9919 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009920 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
9921 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009922 install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd);
9923 install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd);
9924 install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd);
9925 install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009926
9927 /* "neighbor remove-private-AS" commands. */
9928 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
9929 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
9930 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
9931 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
9932 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
9933 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
9934 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
9935 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009936 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
9937 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009938 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
9939 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009940 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
9941 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009942 install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd);
9943 install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd);
9944 install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd);
9945 install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009946
9947 /* "neighbor send-community" commands.*/
9948 install_element (BGP_NODE, &neighbor_send_community_cmd);
9949 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
9950 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
9951 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
9952 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
9953 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
9954 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
9955 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
9956 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
9957 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
9958 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
9959 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
9960 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
9961 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
9962 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
9963 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009964 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
9965 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
9966 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
9967 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00009968 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
9969 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
9970 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
9971 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009972 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
9973 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
9974 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
9975 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009976 install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd);
9977 install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd);
9978 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd);
9979 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd);
9980 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd);
9981 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd);
9982 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd);
9983 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00009984
9985 /* "neighbor route-reflector" commands.*/
9986 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
9987 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
9988 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
9989 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
9990 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
9991 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
9992 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
9993 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009994 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
9995 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +00009996 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
9997 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009998 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
9999 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010000 install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd);
10001 install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd);
10002 install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd);
10003 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010004
10005 /* "neighbor route-server" commands.*/
10006 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
10007 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
10008 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
10009 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
10010 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
10011 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
10012 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
10013 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010014 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
10015 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010016 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
10017 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010018 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
10019 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010020 install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd);
10021 install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd);
10022 install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd);
10023 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010024
10025 /* "neighbor passive" commands. */
10026 install_element (BGP_NODE, &neighbor_passive_cmd);
10027 install_element (BGP_NODE, &no_neighbor_passive_cmd);
10028
10029 /* "neighbor shutdown" commands. */
10030 install_element (BGP_NODE, &neighbor_shutdown_cmd);
10031 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
10032
hassoc9502432005-02-01 22:01:48 +000010033 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +000010034 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
10035 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
10036
10037 /* "neighbor capability orf prefix-list" commands.*/
10038 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
10039 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
10040 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
10041 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
10042 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
10043 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
10044 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
10045 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010046 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
10047 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +000010048
10049 /* "neighbor capability dynamic" commands.*/
10050 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
10051 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
10052
10053 /* "neighbor dont-capability-negotiate" commands. */
10054 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
10055 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
10056
10057 /* "neighbor ebgp-multihop" commands. */
10058 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
10059 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
10060 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
10061 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
10062
hasso6ffd2072005-02-02 14:50:11 +000010063 /* "neighbor disable-connected-check" commands. */
10064 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
10065 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +000010066 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
10067 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
10068
10069 /* "neighbor description" commands. */
10070 install_element (BGP_NODE, &neighbor_description_cmd);
10071 install_element (BGP_NODE, &no_neighbor_description_cmd);
10072 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
10073
10074 /* "neighbor update-source" commands. "*/
10075 install_element (BGP_NODE, &neighbor_update_source_cmd);
10076 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
10077
10078 /* "neighbor default-originate" commands. */
10079 install_element (BGP_NODE, &neighbor_default_originate_cmd);
10080 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
10081 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
10082 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
10083 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
10084 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
10085 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
10086 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
10087 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
10088 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
10089 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
10090 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
10091 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
10092 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
10093 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
10094 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010095 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
10096 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
10097 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
10098 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000010099
10100 /* "neighbor port" commands. */
10101 install_element (BGP_NODE, &neighbor_port_cmd);
10102 install_element (BGP_NODE, &no_neighbor_port_cmd);
10103 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
10104
10105 /* "neighbor weight" commands. */
10106 install_element (BGP_NODE, &neighbor_weight_cmd);
10107 install_element (BGP_NODE, &no_neighbor_weight_cmd);
10108 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
10109
10110 /* "neighbor override-capability" commands. */
10111 install_element (BGP_NODE, &neighbor_override_capability_cmd);
10112 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
10113
10114 /* "neighbor strict-capability-match" commands. */
10115 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
10116 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
10117
10118 /* "neighbor timers" commands. */
10119 install_element (BGP_NODE, &neighbor_timers_cmd);
10120 install_element (BGP_NODE, &no_neighbor_timers_cmd);
10121
10122 /* "neighbor timers connect" commands. */
10123 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
10124 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
10125 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
10126
10127 /* "neighbor advertisement-interval" commands. */
10128 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
10129 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
10130 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
10131
10132 /* "neighbor version" commands. */
10133 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +000010134
10135 /* "neighbor interface" commands. */
10136 install_element (BGP_NODE, &neighbor_interface_cmd);
10137 install_element (BGP_NODE, &no_neighbor_interface_cmd);
10138
10139 /* "neighbor distribute" commands. */
10140 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
10141 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
10142 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
10143 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
10144 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
10145 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
10146 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
10147 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010148 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
10149 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010150 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
10151 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010152 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
10153 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010154 install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd);
10155 install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd);
10156 install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd);
10157 install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010158
10159 /* "neighbor prefix-list" commands. */
10160 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
10161 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
10162 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
10163 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
10164 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
10165 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
10166 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
10167 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010168 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
10169 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010170 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
10171 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010172 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
10173 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010174 install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd);
10175 install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd);
10176 install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd);
10177 install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010178
10179 /* "neighbor filter-list" commands. */
10180 install_element (BGP_NODE, &neighbor_filter_list_cmd);
10181 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
10182 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
10183 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
10184 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
10185 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
10186 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
10187 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010188 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
10189 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010190 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
10191 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010192 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
10193 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010194 install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd);
10195 install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd);
10196 install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd);
10197 install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010198
10199 /* "neighbor route-map" commands. */
10200 install_element (BGP_NODE, &neighbor_route_map_cmd);
10201 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
10202 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
10203 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
10204 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
10205 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
10206 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
10207 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010208 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
10209 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010210 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
10211 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010212 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
10213 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010214 install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd);
10215 install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd);
10216 install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd);
10217 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010218
10219 /* "neighbor unsuppress-map" commands. */
10220 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
10221 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
10222 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
10223 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
10224 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
10225 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
10226 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
10227 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010228 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
10229 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +000010230 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010231 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010232 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010233 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010234 install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd);
10235 install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd);
10236 install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd);
10237 install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +000010238
10239 /* "neighbor maximum-prefix" commands. */
10240 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010241 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010242 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010243 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010244 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
10245 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010246 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
10247 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010248 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10249 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10250 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10251 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10252 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010253 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010254 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010255 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010256 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010257 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10258 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010259 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
10260 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010261 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10262 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10263 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10264 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10265 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010266 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010267 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010268 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010269 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010270 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
10271 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010272 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
10273 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010274 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10275 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10276 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10277 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10278 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010279 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010280 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010281 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010282 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010283 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10284 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010285 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10286 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010287 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10288 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10289 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10290 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10291 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010292 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
10293 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
10294 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
10295 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10296 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
10297 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10298 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
10299 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
10300 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10301 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10302 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10303 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10304 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010305 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010306 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010307 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010308 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010309 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10310 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010311 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
10312 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010313 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10314 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10315 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10316 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10317 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010318
Lou Berger13c378d2016-01-12 13:41:56 -050010319 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
10320 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10321 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10322 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10323 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10324 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10325 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
10326 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10327 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10328 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10329 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10330 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10331 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10332
Lou Bergera3fda882016-01-12 13:42:04 -050010333 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd);
10334 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd);
10335 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd);
10336 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10337 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd);
10338 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10339 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd);
10340 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd);
10341 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10342 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10343 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10344 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10345 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10346
10347 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd);
10348 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10349 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10350 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10351 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10352 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10353 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10354 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10355 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10356 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10357 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10358 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10359 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10360
paul718e3742002-12-13 20:15:29 +000010361 /* "neighbor allowas-in" */
10362 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
10363 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
10364 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
10365 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
10366 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
10367 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
10368 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
10369 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
10370 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
10371 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
10372 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
10373 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010374 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
10375 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
10376 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010377 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
10378 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
10379 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010380 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
10381 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
10382 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010383 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd);
10384 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd);
10385 install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd);
10386 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd);
10387 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd);
10388 install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010389
10390 /* address-family commands. */
10391 install_element (BGP_NODE, &address_family_ipv4_cmd);
10392 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
10393#ifdef HAVE_IPV6
10394 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010395 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010396#endif /* HAVE_IPV6 */
10397 install_element (BGP_NODE, &address_family_vpnv4_cmd);
10398 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
10399
Lou Berger13c378d2016-01-12 13:41:56 -050010400 install_element (BGP_NODE, &address_family_vpnv6_cmd);
10401 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
10402
Lou Bergera3fda882016-01-12 13:42:04 -050010403 install_element (BGP_NODE, &address_family_encap_cmd);
10404 install_element (BGP_NODE, &address_family_encapv4_cmd);
10405#ifdef HAVE_IPV6
10406 install_element (BGP_NODE, &address_family_encapv6_cmd);
10407#endif
10408
paul718e3742002-12-13 20:15:29 +000010409 /* "exit-address-family" command. */
10410 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
10411 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
10412 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010413 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010414 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010415 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010416 install_element (BGP_ENCAP_NODE, &exit_address_family_cmd);
10417 install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010418
10419 /* "clear ip bgp commands" */
10420 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
10421 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
10422 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
10423 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
10424 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
10425 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
10426#ifdef HAVE_IPV6
10427 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
10428 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
10429 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
10430 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
10431 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
10432 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
10433 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
10434 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
10435 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
10436 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
10437 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
10438#endif /* HAVE_IPV6 */
10439
10440 /* "clear ip bgp neighbor soft in" */
10441 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
10442 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
10443 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
10444 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
10445 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
10446 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
10447 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
10448 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
10449 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
10450 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
10451 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
10452 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
10453 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
10454 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
10455 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
10456 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
10457 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
10458 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
10459 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
10460 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
10461 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
10462 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
10463 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
10464 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
10465 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
10466 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
10467 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
10468 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
10469 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
10470 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
10471 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
10472 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
10473 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
10474 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
10475 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
10476 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
10477 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
10478 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
10479 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
10480 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010481 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
10482 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
10483 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
10484 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
10485 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
10486 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
paul718e3742002-12-13 20:15:29 +000010487#ifdef HAVE_IPV6
10488 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
10489 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
10490 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
10491 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
10492 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
10493 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
10494 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
10495 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
10496 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
10497 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
10498 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
10499 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
10500 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
10501 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
10502 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
10503 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
10504 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
10505 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
10506 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
10507 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
10508 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
10509 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
10510 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
10511 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
10512 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
10513 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
10514 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
10515 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
10516 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
10517 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
10518 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
10519#endif /* HAVE_IPV6 */
10520
10521 /* "clear ip bgp neighbor soft out" */
10522 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
10523 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
10524 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
10525 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
10526 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
10527 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
10528 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
10529 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
10530 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
10531 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
10532 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
10533 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
10534 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
10535 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
10536 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
10537 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
10538 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
10539 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
10540 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
10541 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
10542 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
10543 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
10544 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
10545 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
10546 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
10547 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
10548 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
10549 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010550 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
10551 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
10552 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
10553 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
10554 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
10555 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
paul718e3742002-12-13 20:15:29 +000010556#ifdef HAVE_IPV6
10557 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
10558 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
10559 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
10560 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
10561 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
10562 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
10563 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
10564 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
10565 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
10566 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
10567 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
10568 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
10569 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
10570 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
10571 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
10572 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
10573 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
10574 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
10575 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
10576 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
10577 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
10578#endif /* HAVE_IPV6 */
10579
10580 /* "clear ip bgp neighbor soft" */
10581 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
10582 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
10583 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
10584 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
10585 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
10586 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
10587 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
10588 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
10589 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
10590 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
10591 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
10592 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
10593 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
10594 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
10595 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010596 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
10597 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
10598 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
paul718e3742002-12-13 20:15:29 +000010599#ifdef HAVE_IPV6
10600 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
10601 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
10602 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
10603 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
10604 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
10605 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
10606 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
10607 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
10608 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
10609 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
10610 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
10611#endif /* HAVE_IPV6 */
10612
paulfee0f4c2004-09-13 05:12:46 +000010613 /* "clear ip bgp neighbor rsclient" */
10614 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
10615 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
10616 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
10617 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
10618#ifdef HAVE_IPV6
10619 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
10620 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
10621 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
10622 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
10623 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
10624 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
10625 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
10626 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
10627#endif /* HAVE_IPV6 */
10628
paul718e3742002-12-13 20:15:29 +000010629 /* "show ip bgp summary" commands. */
10630 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
10631 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
10632 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010633 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010634 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010635 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010636 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10637 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10638#ifdef HAVE_IPV6
10639 install_element (VIEW_NODE, &show_bgp_summary_cmd);
10640 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
10641 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010642 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010643 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010644 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010645#endif /* HAVE_IPV6 */
Paul Jakma62687ff2008-08-23 14:27:06 +010010646 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
10647 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
10648 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010649 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010650 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010651 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010652 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10653 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10654#ifdef HAVE_IPV6
10655 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
10656 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
10657 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010658 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010659 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010660 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010661#endif /* HAVE_IPV6 */
paul718e3742002-12-13 20:15:29 +000010662 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
10663 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
10664 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010665 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010666 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010667 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010668 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10669 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10670#ifdef HAVE_IPV6
10671 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
10672 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
10673 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010674 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010675 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010676 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010677#endif /* HAVE_IPV6 */
10678
10679 /* "show ip bgp neighbors" commands. */
10680 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
10681 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10682 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
10683 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10684 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10685 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10686 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10687 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10688 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
10689 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010690 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
10691 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10692 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10693 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10694 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010695 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
10696 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10697 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
10698 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10699 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10700 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10701 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10702 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10703 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
10704 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
10705
10706#ifdef HAVE_IPV6
10707 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
10708 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
10709 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
10710 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010711 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
10712 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10713 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
10714 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010715 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
10716 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
10717 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
10718 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010719 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
10720 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
10721 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
10722 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010723 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
10724 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10725 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
10726 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010727
10728 /* Old commands. */
10729 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
10730 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
10731 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
10732 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
10733#endif /* HAVE_IPV6 */
10734
paulfee0f4c2004-09-13 05:12:46 +000010735 /* "show ip bgp rsclient" commands. */
10736 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
10737 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10738 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10739 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010740 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10741 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010742 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
10743 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10744 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10745 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010746 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10747 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010748 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
10749 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10750 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10751 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010752 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10753 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010754
10755#ifdef HAVE_IPV6
10756 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
10757 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10758 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
10759 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010760 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10761 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010762 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
10763 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10764 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
10765 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010766 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10767 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010768 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
10769 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10770 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
10771 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010772 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10773 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010774#endif /* HAVE_IPV6 */
10775
paul718e3742002-12-13 20:15:29 +000010776 /* "show ip bgp paths" commands. */
10777 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
10778 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
10779 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
10780 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
10781
10782 /* "show ip bgp community" commands. */
10783 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
10784 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
10785
10786 /* "show ip bgp attribute-info" commands. */
10787 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
10788 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
10789
10790 /* "redistribute" commands. */
10791 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
10792 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
10793 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
10794 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
10795 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
10796 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
10797 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
10798 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
10799 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
10800 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
10801#ifdef HAVE_IPV6
10802 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
10803 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
10804 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
10805 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
10806 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
10807 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
10808 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
10809 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
10810 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
10811 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
10812#endif /* HAVE_IPV6 */
10813
Nick Hilliardfa411a22011-03-23 15:33:17 +000010814 /* ttl_security commands */
10815 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
10816 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
10817
Paul Jakma4bf6a362006-03-30 14:05:23 +000010818 /* "show bgp memory" commands. */
10819 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010820 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000010821 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
10822
Michael Lamberte0081f72008-11-16 20:12:04 +000010823 /* "show bgp views" commands. */
10824 install_element (VIEW_NODE, &show_bgp_views_cmd);
10825 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
10826 install_element (ENABLE_NODE, &show_bgp_views_cmd);
10827
paul718e3742002-12-13 20:15:29 +000010828 /* Community-list. */
10829 community_list_vty ();
10830}
David Lamparter6b0655a2014-06-04 06:53:35 +020010831
paul718e3742002-12-13 20:15:29 +000010832#include "memory.h"
10833#include "bgp_regex.h"
10834#include "bgp_clist.h"
10835#include "bgp_ecommunity.h"
10836
10837/* VTY functions. */
10838
10839/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000010840static const char *
paul718e3742002-12-13 20:15:29 +000010841community_direct_str (int direct)
10842{
10843 switch (direct)
10844 {
10845 case COMMUNITY_DENY:
10846 return "deny";
paul718e3742002-12-13 20:15:29 +000010847 case COMMUNITY_PERMIT:
10848 return "permit";
paul718e3742002-12-13 20:15:29 +000010849 default:
10850 return "unknown";
paul718e3742002-12-13 20:15:29 +000010851 }
10852}
10853
10854/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000010855static void
paul718e3742002-12-13 20:15:29 +000010856community_list_perror (struct vty *vty, int ret)
10857{
10858 switch (ret)
10859 {
10860 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030010861 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010862 break;
10863 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
10864 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
10865 break;
10866 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
10867 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
10868 break;
10869 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
10870 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
10871 break;
10872 }
10873}
10874
10875/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000010876static int
paulfd79ac92004-10-13 05:06:08 +000010877community_list_set_vty (struct vty *vty, int argc, const char **argv,
10878 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010879{
10880 int ret;
10881 int direct;
10882 char *str;
10883
10884 /* Check the list type. */
10885 if (strncmp (argv[1], "p", 1) == 0)
10886 direct = COMMUNITY_PERMIT;
10887 else if (strncmp (argv[1], "d", 1) == 0)
10888 direct = COMMUNITY_DENY;
10889 else
10890 {
10891 vty_out (vty, "%% Matching condition must be permit or deny%s",
10892 VTY_NEWLINE);
10893 return CMD_WARNING;
10894 }
10895
10896 /* All digit name check. */
10897 if (reject_all_digit_name && all_digit (argv[0]))
10898 {
10899 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10900 return CMD_WARNING;
10901 }
10902
10903 /* Concat community string argument. */
10904 if (argc > 1)
10905 str = argv_concat (argv, argc, 2);
10906 else
10907 str = NULL;
10908
10909 /* When community_list_set() return nevetive value, it means
10910 malformed community string. */
10911 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
10912
10913 /* Free temporary community list string allocated by
10914 argv_concat(). */
10915 if (str)
10916 XFREE (MTYPE_TMP, str);
10917
10918 if (ret < 0)
10919 {
10920 /* Display error string. */
10921 community_list_perror (vty, ret);
10922 return CMD_WARNING;
10923 }
10924
10925 return CMD_SUCCESS;
10926}
10927
paul718e3742002-12-13 20:15:29 +000010928/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000010929static int
hassofee6e4e2005-02-02 16:29:31 +000010930community_list_unset_vty (struct vty *vty, int argc, const char **argv,
10931 int style)
paul718e3742002-12-13 20:15:29 +000010932{
10933 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010934 int direct = 0;
10935 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010936
hassofee6e4e2005-02-02 16:29:31 +000010937 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010938 {
hassofee6e4e2005-02-02 16:29:31 +000010939 /* Check the list direct. */
10940 if (strncmp (argv[1], "p", 1) == 0)
10941 direct = COMMUNITY_PERMIT;
10942 else if (strncmp (argv[1], "d", 1) == 0)
10943 direct = COMMUNITY_DENY;
10944 else
10945 {
10946 vty_out (vty, "%% Matching condition must be permit or deny%s",
10947 VTY_NEWLINE);
10948 return CMD_WARNING;
10949 }
paul718e3742002-12-13 20:15:29 +000010950
hassofee6e4e2005-02-02 16:29:31 +000010951 /* Concat community string argument. */
10952 str = argv_concat (argv, argc, 2);
10953 }
paul718e3742002-12-13 20:15:29 +000010954
10955 /* Unset community list. */
10956 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
10957
10958 /* Free temporary community list string allocated by
10959 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010960 if (str)
10961 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010962
10963 if (ret < 0)
10964 {
10965 community_list_perror (vty, ret);
10966 return CMD_WARNING;
10967 }
10968
10969 return CMD_SUCCESS;
10970}
10971
10972/* "community-list" keyword help string. */
10973#define COMMUNITY_LIST_STR "Add a community list entry\n"
10974#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
10975
paul718e3742002-12-13 20:15:29 +000010976DEFUN (ip_community_list_standard,
10977 ip_community_list_standard_cmd,
10978 "ip community-list <1-99> (deny|permit) .AA:NN",
10979 IP_STR
10980 COMMUNITY_LIST_STR
10981 "Community list number (standard)\n"
10982 "Specify community to reject\n"
10983 "Specify community to accept\n"
10984 COMMUNITY_VAL_STR)
10985{
10986 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
10987}
10988
10989ALIAS (ip_community_list_standard,
10990 ip_community_list_standard2_cmd,
10991 "ip community-list <1-99> (deny|permit)",
10992 IP_STR
10993 COMMUNITY_LIST_STR
10994 "Community list number (standard)\n"
10995 "Specify community to reject\n"
10996 "Specify community to accept\n")
10997
10998DEFUN (ip_community_list_expanded,
10999 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011000 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011001 IP_STR
11002 COMMUNITY_LIST_STR
11003 "Community list number (expanded)\n"
11004 "Specify community to reject\n"
11005 "Specify community to accept\n"
11006 "An ordered list as a regular-expression\n")
11007{
11008 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
11009}
11010
11011DEFUN (ip_community_list_name_standard,
11012 ip_community_list_name_standard_cmd,
11013 "ip community-list standard WORD (deny|permit) .AA:NN",
11014 IP_STR
11015 COMMUNITY_LIST_STR
11016 "Add a standard community-list entry\n"
11017 "Community list name\n"
11018 "Specify community to reject\n"
11019 "Specify community to accept\n"
11020 COMMUNITY_VAL_STR)
11021{
11022 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
11023}
11024
11025ALIAS (ip_community_list_name_standard,
11026 ip_community_list_name_standard2_cmd,
11027 "ip community-list standard WORD (deny|permit)",
11028 IP_STR
11029 COMMUNITY_LIST_STR
11030 "Add a standard community-list entry\n"
11031 "Community list name\n"
11032 "Specify community to reject\n"
11033 "Specify community to accept\n")
11034
11035DEFUN (ip_community_list_name_expanded,
11036 ip_community_list_name_expanded_cmd,
11037 "ip community-list expanded WORD (deny|permit) .LINE",
11038 IP_STR
11039 COMMUNITY_LIST_STR
11040 "Add an expanded community-list entry\n"
11041 "Community list name\n"
11042 "Specify community to reject\n"
11043 "Specify community to accept\n"
11044 "An ordered list as a regular-expression\n")
11045{
11046 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
11047}
11048
hassofee6e4e2005-02-02 16:29:31 +000011049DEFUN (no_ip_community_list_standard_all,
11050 no_ip_community_list_standard_all_cmd,
11051 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011052 NO_STR
11053 IP_STR
11054 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011055 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011056{
hassofee6e4e2005-02-02 16:29:31 +000011057 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011058}
11059
hassofee6e4e2005-02-02 16:29:31 +000011060DEFUN (no_ip_community_list_expanded_all,
11061 no_ip_community_list_expanded_all_cmd,
11062 "no ip community-list <100-500>",
11063 NO_STR
11064 IP_STR
11065 COMMUNITY_LIST_STR
11066 "Community list number (expanded)\n")
11067{
11068 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11069}
11070
11071DEFUN (no_ip_community_list_name_standard_all,
11072 no_ip_community_list_name_standard_all_cmd,
11073 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011074 NO_STR
11075 IP_STR
11076 COMMUNITY_LIST_STR
11077 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000011078 "Community list name\n")
11079{
hassofee6e4e2005-02-02 16:29:31 +000011080 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011081}
11082
hassofee6e4e2005-02-02 16:29:31 +000011083DEFUN (no_ip_community_list_name_expanded_all,
11084 no_ip_community_list_name_expanded_all_cmd,
11085 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000011086 NO_STR
11087 IP_STR
11088 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011089 "Add an expanded community-list entry\n"
11090 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000011091{
hassofee6e4e2005-02-02 16:29:31 +000011092 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011093}
11094
11095DEFUN (no_ip_community_list_standard,
11096 no_ip_community_list_standard_cmd,
11097 "no ip community-list <1-99> (deny|permit) .AA:NN",
11098 NO_STR
11099 IP_STR
11100 COMMUNITY_LIST_STR
11101 "Community list number (standard)\n"
11102 "Specify community to reject\n"
11103 "Specify community to accept\n"
11104 COMMUNITY_VAL_STR)
11105{
11106 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11107}
11108
11109DEFUN (no_ip_community_list_expanded,
11110 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011111 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011112 NO_STR
11113 IP_STR
11114 COMMUNITY_LIST_STR
11115 "Community list number (expanded)\n"
11116 "Specify community to reject\n"
11117 "Specify community to accept\n"
11118 "An ordered list as a regular-expression\n")
11119{
11120 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11121}
11122
11123DEFUN (no_ip_community_list_name_standard,
11124 no_ip_community_list_name_standard_cmd,
11125 "no ip community-list standard WORD (deny|permit) .AA:NN",
11126 NO_STR
11127 IP_STR
11128 COMMUNITY_LIST_STR
11129 "Specify a standard community-list\n"
11130 "Community list name\n"
11131 "Specify community to reject\n"
11132 "Specify community to accept\n"
11133 COMMUNITY_VAL_STR)
11134{
11135 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11136}
11137
11138DEFUN (no_ip_community_list_name_expanded,
11139 no_ip_community_list_name_expanded_cmd,
11140 "no ip community-list expanded WORD (deny|permit) .LINE",
11141 NO_STR
11142 IP_STR
11143 COMMUNITY_LIST_STR
11144 "Specify an expanded community-list\n"
11145 "Community list name\n"
11146 "Specify community to reject\n"
11147 "Specify community to accept\n"
11148 "An ordered list as a regular-expression\n")
11149{
11150 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11151}
11152
paul94f2b392005-06-28 12:44:16 +000011153static void
paul718e3742002-12-13 20:15:29 +000011154community_list_show (struct vty *vty, struct community_list *list)
11155{
11156 struct community_entry *entry;
11157
11158 for (entry = list->head; entry; entry = entry->next)
11159 {
11160 if (entry == list->head)
11161 {
11162 if (all_digit (list->name))
11163 vty_out (vty, "Community %s list %s%s",
11164 entry->style == COMMUNITY_LIST_STANDARD ?
11165 "standard" : "(expanded) access",
11166 list->name, VTY_NEWLINE);
11167 else
11168 vty_out (vty, "Named Community %s list %s%s",
11169 entry->style == COMMUNITY_LIST_STANDARD ?
11170 "standard" : "expanded",
11171 list->name, VTY_NEWLINE);
11172 }
11173 if (entry->any)
11174 vty_out (vty, " %s%s",
11175 community_direct_str (entry->direct), VTY_NEWLINE);
11176 else
11177 vty_out (vty, " %s %s%s",
11178 community_direct_str (entry->direct),
11179 entry->style == COMMUNITY_LIST_STANDARD
11180 ? community_str (entry->u.com) : entry->config,
11181 VTY_NEWLINE);
11182 }
11183}
11184
11185DEFUN (show_ip_community_list,
11186 show_ip_community_list_cmd,
11187 "show ip community-list",
11188 SHOW_STR
11189 IP_STR
11190 "List community-list\n")
11191{
11192 struct community_list *list;
11193 struct community_list_master *cm;
11194
hassofee6e4e2005-02-02 16:29:31 +000011195 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011196 if (! cm)
11197 return CMD_SUCCESS;
11198
11199 for (list = cm->num.head; list; list = list->next)
11200 community_list_show (vty, list);
11201
11202 for (list = cm->str.head; list; list = list->next)
11203 community_list_show (vty, list);
11204
11205 return CMD_SUCCESS;
11206}
11207
11208DEFUN (show_ip_community_list_arg,
11209 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011210 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011211 SHOW_STR
11212 IP_STR
11213 "List community-list\n"
11214 "Community-list number\n"
11215 "Community-list name\n")
11216{
11217 struct community_list *list;
11218
hassofee6e4e2005-02-02 16:29:31 +000011219 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011220 if (! list)
11221 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011222 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011223 return CMD_WARNING;
11224 }
11225
11226 community_list_show (vty, list);
11227
11228 return CMD_SUCCESS;
11229}
David Lamparter6b0655a2014-06-04 06:53:35 +020011230
paul94f2b392005-06-28 12:44:16 +000011231static int
paulfd79ac92004-10-13 05:06:08 +000011232extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
11233 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011234{
11235 int ret;
11236 int direct;
11237 char *str;
11238
11239 /* Check the list type. */
11240 if (strncmp (argv[1], "p", 1) == 0)
11241 direct = COMMUNITY_PERMIT;
11242 else if (strncmp (argv[1], "d", 1) == 0)
11243 direct = COMMUNITY_DENY;
11244 else
11245 {
11246 vty_out (vty, "%% Matching condition must be permit or deny%s",
11247 VTY_NEWLINE);
11248 return CMD_WARNING;
11249 }
11250
11251 /* All digit name check. */
11252 if (reject_all_digit_name && all_digit (argv[0]))
11253 {
11254 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11255 return CMD_WARNING;
11256 }
11257
11258 /* Concat community string argument. */
11259 if (argc > 1)
11260 str = argv_concat (argv, argc, 2);
11261 else
11262 str = NULL;
11263
11264 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
11265
11266 /* Free temporary community list string allocated by
11267 argv_concat(). */
11268 if (str)
11269 XFREE (MTYPE_TMP, str);
11270
11271 if (ret < 0)
11272 {
11273 community_list_perror (vty, ret);
11274 return CMD_WARNING;
11275 }
11276 return CMD_SUCCESS;
11277}
11278
paul94f2b392005-06-28 12:44:16 +000011279static int
hassofee6e4e2005-02-02 16:29:31 +000011280extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
11281 int style)
paul718e3742002-12-13 20:15:29 +000011282{
11283 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011284 int direct = 0;
11285 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011286
hassofee6e4e2005-02-02 16:29:31 +000011287 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011288 {
hassofee6e4e2005-02-02 16:29:31 +000011289 /* Check the list direct. */
11290 if (strncmp (argv[1], "p", 1) == 0)
11291 direct = COMMUNITY_PERMIT;
11292 else if (strncmp (argv[1], "d", 1) == 0)
11293 direct = COMMUNITY_DENY;
11294 else
11295 {
11296 vty_out (vty, "%% Matching condition must be permit or deny%s",
11297 VTY_NEWLINE);
11298 return CMD_WARNING;
11299 }
11300
11301 /* Concat community string argument. */
11302 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000011303 }
paul718e3742002-12-13 20:15:29 +000011304
11305 /* Unset community list. */
11306 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
11307
11308 /* Free temporary community list string allocated by
11309 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011310 if (str)
11311 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011312
11313 if (ret < 0)
11314 {
11315 community_list_perror (vty, ret);
11316 return CMD_WARNING;
11317 }
11318
11319 return CMD_SUCCESS;
11320}
11321
11322/* "extcommunity-list" keyword help string. */
11323#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
11324#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
11325
11326DEFUN (ip_extcommunity_list_standard,
11327 ip_extcommunity_list_standard_cmd,
11328 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11329 IP_STR
11330 EXTCOMMUNITY_LIST_STR
11331 "Extended Community list number (standard)\n"
11332 "Specify community to reject\n"
11333 "Specify community to accept\n"
11334 EXTCOMMUNITY_VAL_STR)
11335{
11336 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
11337}
11338
11339ALIAS (ip_extcommunity_list_standard,
11340 ip_extcommunity_list_standard2_cmd,
11341 "ip extcommunity-list <1-99> (deny|permit)",
11342 IP_STR
11343 EXTCOMMUNITY_LIST_STR
11344 "Extended Community list number (standard)\n"
11345 "Specify community to reject\n"
11346 "Specify community to accept\n")
11347
11348DEFUN (ip_extcommunity_list_expanded,
11349 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011350 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011351 IP_STR
11352 EXTCOMMUNITY_LIST_STR
11353 "Extended Community list number (expanded)\n"
11354 "Specify community to reject\n"
11355 "Specify community to accept\n"
11356 "An ordered list as a regular-expression\n")
11357{
11358 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
11359}
11360
11361DEFUN (ip_extcommunity_list_name_standard,
11362 ip_extcommunity_list_name_standard_cmd,
11363 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11364 IP_STR
11365 EXTCOMMUNITY_LIST_STR
11366 "Specify standard extcommunity-list\n"
11367 "Extended Community list name\n"
11368 "Specify community to reject\n"
11369 "Specify community to accept\n"
11370 EXTCOMMUNITY_VAL_STR)
11371{
11372 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
11373}
11374
11375ALIAS (ip_extcommunity_list_name_standard,
11376 ip_extcommunity_list_name_standard2_cmd,
11377 "ip extcommunity-list standard WORD (deny|permit)",
11378 IP_STR
11379 EXTCOMMUNITY_LIST_STR
11380 "Specify standard extcommunity-list\n"
11381 "Extended Community list name\n"
11382 "Specify community to reject\n"
11383 "Specify community to accept\n")
11384
11385DEFUN (ip_extcommunity_list_name_expanded,
11386 ip_extcommunity_list_name_expanded_cmd,
11387 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
11388 IP_STR
11389 EXTCOMMUNITY_LIST_STR
11390 "Specify expanded extcommunity-list\n"
11391 "Extended Community list name\n"
11392 "Specify community to reject\n"
11393 "Specify community to accept\n"
11394 "An ordered list as a regular-expression\n")
11395{
11396 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
11397}
11398
hassofee6e4e2005-02-02 16:29:31 +000011399DEFUN (no_ip_extcommunity_list_standard_all,
11400 no_ip_extcommunity_list_standard_all_cmd,
11401 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011402 NO_STR
11403 IP_STR
11404 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011405 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011406{
hassofee6e4e2005-02-02 16:29:31 +000011407 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011408}
11409
hassofee6e4e2005-02-02 16:29:31 +000011410DEFUN (no_ip_extcommunity_list_expanded_all,
11411 no_ip_extcommunity_list_expanded_all_cmd,
11412 "no ip extcommunity-list <100-500>",
11413 NO_STR
11414 IP_STR
11415 EXTCOMMUNITY_LIST_STR
11416 "Extended Community list number (expanded)\n")
11417{
11418 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11419}
11420
11421DEFUN (no_ip_extcommunity_list_name_standard_all,
11422 no_ip_extcommunity_list_name_standard_all_cmd,
11423 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011424 NO_STR
11425 IP_STR
11426 EXTCOMMUNITY_LIST_STR
11427 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000011428 "Extended Community list name\n")
11429{
11430 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11431}
11432
11433DEFUN (no_ip_extcommunity_list_name_expanded_all,
11434 no_ip_extcommunity_list_name_expanded_all_cmd,
11435 "no ip extcommunity-list expanded WORD",
11436 NO_STR
11437 IP_STR
11438 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000011439 "Specify expanded extcommunity-list\n"
11440 "Extended Community list name\n")
11441{
hassofee6e4e2005-02-02 16:29:31 +000011442 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011443}
11444
11445DEFUN (no_ip_extcommunity_list_standard,
11446 no_ip_extcommunity_list_standard_cmd,
11447 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11448 NO_STR
11449 IP_STR
11450 EXTCOMMUNITY_LIST_STR
11451 "Extended Community list number (standard)\n"
11452 "Specify community to reject\n"
11453 "Specify community to accept\n"
11454 EXTCOMMUNITY_VAL_STR)
11455{
11456 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11457}
11458
11459DEFUN (no_ip_extcommunity_list_expanded,
11460 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011461 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011462 NO_STR
11463 IP_STR
11464 EXTCOMMUNITY_LIST_STR
11465 "Extended Community list number (expanded)\n"
11466 "Specify community to reject\n"
11467 "Specify community to accept\n"
11468 "An ordered list as a regular-expression\n")
11469{
11470 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11471}
11472
11473DEFUN (no_ip_extcommunity_list_name_standard,
11474 no_ip_extcommunity_list_name_standard_cmd,
11475 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11476 NO_STR
11477 IP_STR
11478 EXTCOMMUNITY_LIST_STR
11479 "Specify standard extcommunity-list\n"
11480 "Extended Community list name\n"
11481 "Specify community to reject\n"
11482 "Specify community to accept\n"
11483 EXTCOMMUNITY_VAL_STR)
11484{
11485 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11486}
11487
11488DEFUN (no_ip_extcommunity_list_name_expanded,
11489 no_ip_extcommunity_list_name_expanded_cmd,
11490 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
11491 NO_STR
11492 IP_STR
11493 EXTCOMMUNITY_LIST_STR
11494 "Specify expanded extcommunity-list\n"
11495 "Community list name\n"
11496 "Specify community to reject\n"
11497 "Specify community to accept\n"
11498 "An ordered list as a regular-expression\n")
11499{
11500 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11501}
11502
paul94f2b392005-06-28 12:44:16 +000011503static void
paul718e3742002-12-13 20:15:29 +000011504extcommunity_list_show (struct vty *vty, struct community_list *list)
11505{
11506 struct community_entry *entry;
11507
11508 for (entry = list->head; entry; entry = entry->next)
11509 {
11510 if (entry == list->head)
11511 {
11512 if (all_digit (list->name))
11513 vty_out (vty, "Extended community %s list %s%s",
11514 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11515 "standard" : "(expanded) access",
11516 list->name, VTY_NEWLINE);
11517 else
11518 vty_out (vty, "Named extended community %s list %s%s",
11519 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11520 "standard" : "expanded",
11521 list->name, VTY_NEWLINE);
11522 }
11523 if (entry->any)
11524 vty_out (vty, " %s%s",
11525 community_direct_str (entry->direct), VTY_NEWLINE);
11526 else
11527 vty_out (vty, " %s %s%s",
11528 community_direct_str (entry->direct),
11529 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11530 entry->u.ecom->str : entry->config,
11531 VTY_NEWLINE);
11532 }
11533}
11534
11535DEFUN (show_ip_extcommunity_list,
11536 show_ip_extcommunity_list_cmd,
11537 "show ip extcommunity-list",
11538 SHOW_STR
11539 IP_STR
11540 "List extended-community list\n")
11541{
11542 struct community_list *list;
11543 struct community_list_master *cm;
11544
hassofee6e4e2005-02-02 16:29:31 +000011545 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011546 if (! cm)
11547 return CMD_SUCCESS;
11548
11549 for (list = cm->num.head; list; list = list->next)
11550 extcommunity_list_show (vty, list);
11551
11552 for (list = cm->str.head; list; list = list->next)
11553 extcommunity_list_show (vty, list);
11554
11555 return CMD_SUCCESS;
11556}
11557
11558DEFUN (show_ip_extcommunity_list_arg,
11559 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011560 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011561 SHOW_STR
11562 IP_STR
11563 "List extended-community list\n"
11564 "Extcommunity-list number\n"
11565 "Extcommunity-list name\n")
11566{
11567 struct community_list *list;
11568
hassofee6e4e2005-02-02 16:29:31 +000011569 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011570 if (! list)
11571 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011572 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011573 return CMD_WARNING;
11574 }
11575
11576 extcommunity_list_show (vty, list);
11577
11578 return CMD_SUCCESS;
11579}
David Lamparter6b0655a2014-06-04 06:53:35 +020011580
paul718e3742002-12-13 20:15:29 +000011581/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000011582static const char *
paul718e3742002-12-13 20:15:29 +000011583community_list_config_str (struct community_entry *entry)
11584{
paulfd79ac92004-10-13 05:06:08 +000011585 const char *str;
paul718e3742002-12-13 20:15:29 +000011586
11587 if (entry->any)
11588 str = "";
11589 else
11590 {
11591 if (entry->style == COMMUNITY_LIST_STANDARD)
11592 str = community_str (entry->u.com);
11593 else
11594 str = entry->config;
11595 }
11596 return str;
11597}
11598
11599/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000011600static int
paul718e3742002-12-13 20:15:29 +000011601community_list_config_write (struct vty *vty)
11602{
11603 struct community_list *list;
11604 struct community_entry *entry;
11605 struct community_list_master *cm;
11606 int write = 0;
11607
11608 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000011609 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011610
11611 for (list = cm->num.head; list; list = list->next)
11612 for (entry = list->head; entry; entry = entry->next)
11613 {
hassofee6e4e2005-02-02 16:29:31 +000011614 vty_out (vty, "ip community-list %s %s %s%s",
11615 list->name, community_direct_str (entry->direct),
11616 community_list_config_str (entry),
11617 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011618 write++;
11619 }
11620 for (list = cm->str.head; list; list = list->next)
11621 for (entry = list->head; entry; entry = entry->next)
11622 {
11623 vty_out (vty, "ip community-list %s %s %s %s%s",
11624 entry->style == COMMUNITY_LIST_STANDARD
11625 ? "standard" : "expanded",
11626 list->name, community_direct_str (entry->direct),
11627 community_list_config_str (entry),
11628 VTY_NEWLINE);
11629 write++;
11630 }
11631
11632 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000011633 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011634
11635 for (list = cm->num.head; list; list = list->next)
11636 for (entry = list->head; entry; entry = entry->next)
11637 {
hassofee6e4e2005-02-02 16:29:31 +000011638 vty_out (vty, "ip extcommunity-list %s %s %s%s",
11639 list->name, community_direct_str (entry->direct),
11640 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011641 write++;
11642 }
11643 for (list = cm->str.head; list; list = list->next)
11644 for (entry = list->head; entry; entry = entry->next)
11645 {
11646 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
11647 entry->style == EXTCOMMUNITY_LIST_STANDARD
11648 ? "standard" : "expanded",
11649 list->name, community_direct_str (entry->direct),
11650 community_list_config_str (entry), VTY_NEWLINE);
11651 write++;
11652 }
11653 return write;
11654}
11655
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080011656static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000011657{
11658 COMMUNITY_LIST_NODE,
11659 "",
11660 1 /* Export to vtysh. */
11661};
11662
paul94f2b392005-06-28 12:44:16 +000011663static void
11664community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000011665{
11666 install_node (&community_list_node, community_list_config_write);
11667
11668 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000011669 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
11670 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
11671 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
11672 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
11673 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
11674 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011675 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
11676 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
11677 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
11678 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011679 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
11680 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
11681 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
11682 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
11683 install_element (VIEW_NODE, &show_ip_community_list_cmd);
11684 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
11685 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
11686 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
11687
11688 /* Extcommunity-list. */
11689 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
11690 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
11691 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
11692 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
11693 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
11694 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011695 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
11696 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
11697 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
11698 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011699 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
11700 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
11701 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
11702 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
11703 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
11704 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
11705 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
11706 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
11707}