blob: e271210d63d492aaff821cbc68f2a3ad69ae97d7 [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. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05007397DEFUN (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
7438DEFUN (show_ip_bgp_instance_ipv4_summary,
7439 show_ip_bgp_instance_ipv4_summary_cmd,
7440 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7441 SHOW_STR
7442 IP_STR
7443 BGP_STR
7444 "BGP view\n"
7445 "View name\n"
7446 "Address family\n"
7447 "Address Family modifier\n"
7448 "Address Family modifier\n"
7449 "Summary of BGP neighbor status\n")
7450{
7451 if (strncmp (argv[1], "m", 1) == 0)
7452 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7453 else
7454 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7455}
7456
7457DEFUN (show_ip_bgp_vpnv4_all_summary,
7458 show_ip_bgp_vpnv4_all_summary_cmd,
7459 "show ip bgp vpnv4 all summary",
7460 SHOW_STR
7461 IP_STR
7462 BGP_STR
7463 "Display VPNv4 NLRI specific information\n"
7464 "Display information about all VPNv4 NLRIs\n"
7465 "Summary of BGP neighbor status\n")
7466{
7467 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7468}
7469
7470DEFUN (show_ip_bgp_vpnv4_rd_summary,
7471 show_ip_bgp_vpnv4_rd_summary_cmd,
7472 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7473 SHOW_STR
7474 IP_STR
7475 BGP_STR
7476 "Display VPNv4 NLRI specific information\n"
7477 "Display information for a route distinguisher\n"
7478 "VPN Route Distinguisher\n"
7479 "Summary of BGP neighbor status\n")
7480{
7481 int ret;
7482 struct prefix_rd prd;
7483
7484 ret = str2prefix_rd (argv[0], &prd);
7485 if (! ret)
7486 {
7487 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7488 return CMD_WARNING;
7489 }
7490
7491 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7492}
7493
Lou Berger651b4022016-01-12 13:42:07 -05007494DEFUN (show_bgp_ipv4_safi_summary,
7495 show_bgp_ipv4_safi_summary_cmd,
7496 "show bgp ipv4 (unicast|multicast) summary",
paul718e3742002-12-13 20:15:29 +00007497 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007498 BGP_STR
7499 "Address family\n"
7500 "Address Family modifier\n"
7501 "Address Family modifier\n"
7502 "Summary of BGP neighbor status\n")
7503{
7504 if (strncmp (argv[0], "m", 1) == 0)
7505 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7506
7507 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7508}
7509
Lou Berger651b4022016-01-12 13:42:07 -05007510DEFUN (show_bgp_instance_ipv4_safi_summary,
7511 show_bgp_instance_ipv4_safi_summary_cmd,
7512 "show bgp view WORD ipv4 (unicast|multicast) summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007513 SHOW_STR
7514 BGP_STR
paul718e3742002-12-13 20:15:29 +00007515 "BGP view\n"
7516 "View name\n"
7517 "Address family\n"
7518 "Address Family modifier\n"
7519 "Address Family modifier\n"
7520 "Summary of BGP neighbor status\n")
7521{
7522 if (strncmp (argv[1], "m", 1) == 0)
7523 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7524 else
7525 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7526}
7527
Lou Berger651b4022016-01-12 13:42:07 -05007528DEFUN (show_bgp_ipv4_vpn_summary,
7529 show_bgp_ipv4_vpn_summary_cmd,
7530 "show bgp ipv4 vpn summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007531 SHOW_STR
7532 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007533 "IPv4\n"
7534 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007535 "Summary of BGP neighbor status\n")
7536{
7537 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7538}
7539
paul718e3742002-12-13 20:15:29 +00007540#ifdef HAVE_IPV6
Lou Berger651b4022016-01-12 13:42:07 -05007541
7542/* `show ip bgp summary' commands. */
7543DEFUN (show_bgp_ipv6_vpn_summary,
7544 show_bgp_ipv6_vpn_summary_cmd,
7545 "show bgp ipv6 vpn summary",
paul718e3742002-12-13 20:15:29 +00007546 SHOW_STR
7547 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007548 "IPv6\n"
7549 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007550 "Summary of BGP neighbor status\n")
7551{
Lou Berger651b4022016-01-12 13:42:07 -05007552 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
paul718e3742002-12-13 20:15:29 +00007553}
Lou Berger651b4022016-01-12 13:42:07 -05007554#endif
7555
7556DEFUN (show_bgp_ipv4_encap_summary,
7557 show_bgp_ipv4_encap_summary_cmd,
7558 "show bgp ipv4 encap summary",
7559 SHOW_STR
7560 BGP_STR
7561 "IPv4\n"
7562 "Display ENCAP NLRI specific information\n"
7563 "Summary of BGP neighbor status\n")
7564{
7565 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7566}
7567
7568#ifdef HAVE_IPV6
7569
7570DEFUN (show_bgp_ipv6_encap_summary,
7571 show_bgp_ipv6_encap_summary_cmd,
7572 "show bgp ipv6 encap summary",
7573 SHOW_STR
7574 BGP_STR
7575 "IPv6\n"
7576 "Display ENCAP NLRI specific information\n"
7577 "Summary of BGP neighbor status\n")
7578{
7579 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7580}
7581
7582#endif
7583
7584
paul718e3742002-12-13 20:15:29 +00007585
7586DEFUN (show_bgp_instance_summary,
7587 show_bgp_instance_summary_cmd,
7588 "show bgp view WORD summary",
7589 SHOW_STR
7590 BGP_STR
7591 "BGP view\n"
7592 "View name\n"
7593 "Summary of BGP neighbor status\n")
7594{
Lou Berger651b4022016-01-12 13:42:07 -05007595 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7596 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7597 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7598 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7599 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7600 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7601 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7602 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7603 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7604 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7605 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7606 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
7607
7608#ifdef HAVE_IPV6
7609 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7610 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7611 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7612 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7613 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7614 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7615 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7616 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7617 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7618 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7619 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7620 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
7621#endif
7622 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007623}
7624
Lou Berger651b4022016-01-12 13:42:07 -05007625DEFUN (show_bgp_instance_ipv4_summary,
7626 show_bgp_instance_ipv4_summary_cmd,
7627 "show bgp view WORD ipv4 summary",
paul718e3742002-12-13 20:15:29 +00007628 SHOW_STR
7629 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007630 IP_STR
7631 "Address Family modifier\n"
7632 "Address Family modifier\n"
7633 "BGP view\n"
7634 "View name\n"
paul718e3742002-12-13 20:15:29 +00007635 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007636{
7637 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7638 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7639 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7640 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7641 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7642 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7643 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7644 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7645 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7646 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7647 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7648 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
paul718e3742002-12-13 20:15:29 +00007649
Lou Berger651b4022016-01-12 13:42:07 -05007650 return CMD_SUCCESS;
7651}
7652
7653
7654#ifdef HAVE_IPV6
7655DEFUN (show_bgp_instance_ipv6_summary,
paul718e3742002-12-13 20:15:29 +00007656 show_bgp_instance_ipv6_summary_cmd,
7657 "show bgp view WORD ipv6 summary",
7658 SHOW_STR
7659 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007660 IPV6_STR
7661 "Address Family modifier\n"
7662 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007663 "BGP view\n"
7664 "View name\n"
paul718e3742002-12-13 20:15:29 +00007665 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007666{
7667 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7668 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7669 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7670 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7671 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7672 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7673 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7674 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7675 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7676 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7677 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7678 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
7679
7680 return CMD_SUCCESS;
7681}
paul718e3742002-12-13 20:15:29 +00007682
Michael Lambert95cbbd22010-07-23 14:43:04 -04007683DEFUN (show_bgp_ipv6_safi_summary,
7684 show_bgp_ipv6_safi_summary_cmd,
7685 "show bgp ipv6 (unicast|multicast) summary",
7686 SHOW_STR
7687 BGP_STR
7688 "Address family\n"
7689 "Address Family modifier\n"
7690 "Address Family modifier\n"
7691 "Summary of BGP neighbor status\n")
7692{
7693 if (strncmp (argv[0], "m", 1) == 0)
7694 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7695
7696 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7697}
7698
7699DEFUN (show_bgp_instance_ipv6_safi_summary,
7700 show_bgp_instance_ipv6_safi_summary_cmd,
7701 "show bgp view WORD ipv6 (unicast|multicast) summary",
7702 SHOW_STR
7703 BGP_STR
7704 "BGP view\n"
7705 "View name\n"
7706 "Address family\n"
7707 "Address Family modifier\n"
7708 "Address Family modifier\n"
7709 "Summary of BGP neighbor status\n")
7710{
7711 if (strncmp (argv[1], "m", 1) == 0)
7712 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7713
7714 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7715}
7716
Lou Bergerf9b6c392016-01-12 13:42:09 -05007717/* old command */
7718DEFUN (show_ipv6_bgp_summary,
7719 show_ipv6_bgp_summary_cmd,
7720 "show ipv6 bgp summary",
7721 SHOW_STR
7722 IPV6_STR
7723 BGP_STR
7724 "Summary of BGP neighbor status\n")
7725{
7726 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7727}
7728
7729/* old command */
7730DEFUN (show_ipv6_mbgp_summary,
7731 show_ipv6_mbgp_summary_cmd,
7732 "show ipv6 mbgp summary",
7733 SHOW_STR
7734 IPV6_STR
7735 MBGP_STR
7736 "Summary of BGP neighbor status\n")
7737{
7738 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7739}
Lou Berger651b4022016-01-12 13:42:07 -05007740#endif /* HAVE_IPV6 */
7741
7742/* variations of show bgp [...] summary */
7743
7744/* This one is for the 0-keyword variant */
7745DEFUN (show_bgp_summary,
7746 show_bgp_summary_cmd,
7747 "show bgp summary",
paul718e3742002-12-13 20:15:29 +00007748 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007749 BGP_STR
7750 "Summary of BGP neighbor status\n")
7751{
Lou Berger651b4022016-01-12 13:42:07 -05007752 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7753 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7754 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7755 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7756 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7757 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7758 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7759 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7760 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7761 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7762 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7763 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7764
7765#ifdef HAVE_IPV6
7766 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7767 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7768 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7769 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7770 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7771 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7772 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7773 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7774 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7775 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7776 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7777 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7778#endif
7779 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007780}
7781
Lou Bergerf9b6c392016-01-12 13:42:09 -05007782ALIAS (show_bgp_summary,
7783 show_bgp_ipv6_summary_cmd,
7784 "show bgp ipv6 summary",
7785 SHOW_STR
7786 BGP_STR
7787 "Address family\n"
7788 "Summary of BGP neighbor status\n")
7789
Lou Berger651b4022016-01-12 13:42:07 -05007790DEFUN (show_bgp_summary_1w,
7791 show_bgp_summary_1w_cmd,
7792#ifdef HAVE_IPV6
7793 "show bgp (ipv4|ipv6|unicast|multicast|vpn|encap) summary",
7794#else
7795 "show bgp (ipv4|unicast|multicast|vpn|encap) summary",
7796#endif
paul718e3742002-12-13 20:15:29 +00007797 SHOW_STR
Lou Berger651b4022016-01-12 13:42:07 -05007798 BGP_STR
7799 IP_STR
7800#ifdef HAVE_IPV6
7801 IP6_STR
7802#endif
7803 "Address Family modifier\n"
7804 "Address Family modifier\n"
7805 "Address Family modifier\n"
7806 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007807 "Summary of BGP neighbor status\n")
7808{
Lou Berger651b4022016-01-12 13:42:07 -05007809 if (strcmp (argv[0], "ipv4") == 0) {
7810 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7811 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7812 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7813 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7814 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7815 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7816 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7817 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7818 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7819 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7820 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7821 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7822 return CMD_SUCCESS;
7823 }
7824#ifdef HAVE_IPV6
7825 if (strcmp (argv[0], "ipv6") == 0) {
7826 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7827 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7828 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7829 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7830 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7831 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7832 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7833 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7834 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7835 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7836 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7837 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7838 return CMD_SUCCESS;
7839 }
7840#endif
7841 if (strcmp (argv[0], "unicast") == 0) {
7842 vty_out(vty, "IPv4 Unicast Summary:%s", VTY_NEWLINE);
7843 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7844 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7845#ifdef HAVE_IPV6
7846 vty_out(vty, "%s", VTY_NEWLINE);
7847 vty_out(vty, "IPv6 Unicast Summary:%s", VTY_NEWLINE);
7848 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7849 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7850#endif
7851 return CMD_SUCCESS;
7852 }
7853 if (strcmp (argv[0], "multicast") == 0) {
7854 vty_out(vty, "IPv4 Multicast Summary:%s", VTY_NEWLINE);
7855 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7856 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7857#ifdef HAVE_IPV6
7858 vty_out(vty, "%s", VTY_NEWLINE);
7859 vty_out(vty, "IPv6 Multicast Summary:%s", VTY_NEWLINE);
7860 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7861 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7862#endif
7863 return CMD_SUCCESS;
7864 }
7865 if (strcmp (argv[0], "vpn") == 0) {
7866 vty_out(vty, "IPv4 VPN Summary:%s", VTY_NEWLINE);
7867 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7868 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7869#ifdef HAVE_IPV6
7870 vty_out(vty, "%s", VTY_NEWLINE);
7871 vty_out(vty, "IPv6 VPN Summary:%s", VTY_NEWLINE);
7872 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7873 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7874#endif
7875 return CMD_SUCCESS;
7876 }
7877 if (strcmp (argv[0], "encap") == 0) {
7878 vty_out(vty, "IPv4 Encap Summary:%s", VTY_NEWLINE);
7879 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7880 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7881#ifdef HAVE_IPV6
7882 vty_out(vty, "%s", VTY_NEWLINE);
7883 vty_out(vty, "IPv6 Encap Summary:%s", VTY_NEWLINE);
7884 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7885 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7886#endif
7887 return CMD_SUCCESS;
7888 }
7889 vty_out(vty, "Unknown keyword: %s%s", argv[0], VTY_NEWLINE);
7890 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00007891}
Lou Berger651b4022016-01-12 13:42:07 -05007892
7893
David Lamparter6b0655a2014-06-04 06:53:35 +02007894
paulfd79ac92004-10-13 05:06:08 +00007895const char *
hasso538621f2004-05-21 09:31:30 +00007896afi_safi_print (afi_t afi, safi_t safi)
7897{
7898 if (afi == AFI_IP && safi == SAFI_UNICAST)
7899 return "IPv4 Unicast";
7900 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7901 return "IPv4 Multicast";
7902 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
Lou Berger9da04bc2016-01-12 13:41:55 -05007903 return "VPN-IPv4 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007904 else if (afi == AFI_IP && safi == SAFI_ENCAP)
7905 return "ENCAP-IPv4 Unicast";
hasso538621f2004-05-21 09:31:30 +00007906 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7907 return "IPv6 Unicast";
7908 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7909 return "IPv6 Multicast";
Lou Berger9da04bc2016-01-12 13:41:55 -05007910 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
7911 return "VPN-IPv6 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007912 else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
7913 return "ENCAP-IPv6 Unicast";
hasso538621f2004-05-21 09:31:30 +00007914 else
7915 return "Unknown";
7916}
7917
paul718e3742002-12-13 20:15:29 +00007918/* Show BGP peer's information. */
7919enum show_type
7920{
7921 show_all,
7922 show_peer
7923};
7924
paul94f2b392005-06-28 12:44:16 +00007925static void
paul718e3742002-12-13 20:15:29 +00007926bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7927 afi_t afi, safi_t safi,
7928 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7929 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7930{
7931 /* Send-Mode */
7932 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7933 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7934 {
7935 vty_out (vty, " Send-mode: ");
7936 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7937 vty_out (vty, "advertised");
7938 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7939 vty_out (vty, "%sreceived",
7940 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7941 ", " : "");
7942 vty_out (vty, "%s", VTY_NEWLINE);
7943 }
7944
7945 /* Receive-Mode */
7946 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7947 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7948 {
7949 vty_out (vty, " Receive-mode: ");
7950 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7951 vty_out (vty, "advertised");
7952 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7953 vty_out (vty, "%sreceived",
7954 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7955 ", " : "");
7956 vty_out (vty, "%s", VTY_NEWLINE);
7957 }
7958}
7959
paul94f2b392005-06-28 12:44:16 +00007960static void
paul718e3742002-12-13 20:15:29 +00007961bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7962{
7963 struct bgp_filter *filter;
7964 char orf_pfx_name[BUFSIZ];
7965 int orf_pfx_count;
7966
7967 filter = &p->filter[afi][safi];
7968
hasso538621f2004-05-21 09:31:30 +00007969 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007970 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007971
paul718e3742002-12-13 20:15:29 +00007972 if (p->af_group[afi][safi])
7973 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7974
7975 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7976 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7977 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7978 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7979 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7980 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7981 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7982
7983 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7984 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7985 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7986 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7987 {
7988 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7989 ORF_TYPE_PREFIX, VTY_NEWLINE);
7990 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7991 PEER_CAP_ORF_PREFIX_SM_ADV,
7992 PEER_CAP_ORF_PREFIX_RM_ADV,
7993 PEER_CAP_ORF_PREFIX_SM_RCV,
7994 PEER_CAP_ORF_PREFIX_RM_RCV);
7995 }
7996 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7997 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7998 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7999 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
8000 {
8001 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
8002 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
8003 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
8004 PEER_CAP_ORF_PREFIX_SM_ADV,
8005 PEER_CAP_ORF_PREFIX_RM_ADV,
8006 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
8007 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
8008 }
8009
8010 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
8011 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
8012
8013 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
8014 || orf_pfx_count)
8015 {
8016 vty_out (vty, " Outbound Route Filter (ORF):");
8017 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
8018 vty_out (vty, " sent;");
8019 if (orf_pfx_count)
8020 vty_out (vty, " received (%d entries)", orf_pfx_count);
8021 vty_out (vty, "%s", VTY_NEWLINE);
8022 }
8023 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
8024 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
8025
8026 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
8027 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
8028 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8029 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
8030 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
8031 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
8032 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
8033 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
8034 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
8035 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
8036 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
8037 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8038 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
8039 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8040 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
8041 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8042 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
8043 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
8044 {
8045 vty_out (vty, " Community attribute sent to this neighbor");
8046 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
8047 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00008048 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008049 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00008050 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008051 else
hasso538621f2004-05-21 09:31:30 +00008052 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008053 }
8054 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
8055 {
8056 vty_out (vty, " Default information originate,");
8057
8058 if (p->default_rmap[afi][safi].name)
8059 vty_out (vty, " default route-map %s%s,",
8060 p->default_rmap[afi][safi].map ? "*" : "",
8061 p->default_rmap[afi][safi].name);
8062 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
8063 vty_out (vty, " default sent%s", VTY_NEWLINE);
8064 else
8065 vty_out (vty, " default not sent%s", VTY_NEWLINE);
8066 }
8067
8068 if (filter->plist[FILTER_IN].name
8069 || filter->dlist[FILTER_IN].name
8070 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00008071 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008072 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
8073 if (filter->plist[FILTER_OUT].name
8074 || filter->dlist[FILTER_OUT].name
8075 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00008076 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00008077 || filter->usmap.name)
8078 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008079 if (filter->map[RMAP_IMPORT].name)
8080 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
8081 if (filter->map[RMAP_EXPORT].name)
8082 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008083
8084 /* prefix-list */
8085 if (filter->plist[FILTER_IN].name)
8086 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
8087 filter->plist[FILTER_IN].plist ? "*" : "",
8088 filter->plist[FILTER_IN].name,
8089 VTY_NEWLINE);
8090 if (filter->plist[FILTER_OUT].name)
8091 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
8092 filter->plist[FILTER_OUT].plist ? "*" : "",
8093 filter->plist[FILTER_OUT].name,
8094 VTY_NEWLINE);
8095
8096 /* distribute-list */
8097 if (filter->dlist[FILTER_IN].name)
8098 vty_out (vty, " Incoming update network filter list is %s%s%s",
8099 filter->dlist[FILTER_IN].alist ? "*" : "",
8100 filter->dlist[FILTER_IN].name,
8101 VTY_NEWLINE);
8102 if (filter->dlist[FILTER_OUT].name)
8103 vty_out (vty, " Outgoing update network filter list is %s%s%s",
8104 filter->dlist[FILTER_OUT].alist ? "*" : "",
8105 filter->dlist[FILTER_OUT].name,
8106 VTY_NEWLINE);
8107
8108 /* filter-list. */
8109 if (filter->aslist[FILTER_IN].name)
8110 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
8111 filter->aslist[FILTER_IN].aslist ? "*" : "",
8112 filter->aslist[FILTER_IN].name,
8113 VTY_NEWLINE);
8114 if (filter->aslist[FILTER_OUT].name)
8115 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
8116 filter->aslist[FILTER_OUT].aslist ? "*" : "",
8117 filter->aslist[FILTER_OUT].name,
8118 VTY_NEWLINE);
8119
8120 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00008121 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008122 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008123 filter->map[RMAP_IN].map ? "*" : "",
8124 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00008125 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008126 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00008127 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008128 filter->map[RMAP_OUT].map ? "*" : "",
8129 filter->map[RMAP_OUT].name,
8130 VTY_NEWLINE);
8131 if (filter->map[RMAP_IMPORT].name)
8132 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
8133 filter->map[RMAP_IMPORT].map ? "*" : "",
8134 filter->map[RMAP_IMPORT].name,
8135 VTY_NEWLINE);
8136 if (filter->map[RMAP_EXPORT].name)
8137 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
8138 filter->map[RMAP_EXPORT].map ? "*" : "",
8139 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00008140 VTY_NEWLINE);
8141
8142 /* unsuppress-map */
8143 if (filter->usmap.name)
8144 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
8145 filter->usmap.map ? "*" : "",
8146 filter->usmap.name, VTY_NEWLINE);
8147
8148 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00008149 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
8150
paul718e3742002-12-13 20:15:29 +00008151 /* Maximum prefix */
8152 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
8153 {
hasso0a486e52005-02-01 20:57:17 +00008154 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00008155 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00008156 ? " (warning-only)" : "", VTY_NEWLINE);
8157 vty_out (vty, " Threshold for warning message %d%%",
8158 p->pmax_threshold[afi][safi]);
8159 if (p->pmax_restart[afi][safi])
8160 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
8161 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008162 }
paul718e3742002-12-13 20:15:29 +00008163
8164 vty_out (vty, "%s", VTY_NEWLINE);
8165}
8166
paul94f2b392005-06-28 12:44:16 +00008167static void
paul718e3742002-12-13 20:15:29 +00008168bgp_show_peer (struct vty *vty, struct peer *p)
8169{
8170 struct bgp *bgp;
8171 char buf1[BUFSIZ];
8172 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00008173 afi_t afi;
8174 safi_t safi;
paul718e3742002-12-13 20:15:29 +00008175
8176 bgp = p->bgp;
8177
8178 /* Configured IP address. */
8179 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008180 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00008181 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00008182 p->change_local_as ? p->change_local_as : p->local_as,
8183 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00008184 " no-prepend" : "",
8185 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
8186 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00008187 vty_out (vty, "%s link%s",
8188 p->as == p->local_as ? "internal" : "external",
8189 VTY_NEWLINE);
8190
8191 /* Description. */
8192 if (p->desc)
8193 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
8194
8195 /* Peer-group */
8196 if (p->group)
8197 vty_out (vty, " Member of peer-group %s for session parameters%s",
8198 p->group->name, VTY_NEWLINE);
8199
8200 /* Administrative shutdown. */
8201 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
8202 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
8203
8204 /* BGP Version. */
8205 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00008206 vty_out (vty, ", remote router ID %s%s",
8207 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
8208 VTY_NEWLINE);
8209
8210 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00008211 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
8212 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00008213 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
8214
8215 /* Status. */
8216 vty_out (vty, " BGP state = %s",
8217 LOOKUP (bgp_status_msg, p->status));
8218 if (p->status == Established)
8219 vty_out (vty, ", up for %8s",
8220 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00008221 else if (p->status == Active)
8222 {
8223 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
8224 vty_out (vty, " (passive)");
8225 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
8226 vty_out (vty, " (NSF passive)");
8227 }
paul718e3742002-12-13 20:15:29 +00008228 vty_out (vty, "%s", VTY_NEWLINE);
8229
8230 /* read timer */
8231 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
8232
8233 /* Configured timer values. */
8234 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
8235 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
8236 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
8237 {
8238 vty_out (vty, " Configured hold time is %d", p->holdtime);
8239 vty_out (vty, ", keepalive interval is %d seconds%s",
8240 p->keepalive, VTY_NEWLINE);
8241 }
hasso93406d82005-02-02 14:40:33 +00008242
paul718e3742002-12-13 20:15:29 +00008243 /* Capability. */
8244 if (p->status == Established)
8245 {
hasso538621f2004-05-21 09:31:30 +00008246 if (p->cap
paul718e3742002-12-13 20:15:29 +00008247 || p->afc_adv[AFI_IP][SAFI_UNICAST]
8248 || p->afc_recv[AFI_IP][SAFI_UNICAST]
8249 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
8250 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
8251#ifdef HAVE_IPV6
8252 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
8253 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
8254 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
8255 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
Lou Berger9da04bc2016-01-12 13:41:55 -05008256 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
8257 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
Lou Bergera3fda882016-01-12 13:42:04 -05008258 || p->afc_adv[AFI_IP6][SAFI_ENCAP]
8259 || p->afc_recv[AFI_IP6][SAFI_ENCAP]
paul718e3742002-12-13 20:15:29 +00008260#endif /* HAVE_IPV6 */
Lou Bergera3fda882016-01-12 13:42:04 -05008261 || p->afc_adv[AFI_IP][SAFI_ENCAP]
8262 || p->afc_recv[AFI_IP][SAFI_ENCAP]
paul718e3742002-12-13 20:15:29 +00008263 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
8264 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
8265 {
8266 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
8267
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008268 /* AS4 */
8269 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
8270 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8271 {
8272 vty_out (vty, " 4 Byte AS:");
8273 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8274 vty_out (vty, " advertised");
8275 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
8276 vty_out (vty, " %sreceived",
8277 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
8278 vty_out (vty, "%s", VTY_NEWLINE);
8279 }
paul718e3742002-12-13 20:15:29 +00008280 /* Dynamic */
8281 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
8282 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8283 {
8284 vty_out (vty, " Dynamic:");
8285 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8286 vty_out (vty, " advertised");
8287 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00008288 vty_out (vty, " %sreceived",
8289 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008290 vty_out (vty, "%s", VTY_NEWLINE);
8291 }
8292
8293 /* Route Refresh */
8294 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
8295 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8296 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
8297 {
8298 vty_out (vty, " Route refresh:");
8299 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
8300 vty_out (vty, " advertised");
8301 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8302 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00008303 vty_out (vty, " %sreceived(%s)",
8304 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
8305 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
8306 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
8307 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
8308
paul718e3742002-12-13 20:15:29 +00008309 vty_out (vty, "%s", VTY_NEWLINE);
8310 }
8311
hasso538621f2004-05-21 09:31:30 +00008312 /* Multiprotocol Extensions */
8313 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8314 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8315 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00008316 {
hasso538621f2004-05-21 09:31:30 +00008317 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
8318 if (p->afc_adv[afi][safi])
8319 vty_out (vty, " advertised");
8320 if (p->afc_recv[afi][safi])
8321 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
8322 vty_out (vty, "%s", VTY_NEWLINE);
8323 }
8324
8325 /* Gracefull Restart */
8326 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8327 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008328 {
hasso538621f2004-05-21 09:31:30 +00008329 vty_out (vty, " Graceful Restart Capabilty:");
8330 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008331 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00008332 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
8333 vty_out (vty, " %sreceived",
8334 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008335 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008336
8337 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00008338 {
hasso538621f2004-05-21 09:31:30 +00008339 int restart_af_count = 0;
8340
8341 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00008342 p->v_gr_restart, VTY_NEWLINE);
8343 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008344
8345 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8346 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8347 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
8348 {
hasso93406d82005-02-02 14:40:33 +00008349 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
8350 afi_safi_print (afi, safi),
8351 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
8352 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00008353 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00008354 }
hasso538621f2004-05-21 09:31:30 +00008355 if (! restart_af_count)
8356 vty_out (vty, "none");
8357 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008358 }
paul718e3742002-12-13 20:15:29 +00008359 }
paul718e3742002-12-13 20:15:29 +00008360 }
8361 }
8362
hasso93406d82005-02-02 14:40:33 +00008363 /* graceful restart information */
8364 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8365 || p->t_gr_restart
8366 || p->t_gr_stale)
8367 {
8368 int eor_send_af_count = 0;
8369 int eor_receive_af_count = 0;
8370
8371 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
8372 if (p->status == Established)
8373 {
8374 vty_out (vty, " End-of-RIB send: ");
8375 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8376 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8377 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
8378 {
8379 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
8380 afi_safi_print (afi, safi));
8381 eor_send_af_count++;
8382 }
8383 vty_out (vty, "%s", VTY_NEWLINE);
8384
8385 vty_out (vty, " End-of-RIB received: ");
8386 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8387 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8388 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
8389 {
8390 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
8391 afi_safi_print (afi, safi));
8392 eor_receive_af_count++;
8393 }
8394 vty_out (vty, "%s", VTY_NEWLINE);
8395 }
8396
8397 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008398 vty_out (vty, " The remaining time of restart timer is %ld%s",
8399 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
8400
hasso93406d82005-02-02 14:40:33 +00008401 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008402 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
8403 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008404 }
8405
paul718e3742002-12-13 20:15:29 +00008406 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00008407 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
8408 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008409 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008410 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
8411 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
8412 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
8413 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
8414 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
8415 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
8416 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
8417 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
8418 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
8419 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
8420 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008421
8422 /* advertisement-interval */
8423 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
8424 p->v_routeadv, VTY_NEWLINE);
8425
8426 /* Update-source. */
8427 if (p->update_if || p->update_source)
8428 {
8429 vty_out (vty, " Update source is ");
8430 if (p->update_if)
8431 vty_out (vty, "%s", p->update_if);
8432 else if (p->update_source)
8433 vty_out (vty, "%s",
8434 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
8435 vty_out (vty, "%s", VTY_NEWLINE);
8436 }
8437
8438 /* Default weight */
8439 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
8440 vty_out (vty, " Default weight %d%s", p->weight,
8441 VTY_NEWLINE);
8442
8443 vty_out (vty, "%s", VTY_NEWLINE);
8444
8445 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00008446 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8447 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8448 if (p->afc[afi][safi])
8449 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00008450
8451 vty_out (vty, " Connections established %d; dropped %d%s",
8452 p->established, p->dropped,
8453 VTY_NEWLINE);
8454
hassoe0701b72004-05-20 09:19:34 +00008455 if (! p->dropped)
8456 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
8457 else
8458 vty_out (vty, " Last reset %s, due to %s%s",
8459 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
8460 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00008461
paul718e3742002-12-13 20:15:29 +00008462 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8463 {
8464 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00008465
8466 if (p->t_pmax_restart)
8467 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8468 p->host, thread_timer_remain_second (p->t_pmax_restart),
8469 VTY_NEWLINE);
8470 else
8471 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8472 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008473 }
8474
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008475 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00008476 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008477 {
8478 if (p->gtsm_hops > 0)
8479 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8480 p->gtsm_hops, VTY_NEWLINE);
8481 else if (p->ttl > 1)
8482 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8483 p->ttl, VTY_NEWLINE);
8484 }
Pradosh Mohapatra5d804b42013-09-12 03:37:07 +00008485 else
8486 {
8487 if (p->gtsm_hops > 0)
8488 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
8489 p->gtsm_hops, VTY_NEWLINE);
8490 }
paul718e3742002-12-13 20:15:29 +00008491
8492 /* Local address. */
8493 if (p->su_local)
8494 {
hasso93406d82005-02-02 14:40:33 +00008495 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00008496 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
8497 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00008498 VTY_NEWLINE);
8499 }
8500
8501 /* Remote address. */
8502 if (p->su_remote)
8503 {
8504 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
8505 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
8506 ntohs (p->su_remote->sin.sin_port),
8507 VTY_NEWLINE);
8508 }
8509
8510 /* Nexthop display. */
8511 if (p->su_local)
8512 {
8513 vty_out (vty, "Nexthop: %s%s",
8514 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
8515 VTY_NEWLINE);
8516#ifdef HAVE_IPV6
8517 vty_out (vty, "Nexthop global: %s%s",
8518 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
8519 VTY_NEWLINE);
8520 vty_out (vty, "Nexthop local: %s%s",
8521 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
8522 VTY_NEWLINE);
8523 vty_out (vty, "BGP connection: %s%s",
8524 p->shared_network ? "shared network" : "non shared network",
8525 VTY_NEWLINE);
8526#endif /* HAVE_IPV6 */
8527 }
8528
Timo Teräsef757702015-04-29 09:43:04 +03008529 /* TCP metrics. */
8530 if (p->status == Established && p->rtt)
8531 vty_out (vty, "Estimated round trip time: %d ms%s",
8532 p->rtt, VTY_NEWLINE);
8533
paul718e3742002-12-13 20:15:29 +00008534 /* Timer information. */
8535 if (p->t_start)
8536 vty_out (vty, "Next start timer due in %ld seconds%s",
8537 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
8538 if (p->t_connect)
8539 vty_out (vty, "Next connect timer due in %ld seconds%s",
8540 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
8541
8542 vty_out (vty, "Read thread: %s Write thread: %s%s",
8543 p->t_read ? "on" : "off",
8544 p->t_write ? "on" : "off",
8545 VTY_NEWLINE);
8546
8547 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
8548 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
8549 bgp_capability_vty_out (vty, p);
8550
8551 vty_out (vty, "%s", VTY_NEWLINE);
8552}
8553
paul94f2b392005-06-28 12:44:16 +00008554static int
paul718e3742002-12-13 20:15:29 +00008555bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
8556 enum show_type type, union sockunion *su)
8557{
paul1eb8ef22005-04-07 07:30:20 +00008558 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00008559 struct peer *peer;
8560 int find = 0;
8561
paul1eb8ef22005-04-07 07:30:20 +00008562 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00008563 {
8564 switch (type)
8565 {
8566 case show_all:
8567 bgp_show_peer (vty, peer);
8568 break;
8569 case show_peer:
8570 if (sockunion_same (&peer->su, su))
8571 {
8572 find = 1;
8573 bgp_show_peer (vty, peer);
8574 }
8575 break;
8576 }
8577 }
8578
8579 if (type == show_peer && ! find)
8580 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
8581
8582 return CMD_SUCCESS;
8583}
8584
paul94f2b392005-06-28 12:44:16 +00008585static int
paulfd79ac92004-10-13 05:06:08 +00008586bgp_show_neighbor_vty (struct vty *vty, const char *name,
8587 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00008588{
8589 int ret;
8590 struct bgp *bgp;
8591 union sockunion su;
8592
8593 if (ip_str)
8594 {
8595 ret = str2sockunion (ip_str, &su);
8596 if (ret < 0)
8597 {
8598 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
8599 return CMD_WARNING;
8600 }
8601 }
8602
8603 if (name)
8604 {
8605 bgp = bgp_lookup_by_name (name);
8606
8607 if (! bgp)
8608 {
8609 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8610 return CMD_WARNING;
8611 }
8612
8613 bgp_show_neighbor (vty, bgp, type, &su);
8614
8615 return CMD_SUCCESS;
8616 }
8617
8618 bgp = bgp_get_default ();
8619
8620 if (bgp)
8621 bgp_show_neighbor (vty, bgp, type, &su);
8622
8623 return CMD_SUCCESS;
8624}
8625
Lou Bergerf9b6c392016-01-12 13:42:09 -05008626/* "show ip bgp neighbors" commands. */DEFUN (show_ip_bgp_neighbors,
8627 show_ip_bgp_neighbors_cmd,
8628 "show ip bgp neighbors",
8629 SHOW_STR
8630 IP_STR
8631 BGP_STR
8632 "Detailed information on TCP and BGP neighbor connections\n")
8633{
8634 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8635}
8636
8637ALIAS (show_ip_bgp_neighbors,
8638 show_ip_bgp_ipv4_neighbors_cmd,
8639 "show ip bgp ipv4 (unicast|multicast) neighbors",
8640 SHOW_STR
8641 IP_STR
8642 BGP_STR
8643 "Address family\n"
8644 "Address Family modifier\n"
8645 "Address Family modifier\n"
8646 "Detailed information on TCP and BGP neighbor connections\n")
8647
8648ALIAS (show_ip_bgp_neighbors,
8649 show_ip_bgp_vpnv4_all_neighbors_cmd,
8650 "show ip bgp vpnv4 all neighbors",
8651 SHOW_STR
8652 IP_STR
8653 BGP_STR
8654 "Display VPNv4 NLRI specific information\n"
8655 "Display information about all VPNv4 NLRIs\n"
8656 "Detailed information on TCP and BGP neighbor connections\n")
8657
8658ALIAS (show_ip_bgp_neighbors,
8659 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8660 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8661 SHOW_STR
8662 IP_STR
8663 BGP_STR
8664 "Display VPNv4 NLRI specific information\n"
8665 "Display information for a route distinguisher\n"
8666 "VPN Route Distinguisher\n"
8667 "Detailed information on TCP and BGP neighbor connections\n")
8668
8669ALIAS (show_ip_bgp_neighbors,
8670 show_bgp_ipv6_neighbors_cmd,
8671 "show bgp ipv6 neighbors",
8672 SHOW_STR
8673 BGP_STR
8674 "Address family\n"
8675 "Detailed information on TCP and BGP neighbor connections\n")
8676
8677DEFUN (show_ip_bgp_neighbors_peer,
8678 show_ip_bgp_neighbors_peer_cmd,
8679 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8680 SHOW_STR
8681 IP_STR
8682 BGP_STR
8683 "Detailed information on TCP and BGP neighbor connections\n"
8684 "Neighbor to display information about\n"
8685 "Neighbor to display information about\n")
8686{
8687 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8688}
8689
8690ALIAS (show_ip_bgp_neighbors_peer,
8691 show_ip_bgp_ipv4_neighbors_peer_cmd,
8692 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8693 SHOW_STR
8694 IP_STR
8695 BGP_STR
8696 "Address family\n"
8697 "Address Family modifier\n"
8698 "Address Family modifier\n"
8699 "Detailed information on TCP and BGP neighbor connections\n"
8700 "Neighbor to display information about\n"
8701 "Neighbor to display information about\n")
8702
8703ALIAS (show_ip_bgp_neighbors_peer,
8704 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8705 "show ip bgp vpnv4 all neighbors A.B.C.D",
8706 SHOW_STR
8707 IP_STR
8708 BGP_STR
8709 "Display VPNv4 NLRI specific information\n"
8710 "Display information about all VPNv4 NLRIs\n"
8711 "Detailed information on TCP and BGP neighbor connections\n"
8712 "Neighbor to display information about\n")
8713
8714ALIAS (show_ip_bgp_neighbors_peer,
8715 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8716 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8717 SHOW_STR
8718 IP_STR
8719 BGP_STR
8720 "Display VPNv4 NLRI specific information\n"
8721 "Display information about all VPNv4 NLRIs\n"
8722 "Detailed information on TCP and BGP neighbor connections\n"
8723 "Neighbor to display information about\n")
8724
8725ALIAS (show_ip_bgp_neighbors_peer,
8726 show_bgp_ipv6_neighbors_peer_cmd,
8727 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8728 SHOW_STR
8729 BGP_STR
8730 "Address family\n"
8731 "Detailed information on TCP and BGP neighbor connections\n"
8732 "Neighbor to display information about\n"
8733 "Neighbor to display information about\n")
8734
8735DEFUN (show_ip_bgp_instance_neighbors,
8736 show_ip_bgp_instance_neighbors_cmd,
8737 "show ip bgp view WORD neighbors",
8738 SHOW_STR
8739 IP_STR
8740 BGP_STR
8741 "BGP view\n"
8742 "View name\n"
8743 "Detailed information on TCP and BGP neighbor connections\n")
8744{
8745 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8746}
8747
8748ALIAS (show_ip_bgp_instance_neighbors,
8749 show_bgp_instance_ipv6_neighbors_cmd,
8750 "show bgp view WORD ipv6 neighbors",
8751 SHOW_STR
8752 BGP_STR
8753 "BGP view\n"
8754 "View name\n"
8755 "Address family\n"
8756 "Detailed information on TCP and BGP neighbor connections\n")
8757
8758DEFUN (show_ip_bgp_instance_neighbors_peer,
8759 show_ip_bgp_instance_neighbors_peer_cmd,
8760 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8761 SHOW_STR
8762 IP_STR
8763 BGP_STR
8764 "BGP view\n"
8765 "View name\n"
8766 "Detailed information on TCP and BGP neighbor connections\n"
8767 "Neighbor to display information about\n"
8768 "Neighbor to display information about\n")
8769{
8770 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8771}
8772
8773/* Show BGP's AS paths internal data. There are both `show ip bgp
8774 paths' and `show ip mbgp paths'. Those functions results are the
8775 same.*/
8776DEFUN (show_ip_bgp_paths,
8777 show_ip_bgp_paths_cmd,
8778 "show ip bgp paths",
8779 SHOW_STR
8780 IP_STR
8781 BGP_STR
8782 "Path information\n")
8783{
8784 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8785 aspath_print_all_vty (vty);
8786 return CMD_SUCCESS;
8787}
8788
8789DEFUN (show_ip_bgp_ipv4_paths,
8790 show_ip_bgp_ipv4_paths_cmd,
8791 "show ip bgp ipv4 (unicast|multicast) paths",
8792 SHOW_STR
8793 IP_STR
8794 BGP_STR
8795 "Address family\n"
8796 "Address Family modifier\n"
8797 "Address Family modifier\n"
8798 "Path information\n")
8799{
8800 vty_out (vty, "Address Refcnt Path\r\n");
8801 aspath_print_all_vty (vty);
8802
8803 return CMD_SUCCESS;
8804}
8805
Lou Berger651b4022016-01-12 13:42:07 -05008806DEFUN (show_bgp_neighbors,
8807 show_bgp_neighbors_cmd,
8808 "show bgp neighbors",
paul718e3742002-12-13 20:15:29 +00008809 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008810 BGP_STR
8811 "Detailed information on TCP and BGP neighbor connections\n")
8812{
8813 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8814}
8815
Lou Berger651b4022016-01-12 13:42:07 -05008816DEFUN (show_bgp_neighbors_peer,
8817 show_bgp_neighbors_peer_cmd,
8818#ifdef HAVE_IPV6
8819 "show bgp neighbors (A.B.C.D|X:X::X:X)",
8820#else
8821 "show bgp neighbors (A.B.C.D)",
8822#endif /* HAVE_IPV6 */
paul718e3742002-12-13 20:15:29 +00008823 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008824 BGP_STR
8825 "Detailed information on TCP and BGP neighbor connections\n"
8826 "Neighbor to display information about\n"
8827 "Neighbor to display information about\n")
8828{
8829 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8830}
8831
Lou Berger651b4022016-01-12 13:42:07 -05008832DEFUN (show_bgp_instance_neighbors,
8833 show_bgp_instance_neighbors_cmd,
8834 "show bgp view WORD neighbors",
paul718e3742002-12-13 20:15:29 +00008835 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008836 BGP_STR
8837 "BGP view\n"
8838 "View name\n"
8839 "Detailed information on TCP and BGP neighbor connections\n")
8840{
8841 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8842}
8843
Lou Berger651b4022016-01-12 13:42:07 -05008844DEFUN (show_bgp_instance_neighbors_peer,
8845 show_bgp_instance_neighbors_peer_cmd,
8846#ifdef HAVE_IPV6
8847 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8848#else
8849 "show bgp view WORD neighbors (A.B.C.D)",
8850#endif
paul718e3742002-12-13 20:15:29 +00008851 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008852 BGP_STR
8853 "BGP view\n"
8854 "View name\n"
8855 "Detailed information on TCP and BGP neighbor connections\n"
8856 "Neighbor to display information about\n"
8857 "Neighbor to display information about\n")
8858{
8859 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8860}
paulbb46e942003-10-24 19:02:03 +00008861
Lou Berger651b4022016-01-12 13:42:07 -05008862ALIAS (show_bgp_instance_neighbors_peer,
paulbb46e942003-10-24 19:02:03 +00008863 show_bgp_instance_ipv6_neighbors_peer_cmd,
8864 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8865 SHOW_STR
8866 BGP_STR
8867 "BGP view\n"
8868 "View name\n"
8869 "Address family\n"
8870 "Detailed information on TCP and BGP neighbor connections\n"
8871 "Neighbor to display information about\n"
8872 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008873
paul718e3742002-12-13 20:15:29 +00008874/* Show BGP's AS paths internal data. There are both `show ip bgp
8875 paths' and `show ip mbgp paths'. Those functions results are the
8876 same.*/
Lou Berger651b4022016-01-12 13:42:07 -05008877DEFUN (show_bgp_ipv4_paths,
8878 show_bgp_ipv4_paths_cmd,
8879 "show bgp paths",
paul718e3742002-12-13 20:15:29 +00008880 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008881 BGP_STR
8882 "Path information\n")
8883{
8884 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8885 aspath_print_all_vty (vty);
8886 return CMD_SUCCESS;
8887}
8888
paul718e3742002-12-13 20:15:29 +00008889#include "hash.h"
8890
paul94f2b392005-06-28 12:44:16 +00008891static void
paul718e3742002-12-13 20:15:29 +00008892community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8893{
8894 struct community *com;
8895
8896 com = (struct community *) backet->data;
David Lampartereed3c482015-03-03 08:51:53 +01008897 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
paul718e3742002-12-13 20:15:29 +00008898 community_str (com), VTY_NEWLINE);
8899}
8900
8901/* Show BGP's community internal data. */
8902DEFUN (show_ip_bgp_community_info,
8903 show_ip_bgp_community_info_cmd,
8904 "show ip bgp community-info",
8905 SHOW_STR
8906 IP_STR
8907 BGP_STR
8908 "List all bgp community information\n")
8909{
8910 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8911
8912 hash_iterate (community_hash (),
8913 (void (*) (struct hash_backet *, void *))
8914 community_show_all_iterator,
8915 vty);
8916
8917 return CMD_SUCCESS;
8918}
8919
8920DEFUN (show_ip_bgp_attr_info,
8921 show_ip_bgp_attr_info_cmd,
8922 "show ip bgp attribute-info",
8923 SHOW_STR
8924 IP_STR
8925 BGP_STR
8926 "List all bgp attribute information\n")
8927{
8928 attr_show_all (vty);
8929 return CMD_SUCCESS;
8930}
David Lamparter6b0655a2014-06-04 06:53:35 +02008931
paul94f2b392005-06-28 12:44:16 +00008932static int
paulfee0f4c2004-09-13 05:12:46 +00008933bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8934 afi_t afi, safi_t safi)
8935{
8936 char timebuf[BGP_UPTIME_LEN];
8937 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008938 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008939 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008940 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008941 int len;
8942 int count = 0;
8943
8944 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8945 {
paul1eb8ef22005-04-07 07:30:20 +00008946 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008947 {
8948 count++;
8949 bgp_write_rsclient_summary (vty, peer, afi, safi);
8950 }
8951 return count;
8952 }
8953
8954 len = vty_out (vty, "%s", rsclient->host);
8955 len = 16 - len;
8956
8957 if (len < 1)
8958 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8959 else
8960 vty_out (vty, "%*s", len, " ");
8961
hasso3d515fd2005-02-01 21:30:04 +00008962 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008963
Milan Kociancb4fc592014-12-01 12:48:25 +00008964 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008965
8966 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8967 if ( rmname && strlen (rmname) > 13 )
8968 {
8969 sprintf (rmbuf, "%13s", "...");
8970 rmname = strncpy (rmbuf, rmname, 10);
8971 }
8972 else if (! rmname)
8973 rmname = "<none>";
8974 vty_out (vty, " %13s ", rmname);
8975
8976 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8977 if ( rmname && strlen (rmname) > 13 )
8978 {
8979 sprintf (rmbuf, "%13s", "...");
8980 rmname = strncpy (rmbuf, rmname, 10);
8981 }
8982 else if (! rmname)
8983 rmname = "<none>";
8984 vty_out (vty, " %13s ", rmname);
8985
8986 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8987
8988 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8989 vty_out (vty, " Idle (Admin)");
8990 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8991 vty_out (vty, " Idle (PfxCt)");
8992 else
8993 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8994
8995 vty_out (vty, "%s", VTY_NEWLINE);
8996
8997 return 1;
8998}
8999
paul94f2b392005-06-28 12:44:16 +00009000static int
paulfd79ac92004-10-13 05:06:08 +00009001bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
9002 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00009003{
9004 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00009005 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00009006 int count = 0;
9007
9008 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00009009 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00009010
paul1eb8ef22005-04-07 07:30:20 +00009011 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00009012 {
9013 if (peer->afc[afi][safi] &&
9014 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
9015 {
9016 if (! count)
9017 {
9018 vty_out (vty,
9019 "Route Server's BGP router identifier %s%s",
9020 inet_ntoa (bgp->router_id), VTY_NEWLINE);
9021 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04009022 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00009023 VTY_NEWLINE);
9024
9025 vty_out (vty, "%s", VTY_NEWLINE);
9026 vty_out (vty, "%s%s", header, VTY_NEWLINE);
9027 }
9028
9029 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
9030 }
9031 }
9032
9033 if (count)
9034 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
9035 count, VTY_NEWLINE);
9036 else
9037 vty_out (vty, "No %s Route Server Client is configured%s",
9038 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
9039
9040 return CMD_SUCCESS;
9041}
9042
paul94f2b392005-06-28 12:44:16 +00009043static int
paulfd79ac92004-10-13 05:06:08 +00009044bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
9045 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00009046{
9047 struct bgp *bgp;
9048
9049 if (name)
9050 {
9051 bgp = bgp_lookup_by_name (name);
9052
9053 if (! bgp)
9054 {
9055 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
9056 return CMD_WARNING;
9057 }
9058
9059 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9060 return CMD_SUCCESS;
9061 }
9062
9063 bgp = bgp_get_default ();
9064
9065 if (bgp)
9066 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9067
9068 return CMD_SUCCESS;
9069}
9070
9071/* 'show bgp rsclient' commands. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05009072DEFUN (show_ip_bgp_rsclient_summary,
9073 show_ip_bgp_rsclient_summary_cmd,
9074 "show ip bgp rsclient summary",
9075 SHOW_STR
9076 IP_STR
9077 BGP_STR
9078 "Information about Route Server Clients\n"
9079 "Summary of all Route Server Clients\n")
9080{
9081 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9082}
9083
9084DEFUN (show_ip_bgp_instance_rsclient_summary,
9085 show_ip_bgp_instance_rsclient_summary_cmd,
9086 "show ip bgp view WORD rsclient summary",
9087 SHOW_STR
9088 IP_STR
9089 BGP_STR
9090 "BGP view\n"
9091 "View name\n"
9092 "Information about Route Server Clients\n"
9093 "Summary of all Route Server Clients\n")
9094{
9095 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9096}
9097
9098DEFUN (show_ip_bgp_ipv4_rsclient_summary,
9099 show_ip_bgp_ipv4_rsclient_summary_cmd,
9100 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
9101 SHOW_STR
9102 IP_STR
9103 BGP_STR
9104 "Address family\n"
9105 "Address Family modifier\n"
9106 "Address Family modifier\n"
9107 "Information about Route Server Clients\n"
9108 "Summary of all Route Server Clients\n")
9109{
9110 if (strncmp (argv[0], "m", 1) == 0)
9111 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9112
9113 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9114}
9115
9116DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
9117 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
9118 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9119 SHOW_STR
9120 IP_STR
9121 BGP_STR
9122 "BGP view\n"
9123 "View name\n"
9124 "Address family\n"
9125 "Address Family modifier\n"
9126 "Address Family modifier\n"
9127 "Information about Route Server Clients\n"
9128 "Summary of all Route Server Clients\n")
9129{
9130 if (strncmp (argv[1], "m", 1) == 0)
9131 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9132
9133 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9134}
paulfee0f4c2004-09-13 05:12:46 +00009135
Michael Lambert95cbbd22010-07-23 14:43:04 -04009136DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
9137 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
9138 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9139 SHOW_STR
9140 BGP_STR
9141 "BGP view\n"
9142 "View name\n"
9143 "Address family\n"
9144 "Address Family modifier\n"
9145 "Address Family modifier\n"
9146 "Information about Route Server Clients\n"
9147 "Summary of all Route Server Clients\n")
9148{
9149 safi_t safi;
9150
9151 if (argc == 2) {
9152 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9153 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
9154 } else {
9155 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9156 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
9157 }
9158}
9159
9160ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
9161 show_bgp_ipv4_safi_rsclient_summary_cmd,
9162 "show bgp ipv4 (unicast|multicast) rsclient summary",
9163 SHOW_STR
9164 BGP_STR
9165 "Address family\n"
9166 "Address Family modifier\n"
9167 "Address Family modifier\n"
9168 "Information about Route Server Clients\n"
9169 "Summary of all Route Server Clients\n")
9170
paulfee0f4c2004-09-13 05:12:46 +00009171DEFUN (show_bgp_rsclient_summary,
9172 show_bgp_rsclient_summary_cmd,
9173 "show bgp rsclient summary",
9174 SHOW_STR
9175 BGP_STR
9176 "Information about Route Server Clients\n"
9177 "Summary of all Route Server Clients\n")
9178{
Lou Berger651b4022016-01-12 13:42:07 -05009179 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9180 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9181 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9182 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9183 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9184 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9185 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9186 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9187 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
9188 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9189 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9190 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
9191
9192#ifdef HAVE_IPV6
9193 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9194 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9195 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9196 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9197 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9198 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9199 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9200 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9201 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9202 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9203 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9204 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
9205#endif
9206 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009207}
9208
9209DEFUN (show_bgp_instance_rsclient_summary,
9210 show_bgp_instance_rsclient_summary_cmd,
9211 "show bgp view WORD rsclient summary",
9212 SHOW_STR
9213 BGP_STR
9214 "BGP view\n"
9215 "View name\n"
9216 "Information about Route Server Clients\n"
9217 "Summary of all Route Server Clients\n")
9218{
Lou Berger651b4022016-01-12 13:42:07 -05009219 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9220 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9221 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9222 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9223 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9224 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9225 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9226 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9227 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
9228 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9229 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9230 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
9231
9232#ifdef HAVE_IPV6
9233 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9234 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9235 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9236 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9237 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9238 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
9239 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9240 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9241 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9242 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9243 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9244 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
9245#endif
9246 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009247}
9248
Lou Berger651b4022016-01-12 13:42:07 -05009249#ifdef HAVE_IPV6
9250DEFUN (show_bgp_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009251 show_bgp_ipv6_rsclient_summary_cmd,
9252 "show bgp ipv6 rsclient summary",
9253 SHOW_STR
9254 BGP_STR
9255 "Address family\n"
9256 "Information about Route Server Clients\n"
9257 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009258{
9259 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9260 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9261 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9262 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9263 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9264 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9265 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9266 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9267 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9268 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9269 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9270 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
paulfee0f4c2004-09-13 05:12:46 +00009271
Lou Berger651b4022016-01-12 13:42:07 -05009272 return CMD_SUCCESS;
9273}
9274
9275DEFUN (show_bgp_instance_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009276 show_bgp_instance_ipv6_rsclient_summary_cmd,
9277 "show bgp view WORD ipv6 rsclient summary",
9278 SHOW_STR
9279 BGP_STR
9280 "BGP view\n"
9281 "View name\n"
9282 "Address family\n"
9283 "Information about Route Server Clients\n"
9284 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009285{
9286 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9287 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9288 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9289 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9290 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9291 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
9292 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9293 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9294 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9295 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9296 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9297 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
9298
9299 return CMD_SUCCESS;
9300}
Michael Lambert95cbbd22010-07-23 14:43:04 -04009301
9302DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
9303 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
9304 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
9305 SHOW_STR
9306 BGP_STR
9307 "BGP view\n"
9308 "View name\n"
9309 "Address family\n"
9310 "Address Family modifier\n"
9311 "Address Family modifier\n"
9312 "Information about Route Server Clients\n"
9313 "Summary of all Route Server Clients\n")
9314{
9315 safi_t safi;
9316
9317 if (argc == 2) {
9318 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9319 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
9320 } else {
9321 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9322 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
9323 }
9324}
9325
9326ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
9327 show_bgp_ipv6_safi_rsclient_summary_cmd,
9328 "show bgp ipv6 (unicast|multicast) rsclient summary",
9329 SHOW_STR
9330 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05009331 IPV6_STR
Michael Lambert95cbbd22010-07-23 14:43:04 -04009332 "Address Family modifier\n"
9333 "Address Family modifier\n"
9334 "Information about Route Server Clients\n"
9335 "Summary of all Route Server Clients\n")
9336
paulfee0f4c2004-09-13 05:12:46 +00009337#endif /* HAVE IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02009338
paul718e3742002-12-13 20:15:29 +00009339/* Redistribute VTY commands. */
9340
paul718e3742002-12-13 20:15:29 +00009341DEFUN (bgp_redistribute_ipv4,
9342 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009343 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009344 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009345 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009346{
9347 int type;
9348
David Lampartere0ca5fd2009-09-16 01:52:42 +02009349 type = proto_redistnum (AFI_IP, argv[0]);
9350 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009351 {
9352 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9353 return CMD_WARNING;
9354 }
9355 return bgp_redistribute_set (vty->index, AFI_IP, type);
9356}
9357
9358DEFUN (bgp_redistribute_ipv4_rmap,
9359 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009360 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009361 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009362 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009363 "Route map reference\n"
9364 "Pointer to route-map entries\n")
9365{
9366 int type;
9367
David Lampartere0ca5fd2009-09-16 01:52:42 +02009368 type = proto_redistnum (AFI_IP, argv[0]);
9369 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009370 {
9371 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9372 return CMD_WARNING;
9373 }
9374
9375 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9376 return bgp_redistribute_set (vty->index, AFI_IP, type);
9377}
9378
9379DEFUN (bgp_redistribute_ipv4_metric,
9380 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009381 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009382 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009383 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009384 "Metric for redistributed routes\n"
9385 "Default metric\n")
9386{
9387 int type;
9388 u_int32_t metric;
9389
David Lampartere0ca5fd2009-09-16 01:52:42 +02009390 type = proto_redistnum (AFI_IP, argv[0]);
9391 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009392 {
9393 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9394 return CMD_WARNING;
9395 }
9396 VTY_GET_INTEGER ("metric", metric, argv[1]);
9397
9398 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9399 return bgp_redistribute_set (vty->index, AFI_IP, type);
9400}
9401
9402DEFUN (bgp_redistribute_ipv4_rmap_metric,
9403 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009404 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009405 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009406 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009407 "Route map reference\n"
9408 "Pointer to route-map entries\n"
9409 "Metric for redistributed routes\n"
9410 "Default metric\n")
9411{
9412 int type;
9413 u_int32_t metric;
9414
David Lampartere0ca5fd2009-09-16 01:52:42 +02009415 type = proto_redistnum (AFI_IP, argv[0]);
9416 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009417 {
9418 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9419 return CMD_WARNING;
9420 }
9421 VTY_GET_INTEGER ("metric", metric, argv[2]);
9422
9423 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9424 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9425 return bgp_redistribute_set (vty->index, AFI_IP, type);
9426}
9427
9428DEFUN (bgp_redistribute_ipv4_metric_rmap,
9429 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009430 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009431 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009432 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009433 "Metric for redistributed routes\n"
9434 "Default metric\n"
9435 "Route map reference\n"
9436 "Pointer to route-map entries\n")
9437{
9438 int type;
9439 u_int32_t metric;
9440
David Lampartere0ca5fd2009-09-16 01:52:42 +02009441 type = proto_redistnum (AFI_IP, argv[0]);
9442 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009443 {
9444 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9445 return CMD_WARNING;
9446 }
9447 VTY_GET_INTEGER ("metric", metric, argv[1]);
9448
9449 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9450 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
9451 return bgp_redistribute_set (vty->index, AFI_IP, type);
9452}
9453
9454DEFUN (no_bgp_redistribute_ipv4,
9455 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009456 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009457 NO_STR
9458 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009459 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009460{
9461 int type;
9462
David Lampartere0ca5fd2009-09-16 01:52:42 +02009463 type = proto_redistnum (AFI_IP, argv[0]);
9464 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009465 {
9466 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9467 return CMD_WARNING;
9468 }
9469
9470 return bgp_redistribute_unset (vty->index, AFI_IP, type);
9471}
9472
9473DEFUN (no_bgp_redistribute_ipv4_rmap,
9474 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009475 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009476 NO_STR
9477 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009478 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009479 "Route map reference\n"
9480 "Pointer to route-map entries\n")
9481{
9482 int type;
9483
David Lampartere0ca5fd2009-09-16 01:52:42 +02009484 type = proto_redistnum (AFI_IP, argv[0]);
9485 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009486 {
9487 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9488 return CMD_WARNING;
9489 }
9490
9491 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9492 return CMD_SUCCESS;
9493}
9494
9495DEFUN (no_bgp_redistribute_ipv4_metric,
9496 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009497 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009498 NO_STR
9499 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009500 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009501 "Metric for redistributed routes\n"
9502 "Default metric\n")
9503{
9504 int type;
9505
David Lampartere0ca5fd2009-09-16 01:52:42 +02009506 type = proto_redistnum (AFI_IP, argv[0]);
9507 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009508 {
9509 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9510 return CMD_WARNING;
9511 }
9512
9513 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9514 return CMD_SUCCESS;
9515}
9516
9517DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
9518 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009519 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009520 NO_STR
9521 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009522 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009523 "Route map reference\n"
9524 "Pointer to route-map entries\n"
9525 "Metric for redistributed routes\n"
9526 "Default metric\n")
9527{
9528 int type;
9529
David Lampartere0ca5fd2009-09-16 01:52:42 +02009530 type = proto_redistnum (AFI_IP, argv[0]);
9531 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009532 {
9533 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9534 return CMD_WARNING;
9535 }
9536
9537 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9538 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9539 return CMD_SUCCESS;
9540}
9541
9542ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
9543 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009544 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009545 NO_STR
9546 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009547 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009548 "Metric for redistributed routes\n"
9549 "Default metric\n"
9550 "Route map reference\n"
9551 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009552
paul718e3742002-12-13 20:15:29 +00009553#ifdef HAVE_IPV6
9554DEFUN (bgp_redistribute_ipv6,
9555 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009556 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009557 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009558 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009559{
9560 int type;
9561
David Lampartere0ca5fd2009-09-16 01:52:42 +02009562 type = proto_redistnum (AFI_IP6, argv[0]);
9563 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009564 {
9565 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9566 return CMD_WARNING;
9567 }
9568
9569 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9570}
9571
9572DEFUN (bgp_redistribute_ipv6_rmap,
9573 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009574 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009575 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009576 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009577 "Route map reference\n"
9578 "Pointer to route-map entries\n")
9579{
9580 int type;
9581
David Lampartere0ca5fd2009-09-16 01:52:42 +02009582 type = proto_redistnum (AFI_IP6, argv[0]);
9583 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009584 {
9585 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9586 return CMD_WARNING;
9587 }
9588
9589 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9590 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9591}
9592
9593DEFUN (bgp_redistribute_ipv6_metric,
9594 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009595 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009596 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009597 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009598 "Metric for redistributed routes\n"
9599 "Default metric\n")
9600{
9601 int type;
9602 u_int32_t metric;
9603
David Lampartere0ca5fd2009-09-16 01:52:42 +02009604 type = proto_redistnum (AFI_IP6, argv[0]);
9605 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009606 {
9607 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9608 return CMD_WARNING;
9609 }
9610 VTY_GET_INTEGER ("metric", metric, argv[1]);
9611
9612 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9613 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9614}
9615
9616DEFUN (bgp_redistribute_ipv6_rmap_metric,
9617 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009618 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009619 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009620 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009621 "Route map reference\n"
9622 "Pointer to route-map entries\n"
9623 "Metric for redistributed routes\n"
9624 "Default metric\n")
9625{
9626 int type;
9627 u_int32_t metric;
9628
David Lampartere0ca5fd2009-09-16 01:52:42 +02009629 type = proto_redistnum (AFI_IP6, argv[0]);
9630 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009631 {
9632 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9633 return CMD_WARNING;
9634 }
9635 VTY_GET_INTEGER ("metric", metric, argv[2]);
9636
9637 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9638 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9639 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9640}
9641
9642DEFUN (bgp_redistribute_ipv6_metric_rmap,
9643 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009644 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009645 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009646 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009647 "Metric for redistributed routes\n"
9648 "Default metric\n"
9649 "Route map reference\n"
9650 "Pointer to route-map entries\n")
9651{
9652 int type;
9653 u_int32_t metric;
9654
David Lampartere0ca5fd2009-09-16 01:52:42 +02009655 type = proto_redistnum (AFI_IP6, argv[0]);
9656 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009657 {
9658 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9659 return CMD_WARNING;
9660 }
9661 VTY_GET_INTEGER ("metric", metric, argv[1]);
9662
9663 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9664 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
9665 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9666}
9667
9668DEFUN (no_bgp_redistribute_ipv6,
9669 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009670 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009671 NO_STR
9672 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009673 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009674{
9675 int type;
9676
David Lampartere0ca5fd2009-09-16 01:52:42 +02009677 type = proto_redistnum (AFI_IP6, argv[0]);
9678 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009679 {
9680 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9681 return CMD_WARNING;
9682 }
9683
9684 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
9685}
9686
9687DEFUN (no_bgp_redistribute_ipv6_rmap,
9688 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009689 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009690 NO_STR
9691 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009692 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009693 "Route map reference\n"
9694 "Pointer to route-map entries\n")
9695{
9696 int type;
9697
David Lampartere0ca5fd2009-09-16 01:52:42 +02009698 type = proto_redistnum (AFI_IP6, argv[0]);
9699 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009700 {
9701 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9702 return CMD_WARNING;
9703 }
9704
9705 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9706 return CMD_SUCCESS;
9707}
9708
9709DEFUN (no_bgp_redistribute_ipv6_metric,
9710 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009711 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009712 NO_STR
9713 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009714 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009715 "Metric for redistributed routes\n"
9716 "Default metric\n")
9717{
9718 int type;
9719
David Lampartere0ca5fd2009-09-16 01:52:42 +02009720 type = proto_redistnum (AFI_IP6, argv[0]);
9721 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009722 {
9723 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9724 return CMD_WARNING;
9725 }
9726
9727 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9728 return CMD_SUCCESS;
9729}
9730
9731DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
9732 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009733 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009734 NO_STR
9735 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009736 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009737 "Route map reference\n"
9738 "Pointer to route-map entries\n"
9739 "Metric for redistributed routes\n"
9740 "Default metric\n")
9741{
9742 int type;
9743
David Lampartere0ca5fd2009-09-16 01:52:42 +02009744 type = proto_redistnum (AFI_IP6, argv[0]);
9745 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009746 {
9747 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9748 return CMD_WARNING;
9749 }
9750
9751 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9752 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9753 return CMD_SUCCESS;
9754}
9755
9756ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9757 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009758 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009759 NO_STR
9760 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009761 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009762 "Metric for redistributed routes\n"
9763 "Default metric\n"
9764 "Route map reference\n"
9765 "Pointer to route-map entries\n")
9766#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02009767
paul718e3742002-12-13 20:15:29 +00009768int
9769bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9770 safi_t safi, int *write)
9771{
9772 int i;
paul718e3742002-12-13 20:15:29 +00009773
9774 /* Unicast redistribution only. */
9775 if (safi != SAFI_UNICAST)
9776 return 0;
9777
9778 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9779 {
9780 /* Redistribute BGP does not make sense. */
9781 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9782 {
9783 /* Display "address-family" when it is not yet diplayed. */
9784 bgp_config_write_family_header (vty, afi, safi, write);
9785
9786 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009787 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009788
9789 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009790 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009791
9792 if (bgp->rmap[afi][i].name)
9793 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9794
9795 vty_out (vty, "%s", VTY_NEWLINE);
9796 }
9797 }
9798 return *write;
9799}
David Lamparter6b0655a2014-06-04 06:53:35 +02009800
paul718e3742002-12-13 20:15:29 +00009801/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009802static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009803{
9804 BGP_NODE,
9805 "%s(config-router)# ",
9806 1,
9807};
9808
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009809static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009810{
9811 BGP_IPV4_NODE,
9812 "%s(config-router-af)# ",
9813 1,
9814};
9815
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009816static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009817{
9818 BGP_IPV4M_NODE,
9819 "%s(config-router-af)# ",
9820 1,
9821};
9822
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009823static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009824{
9825 BGP_IPV6_NODE,
9826 "%s(config-router-af)# ",
9827 1,
9828};
9829
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009830static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009831{
9832 BGP_IPV6M_NODE,
9833 "%s(config-router-af)# ",
9834 1,
9835};
9836
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009837static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009838{
9839 BGP_VPNV4_NODE,
9840 "%s(config-router-af)# ",
9841 1
9842};
David Lamparter6b0655a2014-06-04 06:53:35 +02009843
Lou Berger13c378d2016-01-12 13:41:56 -05009844static struct cmd_node bgp_vpnv6_node =
9845{
9846 BGP_VPNV6_NODE,
9847 "%s(config-router-af-vpnv6)# ",
9848 1
9849};
9850
Lou Bergera3fda882016-01-12 13:42:04 -05009851static struct cmd_node bgp_encap_node =
9852{
9853 BGP_ENCAP_NODE,
9854 "%s(config-router-af-encap)# ",
9855 1
9856};
9857
9858static struct cmd_node bgp_encapv6_node =
9859{
9860 BGP_ENCAPV6_NODE,
9861 "%s(config-router-af-encapv6)# ",
9862 1
9863};
9864
paul1f8ae702005-09-09 23:49:49 +00009865static void community_list_vty (void);
9866
paul718e3742002-12-13 20:15:29 +00009867void
paul94f2b392005-06-28 12:44:16 +00009868bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009869{
paul718e3742002-12-13 20:15:29 +00009870 /* Install bgp top node. */
9871 install_node (&bgp_node, bgp_config_write);
9872 install_node (&bgp_ipv4_unicast_node, NULL);
9873 install_node (&bgp_ipv4_multicast_node, NULL);
9874 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009875 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009876 install_node (&bgp_vpnv4_node, NULL);
Lou Berger13c378d2016-01-12 13:41:56 -05009877 install_node (&bgp_vpnv6_node, NULL);
Lou Bergera3fda882016-01-12 13:42:04 -05009878 install_node (&bgp_encap_node, NULL);
9879 install_node (&bgp_encapv6_node, NULL);
paul718e3742002-12-13 20:15:29 +00009880
9881 /* Install default VTY commands to new nodes. */
9882 install_default (BGP_NODE);
9883 install_default (BGP_IPV4_NODE);
9884 install_default (BGP_IPV4M_NODE);
9885 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009886 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009887 install_default (BGP_VPNV4_NODE);
Lou Berger13c378d2016-01-12 13:41:56 -05009888 install_default (BGP_VPNV6_NODE);
Lou Bergera3fda882016-01-12 13:42:04 -05009889 install_default (BGP_ENCAP_NODE);
9890 install_default (BGP_ENCAPV6_NODE);
paul718e3742002-12-13 20:15:29 +00009891
9892 /* "bgp multiple-instance" commands. */
9893 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9894 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9895
9896 /* "bgp config-type" commands. */
9897 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9898 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9899
9900 /* Dummy commands (Currently not supported) */
9901 install_element (BGP_NODE, &no_synchronization_cmd);
9902 install_element (BGP_NODE, &no_auto_summary_cmd);
9903
9904 /* "router bgp" commands. */
9905 install_element (CONFIG_NODE, &router_bgp_cmd);
9906 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9907
9908 /* "no router bgp" commands. */
9909 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9910 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9911
9912 /* "bgp router-id" commands. */
9913 install_element (BGP_NODE, &bgp_router_id_cmd);
9914 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9915 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9916
9917 /* "bgp cluster-id" commands. */
9918 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9919 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9920 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9921 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9922
9923 /* "bgp confederation" commands. */
9924 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9925 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9926 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9927
9928 /* "bgp confederation peers" commands. */
9929 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9930 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9931
Josh Bailey165b5ff2011-07-20 20:43:22 -07009932 /* "maximum-paths" commands. */
9933 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9934 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9935 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9936 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9937 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9938 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
9939 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9940 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9941 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9942 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9943 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9944 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9945
paul718e3742002-12-13 20:15:29 +00009946 /* "timers bgp" commands. */
9947 install_element (BGP_NODE, &bgp_timers_cmd);
9948 install_element (BGP_NODE, &no_bgp_timers_cmd);
9949 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9950
9951 /* "bgp client-to-client reflection" commands */
9952 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9953 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9954
9955 /* "bgp always-compare-med" commands */
9956 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9957 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9958
9959 /* "bgp deterministic-med" commands */
9960 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9961 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009962
hasso538621f2004-05-21 09:31:30 +00009963 /* "bgp graceful-restart" commands */
9964 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9965 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009966 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9967 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9968 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009969
9970 /* "bgp fast-external-failover" commands */
9971 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9972 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9973
9974 /* "bgp enforce-first-as" commands */
9975 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9976 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9977
9978 /* "bgp bestpath compare-routerid" commands */
9979 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9980 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9981
9982 /* "bgp bestpath as-path ignore" commands */
9983 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9984 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9985
hasso68118452005-04-08 15:40:36 +00009986 /* "bgp bestpath as-path confed" commands */
9987 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9988 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9989
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00009990 /* "bgp bestpath as-path multipath-relax" commands */
9991 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9992 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9993
paul848973c2003-08-13 00:32:49 +00009994 /* "bgp log-neighbor-changes" commands */
9995 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9996 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9997
paul718e3742002-12-13 20:15:29 +00009998 /* "bgp bestpath med" commands */
9999 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
10000 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
10001 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
10002 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
10003 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
10004 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
10005
10006 /* "no bgp default ipv4-unicast" commands. */
10007 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
10008 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
10009
10010 /* "bgp network import-check" commands. */
10011 install_element (BGP_NODE, &bgp_network_import_check_cmd);
10012 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
10013
10014 /* "bgp default local-preference" commands. */
10015 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
10016 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
10017 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
10018
10019 /* "neighbor remote-as" commands. */
10020 install_element (BGP_NODE, &neighbor_remote_as_cmd);
10021 install_element (BGP_NODE, &no_neighbor_cmd);
10022 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
10023
10024 /* "neighbor peer-group" commands. */
10025 install_element (BGP_NODE, &neighbor_peer_group_cmd);
10026 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
10027 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
10028
10029 /* "neighbor local-as" commands. */
10030 install_element (BGP_NODE, &neighbor_local_as_cmd);
10031 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +000010032 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +000010033 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
10034 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
10035 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +000010036 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +000010037
Paul Jakma0df7c912008-07-21 21:02:49 +000010038 /* "neighbor password" commands. */
10039 install_element (BGP_NODE, &neighbor_password_cmd);
10040 install_element (BGP_NODE, &no_neighbor_password_cmd);
10041
paul718e3742002-12-13 20:15:29 +000010042 /* "neighbor activate" commands. */
10043 install_element (BGP_NODE, &neighbor_activate_cmd);
10044 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
10045 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
10046 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010047 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010048 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010049 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010050 install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd);
10051 install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010052
10053 /* "no neighbor activate" commands. */
10054 install_element (BGP_NODE, &no_neighbor_activate_cmd);
10055 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
10056 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
10057 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010058 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010059 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010060 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010061 install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd);
10062 install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010063
10064 /* "neighbor peer-group set" commands. */
10065 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
10066 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
10067 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
10068 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010069 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010070 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010071 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010072 install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd);
10073 install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010074
paul718e3742002-12-13 20:15:29 +000010075 /* "no neighbor peer-group unset" commands. */
10076 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
10077 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
10078 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
10079 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010080 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010081 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010082 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010083 install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd);
10084 install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010085
paul718e3742002-12-13 20:15:29 +000010086 /* "neighbor softreconfiguration inbound" commands.*/
10087 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
10088 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10089 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
10090 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
10091 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
10092 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
10093 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10094 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010095 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
10096 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +000010097 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
10098 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010099 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
10100 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010101 install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd);
10102 install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10103 install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10104 install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +000010105
10106 /* "neighbor attribute-unchanged" commands. */
10107 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
10108 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
10109 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
10110 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
10111 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
10112 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
10113 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
10114 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
10115 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
10116 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
10117 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
10118 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
10119 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
10120 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
10121 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
10122 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
10123 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
10124 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
10125 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
10126 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
10127 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
10128 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
10129 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
10130 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
10131 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
10132 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
10133 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
10134 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
10135 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
10136 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
10137 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
10138 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
10139 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
10140 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
10141 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10142 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10143 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10144 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10145 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10146 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10147 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10148 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10149 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10150 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10151 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
10152 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
10153 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
10154 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
10155 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
10156 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
10157 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
10158 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
10159 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
10160 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
10161 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
10162 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
10163 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
10164 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
10165 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
10166 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
10167 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
10168 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
10169 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
10170 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
10171 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
10172 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
10173 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
10174 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
10175 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
10176 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
10177 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
10178 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
10179 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
10180 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
10181 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
10182 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
10183 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
10184 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10185 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10186 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10187 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10188 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10189 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10190 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10191 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10192 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10193 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10194 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010195 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
10196 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
10197 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
10198 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
10199 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
10200 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
10201 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
10202 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
10203 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
10204 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
10205 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
10206 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
10207 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
10208 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
10209 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
10210 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
10211 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
10212 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
10213 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
10214 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
10215 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
10216 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +000010217 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
10218 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
10219 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
10220 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
10221 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
10222 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
10223 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
10224 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
10225 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
10226 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
10227 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
10228 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
10229 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10230 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10231 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10232 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10233 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10234 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10235 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10236 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10237 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10238 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10239
Lou Berger13c378d2016-01-12 13:41:56 -050010240 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
10241 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
10242 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
10243 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
10244 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
10245 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
10246 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
10247 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
10248 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
10249 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
10250 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
10251 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
10252 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10253 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10254 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10255 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10256 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10257 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10258 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10259 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10260 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10261 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10262
Lou Bergera3fda882016-01-12 13:42:04 -050010263 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd);
10264 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd);
10265 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd);
10266 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd);
10267 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd);
10268 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd);
10269 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd);
10270 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd);
10271 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd);
10272 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd);
10273 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd);
10274 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd);
10275 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd);
10276 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd);
10277 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd);
10278 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd);
10279 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd);
10280 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd);
10281 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd);
10282 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd);
10283 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd);
10284 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd);
10285
10286 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd);
10287 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd);
10288 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd);
10289 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd);
10290 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd);
10291 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd);
10292 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd);
10293 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd);
10294 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd);
10295 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd);
10296 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd);
10297 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10298 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10299 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10300 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10301 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10302 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10303 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10304 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10305 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10306 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10307 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10308
paulfee0f4c2004-09-13 05:12:46 +000010309 /* "nexthop-local unchanged" commands */
10310 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
10311 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
10312
paul718e3742002-12-13 20:15:29 +000010313 /* "transparent-as" and "transparent-nexthop" for old version
10314 compatibility. */
10315 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
10316 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
10317
10318 /* "neighbor next-hop-self" commands. */
10319 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
10320 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
10321 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
10322 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
10323 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
10324 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
10325 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
10326 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010327 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
10328 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010329 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
10330 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010331 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
10332 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010333 install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd);
10334 install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd);
10335 install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd);
10336 install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010337
10338 /* "neighbor remove-private-AS" commands. */
10339 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
10340 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
10341 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
10342 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
10343 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
10344 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
10345 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
10346 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010347 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
10348 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010349 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
10350 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010351 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
10352 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010353 install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd);
10354 install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd);
10355 install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd);
10356 install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010357
10358 /* "neighbor send-community" commands.*/
10359 install_element (BGP_NODE, &neighbor_send_community_cmd);
10360 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
10361 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
10362 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
10363 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
10364 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
10365 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
10366 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
10367 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
10368 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
10369 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
10370 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
10371 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
10372 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
10373 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
10374 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010375 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
10376 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
10377 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
10378 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010379 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
10380 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
10381 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
10382 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010383 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
10384 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
10385 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
10386 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010387 install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd);
10388 install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd);
10389 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd);
10390 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd);
10391 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd);
10392 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd);
10393 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd);
10394 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010395
10396 /* "neighbor route-reflector" commands.*/
10397 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
10398 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
10399 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
10400 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
10401 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
10402 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
10403 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
10404 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010405 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
10406 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010407 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
10408 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010409 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
10410 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010411 install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd);
10412 install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd);
10413 install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd);
10414 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010415
10416 /* "neighbor route-server" commands.*/
10417 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
10418 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
10419 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
10420 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
10421 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
10422 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
10423 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
10424 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010425 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
10426 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010427 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
10428 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010429 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
10430 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010431 install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd);
10432 install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd);
10433 install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd);
10434 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010435
10436 /* "neighbor passive" commands. */
10437 install_element (BGP_NODE, &neighbor_passive_cmd);
10438 install_element (BGP_NODE, &no_neighbor_passive_cmd);
10439
10440 /* "neighbor shutdown" commands. */
10441 install_element (BGP_NODE, &neighbor_shutdown_cmd);
10442 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
10443
hassoc9502432005-02-01 22:01:48 +000010444 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +000010445 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
10446 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
10447
10448 /* "neighbor capability orf prefix-list" commands.*/
10449 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
10450 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
10451 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
10452 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
10453 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
10454 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
10455 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
10456 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010457 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
10458 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +000010459
10460 /* "neighbor capability dynamic" commands.*/
10461 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
10462 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
10463
10464 /* "neighbor dont-capability-negotiate" commands. */
10465 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
10466 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
10467
10468 /* "neighbor ebgp-multihop" commands. */
10469 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
10470 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
10471 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
10472 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
10473
hasso6ffd2072005-02-02 14:50:11 +000010474 /* "neighbor disable-connected-check" commands. */
10475 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
10476 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +000010477 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
10478 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
10479
10480 /* "neighbor description" commands. */
10481 install_element (BGP_NODE, &neighbor_description_cmd);
10482 install_element (BGP_NODE, &no_neighbor_description_cmd);
10483 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
10484
10485 /* "neighbor update-source" commands. "*/
10486 install_element (BGP_NODE, &neighbor_update_source_cmd);
10487 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
10488
10489 /* "neighbor default-originate" commands. */
10490 install_element (BGP_NODE, &neighbor_default_originate_cmd);
10491 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
10492 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
10493 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
10494 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
10495 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
10496 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
10497 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
10498 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
10499 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
10500 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
10501 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
10502 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
10503 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
10504 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
10505 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010506 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
10507 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
10508 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
10509 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000010510
10511 /* "neighbor port" commands. */
10512 install_element (BGP_NODE, &neighbor_port_cmd);
10513 install_element (BGP_NODE, &no_neighbor_port_cmd);
10514 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
10515
10516 /* "neighbor weight" commands. */
10517 install_element (BGP_NODE, &neighbor_weight_cmd);
10518 install_element (BGP_NODE, &no_neighbor_weight_cmd);
10519 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
10520
10521 /* "neighbor override-capability" commands. */
10522 install_element (BGP_NODE, &neighbor_override_capability_cmd);
10523 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
10524
10525 /* "neighbor strict-capability-match" commands. */
10526 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
10527 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
10528
10529 /* "neighbor timers" commands. */
10530 install_element (BGP_NODE, &neighbor_timers_cmd);
10531 install_element (BGP_NODE, &no_neighbor_timers_cmd);
10532
10533 /* "neighbor timers connect" commands. */
10534 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
10535 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
10536 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
10537
10538 /* "neighbor advertisement-interval" commands. */
10539 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
10540 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
10541 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
10542
10543 /* "neighbor version" commands. */
10544 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +000010545
10546 /* "neighbor interface" commands. */
10547 install_element (BGP_NODE, &neighbor_interface_cmd);
10548 install_element (BGP_NODE, &no_neighbor_interface_cmd);
10549
10550 /* "neighbor distribute" commands. */
10551 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
10552 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
10553 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
10554 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
10555 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
10556 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
10557 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
10558 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010559 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
10560 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010561 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
10562 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010563 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
10564 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010565 install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd);
10566 install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd);
10567 install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd);
10568 install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010569
10570 /* "neighbor prefix-list" commands. */
10571 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
10572 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
10573 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
10574 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
10575 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
10576 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
10577 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
10578 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010579 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
10580 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010581 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
10582 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010583 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
10584 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010585 install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd);
10586 install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd);
10587 install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd);
10588 install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010589
10590 /* "neighbor filter-list" commands. */
10591 install_element (BGP_NODE, &neighbor_filter_list_cmd);
10592 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
10593 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
10594 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
10595 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
10596 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
10597 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
10598 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010599 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
10600 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010601 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
10602 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010603 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
10604 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010605 install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd);
10606 install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd);
10607 install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd);
10608 install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010609
10610 /* "neighbor route-map" commands. */
10611 install_element (BGP_NODE, &neighbor_route_map_cmd);
10612 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
10613 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
10614 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
10615 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
10616 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
10617 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
10618 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010619 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
10620 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010621 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
10622 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010623 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
10624 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010625 install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd);
10626 install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd);
10627 install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd);
10628 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010629
10630 /* "neighbor unsuppress-map" commands. */
10631 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
10632 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
10633 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
10634 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
10635 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
10636 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
10637 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
10638 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010639 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
10640 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +000010641 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010642 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010643 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010644 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010645 install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd);
10646 install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd);
10647 install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd);
10648 install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +000010649
10650 /* "neighbor maximum-prefix" commands. */
10651 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010652 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010653 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010654 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010655 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
10656 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010657 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
10658 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010659 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10660 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10661 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10662 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10663 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010664 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010665 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010666 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010667 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010668 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10669 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010670 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
10671 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010672 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10673 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10674 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10675 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10676 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010677 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010678 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010679 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010680 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010681 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
10682 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010683 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
10684 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010685 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10686 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10687 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10688 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10689 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010690 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010691 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010692 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010693 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010694 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10695 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010696 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10697 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010698 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10699 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10700 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10701 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10702 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010703 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
10704 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
10705 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
10706 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10707 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
10708 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10709 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
10710 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
10711 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10712 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10713 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10714 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10715 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010716 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010717 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010718 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010719 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010720 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10721 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010722 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
10723 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010724 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10725 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10726 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10727 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10728 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010729
Lou Berger13c378d2016-01-12 13:41:56 -050010730 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
10731 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10732 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10733 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10734 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10735 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10736 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
10737 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10738 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10739 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10740 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10741 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10742 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10743
Lou Bergera3fda882016-01-12 13:42:04 -050010744 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd);
10745 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd);
10746 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd);
10747 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10748 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd);
10749 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10750 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd);
10751 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd);
10752 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10753 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10754 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10755 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10756 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10757
10758 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd);
10759 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10760 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10761 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10762 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10763 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10764 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10765 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10766 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10767 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10768 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10769 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10770 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10771
paul718e3742002-12-13 20:15:29 +000010772 /* "neighbor allowas-in" */
10773 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
10774 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
10775 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
10776 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
10777 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
10778 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
10779 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
10780 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
10781 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
10782 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
10783 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
10784 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010785 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
10786 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
10787 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010788 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
10789 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
10790 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010791 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
10792 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
10793 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010794 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd);
10795 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd);
10796 install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd);
10797 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd);
10798 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd);
10799 install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010800
10801 /* address-family commands. */
10802 install_element (BGP_NODE, &address_family_ipv4_cmd);
10803 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
10804#ifdef HAVE_IPV6
10805 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010806 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010807#endif /* HAVE_IPV6 */
10808 install_element (BGP_NODE, &address_family_vpnv4_cmd);
10809 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
10810
Lou Berger13c378d2016-01-12 13:41:56 -050010811 install_element (BGP_NODE, &address_family_vpnv6_cmd);
10812 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
10813
Lou Bergera3fda882016-01-12 13:42:04 -050010814 install_element (BGP_NODE, &address_family_encap_cmd);
10815 install_element (BGP_NODE, &address_family_encapv4_cmd);
10816#ifdef HAVE_IPV6
10817 install_element (BGP_NODE, &address_family_encapv6_cmd);
10818#endif
10819
paul718e3742002-12-13 20:15:29 +000010820 /* "exit-address-family" command. */
10821 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
10822 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
10823 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010824 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010825 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010826 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010827 install_element (BGP_ENCAP_NODE, &exit_address_family_cmd);
10828 install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010829
10830 /* "clear ip bgp commands" */
10831 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
10832 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
10833 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
10834 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
10835 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
10836 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
10837#ifdef HAVE_IPV6
10838 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
10839 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
10840 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
10841 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
10842 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
10843 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
10844 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
10845 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
10846 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
10847 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
10848 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
10849#endif /* HAVE_IPV6 */
10850
10851 /* "clear ip bgp neighbor soft in" */
10852 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
10853 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
10854 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
10855 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
10856 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
10857 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
10858 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
10859 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
10860 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
10861 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
10862 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
10863 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
10864 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
10865 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
10866 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
10867 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
10868 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
10869 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
10870 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
10871 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
10872 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
10873 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
10874 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
10875 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
10876 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
10877 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
10878 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
10879 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
10880 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
10881 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
10882 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
10883 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
10884 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
10885 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
10886 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
10887 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
10888 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
10889 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
10890 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
10891 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010892 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
10893 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
10894 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
10895 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
10896 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
10897 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
paul718e3742002-12-13 20:15:29 +000010898#ifdef HAVE_IPV6
10899 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
10900 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
10901 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
10902 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
10903 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
10904 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
10905 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
10906 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
10907 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
10908 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
10909 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
10910 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
10911 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
10912 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
10913 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
10914 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
10915 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
10916 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
10917 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
10918 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
10919 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
10920 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
10921 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
10922 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
10923 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
10924 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
10925 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
10926 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
10927 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
10928 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
10929 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
10930#endif /* HAVE_IPV6 */
10931
10932 /* "clear ip bgp neighbor soft out" */
10933 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
10934 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
10935 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
10936 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
10937 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
10938 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
10939 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
10940 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
10941 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
10942 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
10943 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
10944 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
10945 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
10946 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
10947 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
10948 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
10949 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
10950 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
10951 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
10952 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
10953 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
10954 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
10955 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
10956 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
10957 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
10958 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
10959 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
10960 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010961 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
10962 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
10963 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
10964 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
10965 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
10966 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
paul718e3742002-12-13 20:15:29 +000010967#ifdef HAVE_IPV6
10968 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
10969 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
10970 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
10971 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
10972 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
10973 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
10974 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
10975 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
10976 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
10977 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
10978 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
10979 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
10980 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
10981 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
10982 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
10983 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
10984 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
10985 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
10986 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
10987 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
10988 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
10989#endif /* HAVE_IPV6 */
10990
10991 /* "clear ip bgp neighbor soft" */
10992 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
10993 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
10994 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
10995 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
10996 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
10997 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
10998 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
10999 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
11000 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
11001 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
11002 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
11003 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
11004 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
11005 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
11006 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050011007 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
11008 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
11009 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
paul718e3742002-12-13 20:15:29 +000011010#ifdef HAVE_IPV6
11011 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
11012 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
11013 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
11014 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
11015 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
11016 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
11017 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
11018 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
11019 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
11020 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
11021 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
11022#endif /* HAVE_IPV6 */
11023
paulfee0f4c2004-09-13 05:12:46 +000011024 /* "clear ip bgp neighbor rsclient" */
11025 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
11026 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
11027 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
11028 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
11029#ifdef HAVE_IPV6
11030 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
11031 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
11032 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
11033 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
11034 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
11035 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
11036 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
11037 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
11038#endif /* HAVE_IPV6 */
11039
paul718e3742002-12-13 20:15:29 +000011040 /* "show ip bgp summary" commands. */
paul718e3742002-12-13 20:15:29 +000011041 install_element (VIEW_NODE, &show_bgp_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011042 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
11043 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
11044
11045 install_element (VIEW_NODE, &show_bgp_summary_1w_cmd);
11046 install_element (RESTRICTED_NODE, &show_bgp_summary_1w_cmd);
11047 install_element (ENABLE_NODE, &show_bgp_summary_1w_cmd);
11048
11049 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
11050 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
11051 install_element (VIEW_NODE, &show_bgp_instance_ipv4_summary_cmd);
11052
11053 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_summary_cmd);
11054 install_element (VIEW_NODE, &show_bgp_ipv4_encap_summary_cmd);
11055#ifdef HAVE_IPV6
11056 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11057 install_element (VIEW_NODE, &show_bgp_ipv6_encap_summary_cmd);
11058#endif
11059
paul718e3742002-12-13 20:15:29 +000011060 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011061#ifdef HAVE_IPV6
Michael Lambert95cbbd22010-07-23 14:43:04 -040011062 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011063 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011064 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011065#endif /* HAVE_IPV6 */
Michael Lambert95cbbd22010-07-23 14:43:04 -040011066 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011067 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011068 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011069
11070 install_element (RESTRICTED_NODE, &show_bgp_ipv4_vpn_summary_cmd);
11071 install_element (RESTRICTED_NODE, &show_bgp_ipv4_encap_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011072#ifdef HAVE_IPV6
Lou Berger651b4022016-01-12 13:42:07 -050011073 install_element (RESTRICTED_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11074 install_element (RESTRICTED_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011075#endif
11076
Paul Jakma62687ff2008-08-23 14:27:06 +010011077 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011078#ifdef HAVE_IPV6
Michael Lambert95cbbd22010-07-23 14:43:04 -040011079 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011080 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011081 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011082#endif /* HAVE_IPV6 */
Michael Lambert95cbbd22010-07-23 14:43:04 -040011083 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011084 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011085 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011086
11087 install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_summary_cmd);
11088 install_element (ENABLE_NODE, &show_bgp_ipv4_encap_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011089#ifdef HAVE_IPV6
Lou Berger651b4022016-01-12 13:42:07 -050011090 install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11091 install_element (ENABLE_NODE, &show_bgp_ipv6_encap_summary_cmd);
11092#endif
11093
paul718e3742002-12-13 20:15:29 +000011094 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011095#ifdef HAVE_IPV6
Michael Lambert95cbbd22010-07-23 14:43:04 -040011096 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011097 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011098 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011099#endif /* HAVE_IPV6 */
11100
11101 /* "show ip bgp neighbors" commands. */
paulbb46e942003-10-24 19:02:03 +000011102 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
paulbb46e942003-10-24 19:02:03 +000011103 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011104
11105 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
11106 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
11107 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
11108 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
11109 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
11110 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
11111 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000011112 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011113#ifdef HAVE_IPV6
11114 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
11115 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
11116 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
11117 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
paulbb46e942003-10-24 19:02:03 +000011118 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000011119
paul718e3742002-12-13 20:15:29 +000011120#endif /* HAVE_IPV6 */
11121
paulfee0f4c2004-09-13 05:12:46 +000011122 /* "show ip bgp rsclient" commands. */
Michael Lambert95cbbd22010-07-23 14:43:04 -040011123 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11124 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011125 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11126 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011127 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11128 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011129
paulfee0f4c2004-09-13 05:12:46 +000011130 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011131 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011132 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
11133 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
11134 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
11135 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
11136#ifdef HAVE_IPV6
11137 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011138 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011139 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11140 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011141 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011142 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011143 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11144 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011145 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011146 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011147 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11148 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011149#endif /* HAVE_IPV6 */
11150
paul718e3742002-12-13 20:15:29 +000011151 /* "show ip bgp paths" commands. */
Lou Berger651b4022016-01-12 13:42:07 -050011152 install_element (VIEW_NODE, &show_bgp_ipv4_paths_cmd);
11153 install_element (ENABLE_NODE, &show_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011154
11155 /* "show ip bgp community" commands. */
11156 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
11157 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
11158
11159 /* "show ip bgp attribute-info" commands. */
11160 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
11161 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
11162
11163 /* "redistribute" commands. */
11164 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
11165 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
11166 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
11167 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
11168 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
11169 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
11170 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
11171 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
11172 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
11173 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
11174#ifdef HAVE_IPV6
11175 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
11176 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
11177 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
11178 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
11179 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
11180 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
11181 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
11182 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
11183 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
11184 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
11185#endif /* HAVE_IPV6 */
11186
Nick Hilliardfa411a22011-03-23 15:33:17 +000011187 /* ttl_security commands */
11188 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
11189 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
11190
Paul Jakma4bf6a362006-03-30 14:05:23 +000011191 /* "show bgp memory" commands. */
11192 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011193 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000011194 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
11195
Michael Lamberte0081f72008-11-16 20:12:04 +000011196 /* "show bgp views" commands. */
11197 install_element (VIEW_NODE, &show_bgp_views_cmd);
11198 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
11199 install_element (ENABLE_NODE, &show_bgp_views_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011200
11201 /* non afi/safi forms of commands */
11202 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
11203 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
11204 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
11205 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11206 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11207 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11208 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
11209 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
11210 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
11211 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
11212 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11213 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11214 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11215 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
11216 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
11217 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
11218 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
11219 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11220 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11221 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11222 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
11223 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
11224 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
11225 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
11226 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11227 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
11228 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
11229 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11230 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11231 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
11232 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
11233 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
11234 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11235 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11236 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11237 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
11238 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
11239 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
11240 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
11241 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11242 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
11243 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
11244 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11245 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11246 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
11247 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
11248 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
11249 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
11250 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
11251 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
11252 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
11253 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
11254 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
11255 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
11256 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
11257 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
11258 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11259 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11260 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11261 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
11262 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11263 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11264 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11265 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
11266 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11267 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11268 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11269 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
11270 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
11271 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
11272 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011273 /* Community-list. */
11274 community_list_vty ();
11275}
David Lamparter6b0655a2014-06-04 06:53:35 +020011276
paul718e3742002-12-13 20:15:29 +000011277#include "memory.h"
11278#include "bgp_regex.h"
11279#include "bgp_clist.h"
11280#include "bgp_ecommunity.h"
11281
11282/* VTY functions. */
11283
11284/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000011285static const char *
paul718e3742002-12-13 20:15:29 +000011286community_direct_str (int direct)
11287{
11288 switch (direct)
11289 {
11290 case COMMUNITY_DENY:
11291 return "deny";
paul718e3742002-12-13 20:15:29 +000011292 case COMMUNITY_PERMIT:
11293 return "permit";
paul718e3742002-12-13 20:15:29 +000011294 default:
11295 return "unknown";
paul718e3742002-12-13 20:15:29 +000011296 }
11297}
11298
11299/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000011300static void
paul718e3742002-12-13 20:15:29 +000011301community_list_perror (struct vty *vty, int ret)
11302{
11303 switch (ret)
11304 {
11305 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030011306 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011307 break;
11308 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
11309 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
11310 break;
11311 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
11312 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
11313 break;
11314 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
11315 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
11316 break;
11317 }
11318}
11319
11320/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000011321static int
paulfd79ac92004-10-13 05:06:08 +000011322community_list_set_vty (struct vty *vty, int argc, const char **argv,
11323 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011324{
11325 int ret;
11326 int direct;
11327 char *str;
11328
11329 /* Check the list type. */
11330 if (strncmp (argv[1], "p", 1) == 0)
11331 direct = COMMUNITY_PERMIT;
11332 else if (strncmp (argv[1], "d", 1) == 0)
11333 direct = COMMUNITY_DENY;
11334 else
11335 {
11336 vty_out (vty, "%% Matching condition must be permit or deny%s",
11337 VTY_NEWLINE);
11338 return CMD_WARNING;
11339 }
11340
11341 /* All digit name check. */
11342 if (reject_all_digit_name && all_digit (argv[0]))
11343 {
11344 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11345 return CMD_WARNING;
11346 }
11347
11348 /* Concat community string argument. */
11349 if (argc > 1)
11350 str = argv_concat (argv, argc, 2);
11351 else
11352 str = NULL;
11353
11354 /* When community_list_set() return nevetive value, it means
11355 malformed community string. */
11356 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
11357
11358 /* Free temporary community list string allocated by
11359 argv_concat(). */
11360 if (str)
11361 XFREE (MTYPE_TMP, str);
11362
11363 if (ret < 0)
11364 {
11365 /* Display error string. */
11366 community_list_perror (vty, ret);
11367 return CMD_WARNING;
11368 }
11369
11370 return CMD_SUCCESS;
11371}
11372
paul718e3742002-12-13 20:15:29 +000011373/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000011374static int
hassofee6e4e2005-02-02 16:29:31 +000011375community_list_unset_vty (struct vty *vty, int argc, const char **argv,
11376 int style)
paul718e3742002-12-13 20:15:29 +000011377{
11378 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011379 int direct = 0;
11380 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011381
hassofee6e4e2005-02-02 16:29:31 +000011382 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011383 {
hassofee6e4e2005-02-02 16:29:31 +000011384 /* Check the list direct. */
11385 if (strncmp (argv[1], "p", 1) == 0)
11386 direct = COMMUNITY_PERMIT;
11387 else if (strncmp (argv[1], "d", 1) == 0)
11388 direct = COMMUNITY_DENY;
11389 else
11390 {
11391 vty_out (vty, "%% Matching condition must be permit or deny%s",
11392 VTY_NEWLINE);
11393 return CMD_WARNING;
11394 }
paul718e3742002-12-13 20:15:29 +000011395
hassofee6e4e2005-02-02 16:29:31 +000011396 /* Concat community string argument. */
11397 str = argv_concat (argv, argc, 2);
11398 }
paul718e3742002-12-13 20:15:29 +000011399
11400 /* Unset community list. */
11401 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
11402
11403 /* Free temporary community list string allocated by
11404 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011405 if (str)
11406 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011407
11408 if (ret < 0)
11409 {
11410 community_list_perror (vty, ret);
11411 return CMD_WARNING;
11412 }
11413
11414 return CMD_SUCCESS;
11415}
11416
11417/* "community-list" keyword help string. */
11418#define COMMUNITY_LIST_STR "Add a community list entry\n"
11419#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
11420
paul718e3742002-12-13 20:15:29 +000011421DEFUN (ip_community_list_standard,
11422 ip_community_list_standard_cmd,
11423 "ip community-list <1-99> (deny|permit) .AA:NN",
11424 IP_STR
11425 COMMUNITY_LIST_STR
11426 "Community list number (standard)\n"
11427 "Specify community to reject\n"
11428 "Specify community to accept\n"
11429 COMMUNITY_VAL_STR)
11430{
11431 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
11432}
11433
11434ALIAS (ip_community_list_standard,
11435 ip_community_list_standard2_cmd,
11436 "ip community-list <1-99> (deny|permit)",
11437 IP_STR
11438 COMMUNITY_LIST_STR
11439 "Community list number (standard)\n"
11440 "Specify community to reject\n"
11441 "Specify community to accept\n")
11442
11443DEFUN (ip_community_list_expanded,
11444 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011445 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011446 IP_STR
11447 COMMUNITY_LIST_STR
11448 "Community list number (expanded)\n"
11449 "Specify community to reject\n"
11450 "Specify community to accept\n"
11451 "An ordered list as a regular-expression\n")
11452{
11453 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
11454}
11455
11456DEFUN (ip_community_list_name_standard,
11457 ip_community_list_name_standard_cmd,
11458 "ip community-list standard WORD (deny|permit) .AA:NN",
11459 IP_STR
11460 COMMUNITY_LIST_STR
11461 "Add a standard community-list entry\n"
11462 "Community list name\n"
11463 "Specify community to reject\n"
11464 "Specify community to accept\n"
11465 COMMUNITY_VAL_STR)
11466{
11467 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
11468}
11469
11470ALIAS (ip_community_list_name_standard,
11471 ip_community_list_name_standard2_cmd,
11472 "ip community-list standard WORD (deny|permit)",
11473 IP_STR
11474 COMMUNITY_LIST_STR
11475 "Add a standard community-list entry\n"
11476 "Community list name\n"
11477 "Specify community to reject\n"
11478 "Specify community to accept\n")
11479
11480DEFUN (ip_community_list_name_expanded,
11481 ip_community_list_name_expanded_cmd,
11482 "ip community-list expanded WORD (deny|permit) .LINE",
11483 IP_STR
11484 COMMUNITY_LIST_STR
11485 "Add an expanded community-list entry\n"
11486 "Community list name\n"
11487 "Specify community to reject\n"
11488 "Specify community to accept\n"
11489 "An ordered list as a regular-expression\n")
11490{
11491 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
11492}
11493
hassofee6e4e2005-02-02 16:29:31 +000011494DEFUN (no_ip_community_list_standard_all,
11495 no_ip_community_list_standard_all_cmd,
11496 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011497 NO_STR
11498 IP_STR
11499 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011500 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011501{
hassofee6e4e2005-02-02 16:29:31 +000011502 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011503}
11504
hassofee6e4e2005-02-02 16:29:31 +000011505DEFUN (no_ip_community_list_expanded_all,
11506 no_ip_community_list_expanded_all_cmd,
11507 "no ip community-list <100-500>",
11508 NO_STR
11509 IP_STR
11510 COMMUNITY_LIST_STR
11511 "Community list number (expanded)\n")
11512{
11513 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11514}
11515
11516DEFUN (no_ip_community_list_name_standard_all,
11517 no_ip_community_list_name_standard_all_cmd,
11518 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011519 NO_STR
11520 IP_STR
11521 COMMUNITY_LIST_STR
11522 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000011523 "Community list name\n")
11524{
hassofee6e4e2005-02-02 16:29:31 +000011525 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011526}
11527
hassofee6e4e2005-02-02 16:29:31 +000011528DEFUN (no_ip_community_list_name_expanded_all,
11529 no_ip_community_list_name_expanded_all_cmd,
11530 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000011531 NO_STR
11532 IP_STR
11533 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011534 "Add an expanded community-list entry\n"
11535 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000011536{
hassofee6e4e2005-02-02 16:29:31 +000011537 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011538}
11539
11540DEFUN (no_ip_community_list_standard,
11541 no_ip_community_list_standard_cmd,
11542 "no ip community-list <1-99> (deny|permit) .AA:NN",
11543 NO_STR
11544 IP_STR
11545 COMMUNITY_LIST_STR
11546 "Community list number (standard)\n"
11547 "Specify community to reject\n"
11548 "Specify community to accept\n"
11549 COMMUNITY_VAL_STR)
11550{
11551 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11552}
11553
11554DEFUN (no_ip_community_list_expanded,
11555 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011556 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011557 NO_STR
11558 IP_STR
11559 COMMUNITY_LIST_STR
11560 "Community list number (expanded)\n"
11561 "Specify community to reject\n"
11562 "Specify community to accept\n"
11563 "An ordered list as a regular-expression\n")
11564{
11565 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11566}
11567
11568DEFUN (no_ip_community_list_name_standard,
11569 no_ip_community_list_name_standard_cmd,
11570 "no ip community-list standard WORD (deny|permit) .AA:NN",
11571 NO_STR
11572 IP_STR
11573 COMMUNITY_LIST_STR
11574 "Specify a standard community-list\n"
11575 "Community list name\n"
11576 "Specify community to reject\n"
11577 "Specify community to accept\n"
11578 COMMUNITY_VAL_STR)
11579{
11580 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11581}
11582
11583DEFUN (no_ip_community_list_name_expanded,
11584 no_ip_community_list_name_expanded_cmd,
11585 "no ip community-list expanded WORD (deny|permit) .LINE",
11586 NO_STR
11587 IP_STR
11588 COMMUNITY_LIST_STR
11589 "Specify an expanded community-list\n"
11590 "Community list name\n"
11591 "Specify community to reject\n"
11592 "Specify community to accept\n"
11593 "An ordered list as a regular-expression\n")
11594{
11595 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11596}
11597
paul94f2b392005-06-28 12:44:16 +000011598static void
paul718e3742002-12-13 20:15:29 +000011599community_list_show (struct vty *vty, struct community_list *list)
11600{
11601 struct community_entry *entry;
11602
11603 for (entry = list->head; entry; entry = entry->next)
11604 {
11605 if (entry == list->head)
11606 {
11607 if (all_digit (list->name))
11608 vty_out (vty, "Community %s list %s%s",
11609 entry->style == COMMUNITY_LIST_STANDARD ?
11610 "standard" : "(expanded) access",
11611 list->name, VTY_NEWLINE);
11612 else
11613 vty_out (vty, "Named Community %s list %s%s",
11614 entry->style == COMMUNITY_LIST_STANDARD ?
11615 "standard" : "expanded",
11616 list->name, VTY_NEWLINE);
11617 }
11618 if (entry->any)
11619 vty_out (vty, " %s%s",
11620 community_direct_str (entry->direct), VTY_NEWLINE);
11621 else
11622 vty_out (vty, " %s %s%s",
11623 community_direct_str (entry->direct),
11624 entry->style == COMMUNITY_LIST_STANDARD
11625 ? community_str (entry->u.com) : entry->config,
11626 VTY_NEWLINE);
11627 }
11628}
11629
11630DEFUN (show_ip_community_list,
11631 show_ip_community_list_cmd,
11632 "show ip community-list",
11633 SHOW_STR
11634 IP_STR
11635 "List community-list\n")
11636{
11637 struct community_list *list;
11638 struct community_list_master *cm;
11639
hassofee6e4e2005-02-02 16:29:31 +000011640 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011641 if (! cm)
11642 return CMD_SUCCESS;
11643
11644 for (list = cm->num.head; list; list = list->next)
11645 community_list_show (vty, list);
11646
11647 for (list = cm->str.head; list; list = list->next)
11648 community_list_show (vty, list);
11649
11650 return CMD_SUCCESS;
11651}
11652
11653DEFUN (show_ip_community_list_arg,
11654 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011655 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011656 SHOW_STR
11657 IP_STR
11658 "List community-list\n"
11659 "Community-list number\n"
11660 "Community-list name\n")
11661{
11662 struct community_list *list;
11663
hassofee6e4e2005-02-02 16:29:31 +000011664 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011665 if (! list)
11666 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011667 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011668 return CMD_WARNING;
11669 }
11670
11671 community_list_show (vty, list);
11672
11673 return CMD_SUCCESS;
11674}
David Lamparter6b0655a2014-06-04 06:53:35 +020011675
paul94f2b392005-06-28 12:44:16 +000011676static int
paulfd79ac92004-10-13 05:06:08 +000011677extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
11678 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011679{
11680 int ret;
11681 int direct;
11682 char *str;
11683
11684 /* Check the list type. */
11685 if (strncmp (argv[1], "p", 1) == 0)
11686 direct = COMMUNITY_PERMIT;
11687 else if (strncmp (argv[1], "d", 1) == 0)
11688 direct = COMMUNITY_DENY;
11689 else
11690 {
11691 vty_out (vty, "%% Matching condition must be permit or deny%s",
11692 VTY_NEWLINE);
11693 return CMD_WARNING;
11694 }
11695
11696 /* All digit name check. */
11697 if (reject_all_digit_name && all_digit (argv[0]))
11698 {
11699 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11700 return CMD_WARNING;
11701 }
11702
11703 /* Concat community string argument. */
11704 if (argc > 1)
11705 str = argv_concat (argv, argc, 2);
11706 else
11707 str = NULL;
11708
11709 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
11710
11711 /* Free temporary community list string allocated by
11712 argv_concat(). */
11713 if (str)
11714 XFREE (MTYPE_TMP, str);
11715
11716 if (ret < 0)
11717 {
11718 community_list_perror (vty, ret);
11719 return CMD_WARNING;
11720 }
11721 return CMD_SUCCESS;
11722}
11723
paul94f2b392005-06-28 12:44:16 +000011724static int
hassofee6e4e2005-02-02 16:29:31 +000011725extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
11726 int style)
paul718e3742002-12-13 20:15:29 +000011727{
11728 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011729 int direct = 0;
11730 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011731
hassofee6e4e2005-02-02 16:29:31 +000011732 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011733 {
hassofee6e4e2005-02-02 16:29:31 +000011734 /* Check the list direct. */
11735 if (strncmp (argv[1], "p", 1) == 0)
11736 direct = COMMUNITY_PERMIT;
11737 else if (strncmp (argv[1], "d", 1) == 0)
11738 direct = COMMUNITY_DENY;
11739 else
11740 {
11741 vty_out (vty, "%% Matching condition must be permit or deny%s",
11742 VTY_NEWLINE);
11743 return CMD_WARNING;
11744 }
11745
11746 /* Concat community string argument. */
11747 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000011748 }
paul718e3742002-12-13 20:15:29 +000011749
11750 /* Unset community list. */
11751 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
11752
11753 /* Free temporary community list string allocated by
11754 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011755 if (str)
11756 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011757
11758 if (ret < 0)
11759 {
11760 community_list_perror (vty, ret);
11761 return CMD_WARNING;
11762 }
11763
11764 return CMD_SUCCESS;
11765}
11766
11767/* "extcommunity-list" keyword help string. */
11768#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
11769#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
11770
11771DEFUN (ip_extcommunity_list_standard,
11772 ip_extcommunity_list_standard_cmd,
11773 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11774 IP_STR
11775 EXTCOMMUNITY_LIST_STR
11776 "Extended Community list number (standard)\n"
11777 "Specify community to reject\n"
11778 "Specify community to accept\n"
11779 EXTCOMMUNITY_VAL_STR)
11780{
11781 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
11782}
11783
11784ALIAS (ip_extcommunity_list_standard,
11785 ip_extcommunity_list_standard2_cmd,
11786 "ip extcommunity-list <1-99> (deny|permit)",
11787 IP_STR
11788 EXTCOMMUNITY_LIST_STR
11789 "Extended Community list number (standard)\n"
11790 "Specify community to reject\n"
11791 "Specify community to accept\n")
11792
11793DEFUN (ip_extcommunity_list_expanded,
11794 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011795 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011796 IP_STR
11797 EXTCOMMUNITY_LIST_STR
11798 "Extended Community list number (expanded)\n"
11799 "Specify community to reject\n"
11800 "Specify community to accept\n"
11801 "An ordered list as a regular-expression\n")
11802{
11803 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
11804}
11805
11806DEFUN (ip_extcommunity_list_name_standard,
11807 ip_extcommunity_list_name_standard_cmd,
11808 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11809 IP_STR
11810 EXTCOMMUNITY_LIST_STR
11811 "Specify standard extcommunity-list\n"
11812 "Extended Community list name\n"
11813 "Specify community to reject\n"
11814 "Specify community to accept\n"
11815 EXTCOMMUNITY_VAL_STR)
11816{
11817 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
11818}
11819
11820ALIAS (ip_extcommunity_list_name_standard,
11821 ip_extcommunity_list_name_standard2_cmd,
11822 "ip extcommunity-list standard WORD (deny|permit)",
11823 IP_STR
11824 EXTCOMMUNITY_LIST_STR
11825 "Specify standard extcommunity-list\n"
11826 "Extended Community list name\n"
11827 "Specify community to reject\n"
11828 "Specify community to accept\n")
11829
11830DEFUN (ip_extcommunity_list_name_expanded,
11831 ip_extcommunity_list_name_expanded_cmd,
11832 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
11833 IP_STR
11834 EXTCOMMUNITY_LIST_STR
11835 "Specify expanded extcommunity-list\n"
11836 "Extended Community list name\n"
11837 "Specify community to reject\n"
11838 "Specify community to accept\n"
11839 "An ordered list as a regular-expression\n")
11840{
11841 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
11842}
11843
hassofee6e4e2005-02-02 16:29:31 +000011844DEFUN (no_ip_extcommunity_list_standard_all,
11845 no_ip_extcommunity_list_standard_all_cmd,
11846 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011847 NO_STR
11848 IP_STR
11849 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011850 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011851{
hassofee6e4e2005-02-02 16:29:31 +000011852 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011853}
11854
hassofee6e4e2005-02-02 16:29:31 +000011855DEFUN (no_ip_extcommunity_list_expanded_all,
11856 no_ip_extcommunity_list_expanded_all_cmd,
11857 "no ip extcommunity-list <100-500>",
11858 NO_STR
11859 IP_STR
11860 EXTCOMMUNITY_LIST_STR
11861 "Extended Community list number (expanded)\n")
11862{
11863 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11864}
11865
11866DEFUN (no_ip_extcommunity_list_name_standard_all,
11867 no_ip_extcommunity_list_name_standard_all_cmd,
11868 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011869 NO_STR
11870 IP_STR
11871 EXTCOMMUNITY_LIST_STR
11872 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000011873 "Extended Community list name\n")
11874{
11875 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11876}
11877
11878DEFUN (no_ip_extcommunity_list_name_expanded_all,
11879 no_ip_extcommunity_list_name_expanded_all_cmd,
11880 "no ip extcommunity-list expanded WORD",
11881 NO_STR
11882 IP_STR
11883 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000011884 "Specify expanded extcommunity-list\n"
11885 "Extended Community list name\n")
11886{
hassofee6e4e2005-02-02 16:29:31 +000011887 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011888}
11889
11890DEFUN (no_ip_extcommunity_list_standard,
11891 no_ip_extcommunity_list_standard_cmd,
11892 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11893 NO_STR
11894 IP_STR
11895 EXTCOMMUNITY_LIST_STR
11896 "Extended Community list number (standard)\n"
11897 "Specify community to reject\n"
11898 "Specify community to accept\n"
11899 EXTCOMMUNITY_VAL_STR)
11900{
11901 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11902}
11903
11904DEFUN (no_ip_extcommunity_list_expanded,
11905 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011906 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011907 NO_STR
11908 IP_STR
11909 EXTCOMMUNITY_LIST_STR
11910 "Extended Community list number (expanded)\n"
11911 "Specify community to reject\n"
11912 "Specify community to accept\n"
11913 "An ordered list as a regular-expression\n")
11914{
11915 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11916}
11917
11918DEFUN (no_ip_extcommunity_list_name_standard,
11919 no_ip_extcommunity_list_name_standard_cmd,
11920 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11921 NO_STR
11922 IP_STR
11923 EXTCOMMUNITY_LIST_STR
11924 "Specify standard extcommunity-list\n"
11925 "Extended Community list name\n"
11926 "Specify community to reject\n"
11927 "Specify community to accept\n"
11928 EXTCOMMUNITY_VAL_STR)
11929{
11930 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11931}
11932
11933DEFUN (no_ip_extcommunity_list_name_expanded,
11934 no_ip_extcommunity_list_name_expanded_cmd,
11935 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
11936 NO_STR
11937 IP_STR
11938 EXTCOMMUNITY_LIST_STR
11939 "Specify expanded extcommunity-list\n"
11940 "Community list name\n"
11941 "Specify community to reject\n"
11942 "Specify community to accept\n"
11943 "An ordered list as a regular-expression\n")
11944{
11945 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11946}
11947
paul94f2b392005-06-28 12:44:16 +000011948static void
paul718e3742002-12-13 20:15:29 +000011949extcommunity_list_show (struct vty *vty, struct community_list *list)
11950{
11951 struct community_entry *entry;
11952
11953 for (entry = list->head; entry; entry = entry->next)
11954 {
11955 if (entry == list->head)
11956 {
11957 if (all_digit (list->name))
11958 vty_out (vty, "Extended community %s list %s%s",
11959 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11960 "standard" : "(expanded) access",
11961 list->name, VTY_NEWLINE);
11962 else
11963 vty_out (vty, "Named extended community %s list %s%s",
11964 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11965 "standard" : "expanded",
11966 list->name, VTY_NEWLINE);
11967 }
11968 if (entry->any)
11969 vty_out (vty, " %s%s",
11970 community_direct_str (entry->direct), VTY_NEWLINE);
11971 else
11972 vty_out (vty, " %s %s%s",
11973 community_direct_str (entry->direct),
11974 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11975 entry->u.ecom->str : entry->config,
11976 VTY_NEWLINE);
11977 }
11978}
11979
11980DEFUN (show_ip_extcommunity_list,
11981 show_ip_extcommunity_list_cmd,
11982 "show ip extcommunity-list",
11983 SHOW_STR
11984 IP_STR
11985 "List extended-community list\n")
11986{
11987 struct community_list *list;
11988 struct community_list_master *cm;
11989
hassofee6e4e2005-02-02 16:29:31 +000011990 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011991 if (! cm)
11992 return CMD_SUCCESS;
11993
11994 for (list = cm->num.head; list; list = list->next)
11995 extcommunity_list_show (vty, list);
11996
11997 for (list = cm->str.head; list; list = list->next)
11998 extcommunity_list_show (vty, list);
11999
12000 return CMD_SUCCESS;
12001}
12002
12003DEFUN (show_ip_extcommunity_list_arg,
12004 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000012005 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000012006 SHOW_STR
12007 IP_STR
12008 "List extended-community list\n"
12009 "Extcommunity-list number\n"
12010 "Extcommunity-list name\n")
12011{
12012 struct community_list *list;
12013
hassofee6e4e2005-02-02 16:29:31 +000012014 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000012015 if (! list)
12016 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030012017 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000012018 return CMD_WARNING;
12019 }
12020
12021 extcommunity_list_show (vty, list);
12022
12023 return CMD_SUCCESS;
12024}
David Lamparter6b0655a2014-06-04 06:53:35 +020012025
paul718e3742002-12-13 20:15:29 +000012026/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000012027static const char *
paul718e3742002-12-13 20:15:29 +000012028community_list_config_str (struct community_entry *entry)
12029{
paulfd79ac92004-10-13 05:06:08 +000012030 const char *str;
paul718e3742002-12-13 20:15:29 +000012031
12032 if (entry->any)
12033 str = "";
12034 else
12035 {
12036 if (entry->style == COMMUNITY_LIST_STANDARD)
12037 str = community_str (entry->u.com);
12038 else
12039 str = entry->config;
12040 }
12041 return str;
12042}
12043
12044/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000012045static int
paul718e3742002-12-13 20:15:29 +000012046community_list_config_write (struct vty *vty)
12047{
12048 struct community_list *list;
12049 struct community_entry *entry;
12050 struct community_list_master *cm;
12051 int write = 0;
12052
12053 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000012054 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000012055
12056 for (list = cm->num.head; list; list = list->next)
12057 for (entry = list->head; entry; entry = entry->next)
12058 {
hassofee6e4e2005-02-02 16:29:31 +000012059 vty_out (vty, "ip community-list %s %s %s%s",
12060 list->name, community_direct_str (entry->direct),
12061 community_list_config_str (entry),
12062 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000012063 write++;
12064 }
12065 for (list = cm->str.head; list; list = list->next)
12066 for (entry = list->head; entry; entry = entry->next)
12067 {
12068 vty_out (vty, "ip community-list %s %s %s %s%s",
12069 entry->style == COMMUNITY_LIST_STANDARD
12070 ? "standard" : "expanded",
12071 list->name, community_direct_str (entry->direct),
12072 community_list_config_str (entry),
12073 VTY_NEWLINE);
12074 write++;
12075 }
12076
12077 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000012078 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000012079
12080 for (list = cm->num.head; list; list = list->next)
12081 for (entry = list->head; entry; entry = entry->next)
12082 {
hassofee6e4e2005-02-02 16:29:31 +000012083 vty_out (vty, "ip extcommunity-list %s %s %s%s",
12084 list->name, community_direct_str (entry->direct),
12085 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000012086 write++;
12087 }
12088 for (list = cm->str.head; list; list = list->next)
12089 for (entry = list->head; entry; entry = entry->next)
12090 {
12091 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
12092 entry->style == EXTCOMMUNITY_LIST_STANDARD
12093 ? "standard" : "expanded",
12094 list->name, community_direct_str (entry->direct),
12095 community_list_config_str (entry), VTY_NEWLINE);
12096 write++;
12097 }
12098 return write;
12099}
12100
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080012101static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000012102{
12103 COMMUNITY_LIST_NODE,
12104 "",
12105 1 /* Export to vtysh. */
12106};
12107
paul94f2b392005-06-28 12:44:16 +000012108static void
12109community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000012110{
12111 install_node (&community_list_node, community_list_config_write);
12112
12113 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000012114 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
12115 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
12116 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
12117 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
12118 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
12119 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012120 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
12121 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
12122 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
12123 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012124 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
12125 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
12126 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
12127 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
12128 install_element (VIEW_NODE, &show_ip_community_list_cmd);
12129 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
12130 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
12131 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
12132
12133 /* Extcommunity-list. */
12134 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
12135 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
12136 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
12137 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
12138 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
12139 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012140 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
12141 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
12142 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
12143 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012144 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
12145 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
12146 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
12147 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
12148 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
12149 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
12150 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
12151 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
12152}