blob: 94796c74385d20344fcf794cc2aa407cec9780db [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 Berger135ca152016-01-12 13:42:05 -050060 afi_t afi;
Lou Berger13c378d2016-01-12 13:41:56 -050061 switch (vty->node)
62 {
63 case BGP_IPV6_NODE:
64 case BGP_IPV6M_NODE:
65 case BGP_VPNV6_NODE:
Lou Bergera3fda882016-01-12 13:42:04 -050066 case BGP_ENCAPV6_NODE:
Lou Berger135ca152016-01-12 13:42:05 -050067 afi = AFI_IP6;
68 break;
69 default:
70 afi = AFI_IP;
Lou Berger13c378d2016-01-12 13:41:56 -050071 break;
72 }
Lou Berger135ca152016-01-12 13:42:05 -050073 return afi;
paul718e3742002-12-13 20:15:29 +000074}
75
76/* Utility function to get subsequent address family from current
77 node. */
78safi_t
79bgp_node_safi (struct vty *vty)
80{
Lou Berger135ca152016-01-12 13:42:05 -050081 safi_t safi;
82 switch (vty->node)
83 {
84 case BGP_ENCAP_NODE:
85 case BGP_ENCAPV6_NODE:
86 safi = SAFI_ENCAP;
87 break;
88 case BGP_VPNV4_NODE:
89 case BGP_VPNV6_NODE:
90 safi = SAFI_MPLS_VPN;
91 break;
92 case BGP_IPV4M_NODE:
93 case BGP_IPV6M_NODE:
94 safi = SAFI_MULTICAST;
95 break;
96 default:
97 safi = SAFI_UNICAST;
98 break;
99 }
100 return safi;
paul718e3742002-12-13 20:15:29 +0000101}
102
Lou Bergera3fda882016-01-12 13:42:04 -0500103int
104bgp_parse_afi(const char *str, afi_t *afi)
105{
106 if (!strcmp(str, "ipv4")) {
107 *afi = AFI_IP;
108 return 0;
109 }
110#ifdef HAVE_IPV6
111 if (!strcmp(str, "ipv6")) {
112 *afi = AFI_IP6;
113 return 0;
114 }
115#endif /* HAVE_IPV6 */
116 return -1;
117}
118
119int
120bgp_parse_safi(const char *str, safi_t *safi)
121{
122 if (!strcmp(str, "encap")) {
123 *safi = SAFI_ENCAP;
124 return 0;
125 }
126 if (!strcmp(str, "multicast")) {
127 *safi = SAFI_MULTICAST;
128 return 0;
129 }
130 if (!strcmp(str, "unicast")) {
131 *safi = SAFI_UNICAST;
132 return 0;
133 }
134 if (!strcmp(str, "vpn")) {
135 *safi = SAFI_MPLS_VPN;
136 return 0;
137 }
138 return -1;
139}
140
paul94f2b392005-06-28 12:44:16 +0000141static int
paul718e3742002-12-13 20:15:29 +0000142peer_address_self_check (union sockunion *su)
143{
144 struct interface *ifp = NULL;
145
146 if (su->sa.sa_family == AF_INET)
147 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
148#ifdef HAVE_IPV6
149 else if (su->sa.sa_family == AF_INET6)
150 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
151#endif /* HAVE IPV6 */
152
153 if (ifp)
154 return 1;
155
156 return 0;
157}
158
159/* Utility function for looking up peer from VTY. */
paul94f2b392005-06-28 12:44:16 +0000160static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000161peer_lookup_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +0000162{
163 int ret;
164 struct bgp *bgp;
165 union sockunion su;
166 struct peer *peer;
167
168 bgp = vty->index;
169
170 ret = str2sockunion (ip_str, &su);
171 if (ret < 0)
172 {
173 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
174 return NULL;
175 }
176
177 peer = peer_lookup (bgp, &su);
178 if (! peer)
179 {
180 vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
181 return NULL;
182 }
183 return peer;
184}
185
186/* Utility function for looking up peer or peer group. */
paul94f2b392005-06-28 12:44:16 +0000187static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000188peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
paul718e3742002-12-13 20:15:29 +0000189{
190 int ret;
191 struct bgp *bgp;
192 union sockunion su;
193 struct peer *peer;
194 struct peer_group *group;
195
196 bgp = vty->index;
197
198 ret = str2sockunion (peer_str, &su);
199 if (ret == 0)
200 {
201 peer = peer_lookup (bgp, &su);
202 if (peer)
203 return peer;
204 }
205 else
206 {
207 group = peer_group_lookup (bgp, peer_str);
208 if (group)
209 return group->conf;
210 }
211
212 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
213 VTY_NEWLINE);
214
215 return NULL;
216}
217
paul94f2b392005-06-28 12:44:16 +0000218static int
paul718e3742002-12-13 20:15:29 +0000219bgp_vty_return (struct vty *vty, int ret)
220{
paulfd79ac92004-10-13 05:06:08 +0000221 const char *str = NULL;
paul718e3742002-12-13 20:15:29 +0000222
223 switch (ret)
224 {
225 case BGP_ERR_INVALID_VALUE:
226 str = "Invalid value";
227 break;
228 case BGP_ERR_INVALID_FLAG:
229 str = "Invalid flag";
230 break;
231 case BGP_ERR_PEER_INACTIVE:
232 str = "Activate the neighbor for the address family first";
233 break;
234 case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
235 str = "Invalid command for a peer-group member";
236 break;
237 case BGP_ERR_PEER_GROUP_SHUTDOWN:
238 str = "Peer-group has been shutdown. Activate the peer-group first";
239 break;
240 case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
241 str = "This peer is a peer-group member. Please change peer-group configuration";
242 break;
243 case BGP_ERR_PEER_FLAG_CONFLICT:
244 str = "Can't set override-capability and strict-capability-match at the same time";
245 break;
246 case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
247 str = "No activate for peergroup can be given only if peer-group has no members";
248 break;
249 case BGP_ERR_PEER_BELONGS_TO_GROUP:
250 str = "No activate for an individual peer-group member is invalid";
251 break;
252 case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
253 str = "Activate the peer-group for the address family first";
254 break;
255 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
256 str = "Specify remote-as or peer-group remote AS first";
257 break;
258 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
259 str = "Cannot change the peer-group. Deconfigure first";
260 break;
261 case BGP_ERR_PEER_GROUP_MISMATCH:
262 str = "Cannot have different peer-group for the neighbor";
263 break;
264 case BGP_ERR_PEER_FILTER_CONFLICT:
265 str = "Prefix/distribute list can not co-exist";
266 break;
267 case BGP_ERR_NOT_INTERNAL_PEER:
268 str = "Invalid command. Not an internal neighbor";
269 break;
270 case BGP_ERR_REMOVE_PRIVATE_AS:
271 str = "Private AS cannot be removed for IBGP peers";
272 break;
273 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
274 str = "Local-AS allowed only for EBGP peers";
275 break;
276 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
277 str = "Cannot have local-as same as BGP AS number";
278 break;
Paul Jakma0df7c912008-07-21 21:02:49 +0000279 case BGP_ERR_TCPSIG_FAILED:
280 str = "Error while applying TCP-Sig to session(s)";
281 break;
Nick Hilliardfa411a22011-03-23 15:33:17 +0000282 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
283 str = "ebgp-multihop and ttl-security cannot be configured together";
284 break;
Stephen Hemmingerf5a48272011-03-24 17:30:21 +0000285 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
286 str = "ttl-security only allowed for EBGP peers";
287 break;
paul718e3742002-12-13 20:15:29 +0000288 }
289 if (str)
290 {
291 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
292 return CMD_WARNING;
293 }
294 return CMD_SUCCESS;
295}
296
297/* BGP global configuration. */
298
299DEFUN (bgp_multiple_instance_func,
300 bgp_multiple_instance_cmd,
301 "bgp multiple-instance",
302 BGP_STR
303 "Enable bgp multiple instance\n")
304{
305 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
306 return CMD_SUCCESS;
307}
308
309DEFUN (no_bgp_multiple_instance,
310 no_bgp_multiple_instance_cmd,
311 "no bgp multiple-instance",
312 NO_STR
313 BGP_STR
314 "BGP multiple instance\n")
315{
316 int ret;
317
318 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
319 if (ret < 0)
320 {
321 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
322 return CMD_WARNING;
323 }
324 return CMD_SUCCESS;
325}
326
327DEFUN (bgp_config_type,
328 bgp_config_type_cmd,
329 "bgp config-type (cisco|zebra)",
330 BGP_STR
331 "Configuration type\n"
332 "cisco\n"
333 "zebra\n")
334{
335 if (strncmp (argv[0], "c", 1) == 0)
336 bgp_option_set (BGP_OPT_CONFIG_CISCO);
337 else
338 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
339
340 return CMD_SUCCESS;
341}
342
343DEFUN (no_bgp_config_type,
344 no_bgp_config_type_cmd,
345 "no bgp config-type",
346 NO_STR
347 BGP_STR
348 "Display configuration type\n")
349{
350 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
351 return CMD_SUCCESS;
352}
353
354DEFUN (no_synchronization,
355 no_synchronization_cmd,
356 "no synchronization",
357 NO_STR
358 "Perform IGP synchronization\n")
359{
360 return CMD_SUCCESS;
361}
362
363DEFUN (no_auto_summary,
364 no_auto_summary_cmd,
365 "no auto-summary",
366 NO_STR
367 "Enable automatic network number summarization\n")
368{
369 return CMD_SUCCESS;
370}
hasso3d515fd2005-02-01 21:30:04 +0000371
372DEFUN_DEPRECATED (neighbor_version,
373 neighbor_version_cmd,
374 NEIGHBOR_CMD "version (4|4-)",
375 NEIGHBOR_STR
376 NEIGHBOR_ADDR_STR
377 "Set the BGP version to match a neighbor\n"
378 "Neighbor's BGP version\n")
379{
380 return CMD_SUCCESS;
381}
David Lamparter6b0655a2014-06-04 06:53:35 +0200382
paul718e3742002-12-13 20:15:29 +0000383/* "router bgp" commands. */
384DEFUN (router_bgp,
385 router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000386 "router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000387 ROUTER_STR
388 BGP_STR
389 AS_STR)
390{
391 int ret;
392 as_t as;
393 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000394 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000395
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000396 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000397
398 if (argc == 2)
399 name = argv[1];
400
401 ret = bgp_get (&bgp, &as, name);
402 switch (ret)
403 {
404 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
405 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
406 VTY_NEWLINE);
407 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000408 case BGP_ERR_AS_MISMATCH:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400409 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000410 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000411 case BGP_ERR_INSTANCE_MISMATCH:
412 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400413 vty_out (vty, "BGP instance is already running; AS is %u%s",
paul718e3742002-12-13 20:15:29 +0000414 as, VTY_NEWLINE);
415 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000416 }
417
418 vty->node = BGP_NODE;
419 vty->index = bgp;
420
421 return CMD_SUCCESS;
422}
423
424ALIAS (router_bgp,
425 router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000426 "router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000427 ROUTER_STR
428 BGP_STR
429 AS_STR
430 "BGP view\n"
431 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200432
paul718e3742002-12-13 20:15:29 +0000433/* "no router bgp" commands. */
434DEFUN (no_router_bgp,
435 no_router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000436 "no router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000437 NO_STR
438 ROUTER_STR
439 BGP_STR
440 AS_STR)
441{
442 as_t as;
443 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000444 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000445
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000446 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000447
448 if (argc == 2)
449 name = argv[1];
450
451 /* Lookup bgp structure. */
452 bgp = bgp_lookup (as, name);
453 if (! bgp)
454 {
455 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
456 return CMD_WARNING;
457 }
458
459 bgp_delete (bgp);
460
461 return CMD_SUCCESS;
462}
463
464ALIAS (no_router_bgp,
465 no_router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000466 "no router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000467 NO_STR
468 ROUTER_STR
469 BGP_STR
470 AS_STR
471 "BGP view\n"
472 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200473
paul718e3742002-12-13 20:15:29 +0000474/* BGP router-id. */
475
476DEFUN (bgp_router_id,
477 bgp_router_id_cmd,
478 "bgp router-id A.B.C.D",
479 BGP_STR
480 "Override configured router identifier\n"
481 "Manually configured router identifier\n")
482{
483 int ret;
484 struct in_addr id;
485 struct bgp *bgp;
486
487 bgp = vty->index;
488
489 ret = inet_aton (argv[0], &id);
490 if (! ret)
491 {
492 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
493 return CMD_WARNING;
494 }
495
hasso18a6dce2004-10-03 18:18:34 +0000496 bgp->router_id_static = id;
paul718e3742002-12-13 20:15:29 +0000497 bgp_router_id_set (bgp, &id);
498
499 return CMD_SUCCESS;
500}
501
502DEFUN (no_bgp_router_id,
503 no_bgp_router_id_cmd,
504 "no bgp router-id",
505 NO_STR
506 BGP_STR
507 "Override configured router identifier\n")
508{
509 int ret;
510 struct in_addr id;
511 struct bgp *bgp;
512
513 bgp = vty->index;
514
515 if (argc == 1)
516 {
517 ret = inet_aton (argv[0], &id);
518 if (! ret)
519 {
520 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
521 return CMD_WARNING;
522 }
523
hasso18a6dce2004-10-03 18:18:34 +0000524 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
paul718e3742002-12-13 20:15:29 +0000525 {
526 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
527 return CMD_WARNING;
528 }
529 }
530
hasso18a6dce2004-10-03 18:18:34 +0000531 bgp->router_id_static.s_addr = 0;
532 bgp_router_id_set (bgp, &router_id_zebra);
paul718e3742002-12-13 20:15:29 +0000533
534 return CMD_SUCCESS;
535}
536
537ALIAS (no_bgp_router_id,
538 no_bgp_router_id_val_cmd,
539 "no bgp router-id A.B.C.D",
540 NO_STR
541 BGP_STR
542 "Override configured router identifier\n"
543 "Manually configured router identifier\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200544
paul718e3742002-12-13 20:15:29 +0000545/* BGP Cluster ID. */
546
547DEFUN (bgp_cluster_id,
548 bgp_cluster_id_cmd,
549 "bgp cluster-id A.B.C.D",
550 BGP_STR
551 "Configure Route-Reflector Cluster-id\n"
552 "Route-Reflector Cluster-id in IP address format\n")
553{
554 int ret;
555 struct bgp *bgp;
556 struct in_addr cluster;
557
558 bgp = vty->index;
559
560 ret = inet_aton (argv[0], &cluster);
561 if (! ret)
562 {
563 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
564 return CMD_WARNING;
565 }
566
567 bgp_cluster_id_set (bgp, &cluster);
568
569 return CMD_SUCCESS;
570}
571
572ALIAS (bgp_cluster_id,
573 bgp_cluster_id32_cmd,
574 "bgp cluster-id <1-4294967295>",
575 BGP_STR
576 "Configure Route-Reflector Cluster-id\n"
577 "Route-Reflector Cluster-id as 32 bit quantity\n")
578
579DEFUN (no_bgp_cluster_id,
580 no_bgp_cluster_id_cmd,
581 "no bgp cluster-id",
582 NO_STR
583 BGP_STR
584 "Configure Route-Reflector Cluster-id\n")
585{
586 int ret;
587 struct bgp *bgp;
588 struct in_addr cluster;
589
590 bgp = vty->index;
591
592 if (argc == 1)
593 {
594 ret = inet_aton (argv[0], &cluster);
595 if (! ret)
596 {
597 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
598 return CMD_WARNING;
599 }
600 }
601
602 bgp_cluster_id_unset (bgp);
603
604 return CMD_SUCCESS;
605}
606
607ALIAS (no_bgp_cluster_id,
608 no_bgp_cluster_id_arg_cmd,
609 "no bgp cluster-id A.B.C.D",
610 NO_STR
611 BGP_STR
612 "Configure Route-Reflector Cluster-id\n"
613 "Route-Reflector Cluster-id in IP address format\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200614
paul718e3742002-12-13 20:15:29 +0000615DEFUN (bgp_confederation_identifier,
616 bgp_confederation_identifier_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000617 "bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000618 "BGP specific commands\n"
619 "AS confederation parameters\n"
620 "AS number\n"
621 "Set routing domain confederation AS\n")
622{
623 struct bgp *bgp;
624 as_t as;
625
626 bgp = vty->index;
627
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000628 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000629
630 bgp_confederation_id_set (bgp, as);
631
632 return CMD_SUCCESS;
633}
634
635DEFUN (no_bgp_confederation_identifier,
636 no_bgp_confederation_identifier_cmd,
637 "no bgp confederation identifier",
638 NO_STR
639 "BGP specific commands\n"
640 "AS confederation parameters\n"
641 "AS number\n")
642{
643 struct bgp *bgp;
Paul Jakma7aa9dce2014-09-19 14:42:23 +0100644 as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */
paul718e3742002-12-13 20:15:29 +0000645
646 bgp = vty->index;
647
648 if (argc == 1)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000649 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000650
651 bgp_confederation_id_unset (bgp);
652
653 return CMD_SUCCESS;
654}
655
656ALIAS (no_bgp_confederation_identifier,
657 no_bgp_confederation_identifier_arg_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000658 "no bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000659 NO_STR
660 "BGP specific commands\n"
661 "AS confederation parameters\n"
662 "AS number\n"
663 "Set routing domain confederation AS\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200664
paul718e3742002-12-13 20:15:29 +0000665DEFUN (bgp_confederation_peers,
666 bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000667 "bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000668 "BGP specific commands\n"
669 "AS confederation parameters\n"
670 "Peer ASs in BGP confederation\n"
671 AS_STR)
672{
673 struct bgp *bgp;
674 as_t as;
675 int i;
676
677 bgp = vty->index;
678
679 for (i = 0; i < argc; i++)
680 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000681 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000682
683 if (bgp->as == as)
684 {
685 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
686 VTY_NEWLINE);
687 continue;
688 }
689
690 bgp_confederation_peers_add (bgp, as);
691 }
692 return CMD_SUCCESS;
693}
694
695DEFUN (no_bgp_confederation_peers,
696 no_bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000697 "no bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000698 NO_STR
699 "BGP specific commands\n"
700 "AS confederation parameters\n"
701 "Peer ASs in BGP confederation\n"
702 AS_STR)
703{
704 struct bgp *bgp;
705 as_t as;
706 int i;
707
708 bgp = vty->index;
709
710 for (i = 0; i < argc; i++)
711 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000712 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
713
paul718e3742002-12-13 20:15:29 +0000714 bgp_confederation_peers_remove (bgp, as);
715 }
716 return CMD_SUCCESS;
717}
David Lamparter6b0655a2014-06-04 06:53:35 +0200718
Josh Bailey165b5ff2011-07-20 20:43:22 -0700719/* Maximum-paths configuration */
720DEFUN (bgp_maxpaths,
721 bgp_maxpaths_cmd,
722 "maximum-paths <1-255>",
723 "Forward packets over multiple paths\n"
724 "Number of paths\n")
725{
726 struct bgp *bgp;
727 u_int16_t maxpaths;
728 int ret;
729
730 bgp = vty->index;
731
732 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
733
734 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
735 BGP_PEER_EBGP, maxpaths);
736 if (ret < 0)
737 {
738 vty_out (vty,
739 "%% Failed to set maximum-paths %u for afi %u, safi %u%s",
740 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
741 return CMD_WARNING;
742 }
743
Donald Sharp58a83f22015-09-11 10:11:42 -0400744 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
745 vty_out (vty,
746 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
747 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
748
Josh Bailey165b5ff2011-07-20 20:43:22 -0700749 return CMD_SUCCESS;
750}
751
752DEFUN (bgp_maxpaths_ibgp,
753 bgp_maxpaths_ibgp_cmd,
754 "maximum-paths ibgp <1-255>",
755 "Forward packets over multiple paths\n"
756 "iBGP-multipath\n"
757 "Number of paths\n")
758{
759 struct bgp *bgp;
760 u_int16_t maxpaths;
761 int ret;
762
763 bgp = vty->index;
764
765 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
766
767 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
768 BGP_PEER_IBGP, maxpaths);
769 if (ret < 0)
770 {
771 vty_out (vty,
772 "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
773 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
774 return CMD_WARNING;
775 }
776
Donald Sharp58a83f22015-09-11 10:11:42 -0400777 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
778 vty_out (vty,
779 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
780 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
781
Josh Bailey165b5ff2011-07-20 20:43:22 -0700782 return CMD_SUCCESS;
783}
784
785DEFUN (no_bgp_maxpaths,
786 no_bgp_maxpaths_cmd,
787 "no maximum-paths",
788 NO_STR
789 "Forward packets over multiple paths\n"
790 "Number of paths\n")
791{
792 struct bgp *bgp;
793 int ret;
794
795 bgp = vty->index;
796
797 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
798 BGP_PEER_EBGP);
799 if (ret < 0)
800 {
801 vty_out (vty,
802 "%% Failed to unset maximum-paths for afi %u, safi %u%s",
803 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
804 return CMD_WARNING;
805 }
806
807 return CMD_SUCCESS;
808}
809
810ALIAS (no_bgp_maxpaths,
811 no_bgp_maxpaths_arg_cmd,
812 "no maximum-paths <1-255>",
813 NO_STR
814 "Forward packets over multiple paths\n"
815 "Number of paths\n")
816
817DEFUN (no_bgp_maxpaths_ibgp,
818 no_bgp_maxpaths_ibgp_cmd,
819 "no maximum-paths ibgp",
820 NO_STR
821 "Forward packets over multiple paths\n"
822 "iBGP-multipath\n"
823 "Number of paths\n")
824{
825 struct bgp *bgp;
826 int ret;
827
828 bgp = vty->index;
829
830 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
831 BGP_PEER_IBGP);
832 if (ret < 0)
833 {
834 vty_out (vty,
835 "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
836 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
837 return CMD_WARNING;
838 }
839
840 return CMD_SUCCESS;
841}
842
843ALIAS (no_bgp_maxpaths_ibgp,
844 no_bgp_maxpaths_ibgp_arg_cmd,
845 "no maximum-paths ibgp <1-255>",
846 NO_STR
847 "Forward packets over multiple paths\n"
848 "iBGP-multipath\n"
849 "Number of paths\n")
850
851int
852bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
853 safi_t safi, int *write)
854{
855 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
856 {
857 bgp_config_write_family_header (vty, afi, safi, write);
858 vty_out (vty, " maximum-paths %d%s",
859 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
860 }
861
862 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
863 {
864 bgp_config_write_family_header (vty, afi, safi, write);
865 vty_out (vty, " maximum-paths ibgp %d%s",
866 bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
867 }
868
869 return 0;
870}
David Lamparter6b0655a2014-06-04 06:53:35 +0200871
paul718e3742002-12-13 20:15:29 +0000872/* BGP timers. */
873
874DEFUN (bgp_timers,
875 bgp_timers_cmd,
876 "timers bgp <0-65535> <0-65535>",
877 "Adjust routing timers\n"
878 "BGP timers\n"
879 "Keepalive interval\n"
880 "Holdtime\n")
881{
882 struct bgp *bgp;
883 unsigned long keepalive = 0;
884 unsigned long holdtime = 0;
885
886 bgp = vty->index;
887
888 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
889 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
890
891 /* Holdtime value check. */
892 if (holdtime < 3 && holdtime != 0)
893 {
894 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
895 VTY_NEWLINE);
896 return CMD_WARNING;
897 }
898
899 bgp_timers_set (bgp, keepalive, holdtime);
900
901 return CMD_SUCCESS;
902}
903
904DEFUN (no_bgp_timers,
905 no_bgp_timers_cmd,
906 "no timers bgp",
907 NO_STR
908 "Adjust routing timers\n"
909 "BGP timers\n")
910{
911 struct bgp *bgp;
912
913 bgp = vty->index;
914 bgp_timers_unset (bgp);
915
916 return CMD_SUCCESS;
917}
918
919ALIAS (no_bgp_timers,
920 no_bgp_timers_arg_cmd,
921 "no timers bgp <0-65535> <0-65535>",
922 NO_STR
923 "Adjust routing timers\n"
924 "BGP timers\n"
925 "Keepalive interval\n"
926 "Holdtime\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200927
paul718e3742002-12-13 20:15:29 +0000928DEFUN (bgp_client_to_client_reflection,
929 bgp_client_to_client_reflection_cmd,
930 "bgp client-to-client reflection",
931 "BGP specific commands\n"
932 "Configure client to client route reflection\n"
933 "reflection of routes allowed\n")
934{
935 struct bgp *bgp;
936
937 bgp = vty->index;
938 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
939 return CMD_SUCCESS;
940}
941
942DEFUN (no_bgp_client_to_client_reflection,
943 no_bgp_client_to_client_reflection_cmd,
944 "no bgp client-to-client reflection",
945 NO_STR
946 "BGP specific commands\n"
947 "Configure client to client route reflection\n"
948 "reflection of routes allowed\n")
949{
950 struct bgp *bgp;
951
952 bgp = vty->index;
953 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
954 return CMD_SUCCESS;
955}
956
957/* "bgp always-compare-med" configuration. */
958DEFUN (bgp_always_compare_med,
959 bgp_always_compare_med_cmd,
960 "bgp always-compare-med",
961 "BGP specific commands\n"
962 "Allow comparing MED from different neighbors\n")
963{
964 struct bgp *bgp;
965
966 bgp = vty->index;
967 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
968 return CMD_SUCCESS;
969}
970
971DEFUN (no_bgp_always_compare_med,
972 no_bgp_always_compare_med_cmd,
973 "no bgp always-compare-med",
974 NO_STR
975 "BGP specific commands\n"
976 "Allow comparing MED from different neighbors\n")
977{
978 struct bgp *bgp;
979
980 bgp = vty->index;
981 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
982 return CMD_SUCCESS;
983}
David Lamparter6b0655a2014-06-04 06:53:35 +0200984
paul718e3742002-12-13 20:15:29 +0000985/* "bgp deterministic-med" configuration. */
986DEFUN (bgp_deterministic_med,
987 bgp_deterministic_med_cmd,
988 "bgp deterministic-med",
989 "BGP specific commands\n"
990 "Pick the best-MED path among paths advertised from the neighboring AS\n")
991{
992 struct bgp *bgp;
993
994 bgp = vty->index;
995 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
996 return CMD_SUCCESS;
997}
998
999DEFUN (no_bgp_deterministic_med,
1000 no_bgp_deterministic_med_cmd,
1001 "no bgp deterministic-med",
1002 NO_STR
1003 "BGP specific commands\n"
1004 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1005{
1006 struct bgp *bgp;
1007
1008 bgp = vty->index;
1009 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
1010 return CMD_SUCCESS;
1011}
hasso538621f2004-05-21 09:31:30 +00001012
1013/* "bgp graceful-restart" configuration. */
1014DEFUN (bgp_graceful_restart,
1015 bgp_graceful_restart_cmd,
1016 "bgp graceful-restart",
1017 "BGP specific commands\n"
1018 "Graceful restart capability parameters\n")
1019{
1020 struct bgp *bgp;
1021
1022 bgp = vty->index;
1023 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
1024 return CMD_SUCCESS;
1025}
1026
1027DEFUN (no_bgp_graceful_restart,
1028 no_bgp_graceful_restart_cmd,
1029 "no bgp graceful-restart",
1030 NO_STR
1031 "BGP specific commands\n"
1032 "Graceful restart capability parameters\n")
1033{
1034 struct bgp *bgp;
1035
1036 bgp = vty->index;
1037 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
1038 return CMD_SUCCESS;
1039}
1040
hasso93406d82005-02-02 14:40:33 +00001041DEFUN (bgp_graceful_restart_stalepath_time,
1042 bgp_graceful_restart_stalepath_time_cmd,
1043 "bgp graceful-restart stalepath-time <1-3600>",
1044 "BGP specific commands\n"
1045 "Graceful restart capability parameters\n"
1046 "Set the max time to hold onto restarting peer's stale paths\n"
1047 "Delay value (seconds)\n")
1048{
1049 struct bgp *bgp;
1050 u_int32_t stalepath;
1051
1052 bgp = vty->index;
1053 if (! bgp)
1054 return CMD_WARNING;
1055
1056 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
1057 bgp->stalepath_time = stalepath;
1058 return CMD_SUCCESS;
1059}
1060
1061DEFUN (no_bgp_graceful_restart_stalepath_time,
1062 no_bgp_graceful_restart_stalepath_time_cmd,
1063 "no bgp graceful-restart stalepath-time",
1064 NO_STR
1065 "BGP specific commands\n"
1066 "Graceful restart capability parameters\n"
1067 "Set the max time to hold onto restarting peer's stale paths\n")
1068{
1069 struct bgp *bgp;
1070
1071 bgp = vty->index;
1072 if (! bgp)
1073 return CMD_WARNING;
1074
1075 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1076 return CMD_SUCCESS;
1077}
1078
1079ALIAS (no_bgp_graceful_restart_stalepath_time,
1080 no_bgp_graceful_restart_stalepath_time_val_cmd,
1081 "no bgp graceful-restart stalepath-time <1-3600>",
1082 NO_STR
1083 "BGP specific commands\n"
1084 "Graceful restart capability parameters\n"
1085 "Set the max time to hold onto restarting peer's stale paths\n"
1086 "Delay value (seconds)\n")
1087
paul718e3742002-12-13 20:15:29 +00001088/* "bgp fast-external-failover" configuration. */
1089DEFUN (bgp_fast_external_failover,
1090 bgp_fast_external_failover_cmd,
1091 "bgp fast-external-failover",
1092 BGP_STR
1093 "Immediately reset session if a link to a directly connected external peer goes down\n")
1094{
1095 struct bgp *bgp;
1096
1097 bgp = vty->index;
1098 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1099 return CMD_SUCCESS;
1100}
1101
1102DEFUN (no_bgp_fast_external_failover,
1103 no_bgp_fast_external_failover_cmd,
1104 "no bgp fast-external-failover",
1105 NO_STR
1106 BGP_STR
1107 "Immediately reset session if a link to a directly connected external peer goes down\n")
1108{
1109 struct bgp *bgp;
1110
1111 bgp = vty->index;
1112 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1113 return CMD_SUCCESS;
1114}
David Lamparter6b0655a2014-06-04 06:53:35 +02001115
paul718e3742002-12-13 20:15:29 +00001116/* "bgp enforce-first-as" configuration. */
1117DEFUN (bgp_enforce_first_as,
1118 bgp_enforce_first_as_cmd,
1119 "bgp enforce-first-as",
1120 BGP_STR
1121 "Enforce the first AS for EBGP routes\n")
1122{
1123 struct bgp *bgp;
1124
1125 bgp = vty->index;
1126 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1127 return CMD_SUCCESS;
1128}
1129
1130DEFUN (no_bgp_enforce_first_as,
1131 no_bgp_enforce_first_as_cmd,
1132 "no bgp enforce-first-as",
1133 NO_STR
1134 BGP_STR
1135 "Enforce the first AS for EBGP routes\n")
1136{
1137 struct bgp *bgp;
1138
1139 bgp = vty->index;
1140 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1141 return CMD_SUCCESS;
1142}
David Lamparter6b0655a2014-06-04 06:53:35 +02001143
paul718e3742002-12-13 20:15:29 +00001144/* "bgp bestpath compare-routerid" configuration. */
1145DEFUN (bgp_bestpath_compare_router_id,
1146 bgp_bestpath_compare_router_id_cmd,
1147 "bgp bestpath compare-routerid",
1148 "BGP specific commands\n"
1149 "Change the default bestpath selection\n"
1150 "Compare router-id for identical EBGP paths\n")
1151{
1152 struct bgp *bgp;
1153
1154 bgp = vty->index;
1155 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1156 return CMD_SUCCESS;
1157}
1158
1159DEFUN (no_bgp_bestpath_compare_router_id,
1160 no_bgp_bestpath_compare_router_id_cmd,
1161 "no bgp bestpath compare-routerid",
1162 NO_STR
1163 "BGP specific commands\n"
1164 "Change the default bestpath selection\n"
1165 "Compare router-id for identical EBGP paths\n")
1166{
1167 struct bgp *bgp;
1168
1169 bgp = vty->index;
1170 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1171 return CMD_SUCCESS;
1172}
David Lamparter6b0655a2014-06-04 06:53:35 +02001173
paul718e3742002-12-13 20:15:29 +00001174/* "bgp bestpath as-path ignore" configuration. */
1175DEFUN (bgp_bestpath_aspath_ignore,
1176 bgp_bestpath_aspath_ignore_cmd,
1177 "bgp bestpath as-path ignore",
1178 "BGP specific commands\n"
1179 "Change the default bestpath selection\n"
1180 "AS-path attribute\n"
1181 "Ignore as-path length in selecting a route\n")
1182{
1183 struct bgp *bgp;
1184
1185 bgp = vty->index;
1186 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
1187 return CMD_SUCCESS;
1188}
1189
1190DEFUN (no_bgp_bestpath_aspath_ignore,
1191 no_bgp_bestpath_aspath_ignore_cmd,
1192 "no bgp bestpath as-path ignore",
1193 NO_STR
1194 "BGP specific commands\n"
1195 "Change the default bestpath selection\n"
1196 "AS-path attribute\n"
1197 "Ignore as-path length in selecting a route\n")
1198{
1199 struct bgp *bgp;
1200
1201 bgp = vty->index;
1202 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1203 return CMD_SUCCESS;
1204}
David Lamparter6b0655a2014-06-04 06:53:35 +02001205
hasso68118452005-04-08 15:40:36 +00001206/* "bgp bestpath as-path confed" configuration. */
1207DEFUN (bgp_bestpath_aspath_confed,
1208 bgp_bestpath_aspath_confed_cmd,
1209 "bgp bestpath as-path confed",
1210 "BGP specific commands\n"
1211 "Change the default bestpath selection\n"
1212 "AS-path attribute\n"
1213 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1214{
1215 struct bgp *bgp;
1216
1217 bgp = vty->index;
1218 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1219 return CMD_SUCCESS;
1220}
1221
1222DEFUN (no_bgp_bestpath_aspath_confed,
1223 no_bgp_bestpath_aspath_confed_cmd,
1224 "no bgp bestpath as-path confed",
1225 NO_STR
1226 "BGP specific commands\n"
1227 "Change the default bestpath selection\n"
1228 "AS-path attribute\n"
1229 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1230{
1231 struct bgp *bgp;
1232
1233 bgp = vty->index;
1234 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1235 return CMD_SUCCESS;
1236}
David Lamparter6b0655a2014-06-04 06:53:35 +02001237
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00001238/* "bgp bestpath as-path multipath-relax" configuration. */
1239DEFUN (bgp_bestpath_aspath_multipath_relax,
1240 bgp_bestpath_aspath_multipath_relax_cmd,
1241 "bgp bestpath as-path multipath-relax",
1242 "BGP specific commands\n"
1243 "Change the default bestpath selection\n"
1244 "AS-path attribute\n"
1245 "Allow load sharing across routes that have different AS paths (but same length)\n")
1246{
1247 struct bgp *bgp;
1248
1249 bgp = vty->index;
1250 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1251 return CMD_SUCCESS;
1252}
1253
1254DEFUN (no_bgp_bestpath_aspath_multipath_relax,
1255 no_bgp_bestpath_aspath_multipath_relax_cmd,
1256 "no bgp bestpath as-path multipath-relax",
1257 NO_STR
1258 "BGP specific commands\n"
1259 "Change the default bestpath selection\n"
1260 "AS-path attribute\n"
1261 "Allow load sharing across routes that have different AS paths (but same length)\n")
1262{
1263 struct bgp *bgp;
1264
1265 bgp = vty->index;
1266 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1267 return CMD_SUCCESS;
1268}
David Lamparter6b0655a2014-06-04 06:53:35 +02001269
paul848973c2003-08-13 00:32:49 +00001270/* "bgp log-neighbor-changes" configuration. */
1271DEFUN (bgp_log_neighbor_changes,
1272 bgp_log_neighbor_changes_cmd,
1273 "bgp log-neighbor-changes",
1274 "BGP specific commands\n"
1275 "Log neighbor up/down and reset reason\n")
1276{
1277 struct bgp *bgp;
1278
1279 bgp = vty->index;
1280 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1281 return CMD_SUCCESS;
1282}
1283
1284DEFUN (no_bgp_log_neighbor_changes,
1285 no_bgp_log_neighbor_changes_cmd,
1286 "no bgp log-neighbor-changes",
1287 NO_STR
1288 "BGP specific commands\n"
1289 "Log neighbor up/down and reset reason\n")
1290{
1291 struct bgp *bgp;
1292
1293 bgp = vty->index;
1294 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1295 return CMD_SUCCESS;
1296}
David Lamparter6b0655a2014-06-04 06:53:35 +02001297
paul718e3742002-12-13 20:15:29 +00001298/* "bgp bestpath med" configuration. */
1299DEFUN (bgp_bestpath_med,
1300 bgp_bestpath_med_cmd,
1301 "bgp bestpath med (confed|missing-as-worst)",
1302 "BGP specific commands\n"
1303 "Change the default bestpath selection\n"
1304 "MED attribute\n"
1305 "Compare MED among confederation paths\n"
1306 "Treat missing MED as the least preferred one\n")
1307{
1308 struct bgp *bgp;
1309
1310 bgp = vty->index;
1311
1312 if (strncmp (argv[0], "confed", 1) == 0)
1313 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1314 else
1315 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1316
1317 return CMD_SUCCESS;
1318}
1319
1320DEFUN (bgp_bestpath_med2,
1321 bgp_bestpath_med2_cmd,
1322 "bgp bestpath med confed missing-as-worst",
1323 "BGP specific commands\n"
1324 "Change the default bestpath selection\n"
1325 "MED attribute\n"
1326 "Compare MED among confederation paths\n"
1327 "Treat missing MED as the least preferred one\n")
1328{
1329 struct bgp *bgp;
1330
1331 bgp = vty->index;
1332 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1333 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1334 return CMD_SUCCESS;
1335}
1336
1337ALIAS (bgp_bestpath_med2,
1338 bgp_bestpath_med3_cmd,
1339 "bgp bestpath med missing-as-worst confed",
1340 "BGP specific commands\n"
1341 "Change the default bestpath selection\n"
1342 "MED attribute\n"
1343 "Treat missing MED as the least preferred one\n"
1344 "Compare MED among confederation paths\n")
1345
1346DEFUN (no_bgp_bestpath_med,
1347 no_bgp_bestpath_med_cmd,
1348 "no bgp bestpath med (confed|missing-as-worst)",
1349 NO_STR
1350 "BGP specific commands\n"
1351 "Change the default bestpath selection\n"
1352 "MED attribute\n"
1353 "Compare MED among confederation paths\n"
1354 "Treat missing MED as the least preferred one\n")
1355{
1356 struct bgp *bgp;
1357
1358 bgp = vty->index;
1359
1360 if (strncmp (argv[0], "confed", 1) == 0)
1361 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1362 else
1363 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1364
1365 return CMD_SUCCESS;
1366}
1367
1368DEFUN (no_bgp_bestpath_med2,
1369 no_bgp_bestpath_med2_cmd,
1370 "no bgp bestpath med confed missing-as-worst",
1371 NO_STR
1372 "BGP specific commands\n"
1373 "Change the default bestpath selection\n"
1374 "MED attribute\n"
1375 "Compare MED among confederation paths\n"
1376 "Treat missing MED as the least preferred one\n")
1377{
1378 struct bgp *bgp;
1379
1380 bgp = vty->index;
1381 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1382 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1383 return CMD_SUCCESS;
1384}
1385
1386ALIAS (no_bgp_bestpath_med2,
1387 no_bgp_bestpath_med3_cmd,
1388 "no bgp bestpath med missing-as-worst confed",
1389 NO_STR
1390 "BGP specific commands\n"
1391 "Change the default bestpath selection\n"
1392 "MED attribute\n"
1393 "Treat missing MED as the least preferred one\n"
1394 "Compare MED among confederation paths\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001395
paul718e3742002-12-13 20:15:29 +00001396/* "no bgp default ipv4-unicast". */
1397DEFUN (no_bgp_default_ipv4_unicast,
1398 no_bgp_default_ipv4_unicast_cmd,
1399 "no bgp default ipv4-unicast",
1400 NO_STR
1401 "BGP specific commands\n"
1402 "Configure BGP defaults\n"
1403 "Activate ipv4-unicast for a peer by default\n")
1404{
1405 struct bgp *bgp;
1406
1407 bgp = vty->index;
1408 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1409 return CMD_SUCCESS;
1410}
1411
1412DEFUN (bgp_default_ipv4_unicast,
1413 bgp_default_ipv4_unicast_cmd,
1414 "bgp default ipv4-unicast",
1415 "BGP specific commands\n"
1416 "Configure BGP defaults\n"
1417 "Activate ipv4-unicast for a peer by default\n")
1418{
1419 struct bgp *bgp;
1420
1421 bgp = vty->index;
1422 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1423 return CMD_SUCCESS;
1424}
David Lamparter6b0655a2014-06-04 06:53:35 +02001425
paul718e3742002-12-13 20:15:29 +00001426/* "bgp import-check" configuration. */
1427DEFUN (bgp_network_import_check,
1428 bgp_network_import_check_cmd,
1429 "bgp network import-check",
1430 "BGP specific commands\n"
1431 "BGP network command\n"
1432 "Check BGP network route exists in IGP\n")
1433{
1434 struct bgp *bgp;
1435
1436 bgp = vty->index;
1437 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1438 return CMD_SUCCESS;
1439}
1440
1441DEFUN (no_bgp_network_import_check,
1442 no_bgp_network_import_check_cmd,
1443 "no bgp network import-check",
1444 NO_STR
1445 "BGP specific commands\n"
1446 "BGP network command\n"
1447 "Check BGP network route exists in IGP\n")
1448{
1449 struct bgp *bgp;
1450
1451 bgp = vty->index;
1452 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1453 return CMD_SUCCESS;
1454}
David Lamparter6b0655a2014-06-04 06:53:35 +02001455
paul718e3742002-12-13 20:15:29 +00001456DEFUN (bgp_default_local_preference,
1457 bgp_default_local_preference_cmd,
1458 "bgp default local-preference <0-4294967295>",
1459 "BGP specific commands\n"
1460 "Configure BGP defaults\n"
1461 "local preference (higher=more preferred)\n"
1462 "Configure default local preference value\n")
1463{
1464 struct bgp *bgp;
1465 u_int32_t local_pref;
1466
1467 bgp = vty->index;
1468
1469 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1470
1471 bgp_default_local_preference_set (bgp, local_pref);
1472
1473 return CMD_SUCCESS;
1474}
1475
1476DEFUN (no_bgp_default_local_preference,
1477 no_bgp_default_local_preference_cmd,
1478 "no bgp default local-preference",
1479 NO_STR
1480 "BGP specific commands\n"
1481 "Configure BGP defaults\n"
1482 "local preference (higher=more preferred)\n")
1483{
1484 struct bgp *bgp;
1485
1486 bgp = vty->index;
1487 bgp_default_local_preference_unset (bgp);
1488 return CMD_SUCCESS;
1489}
1490
1491ALIAS (no_bgp_default_local_preference,
1492 no_bgp_default_local_preference_val_cmd,
1493 "no bgp default local-preference <0-4294967295>",
1494 NO_STR
1495 "BGP specific commands\n"
1496 "Configure BGP defaults\n"
1497 "local preference (higher=more preferred)\n"
1498 "Configure default local preference value\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001499
paul718e3742002-12-13 20:15:29 +00001500static int
paulfd79ac92004-10-13 05:06:08 +00001501peer_remote_as_vty (struct vty *vty, const char *peer_str,
1502 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001503{
1504 int ret;
1505 struct bgp *bgp;
1506 as_t as;
1507 union sockunion su;
1508
1509 bgp = vty->index;
1510
1511 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001512 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001513
1514 /* If peer is peer group, call proper function. */
1515 ret = str2sockunion (peer_str, &su);
1516 if (ret < 0)
1517 {
1518 ret = peer_group_remote_as (bgp, peer_str, &as);
1519 if (ret < 0)
1520 {
1521 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1522 return CMD_WARNING;
1523 }
1524 return CMD_SUCCESS;
1525 }
1526
1527 if (peer_address_self_check (&su))
1528 {
1529 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1530 VTY_NEWLINE);
1531 return CMD_WARNING;
1532 }
1533
1534 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1535
1536 /* This peer belongs to peer group. */
1537 switch (ret)
1538 {
1539 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001540 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001541 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001542 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001543 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 +00001544 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001545 }
1546 return bgp_vty_return (vty, ret);
1547}
1548
1549DEFUN (neighbor_remote_as,
1550 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001551 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001552 NEIGHBOR_STR
1553 NEIGHBOR_ADDR_STR2
1554 "Specify a BGP neighbor\n"
1555 AS_STR)
1556{
1557 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1558}
David Lamparter6b0655a2014-06-04 06:53:35 +02001559
paul718e3742002-12-13 20:15:29 +00001560DEFUN (neighbor_peer_group,
1561 neighbor_peer_group_cmd,
1562 "neighbor WORD peer-group",
1563 NEIGHBOR_STR
1564 "Neighbor tag\n"
1565 "Configure peer-group\n")
1566{
1567 struct bgp *bgp;
1568 struct peer_group *group;
1569
1570 bgp = vty->index;
1571
1572 group = peer_group_get (bgp, argv[0]);
1573 if (! group)
1574 return CMD_WARNING;
1575
1576 return CMD_SUCCESS;
1577}
1578
1579DEFUN (no_neighbor,
1580 no_neighbor_cmd,
1581 NO_NEIGHBOR_CMD2,
1582 NO_STR
1583 NEIGHBOR_STR
1584 NEIGHBOR_ADDR_STR2)
1585{
1586 int ret;
1587 union sockunion su;
1588 struct peer_group *group;
1589 struct peer *peer;
1590
1591 ret = str2sockunion (argv[0], &su);
1592 if (ret < 0)
1593 {
1594 group = peer_group_lookup (vty->index, argv[0]);
1595 if (group)
1596 peer_group_delete (group);
1597 else
1598 {
1599 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1600 return CMD_WARNING;
1601 }
1602 }
1603 else
1604 {
1605 peer = peer_lookup (vty->index, &su);
1606 if (peer)
paul200df112005-06-01 11:17:05 +00001607 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001608 }
1609
1610 return CMD_SUCCESS;
1611}
1612
1613ALIAS (no_neighbor,
1614 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001615 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001616 NO_STR
1617 NEIGHBOR_STR
1618 NEIGHBOR_ADDR_STR
1619 "Specify a BGP neighbor\n"
1620 AS_STR)
1621
1622DEFUN (no_neighbor_peer_group,
1623 no_neighbor_peer_group_cmd,
1624 "no neighbor WORD peer-group",
1625 NO_STR
1626 NEIGHBOR_STR
1627 "Neighbor tag\n"
1628 "Configure peer-group\n")
1629{
1630 struct peer_group *group;
1631
1632 group = peer_group_lookup (vty->index, argv[0]);
1633 if (group)
1634 peer_group_delete (group);
1635 else
1636 {
1637 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1638 return CMD_WARNING;
1639 }
1640 return CMD_SUCCESS;
1641}
1642
1643DEFUN (no_neighbor_peer_group_remote_as,
1644 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001645 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001646 NO_STR
1647 NEIGHBOR_STR
1648 "Neighbor tag\n"
1649 "Specify a BGP neighbor\n"
1650 AS_STR)
1651{
1652 struct peer_group *group;
1653
1654 group = peer_group_lookup (vty->index, argv[0]);
1655 if (group)
1656 peer_group_remote_as_delete (group);
1657 else
1658 {
1659 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1660 return CMD_WARNING;
1661 }
1662 return CMD_SUCCESS;
1663}
David Lamparter6b0655a2014-06-04 06:53:35 +02001664
paul718e3742002-12-13 20:15:29 +00001665DEFUN (neighbor_local_as,
1666 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001667 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001668 NEIGHBOR_STR
1669 NEIGHBOR_ADDR_STR2
1670 "Specify a local-as number\n"
1671 "AS number used as local AS\n")
1672{
1673 struct peer *peer;
1674 int ret;
1675
1676 peer = peer_and_group_lookup_vty (vty, argv[0]);
1677 if (! peer)
1678 return CMD_WARNING;
1679
Andrew Certain9d3f9702012-11-07 23:50:07 +00001680 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
paul718e3742002-12-13 20:15:29 +00001681 return bgp_vty_return (vty, ret);
1682}
1683
1684DEFUN (neighbor_local_as_no_prepend,
1685 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001686 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001687 NEIGHBOR_STR
1688 NEIGHBOR_ADDR_STR2
1689 "Specify a local-as number\n"
1690 "AS number used as local AS\n"
1691 "Do not prepend local-as to updates from ebgp peers\n")
1692{
1693 struct peer *peer;
1694 int ret;
1695
1696 peer = peer_and_group_lookup_vty (vty, argv[0]);
1697 if (! peer)
1698 return CMD_WARNING;
1699
Andrew Certain9d3f9702012-11-07 23:50:07 +00001700 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
paul718e3742002-12-13 20:15:29 +00001701 return bgp_vty_return (vty, ret);
1702}
1703
Andrew Certain9d3f9702012-11-07 23:50:07 +00001704DEFUN (neighbor_local_as_no_prepend_replace_as,
1705 neighbor_local_as_no_prepend_replace_as_cmd,
1706 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1707 NEIGHBOR_STR
1708 NEIGHBOR_ADDR_STR2
1709 "Specify a local-as number\n"
1710 "AS number used as local AS\n"
1711 "Do not prepend local-as to updates from ebgp peers\n"
1712 "Do not prepend local-as to updates from ibgp peers\n")
1713{
1714 struct peer *peer;
1715 int ret;
1716
1717 peer = peer_and_group_lookup_vty (vty, argv[0]);
1718 if (! peer)
1719 return CMD_WARNING;
1720
1721 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
1722 return bgp_vty_return (vty, ret);
1723}
1724
1725
paul718e3742002-12-13 20:15:29 +00001726DEFUN (no_neighbor_local_as,
1727 no_neighbor_local_as_cmd,
1728 NO_NEIGHBOR_CMD2 "local-as",
1729 NO_STR
1730 NEIGHBOR_STR
1731 NEIGHBOR_ADDR_STR2
1732 "Specify a local-as number\n")
1733{
1734 struct peer *peer;
1735 int ret;
1736
1737 peer = peer_and_group_lookup_vty (vty, argv[0]);
1738 if (! peer)
1739 return CMD_WARNING;
1740
1741 ret = peer_local_as_unset (peer);
1742 return bgp_vty_return (vty, ret);
1743}
1744
1745ALIAS (no_neighbor_local_as,
1746 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001747 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001748 NO_STR
1749 NEIGHBOR_STR
1750 NEIGHBOR_ADDR_STR2
1751 "Specify a local-as number\n"
1752 "AS number used as local AS\n")
1753
1754ALIAS (no_neighbor_local_as,
1755 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001756 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001757 NO_STR
1758 NEIGHBOR_STR
1759 NEIGHBOR_ADDR_STR2
1760 "Specify a local-as number\n"
1761 "AS number used as local AS\n"
1762 "Do not prepend local-as to updates from ebgp peers\n")
Andrew Certain9d3f9702012-11-07 23:50:07 +00001763
1764ALIAS (no_neighbor_local_as,
1765 no_neighbor_local_as_val3_cmd,
1766 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1767 NO_STR
1768 NEIGHBOR_STR
1769 NEIGHBOR_ADDR_STR2
1770 "Specify a local-as number\n"
1771 "AS number used as local AS\n"
1772 "Do not prepend local-as to updates from ebgp peers\n"
1773 "Do not prepend local-as to updates from ibgp peers\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001774
Paul Jakma0df7c912008-07-21 21:02:49 +00001775DEFUN (neighbor_password,
1776 neighbor_password_cmd,
1777 NEIGHBOR_CMD2 "password LINE",
1778 NEIGHBOR_STR
1779 NEIGHBOR_ADDR_STR2
1780 "Set a password\n"
1781 "The password\n")
1782{
1783 struct peer *peer;
1784 int ret;
1785
1786 peer = peer_and_group_lookup_vty (vty, argv[0]);
1787 if (! peer)
1788 return CMD_WARNING;
1789
1790 ret = peer_password_set (peer, argv[1]);
1791 return bgp_vty_return (vty, ret);
1792}
1793
1794DEFUN (no_neighbor_password,
1795 no_neighbor_password_cmd,
1796 NO_NEIGHBOR_CMD2 "password",
1797 NO_STR
1798 NEIGHBOR_STR
1799 NEIGHBOR_ADDR_STR2
1800 "Set a password\n")
1801{
1802 struct peer *peer;
1803 int ret;
1804
1805 peer = peer_and_group_lookup_vty (vty, argv[0]);
1806 if (! peer)
1807 return CMD_WARNING;
1808
1809 ret = peer_password_unset (peer);
1810 return bgp_vty_return (vty, ret);
1811}
David Lamparter6b0655a2014-06-04 06:53:35 +02001812
paul718e3742002-12-13 20:15:29 +00001813DEFUN (neighbor_activate,
1814 neighbor_activate_cmd,
1815 NEIGHBOR_CMD2 "activate",
1816 NEIGHBOR_STR
1817 NEIGHBOR_ADDR_STR2
1818 "Enable the Address Family for this Neighbor\n")
1819{
1820 struct peer *peer;
1821
1822 peer = peer_and_group_lookup_vty (vty, argv[0]);
1823 if (! peer)
1824 return CMD_WARNING;
1825
1826 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1827
1828 return CMD_SUCCESS;
1829}
1830
1831DEFUN (no_neighbor_activate,
1832 no_neighbor_activate_cmd,
1833 NO_NEIGHBOR_CMD2 "activate",
1834 NO_STR
1835 NEIGHBOR_STR
1836 NEIGHBOR_ADDR_STR2
1837 "Enable the Address Family for this Neighbor\n")
1838{
1839 int ret;
1840 struct peer *peer;
1841
1842 /* Lookup peer. */
1843 peer = peer_and_group_lookup_vty (vty, argv[0]);
1844 if (! peer)
1845 return CMD_WARNING;
1846
1847 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1848
1849 return bgp_vty_return (vty, ret);
1850}
David Lamparter6b0655a2014-06-04 06:53:35 +02001851
paul718e3742002-12-13 20:15:29 +00001852DEFUN (neighbor_set_peer_group,
1853 neighbor_set_peer_group_cmd,
1854 NEIGHBOR_CMD "peer-group WORD",
1855 NEIGHBOR_STR
1856 NEIGHBOR_ADDR_STR
1857 "Member of the peer-group\n"
1858 "peer-group name\n")
1859{
1860 int ret;
1861 as_t as;
1862 union sockunion su;
1863 struct bgp *bgp;
1864 struct peer_group *group;
1865
1866 bgp = vty->index;
1867
1868 ret = str2sockunion (argv[0], &su);
1869 if (ret < 0)
1870 {
1871 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1872 return CMD_WARNING;
1873 }
1874
1875 group = peer_group_lookup (bgp, argv[1]);
1876 if (! group)
1877 {
1878 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1879 return CMD_WARNING;
1880 }
1881
1882 if (peer_address_self_check (&su))
1883 {
1884 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1885 VTY_NEWLINE);
1886 return CMD_WARNING;
1887 }
1888
1889 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1890 bgp_node_safi (vty), &as);
1891
1892 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1893 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001894 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 +00001895 return CMD_WARNING;
1896 }
1897
1898 return bgp_vty_return (vty, ret);
1899}
1900
1901DEFUN (no_neighbor_set_peer_group,
1902 no_neighbor_set_peer_group_cmd,
1903 NO_NEIGHBOR_CMD "peer-group WORD",
1904 NO_STR
1905 NEIGHBOR_STR
1906 NEIGHBOR_ADDR_STR
1907 "Member of the peer-group\n"
1908 "peer-group name\n")
1909{
1910 int ret;
1911 struct bgp *bgp;
1912 struct peer *peer;
1913 struct peer_group *group;
1914
1915 bgp = vty->index;
1916
1917 peer = peer_lookup_vty (vty, argv[0]);
1918 if (! peer)
1919 return CMD_WARNING;
1920
1921 group = peer_group_lookup (bgp, argv[1]);
1922 if (! group)
1923 {
1924 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1925 return CMD_WARNING;
1926 }
1927
1928 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1929 bgp_node_safi (vty));
1930
1931 return bgp_vty_return (vty, ret);
1932}
David Lamparter6b0655a2014-06-04 06:53:35 +02001933
paul94f2b392005-06-28 12:44:16 +00001934static int
paulfd79ac92004-10-13 05:06:08 +00001935peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1936 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001937{
1938 int ret;
1939 struct peer *peer;
1940
1941 peer = peer_and_group_lookup_vty (vty, ip_str);
1942 if (! peer)
1943 return CMD_WARNING;
1944
1945 if (set)
1946 ret = peer_flag_set (peer, flag);
1947 else
1948 ret = peer_flag_unset (peer, flag);
1949
1950 return bgp_vty_return (vty, ret);
1951}
1952
paul94f2b392005-06-28 12:44:16 +00001953static int
paulfd79ac92004-10-13 05:06:08 +00001954peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001955{
1956 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1957}
1958
paul94f2b392005-06-28 12:44:16 +00001959static int
paulfd79ac92004-10-13 05:06:08 +00001960peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001961{
1962 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1963}
1964
1965/* neighbor passive. */
1966DEFUN (neighbor_passive,
1967 neighbor_passive_cmd,
1968 NEIGHBOR_CMD2 "passive",
1969 NEIGHBOR_STR
1970 NEIGHBOR_ADDR_STR2
1971 "Don't send open messages to this neighbor\n")
1972{
1973 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1974}
1975
1976DEFUN (no_neighbor_passive,
1977 no_neighbor_passive_cmd,
1978 NO_NEIGHBOR_CMD2 "passive",
1979 NO_STR
1980 NEIGHBOR_STR
1981 NEIGHBOR_ADDR_STR2
1982 "Don't send open messages to this neighbor\n")
1983{
1984 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1985}
David Lamparter6b0655a2014-06-04 06:53:35 +02001986
paul718e3742002-12-13 20:15:29 +00001987/* neighbor shutdown. */
1988DEFUN (neighbor_shutdown,
1989 neighbor_shutdown_cmd,
1990 NEIGHBOR_CMD2 "shutdown",
1991 NEIGHBOR_STR
1992 NEIGHBOR_ADDR_STR2
1993 "Administratively shut down this neighbor\n")
1994{
1995 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1996}
1997
1998DEFUN (no_neighbor_shutdown,
1999 no_neighbor_shutdown_cmd,
2000 NO_NEIGHBOR_CMD2 "shutdown",
2001 NO_STR
2002 NEIGHBOR_STR
2003 NEIGHBOR_ADDR_STR2
2004 "Administratively shut down this neighbor\n")
2005{
2006 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
2007}
David Lamparter6b0655a2014-06-04 06:53:35 +02002008
hassoc9502432005-02-01 22:01:48 +00002009/* Deprecated neighbor capability route-refresh. */
2010DEFUN_DEPRECATED (neighbor_capability_route_refresh,
2011 neighbor_capability_route_refresh_cmd,
2012 NEIGHBOR_CMD2 "capability route-refresh",
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}
2020
hassoc9502432005-02-01 22:01:48 +00002021DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
2022 no_neighbor_capability_route_refresh_cmd,
2023 NO_NEIGHBOR_CMD2 "capability route-refresh",
2024 NO_STR
2025 NEIGHBOR_STR
2026 NEIGHBOR_ADDR_STR2
2027 "Advertise capability to the peer\n"
2028 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002029{
hassoc9502432005-02-01 22:01:48 +00002030 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002031}
David Lamparter6b0655a2014-06-04 06:53:35 +02002032
paul718e3742002-12-13 20:15:29 +00002033/* neighbor capability dynamic. */
2034DEFUN (neighbor_capability_dynamic,
2035 neighbor_capability_dynamic_cmd,
2036 NEIGHBOR_CMD2 "capability dynamic",
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_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2043}
2044
2045DEFUN (no_neighbor_capability_dynamic,
2046 no_neighbor_capability_dynamic_cmd,
2047 NO_NEIGHBOR_CMD2 "capability dynamic",
2048 NO_STR
2049 NEIGHBOR_STR
2050 NEIGHBOR_ADDR_STR2
2051 "Advertise capability to the peer\n"
2052 "Advertise dynamic capability to this neighbor\n")
2053{
2054 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2055}
David Lamparter6b0655a2014-06-04 06:53:35 +02002056
paul718e3742002-12-13 20:15:29 +00002057/* neighbor dont-capability-negotiate */
2058DEFUN (neighbor_dont_capability_negotiate,
2059 neighbor_dont_capability_negotiate_cmd,
2060 NEIGHBOR_CMD2 "dont-capability-negotiate",
2061 NEIGHBOR_STR
2062 NEIGHBOR_ADDR_STR2
2063 "Do not perform capability negotiation\n")
2064{
2065 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2066}
2067
2068DEFUN (no_neighbor_dont_capability_negotiate,
2069 no_neighbor_dont_capability_negotiate_cmd,
2070 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
2071 NO_STR
2072 NEIGHBOR_STR
2073 NEIGHBOR_ADDR_STR2
2074 "Do not perform capability negotiation\n")
2075{
2076 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2077}
David Lamparter6b0655a2014-06-04 06:53:35 +02002078
paul94f2b392005-06-28 12:44:16 +00002079static int
paulfd79ac92004-10-13 05:06:08 +00002080peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002081 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002082{
2083 int ret;
2084 struct peer *peer;
2085
2086 peer = peer_and_group_lookup_vty (vty, peer_str);
2087 if (! peer)
2088 return CMD_WARNING;
2089
2090 if (set)
2091 ret = peer_af_flag_set (peer, afi, safi, flag);
2092 else
2093 ret = peer_af_flag_unset (peer, afi, safi, flag);
2094
2095 return bgp_vty_return (vty, ret);
2096}
2097
paul94f2b392005-06-28 12:44:16 +00002098static int
paulfd79ac92004-10-13 05:06:08 +00002099peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002100 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002101{
2102 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
2103}
2104
paul94f2b392005-06-28 12:44:16 +00002105static int
paulfd79ac92004-10-13 05:06:08 +00002106peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002107 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002108{
2109 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
2110}
David Lamparter6b0655a2014-06-04 06:53:35 +02002111
paul718e3742002-12-13 20:15:29 +00002112/* neighbor capability orf prefix-list. */
2113DEFUN (neighbor_capability_orf_prefix,
2114 neighbor_capability_orf_prefix_cmd,
2115 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2116 NEIGHBOR_STR
2117 NEIGHBOR_ADDR_STR2
2118 "Advertise capability to the peer\n"
2119 "Advertise ORF capability to the peer\n"
2120 "Advertise prefixlist ORF capability to this neighbor\n"
2121 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2122 "Capability to RECEIVE the ORF from this neighbor\n"
2123 "Capability to SEND the ORF to this neighbor\n")
2124{
2125 u_int16_t flag = 0;
2126
2127 if (strncmp (argv[1], "s", 1) == 0)
2128 flag = PEER_FLAG_ORF_PREFIX_SM;
2129 else if (strncmp (argv[1], "r", 1) == 0)
2130 flag = PEER_FLAG_ORF_PREFIX_RM;
2131 else if (strncmp (argv[1], "b", 1) == 0)
2132 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2133 else
2134 return CMD_WARNING;
2135
2136 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2137 bgp_node_safi (vty), flag);
2138}
2139
2140DEFUN (no_neighbor_capability_orf_prefix,
2141 no_neighbor_capability_orf_prefix_cmd,
2142 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2143 NO_STR
2144 NEIGHBOR_STR
2145 NEIGHBOR_ADDR_STR2
2146 "Advertise capability to the peer\n"
2147 "Advertise ORF capability to the peer\n"
2148 "Advertise prefixlist ORF capability to this neighbor\n"
2149 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2150 "Capability to RECEIVE the ORF from this neighbor\n"
2151 "Capability to SEND the ORF to this neighbor\n")
2152{
2153 u_int16_t flag = 0;
2154
2155 if (strncmp (argv[1], "s", 1) == 0)
2156 flag = PEER_FLAG_ORF_PREFIX_SM;
2157 else if (strncmp (argv[1], "r", 1) == 0)
2158 flag = PEER_FLAG_ORF_PREFIX_RM;
2159 else if (strncmp (argv[1], "b", 1) == 0)
2160 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2161 else
2162 return CMD_WARNING;
2163
2164 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2165 bgp_node_safi (vty), flag);
2166}
David Lamparter6b0655a2014-06-04 06:53:35 +02002167
paul718e3742002-12-13 20:15:29 +00002168/* neighbor next-hop-self. */
2169DEFUN (neighbor_nexthop_self,
2170 neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002171 NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002172 NEIGHBOR_STR
2173 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002174 "Disable the next hop calculation for this neighbor\n"
2175 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002176{
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002177 u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
2178 int rc;
2179
2180 /* Check if "all" is specified */
2181 if (argv[1] != NULL)
2182 flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
2183 else
2184 unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
2185
2186 rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2187 bgp_node_safi (vty), flags);
2188 if ( rc == CMD_SUCCESS && unset )
2189 rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2190 bgp_node_safi (vty), unset);
2191 return rc;
paul718e3742002-12-13 20:15:29 +00002192}
2193
2194DEFUN (no_neighbor_nexthop_self,
2195 no_neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002196 NO_NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002197 NO_STR
2198 NEIGHBOR_STR
2199 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002200 "Disable the next hop calculation for this neighbor\n"
2201 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002202{
2203 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002204 bgp_node_safi (vty),
2205 PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
paul718e3742002-12-13 20:15:29 +00002206}
David Lamparter6b0655a2014-06-04 06:53:35 +02002207
paul718e3742002-12-13 20:15:29 +00002208/* neighbor remove-private-AS. */
2209DEFUN (neighbor_remove_private_as,
2210 neighbor_remove_private_as_cmd,
2211 NEIGHBOR_CMD2 "remove-private-AS",
2212 NEIGHBOR_STR
2213 NEIGHBOR_ADDR_STR2
2214 "Remove private AS number from outbound updates\n")
2215{
2216 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2217 bgp_node_safi (vty),
2218 PEER_FLAG_REMOVE_PRIVATE_AS);
2219}
2220
2221DEFUN (no_neighbor_remove_private_as,
2222 no_neighbor_remove_private_as_cmd,
2223 NO_NEIGHBOR_CMD2 "remove-private-AS",
2224 NO_STR
2225 NEIGHBOR_STR
2226 NEIGHBOR_ADDR_STR2
2227 "Remove private AS number from outbound updates\n")
2228{
2229 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2230 bgp_node_safi (vty),
2231 PEER_FLAG_REMOVE_PRIVATE_AS);
2232}
David Lamparter6b0655a2014-06-04 06:53:35 +02002233
paul718e3742002-12-13 20:15:29 +00002234/* neighbor send-community. */
2235DEFUN (neighbor_send_community,
2236 neighbor_send_community_cmd,
2237 NEIGHBOR_CMD2 "send-community",
2238 NEIGHBOR_STR
2239 NEIGHBOR_ADDR_STR2
2240 "Send Community attribute to this neighbor\n")
2241{
2242 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2243 bgp_node_safi (vty),
2244 PEER_FLAG_SEND_COMMUNITY);
2245}
2246
2247DEFUN (no_neighbor_send_community,
2248 no_neighbor_send_community_cmd,
2249 NO_NEIGHBOR_CMD2 "send-community",
2250 NO_STR
2251 NEIGHBOR_STR
2252 NEIGHBOR_ADDR_STR2
2253 "Send Community attribute to this neighbor\n")
2254{
2255 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2256 bgp_node_safi (vty),
2257 PEER_FLAG_SEND_COMMUNITY);
2258}
David Lamparter6b0655a2014-06-04 06:53:35 +02002259
paul718e3742002-12-13 20:15:29 +00002260/* neighbor send-community extended. */
2261DEFUN (neighbor_send_community_type,
2262 neighbor_send_community_type_cmd,
2263 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2264 NEIGHBOR_STR
2265 NEIGHBOR_ADDR_STR2
2266 "Send Community attribute to this neighbor\n"
2267 "Send Standard and Extended Community attributes\n"
2268 "Send Extended Community attributes\n"
2269 "Send Standard Community attributes\n")
2270{
2271 if (strncmp (argv[1], "s", 1) == 0)
2272 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2273 bgp_node_safi (vty),
2274 PEER_FLAG_SEND_COMMUNITY);
2275 if (strncmp (argv[1], "e", 1) == 0)
2276 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2277 bgp_node_safi (vty),
2278 PEER_FLAG_SEND_EXT_COMMUNITY);
2279
2280 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2281 bgp_node_safi (vty),
2282 (PEER_FLAG_SEND_COMMUNITY|
2283 PEER_FLAG_SEND_EXT_COMMUNITY));
2284}
2285
2286DEFUN (no_neighbor_send_community_type,
2287 no_neighbor_send_community_type_cmd,
2288 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2289 NO_STR
2290 NEIGHBOR_STR
2291 NEIGHBOR_ADDR_STR2
2292 "Send Community attribute to this neighbor\n"
2293 "Send Standard and Extended Community attributes\n"
2294 "Send Extended Community attributes\n"
2295 "Send Standard Community attributes\n")
2296{
2297 if (strncmp (argv[1], "s", 1) == 0)
2298 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2299 bgp_node_safi (vty),
2300 PEER_FLAG_SEND_COMMUNITY);
2301 if (strncmp (argv[1], "e", 1) == 0)
2302 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2303 bgp_node_safi (vty),
2304 PEER_FLAG_SEND_EXT_COMMUNITY);
2305
2306 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2307 bgp_node_safi (vty),
2308 (PEER_FLAG_SEND_COMMUNITY |
2309 PEER_FLAG_SEND_EXT_COMMUNITY));
2310}
David Lamparter6b0655a2014-06-04 06:53:35 +02002311
paul718e3742002-12-13 20:15:29 +00002312/* neighbor soft-reconfig. */
2313DEFUN (neighbor_soft_reconfiguration,
2314 neighbor_soft_reconfiguration_cmd,
2315 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2316 NEIGHBOR_STR
2317 NEIGHBOR_ADDR_STR2
2318 "Per neighbor soft reconfiguration\n"
2319 "Allow inbound soft reconfiguration for this neighbor\n")
2320{
2321 return peer_af_flag_set_vty (vty, argv[0],
2322 bgp_node_afi (vty), bgp_node_safi (vty),
2323 PEER_FLAG_SOFT_RECONFIG);
2324}
2325
2326DEFUN (no_neighbor_soft_reconfiguration,
2327 no_neighbor_soft_reconfiguration_cmd,
2328 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2329 NO_STR
2330 NEIGHBOR_STR
2331 NEIGHBOR_ADDR_STR2
2332 "Per neighbor soft reconfiguration\n"
2333 "Allow inbound soft reconfiguration for this neighbor\n")
2334{
2335 return peer_af_flag_unset_vty (vty, argv[0],
2336 bgp_node_afi (vty), bgp_node_safi (vty),
2337 PEER_FLAG_SOFT_RECONFIG);
2338}
David Lamparter6b0655a2014-06-04 06:53:35 +02002339
paul718e3742002-12-13 20:15:29 +00002340DEFUN (neighbor_route_reflector_client,
2341 neighbor_route_reflector_client_cmd,
2342 NEIGHBOR_CMD2 "route-reflector-client",
2343 NEIGHBOR_STR
2344 NEIGHBOR_ADDR_STR2
2345 "Configure a neighbor as Route Reflector client\n")
2346{
2347 struct peer *peer;
2348
2349
2350 peer = peer_and_group_lookup_vty (vty, argv[0]);
2351 if (! peer)
2352 return CMD_WARNING;
2353
2354 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2355 bgp_node_safi (vty),
2356 PEER_FLAG_REFLECTOR_CLIENT);
2357}
2358
2359DEFUN (no_neighbor_route_reflector_client,
2360 no_neighbor_route_reflector_client_cmd,
2361 NO_NEIGHBOR_CMD2 "route-reflector-client",
2362 NO_STR
2363 NEIGHBOR_STR
2364 NEIGHBOR_ADDR_STR2
2365 "Configure a neighbor as Route Reflector client\n")
2366{
2367 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2368 bgp_node_safi (vty),
2369 PEER_FLAG_REFLECTOR_CLIENT);
2370}
David Lamparter6b0655a2014-06-04 06:53:35 +02002371
paul94f2b392005-06-28 12:44:16 +00002372static int
paulfd79ac92004-10-13 05:06:08 +00002373peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2374 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002375{
2376 int ret;
2377 struct bgp *bgp;
2378 struct peer *peer;
2379 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002380 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002381 struct bgp_filter *pfilter;
2382 struct bgp_filter *gfilter;
Chris Caputo228da422009-07-18 05:44:03 +00002383 int locked_and_added = 0;
paulfee0f4c2004-09-13 05:12:46 +00002384
2385 bgp = vty->index;
2386
2387 peer = peer_and_group_lookup_vty (vty, peer_str);
2388 if ( ! peer )
2389 return CMD_WARNING;
2390
2391 /* If it is already a RS-Client, don't do anything. */
2392 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2393 return CMD_SUCCESS;
2394
2395 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002396 {
2397 peer = peer_lock (peer); /* rsclient peer list reference */
2398 listnode_add_sort (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002399 locked_and_added = 1;
paul200df112005-06-01 11:17:05 +00002400 }
paulfee0f4c2004-09-13 05:12:46 +00002401
2402 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2403 if (ret < 0)
Chris Caputo228da422009-07-18 05:44:03 +00002404 {
2405 if (locked_and_added)
2406 {
2407 listnode_delete (bgp->rsclient, peer);
2408 peer_unlock (peer); /* rsclient peer list reference */
2409 }
2410
2411 return bgp_vty_return (vty, ret);
2412 }
paulfee0f4c2004-09-13 05:12:46 +00002413
Paul Jakma64e580a2006-02-21 01:09:01 +00002414 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002415 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
Chris Caputo228da422009-07-18 05:44:03 +00002416 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2417 peer->rib[afi][safi]->owner = peer_lock (peer);
paulfee0f4c2004-09-13 05:12:46 +00002418
2419 /* Check for existing 'network' and 'redistribute' routes. */
2420 bgp_check_local_routes_rsclient (peer, afi, safi);
2421
2422 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2423 bgp_soft_reconfig_rsclient (peer, afi, safi);
2424
2425 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2426 {
2427 group = peer->group;
2428 gfilter = &peer->filter[afi][safi];
2429
paul1eb8ef22005-04-07 07:30:20 +00002430 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002431 {
2432 pfilter = &peer->filter[afi][safi];
2433
2434 /* Members of a non-RS-Client group should not be RS-Clients, as that
2435 is checked when the become part of the peer-group */
2436 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2437 if (ret < 0)
2438 return bgp_vty_return (vty, ret);
2439
2440 /* Make peer's RIB point to group's RIB. */
2441 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2442
2443 /* Import policy. */
2444 if (pfilter->map[RMAP_IMPORT].name)
2445 free (pfilter->map[RMAP_IMPORT].name);
2446 if (gfilter->map[RMAP_IMPORT].name)
2447 {
2448 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2449 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2450 }
2451 else
2452 {
2453 pfilter->map[RMAP_IMPORT].name = NULL;
2454 pfilter->map[RMAP_IMPORT].map =NULL;
2455 }
2456
2457 /* Export policy. */
2458 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2459 {
2460 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2461 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2462 }
2463 }
2464 }
2465 return CMD_SUCCESS;
2466}
2467
paul94f2b392005-06-28 12:44:16 +00002468static int
paulfd79ac92004-10-13 05:06:08 +00002469peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2470 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002471{
2472 int ret;
2473 struct bgp *bgp;
2474 struct peer *peer;
2475 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002476 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002477
2478 bgp = vty->index;
2479
2480 peer = peer_and_group_lookup_vty (vty, peer_str);
2481 if ( ! peer )
2482 return CMD_WARNING;
2483
2484 /* If it is not a RS-Client, don't do anything. */
2485 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2486 return CMD_SUCCESS;
2487
2488 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2489 {
2490 group = peer->group;
2491
paul1eb8ef22005-04-07 07:30:20 +00002492 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002493 {
2494 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2495 if (ret < 0)
2496 return bgp_vty_return (vty, ret);
2497
2498 peer->rib[afi][safi] = NULL;
2499 }
2500
2501 peer = group->conf;
2502 }
2503
2504 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2505 if (ret < 0)
2506 return bgp_vty_return (vty, ret);
2507
2508 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002509 {
Chris Caputo228da422009-07-18 05:44:03 +00002510 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
paul200df112005-06-01 11:17:05 +00002511 listnode_delete (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002512 peer_unlock (peer); /* peer bgp rsclient reference */
paul200df112005-06-01 11:17:05 +00002513 }
paulfee0f4c2004-09-13 05:12:46 +00002514
Paul Jakmab608d5b2008-07-02 02:12:07 +00002515 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002516
2517 return CMD_SUCCESS;
2518}
David Lamparter6b0655a2014-06-04 06:53:35 +02002519
paul718e3742002-12-13 20:15:29 +00002520/* neighbor route-server-client. */
2521DEFUN (neighbor_route_server_client,
2522 neighbor_route_server_client_cmd,
2523 NEIGHBOR_CMD2 "route-server-client",
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_set_vty (vty, argv[0], bgp_node_afi(vty),
2529 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002530}
2531
2532DEFUN (no_neighbor_route_server_client,
2533 no_neighbor_route_server_client_cmd,
2534 NO_NEIGHBOR_CMD2 "route-server-client",
2535 NO_STR
2536 NEIGHBOR_STR
2537 NEIGHBOR_ADDR_STR2
2538 "Configure a neighbor as Route Server client\n")
2539{
paulfee0f4c2004-09-13 05:12:46 +00002540 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2541 bgp_node_safi(vty));
2542}
David Lamparter6b0655a2014-06-04 06:53:35 +02002543
paulfee0f4c2004-09-13 05:12:46 +00002544DEFUN (neighbor_nexthop_local_unchanged,
2545 neighbor_nexthop_local_unchanged_cmd,
2546 NEIGHBOR_CMD2 "nexthop-local unchanged",
2547 NEIGHBOR_STR
2548 NEIGHBOR_ADDR_STR2
2549 "Configure treatment of outgoing link-local nexthop attribute\n"
2550 "Leave link-local nexthop unchanged for this peer\n")
2551{
2552 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2553 bgp_node_safi (vty),
2554 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2555}
David Lamparter6b0655a2014-06-04 06:53:35 +02002556
paulfee0f4c2004-09-13 05:12:46 +00002557DEFUN (no_neighbor_nexthop_local_unchanged,
2558 no_neighbor_nexthop_local_unchanged_cmd,
2559 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2560 NO_STR
2561 NEIGHBOR_STR
2562 NEIGHBOR_ADDR_STR2
2563 "Configure treatment of outgoing link-local-nexthop attribute\n"
2564 "Leave link-local nexthop unchanged for this peer\n")
2565{
paul718e3742002-12-13 20:15:29 +00002566 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2567 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002568 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002569}
David Lamparter6b0655a2014-06-04 06:53:35 +02002570
paul718e3742002-12-13 20:15:29 +00002571DEFUN (neighbor_attr_unchanged,
2572 neighbor_attr_unchanged_cmd,
2573 NEIGHBOR_CMD2 "attribute-unchanged",
2574 NEIGHBOR_STR
2575 NEIGHBOR_ADDR_STR2
2576 "BGP attribute is propagated unchanged to this neighbor\n")
2577{
2578 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2579 bgp_node_safi (vty),
2580 (PEER_FLAG_AS_PATH_UNCHANGED |
2581 PEER_FLAG_NEXTHOP_UNCHANGED |
2582 PEER_FLAG_MED_UNCHANGED));
2583}
2584
2585DEFUN (neighbor_attr_unchanged1,
2586 neighbor_attr_unchanged1_cmd,
2587 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2588 NEIGHBOR_STR
2589 NEIGHBOR_ADDR_STR2
2590 "BGP attribute is propagated unchanged to this neighbor\n"
2591 "As-path attribute\n"
2592 "Nexthop attribute\n"
2593 "Med attribute\n")
2594{
2595 u_int16_t flags = 0;
2596
2597 if (strncmp (argv[1], "as-path", 1) == 0)
2598 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2599 else if (strncmp (argv[1], "next-hop", 1) == 0)
2600 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2601 else if (strncmp (argv[1], "med", 1) == 0)
2602 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2603
2604 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2605 bgp_node_safi (vty), flags);
2606}
2607
2608DEFUN (neighbor_attr_unchanged2,
2609 neighbor_attr_unchanged2_cmd,
2610 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2611 NEIGHBOR_STR
2612 NEIGHBOR_ADDR_STR2
2613 "BGP attribute is propagated unchanged to this neighbor\n"
2614 "As-path attribute\n"
2615 "Nexthop attribute\n"
2616 "Med attribute\n")
2617{
2618 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2619
2620 if (strncmp (argv[1], "next-hop", 1) == 0)
2621 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2622 else if (strncmp (argv[1], "med", 1) == 0)
2623 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2624
2625 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2626 bgp_node_safi (vty), flags);
2627
2628}
2629
2630DEFUN (neighbor_attr_unchanged3,
2631 neighbor_attr_unchanged3_cmd,
2632 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2633 NEIGHBOR_STR
2634 NEIGHBOR_ADDR_STR2
2635 "BGP attribute is propagated unchanged to this neighbor\n"
2636 "Nexthop attribute\n"
2637 "As-path attribute\n"
2638 "Med attribute\n")
2639{
2640 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2641
2642 if (strncmp (argv[1], "as-path", 1) == 0)
2643 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2644 else if (strncmp (argv[1], "med", 1) == 0)
2645 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2646
2647 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2648 bgp_node_safi (vty), flags);
2649}
2650
2651DEFUN (neighbor_attr_unchanged4,
2652 neighbor_attr_unchanged4_cmd,
2653 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2654 NEIGHBOR_STR
2655 NEIGHBOR_ADDR_STR2
2656 "BGP attribute is propagated unchanged to this neighbor\n"
2657 "Med attribute\n"
2658 "As-path attribute\n"
2659 "Nexthop attribute\n")
2660{
2661 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2662
2663 if (strncmp (argv[1], "as-path", 1) == 0)
2664 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2665 else if (strncmp (argv[1], "next-hop", 1) == 0)
2666 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2667
2668 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2669 bgp_node_safi (vty), flags);
2670}
2671
2672ALIAS (neighbor_attr_unchanged,
2673 neighbor_attr_unchanged5_cmd,
2674 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2675 NEIGHBOR_STR
2676 NEIGHBOR_ADDR_STR2
2677 "BGP attribute is propagated unchanged to this neighbor\n"
2678 "As-path attribute\n"
2679 "Nexthop attribute\n"
2680 "Med attribute\n")
2681
2682ALIAS (neighbor_attr_unchanged,
2683 neighbor_attr_unchanged6_cmd,
2684 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2685 NEIGHBOR_STR
2686 NEIGHBOR_ADDR_STR2
2687 "BGP attribute is propagated unchanged to this neighbor\n"
2688 "As-path attribute\n"
2689 "Med attribute\n"
2690 "Nexthop attribute\n")
2691
2692ALIAS (neighbor_attr_unchanged,
2693 neighbor_attr_unchanged7_cmd,
2694 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2695 NEIGHBOR_STR
2696 NEIGHBOR_ADDR_STR2
2697 "BGP attribute is propagated unchanged to this neighbor\n"
2698 "Nexthop attribute\n"
2699 "Med attribute\n"
2700 "As-path attribute\n")
2701
2702ALIAS (neighbor_attr_unchanged,
2703 neighbor_attr_unchanged8_cmd,
2704 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2705 NEIGHBOR_STR
2706 NEIGHBOR_ADDR_STR2
2707 "BGP attribute is propagated unchanged to this neighbor\n"
2708 "Nexthop attribute\n"
2709 "As-path attribute\n"
2710 "Med attribute\n")
2711
2712ALIAS (neighbor_attr_unchanged,
2713 neighbor_attr_unchanged9_cmd,
2714 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2715 NEIGHBOR_STR
2716 NEIGHBOR_ADDR_STR2
2717 "BGP attribute is propagated unchanged to this neighbor\n"
2718 "Med attribute\n"
2719 "Nexthop attribute\n"
2720 "As-path attribute\n")
2721
2722ALIAS (neighbor_attr_unchanged,
2723 neighbor_attr_unchanged10_cmd,
2724 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2725 NEIGHBOR_STR
2726 NEIGHBOR_ADDR_STR2
2727 "BGP attribute is propagated unchanged to this neighbor\n"
2728 "Med attribute\n"
2729 "As-path attribute\n"
2730 "Nexthop attribute\n")
2731
2732DEFUN (no_neighbor_attr_unchanged,
2733 no_neighbor_attr_unchanged_cmd,
2734 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2735 NO_STR
2736 NEIGHBOR_STR
2737 NEIGHBOR_ADDR_STR2
2738 "BGP attribute is propagated unchanged to this neighbor\n")
2739{
2740 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2741 bgp_node_safi (vty),
2742 (PEER_FLAG_AS_PATH_UNCHANGED |
2743 PEER_FLAG_NEXTHOP_UNCHANGED |
2744 PEER_FLAG_MED_UNCHANGED));
2745}
2746
2747DEFUN (no_neighbor_attr_unchanged1,
2748 no_neighbor_attr_unchanged1_cmd,
2749 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2750 NO_STR
2751 NEIGHBOR_STR
2752 NEIGHBOR_ADDR_STR2
2753 "BGP attribute is propagated unchanged to this neighbor\n"
2754 "As-path attribute\n"
2755 "Nexthop attribute\n"
2756 "Med attribute\n")
2757{
2758 u_int16_t flags = 0;
2759
2760 if (strncmp (argv[1], "as-path", 1) == 0)
2761 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2762 else if (strncmp (argv[1], "next-hop", 1) == 0)
2763 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2764 else if (strncmp (argv[1], "med", 1) == 0)
2765 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2766
2767 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2768 bgp_node_safi (vty), flags);
2769}
2770
2771DEFUN (no_neighbor_attr_unchanged2,
2772 no_neighbor_attr_unchanged2_cmd,
2773 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2774 NO_STR
2775 NEIGHBOR_STR
2776 NEIGHBOR_ADDR_STR2
2777 "BGP attribute is propagated unchanged to this neighbor\n"
2778 "As-path attribute\n"
2779 "Nexthop attribute\n"
2780 "Med attribute\n")
2781{
2782 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2783
2784 if (strncmp (argv[1], "next-hop", 1) == 0)
2785 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2786 else if (strncmp (argv[1], "med", 1) == 0)
2787 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2788
2789 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2790 bgp_node_safi (vty), flags);
2791}
2792
2793DEFUN (no_neighbor_attr_unchanged3,
2794 no_neighbor_attr_unchanged3_cmd,
2795 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2796 NO_STR
2797 NEIGHBOR_STR
2798 NEIGHBOR_ADDR_STR2
2799 "BGP attribute is propagated unchanged to this neighbor\n"
2800 "Nexthop attribute\n"
2801 "As-path attribute\n"
2802 "Med attribute\n")
2803{
2804 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2805
2806 if (strncmp (argv[1], "as-path", 1) == 0)
2807 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2808 else if (strncmp (argv[1], "med", 1) == 0)
2809 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2810
2811 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2812 bgp_node_safi (vty), flags);
2813}
2814
2815DEFUN (no_neighbor_attr_unchanged4,
2816 no_neighbor_attr_unchanged4_cmd,
2817 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2818 NO_STR
2819 NEIGHBOR_STR
2820 NEIGHBOR_ADDR_STR2
2821 "BGP attribute is propagated unchanged to this neighbor\n"
2822 "Med attribute\n"
2823 "As-path attribute\n"
2824 "Nexthop attribute\n")
2825{
2826 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2827
2828 if (strncmp (argv[1], "as-path", 1) == 0)
2829 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2830 else if (strncmp (argv[1], "next-hop", 1) == 0)
2831 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2832
2833 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2834 bgp_node_safi (vty), flags);
2835}
2836
2837ALIAS (no_neighbor_attr_unchanged,
2838 no_neighbor_attr_unchanged5_cmd,
2839 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2840 NO_STR
2841 NEIGHBOR_STR
2842 NEIGHBOR_ADDR_STR2
2843 "BGP attribute is propagated unchanged to this neighbor\n"
2844 "As-path attribute\n"
2845 "Nexthop attribute\n"
2846 "Med attribute\n")
2847
2848ALIAS (no_neighbor_attr_unchanged,
2849 no_neighbor_attr_unchanged6_cmd,
2850 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2851 NO_STR
2852 NEIGHBOR_STR
2853 NEIGHBOR_ADDR_STR2
2854 "BGP attribute is propagated unchanged to this neighbor\n"
2855 "As-path attribute\n"
2856 "Med attribute\n"
2857 "Nexthop attribute\n")
2858
2859ALIAS (no_neighbor_attr_unchanged,
2860 no_neighbor_attr_unchanged7_cmd,
2861 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2862 NO_STR
2863 NEIGHBOR_STR
2864 NEIGHBOR_ADDR_STR2
2865 "BGP attribute is propagated unchanged to this neighbor\n"
2866 "Nexthop attribute\n"
2867 "Med attribute\n"
2868 "As-path attribute\n")
2869
2870ALIAS (no_neighbor_attr_unchanged,
2871 no_neighbor_attr_unchanged8_cmd,
2872 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2873 NO_STR
2874 NEIGHBOR_STR
2875 NEIGHBOR_ADDR_STR2
2876 "BGP attribute is propagated unchanged to this neighbor\n"
2877 "Nexthop attribute\n"
2878 "As-path attribute\n"
2879 "Med attribute\n")
2880
2881ALIAS (no_neighbor_attr_unchanged,
2882 no_neighbor_attr_unchanged9_cmd,
2883 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2884 NO_STR
2885 NEIGHBOR_STR
2886 NEIGHBOR_ADDR_STR2
2887 "BGP attribute is propagated unchanged to this neighbor\n"
2888 "Med attribute\n"
2889 "Nexthop attribute\n"
2890 "As-path attribute\n")
2891
2892ALIAS (no_neighbor_attr_unchanged,
2893 no_neighbor_attr_unchanged10_cmd,
2894 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2895 NO_STR
2896 NEIGHBOR_STR
2897 NEIGHBOR_ADDR_STR2
2898 "BGP attribute is propagated unchanged to this neighbor\n"
2899 "Med attribute\n"
2900 "As-path attribute\n"
2901 "Nexthop attribute\n")
2902
2903/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002904DEFUN_DEPRECATED (neighbor_transparent_as,
2905 neighbor_transparent_as_cmd,
2906 NEIGHBOR_CMD "transparent-as",
2907 NEIGHBOR_STR
2908 NEIGHBOR_ADDR_STR
2909 "Do not append my AS number 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_AS_PATH_UNCHANGED);
2914}
2915
hassodd4c5932005-02-02 17:15:34 +00002916DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2917 neighbor_transparent_nexthop_cmd,
2918 NEIGHBOR_CMD "transparent-nexthop",
2919 NEIGHBOR_STR
2920 NEIGHBOR_ADDR_STR
2921 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002922{
2923 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2924 bgp_node_safi (vty),
2925 PEER_FLAG_NEXTHOP_UNCHANGED);
2926}
David Lamparter6b0655a2014-06-04 06:53:35 +02002927
paul718e3742002-12-13 20:15:29 +00002928/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00002929static int
paulfd79ac92004-10-13 05:06:08 +00002930peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2931 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002932{
2933 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002934 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002935
2936 peer = peer_and_group_lookup_vty (vty, ip_str);
2937 if (! peer)
2938 return CMD_WARNING;
2939
2940 if (! ttl_str)
2941 ttl = TTL_MAX;
2942 else
2943 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2944
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002945 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
paul718e3742002-12-13 20:15:29 +00002946}
2947
paul94f2b392005-06-28 12:44:16 +00002948static int
paulfd79ac92004-10-13 05:06:08 +00002949peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002950{
2951 struct peer *peer;
2952
2953 peer = peer_and_group_lookup_vty (vty, ip_str);
2954 if (! peer)
2955 return CMD_WARNING;
2956
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002957 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
paul718e3742002-12-13 20:15:29 +00002958}
2959
2960/* neighbor ebgp-multihop. */
2961DEFUN (neighbor_ebgp_multihop,
2962 neighbor_ebgp_multihop_cmd,
2963 NEIGHBOR_CMD2 "ebgp-multihop",
2964 NEIGHBOR_STR
2965 NEIGHBOR_ADDR_STR2
2966 "Allow EBGP neighbors not on directly connected networks\n")
2967{
2968 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2969}
2970
2971DEFUN (neighbor_ebgp_multihop_ttl,
2972 neighbor_ebgp_multihop_ttl_cmd,
2973 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2974 NEIGHBOR_STR
2975 NEIGHBOR_ADDR_STR2
2976 "Allow EBGP neighbors not on directly connected networks\n"
2977 "maximum hop count\n")
2978{
2979 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
2980}
2981
2982DEFUN (no_neighbor_ebgp_multihop,
2983 no_neighbor_ebgp_multihop_cmd,
2984 NO_NEIGHBOR_CMD2 "ebgp-multihop",
2985 NO_STR
2986 NEIGHBOR_STR
2987 NEIGHBOR_ADDR_STR2
2988 "Allow EBGP neighbors not on directly connected networks\n")
2989{
2990 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
2991}
2992
2993ALIAS (no_neighbor_ebgp_multihop,
2994 no_neighbor_ebgp_multihop_ttl_cmd,
2995 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2996 NO_STR
2997 NEIGHBOR_STR
2998 NEIGHBOR_ADDR_STR2
2999 "Allow EBGP neighbors not on directly connected networks\n"
3000 "maximum hop count\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003001
hasso6ffd2072005-02-02 14:50:11 +00003002/* disable-connected-check */
3003DEFUN (neighbor_disable_connected_check,
3004 neighbor_disable_connected_check_cmd,
3005 NEIGHBOR_CMD2 "disable-connected-check",
3006 NEIGHBOR_STR
3007 NEIGHBOR_ADDR_STR2
3008 "one-hop away EBGP peer using loopback address\n")
3009{
3010 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3011}
3012
3013DEFUN (no_neighbor_disable_connected_check,
3014 no_neighbor_disable_connected_check_cmd,
3015 NO_NEIGHBOR_CMD2 "disable-connected-check",
3016 NO_STR
3017 NEIGHBOR_STR
3018 NEIGHBOR_ADDR_STR2
3019 "one-hop away EBGP peer using loopback address\n")
3020{
3021 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3022}
3023
paul718e3742002-12-13 20:15:29 +00003024/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00003025ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003026 neighbor_enforce_multihop_cmd,
3027 NEIGHBOR_CMD2 "enforce-multihop",
3028 NEIGHBOR_STR
3029 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003030 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00003031
hasso6ffd2072005-02-02 14:50:11 +00003032/* Enforce multihop. */
3033ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003034 no_neighbor_enforce_multihop_cmd,
3035 NO_NEIGHBOR_CMD2 "enforce-multihop",
3036 NO_STR
3037 NEIGHBOR_STR
3038 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003039 "Enforce EBGP neighbors perform multihop\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003040
paul718e3742002-12-13 20:15:29 +00003041DEFUN (neighbor_description,
3042 neighbor_description_cmd,
3043 NEIGHBOR_CMD2 "description .LINE",
3044 NEIGHBOR_STR
3045 NEIGHBOR_ADDR_STR2
3046 "Neighbor specific description\n"
3047 "Up to 80 characters describing this neighbor\n")
3048{
3049 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003050 char *str;
paul718e3742002-12-13 20:15:29 +00003051
3052 peer = peer_and_group_lookup_vty (vty, argv[0]);
3053 if (! peer)
3054 return CMD_WARNING;
3055
3056 if (argc == 1)
3057 return CMD_SUCCESS;
3058
ajs3b8b1852005-01-29 18:19:13 +00003059 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00003060
3061 peer_description_set (peer, str);
3062
ajs3b8b1852005-01-29 18:19:13 +00003063 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00003064
3065 return CMD_SUCCESS;
3066}
3067
3068DEFUN (no_neighbor_description,
3069 no_neighbor_description_cmd,
3070 NO_NEIGHBOR_CMD2 "description",
3071 NO_STR
3072 NEIGHBOR_STR
3073 NEIGHBOR_ADDR_STR2
3074 "Neighbor specific description\n")
3075{
3076 struct peer *peer;
3077
3078 peer = peer_and_group_lookup_vty (vty, argv[0]);
3079 if (! peer)
3080 return CMD_WARNING;
3081
3082 peer_description_unset (peer);
3083
3084 return CMD_SUCCESS;
3085}
3086
3087ALIAS (no_neighbor_description,
3088 no_neighbor_description_val_cmd,
3089 NO_NEIGHBOR_CMD2 "description .LINE",
3090 NO_STR
3091 NEIGHBOR_STR
3092 NEIGHBOR_ADDR_STR2
3093 "Neighbor specific description\n"
3094 "Up to 80 characters describing this neighbor\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003095
paul718e3742002-12-13 20:15:29 +00003096/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00003097static int
paulfd79ac92004-10-13 05:06:08 +00003098peer_update_source_vty (struct vty *vty, const char *peer_str,
3099 const char *source_str)
paul718e3742002-12-13 20:15:29 +00003100{
3101 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003102
3103 peer = peer_and_group_lookup_vty (vty, peer_str);
3104 if (! peer)
3105 return CMD_WARNING;
3106
3107 if (source_str)
3108 {
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +02003109 union sockunion su;
3110 int ret = str2sockunion (source_str, &su);
3111
3112 if (ret == 0)
3113 peer_update_source_addr_set (peer, &su);
paul718e3742002-12-13 20:15:29 +00003114 else
3115 peer_update_source_if_set (peer, source_str);
3116 }
3117 else
3118 peer_update_source_unset (peer);
3119
3120 return CMD_SUCCESS;
3121}
3122
Paul Jakma9a1a3312009-07-27 12:27:55 +01003123#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
Paul Jakma369688c2006-05-23 22:27:55 +00003124#define BGP_UPDATE_SOURCE_HELP_STR \
3125 "IPv4 address\n" \
Paul Jakma9a1a3312009-07-27 12:27:55 +01003126 "IPv6 address\n" \
3127 "Interface name (requires zebra to be running)\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003128
paul718e3742002-12-13 20:15:29 +00003129DEFUN (neighbor_update_source,
3130 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00003131 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00003132 NEIGHBOR_STR
3133 NEIGHBOR_ADDR_STR2
3134 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003135 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00003136{
3137 return peer_update_source_vty (vty, argv[0], argv[1]);
3138}
3139
3140DEFUN (no_neighbor_update_source,
3141 no_neighbor_update_source_cmd,
3142 NO_NEIGHBOR_CMD2 "update-source",
3143 NO_STR
3144 NEIGHBOR_STR
3145 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00003146 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00003147{
3148 return peer_update_source_vty (vty, argv[0], NULL);
3149}
David Lamparter6b0655a2014-06-04 06:53:35 +02003150
paul94f2b392005-06-28 12:44:16 +00003151static int
paulfd79ac92004-10-13 05:06:08 +00003152peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
3153 afi_t afi, safi_t safi,
3154 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00003155{
3156 int ret;
3157 struct peer *peer;
3158
3159 peer = peer_and_group_lookup_vty (vty, peer_str);
3160 if (! peer)
3161 return CMD_WARNING;
3162
3163 if (set)
3164 ret = peer_default_originate_set (peer, afi, safi, rmap);
3165 else
3166 ret = peer_default_originate_unset (peer, afi, safi);
3167
3168 return bgp_vty_return (vty, ret);
3169}
3170
3171/* neighbor default-originate. */
3172DEFUN (neighbor_default_originate,
3173 neighbor_default_originate_cmd,
3174 NEIGHBOR_CMD2 "default-originate",
3175 NEIGHBOR_STR
3176 NEIGHBOR_ADDR_STR2
3177 "Originate default route to this neighbor\n")
3178{
3179 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3180 bgp_node_safi (vty), NULL, 1);
3181}
3182
3183DEFUN (neighbor_default_originate_rmap,
3184 neighbor_default_originate_rmap_cmd,
3185 NEIGHBOR_CMD2 "default-originate route-map WORD",
3186 NEIGHBOR_STR
3187 NEIGHBOR_ADDR_STR2
3188 "Originate default route to this neighbor\n"
3189 "Route-map to specify criteria to originate default\n"
3190 "route-map name\n")
3191{
3192 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3193 bgp_node_safi (vty), argv[1], 1);
3194}
3195
3196DEFUN (no_neighbor_default_originate,
3197 no_neighbor_default_originate_cmd,
3198 NO_NEIGHBOR_CMD2 "default-originate",
3199 NO_STR
3200 NEIGHBOR_STR
3201 NEIGHBOR_ADDR_STR2
3202 "Originate default route to this neighbor\n")
3203{
3204 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3205 bgp_node_safi (vty), NULL, 0);
3206}
3207
3208ALIAS (no_neighbor_default_originate,
3209 no_neighbor_default_originate_rmap_cmd,
3210 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3211 NO_STR
3212 NEIGHBOR_STR
3213 NEIGHBOR_ADDR_STR2
3214 "Originate default route to this neighbor\n"
3215 "Route-map to specify criteria to originate default\n"
3216 "route-map name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003217
paul718e3742002-12-13 20:15:29 +00003218/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00003219static int
paulfd79ac92004-10-13 05:06:08 +00003220peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3221 const char *port_str)
paul718e3742002-12-13 20:15:29 +00003222{
3223 struct peer *peer;
3224 u_int16_t port;
3225 struct servent *sp;
3226
3227 peer = peer_lookup_vty (vty, ip_str);
3228 if (! peer)
3229 return CMD_WARNING;
3230
3231 if (! port_str)
3232 {
3233 sp = getservbyname ("bgp", "tcp");
3234 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3235 }
3236 else
3237 {
3238 VTY_GET_INTEGER("port", port, port_str);
3239 }
3240
3241 peer_port_set (peer, port);
3242
3243 return CMD_SUCCESS;
3244}
3245
hassof4184462005-02-01 20:13:16 +00003246/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00003247DEFUN (neighbor_port,
3248 neighbor_port_cmd,
3249 NEIGHBOR_CMD "port <0-65535>",
3250 NEIGHBOR_STR
3251 NEIGHBOR_ADDR_STR
3252 "Neighbor's BGP port\n"
3253 "TCP port number\n")
3254{
3255 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3256}
3257
3258DEFUN (no_neighbor_port,
3259 no_neighbor_port_cmd,
3260 NO_NEIGHBOR_CMD "port",
3261 NO_STR
3262 NEIGHBOR_STR
3263 NEIGHBOR_ADDR_STR
3264 "Neighbor's BGP port\n")
3265{
3266 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3267}
3268
3269ALIAS (no_neighbor_port,
3270 no_neighbor_port_val_cmd,
3271 NO_NEIGHBOR_CMD "port <0-65535>",
3272 NO_STR
3273 NEIGHBOR_STR
3274 NEIGHBOR_ADDR_STR
3275 "Neighbor's BGP port\n"
3276 "TCP port number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003277
paul718e3742002-12-13 20:15:29 +00003278/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00003279static int
paulfd79ac92004-10-13 05:06:08 +00003280peer_weight_set_vty (struct vty *vty, const char *ip_str,
3281 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00003282{
paul718e3742002-12-13 20:15:29 +00003283 struct peer *peer;
3284 unsigned long weight;
3285
3286 peer = peer_and_group_lookup_vty (vty, ip_str);
3287 if (! peer)
3288 return CMD_WARNING;
3289
3290 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3291
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003292 return bgp_vty_return (vty, peer_weight_set (peer, weight));
paul718e3742002-12-13 20:15:29 +00003293}
3294
paul94f2b392005-06-28 12:44:16 +00003295static int
paulfd79ac92004-10-13 05:06:08 +00003296peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003297{
3298 struct peer *peer;
3299
3300 peer = peer_and_group_lookup_vty (vty, ip_str);
3301 if (! peer)
3302 return CMD_WARNING;
3303
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003304 return bgp_vty_return (vty, peer_weight_unset (peer));
paul718e3742002-12-13 20:15:29 +00003305}
3306
3307DEFUN (neighbor_weight,
3308 neighbor_weight_cmd,
3309 NEIGHBOR_CMD2 "weight <0-65535>",
3310 NEIGHBOR_STR
3311 NEIGHBOR_ADDR_STR2
3312 "Set default weight for routes from this neighbor\n"
3313 "default weight\n")
3314{
3315 return peer_weight_set_vty (vty, argv[0], argv[1]);
3316}
3317
3318DEFUN (no_neighbor_weight,
3319 no_neighbor_weight_cmd,
3320 NO_NEIGHBOR_CMD2 "weight",
3321 NO_STR
3322 NEIGHBOR_STR
3323 NEIGHBOR_ADDR_STR2
3324 "Set default weight for routes from this neighbor\n")
3325{
3326 return peer_weight_unset_vty (vty, argv[0]);
3327}
3328
3329ALIAS (no_neighbor_weight,
3330 no_neighbor_weight_val_cmd,
3331 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3332 NO_STR
3333 NEIGHBOR_STR
3334 NEIGHBOR_ADDR_STR2
3335 "Set default weight for routes from this neighbor\n"
3336 "default weight\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003337
paul718e3742002-12-13 20:15:29 +00003338/* Override capability negotiation. */
3339DEFUN (neighbor_override_capability,
3340 neighbor_override_capability_cmd,
3341 NEIGHBOR_CMD2 "override-capability",
3342 NEIGHBOR_STR
3343 NEIGHBOR_ADDR_STR2
3344 "Override capability negotiation result\n")
3345{
3346 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3347}
3348
3349DEFUN (no_neighbor_override_capability,
3350 no_neighbor_override_capability_cmd,
3351 NO_NEIGHBOR_CMD2 "override-capability",
3352 NO_STR
3353 NEIGHBOR_STR
3354 NEIGHBOR_ADDR_STR2
3355 "Override capability negotiation result\n")
3356{
3357 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3358}
David Lamparter6b0655a2014-06-04 06:53:35 +02003359
paul718e3742002-12-13 20:15:29 +00003360DEFUN (neighbor_strict_capability,
3361 neighbor_strict_capability_cmd,
3362 NEIGHBOR_CMD "strict-capability-match",
3363 NEIGHBOR_STR
3364 NEIGHBOR_ADDR_STR
3365 "Strict capability negotiation match\n")
3366{
3367 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3368}
3369
3370DEFUN (no_neighbor_strict_capability,
3371 no_neighbor_strict_capability_cmd,
3372 NO_NEIGHBOR_CMD "strict-capability-match",
3373 NO_STR
3374 NEIGHBOR_STR
3375 NEIGHBOR_ADDR_STR
3376 "Strict capability negotiation match\n")
3377{
3378 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3379}
David Lamparter6b0655a2014-06-04 06:53:35 +02003380
paul94f2b392005-06-28 12:44:16 +00003381static int
paulfd79ac92004-10-13 05:06:08 +00003382peer_timers_set_vty (struct vty *vty, const char *ip_str,
3383 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003384{
3385 int ret;
3386 struct peer *peer;
3387 u_int32_t keepalive;
3388 u_int32_t holdtime;
3389
3390 peer = peer_and_group_lookup_vty (vty, ip_str);
3391 if (! peer)
3392 return CMD_WARNING;
3393
3394 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3395 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3396
3397 ret = peer_timers_set (peer, keepalive, holdtime);
3398
3399 return bgp_vty_return (vty, ret);
3400}
David Lamparter6b0655a2014-06-04 06:53:35 +02003401
paul94f2b392005-06-28 12:44:16 +00003402static int
paulfd79ac92004-10-13 05:06:08 +00003403peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003404{
3405 int ret;
3406 struct peer *peer;
3407
3408 peer = peer_lookup_vty (vty, ip_str);
3409 if (! peer)
3410 return CMD_WARNING;
3411
3412 ret = peer_timers_unset (peer);
3413
3414 return bgp_vty_return (vty, ret);
3415}
3416
3417DEFUN (neighbor_timers,
3418 neighbor_timers_cmd,
3419 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3420 NEIGHBOR_STR
3421 NEIGHBOR_ADDR_STR2
3422 "BGP per neighbor timers\n"
3423 "Keepalive interval\n"
3424 "Holdtime\n")
3425{
3426 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3427}
3428
3429DEFUN (no_neighbor_timers,
3430 no_neighbor_timers_cmd,
3431 NO_NEIGHBOR_CMD2 "timers",
3432 NO_STR
3433 NEIGHBOR_STR
3434 NEIGHBOR_ADDR_STR2
3435 "BGP per neighbor timers\n")
3436{
3437 return peer_timers_unset_vty (vty, argv[0]);
3438}
David Lamparter6b0655a2014-06-04 06:53:35 +02003439
paul94f2b392005-06-28 12:44:16 +00003440static int
paulfd79ac92004-10-13 05:06:08 +00003441peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3442 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003443{
paul718e3742002-12-13 20:15:29 +00003444 struct peer *peer;
3445 u_int32_t connect;
3446
Daniel Walton0d7435f2015-10-22 11:35:20 +03003447 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003448 if (! peer)
3449 return CMD_WARNING;
3450
3451 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3452
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003453 return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
paul718e3742002-12-13 20:15:29 +00003454}
3455
paul94f2b392005-06-28 12:44:16 +00003456static int
paulfd79ac92004-10-13 05:06:08 +00003457peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003458{
paul718e3742002-12-13 20:15:29 +00003459 struct peer *peer;
3460
3461 peer = peer_and_group_lookup_vty (vty, ip_str);
3462 if (! peer)
3463 return CMD_WARNING;
3464
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003465 return bgp_vty_return (vty, peer_timers_connect_unset (peer));
paul718e3742002-12-13 20:15:29 +00003466}
3467
3468DEFUN (neighbor_timers_connect,
3469 neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003470 NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003471 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003472 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003473 "BGP per neighbor timers\n"
3474 "BGP connect timer\n"
3475 "Connect timer\n")
3476{
3477 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3478}
3479
3480DEFUN (no_neighbor_timers_connect,
3481 no_neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003482 NO_NEIGHBOR_CMD2 "timers connect",
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{
3489 return peer_timers_connect_unset_vty (vty, argv[0]);
3490}
3491
3492ALIAS (no_neighbor_timers_connect,
3493 no_neighbor_timers_connect_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003494 NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003495 NO_STR
3496 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003497 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003498 "BGP per neighbor timers\n"
3499 "BGP connect timer\n"
3500 "Connect timer\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003501
paul94f2b392005-06-28 12:44:16 +00003502static int
paulfd79ac92004-10-13 05:06:08 +00003503peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3504 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003505{
3506 int ret;
3507 struct peer *peer;
3508 u_int32_t routeadv = 0;
3509
Daniel Walton0d7435f2015-10-22 11:35:20 +03003510 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003511 if (! peer)
3512 return CMD_WARNING;
3513
3514 if (time_str)
3515 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3516
3517 if (set)
3518 ret = peer_advertise_interval_set (peer, routeadv);
3519 else
3520 ret = peer_advertise_interval_unset (peer);
3521
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003522 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003523}
3524
3525DEFUN (neighbor_advertise_interval,
3526 neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003527 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003528 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 "time in seconds\n")
3532{
3533 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3534}
3535
3536DEFUN (no_neighbor_advertise_interval,
3537 no_neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003538 NO_NEIGHBOR_CMD2 "advertisement-interval",
paul718e3742002-12-13 20:15:29 +00003539 NO_STR
3540 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003541 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003542 "Minimum interval between sending BGP routing updates\n")
3543{
3544 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3545}
3546
3547ALIAS (no_neighbor_advertise_interval,
3548 no_neighbor_advertise_interval_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003549 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003550 NO_STR
3551 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003552 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003553 "Minimum interval between sending BGP routing updates\n"
3554 "time in seconds\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003555
paul718e3742002-12-13 20:15:29 +00003556/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003557static int
paulfd79ac92004-10-13 05:06:08 +00003558peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003559{
3560 int ret;
3561 struct peer *peer;
3562
3563 peer = peer_lookup_vty (vty, ip_str);
3564 if (! peer)
3565 return CMD_WARNING;
3566
3567 if (str)
3568 ret = peer_interface_set (peer, str);
3569 else
3570 ret = peer_interface_unset (peer);
3571
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003572 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003573}
3574
3575DEFUN (neighbor_interface,
3576 neighbor_interface_cmd,
3577 NEIGHBOR_CMD "interface WORD",
3578 NEIGHBOR_STR
3579 NEIGHBOR_ADDR_STR
3580 "Interface\n"
3581 "Interface name\n")
3582{
3583 return peer_interface_vty (vty, argv[0], argv[1]);
3584}
3585
3586DEFUN (no_neighbor_interface,
3587 no_neighbor_interface_cmd,
3588 NO_NEIGHBOR_CMD "interface WORD",
3589 NO_STR
3590 NEIGHBOR_STR
3591 NEIGHBOR_ADDR_STR
3592 "Interface\n"
3593 "Interface name\n")
3594{
3595 return peer_interface_vty (vty, argv[0], NULL);
3596}
David Lamparter6b0655a2014-06-04 06:53:35 +02003597
paul718e3742002-12-13 20:15:29 +00003598/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003599static int
paulfd79ac92004-10-13 05:06:08 +00003600peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3601 afi_t afi, safi_t safi,
3602 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003603{
3604 int ret;
3605 struct peer *peer;
3606 int direct = FILTER_IN;
3607
3608 peer = peer_and_group_lookup_vty (vty, ip_str);
3609 if (! peer)
3610 return CMD_WARNING;
3611
3612 /* Check filter direction. */
3613 if (strncmp (direct_str, "i", 1) == 0)
3614 direct = FILTER_IN;
3615 else if (strncmp (direct_str, "o", 1) == 0)
3616 direct = FILTER_OUT;
3617
3618 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3619
3620 return bgp_vty_return (vty, ret);
3621}
3622
paul94f2b392005-06-28 12:44:16 +00003623static int
paulfd79ac92004-10-13 05:06:08 +00003624peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3625 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003626{
3627 int ret;
3628 struct peer *peer;
3629 int direct = FILTER_IN;
3630
3631 peer = peer_and_group_lookup_vty (vty, ip_str);
3632 if (! peer)
3633 return CMD_WARNING;
3634
3635 /* Check filter direction. */
3636 if (strncmp (direct_str, "i", 1) == 0)
3637 direct = FILTER_IN;
3638 else if (strncmp (direct_str, "o", 1) == 0)
3639 direct = FILTER_OUT;
3640
3641 ret = peer_distribute_unset (peer, afi, safi, direct);
3642
3643 return bgp_vty_return (vty, ret);
3644}
3645
3646DEFUN (neighbor_distribute_list,
3647 neighbor_distribute_list_cmd,
3648 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3649 NEIGHBOR_STR
3650 NEIGHBOR_ADDR_STR2
3651 "Filter updates to/from this neighbor\n"
3652 "IP access-list number\n"
3653 "IP access-list number (expanded range)\n"
3654 "IP Access-list name\n"
3655 "Filter incoming updates\n"
3656 "Filter outgoing updates\n")
3657{
3658 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3659 bgp_node_safi (vty), argv[1], argv[2]);
3660}
3661
3662DEFUN (no_neighbor_distribute_list,
3663 no_neighbor_distribute_list_cmd,
3664 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3665 NO_STR
3666 NEIGHBOR_STR
3667 NEIGHBOR_ADDR_STR2
3668 "Filter updates to/from this neighbor\n"
3669 "IP access-list number\n"
3670 "IP access-list number (expanded range)\n"
3671 "IP Access-list name\n"
3672 "Filter incoming updates\n"
3673 "Filter outgoing updates\n")
3674{
3675 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3676 bgp_node_safi (vty), argv[2]);
3677}
David Lamparter6b0655a2014-06-04 06:53:35 +02003678
paul718e3742002-12-13 20:15:29 +00003679/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003680static int
paulfd79ac92004-10-13 05:06:08 +00003681peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3682 safi_t safi, const char *name_str,
3683 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003684{
3685 int ret;
3686 struct peer *peer;
3687 int direct = FILTER_IN;
3688
3689 peer = peer_and_group_lookup_vty (vty, ip_str);
3690 if (! peer)
3691 return CMD_WARNING;
3692
3693 /* Check filter direction. */
3694 if (strncmp (direct_str, "i", 1) == 0)
3695 direct = FILTER_IN;
3696 else if (strncmp (direct_str, "o", 1) == 0)
3697 direct = FILTER_OUT;
3698
3699 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3700
3701 return bgp_vty_return (vty, ret);
3702}
3703
paul94f2b392005-06-28 12:44:16 +00003704static int
paulfd79ac92004-10-13 05:06:08 +00003705peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3706 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003707{
3708 int ret;
3709 struct peer *peer;
3710 int direct = FILTER_IN;
3711
3712 peer = peer_and_group_lookup_vty (vty, ip_str);
3713 if (! peer)
3714 return CMD_WARNING;
3715
3716 /* Check filter direction. */
3717 if (strncmp (direct_str, "i", 1) == 0)
3718 direct = FILTER_IN;
3719 else if (strncmp (direct_str, "o", 1) == 0)
3720 direct = FILTER_OUT;
3721
3722 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3723
3724 return bgp_vty_return (vty, ret);
3725}
3726
3727DEFUN (neighbor_prefix_list,
3728 neighbor_prefix_list_cmd,
3729 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3730 NEIGHBOR_STR
3731 NEIGHBOR_ADDR_STR2
3732 "Filter updates to/from this neighbor\n"
3733 "Name of a prefix list\n"
3734 "Filter incoming updates\n"
3735 "Filter outgoing updates\n")
3736{
3737 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3738 bgp_node_safi (vty), argv[1], argv[2]);
3739}
3740
3741DEFUN (no_neighbor_prefix_list,
3742 no_neighbor_prefix_list_cmd,
3743 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3744 NO_STR
3745 NEIGHBOR_STR
3746 NEIGHBOR_ADDR_STR2
3747 "Filter updates to/from this neighbor\n"
3748 "Name of a prefix list\n"
3749 "Filter incoming updates\n"
3750 "Filter outgoing updates\n")
3751{
3752 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3753 bgp_node_safi (vty), argv[2]);
3754}
David Lamparter6b0655a2014-06-04 06:53:35 +02003755
paul94f2b392005-06-28 12:44:16 +00003756static int
paulfd79ac92004-10-13 05:06:08 +00003757peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3758 afi_t afi, safi_t safi,
3759 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003760{
3761 int ret;
3762 struct peer *peer;
3763 int direct = FILTER_IN;
3764
3765 peer = peer_and_group_lookup_vty (vty, ip_str);
3766 if (! peer)
3767 return CMD_WARNING;
3768
3769 /* Check filter direction. */
3770 if (strncmp (direct_str, "i", 1) == 0)
3771 direct = FILTER_IN;
3772 else if (strncmp (direct_str, "o", 1) == 0)
3773 direct = FILTER_OUT;
3774
3775 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3776
3777 return bgp_vty_return (vty, ret);
3778}
3779
paul94f2b392005-06-28 12:44:16 +00003780static int
paulfd79ac92004-10-13 05:06:08 +00003781peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3782 afi_t afi, safi_t safi,
3783 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003784{
3785 int ret;
3786 struct peer *peer;
3787 int direct = FILTER_IN;
3788
3789 peer = peer_and_group_lookup_vty (vty, ip_str);
3790 if (! peer)
3791 return CMD_WARNING;
3792
3793 /* Check filter direction. */
3794 if (strncmp (direct_str, "i", 1) == 0)
3795 direct = FILTER_IN;
3796 else if (strncmp (direct_str, "o", 1) == 0)
3797 direct = FILTER_OUT;
3798
3799 ret = peer_aslist_unset (peer, afi, safi, direct);
3800
3801 return bgp_vty_return (vty, ret);
3802}
3803
3804DEFUN (neighbor_filter_list,
3805 neighbor_filter_list_cmd,
3806 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3807 NEIGHBOR_STR
3808 NEIGHBOR_ADDR_STR2
3809 "Establish BGP filters\n"
3810 "AS path access-list name\n"
3811 "Filter incoming routes\n"
3812 "Filter outgoing routes\n")
3813{
3814 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3815 bgp_node_safi (vty), argv[1], argv[2]);
3816}
3817
3818DEFUN (no_neighbor_filter_list,
3819 no_neighbor_filter_list_cmd,
3820 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3821 NO_STR
3822 NEIGHBOR_STR
3823 NEIGHBOR_ADDR_STR2
3824 "Establish BGP filters\n"
3825 "AS path access-list name\n"
3826 "Filter incoming routes\n"
3827 "Filter outgoing routes\n")
3828{
3829 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3830 bgp_node_safi (vty), argv[2]);
3831}
David Lamparter6b0655a2014-06-04 06:53:35 +02003832
paul718e3742002-12-13 20:15:29 +00003833/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003834static int
paulfd79ac92004-10-13 05:06:08 +00003835peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3836 afi_t afi, safi_t safi,
3837 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003838{
3839 int ret;
3840 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003841 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003842
3843 peer = peer_and_group_lookup_vty (vty, ip_str);
3844 if (! peer)
3845 return CMD_WARNING;
3846
3847 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003848 if (strncmp (direct_str, "in", 2) == 0)
3849 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003850 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003851 direct = RMAP_OUT;
3852 else if (strncmp (direct_str, "im", 2) == 0)
3853 direct = RMAP_IMPORT;
3854 else if (strncmp (direct_str, "e", 1) == 0)
3855 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003856
3857 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3858
3859 return bgp_vty_return (vty, ret);
3860}
3861
paul94f2b392005-06-28 12:44:16 +00003862static int
paulfd79ac92004-10-13 05:06:08 +00003863peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3864 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003865{
3866 int ret;
3867 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003868 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003869
3870 peer = peer_and_group_lookup_vty (vty, ip_str);
3871 if (! peer)
3872 return CMD_WARNING;
3873
3874 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003875 if (strncmp (direct_str, "in", 2) == 0)
3876 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003877 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003878 direct = RMAP_OUT;
3879 else if (strncmp (direct_str, "im", 2) == 0)
3880 direct = RMAP_IMPORT;
3881 else if (strncmp (direct_str, "e", 1) == 0)
3882 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003883
3884 ret = peer_route_map_unset (peer, afi, safi, direct);
3885
3886 return bgp_vty_return (vty, ret);
3887}
3888
3889DEFUN (neighbor_route_map,
3890 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003891 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003892 NEIGHBOR_STR
3893 NEIGHBOR_ADDR_STR2
3894 "Apply route map to neighbor\n"
3895 "Name of route map\n"
3896 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003897 "Apply map to outbound routes\n"
3898 "Apply map to routes going into a Route-Server client's table\n"
3899 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003900{
3901 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3902 bgp_node_safi (vty), argv[1], argv[2]);
3903}
3904
3905DEFUN (no_neighbor_route_map,
3906 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003907 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003908 NO_STR
3909 NEIGHBOR_STR
3910 NEIGHBOR_ADDR_STR2
3911 "Apply route map to neighbor\n"
3912 "Name of route map\n"
3913 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003914 "Apply map to outbound routes\n"
3915 "Apply map to routes going into a Route-Server client's table\n"
3916 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003917{
3918 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3919 bgp_node_safi (vty), argv[2]);
3920}
David Lamparter6b0655a2014-06-04 06:53:35 +02003921
paul718e3742002-12-13 20:15:29 +00003922/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003923static int
paulfd79ac92004-10-13 05:06:08 +00003924peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3925 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003926{
3927 int ret;
3928 struct peer *peer;
3929
3930 peer = peer_and_group_lookup_vty (vty, ip_str);
3931 if (! peer)
3932 return CMD_WARNING;
3933
3934 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3935
3936 return bgp_vty_return (vty, ret);
3937}
3938
3939/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003940static int
paulfd79ac92004-10-13 05:06:08 +00003941peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003942 safi_t safi)
3943{
3944 int ret;
3945 struct peer *peer;
3946
3947 peer = peer_and_group_lookup_vty (vty, ip_str);
3948 if (! peer)
3949 return CMD_WARNING;
3950
3951 ret = peer_unsuppress_map_unset (peer, afi, safi);
3952
3953 return bgp_vty_return (vty, ret);
3954}
3955
3956DEFUN (neighbor_unsuppress_map,
3957 neighbor_unsuppress_map_cmd,
3958 NEIGHBOR_CMD2 "unsuppress-map WORD",
3959 NEIGHBOR_STR
3960 NEIGHBOR_ADDR_STR2
3961 "Route-map to selectively unsuppress suppressed routes\n"
3962 "Name of route map\n")
3963{
3964 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3965 bgp_node_safi (vty), argv[1]);
3966}
3967
3968DEFUN (no_neighbor_unsuppress_map,
3969 no_neighbor_unsuppress_map_cmd,
3970 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3971 NO_STR
3972 NEIGHBOR_STR
3973 NEIGHBOR_ADDR_STR2
3974 "Route-map to selectively unsuppress suppressed routes\n"
3975 "Name of route map\n")
3976{
3977 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3978 bgp_node_safi (vty));
3979}
David Lamparter6b0655a2014-06-04 06:53:35 +02003980
paul94f2b392005-06-28 12:44:16 +00003981static int
paulfd79ac92004-10-13 05:06:08 +00003982peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3983 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003984 const char *threshold_str, int warning,
3985 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003986{
3987 int ret;
3988 struct peer *peer;
3989 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003990 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003991 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003992
3993 peer = peer_and_group_lookup_vty (vty, ip_str);
3994 if (! peer)
3995 return CMD_WARNING;
3996
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04003997 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003998 if (threshold_str)
3999 threshold = atoi (threshold_str);
4000 else
4001 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004002
hasso0a486e52005-02-01 20:57:17 +00004003 if (restart_str)
4004 restart = atoi (restart_str);
4005 else
4006 restart = 0;
4007
4008 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00004009
4010 return bgp_vty_return (vty, ret);
4011}
4012
paul94f2b392005-06-28 12:44:16 +00004013static int
paulfd79ac92004-10-13 05:06:08 +00004014peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00004015 safi_t safi)
4016{
4017 int ret;
4018 struct peer *peer;
4019
4020 peer = peer_and_group_lookup_vty (vty, ip_str);
4021 if (! peer)
4022 return CMD_WARNING;
4023
4024 ret = peer_maximum_prefix_unset (peer, afi, safi);
4025
4026 return bgp_vty_return (vty, ret);
4027}
4028
4029/* Maximum number of prefix configuration. prefix count is different
4030 for each peer configuration. So this configuration can be set for
4031 each peer configuration. */
4032DEFUN (neighbor_maximum_prefix,
4033 neighbor_maximum_prefix_cmd,
4034 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4035 NEIGHBOR_STR
4036 NEIGHBOR_ADDR_STR2
4037 "Maximum number of prefix accept from this peer\n"
4038 "maximum no. of prefix limit\n")
4039{
4040 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004041 bgp_node_safi (vty), argv[1], NULL, 0,
4042 NULL);
paul718e3742002-12-13 20:15:29 +00004043}
4044
hassoe0701b72004-05-20 09:19:34 +00004045DEFUN (neighbor_maximum_prefix_threshold,
4046 neighbor_maximum_prefix_threshold_cmd,
4047 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
4048 NEIGHBOR_STR
4049 NEIGHBOR_ADDR_STR2
4050 "Maximum number of prefix accept from this peer\n"
4051 "maximum no. of prefix limit\n"
4052 "Threshold value (%) at which to generate a warning msg\n")
4053{
4054 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004055 bgp_node_safi (vty), argv[1], argv[2], 0,
4056 NULL);
4057}
hassoe0701b72004-05-20 09:19:34 +00004058
paul718e3742002-12-13 20:15:29 +00004059DEFUN (neighbor_maximum_prefix_warning,
4060 neighbor_maximum_prefix_warning_cmd,
4061 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4062 NEIGHBOR_STR
4063 NEIGHBOR_ADDR_STR2
4064 "Maximum number of prefix accept from this peer\n"
4065 "maximum no. of prefix limit\n"
4066 "Only give warning message when limit is exceeded\n")
4067{
4068 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004069 bgp_node_safi (vty), argv[1], NULL, 1,
4070 NULL);
paul718e3742002-12-13 20:15:29 +00004071}
4072
hassoe0701b72004-05-20 09:19:34 +00004073DEFUN (neighbor_maximum_prefix_threshold_warning,
4074 neighbor_maximum_prefix_threshold_warning_cmd,
4075 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4076 NEIGHBOR_STR
4077 NEIGHBOR_ADDR_STR2
4078 "Maximum number of prefix accept from this peer\n"
4079 "maximum no. of prefix limit\n"
4080 "Threshold value (%) at which to generate a warning msg\n"
4081 "Only give warning message when limit is exceeded\n")
4082{
4083 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004084 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4085}
4086
4087DEFUN (neighbor_maximum_prefix_restart,
4088 neighbor_maximum_prefix_restart_cmd,
4089 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
4090 NEIGHBOR_STR
4091 NEIGHBOR_ADDR_STR2
4092 "Maximum number of prefix accept from this peer\n"
4093 "maximum no. of prefix limit\n"
4094 "Restart bgp connection after limit is exceeded\n"
4095 "Restart interval in minutes")
4096{
4097 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4098 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
4099}
4100
4101DEFUN (neighbor_maximum_prefix_threshold_restart,
4102 neighbor_maximum_prefix_threshold_restart_cmd,
4103 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4104 NEIGHBOR_STR
4105 NEIGHBOR_ADDR_STR2
4106 "Maximum number of prefix accept from this peer\n"
4107 "maximum no. of prefix limit\n"
4108 "Threshold value (%) at which to generate a warning msg\n"
4109 "Restart bgp connection after limit is exceeded\n"
4110 "Restart interval in minutes")
4111{
4112 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4113 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4114}
hassoe0701b72004-05-20 09:19:34 +00004115
paul718e3742002-12-13 20:15:29 +00004116DEFUN (no_neighbor_maximum_prefix,
4117 no_neighbor_maximum_prefix_cmd,
4118 NO_NEIGHBOR_CMD2 "maximum-prefix",
4119 NO_STR
4120 NEIGHBOR_STR
4121 NEIGHBOR_ADDR_STR2
4122 "Maximum number of prefix accept from this peer\n")
4123{
4124 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4125 bgp_node_safi (vty));
4126}
4127
4128ALIAS (no_neighbor_maximum_prefix,
4129 no_neighbor_maximum_prefix_val_cmd,
4130 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4131 NO_STR
4132 NEIGHBOR_STR
4133 NEIGHBOR_ADDR_STR2
4134 "Maximum number of prefix accept from this peer\n"
4135 "maximum no. of prefix limit\n")
4136
4137ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004138 no_neighbor_maximum_prefix_threshold_cmd,
4139 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4140 NO_STR
4141 NEIGHBOR_STR
4142 NEIGHBOR_ADDR_STR2
4143 "Maximum number of prefix accept from this peer\n"
4144 "maximum no. of prefix limit\n"
4145 "Threshold value (%) at which to generate a warning msg\n")
4146
4147ALIAS (no_neighbor_maximum_prefix,
4148 no_neighbor_maximum_prefix_warning_cmd,
4149 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4150 NO_STR
4151 NEIGHBOR_STR
4152 NEIGHBOR_ADDR_STR2
4153 "Maximum number of prefix accept from this peer\n"
4154 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00004155 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004156
4157ALIAS (no_neighbor_maximum_prefix,
4158 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004159 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4160 NO_STR
4161 NEIGHBOR_STR
4162 NEIGHBOR_ADDR_STR2
4163 "Maximum number of prefix accept from this peer\n"
4164 "maximum no. of prefix limit\n"
4165 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004166 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004167
4168ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004169 no_neighbor_maximum_prefix_restart_cmd,
4170 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004171 NO_STR
4172 NEIGHBOR_STR
4173 NEIGHBOR_ADDR_STR2
4174 "Maximum number of prefix accept from this peer\n"
4175 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00004176 "Restart bgp connection after limit is exceeded\n"
4177 "Restart interval in minutes")
4178
4179ALIAS (no_neighbor_maximum_prefix,
4180 no_neighbor_maximum_prefix_threshold_restart_cmd,
4181 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4182 NO_STR
4183 NEIGHBOR_STR
4184 NEIGHBOR_ADDR_STR2
4185 "Maximum number of prefix accept from this peer\n"
4186 "maximum no. of prefix limit\n"
4187 "Threshold value (%) at which to generate a warning msg\n"
4188 "Restart bgp connection after limit is exceeded\n"
4189 "Restart interval in minutes")
David Lamparter6b0655a2014-06-04 06:53:35 +02004190
paul718e3742002-12-13 20:15:29 +00004191/* "neighbor allowas-in" */
4192DEFUN (neighbor_allowas_in,
4193 neighbor_allowas_in_cmd,
4194 NEIGHBOR_CMD2 "allowas-in",
4195 NEIGHBOR_STR
4196 NEIGHBOR_ADDR_STR2
4197 "Accept as-path with my AS present in it\n")
4198{
4199 int ret;
4200 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004201 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004202
4203 peer = peer_and_group_lookup_vty (vty, argv[0]);
4204 if (! peer)
4205 return CMD_WARNING;
4206
4207 if (argc == 1)
4208 allow_num = 3;
4209 else
4210 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4211
4212 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4213 allow_num);
4214
4215 return bgp_vty_return (vty, ret);
4216}
4217
4218ALIAS (neighbor_allowas_in,
4219 neighbor_allowas_in_arg_cmd,
4220 NEIGHBOR_CMD2 "allowas-in <1-10>",
4221 NEIGHBOR_STR
4222 NEIGHBOR_ADDR_STR2
4223 "Accept as-path with my AS present in it\n"
4224 "Number of occurances of AS number\n")
4225
4226DEFUN (no_neighbor_allowas_in,
4227 no_neighbor_allowas_in_cmd,
4228 NO_NEIGHBOR_CMD2 "allowas-in",
4229 NO_STR
4230 NEIGHBOR_STR
4231 NEIGHBOR_ADDR_STR2
4232 "allow local ASN appears in aspath attribute\n")
4233{
4234 int ret;
4235 struct peer *peer;
4236
4237 peer = peer_and_group_lookup_vty (vty, argv[0]);
4238 if (! peer)
4239 return CMD_WARNING;
4240
4241 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4242
4243 return bgp_vty_return (vty, ret);
4244}
David Lamparter6b0655a2014-06-04 06:53:35 +02004245
Nick Hilliardfa411a22011-03-23 15:33:17 +00004246DEFUN (neighbor_ttl_security,
4247 neighbor_ttl_security_cmd,
4248 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4249 NEIGHBOR_STR
4250 NEIGHBOR_ADDR_STR2
4251 "Specify the maximum number of hops to the BGP peer\n")
4252{
4253 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004254 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004255
4256 peer = peer_and_group_lookup_vty (vty, argv[0]);
4257 if (! peer)
4258 return CMD_WARNING;
4259
4260 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4261
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004262 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004263}
4264
4265DEFUN (no_neighbor_ttl_security,
4266 no_neighbor_ttl_security_cmd,
4267 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4268 NO_STR
4269 NEIGHBOR_STR
4270 NEIGHBOR_ADDR_STR2
4271 "Specify the maximum number of hops to the BGP peer\n")
4272{
4273 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004274
4275 peer = peer_and_group_lookup_vty (vty, argv[0]);
4276 if (! peer)
4277 return CMD_WARNING;
4278
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004279 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004280}
David Lamparter6b0655a2014-06-04 06:53:35 +02004281
paul718e3742002-12-13 20:15:29 +00004282/* Address family configuration. */
4283DEFUN (address_family_ipv4,
4284 address_family_ipv4_cmd,
4285 "address-family ipv4",
4286 "Enter Address Family command mode\n"
4287 "Address family\n")
4288{
4289 vty->node = BGP_IPV4_NODE;
4290 return CMD_SUCCESS;
4291}
4292
4293DEFUN (address_family_ipv4_safi,
4294 address_family_ipv4_safi_cmd,
4295 "address-family ipv4 (unicast|multicast)",
4296 "Enter Address Family command mode\n"
4297 "Address family\n"
4298 "Address Family modifier\n"
4299 "Address Family modifier\n")
4300{
4301 if (strncmp (argv[0], "m", 1) == 0)
4302 vty->node = BGP_IPV4M_NODE;
4303 else
4304 vty->node = BGP_IPV4_NODE;
4305
4306 return CMD_SUCCESS;
4307}
4308
paul25ffbdc2005-08-22 22:42:08 +00004309DEFUN (address_family_ipv6,
4310 address_family_ipv6_cmd,
4311 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004312 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004313 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004314{
4315 vty->node = BGP_IPV6_NODE;
4316 return CMD_SUCCESS;
4317}
4318
paul25ffbdc2005-08-22 22:42:08 +00004319DEFUN (address_family_ipv6_safi,
4320 address_family_ipv6_safi_cmd,
4321 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004322 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004323 "Address family\n"
4324 "Address Family modifier\n"
4325 "Address Family modifier\n")
4326{
4327 if (strncmp (argv[0], "m", 1) == 0)
4328 vty->node = BGP_IPV6M_NODE;
4329 else
4330 vty->node = BGP_IPV6_NODE;
4331
4332 return CMD_SUCCESS;
4333}
paul718e3742002-12-13 20:15:29 +00004334
4335DEFUN (address_family_vpnv4,
4336 address_family_vpnv4_cmd,
4337 "address-family vpnv4",
4338 "Enter Address Family command mode\n"
4339 "Address family\n")
4340{
4341 vty->node = BGP_VPNV4_NODE;
4342 return CMD_SUCCESS;
4343}
4344
4345ALIAS (address_family_vpnv4,
4346 address_family_vpnv4_unicast_cmd,
4347 "address-family vpnv4 unicast",
4348 "Enter Address Family command mode\n"
4349 "Address family\n"
4350 "Address Family Modifier\n")
4351
Lou Berger13c378d2016-01-12 13:41:56 -05004352DEFUN (address_family_vpnv6,
4353 address_family_vpnv6_cmd,
4354 "address-family vpnv6",
4355 "Enter Address Family command mode\n"
4356 "Address family\n")
4357{
4358 vty->node = BGP_VPNV6_NODE;
4359 return CMD_SUCCESS;
4360}
4361
4362ALIAS (address_family_vpnv6,
4363 address_family_vpnv6_unicast_cmd,
4364 "address-family vpnv6 unicast",
4365 "Enter Address Family command mode\n"
4366 "Address family\n"
4367 "Address Family Modifier\n")
4368
Lou Bergera3fda882016-01-12 13:42:04 -05004369DEFUN (address_family_encap,
4370 address_family_encap_cmd,
4371 "address-family encap",
4372 "Enter Address Family command mode\n"
4373 "Address family\n")
4374{
4375 vty->node = BGP_ENCAP_NODE;
4376 return CMD_SUCCESS;
4377}
4378
4379ALIAS (address_family_encap,
4380 address_family_encapv4_cmd,
4381 "address-family encapv4",
4382 "Enter Address Family command mode\n"
4383 "Address family\n")
4384
4385DEFUN (address_family_encapv6,
4386 address_family_encapv6_cmd,
4387 "address-family encapv6",
4388 "Enter Address Family command mode\n"
4389 "Address family\n")
4390{
4391 vty->node = BGP_ENCAPV6_NODE;
4392 return CMD_SUCCESS;
4393}
4394
paul718e3742002-12-13 20:15:29 +00004395DEFUN (exit_address_family,
4396 exit_address_family_cmd,
4397 "exit-address-family",
4398 "Exit from Address Family configuration mode\n")
4399{
Lou Bergera3fda882016-01-12 13:42:04 -05004400 /* should match list in command.c:config_exit */
hassoa8a80d52005-04-09 13:07:47 +00004401 if (vty->node == BGP_IPV4_NODE
Lou Bergera3fda882016-01-12 13:42:04 -05004402 || vty->node == BGP_ENCAP_NODE
4403 || vty->node == BGP_ENCAPV6_NODE
hassoa8a80d52005-04-09 13:07:47 +00004404 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004405 || vty->node == BGP_VPNV4_NODE
Lou Berger13c378d2016-01-12 13:41:56 -05004406 || vty->node == BGP_VPNV6_NODE
paul25ffbdc2005-08-22 22:42:08 +00004407 || vty->node == BGP_IPV6_NODE
4408 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004409 vty->node = BGP_NODE;
4410 return CMD_SUCCESS;
4411}
David Lamparter6b0655a2014-06-04 06:53:35 +02004412
paul718e3742002-12-13 20:15:29 +00004413/* BGP clear sort. */
4414enum clear_sort
4415{
4416 clear_all,
4417 clear_peer,
4418 clear_group,
4419 clear_external,
4420 clear_as
4421};
4422
paul94f2b392005-06-28 12:44:16 +00004423static void
paul718e3742002-12-13 20:15:29 +00004424bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4425 safi_t safi, int error)
4426{
4427 switch (error)
4428 {
4429 case BGP_ERR_AF_UNCONFIGURED:
4430 vty_out (vty,
4431 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4432 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4433 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4434 peer->host, VTY_NEWLINE);
4435 break;
4436 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4437 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);
4438 break;
4439 default:
4440 break;
4441 }
4442}
4443
4444/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004445static int
paul718e3742002-12-13 20:15:29 +00004446bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004447 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004448{
4449 int ret;
4450 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004451 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004452
4453 /* Clear all neighbors. */
4454 if (sort == clear_all)
4455 {
paul1eb8ef22005-04-07 07:30:20 +00004456 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004457 {
4458 if (stype == BGP_CLEAR_SOFT_NONE)
4459 ret = peer_clear (peer);
4460 else
4461 ret = peer_clear_soft (peer, afi, safi, stype);
4462
4463 if (ret < 0)
4464 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4465 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004466 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004467 }
4468
4469 /* Clear specified neighbors. */
4470 if (sort == clear_peer)
4471 {
4472 union sockunion su;
4473 int ret;
4474
4475 /* Make sockunion for lookup. */
4476 ret = str2sockunion (arg, &su);
4477 if (ret < 0)
4478 {
4479 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004480 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004481 }
4482 peer = peer_lookup (bgp, &su);
4483 if (! peer)
4484 {
4485 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004486 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004487 }
4488
4489 if (stype == BGP_CLEAR_SOFT_NONE)
4490 ret = peer_clear (peer);
4491 else
4492 ret = peer_clear_soft (peer, afi, safi, stype);
4493
4494 if (ret < 0)
4495 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4496
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004497 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004498 }
4499
4500 /* Clear all peer-group members. */
4501 if (sort == clear_group)
4502 {
4503 struct peer_group *group;
4504
4505 group = peer_group_lookup (bgp, arg);
4506 if (! group)
4507 {
4508 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004509 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004510 }
4511
paul1eb8ef22005-04-07 07:30:20 +00004512 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004513 {
4514 if (stype == BGP_CLEAR_SOFT_NONE)
4515 {
4516 ret = peer_clear (peer);
4517 continue;
4518 }
4519
4520 if (! peer->af_group[afi][safi])
4521 continue;
4522
4523 ret = peer_clear_soft (peer, afi, safi, stype);
4524
4525 if (ret < 0)
4526 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4527 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004528 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004529 }
4530
4531 if (sort == clear_external)
4532 {
paul1eb8ef22005-04-07 07:30:20 +00004533 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004534 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004535 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004536 continue;
4537
4538 if (stype == BGP_CLEAR_SOFT_NONE)
4539 ret = peer_clear (peer);
4540 else
4541 ret = peer_clear_soft (peer, afi, safi, stype);
4542
4543 if (ret < 0)
4544 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4545 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004546 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004547 }
4548
4549 if (sort == clear_as)
4550 {
4551 as_t as;
paul718e3742002-12-13 20:15:29 +00004552 int find = 0;
4553
Ulrich Weberbde12e32011-11-16 19:32:12 +04004554 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004555
paul1eb8ef22005-04-07 07:30:20 +00004556 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004557 {
4558 if (peer->as != as)
4559 continue;
4560
4561 find = 1;
4562 if (stype == BGP_CLEAR_SOFT_NONE)
4563 ret = peer_clear (peer);
4564 else
4565 ret = peer_clear_soft (peer, afi, safi, stype);
4566
4567 if (ret < 0)
4568 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4569 }
4570 if (! find)
4571 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4572 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004573 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004574 }
4575
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004576 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004577}
4578
paul94f2b392005-06-28 12:44:16 +00004579static int
paulfd79ac92004-10-13 05:06:08 +00004580bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4581 enum clear_sort sort, enum bgp_clear_type stype,
4582 const char *arg)
paul718e3742002-12-13 20:15:29 +00004583{
paul718e3742002-12-13 20:15:29 +00004584 struct bgp *bgp;
4585
4586 /* BGP structure lookup. */
4587 if (name)
4588 {
4589 bgp = bgp_lookup_by_name (name);
4590 if (bgp == NULL)
4591 {
4592 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4593 return CMD_WARNING;
4594 }
4595 }
4596 else
4597 {
4598 bgp = bgp_get_default ();
4599 if (bgp == NULL)
4600 {
4601 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4602 return CMD_WARNING;
4603 }
4604 }
4605
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004606 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004607}
4608
4609DEFUN (clear_ip_bgp_all,
4610 clear_ip_bgp_all_cmd,
4611 "clear ip bgp *",
4612 CLEAR_STR
4613 IP_STR
4614 BGP_STR
4615 "Clear all peers\n")
4616{
4617 if (argc == 1)
4618 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4619
4620 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4621}
4622
4623ALIAS (clear_ip_bgp_all,
4624 clear_bgp_all_cmd,
4625 "clear bgp *",
4626 CLEAR_STR
4627 BGP_STR
4628 "Clear all peers\n")
4629
4630ALIAS (clear_ip_bgp_all,
4631 clear_bgp_ipv6_all_cmd,
4632 "clear bgp ipv6 *",
4633 CLEAR_STR
4634 BGP_STR
4635 "Address family\n"
4636 "Clear all peers\n")
4637
4638ALIAS (clear_ip_bgp_all,
4639 clear_ip_bgp_instance_all_cmd,
4640 "clear ip bgp view WORD *",
4641 CLEAR_STR
4642 IP_STR
4643 BGP_STR
4644 "BGP view\n"
4645 "view name\n"
4646 "Clear all peers\n")
4647
4648ALIAS (clear_ip_bgp_all,
4649 clear_bgp_instance_all_cmd,
4650 "clear bgp view WORD *",
4651 CLEAR_STR
4652 BGP_STR
4653 "BGP view\n"
4654 "view name\n"
4655 "Clear all peers\n")
4656
4657DEFUN (clear_ip_bgp_peer,
4658 clear_ip_bgp_peer_cmd,
4659 "clear ip bgp (A.B.C.D|X:X::X:X)",
4660 CLEAR_STR
4661 IP_STR
4662 BGP_STR
4663 "BGP neighbor IP address to clear\n"
4664 "BGP IPv6 neighbor to clear\n")
4665{
4666 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4667}
4668
4669ALIAS (clear_ip_bgp_peer,
4670 clear_bgp_peer_cmd,
4671 "clear bgp (A.B.C.D|X:X::X:X)",
4672 CLEAR_STR
4673 BGP_STR
4674 "BGP neighbor address to clear\n"
4675 "BGP IPv6 neighbor to clear\n")
4676
4677ALIAS (clear_ip_bgp_peer,
4678 clear_bgp_ipv6_peer_cmd,
4679 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4680 CLEAR_STR
4681 BGP_STR
4682 "Address family\n"
4683 "BGP neighbor address to clear\n"
4684 "BGP IPv6 neighbor to clear\n")
4685
4686DEFUN (clear_ip_bgp_peer_group,
4687 clear_ip_bgp_peer_group_cmd,
4688 "clear ip bgp peer-group WORD",
4689 CLEAR_STR
4690 IP_STR
4691 BGP_STR
4692 "Clear all members of peer-group\n"
4693 "BGP peer-group name\n")
4694{
4695 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4696}
4697
4698ALIAS (clear_ip_bgp_peer_group,
4699 clear_bgp_peer_group_cmd,
4700 "clear bgp peer-group WORD",
4701 CLEAR_STR
4702 BGP_STR
4703 "Clear all members of peer-group\n"
4704 "BGP peer-group name\n")
4705
4706ALIAS (clear_ip_bgp_peer_group,
4707 clear_bgp_ipv6_peer_group_cmd,
4708 "clear bgp ipv6 peer-group WORD",
4709 CLEAR_STR
4710 BGP_STR
4711 "Address family\n"
4712 "Clear all members of peer-group\n"
4713 "BGP peer-group name\n")
4714
4715DEFUN (clear_ip_bgp_external,
4716 clear_ip_bgp_external_cmd,
4717 "clear ip bgp external",
4718 CLEAR_STR
4719 IP_STR
4720 BGP_STR
4721 "Clear all external peers\n")
4722{
4723 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4724}
4725
4726ALIAS (clear_ip_bgp_external,
4727 clear_bgp_external_cmd,
4728 "clear bgp external",
4729 CLEAR_STR
4730 BGP_STR
4731 "Clear all external peers\n")
4732
4733ALIAS (clear_ip_bgp_external,
4734 clear_bgp_ipv6_external_cmd,
4735 "clear bgp ipv6 external",
4736 CLEAR_STR
4737 BGP_STR
4738 "Address family\n"
4739 "Clear all external peers\n")
4740
4741DEFUN (clear_ip_bgp_as,
4742 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004743 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004744 CLEAR_STR
4745 IP_STR
4746 BGP_STR
4747 "Clear peers with the AS number\n")
4748{
4749 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4750}
4751
4752ALIAS (clear_ip_bgp_as,
4753 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004754 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004755 CLEAR_STR
4756 BGP_STR
4757 "Clear peers with the AS number\n")
4758
4759ALIAS (clear_ip_bgp_as,
4760 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004761 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004762 CLEAR_STR
4763 BGP_STR
4764 "Address family\n"
4765 "Clear peers with the AS number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02004766
paul718e3742002-12-13 20:15:29 +00004767/* Outbound soft-reconfiguration */
4768DEFUN (clear_ip_bgp_all_soft_out,
4769 clear_ip_bgp_all_soft_out_cmd,
4770 "clear ip bgp * soft out",
4771 CLEAR_STR
4772 IP_STR
4773 BGP_STR
4774 "Clear all peers\n"
4775 "Soft reconfig\n"
4776 "Soft reconfig outbound update\n")
4777{
4778 if (argc == 1)
4779 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4780 BGP_CLEAR_SOFT_OUT, NULL);
4781
4782 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4783 BGP_CLEAR_SOFT_OUT, NULL);
4784}
4785
4786ALIAS (clear_ip_bgp_all_soft_out,
4787 clear_ip_bgp_all_out_cmd,
4788 "clear ip bgp * out",
4789 CLEAR_STR
4790 IP_STR
4791 BGP_STR
4792 "Clear all peers\n"
4793 "Soft reconfig outbound update\n")
4794
4795ALIAS (clear_ip_bgp_all_soft_out,
4796 clear_ip_bgp_instance_all_soft_out_cmd,
4797 "clear ip bgp view WORD * soft out",
4798 CLEAR_STR
4799 IP_STR
4800 BGP_STR
4801 "BGP view\n"
4802 "view name\n"
4803 "Clear all peers\n"
4804 "Soft reconfig\n"
4805 "Soft reconfig outbound update\n")
4806
4807DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4808 clear_ip_bgp_all_ipv4_soft_out_cmd,
4809 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4810 CLEAR_STR
4811 IP_STR
4812 BGP_STR
4813 "Clear all peers\n"
4814 "Address family\n"
4815 "Address Family modifier\n"
4816 "Address Family modifier\n"
4817 "Soft reconfig\n"
4818 "Soft reconfig outbound update\n")
4819{
4820 if (strncmp (argv[0], "m", 1) == 0)
4821 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4822 BGP_CLEAR_SOFT_OUT, NULL);
4823
4824 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4825 BGP_CLEAR_SOFT_OUT, NULL);
4826}
4827
4828ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4829 clear_ip_bgp_all_ipv4_out_cmd,
4830 "clear ip bgp * ipv4 (unicast|multicast) out",
4831 CLEAR_STR
4832 IP_STR
4833 BGP_STR
4834 "Clear all peers\n"
4835 "Address family\n"
4836 "Address Family modifier\n"
4837 "Address Family modifier\n"
4838 "Soft reconfig outbound update\n")
4839
4840DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4841 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4842 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4843 CLEAR_STR
4844 IP_STR
4845 BGP_STR
4846 "BGP view\n"
4847 "view name\n"
4848 "Clear all peers\n"
4849 "Address family\n"
4850 "Address Family modifier\n"
4851 "Address Family modifier\n"
4852 "Soft reconfig outbound update\n")
4853{
4854 if (strncmp (argv[1], "m", 1) == 0)
4855 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4856 BGP_CLEAR_SOFT_OUT, NULL);
4857
4858 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4859 BGP_CLEAR_SOFT_OUT, NULL);
4860}
4861
4862DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4863 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4864 "clear ip bgp * vpnv4 unicast soft out",
4865 CLEAR_STR
4866 IP_STR
4867 BGP_STR
4868 "Clear all peers\n"
4869 "Address family\n"
4870 "Address Family Modifier\n"
4871 "Soft reconfig\n"
4872 "Soft reconfig outbound update\n")
4873{
4874 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4875 BGP_CLEAR_SOFT_OUT, NULL);
4876}
4877
4878ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4879 clear_ip_bgp_all_vpnv4_out_cmd,
4880 "clear ip bgp * vpnv4 unicast out",
4881 CLEAR_STR
4882 IP_STR
4883 BGP_STR
4884 "Clear all peers\n"
4885 "Address family\n"
4886 "Address Family Modifier\n"
4887 "Soft reconfig outbound update\n")
4888
Lou Berger298cc2f2016-01-12 13:42:02 -05004889DEFUN (clear_ip_bgp_all_encap_soft_out,
4890 clear_ip_bgp_all_encap_soft_out_cmd,
4891 "clear ip bgp * encap unicast soft out",
4892 CLEAR_STR
4893 IP_STR
4894 BGP_STR
4895 "Clear all peers\n"
4896 "Address family\n"
4897 "Address Family Modifier\n"
4898 "Soft reconfig\n"
4899 "Soft reconfig outbound update\n")
4900{
4901 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
4902 BGP_CLEAR_SOFT_OUT, NULL);
4903}
4904
4905ALIAS (clear_ip_bgp_all_encap_soft_out,
4906 clear_ip_bgp_all_encap_out_cmd,
4907 "clear ip bgp * encap unicast out",
4908 CLEAR_STR
4909 IP_STR
4910 BGP_STR
4911 "Clear all peers\n"
4912 "Address family\n"
4913 "Address Family Modifier\n"
4914 "Soft reconfig outbound update\n")
4915
paul718e3742002-12-13 20:15:29 +00004916DEFUN (clear_bgp_all_soft_out,
4917 clear_bgp_all_soft_out_cmd,
4918 "clear bgp * soft out",
4919 CLEAR_STR
4920 BGP_STR
4921 "Clear all peers\n"
4922 "Soft reconfig\n"
4923 "Soft reconfig outbound update\n")
4924{
4925 if (argc == 1)
4926 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4927 BGP_CLEAR_SOFT_OUT, NULL);
4928
4929 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4930 BGP_CLEAR_SOFT_OUT, NULL);
4931}
4932
4933ALIAS (clear_bgp_all_soft_out,
4934 clear_bgp_instance_all_soft_out_cmd,
4935 "clear bgp view WORD * soft out",
4936 CLEAR_STR
4937 BGP_STR
4938 "BGP view\n"
4939 "view name\n"
4940 "Clear all peers\n"
4941 "Soft reconfig\n"
4942 "Soft reconfig outbound update\n")
4943
4944ALIAS (clear_bgp_all_soft_out,
4945 clear_bgp_all_out_cmd,
4946 "clear bgp * out",
4947 CLEAR_STR
4948 BGP_STR
4949 "Clear all peers\n"
4950 "Soft reconfig outbound update\n")
4951
4952ALIAS (clear_bgp_all_soft_out,
4953 clear_bgp_ipv6_all_soft_out_cmd,
4954 "clear bgp ipv6 * soft out",
4955 CLEAR_STR
4956 BGP_STR
4957 "Address family\n"
4958 "Clear all peers\n"
4959 "Soft reconfig\n"
4960 "Soft reconfig outbound update\n")
4961
4962ALIAS (clear_bgp_all_soft_out,
4963 clear_bgp_ipv6_all_out_cmd,
4964 "clear bgp ipv6 * out",
4965 CLEAR_STR
4966 BGP_STR
4967 "Address family\n"
4968 "Clear all peers\n"
4969 "Soft reconfig outbound update\n")
4970
4971DEFUN (clear_ip_bgp_peer_soft_out,
4972 clear_ip_bgp_peer_soft_out_cmd,
4973 "clear ip bgp A.B.C.D soft out",
4974 CLEAR_STR
4975 IP_STR
4976 BGP_STR
4977 "BGP neighbor address to clear\n"
4978 "Soft reconfig\n"
4979 "Soft reconfig outbound update\n")
4980{
4981 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4982 BGP_CLEAR_SOFT_OUT, argv[0]);
4983}
4984
4985ALIAS (clear_ip_bgp_peer_soft_out,
4986 clear_ip_bgp_peer_out_cmd,
4987 "clear ip bgp A.B.C.D out",
4988 CLEAR_STR
4989 IP_STR
4990 BGP_STR
4991 "BGP neighbor address to clear\n"
4992 "Soft reconfig outbound update\n")
4993
4994DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4995 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4996 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4997 CLEAR_STR
4998 IP_STR
4999 BGP_STR
5000 "BGP neighbor address to clear\n"
5001 "Address family\n"
5002 "Address Family modifier\n"
5003 "Address Family modifier\n"
5004 "Soft reconfig\n"
5005 "Soft reconfig outbound update\n")
5006{
5007 if (strncmp (argv[1], "m", 1) == 0)
5008 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5009 BGP_CLEAR_SOFT_OUT, argv[0]);
5010
5011 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5012 BGP_CLEAR_SOFT_OUT, argv[0]);
5013}
5014
5015ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
5016 clear_ip_bgp_peer_ipv4_out_cmd,
5017 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) 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 "Address Family modifier\n"
5025 "Soft reconfig outbound update\n")
5026
5027DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
5028 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
5029 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
5030 CLEAR_STR
5031 IP_STR
5032 BGP_STR
5033 "BGP neighbor address to clear\n"
5034 "Address family\n"
5035 "Address Family Modifier\n"
5036 "Soft reconfig\n"
5037 "Soft reconfig outbound update\n")
5038{
5039 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5040 BGP_CLEAR_SOFT_OUT, argv[0]);
5041}
5042
5043ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
5044 clear_ip_bgp_peer_vpnv4_out_cmd,
5045 "clear ip bgp A.B.C.D vpnv4 unicast out",
5046 CLEAR_STR
5047 IP_STR
5048 BGP_STR
5049 "BGP neighbor address to clear\n"
5050 "Address family\n"
5051 "Address Family Modifier\n"
5052 "Soft reconfig outbound update\n")
5053
Lou Berger298cc2f2016-01-12 13:42:02 -05005054DEFUN (clear_ip_bgp_peer_encap_soft_out,
5055 clear_ip_bgp_peer_encap_soft_out_cmd,
5056 "clear ip bgp A.B.C.D encap unicast soft out",
5057 CLEAR_STR
5058 IP_STR
5059 BGP_STR
5060 "BGP neighbor address to clear\n"
5061 "Address family\n"
5062 "Address Family Modifier\n"
5063 "Soft reconfig\n"
5064 "Soft reconfig outbound update\n")
5065{
5066 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5067 BGP_CLEAR_SOFT_OUT, argv[0]);
5068}
5069
5070ALIAS (clear_ip_bgp_peer_encap_soft_out,
5071 clear_ip_bgp_peer_encap_out_cmd,
5072 "clear ip bgp A.B.C.D encap unicast out",
5073 CLEAR_STR
5074 IP_STR
5075 BGP_STR
5076 "BGP neighbor address to clear\n"
5077 "Address family\n"
5078 "Address Family Modifier\n"
5079 "Soft reconfig outbound update\n")
5080
paul718e3742002-12-13 20:15:29 +00005081DEFUN (clear_bgp_peer_soft_out,
5082 clear_bgp_peer_soft_out_cmd,
5083 "clear bgp (A.B.C.D|X:X::X:X) soft out",
5084 CLEAR_STR
5085 BGP_STR
5086 "BGP neighbor address to clear\n"
5087 "BGP IPv6 neighbor to clear\n"
5088 "Soft reconfig\n"
5089 "Soft reconfig outbound update\n")
5090{
5091 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5092 BGP_CLEAR_SOFT_OUT, argv[0]);
5093}
5094
5095ALIAS (clear_bgp_peer_soft_out,
5096 clear_bgp_ipv6_peer_soft_out_cmd,
5097 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
5098 CLEAR_STR
5099 BGP_STR
5100 "Address family\n"
5101 "BGP neighbor address to clear\n"
5102 "BGP IPv6 neighbor to clear\n"
5103 "Soft reconfig\n"
5104 "Soft reconfig outbound update\n")
5105
5106ALIAS (clear_bgp_peer_soft_out,
5107 clear_bgp_peer_out_cmd,
5108 "clear bgp (A.B.C.D|X:X::X:X) out",
5109 CLEAR_STR
5110 BGP_STR
5111 "BGP neighbor address to clear\n"
5112 "BGP IPv6 neighbor to clear\n"
5113 "Soft reconfig outbound update\n")
5114
5115ALIAS (clear_bgp_peer_soft_out,
5116 clear_bgp_ipv6_peer_out_cmd,
5117 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
5118 CLEAR_STR
5119 BGP_STR
5120 "Address family\n"
5121 "BGP neighbor address to clear\n"
5122 "BGP IPv6 neighbor to clear\n"
5123 "Soft reconfig outbound update\n")
5124
5125DEFUN (clear_ip_bgp_peer_group_soft_out,
5126 clear_ip_bgp_peer_group_soft_out_cmd,
5127 "clear ip bgp peer-group WORD soft out",
5128 CLEAR_STR
5129 IP_STR
5130 BGP_STR
5131 "Clear all members of peer-group\n"
5132 "BGP peer-group name\n"
5133 "Soft reconfig\n"
5134 "Soft reconfig outbound update\n")
5135{
5136 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5137 BGP_CLEAR_SOFT_OUT, argv[0]);
5138}
5139
5140ALIAS (clear_ip_bgp_peer_group_soft_out,
5141 clear_ip_bgp_peer_group_out_cmd,
5142 "clear ip bgp peer-group WORD out",
5143 CLEAR_STR
5144 IP_STR
5145 BGP_STR
5146 "Clear all members of peer-group\n"
5147 "BGP peer-group name\n"
5148 "Soft reconfig outbound update\n")
5149
5150DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
5151 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
5152 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
5153 CLEAR_STR
5154 IP_STR
5155 BGP_STR
5156 "Clear all members of peer-group\n"
5157 "BGP peer-group name\n"
5158 "Address family\n"
5159 "Address Family modifier\n"
5160 "Address Family modifier\n"
5161 "Soft reconfig\n"
5162 "Soft reconfig outbound update\n")
5163{
5164 if (strncmp (argv[1], "m", 1) == 0)
5165 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5166 BGP_CLEAR_SOFT_OUT, argv[0]);
5167
5168 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5169 BGP_CLEAR_SOFT_OUT, argv[0]);
5170}
5171
5172ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
5173 clear_ip_bgp_peer_group_ipv4_out_cmd,
5174 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
5175 CLEAR_STR
5176 IP_STR
5177 BGP_STR
5178 "Clear all members of peer-group\n"
5179 "BGP peer-group name\n"
5180 "Address family\n"
5181 "Address Family modifier\n"
5182 "Address Family modifier\n"
5183 "Soft reconfig outbound update\n")
5184
5185DEFUN (clear_bgp_peer_group_soft_out,
5186 clear_bgp_peer_group_soft_out_cmd,
5187 "clear bgp peer-group WORD soft out",
5188 CLEAR_STR
5189 BGP_STR
5190 "Clear all members of peer-group\n"
5191 "BGP peer-group name\n"
5192 "Soft reconfig\n"
5193 "Soft reconfig outbound update\n")
5194{
5195 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5196 BGP_CLEAR_SOFT_OUT, argv[0]);
5197}
5198
5199ALIAS (clear_bgp_peer_group_soft_out,
5200 clear_bgp_ipv6_peer_group_soft_out_cmd,
5201 "clear bgp ipv6 peer-group WORD soft out",
5202 CLEAR_STR
5203 BGP_STR
5204 "Address family\n"
5205 "Clear all members of peer-group\n"
5206 "BGP peer-group name\n"
5207 "Soft reconfig\n"
5208 "Soft reconfig outbound update\n")
5209
5210ALIAS (clear_bgp_peer_group_soft_out,
5211 clear_bgp_peer_group_out_cmd,
5212 "clear bgp peer-group WORD out",
5213 CLEAR_STR
5214 BGP_STR
5215 "Clear all members of peer-group\n"
5216 "BGP peer-group name\n"
5217 "Soft reconfig outbound update\n")
5218
5219ALIAS (clear_bgp_peer_group_soft_out,
5220 clear_bgp_ipv6_peer_group_out_cmd,
5221 "clear bgp ipv6 peer-group WORD out",
5222 CLEAR_STR
5223 BGP_STR
5224 "Address family\n"
5225 "Clear all members of peer-group\n"
5226 "BGP peer-group name\n"
5227 "Soft reconfig outbound update\n")
5228
5229DEFUN (clear_ip_bgp_external_soft_out,
5230 clear_ip_bgp_external_soft_out_cmd,
5231 "clear ip bgp external soft out",
5232 CLEAR_STR
5233 IP_STR
5234 BGP_STR
5235 "Clear all external peers\n"
5236 "Soft reconfig\n"
5237 "Soft reconfig outbound update\n")
5238{
5239 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5240 BGP_CLEAR_SOFT_OUT, NULL);
5241}
5242
5243ALIAS (clear_ip_bgp_external_soft_out,
5244 clear_ip_bgp_external_out_cmd,
5245 "clear ip bgp external out",
5246 CLEAR_STR
5247 IP_STR
5248 BGP_STR
5249 "Clear all external peers\n"
5250 "Soft reconfig outbound update\n")
5251
5252DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5253 clear_ip_bgp_external_ipv4_soft_out_cmd,
5254 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5255 CLEAR_STR
5256 IP_STR
5257 BGP_STR
5258 "Clear all external peers\n"
5259 "Address family\n"
5260 "Address Family modifier\n"
5261 "Address Family modifier\n"
5262 "Soft reconfig\n"
5263 "Soft reconfig outbound update\n")
5264{
5265 if (strncmp (argv[0], "m", 1) == 0)
5266 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5267 BGP_CLEAR_SOFT_OUT, NULL);
5268
5269 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5270 BGP_CLEAR_SOFT_OUT, NULL);
5271}
5272
5273ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5274 clear_ip_bgp_external_ipv4_out_cmd,
5275 "clear ip bgp external ipv4 (unicast|multicast) out",
5276 CLEAR_STR
5277 IP_STR
5278 BGP_STR
5279 "Clear all external peers\n"
5280 "Address family\n"
5281 "Address Family modifier\n"
5282 "Address Family modifier\n"
5283 "Soft reconfig outbound update\n")
5284
5285DEFUN (clear_bgp_external_soft_out,
5286 clear_bgp_external_soft_out_cmd,
5287 "clear bgp external soft out",
5288 CLEAR_STR
5289 BGP_STR
5290 "Clear all external peers\n"
5291 "Soft reconfig\n"
5292 "Soft reconfig outbound update\n")
5293{
5294 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5295 BGP_CLEAR_SOFT_OUT, NULL);
5296}
5297
5298ALIAS (clear_bgp_external_soft_out,
5299 clear_bgp_ipv6_external_soft_out_cmd,
5300 "clear bgp ipv6 external soft out",
5301 CLEAR_STR
5302 BGP_STR
5303 "Address family\n"
5304 "Clear all external peers\n"
5305 "Soft reconfig\n"
5306 "Soft reconfig outbound update\n")
5307
5308ALIAS (clear_bgp_external_soft_out,
5309 clear_bgp_external_out_cmd,
5310 "clear bgp external out",
5311 CLEAR_STR
5312 BGP_STR
5313 "Clear all external peers\n"
5314 "Soft reconfig outbound update\n")
5315
5316ALIAS (clear_bgp_external_soft_out,
5317 clear_bgp_ipv6_external_out_cmd,
5318 "clear bgp ipv6 external WORD out",
5319 CLEAR_STR
5320 BGP_STR
5321 "Address family\n"
5322 "Clear all external peers\n"
5323 "Soft reconfig outbound update\n")
5324
5325DEFUN (clear_ip_bgp_as_soft_out,
5326 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005327 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005328 CLEAR_STR
5329 IP_STR
5330 BGP_STR
5331 "Clear peers with the AS number\n"
5332 "Soft reconfig\n"
5333 "Soft reconfig outbound update\n")
5334{
5335 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5336 BGP_CLEAR_SOFT_OUT, argv[0]);
5337}
5338
5339ALIAS (clear_ip_bgp_as_soft_out,
5340 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005341 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005342 CLEAR_STR
5343 IP_STR
5344 BGP_STR
5345 "Clear peers with the AS number\n"
5346 "Soft reconfig outbound update\n")
5347
5348DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5349 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005350 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005351 CLEAR_STR
5352 IP_STR
5353 BGP_STR
5354 "Clear peers with the AS number\n"
5355 "Address family\n"
5356 "Address Family modifier\n"
5357 "Address Family modifier\n"
5358 "Soft reconfig\n"
5359 "Soft reconfig outbound update\n")
5360{
5361 if (strncmp (argv[1], "m", 1) == 0)
5362 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5363 BGP_CLEAR_SOFT_OUT, argv[0]);
5364
5365 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5366 BGP_CLEAR_SOFT_OUT, argv[0]);
5367}
5368
5369ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5370 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005371 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) 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 "Address Family modifier\n"
5379 "Soft reconfig outbound update\n")
5380
5381DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5382 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005383 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00005384 CLEAR_STR
5385 IP_STR
5386 BGP_STR
5387 "Clear peers with the AS number\n"
5388 "Address family\n"
5389 "Address Family modifier\n"
5390 "Soft reconfig\n"
5391 "Soft reconfig outbound update\n")
5392{
5393 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5394 BGP_CLEAR_SOFT_OUT, argv[0]);
5395}
5396
5397ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5398 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005399 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005400 CLEAR_STR
5401 IP_STR
5402 BGP_STR
5403 "Clear peers with the AS number\n"
5404 "Address family\n"
5405 "Address Family modifier\n"
5406 "Soft reconfig outbound update\n")
5407
Lou Berger298cc2f2016-01-12 13:42:02 -05005408DEFUN (clear_ip_bgp_as_encap_soft_out,
5409 clear_ip_bgp_as_encap_soft_out_cmd,
5410 "clear ip bgp " CMD_AS_RANGE " encap unicast soft out",
5411 CLEAR_STR
5412 IP_STR
5413 BGP_STR
5414 "Clear peers with the AS number\n"
5415 "Address family\n"
5416 "Address Family modifier\n"
5417 "Soft reconfig\n"
5418 "Soft reconfig outbound update\n")
5419{
5420 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
5421 BGP_CLEAR_SOFT_OUT, argv[0]);
5422}
5423
5424ALIAS (clear_ip_bgp_as_encap_soft_out,
5425 clear_ip_bgp_as_encap_out_cmd,
5426 "clear ip bgp " CMD_AS_RANGE " encap unicast out",
5427 CLEAR_STR
5428 IP_STR
5429 BGP_STR
5430 "Clear peers with the AS number\n"
5431 "Address family\n"
5432 "Address Family modifier\n"
5433 "Soft reconfig outbound update\n")
5434
paul718e3742002-12-13 20:15:29 +00005435DEFUN (clear_bgp_as_soft_out,
5436 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005437 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005438 CLEAR_STR
5439 BGP_STR
5440 "Clear peers with the AS number\n"
5441 "Soft reconfig\n"
5442 "Soft reconfig outbound update\n")
5443{
5444 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5445 BGP_CLEAR_SOFT_OUT, argv[0]);
5446}
5447
5448ALIAS (clear_bgp_as_soft_out,
5449 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005450 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005451 CLEAR_STR
5452 BGP_STR
5453 "Address family\n"
5454 "Clear peers with the AS number\n"
5455 "Soft reconfig\n"
5456 "Soft reconfig outbound update\n")
5457
5458ALIAS (clear_bgp_as_soft_out,
5459 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005460 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005461 CLEAR_STR
5462 BGP_STR
5463 "Clear peers with the AS number\n"
5464 "Soft reconfig outbound update\n")
5465
5466ALIAS (clear_bgp_as_soft_out,
5467 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005468 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005469 CLEAR_STR
5470 BGP_STR
5471 "Address family\n"
5472 "Clear peers with the AS number\n"
5473 "Soft reconfig outbound update\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02005474
paul718e3742002-12-13 20:15:29 +00005475/* Inbound soft-reconfiguration */
5476DEFUN (clear_ip_bgp_all_soft_in,
5477 clear_ip_bgp_all_soft_in_cmd,
5478 "clear ip bgp * soft in",
5479 CLEAR_STR
5480 IP_STR
5481 BGP_STR
5482 "Clear all peers\n"
5483 "Soft reconfig\n"
5484 "Soft reconfig inbound update\n")
5485{
5486 if (argc == 1)
5487 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5488 BGP_CLEAR_SOFT_IN, NULL);
5489
5490 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5491 BGP_CLEAR_SOFT_IN, NULL);
5492}
5493
5494ALIAS (clear_ip_bgp_all_soft_in,
5495 clear_ip_bgp_instance_all_soft_in_cmd,
5496 "clear ip bgp view WORD * soft in",
5497 CLEAR_STR
5498 IP_STR
5499 BGP_STR
5500 "BGP view\n"
5501 "view name\n"
5502 "Clear all peers\n"
5503 "Soft reconfig\n"
5504 "Soft reconfig inbound update\n")
5505
5506ALIAS (clear_ip_bgp_all_soft_in,
5507 clear_ip_bgp_all_in_cmd,
5508 "clear ip bgp * in",
5509 CLEAR_STR
5510 IP_STR
5511 BGP_STR
5512 "Clear all peers\n"
5513 "Soft reconfig inbound update\n")
5514
5515DEFUN (clear_ip_bgp_all_in_prefix_filter,
5516 clear_ip_bgp_all_in_prefix_filter_cmd,
5517 "clear ip bgp * in prefix-filter",
5518 CLEAR_STR
5519 IP_STR
5520 BGP_STR
5521 "Clear all peers\n"
5522 "Soft reconfig inbound update\n"
5523 "Push out prefix-list ORF and do inbound soft reconfig\n")
5524{
5525 if (argc== 1)
5526 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5527 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5528
5529 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5530 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5531}
5532
5533ALIAS (clear_ip_bgp_all_in_prefix_filter,
5534 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5535 "clear ip bgp view WORD * in prefix-filter",
5536 CLEAR_STR
5537 IP_STR
5538 BGP_STR
5539 "BGP view\n"
5540 "view name\n"
5541 "Clear all peers\n"
5542 "Soft reconfig inbound update\n"
5543 "Push out prefix-list ORF and do inbound soft reconfig\n")
5544
5545
5546DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5547 clear_ip_bgp_all_ipv4_soft_in_cmd,
5548 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5549 CLEAR_STR
5550 IP_STR
5551 BGP_STR
5552 "Clear all peers\n"
5553 "Address family\n"
5554 "Address Family modifier\n"
5555 "Address Family modifier\n"
5556 "Soft reconfig\n"
5557 "Soft reconfig inbound update\n")
5558{
5559 if (strncmp (argv[0], "m", 1) == 0)
5560 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5561 BGP_CLEAR_SOFT_IN, NULL);
5562
5563 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5564 BGP_CLEAR_SOFT_IN, NULL);
5565}
5566
5567ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5568 clear_ip_bgp_all_ipv4_in_cmd,
5569 "clear ip bgp * ipv4 (unicast|multicast) in",
5570 CLEAR_STR
5571 IP_STR
5572 BGP_STR
5573 "Clear all peers\n"
5574 "Address family\n"
5575 "Address Family modifier\n"
5576 "Address Family modifier\n"
5577 "Soft reconfig inbound update\n")
5578
5579DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5580 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5581 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5582 CLEAR_STR
5583 IP_STR
5584 BGP_STR
5585 "BGP view\n"
5586 "view name\n"
5587 "Clear all peers\n"
5588 "Address family\n"
5589 "Address Family modifier\n"
5590 "Address Family modifier\n"
5591 "Soft reconfig\n"
5592 "Soft reconfig inbound update\n")
5593{
5594 if (strncmp (argv[1], "m", 1) == 0)
5595 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5596 BGP_CLEAR_SOFT_IN, NULL);
5597
5598 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5599 BGP_CLEAR_SOFT_IN, NULL);
5600}
5601
5602DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5603 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5604 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5605 CLEAR_STR
5606 IP_STR
5607 BGP_STR
5608 "Clear all peers\n"
5609 "Address family\n"
5610 "Address Family modifier\n"
5611 "Address Family modifier\n"
5612 "Soft reconfig inbound update\n"
5613 "Push out prefix-list ORF and do inbound soft reconfig\n")
5614{
5615 if (strncmp (argv[0], "m", 1) == 0)
5616 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5617 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5618
5619 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5620 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5621}
5622
5623DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5624 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5625 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5626 CLEAR_STR
5627 IP_STR
5628 BGP_STR
5629 "Clear all peers\n"
5630 "Address family\n"
5631 "Address Family modifier\n"
5632 "Address Family modifier\n"
5633 "Soft reconfig inbound update\n"
5634 "Push out prefix-list ORF and do inbound soft reconfig\n")
5635{
5636 if (strncmp (argv[1], "m", 1) == 0)
5637 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5638 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5639
5640 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5641 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5642}
5643
5644DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5645 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5646 "clear ip bgp * vpnv4 unicast soft in",
5647 CLEAR_STR
5648 IP_STR
5649 BGP_STR
5650 "Clear all peers\n"
5651 "Address family\n"
5652 "Address Family Modifier\n"
5653 "Soft reconfig\n"
5654 "Soft reconfig inbound update\n")
5655{
5656 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5657 BGP_CLEAR_SOFT_IN, NULL);
5658}
5659
5660ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5661 clear_ip_bgp_all_vpnv4_in_cmd,
5662 "clear ip bgp * vpnv4 unicast in",
5663 CLEAR_STR
5664 IP_STR
5665 BGP_STR
5666 "Clear all peers\n"
5667 "Address family\n"
5668 "Address Family Modifier\n"
5669 "Soft reconfig inbound update\n")
5670
Lou Berger298cc2f2016-01-12 13:42:02 -05005671DEFUN (clear_ip_bgp_all_encap_soft_in,
5672 clear_ip_bgp_all_encap_soft_in_cmd,
5673 "clear ip bgp * encap unicast soft in",
5674 CLEAR_STR
5675 IP_STR
5676 BGP_STR
5677 "Clear all peers\n"
5678 "Address family\n"
5679 "Address Family Modifier\n"
5680 "Soft reconfig\n"
5681 "Soft reconfig inbound update\n")
5682{
5683 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
5684 BGP_CLEAR_SOFT_IN, NULL);
5685}
5686
5687ALIAS (clear_ip_bgp_all_encap_soft_in,
5688 clear_ip_bgp_all_encap_in_cmd,
5689 "clear ip bgp * encap unicast in",
5690 CLEAR_STR
5691 IP_STR
5692 BGP_STR
5693 "Clear all peers\n"
5694 "Address family\n"
5695 "Address Family Modifier\n"
5696 "Soft reconfig inbound update\n")
5697
paul718e3742002-12-13 20:15:29 +00005698DEFUN (clear_bgp_all_soft_in,
5699 clear_bgp_all_soft_in_cmd,
5700 "clear bgp * soft in",
5701 CLEAR_STR
5702 BGP_STR
5703 "Clear all peers\n"
5704 "Soft reconfig\n"
5705 "Soft reconfig inbound update\n")
5706{
5707 if (argc == 1)
5708 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5709 BGP_CLEAR_SOFT_IN, NULL);
5710
5711 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5712 BGP_CLEAR_SOFT_IN, NULL);
5713}
5714
5715ALIAS (clear_bgp_all_soft_in,
5716 clear_bgp_instance_all_soft_in_cmd,
5717 "clear bgp view WORD * soft in",
5718 CLEAR_STR
5719 BGP_STR
5720 "BGP view\n"
5721 "view name\n"
5722 "Clear all peers\n"
5723 "Soft reconfig\n"
5724 "Soft reconfig inbound update\n")
5725
5726ALIAS (clear_bgp_all_soft_in,
5727 clear_bgp_ipv6_all_soft_in_cmd,
5728 "clear bgp ipv6 * soft in",
5729 CLEAR_STR
5730 BGP_STR
5731 "Address family\n"
5732 "Clear all peers\n"
5733 "Soft reconfig\n"
5734 "Soft reconfig inbound update\n")
5735
5736ALIAS (clear_bgp_all_soft_in,
5737 clear_bgp_all_in_cmd,
5738 "clear bgp * in",
5739 CLEAR_STR
5740 BGP_STR
5741 "Clear all peers\n"
5742 "Soft reconfig inbound update\n")
5743
5744ALIAS (clear_bgp_all_soft_in,
5745 clear_bgp_ipv6_all_in_cmd,
5746 "clear bgp ipv6 * in",
5747 CLEAR_STR
5748 BGP_STR
5749 "Address family\n"
5750 "Clear all peers\n"
5751 "Soft reconfig inbound update\n")
5752
5753DEFUN (clear_bgp_all_in_prefix_filter,
5754 clear_bgp_all_in_prefix_filter_cmd,
5755 "clear bgp * in prefix-filter",
5756 CLEAR_STR
5757 BGP_STR
5758 "Clear all peers\n"
5759 "Soft reconfig inbound update\n"
5760 "Push out prefix-list ORF and do inbound soft reconfig\n")
5761{
5762 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5763 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5764}
5765
5766ALIAS (clear_bgp_all_in_prefix_filter,
5767 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5768 "clear bgp ipv6 * in prefix-filter",
5769 CLEAR_STR
5770 BGP_STR
5771 "Address family\n"
5772 "Clear all peers\n"
5773 "Soft reconfig inbound update\n"
5774 "Push out prefix-list ORF and do inbound soft reconfig\n")
5775
5776DEFUN (clear_ip_bgp_peer_soft_in,
5777 clear_ip_bgp_peer_soft_in_cmd,
5778 "clear ip bgp A.B.C.D soft in",
5779 CLEAR_STR
5780 IP_STR
5781 BGP_STR
5782 "BGP neighbor address to clear\n"
5783 "Soft reconfig\n"
5784 "Soft reconfig inbound update\n")
5785{
5786 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5787 BGP_CLEAR_SOFT_IN, argv[0]);
5788}
5789
5790ALIAS (clear_ip_bgp_peer_soft_in,
5791 clear_ip_bgp_peer_in_cmd,
5792 "clear ip bgp A.B.C.D in",
5793 CLEAR_STR
5794 IP_STR
5795 BGP_STR
5796 "BGP neighbor address to clear\n"
5797 "Soft reconfig inbound update\n")
5798
5799DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5800 clear_ip_bgp_peer_in_prefix_filter_cmd,
5801 "clear ip bgp A.B.C.D in prefix-filter",
5802 CLEAR_STR
5803 IP_STR
5804 BGP_STR
5805 "BGP neighbor address to clear\n"
5806 "Soft reconfig inbound update\n"
5807 "Push out the existing ORF prefix-list\n")
5808{
5809 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5810 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5811}
5812
5813DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5814 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5815 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5816 CLEAR_STR
5817 IP_STR
5818 BGP_STR
5819 "BGP neighbor address to clear\n"
5820 "Address family\n"
5821 "Address Family modifier\n"
5822 "Address Family modifier\n"
5823 "Soft reconfig\n"
5824 "Soft reconfig inbound update\n")
5825{
5826 if (strncmp (argv[1], "m", 1) == 0)
5827 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5828 BGP_CLEAR_SOFT_IN, argv[0]);
5829
5830 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5831 BGP_CLEAR_SOFT_IN, argv[0]);
5832}
5833
5834ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5835 clear_ip_bgp_peer_ipv4_in_cmd,
5836 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
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
5846DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5847 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5848 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5849 CLEAR_STR
5850 IP_STR
5851 BGP_STR
5852 "BGP neighbor address to clear\n"
5853 "Address family\n"
5854 "Address Family modifier\n"
5855 "Address Family modifier\n"
5856 "Soft reconfig inbound update\n"
5857 "Push out the existing ORF prefix-list\n")
5858{
5859 if (strncmp (argv[1], "m", 1) == 0)
5860 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5861 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5862
5863 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5864 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5865}
5866
5867DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5868 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5869 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5870 CLEAR_STR
5871 IP_STR
5872 BGP_STR
5873 "BGP neighbor address to clear\n"
5874 "Address family\n"
5875 "Address Family Modifier\n"
5876 "Soft reconfig\n"
5877 "Soft reconfig inbound update\n")
5878{
5879 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5880 BGP_CLEAR_SOFT_IN, argv[0]);
5881}
5882
5883ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5884 clear_ip_bgp_peer_vpnv4_in_cmd,
5885 "clear ip bgp A.B.C.D vpnv4 unicast in",
5886 CLEAR_STR
5887 IP_STR
5888 BGP_STR
5889 "BGP neighbor address to clear\n"
5890 "Address family\n"
5891 "Address Family Modifier\n"
5892 "Soft reconfig inbound update\n")
5893
Lou Berger298cc2f2016-01-12 13:42:02 -05005894DEFUN (clear_ip_bgp_peer_encap_soft_in,
5895 clear_ip_bgp_peer_encap_soft_in_cmd,
5896 "clear ip bgp A.B.C.D encap unicast soft in",
5897 CLEAR_STR
5898 IP_STR
5899 BGP_STR
5900 "BGP neighbor address to clear\n"
5901 "Address family\n"
5902 "Address Family Modifier\n"
5903 "Soft reconfig\n"
5904 "Soft reconfig inbound update\n")
5905{
5906 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5907 BGP_CLEAR_SOFT_IN, argv[0]);
5908}
5909
5910ALIAS (clear_ip_bgp_peer_encap_soft_in,
5911 clear_ip_bgp_peer_encap_in_cmd,
5912 "clear ip bgp A.B.C.D encap unicast in",
5913 CLEAR_STR
5914 IP_STR
5915 BGP_STR
5916 "BGP neighbor address to clear\n"
5917 "Address family\n"
5918 "Address Family Modifier\n"
5919 "Soft reconfig inbound update\n")
5920
paul718e3742002-12-13 20:15:29 +00005921DEFUN (clear_bgp_peer_soft_in,
5922 clear_bgp_peer_soft_in_cmd,
5923 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5924 CLEAR_STR
5925 BGP_STR
5926 "BGP neighbor address to clear\n"
5927 "BGP IPv6 neighbor to clear\n"
5928 "Soft reconfig\n"
5929 "Soft reconfig inbound update\n")
5930{
5931 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5932 BGP_CLEAR_SOFT_IN, argv[0]);
5933}
5934
5935ALIAS (clear_bgp_peer_soft_in,
5936 clear_bgp_ipv6_peer_soft_in_cmd,
5937 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5938 CLEAR_STR
5939 BGP_STR
5940 "Address family\n"
5941 "BGP neighbor address to clear\n"
5942 "BGP IPv6 neighbor to clear\n"
5943 "Soft reconfig\n"
5944 "Soft reconfig inbound update\n")
5945
5946ALIAS (clear_bgp_peer_soft_in,
5947 clear_bgp_peer_in_cmd,
5948 "clear bgp (A.B.C.D|X:X::X:X) in",
5949 CLEAR_STR
5950 BGP_STR
5951 "BGP neighbor address to clear\n"
5952 "BGP IPv6 neighbor to clear\n"
5953 "Soft reconfig inbound update\n")
5954
5955ALIAS (clear_bgp_peer_soft_in,
5956 clear_bgp_ipv6_peer_in_cmd,
5957 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5958 CLEAR_STR
5959 BGP_STR
5960 "Address family\n"
5961 "BGP neighbor address to clear\n"
5962 "BGP IPv6 neighbor to clear\n"
5963 "Soft reconfig inbound update\n")
5964
5965DEFUN (clear_bgp_peer_in_prefix_filter,
5966 clear_bgp_peer_in_prefix_filter_cmd,
5967 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5968 CLEAR_STR
5969 BGP_STR
5970 "BGP neighbor address to clear\n"
5971 "BGP IPv6 neighbor to clear\n"
5972 "Soft reconfig inbound update\n"
5973 "Push out the existing ORF prefix-list\n")
5974{
5975 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5976 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5977}
5978
5979ALIAS (clear_bgp_peer_in_prefix_filter,
5980 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5981 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5982 CLEAR_STR
5983 BGP_STR
5984 "Address family\n"
5985 "BGP neighbor address to clear\n"
5986 "BGP IPv6 neighbor to clear\n"
5987 "Soft reconfig inbound update\n"
5988 "Push out the existing ORF prefix-list\n")
5989
5990DEFUN (clear_ip_bgp_peer_group_soft_in,
5991 clear_ip_bgp_peer_group_soft_in_cmd,
5992 "clear ip bgp peer-group WORD soft in",
5993 CLEAR_STR
5994 IP_STR
5995 BGP_STR
5996 "Clear all members of peer-group\n"
5997 "BGP peer-group name\n"
5998 "Soft reconfig\n"
5999 "Soft reconfig inbound update\n")
6000{
6001 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6002 BGP_CLEAR_SOFT_IN, argv[0]);
6003}
6004
6005ALIAS (clear_ip_bgp_peer_group_soft_in,
6006 clear_ip_bgp_peer_group_in_cmd,
6007 "clear ip bgp peer-group WORD in",
6008 CLEAR_STR
6009 IP_STR
6010 BGP_STR
6011 "Clear all members of peer-group\n"
6012 "BGP peer-group name\n"
6013 "Soft reconfig inbound update\n")
6014
6015DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
6016 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
6017 "clear ip bgp peer-group WORD in prefix-filter",
6018 CLEAR_STR
6019 IP_STR
6020 BGP_STR
6021 "Clear all members of peer-group\n"
6022 "BGP peer-group name\n"
6023 "Soft reconfig inbound update\n"
6024 "Push out prefix-list ORF and do inbound soft reconfig\n")
6025{
6026 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6027 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6028}
6029
6030DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
6031 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
6032 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
6033 CLEAR_STR
6034 IP_STR
6035 BGP_STR
6036 "Clear all members of peer-group\n"
6037 "BGP peer-group name\n"
6038 "Address family\n"
6039 "Address Family modifier\n"
6040 "Address Family modifier\n"
6041 "Soft reconfig\n"
6042 "Soft reconfig inbound update\n")
6043{
6044 if (strncmp (argv[1], "m", 1) == 0)
6045 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6046 BGP_CLEAR_SOFT_IN, argv[0]);
6047
6048 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6049 BGP_CLEAR_SOFT_IN, argv[0]);
6050}
6051
6052ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
6053 clear_ip_bgp_peer_group_ipv4_in_cmd,
6054 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
6055 CLEAR_STR
6056 IP_STR
6057 BGP_STR
6058 "Clear all members of peer-group\n"
6059 "BGP peer-group name\n"
6060 "Address family\n"
6061 "Address Family modifier\n"
6062 "Address Family modifier\n"
6063 "Soft reconfig inbound update\n")
6064
6065DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
6066 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
6067 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
6068 CLEAR_STR
6069 IP_STR
6070 BGP_STR
6071 "Clear all members of peer-group\n"
6072 "BGP peer-group name\n"
6073 "Address family\n"
6074 "Address Family modifier\n"
6075 "Address Family modifier\n"
6076 "Soft reconfig inbound update\n"
6077 "Push out prefix-list ORF and do inbound soft reconfig\n")
6078{
6079 if (strncmp (argv[1], "m", 1) == 0)
6080 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6081 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6082
6083 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6084 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6085}
6086
6087DEFUN (clear_bgp_peer_group_soft_in,
6088 clear_bgp_peer_group_soft_in_cmd,
6089 "clear bgp peer-group WORD soft in",
6090 CLEAR_STR
6091 BGP_STR
6092 "Clear all members of peer-group\n"
6093 "BGP peer-group name\n"
6094 "Soft reconfig\n"
6095 "Soft reconfig inbound update\n")
6096{
6097 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6098 BGP_CLEAR_SOFT_IN, argv[0]);
6099}
6100
6101ALIAS (clear_bgp_peer_group_soft_in,
6102 clear_bgp_ipv6_peer_group_soft_in_cmd,
6103 "clear bgp ipv6 peer-group WORD soft in",
6104 CLEAR_STR
6105 BGP_STR
6106 "Address family\n"
6107 "Clear all members of peer-group\n"
6108 "BGP peer-group name\n"
6109 "Soft reconfig\n"
6110 "Soft reconfig inbound update\n")
6111
6112ALIAS (clear_bgp_peer_group_soft_in,
6113 clear_bgp_peer_group_in_cmd,
6114 "clear bgp peer-group WORD in",
6115 CLEAR_STR
6116 BGP_STR
6117 "Clear all members of peer-group\n"
6118 "BGP peer-group name\n"
6119 "Soft reconfig inbound update\n")
6120
6121ALIAS (clear_bgp_peer_group_soft_in,
6122 clear_bgp_ipv6_peer_group_in_cmd,
6123 "clear bgp ipv6 peer-group WORD in",
6124 CLEAR_STR
6125 BGP_STR
6126 "Address family\n"
6127 "Clear all members of peer-group\n"
6128 "BGP peer-group name\n"
6129 "Soft reconfig inbound update\n")
6130
6131DEFUN (clear_bgp_peer_group_in_prefix_filter,
6132 clear_bgp_peer_group_in_prefix_filter_cmd,
6133 "clear bgp peer-group WORD in prefix-filter",
6134 CLEAR_STR
6135 BGP_STR
6136 "Clear all members of peer-group\n"
6137 "BGP peer-group name\n"
6138 "Soft reconfig inbound update\n"
6139 "Push out prefix-list ORF and do inbound soft reconfig\n")
6140{
6141 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6142 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6143}
6144
6145ALIAS (clear_bgp_peer_group_in_prefix_filter,
6146 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
6147 "clear bgp ipv6 peer-group WORD in prefix-filter",
6148 CLEAR_STR
6149 BGP_STR
6150 "Address family\n"
6151 "Clear all members of peer-group\n"
6152 "BGP peer-group name\n"
6153 "Soft reconfig inbound update\n"
6154 "Push out prefix-list ORF and do inbound soft reconfig\n")
6155
6156DEFUN (clear_ip_bgp_external_soft_in,
6157 clear_ip_bgp_external_soft_in_cmd,
6158 "clear ip bgp external soft in",
6159 CLEAR_STR
6160 IP_STR
6161 BGP_STR
6162 "Clear all external peers\n"
6163 "Soft reconfig\n"
6164 "Soft reconfig inbound update\n")
6165{
6166 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6167 BGP_CLEAR_SOFT_IN, NULL);
6168}
6169
6170ALIAS (clear_ip_bgp_external_soft_in,
6171 clear_ip_bgp_external_in_cmd,
6172 "clear ip bgp external in",
6173 CLEAR_STR
6174 IP_STR
6175 BGP_STR
6176 "Clear all external peers\n"
6177 "Soft reconfig inbound update\n")
6178
6179DEFUN (clear_ip_bgp_external_in_prefix_filter,
6180 clear_ip_bgp_external_in_prefix_filter_cmd,
6181 "clear ip bgp external in prefix-filter",
6182 CLEAR_STR
6183 IP_STR
6184 BGP_STR
6185 "Clear all external peers\n"
6186 "Soft reconfig inbound update\n"
6187 "Push out prefix-list ORF and do inbound soft reconfig\n")
6188{
6189 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6190 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6191}
6192
6193DEFUN (clear_ip_bgp_external_ipv4_soft_in,
6194 clear_ip_bgp_external_ipv4_soft_in_cmd,
6195 "clear ip bgp external ipv4 (unicast|multicast) soft in",
6196 CLEAR_STR
6197 IP_STR
6198 BGP_STR
6199 "Clear all external peers\n"
6200 "Address family\n"
6201 "Address Family modifier\n"
6202 "Address Family modifier\n"
6203 "Soft reconfig\n"
6204 "Soft reconfig inbound update\n")
6205{
6206 if (strncmp (argv[0], "m", 1) == 0)
6207 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6208 BGP_CLEAR_SOFT_IN, NULL);
6209
6210 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6211 BGP_CLEAR_SOFT_IN, NULL);
6212}
6213
6214ALIAS (clear_ip_bgp_external_ipv4_soft_in,
6215 clear_ip_bgp_external_ipv4_in_cmd,
6216 "clear ip bgp external ipv4 (unicast|multicast) in",
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
6226DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
6227 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
6228 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
6229 CLEAR_STR
6230 IP_STR
6231 BGP_STR
6232 "Clear all external peers\n"
6233 "Address family\n"
6234 "Address Family modifier\n"
6235 "Address Family modifier\n"
6236 "Soft reconfig inbound update\n"
6237 "Push out prefix-list ORF and do inbound soft reconfig\n")
6238{
6239 if (strncmp (argv[0], "m", 1) == 0)
6240 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6241 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6242
6243 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6244 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6245}
6246
6247DEFUN (clear_bgp_external_soft_in,
6248 clear_bgp_external_soft_in_cmd,
6249 "clear bgp external soft in",
6250 CLEAR_STR
6251 BGP_STR
6252 "Clear all external peers\n"
6253 "Soft reconfig\n"
6254 "Soft reconfig inbound update\n")
6255{
6256 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6257 BGP_CLEAR_SOFT_IN, NULL);
6258}
6259
6260ALIAS (clear_bgp_external_soft_in,
6261 clear_bgp_ipv6_external_soft_in_cmd,
6262 "clear bgp ipv6 external soft in",
6263 CLEAR_STR
6264 BGP_STR
6265 "Address family\n"
6266 "Clear all external peers\n"
6267 "Soft reconfig\n"
6268 "Soft reconfig inbound update\n")
6269
6270ALIAS (clear_bgp_external_soft_in,
6271 clear_bgp_external_in_cmd,
6272 "clear bgp external in",
6273 CLEAR_STR
6274 BGP_STR
6275 "Clear all external peers\n"
6276 "Soft reconfig inbound update\n")
6277
6278ALIAS (clear_bgp_external_soft_in,
6279 clear_bgp_ipv6_external_in_cmd,
6280 "clear bgp ipv6 external WORD in",
6281 CLEAR_STR
6282 BGP_STR
6283 "Address family\n"
6284 "Clear all external peers\n"
6285 "Soft reconfig inbound update\n")
6286
6287DEFUN (clear_bgp_external_in_prefix_filter,
6288 clear_bgp_external_in_prefix_filter_cmd,
6289 "clear bgp external in prefix-filter",
6290 CLEAR_STR
6291 BGP_STR
6292 "Clear all external peers\n"
6293 "Soft reconfig inbound update\n"
6294 "Push out prefix-list ORF and do inbound soft reconfig\n")
6295{
6296 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6297 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6298}
6299
6300ALIAS (clear_bgp_external_in_prefix_filter,
6301 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6302 "clear bgp ipv6 external in prefix-filter",
6303 CLEAR_STR
6304 BGP_STR
6305 "Address family\n"
6306 "Clear all external peers\n"
6307 "Soft reconfig inbound update\n"
6308 "Push out prefix-list ORF and do inbound soft reconfig\n")
6309
6310DEFUN (clear_ip_bgp_as_soft_in,
6311 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006312 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006313 CLEAR_STR
6314 IP_STR
6315 BGP_STR
6316 "Clear peers with the AS number\n"
6317 "Soft reconfig\n"
6318 "Soft reconfig inbound update\n")
6319{
6320 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6321 BGP_CLEAR_SOFT_IN, argv[0]);
6322}
6323
6324ALIAS (clear_ip_bgp_as_soft_in,
6325 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006326 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006327 CLEAR_STR
6328 IP_STR
6329 BGP_STR
6330 "Clear peers with the AS number\n"
6331 "Soft reconfig inbound update\n")
6332
6333DEFUN (clear_ip_bgp_as_in_prefix_filter,
6334 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006335 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006336 CLEAR_STR
6337 IP_STR
6338 BGP_STR
6339 "Clear peers with the AS number\n"
6340 "Soft reconfig inbound update\n"
6341 "Push out prefix-list ORF and do inbound soft reconfig\n")
6342{
6343 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6344 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6345}
6346
6347DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6348 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006349 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006350 CLEAR_STR
6351 IP_STR
6352 BGP_STR
6353 "Clear peers with the AS number\n"
6354 "Address family\n"
6355 "Address Family modifier\n"
6356 "Address Family modifier\n"
6357 "Soft reconfig\n"
6358 "Soft reconfig inbound update\n")
6359{
6360 if (strncmp (argv[1], "m", 1) == 0)
6361 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6362 BGP_CLEAR_SOFT_IN, argv[0]);
6363
6364 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6365 BGP_CLEAR_SOFT_IN, argv[0]);
6366}
6367
6368ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6369 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006370 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
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
6380DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6381 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006382 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006383 CLEAR_STR
6384 IP_STR
6385 BGP_STR
6386 "Clear peers with the AS number\n"
6387 "Address family\n"
6388 "Address Family modifier\n"
6389 "Address Family modifier\n"
6390 "Soft reconfig inbound update\n"
6391 "Push out prefix-list ORF and do inbound soft reconfig\n")
6392{
6393 if (strncmp (argv[1], "m", 1) == 0)
6394 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6395 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6396
6397 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6398 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6399}
6400
6401DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6402 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006403 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00006404 CLEAR_STR
6405 IP_STR
6406 BGP_STR
6407 "Clear peers with the AS number\n"
6408 "Address family\n"
6409 "Address Family modifier\n"
6410 "Soft reconfig\n"
6411 "Soft reconfig inbound update\n")
6412{
6413 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6414 BGP_CLEAR_SOFT_IN, argv[0]);
6415}
6416
6417ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6418 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006419 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006420 CLEAR_STR
6421 IP_STR
6422 BGP_STR
6423 "Clear peers with the AS number\n"
6424 "Address family\n"
6425 "Address Family modifier\n"
6426 "Soft reconfig inbound update\n")
6427
Lou Berger298cc2f2016-01-12 13:42:02 -05006428DEFUN (clear_ip_bgp_as_encap_soft_in,
6429 clear_ip_bgp_as_encap_soft_in_cmd,
6430 "clear ip bgp " CMD_AS_RANGE " encap unicast soft in",
6431 CLEAR_STR
6432 IP_STR
6433 BGP_STR
6434 "Clear peers with the AS number\n"
6435 "Address family\n"
6436 "Address Family modifier\n"
6437 "Soft reconfig\n"
6438 "Soft reconfig inbound update\n")
6439{
6440 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6441 BGP_CLEAR_SOFT_IN, argv[0]);
6442}
6443
6444ALIAS (clear_ip_bgp_as_encap_soft_in,
6445 clear_ip_bgp_as_encap_in_cmd,
6446 "clear ip bgp " CMD_AS_RANGE " encap unicast in",
6447 CLEAR_STR
6448 IP_STR
6449 BGP_STR
6450 "Clear peers with the AS number\n"
6451 "Address family\n"
6452 "Address Family modifier\n"
6453 "Soft reconfig inbound update\n")
6454
paul718e3742002-12-13 20:15:29 +00006455DEFUN (clear_bgp_as_soft_in,
6456 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006457 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006458 CLEAR_STR
6459 BGP_STR
6460 "Clear peers with the AS number\n"
6461 "Soft reconfig\n"
6462 "Soft reconfig inbound update\n")
6463{
6464 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6465 BGP_CLEAR_SOFT_IN, argv[0]);
6466}
6467
6468ALIAS (clear_bgp_as_soft_in,
6469 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006470 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006471 CLEAR_STR
6472 BGP_STR
6473 "Address family\n"
6474 "Clear peers with the AS number\n"
6475 "Soft reconfig\n"
6476 "Soft reconfig inbound update\n")
6477
6478ALIAS (clear_bgp_as_soft_in,
6479 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006480 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006481 CLEAR_STR
6482 BGP_STR
6483 "Clear peers with the AS number\n"
6484 "Soft reconfig inbound update\n")
6485
6486ALIAS (clear_bgp_as_soft_in,
6487 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006488 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006489 CLEAR_STR
6490 BGP_STR
6491 "Address family\n"
6492 "Clear peers with the AS number\n"
6493 "Soft reconfig inbound update\n")
6494
6495DEFUN (clear_bgp_as_in_prefix_filter,
6496 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006497 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006498 CLEAR_STR
6499 BGP_STR
6500 "Clear peers with the AS number\n"
6501 "Soft reconfig inbound update\n"
6502 "Push out prefix-list ORF and do inbound soft reconfig\n")
6503{
6504 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6505 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6506}
6507
6508ALIAS (clear_bgp_as_in_prefix_filter,
6509 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006510 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006511 CLEAR_STR
6512 BGP_STR
6513 "Address family\n"
6514 "Clear peers with the AS number\n"
6515 "Soft reconfig inbound update\n"
6516 "Push out prefix-list ORF and do inbound soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006517
paul718e3742002-12-13 20:15:29 +00006518/* Both soft-reconfiguration */
6519DEFUN (clear_ip_bgp_all_soft,
6520 clear_ip_bgp_all_soft_cmd,
6521 "clear ip bgp * soft",
6522 CLEAR_STR
6523 IP_STR
6524 BGP_STR
6525 "Clear all peers\n"
6526 "Soft reconfig\n")
6527{
6528 if (argc == 1)
6529 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6530 BGP_CLEAR_SOFT_BOTH, NULL);
6531
6532 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6533 BGP_CLEAR_SOFT_BOTH, NULL);
6534}
6535
6536ALIAS (clear_ip_bgp_all_soft,
6537 clear_ip_bgp_instance_all_soft_cmd,
6538 "clear ip bgp view WORD * soft",
6539 CLEAR_STR
6540 IP_STR
6541 BGP_STR
6542 "BGP view\n"
6543 "view name\n"
6544 "Clear all peers\n"
6545 "Soft reconfig\n")
6546
6547
6548DEFUN (clear_ip_bgp_all_ipv4_soft,
6549 clear_ip_bgp_all_ipv4_soft_cmd,
6550 "clear ip bgp * ipv4 (unicast|multicast) soft",
6551 CLEAR_STR
6552 IP_STR
6553 BGP_STR
6554 "Clear all peers\n"
6555 "Address family\n"
6556 "Address Family Modifier\n"
6557 "Address Family Modifier\n"
6558 "Soft reconfig\n")
6559{
6560 if (strncmp (argv[0], "m", 1) == 0)
6561 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6562 BGP_CLEAR_SOFT_BOTH, NULL);
6563
6564 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6565 BGP_CLEAR_SOFT_BOTH, NULL);
6566}
6567
6568DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6569 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6570 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6571 CLEAR_STR
6572 IP_STR
6573 BGP_STR
6574 "BGP view\n"
6575 "view name\n"
6576 "Clear all peers\n"
6577 "Address family\n"
6578 "Address Family Modifier\n"
6579 "Address Family Modifier\n"
6580 "Soft reconfig\n")
6581{
6582 if (strncmp (argv[1], "m", 1) == 0)
6583 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6584 BGP_CLEAR_SOFT_BOTH, NULL);
6585
6586 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6587 BGP_CLEAR_SOFT_BOTH, NULL);
6588}
6589
6590DEFUN (clear_ip_bgp_all_vpnv4_soft,
6591 clear_ip_bgp_all_vpnv4_soft_cmd,
6592 "clear ip bgp * vpnv4 unicast soft",
6593 CLEAR_STR
6594 IP_STR
6595 BGP_STR
6596 "Clear all peers\n"
6597 "Address family\n"
6598 "Address Family Modifier\n"
6599 "Soft reconfig\n")
6600{
6601 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6602 BGP_CLEAR_SOFT_BOTH, argv[0]);
6603}
6604
Lou Berger298cc2f2016-01-12 13:42:02 -05006605DEFUN (clear_ip_bgp_all_encap_soft,
6606 clear_ip_bgp_all_encap_soft_cmd,
6607 "clear ip bgp * encap unicast soft",
6608 CLEAR_STR
6609 IP_STR
6610 BGP_STR
6611 "Clear all peers\n"
6612 "Address family\n"
6613 "Address Family Modifier\n"
6614 "Soft reconfig\n")
6615{
6616 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
6617 BGP_CLEAR_SOFT_BOTH, argv[0]);
6618}
6619
paul718e3742002-12-13 20:15:29 +00006620DEFUN (clear_bgp_all_soft,
6621 clear_bgp_all_soft_cmd,
6622 "clear bgp * soft",
6623 CLEAR_STR
6624 BGP_STR
6625 "Clear all peers\n"
6626 "Soft reconfig\n")
6627{
6628 if (argc == 1)
6629 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6630 BGP_CLEAR_SOFT_BOTH, argv[0]);
6631
6632 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6633 BGP_CLEAR_SOFT_BOTH, argv[0]);
6634}
6635
6636ALIAS (clear_bgp_all_soft,
6637 clear_bgp_instance_all_soft_cmd,
6638 "clear bgp view WORD * soft",
6639 CLEAR_STR
6640 BGP_STR
6641 "BGP view\n"
6642 "view name\n"
6643 "Clear all peers\n"
6644 "Soft reconfig\n")
6645
6646ALIAS (clear_bgp_all_soft,
6647 clear_bgp_ipv6_all_soft_cmd,
6648 "clear bgp ipv6 * soft",
6649 CLEAR_STR
6650 BGP_STR
6651 "Address family\n"
6652 "Clear all peers\n"
6653 "Soft reconfig\n")
6654
6655DEFUN (clear_ip_bgp_peer_soft,
6656 clear_ip_bgp_peer_soft_cmd,
6657 "clear ip bgp A.B.C.D soft",
6658 CLEAR_STR
6659 IP_STR
6660 BGP_STR
6661 "BGP neighbor address to clear\n"
6662 "Soft reconfig\n")
6663{
6664 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6665 BGP_CLEAR_SOFT_BOTH, argv[0]);
6666}
6667
6668DEFUN (clear_ip_bgp_peer_ipv4_soft,
6669 clear_ip_bgp_peer_ipv4_soft_cmd,
6670 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6671 CLEAR_STR
6672 IP_STR
6673 BGP_STR
6674 "BGP neighbor address to clear\n"
6675 "Address family\n"
6676 "Address Family Modifier\n"
6677 "Address Family Modifier\n"
6678 "Soft reconfig\n")
6679{
6680 if (strncmp (argv[1], "m", 1) == 0)
6681 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6682 BGP_CLEAR_SOFT_BOTH, argv[0]);
6683
6684 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6685 BGP_CLEAR_SOFT_BOTH, argv[0]);
6686}
6687
6688DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6689 clear_ip_bgp_peer_vpnv4_soft_cmd,
6690 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6691 CLEAR_STR
6692 IP_STR
6693 BGP_STR
6694 "BGP neighbor address to clear\n"
6695 "Address family\n"
6696 "Address Family Modifier\n"
6697 "Soft reconfig\n")
6698{
6699 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6700 BGP_CLEAR_SOFT_BOTH, argv[0]);
6701}
6702
Lou Berger298cc2f2016-01-12 13:42:02 -05006703DEFUN (clear_ip_bgp_peer_encap_soft,
6704 clear_ip_bgp_peer_encap_soft_cmd,
6705 "clear ip bgp A.B.C.D encap unicast soft",
6706 CLEAR_STR
6707 IP_STR
6708 BGP_STR
6709 "BGP neighbor address to clear\n"
6710 "Address family\n"
6711 "Address Family Modifier\n"
6712 "Soft reconfig\n")
6713{
6714 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
6715 BGP_CLEAR_SOFT_BOTH, argv[0]);
6716}
6717
paul718e3742002-12-13 20:15:29 +00006718DEFUN (clear_bgp_peer_soft,
6719 clear_bgp_peer_soft_cmd,
6720 "clear bgp (A.B.C.D|X:X::X:X) soft",
6721 CLEAR_STR
6722 BGP_STR
6723 "BGP neighbor address to clear\n"
6724 "BGP IPv6 neighbor to clear\n"
6725 "Soft reconfig\n")
6726{
6727 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6728 BGP_CLEAR_SOFT_BOTH, argv[0]);
6729}
6730
6731ALIAS (clear_bgp_peer_soft,
6732 clear_bgp_ipv6_peer_soft_cmd,
6733 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6734 CLEAR_STR
6735 BGP_STR
6736 "Address family\n"
6737 "BGP neighbor address to clear\n"
6738 "BGP IPv6 neighbor to clear\n"
6739 "Soft reconfig\n")
6740
6741DEFUN (clear_ip_bgp_peer_group_soft,
6742 clear_ip_bgp_peer_group_soft_cmd,
6743 "clear ip bgp peer-group WORD soft",
6744 CLEAR_STR
6745 IP_STR
6746 BGP_STR
6747 "Clear all members of peer-group\n"
6748 "BGP peer-group name\n"
6749 "Soft reconfig\n")
6750{
6751 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6752 BGP_CLEAR_SOFT_BOTH, argv[0]);
6753}
6754
6755DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6756 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6757 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6758 CLEAR_STR
6759 IP_STR
6760 BGP_STR
6761 "Clear all members of peer-group\n"
6762 "BGP peer-group name\n"
6763 "Address family\n"
6764 "Address Family modifier\n"
6765 "Address Family modifier\n"
6766 "Soft reconfig\n")
6767{
6768 if (strncmp (argv[1], "m", 1) == 0)
6769 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6770 BGP_CLEAR_SOFT_BOTH, argv[0]);
6771
6772 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6773 BGP_CLEAR_SOFT_BOTH, argv[0]);
6774}
6775
6776DEFUN (clear_bgp_peer_group_soft,
6777 clear_bgp_peer_group_soft_cmd,
6778 "clear bgp peer-group WORD soft",
6779 CLEAR_STR
6780 BGP_STR
6781 "Clear all members of peer-group\n"
6782 "BGP peer-group name\n"
6783 "Soft reconfig\n")
6784{
6785 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6786 BGP_CLEAR_SOFT_BOTH, argv[0]);
6787}
6788
6789ALIAS (clear_bgp_peer_group_soft,
6790 clear_bgp_ipv6_peer_group_soft_cmd,
6791 "clear bgp ipv6 peer-group WORD soft",
6792 CLEAR_STR
6793 BGP_STR
6794 "Address family\n"
6795 "Clear all members of peer-group\n"
6796 "BGP peer-group name\n"
6797 "Soft reconfig\n")
6798
6799DEFUN (clear_ip_bgp_external_soft,
6800 clear_ip_bgp_external_soft_cmd,
6801 "clear ip bgp external soft",
6802 CLEAR_STR
6803 IP_STR
6804 BGP_STR
6805 "Clear all external peers\n"
6806 "Soft reconfig\n")
6807{
6808 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6809 BGP_CLEAR_SOFT_BOTH, NULL);
6810}
6811
6812DEFUN (clear_ip_bgp_external_ipv4_soft,
6813 clear_ip_bgp_external_ipv4_soft_cmd,
6814 "clear ip bgp external ipv4 (unicast|multicast) soft",
6815 CLEAR_STR
6816 IP_STR
6817 BGP_STR
6818 "Clear all external peers\n"
6819 "Address family\n"
6820 "Address Family modifier\n"
6821 "Address Family modifier\n"
6822 "Soft reconfig\n")
6823{
6824 if (strncmp (argv[0], "m", 1) == 0)
6825 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6826 BGP_CLEAR_SOFT_BOTH, NULL);
6827
6828 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6829 BGP_CLEAR_SOFT_BOTH, NULL);
6830}
6831
6832DEFUN (clear_bgp_external_soft,
6833 clear_bgp_external_soft_cmd,
6834 "clear bgp external soft",
6835 CLEAR_STR
6836 BGP_STR
6837 "Clear all external peers\n"
6838 "Soft reconfig\n")
6839{
6840 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6841 BGP_CLEAR_SOFT_BOTH, NULL);
6842}
6843
6844ALIAS (clear_bgp_external_soft,
6845 clear_bgp_ipv6_external_soft_cmd,
6846 "clear bgp ipv6 external soft",
6847 CLEAR_STR
6848 BGP_STR
6849 "Address family\n"
6850 "Clear all external peers\n"
6851 "Soft reconfig\n")
6852
6853DEFUN (clear_ip_bgp_as_soft,
6854 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006855 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006856 CLEAR_STR
6857 IP_STR
6858 BGP_STR
6859 "Clear peers with the AS number\n"
6860 "Soft reconfig\n")
6861{
6862 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6863 BGP_CLEAR_SOFT_BOTH, argv[0]);
6864}
6865
6866DEFUN (clear_ip_bgp_as_ipv4_soft,
6867 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006868 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006869 CLEAR_STR
6870 IP_STR
6871 BGP_STR
6872 "Clear peers with the AS number\n"
6873 "Address family\n"
6874 "Address Family Modifier\n"
6875 "Address Family Modifier\n"
6876 "Soft reconfig\n")
6877{
6878 if (strncmp (argv[1], "m", 1) == 0)
6879 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6880 BGP_CLEAR_SOFT_BOTH, argv[0]);
6881
6882 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6883 BGP_CLEAR_SOFT_BOTH, argv[0]);
6884}
6885
6886DEFUN (clear_ip_bgp_as_vpnv4_soft,
6887 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006888 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00006889 CLEAR_STR
6890 IP_STR
6891 BGP_STR
6892 "Clear peers with the AS number\n"
6893 "Address family\n"
6894 "Address Family Modifier\n"
6895 "Soft reconfig\n")
6896{
6897 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6898 BGP_CLEAR_SOFT_BOTH, argv[0]);
6899}
6900
Lou Berger298cc2f2016-01-12 13:42:02 -05006901DEFUN (clear_ip_bgp_as_encap_soft,
6902 clear_ip_bgp_as_encap_soft_cmd,
6903 "clear ip bgp " CMD_AS_RANGE " encap unicast soft",
6904 CLEAR_STR
6905 IP_STR
6906 BGP_STR
6907 "Clear peers with the AS number\n"
6908 "Address family\n"
6909 "Address Family Modifier\n"
6910 "Soft reconfig\n")
6911{
6912 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6913 BGP_CLEAR_SOFT_BOTH, argv[0]);
6914}
6915
paul718e3742002-12-13 20:15:29 +00006916DEFUN (clear_bgp_as_soft,
6917 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006918 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006919 CLEAR_STR
6920 BGP_STR
6921 "Clear peers with the AS number\n"
6922 "Soft reconfig\n")
6923{
6924 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6925 BGP_CLEAR_SOFT_BOTH, argv[0]);
6926}
6927
6928ALIAS (clear_bgp_as_soft,
6929 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006930 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006931 CLEAR_STR
6932 BGP_STR
6933 "Address family\n"
6934 "Clear peers with the AS number\n"
6935 "Soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006936
paulfee0f4c2004-09-13 05:12:46 +00006937/* RS-client soft reconfiguration. */
6938#ifdef HAVE_IPV6
6939DEFUN (clear_bgp_all_rsclient,
6940 clear_bgp_all_rsclient_cmd,
6941 "clear bgp * rsclient",
6942 CLEAR_STR
6943 BGP_STR
6944 "Clear all peers\n"
6945 "Soft reconfig for rsclient RIB\n")
6946{
6947 if (argc == 1)
6948 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6949 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6950
6951 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6952 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6953}
6954
6955ALIAS (clear_bgp_all_rsclient,
6956 clear_bgp_ipv6_all_rsclient_cmd,
6957 "clear bgp ipv6 * rsclient",
6958 CLEAR_STR
6959 BGP_STR
6960 "Address family\n"
6961 "Clear all peers\n"
6962 "Soft reconfig for rsclient RIB\n")
6963
6964ALIAS (clear_bgp_all_rsclient,
6965 clear_bgp_instance_all_rsclient_cmd,
6966 "clear bgp view WORD * rsclient",
6967 CLEAR_STR
6968 BGP_STR
6969 "BGP view\n"
6970 "view name\n"
6971 "Clear all peers\n"
6972 "Soft reconfig for rsclient RIB\n")
6973
6974ALIAS (clear_bgp_all_rsclient,
6975 clear_bgp_ipv6_instance_all_rsclient_cmd,
6976 "clear bgp ipv6 view WORD * rsclient",
6977 CLEAR_STR
6978 BGP_STR
6979 "Address family\n"
6980 "BGP view\n"
6981 "view name\n"
6982 "Clear all peers\n"
6983 "Soft reconfig for rsclient RIB\n")
6984#endif /* HAVE_IPV6 */
6985
6986DEFUN (clear_ip_bgp_all_rsclient,
6987 clear_ip_bgp_all_rsclient_cmd,
6988 "clear ip bgp * rsclient",
6989 CLEAR_STR
6990 IP_STR
6991 BGP_STR
6992 "Clear all peers\n"
6993 "Soft reconfig for rsclient RIB\n")
6994{
6995 if (argc == 1)
6996 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6997 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6998
6999 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7000 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7001}
7002
7003ALIAS (clear_ip_bgp_all_rsclient,
7004 clear_ip_bgp_instance_all_rsclient_cmd,
7005 "clear ip bgp view WORD * rsclient",
7006 CLEAR_STR
7007 IP_STR
7008 BGP_STR
7009 "BGP view\n"
7010 "view name\n"
7011 "Clear all peers\n"
7012 "Soft reconfig for rsclient RIB\n")
7013
7014#ifdef HAVE_IPV6
7015DEFUN (clear_bgp_peer_rsclient,
7016 clear_bgp_peer_rsclient_cmd,
7017 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
7018 CLEAR_STR
7019 BGP_STR
7020 "BGP neighbor IP address to clear\n"
7021 "BGP IPv6 neighbor to clear\n"
7022 "Soft reconfig for rsclient RIB\n")
7023{
7024 if (argc == 2)
7025 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
7026 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7027
7028 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
7029 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7030}
7031
7032ALIAS (clear_bgp_peer_rsclient,
7033 clear_bgp_ipv6_peer_rsclient_cmd,
7034 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
7035 CLEAR_STR
7036 BGP_STR
7037 "Address family\n"
7038 "BGP neighbor IP address to clear\n"
7039 "BGP IPv6 neighbor to clear\n"
7040 "Soft reconfig for rsclient RIB\n")
7041
7042ALIAS (clear_bgp_peer_rsclient,
7043 clear_bgp_instance_peer_rsclient_cmd,
7044 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7045 CLEAR_STR
7046 BGP_STR
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
7053ALIAS (clear_bgp_peer_rsclient,
7054 clear_bgp_ipv6_instance_peer_rsclient_cmd,
7055 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
7056 CLEAR_STR
7057 BGP_STR
7058 "Address family\n"
7059 "BGP view\n"
7060 "view name\n"
7061 "BGP neighbor IP address to clear\n"
7062 "BGP IPv6 neighbor to clear\n"
7063 "Soft reconfig for rsclient RIB\n")
7064#endif /* HAVE_IPV6 */
7065
7066DEFUN (clear_ip_bgp_peer_rsclient,
7067 clear_ip_bgp_peer_rsclient_cmd,
7068 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
7069 CLEAR_STR
7070 IP_STR
7071 BGP_STR
7072 "BGP neighbor IP address to clear\n"
7073 "BGP IPv6 neighbor to clear\n"
7074 "Soft reconfig for rsclient RIB\n")
7075{
7076 if (argc == 2)
7077 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
7078 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7079
7080 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
7081 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7082}
7083
7084ALIAS (clear_ip_bgp_peer_rsclient,
7085 clear_ip_bgp_instance_peer_rsclient_cmd,
7086 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7087 CLEAR_STR
7088 IP_STR
7089 BGP_STR
7090 "BGP view\n"
7091 "view name\n"
7092 "BGP neighbor IP address to clear\n"
7093 "BGP IPv6 neighbor to clear\n"
7094 "Soft reconfig for rsclient RIB\n")
7095
Michael Lamberte0081f72008-11-16 20:12:04 +00007096DEFUN (show_bgp_views,
7097 show_bgp_views_cmd,
7098 "show bgp views",
7099 SHOW_STR
7100 BGP_STR
7101 "Show the defined BGP views\n")
7102{
7103 struct list *inst = bm->bgp;
7104 struct listnode *node;
7105 struct bgp *bgp;
7106
7107 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
7108 {
7109 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
7110 return CMD_WARNING;
7111 }
7112
7113 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
7114 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
7115 vty_out (vty, "\t%s (AS%u)%s",
7116 bgp->name ? bgp->name : "(null)",
7117 bgp->as, VTY_NEWLINE);
7118
7119 return CMD_SUCCESS;
7120}
7121
Paul Jakma4bf6a362006-03-30 14:05:23 +00007122DEFUN (show_bgp_memory,
7123 show_bgp_memory_cmd,
7124 "show bgp memory",
7125 SHOW_STR
7126 BGP_STR
7127 "Global BGP memory statistics\n")
7128{
7129 char memstrbuf[MTYPE_MEMSTR_LEN];
7130 unsigned long count;
7131
7132 /* RIB related usage stats */
7133 count = mtype_stats_alloc (MTYPE_BGP_NODE);
7134 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
7135 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7136 count * sizeof (struct bgp_node)),
7137 VTY_NEWLINE);
7138
7139 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
7140 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
7141 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7142 count * sizeof (struct bgp_info)),
7143 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007144 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
7145 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
7146 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7147 count * sizeof (struct bgp_info_extra)),
7148 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007149
7150 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
7151 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
7152 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7153 count * sizeof (struct bgp_static)),
7154 VTY_NEWLINE);
7155
7156 /* Adj-In/Out */
7157 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
7158 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
7159 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7160 count * sizeof (struct bgp_adj_in)),
7161 VTY_NEWLINE);
7162 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
7163 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
7164 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7165 count * sizeof (struct bgp_adj_out)),
7166 VTY_NEWLINE);
7167
7168 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
7169 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
7170 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7171 count * sizeof (struct bgp_nexthop_cache)),
7172 VTY_NEWLINE);
7173
7174 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
7175 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
7176 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7177 count * sizeof (struct bgp_damp_info)),
7178 VTY_NEWLINE);
7179
7180 /* Attributes */
7181 count = attr_count();
7182 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
7183 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7184 count * sizeof(struct attr)),
7185 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007186 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
7187 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
7188 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7189 count * sizeof(struct attr_extra)),
7190 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007191
7192 if ((count = attr_unknown_count()))
7193 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
7194
7195 /* AS_PATH attributes */
7196 count = aspath_count ();
7197 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
7198 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7199 count * sizeof (struct aspath)),
7200 VTY_NEWLINE);
7201
7202 count = mtype_stats_alloc (MTYPE_AS_SEG);
7203 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
7204 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7205 count * sizeof (struct assegment)),
7206 VTY_NEWLINE);
7207
7208 /* Other attributes */
7209 if ((count = community_count ()))
7210 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7211 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7212 count * sizeof (struct community)),
7213 VTY_NEWLINE);
7214 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
7215 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7216 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7217 count * sizeof (struct ecommunity)),
7218 VTY_NEWLINE);
7219
7220 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
7221 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
7222 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7223 count * sizeof (struct cluster_list)),
7224 VTY_NEWLINE);
7225
7226 /* Peer related usage */
7227 count = mtype_stats_alloc (MTYPE_BGP_PEER);
7228 vty_out (vty, "%ld peers, using %s of memory%s", count,
7229 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7230 count * sizeof (struct peer)),
7231 VTY_NEWLINE);
7232
7233 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
7234 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
7235 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7236 count * sizeof (struct peer_group)),
7237 VTY_NEWLINE);
7238
7239 /* Other */
7240 if ((count = mtype_stats_alloc (MTYPE_HASH)))
7241 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
7242 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7243 count * sizeof (struct hash)),
7244 VTY_NEWLINE);
7245 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
7246 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
7247 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7248 count * sizeof (struct hash_backet)),
7249 VTY_NEWLINE);
7250 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
7251 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
7252 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7253 count * sizeof (regex_t)),
7254 VTY_NEWLINE);
7255 return CMD_SUCCESS;
7256}
paulfee0f4c2004-09-13 05:12:46 +00007257
paul718e3742002-12-13 20:15:29 +00007258/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00007259static int
paul718e3742002-12-13 20:15:29 +00007260bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
7261{
7262 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007263 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00007264 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00007265 char timebuf[BGP_UPTIME_LEN];
7266 int len;
7267
7268 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00007269 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00007270
paul1eb8ef22005-04-07 07:30:20 +00007271 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007272 {
7273 if (peer->afc[afi][safi])
7274 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00007275 if (!count)
7276 {
7277 unsigned long ents;
7278 char memstrbuf[MTYPE_MEMSTR_LEN];
7279
7280 /* Usage summary and header */
7281 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007282 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00007283 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007284
Paul Jakma4bf6a362006-03-30 14:05:23 +00007285 ents = bgp_table_count (bgp->rib[afi][safi]);
7286 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
7287 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7288 ents * sizeof (struct bgp_node)),
7289 VTY_NEWLINE);
7290
7291 /* Peer related usage */
7292 ents = listcount (bgp->peer);
7293 vty_out (vty, "Peers %ld, using %s of memory%s",
7294 ents,
7295 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7296 ents * sizeof (struct peer)),
7297 VTY_NEWLINE);
7298
7299 if ((ents = listcount (bgp->rsclient)))
7300 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
7301 ents,
7302 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7303 ents * sizeof (struct peer)),
7304 VTY_NEWLINE);
7305
7306 if ((ents = listcount (bgp->group)))
7307 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
7308 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7309 ents * sizeof (struct peer_group)),
7310 VTY_NEWLINE);
7311
7312 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
7313 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
7314 vty_out (vty, "%s", VTY_NEWLINE);
7315 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7316 }
7317
paul718e3742002-12-13 20:15:29 +00007318 count++;
7319
7320 len = vty_out (vty, "%s", peer->host);
7321 len = 16 - len;
7322 if (len < 1)
7323 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7324 else
7325 vty_out (vty, "%*s", len, " ");
7326
hasso3d515fd2005-02-01 21:30:04 +00007327 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00007328
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007329 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00007330 peer->as,
7331 peer->open_in + peer->update_in + peer->keepalive_in
7332 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
7333 peer->open_out + peer->update_out + peer->keepalive_out
7334 + peer->notify_out + peer->refresh_out
7335 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007336 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00007337
7338 vty_out (vty, "%8s",
7339 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7340
7341 if (peer->status == Established)
7342 {
7343 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
7344 }
7345 else
7346 {
7347 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7348 vty_out (vty, " Idle (Admin)");
7349 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7350 vty_out (vty, " Idle (PfxCt)");
7351 else
7352 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7353 }
7354
7355 vty_out (vty, "%s", VTY_NEWLINE);
7356 }
7357 }
7358
7359 if (count)
7360 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7361 count, VTY_NEWLINE);
7362 else
7363 vty_out (vty, "No %s neighbor is configured%s",
7364 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7365 return CMD_SUCCESS;
7366}
7367
paul94f2b392005-06-28 12:44:16 +00007368static int
paulfd79ac92004-10-13 05:06:08 +00007369bgp_show_summary_vty (struct vty *vty, const char *name,
7370 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007371{
7372 struct bgp *bgp;
7373
7374 if (name)
7375 {
7376 bgp = bgp_lookup_by_name (name);
7377
7378 if (! bgp)
7379 {
7380 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7381 return CMD_WARNING;
7382 }
7383
7384 bgp_show_summary (vty, bgp, afi, safi);
7385 return CMD_SUCCESS;
7386 }
7387
7388 bgp = bgp_get_default ();
7389
7390 if (bgp)
7391 bgp_show_summary (vty, bgp, afi, safi);
7392
7393 return CMD_SUCCESS;
7394}
7395
7396/* `show ip bgp summary' commands. */
7397DEFUN (show_ip_bgp_summary,
7398 show_ip_bgp_summary_cmd,
7399 "show ip bgp summary",
7400 SHOW_STR
7401 IP_STR
7402 BGP_STR
7403 "Summary of BGP neighbor status\n")
7404{
7405 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7406}
7407
7408DEFUN (show_ip_bgp_instance_summary,
7409 show_ip_bgp_instance_summary_cmd,
7410 "show ip bgp view WORD summary",
7411 SHOW_STR
7412 IP_STR
7413 BGP_STR
7414 "BGP view\n"
7415 "View name\n"
7416 "Summary of BGP neighbor status\n")
7417{
7418 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7419}
7420
7421DEFUN (show_ip_bgp_ipv4_summary,
7422 show_ip_bgp_ipv4_summary_cmd,
7423 "show ip bgp ipv4 (unicast|multicast) summary",
7424 SHOW_STR
7425 IP_STR
7426 BGP_STR
7427 "Address family\n"
7428 "Address Family modifier\n"
7429 "Address Family modifier\n"
7430 "Summary of BGP neighbor status\n")
7431{
7432 if (strncmp (argv[0], "m", 1) == 0)
7433 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7434
7435 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7436}
7437
Michael Lambert95cbbd22010-07-23 14:43:04 -04007438ALIAS (show_ip_bgp_ipv4_summary,
7439 show_bgp_ipv4_safi_summary_cmd,
7440 "show bgp ipv4 (unicast|multicast) summary",
7441 SHOW_STR
7442 BGP_STR
7443 "Address family\n"
7444 "Address Family modifier\n"
7445 "Address Family modifier\n"
7446 "Summary of BGP neighbor status\n")
7447
paul718e3742002-12-13 20:15:29 +00007448DEFUN (show_ip_bgp_instance_ipv4_summary,
7449 show_ip_bgp_instance_ipv4_summary_cmd,
7450 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7451 SHOW_STR
7452 IP_STR
7453 BGP_STR
7454 "BGP view\n"
7455 "View name\n"
7456 "Address family\n"
7457 "Address Family modifier\n"
7458 "Address Family modifier\n"
7459 "Summary of BGP neighbor status\n")
7460{
7461 if (strncmp (argv[1], "m", 1) == 0)
7462 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7463 else
7464 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7465}
7466
Michael Lambert95cbbd22010-07-23 14:43:04 -04007467ALIAS (show_ip_bgp_instance_ipv4_summary,
7468 show_bgp_instance_ipv4_safi_summary_cmd,
7469 "show bgp view WORD ipv4 (unicast|multicast) summary",
7470 SHOW_STR
7471 BGP_STR
7472 "BGP view\n"
7473 "View name\n"
7474 "Address family\n"
7475 "Address Family modifier\n"
7476 "Address Family modifier\n"
7477 "Summary of BGP neighbor status\n")
7478
paul718e3742002-12-13 20:15:29 +00007479DEFUN (show_ip_bgp_vpnv4_all_summary,
7480 show_ip_bgp_vpnv4_all_summary_cmd,
7481 "show ip bgp vpnv4 all summary",
7482 SHOW_STR
7483 IP_STR
7484 BGP_STR
7485 "Display VPNv4 NLRI specific information\n"
7486 "Display information about all VPNv4 NLRIs\n"
7487 "Summary of BGP neighbor status\n")
7488{
7489 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7490}
7491
7492DEFUN (show_ip_bgp_vpnv4_rd_summary,
7493 show_ip_bgp_vpnv4_rd_summary_cmd,
7494 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7495 SHOW_STR
7496 IP_STR
7497 BGP_STR
7498 "Display VPNv4 NLRI specific information\n"
7499 "Display information for a route distinguisher\n"
7500 "VPN Route Distinguisher\n"
7501 "Summary of BGP neighbor status\n")
7502{
7503 int ret;
7504 struct prefix_rd prd;
7505
7506 ret = str2prefix_rd (argv[0], &prd);
7507 if (! ret)
7508 {
7509 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7510 return CMD_WARNING;
7511 }
7512
7513 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7514}
7515
7516#ifdef HAVE_IPV6
7517DEFUN (show_bgp_summary,
7518 show_bgp_summary_cmd,
7519 "show bgp summary",
7520 SHOW_STR
7521 BGP_STR
7522 "Summary of BGP neighbor status\n")
7523{
7524 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7525}
7526
7527DEFUN (show_bgp_instance_summary,
7528 show_bgp_instance_summary_cmd,
7529 "show bgp view WORD summary",
7530 SHOW_STR
7531 BGP_STR
7532 "BGP view\n"
7533 "View name\n"
7534 "Summary of BGP neighbor status\n")
7535{
7536 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7537}
7538
7539ALIAS (show_bgp_summary,
7540 show_bgp_ipv6_summary_cmd,
7541 "show bgp ipv6 summary",
7542 SHOW_STR
7543 BGP_STR
7544 "Address family\n"
7545 "Summary of BGP neighbor status\n")
7546
7547ALIAS (show_bgp_instance_summary,
7548 show_bgp_instance_ipv6_summary_cmd,
7549 "show bgp view WORD ipv6 summary",
7550 SHOW_STR
7551 BGP_STR
7552 "BGP view\n"
7553 "View name\n"
7554 "Address family\n"
7555 "Summary of BGP neighbor status\n")
7556
Michael Lambert95cbbd22010-07-23 14:43:04 -04007557DEFUN (show_bgp_ipv6_safi_summary,
7558 show_bgp_ipv6_safi_summary_cmd,
7559 "show bgp ipv6 (unicast|multicast) summary",
7560 SHOW_STR
7561 BGP_STR
7562 "Address family\n"
7563 "Address Family modifier\n"
7564 "Address Family modifier\n"
7565 "Summary of BGP neighbor status\n")
7566{
7567 if (strncmp (argv[0], "m", 1) == 0)
7568 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7569
7570 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7571}
7572
7573DEFUN (show_bgp_instance_ipv6_safi_summary,
7574 show_bgp_instance_ipv6_safi_summary_cmd,
7575 "show bgp view WORD ipv6 (unicast|multicast) summary",
7576 SHOW_STR
7577 BGP_STR
7578 "BGP view\n"
7579 "View name\n"
7580 "Address family\n"
7581 "Address Family modifier\n"
7582 "Address Family modifier\n"
7583 "Summary of BGP neighbor status\n")
7584{
7585 if (strncmp (argv[1], "m", 1) == 0)
7586 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7587
7588 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7589}
7590
paul718e3742002-12-13 20:15:29 +00007591/* old command */
7592DEFUN (show_ipv6_bgp_summary,
7593 show_ipv6_bgp_summary_cmd,
7594 "show ipv6 bgp summary",
7595 SHOW_STR
7596 IPV6_STR
7597 BGP_STR
7598 "Summary of BGP neighbor status\n")
7599{
7600 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7601}
7602
7603/* old command */
7604DEFUN (show_ipv6_mbgp_summary,
7605 show_ipv6_mbgp_summary_cmd,
7606 "show ipv6 mbgp summary",
7607 SHOW_STR
7608 IPV6_STR
7609 MBGP_STR
7610 "Summary of BGP neighbor status\n")
7611{
7612 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7613}
7614#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02007615
paulfd79ac92004-10-13 05:06:08 +00007616const char *
hasso538621f2004-05-21 09:31:30 +00007617afi_safi_print (afi_t afi, safi_t safi)
7618{
7619 if (afi == AFI_IP && safi == SAFI_UNICAST)
7620 return "IPv4 Unicast";
7621 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7622 return "IPv4 Multicast";
7623 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
Lou Berger9da04bc2016-01-12 13:41:55 -05007624 return "VPN-IPv4 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007625 else if (afi == AFI_IP && safi == SAFI_ENCAP)
7626 return "ENCAP-IPv4 Unicast";
hasso538621f2004-05-21 09:31:30 +00007627 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7628 return "IPv6 Unicast";
7629 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7630 return "IPv6 Multicast";
Lou Berger9da04bc2016-01-12 13:41:55 -05007631 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
7632 return "VPN-IPv6 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007633 else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
7634 return "ENCAP-IPv6 Unicast";
hasso538621f2004-05-21 09:31:30 +00007635 else
7636 return "Unknown";
7637}
7638
paul718e3742002-12-13 20:15:29 +00007639/* Show BGP peer's information. */
7640enum show_type
7641{
7642 show_all,
7643 show_peer
7644};
7645
paul94f2b392005-06-28 12:44:16 +00007646static void
paul718e3742002-12-13 20:15:29 +00007647bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7648 afi_t afi, safi_t safi,
7649 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7650 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7651{
7652 /* Send-Mode */
7653 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7654 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7655 {
7656 vty_out (vty, " Send-mode: ");
7657 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7658 vty_out (vty, "advertised");
7659 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7660 vty_out (vty, "%sreceived",
7661 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7662 ", " : "");
7663 vty_out (vty, "%s", VTY_NEWLINE);
7664 }
7665
7666 /* Receive-Mode */
7667 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7668 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7669 {
7670 vty_out (vty, " Receive-mode: ");
7671 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7672 vty_out (vty, "advertised");
7673 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7674 vty_out (vty, "%sreceived",
7675 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7676 ", " : "");
7677 vty_out (vty, "%s", VTY_NEWLINE);
7678 }
7679}
7680
paul94f2b392005-06-28 12:44:16 +00007681static void
paul718e3742002-12-13 20:15:29 +00007682bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7683{
7684 struct bgp_filter *filter;
7685 char orf_pfx_name[BUFSIZ];
7686 int orf_pfx_count;
7687
7688 filter = &p->filter[afi][safi];
7689
hasso538621f2004-05-21 09:31:30 +00007690 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007691 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007692
paul718e3742002-12-13 20:15:29 +00007693 if (p->af_group[afi][safi])
7694 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7695
7696 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7697 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7698 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7699 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7700 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7701 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7702 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7703
7704 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7705 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7706 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7707 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7708 {
7709 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7710 ORF_TYPE_PREFIX, VTY_NEWLINE);
7711 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7712 PEER_CAP_ORF_PREFIX_SM_ADV,
7713 PEER_CAP_ORF_PREFIX_RM_ADV,
7714 PEER_CAP_ORF_PREFIX_SM_RCV,
7715 PEER_CAP_ORF_PREFIX_RM_RCV);
7716 }
7717 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7718 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7719 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7720 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7721 {
7722 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7723 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7724 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7725 PEER_CAP_ORF_PREFIX_SM_ADV,
7726 PEER_CAP_ORF_PREFIX_RM_ADV,
7727 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7728 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7729 }
7730
7731 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7732 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7733
7734 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7735 || orf_pfx_count)
7736 {
7737 vty_out (vty, " Outbound Route Filter (ORF):");
7738 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7739 vty_out (vty, " sent;");
7740 if (orf_pfx_count)
7741 vty_out (vty, " received (%d entries)", orf_pfx_count);
7742 vty_out (vty, "%s", VTY_NEWLINE);
7743 }
7744 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7745 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7746
7747 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7748 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7749 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7750 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7751 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7752 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7753 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7754 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7755 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7756 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
7757 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
7758 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7759 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
7760 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7761 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
7762 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7763 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7764 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
7765 {
7766 vty_out (vty, " Community attribute sent to this neighbor");
7767 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7768 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007769 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007770 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007771 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007772 else
hasso538621f2004-05-21 09:31:30 +00007773 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007774 }
7775 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
7776 {
7777 vty_out (vty, " Default information originate,");
7778
7779 if (p->default_rmap[afi][safi].name)
7780 vty_out (vty, " default route-map %s%s,",
7781 p->default_rmap[afi][safi].map ? "*" : "",
7782 p->default_rmap[afi][safi].name);
7783 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
7784 vty_out (vty, " default sent%s", VTY_NEWLINE);
7785 else
7786 vty_out (vty, " default not sent%s", VTY_NEWLINE);
7787 }
7788
7789 if (filter->plist[FILTER_IN].name
7790 || filter->dlist[FILTER_IN].name
7791 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00007792 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007793 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
7794 if (filter->plist[FILTER_OUT].name
7795 || filter->dlist[FILTER_OUT].name
7796 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00007797 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00007798 || filter->usmap.name)
7799 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007800 if (filter->map[RMAP_IMPORT].name)
7801 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
7802 if (filter->map[RMAP_EXPORT].name)
7803 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007804
7805 /* prefix-list */
7806 if (filter->plist[FILTER_IN].name)
7807 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
7808 filter->plist[FILTER_IN].plist ? "*" : "",
7809 filter->plist[FILTER_IN].name,
7810 VTY_NEWLINE);
7811 if (filter->plist[FILTER_OUT].name)
7812 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
7813 filter->plist[FILTER_OUT].plist ? "*" : "",
7814 filter->plist[FILTER_OUT].name,
7815 VTY_NEWLINE);
7816
7817 /* distribute-list */
7818 if (filter->dlist[FILTER_IN].name)
7819 vty_out (vty, " Incoming update network filter list is %s%s%s",
7820 filter->dlist[FILTER_IN].alist ? "*" : "",
7821 filter->dlist[FILTER_IN].name,
7822 VTY_NEWLINE);
7823 if (filter->dlist[FILTER_OUT].name)
7824 vty_out (vty, " Outgoing update network filter list is %s%s%s",
7825 filter->dlist[FILTER_OUT].alist ? "*" : "",
7826 filter->dlist[FILTER_OUT].name,
7827 VTY_NEWLINE);
7828
7829 /* filter-list. */
7830 if (filter->aslist[FILTER_IN].name)
7831 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
7832 filter->aslist[FILTER_IN].aslist ? "*" : "",
7833 filter->aslist[FILTER_IN].name,
7834 VTY_NEWLINE);
7835 if (filter->aslist[FILTER_OUT].name)
7836 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
7837 filter->aslist[FILTER_OUT].aslist ? "*" : "",
7838 filter->aslist[FILTER_OUT].name,
7839 VTY_NEWLINE);
7840
7841 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00007842 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007843 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007844 filter->map[RMAP_IN].map ? "*" : "",
7845 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00007846 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007847 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00007848 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007849 filter->map[RMAP_OUT].map ? "*" : "",
7850 filter->map[RMAP_OUT].name,
7851 VTY_NEWLINE);
7852 if (filter->map[RMAP_IMPORT].name)
7853 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
7854 filter->map[RMAP_IMPORT].map ? "*" : "",
7855 filter->map[RMAP_IMPORT].name,
7856 VTY_NEWLINE);
7857 if (filter->map[RMAP_EXPORT].name)
7858 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
7859 filter->map[RMAP_EXPORT].map ? "*" : "",
7860 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00007861 VTY_NEWLINE);
7862
7863 /* unsuppress-map */
7864 if (filter->usmap.name)
7865 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
7866 filter->usmap.map ? "*" : "",
7867 filter->usmap.name, VTY_NEWLINE);
7868
7869 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00007870 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
7871
paul718e3742002-12-13 20:15:29 +00007872 /* Maximum prefix */
7873 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
7874 {
hasso0a486e52005-02-01 20:57:17 +00007875 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00007876 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00007877 ? " (warning-only)" : "", VTY_NEWLINE);
7878 vty_out (vty, " Threshold for warning message %d%%",
7879 p->pmax_threshold[afi][safi]);
7880 if (p->pmax_restart[afi][safi])
7881 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
7882 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007883 }
paul718e3742002-12-13 20:15:29 +00007884
7885 vty_out (vty, "%s", VTY_NEWLINE);
7886}
7887
paul94f2b392005-06-28 12:44:16 +00007888static void
paul718e3742002-12-13 20:15:29 +00007889bgp_show_peer (struct vty *vty, struct peer *p)
7890{
7891 struct bgp *bgp;
7892 char buf1[BUFSIZ];
7893 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00007894 afi_t afi;
7895 safi_t safi;
paul718e3742002-12-13 20:15:29 +00007896
7897 bgp = p->bgp;
7898
7899 /* Configured IP address. */
7900 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007901 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00007902 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00007903 p->change_local_as ? p->change_local_as : p->local_as,
7904 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00007905 " no-prepend" : "",
7906 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
7907 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00007908 vty_out (vty, "%s link%s",
7909 p->as == p->local_as ? "internal" : "external",
7910 VTY_NEWLINE);
7911
7912 /* Description. */
7913 if (p->desc)
7914 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
7915
7916 /* Peer-group */
7917 if (p->group)
7918 vty_out (vty, " Member of peer-group %s for session parameters%s",
7919 p->group->name, VTY_NEWLINE);
7920
7921 /* Administrative shutdown. */
7922 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
7923 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
7924
7925 /* BGP Version. */
7926 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00007927 vty_out (vty, ", remote router ID %s%s",
7928 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
7929 VTY_NEWLINE);
7930
7931 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00007932 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
7933 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00007934 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
7935
7936 /* Status. */
7937 vty_out (vty, " BGP state = %s",
7938 LOOKUP (bgp_status_msg, p->status));
7939 if (p->status == Established)
7940 vty_out (vty, ", up for %8s",
7941 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00007942 else if (p->status == Active)
7943 {
7944 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7945 vty_out (vty, " (passive)");
7946 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7947 vty_out (vty, " (NSF passive)");
7948 }
paul718e3742002-12-13 20:15:29 +00007949 vty_out (vty, "%s", VTY_NEWLINE);
7950
7951 /* read timer */
7952 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7953
7954 /* Configured timer values. */
7955 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7956 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7957 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7958 {
7959 vty_out (vty, " Configured hold time is %d", p->holdtime);
7960 vty_out (vty, ", keepalive interval is %d seconds%s",
7961 p->keepalive, VTY_NEWLINE);
7962 }
hasso93406d82005-02-02 14:40:33 +00007963
paul718e3742002-12-13 20:15:29 +00007964 /* Capability. */
7965 if (p->status == Established)
7966 {
hasso538621f2004-05-21 09:31:30 +00007967 if (p->cap
paul718e3742002-12-13 20:15:29 +00007968 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7969 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7970 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7971 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7972#ifdef HAVE_IPV6
7973 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7974 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7975 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7976 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
Lou Berger9da04bc2016-01-12 13:41:55 -05007977 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
7978 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
Lou Bergera3fda882016-01-12 13:42:04 -05007979 || p->afc_adv[AFI_IP6][SAFI_ENCAP]
7980 || p->afc_recv[AFI_IP6][SAFI_ENCAP]
paul718e3742002-12-13 20:15:29 +00007981#endif /* HAVE_IPV6 */
Lou Bergera3fda882016-01-12 13:42:04 -05007982 || p->afc_adv[AFI_IP][SAFI_ENCAP]
7983 || p->afc_recv[AFI_IP][SAFI_ENCAP]
paul718e3742002-12-13 20:15:29 +00007984 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7985 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7986 {
7987 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7988
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007989 /* AS4 */
7990 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
7991 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7992 {
7993 vty_out (vty, " 4 Byte AS:");
7994 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7995 vty_out (vty, " advertised");
7996 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
7997 vty_out (vty, " %sreceived",
7998 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
7999 vty_out (vty, "%s", VTY_NEWLINE);
8000 }
paul718e3742002-12-13 20:15:29 +00008001 /* Dynamic */
8002 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
8003 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8004 {
8005 vty_out (vty, " Dynamic:");
8006 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8007 vty_out (vty, " advertised");
8008 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00008009 vty_out (vty, " %sreceived",
8010 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008011 vty_out (vty, "%s", VTY_NEWLINE);
8012 }
8013
8014 /* Route Refresh */
8015 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
8016 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8017 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
8018 {
8019 vty_out (vty, " Route refresh:");
8020 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
8021 vty_out (vty, " advertised");
8022 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8023 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00008024 vty_out (vty, " %sreceived(%s)",
8025 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
8026 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
8027 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
8028 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
8029
paul718e3742002-12-13 20:15:29 +00008030 vty_out (vty, "%s", VTY_NEWLINE);
8031 }
8032
hasso538621f2004-05-21 09:31:30 +00008033 /* Multiprotocol Extensions */
8034 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8035 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8036 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00008037 {
hasso538621f2004-05-21 09:31:30 +00008038 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
8039 if (p->afc_adv[afi][safi])
8040 vty_out (vty, " advertised");
8041 if (p->afc_recv[afi][safi])
8042 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
8043 vty_out (vty, "%s", VTY_NEWLINE);
8044 }
8045
8046 /* Gracefull Restart */
8047 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8048 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008049 {
hasso538621f2004-05-21 09:31:30 +00008050 vty_out (vty, " Graceful Restart Capabilty:");
8051 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008052 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00008053 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
8054 vty_out (vty, " %sreceived",
8055 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008056 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008057
8058 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00008059 {
hasso538621f2004-05-21 09:31:30 +00008060 int restart_af_count = 0;
8061
8062 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00008063 p->v_gr_restart, VTY_NEWLINE);
8064 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008065
8066 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8067 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8068 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
8069 {
hasso93406d82005-02-02 14:40:33 +00008070 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
8071 afi_safi_print (afi, safi),
8072 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
8073 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00008074 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00008075 }
hasso538621f2004-05-21 09:31:30 +00008076 if (! restart_af_count)
8077 vty_out (vty, "none");
8078 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008079 }
paul718e3742002-12-13 20:15:29 +00008080 }
paul718e3742002-12-13 20:15:29 +00008081 }
8082 }
8083
hasso93406d82005-02-02 14:40:33 +00008084 /* graceful restart information */
8085 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8086 || p->t_gr_restart
8087 || p->t_gr_stale)
8088 {
8089 int eor_send_af_count = 0;
8090 int eor_receive_af_count = 0;
8091
8092 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
8093 if (p->status == Established)
8094 {
8095 vty_out (vty, " End-of-RIB send: ");
8096 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8097 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8098 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
8099 {
8100 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
8101 afi_safi_print (afi, safi));
8102 eor_send_af_count++;
8103 }
8104 vty_out (vty, "%s", VTY_NEWLINE);
8105
8106 vty_out (vty, " End-of-RIB received: ");
8107 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8108 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8109 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
8110 {
8111 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
8112 afi_safi_print (afi, safi));
8113 eor_receive_af_count++;
8114 }
8115 vty_out (vty, "%s", VTY_NEWLINE);
8116 }
8117
8118 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008119 vty_out (vty, " The remaining time of restart timer is %ld%s",
8120 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
8121
hasso93406d82005-02-02 14:40:33 +00008122 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008123 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
8124 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008125 }
8126
paul718e3742002-12-13 20:15:29 +00008127 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00008128 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
8129 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008130 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008131 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
8132 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
8133 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
8134 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
8135 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
8136 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
8137 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
8138 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
8139 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
8140 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
8141 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008142
8143 /* advertisement-interval */
8144 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
8145 p->v_routeadv, VTY_NEWLINE);
8146
8147 /* Update-source. */
8148 if (p->update_if || p->update_source)
8149 {
8150 vty_out (vty, " Update source is ");
8151 if (p->update_if)
8152 vty_out (vty, "%s", p->update_if);
8153 else if (p->update_source)
8154 vty_out (vty, "%s",
8155 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
8156 vty_out (vty, "%s", VTY_NEWLINE);
8157 }
8158
8159 /* Default weight */
8160 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
8161 vty_out (vty, " Default weight %d%s", p->weight,
8162 VTY_NEWLINE);
8163
8164 vty_out (vty, "%s", VTY_NEWLINE);
8165
8166 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00008167 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8168 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8169 if (p->afc[afi][safi])
8170 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00008171
8172 vty_out (vty, " Connections established %d; dropped %d%s",
8173 p->established, p->dropped,
8174 VTY_NEWLINE);
8175
hassoe0701b72004-05-20 09:19:34 +00008176 if (! p->dropped)
8177 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
8178 else
8179 vty_out (vty, " Last reset %s, due to %s%s",
8180 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
8181 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00008182
paul718e3742002-12-13 20:15:29 +00008183 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8184 {
8185 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00008186
8187 if (p->t_pmax_restart)
8188 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8189 p->host, thread_timer_remain_second (p->t_pmax_restart),
8190 VTY_NEWLINE);
8191 else
8192 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8193 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008194 }
8195
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008196 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00008197 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008198 {
8199 if (p->gtsm_hops > 0)
8200 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8201 p->gtsm_hops, VTY_NEWLINE);
8202 else if (p->ttl > 1)
8203 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8204 p->ttl, VTY_NEWLINE);
8205 }
Pradosh Mohapatra5d804b42013-09-12 03:37:07 +00008206 else
8207 {
8208 if (p->gtsm_hops > 0)
8209 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
8210 p->gtsm_hops, VTY_NEWLINE);
8211 }
paul718e3742002-12-13 20:15:29 +00008212
8213 /* Local address. */
8214 if (p->su_local)
8215 {
hasso93406d82005-02-02 14:40:33 +00008216 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00008217 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
8218 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00008219 VTY_NEWLINE);
8220 }
8221
8222 /* Remote address. */
8223 if (p->su_remote)
8224 {
8225 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
8226 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
8227 ntohs (p->su_remote->sin.sin_port),
8228 VTY_NEWLINE);
8229 }
8230
8231 /* Nexthop display. */
8232 if (p->su_local)
8233 {
8234 vty_out (vty, "Nexthop: %s%s",
8235 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
8236 VTY_NEWLINE);
8237#ifdef HAVE_IPV6
8238 vty_out (vty, "Nexthop global: %s%s",
8239 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
8240 VTY_NEWLINE);
8241 vty_out (vty, "Nexthop local: %s%s",
8242 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
8243 VTY_NEWLINE);
8244 vty_out (vty, "BGP connection: %s%s",
8245 p->shared_network ? "shared network" : "non shared network",
8246 VTY_NEWLINE);
8247#endif /* HAVE_IPV6 */
8248 }
8249
Timo Teräsef757702015-04-29 09:43:04 +03008250 /* TCP metrics. */
8251 if (p->status == Established && p->rtt)
8252 vty_out (vty, "Estimated round trip time: %d ms%s",
8253 p->rtt, VTY_NEWLINE);
8254
paul718e3742002-12-13 20:15:29 +00008255 /* Timer information. */
8256 if (p->t_start)
8257 vty_out (vty, "Next start timer due in %ld seconds%s",
8258 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
8259 if (p->t_connect)
8260 vty_out (vty, "Next connect timer due in %ld seconds%s",
8261 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
8262
8263 vty_out (vty, "Read thread: %s Write thread: %s%s",
8264 p->t_read ? "on" : "off",
8265 p->t_write ? "on" : "off",
8266 VTY_NEWLINE);
8267
8268 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
8269 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
8270 bgp_capability_vty_out (vty, p);
8271
8272 vty_out (vty, "%s", VTY_NEWLINE);
8273}
8274
paul94f2b392005-06-28 12:44:16 +00008275static int
paul718e3742002-12-13 20:15:29 +00008276bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
8277 enum show_type type, union sockunion *su)
8278{
paul1eb8ef22005-04-07 07:30:20 +00008279 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00008280 struct peer *peer;
8281 int find = 0;
8282
paul1eb8ef22005-04-07 07:30:20 +00008283 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00008284 {
8285 switch (type)
8286 {
8287 case show_all:
8288 bgp_show_peer (vty, peer);
8289 break;
8290 case show_peer:
8291 if (sockunion_same (&peer->su, su))
8292 {
8293 find = 1;
8294 bgp_show_peer (vty, peer);
8295 }
8296 break;
8297 }
8298 }
8299
8300 if (type == show_peer && ! find)
8301 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
8302
8303 return CMD_SUCCESS;
8304}
8305
paul94f2b392005-06-28 12:44:16 +00008306static int
paulfd79ac92004-10-13 05:06:08 +00008307bgp_show_neighbor_vty (struct vty *vty, const char *name,
8308 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00008309{
8310 int ret;
8311 struct bgp *bgp;
8312 union sockunion su;
8313
8314 if (ip_str)
8315 {
8316 ret = str2sockunion (ip_str, &su);
8317 if (ret < 0)
8318 {
8319 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
8320 return CMD_WARNING;
8321 }
8322 }
8323
8324 if (name)
8325 {
8326 bgp = bgp_lookup_by_name (name);
8327
8328 if (! bgp)
8329 {
8330 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8331 return CMD_WARNING;
8332 }
8333
8334 bgp_show_neighbor (vty, bgp, type, &su);
8335
8336 return CMD_SUCCESS;
8337 }
8338
8339 bgp = bgp_get_default ();
8340
8341 if (bgp)
8342 bgp_show_neighbor (vty, bgp, type, &su);
8343
8344 return CMD_SUCCESS;
8345}
8346
8347/* "show ip bgp neighbors" commands. */
8348DEFUN (show_ip_bgp_neighbors,
8349 show_ip_bgp_neighbors_cmd,
8350 "show ip bgp neighbors",
8351 SHOW_STR
8352 IP_STR
8353 BGP_STR
8354 "Detailed information on TCP and BGP neighbor connections\n")
8355{
8356 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8357}
8358
8359ALIAS (show_ip_bgp_neighbors,
8360 show_ip_bgp_ipv4_neighbors_cmd,
8361 "show ip bgp ipv4 (unicast|multicast) neighbors",
8362 SHOW_STR
8363 IP_STR
8364 BGP_STR
8365 "Address family\n"
8366 "Address Family modifier\n"
8367 "Address Family modifier\n"
8368 "Detailed information on TCP and BGP neighbor connections\n")
8369
8370ALIAS (show_ip_bgp_neighbors,
8371 show_ip_bgp_vpnv4_all_neighbors_cmd,
8372 "show ip bgp vpnv4 all neighbors",
8373 SHOW_STR
8374 IP_STR
8375 BGP_STR
8376 "Display VPNv4 NLRI specific information\n"
8377 "Display information about all VPNv4 NLRIs\n"
8378 "Detailed information on TCP and BGP neighbor connections\n")
8379
8380ALIAS (show_ip_bgp_neighbors,
8381 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8382 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8383 SHOW_STR
8384 IP_STR
8385 BGP_STR
8386 "Display VPNv4 NLRI specific information\n"
8387 "Display information for a route distinguisher\n"
8388 "VPN Route Distinguisher\n"
8389 "Detailed information on TCP and BGP neighbor connections\n")
8390
8391ALIAS (show_ip_bgp_neighbors,
8392 show_bgp_neighbors_cmd,
8393 "show bgp neighbors",
8394 SHOW_STR
8395 BGP_STR
8396 "Detailed information on TCP and BGP neighbor connections\n")
8397
8398ALIAS (show_ip_bgp_neighbors,
8399 show_bgp_ipv6_neighbors_cmd,
8400 "show bgp ipv6 neighbors",
8401 SHOW_STR
8402 BGP_STR
8403 "Address family\n"
8404 "Detailed information on TCP and BGP neighbor connections\n")
8405
8406DEFUN (show_ip_bgp_neighbors_peer,
8407 show_ip_bgp_neighbors_peer_cmd,
8408 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8409 SHOW_STR
8410 IP_STR
8411 BGP_STR
8412 "Detailed information on TCP and BGP neighbor connections\n"
8413 "Neighbor to display information about\n"
8414 "Neighbor to display information about\n")
8415{
8416 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8417}
8418
8419ALIAS (show_ip_bgp_neighbors_peer,
8420 show_ip_bgp_ipv4_neighbors_peer_cmd,
8421 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8422 SHOW_STR
8423 IP_STR
8424 BGP_STR
8425 "Address family\n"
8426 "Address Family modifier\n"
8427 "Address Family modifier\n"
8428 "Detailed information on TCP and BGP neighbor connections\n"
8429 "Neighbor to display information about\n"
8430 "Neighbor to display information about\n")
8431
8432ALIAS (show_ip_bgp_neighbors_peer,
8433 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8434 "show ip bgp vpnv4 all neighbors A.B.C.D",
8435 SHOW_STR
8436 IP_STR
8437 BGP_STR
8438 "Display VPNv4 NLRI specific information\n"
8439 "Display information about all VPNv4 NLRIs\n"
8440 "Detailed information on TCP and BGP neighbor connections\n"
8441 "Neighbor to display information about\n")
8442
8443ALIAS (show_ip_bgp_neighbors_peer,
8444 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8445 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8446 SHOW_STR
8447 IP_STR
8448 BGP_STR
8449 "Display VPNv4 NLRI specific information\n"
8450 "Display information about all VPNv4 NLRIs\n"
8451 "Detailed information on TCP and BGP neighbor connections\n"
8452 "Neighbor to display information about\n")
8453
8454ALIAS (show_ip_bgp_neighbors_peer,
8455 show_bgp_neighbors_peer_cmd,
8456 "show bgp neighbors (A.B.C.D|X:X::X:X)",
8457 SHOW_STR
8458 BGP_STR
8459 "Detailed information on TCP and BGP neighbor connections\n"
8460 "Neighbor to display information about\n"
8461 "Neighbor to display information about\n")
8462
8463ALIAS (show_ip_bgp_neighbors_peer,
8464 show_bgp_ipv6_neighbors_peer_cmd,
8465 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8466 SHOW_STR
8467 BGP_STR
8468 "Address family\n"
8469 "Detailed information on TCP and BGP neighbor connections\n"
8470 "Neighbor to display information about\n"
8471 "Neighbor to display information about\n")
8472
8473DEFUN (show_ip_bgp_instance_neighbors,
8474 show_ip_bgp_instance_neighbors_cmd,
8475 "show ip bgp view WORD neighbors",
8476 SHOW_STR
8477 IP_STR
8478 BGP_STR
8479 "BGP view\n"
8480 "View name\n"
8481 "Detailed information on TCP and BGP neighbor connections\n")
8482{
8483 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8484}
8485
paulbb46e942003-10-24 19:02:03 +00008486ALIAS (show_ip_bgp_instance_neighbors,
8487 show_bgp_instance_neighbors_cmd,
8488 "show bgp view WORD neighbors",
8489 SHOW_STR
8490 BGP_STR
8491 "BGP view\n"
8492 "View name\n"
8493 "Detailed information on TCP and BGP neighbor connections\n")
8494
8495ALIAS (show_ip_bgp_instance_neighbors,
8496 show_bgp_instance_ipv6_neighbors_cmd,
8497 "show bgp view WORD ipv6 neighbors",
8498 SHOW_STR
8499 BGP_STR
8500 "BGP view\n"
8501 "View name\n"
8502 "Address family\n"
8503 "Detailed information on TCP and BGP neighbor connections\n")
8504
paul718e3742002-12-13 20:15:29 +00008505DEFUN (show_ip_bgp_instance_neighbors_peer,
8506 show_ip_bgp_instance_neighbors_peer_cmd,
8507 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8508 SHOW_STR
8509 IP_STR
8510 BGP_STR
8511 "BGP view\n"
8512 "View name\n"
8513 "Detailed information on TCP and BGP neighbor connections\n"
8514 "Neighbor to display information about\n"
8515 "Neighbor to display information about\n")
8516{
8517 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8518}
paulbb46e942003-10-24 19:02:03 +00008519
8520ALIAS (show_ip_bgp_instance_neighbors_peer,
8521 show_bgp_instance_neighbors_peer_cmd,
8522 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8523 SHOW_STR
8524 BGP_STR
8525 "BGP view\n"
8526 "View name\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")
8530
8531ALIAS (show_ip_bgp_instance_neighbors_peer,
8532 show_bgp_instance_ipv6_neighbors_peer_cmd,
8533 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8534 SHOW_STR
8535 BGP_STR
8536 "BGP view\n"
8537 "View name\n"
8538 "Address family\n"
8539 "Detailed information on TCP and BGP neighbor connections\n"
8540 "Neighbor to display information about\n"
8541 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008542
paul718e3742002-12-13 20:15:29 +00008543/* Show BGP's AS paths internal data. There are both `show ip bgp
8544 paths' and `show ip mbgp paths'. Those functions results are the
8545 same.*/
8546DEFUN (show_ip_bgp_paths,
8547 show_ip_bgp_paths_cmd,
8548 "show ip bgp paths",
8549 SHOW_STR
8550 IP_STR
8551 BGP_STR
8552 "Path information\n")
8553{
8554 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8555 aspath_print_all_vty (vty);
8556 return CMD_SUCCESS;
8557}
8558
8559DEFUN (show_ip_bgp_ipv4_paths,
8560 show_ip_bgp_ipv4_paths_cmd,
8561 "show ip bgp ipv4 (unicast|multicast) paths",
8562 SHOW_STR
8563 IP_STR
8564 BGP_STR
8565 "Address family\n"
8566 "Address Family modifier\n"
8567 "Address Family modifier\n"
8568 "Path information\n")
8569{
8570 vty_out (vty, "Address Refcnt Path\r\n");
8571 aspath_print_all_vty (vty);
8572
8573 return CMD_SUCCESS;
8574}
David Lamparter6b0655a2014-06-04 06:53:35 +02008575
paul718e3742002-12-13 20:15:29 +00008576#include "hash.h"
8577
paul94f2b392005-06-28 12:44:16 +00008578static void
paul718e3742002-12-13 20:15:29 +00008579community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8580{
8581 struct community *com;
8582
8583 com = (struct community *) backet->data;
David Lampartereed3c482015-03-03 08:51:53 +01008584 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
paul718e3742002-12-13 20:15:29 +00008585 community_str (com), VTY_NEWLINE);
8586}
8587
8588/* Show BGP's community internal data. */
8589DEFUN (show_ip_bgp_community_info,
8590 show_ip_bgp_community_info_cmd,
8591 "show ip bgp community-info",
8592 SHOW_STR
8593 IP_STR
8594 BGP_STR
8595 "List all bgp community information\n")
8596{
8597 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8598
8599 hash_iterate (community_hash (),
8600 (void (*) (struct hash_backet *, void *))
8601 community_show_all_iterator,
8602 vty);
8603
8604 return CMD_SUCCESS;
8605}
8606
8607DEFUN (show_ip_bgp_attr_info,
8608 show_ip_bgp_attr_info_cmd,
8609 "show ip bgp attribute-info",
8610 SHOW_STR
8611 IP_STR
8612 BGP_STR
8613 "List all bgp attribute information\n")
8614{
8615 attr_show_all (vty);
8616 return CMD_SUCCESS;
8617}
David Lamparter6b0655a2014-06-04 06:53:35 +02008618
paul94f2b392005-06-28 12:44:16 +00008619static int
paulfee0f4c2004-09-13 05:12:46 +00008620bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8621 afi_t afi, safi_t safi)
8622{
8623 char timebuf[BGP_UPTIME_LEN];
8624 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008625 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008626 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008627 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008628 int len;
8629 int count = 0;
8630
8631 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8632 {
paul1eb8ef22005-04-07 07:30:20 +00008633 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008634 {
8635 count++;
8636 bgp_write_rsclient_summary (vty, peer, afi, safi);
8637 }
8638 return count;
8639 }
8640
8641 len = vty_out (vty, "%s", rsclient->host);
8642 len = 16 - len;
8643
8644 if (len < 1)
8645 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8646 else
8647 vty_out (vty, "%*s", len, " ");
8648
hasso3d515fd2005-02-01 21:30:04 +00008649 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008650
Milan Kociancb4fc592014-12-01 12:48:25 +00008651 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008652
8653 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8654 if ( rmname && strlen (rmname) > 13 )
8655 {
8656 sprintf (rmbuf, "%13s", "...");
8657 rmname = strncpy (rmbuf, rmname, 10);
8658 }
8659 else if (! rmname)
8660 rmname = "<none>";
8661 vty_out (vty, " %13s ", rmname);
8662
8663 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8664 if ( rmname && strlen (rmname) > 13 )
8665 {
8666 sprintf (rmbuf, "%13s", "...");
8667 rmname = strncpy (rmbuf, rmname, 10);
8668 }
8669 else if (! rmname)
8670 rmname = "<none>";
8671 vty_out (vty, " %13s ", rmname);
8672
8673 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8674
8675 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8676 vty_out (vty, " Idle (Admin)");
8677 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8678 vty_out (vty, " Idle (PfxCt)");
8679 else
8680 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8681
8682 vty_out (vty, "%s", VTY_NEWLINE);
8683
8684 return 1;
8685}
8686
paul94f2b392005-06-28 12:44:16 +00008687static int
paulfd79ac92004-10-13 05:06:08 +00008688bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8689 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008690{
8691 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008692 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008693 int count = 0;
8694
8695 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00008696 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00008697
paul1eb8ef22005-04-07 07:30:20 +00008698 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008699 {
8700 if (peer->afc[afi][safi] &&
8701 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8702 {
8703 if (! count)
8704 {
8705 vty_out (vty,
8706 "Route Server's BGP router identifier %s%s",
8707 inet_ntoa (bgp->router_id), VTY_NEWLINE);
8708 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008709 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00008710 VTY_NEWLINE);
8711
8712 vty_out (vty, "%s", VTY_NEWLINE);
8713 vty_out (vty, "%s%s", header, VTY_NEWLINE);
8714 }
8715
8716 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
8717 }
8718 }
8719
8720 if (count)
8721 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
8722 count, VTY_NEWLINE);
8723 else
8724 vty_out (vty, "No %s Route Server Client is configured%s",
8725 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
8726
8727 return CMD_SUCCESS;
8728}
8729
paul94f2b392005-06-28 12:44:16 +00008730static int
paulfd79ac92004-10-13 05:06:08 +00008731bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
8732 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008733{
8734 struct bgp *bgp;
8735
8736 if (name)
8737 {
8738 bgp = bgp_lookup_by_name (name);
8739
8740 if (! bgp)
8741 {
8742 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8743 return CMD_WARNING;
8744 }
8745
8746 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8747 return CMD_SUCCESS;
8748 }
8749
8750 bgp = bgp_get_default ();
8751
8752 if (bgp)
8753 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8754
8755 return CMD_SUCCESS;
8756}
8757
8758/* 'show bgp rsclient' commands. */
8759DEFUN (show_ip_bgp_rsclient_summary,
8760 show_ip_bgp_rsclient_summary_cmd,
8761 "show ip bgp rsclient summary",
8762 SHOW_STR
8763 IP_STR
8764 BGP_STR
8765 "Information about Route Server Clients\n"
8766 "Summary of all Route Server Clients\n")
8767{
8768 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8769}
8770
8771DEFUN (show_ip_bgp_instance_rsclient_summary,
8772 show_ip_bgp_instance_rsclient_summary_cmd,
8773 "show ip bgp view WORD rsclient summary",
8774 SHOW_STR
8775 IP_STR
8776 BGP_STR
8777 "BGP view\n"
8778 "View name\n"
8779 "Information about Route Server Clients\n"
8780 "Summary of all Route Server Clients\n")
8781{
8782 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8783}
8784
8785DEFUN (show_ip_bgp_ipv4_rsclient_summary,
8786 show_ip_bgp_ipv4_rsclient_summary_cmd,
8787 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
8788 SHOW_STR
8789 IP_STR
8790 BGP_STR
8791 "Address family\n"
8792 "Address Family modifier\n"
8793 "Address Family modifier\n"
8794 "Information about Route Server Clients\n"
8795 "Summary of all Route Server Clients\n")
8796{
8797 if (strncmp (argv[0], "m", 1) == 0)
8798 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
8799
8800 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8801}
8802
8803DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
8804 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
8805 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8806 SHOW_STR
8807 IP_STR
8808 BGP_STR
8809 "BGP view\n"
8810 "View name\n"
8811 "Address family\n"
8812 "Address Family modifier\n"
8813 "Address Family modifier\n"
8814 "Information about Route Server Clients\n"
8815 "Summary of all Route Server Clients\n")
8816{
8817 if (strncmp (argv[1], "m", 1) == 0)
8818 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
8819
8820 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8821}
8822
Michael Lambert95cbbd22010-07-23 14:43:04 -04008823DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
8824 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
8825 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8826 SHOW_STR
8827 BGP_STR
8828 "BGP view\n"
8829 "View name\n"
8830 "Address family\n"
8831 "Address Family modifier\n"
8832 "Address Family modifier\n"
8833 "Information about Route Server Clients\n"
8834 "Summary of all Route Server Clients\n")
8835{
8836 safi_t safi;
8837
8838 if (argc == 2) {
8839 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8840 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
8841 } else {
8842 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8843 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
8844 }
8845}
8846
8847ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
8848 show_bgp_ipv4_safi_rsclient_summary_cmd,
8849 "show bgp ipv4 (unicast|multicast) rsclient summary",
8850 SHOW_STR
8851 BGP_STR
8852 "Address family\n"
8853 "Address Family modifier\n"
8854 "Address Family modifier\n"
8855 "Information about Route Server Clients\n"
8856 "Summary of all Route Server Clients\n")
8857
paulfee0f4c2004-09-13 05:12:46 +00008858#ifdef HAVE_IPV6
8859DEFUN (show_bgp_rsclient_summary,
8860 show_bgp_rsclient_summary_cmd,
8861 "show bgp rsclient summary",
8862 SHOW_STR
8863 BGP_STR
8864 "Information about Route Server Clients\n"
8865 "Summary of all Route Server Clients\n")
8866{
8867 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8868}
8869
8870DEFUN (show_bgp_instance_rsclient_summary,
8871 show_bgp_instance_rsclient_summary_cmd,
8872 "show bgp view WORD rsclient summary",
8873 SHOW_STR
8874 BGP_STR
8875 "BGP view\n"
8876 "View name\n"
8877 "Information about Route Server Clients\n"
8878 "Summary of all Route Server Clients\n")
8879{
8880 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
8881}
8882
8883ALIAS (show_bgp_rsclient_summary,
8884 show_bgp_ipv6_rsclient_summary_cmd,
8885 "show bgp ipv6 rsclient summary",
8886 SHOW_STR
8887 BGP_STR
8888 "Address family\n"
8889 "Information about Route Server Clients\n"
8890 "Summary of all Route Server Clients\n")
8891
8892ALIAS (show_bgp_instance_rsclient_summary,
8893 show_bgp_instance_ipv6_rsclient_summary_cmd,
8894 "show bgp view WORD ipv6 rsclient summary",
8895 SHOW_STR
8896 BGP_STR
8897 "BGP view\n"
8898 "View name\n"
8899 "Address family\n"
8900 "Information about Route Server Clients\n"
8901 "Summary of all Route Server Clients\n")
Michael Lambert95cbbd22010-07-23 14:43:04 -04008902
8903DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
8904 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
8905 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
8906 SHOW_STR
8907 BGP_STR
8908 "BGP view\n"
8909 "View name\n"
8910 "Address family\n"
8911 "Address Family modifier\n"
8912 "Address Family modifier\n"
8913 "Information about Route Server Clients\n"
8914 "Summary of all Route Server Clients\n")
8915{
8916 safi_t safi;
8917
8918 if (argc == 2) {
8919 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8920 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
8921 } else {
8922 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8923 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
8924 }
8925}
8926
8927ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
8928 show_bgp_ipv6_safi_rsclient_summary_cmd,
8929 "show bgp ipv6 (unicast|multicast) rsclient summary",
8930 SHOW_STR
8931 BGP_STR
8932 "Address family\n"
8933 "Address Family modifier\n"
8934 "Address Family modifier\n"
8935 "Information about Route Server Clients\n"
8936 "Summary of all Route Server Clients\n")
8937
paulfee0f4c2004-09-13 05:12:46 +00008938#endif /* HAVE IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02008939
paul718e3742002-12-13 20:15:29 +00008940/* Redistribute VTY commands. */
8941
paul718e3742002-12-13 20:15:29 +00008942DEFUN (bgp_redistribute_ipv4,
8943 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008944 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008945 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008946 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008947{
8948 int type;
8949
David Lampartere0ca5fd2009-09-16 01:52:42 +02008950 type = proto_redistnum (AFI_IP, argv[0]);
8951 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008952 {
8953 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8954 return CMD_WARNING;
8955 }
8956 return bgp_redistribute_set (vty->index, AFI_IP, type);
8957}
8958
8959DEFUN (bgp_redistribute_ipv4_rmap,
8960 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008961 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008962 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008963 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008964 "Route map reference\n"
8965 "Pointer to route-map entries\n")
8966{
8967 int type;
8968
David Lampartere0ca5fd2009-09-16 01:52:42 +02008969 type = proto_redistnum (AFI_IP, argv[0]);
8970 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008971 {
8972 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8973 return CMD_WARNING;
8974 }
8975
8976 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8977 return bgp_redistribute_set (vty->index, AFI_IP, type);
8978}
8979
8980DEFUN (bgp_redistribute_ipv4_metric,
8981 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008982 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008983 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008984 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008985 "Metric for redistributed routes\n"
8986 "Default metric\n")
8987{
8988 int type;
8989 u_int32_t metric;
8990
David Lampartere0ca5fd2009-09-16 01:52:42 +02008991 type = proto_redistnum (AFI_IP, argv[0]);
8992 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008993 {
8994 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8995 return CMD_WARNING;
8996 }
8997 VTY_GET_INTEGER ("metric", metric, argv[1]);
8998
8999 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9000 return bgp_redistribute_set (vty->index, AFI_IP, type);
9001}
9002
9003DEFUN (bgp_redistribute_ipv4_rmap_metric,
9004 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009005 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009006 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009007 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009008 "Route map reference\n"
9009 "Pointer to route-map entries\n"
9010 "Metric for redistributed routes\n"
9011 "Default metric\n")
9012{
9013 int type;
9014 u_int32_t metric;
9015
David Lampartere0ca5fd2009-09-16 01:52:42 +02009016 type = proto_redistnum (AFI_IP, argv[0]);
9017 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009018 {
9019 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9020 return CMD_WARNING;
9021 }
9022 VTY_GET_INTEGER ("metric", metric, argv[2]);
9023
9024 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9025 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9026 return bgp_redistribute_set (vty->index, AFI_IP, type);
9027}
9028
9029DEFUN (bgp_redistribute_ipv4_metric_rmap,
9030 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009031 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009032 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009033 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009034 "Metric for redistributed routes\n"
9035 "Default metric\n"
9036 "Route map reference\n"
9037 "Pointer to route-map entries\n")
9038{
9039 int type;
9040 u_int32_t metric;
9041
David Lampartere0ca5fd2009-09-16 01:52:42 +02009042 type = proto_redistnum (AFI_IP, argv[0]);
9043 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009044 {
9045 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9046 return CMD_WARNING;
9047 }
9048 VTY_GET_INTEGER ("metric", metric, argv[1]);
9049
9050 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9051 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
9052 return bgp_redistribute_set (vty->index, AFI_IP, type);
9053}
9054
9055DEFUN (no_bgp_redistribute_ipv4,
9056 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009057 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009058 NO_STR
9059 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009060 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009061{
9062 int type;
9063
David Lampartere0ca5fd2009-09-16 01:52:42 +02009064 type = proto_redistnum (AFI_IP, argv[0]);
9065 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009066 {
9067 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9068 return CMD_WARNING;
9069 }
9070
9071 return bgp_redistribute_unset (vty->index, AFI_IP, type);
9072}
9073
9074DEFUN (no_bgp_redistribute_ipv4_rmap,
9075 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009076 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009077 NO_STR
9078 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009079 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009080 "Route map reference\n"
9081 "Pointer to route-map entries\n")
9082{
9083 int type;
9084
David Lampartere0ca5fd2009-09-16 01:52:42 +02009085 type = proto_redistnum (AFI_IP, argv[0]);
9086 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009087 {
9088 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9089 return CMD_WARNING;
9090 }
9091
9092 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9093 return CMD_SUCCESS;
9094}
9095
9096DEFUN (no_bgp_redistribute_ipv4_metric,
9097 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009098 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009099 NO_STR
9100 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009101 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009102 "Metric for redistributed routes\n"
9103 "Default metric\n")
9104{
9105 int type;
9106
David Lampartere0ca5fd2009-09-16 01:52:42 +02009107 type = proto_redistnum (AFI_IP, argv[0]);
9108 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009109 {
9110 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9111 return CMD_WARNING;
9112 }
9113
9114 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9115 return CMD_SUCCESS;
9116}
9117
9118DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
9119 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009120 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009121 NO_STR
9122 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009123 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009124 "Route map reference\n"
9125 "Pointer to route-map entries\n"
9126 "Metric for redistributed routes\n"
9127 "Default metric\n")
9128{
9129 int type;
9130
David Lampartere0ca5fd2009-09-16 01:52:42 +02009131 type = proto_redistnum (AFI_IP, argv[0]);
9132 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009133 {
9134 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9135 return CMD_WARNING;
9136 }
9137
9138 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9139 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9140 return CMD_SUCCESS;
9141}
9142
9143ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
9144 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009145 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009146 NO_STR
9147 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009148 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009149 "Metric for redistributed routes\n"
9150 "Default metric\n"
9151 "Route map reference\n"
9152 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009153
paul718e3742002-12-13 20:15:29 +00009154#ifdef HAVE_IPV6
9155DEFUN (bgp_redistribute_ipv6,
9156 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009157 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009158 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009159 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009160{
9161 int type;
9162
David Lampartere0ca5fd2009-09-16 01:52:42 +02009163 type = proto_redistnum (AFI_IP6, argv[0]);
9164 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009165 {
9166 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9167 return CMD_WARNING;
9168 }
9169
9170 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9171}
9172
9173DEFUN (bgp_redistribute_ipv6_rmap,
9174 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009175 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009176 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009177 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009178 "Route map reference\n"
9179 "Pointer to route-map entries\n")
9180{
9181 int type;
9182
David Lampartere0ca5fd2009-09-16 01:52:42 +02009183 type = proto_redistnum (AFI_IP6, argv[0]);
9184 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009185 {
9186 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9187 return CMD_WARNING;
9188 }
9189
9190 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9191 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9192}
9193
9194DEFUN (bgp_redistribute_ipv6_metric,
9195 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009196 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009197 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009198 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009199 "Metric for redistributed routes\n"
9200 "Default metric\n")
9201{
9202 int type;
9203 u_int32_t metric;
9204
David Lampartere0ca5fd2009-09-16 01:52:42 +02009205 type = proto_redistnum (AFI_IP6, argv[0]);
9206 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009207 {
9208 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9209 return CMD_WARNING;
9210 }
9211 VTY_GET_INTEGER ("metric", metric, argv[1]);
9212
9213 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9214 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9215}
9216
9217DEFUN (bgp_redistribute_ipv6_rmap_metric,
9218 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009219 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009220 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009221 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009222 "Route map reference\n"
9223 "Pointer to route-map entries\n"
9224 "Metric for redistributed routes\n"
9225 "Default metric\n")
9226{
9227 int type;
9228 u_int32_t metric;
9229
David Lampartere0ca5fd2009-09-16 01:52:42 +02009230 type = proto_redistnum (AFI_IP6, argv[0]);
9231 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009232 {
9233 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9234 return CMD_WARNING;
9235 }
9236 VTY_GET_INTEGER ("metric", metric, argv[2]);
9237
9238 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9239 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9240 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9241}
9242
9243DEFUN (bgp_redistribute_ipv6_metric_rmap,
9244 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009245 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009246 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009247 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009248 "Metric for redistributed routes\n"
9249 "Default metric\n"
9250 "Route map reference\n"
9251 "Pointer to route-map entries\n")
9252{
9253 int type;
9254 u_int32_t metric;
9255
David Lampartere0ca5fd2009-09-16 01:52:42 +02009256 type = proto_redistnum (AFI_IP6, argv[0]);
9257 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009258 {
9259 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9260 return CMD_WARNING;
9261 }
9262 VTY_GET_INTEGER ("metric", metric, argv[1]);
9263
9264 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9265 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
9266 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9267}
9268
9269DEFUN (no_bgp_redistribute_ipv6,
9270 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009271 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009272 NO_STR
9273 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009274 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009275{
9276 int type;
9277
David Lampartere0ca5fd2009-09-16 01:52:42 +02009278 type = proto_redistnum (AFI_IP6, argv[0]);
9279 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009280 {
9281 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9282 return CMD_WARNING;
9283 }
9284
9285 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
9286}
9287
9288DEFUN (no_bgp_redistribute_ipv6_rmap,
9289 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009290 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009291 NO_STR
9292 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009293 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009294 "Route map reference\n"
9295 "Pointer to route-map entries\n")
9296{
9297 int type;
9298
David Lampartere0ca5fd2009-09-16 01:52:42 +02009299 type = proto_redistnum (AFI_IP6, argv[0]);
9300 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009301 {
9302 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9303 return CMD_WARNING;
9304 }
9305
9306 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9307 return CMD_SUCCESS;
9308}
9309
9310DEFUN (no_bgp_redistribute_ipv6_metric,
9311 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009312 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009313 NO_STR
9314 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009315 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009316 "Metric for redistributed routes\n"
9317 "Default metric\n")
9318{
9319 int type;
9320
David Lampartere0ca5fd2009-09-16 01:52:42 +02009321 type = proto_redistnum (AFI_IP6, argv[0]);
9322 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009323 {
9324 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9325 return CMD_WARNING;
9326 }
9327
9328 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9329 return CMD_SUCCESS;
9330}
9331
9332DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
9333 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009334 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009335 NO_STR
9336 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009337 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009338 "Route map reference\n"
9339 "Pointer to route-map entries\n"
9340 "Metric for redistributed routes\n"
9341 "Default metric\n")
9342{
9343 int type;
9344
David Lampartere0ca5fd2009-09-16 01:52:42 +02009345 type = proto_redistnum (AFI_IP6, argv[0]);
9346 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009347 {
9348 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9349 return CMD_WARNING;
9350 }
9351
9352 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9353 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9354 return CMD_SUCCESS;
9355}
9356
9357ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9358 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009359 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009360 NO_STR
9361 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009362 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009363 "Metric for redistributed routes\n"
9364 "Default metric\n"
9365 "Route map reference\n"
9366 "Pointer to route-map entries\n")
9367#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02009368
paul718e3742002-12-13 20:15:29 +00009369int
9370bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9371 safi_t safi, int *write)
9372{
9373 int i;
paul718e3742002-12-13 20:15:29 +00009374
9375 /* Unicast redistribution only. */
9376 if (safi != SAFI_UNICAST)
9377 return 0;
9378
9379 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9380 {
9381 /* Redistribute BGP does not make sense. */
9382 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9383 {
9384 /* Display "address-family" when it is not yet diplayed. */
9385 bgp_config_write_family_header (vty, afi, safi, write);
9386
9387 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009388 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009389
9390 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009391 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009392
9393 if (bgp->rmap[afi][i].name)
9394 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9395
9396 vty_out (vty, "%s", VTY_NEWLINE);
9397 }
9398 }
9399 return *write;
9400}
David Lamparter6b0655a2014-06-04 06:53:35 +02009401
paul718e3742002-12-13 20:15:29 +00009402/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009403static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009404{
9405 BGP_NODE,
9406 "%s(config-router)# ",
9407 1,
9408};
9409
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009410static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009411{
9412 BGP_IPV4_NODE,
9413 "%s(config-router-af)# ",
9414 1,
9415};
9416
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009417static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009418{
9419 BGP_IPV4M_NODE,
9420 "%s(config-router-af)# ",
9421 1,
9422};
9423
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009424static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009425{
9426 BGP_IPV6_NODE,
9427 "%s(config-router-af)# ",
9428 1,
9429};
9430
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009431static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009432{
9433 BGP_IPV6M_NODE,
9434 "%s(config-router-af)# ",
9435 1,
9436};
9437
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009438static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009439{
9440 BGP_VPNV4_NODE,
9441 "%s(config-router-af)# ",
9442 1
9443};
David Lamparter6b0655a2014-06-04 06:53:35 +02009444
Lou Berger13c378d2016-01-12 13:41:56 -05009445static struct cmd_node bgp_vpnv6_node =
9446{
9447 BGP_VPNV6_NODE,
9448 "%s(config-router-af-vpnv6)# ",
9449 1
9450};
9451
Lou Bergera3fda882016-01-12 13:42:04 -05009452static struct cmd_node bgp_encap_node =
9453{
9454 BGP_ENCAP_NODE,
9455 "%s(config-router-af-encap)# ",
9456 1
9457};
9458
9459static struct cmd_node bgp_encapv6_node =
9460{
9461 BGP_ENCAPV6_NODE,
9462 "%s(config-router-af-encapv6)# ",
9463 1
9464};
9465
paul1f8ae702005-09-09 23:49:49 +00009466static void community_list_vty (void);
9467
paul718e3742002-12-13 20:15:29 +00009468void
paul94f2b392005-06-28 12:44:16 +00009469bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009470{
paul718e3742002-12-13 20:15:29 +00009471 /* Install bgp top node. */
9472 install_node (&bgp_node, bgp_config_write);
9473 install_node (&bgp_ipv4_unicast_node, NULL);
9474 install_node (&bgp_ipv4_multicast_node, NULL);
9475 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009476 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009477 install_node (&bgp_vpnv4_node, NULL);
Lou Berger13c378d2016-01-12 13:41:56 -05009478 install_node (&bgp_vpnv6_node, NULL);
Lou Bergera3fda882016-01-12 13:42:04 -05009479 install_node (&bgp_encap_node, NULL);
9480 install_node (&bgp_encapv6_node, NULL);
paul718e3742002-12-13 20:15:29 +00009481
9482 /* Install default VTY commands to new nodes. */
9483 install_default (BGP_NODE);
9484 install_default (BGP_IPV4_NODE);
9485 install_default (BGP_IPV4M_NODE);
9486 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009487 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009488 install_default (BGP_VPNV4_NODE);
Lou Berger13c378d2016-01-12 13:41:56 -05009489 install_default (BGP_VPNV6_NODE);
Lou Bergera3fda882016-01-12 13:42:04 -05009490 install_default (BGP_ENCAP_NODE);
9491 install_default (BGP_ENCAPV6_NODE);
paul718e3742002-12-13 20:15:29 +00009492
9493 /* "bgp multiple-instance" commands. */
9494 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9495 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9496
9497 /* "bgp config-type" commands. */
9498 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9499 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9500
9501 /* Dummy commands (Currently not supported) */
9502 install_element (BGP_NODE, &no_synchronization_cmd);
9503 install_element (BGP_NODE, &no_auto_summary_cmd);
9504
9505 /* "router bgp" commands. */
9506 install_element (CONFIG_NODE, &router_bgp_cmd);
9507 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9508
9509 /* "no router bgp" commands. */
9510 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9511 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9512
9513 /* "bgp router-id" commands. */
9514 install_element (BGP_NODE, &bgp_router_id_cmd);
9515 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9516 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9517
9518 /* "bgp cluster-id" commands. */
9519 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9520 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9521 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9522 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9523
9524 /* "bgp confederation" commands. */
9525 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9526 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9527 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9528
9529 /* "bgp confederation peers" commands. */
9530 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9531 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9532
Josh Bailey165b5ff2011-07-20 20:43:22 -07009533 /* "maximum-paths" commands. */
9534 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9535 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9536 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9537 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9538 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9539 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
9540 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9541 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9542 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9543 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9544 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9545 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9546
paul718e3742002-12-13 20:15:29 +00009547 /* "timers bgp" commands. */
9548 install_element (BGP_NODE, &bgp_timers_cmd);
9549 install_element (BGP_NODE, &no_bgp_timers_cmd);
9550 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9551
9552 /* "bgp client-to-client reflection" commands */
9553 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9554 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9555
9556 /* "bgp always-compare-med" commands */
9557 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9558 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9559
9560 /* "bgp deterministic-med" commands */
9561 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9562 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009563
hasso538621f2004-05-21 09:31:30 +00009564 /* "bgp graceful-restart" commands */
9565 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9566 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009567 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9568 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9569 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009570
9571 /* "bgp fast-external-failover" commands */
9572 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9573 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9574
9575 /* "bgp enforce-first-as" commands */
9576 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9577 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9578
9579 /* "bgp bestpath compare-routerid" commands */
9580 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9581 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9582
9583 /* "bgp bestpath as-path ignore" commands */
9584 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9585 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9586
hasso68118452005-04-08 15:40:36 +00009587 /* "bgp bestpath as-path confed" commands */
9588 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9589 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9590
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00009591 /* "bgp bestpath as-path multipath-relax" commands */
9592 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9593 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9594
paul848973c2003-08-13 00:32:49 +00009595 /* "bgp log-neighbor-changes" commands */
9596 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9597 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9598
paul718e3742002-12-13 20:15:29 +00009599 /* "bgp bestpath med" commands */
9600 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9601 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9602 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9603 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9604 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9605 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9606
9607 /* "no bgp default ipv4-unicast" commands. */
9608 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9609 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9610
9611 /* "bgp network import-check" commands. */
9612 install_element (BGP_NODE, &bgp_network_import_check_cmd);
9613 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
9614
9615 /* "bgp default local-preference" commands. */
9616 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
9617 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
9618 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
9619
9620 /* "neighbor remote-as" commands. */
9621 install_element (BGP_NODE, &neighbor_remote_as_cmd);
9622 install_element (BGP_NODE, &no_neighbor_cmd);
9623 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
9624
9625 /* "neighbor peer-group" commands. */
9626 install_element (BGP_NODE, &neighbor_peer_group_cmd);
9627 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
9628 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
9629
9630 /* "neighbor local-as" commands. */
9631 install_element (BGP_NODE, &neighbor_local_as_cmd);
9632 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009633 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +00009634 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
9635 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
9636 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009637 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +00009638
Paul Jakma0df7c912008-07-21 21:02:49 +00009639 /* "neighbor password" commands. */
9640 install_element (BGP_NODE, &neighbor_password_cmd);
9641 install_element (BGP_NODE, &no_neighbor_password_cmd);
9642
paul718e3742002-12-13 20:15:29 +00009643 /* "neighbor activate" commands. */
9644 install_element (BGP_NODE, &neighbor_activate_cmd);
9645 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
9646 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
9647 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009648 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009649 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009650 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009651 install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd);
9652 install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009653
9654 /* "no neighbor activate" commands. */
9655 install_element (BGP_NODE, &no_neighbor_activate_cmd);
9656 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
9657 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
9658 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009659 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009660 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009661 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009662 install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd);
9663 install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009664
9665 /* "neighbor peer-group set" commands. */
9666 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
9667 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
9668 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
9669 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009670 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009671 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009672 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009673 install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd);
9674 install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009675
paul718e3742002-12-13 20:15:29 +00009676 /* "no neighbor peer-group unset" commands. */
9677 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
9678 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
9679 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
9680 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009681 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009682 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009683 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009684 install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd);
9685 install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009686
paul718e3742002-12-13 20:15:29 +00009687 /* "neighbor softreconfiguration inbound" commands.*/
9688 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
9689 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
9690 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
9691 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
9692 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
9693 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
9694 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
9695 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009696 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
9697 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +00009698 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
9699 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009700 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
9701 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009702 install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd);
9703 install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd);
9704 install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd);
9705 install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +00009706
9707 /* "neighbor attribute-unchanged" commands. */
9708 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
9709 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
9710 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
9711 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
9712 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
9713 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
9714 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
9715 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
9716 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
9717 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
9718 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
9719 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
9720 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
9721 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
9722 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
9723 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
9724 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
9725 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
9726 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
9727 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
9728 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
9729 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
9730 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
9731 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
9732 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
9733 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
9734 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
9735 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
9736 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
9737 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
9738 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
9739 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
9740 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
9741 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
9742 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9743 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9744 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9745 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9746 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9747 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9748 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9749 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9750 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9751 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9752 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
9753 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
9754 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
9755 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
9756 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
9757 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
9758 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
9759 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
9760 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
9761 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
9762 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
9763 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
9764 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
9765 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
9766 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
9767 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
9768 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
9769 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
9770 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
9771 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
9772 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
9773 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
9774 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
9775 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
9776 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
9777 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
9778 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
9779 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
9780 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
9781 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
9782 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
9783 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
9784 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
9785 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9786 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9787 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9788 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9789 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9790 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9791 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9792 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9793 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9794 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9795 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009796 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
9797 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
9798 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
9799 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
9800 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
9801 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
9802 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
9803 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
9804 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
9805 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
9806 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
9807 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
9808 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
9809 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
9810 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
9811 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
9812 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
9813 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
9814 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
9815 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
9816 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
9817 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +00009818 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
9819 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
9820 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
9821 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
9822 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
9823 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
9824 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
9825 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
9826 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
9827 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
9828 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
9829 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
9830 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9831 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9832 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9833 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9834 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9835 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9836 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9837 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9838 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9839 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9840
Lou Berger13c378d2016-01-12 13:41:56 -05009841 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
9842 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
9843 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
9844 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
9845 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
9846 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
9847 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
9848 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
9849 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
9850 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
9851 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
9852 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
9853 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9854 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9855 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9856 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9857 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9858 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9859 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9860 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9861 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9862 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
9863
Lou Bergera3fda882016-01-12 13:42:04 -05009864 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd);
9865 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd);
9866 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd);
9867 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd);
9868 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd);
9869 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd);
9870 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd);
9871 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd);
9872 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd);
9873 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd);
9874 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd);
9875 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd);
9876 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd);
9877 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd);
9878 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd);
9879 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd);
9880 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd);
9881 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd);
9882 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd);
9883 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd);
9884 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd);
9885 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd);
9886
9887 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd);
9888 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd);
9889 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd);
9890 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd);
9891 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd);
9892 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd);
9893 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd);
9894 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd);
9895 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd);
9896 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd);
9897 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd);
9898 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9899 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9900 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9901 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9902 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9903 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9904 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9905 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9906 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9907 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9908 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
9909
paulfee0f4c2004-09-13 05:12:46 +00009910 /* "nexthop-local unchanged" commands */
9911 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
9912 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
9913
paul718e3742002-12-13 20:15:29 +00009914 /* "transparent-as" and "transparent-nexthop" for old version
9915 compatibility. */
9916 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
9917 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
9918
9919 /* "neighbor next-hop-self" commands. */
9920 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
9921 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
9922 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
9923 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
9924 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
9925 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
9926 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
9927 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009928 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
9929 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009930 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
9931 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009932 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
9933 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009934 install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd);
9935 install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd);
9936 install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd);
9937 install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009938
9939 /* "neighbor remove-private-AS" commands. */
9940 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
9941 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
9942 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
9943 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
9944 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
9945 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
9946 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
9947 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009948 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
9949 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009950 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
9951 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009952 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
9953 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009954 install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd);
9955 install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd);
9956 install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd);
9957 install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009958
9959 /* "neighbor send-community" commands.*/
9960 install_element (BGP_NODE, &neighbor_send_community_cmd);
9961 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
9962 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
9963 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
9964 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
9965 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
9966 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
9967 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
9968 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
9969 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
9970 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
9971 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
9972 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
9973 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
9974 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
9975 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009976 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
9977 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
9978 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
9979 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00009980 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
9981 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
9982 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
9983 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009984 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
9985 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
9986 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
9987 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009988 install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd);
9989 install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd);
9990 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd);
9991 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd);
9992 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd);
9993 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd);
9994 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd);
9995 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00009996
9997 /* "neighbor route-reflector" commands.*/
9998 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
9999 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
10000 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
10001 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
10002 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
10003 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
10004 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
10005 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010006 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
10007 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010008 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
10009 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010010 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
10011 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010012 install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd);
10013 install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd);
10014 install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd);
10015 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010016
10017 /* "neighbor route-server" commands.*/
10018 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
10019 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
10020 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
10021 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
10022 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
10023 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
10024 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
10025 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010026 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
10027 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010028 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
10029 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010030 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
10031 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010032 install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd);
10033 install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd);
10034 install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd);
10035 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010036
10037 /* "neighbor passive" commands. */
10038 install_element (BGP_NODE, &neighbor_passive_cmd);
10039 install_element (BGP_NODE, &no_neighbor_passive_cmd);
10040
10041 /* "neighbor shutdown" commands. */
10042 install_element (BGP_NODE, &neighbor_shutdown_cmd);
10043 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
10044
hassoc9502432005-02-01 22:01:48 +000010045 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +000010046 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
10047 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
10048
10049 /* "neighbor capability orf prefix-list" commands.*/
10050 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
10051 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
10052 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
10053 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
10054 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
10055 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
10056 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
10057 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010058 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
10059 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +000010060
10061 /* "neighbor capability dynamic" commands.*/
10062 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
10063 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
10064
10065 /* "neighbor dont-capability-negotiate" commands. */
10066 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
10067 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
10068
10069 /* "neighbor ebgp-multihop" commands. */
10070 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
10071 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
10072 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
10073 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
10074
hasso6ffd2072005-02-02 14:50:11 +000010075 /* "neighbor disable-connected-check" commands. */
10076 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
10077 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +000010078 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
10079 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
10080
10081 /* "neighbor description" commands. */
10082 install_element (BGP_NODE, &neighbor_description_cmd);
10083 install_element (BGP_NODE, &no_neighbor_description_cmd);
10084 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
10085
10086 /* "neighbor update-source" commands. "*/
10087 install_element (BGP_NODE, &neighbor_update_source_cmd);
10088 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
10089
10090 /* "neighbor default-originate" commands. */
10091 install_element (BGP_NODE, &neighbor_default_originate_cmd);
10092 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
10093 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
10094 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
10095 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
10096 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
10097 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
10098 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
10099 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
10100 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
10101 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
10102 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
10103 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
10104 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
10105 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
10106 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010107 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
10108 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
10109 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
10110 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000010111
10112 /* "neighbor port" commands. */
10113 install_element (BGP_NODE, &neighbor_port_cmd);
10114 install_element (BGP_NODE, &no_neighbor_port_cmd);
10115 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
10116
10117 /* "neighbor weight" commands. */
10118 install_element (BGP_NODE, &neighbor_weight_cmd);
10119 install_element (BGP_NODE, &no_neighbor_weight_cmd);
10120 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
10121
10122 /* "neighbor override-capability" commands. */
10123 install_element (BGP_NODE, &neighbor_override_capability_cmd);
10124 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
10125
10126 /* "neighbor strict-capability-match" commands. */
10127 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
10128 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
10129
10130 /* "neighbor timers" commands. */
10131 install_element (BGP_NODE, &neighbor_timers_cmd);
10132 install_element (BGP_NODE, &no_neighbor_timers_cmd);
10133
10134 /* "neighbor timers connect" commands. */
10135 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
10136 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
10137 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
10138
10139 /* "neighbor advertisement-interval" commands. */
10140 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
10141 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
10142 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
10143
10144 /* "neighbor version" commands. */
10145 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +000010146
10147 /* "neighbor interface" commands. */
10148 install_element (BGP_NODE, &neighbor_interface_cmd);
10149 install_element (BGP_NODE, &no_neighbor_interface_cmd);
10150
10151 /* "neighbor distribute" commands. */
10152 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
10153 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
10154 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
10155 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
10156 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
10157 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
10158 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
10159 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010160 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
10161 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010162 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
10163 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010164 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
10165 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010166 install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd);
10167 install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd);
10168 install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd);
10169 install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010170
10171 /* "neighbor prefix-list" commands. */
10172 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
10173 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
10174 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
10175 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
10176 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
10177 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
10178 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
10179 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010180 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
10181 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010182 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
10183 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010184 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
10185 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010186 install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd);
10187 install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd);
10188 install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd);
10189 install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010190
10191 /* "neighbor filter-list" commands. */
10192 install_element (BGP_NODE, &neighbor_filter_list_cmd);
10193 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
10194 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
10195 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
10196 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
10197 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
10198 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
10199 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010200 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
10201 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010202 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
10203 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010204 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
10205 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010206 install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd);
10207 install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd);
10208 install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd);
10209 install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010210
10211 /* "neighbor route-map" commands. */
10212 install_element (BGP_NODE, &neighbor_route_map_cmd);
10213 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
10214 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
10215 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
10216 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
10217 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
10218 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
10219 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010220 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
10221 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010222 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
10223 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010224 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
10225 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010226 install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd);
10227 install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd);
10228 install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd);
10229 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010230
10231 /* "neighbor unsuppress-map" commands. */
10232 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
10233 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
10234 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
10235 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
10236 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
10237 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
10238 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
10239 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010240 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
10241 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +000010242 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010243 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010244 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010245 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010246 install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd);
10247 install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd);
10248 install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd);
10249 install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +000010250
10251 /* "neighbor maximum-prefix" commands. */
10252 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010253 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010254 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010255 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010256 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
10257 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010258 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
10259 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010260 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10261 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10262 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10263 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10264 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010265 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010266 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010267 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010268 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010269 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10270 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010271 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
10272 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010273 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10274 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10275 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10276 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10277 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010278 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010279 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010280 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010281 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010282 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
10283 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010284 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
10285 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010286 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10287 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10288 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10289 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10290 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010291 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010292 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010293 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010294 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010295 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10296 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010297 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10298 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010299 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10300 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10301 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10302 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10303 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010304 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
10305 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
10306 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
10307 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10308 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
10309 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10310 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
10311 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
10312 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10313 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10314 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10315 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10316 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010317 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010318 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010319 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010320 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010321 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10322 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010323 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
10324 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010325 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10326 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10327 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10328 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10329 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010330
Lou Berger13c378d2016-01-12 13:41:56 -050010331 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
10332 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10333 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10334 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10335 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10336 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10337 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
10338 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10339 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10340 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10341 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10342 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10343 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10344
Lou Bergera3fda882016-01-12 13:42:04 -050010345 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd);
10346 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd);
10347 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd);
10348 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10349 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd);
10350 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10351 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd);
10352 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd);
10353 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10354 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10355 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10356 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10357 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10358
10359 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd);
10360 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10361 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10362 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10363 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10364 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10365 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10366 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10367 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10368 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10369 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10370 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10371 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10372
paul718e3742002-12-13 20:15:29 +000010373 /* "neighbor allowas-in" */
10374 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
10375 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
10376 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
10377 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
10378 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
10379 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
10380 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
10381 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
10382 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
10383 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
10384 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
10385 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010386 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
10387 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
10388 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010389 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
10390 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
10391 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010392 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
10393 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
10394 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010395 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd);
10396 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd);
10397 install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd);
10398 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd);
10399 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd);
10400 install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010401
10402 /* address-family commands. */
10403 install_element (BGP_NODE, &address_family_ipv4_cmd);
10404 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
10405#ifdef HAVE_IPV6
10406 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010407 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010408#endif /* HAVE_IPV6 */
10409 install_element (BGP_NODE, &address_family_vpnv4_cmd);
10410 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
10411
Lou Berger13c378d2016-01-12 13:41:56 -050010412 install_element (BGP_NODE, &address_family_vpnv6_cmd);
10413 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
10414
Lou Bergera3fda882016-01-12 13:42:04 -050010415 install_element (BGP_NODE, &address_family_encap_cmd);
10416 install_element (BGP_NODE, &address_family_encapv4_cmd);
10417#ifdef HAVE_IPV6
10418 install_element (BGP_NODE, &address_family_encapv6_cmd);
10419#endif
10420
paul718e3742002-12-13 20:15:29 +000010421 /* "exit-address-family" command. */
10422 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
10423 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
10424 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010425 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010426 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010427 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010428 install_element (BGP_ENCAP_NODE, &exit_address_family_cmd);
10429 install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010430
10431 /* "clear ip bgp commands" */
10432 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
10433 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
10434 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
10435 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
10436 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
10437 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
10438#ifdef HAVE_IPV6
10439 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
10440 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
10441 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
10442 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
10443 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
10444 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
10445 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
10446 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
10447 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
10448 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
10449 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
10450#endif /* HAVE_IPV6 */
10451
10452 /* "clear ip bgp neighbor soft in" */
10453 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
10454 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
10455 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
10456 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
10457 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
10458 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
10459 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
10460 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
10461 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
10462 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
10463 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
10464 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
10465 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
10466 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
10467 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
10468 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
10469 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
10470 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
10471 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
10472 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
10473 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
10474 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
10475 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
10476 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
10477 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
10478 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
10479 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
10480 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
10481 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
10482 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
10483 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
10484 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
10485 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
10486 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
10487 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
10488 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
10489 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
10490 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
10491 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
10492 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010493 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
10494 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
10495 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
10496 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
10497 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
10498 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
paul718e3742002-12-13 20:15:29 +000010499#ifdef HAVE_IPV6
10500 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
10501 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
10502 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
10503 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
10504 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
10505 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
10506 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
10507 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
10508 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
10509 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
10510 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
10511 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
10512 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
10513 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
10514 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
10515 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
10516 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
10517 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
10518 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
10519 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
10520 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
10521 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
10522 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
10523 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
10524 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
10525 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
10526 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
10527 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
10528 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
10529 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
10530 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
10531#endif /* HAVE_IPV6 */
10532
10533 /* "clear ip bgp neighbor soft out" */
10534 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
10535 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
10536 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
10537 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
10538 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
10539 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
10540 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
10541 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
10542 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
10543 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
10544 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
10545 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
10546 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
10547 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
10548 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
10549 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
10550 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
10551 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
10552 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
10553 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
10554 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
10555 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
10556 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
10557 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
10558 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
10559 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
10560 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
10561 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010562 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
10563 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
10564 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
10565 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
10566 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
10567 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
paul718e3742002-12-13 20:15:29 +000010568#ifdef HAVE_IPV6
10569 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
10570 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
10571 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
10572 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
10573 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
10574 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
10575 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
10576 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
10577 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
10578 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
10579 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
10580 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
10581 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
10582 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
10583 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
10584 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
10585 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
10586 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
10587 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
10588 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
10589 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
10590#endif /* HAVE_IPV6 */
10591
10592 /* "clear ip bgp neighbor soft" */
10593 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
10594 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
10595 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
10596 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
10597 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
10598 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
10599 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
10600 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
10601 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
10602 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
10603 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
10604 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
10605 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
10606 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
10607 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010608 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
10609 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
10610 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
paul718e3742002-12-13 20:15:29 +000010611#ifdef HAVE_IPV6
10612 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
10613 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
10614 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
10615 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
10616 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
10617 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
10618 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
10619 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
10620 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
10621 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
10622 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
10623#endif /* HAVE_IPV6 */
10624
paulfee0f4c2004-09-13 05:12:46 +000010625 /* "clear ip bgp neighbor rsclient" */
10626 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
10627 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
10628 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
10629 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
10630#ifdef HAVE_IPV6
10631 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
10632 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
10633 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
10634 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
10635 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
10636 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
10637 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
10638 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
10639#endif /* HAVE_IPV6 */
10640
paul718e3742002-12-13 20:15:29 +000010641 /* "show ip bgp summary" commands. */
10642 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
10643 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
10644 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010645 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010646 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010647 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010648 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10649 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10650#ifdef HAVE_IPV6
10651 install_element (VIEW_NODE, &show_bgp_summary_cmd);
10652 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
10653 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010654 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010655 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010656 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010657#endif /* HAVE_IPV6 */
Paul Jakma62687ff2008-08-23 14:27:06 +010010658 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
10659 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
10660 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010661 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010662 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010663 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010664 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10665 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10666#ifdef HAVE_IPV6
10667 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
10668 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
10669 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010670 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010671 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010672 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010673#endif /* HAVE_IPV6 */
paul718e3742002-12-13 20:15:29 +000010674 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
10675 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
10676 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010677 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010678 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010679 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010680 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10681 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10682#ifdef HAVE_IPV6
10683 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
10684 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
10685 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010686 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010687 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010688 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010689#endif /* HAVE_IPV6 */
10690
10691 /* "show ip bgp neighbors" commands. */
10692 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
10693 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10694 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
10695 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10696 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10697 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10698 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10699 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10700 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
10701 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010702 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
10703 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10704 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10705 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10706 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010707 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
10708 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10709 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
10710 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10711 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10712 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10713 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10714 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10715 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
10716 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
10717
10718#ifdef HAVE_IPV6
10719 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
10720 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
10721 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
10722 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010723 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
10724 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10725 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
10726 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010727 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
10728 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
10729 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
10730 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010731 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
10732 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
10733 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
10734 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010735 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
10736 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10737 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
10738 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010739
10740 /* Old commands. */
10741 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
10742 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
10743 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
10744 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
10745#endif /* HAVE_IPV6 */
10746
paulfee0f4c2004-09-13 05:12:46 +000010747 /* "show ip bgp rsclient" commands. */
10748 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
10749 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10750 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10751 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010752 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10753 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010754 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
10755 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10756 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10757 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010758 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10759 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010760 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
10761 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10762 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10763 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010764 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10765 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010766
10767#ifdef HAVE_IPV6
10768 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
10769 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10770 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
10771 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010772 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10773 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010774 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
10775 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10776 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
10777 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010778 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10779 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010780 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
10781 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10782 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
10783 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010784 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10785 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010786#endif /* HAVE_IPV6 */
10787
paul718e3742002-12-13 20:15:29 +000010788 /* "show ip bgp paths" commands. */
10789 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
10790 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
10791 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
10792 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
10793
10794 /* "show ip bgp community" commands. */
10795 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
10796 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
10797
10798 /* "show ip bgp attribute-info" commands. */
10799 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
10800 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
10801
10802 /* "redistribute" commands. */
10803 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
10804 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
10805 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
10806 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
10807 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
10808 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
10809 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
10810 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
10811 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
10812 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
10813#ifdef HAVE_IPV6
10814 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
10815 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
10816 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
10817 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
10818 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
10819 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
10820 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
10821 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
10822 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
10823 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
10824#endif /* HAVE_IPV6 */
10825
Nick Hilliardfa411a22011-03-23 15:33:17 +000010826 /* ttl_security commands */
10827 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
10828 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
10829
Paul Jakma4bf6a362006-03-30 14:05:23 +000010830 /* "show bgp memory" commands. */
10831 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010832 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000010833 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
10834
Michael Lamberte0081f72008-11-16 20:12:04 +000010835 /* "show bgp views" commands. */
10836 install_element (VIEW_NODE, &show_bgp_views_cmd);
10837 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
10838 install_element (ENABLE_NODE, &show_bgp_views_cmd);
10839
paul718e3742002-12-13 20:15:29 +000010840 /* Community-list. */
10841 community_list_vty ();
10842}
David Lamparter6b0655a2014-06-04 06:53:35 +020010843
paul718e3742002-12-13 20:15:29 +000010844#include "memory.h"
10845#include "bgp_regex.h"
10846#include "bgp_clist.h"
10847#include "bgp_ecommunity.h"
10848
10849/* VTY functions. */
10850
10851/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000010852static const char *
paul718e3742002-12-13 20:15:29 +000010853community_direct_str (int direct)
10854{
10855 switch (direct)
10856 {
10857 case COMMUNITY_DENY:
10858 return "deny";
paul718e3742002-12-13 20:15:29 +000010859 case COMMUNITY_PERMIT:
10860 return "permit";
paul718e3742002-12-13 20:15:29 +000010861 default:
10862 return "unknown";
paul718e3742002-12-13 20:15:29 +000010863 }
10864}
10865
10866/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000010867static void
paul718e3742002-12-13 20:15:29 +000010868community_list_perror (struct vty *vty, int ret)
10869{
10870 switch (ret)
10871 {
10872 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030010873 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010874 break;
10875 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
10876 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
10877 break;
10878 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
10879 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
10880 break;
10881 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
10882 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
10883 break;
10884 }
10885}
10886
10887/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000010888static int
paulfd79ac92004-10-13 05:06:08 +000010889community_list_set_vty (struct vty *vty, int argc, const char **argv,
10890 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010891{
10892 int ret;
10893 int direct;
10894 char *str;
10895
10896 /* Check the list type. */
10897 if (strncmp (argv[1], "p", 1) == 0)
10898 direct = COMMUNITY_PERMIT;
10899 else if (strncmp (argv[1], "d", 1) == 0)
10900 direct = COMMUNITY_DENY;
10901 else
10902 {
10903 vty_out (vty, "%% Matching condition must be permit or deny%s",
10904 VTY_NEWLINE);
10905 return CMD_WARNING;
10906 }
10907
10908 /* All digit name check. */
10909 if (reject_all_digit_name && all_digit (argv[0]))
10910 {
10911 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10912 return CMD_WARNING;
10913 }
10914
10915 /* Concat community string argument. */
10916 if (argc > 1)
10917 str = argv_concat (argv, argc, 2);
10918 else
10919 str = NULL;
10920
10921 /* When community_list_set() return nevetive value, it means
10922 malformed community string. */
10923 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
10924
10925 /* Free temporary community list string allocated by
10926 argv_concat(). */
10927 if (str)
10928 XFREE (MTYPE_TMP, str);
10929
10930 if (ret < 0)
10931 {
10932 /* Display error string. */
10933 community_list_perror (vty, ret);
10934 return CMD_WARNING;
10935 }
10936
10937 return CMD_SUCCESS;
10938}
10939
paul718e3742002-12-13 20:15:29 +000010940/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000010941static int
hassofee6e4e2005-02-02 16:29:31 +000010942community_list_unset_vty (struct vty *vty, int argc, const char **argv,
10943 int style)
paul718e3742002-12-13 20:15:29 +000010944{
10945 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010946 int direct = 0;
10947 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010948
hassofee6e4e2005-02-02 16:29:31 +000010949 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010950 {
hassofee6e4e2005-02-02 16:29:31 +000010951 /* Check the list direct. */
10952 if (strncmp (argv[1], "p", 1) == 0)
10953 direct = COMMUNITY_PERMIT;
10954 else if (strncmp (argv[1], "d", 1) == 0)
10955 direct = COMMUNITY_DENY;
10956 else
10957 {
10958 vty_out (vty, "%% Matching condition must be permit or deny%s",
10959 VTY_NEWLINE);
10960 return CMD_WARNING;
10961 }
paul718e3742002-12-13 20:15:29 +000010962
hassofee6e4e2005-02-02 16:29:31 +000010963 /* Concat community string argument. */
10964 str = argv_concat (argv, argc, 2);
10965 }
paul718e3742002-12-13 20:15:29 +000010966
10967 /* Unset community list. */
10968 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
10969
10970 /* Free temporary community list string allocated by
10971 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010972 if (str)
10973 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010974
10975 if (ret < 0)
10976 {
10977 community_list_perror (vty, ret);
10978 return CMD_WARNING;
10979 }
10980
10981 return CMD_SUCCESS;
10982}
10983
10984/* "community-list" keyword help string. */
10985#define COMMUNITY_LIST_STR "Add a community list entry\n"
10986#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
10987
paul718e3742002-12-13 20:15:29 +000010988DEFUN (ip_community_list_standard,
10989 ip_community_list_standard_cmd,
10990 "ip community-list <1-99> (deny|permit) .AA:NN",
10991 IP_STR
10992 COMMUNITY_LIST_STR
10993 "Community list number (standard)\n"
10994 "Specify community to reject\n"
10995 "Specify community to accept\n"
10996 COMMUNITY_VAL_STR)
10997{
10998 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
10999}
11000
11001ALIAS (ip_community_list_standard,
11002 ip_community_list_standard2_cmd,
11003 "ip community-list <1-99> (deny|permit)",
11004 IP_STR
11005 COMMUNITY_LIST_STR
11006 "Community list number (standard)\n"
11007 "Specify community to reject\n"
11008 "Specify community to accept\n")
11009
11010DEFUN (ip_community_list_expanded,
11011 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011012 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011013 IP_STR
11014 COMMUNITY_LIST_STR
11015 "Community list number (expanded)\n"
11016 "Specify community to reject\n"
11017 "Specify community to accept\n"
11018 "An ordered list as a regular-expression\n")
11019{
11020 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
11021}
11022
11023DEFUN (ip_community_list_name_standard,
11024 ip_community_list_name_standard_cmd,
11025 "ip community-list standard WORD (deny|permit) .AA:NN",
11026 IP_STR
11027 COMMUNITY_LIST_STR
11028 "Add a standard community-list entry\n"
11029 "Community list name\n"
11030 "Specify community to reject\n"
11031 "Specify community to accept\n"
11032 COMMUNITY_VAL_STR)
11033{
11034 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
11035}
11036
11037ALIAS (ip_community_list_name_standard,
11038 ip_community_list_name_standard2_cmd,
11039 "ip community-list standard WORD (deny|permit)",
11040 IP_STR
11041 COMMUNITY_LIST_STR
11042 "Add a standard community-list entry\n"
11043 "Community list name\n"
11044 "Specify community to reject\n"
11045 "Specify community to accept\n")
11046
11047DEFUN (ip_community_list_name_expanded,
11048 ip_community_list_name_expanded_cmd,
11049 "ip community-list expanded WORD (deny|permit) .LINE",
11050 IP_STR
11051 COMMUNITY_LIST_STR
11052 "Add an expanded community-list entry\n"
11053 "Community list name\n"
11054 "Specify community to reject\n"
11055 "Specify community to accept\n"
11056 "An ordered list as a regular-expression\n")
11057{
11058 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
11059}
11060
hassofee6e4e2005-02-02 16:29:31 +000011061DEFUN (no_ip_community_list_standard_all,
11062 no_ip_community_list_standard_all_cmd,
11063 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011064 NO_STR
11065 IP_STR
11066 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011067 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011068{
hassofee6e4e2005-02-02 16:29:31 +000011069 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011070}
11071
hassofee6e4e2005-02-02 16:29:31 +000011072DEFUN (no_ip_community_list_expanded_all,
11073 no_ip_community_list_expanded_all_cmd,
11074 "no ip community-list <100-500>",
11075 NO_STR
11076 IP_STR
11077 COMMUNITY_LIST_STR
11078 "Community list number (expanded)\n")
11079{
11080 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11081}
11082
11083DEFUN (no_ip_community_list_name_standard_all,
11084 no_ip_community_list_name_standard_all_cmd,
11085 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011086 NO_STR
11087 IP_STR
11088 COMMUNITY_LIST_STR
11089 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000011090 "Community list name\n")
11091{
hassofee6e4e2005-02-02 16:29:31 +000011092 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011093}
11094
hassofee6e4e2005-02-02 16:29:31 +000011095DEFUN (no_ip_community_list_name_expanded_all,
11096 no_ip_community_list_name_expanded_all_cmd,
11097 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000011098 NO_STR
11099 IP_STR
11100 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011101 "Add an expanded community-list entry\n"
11102 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000011103{
hassofee6e4e2005-02-02 16:29:31 +000011104 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011105}
11106
11107DEFUN (no_ip_community_list_standard,
11108 no_ip_community_list_standard_cmd,
11109 "no ip community-list <1-99> (deny|permit) .AA:NN",
11110 NO_STR
11111 IP_STR
11112 COMMUNITY_LIST_STR
11113 "Community list number (standard)\n"
11114 "Specify community to reject\n"
11115 "Specify community to accept\n"
11116 COMMUNITY_VAL_STR)
11117{
11118 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11119}
11120
11121DEFUN (no_ip_community_list_expanded,
11122 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011123 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011124 NO_STR
11125 IP_STR
11126 COMMUNITY_LIST_STR
11127 "Community list number (expanded)\n"
11128 "Specify community to reject\n"
11129 "Specify community to accept\n"
11130 "An ordered list as a regular-expression\n")
11131{
11132 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11133}
11134
11135DEFUN (no_ip_community_list_name_standard,
11136 no_ip_community_list_name_standard_cmd,
11137 "no ip community-list standard WORD (deny|permit) .AA:NN",
11138 NO_STR
11139 IP_STR
11140 COMMUNITY_LIST_STR
11141 "Specify a standard community-list\n"
11142 "Community list name\n"
11143 "Specify community to reject\n"
11144 "Specify community to accept\n"
11145 COMMUNITY_VAL_STR)
11146{
11147 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11148}
11149
11150DEFUN (no_ip_community_list_name_expanded,
11151 no_ip_community_list_name_expanded_cmd,
11152 "no ip community-list expanded WORD (deny|permit) .LINE",
11153 NO_STR
11154 IP_STR
11155 COMMUNITY_LIST_STR
11156 "Specify an expanded community-list\n"
11157 "Community list name\n"
11158 "Specify community to reject\n"
11159 "Specify community to accept\n"
11160 "An ordered list as a regular-expression\n")
11161{
11162 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11163}
11164
paul94f2b392005-06-28 12:44:16 +000011165static void
paul718e3742002-12-13 20:15:29 +000011166community_list_show (struct vty *vty, struct community_list *list)
11167{
11168 struct community_entry *entry;
11169
11170 for (entry = list->head; entry; entry = entry->next)
11171 {
11172 if (entry == list->head)
11173 {
11174 if (all_digit (list->name))
11175 vty_out (vty, "Community %s list %s%s",
11176 entry->style == COMMUNITY_LIST_STANDARD ?
11177 "standard" : "(expanded) access",
11178 list->name, VTY_NEWLINE);
11179 else
11180 vty_out (vty, "Named Community %s list %s%s",
11181 entry->style == COMMUNITY_LIST_STANDARD ?
11182 "standard" : "expanded",
11183 list->name, VTY_NEWLINE);
11184 }
11185 if (entry->any)
11186 vty_out (vty, " %s%s",
11187 community_direct_str (entry->direct), VTY_NEWLINE);
11188 else
11189 vty_out (vty, " %s %s%s",
11190 community_direct_str (entry->direct),
11191 entry->style == COMMUNITY_LIST_STANDARD
11192 ? community_str (entry->u.com) : entry->config,
11193 VTY_NEWLINE);
11194 }
11195}
11196
11197DEFUN (show_ip_community_list,
11198 show_ip_community_list_cmd,
11199 "show ip community-list",
11200 SHOW_STR
11201 IP_STR
11202 "List community-list\n")
11203{
11204 struct community_list *list;
11205 struct community_list_master *cm;
11206
hassofee6e4e2005-02-02 16:29:31 +000011207 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011208 if (! cm)
11209 return CMD_SUCCESS;
11210
11211 for (list = cm->num.head; list; list = list->next)
11212 community_list_show (vty, list);
11213
11214 for (list = cm->str.head; list; list = list->next)
11215 community_list_show (vty, list);
11216
11217 return CMD_SUCCESS;
11218}
11219
11220DEFUN (show_ip_community_list_arg,
11221 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011222 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011223 SHOW_STR
11224 IP_STR
11225 "List community-list\n"
11226 "Community-list number\n"
11227 "Community-list name\n")
11228{
11229 struct community_list *list;
11230
hassofee6e4e2005-02-02 16:29:31 +000011231 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011232 if (! list)
11233 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011234 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011235 return CMD_WARNING;
11236 }
11237
11238 community_list_show (vty, list);
11239
11240 return CMD_SUCCESS;
11241}
David Lamparter6b0655a2014-06-04 06:53:35 +020011242
paul94f2b392005-06-28 12:44:16 +000011243static int
paulfd79ac92004-10-13 05:06:08 +000011244extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
11245 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011246{
11247 int ret;
11248 int direct;
11249 char *str;
11250
11251 /* Check the list type. */
11252 if (strncmp (argv[1], "p", 1) == 0)
11253 direct = COMMUNITY_PERMIT;
11254 else if (strncmp (argv[1], "d", 1) == 0)
11255 direct = COMMUNITY_DENY;
11256 else
11257 {
11258 vty_out (vty, "%% Matching condition must be permit or deny%s",
11259 VTY_NEWLINE);
11260 return CMD_WARNING;
11261 }
11262
11263 /* All digit name check. */
11264 if (reject_all_digit_name && all_digit (argv[0]))
11265 {
11266 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11267 return CMD_WARNING;
11268 }
11269
11270 /* Concat community string argument. */
11271 if (argc > 1)
11272 str = argv_concat (argv, argc, 2);
11273 else
11274 str = NULL;
11275
11276 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
11277
11278 /* Free temporary community list string allocated by
11279 argv_concat(). */
11280 if (str)
11281 XFREE (MTYPE_TMP, str);
11282
11283 if (ret < 0)
11284 {
11285 community_list_perror (vty, ret);
11286 return CMD_WARNING;
11287 }
11288 return CMD_SUCCESS;
11289}
11290
paul94f2b392005-06-28 12:44:16 +000011291static int
hassofee6e4e2005-02-02 16:29:31 +000011292extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
11293 int style)
paul718e3742002-12-13 20:15:29 +000011294{
11295 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011296 int direct = 0;
11297 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011298
hassofee6e4e2005-02-02 16:29:31 +000011299 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011300 {
hassofee6e4e2005-02-02 16:29:31 +000011301 /* Check the list direct. */
11302 if (strncmp (argv[1], "p", 1) == 0)
11303 direct = COMMUNITY_PERMIT;
11304 else if (strncmp (argv[1], "d", 1) == 0)
11305 direct = COMMUNITY_DENY;
11306 else
11307 {
11308 vty_out (vty, "%% Matching condition must be permit or deny%s",
11309 VTY_NEWLINE);
11310 return CMD_WARNING;
11311 }
11312
11313 /* Concat community string argument. */
11314 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000011315 }
paul718e3742002-12-13 20:15:29 +000011316
11317 /* Unset community list. */
11318 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
11319
11320 /* Free temporary community list string allocated by
11321 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011322 if (str)
11323 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011324
11325 if (ret < 0)
11326 {
11327 community_list_perror (vty, ret);
11328 return CMD_WARNING;
11329 }
11330
11331 return CMD_SUCCESS;
11332}
11333
11334/* "extcommunity-list" keyword help string. */
11335#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
11336#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
11337
11338DEFUN (ip_extcommunity_list_standard,
11339 ip_extcommunity_list_standard_cmd,
11340 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11341 IP_STR
11342 EXTCOMMUNITY_LIST_STR
11343 "Extended Community list number (standard)\n"
11344 "Specify community to reject\n"
11345 "Specify community to accept\n"
11346 EXTCOMMUNITY_VAL_STR)
11347{
11348 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
11349}
11350
11351ALIAS (ip_extcommunity_list_standard,
11352 ip_extcommunity_list_standard2_cmd,
11353 "ip extcommunity-list <1-99> (deny|permit)",
11354 IP_STR
11355 EXTCOMMUNITY_LIST_STR
11356 "Extended Community list number (standard)\n"
11357 "Specify community to reject\n"
11358 "Specify community to accept\n")
11359
11360DEFUN (ip_extcommunity_list_expanded,
11361 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011362 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011363 IP_STR
11364 EXTCOMMUNITY_LIST_STR
11365 "Extended Community list number (expanded)\n"
11366 "Specify community to reject\n"
11367 "Specify community to accept\n"
11368 "An ordered list as a regular-expression\n")
11369{
11370 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
11371}
11372
11373DEFUN (ip_extcommunity_list_name_standard,
11374 ip_extcommunity_list_name_standard_cmd,
11375 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11376 IP_STR
11377 EXTCOMMUNITY_LIST_STR
11378 "Specify standard extcommunity-list\n"
11379 "Extended Community list name\n"
11380 "Specify community to reject\n"
11381 "Specify community to accept\n"
11382 EXTCOMMUNITY_VAL_STR)
11383{
11384 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
11385}
11386
11387ALIAS (ip_extcommunity_list_name_standard,
11388 ip_extcommunity_list_name_standard2_cmd,
11389 "ip extcommunity-list standard WORD (deny|permit)",
11390 IP_STR
11391 EXTCOMMUNITY_LIST_STR
11392 "Specify standard extcommunity-list\n"
11393 "Extended Community list name\n"
11394 "Specify community to reject\n"
11395 "Specify community to accept\n")
11396
11397DEFUN (ip_extcommunity_list_name_expanded,
11398 ip_extcommunity_list_name_expanded_cmd,
11399 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
11400 IP_STR
11401 EXTCOMMUNITY_LIST_STR
11402 "Specify expanded extcommunity-list\n"
11403 "Extended Community list name\n"
11404 "Specify community to reject\n"
11405 "Specify community to accept\n"
11406 "An ordered list as a regular-expression\n")
11407{
11408 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
11409}
11410
hassofee6e4e2005-02-02 16:29:31 +000011411DEFUN (no_ip_extcommunity_list_standard_all,
11412 no_ip_extcommunity_list_standard_all_cmd,
11413 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011414 NO_STR
11415 IP_STR
11416 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011417 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011418{
hassofee6e4e2005-02-02 16:29:31 +000011419 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011420}
11421
hassofee6e4e2005-02-02 16:29:31 +000011422DEFUN (no_ip_extcommunity_list_expanded_all,
11423 no_ip_extcommunity_list_expanded_all_cmd,
11424 "no ip extcommunity-list <100-500>",
11425 NO_STR
11426 IP_STR
11427 EXTCOMMUNITY_LIST_STR
11428 "Extended Community list number (expanded)\n")
11429{
11430 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11431}
11432
11433DEFUN (no_ip_extcommunity_list_name_standard_all,
11434 no_ip_extcommunity_list_name_standard_all_cmd,
11435 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011436 NO_STR
11437 IP_STR
11438 EXTCOMMUNITY_LIST_STR
11439 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000011440 "Extended Community list name\n")
11441{
11442 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11443}
11444
11445DEFUN (no_ip_extcommunity_list_name_expanded_all,
11446 no_ip_extcommunity_list_name_expanded_all_cmd,
11447 "no ip extcommunity-list expanded WORD",
11448 NO_STR
11449 IP_STR
11450 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000011451 "Specify expanded extcommunity-list\n"
11452 "Extended Community list name\n")
11453{
hassofee6e4e2005-02-02 16:29:31 +000011454 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011455}
11456
11457DEFUN (no_ip_extcommunity_list_standard,
11458 no_ip_extcommunity_list_standard_cmd,
11459 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11460 NO_STR
11461 IP_STR
11462 EXTCOMMUNITY_LIST_STR
11463 "Extended Community list number (standard)\n"
11464 "Specify community to reject\n"
11465 "Specify community to accept\n"
11466 EXTCOMMUNITY_VAL_STR)
11467{
11468 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11469}
11470
11471DEFUN (no_ip_extcommunity_list_expanded,
11472 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011473 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011474 NO_STR
11475 IP_STR
11476 EXTCOMMUNITY_LIST_STR
11477 "Extended Community list number (expanded)\n"
11478 "Specify community to reject\n"
11479 "Specify community to accept\n"
11480 "An ordered list as a regular-expression\n")
11481{
11482 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11483}
11484
11485DEFUN (no_ip_extcommunity_list_name_standard,
11486 no_ip_extcommunity_list_name_standard_cmd,
11487 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11488 NO_STR
11489 IP_STR
11490 EXTCOMMUNITY_LIST_STR
11491 "Specify standard extcommunity-list\n"
11492 "Extended Community list name\n"
11493 "Specify community to reject\n"
11494 "Specify community to accept\n"
11495 EXTCOMMUNITY_VAL_STR)
11496{
11497 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11498}
11499
11500DEFUN (no_ip_extcommunity_list_name_expanded,
11501 no_ip_extcommunity_list_name_expanded_cmd,
11502 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
11503 NO_STR
11504 IP_STR
11505 EXTCOMMUNITY_LIST_STR
11506 "Specify expanded extcommunity-list\n"
11507 "Community list name\n"
11508 "Specify community to reject\n"
11509 "Specify community to accept\n"
11510 "An ordered list as a regular-expression\n")
11511{
11512 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11513}
11514
paul94f2b392005-06-28 12:44:16 +000011515static void
paul718e3742002-12-13 20:15:29 +000011516extcommunity_list_show (struct vty *vty, struct community_list *list)
11517{
11518 struct community_entry *entry;
11519
11520 for (entry = list->head; entry; entry = entry->next)
11521 {
11522 if (entry == list->head)
11523 {
11524 if (all_digit (list->name))
11525 vty_out (vty, "Extended community %s list %s%s",
11526 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11527 "standard" : "(expanded) access",
11528 list->name, VTY_NEWLINE);
11529 else
11530 vty_out (vty, "Named extended community %s list %s%s",
11531 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11532 "standard" : "expanded",
11533 list->name, VTY_NEWLINE);
11534 }
11535 if (entry->any)
11536 vty_out (vty, " %s%s",
11537 community_direct_str (entry->direct), VTY_NEWLINE);
11538 else
11539 vty_out (vty, " %s %s%s",
11540 community_direct_str (entry->direct),
11541 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11542 entry->u.ecom->str : entry->config,
11543 VTY_NEWLINE);
11544 }
11545}
11546
11547DEFUN (show_ip_extcommunity_list,
11548 show_ip_extcommunity_list_cmd,
11549 "show ip extcommunity-list",
11550 SHOW_STR
11551 IP_STR
11552 "List extended-community list\n")
11553{
11554 struct community_list *list;
11555 struct community_list_master *cm;
11556
hassofee6e4e2005-02-02 16:29:31 +000011557 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011558 if (! cm)
11559 return CMD_SUCCESS;
11560
11561 for (list = cm->num.head; list; list = list->next)
11562 extcommunity_list_show (vty, list);
11563
11564 for (list = cm->str.head; list; list = list->next)
11565 extcommunity_list_show (vty, list);
11566
11567 return CMD_SUCCESS;
11568}
11569
11570DEFUN (show_ip_extcommunity_list_arg,
11571 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011572 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011573 SHOW_STR
11574 IP_STR
11575 "List extended-community list\n"
11576 "Extcommunity-list number\n"
11577 "Extcommunity-list name\n")
11578{
11579 struct community_list *list;
11580
hassofee6e4e2005-02-02 16:29:31 +000011581 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011582 if (! list)
11583 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011584 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011585 return CMD_WARNING;
11586 }
11587
11588 extcommunity_list_show (vty, list);
11589
11590 return CMD_SUCCESS;
11591}
David Lamparter6b0655a2014-06-04 06:53:35 +020011592
paul718e3742002-12-13 20:15:29 +000011593/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000011594static const char *
paul718e3742002-12-13 20:15:29 +000011595community_list_config_str (struct community_entry *entry)
11596{
paulfd79ac92004-10-13 05:06:08 +000011597 const char *str;
paul718e3742002-12-13 20:15:29 +000011598
11599 if (entry->any)
11600 str = "";
11601 else
11602 {
11603 if (entry->style == COMMUNITY_LIST_STANDARD)
11604 str = community_str (entry->u.com);
11605 else
11606 str = entry->config;
11607 }
11608 return str;
11609}
11610
11611/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000011612static int
paul718e3742002-12-13 20:15:29 +000011613community_list_config_write (struct vty *vty)
11614{
11615 struct community_list *list;
11616 struct community_entry *entry;
11617 struct community_list_master *cm;
11618 int write = 0;
11619
11620 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000011621 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011622
11623 for (list = cm->num.head; list; list = list->next)
11624 for (entry = list->head; entry; entry = entry->next)
11625 {
hassofee6e4e2005-02-02 16:29:31 +000011626 vty_out (vty, "ip community-list %s %s %s%s",
11627 list->name, community_direct_str (entry->direct),
11628 community_list_config_str (entry),
11629 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011630 write++;
11631 }
11632 for (list = cm->str.head; list; list = list->next)
11633 for (entry = list->head; entry; entry = entry->next)
11634 {
11635 vty_out (vty, "ip community-list %s %s %s %s%s",
11636 entry->style == COMMUNITY_LIST_STANDARD
11637 ? "standard" : "expanded",
11638 list->name, community_direct_str (entry->direct),
11639 community_list_config_str (entry),
11640 VTY_NEWLINE);
11641 write++;
11642 }
11643
11644 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000011645 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011646
11647 for (list = cm->num.head; list; list = list->next)
11648 for (entry = list->head; entry; entry = entry->next)
11649 {
hassofee6e4e2005-02-02 16:29:31 +000011650 vty_out (vty, "ip extcommunity-list %s %s %s%s",
11651 list->name, community_direct_str (entry->direct),
11652 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011653 write++;
11654 }
11655 for (list = cm->str.head; list; list = list->next)
11656 for (entry = list->head; entry; entry = entry->next)
11657 {
11658 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
11659 entry->style == EXTCOMMUNITY_LIST_STANDARD
11660 ? "standard" : "expanded",
11661 list->name, community_direct_str (entry->direct),
11662 community_list_config_str (entry), VTY_NEWLINE);
11663 write++;
11664 }
11665 return write;
11666}
11667
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080011668static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000011669{
11670 COMMUNITY_LIST_NODE,
11671 "",
11672 1 /* Export to vtysh. */
11673};
11674
paul94f2b392005-06-28 12:44:16 +000011675static void
11676community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000011677{
11678 install_node (&community_list_node, community_list_config_write);
11679
11680 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000011681 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
11682 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
11683 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
11684 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
11685 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
11686 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011687 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
11688 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
11689 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
11690 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011691 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
11692 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
11693 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
11694 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
11695 install_element (VIEW_NODE, &show_ip_community_list_cmd);
11696 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
11697 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
11698 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
11699
11700 /* Extcommunity-list. */
11701 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
11702 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
11703 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
11704 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
11705 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
11706 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011707 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
11708 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
11709 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
11710 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011711 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
11712 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
11713 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
11714 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
11715 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
11716 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
11717 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
11718 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
11719}