blob: 9f09016a9e238c393d9bf20e146443c06c8548a1 [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
54/* Utility function to get address family from current node. */
55afi_t
56bgp_node_afi (struct vty *vty)
57{
Lou Berger135ca152016-01-12 13:42:05 -050058 afi_t afi;
Lou Berger13c378d2016-01-12 13:41:56 -050059 switch (vty->node)
60 {
61 case BGP_IPV6_NODE:
62 case BGP_IPV6M_NODE:
63 case BGP_VPNV6_NODE:
Lou Bergera3fda882016-01-12 13:42:04 -050064 case BGP_ENCAPV6_NODE:
Lou Berger135ca152016-01-12 13:42:05 -050065 afi = AFI_IP6;
66 break;
67 default:
68 afi = AFI_IP;
Lou Berger13c378d2016-01-12 13:41:56 -050069 break;
70 }
Lou Berger135ca152016-01-12 13:42:05 -050071 return afi;
paul718e3742002-12-13 20:15:29 +000072}
73
74/* Utility function to get subsequent address family from current
75 node. */
76safi_t
77bgp_node_safi (struct vty *vty)
78{
Lou Berger135ca152016-01-12 13:42:05 -050079 safi_t safi;
80 switch (vty->node)
81 {
82 case BGP_ENCAP_NODE:
83 case BGP_ENCAPV6_NODE:
84 safi = SAFI_ENCAP;
85 break;
86 case BGP_VPNV4_NODE:
87 case BGP_VPNV6_NODE:
88 safi = SAFI_MPLS_VPN;
89 break;
90 case BGP_IPV4M_NODE:
91 case BGP_IPV6M_NODE:
92 safi = SAFI_MULTICAST;
93 break;
94 default:
95 safi = SAFI_UNICAST;
96 break;
97 }
98 return safi;
paul718e3742002-12-13 20:15:29 +000099}
100
Lou Bergera3fda882016-01-12 13:42:04 -0500101int
102bgp_parse_afi(const char *str, afi_t *afi)
103{
104 if (!strcmp(str, "ipv4")) {
105 *afi = AFI_IP;
106 return 0;
107 }
Lou Bergera3fda882016-01-12 13:42:04 -0500108 if (!strcmp(str, "ipv6")) {
109 *afi = AFI_IP6;
110 return 0;
111 }
Lou Bergera3fda882016-01-12 13:42:04 -0500112 return -1;
113}
114
115int
116bgp_parse_safi(const char *str, safi_t *safi)
117{
118 if (!strcmp(str, "encap")) {
119 *safi = SAFI_ENCAP;
120 return 0;
121 }
122 if (!strcmp(str, "multicast")) {
123 *safi = SAFI_MULTICAST;
124 return 0;
125 }
126 if (!strcmp(str, "unicast")) {
127 *safi = SAFI_UNICAST;
128 return 0;
129 }
130 if (!strcmp(str, "vpn")) {
131 *safi = SAFI_MPLS_VPN;
132 return 0;
133 }
134 return -1;
135}
136
paul94f2b392005-06-28 12:44:16 +0000137static int
paul718e3742002-12-13 20:15:29 +0000138peer_address_self_check (union sockunion *su)
139{
140 struct interface *ifp = NULL;
141
142 if (su->sa.sa_family == AF_INET)
143 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
paul718e3742002-12-13 20:15:29 +0000144 else if (su->sa.sa_family == AF_INET6)
145 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
paul718e3742002-12-13 20:15:29 +0000146
147 if (ifp)
148 return 1;
149
150 return 0;
151}
152
153/* Utility function for looking up peer from VTY. */
paul94f2b392005-06-28 12:44:16 +0000154static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000155peer_lookup_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +0000156{
157 int ret;
158 struct bgp *bgp;
159 union sockunion su;
160 struct peer *peer;
161
162 bgp = vty->index;
163
164 ret = str2sockunion (ip_str, &su);
165 if (ret < 0)
166 {
167 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
168 return NULL;
169 }
170
171 peer = peer_lookup (bgp, &su);
172 if (! peer)
173 {
174 vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
175 return NULL;
176 }
177 return peer;
178}
179
180/* Utility function for looking up peer or peer group. */
paul94f2b392005-06-28 12:44:16 +0000181static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000182peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
paul718e3742002-12-13 20:15:29 +0000183{
184 int ret;
185 struct bgp *bgp;
186 union sockunion su;
187 struct peer *peer;
188 struct peer_group *group;
189
190 bgp = vty->index;
191
192 ret = str2sockunion (peer_str, &su);
193 if (ret == 0)
194 {
195 peer = peer_lookup (bgp, &su);
196 if (peer)
197 return peer;
198 }
199 else
200 {
201 group = peer_group_lookup (bgp, peer_str);
202 if (group)
203 return group->conf;
204 }
205
206 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
207 VTY_NEWLINE);
208
209 return NULL;
210}
211
paul94f2b392005-06-28 12:44:16 +0000212static int
paul718e3742002-12-13 20:15:29 +0000213bgp_vty_return (struct vty *vty, int ret)
214{
paulfd79ac92004-10-13 05:06:08 +0000215 const char *str = NULL;
paul718e3742002-12-13 20:15:29 +0000216
217 switch (ret)
218 {
219 case BGP_ERR_INVALID_VALUE:
220 str = "Invalid value";
221 break;
222 case BGP_ERR_INVALID_FLAG:
223 str = "Invalid flag";
224 break;
225 case BGP_ERR_PEER_INACTIVE:
226 str = "Activate the neighbor for the address family first";
227 break;
228 case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
229 str = "Invalid command for a peer-group member";
230 break;
231 case BGP_ERR_PEER_GROUP_SHUTDOWN:
232 str = "Peer-group has been shutdown. Activate the peer-group first";
233 break;
234 case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
235 str = "This peer is a peer-group member. Please change peer-group configuration";
236 break;
237 case BGP_ERR_PEER_FLAG_CONFLICT:
238 str = "Can't set override-capability and strict-capability-match at the same time";
239 break;
240 case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
241 str = "No activate for peergroup can be given only if peer-group has no members";
242 break;
243 case BGP_ERR_PEER_BELONGS_TO_GROUP:
244 str = "No activate for an individual peer-group member is invalid";
245 break;
246 case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
247 str = "Activate the peer-group for the address family first";
248 break;
249 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
250 str = "Specify remote-as or peer-group remote AS first";
251 break;
252 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
253 str = "Cannot change the peer-group. Deconfigure first";
254 break;
255 case BGP_ERR_PEER_GROUP_MISMATCH:
256 str = "Cannot have different peer-group for the neighbor";
257 break;
258 case BGP_ERR_PEER_FILTER_CONFLICT:
259 str = "Prefix/distribute list can not co-exist";
260 break;
261 case BGP_ERR_NOT_INTERNAL_PEER:
262 str = "Invalid command. Not an internal neighbor";
263 break;
264 case BGP_ERR_REMOVE_PRIVATE_AS:
265 str = "Private AS cannot be removed for IBGP peers";
266 break;
267 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
268 str = "Local-AS allowed only for EBGP peers";
269 break;
270 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
271 str = "Cannot have local-as same as BGP AS number";
272 break;
Paul Jakma0df7c912008-07-21 21:02:49 +0000273 case BGP_ERR_TCPSIG_FAILED:
274 str = "Error while applying TCP-Sig to session(s)";
275 break;
Nick Hilliardfa411a22011-03-23 15:33:17 +0000276 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
277 str = "ebgp-multihop and ttl-security cannot be configured together";
278 break;
Stephen Hemmingerf5a48272011-03-24 17:30:21 +0000279 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
280 str = "ttl-security only allowed for EBGP peers";
281 break;
paul718e3742002-12-13 20:15:29 +0000282 }
283 if (str)
284 {
285 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
286 return CMD_WARNING;
287 }
288 return CMD_SUCCESS;
289}
290
291/* BGP global configuration. */
292
293DEFUN (bgp_multiple_instance_func,
294 bgp_multiple_instance_cmd,
295 "bgp multiple-instance",
296 BGP_STR
297 "Enable bgp multiple instance\n")
298{
299 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
300 return CMD_SUCCESS;
301}
302
303DEFUN (no_bgp_multiple_instance,
304 no_bgp_multiple_instance_cmd,
305 "no bgp multiple-instance",
306 NO_STR
307 BGP_STR
308 "BGP multiple instance\n")
309{
310 int ret;
311
312 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
313 if (ret < 0)
314 {
315 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
316 return CMD_WARNING;
317 }
318 return CMD_SUCCESS;
319}
320
321DEFUN (bgp_config_type,
322 bgp_config_type_cmd,
323 "bgp config-type (cisco|zebra)",
324 BGP_STR
325 "Configuration type\n"
326 "cisco\n"
327 "zebra\n")
328{
329 if (strncmp (argv[0], "c", 1) == 0)
330 bgp_option_set (BGP_OPT_CONFIG_CISCO);
331 else
332 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
333
334 return CMD_SUCCESS;
335}
336
337DEFUN (no_bgp_config_type,
338 no_bgp_config_type_cmd,
339 "no bgp config-type",
340 NO_STR
341 BGP_STR
342 "Display configuration type\n")
343{
344 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
345 return CMD_SUCCESS;
346}
347
348DEFUN (no_synchronization,
349 no_synchronization_cmd,
350 "no synchronization",
351 NO_STR
352 "Perform IGP synchronization\n")
353{
354 return CMD_SUCCESS;
355}
356
357DEFUN (no_auto_summary,
358 no_auto_summary_cmd,
359 "no auto-summary",
360 NO_STR
361 "Enable automatic network number summarization\n")
362{
363 return CMD_SUCCESS;
364}
hasso3d515fd2005-02-01 21:30:04 +0000365
366DEFUN_DEPRECATED (neighbor_version,
367 neighbor_version_cmd,
368 NEIGHBOR_CMD "version (4|4-)",
369 NEIGHBOR_STR
370 NEIGHBOR_ADDR_STR
371 "Set the BGP version to match a neighbor\n"
372 "Neighbor's BGP version\n")
373{
374 return CMD_SUCCESS;
375}
David Lamparter6b0655a2014-06-04 06:53:35 +0200376
paul718e3742002-12-13 20:15:29 +0000377/* "router bgp" commands. */
378DEFUN (router_bgp,
379 router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000380 "router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000381 ROUTER_STR
382 BGP_STR
383 AS_STR)
384{
385 int ret;
386 as_t as;
387 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000388 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000389
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000390 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000391
392 if (argc == 2)
393 name = argv[1];
394
395 ret = bgp_get (&bgp, &as, name);
396 switch (ret)
397 {
398 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
399 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
400 VTY_NEWLINE);
401 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000402 case BGP_ERR_AS_MISMATCH:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400403 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000404 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000405 case BGP_ERR_INSTANCE_MISMATCH:
406 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400407 vty_out (vty, "BGP instance is already running; AS is %u%s",
paul718e3742002-12-13 20:15:29 +0000408 as, VTY_NEWLINE);
409 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000410 }
411
412 vty->node = BGP_NODE;
413 vty->index = bgp;
414
415 return CMD_SUCCESS;
416}
417
418ALIAS (router_bgp,
419 router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000420 "router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000421 ROUTER_STR
422 BGP_STR
423 AS_STR
424 "BGP view\n"
425 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200426
paul718e3742002-12-13 20:15:29 +0000427/* "no router bgp" commands. */
428DEFUN (no_router_bgp,
429 no_router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000430 "no router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000431 NO_STR
432 ROUTER_STR
433 BGP_STR
434 AS_STR)
435{
436 as_t as;
437 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000438 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000439
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000440 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000441
442 if (argc == 2)
443 name = argv[1];
444
445 /* Lookup bgp structure. */
446 bgp = bgp_lookup (as, name);
447 if (! bgp)
448 {
449 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
450 return CMD_WARNING;
451 }
452
453 bgp_delete (bgp);
454
455 return CMD_SUCCESS;
456}
457
458ALIAS (no_router_bgp,
459 no_router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000460 "no router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000461 NO_STR
462 ROUTER_STR
463 BGP_STR
464 AS_STR
465 "BGP view\n"
466 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200467
paul718e3742002-12-13 20:15:29 +0000468/* BGP router-id. */
469
470DEFUN (bgp_router_id,
471 bgp_router_id_cmd,
472 "bgp router-id A.B.C.D",
473 BGP_STR
474 "Override configured router identifier\n"
475 "Manually configured router identifier\n")
476{
477 int ret;
478 struct in_addr id;
479 struct bgp *bgp;
480
481 bgp = vty->index;
482
483 ret = inet_aton (argv[0], &id);
484 if (! ret)
485 {
486 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
487 return CMD_WARNING;
488 }
489
David Lamparter584083d2016-05-24 18:58:08 +0200490 bgp_router_id_static_set (bgp, id);
paul718e3742002-12-13 20:15:29 +0000491
492 return CMD_SUCCESS;
493}
494
495DEFUN (no_bgp_router_id,
496 no_bgp_router_id_cmd,
497 "no bgp router-id",
498 NO_STR
499 BGP_STR
500 "Override configured router identifier\n")
501{
502 int ret;
503 struct in_addr id;
504 struct bgp *bgp;
505
506 bgp = vty->index;
507
508 if (argc == 1)
509 {
510 ret = inet_aton (argv[0], &id);
511 if (! ret)
512 {
513 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
514 return CMD_WARNING;
515 }
516
hasso18a6dce2004-10-03 18:18:34 +0000517 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
paul718e3742002-12-13 20:15:29 +0000518 {
519 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
520 return CMD_WARNING;
521 }
522 }
523
David Lamparter584083d2016-05-24 18:58:08 +0200524 id.s_addr = 0;
525 bgp_router_id_static_set (bgp, id);
paul718e3742002-12-13 20:15:29 +0000526
527 return CMD_SUCCESS;
528}
529
530ALIAS (no_bgp_router_id,
531 no_bgp_router_id_val_cmd,
532 "no bgp router-id A.B.C.D",
533 NO_STR
534 BGP_STR
535 "Override configured router identifier\n"
536 "Manually configured router identifier\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200537
paul718e3742002-12-13 20:15:29 +0000538/* BGP Cluster ID. */
539
540DEFUN (bgp_cluster_id,
541 bgp_cluster_id_cmd,
542 "bgp cluster-id A.B.C.D",
543 BGP_STR
544 "Configure Route-Reflector Cluster-id\n"
545 "Route-Reflector Cluster-id in IP address format\n")
546{
547 int ret;
548 struct bgp *bgp;
549 struct in_addr cluster;
550
551 bgp = vty->index;
552
553 ret = inet_aton (argv[0], &cluster);
554 if (! ret)
555 {
556 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
557 return CMD_WARNING;
558 }
559
560 bgp_cluster_id_set (bgp, &cluster);
561
562 return CMD_SUCCESS;
563}
564
565ALIAS (bgp_cluster_id,
566 bgp_cluster_id32_cmd,
567 "bgp cluster-id <1-4294967295>",
568 BGP_STR
569 "Configure Route-Reflector Cluster-id\n"
570 "Route-Reflector Cluster-id as 32 bit quantity\n")
571
572DEFUN (no_bgp_cluster_id,
573 no_bgp_cluster_id_cmd,
574 "no bgp cluster-id",
575 NO_STR
576 BGP_STR
577 "Configure Route-Reflector Cluster-id\n")
578{
579 int ret;
580 struct bgp *bgp;
581 struct in_addr cluster;
582
583 bgp = vty->index;
584
585 if (argc == 1)
586 {
587 ret = inet_aton (argv[0], &cluster);
588 if (! ret)
589 {
590 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
591 return CMD_WARNING;
592 }
593 }
594
595 bgp_cluster_id_unset (bgp);
596
597 return CMD_SUCCESS;
598}
599
600ALIAS (no_bgp_cluster_id,
601 no_bgp_cluster_id_arg_cmd,
602 "no bgp cluster-id A.B.C.D",
603 NO_STR
604 BGP_STR
605 "Configure Route-Reflector Cluster-id\n"
606 "Route-Reflector Cluster-id in IP address format\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200607
paul718e3742002-12-13 20:15:29 +0000608DEFUN (bgp_confederation_identifier,
609 bgp_confederation_identifier_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000610 "bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000611 "BGP specific commands\n"
612 "AS confederation parameters\n"
613 "AS number\n"
614 "Set routing domain confederation AS\n")
615{
616 struct bgp *bgp;
617 as_t as;
618
619 bgp = vty->index;
620
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000621 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000622
623 bgp_confederation_id_set (bgp, as);
624
625 return CMD_SUCCESS;
626}
627
628DEFUN (no_bgp_confederation_identifier,
629 no_bgp_confederation_identifier_cmd,
630 "no bgp confederation identifier",
631 NO_STR
632 "BGP specific commands\n"
633 "AS confederation parameters\n"
634 "AS number\n")
635{
636 struct bgp *bgp;
Paul Jakma7aa9dce2014-09-19 14:42:23 +0100637 as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */
paul718e3742002-12-13 20:15:29 +0000638
639 bgp = vty->index;
640
641 if (argc == 1)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000642 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000643
644 bgp_confederation_id_unset (bgp);
645
646 return CMD_SUCCESS;
647}
648
649ALIAS (no_bgp_confederation_identifier,
650 no_bgp_confederation_identifier_arg_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000651 "no bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000652 NO_STR
653 "BGP specific commands\n"
654 "AS confederation parameters\n"
655 "AS number\n"
656 "Set routing domain confederation AS\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200657
paul718e3742002-12-13 20:15:29 +0000658DEFUN (bgp_confederation_peers,
659 bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000660 "bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000661 "BGP specific commands\n"
662 "AS confederation parameters\n"
663 "Peer ASs in BGP confederation\n"
664 AS_STR)
665{
666 struct bgp *bgp;
667 as_t as;
668 int i;
669
670 bgp = vty->index;
671
672 for (i = 0; i < argc; i++)
673 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000674 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000675
676 if (bgp->as == as)
677 {
678 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
679 VTY_NEWLINE);
680 continue;
681 }
682
683 bgp_confederation_peers_add (bgp, as);
684 }
685 return CMD_SUCCESS;
686}
687
688DEFUN (no_bgp_confederation_peers,
689 no_bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000690 "no bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000691 NO_STR
692 "BGP specific commands\n"
693 "AS confederation parameters\n"
694 "Peer ASs in BGP confederation\n"
695 AS_STR)
696{
697 struct bgp *bgp;
698 as_t as;
699 int i;
700
701 bgp = vty->index;
702
703 for (i = 0; i < argc; i++)
704 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000705 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
706
paul718e3742002-12-13 20:15:29 +0000707 bgp_confederation_peers_remove (bgp, as);
708 }
709 return CMD_SUCCESS;
710}
David Lamparter6b0655a2014-06-04 06:53:35 +0200711
Josh Bailey165b5ff2011-07-20 20:43:22 -0700712/* Maximum-paths configuration */
713DEFUN (bgp_maxpaths,
714 bgp_maxpaths_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500715 "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700716 "Forward packets over multiple paths\n"
717 "Number of paths\n")
718{
719 struct bgp *bgp;
720 u_int16_t maxpaths;
721 int ret;
722
723 bgp = vty->index;
724
725 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
726
727 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
728 BGP_PEER_EBGP, maxpaths);
729 if (ret < 0)
730 {
731 vty_out (vty,
732 "%% Failed to set maximum-paths %u for afi %u, safi %u%s",
733 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
734 return CMD_WARNING;
735 }
736
737 return CMD_SUCCESS;
738}
739
740DEFUN (bgp_maxpaths_ibgp,
741 bgp_maxpaths_ibgp_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500742 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700743 "Forward packets over multiple paths\n"
744 "iBGP-multipath\n"
745 "Number of paths\n")
746{
747 struct bgp *bgp;
748 u_int16_t maxpaths;
749 int ret;
750
751 bgp = vty->index;
752
753 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
754
755 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
756 BGP_PEER_IBGP, maxpaths);
757 if (ret < 0)
758 {
759 vty_out (vty,
760 "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
761 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
762 return CMD_WARNING;
763 }
764
765 return CMD_SUCCESS;
766}
767
768DEFUN (no_bgp_maxpaths,
769 no_bgp_maxpaths_cmd,
770 "no maximum-paths",
771 NO_STR
772 "Forward packets over multiple paths\n"
773 "Number of paths\n")
774{
775 struct bgp *bgp;
776 int ret;
777
778 bgp = vty->index;
779
780 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
781 BGP_PEER_EBGP);
782 if (ret < 0)
783 {
784 vty_out (vty,
785 "%% Failed to unset maximum-paths for afi %u, safi %u%s",
786 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
787 return CMD_WARNING;
788 }
789
790 return CMD_SUCCESS;
791}
792
793ALIAS (no_bgp_maxpaths,
794 no_bgp_maxpaths_arg_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500795 "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700796 NO_STR
797 "Forward packets over multiple paths\n"
798 "Number of paths\n")
799
800DEFUN (no_bgp_maxpaths_ibgp,
801 no_bgp_maxpaths_ibgp_cmd,
802 "no maximum-paths ibgp",
803 NO_STR
804 "Forward packets over multiple paths\n"
805 "iBGP-multipath\n"
806 "Number of paths\n")
807{
808 struct bgp *bgp;
809 int ret;
810
811 bgp = vty->index;
812
813 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
814 BGP_PEER_IBGP);
815 if (ret < 0)
816 {
817 vty_out (vty,
818 "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
819 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
820 return CMD_WARNING;
821 }
822
823 return CMD_SUCCESS;
824}
825
826ALIAS (no_bgp_maxpaths_ibgp,
827 no_bgp_maxpaths_ibgp_arg_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500828 "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700829 NO_STR
830 "Forward packets over multiple paths\n"
831 "iBGP-multipath\n"
832 "Number of paths\n")
833
834int
835bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
836 safi_t safi, int *write)
837{
838 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
839 {
840 bgp_config_write_family_header (vty, afi, safi, write);
841 vty_out (vty, " maximum-paths %d%s",
842 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
843 }
844
845 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
846 {
847 bgp_config_write_family_header (vty, afi, safi, write);
848 vty_out (vty, " maximum-paths ibgp %d%s",
849 bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
850 }
851
852 return 0;
853}
David Lamparter6b0655a2014-06-04 06:53:35 +0200854
paul718e3742002-12-13 20:15:29 +0000855/* BGP timers. */
856
857DEFUN (bgp_timers,
858 bgp_timers_cmd,
859 "timers bgp <0-65535> <0-65535>",
860 "Adjust routing timers\n"
861 "BGP timers\n"
862 "Keepalive interval\n"
863 "Holdtime\n")
864{
865 struct bgp *bgp;
866 unsigned long keepalive = 0;
867 unsigned long holdtime = 0;
868
869 bgp = vty->index;
870
871 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
872 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
873
874 /* Holdtime value check. */
875 if (holdtime < 3 && holdtime != 0)
876 {
877 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
878 VTY_NEWLINE);
879 return CMD_WARNING;
880 }
881
882 bgp_timers_set (bgp, keepalive, holdtime);
883
884 return CMD_SUCCESS;
885}
886
887DEFUN (no_bgp_timers,
888 no_bgp_timers_cmd,
889 "no timers bgp",
890 NO_STR
891 "Adjust routing timers\n"
892 "BGP timers\n")
893{
894 struct bgp *bgp;
895
896 bgp = vty->index;
897 bgp_timers_unset (bgp);
898
899 return CMD_SUCCESS;
900}
901
902ALIAS (no_bgp_timers,
903 no_bgp_timers_arg_cmd,
904 "no timers bgp <0-65535> <0-65535>",
905 NO_STR
906 "Adjust routing timers\n"
907 "BGP timers\n"
908 "Keepalive interval\n"
909 "Holdtime\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200910
paul718e3742002-12-13 20:15:29 +0000911DEFUN (bgp_client_to_client_reflection,
912 bgp_client_to_client_reflection_cmd,
913 "bgp client-to-client reflection",
914 "BGP specific commands\n"
915 "Configure client to client route reflection\n"
916 "reflection of routes allowed\n")
917{
918 struct bgp *bgp;
919
920 bgp = vty->index;
921 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
922 return CMD_SUCCESS;
923}
924
925DEFUN (no_bgp_client_to_client_reflection,
926 no_bgp_client_to_client_reflection_cmd,
927 "no bgp client-to-client reflection",
928 NO_STR
929 "BGP specific commands\n"
930 "Configure client to client route reflection\n"
931 "reflection of routes allowed\n")
932{
933 struct bgp *bgp;
934
935 bgp = vty->index;
936 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
937 return CMD_SUCCESS;
938}
939
940/* "bgp always-compare-med" configuration. */
941DEFUN (bgp_always_compare_med,
942 bgp_always_compare_med_cmd,
943 "bgp always-compare-med",
944 "BGP specific commands\n"
945 "Allow comparing MED from different neighbors\n")
946{
947 struct bgp *bgp;
948
949 bgp = vty->index;
950 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
951 return CMD_SUCCESS;
952}
953
954DEFUN (no_bgp_always_compare_med,
955 no_bgp_always_compare_med_cmd,
956 "no bgp always-compare-med",
957 NO_STR
958 "BGP specific commands\n"
959 "Allow comparing MED from different neighbors\n")
960{
961 struct bgp *bgp;
962
963 bgp = vty->index;
964 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
965 return CMD_SUCCESS;
966}
David Lamparter6b0655a2014-06-04 06:53:35 +0200967
paul718e3742002-12-13 20:15:29 +0000968/* "bgp deterministic-med" configuration. */
969DEFUN (bgp_deterministic_med,
970 bgp_deterministic_med_cmd,
971 "bgp deterministic-med",
972 "BGP specific commands\n"
973 "Pick the best-MED path among paths advertised from the neighboring AS\n")
974{
975 struct bgp *bgp;
976
977 bgp = vty->index;
978 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
979 return CMD_SUCCESS;
980}
981
982DEFUN (no_bgp_deterministic_med,
983 no_bgp_deterministic_med_cmd,
984 "no bgp deterministic-med",
985 NO_STR
986 "BGP specific commands\n"
987 "Pick the best-MED path among paths advertised from the neighboring AS\n")
988{
989 struct bgp *bgp;
990
991 bgp = vty->index;
992 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
993 return CMD_SUCCESS;
994}
hasso538621f2004-05-21 09:31:30 +0000995
996/* "bgp graceful-restart" configuration. */
997DEFUN (bgp_graceful_restart,
998 bgp_graceful_restart_cmd,
999 "bgp graceful-restart",
1000 "BGP specific commands\n"
1001 "Graceful restart capability parameters\n")
1002{
1003 struct bgp *bgp;
1004
1005 bgp = vty->index;
1006 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
1007 return CMD_SUCCESS;
1008}
1009
1010DEFUN (no_bgp_graceful_restart,
1011 no_bgp_graceful_restart_cmd,
1012 "no bgp graceful-restart",
1013 NO_STR
1014 "BGP specific commands\n"
1015 "Graceful restart capability parameters\n")
1016{
1017 struct bgp *bgp;
1018
1019 bgp = vty->index;
1020 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
1021 return CMD_SUCCESS;
1022}
1023
hasso93406d82005-02-02 14:40:33 +00001024DEFUN (bgp_graceful_restart_stalepath_time,
1025 bgp_graceful_restart_stalepath_time_cmd,
1026 "bgp graceful-restart stalepath-time <1-3600>",
1027 "BGP specific commands\n"
1028 "Graceful restart capability parameters\n"
1029 "Set the max time to hold onto restarting peer's stale paths\n"
1030 "Delay value (seconds)\n")
1031{
1032 struct bgp *bgp;
1033 u_int32_t stalepath;
1034
1035 bgp = vty->index;
1036 if (! bgp)
1037 return CMD_WARNING;
1038
1039 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
1040 bgp->stalepath_time = stalepath;
1041 return CMD_SUCCESS;
1042}
1043
Philippe Guibert4afa3dd2016-05-24 16:52:02 +02001044DEFUN (bgp_graceful_restart_restart_time,
1045 bgp_graceful_restart_restart_time_cmd,
1046 "bgp graceful-restart restart-time <1-3600>",
1047 "BGP specific commands\n"
1048 "Graceful restart capability parameters\n"
1049 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1050 "Delay value (seconds)\n")
1051{
1052 struct bgp *bgp;
1053 u_int32_t restart;
1054
1055 bgp = vty->index;
1056 if (! bgp)
1057 return CMD_WARNING;
1058
1059 VTY_GET_INTEGER_RANGE ("restart-time", restart, argv[0], 1, 3600);
1060 bgp->restart_time = restart;
1061 return CMD_SUCCESS;
1062}
1063
hasso93406d82005-02-02 14:40:33 +00001064DEFUN (no_bgp_graceful_restart_stalepath_time,
1065 no_bgp_graceful_restart_stalepath_time_cmd,
1066 "no bgp graceful-restart stalepath-time",
1067 NO_STR
1068 "BGP specific commands\n"
1069 "Graceful restart capability parameters\n"
1070 "Set the max time to hold onto restarting peer's stale paths\n")
1071{
1072 struct bgp *bgp;
1073
1074 bgp = vty->index;
1075 if (! bgp)
1076 return CMD_WARNING;
1077
1078 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1079 return CMD_SUCCESS;
1080}
1081
Philippe Guibert4afa3dd2016-05-24 16:52:02 +02001082DEFUN (no_bgp_graceful_restart_restart_time,
1083 no_bgp_graceful_restart_restart_time_cmd,
1084 "no bgp graceful-restart restart-time",
1085 NO_STR
1086 "BGP specific commands\n"
1087 "Graceful restart capability parameters\n"
1088 "Set the time to wait to delete stale routes before a BGP open message is received\n")
1089{
1090 struct bgp *bgp;
1091
1092 bgp = vty->index;
1093 if (! bgp)
1094 return CMD_WARNING;
1095
1096 bgp->restart_time = BGP_DEFAULT_RESTART_TIME;
1097 return CMD_SUCCESS;
1098}
1099
hasso93406d82005-02-02 14:40:33 +00001100ALIAS (no_bgp_graceful_restart_stalepath_time,
1101 no_bgp_graceful_restart_stalepath_time_val_cmd,
1102 "no bgp graceful-restart stalepath-time <1-3600>",
1103 NO_STR
1104 "BGP specific commands\n"
1105 "Graceful restart capability parameters\n"
1106 "Set the max time to hold onto restarting peer's stale paths\n"
1107 "Delay value (seconds)\n")
1108
Philippe Guibert4afa3dd2016-05-24 16:52:02 +02001109ALIAS (no_bgp_graceful_restart_restart_time,
1110 no_bgp_graceful_restart_restart_time_val_cmd,
1111 "no bgp graceful-restart restart-time <1-3600>",
1112 NO_STR
1113 "BGP specific commands\n"
1114 "Graceful restart capability parameters\n"
1115 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1116 "Delay value (seconds)\n")
1117
paul718e3742002-12-13 20:15:29 +00001118/* "bgp fast-external-failover" configuration. */
1119DEFUN (bgp_fast_external_failover,
1120 bgp_fast_external_failover_cmd,
1121 "bgp fast-external-failover",
1122 BGP_STR
1123 "Immediately reset session if a link to a directly connected external peer goes down\n")
1124{
1125 struct bgp *bgp;
1126
1127 bgp = vty->index;
1128 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1129 return CMD_SUCCESS;
1130}
1131
1132DEFUN (no_bgp_fast_external_failover,
1133 no_bgp_fast_external_failover_cmd,
1134 "no bgp fast-external-failover",
1135 NO_STR
1136 BGP_STR
1137 "Immediately reset session if a link to a directly connected external peer goes down\n")
1138{
1139 struct bgp *bgp;
1140
1141 bgp = vty->index;
1142 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1143 return CMD_SUCCESS;
1144}
David Lamparter6b0655a2014-06-04 06:53:35 +02001145
paul718e3742002-12-13 20:15:29 +00001146/* "bgp enforce-first-as" configuration. */
1147DEFUN (bgp_enforce_first_as,
1148 bgp_enforce_first_as_cmd,
1149 "bgp enforce-first-as",
1150 BGP_STR
1151 "Enforce the first AS for EBGP routes\n")
1152{
1153 struct bgp *bgp;
1154
1155 bgp = vty->index;
1156 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1157 return CMD_SUCCESS;
1158}
1159
1160DEFUN (no_bgp_enforce_first_as,
1161 no_bgp_enforce_first_as_cmd,
1162 "no bgp enforce-first-as",
1163 NO_STR
1164 BGP_STR
1165 "Enforce the first AS for EBGP routes\n")
1166{
1167 struct bgp *bgp;
1168
1169 bgp = vty->index;
1170 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1171 return CMD_SUCCESS;
1172}
David Lamparter6b0655a2014-06-04 06:53:35 +02001173
paul718e3742002-12-13 20:15:29 +00001174/* "bgp bestpath compare-routerid" configuration. */
1175DEFUN (bgp_bestpath_compare_router_id,
1176 bgp_bestpath_compare_router_id_cmd,
1177 "bgp bestpath compare-routerid",
1178 "BGP specific commands\n"
1179 "Change the default bestpath selection\n"
1180 "Compare router-id for identical EBGP paths\n")
1181{
1182 struct bgp *bgp;
1183
1184 bgp = vty->index;
1185 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1186 return CMD_SUCCESS;
1187}
1188
1189DEFUN (no_bgp_bestpath_compare_router_id,
1190 no_bgp_bestpath_compare_router_id_cmd,
1191 "no bgp bestpath compare-routerid",
1192 NO_STR
1193 "BGP specific commands\n"
1194 "Change the default bestpath selection\n"
1195 "Compare router-id for identical EBGP paths\n")
1196{
1197 struct bgp *bgp;
1198
1199 bgp = vty->index;
1200 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1201 return CMD_SUCCESS;
1202}
David Lamparter6b0655a2014-06-04 06:53:35 +02001203
paul718e3742002-12-13 20:15:29 +00001204/* "bgp bestpath as-path ignore" configuration. */
1205DEFUN (bgp_bestpath_aspath_ignore,
1206 bgp_bestpath_aspath_ignore_cmd,
1207 "bgp bestpath as-path ignore",
1208 "BGP specific commands\n"
1209 "Change the default bestpath selection\n"
1210 "AS-path attribute\n"
1211 "Ignore as-path length in selecting a route\n")
1212{
1213 struct bgp *bgp;
1214
1215 bgp = vty->index;
1216 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
1217 return CMD_SUCCESS;
1218}
1219
1220DEFUN (no_bgp_bestpath_aspath_ignore,
1221 no_bgp_bestpath_aspath_ignore_cmd,
1222 "no bgp bestpath as-path ignore",
1223 NO_STR
1224 "BGP specific commands\n"
1225 "Change the default bestpath selection\n"
1226 "AS-path attribute\n"
1227 "Ignore as-path length in selecting a route\n")
1228{
1229 struct bgp *bgp;
1230
1231 bgp = vty->index;
1232 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1233 return CMD_SUCCESS;
1234}
David Lamparter6b0655a2014-06-04 06:53:35 +02001235
hasso68118452005-04-08 15:40:36 +00001236/* "bgp bestpath as-path confed" configuration. */
1237DEFUN (bgp_bestpath_aspath_confed,
1238 bgp_bestpath_aspath_confed_cmd,
1239 "bgp bestpath as-path confed",
1240 "BGP specific commands\n"
1241 "Change the default bestpath selection\n"
1242 "AS-path attribute\n"
1243 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1244{
1245 struct bgp *bgp;
1246
1247 bgp = vty->index;
1248 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1249 return CMD_SUCCESS;
1250}
1251
1252DEFUN (no_bgp_bestpath_aspath_confed,
1253 no_bgp_bestpath_aspath_confed_cmd,
1254 "no bgp bestpath as-path confed",
1255 NO_STR
1256 "BGP specific commands\n"
1257 "Change the default bestpath selection\n"
1258 "AS-path attribute\n"
1259 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1260{
1261 struct bgp *bgp;
1262
1263 bgp = vty->index;
1264 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1265 return CMD_SUCCESS;
1266}
David Lamparter6b0655a2014-06-04 06:53:35 +02001267
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00001268/* "bgp bestpath as-path multipath-relax" configuration. */
1269DEFUN (bgp_bestpath_aspath_multipath_relax,
1270 bgp_bestpath_aspath_multipath_relax_cmd,
1271 "bgp bestpath as-path multipath-relax",
1272 "BGP specific commands\n"
1273 "Change the default bestpath selection\n"
1274 "AS-path attribute\n"
1275 "Allow load sharing across routes that have different AS paths (but same length)\n")
1276{
1277 struct bgp *bgp;
1278
1279 bgp = vty->index;
1280 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1281 return CMD_SUCCESS;
1282}
1283
1284DEFUN (no_bgp_bestpath_aspath_multipath_relax,
1285 no_bgp_bestpath_aspath_multipath_relax_cmd,
1286 "no bgp bestpath as-path multipath-relax",
1287 NO_STR
1288 "BGP specific commands\n"
1289 "Change the default bestpath selection\n"
1290 "AS-path attribute\n"
1291 "Allow load sharing across routes that have different AS paths (but same length)\n")
1292{
1293 struct bgp *bgp;
1294
1295 bgp = vty->index;
1296 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1297 return CMD_SUCCESS;
1298}
David Lamparter6b0655a2014-06-04 06:53:35 +02001299
paul848973c2003-08-13 00:32:49 +00001300/* "bgp log-neighbor-changes" configuration. */
1301DEFUN (bgp_log_neighbor_changes,
1302 bgp_log_neighbor_changes_cmd,
1303 "bgp log-neighbor-changes",
1304 "BGP specific commands\n"
1305 "Log neighbor up/down and reset reason\n")
1306{
1307 struct bgp *bgp;
1308
1309 bgp = vty->index;
1310 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1311 return CMD_SUCCESS;
1312}
1313
1314DEFUN (no_bgp_log_neighbor_changes,
1315 no_bgp_log_neighbor_changes_cmd,
1316 "no bgp log-neighbor-changes",
1317 NO_STR
1318 "BGP specific commands\n"
1319 "Log neighbor up/down and reset reason\n")
1320{
1321 struct bgp *bgp;
1322
1323 bgp = vty->index;
1324 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1325 return CMD_SUCCESS;
1326}
David Lamparter6b0655a2014-06-04 06:53:35 +02001327
paul718e3742002-12-13 20:15:29 +00001328/* "bgp bestpath med" configuration. */
1329DEFUN (bgp_bestpath_med,
1330 bgp_bestpath_med_cmd,
1331 "bgp bestpath med (confed|missing-as-worst)",
1332 "BGP specific commands\n"
1333 "Change the default bestpath selection\n"
1334 "MED attribute\n"
1335 "Compare MED among confederation paths\n"
1336 "Treat missing MED as the least preferred one\n")
1337{
1338 struct bgp *bgp;
1339
1340 bgp = vty->index;
1341
1342 if (strncmp (argv[0], "confed", 1) == 0)
1343 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1344 else
1345 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1346
1347 return CMD_SUCCESS;
1348}
1349
1350DEFUN (bgp_bestpath_med2,
1351 bgp_bestpath_med2_cmd,
1352 "bgp bestpath med confed missing-as-worst",
1353 "BGP specific commands\n"
1354 "Change the default bestpath selection\n"
1355 "MED attribute\n"
1356 "Compare MED among confederation paths\n"
1357 "Treat missing MED as the least preferred one\n")
1358{
1359 struct bgp *bgp;
1360
1361 bgp = vty->index;
1362 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1363 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1364 return CMD_SUCCESS;
1365}
1366
1367ALIAS (bgp_bestpath_med2,
1368 bgp_bestpath_med3_cmd,
1369 "bgp bestpath med missing-as-worst confed",
1370 "BGP specific commands\n"
1371 "Change the default bestpath selection\n"
1372 "MED attribute\n"
1373 "Treat missing MED as the least preferred one\n"
1374 "Compare MED among confederation paths\n")
1375
1376DEFUN (no_bgp_bestpath_med,
1377 no_bgp_bestpath_med_cmd,
1378 "no bgp bestpath med (confed|missing-as-worst)",
1379 NO_STR
1380 "BGP specific commands\n"
1381 "Change the default bestpath selection\n"
1382 "MED attribute\n"
1383 "Compare MED among confederation paths\n"
1384 "Treat missing MED as the least preferred one\n")
1385{
1386 struct bgp *bgp;
1387
1388 bgp = vty->index;
1389
1390 if (strncmp (argv[0], "confed", 1) == 0)
1391 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1392 else
1393 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1394
1395 return CMD_SUCCESS;
1396}
1397
1398DEFUN (no_bgp_bestpath_med2,
1399 no_bgp_bestpath_med2_cmd,
1400 "no bgp bestpath med confed missing-as-worst",
1401 NO_STR
1402 "BGP specific commands\n"
1403 "Change the default bestpath selection\n"
1404 "MED attribute\n"
1405 "Compare MED among confederation paths\n"
1406 "Treat missing MED as the least preferred one\n")
1407{
1408 struct bgp *bgp;
1409
1410 bgp = vty->index;
1411 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1412 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1413 return CMD_SUCCESS;
1414}
1415
1416ALIAS (no_bgp_bestpath_med2,
1417 no_bgp_bestpath_med3_cmd,
1418 "no bgp bestpath med missing-as-worst confed",
1419 NO_STR
1420 "BGP specific commands\n"
1421 "Change the default bestpath selection\n"
1422 "MED attribute\n"
1423 "Treat missing MED as the least preferred one\n"
1424 "Compare MED among confederation paths\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001425
paul718e3742002-12-13 20:15:29 +00001426/* "no bgp default ipv4-unicast". */
1427DEFUN (no_bgp_default_ipv4_unicast,
1428 no_bgp_default_ipv4_unicast_cmd,
1429 "no bgp default ipv4-unicast",
1430 NO_STR
1431 "BGP specific commands\n"
1432 "Configure BGP defaults\n"
1433 "Activate ipv4-unicast for a peer by default\n")
1434{
1435 struct bgp *bgp;
1436
1437 bgp = vty->index;
1438 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1439 return CMD_SUCCESS;
1440}
1441
1442DEFUN (bgp_default_ipv4_unicast,
1443 bgp_default_ipv4_unicast_cmd,
1444 "bgp default ipv4-unicast",
1445 "BGP specific commands\n"
1446 "Configure BGP defaults\n"
1447 "Activate ipv4-unicast for a peer by default\n")
1448{
1449 struct bgp *bgp;
1450
1451 bgp = vty->index;
1452 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1453 return CMD_SUCCESS;
1454}
David Lamparter6b0655a2014-06-04 06:53:35 +02001455
paul718e3742002-12-13 20:15:29 +00001456/* "bgp import-check" configuration. */
1457DEFUN (bgp_network_import_check,
1458 bgp_network_import_check_cmd,
1459 "bgp network import-check",
1460 "BGP specific commands\n"
1461 "BGP network command\n"
1462 "Check BGP network route exists in IGP\n")
1463{
1464 struct bgp *bgp;
1465
1466 bgp = vty->index;
1467 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1468 return CMD_SUCCESS;
1469}
1470
1471DEFUN (no_bgp_network_import_check,
1472 no_bgp_network_import_check_cmd,
1473 "no bgp network import-check",
1474 NO_STR
1475 "BGP specific commands\n"
1476 "BGP network command\n"
1477 "Check BGP network route exists in IGP\n")
1478{
1479 struct bgp *bgp;
1480
1481 bgp = vty->index;
1482 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1483 return CMD_SUCCESS;
1484}
David Lamparter6b0655a2014-06-04 06:53:35 +02001485
paul718e3742002-12-13 20:15:29 +00001486DEFUN (bgp_default_local_preference,
1487 bgp_default_local_preference_cmd,
1488 "bgp default local-preference <0-4294967295>",
1489 "BGP specific commands\n"
1490 "Configure BGP defaults\n"
1491 "local preference (higher=more preferred)\n"
1492 "Configure default local preference value\n")
1493{
1494 struct bgp *bgp;
1495 u_int32_t local_pref;
1496
1497 bgp = vty->index;
1498
1499 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1500
1501 bgp_default_local_preference_set (bgp, local_pref);
1502
1503 return CMD_SUCCESS;
1504}
1505
1506DEFUN (no_bgp_default_local_preference,
1507 no_bgp_default_local_preference_cmd,
1508 "no bgp default local-preference",
1509 NO_STR
1510 "BGP specific commands\n"
1511 "Configure BGP defaults\n"
1512 "local preference (higher=more preferred)\n")
1513{
1514 struct bgp *bgp;
1515
1516 bgp = vty->index;
1517 bgp_default_local_preference_unset (bgp);
1518 return CMD_SUCCESS;
1519}
1520
1521ALIAS (no_bgp_default_local_preference,
1522 no_bgp_default_local_preference_val_cmd,
1523 "no bgp default local-preference <0-4294967295>",
1524 NO_STR
1525 "BGP specific commands\n"
1526 "Configure BGP defaults\n"
1527 "local preference (higher=more preferred)\n"
1528 "Configure default local preference value\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001529
Dinesh Dutt083e5e22015-11-09 20:21:54 -05001530static void
1531peer_announce_routes_if_rmap_out (struct bgp *bgp)
1532{
1533 struct peer *peer;
1534 struct listnode *node, *nnode;
1535 struct bgp_filter *filter;
1536 afi_t afi;
1537 safi_t safi;
1538
1539 /* Reannounce all routes to appropriate neighbors */
1540 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
1541 {
1542 for (afi = AFI_IP; afi < AFI_MAX; afi++)
1543 for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
1544 {
1545 if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
1546 {
1547 /* check if there's an out route-map on this client */
1548 filter = &peer->filter[afi][safi];
1549 if (ROUTE_MAP_OUT_NAME(filter))
1550 {
1551 if (BGP_DEBUG(update, UPDATE_OUT))
1552 zlog_debug("%s: Announcing routes again for peer %s"
1553 "(afi=%d, safi=%d", __func__, peer->host, afi,
1554 safi);
1555
1556 bgp_announce_route_all(peer);
1557 }
1558 }
1559 }
1560 }
1561}
1562
1563DEFUN (bgp_rr_allow_outbound_policy,
1564 bgp_rr_allow_outbound_policy_cmd,
1565 "bgp route-reflector allow-outbound-policy",
1566 "BGP specific commands\n"
1567 "Allow modifications made by out route-map\n"
1568 "on ibgp neighbors\n")
1569{
1570 struct bgp *bgp;
1571
1572 bgp = vty->index;
1573
1574 if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))
1575 {
1576 bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
1577 peer_announce_routes_if_rmap_out(bgp);
1578 }
1579
1580 return CMD_SUCCESS;
1581}
1582
1583DEFUN (no_bgp_rr_allow_outbound_policy,
1584 no_bgp_rr_allow_outbound_policy_cmd,
1585 "no bgp route-reflector allow-outbound-policy",
1586 NO_STR
1587 "BGP specific commands\n"
1588 "Allow modifications made by out route-map\n"
1589 "on ibgp neighbors\n")
1590{
1591 struct bgp *bgp;
1592
1593 bgp = vty->index;
1594
1595 if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))
1596 {
1597 bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
1598 peer_announce_routes_if_rmap_out(bgp);
1599 }
1600
1601 return CMD_SUCCESS;
1602}
1603
paul718e3742002-12-13 20:15:29 +00001604static int
paulfd79ac92004-10-13 05:06:08 +00001605peer_remote_as_vty (struct vty *vty, const char *peer_str,
1606 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001607{
1608 int ret;
1609 struct bgp *bgp;
1610 as_t as;
1611 union sockunion su;
1612
1613 bgp = vty->index;
1614
1615 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001616 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001617
1618 /* If peer is peer group, call proper function. */
1619 ret = str2sockunion (peer_str, &su);
1620 if (ret < 0)
1621 {
1622 ret = peer_group_remote_as (bgp, peer_str, &as);
1623 if (ret < 0)
1624 {
1625 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1626 return CMD_WARNING;
1627 }
1628 return CMD_SUCCESS;
1629 }
1630
1631 if (peer_address_self_check (&su))
1632 {
1633 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1634 VTY_NEWLINE);
1635 return CMD_WARNING;
1636 }
1637
1638 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1639
1640 /* This peer belongs to peer group. */
1641 switch (ret)
1642 {
1643 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001644 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001645 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001646 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001647 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 +00001648 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001649 }
1650 return bgp_vty_return (vty, ret);
1651}
1652
1653DEFUN (neighbor_remote_as,
1654 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001655 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001656 NEIGHBOR_STR
1657 NEIGHBOR_ADDR_STR2
1658 "Specify a BGP neighbor\n"
1659 AS_STR)
1660{
1661 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1662}
David Lamparter6b0655a2014-06-04 06:53:35 +02001663
paul718e3742002-12-13 20:15:29 +00001664DEFUN (neighbor_peer_group,
1665 neighbor_peer_group_cmd,
1666 "neighbor WORD peer-group",
1667 NEIGHBOR_STR
1668 "Neighbor tag\n"
1669 "Configure peer-group\n")
1670{
1671 struct bgp *bgp;
1672 struct peer_group *group;
1673
1674 bgp = vty->index;
1675
1676 group = peer_group_get (bgp, argv[0]);
1677 if (! group)
1678 return CMD_WARNING;
1679
1680 return CMD_SUCCESS;
1681}
1682
1683DEFUN (no_neighbor,
1684 no_neighbor_cmd,
1685 NO_NEIGHBOR_CMD2,
1686 NO_STR
1687 NEIGHBOR_STR
1688 NEIGHBOR_ADDR_STR2)
1689{
1690 int ret;
1691 union sockunion su;
1692 struct peer_group *group;
1693 struct peer *peer;
1694
1695 ret = str2sockunion (argv[0], &su);
1696 if (ret < 0)
1697 {
1698 group = peer_group_lookup (vty->index, argv[0]);
1699 if (group)
1700 peer_group_delete (group);
1701 else
1702 {
1703 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1704 return CMD_WARNING;
1705 }
1706 }
1707 else
1708 {
1709 peer = peer_lookup (vty->index, &su);
1710 if (peer)
paul200df112005-06-01 11:17:05 +00001711 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001712 }
1713
1714 return CMD_SUCCESS;
1715}
1716
1717ALIAS (no_neighbor,
1718 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001719 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001720 NO_STR
1721 NEIGHBOR_STR
1722 NEIGHBOR_ADDR_STR
1723 "Specify a BGP neighbor\n"
1724 AS_STR)
1725
1726DEFUN (no_neighbor_peer_group,
1727 no_neighbor_peer_group_cmd,
1728 "no neighbor WORD peer-group",
1729 NO_STR
1730 NEIGHBOR_STR
1731 "Neighbor tag\n"
1732 "Configure peer-group\n")
1733{
1734 struct peer_group *group;
1735
1736 group = peer_group_lookup (vty->index, argv[0]);
1737 if (group)
1738 peer_group_delete (group);
1739 else
1740 {
1741 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1742 return CMD_WARNING;
1743 }
1744 return CMD_SUCCESS;
1745}
1746
1747DEFUN (no_neighbor_peer_group_remote_as,
1748 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001749 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001750 NO_STR
1751 NEIGHBOR_STR
1752 "Neighbor tag\n"
1753 "Specify a BGP neighbor\n"
1754 AS_STR)
1755{
1756 struct peer_group *group;
1757
1758 group = peer_group_lookup (vty->index, argv[0]);
1759 if (group)
1760 peer_group_remote_as_delete (group);
1761 else
1762 {
1763 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1764 return CMD_WARNING;
1765 }
1766 return CMD_SUCCESS;
1767}
David Lamparter6b0655a2014-06-04 06:53:35 +02001768
paul718e3742002-12-13 20:15:29 +00001769DEFUN (neighbor_local_as,
1770 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001771 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001772 NEIGHBOR_STR
1773 NEIGHBOR_ADDR_STR2
1774 "Specify a local-as number\n"
1775 "AS number used as local AS\n")
1776{
1777 struct peer *peer;
1778 int ret;
1779
1780 peer = peer_and_group_lookup_vty (vty, argv[0]);
1781 if (! peer)
1782 return CMD_WARNING;
1783
Andrew Certain9d3f9702012-11-07 23:50:07 +00001784 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
paul718e3742002-12-13 20:15:29 +00001785 return bgp_vty_return (vty, ret);
1786}
1787
1788DEFUN (neighbor_local_as_no_prepend,
1789 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001790 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001791 NEIGHBOR_STR
1792 NEIGHBOR_ADDR_STR2
1793 "Specify a local-as number\n"
1794 "AS number used as local AS\n"
1795 "Do not prepend local-as to updates from ebgp peers\n")
1796{
1797 struct peer *peer;
1798 int ret;
1799
1800 peer = peer_and_group_lookup_vty (vty, argv[0]);
1801 if (! peer)
1802 return CMD_WARNING;
1803
Andrew Certain9d3f9702012-11-07 23:50:07 +00001804 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
paul718e3742002-12-13 20:15:29 +00001805 return bgp_vty_return (vty, ret);
1806}
1807
Andrew Certain9d3f9702012-11-07 23:50:07 +00001808DEFUN (neighbor_local_as_no_prepend_replace_as,
1809 neighbor_local_as_no_prepend_replace_as_cmd,
1810 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1811 NEIGHBOR_STR
1812 NEIGHBOR_ADDR_STR2
1813 "Specify a local-as number\n"
1814 "AS number used as local AS\n"
1815 "Do not prepend local-as to updates from ebgp peers\n"
1816 "Do not prepend local-as to updates from ibgp peers\n")
1817{
1818 struct peer *peer;
1819 int ret;
1820
1821 peer = peer_and_group_lookup_vty (vty, argv[0]);
1822 if (! peer)
1823 return CMD_WARNING;
1824
1825 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
1826 return bgp_vty_return (vty, ret);
1827}
1828
1829
paul718e3742002-12-13 20:15:29 +00001830DEFUN (no_neighbor_local_as,
1831 no_neighbor_local_as_cmd,
1832 NO_NEIGHBOR_CMD2 "local-as",
1833 NO_STR
1834 NEIGHBOR_STR
1835 NEIGHBOR_ADDR_STR2
1836 "Specify a local-as number\n")
1837{
1838 struct peer *peer;
1839 int ret;
1840
1841 peer = peer_and_group_lookup_vty (vty, argv[0]);
1842 if (! peer)
1843 return CMD_WARNING;
1844
1845 ret = peer_local_as_unset (peer);
1846 return bgp_vty_return (vty, ret);
1847}
1848
1849ALIAS (no_neighbor_local_as,
1850 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001851 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001852 NO_STR
1853 NEIGHBOR_STR
1854 NEIGHBOR_ADDR_STR2
1855 "Specify a local-as number\n"
1856 "AS number used as local AS\n")
1857
1858ALIAS (no_neighbor_local_as,
1859 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001860 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001861 NO_STR
1862 NEIGHBOR_STR
1863 NEIGHBOR_ADDR_STR2
1864 "Specify a local-as number\n"
1865 "AS number used as local AS\n"
1866 "Do not prepend local-as to updates from ebgp peers\n")
Andrew Certain9d3f9702012-11-07 23:50:07 +00001867
1868ALIAS (no_neighbor_local_as,
1869 no_neighbor_local_as_val3_cmd,
1870 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1871 NO_STR
1872 NEIGHBOR_STR
1873 NEIGHBOR_ADDR_STR2
1874 "Specify a local-as number\n"
1875 "AS number used as local AS\n"
1876 "Do not prepend local-as to updates from ebgp peers\n"
1877 "Do not prepend local-as to updates from ibgp peers\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001878
Paul Jakma0df7c912008-07-21 21:02:49 +00001879DEFUN (neighbor_password,
1880 neighbor_password_cmd,
1881 NEIGHBOR_CMD2 "password LINE",
1882 NEIGHBOR_STR
1883 NEIGHBOR_ADDR_STR2
1884 "Set a password\n"
1885 "The password\n")
1886{
1887 struct peer *peer;
1888 int ret;
1889
1890 peer = peer_and_group_lookup_vty (vty, argv[0]);
1891 if (! peer)
1892 return CMD_WARNING;
1893
1894 ret = peer_password_set (peer, argv[1]);
1895 return bgp_vty_return (vty, ret);
1896}
1897
1898DEFUN (no_neighbor_password,
1899 no_neighbor_password_cmd,
1900 NO_NEIGHBOR_CMD2 "password",
1901 NO_STR
1902 NEIGHBOR_STR
1903 NEIGHBOR_ADDR_STR2
1904 "Set a password\n")
1905{
1906 struct peer *peer;
1907 int ret;
1908
1909 peer = peer_and_group_lookup_vty (vty, argv[0]);
1910 if (! peer)
1911 return CMD_WARNING;
1912
1913 ret = peer_password_unset (peer);
1914 return bgp_vty_return (vty, ret);
1915}
David Lamparter6b0655a2014-06-04 06:53:35 +02001916
paul718e3742002-12-13 20:15:29 +00001917DEFUN (neighbor_activate,
1918 neighbor_activate_cmd,
1919 NEIGHBOR_CMD2 "activate",
1920 NEIGHBOR_STR
1921 NEIGHBOR_ADDR_STR2
1922 "Enable the Address Family for this Neighbor\n")
1923{
1924 struct peer *peer;
1925
1926 peer = peer_and_group_lookup_vty (vty, argv[0]);
1927 if (! peer)
1928 return CMD_WARNING;
1929
1930 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1931
1932 return CMD_SUCCESS;
1933}
1934
1935DEFUN (no_neighbor_activate,
1936 no_neighbor_activate_cmd,
1937 NO_NEIGHBOR_CMD2 "activate",
1938 NO_STR
1939 NEIGHBOR_STR
1940 NEIGHBOR_ADDR_STR2
1941 "Enable the Address Family for this Neighbor\n")
1942{
1943 int ret;
1944 struct peer *peer;
1945
1946 /* Lookup peer. */
1947 peer = peer_and_group_lookup_vty (vty, argv[0]);
1948 if (! peer)
1949 return CMD_WARNING;
1950
1951 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1952
1953 return bgp_vty_return (vty, ret);
1954}
David Lamparter6b0655a2014-06-04 06:53:35 +02001955
paul718e3742002-12-13 20:15:29 +00001956DEFUN (neighbor_set_peer_group,
1957 neighbor_set_peer_group_cmd,
1958 NEIGHBOR_CMD "peer-group WORD",
1959 NEIGHBOR_STR
1960 NEIGHBOR_ADDR_STR
1961 "Member of the peer-group\n"
1962 "peer-group name\n")
1963{
1964 int ret;
1965 as_t as;
1966 union sockunion su;
1967 struct bgp *bgp;
1968 struct peer_group *group;
1969
1970 bgp = vty->index;
1971
1972 ret = str2sockunion (argv[0], &su);
1973 if (ret < 0)
1974 {
1975 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1976 return CMD_WARNING;
1977 }
1978
1979 group = peer_group_lookup (bgp, argv[1]);
1980 if (! group)
1981 {
1982 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1983 return CMD_WARNING;
1984 }
1985
1986 if (peer_address_self_check (&su))
1987 {
1988 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1989 VTY_NEWLINE);
1990 return CMD_WARNING;
1991 }
1992
1993 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1994 bgp_node_safi (vty), &as);
1995
1996 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1997 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001998 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 +00001999 return CMD_WARNING;
2000 }
2001
2002 return bgp_vty_return (vty, ret);
2003}
2004
2005DEFUN (no_neighbor_set_peer_group,
2006 no_neighbor_set_peer_group_cmd,
2007 NO_NEIGHBOR_CMD "peer-group WORD",
2008 NO_STR
2009 NEIGHBOR_STR
2010 NEIGHBOR_ADDR_STR
2011 "Member of the peer-group\n"
2012 "peer-group name\n")
2013{
2014 int ret;
2015 struct bgp *bgp;
2016 struct peer *peer;
2017 struct peer_group *group;
2018
2019 bgp = vty->index;
2020
2021 peer = peer_lookup_vty (vty, argv[0]);
2022 if (! peer)
2023 return CMD_WARNING;
2024
2025 group = peer_group_lookup (bgp, argv[1]);
2026 if (! group)
2027 {
2028 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
2029 return CMD_WARNING;
2030 }
2031
2032 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
2033 bgp_node_safi (vty));
2034
2035 return bgp_vty_return (vty, ret);
2036}
David Lamparter6b0655a2014-06-04 06:53:35 +02002037
paul94f2b392005-06-28 12:44:16 +00002038static int
paulfd79ac92004-10-13 05:06:08 +00002039peer_flag_modify_vty (struct vty *vty, const char *ip_str,
2040 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002041{
2042 int ret;
2043 struct peer *peer;
2044
2045 peer = peer_and_group_lookup_vty (vty, ip_str);
2046 if (! peer)
2047 return CMD_WARNING;
2048
2049 if (set)
2050 ret = peer_flag_set (peer, flag);
2051 else
2052 ret = peer_flag_unset (peer, flag);
2053
2054 return bgp_vty_return (vty, ret);
2055}
2056
paul94f2b392005-06-28 12:44:16 +00002057static int
paulfd79ac92004-10-13 05:06:08 +00002058peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00002059{
2060 return peer_flag_modify_vty (vty, ip_str, flag, 1);
2061}
2062
paul94f2b392005-06-28 12:44:16 +00002063static int
paulfd79ac92004-10-13 05:06:08 +00002064peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00002065{
2066 return peer_flag_modify_vty (vty, ip_str, flag, 0);
2067}
2068
2069/* neighbor passive. */
2070DEFUN (neighbor_passive,
2071 neighbor_passive_cmd,
2072 NEIGHBOR_CMD2 "passive",
2073 NEIGHBOR_STR
2074 NEIGHBOR_ADDR_STR2
2075 "Don't send open messages to this neighbor\n")
2076{
2077 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
2078}
2079
2080DEFUN (no_neighbor_passive,
2081 no_neighbor_passive_cmd,
2082 NO_NEIGHBOR_CMD2 "passive",
2083 NO_STR
2084 NEIGHBOR_STR
2085 NEIGHBOR_ADDR_STR2
2086 "Don't send open messages to this neighbor\n")
2087{
2088 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
2089}
David Lamparter6b0655a2014-06-04 06:53:35 +02002090
paul718e3742002-12-13 20:15:29 +00002091/* neighbor shutdown. */
2092DEFUN (neighbor_shutdown,
2093 neighbor_shutdown_cmd,
2094 NEIGHBOR_CMD2 "shutdown",
2095 NEIGHBOR_STR
2096 NEIGHBOR_ADDR_STR2
2097 "Administratively shut down this neighbor\n")
2098{
2099 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
2100}
2101
2102DEFUN (no_neighbor_shutdown,
2103 no_neighbor_shutdown_cmd,
2104 NO_NEIGHBOR_CMD2 "shutdown",
2105 NO_STR
2106 NEIGHBOR_STR
2107 NEIGHBOR_ADDR_STR2
2108 "Administratively shut down this neighbor\n")
2109{
2110 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
2111}
David Lamparter6b0655a2014-06-04 06:53:35 +02002112
hassoc9502432005-02-01 22:01:48 +00002113/* Deprecated neighbor capability route-refresh. */
2114DEFUN_DEPRECATED (neighbor_capability_route_refresh,
2115 neighbor_capability_route_refresh_cmd,
2116 NEIGHBOR_CMD2 "capability route-refresh",
2117 NEIGHBOR_STR
2118 NEIGHBOR_ADDR_STR2
2119 "Advertise capability to the peer\n"
2120 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002121{
hassoc9502432005-02-01 22:01:48 +00002122 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002123}
2124
hassoc9502432005-02-01 22:01:48 +00002125DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
2126 no_neighbor_capability_route_refresh_cmd,
2127 NO_NEIGHBOR_CMD2 "capability route-refresh",
2128 NO_STR
2129 NEIGHBOR_STR
2130 NEIGHBOR_ADDR_STR2
2131 "Advertise capability to the peer\n"
2132 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002133{
hassoc9502432005-02-01 22:01:48 +00002134 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002135}
David Lamparter6b0655a2014-06-04 06:53:35 +02002136
paul718e3742002-12-13 20:15:29 +00002137/* neighbor capability dynamic. */
2138DEFUN (neighbor_capability_dynamic,
2139 neighbor_capability_dynamic_cmd,
2140 NEIGHBOR_CMD2 "capability dynamic",
2141 NEIGHBOR_STR
2142 NEIGHBOR_ADDR_STR2
2143 "Advertise capability to the peer\n"
2144 "Advertise dynamic capability to this neighbor\n")
2145{
2146 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2147}
2148
2149DEFUN (no_neighbor_capability_dynamic,
2150 no_neighbor_capability_dynamic_cmd,
2151 NO_NEIGHBOR_CMD2 "capability dynamic",
2152 NO_STR
2153 NEIGHBOR_STR
2154 NEIGHBOR_ADDR_STR2
2155 "Advertise capability to the peer\n"
2156 "Advertise dynamic capability to this neighbor\n")
2157{
2158 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2159}
David Lamparter6b0655a2014-06-04 06:53:35 +02002160
paul718e3742002-12-13 20:15:29 +00002161/* neighbor dont-capability-negotiate */
2162DEFUN (neighbor_dont_capability_negotiate,
2163 neighbor_dont_capability_negotiate_cmd,
2164 NEIGHBOR_CMD2 "dont-capability-negotiate",
2165 NEIGHBOR_STR
2166 NEIGHBOR_ADDR_STR2
2167 "Do not perform capability negotiation\n")
2168{
2169 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2170}
2171
2172DEFUN (no_neighbor_dont_capability_negotiate,
2173 no_neighbor_dont_capability_negotiate_cmd,
2174 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
2175 NO_STR
2176 NEIGHBOR_STR
2177 NEIGHBOR_ADDR_STR2
2178 "Do not perform capability negotiation\n")
2179{
2180 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2181}
David Lamparter6b0655a2014-06-04 06:53:35 +02002182
paul94f2b392005-06-28 12:44:16 +00002183static int
paulfd79ac92004-10-13 05:06:08 +00002184peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002185 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002186{
2187 int ret;
2188 struct peer *peer;
2189
2190 peer = peer_and_group_lookup_vty (vty, peer_str);
2191 if (! peer)
2192 return CMD_WARNING;
2193
2194 if (set)
2195 ret = peer_af_flag_set (peer, afi, safi, flag);
2196 else
2197 ret = peer_af_flag_unset (peer, afi, safi, flag);
2198
2199 return bgp_vty_return (vty, ret);
2200}
2201
paul94f2b392005-06-28 12:44:16 +00002202static int
paulfd79ac92004-10-13 05:06:08 +00002203peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002204 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002205{
2206 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
2207}
2208
paul94f2b392005-06-28 12:44:16 +00002209static int
paulfd79ac92004-10-13 05:06:08 +00002210peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002211 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002212{
2213 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
2214}
David Lamparter6b0655a2014-06-04 06:53:35 +02002215
paul718e3742002-12-13 20:15:29 +00002216/* neighbor capability orf prefix-list. */
2217DEFUN (neighbor_capability_orf_prefix,
2218 neighbor_capability_orf_prefix_cmd,
2219 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2220 NEIGHBOR_STR
2221 NEIGHBOR_ADDR_STR2
2222 "Advertise capability to the peer\n"
2223 "Advertise ORF capability to the peer\n"
2224 "Advertise prefixlist ORF capability to this neighbor\n"
2225 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2226 "Capability to RECEIVE the ORF from this neighbor\n"
2227 "Capability to SEND the ORF to this neighbor\n")
2228{
2229 u_int16_t flag = 0;
2230
2231 if (strncmp (argv[1], "s", 1) == 0)
2232 flag = PEER_FLAG_ORF_PREFIX_SM;
2233 else if (strncmp (argv[1], "r", 1) == 0)
2234 flag = PEER_FLAG_ORF_PREFIX_RM;
2235 else if (strncmp (argv[1], "b", 1) == 0)
2236 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2237 else
2238 return CMD_WARNING;
2239
2240 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2241 bgp_node_safi (vty), flag);
2242}
2243
2244DEFUN (no_neighbor_capability_orf_prefix,
2245 no_neighbor_capability_orf_prefix_cmd,
2246 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2247 NO_STR
2248 NEIGHBOR_STR
2249 NEIGHBOR_ADDR_STR2
2250 "Advertise capability to the peer\n"
2251 "Advertise ORF capability to the peer\n"
2252 "Advertise prefixlist ORF capability to this neighbor\n"
2253 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2254 "Capability to RECEIVE the ORF from this neighbor\n"
2255 "Capability to SEND the ORF to this neighbor\n")
2256{
2257 u_int16_t flag = 0;
2258
2259 if (strncmp (argv[1], "s", 1) == 0)
2260 flag = PEER_FLAG_ORF_PREFIX_SM;
2261 else if (strncmp (argv[1], "r", 1) == 0)
2262 flag = PEER_FLAG_ORF_PREFIX_RM;
2263 else if (strncmp (argv[1], "b", 1) == 0)
2264 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2265 else
2266 return CMD_WARNING;
2267
2268 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2269 bgp_node_safi (vty), flag);
2270}
David Lamparter6b0655a2014-06-04 06:53:35 +02002271
paul718e3742002-12-13 20:15:29 +00002272/* neighbor next-hop-self. */
2273DEFUN (neighbor_nexthop_self,
2274 neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002275 NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002276 NEIGHBOR_STR
2277 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002278 "Disable the next hop calculation for this neighbor\n"
2279 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002280{
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002281 u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
2282 int rc;
2283
2284 /* Check if "all" is specified */
2285 if (argv[1] != NULL)
2286 flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
2287 else
2288 unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
2289
2290 rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2291 bgp_node_safi (vty), flags);
2292 if ( rc == CMD_SUCCESS && unset )
2293 rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2294 bgp_node_safi (vty), unset);
2295 return rc;
paul718e3742002-12-13 20:15:29 +00002296}
2297
2298DEFUN (no_neighbor_nexthop_self,
2299 no_neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002300 NO_NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002301 NO_STR
2302 NEIGHBOR_STR
2303 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002304 "Disable the next hop calculation for this neighbor\n"
2305 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002306{
2307 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002308 bgp_node_safi (vty),
2309 PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
paul718e3742002-12-13 20:15:29 +00002310}
David Lamparter6b0655a2014-06-04 06:53:35 +02002311
paul718e3742002-12-13 20:15:29 +00002312/* neighbor remove-private-AS. */
2313DEFUN (neighbor_remove_private_as,
2314 neighbor_remove_private_as_cmd,
2315 NEIGHBOR_CMD2 "remove-private-AS",
2316 NEIGHBOR_STR
2317 NEIGHBOR_ADDR_STR2
2318 "Remove private AS number from outbound updates\n")
2319{
2320 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2321 bgp_node_safi (vty),
2322 PEER_FLAG_REMOVE_PRIVATE_AS);
2323}
2324
2325DEFUN (no_neighbor_remove_private_as,
2326 no_neighbor_remove_private_as_cmd,
2327 NO_NEIGHBOR_CMD2 "remove-private-AS",
2328 NO_STR
2329 NEIGHBOR_STR
2330 NEIGHBOR_ADDR_STR2
2331 "Remove private AS number from outbound updates\n")
2332{
2333 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2334 bgp_node_safi (vty),
2335 PEER_FLAG_REMOVE_PRIVATE_AS);
2336}
David Lamparter6b0655a2014-06-04 06:53:35 +02002337
paul718e3742002-12-13 20:15:29 +00002338/* neighbor send-community. */
2339DEFUN (neighbor_send_community,
2340 neighbor_send_community_cmd,
2341 NEIGHBOR_CMD2 "send-community",
2342 NEIGHBOR_STR
2343 NEIGHBOR_ADDR_STR2
2344 "Send Community attribute to this neighbor\n")
2345{
2346 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2347 bgp_node_safi (vty),
2348 PEER_FLAG_SEND_COMMUNITY);
2349}
2350
2351DEFUN (no_neighbor_send_community,
2352 no_neighbor_send_community_cmd,
2353 NO_NEIGHBOR_CMD2 "send-community",
2354 NO_STR
2355 NEIGHBOR_STR
2356 NEIGHBOR_ADDR_STR2
2357 "Send Community attribute to this neighbor\n")
2358{
2359 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2360 bgp_node_safi (vty),
2361 PEER_FLAG_SEND_COMMUNITY);
2362}
David Lamparter6b0655a2014-06-04 06:53:35 +02002363
paul718e3742002-12-13 20:15:29 +00002364/* neighbor send-community extended. */
2365DEFUN (neighbor_send_community_type,
2366 neighbor_send_community_type_cmd,
2367 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2368 NEIGHBOR_STR
2369 NEIGHBOR_ADDR_STR2
2370 "Send Community attribute to this neighbor\n"
2371 "Send Standard and Extended Community attributes\n"
2372 "Send Extended Community attributes\n"
2373 "Send Standard Community attributes\n")
2374{
2375 if (strncmp (argv[1], "s", 1) == 0)
2376 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2377 bgp_node_safi (vty),
2378 PEER_FLAG_SEND_COMMUNITY);
2379 if (strncmp (argv[1], "e", 1) == 0)
2380 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2381 bgp_node_safi (vty),
2382 PEER_FLAG_SEND_EXT_COMMUNITY);
2383
2384 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2385 bgp_node_safi (vty),
2386 (PEER_FLAG_SEND_COMMUNITY|
2387 PEER_FLAG_SEND_EXT_COMMUNITY));
2388}
2389
2390DEFUN (no_neighbor_send_community_type,
2391 no_neighbor_send_community_type_cmd,
2392 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2393 NO_STR
2394 NEIGHBOR_STR
2395 NEIGHBOR_ADDR_STR2
2396 "Send Community attribute to this neighbor\n"
2397 "Send Standard and Extended Community attributes\n"
2398 "Send Extended Community attributes\n"
2399 "Send Standard Community attributes\n")
2400{
2401 if (strncmp (argv[1], "s", 1) == 0)
2402 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2403 bgp_node_safi (vty),
2404 PEER_FLAG_SEND_COMMUNITY);
2405 if (strncmp (argv[1], "e", 1) == 0)
2406 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2407 bgp_node_safi (vty),
2408 PEER_FLAG_SEND_EXT_COMMUNITY);
2409
2410 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2411 bgp_node_safi (vty),
2412 (PEER_FLAG_SEND_COMMUNITY |
2413 PEER_FLAG_SEND_EXT_COMMUNITY));
2414}
David Lamparter6b0655a2014-06-04 06:53:35 +02002415
paul718e3742002-12-13 20:15:29 +00002416/* neighbor soft-reconfig. */
2417DEFUN (neighbor_soft_reconfiguration,
2418 neighbor_soft_reconfiguration_cmd,
2419 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2420 NEIGHBOR_STR
2421 NEIGHBOR_ADDR_STR2
2422 "Per neighbor soft reconfiguration\n"
2423 "Allow inbound soft reconfiguration for this neighbor\n")
2424{
2425 return peer_af_flag_set_vty (vty, argv[0],
2426 bgp_node_afi (vty), bgp_node_safi (vty),
2427 PEER_FLAG_SOFT_RECONFIG);
2428}
2429
2430DEFUN (no_neighbor_soft_reconfiguration,
2431 no_neighbor_soft_reconfiguration_cmd,
2432 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2433 NO_STR
2434 NEIGHBOR_STR
2435 NEIGHBOR_ADDR_STR2
2436 "Per neighbor soft reconfiguration\n"
2437 "Allow inbound soft reconfiguration for this neighbor\n")
2438{
2439 return peer_af_flag_unset_vty (vty, argv[0],
2440 bgp_node_afi (vty), bgp_node_safi (vty),
2441 PEER_FLAG_SOFT_RECONFIG);
2442}
David Lamparter6b0655a2014-06-04 06:53:35 +02002443
paul718e3742002-12-13 20:15:29 +00002444DEFUN (neighbor_route_reflector_client,
2445 neighbor_route_reflector_client_cmd,
2446 NEIGHBOR_CMD2 "route-reflector-client",
2447 NEIGHBOR_STR
2448 NEIGHBOR_ADDR_STR2
2449 "Configure a neighbor as Route Reflector client\n")
2450{
2451 struct peer *peer;
2452
2453
2454 peer = peer_and_group_lookup_vty (vty, argv[0]);
2455 if (! peer)
2456 return CMD_WARNING;
2457
2458 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2459 bgp_node_safi (vty),
2460 PEER_FLAG_REFLECTOR_CLIENT);
2461}
2462
2463DEFUN (no_neighbor_route_reflector_client,
2464 no_neighbor_route_reflector_client_cmd,
2465 NO_NEIGHBOR_CMD2 "route-reflector-client",
2466 NO_STR
2467 NEIGHBOR_STR
2468 NEIGHBOR_ADDR_STR2
2469 "Configure a neighbor as Route Reflector client\n")
2470{
2471 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2472 bgp_node_safi (vty),
2473 PEER_FLAG_REFLECTOR_CLIENT);
2474}
David Lamparter6b0655a2014-06-04 06:53:35 +02002475
paul94f2b392005-06-28 12:44:16 +00002476static int
paulfd79ac92004-10-13 05:06:08 +00002477peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2478 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002479{
2480 int ret;
2481 struct bgp *bgp;
2482 struct peer *peer;
2483 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002484 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002485 struct bgp_filter *pfilter;
2486 struct bgp_filter *gfilter;
Chris Caputo228da422009-07-18 05:44:03 +00002487 int locked_and_added = 0;
paulfee0f4c2004-09-13 05:12:46 +00002488
2489 bgp = vty->index;
2490
2491 peer = peer_and_group_lookup_vty (vty, peer_str);
2492 if ( ! peer )
2493 return CMD_WARNING;
2494
2495 /* If it is already a RS-Client, don't do anything. */
2496 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2497 return CMD_SUCCESS;
2498
2499 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002500 {
2501 peer = peer_lock (peer); /* rsclient peer list reference */
2502 listnode_add_sort (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002503 locked_and_added = 1;
paul200df112005-06-01 11:17:05 +00002504 }
paulfee0f4c2004-09-13 05:12:46 +00002505
2506 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2507 if (ret < 0)
Chris Caputo228da422009-07-18 05:44:03 +00002508 {
2509 if (locked_and_added)
2510 {
2511 listnode_delete (bgp->rsclient, peer);
2512 peer_unlock (peer); /* rsclient peer list reference */
2513 }
2514
2515 return bgp_vty_return (vty, ret);
2516 }
paulfee0f4c2004-09-13 05:12:46 +00002517
Paul Jakma64e580a2006-02-21 01:09:01 +00002518 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002519 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
Chris Caputo228da422009-07-18 05:44:03 +00002520 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2521 peer->rib[afi][safi]->owner = peer_lock (peer);
paulfee0f4c2004-09-13 05:12:46 +00002522
2523 /* Check for existing 'network' and 'redistribute' routes. */
2524 bgp_check_local_routes_rsclient (peer, afi, safi);
2525
2526 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2527 bgp_soft_reconfig_rsclient (peer, afi, safi);
2528
2529 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2530 {
2531 group = peer->group;
2532 gfilter = &peer->filter[afi][safi];
2533
paul1eb8ef22005-04-07 07:30:20 +00002534 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002535 {
2536 pfilter = &peer->filter[afi][safi];
2537
2538 /* Members of a non-RS-Client group should not be RS-Clients, as that
2539 is checked when the become part of the peer-group */
2540 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2541 if (ret < 0)
2542 return bgp_vty_return (vty, ret);
2543
2544 /* Make peer's RIB point to group's RIB. */
2545 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2546
2547 /* Import policy. */
2548 if (pfilter->map[RMAP_IMPORT].name)
2549 free (pfilter->map[RMAP_IMPORT].name);
2550 if (gfilter->map[RMAP_IMPORT].name)
2551 {
2552 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2553 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2554 }
2555 else
2556 {
2557 pfilter->map[RMAP_IMPORT].name = NULL;
2558 pfilter->map[RMAP_IMPORT].map =NULL;
2559 }
2560
2561 /* Export policy. */
2562 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2563 {
2564 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2565 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2566 }
2567 }
2568 }
2569 return CMD_SUCCESS;
2570}
2571
paul94f2b392005-06-28 12:44:16 +00002572static int
paulfd79ac92004-10-13 05:06:08 +00002573peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2574 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002575{
2576 int ret;
2577 struct bgp *bgp;
2578 struct peer *peer;
2579 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002580 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002581
2582 bgp = vty->index;
2583
2584 peer = peer_and_group_lookup_vty (vty, peer_str);
2585 if ( ! peer )
2586 return CMD_WARNING;
2587
2588 /* If it is not a RS-Client, don't do anything. */
2589 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2590 return CMD_SUCCESS;
2591
2592 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2593 {
2594 group = peer->group;
2595
paul1eb8ef22005-04-07 07:30:20 +00002596 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002597 {
2598 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2599 if (ret < 0)
2600 return bgp_vty_return (vty, ret);
2601
2602 peer->rib[afi][safi] = NULL;
2603 }
2604
2605 peer = group->conf;
2606 }
2607
2608 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2609 if (ret < 0)
2610 return bgp_vty_return (vty, ret);
2611
2612 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002613 {
Chris Caputo228da422009-07-18 05:44:03 +00002614 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
paul200df112005-06-01 11:17:05 +00002615 listnode_delete (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002616 peer_unlock (peer); /* peer bgp rsclient reference */
paul200df112005-06-01 11:17:05 +00002617 }
paulfee0f4c2004-09-13 05:12:46 +00002618
Paul Jakmab608d5b2008-07-02 02:12:07 +00002619 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002620
2621 return CMD_SUCCESS;
2622}
David Lamparter6b0655a2014-06-04 06:53:35 +02002623
paul718e3742002-12-13 20:15:29 +00002624/* neighbor route-server-client. */
2625DEFUN (neighbor_route_server_client,
2626 neighbor_route_server_client_cmd,
2627 NEIGHBOR_CMD2 "route-server-client",
2628 NEIGHBOR_STR
2629 NEIGHBOR_ADDR_STR2
2630 "Configure a neighbor as Route Server client\n")
2631{
paulfee0f4c2004-09-13 05:12:46 +00002632 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2633 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002634}
2635
2636DEFUN (no_neighbor_route_server_client,
2637 no_neighbor_route_server_client_cmd,
2638 NO_NEIGHBOR_CMD2 "route-server-client",
2639 NO_STR
2640 NEIGHBOR_STR
2641 NEIGHBOR_ADDR_STR2
2642 "Configure a neighbor as Route Server client\n")
2643{
paulfee0f4c2004-09-13 05:12:46 +00002644 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2645 bgp_node_safi(vty));
2646}
David Lamparter6b0655a2014-06-04 06:53:35 +02002647
paulfee0f4c2004-09-13 05:12:46 +00002648DEFUN (neighbor_nexthop_local_unchanged,
2649 neighbor_nexthop_local_unchanged_cmd,
2650 NEIGHBOR_CMD2 "nexthop-local unchanged",
2651 NEIGHBOR_STR
2652 NEIGHBOR_ADDR_STR2
2653 "Configure treatment of outgoing link-local nexthop attribute\n"
2654 "Leave link-local nexthop unchanged for this peer\n")
2655{
2656 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2657 bgp_node_safi (vty),
2658 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2659}
David Lamparter6b0655a2014-06-04 06:53:35 +02002660
paulfee0f4c2004-09-13 05:12:46 +00002661DEFUN (no_neighbor_nexthop_local_unchanged,
2662 no_neighbor_nexthop_local_unchanged_cmd,
2663 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2664 NO_STR
2665 NEIGHBOR_STR
2666 NEIGHBOR_ADDR_STR2
2667 "Configure treatment of outgoing link-local-nexthop attribute\n"
2668 "Leave link-local nexthop unchanged for this peer\n")
2669{
paul718e3742002-12-13 20:15:29 +00002670 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2671 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002672 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002673}
David Lamparter6b0655a2014-06-04 06:53:35 +02002674
paul718e3742002-12-13 20:15:29 +00002675DEFUN (neighbor_attr_unchanged,
2676 neighbor_attr_unchanged_cmd,
2677 NEIGHBOR_CMD2 "attribute-unchanged",
2678 NEIGHBOR_STR
2679 NEIGHBOR_ADDR_STR2
2680 "BGP attribute is propagated unchanged to this neighbor\n")
2681{
2682 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2683 bgp_node_safi (vty),
2684 (PEER_FLAG_AS_PATH_UNCHANGED |
2685 PEER_FLAG_NEXTHOP_UNCHANGED |
2686 PEER_FLAG_MED_UNCHANGED));
2687}
2688
2689DEFUN (neighbor_attr_unchanged1,
2690 neighbor_attr_unchanged1_cmd,
2691 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2692 NEIGHBOR_STR
2693 NEIGHBOR_ADDR_STR2
2694 "BGP attribute is propagated unchanged to this neighbor\n"
2695 "As-path attribute\n"
2696 "Nexthop attribute\n"
2697 "Med attribute\n")
2698{
2699 u_int16_t flags = 0;
2700
2701 if (strncmp (argv[1], "as-path", 1) == 0)
2702 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2703 else if (strncmp (argv[1], "next-hop", 1) == 0)
2704 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2705 else if (strncmp (argv[1], "med", 1) == 0)
2706 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2707
2708 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2709 bgp_node_safi (vty), flags);
2710}
2711
2712DEFUN (neighbor_attr_unchanged2,
2713 neighbor_attr_unchanged2_cmd,
2714 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2715 NEIGHBOR_STR
2716 NEIGHBOR_ADDR_STR2
2717 "BGP attribute is propagated unchanged to this neighbor\n"
2718 "As-path attribute\n"
2719 "Nexthop attribute\n"
2720 "Med attribute\n")
2721{
2722 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2723
2724 if (strncmp (argv[1], "next-hop", 1) == 0)
2725 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2726 else if (strncmp (argv[1], "med", 1) == 0)
2727 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2728
2729 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2730 bgp_node_safi (vty), flags);
2731
2732}
2733
2734DEFUN (neighbor_attr_unchanged3,
2735 neighbor_attr_unchanged3_cmd,
2736 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2737 NEIGHBOR_STR
2738 NEIGHBOR_ADDR_STR2
2739 "BGP attribute is propagated unchanged to this neighbor\n"
2740 "Nexthop attribute\n"
2741 "As-path attribute\n"
2742 "Med attribute\n")
2743{
2744 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2745
2746 if (strncmp (argv[1], "as-path", 1) == 0)
2747 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2748 else if (strncmp (argv[1], "med", 1) == 0)
2749 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2750
2751 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2752 bgp_node_safi (vty), flags);
2753}
2754
2755DEFUN (neighbor_attr_unchanged4,
2756 neighbor_attr_unchanged4_cmd,
2757 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2758 NEIGHBOR_STR
2759 NEIGHBOR_ADDR_STR2
2760 "BGP attribute is propagated unchanged to this neighbor\n"
2761 "Med attribute\n"
2762 "As-path attribute\n"
2763 "Nexthop attribute\n")
2764{
2765 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2766
2767 if (strncmp (argv[1], "as-path", 1) == 0)
2768 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2769 else if (strncmp (argv[1], "next-hop", 1) == 0)
2770 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2771
2772 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2773 bgp_node_safi (vty), flags);
2774}
2775
2776ALIAS (neighbor_attr_unchanged,
2777 neighbor_attr_unchanged5_cmd,
2778 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2779 NEIGHBOR_STR
2780 NEIGHBOR_ADDR_STR2
2781 "BGP attribute is propagated unchanged to this neighbor\n"
2782 "As-path attribute\n"
2783 "Nexthop attribute\n"
2784 "Med attribute\n")
2785
2786ALIAS (neighbor_attr_unchanged,
2787 neighbor_attr_unchanged6_cmd,
2788 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2789 NEIGHBOR_STR
2790 NEIGHBOR_ADDR_STR2
2791 "BGP attribute is propagated unchanged to this neighbor\n"
2792 "As-path attribute\n"
2793 "Med attribute\n"
2794 "Nexthop attribute\n")
2795
2796ALIAS (neighbor_attr_unchanged,
2797 neighbor_attr_unchanged7_cmd,
2798 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2799 NEIGHBOR_STR
2800 NEIGHBOR_ADDR_STR2
2801 "BGP attribute is propagated unchanged to this neighbor\n"
2802 "Nexthop attribute\n"
2803 "Med attribute\n"
2804 "As-path attribute\n")
2805
2806ALIAS (neighbor_attr_unchanged,
2807 neighbor_attr_unchanged8_cmd,
2808 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2809 NEIGHBOR_STR
2810 NEIGHBOR_ADDR_STR2
2811 "BGP attribute is propagated unchanged to this neighbor\n"
2812 "Nexthop attribute\n"
2813 "As-path attribute\n"
2814 "Med attribute\n")
2815
2816ALIAS (neighbor_attr_unchanged,
2817 neighbor_attr_unchanged9_cmd,
2818 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2819 NEIGHBOR_STR
2820 NEIGHBOR_ADDR_STR2
2821 "BGP attribute is propagated unchanged to this neighbor\n"
2822 "Med attribute\n"
2823 "Nexthop attribute\n"
2824 "As-path attribute\n")
2825
2826ALIAS (neighbor_attr_unchanged,
2827 neighbor_attr_unchanged10_cmd,
2828 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2829 NEIGHBOR_STR
2830 NEIGHBOR_ADDR_STR2
2831 "BGP attribute is propagated unchanged to this neighbor\n"
2832 "Med attribute\n"
2833 "As-path attribute\n"
2834 "Nexthop attribute\n")
2835
2836DEFUN (no_neighbor_attr_unchanged,
2837 no_neighbor_attr_unchanged_cmd,
2838 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2839 NO_STR
2840 NEIGHBOR_STR
2841 NEIGHBOR_ADDR_STR2
2842 "BGP attribute is propagated unchanged to this neighbor\n")
2843{
2844 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2845 bgp_node_safi (vty),
2846 (PEER_FLAG_AS_PATH_UNCHANGED |
2847 PEER_FLAG_NEXTHOP_UNCHANGED |
2848 PEER_FLAG_MED_UNCHANGED));
2849}
2850
2851DEFUN (no_neighbor_attr_unchanged1,
2852 no_neighbor_attr_unchanged1_cmd,
2853 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2854 NO_STR
2855 NEIGHBOR_STR
2856 NEIGHBOR_ADDR_STR2
2857 "BGP attribute is propagated unchanged to this neighbor\n"
2858 "As-path attribute\n"
2859 "Nexthop attribute\n"
2860 "Med attribute\n")
2861{
2862 u_int16_t flags = 0;
2863
2864 if (strncmp (argv[1], "as-path", 1) == 0)
2865 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2866 else if (strncmp (argv[1], "next-hop", 1) == 0)
2867 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2868 else if (strncmp (argv[1], "med", 1) == 0)
2869 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2870
2871 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2872 bgp_node_safi (vty), flags);
2873}
2874
2875DEFUN (no_neighbor_attr_unchanged2,
2876 no_neighbor_attr_unchanged2_cmd,
2877 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2878 NO_STR
2879 NEIGHBOR_STR
2880 NEIGHBOR_ADDR_STR2
2881 "BGP attribute is propagated unchanged to this neighbor\n"
2882 "As-path attribute\n"
2883 "Nexthop attribute\n"
2884 "Med attribute\n")
2885{
2886 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2887
2888 if (strncmp (argv[1], "next-hop", 1) == 0)
2889 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2890 else if (strncmp (argv[1], "med", 1) == 0)
2891 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2892
2893 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2894 bgp_node_safi (vty), flags);
2895}
2896
2897DEFUN (no_neighbor_attr_unchanged3,
2898 no_neighbor_attr_unchanged3_cmd,
2899 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2900 NO_STR
2901 NEIGHBOR_STR
2902 NEIGHBOR_ADDR_STR2
2903 "BGP attribute is propagated unchanged to this neighbor\n"
2904 "Nexthop attribute\n"
2905 "As-path attribute\n"
2906 "Med attribute\n")
2907{
2908 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2909
2910 if (strncmp (argv[1], "as-path", 1) == 0)
2911 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2912 else if (strncmp (argv[1], "med", 1) == 0)
2913 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2914
2915 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2916 bgp_node_safi (vty), flags);
2917}
2918
2919DEFUN (no_neighbor_attr_unchanged4,
2920 no_neighbor_attr_unchanged4_cmd,
2921 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2922 NO_STR
2923 NEIGHBOR_STR
2924 NEIGHBOR_ADDR_STR2
2925 "BGP attribute is propagated unchanged to this neighbor\n"
2926 "Med attribute\n"
2927 "As-path attribute\n"
2928 "Nexthop attribute\n")
2929{
2930 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2931
2932 if (strncmp (argv[1], "as-path", 1) == 0)
2933 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2934 else if (strncmp (argv[1], "next-hop", 1) == 0)
2935 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2936
2937 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2938 bgp_node_safi (vty), flags);
2939}
2940
2941ALIAS (no_neighbor_attr_unchanged,
2942 no_neighbor_attr_unchanged5_cmd,
2943 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2944 NO_STR
2945 NEIGHBOR_STR
2946 NEIGHBOR_ADDR_STR2
2947 "BGP attribute is propagated unchanged to this neighbor\n"
2948 "As-path attribute\n"
2949 "Nexthop attribute\n"
2950 "Med attribute\n")
2951
2952ALIAS (no_neighbor_attr_unchanged,
2953 no_neighbor_attr_unchanged6_cmd,
2954 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2955 NO_STR
2956 NEIGHBOR_STR
2957 NEIGHBOR_ADDR_STR2
2958 "BGP attribute is propagated unchanged to this neighbor\n"
2959 "As-path attribute\n"
2960 "Med attribute\n"
2961 "Nexthop attribute\n")
2962
2963ALIAS (no_neighbor_attr_unchanged,
2964 no_neighbor_attr_unchanged7_cmd,
2965 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2966 NO_STR
2967 NEIGHBOR_STR
2968 NEIGHBOR_ADDR_STR2
2969 "BGP attribute is propagated unchanged to this neighbor\n"
2970 "Nexthop attribute\n"
2971 "Med attribute\n"
2972 "As-path attribute\n")
2973
2974ALIAS (no_neighbor_attr_unchanged,
2975 no_neighbor_attr_unchanged8_cmd,
2976 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2977 NO_STR
2978 NEIGHBOR_STR
2979 NEIGHBOR_ADDR_STR2
2980 "BGP attribute is propagated unchanged to this neighbor\n"
2981 "Nexthop attribute\n"
2982 "As-path attribute\n"
2983 "Med attribute\n")
2984
2985ALIAS (no_neighbor_attr_unchanged,
2986 no_neighbor_attr_unchanged9_cmd,
2987 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2988 NO_STR
2989 NEIGHBOR_STR
2990 NEIGHBOR_ADDR_STR2
2991 "BGP attribute is propagated unchanged to this neighbor\n"
2992 "Med attribute\n"
2993 "Nexthop attribute\n"
2994 "As-path attribute\n")
2995
2996ALIAS (no_neighbor_attr_unchanged,
2997 no_neighbor_attr_unchanged10_cmd,
2998 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2999 NO_STR
3000 NEIGHBOR_STR
3001 NEIGHBOR_ADDR_STR2
3002 "BGP attribute is propagated unchanged to this neighbor\n"
3003 "Med attribute\n"
3004 "As-path attribute\n"
3005 "Nexthop attribute\n")
3006
3007/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00003008DEFUN_DEPRECATED (neighbor_transparent_as,
3009 neighbor_transparent_as_cmd,
3010 NEIGHBOR_CMD "transparent-as",
3011 NEIGHBOR_STR
3012 NEIGHBOR_ADDR_STR
3013 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00003014{
3015 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3016 bgp_node_safi (vty),
3017 PEER_FLAG_AS_PATH_UNCHANGED);
3018}
3019
hassodd4c5932005-02-02 17:15:34 +00003020DEFUN_DEPRECATED (neighbor_transparent_nexthop,
3021 neighbor_transparent_nexthop_cmd,
3022 NEIGHBOR_CMD "transparent-nexthop",
3023 NEIGHBOR_STR
3024 NEIGHBOR_ADDR_STR
3025 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00003026{
3027 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3028 bgp_node_safi (vty),
3029 PEER_FLAG_NEXTHOP_UNCHANGED);
3030}
David Lamparter6b0655a2014-06-04 06:53:35 +02003031
paul718e3742002-12-13 20:15:29 +00003032/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00003033static int
paulfd79ac92004-10-13 05:06:08 +00003034peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
3035 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00003036{
3037 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00003038 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00003039
3040 peer = peer_and_group_lookup_vty (vty, ip_str);
3041 if (! peer)
3042 return CMD_WARNING;
3043
3044 if (! ttl_str)
3045 ttl = TTL_MAX;
3046 else
3047 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
3048
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00003049 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
paul718e3742002-12-13 20:15:29 +00003050}
3051
paul94f2b392005-06-28 12:44:16 +00003052static int
paulfd79ac92004-10-13 05:06:08 +00003053peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003054{
3055 struct peer *peer;
3056
3057 peer = peer_and_group_lookup_vty (vty, ip_str);
3058 if (! peer)
3059 return CMD_WARNING;
3060
Timo Teräse3443a22016-10-19 16:02:34 +03003061 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, 0));
paul718e3742002-12-13 20:15:29 +00003062}
3063
3064/* neighbor ebgp-multihop. */
3065DEFUN (neighbor_ebgp_multihop,
3066 neighbor_ebgp_multihop_cmd,
3067 NEIGHBOR_CMD2 "ebgp-multihop",
3068 NEIGHBOR_STR
3069 NEIGHBOR_ADDR_STR2
3070 "Allow EBGP neighbors not on directly connected networks\n")
3071{
3072 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
3073}
3074
3075DEFUN (neighbor_ebgp_multihop_ttl,
3076 neighbor_ebgp_multihop_ttl_cmd,
3077 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
3078 NEIGHBOR_STR
3079 NEIGHBOR_ADDR_STR2
3080 "Allow EBGP neighbors not on directly connected networks\n"
3081 "maximum hop count\n")
3082{
3083 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
3084}
3085
3086DEFUN (no_neighbor_ebgp_multihop,
3087 no_neighbor_ebgp_multihop_cmd,
3088 NO_NEIGHBOR_CMD2 "ebgp-multihop",
3089 NO_STR
3090 NEIGHBOR_STR
3091 NEIGHBOR_ADDR_STR2
3092 "Allow EBGP neighbors not on directly connected networks\n")
3093{
3094 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
3095}
3096
3097ALIAS (no_neighbor_ebgp_multihop,
3098 no_neighbor_ebgp_multihop_ttl_cmd,
3099 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
3100 NO_STR
3101 NEIGHBOR_STR
3102 NEIGHBOR_ADDR_STR2
3103 "Allow EBGP neighbors not on directly connected networks\n"
3104 "maximum hop count\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003105
hasso6ffd2072005-02-02 14:50:11 +00003106/* disable-connected-check */
3107DEFUN (neighbor_disable_connected_check,
3108 neighbor_disable_connected_check_cmd,
3109 NEIGHBOR_CMD2 "disable-connected-check",
3110 NEIGHBOR_STR
3111 NEIGHBOR_ADDR_STR2
3112 "one-hop away EBGP peer using loopback address\n")
3113{
3114 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3115}
3116
3117DEFUN (no_neighbor_disable_connected_check,
3118 no_neighbor_disable_connected_check_cmd,
3119 NO_NEIGHBOR_CMD2 "disable-connected-check",
3120 NO_STR
3121 NEIGHBOR_STR
3122 NEIGHBOR_ADDR_STR2
3123 "one-hop away EBGP peer using loopback address\n")
3124{
3125 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3126}
3127
paul718e3742002-12-13 20:15:29 +00003128/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00003129ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003130 neighbor_enforce_multihop_cmd,
3131 NEIGHBOR_CMD2 "enforce-multihop",
3132 NEIGHBOR_STR
3133 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003134 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00003135
hasso6ffd2072005-02-02 14:50:11 +00003136/* Enforce multihop. */
3137ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003138 no_neighbor_enforce_multihop_cmd,
3139 NO_NEIGHBOR_CMD2 "enforce-multihop",
3140 NO_STR
3141 NEIGHBOR_STR
3142 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003143 "Enforce EBGP neighbors perform multihop\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003144
paul718e3742002-12-13 20:15:29 +00003145DEFUN (neighbor_description,
3146 neighbor_description_cmd,
3147 NEIGHBOR_CMD2 "description .LINE",
3148 NEIGHBOR_STR
3149 NEIGHBOR_ADDR_STR2
3150 "Neighbor specific description\n"
3151 "Up to 80 characters describing this neighbor\n")
3152{
3153 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003154 char *str;
paul718e3742002-12-13 20:15:29 +00003155
3156 peer = peer_and_group_lookup_vty (vty, argv[0]);
3157 if (! peer)
3158 return CMD_WARNING;
3159
3160 if (argc == 1)
3161 return CMD_SUCCESS;
3162
ajs3b8b1852005-01-29 18:19:13 +00003163 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00003164
3165 peer_description_set (peer, str);
3166
ajs3b8b1852005-01-29 18:19:13 +00003167 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00003168
3169 return CMD_SUCCESS;
3170}
3171
3172DEFUN (no_neighbor_description,
3173 no_neighbor_description_cmd,
3174 NO_NEIGHBOR_CMD2 "description",
3175 NO_STR
3176 NEIGHBOR_STR
3177 NEIGHBOR_ADDR_STR2
3178 "Neighbor specific description\n")
3179{
3180 struct peer *peer;
3181
3182 peer = peer_and_group_lookup_vty (vty, argv[0]);
3183 if (! peer)
3184 return CMD_WARNING;
3185
3186 peer_description_unset (peer);
3187
3188 return CMD_SUCCESS;
3189}
3190
3191ALIAS (no_neighbor_description,
3192 no_neighbor_description_val_cmd,
3193 NO_NEIGHBOR_CMD2 "description .LINE",
3194 NO_STR
3195 NEIGHBOR_STR
3196 NEIGHBOR_ADDR_STR2
3197 "Neighbor specific description\n"
3198 "Up to 80 characters describing this neighbor\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003199
paul718e3742002-12-13 20:15:29 +00003200/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00003201static int
paulfd79ac92004-10-13 05:06:08 +00003202peer_update_source_vty (struct vty *vty, const char *peer_str,
3203 const char *source_str)
paul718e3742002-12-13 20:15:29 +00003204{
3205 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003206
3207 peer = peer_and_group_lookup_vty (vty, peer_str);
3208 if (! peer)
3209 return CMD_WARNING;
3210
3211 if (source_str)
3212 {
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +02003213 union sockunion su;
3214 int ret = str2sockunion (source_str, &su);
3215
3216 if (ret == 0)
3217 peer_update_source_addr_set (peer, &su);
paul718e3742002-12-13 20:15:29 +00003218 else
3219 peer_update_source_if_set (peer, source_str);
3220 }
3221 else
3222 peer_update_source_unset (peer);
3223
3224 return CMD_SUCCESS;
3225}
3226
Paul Jakma9a1a3312009-07-27 12:27:55 +01003227#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
Paul Jakma369688c2006-05-23 22:27:55 +00003228#define BGP_UPDATE_SOURCE_HELP_STR \
3229 "IPv4 address\n" \
Paul Jakma9a1a3312009-07-27 12:27:55 +01003230 "IPv6 address\n" \
3231 "Interface name (requires zebra to be running)\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003232
paul718e3742002-12-13 20:15:29 +00003233DEFUN (neighbor_update_source,
3234 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00003235 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00003236 NEIGHBOR_STR
3237 NEIGHBOR_ADDR_STR2
3238 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003239 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00003240{
3241 return peer_update_source_vty (vty, argv[0], argv[1]);
3242}
3243
3244DEFUN (no_neighbor_update_source,
3245 no_neighbor_update_source_cmd,
3246 NO_NEIGHBOR_CMD2 "update-source",
3247 NO_STR
3248 NEIGHBOR_STR
3249 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00003250 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00003251{
3252 return peer_update_source_vty (vty, argv[0], NULL);
3253}
David Lamparter6b0655a2014-06-04 06:53:35 +02003254
paul94f2b392005-06-28 12:44:16 +00003255static int
paulfd79ac92004-10-13 05:06:08 +00003256peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
3257 afi_t afi, safi_t safi,
3258 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00003259{
3260 int ret;
3261 struct peer *peer;
3262
3263 peer = peer_and_group_lookup_vty (vty, peer_str);
3264 if (! peer)
3265 return CMD_WARNING;
3266
3267 if (set)
3268 ret = peer_default_originate_set (peer, afi, safi, rmap);
3269 else
3270 ret = peer_default_originate_unset (peer, afi, safi);
3271
3272 return bgp_vty_return (vty, ret);
3273}
3274
3275/* neighbor default-originate. */
3276DEFUN (neighbor_default_originate,
3277 neighbor_default_originate_cmd,
3278 NEIGHBOR_CMD2 "default-originate",
3279 NEIGHBOR_STR
3280 NEIGHBOR_ADDR_STR2
3281 "Originate default route to this neighbor\n")
3282{
3283 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3284 bgp_node_safi (vty), NULL, 1);
3285}
3286
3287DEFUN (neighbor_default_originate_rmap,
3288 neighbor_default_originate_rmap_cmd,
3289 NEIGHBOR_CMD2 "default-originate route-map WORD",
3290 NEIGHBOR_STR
3291 NEIGHBOR_ADDR_STR2
3292 "Originate default route to this neighbor\n"
3293 "Route-map to specify criteria to originate default\n"
3294 "route-map name\n")
3295{
3296 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3297 bgp_node_safi (vty), argv[1], 1);
3298}
3299
3300DEFUN (no_neighbor_default_originate,
3301 no_neighbor_default_originate_cmd,
3302 NO_NEIGHBOR_CMD2 "default-originate",
3303 NO_STR
3304 NEIGHBOR_STR
3305 NEIGHBOR_ADDR_STR2
3306 "Originate default route to this neighbor\n")
3307{
3308 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3309 bgp_node_safi (vty), NULL, 0);
3310}
3311
3312ALIAS (no_neighbor_default_originate,
3313 no_neighbor_default_originate_rmap_cmd,
3314 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3315 NO_STR
3316 NEIGHBOR_STR
3317 NEIGHBOR_ADDR_STR2
3318 "Originate default route to this neighbor\n"
3319 "Route-map to specify criteria to originate default\n"
3320 "route-map name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003321
paul718e3742002-12-13 20:15:29 +00003322/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00003323static int
paulfd79ac92004-10-13 05:06:08 +00003324peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3325 const char *port_str)
paul718e3742002-12-13 20:15:29 +00003326{
3327 struct peer *peer;
3328 u_int16_t port;
3329 struct servent *sp;
3330
3331 peer = peer_lookup_vty (vty, ip_str);
3332 if (! peer)
3333 return CMD_WARNING;
3334
3335 if (! port_str)
3336 {
3337 sp = getservbyname ("bgp", "tcp");
3338 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3339 }
3340 else
3341 {
3342 VTY_GET_INTEGER("port", port, port_str);
3343 }
3344
3345 peer_port_set (peer, port);
3346
3347 return CMD_SUCCESS;
3348}
3349
hassof4184462005-02-01 20:13:16 +00003350/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00003351DEFUN (neighbor_port,
3352 neighbor_port_cmd,
3353 NEIGHBOR_CMD "port <0-65535>",
3354 NEIGHBOR_STR
3355 NEIGHBOR_ADDR_STR
3356 "Neighbor's BGP port\n"
3357 "TCP port number\n")
3358{
3359 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3360}
3361
3362DEFUN (no_neighbor_port,
3363 no_neighbor_port_cmd,
3364 NO_NEIGHBOR_CMD "port",
3365 NO_STR
3366 NEIGHBOR_STR
3367 NEIGHBOR_ADDR_STR
3368 "Neighbor's BGP port\n")
3369{
3370 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3371}
3372
3373ALIAS (no_neighbor_port,
3374 no_neighbor_port_val_cmd,
3375 NO_NEIGHBOR_CMD "port <0-65535>",
3376 NO_STR
3377 NEIGHBOR_STR
3378 NEIGHBOR_ADDR_STR
3379 "Neighbor's BGP port\n"
3380 "TCP port number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003381
paul718e3742002-12-13 20:15:29 +00003382/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00003383static int
paulfd79ac92004-10-13 05:06:08 +00003384peer_weight_set_vty (struct vty *vty, const char *ip_str,
3385 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00003386{
paul718e3742002-12-13 20:15:29 +00003387 struct peer *peer;
3388 unsigned long weight;
3389
3390 peer = peer_and_group_lookup_vty (vty, ip_str);
3391 if (! peer)
3392 return CMD_WARNING;
3393
3394 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3395
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003396 return bgp_vty_return (vty, peer_weight_set (peer, weight));
paul718e3742002-12-13 20:15:29 +00003397}
3398
paul94f2b392005-06-28 12:44:16 +00003399static int
paulfd79ac92004-10-13 05:06:08 +00003400peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003401{
3402 struct peer *peer;
3403
3404 peer = peer_and_group_lookup_vty (vty, ip_str);
3405 if (! peer)
3406 return CMD_WARNING;
3407
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003408 return bgp_vty_return (vty, peer_weight_unset (peer));
paul718e3742002-12-13 20:15:29 +00003409}
3410
3411DEFUN (neighbor_weight,
3412 neighbor_weight_cmd,
3413 NEIGHBOR_CMD2 "weight <0-65535>",
3414 NEIGHBOR_STR
3415 NEIGHBOR_ADDR_STR2
3416 "Set default weight for routes from this neighbor\n"
3417 "default weight\n")
3418{
3419 return peer_weight_set_vty (vty, argv[0], argv[1]);
3420}
3421
3422DEFUN (no_neighbor_weight,
3423 no_neighbor_weight_cmd,
3424 NO_NEIGHBOR_CMD2 "weight",
3425 NO_STR
3426 NEIGHBOR_STR
3427 NEIGHBOR_ADDR_STR2
3428 "Set default weight for routes from this neighbor\n")
3429{
3430 return peer_weight_unset_vty (vty, argv[0]);
3431}
3432
3433ALIAS (no_neighbor_weight,
3434 no_neighbor_weight_val_cmd,
3435 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3436 NO_STR
3437 NEIGHBOR_STR
3438 NEIGHBOR_ADDR_STR2
3439 "Set default weight for routes from this neighbor\n"
3440 "default weight\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003441
paul718e3742002-12-13 20:15:29 +00003442/* Override capability negotiation. */
3443DEFUN (neighbor_override_capability,
3444 neighbor_override_capability_cmd,
3445 NEIGHBOR_CMD2 "override-capability",
3446 NEIGHBOR_STR
3447 NEIGHBOR_ADDR_STR2
3448 "Override capability negotiation result\n")
3449{
3450 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3451}
3452
3453DEFUN (no_neighbor_override_capability,
3454 no_neighbor_override_capability_cmd,
3455 NO_NEIGHBOR_CMD2 "override-capability",
3456 NO_STR
3457 NEIGHBOR_STR
3458 NEIGHBOR_ADDR_STR2
3459 "Override capability negotiation result\n")
3460{
3461 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3462}
David Lamparter6b0655a2014-06-04 06:53:35 +02003463
paul718e3742002-12-13 20:15:29 +00003464DEFUN (neighbor_strict_capability,
3465 neighbor_strict_capability_cmd,
3466 NEIGHBOR_CMD "strict-capability-match",
3467 NEIGHBOR_STR
3468 NEIGHBOR_ADDR_STR
3469 "Strict capability negotiation match\n")
3470{
3471 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3472}
3473
3474DEFUN (no_neighbor_strict_capability,
3475 no_neighbor_strict_capability_cmd,
3476 NO_NEIGHBOR_CMD "strict-capability-match",
3477 NO_STR
3478 NEIGHBOR_STR
3479 NEIGHBOR_ADDR_STR
3480 "Strict capability negotiation match\n")
3481{
3482 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3483}
David Lamparter6b0655a2014-06-04 06:53:35 +02003484
paul94f2b392005-06-28 12:44:16 +00003485static int
paulfd79ac92004-10-13 05:06:08 +00003486peer_timers_set_vty (struct vty *vty, const char *ip_str,
3487 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003488{
3489 int ret;
3490 struct peer *peer;
3491 u_int32_t keepalive;
3492 u_int32_t holdtime;
3493
3494 peer = peer_and_group_lookup_vty (vty, ip_str);
3495 if (! peer)
3496 return CMD_WARNING;
3497
3498 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3499 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3500
3501 ret = peer_timers_set (peer, keepalive, holdtime);
3502
3503 return bgp_vty_return (vty, ret);
3504}
David Lamparter6b0655a2014-06-04 06:53:35 +02003505
paul94f2b392005-06-28 12:44:16 +00003506static int
paulfd79ac92004-10-13 05:06:08 +00003507peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003508{
3509 int ret;
3510 struct peer *peer;
3511
3512 peer = peer_lookup_vty (vty, ip_str);
3513 if (! peer)
3514 return CMD_WARNING;
3515
3516 ret = peer_timers_unset (peer);
3517
3518 return bgp_vty_return (vty, ret);
3519}
3520
3521DEFUN (neighbor_timers,
3522 neighbor_timers_cmd,
3523 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3524 NEIGHBOR_STR
3525 NEIGHBOR_ADDR_STR2
3526 "BGP per neighbor timers\n"
3527 "Keepalive interval\n"
3528 "Holdtime\n")
3529{
3530 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3531}
3532
3533DEFUN (no_neighbor_timers,
3534 no_neighbor_timers_cmd,
3535 NO_NEIGHBOR_CMD2 "timers",
3536 NO_STR
3537 NEIGHBOR_STR
3538 NEIGHBOR_ADDR_STR2
3539 "BGP per neighbor timers\n")
3540{
3541 return peer_timers_unset_vty (vty, argv[0]);
3542}
David Lamparter6b0655a2014-06-04 06:53:35 +02003543
paul94f2b392005-06-28 12:44:16 +00003544static int
paulfd79ac92004-10-13 05:06:08 +00003545peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3546 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003547{
paul718e3742002-12-13 20:15:29 +00003548 struct peer *peer;
3549 u_int32_t connect;
3550
Daniel Walton0d7435f2015-10-22 11:35:20 +03003551 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003552 if (! peer)
3553 return CMD_WARNING;
3554
3555 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3556
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003557 return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
paul718e3742002-12-13 20:15:29 +00003558}
3559
paul94f2b392005-06-28 12:44:16 +00003560static int
paulfd79ac92004-10-13 05:06:08 +00003561peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003562{
paul718e3742002-12-13 20:15:29 +00003563 struct peer *peer;
3564
3565 peer = peer_and_group_lookup_vty (vty, ip_str);
3566 if (! peer)
3567 return CMD_WARNING;
3568
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003569 return bgp_vty_return (vty, peer_timers_connect_unset (peer));
paul718e3742002-12-13 20:15:29 +00003570}
3571
3572DEFUN (neighbor_timers_connect,
3573 neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003574 NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003575 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003576 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003577 "BGP per neighbor timers\n"
3578 "BGP connect timer\n"
3579 "Connect timer\n")
3580{
3581 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3582}
3583
3584DEFUN (no_neighbor_timers_connect,
3585 no_neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003586 NO_NEIGHBOR_CMD2 "timers connect",
paul718e3742002-12-13 20:15:29 +00003587 NO_STR
3588 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003589 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003590 "BGP per neighbor timers\n"
3591 "BGP connect timer\n")
3592{
3593 return peer_timers_connect_unset_vty (vty, argv[0]);
3594}
3595
3596ALIAS (no_neighbor_timers_connect,
3597 no_neighbor_timers_connect_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003598 NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003599 NO_STR
3600 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003601 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003602 "BGP per neighbor timers\n"
3603 "BGP connect timer\n"
3604 "Connect timer\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003605
paul94f2b392005-06-28 12:44:16 +00003606static int
paulfd79ac92004-10-13 05:06:08 +00003607peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3608 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003609{
3610 int ret;
3611 struct peer *peer;
3612 u_int32_t routeadv = 0;
3613
Daniel Walton0d7435f2015-10-22 11:35:20 +03003614 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003615 if (! peer)
3616 return CMD_WARNING;
3617
3618 if (time_str)
3619 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3620
3621 if (set)
3622 ret = peer_advertise_interval_set (peer, routeadv);
3623 else
3624 ret = peer_advertise_interval_unset (peer);
3625
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003626 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003627}
3628
3629DEFUN (neighbor_advertise_interval,
3630 neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003631 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003632 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003633 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003634 "Minimum interval between sending BGP routing updates\n"
3635 "time in seconds\n")
3636{
3637 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3638}
3639
3640DEFUN (no_neighbor_advertise_interval,
3641 no_neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003642 NO_NEIGHBOR_CMD2 "advertisement-interval",
paul718e3742002-12-13 20:15:29 +00003643 NO_STR
3644 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003645 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003646 "Minimum interval between sending BGP routing updates\n")
3647{
3648 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3649}
3650
3651ALIAS (no_neighbor_advertise_interval,
3652 no_neighbor_advertise_interval_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003653 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003654 NO_STR
3655 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003656 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003657 "Minimum interval between sending BGP routing updates\n"
3658 "time in seconds\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003659
paul718e3742002-12-13 20:15:29 +00003660/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003661static int
paulfd79ac92004-10-13 05:06:08 +00003662peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003663{
3664 int ret;
3665 struct peer *peer;
3666
3667 peer = peer_lookup_vty (vty, ip_str);
3668 if (! peer)
3669 return CMD_WARNING;
3670
3671 if (str)
3672 ret = peer_interface_set (peer, str);
3673 else
3674 ret = peer_interface_unset (peer);
3675
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003676 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003677}
3678
3679DEFUN (neighbor_interface,
3680 neighbor_interface_cmd,
3681 NEIGHBOR_CMD "interface WORD",
3682 NEIGHBOR_STR
3683 NEIGHBOR_ADDR_STR
3684 "Interface\n"
3685 "Interface name\n")
3686{
3687 return peer_interface_vty (vty, argv[0], argv[1]);
3688}
3689
3690DEFUN (no_neighbor_interface,
3691 no_neighbor_interface_cmd,
3692 NO_NEIGHBOR_CMD "interface WORD",
3693 NO_STR
3694 NEIGHBOR_STR
3695 NEIGHBOR_ADDR_STR
3696 "Interface\n"
3697 "Interface name\n")
3698{
3699 return peer_interface_vty (vty, argv[0], NULL);
3700}
David Lamparter6b0655a2014-06-04 06:53:35 +02003701
paul718e3742002-12-13 20:15:29 +00003702/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003703static int
paulfd79ac92004-10-13 05:06:08 +00003704peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3705 afi_t afi, safi_t safi,
3706 const char *name_str, 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_distribute_set (peer, afi, safi, direct, name_str);
3723
3724 return bgp_vty_return (vty, ret);
3725}
3726
paul94f2b392005-06-28 12:44:16 +00003727static int
paulfd79ac92004-10-13 05:06:08 +00003728peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3729 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003730{
3731 int ret;
3732 struct peer *peer;
3733 int direct = FILTER_IN;
3734
3735 peer = peer_and_group_lookup_vty (vty, ip_str);
3736 if (! peer)
3737 return CMD_WARNING;
3738
3739 /* Check filter direction. */
3740 if (strncmp (direct_str, "i", 1) == 0)
3741 direct = FILTER_IN;
3742 else if (strncmp (direct_str, "o", 1) == 0)
3743 direct = FILTER_OUT;
3744
3745 ret = peer_distribute_unset (peer, afi, safi, direct);
3746
3747 return bgp_vty_return (vty, ret);
3748}
3749
3750DEFUN (neighbor_distribute_list,
3751 neighbor_distribute_list_cmd,
3752 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3753 NEIGHBOR_STR
3754 NEIGHBOR_ADDR_STR2
3755 "Filter updates to/from this neighbor\n"
3756 "IP access-list number\n"
3757 "IP access-list number (expanded range)\n"
3758 "IP Access-list name\n"
3759 "Filter incoming updates\n"
3760 "Filter outgoing updates\n")
3761{
3762 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3763 bgp_node_safi (vty), argv[1], argv[2]);
3764}
3765
3766DEFUN (no_neighbor_distribute_list,
3767 no_neighbor_distribute_list_cmd,
3768 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3769 NO_STR
3770 NEIGHBOR_STR
3771 NEIGHBOR_ADDR_STR2
3772 "Filter updates to/from this neighbor\n"
3773 "IP access-list number\n"
3774 "IP access-list number (expanded range)\n"
3775 "IP Access-list name\n"
3776 "Filter incoming updates\n"
3777 "Filter outgoing updates\n")
3778{
3779 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3780 bgp_node_safi (vty), argv[2]);
3781}
David Lamparter6b0655a2014-06-04 06:53:35 +02003782
paul718e3742002-12-13 20:15:29 +00003783/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003784static int
paulfd79ac92004-10-13 05:06:08 +00003785peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3786 safi_t safi, const char *name_str,
3787 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003788{
3789 int ret;
3790 struct peer *peer;
3791 int direct = FILTER_IN;
3792
3793 peer = peer_and_group_lookup_vty (vty, ip_str);
3794 if (! peer)
3795 return CMD_WARNING;
3796
3797 /* Check filter direction. */
3798 if (strncmp (direct_str, "i", 1) == 0)
3799 direct = FILTER_IN;
3800 else if (strncmp (direct_str, "o", 1) == 0)
3801 direct = FILTER_OUT;
3802
3803 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3804
3805 return bgp_vty_return (vty, ret);
3806}
3807
paul94f2b392005-06-28 12:44:16 +00003808static int
paulfd79ac92004-10-13 05:06:08 +00003809peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3810 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003811{
3812 int ret;
3813 struct peer *peer;
3814 int direct = FILTER_IN;
3815
3816 peer = peer_and_group_lookup_vty (vty, ip_str);
3817 if (! peer)
3818 return CMD_WARNING;
3819
3820 /* Check filter direction. */
3821 if (strncmp (direct_str, "i", 1) == 0)
3822 direct = FILTER_IN;
3823 else if (strncmp (direct_str, "o", 1) == 0)
3824 direct = FILTER_OUT;
3825
3826 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3827
3828 return bgp_vty_return (vty, ret);
3829}
3830
3831DEFUN (neighbor_prefix_list,
3832 neighbor_prefix_list_cmd,
3833 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3834 NEIGHBOR_STR
3835 NEIGHBOR_ADDR_STR2
3836 "Filter updates to/from this neighbor\n"
3837 "Name of a prefix list\n"
3838 "Filter incoming updates\n"
3839 "Filter outgoing updates\n")
3840{
3841 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3842 bgp_node_safi (vty), argv[1], argv[2]);
3843}
3844
3845DEFUN (no_neighbor_prefix_list,
3846 no_neighbor_prefix_list_cmd,
3847 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3848 NO_STR
3849 NEIGHBOR_STR
3850 NEIGHBOR_ADDR_STR2
3851 "Filter updates to/from this neighbor\n"
3852 "Name of a prefix list\n"
3853 "Filter incoming updates\n"
3854 "Filter outgoing updates\n")
3855{
3856 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3857 bgp_node_safi (vty), argv[2]);
3858}
David Lamparter6b0655a2014-06-04 06:53:35 +02003859
paul94f2b392005-06-28 12:44:16 +00003860static int
paulfd79ac92004-10-13 05:06:08 +00003861peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3862 afi_t afi, safi_t safi,
3863 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003864{
3865 int ret;
3866 struct peer *peer;
3867 int direct = FILTER_IN;
3868
3869 peer = peer_and_group_lookup_vty (vty, ip_str);
3870 if (! peer)
3871 return CMD_WARNING;
3872
3873 /* Check filter direction. */
3874 if (strncmp (direct_str, "i", 1) == 0)
3875 direct = FILTER_IN;
3876 else if (strncmp (direct_str, "o", 1) == 0)
3877 direct = FILTER_OUT;
3878
3879 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3880
3881 return bgp_vty_return (vty, ret);
3882}
3883
paul94f2b392005-06-28 12:44:16 +00003884static int
paulfd79ac92004-10-13 05:06:08 +00003885peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3886 afi_t afi, safi_t safi,
3887 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003888{
3889 int ret;
3890 struct peer *peer;
3891 int direct = FILTER_IN;
3892
3893 peer = peer_and_group_lookup_vty (vty, ip_str);
3894 if (! peer)
3895 return CMD_WARNING;
3896
3897 /* Check filter direction. */
3898 if (strncmp (direct_str, "i", 1) == 0)
3899 direct = FILTER_IN;
3900 else if (strncmp (direct_str, "o", 1) == 0)
3901 direct = FILTER_OUT;
3902
3903 ret = peer_aslist_unset (peer, afi, safi, direct);
3904
3905 return bgp_vty_return (vty, ret);
3906}
3907
3908DEFUN (neighbor_filter_list,
3909 neighbor_filter_list_cmd,
3910 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3911 NEIGHBOR_STR
3912 NEIGHBOR_ADDR_STR2
3913 "Establish BGP filters\n"
3914 "AS path access-list name\n"
3915 "Filter incoming routes\n"
3916 "Filter outgoing routes\n")
3917{
3918 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3919 bgp_node_safi (vty), argv[1], argv[2]);
3920}
3921
3922DEFUN (no_neighbor_filter_list,
3923 no_neighbor_filter_list_cmd,
3924 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3925 NO_STR
3926 NEIGHBOR_STR
3927 NEIGHBOR_ADDR_STR2
3928 "Establish BGP filters\n"
3929 "AS path access-list name\n"
3930 "Filter incoming routes\n"
3931 "Filter outgoing routes\n")
3932{
3933 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3934 bgp_node_safi (vty), argv[2]);
3935}
David Lamparter6b0655a2014-06-04 06:53:35 +02003936
paul718e3742002-12-13 20:15:29 +00003937/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003938static int
paulfd79ac92004-10-13 05:06:08 +00003939peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3940 afi_t afi, safi_t safi,
3941 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003942{
3943 int ret;
3944 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003945 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003946
3947 peer = peer_and_group_lookup_vty (vty, ip_str);
3948 if (! peer)
3949 return CMD_WARNING;
3950
3951 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003952 if (strncmp (direct_str, "in", 2) == 0)
3953 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003954 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003955 direct = RMAP_OUT;
3956 else if (strncmp (direct_str, "im", 2) == 0)
3957 direct = RMAP_IMPORT;
3958 else if (strncmp (direct_str, "e", 1) == 0)
3959 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003960
3961 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3962
3963 return bgp_vty_return (vty, ret);
3964}
3965
paul94f2b392005-06-28 12:44:16 +00003966static int
paulfd79ac92004-10-13 05:06:08 +00003967peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3968 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003969{
3970 int ret;
3971 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003972 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003973
3974 peer = peer_and_group_lookup_vty (vty, ip_str);
3975 if (! peer)
3976 return CMD_WARNING;
3977
3978 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003979 if (strncmp (direct_str, "in", 2) == 0)
3980 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003981 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003982 direct = RMAP_OUT;
3983 else if (strncmp (direct_str, "im", 2) == 0)
3984 direct = RMAP_IMPORT;
3985 else if (strncmp (direct_str, "e", 1) == 0)
3986 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003987
3988 ret = peer_route_map_unset (peer, afi, safi, direct);
3989
3990 return bgp_vty_return (vty, ret);
3991}
3992
3993DEFUN (neighbor_route_map,
3994 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003995 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003996 NEIGHBOR_STR
3997 NEIGHBOR_ADDR_STR2
3998 "Apply route map to neighbor\n"
3999 "Name of route map\n"
4000 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00004001 "Apply map to outbound routes\n"
4002 "Apply map to routes going into a Route-Server client's table\n"
4003 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00004004{
4005 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
4006 bgp_node_safi (vty), argv[1], argv[2]);
4007}
4008
4009DEFUN (no_neighbor_route_map,
4010 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00004011 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00004012 NO_STR
4013 NEIGHBOR_STR
4014 NEIGHBOR_ADDR_STR2
4015 "Apply route map to neighbor\n"
4016 "Name of route map\n"
4017 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00004018 "Apply map to outbound routes\n"
4019 "Apply map to routes going into a Route-Server client's table\n"
4020 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00004021{
4022 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
4023 bgp_node_safi (vty), argv[2]);
4024}
David Lamparter6b0655a2014-06-04 06:53:35 +02004025
paul718e3742002-12-13 20:15:29 +00004026/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00004027static int
paulfd79ac92004-10-13 05:06:08 +00004028peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
4029 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00004030{
4031 int ret;
4032 struct peer *peer;
4033
4034 peer = peer_and_group_lookup_vty (vty, ip_str);
4035 if (! peer)
4036 return CMD_WARNING;
4037
4038 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
4039
4040 return bgp_vty_return (vty, ret);
4041}
4042
4043/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00004044static int
paulfd79ac92004-10-13 05:06:08 +00004045peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00004046 safi_t safi)
4047{
4048 int ret;
4049 struct peer *peer;
4050
4051 peer = peer_and_group_lookup_vty (vty, ip_str);
4052 if (! peer)
4053 return CMD_WARNING;
4054
4055 ret = peer_unsuppress_map_unset (peer, afi, safi);
4056
4057 return bgp_vty_return (vty, ret);
4058}
4059
4060DEFUN (neighbor_unsuppress_map,
4061 neighbor_unsuppress_map_cmd,
4062 NEIGHBOR_CMD2 "unsuppress-map WORD",
4063 NEIGHBOR_STR
4064 NEIGHBOR_ADDR_STR2
4065 "Route-map to selectively unsuppress suppressed routes\n"
4066 "Name of route map\n")
4067{
4068 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
4069 bgp_node_safi (vty), argv[1]);
4070}
4071
4072DEFUN (no_neighbor_unsuppress_map,
4073 no_neighbor_unsuppress_map_cmd,
4074 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
4075 NO_STR
4076 NEIGHBOR_STR
4077 NEIGHBOR_ADDR_STR2
4078 "Route-map to selectively unsuppress suppressed routes\n"
4079 "Name of route map\n")
4080{
4081 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
4082 bgp_node_safi (vty));
4083}
David Lamparter6b0655a2014-06-04 06:53:35 +02004084
paul94f2b392005-06-28 12:44:16 +00004085static int
paulfd79ac92004-10-13 05:06:08 +00004086peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
4087 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00004088 const char *threshold_str, int warning,
4089 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00004090{
4091 int ret;
4092 struct peer *peer;
4093 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00004094 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00004095 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00004096
4097 peer = peer_and_group_lookup_vty (vty, ip_str);
4098 if (! peer)
4099 return CMD_WARNING;
4100
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04004101 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00004102 if (threshold_str)
4103 threshold = atoi (threshold_str);
4104 else
4105 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004106
hasso0a486e52005-02-01 20:57:17 +00004107 if (restart_str)
4108 restart = atoi (restart_str);
4109 else
4110 restart = 0;
4111
4112 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00004113
4114 return bgp_vty_return (vty, ret);
4115}
4116
paul94f2b392005-06-28 12:44:16 +00004117static int
paulfd79ac92004-10-13 05:06:08 +00004118peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00004119 safi_t safi)
4120{
4121 int ret;
4122 struct peer *peer;
4123
4124 peer = peer_and_group_lookup_vty (vty, ip_str);
4125 if (! peer)
4126 return CMD_WARNING;
4127
4128 ret = peer_maximum_prefix_unset (peer, afi, safi);
4129
4130 return bgp_vty_return (vty, ret);
4131}
4132
4133/* Maximum number of prefix configuration. prefix count is different
4134 for each peer configuration. So this configuration can be set for
4135 each peer configuration. */
4136DEFUN (neighbor_maximum_prefix,
4137 neighbor_maximum_prefix_cmd,
4138 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4139 NEIGHBOR_STR
4140 NEIGHBOR_ADDR_STR2
4141 "Maximum number of prefix accept from this peer\n"
4142 "maximum no. of prefix limit\n")
4143{
4144 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004145 bgp_node_safi (vty), argv[1], NULL, 0,
4146 NULL);
paul718e3742002-12-13 20:15:29 +00004147}
4148
hassoe0701b72004-05-20 09:19:34 +00004149DEFUN (neighbor_maximum_prefix_threshold,
4150 neighbor_maximum_prefix_threshold_cmd,
4151 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
4152 NEIGHBOR_STR
4153 NEIGHBOR_ADDR_STR2
4154 "Maximum number of prefix accept from this peer\n"
4155 "maximum no. of prefix limit\n"
4156 "Threshold value (%) at which to generate a warning msg\n")
4157{
4158 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004159 bgp_node_safi (vty), argv[1], argv[2], 0,
4160 NULL);
4161}
hassoe0701b72004-05-20 09:19:34 +00004162
paul718e3742002-12-13 20:15:29 +00004163DEFUN (neighbor_maximum_prefix_warning,
4164 neighbor_maximum_prefix_warning_cmd,
4165 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4166 NEIGHBOR_STR
4167 NEIGHBOR_ADDR_STR2
4168 "Maximum number of prefix accept from this peer\n"
4169 "maximum no. of prefix limit\n"
4170 "Only give warning message when limit is exceeded\n")
4171{
4172 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004173 bgp_node_safi (vty), argv[1], NULL, 1,
4174 NULL);
paul718e3742002-12-13 20:15:29 +00004175}
4176
hassoe0701b72004-05-20 09:19:34 +00004177DEFUN (neighbor_maximum_prefix_threshold_warning,
4178 neighbor_maximum_prefix_threshold_warning_cmd,
4179 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4180 NEIGHBOR_STR
4181 NEIGHBOR_ADDR_STR2
4182 "Maximum number of prefix accept from this peer\n"
4183 "maximum no. of prefix limit\n"
4184 "Threshold value (%) at which to generate a warning msg\n"
4185 "Only give warning message when limit is exceeded\n")
4186{
4187 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004188 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4189}
4190
4191DEFUN (neighbor_maximum_prefix_restart,
4192 neighbor_maximum_prefix_restart_cmd,
4193 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
4194 NEIGHBOR_STR
4195 NEIGHBOR_ADDR_STR2
4196 "Maximum number of prefix accept from this peer\n"
4197 "maximum no. of prefix limit\n"
4198 "Restart bgp connection after limit is exceeded\n"
4199 "Restart interval in minutes")
4200{
4201 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4202 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
4203}
4204
4205DEFUN (neighbor_maximum_prefix_threshold_restart,
4206 neighbor_maximum_prefix_threshold_restart_cmd,
4207 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4208 NEIGHBOR_STR
4209 NEIGHBOR_ADDR_STR2
4210 "Maximum number of prefix accept from this peer\n"
4211 "maximum no. of prefix limit\n"
4212 "Threshold value (%) at which to generate a warning msg\n"
4213 "Restart bgp connection after limit is exceeded\n"
4214 "Restart interval in minutes")
4215{
4216 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4217 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4218}
hassoe0701b72004-05-20 09:19:34 +00004219
paul718e3742002-12-13 20:15:29 +00004220DEFUN (no_neighbor_maximum_prefix,
4221 no_neighbor_maximum_prefix_cmd,
4222 NO_NEIGHBOR_CMD2 "maximum-prefix",
4223 NO_STR
4224 NEIGHBOR_STR
4225 NEIGHBOR_ADDR_STR2
4226 "Maximum number of prefix accept from this peer\n")
4227{
4228 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4229 bgp_node_safi (vty));
4230}
4231
4232ALIAS (no_neighbor_maximum_prefix,
4233 no_neighbor_maximum_prefix_val_cmd,
4234 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4235 NO_STR
4236 NEIGHBOR_STR
4237 NEIGHBOR_ADDR_STR2
4238 "Maximum number of prefix accept from this peer\n"
4239 "maximum no. of prefix limit\n")
4240
4241ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004242 no_neighbor_maximum_prefix_threshold_cmd,
4243 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4244 NO_STR
4245 NEIGHBOR_STR
4246 NEIGHBOR_ADDR_STR2
4247 "Maximum number of prefix accept from this peer\n"
4248 "maximum no. of prefix limit\n"
4249 "Threshold value (%) at which to generate a warning msg\n")
4250
4251ALIAS (no_neighbor_maximum_prefix,
4252 no_neighbor_maximum_prefix_warning_cmd,
4253 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4254 NO_STR
4255 NEIGHBOR_STR
4256 NEIGHBOR_ADDR_STR2
4257 "Maximum number of prefix accept from this peer\n"
4258 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00004259 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004260
4261ALIAS (no_neighbor_maximum_prefix,
4262 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004263 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4264 NO_STR
4265 NEIGHBOR_STR
4266 NEIGHBOR_ADDR_STR2
4267 "Maximum number of prefix accept from this peer\n"
4268 "maximum no. of prefix limit\n"
4269 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004270 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004271
4272ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004273 no_neighbor_maximum_prefix_restart_cmd,
4274 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004275 NO_STR
4276 NEIGHBOR_STR
4277 NEIGHBOR_ADDR_STR2
4278 "Maximum number of prefix accept from this peer\n"
4279 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00004280 "Restart bgp connection after limit is exceeded\n"
4281 "Restart interval in minutes")
4282
4283ALIAS (no_neighbor_maximum_prefix,
4284 no_neighbor_maximum_prefix_threshold_restart_cmd,
4285 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4286 NO_STR
4287 NEIGHBOR_STR
4288 NEIGHBOR_ADDR_STR2
4289 "Maximum number of prefix accept from this peer\n"
4290 "maximum no. of prefix limit\n"
4291 "Threshold value (%) at which to generate a warning msg\n"
4292 "Restart bgp connection after limit is exceeded\n"
4293 "Restart interval in minutes")
David Lamparter6b0655a2014-06-04 06:53:35 +02004294
paul718e3742002-12-13 20:15:29 +00004295/* "neighbor allowas-in" */
4296DEFUN (neighbor_allowas_in,
4297 neighbor_allowas_in_cmd,
4298 NEIGHBOR_CMD2 "allowas-in",
4299 NEIGHBOR_STR
4300 NEIGHBOR_ADDR_STR2
4301 "Accept as-path with my AS present in it\n")
4302{
4303 int ret;
4304 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004305 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004306
4307 peer = peer_and_group_lookup_vty (vty, argv[0]);
4308 if (! peer)
4309 return CMD_WARNING;
4310
4311 if (argc == 1)
4312 allow_num = 3;
4313 else
4314 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4315
4316 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4317 allow_num);
4318
4319 return bgp_vty_return (vty, ret);
4320}
4321
4322ALIAS (neighbor_allowas_in,
4323 neighbor_allowas_in_arg_cmd,
4324 NEIGHBOR_CMD2 "allowas-in <1-10>",
4325 NEIGHBOR_STR
4326 NEIGHBOR_ADDR_STR2
4327 "Accept as-path with my AS present in it\n"
4328 "Number of occurances of AS number\n")
4329
4330DEFUN (no_neighbor_allowas_in,
4331 no_neighbor_allowas_in_cmd,
4332 NO_NEIGHBOR_CMD2 "allowas-in",
4333 NO_STR
4334 NEIGHBOR_STR
4335 NEIGHBOR_ADDR_STR2
4336 "allow local ASN appears in aspath attribute\n")
4337{
4338 int ret;
4339 struct peer *peer;
4340
4341 peer = peer_and_group_lookup_vty (vty, argv[0]);
4342 if (! peer)
4343 return CMD_WARNING;
4344
4345 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4346
4347 return bgp_vty_return (vty, ret);
4348}
David Lamparter6b0655a2014-06-04 06:53:35 +02004349
Nick Hilliardfa411a22011-03-23 15:33:17 +00004350DEFUN (neighbor_ttl_security,
4351 neighbor_ttl_security_cmd,
4352 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4353 NEIGHBOR_STR
4354 NEIGHBOR_ADDR_STR2
4355 "Specify the maximum number of hops to the BGP peer\n")
4356{
4357 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004358 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004359
4360 peer = peer_and_group_lookup_vty (vty, argv[0]);
4361 if (! peer)
4362 return CMD_WARNING;
4363
4364 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4365
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004366 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004367}
4368
4369DEFUN (no_neighbor_ttl_security,
4370 no_neighbor_ttl_security_cmd,
4371 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4372 NO_STR
4373 NEIGHBOR_STR
4374 NEIGHBOR_ADDR_STR2
4375 "Specify the maximum number of hops to the BGP peer\n")
4376{
4377 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004378
4379 peer = peer_and_group_lookup_vty (vty, argv[0]);
4380 if (! peer)
4381 return CMD_WARNING;
4382
Timo Teräse3443a22016-10-19 16:02:34 +03004383 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, 0));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004384}
David Lamparter6b0655a2014-06-04 06:53:35 +02004385
paul718e3742002-12-13 20:15:29 +00004386/* Address family configuration. */
4387DEFUN (address_family_ipv4,
4388 address_family_ipv4_cmd,
4389 "address-family ipv4",
4390 "Enter Address Family command mode\n"
4391 "Address family\n")
4392{
4393 vty->node = BGP_IPV4_NODE;
4394 return CMD_SUCCESS;
4395}
4396
4397DEFUN (address_family_ipv4_safi,
4398 address_family_ipv4_safi_cmd,
4399 "address-family ipv4 (unicast|multicast)",
4400 "Enter Address Family command mode\n"
4401 "Address family\n"
4402 "Address Family modifier\n"
4403 "Address Family modifier\n")
4404{
4405 if (strncmp (argv[0], "m", 1) == 0)
4406 vty->node = BGP_IPV4M_NODE;
4407 else
4408 vty->node = BGP_IPV4_NODE;
4409
4410 return CMD_SUCCESS;
4411}
4412
paul25ffbdc2005-08-22 22:42:08 +00004413DEFUN (address_family_ipv6,
4414 address_family_ipv6_cmd,
4415 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004416 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004417 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004418{
4419 vty->node = BGP_IPV6_NODE;
4420 return CMD_SUCCESS;
4421}
4422
paul25ffbdc2005-08-22 22:42:08 +00004423DEFUN (address_family_ipv6_safi,
4424 address_family_ipv6_safi_cmd,
4425 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004426 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004427 "Address family\n"
4428 "Address Family modifier\n"
4429 "Address Family modifier\n")
4430{
4431 if (strncmp (argv[0], "m", 1) == 0)
4432 vty->node = BGP_IPV6M_NODE;
4433 else
4434 vty->node = BGP_IPV6_NODE;
4435
4436 return CMD_SUCCESS;
4437}
paul718e3742002-12-13 20:15:29 +00004438
4439DEFUN (address_family_vpnv4,
4440 address_family_vpnv4_cmd,
4441 "address-family vpnv4",
4442 "Enter Address Family command mode\n"
4443 "Address family\n")
4444{
4445 vty->node = BGP_VPNV4_NODE;
4446 return CMD_SUCCESS;
4447}
4448
4449ALIAS (address_family_vpnv4,
4450 address_family_vpnv4_unicast_cmd,
4451 "address-family vpnv4 unicast",
4452 "Enter Address Family command mode\n"
4453 "Address family\n"
4454 "Address Family Modifier\n")
4455
Lou Berger13c378d2016-01-12 13:41:56 -05004456DEFUN (address_family_vpnv6,
4457 address_family_vpnv6_cmd,
4458 "address-family vpnv6",
4459 "Enter Address Family command mode\n"
4460 "Address family\n")
4461{
4462 vty->node = BGP_VPNV6_NODE;
4463 return CMD_SUCCESS;
4464}
4465
4466ALIAS (address_family_vpnv6,
4467 address_family_vpnv6_unicast_cmd,
4468 "address-family vpnv6 unicast",
4469 "Enter Address Family command mode\n"
4470 "Address family\n"
4471 "Address Family Modifier\n")
4472
Lou Bergera3fda882016-01-12 13:42:04 -05004473DEFUN (address_family_encap,
4474 address_family_encap_cmd,
4475 "address-family encap",
4476 "Enter Address Family command mode\n"
4477 "Address family\n")
4478{
4479 vty->node = BGP_ENCAP_NODE;
4480 return CMD_SUCCESS;
4481}
4482
4483ALIAS (address_family_encap,
4484 address_family_encapv4_cmd,
4485 "address-family encapv4",
4486 "Enter Address Family command mode\n"
4487 "Address family\n")
4488
4489DEFUN (address_family_encapv6,
4490 address_family_encapv6_cmd,
4491 "address-family encapv6",
4492 "Enter Address Family command mode\n"
4493 "Address family\n")
4494{
4495 vty->node = BGP_ENCAPV6_NODE;
4496 return CMD_SUCCESS;
4497}
4498
paul718e3742002-12-13 20:15:29 +00004499DEFUN (exit_address_family,
4500 exit_address_family_cmd,
4501 "exit-address-family",
4502 "Exit from Address Family configuration mode\n")
4503{
Lou Bergera3fda882016-01-12 13:42:04 -05004504 /* should match list in command.c:config_exit */
hassoa8a80d52005-04-09 13:07:47 +00004505 if (vty->node == BGP_IPV4_NODE
Lou Bergera3fda882016-01-12 13:42:04 -05004506 || vty->node == BGP_ENCAP_NODE
4507 || vty->node == BGP_ENCAPV6_NODE
hassoa8a80d52005-04-09 13:07:47 +00004508 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004509 || vty->node == BGP_VPNV4_NODE
Lou Berger13c378d2016-01-12 13:41:56 -05004510 || vty->node == BGP_VPNV6_NODE
paul25ffbdc2005-08-22 22:42:08 +00004511 || vty->node == BGP_IPV6_NODE
4512 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004513 vty->node = BGP_NODE;
4514 return CMD_SUCCESS;
4515}
David Lamparter6b0655a2014-06-04 06:53:35 +02004516
paul718e3742002-12-13 20:15:29 +00004517/* BGP clear sort. */
4518enum clear_sort
4519{
4520 clear_all,
4521 clear_peer,
4522 clear_group,
4523 clear_external,
4524 clear_as
4525};
4526
paul94f2b392005-06-28 12:44:16 +00004527static void
paul718e3742002-12-13 20:15:29 +00004528bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4529 safi_t safi, int error)
4530{
4531 switch (error)
4532 {
4533 case BGP_ERR_AF_UNCONFIGURED:
4534 vty_out (vty,
4535 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4536 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4537 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4538 peer->host, VTY_NEWLINE);
4539 break;
4540 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4541 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);
4542 break;
4543 default:
4544 break;
4545 }
4546}
4547
4548/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004549static int
paul718e3742002-12-13 20:15:29 +00004550bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004551 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004552{
4553 int ret;
4554 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004555 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004556
4557 /* Clear all neighbors. */
4558 if (sort == clear_all)
4559 {
paul1eb8ef22005-04-07 07:30:20 +00004560 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004561 {
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 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004570 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004571 }
4572
4573 /* Clear specified neighbors. */
4574 if (sort == clear_peer)
4575 {
4576 union sockunion su;
4577 int ret;
4578
4579 /* Make sockunion for lookup. */
4580 ret = str2sockunion (arg, &su);
4581 if (ret < 0)
4582 {
4583 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004584 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004585 }
4586 peer = peer_lookup (bgp, &su);
4587 if (! peer)
4588 {
4589 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004590 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004591 }
4592
4593 if (stype == BGP_CLEAR_SOFT_NONE)
4594 ret = peer_clear (peer);
4595 else
4596 ret = peer_clear_soft (peer, afi, safi, stype);
4597
4598 if (ret < 0)
4599 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4600
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004601 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004602 }
4603
4604 /* Clear all peer-group members. */
4605 if (sort == clear_group)
4606 {
4607 struct peer_group *group;
4608
4609 group = peer_group_lookup (bgp, arg);
4610 if (! group)
4611 {
4612 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004613 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004614 }
4615
paul1eb8ef22005-04-07 07:30:20 +00004616 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004617 {
4618 if (stype == BGP_CLEAR_SOFT_NONE)
4619 {
4620 ret = peer_clear (peer);
4621 continue;
4622 }
4623
4624 if (! peer->af_group[afi][safi])
4625 continue;
4626
4627 ret = peer_clear_soft (peer, afi, safi, stype);
4628
4629 if (ret < 0)
4630 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4631 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004632 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004633 }
4634
4635 if (sort == clear_external)
4636 {
paul1eb8ef22005-04-07 07:30:20 +00004637 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004638 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004639 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004640 continue;
4641
4642 if (stype == BGP_CLEAR_SOFT_NONE)
4643 ret = peer_clear (peer);
4644 else
4645 ret = peer_clear_soft (peer, afi, safi, stype);
4646
4647 if (ret < 0)
4648 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4649 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004650 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004651 }
4652
4653 if (sort == clear_as)
4654 {
4655 as_t as;
paul718e3742002-12-13 20:15:29 +00004656 int find = 0;
4657
Ulrich Weberbde12e32011-11-16 19:32:12 +04004658 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004659
paul1eb8ef22005-04-07 07:30:20 +00004660 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004661 {
4662 if (peer->as != as)
4663 continue;
4664
4665 find = 1;
4666 if (stype == BGP_CLEAR_SOFT_NONE)
4667 ret = peer_clear (peer);
4668 else
4669 ret = peer_clear_soft (peer, afi, safi, stype);
4670
4671 if (ret < 0)
4672 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4673 }
4674 if (! find)
4675 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4676 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004677 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004678 }
4679
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004680 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004681}
4682
Daniel Walton325fcfb2015-05-19 17:58:10 -07004683/* Recalculate bestpath and re-advertise a prefix */
4684static int
4685bgp_clear_prefix (struct vty *vty, char *view_name, const char *ip_str,
4686 afi_t afi, safi_t safi, struct prefix_rd *prd)
4687{
4688 int ret;
4689 struct prefix match;
4690 struct bgp_node *rn;
4691 struct bgp_node *rm;
4692 struct bgp *bgp;
4693 struct bgp_table *table;
4694 struct bgp_table *rib;
4695
4696 /* BGP structure lookup. */
4697 if (view_name)
4698 {
4699 bgp = bgp_lookup_by_name (view_name);
4700 if (bgp == NULL)
4701 {
4702 vty_out (vty, "%% Can't find BGP view %s%s", view_name, VTY_NEWLINE);
4703 return CMD_WARNING;
4704 }
4705 }
4706 else
4707 {
4708 bgp = bgp_get_default ();
4709 if (bgp == NULL)
4710 {
4711 vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE);
4712 return CMD_WARNING;
4713 }
4714 }
4715
4716 /* Check IP address argument. */
4717 ret = str2prefix (ip_str, &match);
4718 if (! ret)
4719 {
4720 vty_out (vty, "%% address is malformed%s", VTY_NEWLINE);
4721 return CMD_WARNING;
4722 }
4723
4724 match.family = afi2family (afi);
4725 rib = bgp->rib[afi][safi];
4726
4727 if (safi == SAFI_MPLS_VPN)
4728 {
4729 for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn))
4730 {
4731 if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0)
4732 continue;
4733
4734 if ((table = rn->info) != NULL)
4735 {
4736 if ((rm = bgp_node_match (table, &match)) != NULL)
4737 {
4738 if (rm->p.prefixlen == match.prefixlen)
4739 {
4740 SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR);
4741 bgp_process (bgp, rm, afi, safi);
4742 }
4743 bgp_unlock_node (rm);
4744 }
4745 }
4746 }
4747 }
4748 else
4749 {
4750 if ((rn = bgp_node_match (rib, &match)) != NULL)
4751 {
4752 if (rn->p.prefixlen == match.prefixlen)
4753 {
4754 SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR);
4755 bgp_process (bgp, rn, afi, safi);
4756 }
4757 bgp_unlock_node (rn);
4758 }
4759 }
4760
4761 return CMD_SUCCESS;
4762}
4763
paul94f2b392005-06-28 12:44:16 +00004764static int
paulfd79ac92004-10-13 05:06:08 +00004765bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4766 enum clear_sort sort, enum bgp_clear_type stype,
4767 const char *arg)
paul718e3742002-12-13 20:15:29 +00004768{
paul718e3742002-12-13 20:15:29 +00004769 struct bgp *bgp;
4770
4771 /* BGP structure lookup. */
4772 if (name)
4773 {
4774 bgp = bgp_lookup_by_name (name);
4775 if (bgp == NULL)
4776 {
4777 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4778 return CMD_WARNING;
4779 }
4780 }
4781 else
4782 {
4783 bgp = bgp_get_default ();
4784 if (bgp == NULL)
4785 {
4786 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4787 return CMD_WARNING;
4788 }
4789 }
4790
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004791 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004792}
4793
4794DEFUN (clear_ip_bgp_all,
4795 clear_ip_bgp_all_cmd,
4796 "clear ip bgp *",
4797 CLEAR_STR
4798 IP_STR
4799 BGP_STR
4800 "Clear all peers\n")
4801{
4802 if (argc == 1)
4803 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4804
4805 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4806}
4807
4808ALIAS (clear_ip_bgp_all,
4809 clear_bgp_all_cmd,
4810 "clear bgp *",
4811 CLEAR_STR
4812 BGP_STR
4813 "Clear all peers\n")
4814
4815ALIAS (clear_ip_bgp_all,
4816 clear_bgp_ipv6_all_cmd,
4817 "clear bgp ipv6 *",
4818 CLEAR_STR
4819 BGP_STR
4820 "Address family\n"
4821 "Clear all peers\n")
4822
4823ALIAS (clear_ip_bgp_all,
4824 clear_ip_bgp_instance_all_cmd,
4825 "clear ip bgp view WORD *",
4826 CLEAR_STR
4827 IP_STR
4828 BGP_STR
4829 "BGP view\n"
4830 "view name\n"
4831 "Clear all peers\n")
4832
4833ALIAS (clear_ip_bgp_all,
4834 clear_bgp_instance_all_cmd,
4835 "clear bgp view WORD *",
4836 CLEAR_STR
4837 BGP_STR
4838 "BGP view\n"
4839 "view name\n"
4840 "Clear all peers\n")
4841
4842DEFUN (clear_ip_bgp_peer,
4843 clear_ip_bgp_peer_cmd,
4844 "clear ip bgp (A.B.C.D|X:X::X:X)",
4845 CLEAR_STR
4846 IP_STR
4847 BGP_STR
4848 "BGP neighbor IP address to clear\n"
4849 "BGP IPv6 neighbor to clear\n")
4850{
4851 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4852}
4853
4854ALIAS (clear_ip_bgp_peer,
4855 clear_bgp_peer_cmd,
4856 "clear bgp (A.B.C.D|X:X::X:X)",
4857 CLEAR_STR
4858 BGP_STR
4859 "BGP neighbor address to clear\n"
4860 "BGP IPv6 neighbor to clear\n")
4861
4862ALIAS (clear_ip_bgp_peer,
4863 clear_bgp_ipv6_peer_cmd,
4864 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4865 CLEAR_STR
4866 BGP_STR
4867 "Address family\n"
4868 "BGP neighbor address to clear\n"
4869 "BGP IPv6 neighbor to clear\n")
4870
4871DEFUN (clear_ip_bgp_peer_group,
4872 clear_ip_bgp_peer_group_cmd,
4873 "clear ip bgp peer-group WORD",
4874 CLEAR_STR
4875 IP_STR
4876 BGP_STR
4877 "Clear all members of peer-group\n"
4878 "BGP peer-group name\n")
4879{
4880 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4881}
4882
4883ALIAS (clear_ip_bgp_peer_group,
4884 clear_bgp_peer_group_cmd,
4885 "clear bgp peer-group WORD",
4886 CLEAR_STR
4887 BGP_STR
4888 "Clear all members of peer-group\n"
4889 "BGP peer-group name\n")
4890
4891ALIAS (clear_ip_bgp_peer_group,
4892 clear_bgp_ipv6_peer_group_cmd,
4893 "clear bgp ipv6 peer-group WORD",
4894 CLEAR_STR
4895 BGP_STR
4896 "Address family\n"
4897 "Clear all members of peer-group\n"
4898 "BGP peer-group name\n")
4899
4900DEFUN (clear_ip_bgp_external,
4901 clear_ip_bgp_external_cmd,
4902 "clear ip bgp external",
4903 CLEAR_STR
4904 IP_STR
4905 BGP_STR
4906 "Clear all external peers\n")
4907{
4908 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4909}
4910
4911ALIAS (clear_ip_bgp_external,
4912 clear_bgp_external_cmd,
4913 "clear bgp external",
4914 CLEAR_STR
4915 BGP_STR
4916 "Clear all external peers\n")
4917
4918ALIAS (clear_ip_bgp_external,
4919 clear_bgp_ipv6_external_cmd,
4920 "clear bgp ipv6 external",
4921 CLEAR_STR
4922 BGP_STR
4923 "Address family\n"
4924 "Clear all external peers\n")
4925
Daniel Walton325fcfb2015-05-19 17:58:10 -07004926DEFUN (clear_ip_bgp_prefix,
4927 clear_ip_bgp_prefix_cmd,
4928 "clear ip bgp prefix A.B.C.D/M",
4929 CLEAR_STR
4930 IP_STR
4931 BGP_STR
4932 "Clear bestpath and re-advertise\n"
4933 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
4934{
4935 return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL);
4936}
4937
4938ALIAS (clear_ip_bgp_prefix,
4939 clear_bgp_prefix_cmd,
4940 "clear bgp prefix A.B.C.D/M",
4941 CLEAR_STR
4942 BGP_STR
4943 "Clear bestpath and re-advertise\n"
4944 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
4945
4946
paul718e3742002-12-13 20:15:29 +00004947DEFUN (clear_ip_bgp_as,
4948 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004949 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004950 CLEAR_STR
4951 IP_STR
4952 BGP_STR
4953 "Clear peers with the AS number\n")
4954{
4955 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4956}
4957
4958ALIAS (clear_ip_bgp_as,
4959 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004960 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004961 CLEAR_STR
4962 BGP_STR
4963 "Clear peers with the AS number\n")
4964
4965ALIAS (clear_ip_bgp_as,
4966 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004967 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004968 CLEAR_STR
4969 BGP_STR
4970 "Address family\n"
4971 "Clear peers with the AS number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02004972
paul718e3742002-12-13 20:15:29 +00004973/* Outbound soft-reconfiguration */
4974DEFUN (clear_ip_bgp_all_soft_out,
4975 clear_ip_bgp_all_soft_out_cmd,
4976 "clear ip bgp * soft out",
4977 CLEAR_STR
4978 IP_STR
4979 BGP_STR
4980 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07004981 BGP_SOFT_STR
4982 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00004983{
4984 if (argc == 1)
4985 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4986 BGP_CLEAR_SOFT_OUT, NULL);
4987
4988 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4989 BGP_CLEAR_SOFT_OUT, NULL);
4990}
4991
4992ALIAS (clear_ip_bgp_all_soft_out,
4993 clear_ip_bgp_all_out_cmd,
4994 "clear ip bgp * out",
4995 CLEAR_STR
4996 IP_STR
4997 BGP_STR
4998 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07004999 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005000
5001ALIAS (clear_ip_bgp_all_soft_out,
5002 clear_ip_bgp_instance_all_soft_out_cmd,
5003 "clear ip bgp view WORD * soft out",
5004 CLEAR_STR
5005 IP_STR
5006 BGP_STR
5007 "BGP view\n"
5008 "view name\n"
5009 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005010 BGP_SOFT_STR
5011 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005012
5013DEFUN (clear_ip_bgp_all_ipv4_soft_out,
5014 clear_ip_bgp_all_ipv4_soft_out_cmd,
5015 "clear ip bgp * ipv4 (unicast|multicast) soft out",
5016 CLEAR_STR
5017 IP_STR
5018 BGP_STR
5019 "Clear all peers\n"
5020 "Address family\n"
5021 "Address Family modifier\n"
5022 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005023 BGP_SOFT_STR
5024 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005025{
5026 if (strncmp (argv[0], "m", 1) == 0)
5027 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5028 BGP_CLEAR_SOFT_OUT, NULL);
5029
5030 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5031 BGP_CLEAR_SOFT_OUT, NULL);
5032}
5033
5034ALIAS (clear_ip_bgp_all_ipv4_soft_out,
5035 clear_ip_bgp_all_ipv4_out_cmd,
5036 "clear ip bgp * ipv4 (unicast|multicast) out",
5037 CLEAR_STR
5038 IP_STR
5039 BGP_STR
5040 "Clear all peers\n"
5041 "Address family\n"
5042 "Address Family modifier\n"
5043 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005044 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005045
5046DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
5047 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
5048 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
5049 CLEAR_STR
5050 IP_STR
5051 BGP_STR
5052 "BGP view\n"
5053 "view name\n"
5054 "Clear all peers\n"
5055 "Address family\n"
5056 "Address Family modifier\n"
5057 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005058 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005059{
5060 if (strncmp (argv[1], "m", 1) == 0)
5061 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5062 BGP_CLEAR_SOFT_OUT, NULL);
5063
5064 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5065 BGP_CLEAR_SOFT_OUT, NULL);
5066}
5067
5068DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
5069 clear_ip_bgp_all_vpnv4_soft_out_cmd,
5070 "clear ip bgp * vpnv4 unicast soft out",
5071 CLEAR_STR
5072 IP_STR
5073 BGP_STR
5074 "Clear all peers\n"
5075 "Address family\n"
5076 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005077 BGP_SOFT_STR
5078 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005079{
5080 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5081 BGP_CLEAR_SOFT_OUT, NULL);
5082}
5083
5084ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
5085 clear_ip_bgp_all_vpnv4_out_cmd,
5086 "clear ip bgp * vpnv4 unicast out",
5087 CLEAR_STR
5088 IP_STR
5089 BGP_STR
5090 "Clear all peers\n"
5091 "Address family\n"
5092 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005093 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005094
Lou Berger298cc2f2016-01-12 13:42:02 -05005095DEFUN (clear_ip_bgp_all_encap_soft_out,
5096 clear_ip_bgp_all_encap_soft_out_cmd,
5097 "clear ip bgp * encap unicast soft out",
5098 CLEAR_STR
5099 IP_STR
5100 BGP_STR
5101 "Clear all peers\n"
5102 "Address family\n"
5103 "Address Family Modifier\n"
5104 "Soft reconfig\n"
5105 "Soft reconfig outbound update\n")
5106{
5107 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
5108 BGP_CLEAR_SOFT_OUT, NULL);
5109}
5110
5111ALIAS (clear_ip_bgp_all_encap_soft_out,
5112 clear_ip_bgp_all_encap_out_cmd,
5113 "clear ip bgp * encap unicast out",
5114 CLEAR_STR
5115 IP_STR
5116 BGP_STR
5117 "Clear all peers\n"
5118 "Address family\n"
5119 "Address Family Modifier\n"
5120 "Soft reconfig outbound update\n")
5121
paul718e3742002-12-13 20:15:29 +00005122DEFUN (clear_bgp_all_soft_out,
5123 clear_bgp_all_soft_out_cmd,
5124 "clear bgp * soft out",
5125 CLEAR_STR
5126 BGP_STR
5127 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005128 BGP_SOFT_STR
5129 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005130{
5131 if (argc == 1)
5132 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5133 BGP_CLEAR_SOFT_OUT, NULL);
5134
5135 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5136 BGP_CLEAR_SOFT_OUT, NULL);
5137}
5138
5139ALIAS (clear_bgp_all_soft_out,
5140 clear_bgp_instance_all_soft_out_cmd,
5141 "clear bgp view WORD * soft out",
5142 CLEAR_STR
5143 BGP_STR
5144 "BGP view\n"
5145 "view name\n"
5146 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005147 BGP_SOFT_STR
5148 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005149
5150ALIAS (clear_bgp_all_soft_out,
5151 clear_bgp_all_out_cmd,
5152 "clear bgp * out",
5153 CLEAR_STR
5154 BGP_STR
5155 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005156 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005157
5158ALIAS (clear_bgp_all_soft_out,
5159 clear_bgp_ipv6_all_soft_out_cmd,
5160 "clear bgp ipv6 * soft out",
5161 CLEAR_STR
5162 BGP_STR
5163 "Address family\n"
5164 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005165 BGP_SOFT_STR
5166 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005167
5168ALIAS (clear_bgp_all_soft_out,
5169 clear_bgp_ipv6_all_out_cmd,
5170 "clear bgp ipv6 * out",
5171 CLEAR_STR
5172 BGP_STR
5173 "Address family\n"
5174 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005175 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005176
Daniel Walton325fcfb2015-05-19 17:58:10 -07005177DEFUN (clear_bgp_ipv6_safi_prefix,
5178 clear_bgp_ipv6_safi_prefix_cmd,
5179 "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M",
5180 CLEAR_STR
5181 BGP_STR
5182 "Address family\n"
5183 "Address Family Modifier\n"
5184 "Clear bestpath and re-advertise\n"
5185 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
5186{
5187 if (strncmp (argv[0], "m", 1) == 0)
5188 return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL);
5189 else
5190 return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL);
5191}
5192
paul718e3742002-12-13 20:15:29 +00005193DEFUN (clear_ip_bgp_peer_soft_out,
5194 clear_ip_bgp_peer_soft_out_cmd,
5195 "clear ip bgp A.B.C.D soft out",
5196 CLEAR_STR
5197 IP_STR
5198 BGP_STR
5199 "BGP neighbor address to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005200 BGP_SOFT_STR
5201 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005202{
5203 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5204 BGP_CLEAR_SOFT_OUT, argv[0]);
5205}
5206
5207ALIAS (clear_ip_bgp_peer_soft_out,
5208 clear_ip_bgp_peer_out_cmd,
5209 "clear ip bgp A.B.C.D out",
5210 CLEAR_STR
5211 IP_STR
5212 BGP_STR
5213 "BGP neighbor address to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005214 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005215
5216DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
5217 clear_ip_bgp_peer_ipv4_soft_out_cmd,
5218 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
5219 CLEAR_STR
5220 IP_STR
5221 BGP_STR
5222 "BGP neighbor address to clear\n"
5223 "Address family\n"
5224 "Address Family modifier\n"
5225 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005226 BGP_SOFT_STR
5227 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005228{
5229 if (strncmp (argv[1], "m", 1) == 0)
5230 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5231 BGP_CLEAR_SOFT_OUT, argv[0]);
5232
5233 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5234 BGP_CLEAR_SOFT_OUT, argv[0]);
5235}
5236
5237ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
5238 clear_ip_bgp_peer_ipv4_out_cmd,
5239 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
5240 CLEAR_STR
5241 IP_STR
5242 BGP_STR
5243 "BGP neighbor address to clear\n"
5244 "Address family\n"
5245 "Address Family modifier\n"
5246 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005247 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005248
5249DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
5250 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
5251 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
5252 CLEAR_STR
5253 IP_STR
5254 BGP_STR
5255 "BGP neighbor address to clear\n"
5256 "Address family\n"
5257 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005258 BGP_SOFT_STR
5259 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005260{
5261 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5262 BGP_CLEAR_SOFT_OUT, argv[0]);
5263}
5264
5265ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
5266 clear_ip_bgp_peer_vpnv4_out_cmd,
5267 "clear ip bgp A.B.C.D vpnv4 unicast out",
5268 CLEAR_STR
5269 IP_STR
5270 BGP_STR
5271 "BGP neighbor address to clear\n"
5272 "Address family\n"
5273 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005274 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005275
Lou Berger298cc2f2016-01-12 13:42:02 -05005276DEFUN (clear_ip_bgp_peer_encap_soft_out,
5277 clear_ip_bgp_peer_encap_soft_out_cmd,
5278 "clear ip bgp A.B.C.D encap unicast soft out",
5279 CLEAR_STR
5280 IP_STR
5281 BGP_STR
5282 "BGP neighbor address to clear\n"
5283 "Address family\n"
5284 "Address Family Modifier\n"
5285 "Soft reconfig\n"
5286 "Soft reconfig outbound update\n")
5287{
5288 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5289 BGP_CLEAR_SOFT_OUT, argv[0]);
5290}
5291
5292ALIAS (clear_ip_bgp_peer_encap_soft_out,
5293 clear_ip_bgp_peer_encap_out_cmd,
5294 "clear ip bgp A.B.C.D encap unicast out",
5295 CLEAR_STR
5296 IP_STR
5297 BGP_STR
5298 "BGP neighbor address to clear\n"
5299 "Address family\n"
5300 "Address Family Modifier\n"
5301 "Soft reconfig outbound update\n")
5302
paul718e3742002-12-13 20:15:29 +00005303DEFUN (clear_bgp_peer_soft_out,
5304 clear_bgp_peer_soft_out_cmd,
5305 "clear bgp (A.B.C.D|X:X::X:X) soft out",
5306 CLEAR_STR
5307 BGP_STR
5308 "BGP neighbor address to clear\n"
5309 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005310 BGP_SOFT_STR
5311 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005312{
5313 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5314 BGP_CLEAR_SOFT_OUT, argv[0]);
5315}
5316
5317ALIAS (clear_bgp_peer_soft_out,
5318 clear_bgp_ipv6_peer_soft_out_cmd,
5319 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
5320 CLEAR_STR
5321 BGP_STR
5322 "Address family\n"
5323 "BGP neighbor address to clear\n"
5324 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005325 BGP_SOFT_STR
5326 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005327
5328ALIAS (clear_bgp_peer_soft_out,
5329 clear_bgp_peer_out_cmd,
5330 "clear bgp (A.B.C.D|X:X::X:X) out",
5331 CLEAR_STR
5332 BGP_STR
5333 "BGP neighbor address to clear\n"
5334 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005335 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005336
5337ALIAS (clear_bgp_peer_soft_out,
5338 clear_bgp_ipv6_peer_out_cmd,
5339 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
5340 CLEAR_STR
5341 BGP_STR
5342 "Address family\n"
5343 "BGP neighbor address to clear\n"
5344 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005345 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005346
5347DEFUN (clear_ip_bgp_peer_group_soft_out,
5348 clear_ip_bgp_peer_group_soft_out_cmd,
5349 "clear ip bgp peer-group WORD soft out",
5350 CLEAR_STR
5351 IP_STR
5352 BGP_STR
5353 "Clear all members of peer-group\n"
5354 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005355 BGP_SOFT_STR
5356 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005357{
5358 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5359 BGP_CLEAR_SOFT_OUT, argv[0]);
5360}
5361
5362ALIAS (clear_ip_bgp_peer_group_soft_out,
5363 clear_ip_bgp_peer_group_out_cmd,
5364 "clear ip bgp peer-group WORD out",
5365 CLEAR_STR
5366 IP_STR
5367 BGP_STR
5368 "Clear all members of peer-group\n"
5369 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005370 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005371
5372DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
5373 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
5374 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
5375 CLEAR_STR
5376 IP_STR
5377 BGP_STR
5378 "Clear all members of peer-group\n"
5379 "BGP peer-group name\n"
5380 "Address family\n"
5381 "Address Family modifier\n"
5382 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005383 BGP_SOFT_STR
5384 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005385{
5386 if (strncmp (argv[1], "m", 1) == 0)
5387 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5388 BGP_CLEAR_SOFT_OUT, argv[0]);
5389
5390 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5391 BGP_CLEAR_SOFT_OUT, argv[0]);
5392}
5393
5394ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
5395 clear_ip_bgp_peer_group_ipv4_out_cmd,
5396 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
5397 CLEAR_STR
5398 IP_STR
5399 BGP_STR
5400 "Clear all members of peer-group\n"
5401 "BGP peer-group name\n"
5402 "Address family\n"
5403 "Address Family modifier\n"
5404 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005405 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005406
5407DEFUN (clear_bgp_peer_group_soft_out,
5408 clear_bgp_peer_group_soft_out_cmd,
5409 "clear bgp peer-group WORD soft out",
5410 CLEAR_STR
5411 BGP_STR
5412 "Clear all members of peer-group\n"
5413 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005414 BGP_SOFT_STR
5415 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005416{
5417 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5418 BGP_CLEAR_SOFT_OUT, argv[0]);
5419}
5420
5421ALIAS (clear_bgp_peer_group_soft_out,
5422 clear_bgp_ipv6_peer_group_soft_out_cmd,
5423 "clear bgp ipv6 peer-group WORD soft out",
5424 CLEAR_STR
5425 BGP_STR
5426 "Address family\n"
5427 "Clear all members of peer-group\n"
5428 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005429 BGP_SOFT_STR
5430 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005431
5432ALIAS (clear_bgp_peer_group_soft_out,
5433 clear_bgp_peer_group_out_cmd,
5434 "clear bgp peer-group WORD out",
5435 CLEAR_STR
5436 BGP_STR
5437 "Clear all members of peer-group\n"
5438 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005439 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005440
5441ALIAS (clear_bgp_peer_group_soft_out,
5442 clear_bgp_ipv6_peer_group_out_cmd,
5443 "clear bgp ipv6 peer-group WORD out",
5444 CLEAR_STR
5445 BGP_STR
5446 "Address family\n"
5447 "Clear all members of peer-group\n"
5448 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005449 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005450
5451DEFUN (clear_ip_bgp_external_soft_out,
5452 clear_ip_bgp_external_soft_out_cmd,
5453 "clear ip bgp external soft out",
5454 CLEAR_STR
5455 IP_STR
5456 BGP_STR
5457 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005458 BGP_SOFT_STR
5459 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005460{
5461 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5462 BGP_CLEAR_SOFT_OUT, NULL);
5463}
5464
5465ALIAS (clear_ip_bgp_external_soft_out,
5466 clear_ip_bgp_external_out_cmd,
5467 "clear ip bgp external out",
5468 CLEAR_STR
5469 IP_STR
5470 BGP_STR
5471 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005472 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005473
5474DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5475 clear_ip_bgp_external_ipv4_soft_out_cmd,
5476 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5477 CLEAR_STR
5478 IP_STR
5479 BGP_STR
5480 "Clear all external peers\n"
5481 "Address family\n"
5482 "Address Family modifier\n"
5483 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005484 BGP_SOFT_STR
5485 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005486{
5487 if (strncmp (argv[0], "m", 1) == 0)
5488 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5489 BGP_CLEAR_SOFT_OUT, NULL);
5490
5491 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5492 BGP_CLEAR_SOFT_OUT, NULL);
5493}
5494
5495ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5496 clear_ip_bgp_external_ipv4_out_cmd,
5497 "clear ip bgp external ipv4 (unicast|multicast) out",
5498 CLEAR_STR
5499 IP_STR
5500 BGP_STR
5501 "Clear all external peers\n"
5502 "Address family\n"
5503 "Address Family modifier\n"
5504 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005505 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005506
5507DEFUN (clear_bgp_external_soft_out,
5508 clear_bgp_external_soft_out_cmd,
5509 "clear bgp external soft out",
5510 CLEAR_STR
5511 BGP_STR
5512 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005513 BGP_SOFT_STR
5514 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005515{
5516 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5517 BGP_CLEAR_SOFT_OUT, NULL);
5518}
5519
5520ALIAS (clear_bgp_external_soft_out,
5521 clear_bgp_ipv6_external_soft_out_cmd,
5522 "clear bgp ipv6 external soft out",
5523 CLEAR_STR
5524 BGP_STR
5525 "Address family\n"
5526 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005527 BGP_SOFT_STR
5528 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005529
5530ALIAS (clear_bgp_external_soft_out,
5531 clear_bgp_external_out_cmd,
5532 "clear bgp external out",
5533 CLEAR_STR
5534 BGP_STR
5535 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005536 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005537
5538ALIAS (clear_bgp_external_soft_out,
5539 clear_bgp_ipv6_external_out_cmd,
5540 "clear bgp ipv6 external WORD out",
5541 CLEAR_STR
5542 BGP_STR
5543 "Address family\n"
5544 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005545 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005546
5547DEFUN (clear_ip_bgp_as_soft_out,
5548 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005549 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005550 CLEAR_STR
5551 IP_STR
5552 BGP_STR
5553 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005554 BGP_SOFT_STR
5555 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005556{
5557 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5558 BGP_CLEAR_SOFT_OUT, argv[0]);
5559}
5560
5561ALIAS (clear_ip_bgp_as_soft_out,
5562 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005563 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005564 CLEAR_STR
5565 IP_STR
5566 BGP_STR
5567 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005568 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005569
5570DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5571 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005572 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005573 CLEAR_STR
5574 IP_STR
5575 BGP_STR
5576 "Clear peers with the AS number\n"
5577 "Address family\n"
5578 "Address Family modifier\n"
5579 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005580 BGP_SOFT_STR
5581 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005582{
5583 if (strncmp (argv[1], "m", 1) == 0)
5584 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5585 BGP_CLEAR_SOFT_OUT, argv[0]);
5586
5587 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5588 BGP_CLEAR_SOFT_OUT, argv[0]);
5589}
5590
5591ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5592 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005593 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00005594 CLEAR_STR
5595 IP_STR
5596 BGP_STR
5597 "Clear peers with the AS number\n"
5598 "Address family\n"
5599 "Address Family modifier\n"
5600 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005601 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005602
5603DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5604 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005605 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00005606 CLEAR_STR
5607 IP_STR
5608 BGP_STR
5609 "Clear peers with the AS number\n"
5610 "Address family\n"
5611 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005612 BGP_SOFT_STR
5613 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005614{
5615 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5616 BGP_CLEAR_SOFT_OUT, argv[0]);
5617}
5618
5619ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5620 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005621 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005622 CLEAR_STR
5623 IP_STR
5624 BGP_STR
5625 "Clear peers with the AS number\n"
5626 "Address family\n"
5627 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005628 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005629
Lou Berger298cc2f2016-01-12 13:42:02 -05005630DEFUN (clear_ip_bgp_as_encap_soft_out,
5631 clear_ip_bgp_as_encap_soft_out_cmd,
5632 "clear ip bgp " CMD_AS_RANGE " encap unicast soft out",
5633 CLEAR_STR
5634 IP_STR
5635 BGP_STR
5636 "Clear peers with the AS number\n"
5637 "Address family\n"
5638 "Address Family modifier\n"
5639 "Soft reconfig\n"
5640 "Soft reconfig outbound update\n")
5641{
5642 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
5643 BGP_CLEAR_SOFT_OUT, argv[0]);
5644}
5645
5646ALIAS (clear_ip_bgp_as_encap_soft_out,
5647 clear_ip_bgp_as_encap_out_cmd,
5648 "clear ip bgp " CMD_AS_RANGE " encap unicast out",
5649 CLEAR_STR
5650 IP_STR
5651 BGP_STR
5652 "Clear peers with the AS number\n"
5653 "Address family\n"
5654 "Address Family modifier\n"
5655 "Soft reconfig outbound update\n")
5656
paul718e3742002-12-13 20:15:29 +00005657DEFUN (clear_bgp_as_soft_out,
5658 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005659 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005660 CLEAR_STR
5661 BGP_STR
5662 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005663 BGP_SOFT_STR
5664 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005665{
5666 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5667 BGP_CLEAR_SOFT_OUT, argv[0]);
5668}
5669
5670ALIAS (clear_bgp_as_soft_out,
5671 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005672 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005673 CLEAR_STR
5674 BGP_STR
5675 "Address family\n"
5676 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005677 BGP_SOFT_STR
5678 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005679
5680ALIAS (clear_bgp_as_soft_out,
5681 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005682 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005683 CLEAR_STR
5684 BGP_STR
5685 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005686 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005687
5688ALIAS (clear_bgp_as_soft_out,
5689 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005690 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005691 CLEAR_STR
5692 BGP_STR
5693 "Address family\n"
5694 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005695 BGP_SOFT_OUT_STR)
David Lamparter6b0655a2014-06-04 06:53:35 +02005696
paul718e3742002-12-13 20:15:29 +00005697/* Inbound soft-reconfiguration */
5698DEFUN (clear_ip_bgp_all_soft_in,
5699 clear_ip_bgp_all_soft_in_cmd,
5700 "clear ip bgp * soft in",
5701 CLEAR_STR
5702 IP_STR
5703 BGP_STR
5704 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005705 BGP_SOFT_STR
5706 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005707{
5708 if (argc == 1)
5709 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5710 BGP_CLEAR_SOFT_IN, NULL);
5711
5712 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5713 BGP_CLEAR_SOFT_IN, NULL);
5714}
5715
5716ALIAS (clear_ip_bgp_all_soft_in,
5717 clear_ip_bgp_instance_all_soft_in_cmd,
5718 "clear ip bgp view WORD * soft in",
5719 CLEAR_STR
5720 IP_STR
5721 BGP_STR
5722 "BGP view\n"
5723 "view name\n"
5724 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005725 BGP_SOFT_STR
5726 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005727
5728ALIAS (clear_ip_bgp_all_soft_in,
5729 clear_ip_bgp_all_in_cmd,
5730 "clear ip bgp * in",
5731 CLEAR_STR
5732 IP_STR
5733 BGP_STR
5734 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005735 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005736
5737DEFUN (clear_ip_bgp_all_in_prefix_filter,
5738 clear_ip_bgp_all_in_prefix_filter_cmd,
5739 "clear ip bgp * in prefix-filter",
5740 CLEAR_STR
5741 IP_STR
5742 BGP_STR
5743 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005744 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00005745 "Push out prefix-list ORF and do inbound soft reconfig\n")
5746{
5747 if (argc== 1)
5748 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5749 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5750
5751 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5752 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5753}
5754
5755ALIAS (clear_ip_bgp_all_in_prefix_filter,
5756 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5757 "clear ip bgp view WORD * in prefix-filter",
5758 CLEAR_STR
5759 IP_STR
5760 BGP_STR
5761 "BGP view\n"
5762 "view name\n"
5763 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005764 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00005765 "Push out prefix-list ORF and do inbound soft reconfig\n")
5766
5767
5768DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5769 clear_ip_bgp_all_ipv4_soft_in_cmd,
5770 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5771 CLEAR_STR
5772 IP_STR
5773 BGP_STR
5774 "Clear all peers\n"
5775 "Address family\n"
5776 "Address Family modifier\n"
5777 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005778 BGP_SOFT_STR
5779 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005780{
5781 if (strncmp (argv[0], "m", 1) == 0)
5782 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5783 BGP_CLEAR_SOFT_IN, NULL);
5784
5785 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5786 BGP_CLEAR_SOFT_IN, NULL);
5787}
5788
5789ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5790 clear_ip_bgp_all_ipv4_in_cmd,
5791 "clear ip bgp * ipv4 (unicast|multicast) in",
5792 CLEAR_STR
5793 IP_STR
5794 BGP_STR
5795 "Clear all peers\n"
5796 "Address family\n"
5797 "Address Family modifier\n"
5798 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005799 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005800
5801DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5802 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5803 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5804 CLEAR_STR
5805 IP_STR
5806 BGP_STR
5807 "BGP view\n"
5808 "view name\n"
5809 "Clear all peers\n"
5810 "Address family\n"
5811 "Address Family modifier\n"
5812 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005813 BGP_SOFT_STR
5814 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005815{
5816 if (strncmp (argv[1], "m", 1) == 0)
5817 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5818 BGP_CLEAR_SOFT_IN, NULL);
5819
5820 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5821 BGP_CLEAR_SOFT_IN, NULL);
5822}
5823
5824DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5825 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5826 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5827 CLEAR_STR
5828 IP_STR
5829 BGP_STR
5830 "Clear all peers\n"
5831 "Address family\n"
5832 "Address Family modifier\n"
5833 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005834 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00005835 "Push out prefix-list ORF and do inbound soft reconfig\n")
5836{
5837 if (strncmp (argv[0], "m", 1) == 0)
5838 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5839 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5840
5841 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5842 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5843}
5844
5845DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5846 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5847 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5848 CLEAR_STR
5849 IP_STR
5850 BGP_STR
5851 "Clear all peers\n"
5852 "Address family\n"
5853 "Address Family modifier\n"
5854 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005855 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00005856 "Push out prefix-list ORF and do inbound soft reconfig\n")
5857{
5858 if (strncmp (argv[1], "m", 1) == 0)
5859 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5860 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5861
5862 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5863 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5864}
5865
5866DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5867 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5868 "clear ip bgp * vpnv4 unicast soft in",
5869 CLEAR_STR
5870 IP_STR
5871 BGP_STR
5872 "Clear all peers\n"
5873 "Address family\n"
5874 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005875 BGP_SOFT_STR
5876 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005877{
5878 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5879 BGP_CLEAR_SOFT_IN, NULL);
5880}
5881
5882ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5883 clear_ip_bgp_all_vpnv4_in_cmd,
5884 "clear ip bgp * vpnv4 unicast in",
5885 CLEAR_STR
5886 IP_STR
5887 BGP_STR
5888 "Clear all peers\n"
5889 "Address family\n"
5890 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005891 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005892
Lou Berger298cc2f2016-01-12 13:42:02 -05005893DEFUN (clear_ip_bgp_all_encap_soft_in,
5894 clear_ip_bgp_all_encap_soft_in_cmd,
5895 "clear ip bgp * encap unicast soft in",
5896 CLEAR_STR
5897 IP_STR
5898 BGP_STR
5899 "Clear all peers\n"
5900 "Address family\n"
5901 "Address Family Modifier\n"
5902 "Soft reconfig\n"
5903 "Soft reconfig inbound update\n")
5904{
5905 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
5906 BGP_CLEAR_SOFT_IN, NULL);
5907}
5908
5909ALIAS (clear_ip_bgp_all_encap_soft_in,
5910 clear_ip_bgp_all_encap_in_cmd,
5911 "clear ip bgp * encap unicast in",
5912 CLEAR_STR
5913 IP_STR
5914 BGP_STR
5915 "Clear all peers\n"
5916 "Address family\n"
5917 "Address Family Modifier\n"
5918 "Soft reconfig inbound update\n")
5919
paul718e3742002-12-13 20:15:29 +00005920DEFUN (clear_bgp_all_soft_in,
5921 clear_bgp_all_soft_in_cmd,
5922 "clear bgp * soft in",
5923 CLEAR_STR
5924 BGP_STR
5925 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005926 BGP_SOFT_STR
5927 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005928{
5929 if (argc == 1)
5930 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5931 BGP_CLEAR_SOFT_IN, NULL);
5932
5933 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5934 BGP_CLEAR_SOFT_IN, NULL);
5935}
5936
5937ALIAS (clear_bgp_all_soft_in,
5938 clear_bgp_instance_all_soft_in_cmd,
5939 "clear bgp view WORD * soft in",
5940 CLEAR_STR
5941 BGP_STR
5942 "BGP view\n"
5943 "view name\n"
5944 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005945 BGP_SOFT_STR
5946 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005947
5948ALIAS (clear_bgp_all_soft_in,
5949 clear_bgp_ipv6_all_soft_in_cmd,
5950 "clear bgp ipv6 * soft in",
5951 CLEAR_STR
5952 BGP_STR
5953 "Address family\n"
5954 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005955 BGP_SOFT_STR
5956 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005957
5958ALIAS (clear_bgp_all_soft_in,
5959 clear_bgp_all_in_cmd,
5960 "clear bgp * in",
5961 CLEAR_STR
5962 BGP_STR
5963 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005964 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005965
5966ALIAS (clear_bgp_all_soft_in,
5967 clear_bgp_ipv6_all_in_cmd,
5968 "clear bgp ipv6 * in",
5969 CLEAR_STR
5970 BGP_STR
5971 "Address family\n"
5972 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005973 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005974
5975DEFUN (clear_bgp_all_in_prefix_filter,
5976 clear_bgp_all_in_prefix_filter_cmd,
5977 "clear bgp * in prefix-filter",
5978 CLEAR_STR
5979 BGP_STR
5980 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005981 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00005982 "Push out prefix-list ORF and do inbound soft reconfig\n")
5983{
5984 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5985 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5986}
5987
5988ALIAS (clear_bgp_all_in_prefix_filter,
5989 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5990 "clear bgp ipv6 * in prefix-filter",
5991 CLEAR_STR
5992 BGP_STR
5993 "Address family\n"
5994 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005995 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00005996 "Push out prefix-list ORF and do inbound soft reconfig\n")
5997
5998DEFUN (clear_ip_bgp_peer_soft_in,
5999 clear_ip_bgp_peer_soft_in_cmd,
6000 "clear ip bgp A.B.C.D soft in",
6001 CLEAR_STR
6002 IP_STR
6003 BGP_STR
6004 "BGP neighbor address to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006005 BGP_SOFT_STR
6006 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006007{
6008 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6009 BGP_CLEAR_SOFT_IN, argv[0]);
6010}
6011
6012ALIAS (clear_ip_bgp_peer_soft_in,
6013 clear_ip_bgp_peer_in_cmd,
6014 "clear ip bgp A.B.C.D in",
6015 CLEAR_STR
6016 IP_STR
6017 BGP_STR
6018 "BGP neighbor address to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006019 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006020
6021DEFUN (clear_ip_bgp_peer_in_prefix_filter,
6022 clear_ip_bgp_peer_in_prefix_filter_cmd,
6023 "clear ip bgp A.B.C.D in prefix-filter",
6024 CLEAR_STR
6025 IP_STR
6026 BGP_STR
6027 "BGP neighbor address to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006028 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006029 "Push out the existing ORF prefix-list\n")
6030{
6031 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6032 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6033}
6034
6035DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
6036 clear_ip_bgp_peer_ipv4_soft_in_cmd,
6037 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
6038 CLEAR_STR
6039 IP_STR
6040 BGP_STR
6041 "BGP neighbor address to clear\n"
6042 "Address family\n"
6043 "Address Family modifier\n"
6044 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006045 BGP_SOFT_STR
6046 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006047{
6048 if (strncmp (argv[1], "m", 1) == 0)
6049 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6050 BGP_CLEAR_SOFT_IN, argv[0]);
6051
6052 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6053 BGP_CLEAR_SOFT_IN, argv[0]);
6054}
6055
6056ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
6057 clear_ip_bgp_peer_ipv4_in_cmd,
6058 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
6059 CLEAR_STR
6060 IP_STR
6061 BGP_STR
6062 "BGP neighbor address to clear\n"
6063 "Address family\n"
6064 "Address Family modifier\n"
6065 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006066 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006067
6068DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
6069 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
6070 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
6071 CLEAR_STR
6072 IP_STR
6073 BGP_STR
6074 "BGP neighbor address to clear\n"
6075 "Address family\n"
6076 "Address Family modifier\n"
6077 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006078 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006079 "Push out the existing ORF prefix-list\n")
6080{
6081 if (strncmp (argv[1], "m", 1) == 0)
6082 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6083 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6084
6085 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6086 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6087}
6088
6089DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
6090 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
6091 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
6092 CLEAR_STR
6093 IP_STR
6094 BGP_STR
6095 "BGP neighbor address to clear\n"
6096 "Address family\n"
6097 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006098 BGP_SOFT_STR
6099 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006100{
6101 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6102 BGP_CLEAR_SOFT_IN, argv[0]);
6103}
6104
6105ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
6106 clear_ip_bgp_peer_vpnv4_in_cmd,
6107 "clear ip bgp A.B.C.D vpnv4 unicast in",
6108 CLEAR_STR
6109 IP_STR
6110 BGP_STR
6111 "BGP neighbor address to clear\n"
6112 "Address family\n"
6113 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006114 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006115
Lou Berger298cc2f2016-01-12 13:42:02 -05006116DEFUN (clear_ip_bgp_peer_encap_soft_in,
6117 clear_ip_bgp_peer_encap_soft_in_cmd,
6118 "clear ip bgp A.B.C.D encap unicast soft in",
6119 CLEAR_STR
6120 IP_STR
6121 BGP_STR
6122 "BGP neighbor address to clear\n"
6123 "Address family\n"
6124 "Address Family Modifier\n"
6125 "Soft reconfig\n"
6126 "Soft reconfig inbound update\n")
6127{
6128 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
6129 BGP_CLEAR_SOFT_IN, argv[0]);
6130}
6131
6132ALIAS (clear_ip_bgp_peer_encap_soft_in,
6133 clear_ip_bgp_peer_encap_in_cmd,
6134 "clear ip bgp A.B.C.D encap unicast in",
6135 CLEAR_STR
6136 IP_STR
6137 BGP_STR
6138 "BGP neighbor address to clear\n"
6139 "Address family\n"
6140 "Address Family Modifier\n"
6141 "Soft reconfig inbound update\n")
6142
paul718e3742002-12-13 20:15:29 +00006143DEFUN (clear_bgp_peer_soft_in,
6144 clear_bgp_peer_soft_in_cmd,
6145 "clear bgp (A.B.C.D|X:X::X:X) soft in",
6146 CLEAR_STR
6147 BGP_STR
6148 "BGP neighbor address to clear\n"
6149 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006150 BGP_SOFT_STR
6151 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006152{
6153 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6154 BGP_CLEAR_SOFT_IN, argv[0]);
6155}
6156
6157ALIAS (clear_bgp_peer_soft_in,
6158 clear_bgp_ipv6_peer_soft_in_cmd,
6159 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
6160 CLEAR_STR
6161 BGP_STR
6162 "Address family\n"
6163 "BGP neighbor address to clear\n"
6164 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006165 BGP_SOFT_STR
6166 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006167
6168ALIAS (clear_bgp_peer_soft_in,
6169 clear_bgp_peer_in_cmd,
6170 "clear bgp (A.B.C.D|X:X::X:X) in",
6171 CLEAR_STR
6172 BGP_STR
6173 "BGP neighbor address to clear\n"
6174 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006175 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006176
6177ALIAS (clear_bgp_peer_soft_in,
6178 clear_bgp_ipv6_peer_in_cmd,
6179 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
6180 CLEAR_STR
6181 BGP_STR
6182 "Address family\n"
6183 "BGP neighbor address to clear\n"
6184 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006185 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006186
6187DEFUN (clear_bgp_peer_in_prefix_filter,
6188 clear_bgp_peer_in_prefix_filter_cmd,
6189 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
6190 CLEAR_STR
6191 BGP_STR
6192 "BGP neighbor address to clear\n"
6193 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006194 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006195 "Push out the existing ORF prefix-list\n")
6196{
6197 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6198 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6199}
6200
6201ALIAS (clear_bgp_peer_in_prefix_filter,
6202 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
6203 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
6204 CLEAR_STR
6205 BGP_STR
6206 "Address family\n"
6207 "BGP neighbor address to clear\n"
6208 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006209 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006210 "Push out the existing ORF prefix-list\n")
6211
6212DEFUN (clear_ip_bgp_peer_group_soft_in,
6213 clear_ip_bgp_peer_group_soft_in_cmd,
6214 "clear ip bgp peer-group WORD soft in",
6215 CLEAR_STR
6216 IP_STR
6217 BGP_STR
6218 "Clear all members of peer-group\n"
6219 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006220 BGP_SOFT_STR
6221 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006222{
6223 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6224 BGP_CLEAR_SOFT_IN, argv[0]);
6225}
6226
6227ALIAS (clear_ip_bgp_peer_group_soft_in,
6228 clear_ip_bgp_peer_group_in_cmd,
6229 "clear ip bgp peer-group WORD in",
6230 CLEAR_STR
6231 IP_STR
6232 BGP_STR
6233 "Clear all members of peer-group\n"
6234 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006235 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006236
6237DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
6238 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
6239 "clear ip bgp peer-group WORD in prefix-filter",
6240 CLEAR_STR
6241 IP_STR
6242 BGP_STR
6243 "Clear all members of peer-group\n"
6244 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006245 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006246 "Push out prefix-list ORF and do inbound soft reconfig\n")
6247{
6248 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6249 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6250}
6251
6252DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
6253 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
6254 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
6255 CLEAR_STR
6256 IP_STR
6257 BGP_STR
6258 "Clear all members of peer-group\n"
6259 "BGP peer-group name\n"
6260 "Address family\n"
6261 "Address Family modifier\n"
6262 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006263 BGP_SOFT_STR
6264 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006265{
6266 if (strncmp (argv[1], "m", 1) == 0)
6267 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6268 BGP_CLEAR_SOFT_IN, argv[0]);
6269
6270 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6271 BGP_CLEAR_SOFT_IN, argv[0]);
6272}
6273
6274ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
6275 clear_ip_bgp_peer_group_ipv4_in_cmd,
6276 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
6277 CLEAR_STR
6278 IP_STR
6279 BGP_STR
6280 "Clear all members of peer-group\n"
6281 "BGP peer-group name\n"
6282 "Address family\n"
6283 "Address Family modifier\n"
6284 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006285 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006286
6287DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
6288 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
6289 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
6290 CLEAR_STR
6291 IP_STR
6292 BGP_STR
6293 "Clear all members of peer-group\n"
6294 "BGP peer-group name\n"
6295 "Address family\n"
6296 "Address Family modifier\n"
6297 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006298 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006299 "Push out prefix-list ORF and do inbound soft reconfig\n")
6300{
6301 if (strncmp (argv[1], "m", 1) == 0)
6302 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6303 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6304
6305 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6306 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6307}
6308
6309DEFUN (clear_bgp_peer_group_soft_in,
6310 clear_bgp_peer_group_soft_in_cmd,
6311 "clear bgp peer-group WORD soft in",
6312 CLEAR_STR
6313 BGP_STR
6314 "Clear all members of peer-group\n"
6315 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006316 BGP_SOFT_STR
6317 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006318{
6319 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6320 BGP_CLEAR_SOFT_IN, argv[0]);
6321}
6322
6323ALIAS (clear_bgp_peer_group_soft_in,
6324 clear_bgp_ipv6_peer_group_soft_in_cmd,
6325 "clear bgp ipv6 peer-group WORD soft in",
6326 CLEAR_STR
6327 BGP_STR
6328 "Address family\n"
6329 "Clear all members of peer-group\n"
6330 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006331 BGP_SOFT_STR
6332 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006333
6334ALIAS (clear_bgp_peer_group_soft_in,
6335 clear_bgp_peer_group_in_cmd,
6336 "clear bgp peer-group WORD in",
6337 CLEAR_STR
6338 BGP_STR
6339 "Clear all members of peer-group\n"
6340 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006341 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006342
6343ALIAS (clear_bgp_peer_group_soft_in,
6344 clear_bgp_ipv6_peer_group_in_cmd,
6345 "clear bgp ipv6 peer-group WORD in",
6346 CLEAR_STR
6347 BGP_STR
6348 "Address family\n"
6349 "Clear all members of peer-group\n"
6350 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006351 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006352
6353DEFUN (clear_bgp_peer_group_in_prefix_filter,
6354 clear_bgp_peer_group_in_prefix_filter_cmd,
6355 "clear bgp peer-group WORD in prefix-filter",
6356 CLEAR_STR
6357 BGP_STR
6358 "Clear all members of peer-group\n"
6359 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006360 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006361 "Push out prefix-list ORF and do inbound soft reconfig\n")
6362{
6363 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6364 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6365}
6366
6367ALIAS (clear_bgp_peer_group_in_prefix_filter,
6368 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
6369 "clear bgp ipv6 peer-group WORD in prefix-filter",
6370 CLEAR_STR
6371 BGP_STR
6372 "Address family\n"
6373 "Clear all members of peer-group\n"
6374 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006375 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006376 "Push out prefix-list ORF and do inbound soft reconfig\n")
6377
6378DEFUN (clear_ip_bgp_external_soft_in,
6379 clear_ip_bgp_external_soft_in_cmd,
6380 "clear ip bgp external soft in",
6381 CLEAR_STR
6382 IP_STR
6383 BGP_STR
6384 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006385 BGP_SOFT_STR
6386 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006387{
6388 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6389 BGP_CLEAR_SOFT_IN, NULL);
6390}
6391
6392ALIAS (clear_ip_bgp_external_soft_in,
6393 clear_ip_bgp_external_in_cmd,
6394 "clear ip bgp external in",
6395 CLEAR_STR
6396 IP_STR
6397 BGP_STR
6398 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006399 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006400
6401DEFUN (clear_ip_bgp_external_in_prefix_filter,
6402 clear_ip_bgp_external_in_prefix_filter_cmd,
6403 "clear ip bgp external in prefix-filter",
6404 CLEAR_STR
6405 IP_STR
6406 BGP_STR
6407 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006408 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006409 "Push out prefix-list ORF and do inbound soft reconfig\n")
6410{
6411 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6412 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6413}
6414
6415DEFUN (clear_ip_bgp_external_ipv4_soft_in,
6416 clear_ip_bgp_external_ipv4_soft_in_cmd,
6417 "clear ip bgp external ipv4 (unicast|multicast) soft in",
6418 CLEAR_STR
6419 IP_STR
6420 BGP_STR
6421 "Clear all external peers\n"
6422 "Address family\n"
6423 "Address Family modifier\n"
6424 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006425 BGP_SOFT_STR
6426 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006427{
6428 if (strncmp (argv[0], "m", 1) == 0)
6429 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6430 BGP_CLEAR_SOFT_IN, NULL);
6431
6432 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6433 BGP_CLEAR_SOFT_IN, NULL);
6434}
6435
6436ALIAS (clear_ip_bgp_external_ipv4_soft_in,
6437 clear_ip_bgp_external_ipv4_in_cmd,
6438 "clear ip bgp external ipv4 (unicast|multicast) in",
6439 CLEAR_STR
6440 IP_STR
6441 BGP_STR
6442 "Clear all external peers\n"
6443 "Address family\n"
6444 "Address Family modifier\n"
6445 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006446 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006447
6448DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
6449 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
6450 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
6451 CLEAR_STR
6452 IP_STR
6453 BGP_STR
6454 "Clear all external peers\n"
6455 "Address family\n"
6456 "Address Family modifier\n"
6457 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006458 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006459 "Push out prefix-list ORF and do inbound soft reconfig\n")
6460{
6461 if (strncmp (argv[0], "m", 1) == 0)
6462 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6463 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6464
6465 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6466 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6467}
6468
6469DEFUN (clear_bgp_external_soft_in,
6470 clear_bgp_external_soft_in_cmd,
6471 "clear bgp external soft in",
6472 CLEAR_STR
6473 BGP_STR
6474 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006475 BGP_SOFT_STR
6476 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006477{
6478 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6479 BGP_CLEAR_SOFT_IN, NULL);
6480}
6481
6482ALIAS (clear_bgp_external_soft_in,
6483 clear_bgp_ipv6_external_soft_in_cmd,
6484 "clear bgp ipv6 external soft in",
6485 CLEAR_STR
6486 BGP_STR
6487 "Address family\n"
6488 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006489 BGP_SOFT_STR
6490 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006491
6492ALIAS (clear_bgp_external_soft_in,
6493 clear_bgp_external_in_cmd,
6494 "clear bgp external in",
6495 CLEAR_STR
6496 BGP_STR
6497 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006498 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006499
6500ALIAS (clear_bgp_external_soft_in,
6501 clear_bgp_ipv6_external_in_cmd,
6502 "clear bgp ipv6 external WORD in",
6503 CLEAR_STR
6504 BGP_STR
6505 "Address family\n"
6506 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006507 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006508
6509DEFUN (clear_bgp_external_in_prefix_filter,
6510 clear_bgp_external_in_prefix_filter_cmd,
6511 "clear bgp external in prefix-filter",
6512 CLEAR_STR
6513 BGP_STR
6514 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006515 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006516 "Push out prefix-list ORF and do inbound soft reconfig\n")
6517{
6518 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6519 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6520}
6521
6522ALIAS (clear_bgp_external_in_prefix_filter,
6523 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6524 "clear bgp ipv6 external in prefix-filter",
6525 CLEAR_STR
6526 BGP_STR
6527 "Address family\n"
6528 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006529 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006530 "Push out prefix-list ORF and do inbound soft reconfig\n")
6531
6532DEFUN (clear_ip_bgp_as_soft_in,
6533 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006534 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006535 CLEAR_STR
6536 IP_STR
6537 BGP_STR
6538 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006539 BGP_SOFT_STR
6540 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006541{
6542 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6543 BGP_CLEAR_SOFT_IN, argv[0]);
6544}
6545
6546ALIAS (clear_ip_bgp_as_soft_in,
6547 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006548 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006549 CLEAR_STR
6550 IP_STR
6551 BGP_STR
6552 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006553 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006554
6555DEFUN (clear_ip_bgp_as_in_prefix_filter,
6556 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006557 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006558 CLEAR_STR
6559 IP_STR
6560 BGP_STR
6561 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006562 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006563 "Push out prefix-list ORF and do inbound soft reconfig\n")
6564{
6565 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6566 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6567}
6568
6569DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6570 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006571 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006572 CLEAR_STR
6573 IP_STR
6574 BGP_STR
6575 "Clear peers with the AS number\n"
6576 "Address family\n"
6577 "Address Family modifier\n"
6578 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006579 BGP_SOFT_STR
6580 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006581{
6582 if (strncmp (argv[1], "m", 1) == 0)
6583 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6584 BGP_CLEAR_SOFT_IN, argv[0]);
6585
6586 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6587 BGP_CLEAR_SOFT_IN, argv[0]);
6588}
6589
6590ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6591 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006592 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00006593 CLEAR_STR
6594 IP_STR
6595 BGP_STR
6596 "Clear peers with the AS number\n"
6597 "Address family\n"
6598 "Address Family modifier\n"
6599 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006600 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006601
6602DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6603 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006604 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006605 CLEAR_STR
6606 IP_STR
6607 BGP_STR
6608 "Clear peers with the AS number\n"
6609 "Address family\n"
6610 "Address Family modifier\n"
6611 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006612 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006613 "Push out prefix-list ORF and do inbound soft reconfig\n")
6614{
6615 if (strncmp (argv[1], "m", 1) == 0)
6616 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6617 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6618
6619 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6620 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6621}
6622
6623DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6624 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006625 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00006626 CLEAR_STR
6627 IP_STR
6628 BGP_STR
6629 "Clear peers with the AS number\n"
6630 "Address family\n"
6631 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006632 BGP_SOFT_STR
6633 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006634{
6635 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6636 BGP_CLEAR_SOFT_IN, argv[0]);
6637}
6638
6639ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6640 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006641 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006642 CLEAR_STR
6643 IP_STR
6644 BGP_STR
6645 "Clear peers with the AS number\n"
6646 "Address family\n"
6647 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006648 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006649
Lou Berger298cc2f2016-01-12 13:42:02 -05006650DEFUN (clear_ip_bgp_as_encap_soft_in,
6651 clear_ip_bgp_as_encap_soft_in_cmd,
6652 "clear ip bgp " CMD_AS_RANGE " encap unicast soft in",
6653 CLEAR_STR
6654 IP_STR
6655 BGP_STR
6656 "Clear peers with the AS number\n"
6657 "Address family\n"
6658 "Address Family modifier\n"
6659 "Soft reconfig\n"
6660 "Soft reconfig inbound update\n")
6661{
6662 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6663 BGP_CLEAR_SOFT_IN, argv[0]);
6664}
6665
6666ALIAS (clear_ip_bgp_as_encap_soft_in,
6667 clear_ip_bgp_as_encap_in_cmd,
6668 "clear ip bgp " CMD_AS_RANGE " encap unicast in",
6669 CLEAR_STR
6670 IP_STR
6671 BGP_STR
6672 "Clear peers with the AS number\n"
6673 "Address family\n"
6674 "Address Family modifier\n"
6675 "Soft reconfig inbound update\n")
6676
paul718e3742002-12-13 20:15:29 +00006677DEFUN (clear_bgp_as_soft_in,
6678 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006679 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006680 CLEAR_STR
6681 BGP_STR
6682 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006683 BGP_SOFT_STR
6684 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006685{
6686 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6687 BGP_CLEAR_SOFT_IN, argv[0]);
6688}
6689
6690ALIAS (clear_bgp_as_soft_in,
6691 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006692 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006693 CLEAR_STR
6694 BGP_STR
6695 "Address family\n"
6696 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006697 BGP_SOFT_STR
6698 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006699
6700ALIAS (clear_bgp_as_soft_in,
6701 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006702 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006703 CLEAR_STR
6704 BGP_STR
6705 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006706 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006707
6708ALIAS (clear_bgp_as_soft_in,
6709 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006710 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006711 CLEAR_STR
6712 BGP_STR
6713 "Address family\n"
6714 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006715 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006716
6717DEFUN (clear_bgp_as_in_prefix_filter,
6718 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006719 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006720 CLEAR_STR
6721 BGP_STR
6722 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006723 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006724 "Push out prefix-list ORF and do inbound soft reconfig\n")
6725{
6726 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6727 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6728}
6729
6730ALIAS (clear_bgp_as_in_prefix_filter,
6731 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006732 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006733 CLEAR_STR
6734 BGP_STR
6735 "Address family\n"
6736 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006737 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006738 "Push out prefix-list ORF and do inbound soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006739
paul718e3742002-12-13 20:15:29 +00006740/* Both soft-reconfiguration */
6741DEFUN (clear_ip_bgp_all_soft,
6742 clear_ip_bgp_all_soft_cmd,
6743 "clear ip bgp * soft",
6744 CLEAR_STR
6745 IP_STR
6746 BGP_STR
6747 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006748 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006749{
6750 if (argc == 1)
6751 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6752 BGP_CLEAR_SOFT_BOTH, NULL);
6753
6754 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6755 BGP_CLEAR_SOFT_BOTH, NULL);
6756}
6757
6758ALIAS (clear_ip_bgp_all_soft,
6759 clear_ip_bgp_instance_all_soft_cmd,
6760 "clear ip bgp view WORD * soft",
6761 CLEAR_STR
6762 IP_STR
6763 BGP_STR
6764 "BGP view\n"
6765 "view name\n"
6766 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006767 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006768
6769
6770DEFUN (clear_ip_bgp_all_ipv4_soft,
6771 clear_ip_bgp_all_ipv4_soft_cmd,
6772 "clear ip bgp * ipv4 (unicast|multicast) soft",
6773 CLEAR_STR
6774 IP_STR
6775 BGP_STR
6776 "Clear all peers\n"
6777 "Address family\n"
6778 "Address Family Modifier\n"
6779 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006780 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006781{
6782 if (strncmp (argv[0], "m", 1) == 0)
6783 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6784 BGP_CLEAR_SOFT_BOTH, NULL);
6785
6786 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6787 BGP_CLEAR_SOFT_BOTH, NULL);
6788}
6789
6790DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6791 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6792 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6793 CLEAR_STR
6794 IP_STR
6795 BGP_STR
6796 "BGP view\n"
6797 "view name\n"
6798 "Clear all peers\n"
6799 "Address family\n"
6800 "Address Family Modifier\n"
6801 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006802 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006803{
6804 if (strncmp (argv[1], "m", 1) == 0)
6805 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6806 BGP_CLEAR_SOFT_BOTH, NULL);
6807
6808 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6809 BGP_CLEAR_SOFT_BOTH, NULL);
6810}
6811
6812DEFUN (clear_ip_bgp_all_vpnv4_soft,
6813 clear_ip_bgp_all_vpnv4_soft_cmd,
6814 "clear ip bgp * vpnv4 unicast soft",
6815 CLEAR_STR
6816 IP_STR
6817 BGP_STR
6818 "Clear all peers\n"
6819 "Address family\n"
6820 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006821 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006822{
6823 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6824 BGP_CLEAR_SOFT_BOTH, argv[0]);
6825}
6826
Lou Berger298cc2f2016-01-12 13:42:02 -05006827DEFUN (clear_ip_bgp_all_encap_soft,
6828 clear_ip_bgp_all_encap_soft_cmd,
6829 "clear ip bgp * encap unicast soft",
6830 CLEAR_STR
6831 IP_STR
6832 BGP_STR
6833 "Clear all peers\n"
6834 "Address family\n"
6835 "Address Family Modifier\n"
6836 "Soft reconfig\n")
6837{
6838 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
6839 BGP_CLEAR_SOFT_BOTH, argv[0]);
6840}
6841
paul718e3742002-12-13 20:15:29 +00006842DEFUN (clear_bgp_all_soft,
6843 clear_bgp_all_soft_cmd,
6844 "clear bgp * soft",
6845 CLEAR_STR
6846 BGP_STR
6847 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006848 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006849{
6850 if (argc == 1)
6851 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6852 BGP_CLEAR_SOFT_BOTH, argv[0]);
6853
6854 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6855 BGP_CLEAR_SOFT_BOTH, argv[0]);
6856}
6857
6858ALIAS (clear_bgp_all_soft,
6859 clear_bgp_instance_all_soft_cmd,
6860 "clear bgp view WORD * soft",
6861 CLEAR_STR
6862 BGP_STR
6863 "BGP view\n"
6864 "view name\n"
6865 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006866 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006867
6868ALIAS (clear_bgp_all_soft,
6869 clear_bgp_ipv6_all_soft_cmd,
6870 "clear bgp ipv6 * soft",
6871 CLEAR_STR
6872 BGP_STR
6873 "Address family\n"
6874 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006875 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006876
6877DEFUN (clear_ip_bgp_peer_soft,
6878 clear_ip_bgp_peer_soft_cmd,
6879 "clear ip bgp A.B.C.D soft",
6880 CLEAR_STR
6881 IP_STR
6882 BGP_STR
6883 "BGP neighbor address to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006884 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006885{
6886 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6887 BGP_CLEAR_SOFT_BOTH, argv[0]);
6888}
6889
6890DEFUN (clear_ip_bgp_peer_ipv4_soft,
6891 clear_ip_bgp_peer_ipv4_soft_cmd,
6892 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6893 CLEAR_STR
6894 IP_STR
6895 BGP_STR
6896 "BGP neighbor address to clear\n"
6897 "Address family\n"
6898 "Address Family Modifier\n"
6899 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006900 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006901{
6902 if (strncmp (argv[1], "m", 1) == 0)
6903 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6904 BGP_CLEAR_SOFT_BOTH, argv[0]);
6905
6906 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6907 BGP_CLEAR_SOFT_BOTH, argv[0]);
6908}
6909
6910DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6911 clear_ip_bgp_peer_vpnv4_soft_cmd,
6912 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6913 CLEAR_STR
6914 IP_STR
6915 BGP_STR
6916 "BGP neighbor address to clear\n"
6917 "Address family\n"
6918 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006919 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006920{
6921 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6922 BGP_CLEAR_SOFT_BOTH, argv[0]);
6923}
6924
Lou Berger298cc2f2016-01-12 13:42:02 -05006925DEFUN (clear_ip_bgp_peer_encap_soft,
6926 clear_ip_bgp_peer_encap_soft_cmd,
6927 "clear ip bgp A.B.C.D encap unicast soft",
6928 CLEAR_STR
6929 IP_STR
6930 BGP_STR
6931 "BGP neighbor address to clear\n"
6932 "Address family\n"
6933 "Address Family Modifier\n"
6934 "Soft reconfig\n")
6935{
6936 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
6937 BGP_CLEAR_SOFT_BOTH, argv[0]);
6938}
6939
paul718e3742002-12-13 20:15:29 +00006940DEFUN (clear_bgp_peer_soft,
6941 clear_bgp_peer_soft_cmd,
6942 "clear bgp (A.B.C.D|X:X::X:X) soft",
6943 CLEAR_STR
6944 BGP_STR
6945 "BGP neighbor address to clear\n"
6946 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006947 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006948{
6949 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6950 BGP_CLEAR_SOFT_BOTH, argv[0]);
6951}
6952
6953ALIAS (clear_bgp_peer_soft,
6954 clear_bgp_ipv6_peer_soft_cmd,
6955 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6956 CLEAR_STR
6957 BGP_STR
6958 "Address family\n"
6959 "BGP neighbor address to clear\n"
6960 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006961 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006962
6963DEFUN (clear_ip_bgp_peer_group_soft,
6964 clear_ip_bgp_peer_group_soft_cmd,
6965 "clear ip bgp peer-group WORD soft",
6966 CLEAR_STR
6967 IP_STR
6968 BGP_STR
6969 "Clear all members of peer-group\n"
6970 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006971 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006972{
6973 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6974 BGP_CLEAR_SOFT_BOTH, argv[0]);
6975}
6976
6977DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6978 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6979 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6980 CLEAR_STR
6981 IP_STR
6982 BGP_STR
6983 "Clear all members of peer-group\n"
6984 "BGP peer-group name\n"
6985 "Address family\n"
6986 "Address Family modifier\n"
6987 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006988 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006989{
6990 if (strncmp (argv[1], "m", 1) == 0)
6991 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6992 BGP_CLEAR_SOFT_BOTH, argv[0]);
6993
6994 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6995 BGP_CLEAR_SOFT_BOTH, argv[0]);
6996}
6997
6998DEFUN (clear_bgp_peer_group_soft,
6999 clear_bgp_peer_group_soft_cmd,
7000 "clear bgp peer-group WORD soft",
7001 CLEAR_STR
7002 BGP_STR
7003 "Clear all members of peer-group\n"
7004 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007005 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007006{
7007 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
7008 BGP_CLEAR_SOFT_BOTH, argv[0]);
7009}
7010
7011ALIAS (clear_bgp_peer_group_soft,
7012 clear_bgp_ipv6_peer_group_soft_cmd,
7013 "clear bgp ipv6 peer-group WORD soft",
7014 CLEAR_STR
7015 BGP_STR
7016 "Address family\n"
7017 "Clear all members of peer-group\n"
7018 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007019 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007020
7021DEFUN (clear_ip_bgp_external_soft,
7022 clear_ip_bgp_external_soft_cmd,
7023 "clear ip bgp external soft",
7024 CLEAR_STR
7025 IP_STR
7026 BGP_STR
7027 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007028 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007029{
7030 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
7031 BGP_CLEAR_SOFT_BOTH, NULL);
7032}
7033
7034DEFUN (clear_ip_bgp_external_ipv4_soft,
7035 clear_ip_bgp_external_ipv4_soft_cmd,
7036 "clear ip bgp external ipv4 (unicast|multicast) soft",
7037 CLEAR_STR
7038 IP_STR
7039 BGP_STR
7040 "Clear all external peers\n"
7041 "Address family\n"
7042 "Address Family modifier\n"
7043 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007044 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007045{
7046 if (strncmp (argv[0], "m", 1) == 0)
7047 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
7048 BGP_CLEAR_SOFT_BOTH, NULL);
7049
7050 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
7051 BGP_CLEAR_SOFT_BOTH, NULL);
7052}
7053
7054DEFUN (clear_bgp_external_soft,
7055 clear_bgp_external_soft_cmd,
7056 "clear bgp external soft",
7057 CLEAR_STR
7058 BGP_STR
7059 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007060 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007061{
7062 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
7063 BGP_CLEAR_SOFT_BOTH, NULL);
7064}
7065
7066ALIAS (clear_bgp_external_soft,
7067 clear_bgp_ipv6_external_soft_cmd,
7068 "clear bgp ipv6 external soft",
7069 CLEAR_STR
7070 BGP_STR
7071 "Address family\n"
7072 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007073 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007074
7075DEFUN (clear_ip_bgp_as_soft,
7076 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00007077 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00007078 CLEAR_STR
7079 IP_STR
7080 BGP_STR
7081 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007082 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007083{
7084 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
7085 BGP_CLEAR_SOFT_BOTH, argv[0]);
7086}
7087
7088DEFUN (clear_ip_bgp_as_ipv4_soft,
7089 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00007090 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00007091 CLEAR_STR
7092 IP_STR
7093 BGP_STR
7094 "Clear peers with the AS number\n"
7095 "Address family\n"
7096 "Address Family Modifier\n"
7097 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007098 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007099{
7100 if (strncmp (argv[1], "m", 1) == 0)
7101 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
7102 BGP_CLEAR_SOFT_BOTH, argv[0]);
7103
7104 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
7105 BGP_CLEAR_SOFT_BOTH, argv[0]);
7106}
7107
7108DEFUN (clear_ip_bgp_as_vpnv4_soft,
7109 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00007110 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00007111 CLEAR_STR
7112 IP_STR
7113 BGP_STR
7114 "Clear peers with the AS number\n"
7115 "Address family\n"
7116 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007117 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007118{
7119 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
7120 BGP_CLEAR_SOFT_BOTH, argv[0]);
7121}
7122
Lou Berger298cc2f2016-01-12 13:42:02 -05007123DEFUN (clear_ip_bgp_as_encap_soft,
7124 clear_ip_bgp_as_encap_soft_cmd,
7125 "clear ip bgp " CMD_AS_RANGE " encap unicast soft",
7126 CLEAR_STR
7127 IP_STR
7128 BGP_STR
7129 "Clear peers with the AS number\n"
7130 "Address family\n"
7131 "Address Family Modifier\n"
7132 "Soft reconfig\n")
7133{
7134 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
7135 BGP_CLEAR_SOFT_BOTH, argv[0]);
7136}
7137
paul718e3742002-12-13 20:15:29 +00007138DEFUN (clear_bgp_as_soft,
7139 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00007140 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00007141 CLEAR_STR
7142 BGP_STR
7143 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007144 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007145{
7146 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
7147 BGP_CLEAR_SOFT_BOTH, argv[0]);
7148}
7149
7150ALIAS (clear_bgp_as_soft,
7151 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00007152 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00007153 CLEAR_STR
7154 BGP_STR
7155 "Address family\n"
7156 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007157 BGP_SOFT_STR)
David Lamparter6b0655a2014-06-04 06:53:35 +02007158
paulfee0f4c2004-09-13 05:12:46 +00007159/* RS-client soft reconfiguration. */
paulfee0f4c2004-09-13 05:12:46 +00007160DEFUN (clear_bgp_all_rsclient,
7161 clear_bgp_all_rsclient_cmd,
7162 "clear bgp * rsclient",
7163 CLEAR_STR
7164 BGP_STR
7165 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007166 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007167{
7168 if (argc == 1)
7169 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
7170 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7171
7172 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
7173 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7174}
7175
7176ALIAS (clear_bgp_all_rsclient,
7177 clear_bgp_ipv6_all_rsclient_cmd,
7178 "clear bgp ipv6 * rsclient",
7179 CLEAR_STR
7180 BGP_STR
7181 "Address family\n"
7182 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007183 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007184
7185ALIAS (clear_bgp_all_rsclient,
7186 clear_bgp_instance_all_rsclient_cmd,
7187 "clear bgp view WORD * rsclient",
7188 CLEAR_STR
7189 BGP_STR
7190 "BGP view\n"
7191 "view name\n"
7192 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007193 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007194
7195ALIAS (clear_bgp_all_rsclient,
7196 clear_bgp_ipv6_instance_all_rsclient_cmd,
7197 "clear bgp ipv6 view WORD * rsclient",
7198 CLEAR_STR
7199 BGP_STR
7200 "Address family\n"
7201 "BGP view\n"
7202 "view name\n"
7203 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007204 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007205
7206DEFUN (clear_ip_bgp_all_rsclient,
7207 clear_ip_bgp_all_rsclient_cmd,
7208 "clear ip bgp * rsclient",
7209 CLEAR_STR
7210 IP_STR
7211 BGP_STR
7212 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007213 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007214{
7215 if (argc == 1)
7216 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
7217 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7218
7219 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7220 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7221}
7222
7223ALIAS (clear_ip_bgp_all_rsclient,
7224 clear_ip_bgp_instance_all_rsclient_cmd,
7225 "clear ip bgp view WORD * rsclient",
7226 CLEAR_STR
7227 IP_STR
7228 BGP_STR
7229 "BGP view\n"
7230 "view name\n"
7231 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007232 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007233
paulfee0f4c2004-09-13 05:12:46 +00007234DEFUN (clear_bgp_peer_rsclient,
7235 clear_bgp_peer_rsclient_cmd,
7236 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
7237 CLEAR_STR
7238 BGP_STR
7239 "BGP neighbor IP address to clear\n"
7240 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007241 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007242{
7243 if (argc == 2)
7244 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
7245 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7246
7247 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
7248 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7249}
7250
7251ALIAS (clear_bgp_peer_rsclient,
7252 clear_bgp_ipv6_peer_rsclient_cmd,
7253 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
7254 CLEAR_STR
7255 BGP_STR
7256 "Address family\n"
7257 "BGP neighbor IP address to clear\n"
7258 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007259 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007260
7261ALIAS (clear_bgp_peer_rsclient,
7262 clear_bgp_instance_peer_rsclient_cmd,
7263 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7264 CLEAR_STR
7265 BGP_STR
7266 "BGP view\n"
7267 "view name\n"
7268 "BGP neighbor IP address to clear\n"
7269 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007270 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007271
7272ALIAS (clear_bgp_peer_rsclient,
7273 clear_bgp_ipv6_instance_peer_rsclient_cmd,
7274 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
7275 CLEAR_STR
7276 BGP_STR
7277 "Address family\n"
7278 "BGP view\n"
7279 "view name\n"
7280 "BGP neighbor IP address to clear\n"
7281 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007282 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007283
7284DEFUN (clear_ip_bgp_peer_rsclient,
7285 clear_ip_bgp_peer_rsclient_cmd,
7286 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
7287 CLEAR_STR
7288 IP_STR
7289 BGP_STR
7290 "BGP neighbor IP address to clear\n"
7291 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007292 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007293{
7294 if (argc == 2)
7295 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
7296 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7297
7298 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
7299 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7300}
7301
7302ALIAS (clear_ip_bgp_peer_rsclient,
7303 clear_ip_bgp_instance_peer_rsclient_cmd,
7304 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7305 CLEAR_STR
7306 IP_STR
7307 BGP_STR
7308 "BGP view\n"
7309 "view name\n"
7310 "BGP neighbor IP address to clear\n"
7311 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007312 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007313
Michael Lamberte0081f72008-11-16 20:12:04 +00007314DEFUN (show_bgp_views,
7315 show_bgp_views_cmd,
7316 "show bgp views",
7317 SHOW_STR
7318 BGP_STR
7319 "Show the defined BGP views\n")
7320{
7321 struct list *inst = bm->bgp;
7322 struct listnode *node;
7323 struct bgp *bgp;
7324
7325 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
7326 {
7327 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
7328 return CMD_WARNING;
7329 }
7330
7331 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
7332 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
7333 vty_out (vty, "\t%s (AS%u)%s",
7334 bgp->name ? bgp->name : "(null)",
7335 bgp->as, VTY_NEWLINE);
7336
7337 return CMD_SUCCESS;
7338}
7339
Paul Jakma4bf6a362006-03-30 14:05:23 +00007340DEFUN (show_bgp_memory,
7341 show_bgp_memory_cmd,
7342 "show bgp memory",
7343 SHOW_STR
7344 BGP_STR
7345 "Global BGP memory statistics\n")
7346{
7347 char memstrbuf[MTYPE_MEMSTR_LEN];
7348 unsigned long count;
7349
7350 /* RIB related usage stats */
7351 count = mtype_stats_alloc (MTYPE_BGP_NODE);
7352 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
7353 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7354 count * sizeof (struct bgp_node)),
7355 VTY_NEWLINE);
7356
7357 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
7358 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
7359 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7360 count * sizeof (struct bgp_info)),
7361 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007362 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
7363 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
7364 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7365 count * sizeof (struct bgp_info_extra)),
7366 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007367
7368 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
7369 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
7370 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7371 count * sizeof (struct bgp_static)),
7372 VTY_NEWLINE);
7373
7374 /* Adj-In/Out */
7375 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
7376 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
7377 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7378 count * sizeof (struct bgp_adj_in)),
7379 VTY_NEWLINE);
7380 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
7381 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
7382 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7383 count * sizeof (struct bgp_adj_out)),
7384 VTY_NEWLINE);
7385
7386 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
7387 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
7388 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7389 count * sizeof (struct bgp_nexthop_cache)),
7390 VTY_NEWLINE);
7391
7392 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
7393 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
7394 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7395 count * sizeof (struct bgp_damp_info)),
7396 VTY_NEWLINE);
7397
7398 /* Attributes */
7399 count = attr_count();
7400 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
7401 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7402 count * sizeof(struct attr)),
7403 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007404 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
7405 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
7406 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7407 count * sizeof(struct attr_extra)),
7408 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007409
7410 if ((count = attr_unknown_count()))
7411 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
7412
7413 /* AS_PATH attributes */
7414 count = aspath_count ();
7415 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
7416 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7417 count * sizeof (struct aspath)),
7418 VTY_NEWLINE);
7419
7420 count = mtype_stats_alloc (MTYPE_AS_SEG);
7421 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
7422 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7423 count * sizeof (struct assegment)),
7424 VTY_NEWLINE);
7425
7426 /* Other attributes */
7427 if ((count = community_count ()))
7428 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7429 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7430 count * sizeof (struct community)),
7431 VTY_NEWLINE);
7432 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
7433 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7434 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7435 count * sizeof (struct ecommunity)),
7436 VTY_NEWLINE);
7437
7438 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
7439 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
7440 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7441 count * sizeof (struct cluster_list)),
7442 VTY_NEWLINE);
7443
7444 /* Peer related usage */
7445 count = mtype_stats_alloc (MTYPE_BGP_PEER);
7446 vty_out (vty, "%ld peers, using %s of memory%s", count,
7447 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7448 count * sizeof (struct peer)),
7449 VTY_NEWLINE);
7450
7451 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
7452 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
7453 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7454 count * sizeof (struct peer_group)),
7455 VTY_NEWLINE);
7456
7457 /* Other */
7458 if ((count = mtype_stats_alloc (MTYPE_HASH)))
7459 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
7460 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7461 count * sizeof (struct hash)),
7462 VTY_NEWLINE);
7463 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
7464 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
7465 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7466 count * sizeof (struct hash_backet)),
7467 VTY_NEWLINE);
7468 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
7469 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
7470 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7471 count * sizeof (regex_t)),
7472 VTY_NEWLINE);
7473 return CMD_SUCCESS;
7474}
paulfee0f4c2004-09-13 05:12:46 +00007475
paul718e3742002-12-13 20:15:29 +00007476/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00007477static int
paul718e3742002-12-13 20:15:29 +00007478bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
7479{
7480 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007481 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00007482 unsigned int count = 0;
Paul Jakma574e5002016-05-17 13:33:11 +01007483 unsigned int totrcount = 0;
7484 unsigned int totecount = 0;
paul718e3742002-12-13 20:15:29 +00007485 char timebuf[BGP_UPTIME_LEN];
7486 int len;
7487
7488 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00007489 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00007490
paul1eb8ef22005-04-07 07:30:20 +00007491 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007492 {
7493 if (peer->afc[afi][safi])
7494 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00007495 if (!count)
7496 {
7497 unsigned long ents;
7498 char memstrbuf[MTYPE_MEMSTR_LEN];
7499
7500 /* Usage summary and header */
7501 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007502 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00007503 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007504
Paul Jakma4bf6a362006-03-30 14:05:23 +00007505 ents = bgp_table_count (bgp->rib[afi][safi]);
7506 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
7507 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7508 ents * sizeof (struct bgp_node)),
7509 VTY_NEWLINE);
7510
7511 /* Peer related usage */
7512 ents = listcount (bgp->peer);
7513 vty_out (vty, "Peers %ld, using %s of memory%s",
7514 ents,
7515 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7516 ents * sizeof (struct peer)),
7517 VTY_NEWLINE);
7518
7519 if ((ents = listcount (bgp->rsclient)))
7520 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
7521 ents,
7522 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7523 ents * sizeof (struct peer)),
7524 VTY_NEWLINE);
7525
7526 if ((ents = listcount (bgp->group)))
7527 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
7528 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7529 ents * sizeof (struct peer_group)),
7530 VTY_NEWLINE);
7531
7532 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
7533 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
7534 vty_out (vty, "%s", VTY_NEWLINE);
7535 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7536 }
7537
paul718e3742002-12-13 20:15:29 +00007538 count++;
7539
7540 len = vty_out (vty, "%s", peer->host);
7541 len = 16 - len;
7542 if (len < 1)
7543 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7544 else
7545 vty_out (vty, "%*s", len, " ");
7546
hasso3d515fd2005-02-01 21:30:04 +00007547 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00007548
Pradosh Mohapatraaf309fa2015-11-09 20:21:47 -05007549 vty_out (vty, "%5u %7d %7d %8d %4d %4d ",
paul718e3742002-12-13 20:15:29 +00007550 peer->as,
7551 peer->open_in + peer->update_in + peer->keepalive_in
7552 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
7553 peer->open_out + peer->update_out + peer->keepalive_out
7554 + peer->notify_out + peer->refresh_out
7555 + peer->dynamic_cap_out,
Pradosh Mohapatraaf309fa2015-11-09 20:21:47 -05007556 0, 0,
7557 peer->sync[afi][safi]->update.count +
7558 peer->sync[afi][safi]->withdraw.count);
paul718e3742002-12-13 20:15:29 +00007559
7560 vty_out (vty, "%8s",
7561 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7562
7563 if (peer->status == Established)
7564 {
7565 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
Paul Jakma574e5002016-05-17 13:33:11 +01007566 totrcount += peer->pcount[afi][safi];
7567 totecount++;
paul718e3742002-12-13 20:15:29 +00007568 }
7569 else
7570 {
7571 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7572 vty_out (vty, " Idle (Admin)");
7573 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7574 vty_out (vty, " Idle (PfxCt)");
7575 else
7576 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7577 }
7578
7579 vty_out (vty, "%s", VTY_NEWLINE);
7580 }
7581 }
7582
7583 if (count)
Paul Jakma574e5002016-05-17 13:33:11 +01007584 {
7585 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7586 count, VTY_NEWLINE);
7587 vty_out (vty, "%sTotal num. Established sessions %d%s", VTY_NEWLINE,
7588 totecount, VTY_NEWLINE);
7589 vty_out (vty, "Total num. of routes received %d%s",
7590 totrcount, VTY_NEWLINE);
7591 }
paul718e3742002-12-13 20:15:29 +00007592 else
7593 vty_out (vty, "No %s neighbor is configured%s",
7594 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7595 return CMD_SUCCESS;
7596}
7597
paul94f2b392005-06-28 12:44:16 +00007598static int
paulfd79ac92004-10-13 05:06:08 +00007599bgp_show_summary_vty (struct vty *vty, const char *name,
7600 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007601{
7602 struct bgp *bgp;
7603
7604 if (name)
7605 {
7606 bgp = bgp_lookup_by_name (name);
7607
7608 if (! bgp)
7609 {
7610 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7611 return CMD_WARNING;
7612 }
7613
7614 bgp_show_summary (vty, bgp, afi, safi);
7615 return CMD_SUCCESS;
7616 }
7617
7618 bgp = bgp_get_default ();
7619
7620 if (bgp)
7621 bgp_show_summary (vty, bgp, afi, safi);
7622
7623 return CMD_SUCCESS;
7624}
7625
7626/* `show ip bgp summary' commands. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05007627DEFUN (show_ip_bgp_summary,
7628 show_ip_bgp_summary_cmd,
7629 "show ip bgp summary",
7630 SHOW_STR
7631 IP_STR
7632 BGP_STR
7633 "Summary of BGP neighbor status\n")
7634{
7635 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7636}
7637
7638DEFUN (show_ip_bgp_instance_summary,
7639 show_ip_bgp_instance_summary_cmd,
7640 "show ip bgp view WORD summary",
7641 SHOW_STR
7642 IP_STR
7643 BGP_STR
7644 "BGP view\n"
7645 "View name\n"
7646 "Summary of BGP neighbor status\n")
7647{
7648 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7649}
7650
7651DEFUN (show_ip_bgp_ipv4_summary,
7652 show_ip_bgp_ipv4_summary_cmd,
7653 "show ip bgp ipv4 (unicast|multicast) summary",
7654 SHOW_STR
7655 IP_STR
7656 BGP_STR
7657 "Address family\n"
7658 "Address Family modifier\n"
7659 "Address Family modifier\n"
7660 "Summary of BGP neighbor status\n")
7661{
7662 if (strncmp (argv[0], "m", 1) == 0)
7663 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7664
7665 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7666}
7667
7668DEFUN (show_ip_bgp_instance_ipv4_summary,
7669 show_ip_bgp_instance_ipv4_summary_cmd,
7670 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7671 SHOW_STR
7672 IP_STR
7673 BGP_STR
7674 "BGP view\n"
7675 "View name\n"
7676 "Address family\n"
7677 "Address Family modifier\n"
7678 "Address Family modifier\n"
7679 "Summary of BGP neighbor status\n")
7680{
7681 if (strncmp (argv[1], "m", 1) == 0)
7682 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7683 else
7684 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7685}
7686
7687DEFUN (show_ip_bgp_vpnv4_all_summary,
7688 show_ip_bgp_vpnv4_all_summary_cmd,
7689 "show ip bgp vpnv4 all summary",
7690 SHOW_STR
7691 IP_STR
7692 BGP_STR
7693 "Display VPNv4 NLRI specific information\n"
7694 "Display information about all VPNv4 NLRIs\n"
7695 "Summary of BGP neighbor status\n")
7696{
7697 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7698}
7699
7700DEFUN (show_ip_bgp_vpnv4_rd_summary,
7701 show_ip_bgp_vpnv4_rd_summary_cmd,
7702 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7703 SHOW_STR
7704 IP_STR
7705 BGP_STR
7706 "Display VPNv4 NLRI specific information\n"
7707 "Display information for a route distinguisher\n"
7708 "VPN Route Distinguisher\n"
7709 "Summary of BGP neighbor status\n")
7710{
7711 int ret;
7712 struct prefix_rd prd;
7713
7714 ret = str2prefix_rd (argv[0], &prd);
7715 if (! ret)
7716 {
7717 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7718 return CMD_WARNING;
7719 }
7720
7721 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7722}
7723
Lou Berger651b4022016-01-12 13:42:07 -05007724DEFUN (show_bgp_ipv4_safi_summary,
7725 show_bgp_ipv4_safi_summary_cmd,
7726 "show bgp ipv4 (unicast|multicast) summary",
paul718e3742002-12-13 20:15:29 +00007727 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007728 BGP_STR
7729 "Address family\n"
7730 "Address Family modifier\n"
7731 "Address Family modifier\n"
7732 "Summary of BGP neighbor status\n")
7733{
7734 if (strncmp (argv[0], "m", 1) == 0)
7735 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7736
7737 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7738}
7739
Lou Berger651b4022016-01-12 13:42:07 -05007740DEFUN (show_bgp_instance_ipv4_safi_summary,
7741 show_bgp_instance_ipv4_safi_summary_cmd,
7742 "show bgp view WORD ipv4 (unicast|multicast) summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007743 SHOW_STR
7744 BGP_STR
paul718e3742002-12-13 20:15:29 +00007745 "BGP view\n"
7746 "View name\n"
7747 "Address family\n"
7748 "Address Family modifier\n"
7749 "Address Family modifier\n"
7750 "Summary of BGP neighbor status\n")
7751{
7752 if (strncmp (argv[1], "m", 1) == 0)
7753 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7754 else
7755 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7756}
7757
Lou Berger651b4022016-01-12 13:42:07 -05007758DEFUN (show_bgp_ipv4_vpn_summary,
7759 show_bgp_ipv4_vpn_summary_cmd,
7760 "show bgp ipv4 vpn summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007761 SHOW_STR
7762 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007763 "IPv4\n"
7764 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007765 "Summary of BGP neighbor status\n")
7766{
7767 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7768}
7769
Lou Berger651b4022016-01-12 13:42:07 -05007770/* `show ip bgp summary' commands. */
7771DEFUN (show_bgp_ipv6_vpn_summary,
7772 show_bgp_ipv6_vpn_summary_cmd,
7773 "show bgp ipv6 vpn summary",
paul718e3742002-12-13 20:15:29 +00007774 SHOW_STR
7775 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007776 "IPv6\n"
7777 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007778 "Summary of BGP neighbor status\n")
7779{
Lou Berger651b4022016-01-12 13:42:07 -05007780 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
paul718e3742002-12-13 20:15:29 +00007781}
Lou Berger651b4022016-01-12 13:42:07 -05007782
7783DEFUN (show_bgp_ipv4_encap_summary,
7784 show_bgp_ipv4_encap_summary_cmd,
7785 "show bgp ipv4 encap summary",
7786 SHOW_STR
7787 BGP_STR
7788 "IPv4\n"
7789 "Display ENCAP NLRI specific information\n"
7790 "Summary of BGP neighbor status\n")
7791{
7792 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7793}
7794
Lou Berger651b4022016-01-12 13:42:07 -05007795DEFUN (show_bgp_ipv6_encap_summary,
7796 show_bgp_ipv6_encap_summary_cmd,
7797 "show bgp ipv6 encap summary",
7798 SHOW_STR
7799 BGP_STR
7800 "IPv6\n"
7801 "Display ENCAP NLRI specific information\n"
7802 "Summary of BGP neighbor status\n")
7803{
7804 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7805}
7806
paul718e3742002-12-13 20:15:29 +00007807DEFUN (show_bgp_instance_summary,
7808 show_bgp_instance_summary_cmd,
7809 "show bgp view WORD summary",
7810 SHOW_STR
7811 BGP_STR
7812 "BGP view\n"
7813 "View name\n"
7814 "Summary of BGP neighbor status\n")
7815{
Lou Berger651b4022016-01-12 13:42:07 -05007816 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7817 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7818 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7819 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7820 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7821 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7822 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7823 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7824 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7825 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7826 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7827 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
7828
Lou Berger651b4022016-01-12 13:42:07 -05007829 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7830 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7831 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7832 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7833 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7834 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7835 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7836 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7837 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7838 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7839 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7840 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05007841
Lou Berger651b4022016-01-12 13:42:07 -05007842 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007843}
7844
Lou Berger651b4022016-01-12 13:42:07 -05007845DEFUN (show_bgp_instance_ipv4_summary,
7846 show_bgp_instance_ipv4_summary_cmd,
7847 "show bgp view WORD ipv4 summary",
paul718e3742002-12-13 20:15:29 +00007848 SHOW_STR
7849 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007850 IP_STR
7851 "Address Family modifier\n"
7852 "Address Family modifier\n"
7853 "BGP view\n"
7854 "View name\n"
paul718e3742002-12-13 20:15:29 +00007855 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007856{
7857 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7858 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7859 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7860 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7861 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7862 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7863 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7864 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7865 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7866 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7867 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7868 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
paul718e3742002-12-13 20:15:29 +00007869
Lou Berger651b4022016-01-12 13:42:07 -05007870 return CMD_SUCCESS;
7871}
7872
Lou Berger651b4022016-01-12 13:42:07 -05007873DEFUN (show_bgp_instance_ipv6_summary,
paul718e3742002-12-13 20:15:29 +00007874 show_bgp_instance_ipv6_summary_cmd,
7875 "show bgp view WORD ipv6 summary",
7876 SHOW_STR
7877 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007878 IPV6_STR
7879 "Address Family modifier\n"
7880 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007881 "BGP view\n"
7882 "View name\n"
paul718e3742002-12-13 20:15:29 +00007883 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007884{
7885 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7886 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7887 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7888 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7889 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7890 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7891 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7892 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7893 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7894 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7895 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7896 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
7897
7898 return CMD_SUCCESS;
7899}
paul718e3742002-12-13 20:15:29 +00007900
Michael Lambert95cbbd22010-07-23 14:43:04 -04007901DEFUN (show_bgp_ipv6_safi_summary,
7902 show_bgp_ipv6_safi_summary_cmd,
7903 "show bgp ipv6 (unicast|multicast) summary",
7904 SHOW_STR
7905 BGP_STR
7906 "Address family\n"
7907 "Address Family modifier\n"
7908 "Address Family modifier\n"
7909 "Summary of BGP neighbor status\n")
7910{
7911 if (strncmp (argv[0], "m", 1) == 0)
7912 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7913
7914 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7915}
7916
7917DEFUN (show_bgp_instance_ipv6_safi_summary,
7918 show_bgp_instance_ipv6_safi_summary_cmd,
7919 "show bgp view WORD ipv6 (unicast|multicast) summary",
7920 SHOW_STR
7921 BGP_STR
7922 "BGP view\n"
7923 "View name\n"
7924 "Address family\n"
7925 "Address Family modifier\n"
7926 "Address Family modifier\n"
7927 "Summary of BGP neighbor status\n")
7928{
7929 if (strncmp (argv[1], "m", 1) == 0)
7930 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7931
7932 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7933}
7934
Lou Bergerf9b6c392016-01-12 13:42:09 -05007935/* old command */
7936DEFUN (show_ipv6_bgp_summary,
7937 show_ipv6_bgp_summary_cmd,
7938 "show ipv6 bgp summary",
7939 SHOW_STR
7940 IPV6_STR
7941 BGP_STR
7942 "Summary of BGP neighbor status\n")
7943{
7944 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7945}
7946
7947/* old command */
7948DEFUN (show_ipv6_mbgp_summary,
7949 show_ipv6_mbgp_summary_cmd,
7950 "show ipv6 mbgp summary",
7951 SHOW_STR
7952 IPV6_STR
7953 MBGP_STR
7954 "Summary of BGP neighbor status\n")
7955{
7956 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7957}
Lou Berger651b4022016-01-12 13:42:07 -05007958
7959/* variations of show bgp [...] summary */
7960
7961/* This one is for the 0-keyword variant */
7962DEFUN (show_bgp_summary,
7963 show_bgp_summary_cmd,
7964 "show bgp summary",
paul718e3742002-12-13 20:15:29 +00007965 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007966 BGP_STR
7967 "Summary of BGP neighbor status\n")
7968{
Lou Berger651b4022016-01-12 13:42:07 -05007969 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7970 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7971 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7972 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7973 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7974 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7975 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7976 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7977 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7978 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7979 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7980 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7981
Lou Berger651b4022016-01-12 13:42:07 -05007982 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7983 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7984 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7985 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7986 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7987 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7988 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7989 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7990 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7991 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7992 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7993 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05007994
Lou Berger651b4022016-01-12 13:42:07 -05007995 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007996}
7997
Lou Bergerf9b6c392016-01-12 13:42:09 -05007998ALIAS (show_bgp_summary,
7999 show_bgp_ipv6_summary_cmd,
8000 "show bgp ipv6 summary",
8001 SHOW_STR
8002 BGP_STR
8003 "Address family\n"
8004 "Summary of BGP neighbor status\n")
8005
Lou Berger651b4022016-01-12 13:42:07 -05008006DEFUN (show_bgp_summary_1w,
8007 show_bgp_summary_1w_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05008008 "show bgp (ipv4|ipv6|unicast|multicast|vpn|encap) summary",
paul718e3742002-12-13 20:15:29 +00008009 SHOW_STR
Lou Berger651b4022016-01-12 13:42:07 -05008010 BGP_STR
8011 IP_STR
Lou Berger651b4022016-01-12 13:42:07 -05008012 IP6_STR
Lou Berger651b4022016-01-12 13:42:07 -05008013 "Address Family modifier\n"
8014 "Address Family modifier\n"
8015 "Address Family modifier\n"
8016 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00008017 "Summary of BGP neighbor status\n")
8018{
Lou Berger651b4022016-01-12 13:42:07 -05008019 if (strcmp (argv[0], "ipv4") == 0) {
8020 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8021 vty_out(vty, "---------------------%s", VTY_NEWLINE);
8022 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8023 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8024 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
8025 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
8026 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8027 vty_out(vty, "-----------------%s", VTY_NEWLINE);
8028 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
8029 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8030 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8031 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
8032 return CMD_SUCCESS;
8033 }
Lou Berger205e6742016-01-12 13:42:11 -05008034
Lou Berger651b4022016-01-12 13:42:07 -05008035 if (strcmp (argv[0], "ipv6") == 0) {
8036 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8037 vty_out(vty, "---------------------%s", VTY_NEWLINE);
8038 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8039 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8040 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
8041 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
8042 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8043 vty_out(vty, "-----------------%s", VTY_NEWLINE);
8044 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
8045 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8046 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8047 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
8048 return CMD_SUCCESS;
8049 }
Lou Berger205e6742016-01-12 13:42:11 -05008050
Lou Berger651b4022016-01-12 13:42:07 -05008051 if (strcmp (argv[0], "unicast") == 0) {
8052 vty_out(vty, "IPv4 Unicast Summary:%s", VTY_NEWLINE);
8053 vty_out(vty, "---------------------%s", VTY_NEWLINE);
8054 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
Lou Berger651b4022016-01-12 13:42:07 -05008055 vty_out(vty, "%s", VTY_NEWLINE);
8056 vty_out(vty, "IPv6 Unicast Summary:%s", VTY_NEWLINE);
8057 vty_out(vty, "---------------------%s", VTY_NEWLINE);
8058 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
Lou Berger651b4022016-01-12 13:42:07 -05008059 return CMD_SUCCESS;
8060 }
8061 if (strcmp (argv[0], "multicast") == 0) {
8062 vty_out(vty, "IPv4 Multicast Summary:%s", VTY_NEWLINE);
8063 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
8064 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
Lou Berger651b4022016-01-12 13:42:07 -05008065 vty_out(vty, "%s", VTY_NEWLINE);
8066 vty_out(vty, "IPv6 Multicast Summary:%s", VTY_NEWLINE);
8067 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
8068 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
Lou Berger651b4022016-01-12 13:42:07 -05008069 return CMD_SUCCESS;
8070 }
8071 if (strcmp (argv[0], "vpn") == 0) {
8072 vty_out(vty, "IPv4 VPN Summary:%s", VTY_NEWLINE);
8073 vty_out(vty, "-----------------%s", VTY_NEWLINE);
8074 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
Lou Berger651b4022016-01-12 13:42:07 -05008075 vty_out(vty, "%s", VTY_NEWLINE);
8076 vty_out(vty, "IPv6 VPN Summary:%s", VTY_NEWLINE);
8077 vty_out(vty, "-----------------%s", VTY_NEWLINE);
8078 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
Lou Berger651b4022016-01-12 13:42:07 -05008079 return CMD_SUCCESS;
8080 }
8081 if (strcmp (argv[0], "encap") == 0) {
8082 vty_out(vty, "IPv4 Encap Summary:%s", VTY_NEWLINE);
8083 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8084 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
Lou Berger651b4022016-01-12 13:42:07 -05008085 vty_out(vty, "%s", VTY_NEWLINE);
8086 vty_out(vty, "IPv6 Encap Summary:%s", VTY_NEWLINE);
8087 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8088 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger651b4022016-01-12 13:42:07 -05008089 return CMD_SUCCESS;
8090 }
8091 vty_out(vty, "Unknown keyword: %s%s", argv[0], VTY_NEWLINE);
8092 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00008093}
Lou Berger651b4022016-01-12 13:42:07 -05008094
8095
David Lamparter6b0655a2014-06-04 06:53:35 +02008096
paulfd79ac92004-10-13 05:06:08 +00008097const char *
hasso538621f2004-05-21 09:31:30 +00008098afi_safi_print (afi_t afi, safi_t safi)
8099{
8100 if (afi == AFI_IP && safi == SAFI_UNICAST)
8101 return "IPv4 Unicast";
8102 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
8103 return "IPv4 Multicast";
8104 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
Lou Berger9da04bc2016-01-12 13:41:55 -05008105 return "VPN-IPv4 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05008106 else if (afi == AFI_IP && safi == SAFI_ENCAP)
8107 return "ENCAP-IPv4 Unicast";
hasso538621f2004-05-21 09:31:30 +00008108 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
8109 return "IPv6 Unicast";
8110 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
8111 return "IPv6 Multicast";
Lou Berger9da04bc2016-01-12 13:41:55 -05008112 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
8113 return "VPN-IPv6 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05008114 else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
8115 return "ENCAP-IPv6 Unicast";
hasso538621f2004-05-21 09:31:30 +00008116 else
8117 return "Unknown";
8118}
8119
paul718e3742002-12-13 20:15:29 +00008120/* Show BGP peer's information. */
8121enum show_type
8122{
8123 show_all,
8124 show_peer
8125};
8126
paul94f2b392005-06-28 12:44:16 +00008127static void
paul718e3742002-12-13 20:15:29 +00008128bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
8129 afi_t afi, safi_t safi,
8130 u_int16_t adv_smcap, u_int16_t adv_rmcap,
8131 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
8132{
8133 /* Send-Mode */
8134 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
8135 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
8136 {
8137 vty_out (vty, " Send-mode: ");
8138 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
8139 vty_out (vty, "advertised");
8140 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
8141 vty_out (vty, "%sreceived",
8142 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
8143 ", " : "");
8144 vty_out (vty, "%s", VTY_NEWLINE);
8145 }
8146
8147 /* Receive-Mode */
8148 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
8149 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
8150 {
8151 vty_out (vty, " Receive-mode: ");
8152 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
8153 vty_out (vty, "advertised");
8154 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
8155 vty_out (vty, "%sreceived",
8156 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
8157 ", " : "");
8158 vty_out (vty, "%s", VTY_NEWLINE);
8159 }
8160}
8161
paul94f2b392005-06-28 12:44:16 +00008162static void
paul718e3742002-12-13 20:15:29 +00008163bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
8164{
8165 struct bgp_filter *filter;
8166 char orf_pfx_name[BUFSIZ];
8167 int orf_pfx_count;
8168
8169 filter = &p->filter[afi][safi];
8170
hasso538621f2004-05-21 09:31:30 +00008171 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00008172 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008173
paul718e3742002-12-13 20:15:29 +00008174 if (p->af_group[afi][safi])
8175 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
8176
8177 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
8178 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
8179 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
8180 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
8181 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
8182 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
8183 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
8184
8185 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
8186 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
8187 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
8188 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
8189 {
8190 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
8191 ORF_TYPE_PREFIX, VTY_NEWLINE);
8192 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
8193 PEER_CAP_ORF_PREFIX_SM_ADV,
8194 PEER_CAP_ORF_PREFIX_RM_ADV,
8195 PEER_CAP_ORF_PREFIX_SM_RCV,
8196 PEER_CAP_ORF_PREFIX_RM_RCV);
8197 }
8198 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
8199 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
8200 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
8201 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
8202 {
8203 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
8204 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
8205 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
8206 PEER_CAP_ORF_PREFIX_SM_ADV,
8207 PEER_CAP_ORF_PREFIX_RM_ADV,
8208 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
8209 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
8210 }
8211
8212 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
8213 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
8214
8215 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
8216 || orf_pfx_count)
8217 {
8218 vty_out (vty, " Outbound Route Filter (ORF):");
8219 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
8220 vty_out (vty, " sent;");
8221 if (orf_pfx_count)
8222 vty_out (vty, " received (%d entries)", orf_pfx_count);
8223 vty_out (vty, "%s", VTY_NEWLINE);
8224 }
8225 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
8226 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
8227
8228 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
8229 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
8230 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8231 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
8232 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
8233 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
8234 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
8235 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
8236 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
8237 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
8238 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
8239 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8240 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
8241 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8242 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
8243 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8244 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
8245 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
8246 {
8247 vty_out (vty, " Community attribute sent to this neighbor");
8248 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
8249 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00008250 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008251 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00008252 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008253 else
hasso538621f2004-05-21 09:31:30 +00008254 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008255 }
8256 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
8257 {
8258 vty_out (vty, " Default information originate,");
8259
8260 if (p->default_rmap[afi][safi].name)
8261 vty_out (vty, " default route-map %s%s,",
8262 p->default_rmap[afi][safi].map ? "*" : "",
8263 p->default_rmap[afi][safi].name);
8264 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
8265 vty_out (vty, " default sent%s", VTY_NEWLINE);
8266 else
8267 vty_out (vty, " default not sent%s", VTY_NEWLINE);
8268 }
8269
8270 if (filter->plist[FILTER_IN].name
8271 || filter->dlist[FILTER_IN].name
8272 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00008273 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008274 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
8275 if (filter->plist[FILTER_OUT].name
8276 || filter->dlist[FILTER_OUT].name
8277 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00008278 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00008279 || filter->usmap.name)
8280 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008281 if (filter->map[RMAP_IMPORT].name)
8282 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
8283 if (filter->map[RMAP_EXPORT].name)
8284 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008285
8286 /* prefix-list */
8287 if (filter->plist[FILTER_IN].name)
8288 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
8289 filter->plist[FILTER_IN].plist ? "*" : "",
8290 filter->plist[FILTER_IN].name,
8291 VTY_NEWLINE);
8292 if (filter->plist[FILTER_OUT].name)
8293 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
8294 filter->plist[FILTER_OUT].plist ? "*" : "",
8295 filter->plist[FILTER_OUT].name,
8296 VTY_NEWLINE);
8297
8298 /* distribute-list */
8299 if (filter->dlist[FILTER_IN].name)
8300 vty_out (vty, " Incoming update network filter list is %s%s%s",
8301 filter->dlist[FILTER_IN].alist ? "*" : "",
8302 filter->dlist[FILTER_IN].name,
8303 VTY_NEWLINE);
8304 if (filter->dlist[FILTER_OUT].name)
8305 vty_out (vty, " Outgoing update network filter list is %s%s%s",
8306 filter->dlist[FILTER_OUT].alist ? "*" : "",
8307 filter->dlist[FILTER_OUT].name,
8308 VTY_NEWLINE);
8309
8310 /* filter-list. */
8311 if (filter->aslist[FILTER_IN].name)
8312 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
8313 filter->aslist[FILTER_IN].aslist ? "*" : "",
8314 filter->aslist[FILTER_IN].name,
8315 VTY_NEWLINE);
8316 if (filter->aslist[FILTER_OUT].name)
8317 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
8318 filter->aslist[FILTER_OUT].aslist ? "*" : "",
8319 filter->aslist[FILTER_OUT].name,
8320 VTY_NEWLINE);
8321
8322 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00008323 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008324 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008325 filter->map[RMAP_IN].map ? "*" : "",
8326 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00008327 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008328 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00008329 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008330 filter->map[RMAP_OUT].map ? "*" : "",
8331 filter->map[RMAP_OUT].name,
8332 VTY_NEWLINE);
8333 if (filter->map[RMAP_IMPORT].name)
8334 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
8335 filter->map[RMAP_IMPORT].map ? "*" : "",
8336 filter->map[RMAP_IMPORT].name,
8337 VTY_NEWLINE);
8338 if (filter->map[RMAP_EXPORT].name)
8339 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
8340 filter->map[RMAP_EXPORT].map ? "*" : "",
8341 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00008342 VTY_NEWLINE);
8343
8344 /* unsuppress-map */
8345 if (filter->usmap.name)
8346 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
8347 filter->usmap.map ? "*" : "",
8348 filter->usmap.name, VTY_NEWLINE);
8349
8350 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00008351 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
8352
paul718e3742002-12-13 20:15:29 +00008353 /* Maximum prefix */
8354 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
8355 {
hasso0a486e52005-02-01 20:57:17 +00008356 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00008357 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00008358 ? " (warning-only)" : "", VTY_NEWLINE);
8359 vty_out (vty, " Threshold for warning message %d%%",
8360 p->pmax_threshold[afi][safi]);
8361 if (p->pmax_restart[afi][safi])
8362 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
8363 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008364 }
paul718e3742002-12-13 20:15:29 +00008365
8366 vty_out (vty, "%s", VTY_NEWLINE);
8367}
8368
paul94f2b392005-06-28 12:44:16 +00008369static void
paul718e3742002-12-13 20:15:29 +00008370bgp_show_peer (struct vty *vty, struct peer *p)
8371{
8372 struct bgp *bgp;
8373 char buf1[BUFSIZ];
8374 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00008375 afi_t afi;
8376 safi_t safi;
Timo Teräse3443a22016-10-19 16:02:34 +03008377 int ttl;
paul718e3742002-12-13 20:15:29 +00008378
8379 bgp = p->bgp;
8380
8381 /* Configured IP address. */
8382 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008383 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00008384 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00008385 p->change_local_as ? p->change_local_as : p->local_as,
8386 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00008387 " no-prepend" : "",
8388 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
8389 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00008390 vty_out (vty, "%s link%s",
8391 p->as == p->local_as ? "internal" : "external",
8392 VTY_NEWLINE);
8393
8394 /* Description. */
8395 if (p->desc)
8396 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
8397
8398 /* Peer-group */
8399 if (p->group)
8400 vty_out (vty, " Member of peer-group %s for session parameters%s",
8401 p->group->name, VTY_NEWLINE);
8402
8403 /* Administrative shutdown. */
8404 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
8405 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
8406
8407 /* BGP Version. */
8408 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00008409 vty_out (vty, ", remote router ID %s%s",
8410 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
8411 VTY_NEWLINE);
8412
8413 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00008414 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
8415 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00008416 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
8417
8418 /* Status. */
8419 vty_out (vty, " BGP state = %s",
8420 LOOKUP (bgp_status_msg, p->status));
8421 if (p->status == Established)
8422 vty_out (vty, ", up for %8s",
8423 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00008424 else if (p->status == Active)
8425 {
8426 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
8427 vty_out (vty, " (passive)");
8428 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
8429 vty_out (vty, " (NSF passive)");
8430 }
paul718e3742002-12-13 20:15:29 +00008431 vty_out (vty, "%s", VTY_NEWLINE);
8432
8433 /* read timer */
8434 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
8435
8436 /* Configured timer values. */
8437 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
8438 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
8439 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
8440 {
8441 vty_out (vty, " Configured hold time is %d", p->holdtime);
8442 vty_out (vty, ", keepalive interval is %d seconds%s",
8443 p->keepalive, VTY_NEWLINE);
8444 }
hasso93406d82005-02-02 14:40:33 +00008445
paul718e3742002-12-13 20:15:29 +00008446 /* Capability. */
8447 if (p->status == Established)
8448 {
hasso538621f2004-05-21 09:31:30 +00008449 if (p->cap
paul718e3742002-12-13 20:15:29 +00008450 || p->afc_adv[AFI_IP][SAFI_UNICAST]
8451 || p->afc_recv[AFI_IP][SAFI_UNICAST]
8452 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
8453 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
paul718e3742002-12-13 20:15:29 +00008454 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
8455 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
8456 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
8457 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
Lou Berger9da04bc2016-01-12 13:41:55 -05008458 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
8459 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
Lou Bergera3fda882016-01-12 13:42:04 -05008460 || p->afc_adv[AFI_IP6][SAFI_ENCAP]
8461 || p->afc_recv[AFI_IP6][SAFI_ENCAP]
Lou Bergera3fda882016-01-12 13:42:04 -05008462 || p->afc_adv[AFI_IP][SAFI_ENCAP]
8463 || p->afc_recv[AFI_IP][SAFI_ENCAP]
paul718e3742002-12-13 20:15:29 +00008464 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
8465 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
8466 {
8467 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
8468
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008469 /* AS4 */
8470 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
8471 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8472 {
8473 vty_out (vty, " 4 Byte AS:");
8474 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8475 vty_out (vty, " advertised");
8476 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
8477 vty_out (vty, " %sreceived",
8478 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
8479 vty_out (vty, "%s", VTY_NEWLINE);
8480 }
paul718e3742002-12-13 20:15:29 +00008481 /* Dynamic */
8482 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
8483 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8484 {
8485 vty_out (vty, " Dynamic:");
8486 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8487 vty_out (vty, " advertised");
8488 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00008489 vty_out (vty, " %sreceived",
8490 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008491 vty_out (vty, "%s", VTY_NEWLINE);
8492 }
8493
8494 /* Route Refresh */
8495 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
8496 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8497 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
8498 {
8499 vty_out (vty, " Route refresh:");
8500 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
8501 vty_out (vty, " advertised");
8502 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8503 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00008504 vty_out (vty, " %sreceived(%s)",
8505 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
8506 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
8507 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
8508 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
8509
paul718e3742002-12-13 20:15:29 +00008510 vty_out (vty, "%s", VTY_NEWLINE);
8511 }
8512
hasso538621f2004-05-21 09:31:30 +00008513 /* Multiprotocol Extensions */
8514 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8515 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8516 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00008517 {
hasso538621f2004-05-21 09:31:30 +00008518 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
8519 if (p->afc_adv[afi][safi])
8520 vty_out (vty, " advertised");
8521 if (p->afc_recv[afi][safi])
8522 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
8523 vty_out (vty, "%s", VTY_NEWLINE);
8524 }
8525
8526 /* Gracefull Restart */
8527 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8528 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008529 {
hasso538621f2004-05-21 09:31:30 +00008530 vty_out (vty, " Graceful Restart Capabilty:");
8531 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008532 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00008533 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
8534 vty_out (vty, " %sreceived",
8535 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008536 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008537
8538 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00008539 {
hasso538621f2004-05-21 09:31:30 +00008540 int restart_af_count = 0;
8541
8542 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00008543 p->v_gr_restart, VTY_NEWLINE);
8544 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008545
8546 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8547 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8548 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
8549 {
hasso93406d82005-02-02 14:40:33 +00008550 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
8551 afi_safi_print (afi, safi),
8552 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
8553 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00008554 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00008555 }
hasso538621f2004-05-21 09:31:30 +00008556 if (! restart_af_count)
8557 vty_out (vty, "none");
8558 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008559 }
paul718e3742002-12-13 20:15:29 +00008560 }
paul718e3742002-12-13 20:15:29 +00008561 }
8562 }
8563
hasso93406d82005-02-02 14:40:33 +00008564 /* graceful restart information */
8565 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8566 || p->t_gr_restart
8567 || p->t_gr_stale)
8568 {
8569 int eor_send_af_count = 0;
8570 int eor_receive_af_count = 0;
8571
8572 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
8573 if (p->status == Established)
8574 {
8575 vty_out (vty, " End-of-RIB send: ");
8576 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8577 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8578 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
8579 {
8580 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
8581 afi_safi_print (afi, safi));
8582 eor_send_af_count++;
8583 }
8584 vty_out (vty, "%s", VTY_NEWLINE);
8585
8586 vty_out (vty, " End-of-RIB received: ");
8587 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8588 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8589 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
8590 {
8591 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
8592 afi_safi_print (afi, safi));
8593 eor_receive_af_count++;
8594 }
8595 vty_out (vty, "%s", VTY_NEWLINE);
8596 }
8597
8598 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008599 vty_out (vty, " The remaining time of restart timer is %ld%s",
8600 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
8601
hasso93406d82005-02-02 14:40:33 +00008602 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008603 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
8604 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008605 }
8606
paul718e3742002-12-13 20:15:29 +00008607 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00008608 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
8609 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008610 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008611 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
8612 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
8613 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
8614 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
8615 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
8616 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
8617 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
8618 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
8619 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
8620 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
8621 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008622
8623 /* advertisement-interval */
8624 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
8625 p->v_routeadv, VTY_NEWLINE);
8626
8627 /* Update-source. */
8628 if (p->update_if || p->update_source)
8629 {
8630 vty_out (vty, " Update source is ");
8631 if (p->update_if)
8632 vty_out (vty, "%s", p->update_if);
8633 else if (p->update_source)
8634 vty_out (vty, "%s",
8635 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
8636 vty_out (vty, "%s", VTY_NEWLINE);
8637 }
8638
8639 /* Default weight */
8640 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
8641 vty_out (vty, " Default weight %d%s", p->weight,
8642 VTY_NEWLINE);
8643
8644 vty_out (vty, "%s", VTY_NEWLINE);
8645
8646 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00008647 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8648 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8649 if (p->afc[afi][safi])
8650 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00008651
8652 vty_out (vty, " Connections established %d; dropped %d%s",
8653 p->established, p->dropped,
8654 VTY_NEWLINE);
8655
hassoe0701b72004-05-20 09:19:34 +00008656 if (! p->dropped)
8657 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
8658 else
8659 vty_out (vty, " Last reset %s, due to %s%s",
8660 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
8661 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00008662
paul718e3742002-12-13 20:15:29 +00008663 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8664 {
8665 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00008666
8667 if (p->t_pmax_restart)
8668 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8669 p->host, thread_timer_remain_second (p->t_pmax_restart),
8670 VTY_NEWLINE);
8671 else
8672 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8673 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008674 }
8675
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008676 /* EBGP Multihop and GTSM */
Timo Teräse3443a22016-10-19 16:02:34 +03008677 ttl = p->gtsm_hops;
8678 if (! ttl)
8679 ttl = peer_ttl (p);
8680 vty_out (vty, " %s BGP neighbor may be up to %d hops away.%s",
8681 p->sort == BGP_PEER_IBGP ? "Internal" : "External",
8682 ttl, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008683
8684 /* Local address. */
8685 if (p->su_local)
8686 {
hasso93406d82005-02-02 14:40:33 +00008687 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00008688 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
8689 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00008690 VTY_NEWLINE);
8691 }
8692
8693 /* Remote address. */
8694 if (p->su_remote)
8695 {
8696 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
8697 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
8698 ntohs (p->su_remote->sin.sin_port),
8699 VTY_NEWLINE);
8700 }
8701
8702 /* Nexthop display. */
8703 if (p->su_local)
8704 {
8705 vty_out (vty, "Nexthop: %s%s",
8706 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
8707 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008708 vty_out (vty, "Nexthop global: %s%s",
8709 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
8710 VTY_NEWLINE);
8711 vty_out (vty, "Nexthop local: %s%s",
8712 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
8713 VTY_NEWLINE);
8714 vty_out (vty, "BGP connection: %s%s",
8715 p->shared_network ? "shared network" : "non shared network",
8716 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008717 }
8718
Timo Teräsef757702015-04-29 09:43:04 +03008719 /* TCP metrics. */
8720 if (p->status == Established && p->rtt)
8721 vty_out (vty, "Estimated round trip time: %d ms%s",
8722 p->rtt, VTY_NEWLINE);
8723
paul718e3742002-12-13 20:15:29 +00008724 /* Timer information. */
8725 if (p->t_start)
8726 vty_out (vty, "Next start timer due in %ld seconds%s",
8727 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
8728 if (p->t_connect)
8729 vty_out (vty, "Next connect timer due in %ld seconds%s",
8730 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
8731
8732 vty_out (vty, "Read thread: %s Write thread: %s%s",
8733 p->t_read ? "on" : "off",
8734 p->t_write ? "on" : "off",
8735 VTY_NEWLINE);
8736
8737 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
8738 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
8739 bgp_capability_vty_out (vty, p);
8740
8741 vty_out (vty, "%s", VTY_NEWLINE);
8742}
8743
paul94f2b392005-06-28 12:44:16 +00008744static int
paul718e3742002-12-13 20:15:29 +00008745bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
8746 enum show_type type, union sockunion *su)
8747{
paul1eb8ef22005-04-07 07:30:20 +00008748 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00008749 struct peer *peer;
8750 int find = 0;
8751
paul1eb8ef22005-04-07 07:30:20 +00008752 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00008753 {
8754 switch (type)
8755 {
8756 case show_all:
8757 bgp_show_peer (vty, peer);
8758 break;
8759 case show_peer:
8760 if (sockunion_same (&peer->su, su))
8761 {
8762 find = 1;
8763 bgp_show_peer (vty, peer);
8764 }
8765 break;
8766 }
8767 }
8768
8769 if (type == show_peer && ! find)
8770 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
8771
8772 return CMD_SUCCESS;
8773}
8774
paul94f2b392005-06-28 12:44:16 +00008775static int
paulfd79ac92004-10-13 05:06:08 +00008776bgp_show_neighbor_vty (struct vty *vty, const char *name,
8777 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00008778{
8779 int ret;
8780 struct bgp *bgp;
8781 union sockunion su;
8782
8783 if (ip_str)
8784 {
8785 ret = str2sockunion (ip_str, &su);
8786 if (ret < 0)
8787 {
8788 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
8789 return CMD_WARNING;
8790 }
8791 }
8792
8793 if (name)
8794 {
8795 bgp = bgp_lookup_by_name (name);
8796
8797 if (! bgp)
8798 {
8799 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8800 return CMD_WARNING;
8801 }
8802
8803 bgp_show_neighbor (vty, bgp, type, &su);
8804
8805 return CMD_SUCCESS;
8806 }
8807
8808 bgp = bgp_get_default ();
8809
8810 if (bgp)
8811 bgp_show_neighbor (vty, bgp, type, &su);
8812
8813 return CMD_SUCCESS;
8814}
8815
Lou Bergerf9b6c392016-01-12 13:42:09 -05008816/* "show ip bgp neighbors" commands. */DEFUN (show_ip_bgp_neighbors,
8817 show_ip_bgp_neighbors_cmd,
8818 "show ip bgp neighbors",
8819 SHOW_STR
8820 IP_STR
8821 BGP_STR
8822 "Detailed information on TCP and BGP neighbor connections\n")
8823{
8824 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8825}
8826
8827ALIAS (show_ip_bgp_neighbors,
8828 show_ip_bgp_ipv4_neighbors_cmd,
8829 "show ip bgp ipv4 (unicast|multicast) neighbors",
8830 SHOW_STR
8831 IP_STR
8832 BGP_STR
8833 "Address family\n"
8834 "Address Family modifier\n"
8835 "Address Family modifier\n"
8836 "Detailed information on TCP and BGP neighbor connections\n")
8837
8838ALIAS (show_ip_bgp_neighbors,
8839 show_ip_bgp_vpnv4_all_neighbors_cmd,
8840 "show ip bgp vpnv4 all neighbors",
8841 SHOW_STR
8842 IP_STR
8843 BGP_STR
8844 "Display VPNv4 NLRI specific information\n"
8845 "Display information about all VPNv4 NLRIs\n"
8846 "Detailed information on TCP and BGP neighbor connections\n")
8847
8848ALIAS (show_ip_bgp_neighbors,
8849 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8850 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8851 SHOW_STR
8852 IP_STR
8853 BGP_STR
8854 "Display VPNv4 NLRI specific information\n"
8855 "Display information for a route distinguisher\n"
8856 "VPN Route Distinguisher\n"
8857 "Detailed information on TCP and BGP neighbor connections\n")
8858
8859ALIAS (show_ip_bgp_neighbors,
8860 show_bgp_ipv6_neighbors_cmd,
8861 "show bgp ipv6 neighbors",
8862 SHOW_STR
8863 BGP_STR
8864 "Address family\n"
8865 "Detailed information on TCP and BGP neighbor connections\n")
8866
8867DEFUN (show_ip_bgp_neighbors_peer,
8868 show_ip_bgp_neighbors_peer_cmd,
8869 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8870 SHOW_STR
8871 IP_STR
8872 BGP_STR
8873 "Detailed information on TCP and BGP neighbor connections\n"
8874 "Neighbor to display information about\n"
8875 "Neighbor to display information about\n")
8876{
8877 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8878}
8879
8880ALIAS (show_ip_bgp_neighbors_peer,
8881 show_ip_bgp_ipv4_neighbors_peer_cmd,
8882 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8883 SHOW_STR
8884 IP_STR
8885 BGP_STR
8886 "Address family\n"
8887 "Address Family modifier\n"
8888 "Address Family modifier\n"
8889 "Detailed information on TCP and BGP neighbor connections\n"
8890 "Neighbor to display information about\n"
8891 "Neighbor to display information about\n")
8892
8893ALIAS (show_ip_bgp_neighbors_peer,
8894 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8895 "show ip bgp vpnv4 all neighbors A.B.C.D",
8896 SHOW_STR
8897 IP_STR
8898 BGP_STR
8899 "Display VPNv4 NLRI specific information\n"
8900 "Display information about all VPNv4 NLRIs\n"
8901 "Detailed information on TCP and BGP neighbor connections\n"
8902 "Neighbor to display information about\n")
8903
8904ALIAS (show_ip_bgp_neighbors_peer,
8905 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8906 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8907 SHOW_STR
8908 IP_STR
8909 BGP_STR
8910 "Display VPNv4 NLRI specific information\n"
8911 "Display information about all VPNv4 NLRIs\n"
8912 "Detailed information on TCP and BGP neighbor connections\n"
8913 "Neighbor to display information about\n")
8914
8915ALIAS (show_ip_bgp_neighbors_peer,
8916 show_bgp_ipv6_neighbors_peer_cmd,
8917 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8918 SHOW_STR
8919 BGP_STR
8920 "Address family\n"
8921 "Detailed information on TCP and BGP neighbor connections\n"
8922 "Neighbor to display information about\n"
8923 "Neighbor to display information about\n")
8924
8925DEFUN (show_ip_bgp_instance_neighbors,
8926 show_ip_bgp_instance_neighbors_cmd,
8927 "show ip bgp view WORD neighbors",
8928 SHOW_STR
8929 IP_STR
8930 BGP_STR
8931 "BGP view\n"
8932 "View name\n"
8933 "Detailed information on TCP and BGP neighbor connections\n")
8934{
8935 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8936}
8937
8938ALIAS (show_ip_bgp_instance_neighbors,
8939 show_bgp_instance_ipv6_neighbors_cmd,
8940 "show bgp view WORD ipv6 neighbors",
8941 SHOW_STR
8942 BGP_STR
8943 "BGP view\n"
8944 "View name\n"
8945 "Address family\n"
8946 "Detailed information on TCP and BGP neighbor connections\n")
8947
8948DEFUN (show_ip_bgp_instance_neighbors_peer,
8949 show_ip_bgp_instance_neighbors_peer_cmd,
8950 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8951 SHOW_STR
8952 IP_STR
8953 BGP_STR
8954 "BGP view\n"
8955 "View name\n"
8956 "Detailed information on TCP and BGP neighbor connections\n"
8957 "Neighbor to display information about\n"
8958 "Neighbor to display information about\n")
8959{
8960 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8961}
8962
8963/* Show BGP's AS paths internal data. There are both `show ip bgp
8964 paths' and `show ip mbgp paths'. Those functions results are the
8965 same.*/
8966DEFUN (show_ip_bgp_paths,
8967 show_ip_bgp_paths_cmd,
8968 "show ip bgp paths",
8969 SHOW_STR
8970 IP_STR
8971 BGP_STR
8972 "Path information\n")
8973{
8974 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8975 aspath_print_all_vty (vty);
8976 return CMD_SUCCESS;
8977}
8978
8979DEFUN (show_ip_bgp_ipv4_paths,
8980 show_ip_bgp_ipv4_paths_cmd,
8981 "show ip bgp ipv4 (unicast|multicast) paths",
8982 SHOW_STR
8983 IP_STR
8984 BGP_STR
8985 "Address family\n"
8986 "Address Family modifier\n"
8987 "Address Family modifier\n"
8988 "Path information\n")
8989{
8990 vty_out (vty, "Address Refcnt Path\r\n");
8991 aspath_print_all_vty (vty);
8992
8993 return CMD_SUCCESS;
8994}
8995
Lou Berger651b4022016-01-12 13:42:07 -05008996DEFUN (show_bgp_neighbors,
8997 show_bgp_neighbors_cmd,
8998 "show bgp neighbors",
paul718e3742002-12-13 20:15:29 +00008999 SHOW_STR
paul718e3742002-12-13 20:15:29 +00009000 BGP_STR
9001 "Detailed information on TCP and BGP neighbor connections\n")
9002{
9003 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
9004}
9005
Lou Berger651b4022016-01-12 13:42:07 -05009006DEFUN (show_bgp_neighbors_peer,
9007 show_bgp_neighbors_peer_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05009008 "show bgp neighbors (A.B.C.D|X:X::X:X)",
paul718e3742002-12-13 20:15:29 +00009009 SHOW_STR
paul718e3742002-12-13 20:15:29 +00009010 BGP_STR
9011 "Detailed information on TCP and BGP neighbor connections\n"
9012 "Neighbor to display information about\n"
9013 "Neighbor to display information about\n")
9014{
9015 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
9016}
9017
Lou Berger651b4022016-01-12 13:42:07 -05009018DEFUN (show_bgp_instance_neighbors,
9019 show_bgp_instance_neighbors_cmd,
9020 "show bgp view WORD neighbors",
paul718e3742002-12-13 20:15:29 +00009021 SHOW_STR
paul718e3742002-12-13 20:15:29 +00009022 BGP_STR
9023 "BGP view\n"
9024 "View name\n"
9025 "Detailed information on TCP and BGP neighbor connections\n")
9026{
9027 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
9028}
9029
Lou Berger651b4022016-01-12 13:42:07 -05009030DEFUN (show_bgp_instance_neighbors_peer,
9031 show_bgp_instance_neighbors_peer_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05009032 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
paul718e3742002-12-13 20:15:29 +00009033 SHOW_STR
paul718e3742002-12-13 20:15:29 +00009034 BGP_STR
9035 "BGP view\n"
9036 "View name\n"
9037 "Detailed information on TCP and BGP neighbor connections\n"
9038 "Neighbor to display information about\n"
9039 "Neighbor to display information about\n")
9040{
9041 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
9042}
paulbb46e942003-10-24 19:02:03 +00009043
Lou Berger651b4022016-01-12 13:42:07 -05009044ALIAS (show_bgp_instance_neighbors_peer,
paulbb46e942003-10-24 19:02:03 +00009045 show_bgp_instance_ipv6_neighbors_peer_cmd,
9046 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
9047 SHOW_STR
9048 BGP_STR
9049 "BGP view\n"
9050 "View name\n"
9051 "Address family\n"
9052 "Detailed information on TCP and BGP neighbor connections\n"
9053 "Neighbor to display information about\n"
9054 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009055
paul718e3742002-12-13 20:15:29 +00009056/* Show BGP's AS paths internal data. There are both `show ip bgp
9057 paths' and `show ip mbgp paths'. Those functions results are the
9058 same.*/
Lou Berger651b4022016-01-12 13:42:07 -05009059DEFUN (show_bgp_ipv4_paths,
9060 show_bgp_ipv4_paths_cmd,
9061 "show bgp paths",
paul718e3742002-12-13 20:15:29 +00009062 SHOW_STR
paul718e3742002-12-13 20:15:29 +00009063 BGP_STR
9064 "Path information\n")
9065{
9066 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
9067 aspath_print_all_vty (vty);
9068 return CMD_SUCCESS;
9069}
9070
paul718e3742002-12-13 20:15:29 +00009071#include "hash.h"
9072
paul94f2b392005-06-28 12:44:16 +00009073static void
paul718e3742002-12-13 20:15:29 +00009074community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
9075{
9076 struct community *com;
9077
9078 com = (struct community *) backet->data;
David Lampartereed3c482015-03-03 08:51:53 +01009079 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
paul718e3742002-12-13 20:15:29 +00009080 community_str (com), VTY_NEWLINE);
9081}
9082
9083/* Show BGP's community internal data. */
9084DEFUN (show_ip_bgp_community_info,
9085 show_ip_bgp_community_info_cmd,
9086 "show ip bgp community-info",
9087 SHOW_STR
9088 IP_STR
9089 BGP_STR
9090 "List all bgp community information\n")
9091{
9092 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
9093
9094 hash_iterate (community_hash (),
9095 (void (*) (struct hash_backet *, void *))
9096 community_show_all_iterator,
9097 vty);
9098
9099 return CMD_SUCCESS;
9100}
9101
9102DEFUN (show_ip_bgp_attr_info,
9103 show_ip_bgp_attr_info_cmd,
9104 "show ip bgp attribute-info",
9105 SHOW_STR
9106 IP_STR
9107 BGP_STR
9108 "List all bgp attribute information\n")
9109{
9110 attr_show_all (vty);
9111 return CMD_SUCCESS;
9112}
David Lamparter6b0655a2014-06-04 06:53:35 +02009113
paul94f2b392005-06-28 12:44:16 +00009114static int
paulfee0f4c2004-09-13 05:12:46 +00009115bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
9116 afi_t afi, safi_t safi)
9117{
9118 char timebuf[BGP_UPTIME_LEN];
9119 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00009120 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00009121 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00009122 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00009123 int len;
9124 int count = 0;
9125
9126 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
9127 {
paul1eb8ef22005-04-07 07:30:20 +00009128 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00009129 {
9130 count++;
9131 bgp_write_rsclient_summary (vty, peer, afi, safi);
9132 }
9133 return count;
9134 }
9135
9136 len = vty_out (vty, "%s", rsclient->host);
9137 len = 16 - len;
9138
9139 if (len < 1)
9140 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
9141 else
9142 vty_out (vty, "%*s", len, " ");
9143
hasso3d515fd2005-02-01 21:30:04 +00009144 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00009145
Milan Kociancb4fc592014-12-01 12:48:25 +00009146 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00009147
9148 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
9149 if ( rmname && strlen (rmname) > 13 )
9150 {
9151 sprintf (rmbuf, "%13s", "...");
9152 rmname = strncpy (rmbuf, rmname, 10);
9153 }
9154 else if (! rmname)
9155 rmname = "<none>";
9156 vty_out (vty, " %13s ", rmname);
9157
9158 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
9159 if ( rmname && strlen (rmname) > 13 )
9160 {
9161 sprintf (rmbuf, "%13s", "...");
9162 rmname = strncpy (rmbuf, rmname, 10);
9163 }
9164 else if (! rmname)
9165 rmname = "<none>";
9166 vty_out (vty, " %13s ", rmname);
9167
9168 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
9169
9170 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
9171 vty_out (vty, " Idle (Admin)");
9172 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
9173 vty_out (vty, " Idle (PfxCt)");
9174 else
9175 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
9176
9177 vty_out (vty, "%s", VTY_NEWLINE);
9178
9179 return 1;
9180}
9181
paul94f2b392005-06-28 12:44:16 +00009182static int
paulfd79ac92004-10-13 05:06:08 +00009183bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
9184 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00009185{
9186 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00009187 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00009188 int count = 0;
9189
9190 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00009191 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00009192
paul1eb8ef22005-04-07 07:30:20 +00009193 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00009194 {
9195 if (peer->afc[afi][safi] &&
9196 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
9197 {
9198 if (! count)
9199 {
9200 vty_out (vty,
9201 "Route Server's BGP router identifier %s%s",
9202 inet_ntoa (bgp->router_id), VTY_NEWLINE);
9203 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04009204 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00009205 VTY_NEWLINE);
9206
9207 vty_out (vty, "%s", VTY_NEWLINE);
9208 vty_out (vty, "%s%s", header, VTY_NEWLINE);
9209 }
9210
9211 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
9212 }
9213 }
9214
9215 if (count)
9216 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
9217 count, VTY_NEWLINE);
9218 else
9219 vty_out (vty, "No %s Route Server Client is configured%s",
9220 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
9221
9222 return CMD_SUCCESS;
9223}
9224
paul94f2b392005-06-28 12:44:16 +00009225static int
paulfd79ac92004-10-13 05:06:08 +00009226bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
9227 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00009228{
9229 struct bgp *bgp;
9230
9231 if (name)
9232 {
9233 bgp = bgp_lookup_by_name (name);
9234
9235 if (! bgp)
9236 {
9237 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
9238 return CMD_WARNING;
9239 }
9240
9241 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9242 return CMD_SUCCESS;
9243 }
9244
9245 bgp = bgp_get_default ();
9246
9247 if (bgp)
9248 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9249
9250 return CMD_SUCCESS;
9251}
9252
9253/* 'show bgp rsclient' commands. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05009254DEFUN (show_ip_bgp_rsclient_summary,
9255 show_ip_bgp_rsclient_summary_cmd,
9256 "show ip bgp rsclient summary",
9257 SHOW_STR
9258 IP_STR
9259 BGP_STR
9260 "Information about Route Server Clients\n"
9261 "Summary of all Route Server Clients\n")
9262{
9263 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9264}
9265
9266DEFUN (show_ip_bgp_instance_rsclient_summary,
9267 show_ip_bgp_instance_rsclient_summary_cmd,
9268 "show ip bgp view WORD rsclient summary",
9269 SHOW_STR
9270 IP_STR
9271 BGP_STR
9272 "BGP view\n"
9273 "View name\n"
9274 "Information about Route Server Clients\n"
9275 "Summary of all Route Server Clients\n")
9276{
9277 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9278}
9279
9280DEFUN (show_ip_bgp_ipv4_rsclient_summary,
9281 show_ip_bgp_ipv4_rsclient_summary_cmd,
9282 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
9283 SHOW_STR
9284 IP_STR
9285 BGP_STR
9286 "Address family\n"
9287 "Address Family modifier\n"
9288 "Address Family modifier\n"
9289 "Information about Route Server Clients\n"
9290 "Summary of all Route Server Clients\n")
9291{
9292 if (strncmp (argv[0], "m", 1) == 0)
9293 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9294
9295 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9296}
9297
9298DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
9299 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
9300 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9301 SHOW_STR
9302 IP_STR
9303 BGP_STR
9304 "BGP view\n"
9305 "View name\n"
9306 "Address family\n"
9307 "Address Family modifier\n"
9308 "Address Family modifier\n"
9309 "Information about Route Server Clients\n"
9310 "Summary of all Route Server Clients\n")
9311{
9312 if (strncmp (argv[1], "m", 1) == 0)
9313 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9314
9315 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9316}
paulfee0f4c2004-09-13 05:12:46 +00009317
Michael Lambert95cbbd22010-07-23 14:43:04 -04009318DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
9319 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
9320 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9321 SHOW_STR
9322 BGP_STR
9323 "BGP view\n"
9324 "View name\n"
9325 "Address family\n"
9326 "Address Family modifier\n"
9327 "Address Family modifier\n"
9328 "Information about Route Server Clients\n"
9329 "Summary of all Route Server Clients\n")
9330{
9331 safi_t safi;
9332
9333 if (argc == 2) {
9334 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9335 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
9336 } else {
9337 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9338 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
9339 }
9340}
9341
9342ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
9343 show_bgp_ipv4_safi_rsclient_summary_cmd,
9344 "show bgp ipv4 (unicast|multicast) rsclient summary",
9345 SHOW_STR
9346 BGP_STR
9347 "Address family\n"
9348 "Address Family modifier\n"
9349 "Address Family modifier\n"
9350 "Information about Route Server Clients\n"
9351 "Summary of all Route Server Clients\n")
9352
paulfee0f4c2004-09-13 05:12:46 +00009353DEFUN (show_bgp_rsclient_summary,
9354 show_bgp_rsclient_summary_cmd,
9355 "show bgp rsclient summary",
9356 SHOW_STR
9357 BGP_STR
9358 "Information about Route Server Clients\n"
9359 "Summary of all Route Server Clients\n")
9360{
Lou Berger651b4022016-01-12 13:42:07 -05009361 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9362 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9363 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9364 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9365 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9366 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9367 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9368 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9369 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
9370 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9371 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9372 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
9373
Lou Berger651b4022016-01-12 13:42:07 -05009374 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9375 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9376 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9377 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9378 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9379 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9380 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9381 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9382 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9383 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9384 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9385 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05009386
Lou Berger651b4022016-01-12 13:42:07 -05009387 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009388}
9389
9390DEFUN (show_bgp_instance_rsclient_summary,
9391 show_bgp_instance_rsclient_summary_cmd,
9392 "show bgp view WORD rsclient summary",
9393 SHOW_STR
9394 BGP_STR
9395 "BGP view\n"
9396 "View name\n"
9397 "Information about Route Server Clients\n"
9398 "Summary of all Route Server Clients\n")
9399{
Lou Berger651b4022016-01-12 13:42:07 -05009400 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9401 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9402 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9403 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9404 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9405 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9406 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9407 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9408 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
9409 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9410 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9411 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
9412
Lou Berger651b4022016-01-12 13:42:07 -05009413 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9414 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9415 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9416 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9417 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9418 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
9419 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9420 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9421 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9422 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9423 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9424 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05009425
Lou Berger651b4022016-01-12 13:42:07 -05009426 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009427}
9428
Lou Berger651b4022016-01-12 13:42:07 -05009429DEFUN (show_bgp_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009430 show_bgp_ipv6_rsclient_summary_cmd,
9431 "show bgp ipv6 rsclient summary",
9432 SHOW_STR
9433 BGP_STR
9434 "Address family\n"
9435 "Information about Route Server Clients\n"
9436 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009437{
9438 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9439 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9440 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9441 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9442 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9443 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9444 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9445 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9446 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9447 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9448 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9449 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
paulfee0f4c2004-09-13 05:12:46 +00009450
Lou Berger651b4022016-01-12 13:42:07 -05009451 return CMD_SUCCESS;
9452}
9453
9454DEFUN (show_bgp_instance_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009455 show_bgp_instance_ipv6_rsclient_summary_cmd,
9456 "show bgp view WORD ipv6 rsclient summary",
9457 SHOW_STR
9458 BGP_STR
9459 "BGP view\n"
9460 "View name\n"
9461 "Address family\n"
9462 "Information about Route Server Clients\n"
9463 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009464{
9465 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9466 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9467 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9468 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9469 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9470 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
9471 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9472 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9473 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9474 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9475 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9476 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
9477
9478 return CMD_SUCCESS;
9479}
Michael Lambert95cbbd22010-07-23 14:43:04 -04009480
9481DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
9482 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
9483 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
9484 SHOW_STR
9485 BGP_STR
9486 "BGP view\n"
9487 "View name\n"
9488 "Address family\n"
9489 "Address Family modifier\n"
9490 "Address Family modifier\n"
9491 "Information about Route Server Clients\n"
9492 "Summary of all Route Server Clients\n")
9493{
9494 safi_t safi;
9495
9496 if (argc == 2) {
9497 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9498 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
9499 } else {
9500 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9501 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
9502 }
9503}
9504
9505ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
9506 show_bgp_ipv6_safi_rsclient_summary_cmd,
9507 "show bgp ipv6 (unicast|multicast) rsclient summary",
9508 SHOW_STR
9509 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05009510 IPV6_STR
Michael Lambert95cbbd22010-07-23 14:43:04 -04009511 "Address Family modifier\n"
9512 "Address Family modifier\n"
9513 "Information about Route Server Clients\n"
9514 "Summary of all Route Server Clients\n")
9515
paul718e3742002-12-13 20:15:29 +00009516/* Redistribute VTY commands. */
9517
paul718e3742002-12-13 20:15:29 +00009518DEFUN (bgp_redistribute_ipv4,
9519 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009520 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009521 "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{
9524 int type;
9525
David Lampartere0ca5fd2009-09-16 01:52:42 +02009526 type = proto_redistnum (AFI_IP, argv[0]);
9527 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009528 {
9529 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9530 return CMD_WARNING;
9531 }
9532 return bgp_redistribute_set (vty->index, AFI_IP, type);
9533}
9534
9535DEFUN (bgp_redistribute_ipv4_rmap,
9536 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009537 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009538 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009539 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009540 "Route map reference\n"
9541 "Pointer to route-map entries\n")
9542{
9543 int type;
9544
David Lampartere0ca5fd2009-09-16 01:52:42 +02009545 type = proto_redistnum (AFI_IP, argv[0]);
9546 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009547 {
9548 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9549 return CMD_WARNING;
9550 }
9551
9552 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9553 return bgp_redistribute_set (vty->index, AFI_IP, type);
9554}
9555
9556DEFUN (bgp_redistribute_ipv4_metric,
9557 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009558 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009559 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009560 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009561 "Metric for redistributed routes\n"
9562 "Default metric\n")
9563{
9564 int type;
9565 u_int32_t metric;
9566
David Lampartere0ca5fd2009-09-16 01:52:42 +02009567 type = proto_redistnum (AFI_IP, argv[0]);
9568 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009569 {
9570 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9571 return CMD_WARNING;
9572 }
9573 VTY_GET_INTEGER ("metric", metric, argv[1]);
9574
9575 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9576 return bgp_redistribute_set (vty->index, AFI_IP, type);
9577}
9578
9579DEFUN (bgp_redistribute_ipv4_rmap_metric,
9580 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009581 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009582 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009583 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009584 "Route map reference\n"
9585 "Pointer to route-map entries\n"
9586 "Metric for redistributed routes\n"
9587 "Default metric\n")
9588{
9589 int type;
9590 u_int32_t metric;
9591
David Lampartere0ca5fd2009-09-16 01:52:42 +02009592 type = proto_redistnum (AFI_IP, argv[0]);
9593 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009594 {
9595 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9596 return CMD_WARNING;
9597 }
9598 VTY_GET_INTEGER ("metric", metric, argv[2]);
9599
9600 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9601 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9602 return bgp_redistribute_set (vty->index, AFI_IP, type);
9603}
9604
9605DEFUN (bgp_redistribute_ipv4_metric_rmap,
9606 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009607 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009608 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009609 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009610 "Metric for redistributed routes\n"
9611 "Default metric\n"
9612 "Route map reference\n"
9613 "Pointer to route-map entries\n")
9614{
9615 int type;
9616 u_int32_t metric;
9617
David Lampartere0ca5fd2009-09-16 01:52:42 +02009618 type = proto_redistnum (AFI_IP, argv[0]);
9619 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009620 {
9621 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9622 return CMD_WARNING;
9623 }
9624 VTY_GET_INTEGER ("metric", metric, argv[1]);
9625
9626 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9627 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
9628 return bgp_redistribute_set (vty->index, AFI_IP, type);
9629}
9630
9631DEFUN (no_bgp_redistribute_ipv4,
9632 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009633 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009634 NO_STR
9635 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009636 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009637{
9638 int type;
9639
David Lampartere0ca5fd2009-09-16 01:52:42 +02009640 type = proto_redistnum (AFI_IP, argv[0]);
9641 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009642 {
9643 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9644 return CMD_WARNING;
9645 }
9646
9647 return bgp_redistribute_unset (vty->index, AFI_IP, type);
9648}
9649
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009650ALIAS (no_bgp_redistribute_ipv4,
paul718e3742002-12-13 20:15:29 +00009651 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009652 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009653 NO_STR
9654 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009655 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009656 "Route map reference\n"
9657 "Pointer to route-map entries\n")
paul718e3742002-12-13 20:15:29 +00009658
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009659ALIAS (no_bgp_redistribute_ipv4,
paul718e3742002-12-13 20:15:29 +00009660 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009661 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009662 NO_STR
9663 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009664 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009665 "Metric for redistributed routes\n"
9666 "Default metric\n")
paul718e3742002-12-13 20:15:29 +00009667
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009668ALIAS (no_bgp_redistribute_ipv4,
paul718e3742002-12-13 20:15:29 +00009669 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009670 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
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_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009674 "Route map reference\n"
9675 "Pointer to route-map entries\n"
9676 "Metric for redistributed routes\n"
9677 "Default metric\n")
paul718e3742002-12-13 20:15:29 +00009678
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009679ALIAS (no_bgp_redistribute_ipv4,
paul718e3742002-12-13 20:15:29 +00009680 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009681 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009682 NO_STR
9683 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009684 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009685 "Metric for redistributed routes\n"
9686 "Default metric\n"
9687 "Route map reference\n"
9688 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009689
paul718e3742002-12-13 20:15:29 +00009690DEFUN (bgp_redistribute_ipv6,
9691 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009692 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009693 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009694 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009695{
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 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9706}
9707
9708DEFUN (bgp_redistribute_ipv6_rmap,
9709 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009710 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009711 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009712 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009713 "Route map reference\n"
9714 "Pointer to route-map entries\n")
9715{
9716 int type;
9717
David Lampartere0ca5fd2009-09-16 01:52:42 +02009718 type = proto_redistnum (AFI_IP6, argv[0]);
9719 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009720 {
9721 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9722 return CMD_WARNING;
9723 }
9724
9725 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9726 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9727}
9728
9729DEFUN (bgp_redistribute_ipv6_metric,
9730 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009731 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009732 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009733 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009734 "Metric for redistributed routes\n"
9735 "Default metric\n")
9736{
9737 int type;
9738 u_int32_t metric;
9739
David Lampartere0ca5fd2009-09-16 01:52:42 +02009740 type = proto_redistnum (AFI_IP6, argv[0]);
9741 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009742 {
9743 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9744 return CMD_WARNING;
9745 }
9746 VTY_GET_INTEGER ("metric", metric, argv[1]);
9747
9748 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9749 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9750}
9751
9752DEFUN (bgp_redistribute_ipv6_rmap_metric,
9753 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009754 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009755 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009756 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009757 "Route map reference\n"
9758 "Pointer to route-map entries\n"
9759 "Metric for redistributed routes\n"
9760 "Default metric\n")
9761{
9762 int type;
9763 u_int32_t metric;
9764
David Lampartere0ca5fd2009-09-16 01:52:42 +02009765 type = proto_redistnum (AFI_IP6, argv[0]);
9766 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009767 {
9768 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9769 return CMD_WARNING;
9770 }
9771 VTY_GET_INTEGER ("metric", metric, argv[2]);
9772
9773 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9774 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9775 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9776}
9777
9778DEFUN (bgp_redistribute_ipv6_metric_rmap,
9779 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009780 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009781 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009782 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009783 "Metric for redistributed routes\n"
9784 "Default metric\n"
9785 "Route map reference\n"
9786 "Pointer to route-map entries\n")
9787{
9788 int type;
9789 u_int32_t metric;
9790
David Lampartere0ca5fd2009-09-16 01:52:42 +02009791 type = proto_redistnum (AFI_IP6, argv[0]);
9792 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009793 {
9794 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9795 return CMD_WARNING;
9796 }
9797 VTY_GET_INTEGER ("metric", metric, argv[1]);
9798
9799 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9800 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
9801 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9802}
9803
9804DEFUN (no_bgp_redistribute_ipv6,
9805 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009806 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009807 NO_STR
9808 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009809 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009810{
9811 int type;
9812
David Lampartere0ca5fd2009-09-16 01:52:42 +02009813 type = proto_redistnum (AFI_IP6, argv[0]);
9814 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009815 {
9816 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9817 return CMD_WARNING;
9818 }
9819
9820 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
9821}
9822
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009823ALIAS (no_bgp_redistribute_ipv6,
paul718e3742002-12-13 20:15:29 +00009824 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009825 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009826 NO_STR
9827 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009828 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009829 "Route map reference\n"
9830 "Pointer to route-map entries\n")
paul718e3742002-12-13 20:15:29 +00009831
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009832ALIAS (no_bgp_redistribute_ipv6,
paul718e3742002-12-13 20:15:29 +00009833 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009834 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009835 NO_STR
9836 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009837 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009838 "Metric for redistributed routes\n"
9839 "Default metric\n")
paul718e3742002-12-13 20:15:29 +00009840
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009841ALIAS (no_bgp_redistribute_ipv6,
paul718e3742002-12-13 20:15:29 +00009842 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009843 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009844 NO_STR
9845 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009846 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009847 "Route map reference\n"
9848 "Pointer to route-map entries\n"
9849 "Metric for redistributed routes\n"
9850 "Default metric\n")
paul718e3742002-12-13 20:15:29 +00009851
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009852ALIAS (no_bgp_redistribute_ipv6,
paul718e3742002-12-13 20:15:29 +00009853 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009854 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009855 NO_STR
9856 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009857 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009858 "Metric for redistributed routes\n"
9859 "Default metric\n"
9860 "Route map reference\n"
9861 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009862
paul718e3742002-12-13 20:15:29 +00009863int
9864bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9865 safi_t safi, int *write)
9866{
9867 int i;
paul718e3742002-12-13 20:15:29 +00009868
9869 /* Unicast redistribution only. */
9870 if (safi != SAFI_UNICAST)
9871 return 0;
9872
9873 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9874 {
9875 /* Redistribute BGP does not make sense. */
9876 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9877 {
9878 /* Display "address-family" when it is not yet diplayed. */
9879 bgp_config_write_family_header (vty, afi, safi, write);
9880
9881 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009882 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009883
9884 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009885 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009886
9887 if (bgp->rmap[afi][i].name)
9888 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9889
9890 vty_out (vty, "%s", VTY_NEWLINE);
9891 }
9892 }
9893 return *write;
9894}
David Lamparter6b0655a2014-06-04 06:53:35 +02009895
paul718e3742002-12-13 20:15:29 +00009896/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009897static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009898{
9899 BGP_NODE,
9900 "%s(config-router)# ",
9901 1,
9902};
9903
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009904static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009905{
9906 BGP_IPV4_NODE,
9907 "%s(config-router-af)# ",
9908 1,
9909};
9910
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009911static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009912{
9913 BGP_IPV4M_NODE,
9914 "%s(config-router-af)# ",
9915 1,
9916};
9917
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009918static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009919{
9920 BGP_IPV6_NODE,
9921 "%s(config-router-af)# ",
9922 1,
9923};
9924
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009925static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009926{
9927 BGP_IPV6M_NODE,
9928 "%s(config-router-af)# ",
9929 1,
9930};
9931
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009932static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009933{
9934 BGP_VPNV4_NODE,
9935 "%s(config-router-af)# ",
9936 1
9937};
David Lamparter6b0655a2014-06-04 06:53:35 +02009938
Lou Berger13c378d2016-01-12 13:41:56 -05009939static struct cmd_node bgp_vpnv6_node =
9940{
9941 BGP_VPNV6_NODE,
9942 "%s(config-router-af-vpnv6)# ",
9943 1
9944};
9945
Lou Bergera3fda882016-01-12 13:42:04 -05009946static struct cmd_node bgp_encap_node =
9947{
9948 BGP_ENCAP_NODE,
9949 "%s(config-router-af-encap)# ",
9950 1
9951};
9952
9953static struct cmd_node bgp_encapv6_node =
9954{
9955 BGP_ENCAPV6_NODE,
9956 "%s(config-router-af-encapv6)# ",
9957 1
9958};
9959
paul1f8ae702005-09-09 23:49:49 +00009960static void community_list_vty (void);
9961
paul718e3742002-12-13 20:15:29 +00009962void
paul94f2b392005-06-28 12:44:16 +00009963bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009964{
paul718e3742002-12-13 20:15:29 +00009965 /* Install bgp top node. */
9966 install_node (&bgp_node, bgp_config_write);
9967 install_node (&bgp_ipv4_unicast_node, NULL);
9968 install_node (&bgp_ipv4_multicast_node, NULL);
9969 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009970 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009971 install_node (&bgp_vpnv4_node, NULL);
Lou Berger13c378d2016-01-12 13:41:56 -05009972 install_node (&bgp_vpnv6_node, NULL);
Lou Bergera3fda882016-01-12 13:42:04 -05009973 install_node (&bgp_encap_node, NULL);
9974 install_node (&bgp_encapv6_node, NULL);
paul718e3742002-12-13 20:15:29 +00009975
9976 /* Install default VTY commands to new nodes. */
9977 install_default (BGP_NODE);
9978 install_default (BGP_IPV4_NODE);
9979 install_default (BGP_IPV4M_NODE);
9980 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009981 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009982 install_default (BGP_VPNV4_NODE);
Lou Berger13c378d2016-01-12 13:41:56 -05009983 install_default (BGP_VPNV6_NODE);
Lou Bergera3fda882016-01-12 13:42:04 -05009984 install_default (BGP_ENCAP_NODE);
9985 install_default (BGP_ENCAPV6_NODE);
paul718e3742002-12-13 20:15:29 +00009986
9987 /* "bgp multiple-instance" commands. */
9988 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9989 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9990
9991 /* "bgp config-type" commands. */
9992 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9993 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9994
9995 /* Dummy commands (Currently not supported) */
9996 install_element (BGP_NODE, &no_synchronization_cmd);
9997 install_element (BGP_NODE, &no_auto_summary_cmd);
9998
9999 /* "router bgp" commands. */
10000 install_element (CONFIG_NODE, &router_bgp_cmd);
10001 install_element (CONFIG_NODE, &router_bgp_view_cmd);
10002
10003 /* "no router bgp" commands. */
10004 install_element (CONFIG_NODE, &no_router_bgp_cmd);
10005 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
10006
10007 /* "bgp router-id" commands. */
10008 install_element (BGP_NODE, &bgp_router_id_cmd);
10009 install_element (BGP_NODE, &no_bgp_router_id_cmd);
10010 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
10011
10012 /* "bgp cluster-id" commands. */
10013 install_element (BGP_NODE, &bgp_cluster_id_cmd);
10014 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
10015 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
10016 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
10017
10018 /* "bgp confederation" commands. */
10019 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
10020 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
10021 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
10022
10023 /* "bgp confederation peers" commands. */
10024 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
10025 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
10026
Josh Bailey165b5ff2011-07-20 20:43:22 -070010027 /* "maximum-paths" commands. */
10028 install_element (BGP_NODE, &bgp_maxpaths_cmd);
10029 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
10030 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
10031 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
10032 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
10033 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
Ayan Banerjeeb8d1f712015-11-09 20:14:54 -050010034 install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd);
10035 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd);
10036 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd);
Josh Bailey165b5ff2011-07-20 20:43:22 -070010037 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
10038 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
10039 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
10040 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
10041 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
10042 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
Ayan Banerjeeb8d1f712015-11-09 20:14:54 -050010043 install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd);
10044 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd);
10045 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
Josh Bailey165b5ff2011-07-20 20:43:22 -070010046
paul718e3742002-12-13 20:15:29 +000010047 /* "timers bgp" commands. */
10048 install_element (BGP_NODE, &bgp_timers_cmd);
10049 install_element (BGP_NODE, &no_bgp_timers_cmd);
10050 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
10051
10052 /* "bgp client-to-client reflection" commands */
10053 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
10054 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
10055
10056 /* "bgp always-compare-med" commands */
10057 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
10058 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
10059
10060 /* "bgp deterministic-med" commands */
10061 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
10062 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +000010063
hasso538621f2004-05-21 09:31:30 +000010064 /* "bgp graceful-restart" commands */
10065 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
10066 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +000010067 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
10068 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
10069 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
Philippe Guibert4afa3dd2016-05-24 16:52:02 +020010070 install_element (BGP_NODE, &bgp_graceful_restart_restart_time_cmd);
10071 install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_cmd);
10072 install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_val_cmd);
paul718e3742002-12-13 20:15:29 +000010073
10074 /* "bgp fast-external-failover" commands */
10075 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
10076 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
10077
10078 /* "bgp enforce-first-as" commands */
10079 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
10080 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
10081
10082 /* "bgp bestpath compare-routerid" commands */
10083 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
10084 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
10085
10086 /* "bgp bestpath as-path ignore" commands */
10087 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
10088 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
10089
hasso68118452005-04-08 15:40:36 +000010090 /* "bgp bestpath as-path confed" commands */
10091 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
10092 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
10093
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +000010094 /* "bgp bestpath as-path multipath-relax" commands */
10095 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
10096 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
10097
paul848973c2003-08-13 00:32:49 +000010098 /* "bgp log-neighbor-changes" commands */
10099 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
10100 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
10101
paul718e3742002-12-13 20:15:29 +000010102 /* "bgp bestpath med" commands */
10103 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
10104 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
10105 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
10106 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
10107 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
10108 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
10109
10110 /* "no bgp default ipv4-unicast" commands. */
10111 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
10112 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
10113
10114 /* "bgp network import-check" commands. */
10115 install_element (BGP_NODE, &bgp_network_import_check_cmd);
10116 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
10117
10118 /* "bgp default local-preference" commands. */
10119 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
10120 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
10121 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
10122
Dinesh Dutt083e5e22015-11-09 20:21:54 -050010123 /* bgp ibgp-allow-policy-mods command */
10124 install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd);
10125 install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd);
10126
paul718e3742002-12-13 20:15:29 +000010127 /* "neighbor remote-as" commands. */
10128 install_element (BGP_NODE, &neighbor_remote_as_cmd);
10129 install_element (BGP_NODE, &no_neighbor_cmd);
10130 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
10131
10132 /* "neighbor peer-group" commands. */
10133 install_element (BGP_NODE, &neighbor_peer_group_cmd);
10134 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
10135 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
10136
10137 /* "neighbor local-as" commands. */
10138 install_element (BGP_NODE, &neighbor_local_as_cmd);
10139 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +000010140 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +000010141 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
10142 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
10143 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +000010144 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +000010145
Paul Jakma0df7c912008-07-21 21:02:49 +000010146 /* "neighbor password" commands. */
10147 install_element (BGP_NODE, &neighbor_password_cmd);
10148 install_element (BGP_NODE, &no_neighbor_password_cmd);
10149
paul718e3742002-12-13 20:15:29 +000010150 /* "neighbor activate" commands. */
10151 install_element (BGP_NODE, &neighbor_activate_cmd);
10152 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
10153 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
10154 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010155 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010156 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010157 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010158 install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd);
10159 install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010160
10161 /* "no neighbor activate" commands. */
10162 install_element (BGP_NODE, &no_neighbor_activate_cmd);
10163 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
10164 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
10165 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010166 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010167 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010168 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010169 install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd);
10170 install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010171
10172 /* "neighbor peer-group set" commands. */
10173 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
10174 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
10175 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
10176 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010177 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010178 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010179 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010180 install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd);
10181 install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010182
paul718e3742002-12-13 20:15:29 +000010183 /* "no neighbor peer-group unset" commands. */
10184 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
10185 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
10186 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
10187 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010188 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010189 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010190 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010191 install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd);
10192 install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010193
paul718e3742002-12-13 20:15:29 +000010194 /* "neighbor softreconfiguration inbound" commands.*/
10195 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
10196 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10197 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
10198 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
10199 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
10200 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
10201 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10202 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010203 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
10204 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +000010205 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
10206 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010207 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
10208 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010209 install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd);
10210 install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10211 install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10212 install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +000010213
10214 /* "neighbor attribute-unchanged" commands. */
10215 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
10216 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
10217 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
10218 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
10219 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
10220 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
10221 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
10222 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
10223 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
10224 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
10225 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
10226 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
10227 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
10228 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
10229 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
10230 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
10231 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
10232 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
10233 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
10234 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
10235 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
10236 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
10237 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
10238 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
10239 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
10240 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
10241 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
10242 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
10243 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
10244 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
10245 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
10246 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
10247 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
10248 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
10249 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10250 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10251 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10252 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10253 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10254 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10255 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10256 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10257 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10258 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10259 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
10260 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
10261 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
10262 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
10263 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
10264 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
10265 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
10266 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
10267 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
10268 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
10269 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
10270 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
10271 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
10272 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
10273 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
10274 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
10275 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
10276 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
10277 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
10278 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
10279 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
10280 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
10281 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
10282 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
10283 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
10284 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
10285 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
10286 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
10287 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
10288 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
10289 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
10290 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
10291 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
10292 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10293 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10294 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10295 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10296 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10297 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10298 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10299 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10300 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10301 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10302 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010303 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
10304 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
10305 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
10306 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
10307 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
10308 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
10309 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
10310 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
10311 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
10312 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
10313 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
10314 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
10315 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
10316 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
10317 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
10318 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
10319 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
10320 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
10321 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
10322 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
10323 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
10324 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +000010325 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
10326 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
10327 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
10328 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
10329 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
10330 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
10331 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
10332 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
10333 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
10334 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
10335 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
10336 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
10337 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10338 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10339 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10340 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10341 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10342 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10343 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10344 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10345 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10346 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10347
Lou Berger13c378d2016-01-12 13:41:56 -050010348 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
10349 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
10350 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
10351 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
10352 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
10353 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
10354 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
10355 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
10356 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
10357 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
10358 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
10359 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
10360 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10361 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10362 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10363 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10364 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10365 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10366 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10367 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10368 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10369 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10370
Lou Bergera3fda882016-01-12 13:42:04 -050010371 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd);
10372 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd);
10373 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd);
10374 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd);
10375 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd);
10376 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd);
10377 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd);
10378 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd);
10379 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd);
10380 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd);
10381 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd);
10382 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd);
10383 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd);
10384 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd);
10385 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd);
10386 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd);
10387 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd);
10388 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd);
10389 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd);
10390 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd);
10391 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd);
10392 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd);
10393
10394 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd);
10395 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd);
10396 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd);
10397 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd);
10398 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd);
10399 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd);
10400 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd);
10401 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd);
10402 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd);
10403 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd);
10404 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd);
10405 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10406 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10407 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10408 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10409 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10410 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10411 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10412 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10413 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10414 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10415 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10416
paulfee0f4c2004-09-13 05:12:46 +000010417 /* "nexthop-local unchanged" commands */
10418 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
10419 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
10420
paul718e3742002-12-13 20:15:29 +000010421 /* "transparent-as" and "transparent-nexthop" for old version
10422 compatibility. */
10423 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
10424 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
10425
10426 /* "neighbor next-hop-self" commands. */
10427 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
10428 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
10429 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
10430 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
10431 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
10432 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
10433 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
10434 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010435 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
10436 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010437 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
10438 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010439 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
10440 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010441 install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd);
10442 install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd);
10443 install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd);
10444 install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010445
10446 /* "neighbor remove-private-AS" commands. */
10447 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
10448 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
10449 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
10450 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
10451 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
10452 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
10453 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
10454 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010455 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
10456 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010457 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
10458 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010459 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
10460 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010461 install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd);
10462 install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd);
10463 install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd);
10464 install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010465
10466 /* "neighbor send-community" commands.*/
10467 install_element (BGP_NODE, &neighbor_send_community_cmd);
10468 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
10469 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
10470 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
10471 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
10472 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
10473 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
10474 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
10475 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
10476 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
10477 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
10478 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
10479 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
10480 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
10481 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
10482 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010483 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
10484 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
10485 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
10486 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010487 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
10488 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
10489 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
10490 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010491 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
10492 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
10493 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
10494 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010495 install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd);
10496 install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd);
10497 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd);
10498 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd);
10499 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd);
10500 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd);
10501 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd);
10502 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010503
10504 /* "neighbor route-reflector" commands.*/
10505 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
10506 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
10507 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
10508 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
10509 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
10510 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
10511 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
10512 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010513 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
10514 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010515 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
10516 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010517 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
10518 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010519 install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd);
10520 install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd);
10521 install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd);
10522 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010523
10524 /* "neighbor route-server" commands.*/
10525 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
10526 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
10527 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
10528 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
10529 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
10530 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
10531 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
10532 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010533 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
10534 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010535 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
10536 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010537 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
10538 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010539 install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd);
10540 install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd);
10541 install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd);
10542 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010543
10544 /* "neighbor passive" commands. */
10545 install_element (BGP_NODE, &neighbor_passive_cmd);
10546 install_element (BGP_NODE, &no_neighbor_passive_cmd);
10547
10548 /* "neighbor shutdown" commands. */
10549 install_element (BGP_NODE, &neighbor_shutdown_cmd);
10550 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
10551
hassoc9502432005-02-01 22:01:48 +000010552 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +000010553 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
10554 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
10555
10556 /* "neighbor capability orf prefix-list" commands.*/
10557 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
10558 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
10559 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
10560 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
10561 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
10562 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
10563 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
10564 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010565 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
10566 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +000010567
10568 /* "neighbor capability dynamic" commands.*/
10569 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
10570 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
10571
10572 /* "neighbor dont-capability-negotiate" commands. */
10573 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
10574 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
10575
10576 /* "neighbor ebgp-multihop" commands. */
10577 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
10578 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
10579 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
10580 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
10581
hasso6ffd2072005-02-02 14:50:11 +000010582 /* "neighbor disable-connected-check" commands. */
10583 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
10584 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +000010585 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
10586 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
10587
10588 /* "neighbor description" commands. */
10589 install_element (BGP_NODE, &neighbor_description_cmd);
10590 install_element (BGP_NODE, &no_neighbor_description_cmd);
10591 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
10592
10593 /* "neighbor update-source" commands. "*/
10594 install_element (BGP_NODE, &neighbor_update_source_cmd);
10595 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
10596
10597 /* "neighbor default-originate" commands. */
10598 install_element (BGP_NODE, &neighbor_default_originate_cmd);
10599 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
10600 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
10601 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
10602 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
10603 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
10604 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
10605 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
10606 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
10607 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
10608 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
10609 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
10610 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
10611 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
10612 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
10613 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010614 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
10615 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
10616 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
10617 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000010618
10619 /* "neighbor port" commands. */
10620 install_element (BGP_NODE, &neighbor_port_cmd);
10621 install_element (BGP_NODE, &no_neighbor_port_cmd);
10622 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
10623
10624 /* "neighbor weight" commands. */
10625 install_element (BGP_NODE, &neighbor_weight_cmd);
10626 install_element (BGP_NODE, &no_neighbor_weight_cmd);
10627 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
10628
10629 /* "neighbor override-capability" commands. */
10630 install_element (BGP_NODE, &neighbor_override_capability_cmd);
10631 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
10632
10633 /* "neighbor strict-capability-match" commands. */
10634 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
10635 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
10636
10637 /* "neighbor timers" commands. */
10638 install_element (BGP_NODE, &neighbor_timers_cmd);
10639 install_element (BGP_NODE, &no_neighbor_timers_cmd);
10640
10641 /* "neighbor timers connect" commands. */
10642 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
10643 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
10644 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
10645
10646 /* "neighbor advertisement-interval" commands. */
10647 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
10648 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
10649 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
10650
10651 /* "neighbor version" commands. */
10652 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +000010653
10654 /* "neighbor interface" commands. */
10655 install_element (BGP_NODE, &neighbor_interface_cmd);
10656 install_element (BGP_NODE, &no_neighbor_interface_cmd);
10657
10658 /* "neighbor distribute" commands. */
10659 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
10660 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
10661 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
10662 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
10663 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
10664 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
10665 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
10666 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010667 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
10668 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010669 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
10670 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010671 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
10672 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010673 install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd);
10674 install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd);
10675 install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd);
10676 install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010677
10678 /* "neighbor prefix-list" commands. */
10679 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
10680 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
10681 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
10682 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
10683 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
10684 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
10685 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
10686 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010687 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
10688 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010689 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
10690 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010691 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
10692 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010693 install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd);
10694 install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd);
10695 install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd);
10696 install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010697
10698 /* "neighbor filter-list" commands. */
10699 install_element (BGP_NODE, &neighbor_filter_list_cmd);
10700 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
10701 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
10702 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
10703 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
10704 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
10705 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
10706 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010707 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
10708 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010709 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
10710 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010711 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
10712 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010713 install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd);
10714 install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd);
10715 install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd);
10716 install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010717
10718 /* "neighbor route-map" commands. */
10719 install_element (BGP_NODE, &neighbor_route_map_cmd);
10720 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
10721 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
10722 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
10723 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
10724 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
10725 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
10726 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010727 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
10728 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010729 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
10730 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010731 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
10732 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010733 install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd);
10734 install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd);
10735 install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd);
10736 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010737
10738 /* "neighbor unsuppress-map" commands. */
10739 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
10740 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
10741 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
10742 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
10743 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
10744 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
10745 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
10746 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010747 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
10748 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +000010749 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010750 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010751 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010752 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010753 install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd);
10754 install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd);
10755 install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd);
10756 install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +000010757
10758 /* "neighbor maximum-prefix" commands. */
10759 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010760 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010761 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010762 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010763 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
10764 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010765 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
10766 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010767 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10768 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10769 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10770 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10771 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010772 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010773 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010774 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010775 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010776 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10777 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010778 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
10779 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010780 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10781 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10782 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10783 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10784 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010785 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010786 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010787 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010788 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010789 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
10790 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010791 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
10792 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010793 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10794 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10795 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10796 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10797 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010798 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010799 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010800 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010801 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010802 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10803 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010804 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10805 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010806 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10807 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10808 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10809 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10810 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010811 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
10812 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
10813 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
10814 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10815 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
10816 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10817 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
10818 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
10819 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10820 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10821 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10822 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10823 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010824 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010825 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010826 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010827 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010828 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10829 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010830 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
10831 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010832 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10833 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10834 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10835 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10836 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010837
Lou Berger13c378d2016-01-12 13:41:56 -050010838 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
10839 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10840 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10841 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10842 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10843 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10844 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
10845 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10846 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10847 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10848 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10849 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10850 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10851
Lou Bergera3fda882016-01-12 13:42:04 -050010852 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd);
10853 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd);
10854 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd);
10855 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10856 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd);
10857 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10858 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd);
10859 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd);
10860 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10861 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10862 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10863 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10864 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10865
10866 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd);
10867 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10868 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10869 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10870 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10871 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10872 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10873 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10874 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10875 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10876 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10877 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10878 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10879
paul718e3742002-12-13 20:15:29 +000010880 /* "neighbor allowas-in" */
10881 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
10882 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
10883 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
10884 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
10885 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
10886 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
10887 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
10888 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
10889 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
10890 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
10891 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
10892 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010893 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
10894 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
10895 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010896 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
10897 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
10898 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010899 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
10900 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
10901 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010902 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd);
10903 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd);
10904 install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd);
10905 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd);
10906 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd);
10907 install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010908
10909 /* address-family commands. */
10910 install_element (BGP_NODE, &address_family_ipv4_cmd);
10911 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010912 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010913 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010914 install_element (BGP_NODE, &address_family_vpnv4_cmd);
10915 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
10916
Lou Berger13c378d2016-01-12 13:41:56 -050010917 install_element (BGP_NODE, &address_family_vpnv6_cmd);
10918 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
10919
Lou Bergera3fda882016-01-12 13:42:04 -050010920 install_element (BGP_NODE, &address_family_encap_cmd);
10921 install_element (BGP_NODE, &address_family_encapv4_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010922 install_element (BGP_NODE, &address_family_encapv6_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010923
paul718e3742002-12-13 20:15:29 +000010924 /* "exit-address-family" command. */
10925 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
10926 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
10927 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010928 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010929 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010930 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010931 install_element (BGP_ENCAP_NODE, &exit_address_family_cmd);
10932 install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010933
10934 /* "clear ip bgp commands" */
10935 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
10936 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
10937 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
10938 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
10939 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
10940 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
paul718e3742002-12-13 20:15:29 +000010941 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
10942 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
10943 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
10944 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
10945 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
10946 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
10947 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
10948 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
10949 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
10950 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
10951 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
paul718e3742002-12-13 20:15:29 +000010952
10953 /* "clear ip bgp neighbor soft in" */
10954 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
10955 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
10956 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
10957 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
10958 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
10959 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
10960 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
10961 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
10962 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
10963 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
10964 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
10965 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
10966 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
10967 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
10968 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
10969 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
10970 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
10971 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
10972 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
10973 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
10974 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
10975 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
10976 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
10977 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
10978 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
10979 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
10980 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
10981 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
10982 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
10983 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
10984 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
10985 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
10986 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
10987 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
10988 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
10989 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
10990 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
10991 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
10992 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
10993 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010994 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
10995 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
10996 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
10997 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
10998 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
10999 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
paul718e3742002-12-13 20:15:29 +000011000 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
11001 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
11002 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
11003 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
11004 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
11005 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
11006 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
11007 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
11008 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
11009 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
11010 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
11011 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
11012 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
11013 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
11014 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
11015 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
11016 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
11017 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
11018 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
11019 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
11020 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
11021 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
11022 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
11023 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
11024 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
11025 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
11026 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
11027 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
11028 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
11029 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
11030 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
paul718e3742002-12-13 20:15:29 +000011031
Daniel Walton325fcfb2015-05-19 17:58:10 -070011032 /* clear ip bgp prefix */
11033 install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd);
11034 install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd);
11035
paul718e3742002-12-13 20:15:29 +000011036 /* "clear ip bgp neighbor soft out" */
11037 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
11038 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
11039 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
11040 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
11041 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
11042 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
11043 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
11044 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
11045 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
11046 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
11047 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
11048 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
11049 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
11050 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
11051 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
11052 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
11053 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
11054 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
11055 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
11056 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
11057 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
11058 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
11059 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
11060 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
11061 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
11062 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
11063 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
11064 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050011065 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
11066 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
11067 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
11068 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
11069 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
11070 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
paul718e3742002-12-13 20:15:29 +000011071 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
11072 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
11073 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
11074 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
11075 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
11076 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
11077 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
11078 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
11079 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
11080 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
11081 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
11082 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
11083 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
11084 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
11085 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
11086 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
11087 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
11088 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
11089 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
11090 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
11091 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
paul718e3742002-12-13 20:15:29 +000011092
11093 /* "clear ip bgp neighbor soft" */
11094 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
11095 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
11096 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
11097 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
11098 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
11099 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
11100 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
11101 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
11102 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
11103 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
11104 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
11105 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
11106 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
11107 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
11108 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050011109 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
11110 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
11111 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
paul718e3742002-12-13 20:15:29 +000011112 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
11113 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
11114 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
11115 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
11116 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
11117 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
11118 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
11119 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
11120 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
11121 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
11122 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
paul718e3742002-12-13 20:15:29 +000011123
paulfee0f4c2004-09-13 05:12:46 +000011124 /* "clear ip bgp neighbor rsclient" */
11125 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
11126 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
11127 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
11128 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011129 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
11130 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
11131 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
11132 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
11133 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
11134 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
11135 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
11136 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011137
paul718e3742002-12-13 20:15:29 +000011138 /* "show ip bgp summary" commands. */
paul718e3742002-12-13 20:15:29 +000011139 install_element (VIEW_NODE, &show_bgp_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011140 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011141
11142 install_element (VIEW_NODE, &show_bgp_summary_1w_cmd);
11143 install_element (RESTRICTED_NODE, &show_bgp_summary_1w_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011144
11145 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
11146 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
11147 install_element (VIEW_NODE, &show_bgp_instance_ipv4_summary_cmd);
11148
11149 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_summary_cmd);
11150 install_element (VIEW_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011151 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11152 install_element (VIEW_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011153
paul718e3742002-12-13 20:15:29 +000011154 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011155 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011156 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011157 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011158
Michael Lambert95cbbd22010-07-23 14:43:04 -040011159 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011160 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011161 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011162
11163 install_element (RESTRICTED_NODE, &show_bgp_ipv4_vpn_summary_cmd);
11164 install_element (RESTRICTED_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011165 install_element (RESTRICTED_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11166 install_element (RESTRICTED_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011167
Paul Jakma62687ff2008-08-23 14:27:06 +010011168 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011169 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011170 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011171 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011172
11173 /* "show ip bgp neighbors" commands. */
paulbb46e942003-10-24 19:02:03 +000011174 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011175
11176 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
11177 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
11178 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
11179 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
11180 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011181 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
11182 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
11183 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000011184
paulfee0f4c2004-09-13 05:12:46 +000011185 /* "show ip bgp rsclient" commands. */
Michael Lambert95cbbd22010-07-23 14:43:04 -040011186 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11187 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011188 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11189 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011190
paulfee0f4c2004-09-13 05:12:46 +000011191 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011192 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011193 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
11194 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011195
Lou Berger651b4022016-01-12 13:42:07 -050011196 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011197 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011198 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11199 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011200 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011201 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011202 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11203 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011204
paul718e3742002-12-13 20:15:29 +000011205 /* "show ip bgp paths" commands. */
Lou Berger651b4022016-01-12 13:42:07 -050011206 install_element (VIEW_NODE, &show_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011207
11208 /* "show ip bgp community" commands. */
11209 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
paul718e3742002-12-13 20:15:29 +000011210
11211 /* "show ip bgp attribute-info" commands. */
11212 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
paul718e3742002-12-13 20:15:29 +000011213
11214 /* "redistribute" commands. */
11215 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
11216 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
11217 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
11218 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
11219 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
11220 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
11221 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
11222 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
11223 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
11224 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000011225 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
11226 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
11227 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
11228 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
11229 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
11230 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
11231 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
11232 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
11233 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
11234 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000011235
Nick Hilliardfa411a22011-03-23 15:33:17 +000011236 /* ttl_security commands */
11237 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
11238 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
11239
Paul Jakma4bf6a362006-03-30 14:05:23 +000011240 /* "show bgp memory" commands. */
11241 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011242 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000011243
Michael Lamberte0081f72008-11-16 20:12:04 +000011244 /* "show bgp views" commands. */
11245 install_element (VIEW_NODE, &show_bgp_views_cmd);
11246 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011247
Lou Bergerf9b6c392016-01-12 13:42:09 -050011248 /* non afi/safi forms of commands */
11249 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
11250 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
11251 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
11252 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11253 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11254 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11255 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
11256 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
11257 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
11258 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
11259 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11260 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11261 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11262 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011263 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
11264 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
11265 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
11266 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11267 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
11268 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
11269 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11270 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11271 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
11272 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
11273 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
11274 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11275 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11276 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11277 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011278 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
11279 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
11280 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011281 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
11282 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011283 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
11284 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11285 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11286 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11287 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
11288 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11289 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11290 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011291 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
11292 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011293 /* Community-list. */
11294 community_list_vty ();
11295}
David Lamparter6b0655a2014-06-04 06:53:35 +020011296
paul718e3742002-12-13 20:15:29 +000011297#include "memory.h"
11298#include "bgp_regex.h"
11299#include "bgp_clist.h"
11300#include "bgp_ecommunity.h"
11301
11302/* VTY functions. */
11303
11304/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000011305static const char *
paul718e3742002-12-13 20:15:29 +000011306community_direct_str (int direct)
11307{
11308 switch (direct)
11309 {
11310 case COMMUNITY_DENY:
11311 return "deny";
paul718e3742002-12-13 20:15:29 +000011312 case COMMUNITY_PERMIT:
11313 return "permit";
paul718e3742002-12-13 20:15:29 +000011314 default:
11315 return "unknown";
paul718e3742002-12-13 20:15:29 +000011316 }
11317}
11318
11319/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000011320static void
paul718e3742002-12-13 20:15:29 +000011321community_list_perror (struct vty *vty, int ret)
11322{
11323 switch (ret)
11324 {
11325 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030011326 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011327 break;
11328 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
11329 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
11330 break;
11331 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
11332 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
11333 break;
11334 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
11335 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
11336 break;
11337 }
11338}
11339
11340/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000011341static int
paulfd79ac92004-10-13 05:06:08 +000011342community_list_set_vty (struct vty *vty, int argc, const char **argv,
11343 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011344{
11345 int ret;
11346 int direct;
11347 char *str;
11348
11349 /* Check the list type. */
11350 if (strncmp (argv[1], "p", 1) == 0)
11351 direct = COMMUNITY_PERMIT;
11352 else if (strncmp (argv[1], "d", 1) == 0)
11353 direct = COMMUNITY_DENY;
11354 else
11355 {
11356 vty_out (vty, "%% Matching condition must be permit or deny%s",
11357 VTY_NEWLINE);
11358 return CMD_WARNING;
11359 }
11360
11361 /* All digit name check. */
11362 if (reject_all_digit_name && all_digit (argv[0]))
11363 {
11364 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11365 return CMD_WARNING;
11366 }
11367
11368 /* Concat community string argument. */
11369 if (argc > 1)
11370 str = argv_concat (argv, argc, 2);
11371 else
11372 str = NULL;
11373
11374 /* When community_list_set() return nevetive value, it means
11375 malformed community string. */
11376 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
11377
11378 /* Free temporary community list string allocated by
11379 argv_concat(). */
11380 if (str)
11381 XFREE (MTYPE_TMP, str);
11382
11383 if (ret < 0)
11384 {
11385 /* Display error string. */
11386 community_list_perror (vty, ret);
11387 return CMD_WARNING;
11388 }
11389
11390 return CMD_SUCCESS;
11391}
11392
paul718e3742002-12-13 20:15:29 +000011393/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000011394static int
hassofee6e4e2005-02-02 16:29:31 +000011395community_list_unset_vty (struct vty *vty, int argc, const char **argv,
11396 int style)
paul718e3742002-12-13 20:15:29 +000011397{
11398 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011399 int direct = 0;
11400 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011401
hassofee6e4e2005-02-02 16:29:31 +000011402 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011403 {
hassofee6e4e2005-02-02 16:29:31 +000011404 /* Check the list direct. */
11405 if (strncmp (argv[1], "p", 1) == 0)
11406 direct = COMMUNITY_PERMIT;
11407 else if (strncmp (argv[1], "d", 1) == 0)
11408 direct = COMMUNITY_DENY;
11409 else
11410 {
11411 vty_out (vty, "%% Matching condition must be permit or deny%s",
11412 VTY_NEWLINE);
11413 return CMD_WARNING;
11414 }
paul718e3742002-12-13 20:15:29 +000011415
hassofee6e4e2005-02-02 16:29:31 +000011416 /* Concat community string argument. */
11417 str = argv_concat (argv, argc, 2);
11418 }
paul718e3742002-12-13 20:15:29 +000011419
11420 /* Unset community list. */
11421 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
11422
11423 /* Free temporary community list string allocated by
11424 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011425 if (str)
11426 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011427
11428 if (ret < 0)
11429 {
11430 community_list_perror (vty, ret);
11431 return CMD_WARNING;
11432 }
11433
11434 return CMD_SUCCESS;
11435}
11436
11437/* "community-list" keyword help string. */
11438#define COMMUNITY_LIST_STR "Add a community list entry\n"
11439#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
11440
paul718e3742002-12-13 20:15:29 +000011441DEFUN (ip_community_list_standard,
11442 ip_community_list_standard_cmd,
11443 "ip community-list <1-99> (deny|permit) .AA:NN",
11444 IP_STR
11445 COMMUNITY_LIST_STR
11446 "Community list number (standard)\n"
11447 "Specify community to reject\n"
11448 "Specify community to accept\n"
11449 COMMUNITY_VAL_STR)
11450{
11451 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
11452}
11453
11454ALIAS (ip_community_list_standard,
11455 ip_community_list_standard2_cmd,
11456 "ip community-list <1-99> (deny|permit)",
11457 IP_STR
11458 COMMUNITY_LIST_STR
11459 "Community list number (standard)\n"
11460 "Specify community to reject\n"
11461 "Specify community to accept\n")
11462
11463DEFUN (ip_community_list_expanded,
11464 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011465 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011466 IP_STR
11467 COMMUNITY_LIST_STR
11468 "Community list number (expanded)\n"
11469 "Specify community to reject\n"
11470 "Specify community to accept\n"
11471 "An ordered list as a regular-expression\n")
11472{
11473 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
11474}
11475
11476DEFUN (ip_community_list_name_standard,
11477 ip_community_list_name_standard_cmd,
11478 "ip community-list standard WORD (deny|permit) .AA:NN",
11479 IP_STR
11480 COMMUNITY_LIST_STR
11481 "Add a standard community-list entry\n"
11482 "Community list name\n"
11483 "Specify community to reject\n"
11484 "Specify community to accept\n"
11485 COMMUNITY_VAL_STR)
11486{
11487 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
11488}
11489
11490ALIAS (ip_community_list_name_standard,
11491 ip_community_list_name_standard2_cmd,
11492 "ip community-list standard WORD (deny|permit)",
11493 IP_STR
11494 COMMUNITY_LIST_STR
11495 "Add a standard community-list entry\n"
11496 "Community list name\n"
11497 "Specify community to reject\n"
11498 "Specify community to accept\n")
11499
11500DEFUN (ip_community_list_name_expanded,
11501 ip_community_list_name_expanded_cmd,
11502 "ip community-list expanded WORD (deny|permit) .LINE",
11503 IP_STR
11504 COMMUNITY_LIST_STR
11505 "Add an expanded community-list entry\n"
11506 "Community list name\n"
11507 "Specify community to reject\n"
11508 "Specify community to accept\n"
11509 "An ordered list as a regular-expression\n")
11510{
11511 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
11512}
11513
hassofee6e4e2005-02-02 16:29:31 +000011514DEFUN (no_ip_community_list_standard_all,
11515 no_ip_community_list_standard_all_cmd,
11516 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011517 NO_STR
11518 IP_STR
11519 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011520 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011521{
hassofee6e4e2005-02-02 16:29:31 +000011522 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011523}
11524
hassofee6e4e2005-02-02 16:29:31 +000011525DEFUN (no_ip_community_list_expanded_all,
11526 no_ip_community_list_expanded_all_cmd,
11527 "no ip community-list <100-500>",
11528 NO_STR
11529 IP_STR
11530 COMMUNITY_LIST_STR
11531 "Community list number (expanded)\n")
11532{
11533 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11534}
11535
11536DEFUN (no_ip_community_list_name_standard_all,
11537 no_ip_community_list_name_standard_all_cmd,
11538 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011539 NO_STR
11540 IP_STR
11541 COMMUNITY_LIST_STR
11542 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000011543 "Community list name\n")
11544{
hassofee6e4e2005-02-02 16:29:31 +000011545 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011546}
11547
hassofee6e4e2005-02-02 16:29:31 +000011548DEFUN (no_ip_community_list_name_expanded_all,
11549 no_ip_community_list_name_expanded_all_cmd,
11550 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000011551 NO_STR
11552 IP_STR
11553 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011554 "Add an expanded community-list entry\n"
11555 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000011556{
hassofee6e4e2005-02-02 16:29:31 +000011557 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011558}
11559
11560DEFUN (no_ip_community_list_standard,
11561 no_ip_community_list_standard_cmd,
11562 "no ip community-list <1-99> (deny|permit) .AA:NN",
11563 NO_STR
11564 IP_STR
11565 COMMUNITY_LIST_STR
11566 "Community list number (standard)\n"
11567 "Specify community to reject\n"
11568 "Specify community to accept\n"
11569 COMMUNITY_VAL_STR)
11570{
11571 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11572}
11573
11574DEFUN (no_ip_community_list_expanded,
11575 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011576 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011577 NO_STR
11578 IP_STR
11579 COMMUNITY_LIST_STR
11580 "Community list number (expanded)\n"
11581 "Specify community to reject\n"
11582 "Specify community to accept\n"
11583 "An ordered list as a regular-expression\n")
11584{
11585 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11586}
11587
11588DEFUN (no_ip_community_list_name_standard,
11589 no_ip_community_list_name_standard_cmd,
11590 "no ip community-list standard WORD (deny|permit) .AA:NN",
11591 NO_STR
11592 IP_STR
11593 COMMUNITY_LIST_STR
11594 "Specify a standard community-list\n"
11595 "Community list name\n"
11596 "Specify community to reject\n"
11597 "Specify community to accept\n"
11598 COMMUNITY_VAL_STR)
11599{
11600 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11601}
11602
11603DEFUN (no_ip_community_list_name_expanded,
11604 no_ip_community_list_name_expanded_cmd,
11605 "no ip community-list expanded WORD (deny|permit) .LINE",
11606 NO_STR
11607 IP_STR
11608 COMMUNITY_LIST_STR
11609 "Specify an expanded community-list\n"
11610 "Community list name\n"
11611 "Specify community to reject\n"
11612 "Specify community to accept\n"
11613 "An ordered list as a regular-expression\n")
11614{
11615 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11616}
11617
paul94f2b392005-06-28 12:44:16 +000011618static void
paul718e3742002-12-13 20:15:29 +000011619community_list_show (struct vty *vty, struct community_list *list)
11620{
11621 struct community_entry *entry;
11622
11623 for (entry = list->head; entry; entry = entry->next)
11624 {
11625 if (entry == list->head)
11626 {
11627 if (all_digit (list->name))
11628 vty_out (vty, "Community %s list %s%s",
11629 entry->style == COMMUNITY_LIST_STANDARD ?
11630 "standard" : "(expanded) access",
11631 list->name, VTY_NEWLINE);
11632 else
11633 vty_out (vty, "Named Community %s list %s%s",
11634 entry->style == COMMUNITY_LIST_STANDARD ?
11635 "standard" : "expanded",
11636 list->name, VTY_NEWLINE);
11637 }
11638 if (entry->any)
11639 vty_out (vty, " %s%s",
11640 community_direct_str (entry->direct), VTY_NEWLINE);
11641 else
11642 vty_out (vty, " %s %s%s",
11643 community_direct_str (entry->direct),
11644 entry->style == COMMUNITY_LIST_STANDARD
11645 ? community_str (entry->u.com) : entry->config,
11646 VTY_NEWLINE);
11647 }
11648}
11649
11650DEFUN (show_ip_community_list,
11651 show_ip_community_list_cmd,
11652 "show ip community-list",
11653 SHOW_STR
11654 IP_STR
11655 "List community-list\n")
11656{
11657 struct community_list *list;
11658 struct community_list_master *cm;
11659
hassofee6e4e2005-02-02 16:29:31 +000011660 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011661 if (! cm)
11662 return CMD_SUCCESS;
11663
11664 for (list = cm->num.head; list; list = list->next)
11665 community_list_show (vty, list);
11666
11667 for (list = cm->str.head; list; list = list->next)
11668 community_list_show (vty, list);
11669
11670 return CMD_SUCCESS;
11671}
11672
11673DEFUN (show_ip_community_list_arg,
11674 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011675 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011676 SHOW_STR
11677 IP_STR
11678 "List community-list\n"
11679 "Community-list number\n"
11680 "Community-list name\n")
11681{
11682 struct community_list *list;
11683
hassofee6e4e2005-02-02 16:29:31 +000011684 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011685 if (! list)
11686 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011687 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011688 return CMD_WARNING;
11689 }
11690
11691 community_list_show (vty, list);
11692
11693 return CMD_SUCCESS;
11694}
David Lamparter6b0655a2014-06-04 06:53:35 +020011695
paul94f2b392005-06-28 12:44:16 +000011696static int
paulfd79ac92004-10-13 05:06:08 +000011697extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
11698 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011699{
11700 int ret;
11701 int direct;
11702 char *str;
11703
11704 /* Check the list type. */
11705 if (strncmp (argv[1], "p", 1) == 0)
11706 direct = COMMUNITY_PERMIT;
11707 else if (strncmp (argv[1], "d", 1) == 0)
11708 direct = COMMUNITY_DENY;
11709 else
11710 {
11711 vty_out (vty, "%% Matching condition must be permit or deny%s",
11712 VTY_NEWLINE);
11713 return CMD_WARNING;
11714 }
11715
11716 /* All digit name check. */
11717 if (reject_all_digit_name && all_digit (argv[0]))
11718 {
11719 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11720 return CMD_WARNING;
11721 }
11722
11723 /* Concat community string argument. */
11724 if (argc > 1)
11725 str = argv_concat (argv, argc, 2);
11726 else
11727 str = NULL;
11728
11729 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
11730
11731 /* Free temporary community list string allocated by
11732 argv_concat(). */
11733 if (str)
11734 XFREE (MTYPE_TMP, str);
11735
11736 if (ret < 0)
11737 {
11738 community_list_perror (vty, ret);
11739 return CMD_WARNING;
11740 }
11741 return CMD_SUCCESS;
11742}
11743
paul94f2b392005-06-28 12:44:16 +000011744static int
hassofee6e4e2005-02-02 16:29:31 +000011745extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
11746 int style)
paul718e3742002-12-13 20:15:29 +000011747{
11748 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011749 int direct = 0;
11750 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011751
hassofee6e4e2005-02-02 16:29:31 +000011752 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011753 {
hassofee6e4e2005-02-02 16:29:31 +000011754 /* Check the list direct. */
11755 if (strncmp (argv[1], "p", 1) == 0)
11756 direct = COMMUNITY_PERMIT;
11757 else if (strncmp (argv[1], "d", 1) == 0)
11758 direct = COMMUNITY_DENY;
11759 else
11760 {
11761 vty_out (vty, "%% Matching condition must be permit or deny%s",
11762 VTY_NEWLINE);
11763 return CMD_WARNING;
11764 }
11765
11766 /* Concat community string argument. */
11767 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000011768 }
paul718e3742002-12-13 20:15:29 +000011769
11770 /* Unset community list. */
11771 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
11772
11773 /* Free temporary community list string allocated by
11774 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011775 if (str)
11776 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011777
11778 if (ret < 0)
11779 {
11780 community_list_perror (vty, ret);
11781 return CMD_WARNING;
11782 }
11783
11784 return CMD_SUCCESS;
11785}
11786
11787/* "extcommunity-list" keyword help string. */
11788#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
11789#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
11790
11791DEFUN (ip_extcommunity_list_standard,
11792 ip_extcommunity_list_standard_cmd,
11793 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11794 IP_STR
11795 EXTCOMMUNITY_LIST_STR
11796 "Extended Community list number (standard)\n"
11797 "Specify community to reject\n"
11798 "Specify community to accept\n"
11799 EXTCOMMUNITY_VAL_STR)
11800{
11801 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
11802}
11803
11804ALIAS (ip_extcommunity_list_standard,
11805 ip_extcommunity_list_standard2_cmd,
11806 "ip extcommunity-list <1-99> (deny|permit)",
11807 IP_STR
11808 EXTCOMMUNITY_LIST_STR
11809 "Extended Community list number (standard)\n"
11810 "Specify community to reject\n"
11811 "Specify community to accept\n")
11812
11813DEFUN (ip_extcommunity_list_expanded,
11814 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011815 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011816 IP_STR
11817 EXTCOMMUNITY_LIST_STR
11818 "Extended Community list number (expanded)\n"
11819 "Specify community to reject\n"
11820 "Specify community to accept\n"
11821 "An ordered list as a regular-expression\n")
11822{
11823 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
11824}
11825
11826DEFUN (ip_extcommunity_list_name_standard,
11827 ip_extcommunity_list_name_standard_cmd,
11828 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11829 IP_STR
11830 EXTCOMMUNITY_LIST_STR
11831 "Specify standard extcommunity-list\n"
11832 "Extended Community list name\n"
11833 "Specify community to reject\n"
11834 "Specify community to accept\n"
11835 EXTCOMMUNITY_VAL_STR)
11836{
11837 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
11838}
11839
11840ALIAS (ip_extcommunity_list_name_standard,
11841 ip_extcommunity_list_name_standard2_cmd,
11842 "ip extcommunity-list standard WORD (deny|permit)",
11843 IP_STR
11844 EXTCOMMUNITY_LIST_STR
11845 "Specify standard extcommunity-list\n"
11846 "Extended Community list name\n"
11847 "Specify community to reject\n"
11848 "Specify community to accept\n")
11849
11850DEFUN (ip_extcommunity_list_name_expanded,
11851 ip_extcommunity_list_name_expanded_cmd,
11852 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
11853 IP_STR
11854 EXTCOMMUNITY_LIST_STR
11855 "Specify expanded extcommunity-list\n"
11856 "Extended Community list name\n"
11857 "Specify community to reject\n"
11858 "Specify community to accept\n"
11859 "An ordered list as a regular-expression\n")
11860{
11861 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
11862}
11863
hassofee6e4e2005-02-02 16:29:31 +000011864DEFUN (no_ip_extcommunity_list_standard_all,
11865 no_ip_extcommunity_list_standard_all_cmd,
11866 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011867 NO_STR
11868 IP_STR
11869 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011870 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011871{
hassofee6e4e2005-02-02 16:29:31 +000011872 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011873}
11874
hassofee6e4e2005-02-02 16:29:31 +000011875DEFUN (no_ip_extcommunity_list_expanded_all,
11876 no_ip_extcommunity_list_expanded_all_cmd,
11877 "no ip extcommunity-list <100-500>",
11878 NO_STR
11879 IP_STR
11880 EXTCOMMUNITY_LIST_STR
11881 "Extended Community list number (expanded)\n")
11882{
11883 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11884}
11885
11886DEFUN (no_ip_extcommunity_list_name_standard_all,
11887 no_ip_extcommunity_list_name_standard_all_cmd,
11888 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011889 NO_STR
11890 IP_STR
11891 EXTCOMMUNITY_LIST_STR
11892 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000011893 "Extended Community list name\n")
11894{
11895 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11896}
11897
11898DEFUN (no_ip_extcommunity_list_name_expanded_all,
11899 no_ip_extcommunity_list_name_expanded_all_cmd,
11900 "no ip extcommunity-list expanded WORD",
11901 NO_STR
11902 IP_STR
11903 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000011904 "Specify expanded extcommunity-list\n"
11905 "Extended Community list name\n")
11906{
hassofee6e4e2005-02-02 16:29:31 +000011907 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011908}
11909
11910DEFUN (no_ip_extcommunity_list_standard,
11911 no_ip_extcommunity_list_standard_cmd,
11912 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11913 NO_STR
11914 IP_STR
11915 EXTCOMMUNITY_LIST_STR
11916 "Extended Community list number (standard)\n"
11917 "Specify community to reject\n"
11918 "Specify community to accept\n"
11919 EXTCOMMUNITY_VAL_STR)
11920{
11921 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11922}
11923
11924DEFUN (no_ip_extcommunity_list_expanded,
11925 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011926 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011927 NO_STR
11928 IP_STR
11929 EXTCOMMUNITY_LIST_STR
11930 "Extended Community list number (expanded)\n"
11931 "Specify community to reject\n"
11932 "Specify community to accept\n"
11933 "An ordered list as a regular-expression\n")
11934{
11935 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11936}
11937
11938DEFUN (no_ip_extcommunity_list_name_standard,
11939 no_ip_extcommunity_list_name_standard_cmd,
11940 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11941 NO_STR
11942 IP_STR
11943 EXTCOMMUNITY_LIST_STR
11944 "Specify standard extcommunity-list\n"
11945 "Extended Community list name\n"
11946 "Specify community to reject\n"
11947 "Specify community to accept\n"
11948 EXTCOMMUNITY_VAL_STR)
11949{
11950 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11951}
11952
11953DEFUN (no_ip_extcommunity_list_name_expanded,
11954 no_ip_extcommunity_list_name_expanded_cmd,
11955 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
11956 NO_STR
11957 IP_STR
11958 EXTCOMMUNITY_LIST_STR
11959 "Specify expanded extcommunity-list\n"
11960 "Community list name\n"
11961 "Specify community to reject\n"
11962 "Specify community to accept\n"
11963 "An ordered list as a regular-expression\n")
11964{
11965 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11966}
11967
paul94f2b392005-06-28 12:44:16 +000011968static void
paul718e3742002-12-13 20:15:29 +000011969extcommunity_list_show (struct vty *vty, struct community_list *list)
11970{
11971 struct community_entry *entry;
11972
11973 for (entry = list->head; entry; entry = entry->next)
11974 {
11975 if (entry == list->head)
11976 {
11977 if (all_digit (list->name))
11978 vty_out (vty, "Extended community %s list %s%s",
11979 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11980 "standard" : "(expanded) access",
11981 list->name, VTY_NEWLINE);
11982 else
11983 vty_out (vty, "Named extended community %s list %s%s",
11984 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11985 "standard" : "expanded",
11986 list->name, VTY_NEWLINE);
11987 }
11988 if (entry->any)
11989 vty_out (vty, " %s%s",
11990 community_direct_str (entry->direct), VTY_NEWLINE);
11991 else
11992 vty_out (vty, " %s %s%s",
11993 community_direct_str (entry->direct),
11994 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11995 entry->u.ecom->str : entry->config,
11996 VTY_NEWLINE);
11997 }
11998}
11999
12000DEFUN (show_ip_extcommunity_list,
12001 show_ip_extcommunity_list_cmd,
12002 "show ip extcommunity-list",
12003 SHOW_STR
12004 IP_STR
12005 "List extended-community list\n")
12006{
12007 struct community_list *list;
12008 struct community_list_master *cm;
12009
hassofee6e4e2005-02-02 16:29:31 +000012010 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000012011 if (! cm)
12012 return CMD_SUCCESS;
12013
12014 for (list = cm->num.head; list; list = list->next)
12015 extcommunity_list_show (vty, list);
12016
12017 for (list = cm->str.head; list; list = list->next)
12018 extcommunity_list_show (vty, list);
12019
12020 return CMD_SUCCESS;
12021}
12022
12023DEFUN (show_ip_extcommunity_list_arg,
12024 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000012025 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000012026 SHOW_STR
12027 IP_STR
12028 "List extended-community list\n"
12029 "Extcommunity-list number\n"
12030 "Extcommunity-list name\n")
12031{
12032 struct community_list *list;
12033
hassofee6e4e2005-02-02 16:29:31 +000012034 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000012035 if (! list)
12036 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030012037 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000012038 return CMD_WARNING;
12039 }
12040
12041 extcommunity_list_show (vty, list);
12042
12043 return CMD_SUCCESS;
12044}
David Lamparter6b0655a2014-06-04 06:53:35 +020012045
paul718e3742002-12-13 20:15:29 +000012046/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000012047static const char *
paul718e3742002-12-13 20:15:29 +000012048community_list_config_str (struct community_entry *entry)
12049{
paulfd79ac92004-10-13 05:06:08 +000012050 const char *str;
paul718e3742002-12-13 20:15:29 +000012051
12052 if (entry->any)
12053 str = "";
12054 else
12055 {
12056 if (entry->style == COMMUNITY_LIST_STANDARD)
12057 str = community_str (entry->u.com);
12058 else
12059 str = entry->config;
12060 }
12061 return str;
12062}
12063
12064/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000012065static int
paul718e3742002-12-13 20:15:29 +000012066community_list_config_write (struct vty *vty)
12067{
12068 struct community_list *list;
12069 struct community_entry *entry;
12070 struct community_list_master *cm;
12071 int write = 0;
12072
12073 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000012074 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000012075
12076 for (list = cm->num.head; list; list = list->next)
12077 for (entry = list->head; entry; entry = entry->next)
12078 {
hassofee6e4e2005-02-02 16:29:31 +000012079 vty_out (vty, "ip community-list %s %s %s%s",
12080 list->name, community_direct_str (entry->direct),
12081 community_list_config_str (entry),
12082 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000012083 write++;
12084 }
12085 for (list = cm->str.head; list; list = list->next)
12086 for (entry = list->head; entry; entry = entry->next)
12087 {
12088 vty_out (vty, "ip community-list %s %s %s %s%s",
12089 entry->style == COMMUNITY_LIST_STANDARD
12090 ? "standard" : "expanded",
12091 list->name, community_direct_str (entry->direct),
12092 community_list_config_str (entry),
12093 VTY_NEWLINE);
12094 write++;
12095 }
12096
12097 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000012098 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000012099
12100 for (list = cm->num.head; list; list = list->next)
12101 for (entry = list->head; entry; entry = entry->next)
12102 {
hassofee6e4e2005-02-02 16:29:31 +000012103 vty_out (vty, "ip extcommunity-list %s %s %s%s",
12104 list->name, community_direct_str (entry->direct),
12105 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000012106 write++;
12107 }
12108 for (list = cm->str.head; list; list = list->next)
12109 for (entry = list->head; entry; entry = entry->next)
12110 {
12111 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
12112 entry->style == EXTCOMMUNITY_LIST_STANDARD
12113 ? "standard" : "expanded",
12114 list->name, community_direct_str (entry->direct),
12115 community_list_config_str (entry), VTY_NEWLINE);
12116 write++;
12117 }
12118 return write;
12119}
12120
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080012121static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000012122{
12123 COMMUNITY_LIST_NODE,
12124 "",
12125 1 /* Export to vtysh. */
12126};
12127
paul94f2b392005-06-28 12:44:16 +000012128static void
12129community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000012130{
12131 install_node (&community_list_node, community_list_config_write);
12132
12133 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000012134 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
12135 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
12136 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
12137 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
12138 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
12139 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012140 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
12141 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
12142 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
12143 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012144 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
12145 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
12146 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
12147 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
12148 install_element (VIEW_NODE, &show_ip_community_list_cmd);
12149 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
paul718e3742002-12-13 20:15:29 +000012150
12151 /* Extcommunity-list. */
12152 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
12153 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
12154 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
12155 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
12156 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
12157 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012158 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
12159 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
12160 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
12161 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012162 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
12163 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
12164 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
12165 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
12166 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
12167 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
paul718e3742002-12-13 20:15:29 +000012168}